UNPKG

igniteui-webcomponents-charts

Version:

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

2,883 lines 102 kB
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { Base, markType, INotifyPropertyChanged_$type, PropertyChangedEventArgs, Array_$type, enumGetBox, EnumUtil, typeGetValue, Number_$type, String_$type, fromEnum, typeCast, Date_$type, markDep, runOn, TypeRegistrar } from "igniteui-webcomponents-core";
import { List$1 } from "igniteui-webcomponents-core";
import { DataAbbreviationMode_$type } from "igniteui-webcomponents-core";
import { Brush } from "igniteui-webcomponents-core";
import { FontInfo } from "igniteui-webcomponents-core";
import { Thickness } from "igniteui-webcomponents-core";
import { Size } from "igniteui-webcomponents-core";
import { Rect } from "igniteui-webcomponents-core";
import { stringIsNullOrEmpty, stringEmpty, stringContains } from "igniteui-webcomponents-core";
import { DataLegendSeriesContext } from "igniteui-webcomponents-core";
import { LegendItemBadgeShape_$type } from "igniteui-webcomponents-core";
import { Control } from "igniteui-webcomponents-core";
import { IDataLegend_$type } from "igniteui-webcomponents-core";
import { IOnDemandRender_$type } from "igniteui-webcomponents-core";
import { DependencyProperty } from "igniteui-webcomponents-core";
import { DataLegendValueMode_$type } from "igniteui-webcomponents-core";
import { FontUtil } from "igniteui-webcomponents-core";
import { DataLegendHeaderDateMode_$type } from "igniteui-webcomponents-core";
import { DataLegendHeaderTimeMode_$type } from "igniteui-webcomponents-core";
import { DataLegendSummaryType_$type } from "igniteui-webcomponents-core";
import { DataLegendUnitsMode_$type } from "igniteui-webcomponents-core";
import { DataLegendLabelMode_$type } from "igniteui-webcomponents-core";
import { DataLegendLayoutMode_$type } from "igniteui-webcomponents-core";
import { BindingFormatter } from "igniteui-webcomponents-core";
import { DataLegendVisualData } from "./DataLegendVisualData";
import { Extensions } from "igniteui-webcomponents-core";
import { TextBlock } from "igniteui-webcomponents-core";
import { DataLegendVisualDataRow } from "./DataLegendVisualDataRow";
import { DataLegendVisualDataColumn } from "./DataLegendVisualDataColumn";
import { ILegendContext_$type } from "igniteui-webcomponents-core";
import { RectData } from "igniteui-webcomponents-core";
import { AppearanceHelper } from "igniteui-webcomponents-core";
import { PrimitiveAppearanceData } from "igniteui-webcomponents-core";
import { FrameworkElement } from "igniteui-webcomponents-core";
import { DataLegendSummaryEventArgs } from "./DataLegendSummaryEventArgs";
import { DataLegendSummaryCalculationTotal } from "./DataLegendSummaryCalculationTotal";
import { DataLegendSummaryCalculationAverage } from "./DataLegendSummaryCalculationAverage";
import { DataLegendSummaryCalculationMin } from "./DataLegendSummaryCalculationMin";
import { DataLegendSummaryCalculationMax } from "./DataLegendSummaryCalculationMax";
import { DataLegendSummaryCalculationEmpty } from "./DataLegendSummaryCalculationEmpty";
import { DataLegendStylingRowEventArgs } from "./DataLegendStylingRowEventArgs";
import { DataLegendStylingColumnEventArgs } from "./DataLegendStylingColumnEventArgs";
import { Dictionary$2 } from "igniteui-webcomponents-core";
import { IDataLegendSeries_$type } from "igniteui-webcomponents-core";
import { DataLegendSeriesGroupInfo } from "./DataLegendSeriesGroupInfo";
import { RenderingContext } from "igniteui-webcomponents-core";
import { DataLegendRenderContext } from "./DataLegendRenderContext";
import { Pool$1 } from "igniteui-webcomponents-core";
import { ContentControl } from "igniteui-webcomponents-core";
import { DataLegendSeriesValueInfo } from "igniteui-webcomponents-core";
import { DataLegendColumn } from "./DataLegendColumn";
import { DataLegendSummaryColumn } from "igniteui-webcomponents-core";
import { DataAbbreviator } from "./DataAbbreviator";
import { NumberFormatSpecifier } from "igniteui-webcomponents-core";
import { DateTimeFormatSpecifier } from "igniteui-webcomponents-core";
import { PropertyMetadata } from "igniteui-webcomponents-core";
import { isNaN_, isInfinity, truncate } from "igniteui-webcomponents-core";
import { EventProxy } from "igniteui-webcomponents-core";
import { Tuple$2 } from "igniteui-webcomponents-core";
import { CanvasViewRenderer } from "igniteui-webcomponents-core";
import { DataTemplatePassInfo } from "igniteui-webcomponents-core";
import { DataTemplateMeasureInfo } from "igniteui-webcomponents-core";
import { DataTemplateRenderInfo } from "igniteui-webcomponents-core";
import { FontDefaults } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let DataLegendContent = /*@__PURE__*/ (() => {
    class DataLegendContent extends Base {
        constructor() {
            super(...arguments);
            this.a = new List$1(DataLegendRowInfo.$, 0);
            this.d = 0;
            this.c = 0;
        }
        get b() {
            return this.a;
        }
        f() {
            this.b.clear();
        }
        e(a) {
            this.b.add(a);
        }
    }
    DataLegendContent.$t = /*@__PURE__*/ markType(DataLegendContent, 'DataLegendContent');
    return DataLegendContent;
})();
/**
 * @hidden
 */
export let DataLegendRowBase = /*@__PURE__*/ (() => {
    class DataLegendRowBase extends Base {
        constructor(a, b, c, d, e) {
            super();
            this.g = 0;
            this.c = false;
            this.e = false;
            this.a = false;
            this.b = false;
            this.d = false;
            this.f = false;
            this.g = e;
            this.e = b;
            this.b = c;
            this.a = d;
            this.d = !c && !b && !d;
            this.c = true;
            this.f = false;
        }
    }
    DataLegendRowBase.$t = /*@__PURE__*/ markType(DataLegendRowBase, 'DataLegendRowBase');
    return DataLegendRowBase;
})();
/**
 * @hidden
 */
export let DataLegendRowCell = /*@__PURE__*/ (() => {
    class DataLegendRowCell extends DataLegendRowBase {
        constructor(a, b, c, d, e) {
            super(a, b, c, d, e);
            this.u = 0;
            this.h = 0;
            this.t = 0;
            this.y = null;
            this.x = null;
            this.v = null;
            this.z = null;
            this.w = null;
            this.ab = null;
            this.ac = null;
            this.ad = null;
            this.i = null;
            this.k = null;
            this.j = null;
            this.an = null;
            this.ap = null;
            this.ao = null;
            this.ai = new Size();
            this.am = new Size();
            this.ak = new Size();
            this.o = false;
            this.l = false;
            this.ae = null;
            this.ag = null;
            this.af = null;
            this.ah = new Size();
            this.al = new Size();
            this.aj = new Size();
            this.t = NaN;
            this.an = new Thickness(0, 0);
            this.ap = new Thickness(0, 0);
            this.ao = new Thickness(0, 0);
            this.ai = new Size(1, 0, 0);
            this.am = new Size(1, 0, 0);
            this.ak = new Size(1, 0, 0);
            this.o = true;
            this.l = true;
            if (this.d) {
                this.ab = a.bw();
                this.ad = a.by();
                this.ac = a.bx();
                this.i = a.l();
                this.k = a.p();
                this.j = a.o();
            }
            else if (this.e) {
                let f = a.bv();
                let g = a.m();
                this.ab = f;
                this.ad = f;
                this.ac = f;
                this.i = g;
                this.k = g;
                this.j = g;
            }
            else if (this.a) {
                let h = a.bs();
                let i = a.j();
                this.ab = h;
                this.ad = h;
                this.ac = h;
                this.i = i;
                this.k = i;
                this.j = i;
            }
            else {
                let j = a.bt();
                let k = a.k();
                this.ab = j;
                this.ad = j;
                this.ac = j;
                this.i = k;
                this.k = k;
                this.j = k;
            }
            this.ae = Rect.empty;
            this.ag = Rect.empty;
            this.af = Rect.empty;
        }
        m() {
            return this.ai.width > 0 && this.ai.height > 0;
        }
        p() {
            return this.ak.width > 0 && this.ak.height > 0;
        }
        r() {
            return this.am.width > 0 && this.am.height > 0;
        }
        n() {
            return this.v != null;
        }
        q() {
            return this.w != null;
        }
        s() {
            return !stringIsNullOrEmpty(this.z) && this.am.width > 0 && this.am.height > 0;
        }
        aa() {
            this.ah = new Size(1, 0, 0);
            this.al = new Size(1, 0, 0);
            this.aj = new Size(1, 0, 0);
        }
    }
    DataLegendRowCell.$t = /*@__PURE__*/ markType(DataLegendRowCell, 'DataLegendRowCell', DataLegendRowBase.$);
    return DataLegendRowCell;
})();
/**
 * @hidden
 */
export let DataLegendRowInfo = /*@__PURE__*/ (() => {
    class DataLegendRowInfo extends DataLegendRowBase {
        s(a) {
            if (this.m == null) {
                return;
            }
            for (let b = 0; b < this.m.count; b++) {
                a(this.m._inner[b]);
            }
        }
        constructor(a, b, c, d, e) {
            super(a, b, c, d, e);
            this.m = null;
            this.l = false;
            this.q = null;
            this.h = null;
            this.i = null;
            this.r = null;
            this.u = null;
            this.k = null;
            this.y = new Size();
            this.ab = null;
            this.p = null;
            this.t = null;
            this.x = new Size();
            this.n = null;
            this.j = 0;
            this.o = null;
            this.aa = null;
            this.z = null;
            this.v = null;
            this.w = null;
            this.h = new Array(0);
            this.m = new List$1(DataLegendRowCell.$, 0);
            this.l = this.d;
            this.aa = new Thickness(0, 0);
            this.z = new Thickness(0, 0);
            this.ab = new Thickness(0, 0);
            this.x = new Size(1, 0, 0);
            this.y = new Size(1, 0, 0);
            if (this.d) {
                this.u = a.bw();
                this.k = a.n();
            }
            else if (this.e) {
                let f = a.bv();
                let g = a.m();
                this.u = f;
                this.k = g;
            }
            else if (this.a) {
                let h = a.bs();
                let i = a.j();
                this.u = h;
                this.k = i;
            }
            else {
                let j = a.bt();
                let k = a.k();
                this.u = j;
                this.k = k;
            }
            this.w = Rect.empty;
            this.v = Rect.empty;
            this.j = 7;
            this.o = "None";
        }
    }
    DataLegendRowInfo.$t = /*@__PURE__*/ markType(DataLegendRowInfo, 'DataLegendRowInfo', DataLegendRowBase.$);
    return DataLegendRowInfo;
})();
/**
 * @hidden
 */
export let XamDataLegend = /*@__PURE__*/ (() => {
    class XamDataLegend extends Control {
        get cq() {
            return this.cm;
        }
        set cq(a) {
            let b = this.cm;
            this.cm = a;
            if (b != this.cm) {
                this.gb("ActualCursorPositionX", b, this.cm);
            }
        }
        get cr() {
            return this.cn;
        }
        set cr(a) {
            let b = this.cn;
            this.cn = a;
            if (b != this.cn) {
                this.gb("ActualCursorPositionY", b, this.cn);
            }
        }
        get cs() {
            return this.co;
        }
        set cs(a) {
            let b = this.co;
            this.co = a;
            this.gb("ActualPixelScalingRatio", b, this.co);
        }
        get bx() {
            return this.bm;
        }
        set bx(a) {
            let b = this.bm;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.p();
            }
            this.bm = a;
            if (b != this.bm) {
                this.gb("ValueTextStyle", b, this.bm);
            }
        }
        get bp() {
            return this.be;
        }
        set bp(a) {
            let b = this.be;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.k();
            }
            this.be = a;
            if (b != this.be) {
                this.gb("HeaderTextStyle", b, this.be);
            }
        }
        get bo() {
            return this.bd;
        }
        set bo(a) {
            let b = this.bd;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.j();
            }
            this.bd = a;
            if (b != this.bd) {
                this.gb("GroupTextStyle", b, this.bd);
            }
        }
        get bs() {
            return this.bh;
        }
        set bs(a) {
            let b = this.bh;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.m();
            }
            this.bh = a;
            if (b != this.bh) {
                this.gb("SummaryTitleTextStyle", b, this.bh);
            }
        }
        get bu() {
            return this.bj;
        }
        set bu(a) {
            let b = this.bj;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.p();
            }
            this.bj = a;
            if (b != this.bj) {
                this.gb("SummaryValueTextStyle", b, this.bj);
            }
        }
        get br() {
            return this.bg;
        }
        set br(a) {
            let b = this.bg;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.l();
            }
            this.bg = a;
            if (b != this.bg) {
                this.gb("SummaryLabelTextStyle", b, this.bg);
            }
        }
        get bt() {
            return this.bi;
        }
        set bt(a) {
            let b = this.bi;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.o();
            }
            this.bi = a;
            if (b != this.bi) {
                this.gb("SummaryUnitsTextStyle", b, this.bi);
            }
        }
        get bw() {
            return this.bl;
        }
        set bw(a) {
            let b = this.bl;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.o();
            }
            this.bl = a;
            if (b != this.bl) {
                this.gb("UnitsTextStyle", b, this.bl);
            }
        }
        get bv() {
            return this.bk;
        }
        set bv(a) {
            let b = this.bk;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.n();
            }
            this.bk = a;
            if (b != this.bk) {
                this.gb("TitleTextStyle", b, this.bk);
            }
        }
        get bq() {
            return this.bf;
        }
        set bq(a) {
            let b = this.bf;
            if (typeof a === 'string') {
                a = FontUtil.getFontInfoFromString(this.a7.al, a);
            }
            else if (a == null || a.c()) {
                a = this.a7.l();
            }
            this.bf = a;
            if (b != this.bf) {
                this.gb("LabelTextStyle", b, this.bf);
            }
        }
        get pixelScalingRatio() {
            return this.cp;
        }
        set pixelScalingRatio(a) {
            let b = this.cp;
            this.cp = a;
            this.gb("PixelScalingRatio", b, this.cp);
        }
        exportSerializedVisualData() {
            let a = this.exportVisualData();
            return a.serialize();
        }
        cu(a, b) {
            let c = Math.max(b.left, a);
            let d = Math.max(b.right, a);
            let e = Math.max(b.right, a);
            return Math.min(b.top, a);
        }
        ct(a, b) {
            return Math.min(b.left, a);
        }
        iy(a, b) {
            let c = Rect.l_op_Equality(a, null) || a.isEmpty || !Extensions.b(a);
            let d = Rect.l_op_Equality(b, null) || b.isEmpty || !Extensions.b(b);
            if (c) {
                return b;
            }
            if (d) {
                return a;
            }
            if (c && c) {
                return Rect.empty;
            }
            let e = Math.min(a.top, b.top);
            let f = Math.min(a.left, b.left);
            let g = Math.max(a.right, b.right);
            let h = Math.max(a.bottom, b.bottom);
            return new Rect(0, f, e, g - f, h - e);
        }
        exportVisualData() {
            let a = new DataLegendVisualData();
            a.width = this.ao.d;
            a.height = this.ao.c;
            if (this.a7 == null) {
                return a;
            }
            let b = -1;
            let c = -1;
            let d = -1;
            let e = -1;
            let f = this.a7.af;
            let g = this.a7.ad;
            let h = this.a7.ah;
            let i = this.a7.ag;
            if (f.count < this.ao.b.count) {
                return a;
            }
            if (Rect.l_op_Equality(this.iz, null) || this.iz.isEmpty) {
                a.viewport = null;
            }
            else {
                a.viewport = new RectData(0, 0, this.iz.width, this.iz.height);
            }
            for (let j = 0; j < this.ao.b.count; j++) {
                let k = this.ao.b._inner[j];
                let l = new DataLegendVisualDataRow();
                l.seriesIndex = k.g;
                l.rowMarginTop = k.aa.top;
                l.rowMarginBottom = k.aa.bottom;
                l.rowMarginRight = k.aa.right;
                l.rowMarginLeft = k.aa.left;
                let m = Rect.empty;
                if (k.c) {
                    if (Extensions.b(k.w) && f.count > (b + 1)) {
                        b++;
                        let n = f._inner[b];
                        let o = this.bn(n, k.k);
                        let p = new DataLegendVisualDataColumn();
                        p.bounds = RectData.b(k.w);
                        p.text = n.al;
                        p.textColor = AppearanceHelper.b(k.u);
                        p.marginTop = k.ab.top;
                        p.marginLeft = k.ab.left;
                        p.marginRight = k.ab.right;
                        p.marginBottom = k.ab.bottom;
                        this.gl(p, o);
                        l.columns.add(p);
                        m = this.iy(m, k.w);
                    }
                    for (let q of fromEnum(k.m)) {
                        if (Extensions.b(q.ae) && g.count > (c + 1)) {
                            c++;
                            let r = g._inner[c];
                            let s = this.bn(r, q.i);
                            let t = new DataLegendVisualDataColumn();
                            t.bounds = RectData.b(q.ae);
                            t.text = r.al;
                            t.textColor = AppearanceHelper.b(q.ab);
                            t.marginTop = q.an.top;
                            t.marginLeft = q.an.left;
                            t.marginRight = q.an.right;
                            t.marginBottom = q.an.bottom;
                            this.gl(t, s);
                            l.columns.add(t);
                            m = this.iy(m, q.ae);
                        }
                        if (Extensions.b(q.ag) && h.count > (d + 1)) {
                            d++;
                            let u = h._inner[d];
                            let v = this.bn(u, q.k);
                            let w = new DataLegendVisualDataColumn();
                            w.bounds = RectData.b(q.ag);
                            w.text = u.al;
                            w.textColor = AppearanceHelper.b(q.ad);
                            w.marginTop = q.ap.top;
                            w.marginLeft = q.ap.left;
                            w.marginRight = q.ap.right;
                            w.marginBottom = q.ap.bottom;
                            this.gl(w, v);
                            l.columns.add(w);
                            m = this.iy(m, q.ag);
                        }
                        if (Extensions.b(q.af) && i.count > (e + 1)) {
                            e++;
                            let x = i._inner[e];
                            let y = this.bn(x, q.j);
                            let z = new DataLegendVisualDataColumn();
                            z.bounds = RectData.b(q.af);
                            z.text = q.o ? q.w : null;
                            z.textColor = AppearanceHelper.b(q.ac);
                            z.marginTop = q.ao.top;
                            z.marginLeft = q.ao.left;
                            z.marginRight = q.ao.right;
                            z.marginBottom = q.ao.bottom;
                            this.gl(z, y);
                            l.columns.add(z);
                            m = this.iy(m, q.af);
                        }
                    }
                    if (k.l) {
                        m = this.iy(m, k.v);
                        l.badgeBounds = RectData.b(k.v);
                        l.badgeMarginTop = k.z.top;
                        l.badgeMarginBottom = k.z.bottom;
                        l.badgeMarginRight = k.z.right;
                        l.badgeMarginLeft = k.z.left;
                        l.badgeAppearance = new PrimitiveAppearanceData();
                        let aa = typeCast(ILegendContext_$type, k.n);
                        let ab = typeCast(ILegendContext_$type, k.i);
                        l.badgeAppearance.fill = AppearanceHelper.b(aa.actualItemBrush);
                        l.badgeAppearance.stroke = AppearanceHelper.b(aa.outline);
                        l.badgeShape = k.o;
                    }
                    l.rowBounds = RectData.b(m);
                }
                a.rows.add(l);
            }
            return a;
        }
        gl(a, b) {
            if (b != null) {
                if (b.q != null) {
                    a.fontFamily = b.q;
                }
                if (!isNaN_(b.f)) {
                    a.fontSize = b.f;
                }
                a.fontWeight = stringIsNullOrEmpty(b.v) ? "Normal" : b.v;
                a.fontStyle = stringIsNullOrEmpty(b.t) ? "Normal" : b.t;
                if (b.r != null) {
                    a.fontStretch = b.t;
                }
            }
        }
        bn(a, b) {
            let c = a.dataContext;
            if (c != null) {
                b = a.dataContext;
            }
            if (b == null || stringIsNullOrEmpty(b.fontString)) {
                return b;
            }
            else {
                return FontUtil.toFontInfo(this.a7.al, b.fontString);
            }
        }
        a2(a) {
            if (this.calculateColumnSummary != null) {
                let b = new DataLegendSummaryEventArgs(a.a, a.d);
                b.summaryValue = a.c;
                this.calculateColumnSummary(this, b);
                a.c = b.summaryValue;
                a.f = b.summaryUnits;
                a.e = b.summaryLabel;
            }
            return a;
        }
        a8() {
            switch (this.a3) {
                case 0:
                case 1: return new DataLegendSummaryCalculationTotal();
                case 2: return new DataLegendSummaryCalculationAverage();
                case 3: return new DataLegendSummaryCalculationMin();
                case 4: return new DataLegendSummaryCalculationMax();
                case 5: return new DataLegendSummaryCalculationEmpty();
                default: return new DataLegendSummaryCalculationEmpty();
            }
        }
        gq(a) {
            if (this.styleSummaryRow != null) {
                let b = this.a0(a);
                this.styleSummaryRow(this, b);
                this.gm(a, b);
            }
            if (a.c && a.m != null && this.styleSummaryColumn != null) {
                for (let c = 0; c < a.m.count; c++) {
                    let d = this.az(a.m._inner[c]);
                    d.d = a.g;
                    d.g = a.q;
                    d.c = c;
                    d.e = a.p;
                    this.styleSummaryColumn(this, d);
                    this.gr(a.m._inner[c], d);
                }
            }
        }
        gp(a) {
            if (this.styleSeriesRow != null) {
                let b = this.a0(a);
                this.styleSeriesRow(this, b);
                this.gm(a, b);
            }
            if (a.c && a.m != null && this.styleSeriesColumn != null) {
                for (let c = 0; c < a.m.count; c++) {
                    let d = this.az(a.m._inner[c]);
                    d.d = a.g;
                    d.g = a.q;
                    d.c = c;
                    d.e = a.p;
                    this.styleSeriesColumn(this, d);
                    this.gr(a.m._inner[c], d);
                }
            }
        }
        go(a) {
            if (this.styleHeaderRow != null) {
                let b = this.a0(a);
                this.styleHeaderRow(this, b);
                this.gm(a, b);
            }
        }
        gn(a) {
            if (this.styleGroupRow != null) {
                let b = this.a0(a);
                this.styleGroupRow(this, b);
                this.gm(a, b);
            }
        }
        a0(a) {
            let b = new DataLegendStylingRowEventArgs();
            b.g = a.r;
            b.h = a.u;
            b.e = a.p;
            b.a = a.j;
            b.b = a.l;
            b.c = a.c;
            b.d = a.g;
            b.f = a.q;
            return b;
        }
        gm(a, b) {
            a.r = b.g;
            a.u = b.h;
            a.j = b.a;
            a.l = b.b;
            a.c = b.c;
        }
        az(a) {
            let b = new DataLegendStylingColumnEventArgs();
            b.f = a.v;
            b.l = a.ab;
            b.h = a.w;
            b.m = a.ac;
            b.k = a.z;
            b.n = a.ad;
            b.b = a.t;
            b.j = a.y;
            b.i = a.x;
            b.a = a.h;
            return b;
        }
        gr(a, b) {
            a.ab = b.l;
            a.v = b.f;
            a.l = !stringIsNullOrEmpty(a.v);
            a.w = b.h;
            a.ac = b.m;
            a.o = !stringIsNullOrEmpty(a.w);
            a.z = b.k;
            a.ad = b.n;
        }
        ge(a, b, c) {
            switch (a) {
                case XamDataLegend.$$p[25]:
                    this.b1 = c;
                    break;
                case XamDataLegend.$$p[19]:
                case XamDataLegend.$$p[3]:
                    this.gv();
                    break;
                case XamDataLegend.$$p[18]:
                case XamDataLegend.$$p[2]:
                    this.gu();
                    break;
                case XamDataLegend.$$p[38]:
                    let d = c;
                    let e = b;
                    this.gc(e, d);
                    break;
                case XamDataLegend.$$p[36]:
                    if (this.b6(this.targetCursorPositionX)) {
                        this.cq = this.targetCursorPositionX;
                    }
                    break;
                case XamDataLegend.$$p[37]:
                    if (this.b6(this.targetCursorPositionY)) {
                        this.cr = this.targetCursorPositionY;
                    }
                    break;
                case XamDataLegend.$$p[52]:
                case XamDataLegend.$$p[51]:
                    if (!stringIsNullOrEmpty(this.fg)) {
                        this.ak = ((() => {
                            let $ret = new BindingFormatter();
                            $ret.j = this.fg;
                            $ret.d = this.ah;
                            return $ret;
                        })());
                    }
                    else {
                        this.ak = null;
                    }
                    break;
                case XamDataLegend.$$p[11]:
                case XamDataLegend.$$p[10]:
                    if (!stringIsNullOrEmpty(this.dm)) {
                        this.ai = ((() => {
                            let $ret = new BindingFormatter();
                            $ret.j = this.dm;
                            $ret.d = this.ag;
                            return $ret;
                        })());
                    }
                    else {
                        this.ai = null;
                    }
                    break;
                case "PixelScalingRatio":
                    if (isNaN_(this.cs)) {
                        this.a7.ay();
                    }
                    else {
                        this.cs = this.pixelScalingRatio;
                    }
                    break;
                case "ActualPixelScalingRatio":
                    this.a7.a9(c);
                    break;
            }
            this.gg();
        }
        gb(a, b, c) {
            this.ge(a, b, c);
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
        }
        gc(a, b) {
            this.a9 = b;
            if (a != null) {
                a.detachDataLegend(this);
            }
            if (b != null) {
                b.attachDataLegend(this);
                if (isNaN_(this.targetCursorPositionX)) {
                    this.cq = -1;
                }
                if (isNaN_(this.targetCursorPositionY)) {
                    this.cr = -1;
                }
            }
        }
        gv() {
            this.ch = this.ci(this.includedSeries);
            this.cg = this.ci(this.excludedSeries);
        }
        gu() {
            this.ce = this.ci(this.includedColumns);
            this.cd = this.ci(this.excludedColumns);
            if (this.ce != null) {
                let a = new List$1(String_$type, 1, this.ce.keys);
                for (let b of fromEnum(a)) {
                    let c = b + ":";
                    let d = this.ce.item(b);
                    if (!this.ce.containsKey(c)) {
                        this.ce.addItem(c, d);
                    }
                }
                this.fs(this.ce);
            }
            if (this.cd != null) {
                let e = new List$1(String_$type, 1, this.cd.keys);
                for (let f of fromEnum(e)) {
                    let g = f + ":";
                    let h = this.cd.item(f);
                    if (!this.cd.containsKey(g)) {
                        this.cd.addItem(g, h);
                    }
                }
                this.fs(this.cd);
            }
        }
        fs(a) {
            let b = new List$1(String_$type, 1, a.keys);
            for (let c of fromEnum(b)) {
                let d = a.item(c);
                let e = c.toLowerCase();
                if (!a.containsKey(e)) {
                    a.addItem(e, d);
                }
                let f = c.toUpperCase();
                if (!a.containsKey(f)) {
                    a.addItem(f, d);
                }
                if (c.length > 0) {
                    let g = f.substr(0, 1) + e.substr(1);
                    if (!a.containsKey(g)) {
                        a.addItem(g, d);
                    }
                }
            }
        }
        ci(a) {
            if (a == null) {
                return null;
            }
            let b = new Dictionary$2(String_$type, Number_$type, 0);
            for (let c = 0; c < a.length; c++) {
                let d = a[c];
                if (!stringIsNullOrEmpty(d) && !b.containsKey(d.trim())) {
                    b.addItem(d.trim(), b.count);
                }
            }
            return b;
        }
        b6(a) {
            return a >= 0 && a <= 1;
        }
        notifyCursorPositionChanged(a) {
            let b = !isNaN_(this.targetCursorPositionX) || !isNaN_(this.targetCursorPositionY);
            let c = !isNaN_(a.x) && this.b6(a.x);
            let d = !isNaN_(a.y) && this.b6(a.y);
            if (!b && c && d) {
                this.cq = a.x;
                this.cr = a.y;
            }
        }
        notifySizeChanged() {
            this.a7.a7();
        }
        notifyVisualPropertiesChanged(a) {
        }
        notifySeriesCollectionChanged() {
            this.gg();
        }
        notifySeriesDataChanged() {
            if (this.b1) {
                this.gg();
            }
        }
        constructor() {
            super();
            this.b0 = false;
            this.cm = NaN;
            this.cn = NaN;
            this.co = 1;
            this.b1 = false;
            this.bm = null;
            this.be = null;
            this.bd = null;
            this.bh = null;
            this.bj = null;
            this.bg = null;
            this.bi = null;
            this.a9 = null;
            this.bl = null;
            this.bk = null;
            this.b7 = false;
            this.bf = null;
            this.cp = NaN;
            this.calculateColumnSummary = null;
            this.styleHeaderRow = null;
            this.styleGroupRow = null;
            this.styleSeriesRow = null;
            this.styleSummaryRow = null;
            this.styleSeriesColumn = null;
            this.styleSummaryColumn = null;
            this.propertyChanged = null;
            this.ce = null;
            this.cd = null;
            this.ch = null;
            this.cg = null;
            this.a7 = null;
            this.iz = null;
            this._externalObject = null;
            this.by = false;
            this.bz = false;
            this.cl = null;
            this.cf = new Dictionary$2(String_$type, DataLegendSeriesGroupInfo.$, 0);
            this.ao = new DataLegendContent();
            this.cw = 0;
            this.ak = null;
            this.al = null;
            this.c2 = "";
            this.ai = null;
            this.aj = null;
            this.iz = Rect.empty;
            this.b1 = true;
            this.ab = XamDataLegend.$;
            this.a7 = this.a6();
        }
        updatePropertyByName(a, b) {
            switch (a) {
                case XamDataLegend.$$p[20]:
                    this.isEmbeddedInDataTooltip = b;
                    break;
                case XamDataLegend.$$p[19]:
                    this.includedSeries = b;
                    break;
                case XamDataLegend.$$p[3]:
                    this.excludedSeries = b;
                    break;
                case XamDataLegend.$$p[18]:
                    this.includedColumns = b;
                    break;
                case XamDataLegend.$$p[2]:
                    this.excludedColumns = b;
                    break;
                case XamDataLegend.$$p[45]:
                    this.an = EnumUtil.getEnumValue(DataAbbreviationMode_$type, b);
                    break;
                case XamDataLegend.$$p[48]:
                    this.cy = typeGetValue(b);
                    break;
                case XamDataLegend.$$p[49]:
                    this.cz = typeGetValue(b);
                    break;
                case XamDataLegend.$$p[50]:
                    this.a5 = EnumUtil.getEnumValue(DataLegendValueMode_$type, b);
                    break;
                case XamDataLegend.$$p[46]:
                    this.e8 = b;
                    break;
                case XamDataLegend.$$p[53]:
                    this.ca = b;
                    break;
                case XamDataLegend.$$p[52]:
                    this.fg = b;
                    break;
                case XamDataLegend.$$p[51]:
                    this.ah = b;
                    break;
                case XamDataLegend.$$p[54]:
                    this.jf = b;
                    break;
                case XamDataLegend.$$p[55]:
                    this.cb = b;
                    break;
                case XamDataLegend.$$p[59]:
                    this.fp = b;
                    break;
                case XamDataLegend.$$p[58]:
                    this.cc = b;
                    break;
                case XamDataLegend.$$p[57]:
                    this.jg = b;
                    break;
                case XamDataLegend.$$p[56]:
                    this.ix = b;
                    break;
                case "ValueTextStyle":
                    this.bx = b;
                    break;
                case XamDataLegend.$$p[11]:
                    this.dm = b;
                    break;
                case XamDataLegend.$$p[10]:
                    this.ag = b;
                    break;
                case XamDataLegend.$$p[8]:
                    this.di = b;
                    break;
                case XamDataLegend.$$p[9]:
                    this.ap = EnumUtil.getEnumValue(DataLegendHeaderDateMode_$type, b);
                    break;
                case XamDataLegend.$$p[12]:
                    this.aq = EnumUtil.getEnumValue(DataLegendHeaderTimeMode_$type, b);
                    break;
                case XamDataLegend.$$p[17]:
                    this.ds = b;
                    break;
                case XamDataLegend.$$p[15]:
                    this.io = b;
                    break;
                case XamDataLegend.$$p[16]:
                    this.i8 = b;
                    break;
                case XamDataLegend.$$p[13]:
                    this.i7 = b;
                    break;
                case XamDataLegend.$$p[14]:
                    this.b5 = b;
                    break;
                case "HeaderTextStyle":
                    this.bp = b;
                    break;
                case XamDataLegend.$$p[6]:
                    this.im = b;
                    break;
                case XamDataLegend.$$p[7]:
                    this.i6 = b;
                    break;
                case XamDataLegend.$$p[4]:
                    this.i5 = b;
                    break;
                case XamDataLegend.$$p[5]:
                    this.b3 = b;
                    break;
                case "GroupTextStyle":
                    this.bo = b;
                    break;
                case XamDataLegend.$$p[29]:
                    this.is = b;
                    break;
                case "SummaryTitleTextStyle":
                    this.bs = b;
                    break;
                case XamDataLegend.$$p[32]:
                    this.a3 = EnumUtil.getEnumValue(DataLegendSummaryType_$type, b);
                    break;
                case XamDataLegend.$$p[31]:
                    this.ej = b;
                    break;
                case XamDataLegend.$$p[30]:
                    this.jb = b;
                    break;
                case XamDataLegend.$$p[28]:
                    this.ja = b;
                    break;
                case XamDataLegend.$$p[35]:
                    this.iu = b;
                    break;
                case "SummaryValueTextStyle":
                    this.bu = b;
                    break;
                case XamDataLegend.$$p[27]:
                    this.ee = b;
                    break;
                case XamDataLegend.$$p[26]:
                    this.ir = b;
                    break;
                case "SummaryLabelTextStyle":
                    this.br = b;
                    break;
                case XamDataLegend.$$p[34]:
                    this.ep = b;
                    break;
                case XamDataLegend.$$p[33]:
                    this.it = b;
                    break;
                case "SummaryUnitsTextStyle":
                    this.bt = b;
                    break;
                case XamDataLegend.$$p[0]:
                    this.i4 = b;
                    break;
                case XamDataLegend.$$p[1]:
                    this.ba = EnumUtil.getEnumValue(LegendItemBadgeShape_$type, b);
                    break;
                case XamDataLegend.$$p[41]:
                    this.a4 = EnumUtil.getEnumValue(DataLegendUnitsMode_$type, b);
                    break;
                case XamDataLegend.$$p[44]:
                    this.e2 = b;
                    break;
                case XamDataLegend.$$p[42]:
                    this.iw = b;
                    break;
                case XamDataLegend.$$p[43]:
                    this.jd = b;
                    break;
                case "UnitsTextStyle":
                    this.bw = b;
                    break;
                case XamDataLegend.$$p[40]:
                    this.jc = b;
                    break;
                case XamDataLegend.$$p[39]:
                    this.iv = b;
                    break;
                case "TitleTextStyle":
                    this.bv = b;
                    break;
                case XamDataLegend.$$p[21]:
                    this.ar = EnumUtil.getEnumValue(DataLegendLabelMode_$type, b);
                    break;
                case XamDataLegend.$$p[22]:
                    this.ip = b;
                    break;
                case XamDataLegend.$$p[23]:
                    this.b7 = true;
                    this.i9 = b;
                    break;
                case XamDataLegend.$$p[24]:
                    this.as = EnumUtil.getEnumValue(DataLegendLayoutMode_$type, b);
                    break;
                case "LabelTextStyle":
                    this.bq = b;
                    break;
            }
        }
        a6() {
            return new DataLegendView(this);
        }
        destroy() {
            this.provideContainer(null);
        }
        get externalObject() {
            return this._externalObject;
        }
        set externalObject(a) {
            this._externalObject = a;
        }
        flush() {
            this.a7.av();
        }
        onAttachedToUI() {
            this.a7.a5();
        }
        onDetachedFromUI() {
            this.a7.a8();
        }
        ensureIndirectContainer(a, b) {
            if (this.a7.al == null) {
                this.a7.a6(a, true);
            }
        }
        provideContainer(a) {
            this.a7.a6(a, false);
        }
        gg() {
            if (this.by) {
                return;
            }
            this.by = this.a7.aa();
        }
        get shouldOnDemandRender() {
            return this.bz;
        }
        set shouldOnDemandRender(a) {
            this.bz = a;
        }
        doRender(a, b) {
            if (this.iz.isEmpty) {
                let c = this.getDesiredSize();
                this.iz = new Rect(0, 0, 0, c.width, c.height);
            }
            this.gh(true);
            this.a7.bb(a, b);
        }
        ensureUpdated() {
            let a = this.getDesiredSize();
        }
        f1() {
            if (!this.by) {
                if (this.ao == null) {
                    this.gg();
                }
                else {
                    return;
                }
            }
            this.gt();
        }
        getDesiredSize() {
            this.f1();
            if (this.ao == null) {
                return new Size(1, 0, 0);
            }
            return new Size(1, this.ao.d, this.ao.c);
        }
        gt() {
            this.fy();
            if (this.a9 == null || this.a9.isDetached || !this.b4()) {
                return;
            }
            let a = this.a9;
            let b = a.getDataLegendSeries();
            this.f2(b);
            this.fr(b, "");
            this.cl = new List$1(String_$type, 0);
            for (let c of fromEnum(this.cf.keys)) {
                let d = this.cf.item(c);
                this.f5(d);
                for (let e of fromEnum(d.b)) {
                    if (!this.cl.contains(e.h) && !stringContains(e.h, "Highlight") && !stringContains(e.h, "Overlay") && !stringContains(e.h, "Value Layer")) {
                        this.cl.add(e.h);
                    }
                }
            }
            for (let f of fromEnum(this.cf.keys)) {
                let g = this.cf.item(f);
                if (g.c.count > 0) {
                    this.f4(g);
                }
            }
            this.b0 = this.b8();
            this.fx(this.ao);
        }
        f2(a) {
            let b = new Dictionary$2(Number_$type, List$1.$.specialize(IDataLegendSeries_$type), 0);
            for (let c = 0; c < a.length; c++) {
                if (!this.isEmbeddedInDataTooltip) {
                    if (a[c].legendItemVisibility != 0) {
                        continue;
                    }
                }
                let d = a[c].title == null ? null : a[c].title.toString();
                let e = this.ch == null || this.ch.containsKey(a[c].dataLegendKey) || this.ch.containsKey(a[c].parentKey) || this.ch.containsKey(a[c].parentTitle) || this.ch.containsKey(a[c].index.toString()) || this.ch.containsKey(a[c].group) || this.ch.containsKey(d);
                let f = this.cg != null && (this.cg.containsKey(a[c].dataLegendKey) || this.cg.containsKey(a[c].parentKey) || this.cg.containsKey(a[c].parentTitle) || this.cg.containsKey(a[c].index.toString()) || this.cg.containsKey(a[c].group) || this.cg.containsKey(d));
                if (e && !f) {
                    let g = this.cx(a[c]);
                    if (!b.containsKey(g)) {
                        b.addItem(g, new List$1(IDataLegendSeries_$type, 0));
                    }
                    b.item(g).add(a[c]);
                }
            }
            let h = new List$1(Number_$type, 1, b.keys);
            h.y();
            let i = new List$1(IDataLegendSeries_$type, 0);
            for (let j of fromEnum(h)) {
                for (let k of fromEnum(b.item(j))) {
                    i.add(k);
                }
            }
            this.cf = new Dictionary$2(String_$type, DataLegendSeriesGroupInfo.$, 0);
            for (let l of fromEnum(i)) {
                let m = l.group;
                if (!this.cf.containsKey(m)) {
                    this.cf.addItem(m, ((() => {
                        let $ret = new DataLegendSeriesGroupInfo();
                        $ret.f = m;
                        return $ret;
                    })()));
                }
                this.cf.item(m).c.add(l);
            }
        }
        cx(a) {
            if (this.ch == null) {
                return a.index;
            }
            let b = a.dataLegendKey;
            if (this.ch.containsKey(b)) {
                return this.ch.item(b);
            }
            let c = a.index.toString();
            if (this.ch.containsKey(c)) {
                return this.ch.item(c);
            }
            let d = a.title == null ? null : a.title.toString();
            if (this.ch.containsKey(d)) {
                return this.ch.item(d);
            }
            return a.index;
        }
        f0() {
            this.by = false;
            if (!this.a7.z) {
                return;
            }
            let a = new Size(1, 0, 0);
            if (this.ao != null) {
                a = new Size(1, this.ao.d, this.ao.c);
            }
            this.gt();
            let b = new Size(1, 0, 0);
            if (this.ao != null) {
                b = new Size(1, this.ao.d, this.ao.c);
            }
            if (!a.equals(b)) {
                this.a7.aq(b.width, b.height);
            }
            this.gh(this.bz);
        }
        f6(message_) {
        }
        gh(a) {
            let b = new DataLegendRenderContext();
            for (let c = 0; c < this.ao.b.count; c++) {
                let d = this.ao.b._inner[c];
                this.gj(d, b);
            }
            this.a7.r.count = b.b;
            this.a7.s.count = b.c;
            this.a7.u.count = b.e;
            this.a7.t.count = b.d;
            this.a7.q.count = b.a;
            if (!a) {
                this.a7.au(this.ao);
            }
        }
        gj(a, b) {
            if (a.x.width > 0 && a.x.height > 0 && !a.b && !a.e && !a.a && a.l) {
                let c = this.a7.r.item(b.b);
                b.b += 1;
                this.gi(c, a, b);
            }
            this.a7.bd();
            if (!a.w.isEmpty && a.w.width > 0 && a.w.height > 0) {
                let d = this.a7.s.item(b.c);
                b.c += 1;
                this.gk(d, a.r, a.u, a.k, a.w);
            }
            for (let e of fromEnum(a.m)) {
                if (!e.ag.isEmpty && e.s()) {
                    let f = this.a7.u.item(b.e);
                    b.e += 1;
                    this.gk(f, e.z, e.ad, e.k, e.ag);
                }
                if (!e.af.isEmpty && e.q() && e.o) {
                    let g = this.a7.t.item(b.d);
                    b.d += 1;
                    this.gk(g, e.w, e.ac, e.j, e.af);
                }
                if (!e.ae.isEmpty && e.n() && e.l) {
                    let h = this.a7.q.item(b.a);
                    b.a += 1;
                    this.gk(h, e.v, e.ab, e.i, e.ae);
                }
            }
            this.a7.ar();
        }
        gk(a, b, c, d, e) {
            a.al = b;
            this.a7.bc(a, e.left, e.top);
            this.a7.as(a, d);
            this.a7.at(a, d);
            a.ao = c;
        }
        gi(a, b, c) {
            a.ah = b.t;
            a.content = b.n;
            a.width = b.x.width;
            a.height = b.x.height;
            if (!b.v.isEmpty && !isInfinity(b.v.top) && !isInfinity(b.v.left)) {
                this.a7.bc(a, b.v.left, b.v.top);
            }
        }
        b2(a, b) {
            if (b == null) {
                return false;
            }
            return a.containsKey(b);
        }
        f5(a) {
            a.a.clear();
            a.b.clear();
            a.d = 0;
            for (let b = 0; b < a.c.count; b++) {
                let c = a.c._inner[b];
                let d = b;
                let e = c.getDataLegendResolvedWorldPositionX(this.cq);
                let f = c.getDataLegendResolvedWorldPositionY(this.cr);
                let g = typeCast(DataLegendSeriesContext.$, c.getDataLegendSeriesContextAt(e, f));
                if (g != null) {
                    let h = new List$1(DataLegendSeriesValueInfo.$, 0);
                    for (let i = 0; i < g.e.count; i++) {
                        let j = g.e._inner[i];
                        let k = this.ce == null || this.b2(this.ce, j.r) || this.b2(this.ce, j.q) || this.b2(this.ce, j.s) || this.b2(this.ce, "ALL");
                        let l = this.cd != null && (this.b2(this.cd, j.r) || this.b2(this.cd, j.q) || this.b2(this.cd, j.s) || this.b2(this.cd, "ALL"));
                        let m = this.ce == null && this.cd == null && j.k;
                        if (k && (!l && !m)) {
                            j.o = h.count;
                            h.add(j);
                            if (!a.a.containsKey(j.o)) {
                                a.a.addItem(j.o, new DataLegendColumn());
                            }
                            a.a.item(j.o).i = j.o;
                            a.a.item(j.o).d.q(d, j.t);
                            a.a.item(j.o).b.q(d, j.s);
                            a.a.item(j.o).e.q(d, j.l);
                            a.a.item(j.o).c.q(d, j);
                            a.a.item(j.o).h.add(d);
                        }
                    }
                    g.e = h;
                    a.b.add(g);
                    a.d = Math.max(a.d, g.e.count);
                }
            }
            for (let n of fromEnum(a.a.values)) {
                n.f.clear();
                n.a.clear();
                let o = n.e.p(n.h);
                let p = this.cj(o);
                for (let q = 0; q < p.count; q++) {
                    let r = p._inner[q];
                    let s = n.h._inner[q];
                    n.a.q(s, r);
                    let t = n.c.item(s);
                    let u = this.ec(r, t);
                    n.f.q(s, u);
                    let v = !stringIsNullOrEmpty(r.l);
                    if (v) {
                        n.g = true;
                    }
                }
            }
        }
        f4(a) {
            if (this.cf.count >= 1 && this.b3) {
                this.ft(a.f);
            }
            for (let b = 0; b < a.c.count; b++) {
                this.gs(a.c._inner[b], this.ba);
                this.fu(a, b);
            }
            if (this.as == 0) {
                this.fv(a);
            }
        }
        b8() {
            let a = false;
            for (let b = 0; b < this.ao.b.count; b++) {
                let c = this.ao.b._inner[b];
                if (c.d && c.l && c.j != 7) {
                    a = true;
                    break;
                }
            }
            return a;
        }
        fx(a) {
            let b = 0;
            let c = 0;
            for (let d = 0; d < a.b.count; d++) {
                let e = a.b._inner[d];
                this.f7(e);
            }
            let f = 0;
            let g = new Size(1, 0, 0);
            let h = new Size(1, 0, 0);
            let i = new Dictionary$2(Number_$type, Size.$, 0);
            let j = new Dictionary$2(Number_$type, Size.$, 0);
            let k = new Dictionary$2(Number_$type, Size.$, 0);
            for (let l of fromEnum(a.b)) {
                for (let m = 0; m < l.m.count; m++) {
                    let n = l.m._inner[m];
                    if (!i.containsKey(m)) {
                        i.addItem(m, new Size(1, 0, 0));
                    }
                    i.item(m, this.i3(i.item(m), n.am, n.ap));
                    if (!j.containsKey(m)) {
                        j.addItem(m, new Size(1, 0, 0));
                    }
                    j.item(m, this.i3(j.item(m), n.ak, n.ao));
                    if (!k.containsKey(m)) {
                        k.addItem(m, new Size(1, 0, 0));
                    }
                    k.item(m, this.i3(k.item(m), n.ai, n.an));
                }
            }
            for (let o = 0; o < a.b.count; o++) {
                let p = a.b._inner[o];
                h = this.i2(h, p.x, p.z);
                g = this.i3(g, p.y, p.ab);
                for (let q = 0; q < p.m.count; q++) {
                    p.m._inner[q].al = i.item(q);
                    p.m._inner[q].aj = j.item(q);
                    p.m._inner[q].ah = k.item(q);
                }
                if (p.e) {
                    let r = p.y.width + p.ab.left + p.ab.right;
                    f = Math.max(f, r + p.aa.left);
                }
                else if (p.d) {
                    let s = p.y.width + p.ab.left + p.ab.right;
                    let t = p.x.width + p.z.left + p.z.right;
                    f = Math.max(f, s + p.aa.left + t);
                }
            }
            let u = 0;
            let v = 0;
            for (let w = 0; w < a.b.count; w++) {
                let x = a.b._inner[w];
                let y = this.i0(v, x, f, g, h);
                v = y.height;
                u = Math.max(u, y.width);
            }
            c = v;
            b = u;
            a.d = b;
            a.c = c;
        }
        i2(a, b, c) {
            return new Size(1, Math.max(a.width, b.width + c.left + c.right), Math.max(a.height, b.height + c.top + c.bottom));
        }
        i3(a, b, c) {
            return new Size(1, Math.max(a.width, b.width + c.left + c.right), Math.max(a.height, b.height + c.top + c.bottom));
        }
        i0(a, b, c, d, e) {
            let f = 0;
            let g = 0;
            g = Math.max(b.x.height, g);
            g = Math.max(b.y.height, g);
            for (let h of fromEnum(b.m)) {
                g = Math.max(h.am.height, g);
                if (h.o) {
                    g = Math.max(h.ak.height, g);
                }
                if (h.l) {
                    g = Math.max(h.ai.height, g);
                }
            }
            f += b.aa.left;
            a += b.aa.top;
            if (!b.b && !b.e && !b.a && !b.f && this.b0) {
                f += b.z.left;
                let i = 0;
                if (g > b.x.height) {
                    i = (g - b.x.height) / 2;
                }
                b.v = new Rect(0, f, a + i, b.x.width, b.x.height);
                f += (b.v.width) + b.z.right;
            }
            else {
                b.v = new Rect(0, 0, 0, 0, 0);
            }
            if (!stringIsNullOrEmpty(b.r)) {
                f += b.ab.left;
                let j = 0;
                if (g > b.y.height) {
                    j = (g - b.y.height) / 2;
                }
                b.w = new Rect(0, f, a + j, b.y.width + b.ab.right, b.y.height);
                f = Math.max(c, b.w.right);
            }
            for (let k of fromEnum(b.m)) {
                if ((k.n() && k.l) && k.ah.width > 0) {
                    let l = 0;
                    if (g > k.ai.height) {
                        l = (g - k.ai.height) / 2;
                    }
                    k.ae = new Rect(0, f + k.an.left, a + l, k.ai.width, k.ai.height);
                    f += k.ah.width;
                }
                if (k.s()) {
                    f += k.ap.left;
                    f += (k.al.width - (k.am.width + k.ap.right));
                    let m = 0;
                    if (g > k.am.height) {
                        m = (g - k.am.height) / 2;
                    }
                    k.ag = new Rect(0, f, a + m, k.am.width, k.am.height);
                    f += k.ag.width;
                    f += k.ap.right;
                }
                if ((k.q() && k.o) && k.aj.width > 0) {
                    let n = 0;
                    if (g > k.ak.height) {
                        n = (g - k.ak.height) / 2;
                    }
                    k.af = new Rect(0, f + k.ao.left, a + n, k.ak.width, k.ak.height);
                    f += k.aj.width;
                }
            }
            f += b.aa.right;
            a += g;
            a += b.aa.bottom;
            return new Size(1, f, a);
        }
        f7(a) {
            a.y = a.r == null ? new Size(1, 0, 0) : this.a7.bz(a.r, a.k);
            for (let b of fromEnum(a.m)) {
                b.am = b.z == null ? new Size(1, 0, 0) : this.a7.bz(b.z, b.k);
                b.ak = b.w == null ? new Size(1, 0, 0) : this.a7.bz(b.w, b.j);
                b.ai = b.v == null ? new Size(1, 0, 0) : this.a7.bz(b.v, b.i);
            }
        }
        eb(a, b, c, d, e) {
            if (this.a4 == 2) {
                return null;
            }
            let f = "";
            if (stringIsNullOrEmpty(this.e2)) {
                f = c;
            }
            else {
                f = this.e2;
            }
            if (e) {
                if (stringIsNullOrEmpty(f)) {
                    f = d;
                }
                else {
                    f = d + f;
                }
            }
            let g = a.a.item(b).d;
            let h = a.a.item(b).g;
            if (h && stringIsNullOrEmpty(f)) {
                f = " ";
            }
            else if (g.count > 0 && stringIsNullOrEmpty(f)) {
                f = " ";
            }
            else if (!e) {
                return null;
            }
            return f;
        }
        d9(a, b, c, d) {
            if (this.ar == 2) {
                return null;
            }
            let e = a.d > 1;
            let f = this.ar == 1;
            let g = a.a.item(b).b.count > 0;
            if (g && (e || f)) {
                if (stringIsNullOrEmpty(c)) {
                    return " ";
                }
                else if (d) {
                    return c;
                }
            }
            return null;
        }
        fv(a) {
            if (this.a3 == 5) {
                return;
            }
            if (a.f == "Value Layer") {
                return;
            }
            if (a.c == null || a.c.count <= 1) {
                return;
            }
            let b = new Dictionary$2(Number_$type, DataLegendSummaryColumn.$, 0);
            let c = 0;
            let d = false;
            let e = new List$1(String_$type, 0);
            for (let f of fromEnum(a.b)) {
                c = Math.max(c, f.e.count);
                if (!e.contains(f.h)) {
                    e.add(f.h);
                }
                if (this.a3 == 0) {
                    if (e.count > 1) {
                        return;
                    }
                }
                if (stringContains(f.h, "Geographic") || stringContains(f.h, "Scatter") || stringContains(f.h, "Shape") || stringContains(f.h, "Polar") || stringContains(f.h, "Financial") || stringContains(f.h, "Indicator")) {
                    d = true;
                }
                for (let g = 0; g < f.e.count; g++) {
                    let h = f.e._inner[g];
                    if (!b.containsKey(g)) {
                        b.addItem(g, new DataLegendSummaryColumn());
                    }
                    let i = b.item(g);
                    i.n = h.n;
                    i.m = h.m;
                    i.e = h.e;
                    i.h = h.h;
                    i.f = h.f;
                    i.f = h.g;
                    i.d = h.d;
                    i.z = h.z;
                    i.ak(h.l);
                    i.ai(h.s);
                    i.aj(h.t);
                    if (stringIsNullOrEmpty(i.v)) {
                        i.v = h.v;
                    }
                    if (stringIsNullOrEmpty(i.w)) {
                        i.w = h.w;
                    }
                    if (stringIsNullOrEmpty(i.x)) {
                        i.x = h.x;
                    }
                    if (stringIsNullOrEmpty(i.y)) {
                        i.y = h.y;
                    }
                    if (stringIsNullOrEmpty(i.r)) {
                        i.r = h.r;
                    }
                    if (stringIsNullOrEmpty(i.q)) {
                        i.q = h.q;
                    }
                }
            }
            if (this.a3 == 0) {
                if (d) {
                    return;
                }
                let j = this.cl.count > 1;
                if (j) {
                    return;
                }
                for (let k = 0; k < a.c.count; k++) {
                    let l = a.c._inner[k];
                    if (!l.isSummarizationSupported) {
                        return;
                    }
                }
            }
            let m = this.a8();
            let n = new DataLegendRowInfo(this.a7, true, false, false, -1);
            n.r = this.ej != null ? this.ej : m.title;
            n.u = this.is || n.u;
            n.k = this.bs || n.k;
            n.p = a.f;
            for (let o = 0; o < c; o++) {
                let p = b.item(o);
                let q = m.calculate(p.ac, p.r);
                q = this.a2(q);
                let r = this.an;
                let s = r == 0 || r == 2 || r == 8;
                let t = -1;
                for (let u of fromEnum(a.a.item(o).a.values)) {
                    if (u.b()) {
                        t = Math.max(t, u.h);
                        if (s) {
                            r = u.a;
                        }
                    }
                }
                let v = this.cz >= 0 ? this.cz : t;
                let w = this.cy >= 0 ? this.cy : t;
                let x = this.am(q.c, r, v, w);
                x.i = v;
                x.h = w;
                let y = this.ec(x, p);
                let z = new DataLegendRowCell(this.a7, true, false, false, -1);
                z.u = n.m.count;
                z.v = this.d9(a, z.u, " ", p.b);
                if (!stringIsNullOrEmpty(this.ee)) {
                    z.v = this.ee;
                }
                if (q.e != null) {
                    z.v = q.e;
                }
                z.l = !stringIsNullOrEmpty(z.v);
                z.ab = this.ir || z.ab;
                z.i = this.br || z.i;
                z.z = y;
                z.k = this.bu || z.k;
                z.ad = this.iq(this.iu, z.ad, null);
                z.t = q.c;
                z.h = x.a;
                z.y = p.r;
                z.x = p.q;
                let aa = p.ab.length >= 1 ? p.ab[0] : " ";
                z.w = this.eb(a, z.u, aa, x.l, p.d);
                if (q.f != null) {
                    z.w = q.f;
                }
                z.o = !stringIsNullOrEmpty(z.w);
                z.ac = this.it || z.ac;
                z.j = this.bt || z.j;
                n.m.add(z);
            }
            this.gq(n);
            if (n.c) {
                this.fw(n);
                this.gd(n);
                this.ao.e(n);
            }
        }
        am(a, b, c, d) {
            if (b == 8 || b == 0) {
                b = this.an;
            }
            if (d < 0) {
                d = this.cy;
            }
            if (c < 0) {
                c = this.cz;
            }
            return DataAbbreviator.a(a, b, c, d);
        }
        cv(a, b, c, d) {
            return this.am(a, b, c, d).d;
        }
        dc(a, b, c, d) {
            return this.am(a, b, c, d).l;
        }
        db(a, b, c, d) {
            let e = this.am(a, b, c, d);
            return e.m + e.l;
        }
        cj(a) {
            let b = this.cz;
            let c = this.cy;
            let d = this.an;
            let e = DataAbbreviator.h(a, d, b, c);
            return e;
        }
        ck(a, b) {
            let c = new List$1(Number_$type, 0);
            if (b < 0) {
                return c;
            }
            for (let d = 0; d < a.b.count; d++) {
                let e = a.b._inner[d];
                if (e.e.count > b) {
                    let f = e.e._inner[b].l;
                    if (!isNaN_(f)) {
                        c.add(f);
                    }
                }
            }
            return c;
        }
        fw(a) {
        }
        iq(a, b, c) {
            if (a != null) {
                return a;
            }
            if (this.cc && c != null) {
                return c;
            }
            return b;
        }
        ea(a, b) {
            return stringIsNullOrEmpty(a) ? b : a;
        }
        ec(a, b) {
            let c = a.d;
            if (b == null || isNaN_(c) || isInfinity(c)) {
                return this.fp;
            }
            let d;
            let e = b.d ? a.d : a.g;
            if (this.ak != null) {
                d = this.ak.i(e);
            }
            else {
                let f = this.a5;
                if (f == 0) {
                    f = 1;
                }
                let g = new NumberFormatSpecifier();
                g.useGrouping = this.ca;
                g.locale = this.ea(this.e8, null);
                g.currencyCode = this.fa;
                if (b.d) {
                    g.minimumFractionDigits = a.i;
                    g.maximumFractionDigits = a.h;
                    if (b.n >= 0 && b.n > a.i) {
                        g.minimumFractionDigits = b.n;
                    }
                    else if (this.cz >= 0) {
                        g.minimumFractionDigits = this.cz;
                    }
                    if (b.m >= 0 && b.m > a.h) {
                        g.maximumFractionDigits = b.m;
                    }
                    else if (this.cy >= 0) {
                        g.maximumFractionDigits = this.cy;
                    }
                }
                else {
                    g.minimumFractionDigits = b.n;
                    g.maximumFractionDigits = b.m;
                }
                if (g.minimumFractionDigits > g.maximumFractionDigits) {
                    g.maximumFractionDigits = g.minimumFractionDigits;
                }
                if (f == 2 && b.e) {
                    g.style = "currency";
                }
                if (this.al == null) {
                    this.al = new BindingFormatter();
                }
                this.al.j = "{0}";
                this.al.d = [g];
                d = this.al.i(e);
                if (e > 0) {
                    d = b.x + d;
                }
                else if (e < 0) {
                    d = b.v + d;
                }
                if (e >= 0) {
                    d += b.y;
                }
                else {
                    d += b.w;
                }
            }
            return d;
        }
        fu(a, b) {
            if (this.cb == false) {
                return;
            }
            let c = a.b._inner[b];
            let d = a.c._inner[b];
            let e = d.getDataLegendSeriesTitle();
            let f = c.a();
            let g = new DataLegendRowInfo(this.a7, false, false, false, b);
            g.h = f;
            g.q = e;
            g.p = a.f;
            g.r = e;
            g.u = this.iv || g.u;
            g.k = this.bv || g.k;
            g.j = this.bb(d);
            g.o = d.getDataLegendBadgeShapeAndMarker();
            if (this.as == 0) {
                for (let h = 0; h < c.e.count; h++) {
                    let i = c.e._inner[h];
                    let j = a.a.item(h).a.item(b);
                    let k = a.a.item(h).f.item(b);
                    let l = new DataLegendRowCell(this.a7, false, false, false, b);
                    l.u = g.m.count;
                    l.k = this.bx || l.k;
                    l.z = k;
                    l.ad = this.iq(this.ix, l.ad, i.z);
                    l.y = i.r;
                    l.x = i.q;
                    l.t = i.l;
                    l.h = j.a;
                    l.w = this.eb(a, l.u, i.t, j.l, i.d);
                    l.o = !stringIsNullOrEmpty(l.w);
                    l.ac = this.iw || l.ac;
                    l.j = this.bw || l.j;
                    l.v = this.d9(a, l.u, i.s, i.b);
                    l.l = !stringIsNullOrEmpty(l.v);
                    l.ab = this.ip || l.ab;
                    l.i = this.bq || l.i;
                    g.m.add(l);
                }
                this.fw(g);
                this.gd(g);
                this.gp(g);
                if (g.c) {
                    if (g.l) {
                        this.gs(d, g.j);
                        let m = this.gw(d);
                        let n = this.c1(d);
                        g.t = m;
                        g.n = n;
                    }
                    this.ao.e(g);
                }
            }
            else if (this.as == 1) {
                this.fw(g);
                this.gd(g);
                this.gp(g);
                if (g.c) {
                    if (g.l) {
                        this.gs(d, g.j);
                        let o = this.gw(d);
                        let p = this.c1(d);
                        g.t = o;
                        g.n = p;
                    }
                    this.ao.e(g);
                }
                for (let q = 0; q < c.e.count; q++) {
                    let r = c.e._inner[q];
                    let s = a.a.item(q).a.item(b);
                    let t = a.a.item(q).f.item(b);
                    let u = new DataLegendRowCell(this.a7, false, false, false, b);
                    u.u = g.m.count;
                    u.k = this.bx || u.k;
                    u.z = t;
                    u.ad = this.iq(this.ix, u.ad, r.z);
                    u.y = r.r;
                    u.x = r.q;
                    u.t = r.l;
                    u.h = s.a;
                    u.w = this.eb(a, u.u, r.t, s.l, r.d);
                    u.o = !stringIsNullOrEmpty(u.w);
                    u.ac = this.iw || u.ac;
                    u.j = this.bw || u.j;
                    u.v = this.d9(a, u.u, r.s, r.b);
                    u.l = !stringIsNullOrEmpty(u.v);
                    u.ab = this.ip || u.ab;
                    u.i = this.bq || u.i;
                    let v = new DataLegendRowInfo(this.a7, false, false, false, b);
                    v.h = f;
                    v.p = a.f;
                    v.f = true;
                    v.j = 7;
                    v.m.add(u);
                    this.fw(v);
                    this.gd(v);
                    this.gp(v);
                    if (v.c) {
                        this.ao.e(v);
                    }
                }
            }
        }
        c1(a) {
            if (a.isColoredItemwise) {
                let b = a.getDataLegendBadgeContextAtPosition(this.cq, this.cr);
                if (b == null) {
                    return a.getDataLegendBadgeContext();
                }
            }
            return a.getDataLegendBadgeContext();
        }
        bb(a) {
            if (this.ba != 0) {
                return this.ba;
            }
            return a.legendItemBadgeShape;
        }
        gs(a, b) {
            if (b == 0) {
                return;
            }
            if (a.legendItemBadgeShape != b) {
                a.legendItemBadgeShape = b;
            }
        }
        b4() {
            return !isNaN_(this.cq) && !isNaN_(this.cr);
        }
        gw(a) {
            return a.getDataLegendBadge();
        }
        fr(a, b) {
            if (this.b5 == false) {
                return;
            }
            let c = this.d8(a);
            if (c == null) {
                c = this.c2;
            }
            else {
                this.c2 = c;
            }
            if (stringIsNullOrEmpty(c)) {
                return;
            }
            let d = new DataLegendRowInfo(this.a7, false, true, false, -1);
            d.r = c;
            d.u = this.io || d.u;
            d.k = this.bp || d.k;
            d.p = b;
            this.fw(d);
            this.gd(d);
            this.go(d);
            if (d.c) {
                this.ao.e(d);
            }
        }
        ft(a) {
            if (stringIsNullOrEmpty(a)) {
                return;
            }
            let b = new DataLegendRowInfo(this.a7, false, false, true, -1);
            b.r = a;
            b.u = this.im || b.u;
            b.k = this.bo || b.k;
            b.p = a;
            this.fw(b);
            this.gd(b);
            this.gn(b);
            if (b.c) {
                this.ao.e(b);
            }
        }
        je(a) {
            let b = new Thickness(0, 0);
            if (a.top >= 0) {
                b.top = a.top;
            }
            if (a.bottom >= 0) {
                b.bottom = a.bottom;
            }
            if (a.left >= 0) {
                b.left = a.left;
            }
            if (a.right >= 0) {
                b.right = a.right;
            }
            return b;
        }
        gd(a) {
            if (a.d) {
                a.ab = this.je(this.jc);
                a.aa = this.je(this.jf);
            }
            else if (a.b) {
                a.ab = this.je(this.i8);
                a.aa = this.je(this.i7);
            }
            else if (a.a) {
                a.ab = this.je(this.i6);
                a.aa = this.je(this.i5);
            }
            else {
                a.ab = this.je(this.jb);
                a.aa = this.je(this.ja);
            }
            for (let b of fromEnum(a.m)) {
                b.ap = this.je(this.jg);
                b.ao = this.je(this.jd);
                if (this.as == 1 && !this.b7) {
                    b.an = this.je(new Thickness(1, 0, 0, 20, 0));
                }
                else {
                    b.an = this.je(this.i9);
                }
            }
            if (a.d) {
                a.z = this.je(this.i4);
                a.x = new Size(1, 20, 15);
            }
        }
        d8(a) {
            if (this.ds != null) {
                return this.ds;
            }
            let b = true;
            let c = null;
            for (let d = 0; d < a.length; d++) {
                let e = a[d];
                let f = this.d6(e);
                if (f == null) {
                    continue;
                }
                if (c == null) {
                    c = f;
                }
                else {
                    if (!Base.equalsStatic(c, f)) {
                        b = false;
                        break;
                    }
                }
            }
            if (b || !stringIsNullOrEmpty(c)) {
                return c;
            }
            return null;
        }
        d6(a) {
            if (this.b4()) {
                let b = a.getDataLegendAxisLabelFromCursorPosition(this.cq, this.cr);
                if (typeCast(Date_$type, b) !== null) {
                    let c = b;
                    b = this.d7(c);
                }
                return b == null ? "" : b.toString();
            }
            else {
                return null;
            }
        }
        d7(a) {
            if (this.ai != null) {
                let b = this.ai.i(a);
                return b;
            }
            else {
                let c = new DateTimeFormatSpecifier();
                c.dateStyle = "short";
                c.timeStyle = "full";
                let d = this.ap;
                if (d == 0) {
                    d = 1;
                }
                if (d == 3) {
                    c.dateStyle = "medium";
                }
                if (d == 1) {
                    c.dateStyle = "short";
                }
                if (d == 4) {
                    c.dateStyle = "full";
                }
                if (d == 2) {
                    c.dateStyle = "long";
                }
                if (d == 5) {
                    c.dateStyle = null;
                }
                let e = this.aq;
                if (e == 0) {
                    e = 1;
                }
                if (e == 3) {
                    c.timeStyle = "medium";
                }
                if (e == 1) {
                    c.timeStyle = "short";
                }
                if (e == 4) {
                    c.timeStyle = "full";
                }
                if (e == 2) {
                    c.timeStyle = "long";
                }
                if (e == 5) {
                    c.timeStyle = null;
                }
                c.locale = this.ea(this.di, "en-US");
                if (this.aj == null) {
                    this.aj = new BindingFormatter();
                }
                this.aj.j = "{0}";
                this.aj.d = [c];
                let f = this.aj.i(a);
                return f;
            }
        }
        fy() {
            if (this.ao != null) {
                this.ao.f();
            }
        }
    }
    XamDataLegend.$t = /*@__PURE__*/ markType(XamDataLegend, 'XamDataLegend', Control.$, [INotifyPropertyChanged_$type, IDataLegend_$type, IOnDemandRender_$type]);
    XamDataLegend.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, XamDataLegend, 'gb', ['BadgeMargin:i4:gx', [Thickness.$, /*@__PURE__*/ new Thickness(1, 0, 0, 0, 0)], 'BadgeShape:ba:gy', [LegendItemBadgeShape_$type, /*@__PURE__*/ enumGetBox(LegendItemBadgeShape_$type, 0)], 'ExcludedColumns::gz', [Array_$type, null], 'ExcludedSeries::g0', [Array_$type, null], 'GroupRowMargin:i5:g1', [Thickness.$, /*@__PURE__*/ new Thickness(0, 5)], 'GroupRowVisible:b3:g2', [0, false], 'GroupTextColor:im:g3', [Brush.$, null], 'GroupTextMargin:i6:g4', [Thickness.$, /*@__PURE__*/ new Thickness(1, 2, 0, 0, 0)], 'HeaderFormatCulture:di:g5', [2, /*@__PURE__*/ stringEmpty()], 'HeaderFormatDate:ap:g6', [DataLegendHeaderDateMode_$type, /*@__PURE__*/ enumGetBox(DataLegendHeaderDateMode_$type, 0)], 'HeaderFormatSpecifiers:ag:g7', [Array_$type, null], 'HeaderFormatString:dm:g8', [2, null], 'HeaderFormatTime:aq:g9', [DataLegendHeaderTimeMode_$type, /*@__PURE__*/ enumGetBox(DataLegendHeaderTimeMode_$type, 0)], 'HeaderRowMargin:i7:ha', [Thickness.$, /*@__PURE__*/ new Thickness(0, 5)], 'HeaderRowVisible:b5:hb', [0, true], 'HeaderTextColor:io:hc', [Brush.$, null], 'HeaderTextMargin:i8:hd', [Thickness.$, /*@__PURE__*/ new Thickness(1, 2, 0, 0, 0)], 'HeaderText:ds:he', [2, null], 'IncludedColumns::hf', [Array_$type, null], 'IncludedSeries::hg', [Array_$type, null], 'IsEmbeddedInDataTooltip::hh', [0, false], 'LabelDisplayMode:ar:hi', [DataLegendLabelMode_$type, /*@__PURE__*/ enumGetBox(DataLegendLabelMode_$type, 0)], 'LabelTextColor:ip:hj', [Brush.$, null], 'LabelTextMargin:i9:hk', [Thickness.$, /*@__PURE__*/ new Thickness(1, 12, 0, 0, 0)], 'LayoutMode:as:hl', [DataLegendLayoutMode_$type, /*@__PURE__*/ enumGetBox(DataLegendLayoutMode_$type, 0)], 'ShouldUpdateWhenSeriesDataChanges:b9:hm', [0, true], 'SummaryLabelTextColor:ir:hn', [Brush.$, null], 'SummaryLabelText:ee:ho', [2, null], 'SummaryRowMargin:ja:hp', [Thickness.$, /*@__PURE__*/ new Thickness(0, 5)], 'SummaryTitleTextColor:is:hq', [Brush.$, null], 'SummaryTitleTextMargin:jb:hr', [Thickness.$, /*@__PURE__*/ new Thickness(1, 2, 0, 4, 0)], 'SummaryTitleText:ej:hs', [2, null], 'SummaryType:a3:ht', [DataLegendSummaryType_$type, /*@__PURE__*/ enumGetBox(DataLegendSummaryType_$type, 0)], 'SummaryUnitsTextColor:it:hu', [Brush.$, null], 'SummaryUnitsText:ep:hv', [2, null], 'SummaryValueTextColor:iu:hw', [Brush.$, null], 'TargetCursorPositionX::hx', [1, NaN], 'TargetCursorPositionY::hy', [1, NaN], 'Target::hz', [4, null], 'TitleTextColor:iv:h0', [Brush.$, null], 'TitleTextMargin:jc:h1', [Thickness.$, /*@__PURE__*/ new Thickness(1, 0, 0, 4, 0)], 'UnitsDisplayMode:a4:h2', [DataLegendUnitsMode_$type, /*@__PURE__*/ enumGetBox(DataLegendUnitsMode_$type, 0)], 'UnitsTextColor:iw:h3', [Brush.$, null], 'UnitsTextMargin:jd:h4', [Thickness.$, /*@__PURE__*/ new Thickness(1, 0, 0, 0, 0)], 'UnitsText:e2:h5', [2, null], 'ValueFormatAbbreviation:an:h6', [DataAbbreviationMode_$type, /*@__PURE__*/ enumGetBox(DataAbbreviationMode_$type, 0)], 'ValueFormatCulture:e8:h7', [2, /*@__PURE__*/ stringEmpty()], 'ValueFormatCurrencyCode:fa:h8', [2, null], 'ValueFormatMaxFractions:cy:h9', [1, -1], 'ValueFormatMinFractions:cz:ia', [1, -1], 'ValueFormatMode:a5:ib', [DataLegendValueMode_$type, /*@__PURE__*/ enumGetBox(DataLegendValueMode_$type, 0)], 'ValueFormatSpecifiers:ah:ic', [Array_$type, null], 'ValueFormatString:fg:id', [2, null], 'ValueFormatUseGrouping:ca:ie', [0, true], 'ValueRowMargin:jf:ig', [Thickness.$, /*@__PURE__*/ new Thickness(0, 5)], 'ValueRowVisible:cb:ih', [0, true], 'ValueTextColor:ix:ii', [Brush.$, null], 'ValueTextMargin:jg:ij', [Thickness.$, /*@__PURE__*/ new Thickness(1, 2, 0, 2, 0)], 'ValueTextUseSeriesColors:cc:ik', [0, false], 'ValueTextWhenMissingData:fp:il', [2, "N/A"]]);
    return XamDataLegend;
})();
/**
 * @hidden
 */
export let DataLegendView = /*@__PURE__*/ (() => {
    class DataLegendView extends Base {
        constructor(a) {
            super();
            this.ad = null;
            this.af = null;
            this.ah = null;
            this.ag = null;
            this.ae = null;
            this.q = null;
            this.s = null;
            this.u = null;
            this.t = null;
            this.r = null;
            this.a = null;
            this.am = null;
            this.al = null;
            this.v = null;
            this.b = null;
            this.ai = 1;
            this.y = false;
            this.ao = -1;
            this.an = -1;
            this.ab = new Dictionary$2(FontInfo.$, Tuple$2.$.specialize(Number_$type, FontInfo.$), 0);
            this.x = false;
            this.ac = new List$1(FrameworkElement.$, 0);
            this.aj = 0;
            this.g = null;
            this.i = null;
            this.h = null;
            this.e = null;
            this.f = null;
            this.d = null;
            this.c = null;
            this.w = null;
            this.a = a;
            this.s = ((() => {
                let $ret = new Pool$1(TextBlock.$);
                $ret.create = runOn(this, this.bp);
                $ret.activate = runOn(this, this.be);
                $ret.disactivate = runOn(this, this.bg);
                $ret.destroy = runOn(this, this.bf);
                return $ret;
            })());
            this.u = ((() => {
                let $ret = new Pool$1(TextBlock.$);
                $ret.create = runOn(this, this.br);
                $ret.activate = runOn(this, this.bk);
                $ret.disactivate = runOn(this, this.bm);
                $ret.destroy = runOn(this, this.bl);
                return $ret;
            })());
            this.t = ((() => {
                let $ret = new Pool$1(TextBlock.$);
                $ret.create = runOn(this, this.bq);
                $ret.activate = runOn(this, this.bh);
                $ret.disactivate = runOn(this, this.bj);
                $ret.destroy = runOn(this, this.bi);
                return $ret;
            })());
            this.r = ((() => {
                let $ret = new Pool$1(ContentControl.$);
                $ret.create = runOn(this, this.bn);
                $ret.activate = runOn(this, this.a2);
                $ret.disactivate = runOn(this, this.a4);
                $ret.destroy = runOn(this, this.a3);
                return $ret;
            })());
            this.q = ((() => {
                let $ret = new Pool$1(TextBlock.$);
                $ret.create = runOn(this, this.bo);
                $ret.activate = runOn(this, this.az);
                $ret.disactivate = runOn(this, this.a1);
                $ret.destroy = runOn(this, this.a0);
                return $ret;
            })());
            this.ad = new List$1(TextBlock.$, 0);
            this.af = new List$1(TextBlock.$, 0);
            this.ah = new List$1(TextBlock.$, 0);
            this.ag = new List$1(TextBlock.$, 0);
            this.ae = new List$1(ContentControl.$, 0);
        }
        av() {
            this.a.f0();
        }
        bp() {
            let a = new TextBlock();
            this.af.add(a);
            return a;
        }
        be(a) {
            a._visibility = 0;
        }
        bg(a) {
            a._visibility = 1;
        }
        bf(a) {
            this.af.remove(a);
        }
        br() {
            let a = new TextBlock();
            this.ah.add(a);
            return a;
        }
        bk(a) {
            a._visibility = 0;
        }
        bm(a) {
            a._visibility = 1;
        }
        bl(a) {
            this.ah.remove(a);
        }
        bq() {
            let a = new TextBlock();
            this.ag.add(a);
            return a;
        }
        bh(a) {
            a._visibility = 0;
        }
        bj(a) {
            a._visibility = 1;
        }
        bi(a) {
            this.ag.remove(a);
        }
        bo() {
            let a = new TextBlock();
            this.ad.add(a);
            return a;
        }
        az(a) {
            a._visibility = 0;
        }
        a1(a) {
            a._visibility = 1;
        }
        a0(a) {
            this.ad.remove(a);
        }
        bn() {
            let a = new ContentControl();
            this.ae.add(a);
            return a;
        }
        a2(a) {
            a._visibility = 0;
        }
        a4(a) {
            a._visibility = 1;
        }
        a3(a) {
        }
        ay() {
            let a = this.a.pixelScalingRatio;
            let b = this.a.cs;
            if (!isNaN_(a) && a != 0) {
                return;
            }
            if (window.devicePixelRatio != undefined && window.devicePixelRatio != b) {
                this.a.cs = window.devicePixelRatio;
            }
        }
        a7() {
            this.ay();
            let a = Math.round(this.al.rootWrapper.width());
            let b = Math.round(this.al.rootWrapper.height());
            this.a.iz = new Rect(0, 0, 0, a, b);
            if (this.b != null) {
                this.b.bl = this.a.iz;
            }
            this.a.gg();
        }
        ap() {
            if (this.b != null) {
                this.b.ao = null;
                this.b.av();
                this.b = null;
            }
        }
        get z() {
            return this.al != null;
        }
        a6(a, b) {
            if (a == null) {
                this.am = null;
                this.al = null;
                this.v = null;
                this.ap();
                return;
            }
            this.ai = (isNaN_(this.a.pixelScalingRatio) ? this.a.cs : this.a.pixelScalingRatio);
            let c = a;
            this.al = c;
            let d = this.ai;
            let e = Math.round(c.rootWrapper.width());
            let f = Math.round(c.rootWrapper.height());
            let g = e * d;
            let h = f * d;
            this.al.rootWrapper.setStyleProperty("position", "relative");
            let i = this.al.createElement("canvas");
            i.setStyleProperty("position", "absolute");
            this.al.append(i);
            this.ao = truncate(Math.round(g));
            this.an = truncate(Math.round(h));
            i.setAttribute("width", g.toString());
            i.setAttribute("height", h.toString());
            i.setStyleProperty("width", e.toString() + "px");
            i.setStyleProperty("height", f.toString() + "px");
            this.a.iz = new Rect(0, 0, 0, e, f);
            this.am = i;
            let j = this.al.get2DCanvasContext(this.am);
            this.v = new RenderingContext(new CanvasViewRenderer(), j);
            this.ap();
            if (TypeRegistrar.isRegistered("CanvasGestureDOMEventProxy")) {
                this.b = typeCast(EventProxy.$, TypeRegistrar.create("CanvasGestureDOMEventProxy", this.al.rootWrapper, this.al, false));
            }
            if (this.b != null) {
            }
        }
        ax(a, b) {
            this.a7();
        }
        aw(a) {
        }
        ba() {
            let a = this.a.iz.width;
            let b = this.a.iz.height;
            let c = Math.round(a * this.ai);
            let d = Math.round(b * this.ai);
            if (this.ao != c || this.an != d) {
                this.am.setAttribute("width", c.toString());
                this.am.setAttribute("height", d.toString());
                this.am.setStyleProperty("width", a.toString() + "px");
                this.am.setStyleProperty("height", b.toString() + "px");
                this.ao = truncate(Math.round(c));
                this.an = truncate(Math.round(d));
            }
            this.bb(this.v, this.ai);
        }
        bb(a, b) {
            if (this.v == null) {
                this.y = true;
                this.v = a;
            }
            if (a.d && b != 1) {
                a.aa();
                a.ab(b, b);
            }
            if (a == this.v) {
                if (!a.e) {
                    a.l(this.a.iz.left, this.a.iz.top, this.a.iz.width, this.a.iz.height);
                }
            }
            let c = new DataTemplatePassInfo();
            c.passID = "LegendItem";
            for (let d = 0; d < this.ae.count; d++) {
                let e = this.ae._inner[d];
                if (e == null) {
                    continue;
                }
                let f = e.ah;
                if (f == null) {
                    continue;
                }
                let g = new DataTemplateMeasureInfo();
                g.passInfo = c;
                g.context = this.v.h();
                g.width = e.width;
                g.height = e.height;
                g.data = e.content;
                g.renderContext = a;
                f.measure(g);
                let h = new DataTemplateRenderInfo();
                h.availableWidth = e.width;
                h.availableHeight = e.height;
                h.passInfo = c;
                h.context = a.h();
                h.renderContext = a;
                h.data = e.content;
                h.xPosition = e.n;
                h.yPosition = e.o;
                a.aa();
                a.ag(e.n, e.o);
                f.render(h);
                a.z();
            }
            for (let i = 0; i < this.af.count; i++) {
                let j = this.af._inner[i];
                a.ad(j.dataContext);
                a.x(j);
            }
            for (let k = 0; k < this.ad.count; k++) {
                let l = this.ad._inner[k];
                a.ad(l.dataContext);
                a.x(l);
            }
            for (let m = 0; m < this.ah.count; m++) {
                let n = this.ah._inner[m];
                a.ad(n.dataContext);
                a.x(n);
            }
            for (let o = 0; o < this.ag.count; o++) {
                let p = this.ag._inner[o];
                a.ad(p.dataContext);
                a.x(p);
            }
            if (a.d && b != 1) {
                a.z();
            }
        }
        aa() {
            if (this.al != null) {
                this.al.setTimeout(runOn(this.a, this.a.f0), 0);
                return true;
            }
            return false;
        }
        bz(a, b) {
            this.v.ad(b);
            let c = new TextBlock();
            c.al = a;
            let d = this.v.ah(c, this.ak(b), true);
            return new Size(1, d.c, d.b);
        }
        ak(a) {
            if (this.ab.containsKey(a)) {
                let b = this.ab.item(a);
                if (b.d.j == a.j) {
                    return b.c;
                }
            }
            let c = FontUtil.getCurrentFontHeight(this.al, a);
            let d = new Tuple$2(Number_$type, FontInfo.$, c, a);
            this.ab.item(a, d);
            return c;
        }
        bc(a, b, c) {
            if (this.x) {
                this.ac.add(a);
            }
            a.n = b;
            a.o = c;
        }
        au(a) {
            this.ba();
        }
        as(a, b) {
            a.dataContext = b;
        }
        by() {
            return FontDefaults.dataLegendFontBrush;
        }
        bw() {
            return FontDefaults.dataLegendFontBrush;
        }
        bx() {
            return FontDefaults.dataLegendFontBrush;
        }
        bu() {
            return FontDefaults.dataLegendFontBrush;
        }
        bv() {
            return FontDefaults.dataLegendFontBrush;
        }
        bt() {
            return FontDefaults.dataLegendFontBrush;
        }
        bs() {
            return FontDefaults.dataLegendFontBrush;
        }
        n() {
            if (this.g == null) {
                this.g = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.g;
        }
        p() {
            if (this.i == null) {
                this.i = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.i;
        }
        o() {
            if (this.h == null) {
                this.h = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.h;
        }
        l() {
            if (this.e == null) {
                this.e = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.e;
        }
        m() {
            if (this.f == null) {
                this.f = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.f;
        }
        k() {
            if (this.d == null) {
                this.d = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendHeaderFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.d;
        }
        j() {
            if (this.c == null) {
                this.c = ((() => {
                    let $ret = new FontInfo();
                    $ret.q = FontDefaults.dataLegendFontFamily;
                    $ret.f = FontDefaults.dataLegendFontSize;
                    $ret.t = FontDefaults.dataLegendFontStyle;
                    $ret.v = FontDefaults.dataLegendFontWeight;
                    $ret.r = FontDefaults.dataLegendFontStretch;
                    $ret.u = FontDefaults.dataLegendFontVariant;
                    return $ret;
                })());
            }
            return this.c;
        }
        aq(a, b) {
            let model_ = this.a;
            let ext_ = model_.externalObject;
            if (ext_ != null) {
                let width_ = a;
                let height_ = b;
                this.al.rootWrapper.setStyleProperty("min-height", b + "px");
                this.al.rootWrapper.setStyleProperty("min-width", a + "px");
                this.a.notifySizeChanged();
            }
        }
        a9(a) {
            this.ai = a;
        }
        a5() {
            if (this.b != null) {
                let a = this.al.rootWrapper;
                this.b.at(a, "");
            }
        }
        a8() {
            if (this.b != null) {
                if (this.al == null) {
                    return;
                }
                let a = this.al.rootWrapper;
                this.b.bh(a, "");
            }
        }
        at(a, b) {
            a.ag = true;
            let c = this.v.ah(a, this.ak(b), true);
        }
        bd() {
            this.ac.clear();
            this.x = true;
            this.aj = 0;
        }
        ar() {
            for (let a = 0; a < this.ac.count; a++) {
                this.aj = Math.max(this.aj, this.ac._inner[a].ah);
            }
            if (this.aj > 0) {
                for (let b = 0; b < this.ac.count; b++) {
                    this.ac._inner[b].ah = this.aj;
                }
            }
            this.x = false;
            this.aj = 0;
        }
    }
    DataLegendView.$t = /*@__PURE__*/ markType(DataLegendView, 'DataLegendView');
    return DataLegendView;
})();