/*
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 { Axis } from "./Axis";
import { DependencyProperty } from "igniteui-react-core";
import { DataToolTipLayerGroupingMode_$type } from "igniteui-react-core";
import { Series } from "./Series";
import { Rect } from "igniteui-react-core";
import { Base, enumGetBox, EnumUtil, fromEnum, typeCast, String_$type, typeGetValue, Point_$type, Array_$type, markType, markDep, runOn, TypeRegistrar } from "igniteui-react-core";
import { Size } from "igniteui-react-core";
import { RectUtil } from "igniteui-react-core";
import { DataTooltipGroupedPositionX_$type } from "igniteui-react-core";
import { DataTooltipGroupedPositionY_$type } from "igniteui-react-core";
import { DataAbbreviationMode_$type } from "igniteui-react-core";
import { DataLegendValueMode_$type } from "igniteui-react-core";
import { Thickness } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { DataLegendHeaderDateMode_$type } from "igniteui-react-core";
import { DataLegendHeaderTimeMode_$type } from "igniteui-react-core";
import { DataLegendSummaryType_$type } from "igniteui-react-core";
import { LegendItemBadgeShape_$type } from "igniteui-react-core";
import { DataLegendLayoutMode_$type } from "igniteui-react-core";
import { DataLegendUnitsMode_$type } from "igniteui-react-core";
import { DataLegendLabelMode_$type } from "igniteui-react-core";
import { DataToolTipLayerFrame } from "./DataToolTipLayerFrame";
import { Dictionary$2 } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { DataToolTipSeriesInfo } from "./DataToolTipSeriesInfo";
import { DataContext } from "igniteui-react-core";
import { DataTooltipCollisionInfo } from "./DataTooltipCollisionInfo";
import { DeviceUtils } from "igniteui-react-core";
import { HashSet$1 } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
import { stringEmpty } from "igniteui-react-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { PointerTooltip } from "./PointerTooltip";
import { IOnDemandRender_$type } from "igniteui-react-core";
/**
 * @hidden
 */
var DataToolTipLayer = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(DataToolTipLayer, _super);
    function DataToolTipLayer() {
        var _this = _super.call(this) || this;
        _this.aaf = 1;
        _this.abk = new Dictionary$2(String_$type, Base.$, 0);
        _this.abl = new List$1(String_$type, 0);
        _this.z7 = 8;
        _this.aab = 11;
        _this.aav = null;
        _this.aan = null;
        _this.aam = null;
        _this.aaq = null;
        _this.aas = null;
        _this.aap = null;
        _this.aar = null;
        _this.aau = null;
        _this.aat = null;
        _this.aao = null;
        var a = new DataToolTipLayerFrame();
        var b = new DataToolTipLayerFrame();
        var c = new DataToolTipLayerFrame();
        _this.w4 = a;
        _this.w3 = b;
        _this.w5 = c;
        _this.ab = DataToolTipLayer.$;
        return _this;
    }
    DataToolTipLayer.prototype.bi = function () {
        return new DataToolTipLayer();
    };
    DataToolTipLayer.prototype.get_ep = function () {
        return true;
    };
    DataToolTipLayer.prototype.cq = function () {
        return new DataToolTipLayerView(this);
    };
    DataToolTipLayer.prototype.qx = function (a) {
        _super.prototype.qx.call(this, a);
        this.aaj = a;
    };
    DataToolTipLayer.prototype.get_e0 = function () {
        return true;
    };
    Object.defineProperty(DataToolTipLayer.prototype, "aag", {
        get: function () {
            return this.aaf;
        },
        set: function (a) {
            var b = this.aaf;
            this.aaf = a;
            if (b != this.aaf) {
                this.raisePropertyChanged("ActualGroupingMode", enumGetBox(DataToolTipLayerGroupingMode_$type, b), enumGetBox(DataToolTipLayerGroupingMode_$type, this.aaf));
            }
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayer.prototype.aai = function () {
        var e_1, _a;
        var a = true;
        var b = true;
        var c = true;
        var d = true;
        if (this.aah != 0) {
            return this.aah;
        }
        var e = this.zx();
        if (e != null) {
            try {
                for (var _b = __values(fromEnum(e.db())), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var f = _c.value;
                    if (!f.eq && !f.fu) {
                        a = false;
                    }
                    if (!f.eq && !f.fn) {
                        b = false;
                    }
                    if (!f.eq && !f.fv) {
                        c = false;
                    }
                    if (!f.eq && !f.fr) {
                        d = 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 (a || b || c || d) {
            return 2;
        }
        return 1;
    };
    DataToolTipLayer.prototype.q5 = function (a, b, c, d) {
        _super.prototype.q5.call(this, a, b, c, d);
        switch (b) {
            case DataToolTipLayer.$$p[42]:
                this.rn(true);
                break;
            case DataToolTipLayer.$$p[49]:
                this.rn(true);
                break;
            case DataToolTipLayer.$$p[12]:
                this.aag = this.aai();
                break;
            case "ActualGroupingMode":
                this.rn(true);
                break;
            case DataToolTipLayer.$$p[10]:
                this.z8 = this.aaa();
                break;
            case DataToolTipLayer.$$p[11]:
                this.aac = this.aae();
                break;
            case "SeriesViewer":
                this.aaj.cl();
                break;
            case DataToolTipLayer.$$p[31]:
            case DataToolTipLayer.$$p[24]:
            case DataToolTipLayer.$$p[5]:
            case DataToolTipLayer.$$p[23]:
            case DataToolTipLayer.$$p[4]:
            case DataToolTipLayer.$$p[28]:
            case DataToolTipLayer.$$p[50]:
            case DataToolTipLayer.$$p[52]:
            case DataToolTipLayer.$$p[53]:
            case DataToolTipLayer.$$p[54]:
            case DataToolTipLayer.$$p[51]:
            case DataToolTipLayer.$$p[57]:
            case DataToolTipLayer.$$p[56]:
            case DataToolTipLayer.$$p[55]:
            case DataToolTipLayer.$$p[58]:
            case DataToolTipLayer.$$p[59]:
            case DataToolTipLayer.$$p[63]:
            case DataToolTipLayer.$$p[62]:
            case DataToolTipLayer.$$p[61]:
            case DataToolTipLayer.$$p[60]:
            case "ValueTextStyle":
            case DataToolTipLayer.$$p[16]:
            case DataToolTipLayer.$$p[15]:
            case DataToolTipLayer.$$p[13]:
            case DataToolTipLayer.$$p[14]:
            case DataToolTipLayer.$$p[17]:
            case DataToolTipLayer.$$p[22]:
            case DataToolTipLayer.$$p[20]:
            case DataToolTipLayer.$$p[21]:
            case DataToolTipLayer.$$p[18]:
            case DataToolTipLayer.$$p[19]:
            case "HeaderTextStyle":
            case DataToolTipLayer.$$p[8]:
            case DataToolTipLayer.$$p[9]:
            case DataToolTipLayer.$$p[6]:
            case DataToolTipLayer.$$p[7]:
            case "GroupTextStyle":
            case DataToolTipLayer.$$p[35]:
            case "SummaryTitleTextStyle":
            case DataToolTipLayer.$$p[38]:
            case DataToolTipLayer.$$p[37]:
            case DataToolTipLayer.$$p[36]:
            case DataToolTipLayer.$$p[34]:
            case DataToolTipLayer.$$p[41]:
            case "SummaryValueTextStyle":
            case DataToolTipLayer.$$p[33]:
            case DataToolTipLayer.$$p[32]:
            case "SummaryLabelTextStyle":
            case DataToolTipLayer.$$p[40]:
            case DataToolTipLayer.$$p[39]:
            case "SummaryUnitsTextStyle":
            case DataToolTipLayer.$$p[0]:
            case DataToolTipLayer.$$p[1]:
            case DataToolTipLayer.$$p[45]:
            case DataToolTipLayer.$$p[48]:
            case DataToolTipLayer.$$p[46]:
            case DataToolTipLayer.$$p[47]:
            case "UnitsTextStyle":
            case DataToolTipLayer.$$p[44]:
            case DataToolTipLayer.$$p[43]:
            case "TitleTextStyle":
            case DataToolTipLayer.$$p[25]:
            case DataToolTipLayer.$$p[26]:
            case DataToolTipLayer.$$p[27]:
            case "LabelTextStyle":
                this.ae8(b, c, d);
                break;
        }
    };
    DataToolTipLayer.prototype.ae8 = function (a, b, c) {
        if (!this.abk.containsKey(a)) {
            this.abl.add(a);
            this.abk.addItem(a, c);
        }
        else {
            this.abk.item(a, c);
        }
        this.rn(true);
    };
    DataToolTipLayer.prototype.afc = function (a, b) {
        switch (a) {
            case DataToolTipLayer.$$p[12]:
                this.aah = EnumUtil.getEnumValue(DataToolTipLayerGroupingMode_$type, b);
                break;
            case DataToolTipLayer.$$p[29]:
                this.abp = b;
                break;
            case DataToolTipLayer.$$p[30]:
                this.abq = b;
                break;
            case DataToolTipLayer.$$p[2]:
                this.abn = b;
                break;
            case DataToolTipLayer.$$p[3]:
                this.abo = b;
                break;
            case DataToolTipLayer.$$p[10]:
                this.z9 = EnumUtil.getEnumValue(DataTooltipGroupedPositionX_$type, b);
                break;
            case DataToolTipLayer.$$p[11]:
                this.aad = EnumUtil.getEnumValue(DataTooltipGroupedPositionY_$type, b);
                break;
            case DataToolTipLayer.$$p[31]:
                this.abf = b;
                break;
            case DataToolTipLayer.$$p[24]:
                this.zv = b;
                break;
            case DataToolTipLayer.$$p[5]:
                this.zq = b;
                break;
            case DataToolTipLayer.$$p[23]:
                this.zu = b;
                break;
            case DataToolTipLayer.$$p[4]:
                this.zp = b;
                break;
            case DataToolTipLayer.$$p[50]:
                this.zz = EnumUtil.getEnumValue(DataAbbreviationMode_$type, b);
                break;
            case DataToolTipLayer.$$p[52]:
                this.acp = typeGetValue(b);
                break;
            case DataToolTipLayer.$$p[53]:
                this.acq = typeGetValue(b);
                break;
            case DataToolTipLayer.$$p[54]:
                this.z6 = EnumUtil.getEnumValue(DataLegendValueMode_$type, b);
                break;
            case DataToolTipLayer.$$p[51]:
                this.aeq = b;
                break;
            case DataToolTipLayer.$$p[57]:
                this.abh = b;
                break;
            case DataToolTipLayer.$$p[56]:
                this.aew = b;
                break;
            case DataToolTipLayer.$$p[55]:
                this.zw = b;
                break;
            case DataToolTipLayer.$$p[58]:
                this.ahv = b;
                break;
            case DataToolTipLayer.$$p[59]:
                this.abi = b;
                break;
            case DataToolTipLayer.$$p[63]:
                this.ae5 = b;
                break;
            case DataToolTipLayer.$$p[62]:
                this.abj = b;
                break;
            case DataToolTipLayer.$$p[61]:
                this.ahw = b;
                break;
            case DataToolTipLayer.$$p[60]:
                this.ahe = b;
                break;
            case "ValueTextStyle":
                this.aa5 = b;
                break;
            case DataToolTipLayer.$$p[16]:
                this.add = b;
                break;
            case DataToolTipLayer.$$p[15]:
                this.zt = b;
                break;
            case DataToolTipLayer.$$p[13]:
                this.ac9 = b;
                break;
            case DataToolTipLayer.$$p[14]:
                this.z0 = EnumUtil.getEnumValue(DataLegendHeaderDateMode_$type, b);
                break;
            case DataToolTipLayer.$$p[17]:
                this.z1 = EnumUtil.getEnumValue(DataLegendHeaderTimeMode_$type, b);
                break;
            case DataToolTipLayer.$$p[22]:
                this.adi = b;
                break;
            case DataToolTipLayer.$$p[20]:
                this.ag6 = b;
                break;
            case DataToolTipLayer.$$p[21]:
                this.ahp = b;
                break;
            case DataToolTipLayer.$$p[18]:
                this.aho = b;
                break;
            case DataToolTipLayer.$$p[19]:
                this.aa8 = b;
                break;
            case "HeaderTextStyle":
                this.aax = b;
                break;
            case DataToolTipLayer.$$p[28]:
                this.z3 = EnumUtil.getEnumValue(DataLegendLayoutMode_$type, b);
                break;
            case DataToolTipLayer.$$p[8]:
                this.ag5 = b;
                break;
            case DataToolTipLayer.$$p[9]:
                this.ahn = b;
                break;
            case DataToolTipLayer.$$p[6]:
                this.ahm = b;
                break;
            case DataToolTipLayer.$$p[7]:
                this.aa7 = b;
                break;
            case "GroupTextStyle":
                this.aaw = b;
                break;
            case DataToolTipLayer.$$p[35]:
                this.ag9 = b;
                break;
            case "SummaryTitleTextStyle":
                this.aa0 = b;
                break;
            case DataToolTipLayer.$$p[38]:
                this.z4 = EnumUtil.getEnumValue(DataLegendSummaryType_$type, b);
                break;
            case DataToolTipLayer.$$p[37]:
                this.ad2 = b;
                break;
            case DataToolTipLayer.$$p[36]:
                this.ahs = b;
                break;
            case DataToolTipLayer.$$p[34]:
                this.ahr = b;
                break;
            case DataToolTipLayer.$$p[41]:
                this.ahb = b;
                break;
            case "SummaryValueTextStyle":
                this.aa2 = b;
                break;
            case DataToolTipLayer.$$p[33]:
                this.adx = b;
                break;
            case DataToolTipLayer.$$p[32]:
                this.ag8 = b;
                break;
            case "SummaryLabelTextStyle":
                this.aaz = b;
                break;
            case DataToolTipLayer.$$p[40]:
                this.ad8 = b;
                break;
            case DataToolTipLayer.$$p[39]:
                this.aha = b;
                break;
            case "SummaryUnitsTextStyle":
                this.aa1 = b;
                break;
            case DataToolTipLayer.$$p[0]:
                this.ahl = b;
                break;
            case DataToolTipLayer.$$p[1]:
                this.aal = EnumUtil.getEnumValue(LegendItemBadgeShape_$type, b);
                break;
            case DataToolTipLayer.$$p[45]:
                this.z5 = EnumUtil.getEnumValue(DataLegendUnitsMode_$type, b);
                break;
            case DataToolTipLayer.$$p[48]:
                this.aej = b;
                break;
            case DataToolTipLayer.$$p[46]:
                this.ahd = b;
                break;
            case DataToolTipLayer.$$p[47]:
                this.ahu = b;
                break;
            case "UnitsTextStyle":
                this.aa4 = b;
                break;
            case DataToolTipLayer.$$p[44]:
                this.aht = b;
                break;
            case DataToolTipLayer.$$p[43]:
                this.ahc = b;
                break;
            case "TitleTextStyle":
                this.aa3 = b;
                break;
            case DataToolTipLayer.$$p[25]:
                this.z2 = EnumUtil.getEnumValue(DataLegendLabelMode_$type, b);
                break;
            case DataToolTipLayer.$$p[26]:
                this.ag7 = b;
                break;
            case DataToolTipLayer.$$p[27]:
                this.ahq = b;
                break;
            case "LabelTextStyle":
                this.aay = b;
                break;
        }
    };
    DataToolTipLayer.prototype.ae9 = function (a) {
        for (var b = 0; b < this.abl.count; b++) {
            var c = this.abl._inner[b];
            a.updatePropertyByName(c, this.abk.item(c));
        }
    };
    DataToolTipLayer.prototype.yg = function (a, b) {
        {
            if (!this.a0.c) {
                this.rn(b);
            }
        }
    };
    DataToolTipLayer.prototype.yh = function (a, b) {
        if (!this.a0.c) {
            this.rn(b);
        }
    };
    DataToolTipLayer.prototype.yj = function (a, b) {
        var e_2, _a;
        var _this = this;
        _super.prototype.yj.call(this, a, b);
        this.aaf = this.aai();
        var c = a;
        var d = this.aaj.b9;
        var e = this.abg;
        var f = false;
        c.m.clear();
        c.i.clear();
        c.l.clear();
        c.g.clear();
        c.f.clear();
        c.k.clear();
        c.j.clear();
        c.h.clear();
        if (isNaN_(this.zm.x) && isNaN_(this.zm.y)) {
            d.count = 0;
            return;
        }
        {
            if (this.aag == 2) {
                var g_1 = 0;
                {
                    try {
                        for (var _b = __values(fromEnum(this.c9.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                            var h = _c.value;
                            if (this.xa(h)) {
                                this.afb(h, c, e, f, g_1);
                                g_1++;
                            }
                            if (h.isStacked) {
                                h.pz(function (i) {
                                    if (_this.xa(i)) {
                                        _this.afb(i, c, e, f, g_1);
                                        g_1++;
                                    }
                                    if (i.ee) {
                                        i.px(function (j) {
                                            if (_this.xa(j)) {
                                                _this.afb(j, c, e, f, g_1);
                                                g_1++;
                                            }
                                            return true;
                                        });
                                    }
                                    return true;
                                });
                            }
                            if (h.ee) {
                                h.px(function (i) {
                                    if (_this.xa(i)) {
                                        _this.afb(i, c, e, f, g_1);
                                        g_1++;
                                    }
                                    return true;
                                });
                            }
                        }
                    }
                    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;
                        }
                    }
                    this.ae7(c);
                }
                d.count = g_1;
            }
            else {
                var i = this.zx();
                var j = this.abm(i);
                var k = this.aak(i, j, e);
                this.afa(k, c, e);
            }
        }
    };
    DataToolTipLayer.prototype.abm = function (a) {
        var e_3, _a;
        var b = new List$1(Series.$, 0);
        if (a == null) {
            return b;
        }
        try {
            for (var _b = __values(fromEnum(a.de)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                b.add(c);
            }
        }
        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;
            }
        }
        return b;
    };
    DataToolTipLayer.prototype.zx = function () {
        var e_4, _a, e_5, _b;
        if (this.zy != null) {
            return this.zy;
        }
        if (this.c9 == null) {
            return null;
        }
        try {
            for (var _c = __values(fromEnum(this.c9.series)), _d = _c.next(); !_d.done; _d = _c.next()) {
                var a = _d.value;
                if (a.ew) {
                    var b = a.az();
                    if (b != null && b.co()) {
                        return b;
                    }
                }
            }
        }
        catch (e_4_1) {
            e_4 = { error: e_4_1 };
        }
        finally {
            try {
                if (_d && !_d.done && (_a = _c.return))
                    _a.call(_c);
            }
            finally {
                if (e_4)
                    throw e_4.error;
            }
        }
        try {
            for (var _e = __values(fromEnum(this.c9.series)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var c = _f.value;
                if (!c.ew) {
                    var d = c.ai();
                    var e = d != null && d.length > 0 ? d[0] : null;
                    if (e != null && e.co()) {
                        return e;
                    }
                }
            }
        }
        catch (e_5_1) {
            e_5 = { error: e_5_1 };
        }
        finally {
            try {
                if (_f && !_f.done && (_b = _e.return))
                    _b.call(_e);
            }
            finally {
                if (e_5)
                    throw e_5.error;
            }
        }
        return null;
    };
    DataToolTipLayer.prototype.aak = function (a, b, c) {
        var d = 1.7976931348623157E+308;
        var e = -1.7976931348623157E+308;
        var f = new List$1(DataContext.$, 0);
        var g = new List$1(Base.$, 0);
        var h = false;
        var i = true;
        var j = { $type: Point_$type, x: NaN, y: NaN };
        var k = 0;
        var l = 0;
        var _loop_1 = function (m) {
            var n = b.item(m);
            k = n.c9.l;
            l = n.c9.m;
            if (n.ew) {
                var o = n;
                var p_1 = new List$1(Series.$, 0);
                if (o.isStacked) {
                    o.pz(function (q) {
                        p_1.add(q);
                        if (q.ee) {
                            q.px(function (r) {
                                p_1.add(r);
                                return true;
                            });
                        }
                        return true;
                    });
                }
                else if (o.ee) {
                    p_1.add(o);
                    o.px(function (q) {
                        p_1.add(q);
                        return true;
                    });
                }
                else {
                    p_1.add(o);
                }
                for (var q = 0; q < p_1.count; q++) {
                    var r = p_1._inner[q];
                    var s = p_1._inner[q];
                    if (!r.categoryAxis.co()) {
                        continue;
                    }
                    if (i) {
                        h = s.isVertical;
                    }
                    else {
                        if (h != s.isVertical) {
                            continue;
                        }
                    }
                    var t = this_1.yc(s);
                    if (!t.c) {
                        continue;
                    }
                    j = s.v1(t.d);
                    var u = s.v6(t.d, c, false);
                    if (h) {
                        if (!isNaN_(u.y)) {
                            d = Math.min(d, u.y);
                            e = Math.max(e, u.y);
                        }
                    }
                    else {
                        if (!isNaN_(u.x)) {
                            d = Math.min(d, u.x);
                            e = Math.max(e, u.x);
                        }
                    }
                }
            }
            else {
                var v = n.ai();
                for (var w = 0; w < v.length; w++) {
                    if (!v[w].co()) {
                        continue;
                    }
                }
                var x = n.v6(this_1.zm, c, false);
                j = n.v1(this_1.zm);
                if (h) {
                    if (!isNaN_(x.y)) {
                        d = Math.min(d, x.y);
                        e = Math.max(e, x.y);
                    }
                }
                else {
                    if (!isNaN_(x.x)) {
                        d = Math.min(d, x.x);
                        e = Math.max(e, x.x);
                    }
                }
            }
            var y = null;
            var z = n.kl(this_1.zm);
            if (n.e1 && z != null) {
                y = n.a2(z);
            }
            else {
                y = new DataContext();
                y.item = z;
                y.series = n;
            }
            f.add(y);
        };
        var this_1 = this;
        for (var m = 0; m < b.count; m++) {
            _loop_1(m);
        }
        var aa = 0;
        var ab = 0;
        if (h) {
            ab = (d + e) / 2;
            aa = this.wl.right;
            if (!isNaN_(j.x)) {
                aa = j.x;
            }
            if (ab < 0 || ab > this.wl.bottom) {
                ab = NaN;
            }
        }
        else {
            aa = (d + e) / 2;
            if (!isNaN_(j.y)) {
                ab = j.y;
            }
            if (aa < 0 || aa > this.wl.right) {
                aa = NaN;
            }
        }
        var ac = new DataToolTipSeriesInfo();
        ac.f = { $type: Point_$type, x: aa, y: ab };
        ac.e = { $type: Point_$type, x: j.x, y: j.y };
        ac.b = f;
        ac.a = h;
        return ac;
    };
    DataToolTipLayer.prototype.p2 = function () {
        this.zm = { $type: Point_$type, x: NaN, y: NaN };
        this.rn(false);
        this.aaj.cj(false);
    };
    DataToolTipLayer.prototype.p3 = function () {
        this.zm = { $type: Point_$type, x: NaN, y: NaN };
        this.rn(false);
        this.aaj.cj(true);
    };
    Object.defineProperty(DataToolTipLayer.prototype, "ahi", {
        get: function () {
            var a = RectUtil.n(this.ct.bx);
            var b = new Size(1, this.ct.bx.width, this.ct.bx.height);
            return new Rect(3, a, b);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "ahh", {
        get: function () {
            var a = RectUtil.n(this.ct.bx);
            var b = new Size(1, this.ct.bx.width, this.ct.bx.height);
            return new Rect(3, this.aaj.cm(a), b);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "ahg", {
        get: function () {
            var a = new Rect(0, 0, 0, this.c9.m, this.c9.l);
            var b = RectUtil.n(a);
            var c = new Size(1, a.width, a.height);
            return new Rect(3, this.aaj.cm(b), c);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "ahk", {
        get: function () {
            var a = { $type: Point_$type, x: 0, y: 0 };
            return new Rect(3, a, this.aaj.cr());
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayer.prototype.ahj = function () {
        return this.ahi;
    };
    DataToolTipLayer.prototype.abc = function (a, b, c) {
        if (Rect.l_op_Equality(a, Rect.empty)) {
            return false;
        }
        var d = a.top;
        return c < d;
    };
    DataToolTipLayer.prototype.aa9 = function (a, b, c, d) {
        if (Rect.l_op_Equality(a, Rect.empty)) {
            return false;
        }
        var e = a.bottom;
        return c + d.height >= e;
    };
    DataToolTipLayer.prototype.aba = function (a, b, c) {
        if (Rect.l_op_Equality(a, Rect.empty)) {
            return false;
        }
        var d = a.left;
        return c < d;
    };
    DataToolTipLayer.prototype.abb = function (a, b, c, d) {
        if (Rect.l_op_Equality(a, Rect.empty)) {
            return false;
        }
        var e = a.right;
        return c + d.width > e;
    };
    DataToolTipLayer.prototype.acf = function (a, b) {
        return a.top + b;
    };
    DataToolTipLayer.prototype.acd = function (a, b, c) {
        return a.bottom - c.height - b;
    };
    DataToolTipLayer.prototype.ace = function (a, b) {
        return ((a.bottom + a.top) / 2) - (b.height / 2);
    };
    DataToolTipLayer.prototype.aco = function (a, b, c, d, e) {
        var f = c.y - d.height - b;
        return f;
    };
    DataToolTipLayer.prototype.acm = function (a, b, c, d, e) {
        var f = c.y + b;
        return f;
    };
    DataToolTipLayer.prototype.acn = function (a, b, c, d, e) {
        var f = c.y - (d.height / 2);
        return f;
    };
    DataToolTipLayer.prototype.aci = function (a, b, c, d, e) {
        var f = c.y - d.height;
        f = f - b;
        return f;
    };
    DataToolTipLayer.prototype.acg = function (a, b, c, d, e) {
        var f = c.y;
        f = f + b;
        return f;
    };
    DataToolTipLayer.prototype.ach = function (a, b, c, d, e) {
        var f = c.y - (d.height / 2);
        return f;
    };
    DataToolTipLayer.prototype.aby = function (a, b) {
        return a.left + b;
    };
    DataToolTipLayer.prototype.ab0 = function (a, b, c) {
        return (a.right - (c.width)) - b;
    };
    DataToolTipLayer.prototype.abz = function (a, b, c) {
        return ((a.right + a.left) / 2) - (c.width / 2) + b;
    };
    DataToolTipLayer.prototype.ab7 = function (a, b, c, d, e) {
        var f = (c.x - d.width) - b;
        return f;
    };
    DataToolTipLayer.prototype.ab9 = function (a, b, c, d, e) {
        var f = c.x + b;
        return f;
    };
    DataToolTipLayer.prototype.ab8 = function (a, b, c, d, e) {
        var f = (c.x - (d.width / 2));
        f = f + b;
        return f;
    };
    DataToolTipLayer.prototype.ab4 = function (a, b, c, d, e) {
        var f = c.x - d.width;
        f = f - b;
        return f;
    };
    DataToolTipLayer.prototype.ab6 = function (a, b, c, d, e) {
        var f = c.x;
        f = f + b;
        return f;
    };
    DataToolTipLayer.prototype.ab5 = function (a, b, c, d, e) {
        var f = c.x - (d.width / 2);
        f = f + b;
        return f;
    };
    DataToolTipLayer.prototype.abu = function (a, b, c, d, e, f, g, h) {
        switch (a) {
            case 1:
                {
                    return this.aci(e, b, h, f, true);
                }
            case 2:
                {
                    return this.acg(e, b, h, f, true);
                }
            case 3:
                {
                    return this.ach(e, b, h, f, true);
                }
            case 5: return this.acj(e, c, b, h, f);
            case 6: return this.ack(e, c, b, h, f);
            case 4: return this.acl(e, c, b, h, f);
            case 8: return this.aca(e, c, b, h, f);
            case 9: return this.acb(e, c, b, h, f);
            case 7: return this.acc(e, c, b, h, f);
            case 13: return this.acf(d, b);
            case 14: return this.acd(d, b, f);
            case 15: return this.ace(d, f);
            case 10: return this.aco(e, b, g, f, true);
            case 12: return this.acn(e, b, g, f, true);
            case 11:
            default: return this.acm(e, b, g, f, true);
        }
    };
    DataToolTipLayer.prototype.ab1 = function (a, b, c, d, e) {
        var f = d.x;
        f = f + b / 2;
        f = f - e.width;
        f = f - c;
        return f;
    };
    DataToolTipLayer.prototype.ab2 = function (a, b, c, d, e) {
        var f = d.x;
        f = f + b / 2;
        f = f - e.width / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.ab3 = function (a, b, c, d, e) {
        var f = d.x;
        f = f + b / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.abv = function (a, b, c, d, e) {
        var f = d.x;
        f = f - b / 2;
        f = f - e.width;
        f = f - c;
        return f;
    };
    DataToolTipLayer.prototype.abw = function (a, b, c, d, e) {
        var f = d.x;
        f = f - b / 2;
        f = f - e.width / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.abx = function (a, b, c, d, e) {
        var f = d.x;
        f = f - b / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.acc = function (a, b, c, d, e) {
        var f = d.y;
        f = f + b / 2;
        f = f - e.height;
        f = f - c;
        return f;
    };
    DataToolTipLayer.prototype.acb = function (a, b, c, d, e) {
        var f = d.y;
        f = f + b / 2;
        f = f - e.height / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.aca = function (a, b, c, d, e) {
        var f = d.y;
        f = f + b / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.acl = function (a, b, c, d, e) {
        var f = d.y;
        f = f - b / 2;
        f = f - e.height;
        f = f - c;
        return f;
    };
    DataToolTipLayer.prototype.ack = function (a, b, c, d, e) {
        var f = d.y;
        f = f - b / 2;
        f = f - e.height / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.acj = function (a, b, c, d, e) {
        var f = d.y;
        f = f - b / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.abt = function (a, b, c, d, e, f, g, h) {
        switch (a) {
            case 10: return this.ab7(e, b, g, f, true);
            case 11: return this.ab9(e, b, g, f, true);
            case 12: return this.ab8(e, b, g, f, true);
            case 13: return this.aby(d, b);
            case 14: return this.ab0(e, b, f);
            case 15: return this.abz(e, b, f);
            case 5: return this.abx(e, c, b, h, f);
            case 6: return this.abw(e, c, b, h, f);
            case 4: return this.abv(e, c, b, h, f);
            case 8: return this.ab3(e, c, b, h, f);
            case 9: return this.ab2(e, c, b, h, f);
            case 7: return this.ab1(e, c, b, h, f);
            case 1:
                {
                    return this.ab4(e, b, h, f, true);
                }
            case 3:
                {
                    return this.ab5(e, b, h, f, true);
                }
            case 2:
            default:
                {
                    return this.ab6(e, b, h, f, true);
                }
        }
    };
    DataToolTipLayer.prototype.ahf = function (a, b, c, d) {
        var e = this.z8;
        var f = this.aac;
        var g = this.zx();
        var h = 0;
        if (g != null && g.cb && this.c9 != null) {
            h = g.getCategorySize(this.c9.vl, this.wl, this.getEffectiveViewport());
            if (g.categoryMode == 0) {
                h = 0;
            }
        }
        var i = this.abr(e);
        var j = this.abs(f);
        var k = this.abt(e, i, h, this.ahi, a, b, c, d);
        var l = this.abu(f, j, h, this.ahi, a, b, c, d);
        var m = this.abd(a, i, k, b);
        var n = this.abe(a, j, l, b);
        if (!m) {
            var o = this.zr(e);
            var p = 0;
            while (!m && p < o.length) {
                e = o[p];
                i = this.abr(e);
                k = this.abt(e, i, h, this.ahi, a, b, c, d);
                m = this.abd(a, i, k, b);
                p++;
            }
        }
        if (!n) {
            var q = this.zs(f);
            var r = 0;
            while (!n && r < q.length) {
                f = q[r];
                j = this.abs(f);
                l = this.abu(f, j, h, this.ahi, a, b, c, d);
                n = this.abe(a, j, l, b);
                r++;
            }
        }
        return { $type: Point_$type, x: k, y: l };
    };
    DataToolTipLayer.prototype.abs = function (a) {
        if (!isNaN_(this.abq)) {
            return this.abq;
        }
        switch (a) {
            case 1: return this.abo;
            case 2: return this.abo;
            case 3: return 0;
            case 4: return this.abo;
            case 5: return this.abo;
            case 6: return this.abo;
            case 7: return this.abo;
            case 8: return this.abo;
            case 9: return 0;
            case 10: return this.abo;
            case 11: return this.abo;
            case 12: return 0;
            case 13: return this.abo;
            case 14: return this.abo;
            case 15: return 0;
        }
        return this.abo;
    };
    DataToolTipLayer.prototype.abr = function (a) {
        if (!isNaN_(this.abp)) {
            return this.abp;
        }
        switch (a) {
            case 4: return this.abn;
            case 6: return 0;
            case 5: return this.abn;
            case 13: return this.abn;
            case 15: return 0;
            case 14: return this.abn;
            case 7: return this.abn;
            case 9: return 0;
            case 8: return this.abn;
            case 1: return this.abn;
            case 3: return 0;
            case 2: return this.abn;
            case 10: return this.abn;
            case 12: return 0;
            case 11: return this.abn;
        }
        return this.abn;
    };
    DataToolTipLayer.prototype.zs = function (a) {
        var b = [a];
        switch (a) {
            case 1:
                b = [2, 3, 13, 14];
                break;
            case 2:
                b = [1, 3, 14, 13];
                break;
            case 3:
                b = [1, 2];
                break;
            case 4:
                b = [8, 7, 3, 13, 14];
                break;
            case 5:
                b = [7, 8, 3, 13, 14];
                break;
            case 6:
                b = [9, 8, 4, 3];
                break;
            case 7:
                b = [5, 4, 2, 14, 13];
                break;
            case 8:
                b = [4, 5, 3, 14, 13];
                break;
            case 9:
                b = [6, 4, 8, 3];
                break;
            case 10:
                b = [11, 12, 2, 1, 3, 13, 14];
                break;
            case 11:
                b = [10, 12, 1, 2, 3, 14, 13];
                break;
            case 12:
                b = [10, 11];
                break;
            case 13: break;
            case 14: break;
            case 15: break;
        }
        return b;
    };
    DataToolTipLayer.prototype.zr = function (a) {
        var b = [a];
        switch (a) {
            case 1:
                b = [2, 3, 13, 14];
                break;
            case 2:
                b = [1, 3, 14, 13];
                break;
            case 3:
                b = [1, 2];
                break;
            case 4:
                b = [8, 7, 3, 13, 14];
                break;
            case 5:
                b = [7, 8, 1, 14, 13];
                break;
            case 6:
                b = [9, 8, 4, 3];
                break;
            case 7:
                b = [5, 4, 2, 14, 13];
                break;
            case 8:
                b = [4, 5, 3, 13, 14];
                break;
            case 9:
                b = [6, 4, 8, 3];
                break;
            case 10:
                b = [11, 12, 2, 1, 3, 13, 14];
                break;
            case 11:
                b = [10, 12, 1, 2, 3, 14, 13];
                break;
            case 12:
                b = [10, 11];
                break;
            case 13: break;
            case 14: break;
            case 15: break;
        }
        return b;
    };
    DataToolTipLayer.prototype.abd = function (a, b, c, d) {
        return !(this.aba(a, b, c) || this.abb(a, b, c, d));
    };
    DataToolTipLayer.prototype.abe = function (a, b, c, d) {
        return !(this.abc(a, b, c) || this.aa9(a, b, c, d));
    };
    DataToolTipLayer.prototype.ae7 = function (a) {
        var b = new List$1(DataTooltipCollisionInfo.$, 0);
        for (var c = 0; c < a.f.count; c++) {
            var d = new DataTooltipCollisionInfo();
            d.d = c;
            d.e = { $type: Point_$type, x: a.f._inner[c], y: a.g._inner[c] };
            d.c = a.k._inner[c];
            d.a = a.j._inner[c];
            d.b = a.m._inner[c];
            if (isNaN_(d.e.x) || isNaN_(d.e.y)) {
                continue;
            }
            b.add(d);
        }
        b.aa(function (e, f) {
            if (e.e.y < f.e.y) {
                return -1;
            }
            if (e.e.y > f.e.y) {
                return 1;
            }
            if (e.b < f.b) {
                return -1;
            }
            if (e.b > f.b) {
                return 1;
            }
            return 0;
        });
        var e = this.aa6(b);
        if (!e) {
            return;
        }
        for (var f = 0; f < b.count - 1; f++) {
            var g = b._inner[f];
            var h = b._inner[f + 1];
            var i = new Rect(0, g.e.x, g.e.y, g.c, g.a);
            var j = new Rect(0, h.e.x, h.e.y, h.c, h.a);
            if (i.intersectsWith(j) || i.top > j.bottom) {
                h.e = { $type: Point_$type, x: h.e.x, y: i.bottom + 1 };
            }
        }
        if (b._inner[b.count - 1].e.y + b._inner[b.count - 1].a > this.ct.bx.height) {
            b._inner[b.count - 1].e = { $type: Point_$type, x: b._inner[b.count - 1].e.x, y: b._inner[b.count - 1].e.y - ((b._inner[b.count - 1].e.y + b._inner[b.count - 1].a) - this.ct.bx.height) };
        }
        for (var k = b.count - 1; k >= 1; k--) {
            var l = b._inner[k];
            var m = b._inner[k - 1];
            var n = new Rect(0, l.e.x, l.e.y, l.c, l.a);
            var o = new Rect(0, m.e.x, m.e.y, m.c, m.a);
            if (n.intersectsWith(o) || n.top < o.bottom) {
                m.e = { $type: Point_$type, x: m.e.x, y: n.top - (o.height + 1) };
            }
        }
        for (var p = 0; p < b.count; p++) {
            var q = b._inner[p].d;
            var r = b._inner[p];
            a.f._inner[q] = r.e.x;
            a.g._inner[q] = r.e.y;
        }
    };
    DataToolTipLayer.prototype.aa6 = function (a) {
        if (a.count <= 1) {
            return false;
        }
        var b = this.ct.bx;
        for (var c = 0; c < a.count - 1; c++) {
            var d = a._inner[c];
            var e = a._inner[c + 1];
            var f = new Rect(0, d.e.x, d.e.y, d.c, d.a);
            var g = new Rect(0, e.e.x, e.e.y, e.c, e.a);
            if (f.intersectsWith(g)) {
                return true;
            }
        }
        return false;
    };
    DataToolTipLayer.prototype.afb = function (a, b, c, d, e) {
        var _this = this;
        var f = this.yc(a);
        if (!f.c) {
            return;
        }
        var g = a.v6(f.d, c, d);
        var h = this.aaj.b9;
        var i = this.zm;
        if (!c) {
            i = this.wb(g);
        }
        var j = a.kl(i);
        var k = h.item(e);
        var l = this.ct.bx;
        var m = this.aaj.b8(k);
        if (!Base.equalsStatic(m.target, this.c9)) {
            m.target = this.c9;
        }
        var n = new List$1(String_$type, 0);
        if (a.ee && this.aag == 2) {
            a.px(function (o) {
                if (_this.xa(o)) {
                    n.add(o.dataLegendKey);
                }
                return true;
            });
        }
        m.includedSeries = [a.dataLegendKey];
        m.excludedSeries = n.toArray();
        this.ae9(m);
        m.targetCursorPositionX = this.zm.x;
        m.targetCursorPositionY = this.zm.y;
        if (!this.aaj.cb(k, a)) {
            return;
        }
        var o = this.aaj.cq(k);
        b.i.add1(k);
        var p = g.x;
        var q = g.x;
        q = Math.max(q, l.left);
        q = Math.min(q, l.right);
        b.l.add(q);
        var r = g.y;
        r = Math.max(r, l.top);
        r = Math.min(r, l.bottom);
        b.m.add(r);
        var s = DeviceUtils.g(10);
        var t = g.x + s;
        if (t + o.width > l.right) {
            t = (l.right - o.width) - s;
        }
        if (t < l.left) {
            t = l.left;
        }
        b.f.add(t);
        var u = (g.y - o.height) - s;
        if (u + o.height > l.bottom) {
            u = (l.bottom - o.height) - s;
        }
        if (u < l.top) {
            u = l.top;
        }
        b.g.add(u);
        b.k.add(o.width);
        b.j.add(o.height);
        var v = this.u3;
        if (v == null) {
            v = this.u9;
        }
        if (v == null) {
            v = a.u3;
        }
        b.h.add(v);
    };
    DataToolTipLayer.prototype.afa = function (a, b, c) {
        var e_6, _a;
        this.z7 = this.aaa();
        this.aab = this.aae();
        var d = a.f;
        var e = a.e;
        var f = 0;
        var g = this.aaj.b9.item(0);
        this.aaj.cb(g, null);
        var h = this.aaj.b8(g);
        if (!Base.equalsStatic(h.target, this.c9)) {
            h.target = this.c9;
        }
        var i = new List$1(String_$type, 0);
        var j = this.zx();
        if (j != null) {
            try {
                for (var _b = __values(fromEnum(j.db())), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var k = _c.value;
                    if (k.isStacked) {
                        k.pz(function (l) {
                            i.add(l.dataLegendKey);
                            if (l.ee) {
                                l.px(function (m) {
                                    i.add(m.dataLegendKey);
                                    return true;
                                });
                            }
                            return true;
                        });
                    }
                    else if (k.ee) {
                        i.add(k.dataLegendKey);
                        k.px(function (l) {
                            i.add(l.dataLegendKey);
                            return true;
                        });
                    }
                    else {
                        i.add(k.dataLegendKey);
                    }
                }
            }
            catch (e_6_1) {
                e_6 = { error: e_6_1 };
            }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return))
                        _a.call(_b);
                }
                finally {
                    if (e_6)
                        throw e_6.error;
                }
            }
            h.includedSeries = i.toArray();
            h.excludedSeries = null;
        }
        else {
            h.includedSeries = null;
            h.excludedSeries = null;
        }
        this.ae9(h);
        h.targetCursorPositionX = this.zm.x;
        h.targetCursorPositionY = this.zm.y;
        var l = this.aaj.cq(g);
        var m = 0;
        var n = 0;
        var o = 0;
        var p = 0;
        var q = false;
        var r = false;
        o = d.x;
        p = d.y;
        var s = this.ct.bx;
        var t = this.aaj.cr();
        var u = this.ahj();
        var v = this.ahf(u, l, e, d);
        var w = v.x;
        var x = v.y;
        {
        }
        b.l.add(w);
        b.m.add(x);
        b.f.add(w);
        b.g.add(x);
        b.k.add(l.width);
        b.j.add(l.height);
        b.i.add1(g);
        var y = null;
        b.h.add(y);
        this.aaj.b9.count = 1;
    };
    DataToolTipLayer.prototype.acr = function (a) {
        return a.toolTip;
    };
    DataToolTipLayer.prototype.ym = function (a, b) {
        _super.prototype.ym.call(this, a, b);
        var c = a;
        var d = c.m.count;
        var e = b.bx.left;
        var f = b.bx.right;
        var g = b.bx.top;
        var h = b.bx.bottom;
        for (var i = 0; i < d; i++) {
            if (isNaN_(c.l._inner[i]) || isNaN_(c.m._inner[i]) || isNaN_(c.f._inner[i]) || isNaN_(c.g._inner[i])) {
                this.aaj.ci(c.i._inner[i]);
                continue;
            }
            var j = c.f._inner[i];
            var k = c.g._inner[i];
            var l = c.k._inner[i];
            var m = c.j._inner[i];
            var n = false;
            if (n) {
                this.aaj.ci(c.i._inner[i]);
                continue;
            }
            var o = c.i._inner[i];
            var p = Math.min(c.f._inner[i], c.l._inner[i]);
            var q = Math.min(c.g._inner[i], c.m._inner[i]);
            var r = c.l._inner[i] - c.f._inner[i];
            var s = c.m._inner[i] - c.g._inner[i];
            if (o != null) {
                this.aaj.ck(o, p, q, r, s);
            }
        }
    };
    DataToolTipLayer.prototype.f8 = function () {
        return true;
    };
    Object.defineProperty(DataToolTipLayer.prototype, "z8", {
        get: function () {
            return this.z7;
        },
        set: function (a) {
            var b = this.z7;
            this.z7 = a;
            if (b != this.z7) {
                this.raisePropertyChanged("ActualGroupedPositionModeX", enumGetBox(DataTooltipGroupedPositionX_$type, b), enumGetBox(DataTooltipGroupedPositionX_$type, this.z7));
            }
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayer.prototype.aaa = function () {
        var e_7, _a;
        if (this.c9 == null) {
            return 2;
        }
        var a = false;
        var b = false;
        var c = false;
        var d = false;
        var e = this.zx();
        if (e == null) {
            if (this.z9 != 0) {
                return this.z9;
            }
            else {
                return 2;
            }
        }
        try {
            for (var _b = __values(fromEnum(e.de)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var f = _c.value;
                if (f.ex) {
                    a = true;
                }
                if (f.isVertical) {
                    b = true;
                }
                if (f.fn) {
                    c = true;
                }
                if (f.fu) {
                    d = true;
                }
            }
        }
        catch (e_7_1) {
            e_7 = { error: e_7_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_7)
                    throw e_7.error;
            }
        }
        var g = ((function () {
            var $ret = new HashSet$1(DataTooltipGroupedPositionX_$type, 0);
            $ret.add_1(1);
            $ret.add_1(2);
            $ret.add_1(3);
            $ret.add_1(4);
            $ret.add_1(5);
            $ret.add_1(6);
            $ret.add_1(7);
            $ret.add_1(8);
            $ret.add_1(9);
            return $ret;
        })());
        var h = g.contains(this.z9);
        if (this.z9 != 0) {
            return this.z9;
        }
        if (h && b) {
            return 11;
        }
        if (c || d) {
            return 11;
        }
        if (b) {
            return 11;
        }
        if (a) {
            return 8;
        }
        return 8;
    };
    Object.defineProperty(DataToolTipLayer.prototype, "aac", {
        get: function () {
            return this.aab;
        },
        set: function (a) {
            var b = this.aab;
            this.aab = a;
            if (b != this.aab) {
                this.raisePropertyChanged("ActualPositionModeY", enumGetBox(DataTooltipGroupedPositionY_$type, b), enumGetBox(DataTooltipGroupedPositionY_$type, this.aab));
            }
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayer.prototype.aae = function () {
        var e_8, _a;
        if (this.c9 == null) {
            return 11;
        }
        var a = false;
        var b = false;
        var c = false;
        var d = this.zx();
        if (d == null) {
            if (this.aad != 0) {
                return this.aad;
            }
            else {
                return 11;
            }
        }
        try {
            for (var _b = __values(fromEnum(d.db())), _c = _b.next(); !_c.done; _c = _b.next()) {
                var e = _c.value;
                if (e.isVertical) {
                    a = true;
                }
                if (e.fn) {
                    b = true;
                }
                if (e.fu) {
                    c = true;
                }
            }
        }
        catch (e_8_1) {
            e_8 = { error: e_8_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_8)
                    throw e_8.error;
            }
        }
        var f = ((function () {
            var $ret = new HashSet$1(DataTooltipGroupedPositionY_$type, 0);
            $ret.add_1(1);
            $ret.add_1(2);
            $ret.add_1(3);
            $ret.add_1(4);
            $ret.add_1(5);
            $ret.add_1(6);
            $ret.add_1(7);
            $ret.add_1(8);
            $ret.add_1(9);
            return $ret;
        })());
        var g = f.contains(this.aad);
        if (this.aad != 0) {
            return this.aad;
        }
        if (g && !a) {
            return 11;
        }
        if (b || c) {
            return 11;
        }
        if (a) {
            return 8;
        }
        if (!a) {
            return 11;
        }
        return 11;
    };
    Object.defineProperty(DataToolTipLayer.prototype, "aa5", {
        get: function () {
            return this.aav;
        },
        set: function (a) {
            var b = this.aav;
            this.aav = a;
            if (b != this.aav) {
                this.raisePropertyChanged("ValueTextStyle", b, this.aav);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "aax", {
        get: function () {
            return this.aan;
        },
        set: function (a) {
            var b = this.aan;
            this.aan = a;
            if (b != this.aan) {
                this.raisePropertyChanged("HeaderTextStyle", b, this.aan);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "aaw", {
        get: function () {
            return this.aam;
        },
        set: function (a) {
            var b = this.aam;
            this.aam = a;
            if (b != this.aam) {
                this.raisePropertyChanged("GroupTextStyle", b, this.aam);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "aa0", {
        get: function () {
            return this.aaq;
        },
        set: function (a) {
            var b = this.aaq;
            this.aaq = a;
            if (b != this.aaq) {
                this.raisePropertyChanged("SummaryTitleTextStyle", b, this.aaq);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "aa2", {
        get: function () {
            return this.aas;
        },
        set: function (a) {
            var b = this.aas;
            this.aas = a;
            if (b != this.aas) {
                this.raisePropertyChanged("SummaryValueTextStyle", b, this.aas);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "aaz", {
        get: function () {
            return this.aap;
        },
        set: function (a) {
            var b = this.aap;
            this.aap = a;
            if (b != this.aap) {
                this.raisePropertyChanged("SummaryLabelTextStyle", b, this.aap);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "aa1", {
        get: function () {
            return this.aar;
        },
        set: function (a) {
            var b = this.aar;
            this.aar = a;
            if (b != this.aar) {
                this.raisePropertyChanged("SummaryUnitsTextStyle", b, this.aar);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "aa4", {
        get: function () {
            return this.aau;
        },
        set: function (a) {
            var b = this.aau;
            this.aau = a;
            if (b != this.aau) {
                this.raisePropertyChanged("UnitsTextStyle", b, this.aau);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "aa3", {
        get: function () {
            return this.aat;
        },
        set: function (a) {
            var b = this.aat;
            this.aat = a;
            if (b != this.aat) {
                this.raisePropertyChanged("TitleTextStyle", b, this.aat);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "aay", {
        get: function () {
            return this.aao;
        },
        set: function (a) {
            var b = this.aao;
            this.aao = a;
            if (b != this.aao) {
                this.raisePropertyChanged("LabelTextStyle", b, this.aao);
            }
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayer.$t = markType(DataToolTipLayer, 'DataToolTipLayer', AnnotationLayer.$);
    DataToolTipLayer.$$p = markDep(DependencyProperty, PropertyMetadata, DataToolTipLayer, 'raisePropertyChanged', ['BadgeMargin:ahl:afd', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'BadgeShape:aal:afe', [LegendItemBadgeShape_$type, enumGetBox(LegendItemBadgeShape_$type, 0)], 'DefaultPositionOffsetX:abn:aff', [1, DeviceUtils.g(10)], 'DefaultPositionOffsetY:abo:afg', [1, DeviceUtils.g(10)], 'ExcludedColumns:zp:afh', [Array_$type, null], 'ExcludedSeries:zq:afi', [Array_$type, null], 'GroupRowMargin:ahm:afm', [Thickness.$, new Thickness(0, 5)], 'GroupRowVisible:aa7:afn', [0, false], 'GroupTextColor:ag5:afo', [Brush.$, null], 'GroupTextMargin:ahn:afp', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'GroupedPositionModeX:z9:afj', [DataTooltipGroupedPositionX_$type, enumGetBox(DataTooltipGroupedPositionX_$type, 0)], 'GroupedPositionModeY:aad:afk', [DataTooltipGroupedPositionY_$type, enumGetBox(DataTooltipGroupedPositionY_$type, 0)], 'GroupingMode:aah:afl', [DataToolTipLayerGroupingMode_$type, enumGetBox(DataToolTipLayerGroupingMode_$type, 0)], 'HeaderFormatCulture:ac9:afq', [2, stringEmpty()], 'HeaderFormatDate:z0:afr', [DataLegendHeaderDateMode_$type, enumGetBox(DataLegendHeaderDateMode_$type, 0)], 'HeaderFormatSpecifiers:zt:afs', [Array_$type, null], 'HeaderFormatString:add:aft', [2, null], 'HeaderFormatTime:z1:afu', [DataLegendHeaderTimeMode_$type, enumGetBox(DataLegendHeaderTimeMode_$type, 0)], 'HeaderRowMargin:aho:afv', [Thickness.$, new Thickness(0, 5)], 'HeaderRowVisible:aa8:afw', [0, true], 'HeaderTextColor:ag6:afx', [Brush.$, null], 'HeaderTextMargin:ahp:afy', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'HeaderText:adi:afz', [2, null], 'IncludedColumns:zu:af0', [Array_$type, null], 'IncludedSeries:zv:af1', [Array_$type, null], 'LabelDisplayMode:z2:af2', [DataLegendLabelMode_$type, enumGetBox(DataLegendLabelMode_$type, 0)], 'LabelTextColor:ag7:af3', [Brush.$, null], 'LabelTextMargin:ahq:af4', [Thickness.$, new Thickness(1, 8, 0, 0, 0)], 'LayoutMode:z3:af5', [DataLegendLayoutMode_$type, enumGetBox(DataLegendLayoutMode_$type, 0)], 'PositionOffsetX:abp:af6', [1, NaN], 'PositionOffsetY:abq:af7', [1, NaN], 'ShouldUpdateWhenSeriesDataChanges:abf:af8', [0, true], 'SummaryLabelTextColor:ag8:af9', [Brush.$, null], 'SummaryLabelText:adx:aga', [2, null], 'SummaryRowMargin:ahr:agb', [Thickness.$, new Thickness(0, 5)], 'SummaryTitleTextColor:ag9:agc', [Brush.$, null], 'SummaryTitleTextMargin:ahs:agd', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'SummaryTitleText:ad2:age', [2, null], 'SummaryType:z4:agf', [DataLegendSummaryType_$type, enumGetBox(DataLegendSummaryType_$type, 0)], 'SummaryUnitsTextColor:aha:agg', [Brush.$, null], 'SummaryUnitsText:ad8:agh', [2, null], 'SummaryValueTextColor:ahb:agi', [Brush.$, null], 'TargetAxis:zy:agj', [Axis.$, null], 'TitleTextColor:ahc:agk', [Brush.$, null], 'TitleTextMargin:aht:agl', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'UnitsDisplayMode:z5:agm', [DataLegendUnitsMode_$type, enumGetBox(DataLegendUnitsMode_$type, 0)], 'UnitsTextColor:ahd:agn', [Brush.$, null], 'UnitsTextMargin:ahu:ago', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'UnitsText:aej:agp', [2, null], 'UseInterpolation:abg:agq', [0, false], 'ValueFormatAbbreviation:zz:agr', [DataAbbreviationMode_$type, enumGetBox(DataAbbreviationMode_$type, 0)], 'ValueFormatCulture:aeq:ags', [2, stringEmpty()], 'ValueFormatMaxFractions:acp:agt', [1, -1], 'ValueFormatMinFractions:acq:agu', [1, -1], 'ValueFormatMode:z6:agv', [DataLegendValueMode_$type, enumGetBox(DataLegendValueMode_$type, 0)], 'ValueFormatSpecifiers:zw:agw', [Array_$type, null], 'ValueFormatString:aew:agx', [2, null], 'ValueFormatUseGrouping:abh:agy', [0, true], 'ValueRowMargin:ahv:agz', [Thickness.$, new Thickness(0, 5)], 'ValueRowVisible:abi:ag0', [0, true], 'ValueTextColor:ahe:ag1', [Brush.$, null], 'ValueTextMargin:ahw:ag2', [Thickness.$, new Thickness(1, 2, 0, 2, 0)], 'ValueTextUseSeriesColors:abj:ag3', [0, false], 'ValueTextWhenMissingData:ae5:ag4', [2, "N/A"]]);
    return DataToolTipLayer;
}(AnnotationLayer));
export { DataToolTipLayer };
/**
 * @hidden
 */
var DataToolTipLayerView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(DataToolTipLayerView, _super);
    function DataToolTipLayerView(a) {
        var _this = _super.call(this, a) || this;
        _this.b9 = null;
        _this.cc = null;
        _this.b7 = null;
        _this.ca = false;
        _this._htmlTest = null;
        _this.b7 = a;
        _this.htmlTest = /^[^<]*(<[\w\W]+>)[^>]*$/;
        _this.cc = new List$1(PointerTooltip.$, 0);
        return _this;
    }
    DataToolTipLayerView.prototype.ak = function () {
        _super.prototype.ak.call(this);
        for (var a = 0; a < this.b9.a.count; a++) {
            this.b9.a._inner[a].br();
        }
        for (var b = 0; b < this.b9.b.count; b++) {
            this.b9.b._inner[b].br();
        }
        this.b9.clear();
    };
    DataToolTipLayerView.prototype.cd = function () {
        var a = new PointerTooltip();
        a.bw(this.e.jx);
        a._visibility = 1;
        a.ap = this.e.c9.c8.k;
        var b = null;
        if (TypeRegistrar.isRegistered("XamDataLegend")) {
            b = TypeRegistrar.create("XamDataLegend");
        }
        b.pixelScalingRatio = 1;
        if (this.e.c9 != null) {
            var c = this.e.c9.c8.j.ae.createElement("div");
            var ren_ = this.e.c9.c8.j.ae.getSubRenderer(c);
            var len_ = b;
            len_.provideContainer(ren_);
        }
        a.ai = typeCast(IOnDemandRender_$type, b);
        a.ai.shouldOnDemandRender = true;
        this.cc.add(a);
        return a;
    };
    DataToolTipLayerView.prototype.cf = function (a) {
        var b = a;
    };
    DataToolTipLayerView.prototype.ch = function (a) {
        var b = a;
        b._visibility = 1;
    };
    DataToolTipLayerView.prototype.cg = function (a) {
        var b = a;
        b.bz();
        b.content = null;
        this.cc.remove1(a);
    };
    DataToolTipLayerView.prototype.au = function () {
        var _this = this;
        _super.prototype.au.call(this);
        this.b9 = ((function () {
            var $ret = new Pool$1(Base.$);
            $ret.create = runOn(_this, _this.cd);
            $ret.activate = runOn(_this, _this.cf);
            $ret.disactivate = runOn(_this, _this.ch);
            $ret.destroy = runOn(_this, _this.cg);
            return $ret;
        })());
    };
    Object.defineProperty(DataToolTipLayerView.prototype, "htmlTest", {
        get: function () {
            return this._htmlTest;
        },
        set: function (a) {
            this._htmlTest = a;
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayerView.prototype.cb = function (a, b) {
        var c = a;
        var d = c.ai;
        return true;
    };
    DataToolTipLayerView.prototype.cq = function (a) {
        var b = a;
        var c = new Size(1, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
        b.cy = 1;
        var d = b.cx(new Size(1, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY));
        b.cy = 0;
        return d;
    };
    DataToolTipLayerView.prototype.cp = function () {
        if (this.e.c9 != null) {
            var a = this.e.c9.ve();
            var b = this.e.c9.c8.a8;
            var c = this.e.c9.c8.a7;
            return new Rect(0, 0, 0, b, c);
        }
        return Rect.empty;
    };
    DataToolTipLayerView.prototype.co = function () {
        if (this.e.c9 != null) {
            var a = this.e.c9.ve();
            var b = this.e.c9.c8.a8;
            var c = this.e.c9.c8.a7;
            return new Rect(0, 0, 0, b, c);
        }
        return Rect.empty;
    };
    DataToolTipLayerView.prototype.cn = function () {
        var a = 0;
        var b = 0;
        if (this.e.c9 != null) {
            var c = this.e.c9.ve();
            a += c.x;
            b += c.y;
            var d = this.e.c9.c8.a8;
            var e = this.e.c9.c8.a7;
            return new Rect(0, a, b, d, e);
        }
        return Rect.empty;
    };
    DataToolTipLayerView.prototype.cm = function (a) {
        var b = 0;
        var c = 0;
        if (this.e.c9 != null) {
            var d = this.e.c9.ve();
            b += d.x;
            c += d.y;
        }
        return { $type: Point_$type, x: b + a.x, y: c + a.y };
    };
    DataToolTipLayerView.prototype.ck = function (a, b, c, d, e) {
        var f = null;
        if (this.e.c9 != null) {
            f = this.e.c9.c8.j.i();
        }
        var g = a;
        if (g == null) {
            return;
        }
        if (d == 0 && e == 0) {
            g.cy = 1;
        }
        else {
            g.cy = 0;
        }
        g.aq = f;
        g.cs = { $type: Point_$type, x: d, y: e };
        g._visibility = 0;
        g.n = b;
        g.o = c;
    };
    DataToolTipLayerView.prototype.cr = function () {
        var a = (window.innerWidth);
        var b = (window.innerHeight);
        return new Size(1, a, b);
    };
    DataToolTipLayerView.prototype.ci = function (a) {
        if (a != null) {
            var b = a;
            b._visibility = 1;
        }
    };
    DataToolTipLayerView.prototype.cl = function () {
        if (this.e.c9 == null) {
            this.cj(true);
        }
    };
    DataToolTipLayerView.prototype.a8 = function (a, b) {
        _super.prototype.a8.call(this, a, b);
        if (b) {
            return;
        }
        var c = 0;
        var d = 0;
        var e = this.e.c9;
        if (e != null) {
            var f = e.c8.j.b8();
            c += f.x;
            d += f.y;
        }
        for (var g = 0; g < this.cc.count; g++) {
            this.cc._inner[g].by(this.cc._inner[g].n + c, this.cc._inner[g].o + d);
        }
    };
    DataToolTipLayerView.prototype.an = function (a) {
        _super.prototype.an.call(this, a);
        for (var b = 0; b < this.cc.count; b++) {
            var c = this.cc._inner[b];
            var d = 0;
            var e = 0;
            if (this.e.c9 != null) {
                var f = this.e.c9.ve();
                d += f.x;
                e += f.y;
            }
            var g = c.a5();
            var h = c.n - d;
            var i = c.o - e;
            var j = c.ai;
            var k = null;
            if (j != null) {
                k = j.exportVisualData();
            }
            this.e.bb.addPointerTooltipWithDataLegend(a, g, h, i, k);
        }
    };
    DataToolTipLayerView.prototype.b8 = function (a) {
        var b = a;
        return b.ai;
    };
    DataToolTipLayerView.prototype.cj = function (a) {
        this.as();
        for (var b = 0; b < this.cc.count; b++) {
            this.ci(this.cc._inner[b]);
            if (a) {
                this.cc._inner[b].bs();
            }
        }
    };
    DataToolTipLayerView.$t = markType(DataToolTipLayerView, 'DataToolTipLayerView', AnnotationLayerView.$);
    return DataToolTipLayerView;
}(AnnotationLayerView));
export { DataToolTipLayerView };
