/*
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-react-core";
import { ISupportsSizeScale_$type } from "./ISupportsSizeScale";
import { ISupportsFillScale_$type } from "./ISupportsFillScale";
import { Base, typeCast, Point_$type, fromEnum, markType, markDep, enumGetBox, runOn } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { UIElement } from "igniteui-react-core";
import { ActualRange } from "./ActualRange";
import { DependencyProperty } from "igniteui-react-core";
import { SizeScale } from "./SizeScale";
import { BrushScale } from "./BrushScale";
import { ScatterFrame } from "./ScatterFrame";
import { IChartLegend_$type } from "igniteui-react-core";
import { ValueBrushScale } from "./ValueBrushScale";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { ScatterBaseView } from "./ScatterBaseView";
import { ScalerParams } from "./ScalerParams";
import { Dictionary$2 } from "igniteui-react-core";
import { OwnedPoint } from "./OwnedPoint";
import { BubbleMarkerManager } from "./BubbleMarkerManager";
import { IChartItemLegend_$type } from "igniteui-react-core";
import { IChartScaleLegend_$type } from "igniteui-react-core";
import { ContentControl } from "igniteui-react-core";
import { DataContext } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { BrushUtil } from "igniteui-react-core";
import { DataLegendSeriesValueInfo } from "igniteui-react-core";
import { DataLegendSeriesContext } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_, isInfinity, logBase } from "igniteui-react-core";
import { stringIsNullOrEmpty } from "igniteui-react-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.ad7 = null;
        _this.ad6 = null;
        _this.acu = null;
        _this.acm = null;
        _this.acl = null;
        _this.ack = null;
        _this.aci = null;
        _this.ab = BubbleSeries.$;
        _this.yu = new ScatterFrame();
        _this.yw = new ScatterFrame();
        _this.ys = new ScatterFrame();
        return _this;
    }
    BubbleSeries.prototype.bi = function () {
        return new BubbleSeries();
    };
    BubbleSeries.prototype.get_eg = function () {
        return true;
    };
    BubbleSeries.prototype.cq = function () {
        return new BubbleSeriesView(this);
    };
    BubbleSeries.prototype.qx = function (a) {
        _super.prototype.qx.call(this, a);
        this.ach = a;
    };
    BubbleSeries.prototype.jj = function () {
        return 0.7;
    };
    BubbleSeries.prototype.wt = function () {
        if (this.ws == 0) {
            return 2;
        }
        return _super.prototype.wt.call(this);
    };
    BubbleSeries.prototype.isAttachedTo = function (a) {
        return this.a4 == a;
    };
    BubbleSeries.prototype.ef = function () {
        return true;
    };
    BubbleSeries.prototype.py = function (a) {
        _super.prototype.py.call(this, a);
        if (this.acp != null && this.acu != null && this.acu.count > 0) {
            for (var b = 0; b < this.acu.count; b++) {
                a(this.acu._inner[b]);
            }
        }
    };
    Object.defineProperty(BubbleSeries.prototype, "aco", {
        get: function () {
            return this.acq;
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.prototype.get_isColoredItemwise = function () {
        return this.acn != null && this.acn.count > 0;
    };
    BubbleSeries.prototype.ad5 = function (a) {
        var b = typeCast(CustomPaletteBrushScale.$, this.acg);
        var c = typeCast(ValueBrushScale.$, this.acg);
        var d = this.acg;
        if (b != null && this.dl != null) {
            return b.getBrush1(a, this.dl.count);
        }
        else if (c != null) {
            return c.getBrushByIndex(a, this.acn);
        }
        else if (d != null) {
            return d.getBrush(a);
        }
        return null;
    };
    Object.defineProperty(BubbleSeries.prototype, "legendReady", {
        get: function () {
            return this.acq != null && this.acq.count != 0;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "minScaleText", {
        get: function () {
            var a = this.acf(this.acj).b;
            return (Math.round(a * 1000) / 1000).toString();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "maxScaleText", {
        get: function () {
            var a = this.acf(this.acj).a;
            return (Math.round(a * 1000) / 1000).toString();
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.prototype.forScaleColors = function (a) {
        for (var b = 0; b < this.acq.count; b++) {
            if (this.acg == null || !this.acg.isReady) {
                return false;
            }
            var c = NaN;
            if (this.acn != null) {
                c = (this.acn.item(b) - this.acn.minimum) / (this.acn.maximum - this.acn.minimum);
            }
            var d = (this.acq.item(b) - this.acq.minimum) / (this.acq.maximum - this.acq.minimum);
            if (isNaN_(c)) {
                c = 0;
            }
            if (isNaN_(d)) {
                d = c;
            }
            var e = this.x9;
            var f = this.ad5(b);
            var g = f != null ? f : e;
            a(g, d);
        }
        return true;
    };
    BubbleSeries.prototype.ko = function (a, b) {
        var c = this.nb(b);
        if (c == BubbleSeries.$$p[5]) {
            return this.kp(a, b, this.ac9);
        }
        if (c == BubbleSeries.$$p[11]) {
            return this.kp(a, b, this.adj);
        }
        if (c == ScatterBase.$$p[12]) {
            return this.kp(a, b, this.aal);
        }
        if (c == ScatterBase.$$p[16]) {
            return this.kp(a, b, this.aat);
        }
        if (c == BubbleSeries.$$p[2]) {
            return this.kp(a, b, this.ac4);
        }
        return _super.prototype.ko.call(this, a, b);
    };
    BubbleSeries.prototype.mb = function (a) {
        var b = this.nb(a);
        if (b == BubbleSeries.$$p[5]) {
            return this.ac9;
        }
        if (b == BubbleSeries.$$p[11]) {
            return this.adj;
        }
        if (b == ScatterBase.$$p[12]) {
            return this.aal;
        }
        if (b == ScatterBase.$$p[16]) {
            return this.aat;
        }
        if (b == BubbleSeries.$$p[2]) {
            return this.ac4;
        }
        return _super.prototype.mb.call(this, a);
    };
    Object.defineProperty(BubbleSeries.prototype, "acq", {
        get: function () {
            return this.acm;
        },
        set: function (a) {
            if (this.acm != a) {
                var b = this.acq;
                this.acm = a;
                this.raisePropertyChanged("RadiusColumn", b, this.acq);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "acp", {
        get: function () {
            return this.acl;
        },
        set: function (a) {
            if (this.acl != a) {
                var b = this.acp;
                this.acl = a;
                this.raisePropertyChanged("LabelColumn", b, this.acp);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "acn", {
        get: function () {
            return this.ack;
        },
        set: function (a) {
            if (this.ack != a) {
                var b = this.acn;
                this.ack = a;
                this.raisePropertyChanged("FillColumn", b, this.acn);
            }
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.prototype.aaw = function (a, b, c, d, e) {
        if (c <= this.z1) {
            b.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, c);
        }
        var f = this.z1;
        var g = this.dl;
        var h;
        var i;
        var j = this.getEffectiveViewport1(a);
        var k = new ScalerParams(0, d, e, this.yo.d, j);
        var l = new ScalerParams(0, d, e, this.yo.e, j);
        var m = false;
        var n = 0;
        if (this.c9 != null) {
            if (this.c9.fz()) {
                var o = this.c9.mt(d, k);
                m = o.c;
                n = o.d;
            }
        }
        var _loop_1 = function (p) {
            h = this_1.y9.item(p);
            i = this_1.za.item(p);
            var q = { $type: Point_$type, x: this_1.yo.a.ek(h, k), y: this_1.yo.b.ek(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.aa6 = function (a, b) {
        var c = typeCast(BubbleSeriesView.$, b);
        var d = c.c0;
        d.m = this.acq;
        _super.prototype.aa6.call(this, a, b);
        var e = Math.min(this.y9 != null ? this.y9.count : 0, this.za != null ? this.za.count : 0);
        if (e < 1) {
            return;
        }
        c.dm();
        c.dn();
    };
    BubbleSeries.prototype.ado = function () {
        if (this.c9 == null) {
            return;
        }
        if (this.a4 == null) {
            return;
        }
        if (this.a4.isItemwise) {
            var a = this.a4;
            this.a4.clearLegendItemsForSeries(this);
            this.adn();
            a.renderItemwiseContent(this);
        }
        if (this.a4.isScale) {
            var b = this.a4;
            b.restoreOriginalState();
            b.initializeLegend(this);
        }
    };
    BubbleSeries.acv = 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.acw = function (a, b, c, d, logBase_, e) {
        var f = logBase(e, logBase_);
        var g = logBase(a, logBase_);
        var h = logBase(b, logBase_);
        return BubbleSeries.acv(g, h, c, d, f);
    };
    BubbleSeries.prototype.hc = function (a, b, c) {
        var d = _super.prototype.hc.call(this, a, b, c);
        if (this.acq == null || this.dl == null || this.acq.count == 0 || this.dl.count != this.acq.count) {
            d = false;
        }
        return d;
    };
    BubbleSeries.prototype.zj = function (a, b) {
        if (b != 3) {
            return true;
        }
        if (a == null) {
            return true;
        }
        if (this.aal == a || this.aat == a || this.adj == a) {
            return true;
        }
        return false;
    };
    BubbleSeries.prototype.adn = function () {
        var _this = this;
        var a = typeCast(IChartLegend_$type, this.a4);
        if (a == null || this.dl == null) {
            return;
        }
        this.acu = new List$1(UIElement.$, 0);
        var b = typeCast(CustomPaletteBrushScale.$, this.acg);
        var c = typeCast(ValueBrushScale.$, this.acg);
        var d = this.acg;
        var e = this.ace();
        var f = e.b;
        var g = e.a;
        var h = this.dl;
        var _loop_2 = function (i) {
            var j = null;
            if (c != null && this_2.acn != null) {
                var k = this_2.acn.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.acp != null && this_2.acp.item(i) != null ? this_2.acp.item(i).toString() : "";
            l.content = ((function () {
                var $ret = new DataContext();
                $ret.series = _this;
                $ret.item = h.item(i);
                $ret.itemBrush = j;
                $ret.itemLabel = m;
                return $ret;
            })());
            var n = this_2.sr;
            if (n == null) {
                n = this_2.ct.bn(this_2.cy);
            }
            l.ah = n;
            this_2.acu.add(l);
        };
        var this_2 = this;
        for (var i = 0; i < h.count; i++) {
            _loop_2(i);
        }
    };
    BubbleSeries.prototype.o9 = function (a, b, c, d) {
        _super.prototype.o9.call(this, a, b, c, d);
        if (this.acj != null) {
            this.acj.aa();
        }
        if (this.acg != null) {
            this.acg.x();
        }
        this.ado();
    };
    BubbleSeries.prototype.p9 = function () {
        _super.prototype.p9.call(this);
        this.ado();
    };
    BubbleSeries.prototype.qg = function () {
        _super.prototype.qg.call(this);
        this.ado();
    };
    BubbleSeries.prototype.q5 = function (a, b, c, d) {
        var e_1, _a;
        _super.prototype.q5.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.qb();
                break;
            case "FastItemsSource":
                if (this.acj != null) {
                    this.acj.aa();
                }
                if (this.acg != null) {
                    this.acg.x();
                }
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.acq);
                    c.deregisterColumn(this.acn);
                    c.deregisterColumn(this.acp);
                    this.acq = null;
                    this.acn = null;
                    this.acp = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.acq = this.di(this.adj);
                    if (!stringIsNullOrEmpty(this.ac4)) {
                        this.acn = this.di(this.ac4);
                    }
                    this.acp = this.dk(this.ac9);
                }
                this.rn(false);
                this.ado();
                break;
            case BubbleSeries.$$p[11]:
                if (this.acj != null) {
                    this.acj.aa();
                }
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.acq);
                    this.acq = this.di(this.adj);
                    this.ado();
                }
                break;
            case "RadiusColumn":
                if (this.acj != null) {
                    this.acj.aa();
                }
                this.yp.c2.g$i();
                this.rn(this.ge && this.d5);
                this.qi();
                break;
            case BubbleSeries.$$p[12]:
                if (c != null) {
                    c.l.remove(this);
                    c.aa();
                }
                if (d != null) {
                    d.l.add(this);
                    d.aa();
                }
                this.rn(false);
                this.qh();
                break;
            case BubbleSeries.$$p[13]:
                this.rn(false);
                this.qh();
                break;
            case "DiscreteLegendItemTemplate":
                this.ado();
                break;
            case BubbleSeries.$$p[3]:
                if (c != null) {
                    c.o.remove(this);
                    c.x();
                }
                if (d != null) {
                    d.o.add(this);
                    d.x();
                }
                this.rn(false);
                this.ado();
                this.qh();
                break;
            case BubbleSeries.$$p[4]:
            case BubbleSeries.$$p[8]:
            case BubbleSeries.$$p[7]:
            case BubbleSeries.$$p[6]:
                this.rn(false);
                this.ado();
                this.qh();
                break;
            case "FillColumn":
                this.rn(this.ge && this.d5);
                this.qh();
                break;
            case BubbleSeries.$$p[2]:
                if (this.acg != null) {
                    this.acg.x();
                }
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.acn);
                    this.acn = this.di(this.ac4);
                    this.ado();
                }
                break;
            case BubbleSeries.$$p[5]:
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.acp);
                    this.acp = this.dk(this.ac9);
                    this.ado();
                }
                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.c9 != null) {
                        try {
                            for (var _b = __values(fromEnum(this.c9.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.ado();
                break;
            case "SeriesViewer":
                this.ado();
                break;
        }
    };
    BubbleSeries.prototype.updateSizeScaleGlobals = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.acq != null) {
            a.b = this.acq.minimum;
            a.a = this.acq.maximum;
        }
        if (this.acj != null) {
            this.acj.ab(a.b, a.a);
        }
    };
    BubbleSeries.prototype.updateFillScaleGlobals = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.acn != null) {
            a.b = this.acn.minimum;
            a.a = this.acn.maximum;
        }
        if (this.acg != null) {
            this.acg.z(a.b, a.a);
        }
    };
    BubbleSeries.prototype.acf = function (a) {
        var b = new ActualRange();
        b.b = NaN;
        b.a = NaN;
        if (this.acq != null) {
            b.b = this.acq.minimum;
            b.a = this.acq.maximum;
        }
        if (a != null) {
            a.x();
            if (this.act) {
                b.b = a.globalMinimum;
                b.a = a.globalMaximum;
            }
        }
        return b;
    };
    BubbleSeries.prototype.ace = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.acn != null) {
            a.b = this.acn.minimum;
            a.a = this.acn.maximum;
        }
        var b = typeCast(ValueBrushScale.$, this.acg);
        if (b != null) {
            b.s();
            if (this.acr && this.acg.o.count > 1) {
                a.b = b.q;
                a.a = b.p;
            }
        }
        return a;
    };
    BubbleSeries.prototype.adq = function (a, b, c, d) {
        var e = c.width;
        if (!this.ct.bx.isEmpty) {
            e = this.ct.bx.width;
        }
        else if (this.c9 != null && !this.c9.v0.isEmpty) {
            e = this.c9.v0.width;
        }
        var f = DeviceUtils.c(e);
        this.aci = this.acj || ((function () {
            var $ret = new SizeScale();
            $ret.minimumValue = f / 10;
            $ret.maximumValue = f / 5;
            return $ret;
        })());
        if (this.aci != null) {
            var g = this.aci.minimumValue;
            var h = this.aci.maximumValue;
            var i = this.aci.logarithmBase;
            var j = this.acf(this.aci);
            var k = j.b;
            var l = j.a;
            if (this.aci.isLogarithmic) {
                for (var m = 0; m < b.count; m++) {
                    b._inner[m] = BubbleSeries.acw(k, l, g, h, i, b._inner[m]);
                }
            }
            else {
                for (var n = 0; n < b.count; n++) {
                    b._inner[n] = BubbleSeries.acv(k, l, g, h, b._inner[n]);
                }
            }
        }
        var o = 1;
        o = DeviceUtils.d();
        var p = this.acj == 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.adp = function (a) {
        var b = typeCast(BubbleSeriesView.$, this.cs);
        this.ach.b7 = false;
        if (b != null) {
            b.b7 = false;
        }
        var c = typeCast(CustomPaletteBrushScale.$, this.acg);
        var d = typeCast(ValueBrushScale.$, this.acg);
        var e = this.acg;
        var f = this.ace();
        var g = f.b;
        var h = f.a;
        var i = this.acg == null || !this.acg.isReady || (d != null && this.ac4 == null);
        if (i) {
            this.ach.dl();
            if (b != null) {
                b.dl();
            }
            return;
        }
        this.ach.b7 = true;
        if (b != null) {
            b.b7 = true;
        }
        var j = a.count;
        var k = this.dl;
        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.acn != null) {
                    var q = this.acn.item(p);
                    o = d.getBrushByRange(q, g, h);
                }
                else if (e != null) {
                    o = e.getBrush(p);
                }
                else {
                    if (this.yb == null) {
                        o = this.x9;
                    }
                    else {
                        o = this.yb;
                    }
                }
                var r = null;
                if (this.yc == null) {
                    r = this.ya;
                }
                else {
                    r = this.yc;
                }
                if (this.acs && o != null) {
                    r = o;
                }
                if (r != null && !isNaN_(this.acy)) {
                    r = BrushUtil.m(r, this.acy);
                }
                if (o != null && !isNaN_(this.acx)) {
                    o = BrushUtil.m(o, this.acx);
                }
                n.itemBrush = o;
                n.actualItemBrush = o;
                n.outline = r;
            }
        }
    };
    BubbleSeries.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.kl(c);
        var e = d == null ? NaN : this.iv(d, "XMemberPath");
        var f = d == null ? NaN : this.iv(d, "YMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.a = 13;
        g.l = e;
        g.q = "X";
        g.r = this.aal != null ? this.aal : "X";
        g.s = this.aah != null ? this.aah : "X:";
        g.t = this.aaj != null ? this.aaj : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 14;
        h.q = "Y";
        h.r = this.aat != null ? this.aat : "Y";
        h.s = this.aap != null ? this.aap : "Y:";
        h.t = this.aar != null ? this.aar : "";
        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.ma();
        if (!stringIsNullOrEmpty(this.adj)) {
            var j = d == null ? NaN : this.iv(d, "RadiusMemberPath");
            var k = new DataLegendSeriesValueInfo();
            k.l = j;
            k.a = 11;
            k.q = "Radius";
            k.r = this.adj != null ? this.adj : "Radius";
            k.s = this.adf != null ? this.adf : "R:";
            k.t = this.adh != null ? this.adh : "";
            i.e.add(k);
        }
        else if (this.aci != null) {
            var l = new DataLegendSeriesValueInfo();
            l.l = this.aci.maximumValue;
            l.a = 11;
            l.q = "Radius";
            l.r = this.adj != null ? this.adj : "Radius";
            l.s = this.adf != null ? this.adf : "R:";
            l.t = this.adh != null ? this.adh : "";
            i.e.add(l);
        }
        if (!stringIsNullOrEmpty(this.ac4)) {
            var m = d == null ? NaN : this.iv(d, "FillMemberPath");
            var n = new DataLegendSeriesValueInfo();
            n.l = m;
            n.a = 12;
            n.q = "Fill";
            n.r = this.ac4 != null ? this.ac4 : "Fill";
            n.s = this.ac0 != null ? this.ac0 : "F:";
            n.t = this.ac2 != null ? this.ac2 : "";
            i.e.add(n);
        }
        return i;
    };
    Object.defineProperty(BubbleSeries.prototype, "actualMarkerBrush", {
        get: function () {
            return this.x9;
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.$t = markType(BubbleSeries, 'BubbleSeries', ScatterBase.$, [IScaleLegendSeries_$type, ISupportsSizeScale_$type, ISupportsFillScale_$type]);
    BubbleSeries.$$p = markDep(DependencyProperty, PropertyMetadata, BubbleSeries, 'raisePropertyChanged', ['FillMemberAsLegendLabel:ac0:adr', [2, null], 'FillMemberAsLegendUnit:ac2:ads', [2, null], 'FillMemberPath:ac4:adt', [2], 'FillScale:acg:adu', [BrushScale.$], 'FillScaleUseGlobalValues:acr:adv', [0, false], 'LabelMemberPath:ac9:adw', [2], 'MarkerBrushBrightness:acx:adx', [1, NaN], 'MarkerOutlineBrightness:acy:ady', [1, NaN], 'MarkerOutlineUsesFillScale:acs:adz', [0, false], 'RadiusMemberAsLegendLabel:adf:ad0', [2, null], 'RadiusMemberAsLegendUnit:adh:ad1', [2, null], 'RadiusMemberPath:adj:ad2', [2, null], 'RadiusScale:acj:ad3', [SizeScale.$], 'RadiusScaleUseGlobalValues:act:ad4', [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.acv(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.w2 = Defaults.e;
        }
    };
    BubbleSeriesView.prototype.cz = function () {
        var _this = this;
        return new BubbleMarkerManager(function (a) { return _this.c3.item(a); }, function (a) { return _this.c1.yo.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.adq(a.n, a.o, this.bx, this == this.e.cs);
        this.as();
    };
    BubbleSeriesView.prototype.dn = function () {
        var a = this.c0;
        this.dk.adp(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.a9.a$u(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.dk.title + "</span><br/><span>" + "(${item." + this.dk.aal + "}, ${item." + this.dk.aat + "})</span>";
        if (!stringIsNullOrEmpty(this.dk.adj)) {
            a += "<span>, Radius: ${item." + this.dk.adj + "}</span>";
        }
        a += "</div>";
        return a;
    };
    BubbleSeriesView.$t = markType(BubbleSeriesView, 'BubbleSeriesView', ScatterBaseView.$);
    return BubbleSeriesView;
}(ScatterBaseView));
export { BubbleSeriesView };
