/*
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 { ScatterBase } from "./ScatterBase";
import { IScaleLegendSeries_$type } from "igniteui-angular-core";
import { ISupportsSizeScale_$type } from "./ISupportsSizeScale";
import { ISupportsFillScale_$type } from "./ISupportsFillScale";
import { Base, typeCast, Point_$type, fromEnum, markType, markDep, enumGetBox, runOn } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { UIElement } from "igniteui-angular-core";
import { ActualRange } from "./ActualRange";
import { DependencyProperty } from "igniteui-angular-core";
import { SizeScale } from "./SizeScale";
import { BrushScale } from "./BrushScale";
import { ScatterFrame } from "./ScatterFrame";
import { IChartLegend_$type } from "igniteui-angular-core";
import { ValueBrushScale } from "./ValueBrushScale";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { ScatterBaseView } from "./ScatterBaseView";
import { ScalerParams } from "./ScalerParams";
import { Dictionary$2 } from "igniteui-angular-core";
import { OwnedPoint } from "./OwnedPoint";
import { BubbleMarkerManager } from "./BubbleMarkerManager";
import { IChartItemLegend_$type } from "igniteui-angular-core";
import { IChartScaleLegend_$type } from "igniteui-angular-core";
import { ContentControl } from "igniteui-angular-core";
import { DataContext } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { BrushUtil } from "igniteui-angular-core";
import { ChartSelection } from "./ChartSelection";
import { FastItemsSource } from "igniteui-angular-core";
import { FastItemColumn } from "igniteui-angular-core";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_, isInfinity, logBase } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
import { BrushSelectionMode_$type } from "./BrushSelectionMode";
import { ScatterTrendLineManager } from "./ScatterTrendLineManager";
import { Defaults } from "./Defaults";
/**
 * @hidden
 */
var BubbleSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(BubbleSeries, _super);
    function BubbleSeries() {
        var _this = _super.call(this) || this;
        _this.aef = null;
        _this.aee = null;
        _this.ac2 = null;
        _this.act = null;
        _this.acs = null;
        _this.acr = null;
        _this.acp = null;
        _this.ab = BubbleSeries.$;
        _this.y0 = new ScatterFrame();
        _this.y2 = new ScatterFrame();
        _this.yy = new ScatterFrame();
        return _this;
    }
    BubbleSeries.prototype.bj = function () {
        return new BubbleSeries();
    };
    BubbleSeries.prototype.get_ei = function () {
        return true;
    };
    BubbleSeries.prototype.cs = function () {
        return new BubbleSeriesView(this);
    };
    BubbleSeries.prototype.qz = function (a) {
        _super.prototype.qz.call(this, a);
        this.aco = a;
    };
    BubbleSeries.prototype.jl = function () {
        return 0.7;
    };
    BubbleSeries.prototype.wz = function () {
        if (this.wy == 0) {
            return 2;
        }
        return _super.prototype.wz.call(this);
    };
    BubbleSeries.prototype.isAttachedTo = function (a) {
        return this.a5 == a;
    };
    BubbleSeries.prototype.eh = function () {
        return true;
    };
    BubbleSeries.prototype.p0 = function (a) {
        _super.prototype.p0.call(this, a);
        if (this.acx != null && this.ac2 != null && this.ac2.count > 0) {
            for (var b = 0; b < this.ac2.count; b++) {
                a(this.ac2._inner[b]);
            }
        }
    };
    Object.defineProperty(BubbleSeries.prototype, "acw", {
        get: function () {
            return this.acy;
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.prototype.get_isColoredItemwise = function () {
        return this.acu != null && this.acu.count > 0;
    };
    BubbleSeries.prototype.aed = function (a) {
        var b = typeCast(CustomPaletteBrushScale.$, this.acn);
        var c = typeCast(ValueBrushScale.$, this.acn);
        var d = this.acn;
        if (b != null && this.dn != null) {
            return b.getBrush1(a, this.dn.count);
        }
        else if (c != null) {
            return c.getBrushByIndex(a, this.acu);
        }
        else if (d != null) {
            return d.getBrush(a);
        }
        return null;
    };
    Object.defineProperty(BubbleSeries.prototype, "legendReady", {
        get: function () {
            return this.acy != null && this.acy.count != 0;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "minScaleText", {
        get: function () {
            var a = this.acm(this.acq).b;
            return (Math.round(a * 1000) / 1000).toString();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "maxScaleText", {
        get: function () {
            var a = this.acm(this.acq).a;
            return (Math.round(a * 1000) / 1000).toString();
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.prototype.forScaleColors = function (a) {
        for (var b = 0; b < this.acy.count; b++) {
            if (this.acn == null || !this.acn.isReady) {
                return false;
            }
            var c = NaN;
            if (this.acu != null) {
                c = (this.acu.item(b) - this.acu.minimum) / (this.acu.maximum - this.acu.minimum);
            }
            var d = (this.acy.item(b) - this.acy.minimum) / (this.acy.maximum - this.acy.minimum);
            if (isNaN_(c)) {
                c = 0;
            }
            if (isNaN_(d)) {
                d = c;
            }
            var e = this.yf;
            var f = this.aed(b);
            var g = f != null ? f : e;
            a(g, d);
        }
        return true;
    };
    BubbleSeries.prototype.kq = function (a, b) {
        var c = this.nd(b);
        if (c == BubbleSeries.$$p[5]) {
            return this.kr(a, b, this.adh);
        }
        if (c == BubbleSeries.$$p[11]) {
            return this.kr(a, b, this.adr);
        }
        if (c == ScatterBase.$$p[12]) {
            return this.kr(a, b, this.aar);
        }
        if (c == ScatterBase.$$p[16]) {
            return this.kr(a, b, this.aaz);
        }
        if (c == BubbleSeries.$$p[2]) {
            return this.kr(a, b, this.adc);
        }
        return _super.prototype.kq.call(this, a, b);
    };
    BubbleSeries.prototype.md = function (a) {
        var b = this.nd(a);
        if (b == BubbleSeries.$$p[5]) {
            return this.adh;
        }
        if (b == BubbleSeries.$$p[11]) {
            return this.adr;
        }
        if (b == ScatterBase.$$p[12]) {
            return this.aar;
        }
        if (b == ScatterBase.$$p[16]) {
            return this.aaz;
        }
        if (b == BubbleSeries.$$p[2]) {
            return this.adc;
        }
        return _super.prototype.md.call(this, a);
    };
    Object.defineProperty(BubbleSeries.prototype, "acy", {
        get: function () {
            return this.act;
        },
        set: function (a) {
            if (this.act != a) {
                var b = this.acy;
                this.act = a;
                this.raisePropertyChanged("RadiusColumn", b, this.acy);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "acx", {
        get: function () {
            return this.acs;
        },
        set: function (a) {
            if (this.acs != a) {
                var b = this.acx;
                this.acs = a;
                this.raisePropertyChanged("LabelColumn", b, this.acx);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "acu", {
        get: function () {
            return this.acr;
        },
        set: function (a) {
            if (this.acr != a) {
                var b = this.acu;
                this.acr = a;
                this.raisePropertyChanged("FillColumn", b, this.acu);
            }
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.prototype.aa2 = function (a, b, c, d, e) {
        if (c <= this.z7) {
            b.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, c);
        }
        var f = this.z7;
        var g = this.dn;
        var h;
        var i;
        var j = this.getEffectiveViewport1(a);
        var k = new ScalerParams(0, d, e, this.yu.d, j);
        var l = new ScalerParams(0, d, e, this.yu.e, j);
        var m = false;
        var n = 0;
        if (this.db != null) {
            if (this.db.f4()) {
                var o = this.db.m4(d, k);
                m = o.c;
                n = o.d;
            }
        }
        var _loop_1 = function (p) {
            h = this_1.zf.item(p);
            i = this_1.zg.item(p);
            var q = { $type: Point_$type, x: this_1.yu.a.el(h, k), y: this_1.yu.b.el(i, l) };
            if (m) {
                if (q.x < e.left || q.x > e.right) {
                    if (q.x + n >= e.left && q.x + n <= e.right) {
                        q = { $type: Point_$type, x: q.x + n, y: i };
                    }
                }
            }
            if (!isInfinity(q.x) && !isInfinity(q.y)) {
                var r_1 = g.item(p);
                if (c <= f) {
                    if (!b.g.containsKey(r_1)) {
                        var s_1 = { $type: Point_$type, x: h, y: i };
                        b.g.addItem(r_1, ((function () {
                            var $ret = new OwnedPoint();
                            $ret.a = r_1;
                            $ret.b = s_1;
                            $ret.c = q;
                            return $ret;
                        })()));
                    }
                }
            }
        };
        var this_1 = this;
        for (var p = 0; p < c; p++) {
            _loop_1(p);
        }
    };
    BubbleSeries.prototype.abd = function (a, b) {
        var c = typeCast(BubbleSeriesView.$, b);
        var d = c.c0;
        d.m = this.acy;
        _super.prototype.abd.call(this, a, b);
        var e = Math.min(this.zf != null ? this.zf.count : 0, this.zg != null ? this.zg.count : 0);
        if (e < 1) {
            return;
        }
        c.dm();
        c.dn();
    };
    BubbleSeries.prototype.adw = function () {
        if (this.db == null) {
            return;
        }
        if (this.a5 == null) {
            return;
        }
        if (this.a5.isItemwise) {
            var a = this.a5;
            this.a5.clearLegendItemsForSeries(this);
            this.adv();
            a.renderItemwiseContent(this);
        }
        if (this.a5.isScale) {
            var b = this.a5;
            b.restoreOriginalState();
            b.initializeLegend(this);
        }
    };
    BubbleSeries.ac3 = function (a, b, c, d, e) {
        if (e <= a || isNaN_(e) || isInfinity(e)) {
            return c;
        }
        if (e >= b) {
            return d;
        }
        var f = c + ((d - c) / (b - a)) * (e - a);
        return f;
    };
    BubbleSeries.ac4 = function (a, b, c, d, logBase_, e) {
        var f = logBase(e, logBase_);
        var g = logBase(a, logBase_);
        var h = logBase(b, logBase_);
        return BubbleSeries.ac3(g, h, c, d, f);
    };
    BubbleSeries.prototype.he = function (a, b, c) {
        var d = _super.prototype.he.call(this, a, b, c);
        if (this.acy == null || this.dn == null || this.acy.count == 0 || this.dn.count != this.acy.count) {
            d = false;
        }
        return d;
    };
    BubbleSeries.prototype.zp = function (a, b) {
        if (b != 3) {
            return true;
        }
        if (a == null) {
            return true;
        }
        if (this.aar == a || this.aaz == a || this.adr == a) {
            return true;
        }
        return false;
    };
    BubbleSeries.prototype.adv = function () {
        var _this = this;
        var a = typeCast(IChartLegend_$type, this.a5);
        if (a == null || this.dn == null) {
            return;
        }
        this.ac2 = new List$1(UIElement.$, 0);
        var b = typeCast(CustomPaletteBrushScale.$, this.acn);
        var c = typeCast(ValueBrushScale.$, this.acn);
        var d = this.acn;
        var e = this.acl();
        var f = e.b;
        var g = e.a;
        var h = this.dn;
        var _loop_2 = function (i) {
            var j = null;
            if (c != null && this_2.acu != null) {
                var k = this_2.acu.item(i);
                j = c.getBrushByRange(k, f, g);
            }
            else if (b != null) {
                j = b.getBrush1(i, h.count);
            }
            else if (d != null) {
                j = d.getBrush(i);
            }
            var l = new ContentControl();
            var m = this_2.acx != null && this_2.acx.item(i) != null ? this_2.acx.item(i).toString() : "";
            l.content = ((function () {
                var $ret = new DataContext();
                $ret.series = _this;
                $ret.item = h.item(i);
                $ret.itemBrush = j;
                $ret.itemLabel = m;
                $ret.legendLabel = m;
                return $ret;
            })());
            var n = this_2.sv;
            if (n == null) {
                n = this_2.cv.bn(this_2.c0);
            }
            l.ah = n;
            this_2.ac2.add(l);
        };
        var this_2 = this;
        for (var i = 0; i < h.count; i++) {
            _loop_2(i);
        }
    };
    BubbleSeries.prototype.pb = function (a, b, c, d) {
        _super.prototype.pb.call(this, a, b, c, d);
        if (this.acq != null) {
            this.acq.aa();
        }
        if (this.acn != null) {
            this.acn.x();
        }
        this.adw();
    };
    BubbleSeries.prototype.qb = function () {
        _super.prototype.qb.call(this);
        this.adw();
    };
    BubbleSeries.prototype.qi = function () {
        _super.prototype.qi.call(this);
        this.adw();
    };
    BubbleSeries.prototype.q7 = function (a, b, c, d) {
        var e_1, _a;
        _super.prototype.q7.call(this, a, b, c, d);
        switch (b) {
            case ScatterBase.$$p[10]:
            case ScatterBase.$$p[14]:
            case ScatterBase.$$p[11]:
            case ScatterBase.$$p[15]:
            case BubbleSeries.$$p[9]:
            case BubbleSeries.$$p[10]:
                this.qd();
                break;
            case "FastItemsSource":
                if (this.acq != null) {
                    this.acq.aa();
                }
                if (this.acn != null) {
                    this.acn.x();
                }
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.acy);
                    c.deregisterColumn(this.acu);
                    c.deregisterColumn(this.acx);
                    this.acy = null;
                    this.acu = null;
                    this.acx = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.acy = this.dk(this.adr);
                    if (!stringIsNullOrEmpty(this.adc)) {
                        this.acu = this.dk(this.adc);
                    }
                    this.acx = this.dm(this.adh);
                }
                this.rp(false);
                this.adw();
                break;
            case BubbleSeries.$$p[11]:
                if (this.acq != null) {
                    this.acq.aa();
                }
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.acy);
                    this.acy = this.dk(this.adr);
                    this.adw();
                }
                break;
            case "RadiusColumn":
                if (this.acq != null) {
                    this.acq.aa();
                }
                this.yv.c2.g$i();
                this.rp(this.gg && this.d7);
                this.qk();
                break;
            case BubbleSeries.$$p[12]:
                if (c != null) {
                    c.l.remove(this);
                    c.aa();
                }
                if (d != null) {
                    d.l.add(this);
                    d.aa();
                }
                this.rp(false);
                this.qj();
                break;
            case BubbleSeries.$$p[13]:
                this.rp(false);
                this.qj();
                break;
            case "DiscreteLegendItemTemplate":
                this.adw();
                break;
            case BubbleSeries.$$p[3]:
                if (c != null) {
                    c.o.remove(this);
                    c.x();
                }
                if (d != null) {
                    d.o.add(this);
                    d.x();
                }
                this.rp(false);
                this.adw();
                this.qj();
                break;
            case BubbleSeries.$$p[4]:
            case BubbleSeries.$$p[8]:
            case BubbleSeries.$$p[7]:
            case BubbleSeries.$$p[6]:
                this.rp(false);
                this.adw();
                this.qj();
                break;
            case "FillColumn":
                this.rp(this.gg && this.d7);
                this.qj();
                break;
            case BubbleSeries.$$p[2]:
                if (this.acn != null) {
                    this.acn.x();
                }
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.acu);
                    this.acu = this.dk(this.adc);
                    this.adw();
                }
                break;
            case BubbleSeries.$$p[5]:
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.acx);
                    this.acx = this.dm(this.adh);
                    this.adw();
                }
                break;
            case "ActualLegend":
                var e = typeCast(IChartLegend_$type, c);
                if (e != null && e.isItemwise) {
                    var f = typeCast(IChartItemLegend_$type, e);
                    f.clearLegendItemsForSeries(this);
                }
                if (e != null && e.isScale) {
                    var g = typeCast(IChartScaleLegend_$type, e);
                    var h = true;
                    var i = null;
                    if (this.db != null) {
                        try {
                            for (var _b = __values(fromEnum(this.db.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                                var j = _c.value;
                                if (j.legend == g) {
                                    i = j;
                                    h = false;
                                }
                            }
                        }
                        catch (e_1_1) {
                            e_1 = { error: e_1_1 };
                        }
                        finally {
                            try {
                                if (_c && !_c.done && (_a = _b.return))
                                    _a.call(_b);
                            }
                            finally {
                                if (e_1)
                                    throw e_1.error;
                            }
                        }
                    }
                    if (h) {
                        g.restoreOriginalState();
                    }
                    else {
                        g.initializeLegend(typeCast(IScaleLegendSeries_$type, i));
                    }
                }
                this.adw();
                break;
            case "SeriesViewer":
                this.adw();
                break;
        }
    };
    BubbleSeries.prototype.updateSizeScaleGlobals = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.acy != null) {
            a.b = this.acy.minimum;
            a.a = this.acy.maximum;
        }
        if (this.acq != null) {
            this.acq.ab(a.b, a.a);
        }
    };
    BubbleSeries.prototype.updateFillScaleGlobals = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.acu != null) {
            a.b = this.acu.minimum;
            a.a = this.acu.maximum;
        }
        if (this.acn != null) {
            this.acn.z(a.b, a.a);
        }
    };
    BubbleSeries.prototype.acm = function (a) {
        var b = new ActualRange();
        b.b = NaN;
        b.a = NaN;
        if (this.acy != null) {
            b.b = this.acy.minimum;
            b.a = this.acy.maximum;
        }
        if (a != null) {
            a.x();
            if (this.ac1) {
                b.b = a.globalMinimum;
                b.a = a.globalMaximum;
            }
        }
        return b;
    };
    BubbleSeries.prototype.acl = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.acu != null) {
            a.b = this.acu.minimum;
            a.a = this.acu.maximum;
        }
        var b = typeCast(ValueBrushScale.$, this.acn);
        if (b != null) {
            b.s();
            if (this.acz && this.acn.o.count > 1) {
                a.b = b.q;
                a.a = b.p;
            }
        }
        return a;
    };
    BubbleSeries.prototype.ady = function (a, b, c, d) {
        var e = c.width;
        if (!this.cv.bx.isEmpty) {
            e = this.cv.bx.width;
        }
        else if (this.db != null && !this.db.wj.isEmpty) {
            e = this.db.wj.width;
        }
        var f = DeviceUtils.c(e);
        this.acp = this.acq || ((function () {
            var $ret = new SizeScale();
            $ret.minimumValue = f / 10;
            $ret.maximumValue = f / 5;
            return $ret;
        })());
        if (this.acp != null) {
            var g = this.acp.minimumValue;
            var h = this.acp.maximumValue;
            var i = this.acp.logarithmBase;
            var j = this.acm(this.acp);
            var k = j.b;
            var l = j.a;
            if (this.acp.isLogarithmic) {
                for (var m = 0; m < b.count; m++) {
                    b._inner[m] = BubbleSeries.ac4(k, l, g, h, i, b._inner[m]);
                }
            }
            else {
                for (var n = 0; n < b.count; n++) {
                    b._inner[n] = BubbleSeries.ac3(k, l, g, h, b._inner[n]);
                }
            }
        }
        var o = 1;
        o = DeviceUtils.d();
        var p = this.acq == null;
        if (d) {
            var q = c.width / e;
            for (var r = 0; r < b.count; r++) {
                if (p) {
                    b._inner[r] = b._inner[r] / o;
                }
                b._inner[r] = b._inner[r] * q;
            }
        }
        for (var s = 0; s < a.count; s++) {
            var t = a._inner[s];
            if (p && !d) {
                t.width = Math.max(0, b._inner[s] / o);
                t.height = Math.max(0, b._inner[s] / o);
            }
            else {
                t.width = Math.max(0, b._inner[s]);
                t.height = Math.max(0, b._inner[s]);
            }
        }
    };
    BubbleSeries.prototype.adx = function (a) {
        var b = typeCast(BubbleSeriesView.$, this.cu);
        this.aco.b7 = false;
        if (b != null) {
            b.b7 = false;
        }
        var c = typeCast(CustomPaletteBrushScale.$, this.acn);
        var d = typeCast(ValueBrushScale.$, this.acn);
        var e = this.acn;
        var f = this.acl();
        var g = f.b;
        var h = f.a;
        var i = this.acn == null || !this.acn.isReady || (d != null && this.adc == null);
        if (i) {
            this.aco.dl();
            if (b != null) {
                b.dl();
            }
            return;
        }
        this.aco.b7 = true;
        if (b != null) {
            b.b7 = true;
        }
        var j = a.count;
        var k = this.dn;
        for (var l = 0; l < j; l++) {
            var m = a._inner[l];
            var n = typeCast(DataContext.$, m.content);
            if (n != null) {
                var o = null;
                var p = k.indexOf(n.item);
                if (c != null) {
                    o = c.getBrush1(p, k.count);
                }
                else if (d != null && this.acu != null) {
                    var q = this.acu.item(p);
                    o = d.getBrushByRange(q, g, h);
                }
                else if (e != null) {
                    o = e.getBrush(p);
                }
                else {
                    if (this.yh == null) {
                        o = this.yf;
                    }
                    else {
                        o = this.yh;
                    }
                }
                var r = null;
                if (this.yi == null) {
                    r = this.yg;
                }
                else {
                    r = this.yi;
                }
                if (this.ac0 && o != null) {
                    r = o;
                }
                if (r != null && !isNaN_(this.ac6)) {
                    r = BrushUtil.m(r, this.ac6);
                }
                if (o != null && !isNaN_(this.ac5)) {
                    o = BrushUtil.m(o, this.ac5);
                }
                n.itemBrush = o;
                n.actualItemBrush = o;
                n.outline = r;
            }
        }
    };
    BubbleSeries.prototype.ak = function (a, b) {
        var c = new List$1(ChartSelection.$, 0);
        this.p2(a, c, b);
        return c.toArray();
    };
    BubbleSeries.prototype.p2 = function (a, b, c) {
        var d = 1;
        if (d == 1) {
            var e = this.acv();
            this.aa5(a, b, c, d, e);
        }
        else {
            _super.prototype.p2.call(this, a, b, c);
        }
    };
    BubbleSeries.prototype.acv = function () {
        var a = new FastItemColumn(typeCast(FastItemsSource.$, this.dn), "RadiusColumn", null, false);
        var b = this.cv.bx;
        var c = b.width;
        if (!this.cv.bx.isEmpty) {
            c = this.cv.bx.width;
        }
        else if (this.db != null && !this.db.wj.isEmpty) {
            c = this.db.wj.width;
        }
        var d = DeviceUtils.c(c);
        this.acp = this.acq || ((function () {
            var $ret = new SizeScale();
            $ret.minimumValue = d / 10;
            $ret.maximumValue = d / 5;
            return $ret;
        })());
        if (this.acp != null) {
            var e = this.acp.minimumValue;
            var f = this.acp.maximumValue;
            var g = this.acp.logarithmBase;
            var h = this.acm(this.acp);
            var i = h.b;
            var j = h.a;
            if (this.acp.isLogarithmic) {
                for (var k = 0; k < a.count; k++) {
                    a.item(k, BubbleSeries.ac4(i, j, e, f, g, a.item(k)));
                }
            }
            else {
                for (var l = 0; l < a.count; l++) {
                    a.item(l, BubbleSeries.ac3(i, j, e, f, a.item(l)));
                }
            }
        }
        var m = DeviceUtils.d();
        var n = this.acq == null;
        var o = this.cv == this.cu;
        if (o) {
            var p = b.width / c;
            for (var q = 0; q < a.count; q++) {
                if (n) {
                    a.item(q, a.item(q) / m);
                }
                a.item(q, a.item(q) * p);
            }
        }
        for (var r = 0; r < a.count; r++) {
            var s = void 0;
            if (n && !o) {
                a.item(r, Math.max(0, a.item(r) / m));
            }
            else {
                a.item(r, Math.max(0, a.item(r)));
            }
        }
        return a;
    };
    BubbleSeries.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.kn(c);
        var e = d == null ? NaN : this.ix(d, "XMemberPath");
        var f = d == null ? NaN : this.ix(d, "YMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.a = 13;
        g.l = e;
        g.q = "X";
        g.r = this.aar != null ? this.aar : "X";
        g.s = this.aan != null ? this.aan : "X:";
        g.t = this.aap != null ? this.aap : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 14;
        h.q = "Y";
        h.r = this.aaz != null ? this.aaz : "Y";
        h.s = this.aav != null ? this.aav : "Y:";
        h.t = this.aax != null ? this.aax : "";
        var i = new DataLegendSeriesContext();
        i.e = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(g);
            $ret.add(h);
            return $ret;
        })());
        i.h = this.mc();
        if (!stringIsNullOrEmpty(this.adr)) {
            var j = d == null ? NaN : this.ix(d, "RadiusMemberPath");
            var k = new DataLegendSeriesValueInfo();
            k.l = j;
            k.a = 11;
            k.q = "Radius";
            k.r = this.adr != null ? this.adr : "Radius";
            k.s = this.adn != null ? this.adn : "R:";
            k.t = this.adp != null ? this.adp : "";
            i.e.add(k);
        }
        else if (this.acp != null) {
            var l = new DataLegendSeriesValueInfo();
            l.l = this.acp.maximumValue;
            l.a = 11;
            l.q = "Radius";
            l.r = this.adr != null ? this.adr : "Radius";
            l.s = this.adn != null ? this.adn : "R:";
            l.t = this.adp != null ? this.adp : "";
            i.e.add(l);
        }
        if (!stringIsNullOrEmpty(this.adc)) {
            var m = d == null ? NaN : this.ix(d, "FillMemberPath");
            var n = new DataLegendSeriesValueInfo();
            n.l = m;
            n.a = 12;
            n.q = "Fill";
            n.r = this.adc != null ? this.adc : "Fill";
            n.s = this.ac8 != null ? this.ac8 : "F:";
            n.t = this.ada != null ? this.ada : "";
            i.e.add(n);
        }
        return i;
    };
    Object.defineProperty(BubbleSeries.prototype, "actualMarkerBrush", {
        get: function () {
            return this.yf;
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.$t = markType(BubbleSeries, 'BubbleSeries', ScatterBase.$, [IScaleLegendSeries_$type, ISupportsSizeScale_$type, ISupportsFillScale_$type]);
    BubbleSeries.$$p = markDep(DependencyProperty, PropertyMetadata, BubbleSeries, 'raisePropertyChanged', ['FillMemberAsLegendLabel:ac8:adz', [2, null], 'FillMemberAsLegendUnit:ada:ad0', [2, null], 'FillMemberPath:adc:ad1', [2], 'FillScale:acn:ad2', [BrushScale.$], 'FillScaleUseGlobalValues:acz:ad3', [0, false], 'LabelMemberPath:adh:ad4', [2], 'MarkerBrushBrightness:ac5:ad5', [1, NaN], 'MarkerOutlineBrightness:ac6:ad6', [1, NaN], 'MarkerOutlineUsesFillScale:ac0:ad7', [0, false], 'RadiusMemberAsLegendLabel:adn:ad8', [2, null], 'RadiusMemberAsLegendUnit:adp:ad9', [2, null], 'RadiusMemberPath:adr:aea', [2, null], 'RadiusScale:acq:aeb', [SizeScale.$], 'RadiusScaleUseGlobalValues:ac1:aec', [0, false]]);
    return BubbleSeries;
}(ScatterBase));
export { BubbleSeries };
/**
 * @hidden
 */
var CustomPaletteBrushScale = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CustomPaletteBrushScale, _super);
    function CustomPaletteBrushScale() {
        return _super.call(this) || this;
    }
    CustomPaletteBrushScale.prototype.getBrush1 = function (a, b) {
        if (this.brushes == null || this.brushes.count == 0) {
            return null;
        }
        if (this.brushSelectionMode == 0) {
            return _super.prototype.getBrush.call(this, a % this.brushes.count);
        }
        var c = BubbleSeries.ac3(0, b - 1, 0, this.brushes.count - 1, a);
        return this.ab(c);
    };
    CustomPaletteBrushScale.prototype.get_isReady = function () {
        return this.brushes != null && this.brushes.count > 0;
    };
    CustomPaletteBrushScale.$t = markType(CustomPaletteBrushScale, 'CustomPaletteBrushScale', BrushScale.$);
    CustomPaletteBrushScale.$$p = markDep(DependencyProperty, PropertyMetadata, CustomPaletteBrushScale, 'v', ['BrushSelectionMode', [BrushSelectionMode_$type, enumGetBox(BrushSelectionMode_$type, 0)]]);
    return CustomPaletteBrushScale;
}(BrushScale));
export { CustomPaletteBrushScale };
/**
 * @hidden
 */
var BubbleSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(BubbleSeriesView, _super);
    function BubbleSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.dk = null;
        _this.dk = a;
        _this.c2 = new ScatterTrendLineManager();
        return _this;
    }
    BubbleSeriesView.prototype.au = function () {
        _super.prototype.au.call(this);
        if (!this.q) {
            this.b4.w8 = Defaults.e;
        }
    };
    BubbleSeriesView.prototype.cz = function () {
        var _this = this;
        return new BubbleMarkerManager(function (a) { return _this.c3.item(a); }, function (a) { return _this.c1.yu.c.item(a); }, runOn(this, this.de), runOn(this, this.cw), runOn(this, this.c4));
    };
    BubbleSeriesView.prototype.dm = function () {
        var a = this.c0;
        this.dk.ady(a.n, a.o, this.bx, this == this.e.cu);
        this.as();
    };
    BubbleSeriesView.prototype.dn = function () {
        var a = this.c0;
        this.dk.adx(a.n);
    };
    BubbleSeriesView.prototype.dl = function () {
        var e_2, _a;
        var a = this.c0;
        try {
            for (var _b = __values(fromEnum(a.n)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                var c = typeCast(DataContext.$, b.content);
                if (c != null) {
                    c.itemBrush = null;
                    c.outline = null;
                }
            }
        }
        catch (e_2_1) {
            e_2 = { error: e_2_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_2)
                    throw e_2.error;
            }
        }
    };
    BubbleSeriesView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span";
        var b = this.e.ba.a$u(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.dk.title + "</span><br/><span>" + "(${item." + this.dk.aar + "}, ${item." + this.dk.aaz + "})</span>";
        if (!stringIsNullOrEmpty(this.dk.adr)) {
            a += "<span>, Radius: ${item." + this.dk.adr + "}</span>";
        }
        a += "</div>";
        return a;
    };
    BubbleSeriesView.$t = markType(BubbleSeriesView, 'BubbleSeriesView', ScatterBaseView.$);
    return BubbleSeriesView;
}(ScatterBaseView));
export { BubbleSeriesView };
