UNPKG

igniteui-webcomponents-charts

Version:

Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.

2,185 lines 73.8 kB
/*
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 { AnnotationLayer } from "./AnnotationLayer";
import { DependencyProperty } from "igniteui-webcomponents-core";
import { Base, runOn, delegateCombine, String_$type, Array_$type, enumGetBox, EnumUtil, typeCast, fromEnum, delegateRemove, Point_$type, Date_$type, markType, markDep } from "igniteui-webcomponents-core";
import { Series } from "./Series";
import { CalloutPlacementPositionsCollection } from "./CalloutPlacementPositionsCollection";
import { HighlightedValueLabelMode_$type } from "igniteui-webcomponents-core";
import { AutoCalloutVisibilityMode_$type } from "./AutoCalloutVisibilityMode";
import { Brush } from "igniteui-webcomponents-core";
import { Thickness } from "igniteui-webcomponents-core";
import { CalloutCollisionMode_$type } from "igniteui-webcomponents-core";
import { FontUtil } from "igniteui-webcomponents-core";
import { Rect } from "igniteui-webcomponents-core";
import { BindingFormatter } from "igniteui-webcomponents-core";
import { CalloutLayerFrame } from "./CalloutLayerFrame";
import { Size } from "igniteui-webcomponents-core";
import { HashSet$1 } from "igniteui-webcomponents-core";
import { CalloutAnnotationWrapper } from "./CalloutAnnotationWrapper";
import { List$1 } from "igniteui-webcomponents-core";
import { LinkedList$1 } from "igniteui-webcomponents-core";
import { Dictionary$2 } from "igniteui-webcomponents-core";
import { LinkedListNode$1 } from "igniteui-webcomponents-core";
import { LabelCollisionManager } from "igniteui-webcomponents-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { CalloutAnnotation } from "./CalloutAnnotation";
import { IFastItemsSource_$type } from "igniteui-webcomponents-core";
import { DeviceUtils } from "igniteui-webcomponents-core";
import { CalloutLabelUpdatingEventArgs } from "./CalloutLabelUpdatingEventArgs";
import { CalloutSeriesSelectingEventArgs } from "./CalloutSeriesSelectingEventArgs";
import { CalloutStyleUpdatingEventArgs } from "./CalloutStyleUpdatingEventArgs";
import { BrushUtilCore } from "igniteui-webcomponents-core";
import { LabelCollisionInfo } from "igniteui-webcomponents-core";
import { BrushUtil } from "igniteui-webcomponents-core";
import { CalloutRenderStyleUpdatingEventArgs } from "./CalloutRenderStyleUpdatingEventArgs";
import { IHasCategoryAxis_$type } from "./IHasCategoryAxis";
import { QuadTreeBoundingBox } from "igniteui-webcomponents-core";
import { ScalerParams } from "./ScalerParams";
import { ViewportUtils } from "./ViewportUtils";
import { CalloutContentUpdatingEventArgs } from "./CalloutContentUpdatingEventArgs";
import { CalloutKey } from "./CalloutKey";
import { DataContext } from "igniteui-webcomponents-core";
import { HashPool$2 } from "igniteui-webcomponents-core";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-webcomponents-core";
import { isNaN_, isInfinity } from "igniteui-webcomponents-core";
import { stringIsNullOrEmpty } from "igniteui-webcomponents-core";
import { FastItemObjectColumn } from "igniteui-webcomponents-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { TextBlock } from "igniteui-webcomponents-core";
import { Color } from "igniteui-webcomponents-core";
import { Line } from "igniteui-webcomponents-core";
import { CalloutViewHelper } from "./CalloutViewHelper";
import { Rectangle } from "igniteui-webcomponents-core";
import { TranslateTransform } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
var CalloutLayer = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CalloutLayer, _super);
    function CalloutLayer() {
        var _this = _super.call(this) || this;
        _this.aa9 = true;
        _this.aga = new Size(1, 0, 0);
        _this.calloutStyleUpdating = null;
        _this.calloutRenderStyleUpdating = null;
        _this.aax = null;
        _this.aay = null;
        _this.aaz = null;
        _this.aaw = null;
        _this.aav = null;
        _this.abw = new HashSet$1(CalloutAnnotationWrapper.$, 0);
        _this.abz = new List$1(CalloutAnnotationWrapper.$, 0);
        _this.ab0 = new List$1(CalloutAnnotationWrapper.$, 0);
        _this.aam = null;
        _this.aaa = null;
        _this.aat = null;
        _this.abx = new LinkedList$1(CalloutAnnotationWrapper.$);
        _this.abu = new Dictionary$2(CalloutAnnotationWrapper.$, LinkedListNode$1.$.specialize(CalloutAnnotationWrapper.$), 0);
        _this.aa5 = null;
        _this.af8 = new Rect(0, 0, 0, 1, 1);
        _this.abc = false;
        _this.abe = false;
        _this.acf = 0;
        _this.af7 = Rect.empty;
        _this.abb = false;
        _this.abd = false;
        _this.calloutContentUpdating = null;
        _this.calloutLabelUpdating = null;
        _this.calloutSeriesSelecting = null;
        _this.aby = new List$1(SeriesPointOfInterest.$, 0);
        _this.abg = false;
        _this.abh = false;
        _this.ab2 = 0;
        _this.abf = false;
        _this.aad = null;
        _this.aba = true;
        _this.aae = 1;
        FastItemObjectColumn.m();
        _this.aaa = null;
        _this.aam = new CalloutPlacementPositionsCollection();
        var a = _this.aam;
        a.collectionChanged = delegateCombine(a.collectionChanged, runOn(_this, _this.aea));
        _this.xp = true;
        var b = new CalloutLayerFrame();
        var c = new CalloutLayerFrame();
        var d = new CalloutLayerFrame();
        var e = _this.ke / 1000;
        _this.xh = b;
        _this.xg = c;
        _this.xi = d;
        _this.ab = CalloutLayer.$;
        return _this;
    }
    CalloutLayer.prototype.bk = function () {
        return new CalloutLayer();
    };
    CalloutLayer.prototype.get_eq = function () {
        return true;
    };
    CalloutLayer.prototype.aea = function (a, b) {
        this.aej();
    };
    CalloutLayer.prototype.aej = function () {
        this.aaa = this.aac(this.aan);
        this.aeg();
    };
    CalloutLayer.prototype.aeb = function (a, b) {
        this.ab0.clear();
        this.ru(false);
    };
    CalloutLayer.prototype.pd = function (a, b, c, d) {
        _super.prototype.pd.call(this, a, b, c, d);
        var e = this.abv();
        switch (a) {
            case 3:
                this.aeq(b, e);
                break;
            case 1:
                for (var f = b; f < b + c; f++) {
                    var g = new CalloutAnnotation();
                    var h = new CalloutAnnotationWrapper();
                    h.b = g;
                    h.b.series = this.aas;
                    this.ab0.insert(f, h);
                    this.aeq(f, e);
                }
                break;
            case 0:
                this.ab0.v(b, c);
                break;
            case 2:
                for (var i = b; i < b + c; i++) {
                    this.aeq(i, e);
                }
                break;
            case 4:
                this.ab0.clear();
                for (var j = 0; j < this.dp.count; j++) {
                    var k = new CalloutAnnotation();
                    var l = new CalloutAnnotationWrapper();
                    l.b = k;
                    l.b.series = this.aas;
                    this.ab0.add(l);
                    this.aeq(j, e);
                }
                break;
        }
        this.ru(true);
    };
    CalloutLayer.prototype.gg = function (a) {
        return false;
    };
    CalloutLayer.prototype.agc = function () {
        var a = new Thickness(0, DeviceUtils.g(3));
        if (isNaN_(this.agb.left) || isNaN_(this.agb.top) || isNaN_(this.agb.right) || isNaN_(this.agb.bottom)) {
            a = new Thickness(0, DeviceUtils.g(3));
        }
        else {
            a = this.agb;
        }
        return a;
    };
    CalloutLayer.prototype.wy = function () {
        var a = 0;
        var b = 0;
        if (!this.abi) {
            return new Size(1, b, a);
        }
        if (!this.aa9) {
            return this.aga;
        }
        var c = "Ig";
        var d = this.agc();
        var e = this.aal.c7(c, d);
        if (!isNaN_(e.height)) {
            a = Math.max(e.height, a);
        }
        if (!isNaN_(this.acc)) {
            a += this.acc;
        }
        if (!isNaN_(this.acc)) {
            b += this.acc;
        }
        if (!isNaN_(this.ab6)) {
            a = Math.max(a, this.ab6);
        }
        if (!isNaN_(this.ab4)) {
            a = Math.min(a, this.ab4);
        }
        if (!isNaN_(this.ab7)) {
            b = Math.max(b, this.ab7);
        }
        if (!isNaN_(this.ab5)) {
            b = Math.min(b, this.ab5);
        }
        this.aa9 = false;
        this.aga = new Size(1, b, a);
        return this.aga;
    };
    CalloutLayer.prototype.abv = function () {
        var a = new Dictionary$2(String_$type, Series.$, 0);
        if (this.dc != null) {
            for (var b = 0; b < this.dc.series.count; b++) {
                var c = this.dc.series._inner[b];
                if (c.name != null && !a.containsKey(c.name)) {
                    a.addItem(c.name, c);
                }
            }
        }
        return a;
    };
    CalloutLayer.prototype.aeq = function (a, b) {
        var _this = this;
        if (this.aa4 == null || this.aa2 == null) {
            return;
        }
        var c = a;
        if (this.aa3 != null) {
            c = this.aa3.item(a);
        }
        var d = this.aa4.item(a);
        var e = this.aa2.item(a);
        var f = this.ab0._inner[a];
        if (this.aa1 != null) {
            if (f.b.ab != this.aa1.item(a)) {
                f.b.key = this.aa1.item(a);
            }
        }
        if (this.abu.containsKey(f)) {
            f.b = this.abu.item(f).c.b;
        }
        f.b.xValue = c;
        f.b.yValue = d;
        if (this.calloutLabelUpdating != null) {
            var g = ((function () {
                var $ret = new CalloutLabelUpdatingEventArgs();
                $ret.d = c;
                $ret.e = d;
                $ret.item = _this.dp.item(a);
                return $ret;
            })());
            this.calloutLabelUpdating(this, g);
            if (g.c != null && !Base.equalsStatic(g.c, f.b.ao)) {
                var h = g.c;
                if (this.aad != null) {
                    f.b.text = this.aad.i(h);
                }
                else {
                    f.b.text = h != null ? h.toString() : "";
                }
            }
        }
        else {
            if (this.aad != null) {
                f.b.text = this.aad.i(e);
            }
            else {
                f.b.text = e != null ? e.toString() : "";
            }
        }
        if (this.aa0 != null) {
            f.b.content = this.aa0.item(a);
        }
        else {
            f.b.content = this.dp.item(a);
        }
        if (this.calloutSeriesSelecting != null) {
            var i = ((function () {
                var $ret = new CalloutSeriesSelectingEventArgs();
                $ret.c = c;
                $ret.d = d;
                $ret.item = _this.dp.item(a);
                return $ret;
            })());
            this.calloutSeriesSelecting(this, i);
            if (i.a != null) {
                f.b.series = i.a;
            }
            else if (i.e != null) {
                if (b.containsKey(i.e)) {
                    f.b.series = b.item(i.e);
                }
            }
        }
        this.aer(f);
    };
    CalloutLayer.prototype.aer = function (a) {
        var b = new Thickness(0, DeviceUtils.g(3));
        if (isNaN_(this.agb.left) || isNaN_(this.agb.top) || isNaN_(this.agb.right) || isNaN_(this.agb.bottom)) {
            b = new Thickness(0, DeviceUtils.g(3));
        }
        else {
            b = this.agb;
        }
        var c = DeviceUtils.g(3);
        if (isNaN_(this.ab3)) {
            c = DeviceUtils.g(3);
        }
        else {
            c = this.ab3;
        }
        var d = this.af1 != null && !this.abq ? this.af1 : this.aal.c1(a.b.l, a.b.itemColor);
        var e = this.af6 != null ? this.af6 : null;
        var f = this.af4 != null ? this.af4 : this.aal.c4();
        var g = this.af2 != null ? this.af2 : this.aal.c2();
        var h = this.af5 != null && !this.abr ? this.af5 : this.aal.c5(a.b.l, a.b.itemColor);
        var i = this.af3 != null ? this.af3 : this.aal.c3(a.b.l, a.b.itemColor);
        var j = isNaN_(this.acd) ? 0 : this.acd;
        if (e == null && (this.abo || this.af4 != null || this.af2 != null)) {
            var k = d;
            if (k == null || BrushUtilCore.a(d)) {
                k = this.dc != null ? this.dc.vx : null;
                if (a.c != null && (a.c.b == 8 || a.c.b == 9)) {
                    k = a.b.itemColor;
                }
                if (k == null || BrushUtilCore.a(d)) {
                    k = BrushUtil.j(255, 255, 255, 255);
                }
            }
            e = BrushUtil.l(k, g, f);
        }
        if (e == null) {
            e = this.aal.c4();
        }
        if (this.abm && this.calloutStyleUpdating != null) {
            var l = new CalloutStyleUpdatingEventArgs();
            l.item = a.b.aa;
            l.xValue = a.b.ac;
            l.yValue = a.b.ad;
            l.series = a.b.l;
            l.background = d;
            l.textColor = e;
            l.outline = h;
            l.leaderBrush = i;
            l.strokeThickness = j;
            this.calloutStyleUpdating(this, l);
            d = l.background;
            e = l.textColor;
            h = l.outline;
            i = l.leaderBrush;
            j = l.strokeThickness;
        }
        a.b.backgroundPadding = b;
        a.b.backgroundCornerRadius = c;
        a.b.background = d;
        a.b.textColor = e;
        a.b.outline = h;
        a.b.leaderBrush = i;
        a.b.strokeThickness = j;
    };
    CalloutLayer.prototype.kr = function (a, b) {
        var c = this.nf(b);
        if (c == CalloutLayer.$$p[31]) {
            return this.ks(a, b, this.adp);
        }
        if (c == CalloutLayer.$$p[42]) {
            return this.ks(a, b, this.ad5);
        }
        if (c == CalloutLayer.$$p[43]) {
            return this.ks(a, b, this.ad8);
        }
        if (c == CalloutLayer.$$p[28]) {
            return this.ks(a, b, this.adj);
        }
        if (c == CalloutLayer.$$p[22]) {
            return this.ks(a, b, this.adb);
        }
        return _super.prototype.kr.call(this, a, b);
    };
    CalloutLayer.prototype.mf = function (a) {
        var b = this.nf(a);
        if (b == CalloutLayer.$$p[31]) {
            return this.adp;
        }
        if (b == CalloutLayer.$$p[42]) {
            return this.ad5;
        }
        if (b == CalloutLayer.$$p[43]) {
            return this.ad8;
        }
        if (b == CalloutLayer.$$p[28]) {
            return this.adj;
        }
        if (b == CalloutLayer.$$p[22]) {
            return this.adb;
        }
        return _super.prototype.mf.call(this, a);
    };
    Object.defineProperty(CalloutLayer.prototype, "aa2", {
        get: function () {
            return this.aax;
        },
        set: function (a) {
            if (this.aax != a) {
                var b = this.aax;
                this.aax = a;
                this.raisePropertyChanged("LabelColumn", b, this.aax);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "aa3", {
        get: function () {
            return this.aay;
        },
        set: function (a) {
            if (this.aay != a) {
                var b = this.aay;
                this.aay = a;
                this.raisePropertyChanged("XColumn", b, this.aay);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "aa4", {
        get: function () {
            return this.aaz;
        },
        set: function (a) {
            if (this.aaz != a) {
                var b = this.aaz;
                this.aaz = a;
                this.raisePropertyChanged("YColumn", b, this.aaz);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "aa1", {
        get: function () {
            return this.aaw;
        },
        set: function (a) {
            if (this.aaw != a) {
                var b = this.aaw;
                this.aaw = a;
                this.raisePropertyChanged("KeyColumn", b, this.aaw);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "aa0", {
        get: function () {
            return this.aav;
        },
        set: function (a) {
            if (this.aav != a) {
                var b = this.aav;
                this.aav = a;
                this.raisePropertyChanged("ContentColumn", b, this.aav);
            }
        },
        enumerable: false,
        configurable: true
    });
    CalloutLayer.prototype.aed = function (a, b) {
        if (b.propertyName == CalloutAnnotation.$$p[15] || b.propertyName == CalloutAnnotation.$$p[16]) {
            var c = a.k;
            if (!this.abw.contains(c)) {
                this.abw.add_1(c);
                this.abz.add(c);
                this.ru(false);
            }
        }
    };
    CalloutLayer.prototype.ct = function () {
        return new CalloutLayerView(this);
    };
    CalloutLayer.prototype.q3 = function (a) {
        _super.prototype.q3.call(this, a);
        this.aal = a;
    };
    Object.defineProperty(CalloutLayer.prototype, "aan", {
        get: function () {
            return this.aam;
        },
        set: function (a) {
            var b = this.aan;
            if (a != b) {
                this.aam = a;
                this.raisePropertyChanged("AllowedPositions", b, this.aan);
            }
        },
        enumerable: false,
        configurable: true
    });
    CalloutLayer.prototype.gv = function (a) {
        if (this.aas == null) {
            return true;
        }
        if (this.aas == a) {
            return true;
        }
        return false;
    };
    Object.defineProperty(CalloutLayer.prototype, "aag", {
        get: function () {
            return EnumUtil.getEnumValue(AutoCalloutVisibilityMode_$type, this.c(CalloutLayer.afd));
        },
        set: function (a) {
            this.h(CalloutLayer.afd, enumGetBox(AutoCalloutVisibilityMode_$type, a));
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "aaf", {
        get: function () {
            return this.aae;
        },
        set: function (a) {
            this.aae = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "agb", {
        get: function () {
            return new Thickness(1, this.ab9, this.acb, this.aca, this.ab8);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutLayer.prototype, "aau", {
        get: function () {
            if (this.aat == null) {
                this.aat = FontUtil.toFontInfo(this.j0, this.adv);
            }
            return this.aat;
        },
        enumerable: false,
        configurable: true
    });
    CalloutLayer.prototype.yw = function (a, b) {
        if (this.aas == null || this.aas == a) {
            if (!this.a1.c) {
                this.ru(b);
            }
        }
    };
    CalloutLayer.prototype.yy = function (a, b) {
        var e_1, _a;
        var _this = this;
        _super.prototype.yy.call(this, a, b);
        var c = a;
        c.q.clear();
        c.r.clear();
        c.n.clear();
        c.f.clear();
        c.i.clear();
        c.h.clear();
        c.k.clear();
        c.m.clear();
        c.l.clear();
        c.j.clear();
        c.g.clear();
        c.o.clear();
        c.p.clear();
        c.u.clear();
        c.v.clear();
        c.s.clear();
        c.t.clear();
        var d = this.ab1();
        var e = new List$1(CalloutAnnotationWrapper.$, 0);
        var f = Number.POSITIVE_INFINITY;
        var g = true;
        if (this.abj) {
            if (this.xn(this.aas)) {
                if (typeCast(IHasCategoryAxis_$type, this.aas) !== null) {
                    var h = this.aas.ix() > 0 ? this.aas.ix() : this.aas.getCategoryWidth();
                    if (!isNaN_(h) && !isInfinity(h) && h > 0) {
                        f = Math.min(f, h);
                    }
                }
                this.ael(this.aas, c, e);
            }
            else {
                try {
                    for (var _b = __values(fromEnum(this.dc.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                        var i = _c.value;
                        if (this.xn(i)) {
                            if (typeCast(IHasCategoryAxis_$type, i) !== null) {
                                var j = i.ix() > 0 ? i.ix() : i.getCategoryWidth();
                                if (!isNaN_(j) && !isInfinity(j) && j > 0) {
                                    f = Math.min(f, j);
                                }
                            }
                            if (!i.eu) {
                                if (!i.isVertical) {
                                    g = false;
                                }
                            }
                            var k = false;
                            if (i.ei && this.aar == 0 || this.aar == 3 || this.aar == 2) {
                                if (this.aar == 0 || this.aar == 2) {
                                    k = true;
                                }
                                i.p3(function (l) {
                                    _this.ael(l, c, e);
                                    return true;
                                });
                            }
                            if (!k) {
                                this.ael(i, c, e);
                            }
                        }
                    }
                }
                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 (this.abj && this.aaf == 2) {
            var l = 0;
            var m = 0;
            var n = 1.7976931348623157E+308;
            var o = 1.7976931348623157E+308;
            var p = -1.7976931348623157E+308;
            var q = -1.7976931348623157E+308;
            if (e.count > 0) {
                if (e._inner[0].c != null) {
                    l = e._inner[0].e;
                    m = e._inner[0].f;
                }
                for (var r = 0; r < e.count; r++) {
                    var s = e._inner[r];
                    if (s.c != null) {
                        var t = s.e;
                        var u = s.f;
                        if (t != l) {
                            n = Math.min(n, Math.abs(t - l));
                        }
                        if (u != m) {
                            o = Math.min(o, Math.abs(u - m));
                        }
                        p = Math.max(s.c.p + s.c.p, p);
                        q = Math.max(s.c.o + s.c.o, q);
                    }
                }
                if (g) {
                    if (!isNaN_(f) && !isInfinity(f)) {
                        if (q > f) {
                            e.clear();
                        }
                    }
                    else {
                        if (q > o) {
                            e.clear();
                        }
                    }
                }
                else {
                    if (!isNaN_(f) && !isInfinity(f)) {
                        if (p > f) {
                            e.clear();
                        }
                    }
                    else {
                        if (p > n) {
                            e.clear();
                        }
                    }
                }
            }
        }
        this.aek(c, d, e);
    };
    CalloutLayer.prototype.sv = function (a, b) {
        _super.prototype.sv.call(this, a, b);
        var c = b.width - this.af8.width;
        var d = b.height - this.af8.height;
        var e = 0;
        if (Math.abs(c) > Math.abs(d)) {
            e = c;
            this.ab2 = c * this.wx.width;
        }
        else {
            e = d;
            this.ab2 = d * this.wx.height;
        }
        if (e > 0 && this.ab2 > 5) {
            this.abh = true;
        }
        if (e < 0 && this.ab2 > 5) {
            this.abg = true;
        }
    };
    CalloutLayer.prototype.su = function (a, b) {
        _super.prototype.su.call(this, a, b);
        if (!a.equals1(b)) {
            this.abf = true;
        }
    };
    Object.defineProperty(CalloutLayer.prototype, "af9", {
        get: function () {
            return this.af7;
        },
        set: function (a) {
            this.af7 = a;
        },
        enumerable: false,
        configurable: true
    });
    CalloutLayer.prototype.aek = function (a, b, c) {
        var e_2, _a;
        if (this.dc != null) {
            this.af8 = this.dc.wh;
        }
        if (this.wx.isEmpty) {
            return;
        }
        this.af9 = new Rect(0, this.wx.left, this.wx.top, this.wx.width, this.wx.height);
        if (this.aa5 != null && this.ac8 != null && this.ac8 != this.aa5.bd) {
            this.aef();
        }
        if (this.aa5 != null && this.aa5.j != this.aa7()) {
            this.aef();
        }
        if (this.aa5 == null) {
            var d = this.aa6();
            if (d != null) {
                this.aa5 = d;
                var e = this.aa5;
                e.labelsMoved = delegateCombine(e.labelsMoved, runOn(this, this.aec));
            }
            else {
                var f = this.wo(this.cw);
                var g = new Array(2);
                g[0] = 0;
                g[1] = 3;
                if (this.aas != null) {
                    if (this.aas.isVertical) {
                        g = new Array(2);
                        g[0] = 2;
                        g[1] = 1;
                    }
                }
                else {
                    var h = false;
                    if (this.dc != null && this.dc.series.count > 0) {
                        h = true;
                        try {
                            for (var _b = __values(fromEnum(this.dc.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                                var i = _c.value;
                                if (!i.eu) {
                                    if (!i.isVertical) {
                                        h = false;
                                    }
                                }
                            }
                        }
                        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;
                            }
                        }
                    }
                    if (h) {
                        g = new Array(2);
                        g[0] = 2;
                        g[1] = 1;
                    }
                }
                if (this.aai == 4 || this.aai == 6) {
                    g = new Array(4);
                    g[0] = 10;
                    g[1] = 11;
                    g[2] = 8;
                    g[3] = 9;
                }
                if (this.aai == 5) {
                    g = new Array(4);
                    g[0] = 9;
                    g[1] = 10;
                    g[2] = 11;
                    g[3] = 8;
                }
                if (this.aai == 7) {
                    g = new Array(4);
                    g = new Array(4);
                    g[0] = 8;
                    g[1] = 10;
                    g[2] = 11;
                    g[3] = 9;
                }
                this.aa5 = new LabelCollisionManager(this.wx.right, this.wx.bottom, this.wx, this.aal.k(), this.acc, this.aa7(), g, this.acj(), this.aci(), this.abk, this.aaa);
                this.aa5.v = this.abn;
                if (this.ac8 != null) {
                    this.aa5.bd = this.ac8;
                    this.aa5.bb = this;
                }
                var j = this.aa5;
                j.labelsMoved = delegateCombine(j.labelsMoved, runOn(this, this.aec));
            }
        }
        if (this.abg) {
            this.abg = false;
            if (this.aa5.a9 > 2) {
                this.abe = true;
            }
        }
        if (this.abh) {
            this.abh = false;
            if (this.ab2 > 5) {
                this.abe = true;
            }
        }
        if (this.abf) {
            this.abf = false;
            this.aa5.bs(this.wx.right, this.wx.bottom, this.wx);
            this.abe = true;
        }
        var k = new HashSet$1(CalloutAnnotationWrapper.$, 0);
        var l = new HashSet$1(CalloutAnnotationWrapper.$, 0);
        var m = new List$1(CalloutAnnotationWrapper.$, 0);
        var n = new List$1(CalloutAnnotationWrapper.$, 0);
        var o = new HashSet$1(CalloutAnnotationWrapper.$, 0);
        for (var p = 0; p < b.count; p++) {
            o.add_1(b._inner[p]);
        }
        for (var q = 0; q < c.count; q++) {
            o.add_1(c._inner[q]);
        }
        var r = this.abx.c;
        while (r != null) {
            var s = r.a;
            if (!o.contains(r.c)) {
                n.add(r.c);
                l.add_1(r.c);
                var t = r.c.b;
                t.propertyChanged = delegateRemove(t.propertyChanged, runOn(this, this.aed));
                this.abx.h(r);
                this.abu.removeItem(r.c);
                this.aa5.br(r.c.c);
            }
            r = s;
        }
        for (var u = 0; u < b.count; u++) {
            if (!this.abu.containsKey(b._inner[u])) {
                this.abx.f(b._inner[u]);
                var v = b._inner[u].b;
                v.propertyChanged = delegateCombine(v.propertyChanged, runOn(this, this.aed));
                this.abu.addItem(b._inner[u], this.abx.d);
                m.add(b._inner[u]);
                k.add_1(b._inner[u]);
                this.abe = true;
            }
        }
        for (var w = 0; w < c.count; w++) {
            if (!this.abu.containsKey(c._inner[w])) {
                this.abx.f(c._inner[w]);
                this.abu.addItem(c._inner[w], this.abx.d);
                var x = c._inner[w].b;
                x.propertyChanged = delegateCombine(x.propertyChanged, runOn(this, this.aed));
                m.add(c._inner[w]);
                k.add_1(c._inner[w]);
                this.abe = true;
            }
        }
        if (this.abb == true) {
            this.abb = false;
            this.abe = true;
        }
        var y = false;
        if (this.abz.count > 0) {
            y = true;
            this.abz.clear();
            this.abw.clear();
        }
        r = this.abx.c;
        while (r != null) {
            var z = this.aa8(r.c);
            if (z == null) {
                return;
            }
            if (!Base.equalsStatic(z, r.c.c.e)) {
                var aa = false;
                if (r.c.c.e == null) {
                    aa = true;
                }
                var ab = r.c.c;
                ab.s = z.d;
                ab.t = z.e;
                if (!isNaN_(ab.s) && !isNaN_(ab.t)) {
                    ab.r = z.g;
                    ab.q = z.f;
                    if (ab.c == null) {
                        this.aa5.ad(ab, false);
                    }
                    if (aa) {
                        this.aa5.be(ab);
                    }
                    else {
                        this.aa5.bo(ab);
                    }
                }
            }
            r = r.a;
        }
        var ac = this.aa5.ba();
        var ad = this.aa5.af();
        if (!this.abe && y && (ac != 0 || ad)) {
            {
                this.abe = true;
            }
        }
        if (ad) {
            if (this.aa5.x()) {
                this.abe = true;
            }
        }
        if (this.abe && (ac != 0 || ad || this.abc)) {
            this.abc = false;
            this.abe = false;
            this.acf = 0x7FFFFFFF;
            if (this.ac8 != null) {
                var ae = true;
                for (var af = 0; af < this.dc.series.count; af++) {
                    var ag = this.dc.series._inner[af];
                    if (ag.eu && typeCast(CalloutLayer.$, ag) !== null) {
                        var ah = ag;
                        if (ah.ac8 == this.ac8) {
                            if (!ah.af9.equals1(this.aa5.b0)) {
                                ae = false;
                                break;
                            }
                        }
                    }
                }
                if (ae) {
                    this.aa5.bv();
                }
                else {
                    this.aa5.bf();
                    this.aa5.bg();
                }
            }
            else {
                this.aa5.bv();
            }
        }
        else {
            this.aa5.bg();
        }
        var ai = this.abx.c;
        var aj;
        var ak;
        var al;
        var am;
        var an;
        var ao;
        var ap;
        var aq;
        var ar;
        var as;
        var at;
        var au;
        var av;
        var aw;
        var ax;
        var ay;
        var az = this.abl;
        var a0 = this.abn;
        var a1 = this.cw.b5();
        while (ai != null) {
            var a2 = ai.c;
            var a3 = a2.b;
            aj = a3.bm;
            ak = a3.bp;
            al = a3.bo;
            am = a3.backgroundPadding.left;
            an = a3.backgroundPadding.top;
            ao = a3.backgroundPadding.right;
            ap = a3.backgroundPadding.bottom;
            ar = a3.backgroundCornerRadius;
            aq = a3.y;
            as = a3.bq;
            at = a3.ao;
            au = a3.aa;
            var a4 = a2.c;
            av = a4.s - (a4.k - a4.p);
            aw = a4.t - (a4.l - a4.o);
            ax = a4.k - a4.p;
            ay = a4.l - a4.o;
            var a5 = false;
            if (a0) {
                if (a4.c != null && this.aa5.ab(a4.c)) {
                    a5 = true;
                }
            }
            if (a2.c.h && !a5) {
                av = NaN;
                aw = NaN;
            }
            if (!a2.c.h && (a2.c.b == 8 || a2.c.b == 9)) {
                al = a1;
                av = a4.k;
                aw = a4.l;
            }
            if (a5) {
                at = this.adx(a2, at);
                var a6 = this.aa5.as(a2.c.c);
                if (a6 > 0) {
                    ax += a6;
                    av -= a6;
                }
            }
            if (az) {
                var a7 = new CalloutRenderStyleUpdatingEventArgs();
                a7.background = aj;
                a7.outline = ak;
                a7.leaderBrush = al;
                a7.strokeThickness = aq;
                a7.textColor = as;
                a7.item = au;
                a7.series = a3.l;
                a7.actualPosition = a4.b;
                a7.xValue = a3.ac;
                a7.yValue = a3.ad;
                if (this.calloutRenderStyleUpdating != null) {
                    this.calloutRenderStyleUpdating(this, a7);
                    aj = a7.background;
                    ak = a7.outline;
                    al = a7.leaderBrush;
                    aq = a7.strokeThickness;
                    as = a7.textColor;
                }
            }
            a.n.add1(a2);
            a.f.add(aj);
            a.i.add(ak);
            a.h.add(al);
            a.k.add(am);
            a.m.add(an);
            a.l.add(ao);
            a.j.add(ap);
            a.g.add(ar);
            a.o.add(aq);
            a.p.add(as);
            a.q.add1(at);
            a.r.add1(au);
            a.u.add(av);
            a.v.add(aw);
            a.s.add(ax);
            a.t.add(ay);
            ai = ai.a;
        }
    };
    CalloutLayer.prototype.adx = function (a, b) {
        var c = Math.max(this.aa5.as(a.c.c), this.aa5.at(a.c.c));
        if (c <= 0) {
            return b;
        }
        var d = b.length;
        var e = this.aal.c7(b, a.b.backgroundPadding);
        var f = e.width;
        var g = f - c;
        while (f - g > 0.0001 && d > 0) {
            d--;
            b = b.substr(0, d) + "…";
            e = this.aal.c7(b, a.b.backgroundPadding);
            f = e.width;
        }
        return b;
    };
    CalloutLayer.prototype.aef = function () {
        if (this.aa5 != null) {
            var a = this.abx.c;
            while (a != null) {
                var b = a.c.c;
                if (b != null) {
                    this.aa5.br(b);
                }
                a = a.a;
            }
            var c = this.aa5;
            c.labelsMoved = delegateRemove(c.labelsMoved, runOn(this, this.aec));
            this.aa5 = null;
        }
        this.aee();
    };
    CalloutLayer.prototype.aa6 = function () {
        if (this.dc == null) {
            return null;
        }
        for (var a = 0; a < this.dc.series.count; a++) {
            var b = this.dc.series._inner[a];
            if (b.eu && typeCast(CalloutLayer.$, b) !== null) {
                var c = b;
                if (c != this) {
                    if (c.ac8 != null && c.ac8 == this.ac8) {
                        if (c.aa5 != null) {
                            return c.aa5;
                        }
                    }
                }
            }
        }
        return null;
    };
    CalloutLayer.prototype.aci = function () {
        return 20000;
    };
    CalloutLayer.prototype.acj = function () {
        return 300;
    };
    CalloutLayer.prototype.aa7 = function () {
        switch (this.aai) {
            case 0: return 2;
            case 2: return 1;
            case 3: return 2;
            case 1: return 0;
            case 4: return 3;
            case 7: return 7;
            case 5: return 5;
            case 6: return 6;
        }
        return 2;
    };
    CalloutLayer.prototype.aec = function (a) {
        var b = this.aa5.ba();
        var c = this.acf;
        if (b < this.acf) {
            this.acf = b;
            if (c != 0x7FFFFFFF) {
                this.ru(false);
            }
        }
    };
    CalloutLayer.prototype.aa8 = function (a) {
        var b = this.aas;
        if (a.b.l != null) {
            b = a.b.l;
        }
        if (b == null) {
            for (var c = 0; c < this.dc.series.count; c++) {
                var d = this.dc.series._inner[c];
                if (!d.eu) {
                    b = d;
                    break;
                }
            }
        }
        if (b == null) {
            return null;
        }
        var e = b.ai();
        var f = b.iz();
        var g = null;
        var h = null;
        var i = false;
        for (var j = 0; j < e.length; j++) {
            if (e[j] == null) {
                continue;
            }
            if (e[j].b9) {
                i = true;
                g = e[j];
            }
            else if (e[j].cm) {
                i = true;
                h = e[j];
            }
            else if (e[j].cp) {
                h = e[j];
            }
            else {
                g = e[j];
            }
        }
        if (g == null || h == null) {
            return null;
        }
        if (!g.co() || !h.co()) {
            return null;
        }
        var k = 0;
        var l = 0;
        if (g.cb && g.categoryMode != 0) {
            if (b.e8) {
                k = b.getOffsetValue();
            }
            else if (b.e0) {
                k = b.getOffsetValue();
            }
        }
        if (h.cb && h.categoryMode != 0) {
            if (b.e0) {
                l = b.getOffsetValue();
            }
        }
        var m = new ScalerParams(0, this.dc.wh, g.kh, g.ch, g.kc());
        m.b = f;
        var n = new ScalerParams(0, this.dc.wh, h.kh, h.ch, h.kc());
        n.b = f;
        var o = 0;
        var p = 0;
        if (i) {
            o = g.el(this.ace(a.b.ac), m) + k;
            p = h.el(this.ace(a.b.ad), n) + l;
            var q = o;
            var r = p;
            var s = { $type: Point_$type, x: 0.5, y: 0.5 };
            var t = s.x + (r * Math.cos(q));
            o = ViewportUtils.e(t, m.e, m.d, m.c);
            var u = s.y + (r * Math.sin(q));
            p = ViewportUtils.i(u, n.e, n.d, n.c);
        }
        else {
            o = g.el(this.ace(a.b.ac), m) + k;
            p = h.el(this.ace(a.b.ad), n) + l;
        }
        var v = new QuadTreeBoundingBox();
        v.d = o;
        v.e = p;
        v.g = 3;
        v.f = 3;
        v.i = a.b;
        return v;
    };
    CalloutLayer.prototype.ace = function (a) {
        if (typeCast(Date_$type, a) !== null) {
            return a.getTime();
        }
        if (a == null) {
            return 0;
        }
        return a;
    };
    CalloutLayer.prototype.ab1 = function () {
        var a = new List$1(CalloutAnnotationWrapper.$, 0);
        for (var b = 0; b < this.ab0.count; b++) {
            if (stringIsNullOrEmpty(this.ab0._inner[b].b.ao)) {
                continue;
            }
            if (this.ab0._inner[b].c == null) {
                var c = new LabelCollisionInfo();
                this.ab0._inner[b].c = c;
                var d = this.aal.c7(this.ack(this.ab0._inner[b]), this.ab0._inner[b].b.backgroundPadding);
                c.o = d.height / 2;
                c.p = d.width / 2;
            }
            var e = this.aa8(this.ab0._inner[b]);
            if (e == null || e.d < this.wx.left || e.d > this.wx.right || e.e < this.wx.top || e.e > this.wx.bottom) {
                continue;
            }
            a.add(this.ab0._inner[b]);
        }
        return a;
    };
    CalloutLayer.prototype.ack = function (a) {
        return a.b.ao;
    };
    CalloutLayer.prototype.xn = function (a) {
        if (!_super.prototype.xn.call(this, a)) {
            return false;
        }
        if (this.ads != null) {
            if (a.isFragment) {
                var b = a.ne();
                if (!Base.equalsStatic(this.ads, b)) {
                    return false;
                }
            }
            else {
                if (!Base.equalsStatic(this.ads, a.name)) {
                    return false;
                }
            }
        }
        return true;
    };
    CalloutLayer.prototype.qr = function () {
        _super.prototype.qr.call(this);
        if (!this.a1.c && !this.d4()) {
            return;
        }
        if (this.aba) {
            this.aba = false;
            this.aem();
            this.aeh();
        }
        if (this.d4()) {
            this.aep(this.xi, false);
        }
        else {
            this.aep(this.xg, false);
        }
    };
    CalloutLayer.prototype.aei = function () {
        if (!this.abd) {
            this.abd = true;
            this.ru(true);
        }
    };
    CalloutLayer.prototype.ael = function (a, b, c) {
        var d = false;
        if (this.abd) {
            this.abd = false;
            d = true;
        }
        a.kj = this.aad;
        if (!a.gj && a.ed(this.aby, this.abt, this.abp, this.acg, false)) {
            var e = this.aby;
            var _loop_1 = function (f) {
                var g = e._inner[f];
                var h = g.b != null ? g.b.item : null;
                var i = g.b.item != null ? g.b.item : g.b;
                var j = g.g;
                var k = a;
                var l = new CalloutKey(i, k);
                var m = new CalloutAnnotationWrapper();
                var n = new CalloutAnnotation();
                m.b = n;
                n.key = l;
                var o = false;
                if (this_1.abu.containsKey(m)) {
                    m = this_1.abu.item(m).c;
                    n = m.b;
                    o = d;
                }
                else {
                    o = true;
                }
                var p = n.ac;
                var q = n.ad;
                if (this_1.ace(p) != this_1.ace(g.d) && (!isNaN_(this_1.ace(p)) || !isNaN_(this_1.ace(g.d)))) {
                    n.xValue = g.d;
                }
                if (this_1.ace(q) != this_1.ace(g.e) && (!isNaN_(this_1.ace(q)) || !isNaN_(this_1.ace(g.e)))) {
                    n.yValue = g.e;
                }
                n.itemColor = j;
                n.series = a;
                var r = false;
                if (g.f != n.az) {
                    n.az = g.f;
                    r = true;
                }
                if (o || r) {
                    if (this_1.calloutLabelUpdating != null) {
                        var s = ((function () {
                            var $ret = new CalloutLabelUpdatingEventArgs();
                            $ret.d = n.ac;
                            $ret.e = n.ad;
                            $ret.item = h;
                            $ret.a = a;
                            $ret.f = a.name;
                            return $ret;
                        })());
                        this_1.calloutLabelUpdating(this_1, s);
                        if (s.c != null && !Base.equalsStatic(s.c, m.b.ao)) {
                            var t = s.c;
                            if (this_1.aad != null) {
                                m.b.text = this_1.aad.i(t);
                            }
                            else {
                                m.b.text = t != null ? t.toString() : "";
                            }
                        }
                    }
                    else {
                        if (g.f != null) {
                            n.text = g.f;
                        }
                    }
                }
                if (n.ao == null) {
                    return "continue";
                }
                if (o || r) {
                    if (this_1.calloutContentUpdating != null) {
                        var u = ((function () {
                            var $ret = new CalloutContentUpdatingEventArgs();
                            $ret.c = n.ac;
                            $ret.d = n.ad;
                            $ret.item = h;
                            $ret.a = i;
                            return $ret;
                        })());
                        this_1.calloutContentUpdating(this_1, u);
                        if (u.a != null && u.a != m.b.aa) {
                            m.b.content = u.a;
                        }
                    }
                    else {
                        if (i != null && i != m.b.aa) {
                            m.b.content = i;
                        }
                    }
                }
                if (o) {
                    this_1.aer(m);
                }
                if (m.c == null) {
                    var v = new LabelCollisionInfo();
                    m.c = v;
                    var w = this_1.aal.c7(this_1.ack(m), m.b.backgroundPadding);
                    v.o = w.height / 2;
                    v.p = w.width / 2;
                }
                var x = this_1.aa8(m);
                if (x == null || x.d < this_1.wx.left || x.d > this_1.wx.right || x.e < this_1.wx.top || x.e > this_1.wx.bottom) {
                    return "continue";
                }
                m.e = x.d;
                m.f = x.e;
                if (g.a != null) {
                    m.c.a = g.a;
                }
                c.add(m);
            };
            var this_1 = this;
            for (var f = 0; f < this.aby.count; f++) {
                _loop_1(f);
            }
        }
        a.kj = null;
    };
    CalloutLayer.prototype.b3 = function () {
        return 1;
    };
    CalloutLayer.prototype.a2 = function (a, b) {
        var c = this.aa5.i(a, b);
        if (c == null) {
            return null;
        }
        return c.y;
    };
    CalloutLayer.prototype.gx = function (a, b) {
        if (this.aa5 == null) {
            return false;
        }
        return this.aa5.i(a, b) != null;
    };
    CalloutLayer.prototype.aep = function (a, b) {
        var e_3, _a;
        var c = 0;
        var d = new HashSet$1(CalloutAnnotationWrapper.$, 0);
        for (c = 0; c < a.q.count; c++) {
            var e = a.n._inner[c];
            if (isNaN_(a.u._inner[c]) || isNaN_(a.v._inner[c])) {
                continue;
            }
            var f = this.aal.cr.item(e);
            d.add_1(e);
            if (f.h != a.q._inner[c]) {
                f.h = a.q._inner[c];
                var g = f.u();
            }
            f.e = a.o._inner[c];
            f.m = a.f._inner[c];
            f.p = a.p._inner[c];
            f.o = f.e > 0 ? a.i._inner[c] : this.cw.b5();
            f.n = a.h._inner[c];
            f.x = new Thickness(1, a.k._inner[c], a.m._inner[c], a.l._inner[c], a.j._inner[c]);
            f.d = a.g._inner[c];
            this.aal.cz(f, Math.min(a.s._inner[c], a.s._inner[c] + a.u._inner[c]), Math.min(a.t._inner[c], a.t._inner[c] + a.v._inner[c]));
            this.aal.c0(f, e, a.r._inner[c]);
            f.r = { $type: Point_$type, x: a.u._inner[c], y: a.v._inner[c] };
        }
        var h = new List$1(CalloutAnnotationWrapper.$, 0);
        try {
            for (var _b = __values(fromEnum(this.aal.cr.c)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var i = _c.value;
                if (!d.contains(i)) {
                    h.add(i);
                }
            }
        }
        catch (e_3_1) {
            e_3 = { error: e_3_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_3)
                    throw e_3.error;
            }
        }
        for (var j = 0; j < h.count; j++) {
            this.aal.cr.h(h._inner[j]);
        }
    };
    CalloutLayer.prototype.y1 = function (a, b) {
        _super.prototype.y1.call(this, a, b);
        if (this.d4()) {
            this.aep(this.xi, true);
        }
        else {
            this.aep(this.xg, false);
        }
    };
    CalloutLayer.prototype.gb = function () {
        return true;
    };
    CalloutLayer.prototype.rc = function (a, b, c, d) {
        _super.prototype.rc.call(this, a, b, c, d);
        switch (b) {
            case CalloutLayer.$$p[35]:
                this.aat = null;
                this.aal.cy();
                this.ru(true);
                break;
            case CalloutLayer.$$p[33]:
            case CalloutLayer.$$p[34]:
                this.ru(true);
                break;
            case CalloutLayer.$$p[29]:
            case CalloutLayer.$$p[30]:
                if (this.adm != null) {
                    this.aad = new BindingFormatter();
                    this.aad.j = this.adm;
                    this.aad.d = this.aab;
                }
                else {
                    this.aad = null;
                }
                break;
            case CalloutLayer.$$p[21]:
            case CalloutLayer.$$p[23]:
                this.ru(true);
                break;
            case "SeriesViewer":
                if (c != null) {
                    var e = c;
                    e.seriesAnimating = delegateRemove(e.seriesAnimating, runOn(this, this.aeo));
                }
                if (d != null) {
                    var f = d;
                    f.seriesAnimating = delegateCombine(f.seriesAnimating, runOn(this, this.aeo));
                }
                if (d == null) {
                    this.aef();
                }
                break;
            case "AutoCalloutVisibilityMode":
                this.aaf = this.aah();
                this.aeg();
                break;
            case "AllowedPositions":
                if (c != null) {
                    var g = c;
                    g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.aea));
                }
                if (d != null) {
                    var h = d;
                    h.collectionChanged = delegateCombine(h.collectionChanged, runOn(this, this.aea));
                }
                this.aaa = this.aac(this.aan);
                this.aeg();
                break;
            case CalloutLayer.$$p[24]:
            case CalloutLayer.$$p[25]:
            case CalloutLayer.$$p[1]:
            case CalloutLayer.$$p[13]:
            case CalloutLayer.$$p[11]:
            case CalloutLayer.$$p[37]:
            case CalloutLayer.$$p[40]:
            case CalloutLayer.$$p[27]:
            case CalloutLayer.$$p[26]:
            case CalloutLayer.$$p[15]:
            case CalloutLayer.$$p[17]:
            case CalloutLayer.$$p[16]:
            case CalloutLayer.$$p[14]:
            case "Visibility":
            case CalloutLayer.$$p[18]:
            case CalloutLayer.$$p[5]:
            case CalloutLayer.$$p[8]:
            case CalloutLayer.$$p[6]:
            case CalloutLayer.$$p[9]:
            case CalloutLayer.$$p[7]:
                this.aa9 = true;
                this.aeg();
                break;
            case CalloutLayer.$$p[19]:
            case CalloutLayer.$$p[20]:
            case CalloutLayer.$$p[2]:
                this.aeg();
                break;
            case CalloutLayer.$$p[32]:
                this.aeg();
                if (this.aa5 != null) {
                    this.aa5.v = d;
                }
                break;
            case CalloutLayer.$$p[31]:
                if (this.dp != null) {
                    this.dp.deregisterColumn(this.aa2);
                    this.aa2 = this.dn(this.adp);
                }
                break;
            case "LabelColumn":
                this.aeg();
                break;
            case CalloutLayer.$$p[22]:
                if (this.dp != null) {
                    this.dp.deregisterColumn(this.aa0);
                    this.aa0 = this.dn(this.adb);
                }
                break;
            case "ContentColumn":
                this.aeg();
                break;
            case CalloutLayer.$$p[42]:
                if (this.dp != null) {
                    this.dp.deregisterColumn(this.aa3);
                    this.aa3 = stringIsNullOrEmpty(this.ad5) == false ? this.dn(this.ad5) : null;
                }
                break;
            case "XColumn":
                this.aeg();
                break;
            case CalloutLayer.$$p[43]:
                if (this.dp != null) {
                    this.dp.deregisterColumn(this.aa4);
                    this.aa4 = this.dn(this.ad8);
                }
                break;
            case "YColumn":
                this.aeg();
                break;
            case CalloutLayer.$$p[28]:
                if (this.dp != null) {
                    this.dp.deregisterColumn(this.aa1);
                    this.aa1 = this.dn(this.adj);
                }
                break;
            case "KeyColumn":
                this.aeg();
                break;
            case "FastItemsSource":
                this.abb = true;
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.aa2);
                    c.deregisterColumn(this.aa0);
                    c.deregisterColumn(this.aa3);
                    c.deregisterColumn(this.aa4);
                    c.deregisterColumn(this.aa1);
                    this.aa2 = null;
                    this.aa0 = null;
                    this.aa3 = null;
                    this.aa4 = null;
                    this.aa1 = null;
                    this.ab0.clear();
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.aa2 = this.dn(this.adp);
                    this.aa0 = this.dn(this.adb);
                    if (stringIsNullOrEmpty(this.ad5) == false) {
                        this.aa3 = this.dn(this.ad5);
                    }
                    this.aa4 = this.dn(this.ad8);
                    this.aa1 = this.dn(this.adj);
                }
                this.aeg();
                break;
        }
    };
    CalloutLayer.prototype.aah = function () {
        if (this.aag == 0) {
            return 1;
        }
        return this.aag;
    };
    CalloutLayer.prototype.aac = function (a) {
        if (a == null || a.count == 0) {
            return null;
        }
        var b = new Array(a.count);
        for (var c = 0; c < a.count; c++) {
            b[c] = a._inner[c];
        }
        return b;
    };
    CalloutLayer.prototype.aeo = function (a) {
        if (a.eu) {
            return;
        }
        if ((a == this.aas || this.aas == null) && this.abj) {
            this.ru(false);
        }
    };
    CalloutLayer.prototype.aeg = function () {
        if (this.aba == false) {
            this.aba = true;
            this.ru(false);
        }
    };
    CalloutLayer.prototype.ax = function (a, b, c) {
        var d = this.getEffectiveViewport();
        var e = this.dc.wz;
        var f = this.wy();
        var g = 0;
        if (b.cp) {
            var h = new ScalerParams(0, c, e, !b.ch, d);
            var i = b.eo(0, h);
            var j = b.eo(f.height, h);
            g = Math.abs(j - i);
            return new AxisRange(a.c - g, a.b + g);
        }
        else {
            var k = new ScalerParams(0, c, e, b.ch, d);
            var l = b.eo(0, k);
            var m = b.eo(f.width, k);
            g = Math.abs(m - l);
            return new AxisRange(a.c - g, a.b + g);
        }
    };
    CalloutLayer.prototype.aem = function () {
        var e_4, _a;
        if (!this.abi) {
            return;
        }
        if (this.da == null) {
            return;
        }
        var a = this.da.series;
        if (a == null) {
            return;
        }
        var b = this.da.axes;
        if (b == null) {
            return;
        }
        try {
            for (var _b = __values(fromEnum(b)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                c.hl();
                c.c2(true);
            }
        }
        catch (e_4_1) {
            e_4 = { error: e_4_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_4)
                    throw e_4.error;
            }
        }
    };
    CalloutLayer.prototype.aee = function () {
        this.aal.cr.clear();
        this.abx.g();
        this.abu.clear();
    };
    CalloutLayer.prototype.aeh = function () {
        if (this.aa4 == null || this.aa2 == null) {
            var a = this.abx.c;
            while (a != null) {
                this.aer(a.c);
                a = a.a;
            }
            return;
        }
        var b = this.abv();
        for (var c = 0; c < this.aa4.count; c++) {
            var d = void 0;
            if (this.ab0.count <= c) {
                var e = new CalloutAnnotation();
                d = new CalloutAnnotationWrapper();
                d.b = e;
                d.b.series = this.aas;
                this.ab0.add(d);
            }
            else {
                d = this.ab0._inner[c];
            }
            this.aeq(c, b);
        }
    };
    CalloutLayer.prototype.aen = function () {
        this.abc = true;
        this.abe = true;
        this.aeg();
    };
    CalloutLayer.$t = markType(CalloutLayer, 'CalloutLayer', AnnotationLayer.$);
    CalloutLayer.afd = DependencyProperty.i("AutoCalloutVisibilityMode", AutoCalloutVisibilityMode_$type, CalloutLayer.$, new PropertyMetadata(2, enumGetBox(AutoCalloutVisibilityMode_$type, 0), function (a, b) { return a.raisePropertyChanged("AutoCalloutVisibilityMode", b.oldValue, b.newValue); }));
    CalloutLayer.$$p = markDep(DependencyProperty, PropertyMetadata, CalloutLayer, 'raisePropertyChanged', ['AutoCalloutLabelPrecision:acg:aes', [1, 5], 'CalloutBackground:af1:aet', [Brush.$, null], 'CalloutCollisionMode:aai:aeu', [CalloutCollisionMode_$type, enumGetBox(CalloutCollisionMode_$type, 3)], 'CalloutCornerRadius:ab3:aev', [1, NaN], 'CalloutDarkTextColor:af2:aew', [Brush.$, null], 'CalloutExpandsAxisBufferEnabled:abi:aex', [0, false], 'CalloutExpandsAxisBufferMaxHeight:ab4:aey', [1, 400], 'CalloutExpandsAxisBufferMaxWidth:ab5:aez', [1, 400], 'CalloutExpandsAxisBufferMinHeight:ab6:ae0', [1, 50], 'CalloutExpandsAxisBufferMinWidth:ab7:ae1', [1, 50], 'CalloutInterpolatedValuePrecision:ach:ae2', [1, -1], 'CalloutLeaderBrush:af3:ae3', [Brush.$, null], 'CalloutLightTextColor:af4:ae4', [Brush.$, null], 'CalloutOutline:af5:ae5', [Brush.$, null], 'CalloutPaddingBottom:ab8:ae6', [1, NaN], 'CalloutPaddingLeft:ab9:ae7', [1, NaN], 'CalloutPaddingRight:aca:ae8', [1, NaN], 'CalloutPaddingTop:acb:ae9', [1, NaN], 'CalloutPositionPadding:acc:afa', [1, 10], 'CalloutStrokeThickness:acd:afb', [1, NaN], 'CalloutTextColor:af6:afc', [Brush.$, null], 'CollisionChannel:ac8:afe', [2, null], 'ContentMemberPath:adb:aff', [2, null], 'HighlightedValueLabelMode:aar:afg', [HighlightedValueLabelMode_$type, enumGetBox(HighlightedValueLabelMode_$type, 0)], 'IsAutoCalloutBehaviorEnabled:abj:afh', [0, false], 'IsCalloutOffsettingEnabled:abk:afi', [0, true], 'IsCustomCalloutRenderStyleEnabled:abl:afj', [0, false], 'IsCustomCalloutStyleEnabled:abm:afk', [0, false], 'KeyMemberPath:adj:afl', [2, null], 'LabelFormat:adm:afm', [2, null], 'LabelFormatSpecifiers:aab:afn', [Array_$type, null], 'LabelMemberPath:adp:afo', [2, null], 'ShouldTruncateOnBoundaryCollisions:abn:afp', [0, false], 'TargetSeriesName:ads:afq', [2, null], 'TargetSeries:aas:afr', [Series.$, null], 'TextStyle:adv:afs', [2, null], 'UseAutoContrastingLabelColors:abo:aft', [0, false], 'UseInterpolatedValueForAutoCalloutLabels:abp:afu', [0, false], 'UseItemColorForFill:abq:afv', [0, false], 'UseItemColorForOutline:abr:afw', [0, false], 'UseSeriesColorForOutline:abs:afx', [0, false], 'UseValueForAutoCalloutLabels:abt:afy', [0, true], 'XMemberPath:ad5:afz', [2, null], 'YMemberPath:ad8:af0', [2, null]]);
    return CalloutLayer;
}(AnnotationLayer));
export { CalloutLayer };
/**
 * @hidden
 */
var CalloutLayerView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CalloutLayerView, _super);
    function CalloutLayerView(a) {
        var _this = _super.call(this, a) || this;
        _this.cn = null;
        _this.cs = null;
        _this.cr = null;
        _this.ct = NaN;
        _this.co = null;
        _this.cn = a;
        _this.cs = new List$1(CalloutView.$, 0);
        return _this;
    }
    CalloutLayerView.prototype.a4 = function () {
        var _this = this;
        _super.prototype.a4.call(this);
        this.cr = ((function () {
            var $ret = new HashPool$2(CalloutAnnotationWrapper.$, CalloutView.$);
            $ret.create = runOn(_this, _this.cp);
            $ret.activate = runOn(_this, _this.cv);
            $ret.disactivate = runOn(_this, _this.cx);
            $ret.destroy = runOn(_this, _this.cw);
            return $ret;
        })());
    };
    CalloutLayerView.prototype.cp = function () {
        var a = new CalloutView(this);
        this.cs.add(a);
        return a;
    };
    CalloutLayerView.prototype.cv = function (a) {
        a.y = 0;
    };
    CalloutLayerView.prototype.cx = function (a) {
        a.y = 1;
    };
    CalloutLayerView.prototype.cw = function (a) {
        this.cs.remove(a);
    };
    CalloutLayerView.prototype.c6 = function (a) {
        if (a == null) {
            return a;
        }
        return BrushUtil.o(a, 0.1);
    };
    CalloutLayerView.prototype.bj = function (a, b) {
        _super.prototype.bj.call(this, a, b);
        a.ad(this.cq());
        if (a.d && !b) {
            for (var c = 0; c < this.cs.count; c++) {
                var d = this.cs._inner[c];
                if (d.y == 0) {
                    d.j(a);
                }
            }
        }
    };
    CalloutLayerView.prototype.cq = function () {
        if (this.cn.aau != null) {
            return this.cn.aau;
        }
        return this.f.dc.getFontInfo();
    };
    CalloutLayerView.prototype.ax = function (a) {
        _super.prototype.ax.call(this, a);
        for (var b = 0; b < this.cs.count; b++) {
            var c = this.cs._inner[b];
            if (c.y != 0) {
                continue;
            }
            c.i(this.cn, this.cq(), a);
        }
    };
    CalloutLayerView.prototype.c8 = function (a) {
        this.m.ad(this.cq());
        this.ct = this.cu();
        var b = this.m.ah(a, this.ct, true);
        return new Size(1, b.c, b.b);
    };
    CalloutLayerView.prototype.cu = function () {
        var a = this.cq();
        if (isNaN_(this.ct)) {
            var b = FontUtil.getCurrentFontHeight(this.f.dc.c9.j.ae, a);
            this.ct = b;
        }
        return this.ct;
    };
    CalloutLayerView.prototype.c7 = function (a, b) {
        if (this.co == null) {
            this.co = new CalloutView(this);
        }
        this.co.h = a;
        this.co.x = b;
        var c = this.co.u();
        this.co.h = null;
        return c;
    };
    CalloutLayerView.prototype.cz = function (a, b, c) {
        a.f = b;
        a.g = c;
    };
    CalloutLayerView.prototype.c0 = function (a, b, c) {
        a.k(this.f, b, c);
    };
    CalloutLayerView.prototype.c1 = function (a, b) {
        if (b != null && this.cn.abq) {
            return this.c6(b);
        }
        if (a != null) {
            return this.c6(a.vl);
        }
        return this.f.vl;
    };
    CalloutLayerView.prototype.c4 = function () {
        return ((function () {
            var $ret = new Brush();
            $ret.color = Color.u(255, 255, 255, 255);
            return $ret;
        })());
    };
    CalloutLayerView.prototype.c2 = function () {
        return ((function () {
            var $ret = new Brush();
            $ret.color = Color.u(255, 0, 0, 0);
            return $ret;
        })());
    };
    CalloutLayerView.prototype.c5 = function (a, b) {
        if (b != null && this.cn.abr) {
            return this.c6(b);
        }
        if (this.cn.abs) {
            if (a != null) {
                return this.c6(a.vl);
            }
        }
        return ((function () {
            var $ret = new Brush();
            $ret.color = Color.u(255, 255, 255, 255);
            return $ret;
        })());
    };
    CalloutLayerView.prototype.c3 = function (a, b) {
        if (b != null && this.cn.abr) {
            return this.c6(b);
        }
        if (a != null) {
            return this.c6(a.ve);
        }
        return this.f.ve;
    };
    CalloutLayerView.prototype.cy = function () {
        this.ct = NaN;
    };
    CalloutLayerView.$t = markType(CalloutLayerView, 'CalloutLayerView', AnnotationLayerView.$);
    return CalloutLayerView;
}(AnnotationLayerView));
export { CalloutLayerView };
/**
 * @hidden
 */
var CalloutView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CalloutView, _super);
    function CalloutView(a) {
        var _this = _super.call(this) || this;
        _this.a = null;
        _this.y = 0;
        _this.l = null;
        _this.t = null;
        _this.q = { $type: Point_$type, x: 0, y: 0 };
        _this.s = null;
        _this.w = new Thickness(0, 0);
        _this.v = null;
        _this.c = 0;
        _this.f = 0;
        _this.g = 0;
        _this.b = null;
        _this.s = new Line();
        _this.s.ab = false;
        _this.s._stroke = ((function () {
            var $ret = new Brush();
            $ret.color = Color.u(255, 0, 0, 0);
            return $ret;
        })());
        _this.s.ad = 2;
        _this.l = new TextBlock();
        _this.t = new Rectangle();
        _this.t.ad = 0;
        _this.a = a;
        _this.y = 0;
        return _this;
    }
    CalloutView.prototype.j = function (a) {
        a.aa();
        a.ag(this.f, this.g);
        var b = new TranslateTransform();
        b.j = this.v.left;
        b.k = this.v.top;
        this.t.j = b;
        a.s(this.s);
        a.aa();
        this.t.width = this.l.m + this.w.left + this.w.right;
        this.t.height = this.l.l + this.w.top + this.w.bottom;
        this.t.ap = this.c;
        this.t.aq = this.c;
        a.k(this.t.j);
        a.w(this.t);
        this.l.ag = true;
        this.l.o = this.w.top;
        this.l.n = this.w.left;
        a.x(this.l);
        a.z();
        a.z();
    };
    Object.defineProperty(CalloutView.prototype, "r", {
        get: function () {
            return this.q;
        },
        set: function (a) {
            if (this.q.x != a.x || this.q.y != a.y) {
                var b = this.u();
                var c = b.height;
                var d = b.width;
                this.q = a;
                var e = CalloutViewHelper.b(this.r, d, c, this.s);
                this.v = e;
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "p", {
        get: function () {
            return this.l.ao;
        },
        set: function (a) {
            this.l.ao = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "o", {
        get: function () {
            return this.t._stroke;
        },
        set: function (a) {
            this.t._stroke = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "n", {
        get: function () {
            return this.s._stroke;
        },
        set: function (a) {
            this.s._stroke = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "m", {
        get: function () {
            return this.t._fill;
        },
        set: function (a) {
            this.t._fill = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "e", {
        get: function () {
            return this.t.ad;
        },
        set: function (a) {
            this.t.ad = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "x", {
        get: function () {
            return this.w;
        },
        set: function (a) {
            this.w = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "d", {
        get: function () {
            return this.c;
        },
        set: function (a) {
            this.c = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CalloutView.prototype, "h", {
        get: function () {
            return this.l.al;
        },
        set: function (a) {
            if (a == null) {
                this.l.al = "";
            }
            else {
                this.l.al = a.toString();
            }
            var b = this.u();
            var c = b.height;
            var d = b.width;
            var e = CalloutViewHelper.b(this.r, d, c, this.s);
            this.v = e;
        },
        enumerable: false,
        configurable: true
    });
    CalloutView.prototype.u = function () {
        var a = this.a.c8(this.l);
        this.l.m = a.width;
        this.l.l = a.height;
        return new Size(1, a.width + this.w.left + this.w.right, a.height + this.w.top + this.w.bottom);
    };
    CalloutView.prototype.k = function (a, b, c) {
        if (this.b == null) {
            this.b = new DataContext();
        }
        this.b.series = a;
        this.b.item = c;
        if (b.c != null) {
            b.c.y = this.b;
        }
    };
    CalloutView.prototype.i = function (a, b, c) {
        a.bc.exportCalloutData(this.f, this.g, this.v.left, this.v.top, c, this.t, this.l, b, this.s, "callout", ["Main", "Callout"]);
    };
    CalloutView.$t = markType(CalloutView, 'CalloutView');
    return CalloutView;
}(Base));
export { CalloutView };