/*
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 { 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 { DataLegendLayoutMode_$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";
import { PointerTooltipStyle } from "./PointerTooltipStyle";
import { PointerTooltipUtils } from "./PointerTooltipUtils";
/**
 * @hidden
 */
export let DataToolTipLayer = /*@__PURE__*/ (() => {
    class DataToolTipLayer extends AnnotationLayer {
        constructor() {
            super();
            this.aa5 = 1;
            this.aca = new Dictionary$2(String_$type, Base.$, 0);
            this.acb = new List$1(String_$type, 0);
            this.aax = 8;
            this.aa1 = 11;
            this.abl = null;
            this.abd = null;
            this.abc = null;
            this.abg = null;
            this.abi = null;
            this.abf = null;
            this.abh = null;
            this.abk = null;
            this.abj = null;
            this.abe = null;
            let a = new DataToolTipLayerFrame();
            let b = new DataToolTipLayerFrame();
            let c = new DataToolTipLayerFrame();
            this.xm = a;
            this.xl = b;
            this.xn = c;
            this.ab = DataToolTipLayer.$;
        }
        bk() {
            return new DataToolTipLayer();
        }
        get_et() {
            return true;
        }
        ct() {
            return new DataToolTipLayerView(this);
        }
        q7(a) {
            super.q7(a);
            this.aa9 = a;
        }
        get_e4() {
            return true;
        }
        get aa6() {
            return this.aa5;
        }
        set aa6(a) {
            let b = this.aa5;
            this.aa5 = a;
            if (b != this.aa5) {
                this.raisePropertyChanged("ActualGroupingMode", enumGetBox(DataToolTipLayerGroupingMode_$type, b), enumGetBox(DataToolTipLayerGroupingMode_$type, this.aa5));
            }
        }
        aa8() {
            let a = true;
            let b = true;
            let c = true;
            let d = true;
            if (this.aa7 != 0) {
                return this.aa7;
            }
            let e = this.aan();
            if (e != null) {
                for (let f of fromEnum(e.ed())) {
                    if (!f.eu && !f.fx) {
                        a = false;
                    }
                    if (!f.eu && !f.fq) {
                        b = false;
                    }
                    if (!f.eu && !f.fy) {
                        c = false;
                    }
                    if (!f.eu && !f.fu) {
                        d = false;
                    }
                }
            }
            if (a || b || c || d) {
                return 2;
            }
            return 1;
        }
        rg(a, b, c, d) {
            super.rg(a, b, c, d);
            switch (b) {
                case DataToolTipLayer.$$p[42]:
                    this.ry(true);
                    break;
                case DataToolTipLayer.$$p[52]:
                    this.ry(true);
                    break;
                case DataToolTipLayer.$$p[12]:
                    this.aa6 = this.aa8();
                    break;
                case "ActualGroupingMode":
                    this.ry(true);
                    break;
                case DataToolTipLayer.$$p[10]:
                    this.aay = this.aa0();
                    break;
                case DataToolTipLayer.$$p[11]:
                    this.aa2 = this.aa4();
                    break;
                case "SeriesViewer":
                    this.aa9.c1();
                    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[53]:
                case DataToolTipLayer.$$p[55]:
                case DataToolTipLayer.$$p[56]:
                case DataToolTipLayer.$$p[57]:
                case DataToolTipLayer.$$p[54]:
                case DataToolTipLayer.$$p[60]:
                case DataToolTipLayer.$$p[59]:
                case DataToolTipLayer.$$p[58]:
                case DataToolTipLayer.$$p[61]:
                case DataToolTipLayer.$$p[62]:
                case DataToolTipLayer.$$p[66]:
                case DataToolTipLayer.$$p[65]:
                case DataToolTipLayer.$$p[64]:
                case DataToolTipLayer.$$p[63]:
                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[48]:
                case DataToolTipLayer.$$p[51]:
                case DataToolTipLayer.$$p[49]:
                case DataToolTipLayer.$$p[50]:
                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.af2(b, c, d);
                    break;
                case DataToolTipLayer.$$p[45]:
                case DataToolTipLayer.$$p[46]:
                case DataToolTipLayer.$$p[47]:
                    this.ry(true);
                    break;
            }
        }
        af2(a, b, c) {
            if (!this.aca.containsKey(a)) {
                this.acb.add(a);
                this.aca.addItem(a, c);
            }
            else {
                this.aca.item(a, c);
            }
            this.ry(true);
        }
        af6(a, b) {
            switch (a) {
                case DataToolTipLayer.$$p[12]:
                    this.aa7 = EnumUtil.getEnumValue(DataToolTipLayerGroupingMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[29]:
                    this.acf = b;
                    break;
                case DataToolTipLayer.$$p[30]:
                    this.acg = b;
                    break;
                case DataToolTipLayer.$$p[2]:
                    this.acd = b;
                    break;
                case DataToolTipLayer.$$p[3]:
                    this.ace = b;
                    break;
                case DataToolTipLayer.$$p[10]:
                    this.aaz = EnumUtil.getEnumValue(DataTooltipGroupedPositionX_$type, b);
                    break;
                case DataToolTipLayer.$$p[11]:
                    this.aa3 = EnumUtil.getEnumValue(DataTooltipGroupedPositionY_$type, b);
                    break;
                case DataToolTipLayer.$$p[31]:
                    this.ab5 = b;
                    break;
                case DataToolTipLayer.$$p[24]:
                    this.aal = b;
                    break;
                case DataToolTipLayer.$$p[5]:
                    this.aag = b;
                    break;
                case DataToolTipLayer.$$p[23]:
                    this.aak = b;
                    break;
                case DataToolTipLayer.$$p[4]:
                    this.aaf = b;
                    break;
                case DataToolTipLayer.$$p[53]:
                    this.aap = EnumUtil.getEnumValue(DataAbbreviationMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[55]:
                    this.adg = typeGetValue(b);
                    break;
                case DataToolTipLayer.$$p[56]:
                    this.adh = typeGetValue(b);
                    break;
                case DataToolTipLayer.$$p[57]:
                    this.aaw = EnumUtil.getEnumValue(DataLegendValueMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[54]:
                    this.afk = b;
                    break;
                case DataToolTipLayer.$$p[60]:
                    this.ab7 = b;
                    break;
                case DataToolTipLayer.$$p[59]:
                    this.afq = b;
                    break;
                case DataToolTipLayer.$$p[58]:
                    this.aam = b;
                    break;
                case DataToolTipLayer.$$p[61]:
                    this.aiu = b;
                    break;
                case DataToolTipLayer.$$p[62]:
                    this.ab8 = b;
                    break;
                case DataToolTipLayer.$$p[66]:
                    this.afz = b;
                    break;
                case DataToolTipLayer.$$p[65]:
                    this.ab9 = b;
                    break;
                case DataToolTipLayer.$$p[64]:
                    this.aiv = b;
                    break;
                case DataToolTipLayer.$$p[63]:
                    this.aid = b;
                    break;
                case "ValueTextStyle":
                    this.abv = b;
                    break;
                case DataToolTipLayer.$$p[16]:
                    this.ad4 = b;
                    break;
                case DataToolTipLayer.$$p[15]:
                    this.aaj = b;
                    break;
                case DataToolTipLayer.$$p[13]:
                    this.ad0 = b;
                    break;
                case DataToolTipLayer.$$p[14]:
                    this.aaq = EnumUtil.getEnumValue(DataLegendHeaderDateMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[17]:
                    this.aar = EnumUtil.getEnumValue(DataLegendHeaderTimeMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[22]:
                    this.ad9 = b;
                    break;
                case DataToolTipLayer.$$p[20]:
                    this.ah3 = b;
                    break;
                case DataToolTipLayer.$$p[21]:
                    this.aio = b;
                    break;
                case DataToolTipLayer.$$p[18]:
                    this.ain = b;
                    break;
                case DataToolTipLayer.$$p[19]:
                    this.aby = b;
                    break;
                case "HeaderTextStyle":
                    this.abn = b;
                    break;
                case DataToolTipLayer.$$p[28]:
                    this.aat = EnumUtil.getEnumValue(DataLegendLayoutMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[8]:
                    this.ah2 = b;
                    break;
                case DataToolTipLayer.$$p[9]:
                    this.aim = b;
                    break;
                case DataToolTipLayer.$$p[6]:
                    this.ail = b;
                    break;
                case DataToolTipLayer.$$p[7]:
                    this.abx = b;
                    break;
                case "GroupTextStyle":
                    this.abm = b;
                    break;
                case DataToolTipLayer.$$p[35]:
                    this.ah6 = b;
                    break;
                case "SummaryTitleTextStyle":
                    this.abq = b;
                    break;
                case DataToolTipLayer.$$p[38]:
                    this.aau = EnumUtil.getEnumValue(DataLegendSummaryType_$type, b);
                    break;
                case DataToolTipLayer.$$p[37]:
                    this.aet = b;
                    break;
                case DataToolTipLayer.$$p[36]:
                    this.air = b;
                    break;
                case DataToolTipLayer.$$p[34]:
                    this.aiq = b;
                    break;
                case DataToolTipLayer.$$p[41]:
                    this.ah8 = b;
                    break;
                case "SummaryValueTextStyle":
                    this.abs = b;
                    break;
                case DataToolTipLayer.$$p[33]:
                    this.aeo = b;
                    break;
                case DataToolTipLayer.$$p[32]:
                    this.ah5 = b;
                    break;
                case "SummaryLabelTextStyle":
                    this.abp = b;
                    break;
                case DataToolTipLayer.$$p[40]:
                    this.aez = b;
                    break;
                case DataToolTipLayer.$$p[39]:
                    this.ah7 = b;
                    break;
                case "SummaryUnitsTextStyle":
                    this.abr = b;
                    break;
                case DataToolTipLayer.$$p[0]:
                    this.aik = b;
                    break;
                case DataToolTipLayer.$$p[1]:
                    this.abb = EnumUtil.getEnumValue(LegendItemBadgeShape_$type, b);
                    break;
                case DataToolTipLayer.$$p[48]:
                    this.aav = EnumUtil.getEnumValue(DataLegendUnitsMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[51]:
                    this.afd = b;
                    break;
                case DataToolTipLayer.$$p[49]:
                    this.aic = b;
                    break;
                case DataToolTipLayer.$$p[50]:
                    this.ait = b;
                    break;
                case "UnitsTextStyle":
                    this.abu = b;
                    break;
                case DataToolTipLayer.$$p[44]:
                    this.ais = b;
                    break;
                case DataToolTipLayer.$$p[43]:
                    this.ah9 = b;
                    break;
                case "TitleTextStyle":
                    this.abt = b;
                    break;
                case DataToolTipLayer.$$p[25]:
                    this.aas = EnumUtil.getEnumValue(DataLegendLabelMode_$type, b);
                    break;
                case DataToolTipLayer.$$p[26]:
                    this.ah4 = b;
                    break;
                case DataToolTipLayer.$$p[27]:
                    this.aip = b;
                    break;
                case "LabelTextStyle":
                    this.abo = b;
                    break;
                case DataToolTipLayer.$$p[47]:
                    this.acl = b;
                    break;
                case DataToolTipLayer.$$p[46]:
                    this.aib = b;
                    break;
                case DataToolTipLayer.$$p[45]:
                    this.aia = b;
                    break;
            }
        }
        af3(a) {
            for (let b = 0; b < this.acb.count; b++) {
                let c = this.acb._inner[b];
                a.updatePropertyByName(c, this.aca.item(c));
            }
        }
        y0(a, b) {
            {
                if (!this.a1.c) {
                    this.ry(b);
                }
            }
        }
        y1(a, b) {
            if (!this.a1.c) {
                this.ry(b);
            }
        }
        y3(a, b) {
            super.y3(a, b);
            this.aa5 = this.aa8();
            let c = a;
            let d = this.aa9.cp;
            let e = this.ab6;
            let 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.aac.x) && isNaN_(this.aac.y)) {
                d.count = 0;
                return;
            }
            {
                if (this.aa6 == 2) {
                    let g = 0;
                    {
                        for (let h of fromEnum(this.dc.series)) {
                            if (this.xs(h)) {
                                this.af5(h, c, e, f, g);
                                g++;
                            }
                            if (h.isStacked) {
                                h.p9((i) => {
                                    if (this.xs(i)) {
                                        this.af5(i, c, e, f, g);
                                        g++;
                                    }
                                    if (i.ei) {
                                        i.p7((j) => {
                                            if (this.xs(j)) {
                                                this.af5(j, c, e, f, g);
                                                g++;
                                            }
                                            return true;
                                        });
                                    }
                                    return true;
                                });
                            }
                            if (h.ei) {
                                h.p7((i) => {
                                    if (this.xs(i)) {
                                        this.af5(i, c, e, f, g);
                                        g++;
                                    }
                                    return true;
                                });
                            }
                        }
                        this.af1(c);
                    }
                    d.count = g;
                }
                else {
                    let i = this.aan();
                    let j = this.acc(i);
                    let k = this.aba(i, j, e);
                    this.af4(k, c, e);
                }
            }
        }
        acc(a) {
            let b = new List$1(Series.$, 0);
            if (a == null) {
                return b;
            }
            for (let c of fromEnum(a.eh)) {
                b.add(c);
            }
            return b;
        }
        aan() {
            if (this.aao != null) {
                return this.aao;
            }
            if (this.dc == null) {
                return null;
            }
            for (let a of fromEnum(this.dc.series)) {
                if (a.e0) {
                    let b = a.a0();
                    if (b != null && b.dp()) {
                        return b;
                    }
                }
            }
            for (let c of fromEnum(this.dc.series)) {
                if (!c.e0) {
                    let d = c.ai();
                    let e = d != null && d.length > 0 ? d[0] : null;
                    if (e != null && e.dp()) {
                        return e;
                    }
                }
            }
            return null;
        }
        aba(a, b, c) {
            let d = 1.7976931348623157E+308;
            let e = -1.7976931348623157E+308;
            let f = new List$1(DataContext.$, 0);
            let g = new List$1(Base.$, 0);
            let h = false;
            let i = true;
            let j = { $type: Point_$type, x: NaN, y: NaN };
            let k = 0;
            let l = 0;
            for (let m = 0; m < b.count; m++) {
                let n = b.item(m);
                k = n.dc.l;
                l = n.dc.m;
                if (n.e0) {
                    let o = n;
                    let p = new List$1(Series.$, 0);
                    if (o.isStacked) {
                        o.p9((q) => {
                            p.add(q);
                            if (q.ei) {
                                q.p7((r) => {
                                    p.add(r);
                                    return true;
                                });
                            }
                            return true;
                        });
                    }
                    else if (o.ei) {
                        p.add(o);
                        o.p7((q) => {
                            p.add(q);
                            return true;
                        });
                    }
                    else {
                        p.add(o);
                    }
                    for (let q = 0; q < p.count; q++) {
                        let r = p._inner[q];
                        let s = p._inner[q];
                        if (s.dc == null) {
                            continue;
                        }
                        if (!r.categoryAxis.dp()) {
                            continue;
                        }
                        if (i) {
                            h = s.isVertical;
                        }
                        else {
                            if (h != s.isVertical) {
                                continue;
                            }
                        }
                        let t = this.yw(s);
                        if (!t.c) {
                            continue;
                        }
                        j = s.wh(t.d);
                        let u = s.wm(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 {
                    let v = n.ai();
                    for (let w = 0; w < v.length; w++) {
                        if (!v[w].dp()) {
                            continue;
                        }
                    }
                    let x = n.wm(this.aac, c, false);
                    j = n.wh(this.aac);
                    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);
                        }
                    }
                }
                let y = null;
                let z = n.kr(this.aac);
                if (n.e5 && z != null) {
                    y = n.a3(z);
                }
                else {
                    y = new DataContext();
                    y.item = z;
                    y.series = n;
                }
                f.add(y);
            }
            let aa = 0;
            let ab = 0;
            if (h) {
                ab = (d + e) / 2;
                aa = this.w2.right;
                if (!isNaN_(j.x)) {
                    aa = j.x;
                }
                if (ab < 0 || ab > this.w2.bottom) {
                    ab = NaN;
                }
            }
            else {
                aa = (d + e) / 2;
                if (!isNaN_(j.y)) {
                    ab = j.y;
                }
                if (aa < 0 || aa > this.w2.right) {
                    aa = NaN;
                }
            }
            let 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;
        }
        qd() {
            this.aac = { $type: Point_$type, x: NaN, y: NaN };
            this.ry(false);
            this.aa9.cz(false);
        }
        qe() {
            this.aac = { $type: Point_$type, x: NaN, y: NaN };
            this.ry(false);
            this.aa9.cz(true);
        }
        get aih() {
            let a = RectUtil.n(this.cw.b9);
            let b = new Size(1, this.cw.b9.width, this.cw.b9.height);
            return new Rect(3, a, b);
        }
        get aig() {
            let a = RectUtil.n(this.cw.b9);
            let b = new Size(1, this.cw.b9.width, this.cw.b9.height);
            return new Rect(3, this.aa9.c2(a), b);
        }
        get aif() {
            let a = new Rect(0, 0, 0, this.dc.m, this.dc.l);
            let b = RectUtil.n(a);
            let c = new Size(1, a.width, a.height);
            return new Rect(3, this.aa9.c2(b), c);
        }
        get aij() {
            let a = { $type: Point_$type, x: 0, y: 0 };
            return new Rect(3, a, this.aa9.c7());
        }
        aii() {
            return this.aih;
        }
        ab2(a, b, c) {
            if (Rect.l_op_Equality(a, Rect.empty)) {
                return false;
            }
            let d = a.top;
            return c < d;
        }
        abz(a, b, c, d) {
            if (Rect.l_op_Equality(a, Rect.empty)) {
                return false;
            }
            let e = a.bottom;
            return c + d.height >= e;
        }
        ab0(a, b, c) {
            if (Rect.l_op_Equality(a, Rect.empty)) {
                return false;
            }
            let d = a.left;
            return c < d;
        }
        ab1(a, b, c, d) {
            if (Rect.l_op_Equality(a, Rect.empty)) {
                return false;
            }
            let e = a.right;
            return c + d.width > e;
        }
        ac6(a, b) {
            return a.top + b;
        }
        ac4(a, b, c) {
            return a.bottom - c.height - b;
        }
        ac5(a, b) {
            return ((a.bottom + a.top) / 2) - (b.height / 2);
        }
        adf(a, b, c, d, e) {
            let f = c.y - d.height - b;
            return f;
        }
        add(a, b, c, d, e) {
            let f = c.y + b;
            return f;
        }
        ade(a, b, c, d, e) {
            let f = c.y - (d.height / 2);
            return f;
        }
        ac9(a, b, c, d, e) {
            let f = c.y - d.height;
            f = f - b;
            return f;
        }
        ac7(a, b, c, d, e) {
            let f = c.y;
            f = f + b;
            return f;
        }
        ac8(a, b, c, d, e) {
            let f = c.y - (d.height / 2);
            return f;
        }
        acp(a, b) {
            return a.left + b;
        }
        acr(a, b, c) {
            return (a.right - (c.width)) - b;
        }
        acq(a, b, c) {
            return ((a.right + a.left) / 2) - (c.width / 2) + b;
        }
        acy(a, b, c, d, e) {
            let f = (c.x - d.width) - b;
            return f;
        }
        ac0(a, b, c, d, e) {
            let f = c.x + b;
            return f;
        }
        acz(a, b, c, d, e) {
            let f = (c.x - (d.width / 2));
            f = f + b;
            return f;
        }
        acv(a, b, c, d, e) {
            let f = c.x - d.width;
            f = f - b;
            return f;
        }
        acx(a, b, c, d, e) {
            let f = c.x;
            f = f + b;
            return f;
        }
        acw(a, b, c, d, e) {
            let f = c.x - (d.width / 2);
            f = f + b;
            return f;
        }
        ack(a, b, c, d, e, f, g, h) {
            switch (a) {
                case 1:
                    {
                        return this.ac9(e, b, h, f, true);
                    }
                case 2:
                    {
                        return this.ac7(e, b, h, f, true);
                    }
                case 3:
                    {
                        return this.ac8(e, b, h, f, true);
                    }
                case 5: return this.ada(e, c, b, h, f);
                case 6: return this.adb(e, c, b, h, f);
                case 4: return this.adc(e, c, b, h, f);
                case 8: return this.ac1(e, c, b, h, f);
                case 9: return this.ac2(e, c, b, h, f);
                case 7: return this.ac3(e, c, b, h, f);
                case 13: return this.ac6(d, b);
                case 14: return this.ac4(d, b, f);
                case 15: return this.ac5(d, f);
                case 10: return this.adf(e, b, g, f, true);
                case 12: return this.ade(e, b, g, f, true);
                case 11:
                default: return this.add(e, b, g, f, true);
            }
        }
        acs(a, b, c, d, e) {
            let f = d.x;
            f = f + b / 2;
            f = f - e.width;
            f = f - c;
            return f;
        }
        act(a, b, c, d, e) {
            let f = d.x;
            f = f + b / 2;
            f = f - e.width / 2;
            f = f + c;
            return f;
        }
        acu(a, b, c, d, e) {
            let f = d.x;
            f = f + b / 2;
            f = f + c;
            return f;
        }
        acm(a, b, c, d, e) {
            let f = d.x;
            f = f - b / 2;
            f = f - e.width;
            f = f - c;
            return f;
        }
        acn(a, b, c, d, e) {
            let f = d.x;
            f = f - b / 2;
            f = f - e.width / 2;
            f = f + c;
            return f;
        }
        aco(a, b, c, d, e) {
            let f = d.x;
            f = f - b / 2;
            f = f + c;
            return f;
        }
        ac3(a, b, c, d, e) {
            let f = d.y;
            f = f + b / 2;
            f = f - e.height;
            f = f - c;
            return f;
        }
        ac2(a, b, c, d, e) {
            let f = d.y;
            f = f + b / 2;
            f = f - e.height / 2;
            f = f + c;
            return f;
        }
        ac1(a, b, c, d, e) {
            let f = d.y;
            f = f + b / 2;
            f = f + c;
            return f;
        }
        adc(a, b, c, d, e) {
            let f = d.y;
            f = f - b / 2;
            f = f - e.height;
            f = f - c;
            return f;
        }
        adb(a, b, c, d, e) {
            let f = d.y;
            f = f - b / 2;
            f = f - e.height / 2;
            f = f + c;
            return f;
        }
        ada(a, b, c, d, e) {
            let f = d.y;
            f = f - b / 2;
            f = f + c;
            return f;
        }
        acj(a, b, c, d, e, f, g, h) {
            switch (a) {
                case 10: return this.acy(e, b, g, f, true);
                case 11: return this.ac0(e, b, g, f, true);
                case 12: return this.acz(e, b, g, f, true);
                case 13: return this.acp(d, b);
                case 14: return this.acr(e, b, f);
                case 15: return this.acq(e, b, f);
                case 5: return this.aco(e, c, b, h, f);
                case 6: return this.acn(e, c, b, h, f);
                case 4: return this.acm(e, c, b, h, f);
                case 8: return this.acu(e, c, b, h, f);
                case 9: return this.act(e, c, b, h, f);
                case 7: return this.acs(e, c, b, h, f);
                case 1:
                    {
                        return this.acv(e, b, h, f, true);
                    }
                case 3:
                    {
                        return this.acw(e, b, h, f, true);
                    }
                case 2:
                default:
                    {
                        return this.acx(e, b, h, f, true);
                    }
            }
        }
        aie(a, b, c, d) {
            let e = this.aay;
            let f = this.aa2;
            let g = this.aan();
            let h = 0;
            if (g != null && g.c8 && this.dc != null) {
                h = g.getCategorySize(this.dc.xm, this.w2, this.getEffectiveViewport());
                if (g.categoryMode == 0) {
                    h = 0;
                }
            }
            let i = this.ach(e);
            let j = this.aci(f);
            let k = this.acj(e, i, h, this.aih, a, b, c, d);
            let l = this.ack(f, j, h, this.aih, a, b, c, d);
            let m = this.ab3(a, i, k, b);
            let n = this.ab4(a, j, l, b);
            if (!m) {
                let o = this.aah(e);
                let p = 0;
                while (!m && p < o.length) {
                    e = o[p];
                    i = this.ach(e);
                    k = this.acj(e, i, h, this.aih, a, b, c, d);
                    m = this.ab3(a, i, k, b);
                    p++;
                }
            }
            if (!n) {
                let q = this.aai(f);
                let r = 0;
                while (!n && r < q.length) {
                    f = q[r];
                    j = this.aci(f);
                    l = this.ack(f, j, h, this.aih, a, b, c, d);
                    n = this.ab4(a, j, l, b);
                    r++;
                }
            }
            return { $type: Point_$type, x: k, y: l };
        }
        aci(a) {
            if (!isNaN_(this.acg)) {
                return this.acg;
            }
            switch (a) {
                case 1: return this.ace;
                case 2: return this.ace;
                case 3: return 0;
                case 4: return this.ace;
                case 5: return this.ace;
                case 6: return this.ace;
                case 7: return this.ace;
                case 8: return this.ace;
                case 9: return 0;
                case 10: return this.ace;
                case 11: return this.ace;
                case 12: return 0;
                case 13: return this.ace;
                case 14: return this.ace;
                case 15: return 0;
            }
            return this.ace;
        }
        ach(a) {
            if (!isNaN_(this.acf)) {
                return this.acf;
            }
            switch (a) {
                case 4: return this.acd;
                case 6: return 0;
                case 5: return this.acd;
                case 13: return this.acd;
                case 15: return 0;
                case 14: return this.acd;
                case 7: return this.acd;
                case 9: return 0;
                case 8: return this.acd;
                case 1: return this.acd;
                case 3: return 0;
                case 2: return this.acd;
                case 10: return this.acd;
                case 12: return 0;
                case 11: return this.acd;
            }
            return this.acd;
        }
        aai(a) {
            let 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;
        }
        aah(a) {
            let 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;
        }
        ab3(a, b, c, d) {
            return !(this.ab0(a, b, c) || this.ab1(a, b, c, d));
        }
        ab4(a, b, c, d) {
            return !(this.ab2(a, b, c) || this.abz(a, b, c, d));
        }
        af1(a) {
            let b = new List$1(DataTooltipCollisionInfo.$, 0);
            for (let c = 0; c < a.f.count; c++) {
                let 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((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;
            });
            let e = this.abw(b);
            if (!e) {
                return;
            }
            for (let f = 0; f < b.count - 1; f++) {
                let g = b._inner[f];
                let h = b._inner[f + 1];
                let i = new Rect(0, g.e.x, g.e.y, g.c, g.a);
                let 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.cw.b9.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.cw.b9.height) };
            }
            for (let k = b.count - 1; k >= 1; k--) {
                let l = b._inner[k];
                let m = b._inner[k - 1];
                let n = new Rect(0, l.e.x, l.e.y, l.c, l.a);
                let 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 (let p = 0; p < b.count; p++) {
                let q = b._inner[p].d;
                let r = b._inner[p];
                a.f._inner[q] = r.e.x;
                a.g._inner[q] = r.e.y;
            }
        }
        abw(a) {
            if (a.count <= 1) {
                return false;
            }
            let b = this.cw.b9;
            for (let c = 0; c < a.count - 1; c++) {
                let d = a._inner[c];
                let e = a._inner[c + 1];
                let f = new Rect(0, d.e.x, d.e.y, d.c, d.a);
                let g = new Rect(0, e.e.x, e.e.y, e.c, e.a);
                if (f.intersectsWith(g)) {
                    return true;
                }
            }
            return false;
        }
        af5(a, b, c, d, e) {
            let f = this.yw(a);
            if (!f.c) {
                return;
            }
            let g = a.wm(f.d, c, d);
            let h = this.aa9.cp;
            let i = this.aac;
            if (!c) {
                i = this.wr(g);
            }
            let j = a.kr(i);
            let k = h.item(e);
            let l = this.cw.b9;
            let m = this.aa9.co(k);
            if (!Base.equalsStatic(m.target, this.dc)) {
                m.target = this.dc;
            }
            let n = new List$1(String_$type, 0);
            if (a.ei && this.aa6 == 2) {
                a.p7((o) => {
                    if (this.xs(o)) {
                        n.add(o.dataLegendKey);
                    }
                    return true;
                });
            }
            m.includedSeries = [a.dataLegendKey];
            m.excludedSeries = n.toArray();
            this.af3(m);
            m.targetCursorPositionX = this.aac.x;
            m.targetCursorPositionY = this.aac.y;
            if (!this.aa9.cr(k, a)) {
                return;
            }
            let o = this.aa9.c6(k);
            b.i.add1(k);
            let p = g.x;
            let q = g.x;
            q = Math.max(q, l.left);
            q = Math.min(q, l.right);
            b.l.add(q);
            let r = g.y;
            r = Math.max(r, l.top);
            r = Math.min(r, l.bottom);
            b.m.add(r);
            let s = DeviceUtils.g(10);
            let 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);
            let 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);
            let v = this.vj;
            if (v == null) {
                v = this.vp;
            }
            if (v == null) {
                v = a.vj;
            }
            b.h.add(v);
        }
        af4(a, b, c) {
            this.aax = this.aa0();
            this.aa1 = this.aa4();
            let d = a.f;
            let e = a.e;
            let f = 0;
            let g = this.aa9.cp.item(0);
            this.aa9.cr(g, null);
            let h = this.aa9.co(g);
            if (!Base.equalsStatic(h.target, this.dc)) {
                h.target = this.dc;
            }
            let i = new List$1(String_$type, 0);
            let j = this.aan();
            if (j != null) {
                for (let k of fromEnum(j.ed())) {
                    if (k.isStacked) {
                        k.p9((l) => {
                            i.add(l.dataLegendKey);
                            if (l.ei) {
                                l.p7((m) => {
                                    i.add(m.dataLegendKey);
                                    return true;
                                });
                            }
                            return true;
                        });
                    }
                    else if (k.ei) {
                        i.add(k.dataLegendKey);
                        k.p7((l) => {
                            i.add(l.dataLegendKey);
                            return true;
                        });
                    }
                    else {
                        i.add(k.dataLegendKey);
                    }
                }
                h.includedSeries = i.toArray();
                h.excludedSeries = null;
            }
            else {
                h.includedSeries = null;
                h.excludedSeries = null;
            }
            this.af3(h);
            h.targetCursorPositionX = this.aac.x;
            h.targetCursorPositionY = this.aac.y;
            let l = this.aa9.c6(g);
            let m = 0;
            let n = 0;
            let o = 0;
            let p = 0;
            let q = false;
            let r = false;
            o = d.x;
            p = d.y;
            let s = this.cw.b9;
            let t = this.aa9.c7();
            let u = this.aii();
            let v = this.aie(u, l, e, d);
            let w = v.x;
            let 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);
            let y = null;
            b.h.add(y);
            this.aa9.cp.count = 1;
        }
        adi(a) {
            return a.toolTip;
        }
        y6(a, b) {
            super.y6(a, b);
            let c = a;
            let d = c.m.count;
            let e = b.b9.left;
            let f = b.b9.right;
            let g = b.b9.top;
            let h = b.b9.bottom;
            for (let 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.aa9.cy(c.i._inner[i]);
                    continue;
                }
                let j = c.f._inner[i];
                let k = c.g._inner[i];
                let l = c.k._inner[i];
                let m = c.j._inner[i];
                let n = false;
                if (n) {
                    this.aa9.cy(c.i._inner[i]);
                    continue;
                }
                let o = c.i._inner[i];
                let p = Math.min(c.f._inner[i], c.l._inner[i]);
                let q = Math.min(c.g._inner[i], c.m._inner[i]);
                let r = c.l._inner[i] - c.f._inner[i];
                let s = c.m._inner[i] - c.g._inner[i];
                if (o != null) {
                    this.aa9.c0(o, p, q, r, s);
                }
            }
        }
        gb() {
            return true;
        }
        get aay() {
            return this.aax;
        }
        set aay(a) {
            let b = this.aax;
            this.aax = a;
            if (b != this.aax) {
                this.raisePropertyChanged("ActualGroupedPositionModeX", enumGetBox(DataTooltipGroupedPositionX_$type, b), enumGetBox(DataTooltipGroupedPositionX_$type, this.aax));
            }
        }
        aa0() {
            if (this.dc == null) {
                return 2;
            }
            let a = false;
            let b = false;
            let c = false;
            let d = false;
            let e = this.aan();
            if (e == null) {
                if (this.aaz != 0) {
                    return this.aaz;
                }
                else {
                    return 2;
                }
            }
            for (let f of fromEnum(e.eh)) {
                if (f.e1) {
                    a = true;
                }
                if (f.isVertical) {
                    b = true;
                }
                if (f.fq) {
                    c = true;
                }
                if (f.fx) {
                    d = true;
                }
            }
            let g = ((() => {
                let $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;
            })());
            let h = g.contains(this.aaz);
            if (this.aaz != 0) {
                return this.aaz;
            }
            if (h && b) {
                return 11;
            }
            if (c || d) {
                return 11;
            }
            if (b) {
                return 11;
            }
            if (a) {
                return 8;
            }
            return 8;
        }
        get aa2() {
            return this.aa1;
        }
        set aa2(a) {
            let b = this.aa1;
            this.aa1 = a;
            if (b != this.aa1) {
                this.raisePropertyChanged("ActualPositionModeY", enumGetBox(DataTooltipGroupedPositionY_$type, b), enumGetBox(DataTooltipGroupedPositionY_$type, this.aa1));
            }
        }
        aa4() {
            if (this.dc == null) {
                return 11;
            }
            let a = false;
            let b = false;
            let c = false;
            let d = this.aan();
            if (d == null) {
                if (this.aa3 != 0) {
                    return this.aa3;
                }
                else {
                    return 11;
                }
            }
            for (let e of fromEnum(d.ed())) {
                if (e.isVertical) {
                    a = true;
                }
                if (e.fq) {
                    b = true;
                }
                if (e.fx) {
                    c = true;
                }
            }
            let f = ((() => {
                let $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;
            })());
            let g = f.contains(this.aa3);
            if (this.aa3 != 0) {
                return this.aa3;
            }
            if (g && !a) {
                return 11;
            }
            if (b || c) {
                return 11;
            }
            if (a) {
                return 8;
            }
            if (!a) {
                return 11;
            }
            return 11;
        }
        get abv() {
            return this.abl;
        }
        set abv(a) {
            let b = this.abl;
            this.abl = a;
            if (b != this.abl) {
                this.raisePropertyChanged("ValueTextStyle", b, this.abl);
            }
        }
        get abn() {
            return this.abd;
        }
        set abn(a) {
            let b = this.abd;
            this.abd = a;
            if (b != this.abd) {
                this.raisePropertyChanged("HeaderTextStyle", b, this.abd);
            }
        }
        get abm() {
            return this.abc;
        }
        set abm(a) {
            let b = this.abc;
            this.abc = a;
            if (b != this.abc) {
                this.raisePropertyChanged("GroupTextStyle", b, this.abc);
            }
        }
        get abq() {
            return this.abg;
        }
        set abq(a) {
            let b = this.abg;
            this.abg = a;
            if (b != this.abg) {
                this.raisePropertyChanged("SummaryTitleTextStyle", b, this.abg);
            }
        }
        get abs() {
            return this.abi;
        }
        set abs(a) {
            let b = this.abi;
            this.abi = a;
            if (b != this.abi) {
                this.raisePropertyChanged("SummaryValueTextStyle", b, this.abi);
            }
        }
        get abp() {
            return this.abf;
        }
        set abp(a) {
            let b = this.abf;
            this.abf = a;
            if (b != this.abf) {
                this.raisePropertyChanged("SummaryLabelTextStyle", b, this.abf);
            }
        }
        get abr() {
            return this.abh;
        }
        set abr(a) {
            let b = this.abh;
            this.abh = a;
            if (b != this.abh) {
                this.raisePropertyChanged("SummaryUnitsTextStyle", b, this.abh);
            }
        }
        get abu() {
            return this.abk;
        }
        set abu(a) {
            let b = this.abk;
            this.abk = a;
            if (b != this.abk) {
                this.raisePropertyChanged("UnitsTextStyle", b, this.abk);
            }
        }
        get abt() {
            return this.abj;
        }
        set abt(a) {
            let b = this.abj;
            this.abj = a;
            if (b != this.abj) {
                this.raisePropertyChanged("TitleTextStyle", b, this.abj);
            }
        }
        get abo() {
            return this.abe;
        }
        set abo(a) {
            let b = this.abe;
            this.abe = a;
            if (b != this.abe) {
                this.raisePropertyChanged("LabelTextStyle", b, this.abe);
            }
        }
    }
    DataToolTipLayer.$t = markType(DataToolTipLayer, 'DataToolTipLayer', AnnotationLayer.$);
    DataToolTipLayer.$$p = markDep(DependencyProperty, PropertyMetadata, DataToolTipLayer, 'raisePropertyChanged', ['BadgeMargin:aik:af7', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'BadgeShape:abb:af8', [LegendItemBadgeShape_$type, enumGetBox(LegendItemBadgeShape_$type, 0)], 'DefaultPositionOffsetX:acd:af9', [1, DeviceUtils.g(10)], 'DefaultPositionOffsetY:ace:aga', [1, DeviceUtils.g(10)], 'ExcludedColumns:aaf:agb', [Array_$type, null], 'ExcludedSeries:aag:agc', [Array_$type, null], 'GroupRowMargin:ail:agg', [Thickness.$, new Thickness(0, 5)], 'GroupRowVisible:abx:agh', [0, false], 'GroupTextColor:ah2:agi', [Brush.$, null], 'GroupTextMargin:aim:agj', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'GroupedPositionModeX:aaz:agd', [DataTooltipGroupedPositionX_$type, enumGetBox(DataTooltipGroupedPositionX_$type, 0)], 'GroupedPositionModeY:aa3:age', [DataTooltipGroupedPositionY_$type, enumGetBox(DataTooltipGroupedPositionY_$type, 0)], 'GroupingMode:aa7:agf', [DataToolTipLayerGroupingMode_$type, enumGetBox(DataToolTipLayerGroupingMode_$type, 0)], 'HeaderFormatCulture:ad0:agk', [2, stringEmpty()], 'HeaderFormatDate:aaq:agl', [DataLegendHeaderDateMode_$type, enumGetBox(DataLegendHeaderDateMode_$type, 0)], 'HeaderFormatSpecifiers:aaj:agm', [Array_$type, null], 'HeaderFormatString:ad4:agn', [2, null], 'HeaderFormatTime:aar:ago', [DataLegendHeaderTimeMode_$type, enumGetBox(DataLegendHeaderTimeMode_$type, 0)], 'HeaderRowMargin:ain:agp', [Thickness.$, new Thickness(0, 5)], 'HeaderRowVisible:aby:agq', [0, true], 'HeaderTextColor:ah3:agr', [Brush.$, null], 'HeaderTextMargin:aio:ags', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'HeaderText:ad9:agt', [2, null], 'IncludedColumns:aak:agu', [Array_$type, null], 'IncludedSeries:aal:agv', [Array_$type, null], 'LabelDisplayMode:aas:agw', [DataLegendLabelMode_$type, enumGetBox(DataLegendLabelMode_$type, 0)], 'LabelTextColor:ah4:agx', [Brush.$, null], 'LabelTextMargin:aip:agy', [Thickness.$, new Thickness(1, 8, 0, 0, 0)], 'LayoutMode:aat:agz', [DataLegendLayoutMode_$type, enumGetBox(DataLegendLayoutMode_$type, 0)], 'PositionOffsetX:acf:ag0', [1, NaN], 'PositionOffsetY:acg:ag1', [1, NaN], 'ShouldUpdateWhenSeriesDataChanges:ab5:ag2', [0, true], 'SummaryLabelTextColor:ah5:ag3', [Brush.$, null], 'SummaryLabelText:aeo:ag4', [2, null], 'SummaryRowMargin:aiq:ag5', [Thickness.$, new Thickness(0, 5)], 'SummaryTitleTextColor:ah6:ag6', [Brush.$, null], 'SummaryTitleTextMargin:air:ag7', [Thickness.$, new Thickness(1, 2, 0, 0, 0)], 'SummaryTitleText:aet:ag8', [2, null], 'SummaryType:aau:ag9', [DataLegendSummaryType_$type, enumGetBox(DataLegendSummaryType_$type, 0)], 'SummaryUnitsTextColor:ah7:aha', [Brush.$, null], 'SummaryUnitsText:aez:ahb', [2, null], 'SummaryValueTextColor:ah8:ahc', [Brush.$, null], 'TargetAxis:aao:ahd', [Axis.$, null], 'TitleTextColor:ah9:ahe', [Brush.$, null], 'TitleTextMargin:ais:ahf', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'ToolTipBackground:aia:ahg', [Brush.$, null], 'ToolTipBorderBrush:aib:ahh', [Brush.$, null], 'ToolTipBorderThickness:acl:ahi', [1, NaN], 'UnitsDisplayMode:aav:ahj', [DataLegendUnitsMode_$type, enumGetBox(DataLegendUnitsMode_$type, 0)], 'UnitsTextColor:aic:ahk', [Brush.$, null], 'UnitsTextMargin:ait:ahl', [Thickness.$, new Thickness(1, 0, 0, 0, 0)], 'UnitsText:afd:ahm', [2, null], 'UseInterpolation:ab6:ahn', [0, false], 'ValueFormatAbbreviation:aap:aho', [DataAbbreviationMode_$type, enumGetBox(DataAbbreviationMode_$type, 0)], 'ValueFormatCulture:afk:ahp', [2, stringEmpty()], 'ValueFormatMaxFractions:adg:ahq', [1, -1], 'ValueFormatMinFractions:adh:ahr', [1, -1], 'ValueFormatMode:aaw:ahs', [DataLegendValueMode_$type, enumGetBox(DataLegendValueMode_$type, 0)], 'ValueFormatSpecifiers:aam:aht', [Array_$type, null], 'ValueFormatString:afq:ahu', [2, null], 'ValueFormatUseGrouping:ab7:ahv', [0, true], 'ValueRowMargin:aiu:ahw', [Thickness.$, new Thickness(0, 5)], 'ValueRowVisible:ab8:ahx', [0, true], 'ValueTextColor:aid:ahy', [Brush.$, null], 'ValueTextMargin:aiv:ahz', [Thickness.$, new Thickness(1, 2, 0, 2, 0)], 'ValueTextUseSeriesColors:ab9:ah0', [0, false], 'ValueTextWhenMissingData:afz:ah1', [2, "N/A"]]);
    return DataToolTipLayer;
})();
/**
 * @hidden
 */
export let DataToolTipLayerView = /*@__PURE__*/ (() => {
    class DataToolTipLayerView extends AnnotationLayerView {
        constructor(a) {
            super(a);
            this.cp = null;
            this.cs = null;
            this.cn = null;
            this.cq = false;
            this._htmlTest = null;
            this.cn = a;
            this.htmlTest = /^[^<]*(<[\w\W]+>)[^>]*$/;
            this.cs = new List$1(PointerTooltip.$, 0);
        }
        as() {
            super.as();
            for (let a = 0; a < this.cp.a.count; a++) {
                this.cp.a._inner[a].br();
            }
            for (let b = 0; b < this.cp.b.count; b++) {
                this.cp.b._inner[b].br();
            }
            this.cp.clear();
        }
        ct() {
            let a = new PointerTooltip();
            a.bw(this.f.j3);
            a._visibility = 1;
            a.ap = this.f.dc.dp.k;
            let b = null;
            if (TypeRegistrar.isRegistered("XamDataLegend")) {
                b = TypeRegistrar.create("XamDataLegend");
            }
            b.pixelScalingRatio = 1;
            b.isEmbeddedInDataTooltip = true;
            if (this.f.dc != null) {
                let c = this.f.dc.dp.j.ae.createElement("div");
                let ren_ = this.f.dc.dp.j.ae.getSubRenderer(c);
                let len_ = b;
                len_.provideContainer(ren_);
            }
            a.ai = typeCast(IOnDemandRender_$type, b);
            a.ai.shouldOnDemandRender = true;
            this.cs.add(a);
            return a;
        }
        cv(a) {
            let b = a;
        }
        cx(a) {
            let b = a;
            b._visibility = 1;
        }
        cw(a) {
            let b = a;
            b.bz();
            b.content = null;
            this.cs.remove1(a);
        }
        a4() {
            super.a4();
            this.cp = ((() => {
                let $ret = new Pool$1(Base.$);
                $ret.create = runOn(this, this.ct);
                $ret.activate = runOn(this, this.cv);
                $ret.disactivate = runOn(this, this.cx);
                $ret.destroy = runOn(this, this.cw);
                return $ret;
            })());
        }
        get htmlTest() {
            return this._htmlTest;
        }
        set htmlTest(a) {
            this._htmlTest = a;
        }
        cr(a, b) {
            let c = a;
            let d = c.ai;
            return true;
        }
        c6(a) {
            let b = a;
            let c = new Size(1, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
            b.cy = 1;
            let d = b.cx(new Size(1, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY));
            b.cy = 0;
            return d;
        }
        c5() {
            if (this.f.dc != null) {
                let a = this.f.dc.xf();
                let b = this.f.dc.dp.a8;
                let c = this.f.dc.dp.a7;
                return new Rect(0, 0, 0, b, c);
            }
            return Rect.empty;
        }
        c4() {
            if (this.f.dc != null) {
                let a = this.f.dc.xf();
                let b = this.f.dc.dp.a8;
                let c = this.f.dc.dp.a7;
                return new Rect(0, 0, 0, b, c);
            }
            return Rect.empty;
        }
        c3() {
            let a = 0;
            let b = 0;
            if (this.f.dc != null) {
                let c = this.f.dc.xf();
                a += c.x;
                b += c.y;
                let d = this.f.dc.dp.a8;
                let e = this.f.dc.dp.a7;
                return new Rect(0, a, b, d, e);
            }
            return Rect.empty;
        }
        c2(a) {
            let b = 0;
            let c = 0;
            if (this.f.dc != null) {
                let d = this.f.dc.xf();
                b += d.x;
                c += d.y;
            }
            return { $type: Point_$type, x: b + a.x, y: c + a.y };
        }
        c0(a, b, c, d, e) {
            let f = new PointerTooltipStyle();
            if (this.f.dc != null) {
                let g = this.f.dc.dp.j.i();
                PointerTooltipUtils.a(g, f, this.cn.aia, this.cn.aib, this.cn.acl);
            }
            let h = a;
            if (h == null) {
                return;
            }
            if (d == 0 && e == 0) {
                h.cy = 1;
            }
            else {
                h.cy = 0;
            }
            h.aq = f;
            h.cs = { $type: Point_$type, x: d, y: e };
            h._visibility = 0;
            h.n = b;
            h.o = c;
        }
        c7() {
            let a = (window.innerWidth);
            let b = (window.innerHeight);
            return new Size(1, a, b);
        }
        cy(a) {
            if (a != null) {
                let b = a;
                b._visibility = 1;
            }
        }
        c1() {
            if (this.f.dc == null) {
                this.cz(true);
            }
        }
        bj(a, b) {
            super.bj(a, b);
            if (b) {
                return;
            }
            let c = 0;
            let d = 0;
            let e = this.f.dc;
            if (e != null) {
                let f = e.dp.j.b8();
                c += f.x;
                d += f.y;
            }
            for (let g = 0; g < this.cs.count; g++) {
                this.cs._inner[g].by(this.cs._inner[g].n + c, this.cs._inner[g].o + d);
            }
        }
        ax(a) {
            super.ax(a);
            for (let b = 0; b < this.cs.count; b++) {
                let c = this.cs._inner[b];
                let d = 0;
                let e = 0;
                if (this.f.dc != null) {
                    let f = this.f.dc.xf();
                    d += f.x;
                    e += f.y;
                }
                let g = c.a5();
                let h = c.n - d;
                let i = c.o - e;
                let j = c.ai;
                let k = null;
                if (j != null) {
                    k = j.exportVisualData();
                }
                this.f.bc.addPointerTooltipWithDataLegend(a, g, h, i, k);
            }
        }
        co(a) {
            let b = a;
            let c = b.ai;
            return c;
        }
        cz(a) {
            this.a2();
            for (let b = 0; b < this.cs.count; b++) {
                this.cy(this.cs._inner[b]);
                if (a) {
                    this.cs._inner[b].bs();
                }
            }
        }
    }
    DataToolTipLayerView.$t = markType(DataToolTipLayerView, 'DataToolTipLayerView', AnnotationLayerView.$);
    return DataToolTipLayerView;
})();
