/*
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-angular-core";
import { DataToolTipLayerGroupingMode_$type } from "igniteui-angular-core";
import { Series } from "./Series";
import { Rect } from "igniteui-angular-core";
import { Base, enumGetBox, EnumUtil, fromEnum, typeCast, String_$type, typeGetValue, Point_$type, Array_$type, markType, markDep, runOn, TypeRegistrar } from "igniteui-angular-core";
import { Size } from "igniteui-angular-core";
import { RectUtil } from "igniteui-angular-core";
import { DataTooltipGroupedPositionX_$type } from "igniteui-angular-core";
import { DataTooltipGroupedPositionY_$type } from "igniteui-angular-core";
import { DataAbbreviationMode_$type } from "igniteui-angular-core";
import { DataLegendValueMode_$type } from "igniteui-angular-core";
import { Thickness } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { DataLegendHeaderDateMode_$type } from "igniteui-angular-core";
import { DataLegendHeaderTimeMode_$type } from "igniteui-angular-core";
import { DataLegendSummaryType_$type } from "igniteui-angular-core";
import { LegendItemBadgeShape_$type } from "igniteui-angular-core";
import { DataLegendUnitsMode_$type } from "igniteui-angular-core";
import { DataLegendLabelMode_$type } from "igniteui-angular-core";
import { DataToolTipLayerFrame } from "./DataToolTipLayerFrame";
import { Dictionary$2 } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { DataToolTipSeriesInfo } from "./DataToolTipSeriesInfo";
import { DataContext } from "igniteui-angular-core";
import { DataTooltipCollisionInfo } from "./DataTooltipCollisionInfo";
import { DeviceUtils } from "igniteui-angular-core";
import { HashSet$1 } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
import { stringEmpty } from "igniteui-angular-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { PointerTooltip } from "./PointerTooltip";
import { IOnDemandRender_$type } from "igniteui-angular-core";
/**
 * @hidden
 */
var DataToolTipLayer = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(DataToolTipLayer, _super);
    function DataToolTipLayer() {
        var _this = _super.call(this) || this;
        _this.rw = 1;
        _this.sy = new Dictionary$2(String_$type, Base.$, 0);
        _this.sz = new List$1(String_$type, 0);
        _this.ro = 8;
        _this.rs = 11;
        _this.sb = null;
        _this.r3 = null;
        _this.r6 = null;
        _this.r8 = null;
        _this.r5 = null;
        _this.r7 = null;
        _this.sa = null;
        _this.r9 = null;
        _this.r4 = null;
        var a = new DataToolTipLayerFrame();
        var b = new DataToolTipLayerFrame();
        var c = new DataToolTipLayerFrame();
        _this.p5 = a;
        _this.p4 = b;
        _this.p6 = c;
        _this.ab = DataToolTipLayer.$;
        return _this;
    }
    DataToolTipLayer.prototype.get_db = function () {
        return true;
    };
    DataToolTipLayer.prototype.bx = function () {
        return new DataToolTipLayerView(this);
    };
    DataToolTipLayer.prototype.ly = function (a) {
        _super.prototype.ly.call(this, a);
        this.r0 = a;
    };
    DataToolTipLayer.prototype.get_dk = function () {
        return true;
    };
    Object.defineProperty(DataToolTipLayer.prototype, "rx", {
        get: function () {
            return this.rw;
        },
        set: function (a) {
            var b = this.rw;
            this.rw = a;
            if (b != this.rw) {
                this.raisePropertyChanged("ActualGroupingMode", enumGetBox(DataToolTipLayerGroupingMode_$type, b), enumGetBox(DataToolTipLayerGroupingMode_$type, this.rw));
            }
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayer.prototype.rz = function () {
        var e_1, _a;
        var a = true;
        var b = true;
        var c = true;
        var d = true;
        if (this.ry != 0) {
            return this.ry;
        }
        var e = this.rf();
        if (e != null) {
            try {
                for (var _b = __values(fromEnum(e.da())), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var f = _c.value;
                    if (!f.dc && !f.ec) {
                        a = false;
                    }
                    if (!f.dc && !f.d6) {
                        b = false;
                    }
                    if (!f.dc && !f.ed) {
                        c = false;
                    }
                    if (!f.dc && !f.ea) {
                        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.l3 = function (a, b, c, d) {
        _super.prototype.l3.call(this, a, b, c, d);
        switch (b) {
            case DataToolTipLayer.$$p[37]:
                this.mh(true);
                break;
            case DataToolTipLayer.$$p[44]:
                this.mh(true);
                break;
            case DataToolTipLayer.$$p[8]:
                this.rx = this.rz();
                break;
            case "ActualGroupingMode":
                this.mh(true);
                break;
            case DataToolTipLayer.$$p[6]:
                this.rp = this.rr();
                break;
            case DataToolTipLayer.$$p[7]:
                this.rt = this.rv();
                break;
            case "SeriesViewer":
                this.r0.ch();
                break;
            case DataToolTipLayer.$$p[26]:
            case DataToolTipLayer.$$p[20]:
            case DataToolTipLayer.$$p[5]:
            case DataToolTipLayer.$$p[19]:
            case DataToolTipLayer.$$p[4]:
            case DataToolTipLayer.$$p[45]:
            case DataToolTipLayer.$$p[47]:
            case DataToolTipLayer.$$p[48]:
            case DataToolTipLayer.$$p[49]:
            case DataToolTipLayer.$$p[46]:
            case DataToolTipLayer.$$p[52]:
            case DataToolTipLayer.$$p[51]:
            case DataToolTipLayer.$$p[50]:
            case DataToolTipLayer.$$p[53]:
            case DataToolTipLayer.$$p[54]:
            case DataToolTipLayer.$$p[58]:
            case DataToolTipLayer.$$p[57]:
            case DataToolTipLayer.$$p[56]:
            case DataToolTipLayer.$$p[55]:
            case "ValueTextStyle":
            case DataToolTipLayer.$$p[12]:
            case DataToolTipLayer.$$p[11]:
            case DataToolTipLayer.$$p[9]:
            case DataToolTipLayer.$$p[10]:
            case DataToolTipLayer.$$p[13]:
            case DataToolTipLayer.$$p[18]:
            case DataToolTipLayer.$$p[16]:
            case DataToolTipLayer.$$p[17]:
            case DataToolTipLayer.$$p[14]:
            case DataToolTipLayer.$$p[15]:
            case "HeaderTextStyle":
            case DataToolTipLayer.$$p[30]:
            case "SummaryTitleTextStyle":
            case DataToolTipLayer.$$p[33]:
            case DataToolTipLayer.$$p[32]:
            case DataToolTipLayer.$$p[31]:
            case DataToolTipLayer.$$p[29]:
            case DataToolTipLayer.$$p[36]:
            case "SummaryValueTextStyle":
            case DataToolTipLayer.$$p[28]:
            case DataToolTipLayer.$$p[27]:
            case "SummaryLabelTextStyle":
            case DataToolTipLayer.$$p[35]:
            case DataToolTipLayer.$$p[34]:
            case "SummaryUnitsTextStyle":
            case DataToolTipLayer.$$p[0]:
            case DataToolTipLayer.$$p[1]:
            case DataToolTipLayer.$$p[40]:
            case DataToolTipLayer.$$p[43]:
            case DataToolTipLayer.$$p[41]:
            case DataToolTipLayer.$$p[42]:
            case "UnitsTextStyle":
            case DataToolTipLayer.$$p[39]:
            case DataToolTipLayer.$$p[38]:
            case "TitleTextStyle":
            case DataToolTipLayer.$$p[21]:
            case DataToolTipLayer.$$p[22]:
            case DataToolTipLayer.$$p[23]:
            case "LabelTextStyle":
                this.wg(b, c, d);
                break;
        }
    };
    DataToolTipLayer.prototype.wg = function (a, b, c) {
        if (!this.sy.containsKey(a)) {
            this.sz.add(a);
            this.sy.addItem(a, c);
        }
        else {
            this.sy.item(a, c);
        }
        this.mh(true);
    };
    DataToolTipLayer.prototype.wk = function (a, b) {
        switch (a) {
            case DataToolTipLayer.$$p[8]:
                this.ry = EnumUtil.getEnumValue(DataToolTipLayerGroupingMode_$type, b);
                break;
            case DataToolTipLayer.$$p[24]:
                this.s3 = b;
                break;
            case DataToolTipLayer.$$p[25]:
                this.s4 = b;
                break;
            case DataToolTipLayer.$$p[2]:
                this.s1 = b;
                break;
            case DataToolTipLayer.$$p[3]:
                this.s2 = b;
                break;
            case DataToolTipLayer.$$p[6]:
                this.rq = EnumUtil.getEnumValue(DataTooltipGroupedPositionX_$type, b);
                break;
            case DataToolTipLayer.$$p[7]:
                this.ru = EnumUtil.getEnumValue(DataTooltipGroupedPositionY_$type, b);
                break;
            case DataToolTipLayer.$$p[26]:
                this.st = b;
                break;
            case DataToolTipLayer.$$p[20]:
                this.rd = b;
                break;
            case DataToolTipLayer.$$p[5]:
                this.q8 = b;
                break;
            case DataToolTipLayer.$$p[19]:
                this.rc = b;
                break;
            case DataToolTipLayer.$$p[4]:
                this.q7 = b;
                break;
            case DataToolTipLayer.$$p[45]:
                this.rh = EnumUtil.getEnumValue(DataAbbreviationMode_$type, b);
                break;
            case DataToolTipLayer.$$p[47]:
                this.t3 = typeGetValue(b);
                break;
            case DataToolTipLayer.$$p[48]:
                this.t4 = typeGetValue(b);
                break;
            case DataToolTipLayer.$$p[49]:
                this.rn = EnumUtil.getEnumValue(DataLegendValueMode_$type, b);
                break;
            case DataToolTipLayer.$$p[46]:
                this.vy = b;
                break;
            case DataToolTipLayer.$$p[52]:
                this.sv = b;
                break;
            case DataToolTipLayer.$$p[51]:
                this.v4 = b;
                break;
            case DataToolTipLayer.$$p[50]:
                this.re = b;
                break;
            case DataToolTipLayer.$$p[53]:
                this.yv = b;
                break;
            case DataToolTipLayer.$$p[54]:
                this.sw = b;
                break;
            case DataToolTipLayer.$$p[58]:
                this.wd = b;
                break;
            case DataToolTipLayer.$$p[57]:
                this.sx = b;
                break;
            case DataToolTipLayer.$$p[56]:
                this.yw = b;
                break;
            case DataToolTipLayer.$$p[55]:
                this.yg = b;
                break;
            case "ValueTextStyle":
                this.sk = b;
                break;
            case DataToolTipLayer.$$p[12]:
                this.um = b;
                break;
            case DataToolTipLayer.$$p[11]:
                this.rb = b;
                break;
            case DataToolTipLayer.$$p[9]:
                this.ui = b;
                break;
            case DataToolTipLayer.$$p[10]:
                this.ri = EnumUtil.getEnumValue(DataLegendHeaderDateMode_$type, b);
                break;
            case DataToolTipLayer.$$p[13]:
                this.rj = EnumUtil.getEnumValue(DataLegendHeaderTimeMode_$type, b);
                break;
            case DataToolTipLayer.$$p[18]:
                this.ur = b;
                break;
            case DataToolTipLayer.$$p[16]:
                this.x8 = b;
                break;
            case DataToolTipLayer.$$p[17]:
                this.yp = b;
                break;
            case DataToolTipLayer.$$p[14]:
                this.yo = b;
                break;
            case DataToolTipLayer.$$p[15]:
                this.sm = b;
                break;
            case "HeaderTextStyle":
                this.sc = b;
                break;
            case DataToolTipLayer.$$p[30]:
                this.yb = b;
                break;
            case "SummaryTitleTextStyle":
                this.sf = b;
                break;
            case DataToolTipLayer.$$p[33]:
                this.rl = EnumUtil.getEnumValue(DataLegendSummaryType_$type, b);
                break;
            case DataToolTipLayer.$$p[32]:
                this.va = b;
                break;
            case DataToolTipLayer.$$p[31]:
                this.ys = b;
                break;
            case DataToolTipLayer.$$p[29]:
                this.yr = b;
                break;
            case DataToolTipLayer.$$p[36]:
                this.yd = b;
                break;
            case "SummaryValueTextStyle":
                this.sh = b;
                break;
            case DataToolTipLayer.$$p[28]:
                this.u5 = b;
                break;
            case DataToolTipLayer.$$p[27]:
                this.ya = b;
                break;
            case "SummaryLabelTextStyle":
                this.se = b;
                break;
            case DataToolTipLayer.$$p[35]:
                this.vg = b;
                break;
            case DataToolTipLayer.$$p[34]:
                this.yc = b;
                break;
            case "SummaryUnitsTextStyle":
                this.sg = b;
                break;
            case DataToolTipLayer.$$p[0]:
                this.yn = b;
                break;
            case DataToolTipLayer.$$p[1]:
                this.r2 = EnumUtil.getEnumValue(LegendItemBadgeShape_$type, b);
                break;
            case DataToolTipLayer.$$p[40]:
                this.rm = EnumUtil.getEnumValue(DataLegendUnitsMode_$type, b);
                break;
            case DataToolTipLayer.$$p[43]:
                this.vr = b;
                break;
            case DataToolTipLayer.$$p[41]:
                this.yf = b;
                break;
            case DataToolTipLayer.$$p[42]:
                this.yu = b;
                break;
            case "UnitsTextStyle":
                this.sj = b;
                break;
            case DataToolTipLayer.$$p[39]:
                this.yt = b;
                break;
            case DataToolTipLayer.$$p[38]:
                this.ye = b;
                break;
            case "TitleTextStyle":
                this.si = b;
                break;
            case DataToolTipLayer.$$p[21]:
                this.rk = EnumUtil.getEnumValue(DataLegendLabelMode_$type, b);
                break;
            case DataToolTipLayer.$$p[22]:
                this.x9 = b;
                break;
            case DataToolTipLayer.$$p[23]:
                this.yq = b;
                break;
            case "LabelTextStyle":
                this.sd = b;
                break;
        }
    };
    DataToolTipLayer.prototype.wh = function (a) {
        for (var b = 0; b < this.sz.count; b++) {
            var c = this.sz._inner[b];
            a.updatePropertyByName(c, this.sy.item(c));
        }
    };
    DataToolTipLayer.prototype.qn = function (a, b) {
        {
            if (!this.as.c) {
                this.mh(b);
            }
        }
    };
    DataToolTipLayer.prototype.qo = function (a, b) {
        if (!this.as.c) {
            this.mh(b);
        }
    };
    DataToolTipLayer.prototype.qq = function (a, b) {
        var e_2, _a;
        var _this = this;
        _super.prototype.qq.call(this, a, b);
        this.rw = this.rz();
        var c = a;
        var d = this.r0.b6;
        var e = this.su;
        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.q4.x) && isNaN_(this.q4.y)) {
            d.count = 0;
            return;
        }
        {
            if (this.rx == 2) {
                var g_1 = 0;
                {
                    try {
                        for (var _b = __values(fromEnum(this.cd.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                            var h = _c.value;
                            if (this.qb(h)) {
                                this.wj(h, c, e, f, g_1);
                                g_1++;
                            }
                            if (h.isStacked) {
                                h.la(function (i) {
                                    if (_this.qb(i)) {
                                        _this.wj(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.wf(c);
                }
                d.count = g_1;
            }
            else {
                var i = this.rf();
                var j = this.s0(i);
                var k = this.r1(i, j, e);
                this.wi(k, c, e);
            }
        }
    };
    DataToolTipLayer.prototype.s0 = 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.dd)), _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.rf = function () {
        var e_4, _a, e_5, _b;
        if (this.rg != null) {
            return this.rg;
        }
        if (this.cd == null) {
            return null;
        }
        try {
            for (var _c = __values(fromEnum(this.cd.series)), _d = _c.next(); !_d.done; _d = _c.next()) {
                var a = _d.value;
                if (a.dg) {
                    var b = a.ar();
                    if (b != null && b.cn()) {
                        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.cd.series)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var c = _f.value;
                if (!c.dg) {
                    var d = c.ag();
                    var e = d != null && d.length > 0 ? d[0] : null;
                    if (e != null && e.cn()) {
                        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.r1 = 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;
        for (var m = 0; m < b.count; m++) {
            var n = b.item(m);
            k = n.cd.l;
            l = n.cd.m;
            if (n.dg) {
                if (n.isStacked) {
                    continue;
                }
                var o = n;
                if (!o.categoryAxis.cn()) {
                    continue;
                }
                if (i) {
                    h = n.isVertical;
                }
                else {
                    if (h != n.isVertical) {
                        continue;
                    }
                }
                var p = this.qj(n);
                if (!p.c) {
                    continue;
                }
                j = n.pg(p.d);
                var q = n.pl(p.d, c, false);
                if (h) {
                    if (!isNaN_(q.y)) {
                        d = Math.min(d, q.y);
                        e = Math.max(e, q.y);
                    }
                }
                else {
                    if (!isNaN_(q.x)) {
                        d = Math.min(d, q.x);
                        e = Math.max(e, q.x);
                    }
                }
            }
            else {
                var r = n.ag();
                for (var s = 0; s < r.length; s++) {
                    if (!r[s].cn()) {
                        continue;
                    }
                }
                var t = n.pl(this.q4, c, false);
                j = n.pg(this.q4);
                if (h) {
                    if (!isNaN_(t.y)) {
                        d = Math.min(d, t.y);
                        e = Math.max(e, t.y);
                    }
                }
                else {
                    if (!isNaN_(t.x)) {
                        d = Math.min(d, t.x);
                        e = Math.max(e, t.x);
                    }
                }
            }
            var u = null;
            var v = n.ht(this.q4);
            if (n.dl && v != null) {
                u = n.au(v);
            }
            else {
                u = new DataContext();
                u.item = v;
                u.series = n;
            }
            f.add(u);
        }
        var w = 0;
        var x = 0;
        if (h) {
            x = (d + e) / 2;
            w = this.py.right;
            if (!isNaN_(j.x)) {
                w = j.x;
            }
            if (x < 0 || x > this.py.bottom) {
                x = NaN;
            }
        }
        else {
            w = (d + e) / 2;
            if (!isNaN_(j.y)) {
                x = j.y;
            }
            if (w < 0 || w > this.py.right) {
                w = NaN;
            }
        }
        var y = new DataToolTipSeriesInfo();
        y.f = { $type: Point_$type, x: w, y: x };
        y.e = { $type: Point_$type, x: j.x, y: j.y };
        y.b = f;
        y.a = h;
        return y;
    };
    DataToolTipLayer.prototype.ld = function () {
        this.q4 = { $type: Point_$type, x: NaN, y: NaN };
        this.b0.ap();
    };
    Object.defineProperty(DataToolTipLayer.prototype, "yk", {
        get: function () {
            var a = RectUtil.n(this.b0.bu);
            var b = new Size(1, this.b0.bu.width, this.b0.bu.height);
            return new Rect(3, a, b);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "yj", {
        get: function () {
            var a = RectUtil.n(this.b0.bu);
            var b = new Size(1, this.b0.bu.width, this.b0.bu.height);
            return new Rect(3, this.r0.ci(a), b);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "yi", {
        get: function () {
            var a = new Rect(0, 0, 0, this.cd.m, this.cd.l);
            var b = RectUtil.n(a);
            var c = new Size(1, a.width, a.height);
            return new Rect(3, this.r0.ci(b), c);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "ym", {
        get: function () {
            var a = { $type: Point_$type, x: 0, y: 0 };
            return new Rect(3, a, this.r0.cn());
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayer.prototype.yl = function () {
        return this.yk;
    };
    DataToolTipLayer.prototype.sq = function (a, b, c) {
        if (Rect.l_op_Equality(a, Rect.empty)) {
            return false;
        }
        var d = a.top;
        return c < d;
    };
    DataToolTipLayer.prototype.sn = 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.so = function (a, b, c) {
        if (Rect.l_op_Equality(a, Rect.empty)) {
            return false;
        }
        var d = a.left;
        return c < d;
    };
    DataToolTipLayer.prototype.sp = 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.tt = function (a, b) {
        return a.top + b;
    };
    DataToolTipLayer.prototype.tr = function (a, b, c) {
        return a.bottom - c.height - b;
    };
    DataToolTipLayer.prototype.ts = function (a, b) {
        return ((a.bottom + a.top) / 2) - (b.height / 2);
    };
    DataToolTipLayer.prototype.t2 = function (a, b, c, d, e) {
        var f = c.y - d.height - b;
        return f;
    };
    DataToolTipLayer.prototype.t0 = function (a, b, c, d, e) {
        var f = c.y + b;
        return f;
    };
    DataToolTipLayer.prototype.t1 = function (a, b, c, d, e) {
        var f = c.y - (d.height / 2);
        return f;
    };
    DataToolTipLayer.prototype.tw = function (a, b, c, d, e) {
        var f = c.y - d.height;
        f = f - b;
        return f;
    };
    DataToolTipLayer.prototype.tu = function (a, b, c, d, e) {
        var f = c.y;
        f = f + b;
        return f;
    };
    DataToolTipLayer.prototype.tv = function (a, b, c, d, e) {
        var f = c.y - (d.height / 2);
        return f;
    };
    DataToolTipLayer.prototype.tc = function (a, b) {
        return a.left + b;
    };
    DataToolTipLayer.prototype.te = function (a, b, c) {
        return (a.right - (c.width)) - b;
    };
    DataToolTipLayer.prototype.td = function (a, b, c) {
        return ((a.right + a.left) / 2) - (c.width / 2) + b;
    };
    DataToolTipLayer.prototype.tl = function (a, b, c, d, e) {
        var f = (c.x - d.width) - b;
        return f;
    };
    DataToolTipLayer.prototype.tn = function (a, b, c, d, e) {
        var f = c.x + b;
        return f;
    };
    DataToolTipLayer.prototype.tm = function (a, b, c, d, e) {
        var f = (c.x - (d.width / 2));
        f = f + b;
        return f;
    };
    DataToolTipLayer.prototype.ti = function (a, b, c, d, e) {
        var f = c.x - d.width;
        f = f - b;
        return f;
    };
    DataToolTipLayer.prototype.tk = function (a, b, c, d, e) {
        var f = c.x;
        f = f + b;
        return f;
    };
    DataToolTipLayer.prototype.tj = function (a, b, c, d, e) {
        var f = c.x - (d.width / 2);
        f = f + b;
        return f;
    };
    DataToolTipLayer.prototype.s8 = function (a, b, c, d, e, f, g, h) {
        switch (a) {
            case 1:
                {
                    return this.tw(e, b, h, f, true);
                }
            case 2:
                {
                    return this.tu(e, b, h, f, true);
                }
            case 3:
                {
                    return this.tv(e, b, h, f, true);
                }
            case 5: return this.tx(e, c, b, h, f);
            case 6: return this.ty(e, c, b, h, f);
            case 4: return this.tz(e, c, b, h, f);
            case 8: return this.to(e, c, b, h, f);
            case 9: return this.tp(e, c, b, h, f);
            case 7: return this.tq(e, c, b, h, f);
            case 13: return this.tt(d, b);
            case 14: return this.tr(d, b, f);
            case 15: return this.ts(d, f);
            case 10: return this.t2(e, b, g, f, true);
            case 12: return this.t1(e, b, g, f, true);
            case 11:
            default: return this.t0(e, b, g, f, true);
        }
    };
    DataToolTipLayer.prototype.tf = 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.tg = 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.th = function (a, b, c, d, e) {
        var f = d.x;
        f = f + b / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.s9 = 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.ta = 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.tb = function (a, b, c, d, e) {
        var f = d.x;
        f = f - b / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.tq = 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.tp = 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.to = function (a, b, c, d, e) {
        var f = d.y;
        f = f + b / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.tz = 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.ty = 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.tx = function (a, b, c, d, e) {
        var f = d.y;
        f = f - b / 2;
        f = f + c;
        return f;
    };
    DataToolTipLayer.prototype.s7 = function (a, b, c, d, e, f, g, h) {
        switch (a) {
            case 10: return this.tl(e, b, g, f, true);
            case 11: return this.tn(e, b, g, f, true);
            case 12: return this.tm(e, b, g, f, true);
            case 13: return this.tc(d, b);
            case 14: return this.te(e, b, f);
            case 15: return this.td(e, b, f);
            case 5: return this.tb(e, c, b, h, f);
            case 6: return this.ta(e, c, b, h, f);
            case 4: return this.s9(e, c, b, h, f);
            case 8: return this.th(e, c, b, h, f);
            case 9: return this.tg(e, c, b, h, f);
            case 7: return this.tf(e, c, b, h, f);
            case 1:
                {
                    return this.ti(e, b, h, f, true);
                }
            case 3:
                {
                    return this.tj(e, b, h, f, true);
                }
            case 2:
            default:
                {
                    return this.tk(e, b, h, f, true);
                }
        }
    };
    DataToolTipLayer.prototype.yh = function (a, b, c, d) {
        var e = this.rp;
        var f = this.rt;
        var g = this.rf();
        var h = 0;
        if (g != null && g.ca && this.cd != null) {
            h = g.getCategorySize(this.cd.sf, this.py, this.getEffectiveViewport());
            if (g.categoryMode == 0) {
                h = 0;
            }
        }
        var i = this.s5(e);
        var j = this.s6(f);
        var k = this.s7(e, i, h, this.yk, a, b, c, d);
        var l = this.s8(f, j, h, this.yk, a, b, c, d);
        var m = this.sr(a, i, k, b);
        var n = this.ss(a, j, l, b);
        if (!m) {
            var o = this.q9(e);
            var p = 0;
            while (!m && p < o.length) {
                e = o[p];
                i = this.s5(e);
                k = this.s7(e, i, h, this.yk, a, b, c, d);
                m = this.sr(a, i, k, b);
                p++;
            }
        }
        if (!n) {
            var q = this.ra(f);
            var r = 0;
            while (!n && r < q.length) {
                f = q[r];
                j = this.s6(f);
                l = this.s8(f, j, h, this.yk, a, b, c, d);
                n = this.ss(a, j, l, b);
                r++;
            }
        }
        return { $type: Point_$type, x: k, y: l };
    };
    DataToolTipLayer.prototype.s6 = function (a) {
        if (!isNaN_(this.s4)) {
            return this.s4;
        }
        switch (a) {
            case 1: return this.s2;
            case 2: return this.s2;
            case 3: return 0;
            case 4: return this.s2;
            case 5: return this.s2;
            case 6: return this.s2;
            case 7: return this.s2;
            case 8: return this.s2;
            case 9: return 0;
            case 10: return this.s2;
            case 11: return this.s2;
            case 12: return 0;
            case 13: return this.s2;
            case 14: return this.s2;
            case 15: return 0;
        }
        return this.s2;
    };
    DataToolTipLayer.prototype.s5 = function (a) {
        if (!isNaN_(this.s3)) {
            return this.s3;
        }
        switch (a) {
            case 4: return this.s1;
            case 6: return 0;
            case 5: return this.s1;
            case 13: return this.s1;
            case 15: return 0;
            case 14: return this.s1;
            case 7: return this.s1;
            case 9: return 0;
            case 8: return this.s1;
            case 1: return this.s1;
            case 3: return 0;
            case 2: return this.s1;
            case 10: return this.s1;
            case 12: return 0;
            case 11: return this.s1;
        }
        return this.s1;
    };
    DataToolTipLayer.prototype.ra = function (a) {
        var b = [a];
        switch (a) {
            case 1:
                b = [2, 3];
                break;
            case 2:
                b = [1, 3];
                break;
            case 3:
                b = [1, 2];
                break;
            case 4:
                b = [8, 7, 3];
                break;
            case 5:
                b = [7, 8, 3];
                break;
            case 6:
                b = [9, 8, 4, 3];
                break;
            case 7:
                b = [5, 4, 2];
                break;
            case 8:
                b = [4, 5, 3];
                break;
            case 9:
                b = [6, 4, 8, 3];
                break;
            case 10:
                b = [11, 12];
                break;
            case 11:
                b = [10, 12];
                break;
            case 12:
                b = [10, 11];
                break;
            case 13: break;
            case 14: break;
            case 15: break;
        }
        return b;
    };
    DataToolTipLayer.prototype.q9 = function (a) {
        var b = [a];
        switch (a) {
            case 1:
                b = [2, 3];
                break;
            case 2:
                b = [1, 3];
                break;
            case 3:
                b = [1, 2];
                break;
            case 4:
                b = [8, 7, 3];
                break;
            case 5:
                b = [7, 8, 1];
                break;
            case 6:
                b = [9, 8, 4, 3];
                break;
            case 7:
                b = [5, 4, 2];
                break;
            case 8:
                b = [4, 5, 3];
                break;
            case 9:
                b = [6, 4, 8, 3];
                break;
            case 10:
                b = [11, 12];
                break;
            case 11:
                b = [10, 12];
                break;
            case 12:
                b = [10, 11];
                break;
            case 13: break;
            case 14: break;
            case 15: break;
        }
        return b;
    };
    DataToolTipLayer.prototype.sr = function (a, b, c, d) {
        return !(this.so(a, b, c) || this.sp(a, b, c, d));
    };
    DataToolTipLayer.prototype.ss = function (a, b, c, d) {
        return !(this.sq(a, b, c) || this.sn(a, b, c, d));
    };
    DataToolTipLayer.prototype.wf = 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.sl(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.b0.bu.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.b0.bu.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.sl = function (a) {
        if (a.count <= 1) {
            return false;
        }
        var b = this.b0.bu;
        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.wj = function (a, b, c, d, e) {
        var f = this.qj(a);
        if (!f.c) {
            return;
        }
        var g = a.pl(f.d, c, d);
        var h = this.r0.b6;
        var i = this.q4;
        if (!c) {
            i = this.po(g);
        }
        var j = a.ht(i);
        var k = h.item(e);
        var l = this.b0.bu;
        var m = this.r0.b5(k);
        if (!Base.equalsStatic(m.target, this.cd)) {
            m.target = this.cd;
        }
        m.includedSeries = [a.dataLegendKey];
        this.wh(m);
        if (!this.r0.b8(k, a)) {
            return;
        }
        var n = this.r0.cm(k);
        b.i.add1(k);
        var o = g.x;
        var p = g.x;
        p = Math.max(p, l.left);
        p = Math.min(p, l.right);
        b.l.add(p);
        var q = g.y;
        q = Math.max(q, l.top);
        q = Math.min(q, l.bottom);
        b.m.add(q);
        var r = DeviceUtils.g(10);
        var s = g.x + r;
        if (s + n.width > l.right) {
            s = (o - n.width) - r;
        }
        if (s < l.left) {
            s = l.left;
        }
        b.f.add(s);
        var t = (g.y - n.height) - r;
        if (t + n.height > l.bottom) {
            t = (l.bottom - n.height) - r;
        }
        if (t < l.top) {
            t = l.top;
        }
        b.g.add(t);
        b.k.add(n.width);
        b.j.add(n.height);
        var u = this.oy;
        if (u == null) {
            u = this.o2;
        }
        if (u == null) {
            u = a.oy;
        }
        b.h.add(u);
    };
    DataToolTipLayer.prototype.wi = function (a, b, c) {
        var e_6, _a;
        this.ro = this.rr();
        this.rs = this.rv();
        var d = a.f;
        var e = a.e;
        var f = 0;
        var g = this.r0.b6.item(0);
        this.r0.b8(g, null);
        var h = this.r0.b5(g);
        if (!Base.equalsStatic(h.target, this.cd)) {
            h.target = this.cd;
        }
        var i = new List$1(String_$type, 0);
        var j = this.rf();
        if (j != null) {
            try {
                for (var _b = __values(fromEnum(j.da())), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var k = _c.value;
                    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();
        }
        else {
            h.includedSeries = null;
        }
        this.wh(h);
        h.targetCursorPositionX = this.q4.x;
        h.targetCursorPositionY = this.q4.y;
        var l = this.r0.cm(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.b0.bu;
        var t = this.r0.cn();
        var u = this.yl();
        var v = this.yh(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.r0.b6.count = 1;
    };
    DataToolTipLayer.prototype.t5 = function (a) {
        return a.toolTip;
    };
    DataToolTipLayer.prototype.qt = function (a, b) {
        _super.prototype.qt.call(this, a, b);
        var c = a;
        var d = c.m.count;
        var e = b.bu.left;
        var f = b.bu.right;
        var g = b.bu.top;
        var h = b.bu.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.r0.cf(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.r0.cf(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];
            this.r0.cg(o, p, q, r, s);
        }
    };
    DataToolTipLayer.prototype.em = function () {
        return true;
    };
    Object.defineProperty(DataToolTipLayer.prototype, "rp", {
        get: function () {
            return this.ro;
        },
        set: function (a) {
            var b = this.ro;
            this.ro = a;
            if (b != this.ro) {
                this.raisePropertyChanged("ActualGroupedPositionModeX", enumGetBox(DataTooltipGroupedPositionX_$type, b), enumGetBox(DataTooltipGroupedPositionX_$type, this.ro));
            }
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayer.prototype.rr = function () {
        var e_7, _a;
        if (this.cd == null) {
            return 2;
        }
        var a = false;
        var b = false;
        var c = false;
        var d = false;
        var e = this.rf();
        if (e == null) {
            return 2;
        }
        try {
            for (var _b = __values(fromEnum(e.dd)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var f = _c.value;
                if (f.dh) {
                    a = true;
                }
                if (f.isVertical) {
                    b = true;
                }
                if (f.d6) {
                    c = true;
                }
                if (f.ec) {
                    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.rq);
        if (this.rq != 0) {
            if (h && b) {
                return 11;
            }
            return this.rq;
        }
        if (c || d) {
            return 11;
        }
        if (b) {
            return 11;
        }
        if (a) {
            return 8;
        }
        return 8;
    };
    Object.defineProperty(DataToolTipLayer.prototype, "rt", {
        get: function () {
            return this.rs;
        },
        set: function (a) {
            var b = this.rs;
            this.rs = a;
            if (b != this.rs) {
                this.raisePropertyChanged("ActualPositionModeY", enumGetBox(DataTooltipGroupedPositionY_$type, b), enumGetBox(DataTooltipGroupedPositionY_$type, this.rs));
            }
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayer.prototype.rv = function () {
        var e_8, _a;
        if (this.cd == null) {
            return 11;
        }
        var a = false;
        var b = false;
        var c = false;
        var d = this.rf();
        if (d == null) {
            return 11;
        }
        try {
            for (var _b = __values(fromEnum(d.da())), _c = _b.next(); !_c.done; _c = _b.next()) {
                var e = _c.value;
                if (e.isVertical) {
                    a = true;
                }
                if (e.d6) {
                    b = true;
                }
                if (e.ec) {
                    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.ru);
        if (this.ru != 0) {
            if (g && !a) {
                return 11;
            }
            return this.ru;
        }
        if (b || c) {
            return 11;
        }
        if (a) {
            return 8;
        }
        if (!a) {
            return 11;
        }
        return 11;
    };
    Object.defineProperty(DataToolTipLayer.prototype, "sk", {
        get: function () {
            return this.sb;
        },
        set: function (a) {
            var b = this.sb;
            this.sb = a;
            if (b != this.sb) {
                this.raisePropertyChanged("ValueTextStyle", b, this.sb);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "sc", {
        get: function () {
            return this.r3;
        },
        set: function (a) {
            var b = this.r3;
            this.r3 = a;
            if (b != this.r3) {
                this.raisePropertyChanged("HeaderTextStyle", b, this.r3);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "sf", {
        get: function () {
            return this.r6;
        },
        set: function (a) {
            var b = this.r6;
            this.r6 = a;
            if (b != this.r6) {
                this.raisePropertyChanged("SummaryTitleTextStyle", b, this.r6);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "sh", {
        get: function () {
            return this.r8;
        },
        set: function (a) {
            var b = this.r8;
            this.r8 = a;
            if (b != this.r8) {
                this.raisePropertyChanged("SummaryValueTextStyle", b, this.r8);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "se", {
        get: function () {
            return this.r5;
        },
        set: function (a) {
            var b = this.r5;
            this.r5 = a;
            if (b != this.r5) {
                this.raisePropertyChanged("SummaryLabelTextStyle", b, this.r5);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "sg", {
        get: function () {
            return this.r7;
        },
        set: function (a) {
            var b = this.r7;
            this.r7 = a;
            if (b != this.r7) {
                this.raisePropertyChanged("SummaryUnitsTextStyle", b, this.r7);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "sj", {
        get: function () {
            return this.sa;
        },
        set: function (a) {
            var b = this.sa;
            this.sa = a;
            if (b != this.sa) {
                this.raisePropertyChanged("UnitsTextStyle", b, this.sa);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "si", {
        get: function () {
            return this.r9;
        },
        set: function (a) {
            var b = this.r9;
            this.r9 = a;
            if (b != this.r9) {
                this.raisePropertyChanged("TitleTextStyle", b, this.r9);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(DataToolTipLayer.prototype, "sd", {
        get: function () {
            return this.r4;
        },
        set: function (a) {
            var b = this.r4;
            this.r4 = a;
            if (b != this.r4) {
                this.raisePropertyChanged("LabelTextStyle", b, this.r4);
            }
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayer.$t = markType(DataToolTipLayer, 'DataToolTipLayer', AnnotationLayer.$);
    DataToolTipLayer.$$p = markDep(DependencyProperty, PropertyMetadata, DataToolTipLayer, 'raisePropertyChanged', ['BadgeMargin:yn:wl', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'BadgeShape:r2:wm', [LegendItemBadgeShape_$type, enumGetBox(LegendItemBadgeShape_$type, 0)], 'DefaultPositionOffsetX:s1:wn', [1, DeviceUtils.g(10)], 'DefaultPositionOffsetY:s2:wo', [1, DeviceUtils.g(10)], 'ExcludedColumns:q7:wp', [Array_$type, null], 'ExcludedSeries:q8:wq', [Array_$type, null], 'GroupedPositionModeX:rq:wr', [DataTooltipGroupedPositionX_$type, enumGetBox(DataTooltipGroupedPositionX_$type, 0)], 'GroupedPositionModeY:ru:ws', [DataTooltipGroupedPositionY_$type, enumGetBox(DataTooltipGroupedPositionY_$type, 0)], 'GroupingMode:ry:wt', [DataToolTipLayerGroupingMode_$type, enumGetBox(DataToolTipLayerGroupingMode_$type, 0)], 'HeaderFormatCulture:ui:wu', [2, stringEmpty()], 'HeaderFormatDate:ri:wv', [DataLegendHeaderDateMode_$type, enumGetBox(DataLegendHeaderDateMode_$type, 0)], 'HeaderFormatSpecifiers:rb:ww', [Array_$type, null], 'HeaderFormatString:um:wx', [2, null], 'HeaderFormatTime:rj:wy', [DataLegendHeaderTimeMode_$type, enumGetBox(DataLegendHeaderTimeMode_$type, 0)], 'HeaderRowMargin:yo:wz', [Thickness.$, new Thickness(0, 5)], 'HeaderRowVisible:sm:w0', [0, true], 'HeaderTextColor:x8:w1', [Brush.$, null], 'HeaderTextMargin:yp:w2', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'HeaderText:ur:w3', [2, null], 'IncludedColumns:rc:w4', [Array_$type, null], 'IncludedSeries:rd:w5', [Array_$type, null], 'LabelDisplayMode:rk:w6', [DataLegendLabelMode_$type, enumGetBox(DataLegendLabelMode_$type, 0)], 'LabelTextColor:x9:w7', [Brush.$, null], 'LabelTextMargin:yq:w8', [Thickness.$, new Thickness(1, 8, 0, 0, 0)], 'PositionOffsetX:s3:w9', [1, NaN], 'PositionOffsetY:s4:xa', [1, NaN], 'ShouldUpdateWhenSeriesDataChanges:st:xb', [0, true], 'SummaryLabelTextColor:ya:xc', [Brush.$, null], 'SummaryLabelText:u5:xd', [2, null], 'SummaryRowMargin:yr:xe', [Thickness.$, new Thickness(0, 5)], 'SummaryTitleTextColor:yb:xf', [Brush.$, null], 'SummaryTitleTextMargin:ys:xg', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'SummaryTitleText:va:xh', [2, null], 'SummaryType:rl:xi', [DataLegendSummaryType_$type, enumGetBox(DataLegendSummaryType_$type, 0)], 'SummaryUnitsTextColor:yc:xj', [Brush.$, null], 'SummaryUnitsText:vg:xk', [2, null], 'SummaryValueTextColor:yd:xl', [Brush.$, null], 'TargetAxis:rg:xm', [Axis.$, null], 'TitleTextColor:ye:xn', [Brush.$, null], 'TitleTextMargin:yt:xo', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'UnitsDisplayMode:rm:xp', [DataLegendUnitsMode_$type, enumGetBox(DataLegendUnitsMode_$type, 0)], 'UnitsTextColor:yf:xq', [Brush.$, null], 'UnitsTextMargin:yu:xr', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'UnitsText:vr:xs', [2, null], 'UseInterpolation:su:xt', [0, false], 'ValueFormatAbbreviation:rh:xu', [DataAbbreviationMode_$type, enumGetBox(DataAbbreviationMode_$type, 0)], 'ValueFormatCulture:vy:xv', [2, stringEmpty()], 'ValueFormatMaxFractions:t3:xw', [1, -1], 'ValueFormatMinFractions:t4:xx', [1, -1], 'ValueFormatMode:rn:xy', [DataLegendValueMode_$type, enumGetBox(DataLegendValueMode_$type, 0)], 'ValueFormatSpecifiers:re:xz', [Array_$type, null], 'ValueFormatString:v4:x0', [2, null], 'ValueFormatUseGrouping:sv:x1', [0, true], 'ValueRowMargin:yv:x2', [Thickness.$, new Thickness(0, 5)], 'ValueRowVisible:sw:x3', [0, true], 'ValueTextColor:yg:x4', [Brush.$, null], 'ValueTextMargin:yw:x5', [Thickness.$, new Thickness(1, 2, 0, 2, 0)], 'ValueTextUseSeriesColors:sx:x6', [0, false], 'ValueTextWhenMissingData:wd:x7', [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.b6 = null;
        _this.b9 = null;
        _this.b4 = null;
        _this.b7 = false;
        _this._htmlTest = null;
        _this.b4 = a;
        _this.htmlTest = /^[^<]*(<[\w\W]+>)[^>]*$/;
        _this.b9 = new List$1(PointerTooltip.$, 0);
        return _this;
    }
    DataToolTipLayerView.prototype.aj = function () {
        _super.prototype.aj.call(this);
        for (var a = 0; a < this.b6.a.count; a++) {
            this.b6.a._inner[a].br();
        }
        for (var b = 0; b < this.b6.b.count; b++) {
            this.b6.b._inner[b].br();
        }
        this.b6.clear();
    };
    DataToolTipLayerView.prototype.ca = function () {
        var a = new PointerTooltip();
        a.bv(this.e.g9);
        a._visibility = 1;
        a.ap = this.e.cd.cq.k;
        var b = null;
        if (TypeRegistrar.isRegistered("XamDataLegend")) {
            b = TypeRegistrar.create("XamDataLegend");
        }
        b.pixelScalingRatio = 1;
        if (this.e.cd != null) {
            var c = this.e.cd.cq.j.ae.createElement("div");
            var ren_ = this.e.cd.cq.j.ae.getSubRenderer(c);
            var len_ = b;
            len_.provideContainer(ren_);
        }
        a.ai = typeCast(IOnDemandRender_$type, b);
        a.ai.shouldOnDemandRender = true;
        this.b9.add(a);
        return a;
    };
    DataToolTipLayerView.prototype.cc = function (a) {
        var b = a;
    };
    DataToolTipLayerView.prototype.ce = function (a) {
        var b = a;
        b._visibility = 1;
    };
    DataToolTipLayerView.prototype.cd = function (a) {
        var b = a;
        b.by();
        b.content = null;
        this.b9.remove1(a);
    };
    DataToolTipLayerView.prototype.as = function () {
        var _this = this;
        _super.prototype.as.call(this);
        this.b6 = ((function () {
            var $ret = new Pool$1(Base.$);
            $ret.create = runOn(_this, _this.ca);
            $ret.activate = runOn(_this, _this.cc);
            $ret.disactivate = runOn(_this, _this.ce);
            $ret.destroy = runOn(_this, _this.cd);
            return $ret;
        })());
    };
    Object.defineProperty(DataToolTipLayerView.prototype, "htmlTest", {
        get: function () {
            return this._htmlTest;
        },
        set: function (a) {
            this._htmlTest = a;
        },
        enumerable: false,
        configurable: true
    });
    DataToolTipLayerView.prototype.b8 = function (a, b) {
        var c = a;
        var d = c.ai;
        return true;
    };
    DataToolTipLayerView.prototype.cm = function (a) {
        var b = a;
        var c = new Size(1, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
        b.cx = 1;
        var d = b.cw(new Size(1, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY));
        b.cx = 0;
        return d;
    };
    DataToolTipLayerView.prototype.cl = function () {
        if (this.e.cd != null) {
            var a = this.e.cd.r8();
            var b = this.e.cd.cq.a8;
            var c = this.e.cd.cq.a7;
            return new Rect(0, 0, 0, b, c);
        }
        return Rect.empty;
    };
    DataToolTipLayerView.prototype.ck = function () {
        if (this.e.cd != null) {
            var a = this.e.cd.r8();
            var b = this.e.cd.cq.a8;
            var c = this.e.cd.cq.a7;
            return new Rect(0, 0, 0, b, c);
        }
        return Rect.empty;
    };
    DataToolTipLayerView.prototype.cj = function () {
        var a = 0;
        var b = 0;
        if (this.e.cd != null) {
            var c = this.e.cd.r8();
            a += c.x;
            b += c.y;
            var d = this.e.cd.cq.a8;
            var e = this.e.cd.cq.a7;
            return new Rect(0, a, b, d, e);
        }
        return Rect.empty;
    };
    DataToolTipLayerView.prototype.ci = function (a) {
        var b = 0;
        var c = 0;
        if (this.e.cd != null) {
            var d = this.e.cd.r8();
            b += d.x;
            c += d.y;
        }
        return { $type: Point_$type, x: b + a.x, y: c + a.y };
    };
    DataToolTipLayerView.prototype.cg = function (a, b, c, d, e) {
        var f = null;
        if (this.e.cd != null) {
            f = this.e.cd.cq.j.i();
        }
        var g = a;
        if (g == null) {
            return;
        }
        if (d == 0 && e == 0) {
            g.cx = 1;
        }
        else {
            g.cx = 0;
        }
        g.aq = f;
        g.cr = { $type: Point_$type, x: d, y: e };
        g._visibility = 0;
        g.n = b;
        g.o = c;
    };
    DataToolTipLayerView.prototype.cn = function () {
        var a = (window.innerWidth);
        var b = (window.innerHeight);
        return new Size(1, a, b);
    };
    DataToolTipLayerView.prototype.cf = function (a) {
        if (a != null) {
            var b = a;
            b._visibility = 1;
        }
    };
    DataToolTipLayerView.prototype.ch = function () {
    };
    DataToolTipLayerView.prototype.a6 = function (a, b) {
        _super.prototype.a6.call(this, a, b);
        if (b) {
            return;
        }
        var c = 0;
        var d = 0;
        var e = this.e.cd;
        if (e != null) {
            var f = e.cq.j.b7();
            c += f.x;
            d += f.y;
        }
        for (var g = 0; g < this.b9.count; g++) {
            this.b9._inner[g].bx(this.b9._inner[g].n + c, this.b9._inner[g].o + d);
        }
    };
    DataToolTipLayerView.prototype.al = function (a) {
        _super.prototype.al.call(this, a);
        for (var b = 0; b < this.b9.count; b++) {
            var c = this.b9._inner[b];
            var d = 0;
            var e = 0;
            if (this.e.cd != null) {
                var f = this.e.cd.r8();
                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.a8.addPointerTooltipWithDataLegend(a, g, h, i, k);
        }
    };
    DataToolTipLayerView.prototype.b5 = function (a) {
        var b = a;
        return b.ai;
    };
    DataToolTipLayerView.$t = markType(DataToolTipLayerView, 'DataToolTipLayerView', AnnotationLayerView.$);
    return DataToolTipLayerView;
}(AnnotationLayerView));
export { DataToolTipLayerView };
