/*
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, INotifyPropertyChanged_$type, BaseError, PropertyChangedEventArgs, Delegate_$type, fromEnum, String_$type, runOn, delegateCombine, EnumUtil, typeCast, delegateRemove, enumGetBox, markType, TypeRegistrar, getInstanceType } from "igniteui-react-core/ES2015/type";
import { ArrayExtension } from "igniteui-react-core/ES2015/ArrayExtension";
import { List$1 } from "igniteui-react-core/ES2015/List$1";
import { Brush } from "igniteui-react-core/ES2015/Brush";
import { XamDataChart } from "./XamDataChart";
import { DataSeriesType_$type } from "igniteui-react-core/ES2015/DataSeriesType";
import { MarkerType_$type } from "./MarkerType";
import { Color } from "igniteui-react-core/ES2015/Color";
import { ColorUtil } from "igniteui-react-core/ES2015/ColorUtil";
import { Rect } from "igniteui-react-core/ES2015/Rect";
import { HorizontalAlignment_$type } from "igniteui-react-core/ES2015/HorizontalAlignment";
import { UnknownValuePlotting_$type } from "igniteui-react-core/ES2015/UnknownValuePlotting";
import { TrendLineType_$type } from "igniteui-react-core/ES2015/TrendLineType";
import { ToolTipType_$type } from "./ToolTipType";
import { CrosshairsDisplayMode_$type } from "./CrosshairsDisplayMode";
import { DeviceUtils } from "igniteui-react-core/ES2015/DeviceUtils";
import { Series } from "./Series";
import { DataSeriesAdapter } from "igniteui-react-core/ES2015/DataSeriesAdapter";
import { ObservableCollection$1 } from "igniteui-react-core/ES2015/ObservableCollection$1";
import { ObservableColorCollection } from "igniteui-react-core/ES2015/ObservableColorCollection";
import { BrushCollectionUtil } from "igniteui-react-core/ES2015/BrushCollectionUtil";
import { ChartSeriesEventArgs } from "./ChartSeriesEventArgs";
import { DomainChartSeriesPointerEventArgs } from "./DomainChartSeriesPointerEventArgs";
import { IUnknownValuePlotting_$type } from "igniteui-react-core/ES2015/IUnknownValuePlotting";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { Random } from "igniteui-react-core/ES2015/Random";
import { isNaN_ } from "igniteui-react-core/ES2015/number";
import { stringIsNullOrEmpty, stringEmpty } from "igniteui-react-core/ES2015/string";
/**
 * @hidden
 */
export class DomainChart extends Base {
    constructor() {
        super();
        this.di = null;
        this.dh = null;
        this.bz = null;
        this.cd = NaN;
        this.dg = null;
        this.cm = 0;
        this.cn = 0;
        this.co = 0;
        this.cl = 0;
        this.ch = 0;
        this.cj = 0;
        this.ci = 0;
        this.cg = 0;
        this.hv = null;
        this.hw = null;
        this.cc = NaN;
        this.cp = NaN;
        this.cf = NaN;
        this.cb = NaN;
        this.db = 0;
        this.a0 = null;
        this.c7 = null;
        this.bx = false;
        this.af = null;
        this.dw = null;
        this.dy = null;
        this.ay = null;
        this.b3 = null;
        this.propertyChanged = null;
        this.da = 0;
        this.br = false;
        this.ab = null;
        this.by = null;
        this.seriesAdded = null;
        this.seriesRemoved = null;
        this.seriesPointerEnter = null;
        this.seriesPointerLeave = null;
        this.seriesPointerMove = null;
        this.seriesPointerDown = null;
        this.seriesPointerUp = null;
        this.calloutStyleUpdating = null;
        this.b2 = null;
        this.a3 = null;
        this.a6 = false;
        this.b8 = null;
        this.b = null;
        this.a = null;
        this.e = null;
        this.h = null;
        this.ad = null;
        this.bc = true;
        this.be = true;
        this.bd = false;
        this.h4 = new Rect(0, 0, 0, 1, 1);
        this.dx = null;
        this.dv = null;
        this.hs = 1;
        this.hr = 1;
        this.aw = 0;
        this.ce = 1;
        this.ck = 1;
        this.aj = null;
        this.f = null;
        this.g = null;
        this.c9 = 400;
        this.a5 = false;
        this.i = null;
        this.au = 0;
        this.cq = 1.5;
        this.a4 = true;
        this.dc = 7;
        this.as = 0;
        this.s = 0;
        this.ba = true;
        this.a9 = false;
        this.bb = false;
        this.a8 = false;
        this.a7 = false;
        this.b7 = null;
        this.dt = null;
        this.du = null;
        this.ds = "CalloutLabel";
        this.dr = "CalloutContent";
        this.b2 = new List$1(Delegate_$type, 0);
        this.gh();
        this.f3();
    }
    provideContainer(a) {
        if (a == null) {
            this.dataChart.provideContainer(null);
            return;
        }
        let b = this.di;
        this.di = a;
        if (this.a3 != null && this.di != null && b == null) {
            this.di.setTimeout(this.a3, 0);
            this.a3 = null;
        }
        let c = ((() => {
            let $ret = new XamDataChart();
            $ret.ct = true;
            return $ret;
        })());
        c.provideContainer(a);
        this.dataChart = c;
        this.gi();
    }
    destroy() {
        this.provideContainer(null);
    }
    gi() {
        if (this.dataChart == null) {
            return;
        }
        let a = this.dataChart.bn.i.e();
        this.j = a.a;
        this.n = a.f;
        this.l = a.b;
        this.m = a.c;
        this.o = a.g;
        this.c0 = DeviceUtils.g(1);
        this.gj();
    }
    gj() {
    }
    gf(a) {
        if (a == null) {
            return;
        }
        a.et = this.c4;
        a.er = this.c2;
        a.es = this.c3;
        a.eq = this.c1;
        a.mg = this.h2;
        a.en = this.cx;
        a.ep = this.cz;
        a.eo = this.cy;
        a.em = this.cw;
        a.mf = this.h1;
        if (!isNaN_(this.ct)) {
            a.ek = this.ct;
        }
    }
    gc() {
    }
    gl(a, b) {
        a.ff = this.de;
        a.bu = this.a1;
    }
    g2(a, b, c) {
        switch (a) {
            case "TitleTopMargin":
                if (this.dataChart != null) {
                    this.dataChart.et = this.c4;
                }
                break;
            case "TitleLeftMargin":
                if (this.dataChart != null) {
                    this.dataChart.er = this.c2;
                }
                break;
            case "PixelScalingRatio":
                if (this.dataChart != null) {
                    this.gw((d) => d.ek = this.ct);
                }
                break;
            case "TitleRightMargin":
                if (this.dataChart != null) {
                    this.dataChart.es = this.c3;
                }
                break;
            case "TitleBottomMargin":
                if (this.dataChart != null) {
                    this.dataChart.eq = this.c1;
                }
                break;
            case "TitleTextColor":
                if (this.dataChart != null) {
                    this.dataChart.mg = this.h2;
                }
                break;
            case "SubtitleLeftMargin":
                if (this.dataChart != null) {
                    this.dataChart.en = this.cx;
                }
                break;
            case "SubtitleTopMargin":
                if (this.dataChart != null) {
                    this.dataChart.ep = this.cz;
                }
                break;
            case "SubtitleRightMargin":
                if (this.dataChart != null) {
                    this.dataChart.eo = this.cy;
                }
                break;
            case "SubtitleBottomMargin":
                if (this.dataChart != null) {
                    this.dataChart.em = this.cw;
                }
                break;
            case "SubtitleTextColor":
                if (this.dataChart != null) {
                    this.dataChart.mf = this.h1;
                }
                break;
            case "LeftMargin":
                if (this.dataChart != null) {
                    this.dataChart.ej = this.cs;
                }
                break;
            case "TopMargin":
                if (this.dataChart != null) {
                    this.dataChart.eu = this.c5;
                }
                break;
            case "RightMargin":
                if (this.dataChart != null) {
                    this.dataChart.el = this.cv;
                }
                break;
            case "BottomMargin":
                if (this.dataChart != null) {
                    this.dataChart.ef = this.cr;
                }
                break;
            case "TransitionDuration":
                this.f8((d) => d.ff = this.de);
                break;
            case "TransitionEasingFunction":
                this.f8((d) => d.bu = this.a1);
                break;
        }
    }
    get tooltipTemplate() {
        return ArrayExtension.getModulus$1(Base.$, this.tooltipTemplates, 0);
    }
    set tooltipTemplate(a) {
        this.tooltipTemplates = a == null ? null : new List$1(Base.$, 1, [a]);
    }
    get tooltipTemplates() {
        return this.bz;
    }
    set tooltipTemplates(a) {
        let b = this.tooltipTemplates;
        if (a != b) {
            this.bz = a;
            this.g1("TooltipTemplates", b, this.tooltipTemplates);
        }
    }
    get ct() {
        return this.cd;
    }
    set ct(a) {
        let b = this.cd;
        if (a != b) {
            this.cd = a;
            this.g1("PixelScalingRatio", b, this.ct);
        }
    }
    get toolTip() {
        return this.dg;
    }
    set toolTip(a) {
        let b = this.toolTip;
        if (b != a) {
            this.dg = a;
            this.g1("ToolTip", b, this.toolTip);
        }
    }
    get c2() {
        return this.cm;
    }
    set c2(a) {
        let b = this.c2;
        if (a != b) {
            this.cm = a;
            this.g1("TitleLeftMargin", b, this.c2);
        }
    }
    get c3() {
        return this.cn;
    }
    set c3(a) {
        let b = this.c3;
        if (a != b) {
            this.cn = a;
            this.g1("TitleRightMargin", b, this.c3);
        }
    }
    get c4() {
        return this.co;
    }
    set c4(a) {
        let b = this.c4;
        if (a != b) {
            this.co = a;
            this.g1("TitleTopMargin", b, this.c4);
        }
    }
    get c1() {
        return this.cl;
    }
    set c1(a) {
        let b = this.c1;
        if (a != b) {
            this.cl = a;
            this.g1("TitleBottomMargin", b, this.c1);
        }
    }
    get cx() {
        return this.ch;
    }
    set cx(a) {
        let b = this.cx;
        if (a != b) {
            this.ch = a;
            this.g1("SubtitleLeftMargin", b, this.cx);
        }
    }
    get cz() {
        return this.cj;
    }
    set cz(a) {
        let b = this.cz;
        if (a != b) {
            this.cj = a;
            this.g1("SubtitleTopMargin", b, this.cz);
        }
    }
    get cy() {
        return this.ci;
    }
    set cy(a) {
        let b = this.cy;
        if (a != b) {
            this.ci = a;
            this.g1("SubtitleRightMargin", b, this.cy);
        }
    }
    get cw() {
        return this.cg;
    }
    set cw(a) {
        let b = this.cw;
        if (a != b) {
            this.cg = a;
            this.g1("SubtitleBottomMargin", b, this.cw);
        }
    }
    get h1() {
        return this.hv;
    }
    set h1(a) {
        let b = this.h1;
        if (a != b) {
            this.hv = a;
            this.g1("SubtitleTextColor", b, this.h1);
        }
    }
    get h2() {
        return this.hw;
    }
    set h2(a) {
        let b = this.h2;
        if (a != b) {
            this.hw = a;
            this.g1("TitleTextColor", b, this.h2);
        }
    }
    get_cs() {
        return this.cc;
    }
    set_cs(a) {
        let b = this.cs;
        if (a != b) {
            this.cc = a;
            this.g1("LeftMargin", b, this.cs);
        }
    }
    get cs() {
        return this.get_cs();
    }
    set cs(a) {
        this.set_cs(a);
    }
    get c5() {
        return this.cp;
    }
    set c5(a) {
        let b = this.c5;
        if (a != b) {
            this.cp = a;
            this.g1("TopMargin", b, this.c5);
        }
    }
    get cv() {
        return this.cf;
    }
    set cv(a) {
        let b = this.cv;
        if (a != b) {
            this.cf = a;
            this.g1("RightMargin", b, this.cv);
        }
    }
    get cr() {
        return this.cb;
    }
    set cr(a) {
        let b = this.cr;
        if (a != b) {
            this.cb = a;
            this.g1("BottomMargin", b, this.cr);
        }
    }
    get de() {
        return this.db;
    }
    set de(a) {
        let b = this.de;
        if (a != b) {
            this.db = a;
            this.g1("TransitionDuration", b, this.de);
        }
    }
    get a1() {
        return this.a0;
    }
    set a1(a) {
        let b = this.a1;
        if (a != b) {
            this.a0 = a;
            this.g1("TransitionEasingFunction", b, this.a1);
        }
    }
    gg(a) {
        if (this.dataChart == null) {
            return;
        }
        a.gx = this.fk;
        a.gl = this.e9;
    }
    gm(a, b) {
        this.gn(a, b);
    }
    gd() {
    }
    gn(a, b) {
        if (a == null) {
            return;
        }
        let toolTipTemplate_ = ArrayExtension.getModulus$1(Base.$, this.tooltipTemplates, b);
        if (toolTipTemplate_ == null) {
            a.dc = true;
        }
        else {
            let series_ = a;
            a.dc = false;
            series_.externalObject.tooltipTemplate = toolTipTemplate_;
        }
    }
    hp(a, b, c) {
    }
    dk(a) {
        return a;
        return null;
    }
    c8(a) {
        return null;
    }
    g3(a, b, c) {
        switch (a) {
            case "SubtitleTextStyle":
                if (this.dataChart != null) {
                    this.dataChart.gl = this.e9;
                }
                break;
            case "TitleTextStyle":
                if (this.dataChart != null) {
                    this.dataChart.gx = this.fk;
                }
                break;
            case "TooltipTemplate":
                if (this.bx) {
                    return;
                }
                this.bx = true;
                this.tooltipTemplate = this.dk(this.tooltipTemplate);
                this.bx = false;
                if (this.dataChart != null) {
                    this.dataChart.e8 = this.tooltipTemplate;
                }
                this.toolTip = this.tooltipTemplate;
                break;
            case "ToolTip":
                this.f9((d, e) => this.gn(d, e));
                break;
            case "TooltipTemplates":
                if (this.tooltipTemplates == null) {
                    break;
                }
                this.bx = true;
                this.f9((d, e) => {
                    let f = this.dk(ArrayExtension.getModulus$1(Base.$, this.tooltipTemplates, e));
                    let series_ = d;
                    let templ_ = f;
                    series_.externalObject.tooltipTemplate = templ_;
                });
                this.bx = false;
                break;
        }
    }
    get ag() {
        return this.af;
    }
    set ag(a) {
        let b = this.ag;
        if (a != b) {
            this.af = a;
            this.g1("Widget", b, this.ag);
        }
    }
    get e9() {
        return this.dw;
    }
    set e9(a) {
        let b = this.e9;
        if (a != b) {
            this.dw = a;
            this.g1("SubtitleTextStyle", b, this.e9);
        }
    }
    get fk() {
        return this.dy;
    }
    set fk(a) {
        let b = this.fk;
        if (a != b) {
            this.dy = a;
            this.g1("TitleTextStyle", b, this.fk);
        }
    }
    get dataChart() {
        return this.ay;
    }
    set dataChart(a) {
        let b = this.dataChart;
        if (b != a) {
            this.ay = a;
            this.g1("DataChart", b, this.dataChart);
        }
    }
    gh() {
        this.b3 = new List$1(MarkerType_$type, 0);
        this.v = new DataSeriesAdapter().e;
        if (this.d != null) {
            this.v.includedProperties = this.d;
        }
        if (this.c != null) {
            this.v.excludedProperties = this.c;
        }
        this.v.supportedSeriesTypes = this.b5.toArray();
        this.v.rules.clear();
        for (let a of fromEnum(this.b4)) {
            this.v.rules.add(a);
        }
        let b = new List$1(String_$type, 0);
        for (let c of fromEnum(this.v.rules)) {
            b.add(getInstanceType(c).typeName);
        }
        let d = this.v.dataSeries;
        d.collectionChanged = delegateCombine(d.collectionChanged, runOn(this, this.gz));
    }
    bt(a) {
        return a != 24 && this.b5.contains(a);
    }
    notifyResized() {
        this.gw((a) => a.notifyContainerResized());
    }
    gv() {
        this.gw((a) => {
            for (let b = 0; b < a.series.count; b++) {
                a.series._inner[b].ie();
            }
        });
    }
    f7() {
        if (this.dataChart == null) {
            return;
        }
        if (this.br) {
            this.hj();
        }
        this.dataChart.flush();
    }
    ga() {
        if (this.dataChart == null) {
            return;
        }
        this.dataChart.ho();
    }
    g8(a) {
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
    }
    f8(a) {
        this.f9((b, c) => a(b));
    }
    f9(a) {
        if (this.dataChart == null) {
            return;
        }
        for (let b = 0; b < this.dataChart.series.count; b++) {
            a(this.dataChart.series._inner[b], b);
        }
    }
    gw(a) {
        this.gx(a, true);
    }
    gx(a, b) {
        this.gy(a, b, null);
    }
    gy(a, b, c) {
        if (this.dataChart == null) {
            return;
        }
        a(this.dataChart);
    }
    bu(a) {
        if (!this.bt(a.suggestedSeries)) {
            return false;
        }
        let b = a.data;
        if (b == null) {
            return false;
        }
        return true;
    }
    bp() {
        if (this.dataChart == null) {
            return false;
        }
        return true;
    }
    el(a) {
        let b = "series_" + (this.dataChart.series.count + 1) + "_" + EnumUtil.getName(DataSeriesType_$type, a.suggestedSeries);
        return b;
    }
    em(a, b) {
        if (stringIsNullOrEmpty(a.title)) {
            let c = EnumUtil.getName(DataSeriesType_$type, b);
            return c + (this.dataChart.series.count + 1);
        }
        else {
            return a.title;
        }
    }
    ek() {
        return stringEmpty();
    }
    hj() {
        if (this.dataChart == null) {
            return;
        }
        this.br = false;
        this.hl();
        if (this.itemsSource == null) {
            return;
        }
        let a = new List$1(MarkerType_$type, 0);
        for (let b of fromEnum(this.v.dataSeries)) {
            a.add(this.ah(b.suggestedMarker));
        }
        this.b3 = a;
        let c = 0;
        for (let d of fromEnum(this.v.dataSeries)) {
            if (!this.bu(d)) {
                continue;
            }
            if (d.index < 0) {
                d.index = c;
            }
            this.hh(d);
            this.hi(d);
            c++;
        }
        this.hq();
        this.f9(runOn(this, this.gk));
    }
    ar(seriesType_) {
        return (this.externalObject.createSeries(seriesType_).i);
    }
    al() {
        return this.ar(28);
    }
    an() {
        return this.ar(27);
    }
    ao() {
        return this.ar(29);
    }
    ap() {
        return this.ar(25);
    }
    am() {
        return this.ar(26);
    }
    get ac() {
        if (TypeRegistrar.isRegistered("AnnotationLayerProxy")) {
            return TypeRegistrar.create("AnnotationLayerProxy");
        }
        else {
            throw new BaseError(1, "annoation layer module is not loaded, but is required.");
        }
    }
    get bn() {
        return (TypeRegistrar.isRegistered("AnnotationLayerProxy"));
    }
    bo(a) {
        if (!this.bn) {
            return false;
        }
        return this.ac.matchesType(a);
    }
    hq() {
        let a = this.b1("", true);
        if (a != null) {
            for (let b = 0; b < a.count; b++) {
                this.dataChart.series.add(a._inner[b]);
            }
        }
    }
    b1(a, b) {
        if (!this.bn) {
            return null;
        }
        let c = new List$1(Series.$, 0);
        if (b) {
            if (this.a8) {
                let d = 1;
                if (this.b7 == null) {
                    for (let e of fromEnum(this.dataChart.series)) {
                        let f = this.al();
                        this.ac.setTargetSeries(f, e);
                        this.ac.setCollisionChannel(f, "MainChartCollisionChannel");
                        this.ho(f, e, this.v.dataSeries._inner[d - 1]);
                        f.name = a + getInstanceType(f).typeName + d.toString();
                        c.add(f);
                        d++;
                    }
                    ;
                }
                else {
                    let g = this.al();
                    this.ho(g, null, this.v.dataSeries._inner[d - 1]);
                    g.name = a + getInstanceType(g).typeName + d.toString();
                    c.add(g);
                }
            }
        }
        switch (this.s) {
            case 4:
            case 3:
            case 2:
                {
                    let h = this.an();
                    this.ac.setUseInterpolation(h, !this.ba);
                    this.ac.setHorizontalLineVisibility(h, (this.s == 2 || this.s == 4) ? 0 : 1);
                    this.ac.setVerticalLineVisibility(h, (this.s == 3 || this.s == 4) ? 0 : 1);
                    this.ac.setIsAxisAnnotationEnabled(h, this.a9);
                    c.add(h);
                    break;
                }
            case 1:
            case 0:
                {
                    break;
                }
        }
        if (this.bb) {
            let i = this.ao();
            c.add(i);
        }
        if (b) {
            switch (this.as) {
                case 1:
                    {
                        let j = this.ap();
                        c.add(j);
                        break;
                    }
                case 2:
                    {
                        let k = this.am();
                        c.add(k);
                        break;
                    }
                case 3:
                    {
                        this.f8((l) => l.dc = false);
                        break;
                    }
                case 0:
                    {
                        this.f8((l) => l.dc = true);
                        break;
                    }
            }
        }
        for (let l of fromEnum(c)) {
            if (stringIsNullOrEmpty(l.name) == false) {
                continue;
            }
            l.name = a + getInstanceType(l).typeName;
        }
        return c;
    }
    ho(a, b, c) {
        a.itemsSource = this.b7 != null ? this.b7 : b.itemsSource;
        this.ac.setXMemberPath(a, this.dt);
        this.ac.setYMemberPath(a, this.du);
        this.ac.setLabelMemberPath(a, this.ds);
        this.ac.setContentMemberPath(a, this.dr);
    }
    hl() {
        this.hm(this.dataChart);
    }
    hm(a) {
        if (a != null && a == this.dataChart) {
            this.hk();
        }
        if (a == null || a.series.count == 0) {
            return;
        }
        this.f8((b) => {
            if (this.bo(b) && this.ac.isCalloutLayer(b)) {
                this.ac.removeCalloutStyleUpdating(b, runOn(this, this.g7));
            }
            this.hf(b);
        });
        for (let b of fromEnum(a.series)) {
            this.hn(b);
        }
        a.series.clear();
    }
    hn(a) {
        a.itemsSource = null;
        a.legend = null;
        a.hn();
    }
    gz(a, b) {
        if (this.dataChart == null) {
            return;
        }
        let c = b.oldItems == null ? "null" : b.oldItems.count.toString();
        let d = b.newItems == null ? "null" : b.newItems.count.toString();
        if (this.br) {
            return;
        }
        let e = this.g6(runOn(this, this.f5), this.br);
        this.br = e.p1;
    }
    f5() {
        this.di.runInMainZone(runOn(this, this.hj));
    }
    hx(a) {
        return ArrayExtension.getModulus$1(Brush.$, this.j, a);
    }
    h0(a) {
        return ArrayExtension.getModulus$1(Brush.$, this.n, a);
    }
    hy(a) {
        return ArrayExtension.getModulus$1(Brush.$, this.l, a);
    }
    hz(a) {
        return ArrayExtension.getModulus$1(Brush.$, this.m, a);
    }
    h3(a) {
        let b = new Color();
        if (this.j == null || this.j.count == 0) {
            b = ArrayExtension.getModulus$1(Color.$, this.b0, a);
        }
        else {
            let c = ArrayExtension.getModulus$1(Brush.$, this.j, a);
            if (c == null) {
                b = ArrayExtension.getModulus$1(Color.$, this.b0, a);
            }
            else {
                b = ColorUtil.j(c);
            }
        }
        return b;
    }
    a2(a) {
        let b = new ObservableColorCollection();
        b.add(ColorUtil.o(a, 0.5));
        b.add(a);
        return b;
    }
    k(a) {
        let b = this.a2(a);
        let c = BrushCollectionUtil.a(b);
        return c;
    }
    get b0() {
        if (this.by != null) {
            return this.by;
        }
        this.by = new List$1(Color.$, 0);
        this.by.add(ColorUtil.k("#FF7446B9"));
        this.by.add(ColorUtil.k("#FF9FB328"));
        this.by.add(ColorUtil.k("#FFF96232"));
        this.by.add(ColorUtil.k("#FF2E9CA6"));
        this.by.add(ColorUtil.k("#FFDC3F76"));
        this.by.add(ColorUtil.k("#FFFF9800"));
        this.by.add(ColorUtil.k("#FF3F51B5"));
        this.by.add(ColorUtil.k("#FF439C47"));
        this.by.add(ColorUtil.k("#FF795548"));
        this.by.add(ColorUtil.k("#FF494747"));
        return this.by;
    }
    dj() {
        if (this.dataChart == null) {
            return null;
        }
        return this.dataChart.oe();
    }
    go(a, b) {
    }
    gp(a, b, c) {
    }
    ah(a) {
        if (a == 2) {
            return 3;
        }
        else if (a == 12) {
            return 13;
        }
        else if (a == 6) {
            return 7;
        }
        else if (a == 8) {
            return 9;
        }
        else if (a == 11) {
            return 12;
        }
        else if (a == 1) {
            return 1;
        }
        else if (a == 7) {
            return 8;
        }
        else if (a == 10) {
            return 11;
        }
        else if (a == 4) {
            return 5;
        }
        else if (a == 5) {
            return 6;
        }
        else if (a == 9) {
            return 10;
        }
        else if (a == 3) {
            return 4;
        }
        return 2;
    }
    gu(source_, a, b, c) {
        if (this.v != null) {
            this.v.notifySetItem(source_, a, b, c);
        }
        if (this.dataChart != null) {
            this.dataChart.h0(source_, a, b, c);
        }
    }
    gq(source_) {
        if (this.v != null) {
            this.v.notifyClearItems(source_);
        }
        if (this.dataChart != null) {
            this.dataChart.hv(source_);
        }
    }
    gr(source_, a, b) {
        if (this.v != null) {
            this.v.notifyInsertItem(source_, a, b);
        }
        if (this.dataChart != null) {
            this.dataChart.hy(source_, a, b);
        }
    }
    gs(source_, a, b) {
        if (this.v != null) {
            this.v.notifyRemoveItem(source_, a, b);
        }
        if (this.dataChart != null) {
            this.dataChart.hz(source_, a, b);
        }
    }
    g9(a) {
        if (this.seriesAdded != null && a != null) {
            this.seriesAdded(this, new ChartSeriesEventArgs(a));
        }
    }
    hf(a) {
        if (this.seriesRemoved != null && a != null) {
            this.seriesRemoved(this, new ChartSeriesEventArgs(a));
        }
    }
    hb(a, b) {
        if (this.seriesPointerEnter != null && a != null) {
            this.seriesPointerEnter(this, new DomainChartSeriesPointerEventArgs(a, b));
        }
    }
    hc(a, b) {
        if (this.seriesPointerLeave != null && a != null) {
            this.seriesPointerLeave(this, new DomainChartSeriesPointerEventArgs(a, b));
        }
    }
    hd(a, b) {
        if (this.seriesPointerMove != null && a != null) {
            this.seriesPointerMove(this, new DomainChartSeriesPointerEventArgs(a, b));
        }
    }
    ha(a, b) {
        if (this.seriesPointerDown != null && a != null) {
            this.seriesPointerDown(this, new DomainChartSeriesPointerEventArgs(a, b));
        }
    }
    he(a, b) {
        if (this.seriesPointerUp != null && a != null) {
            this.seriesPointerUp(this, new DomainChartSeriesPointerEventArgs(a, b));
        }
    }
    g7(a, b) {
        if (this.calloutStyleUpdating != null && a != null) {
            this.calloutStyleUpdating(this, b);
        }
    }
    g5(a) {
        if (!this.b2.contains(a)) {
            this.b2.add(a);
            let b = false;
            let c = this.g6(() => {
                a();
                this.b2.remove(a);
            }, b);
            b = c.p1;
        }
    }
    g6(a, b) {
        if (!b) {
            b = true;
            if (this.di != null) {
                this.di.setTimeout(a, 0);
            }
            else {
                this.a3 = a;
            }
        }
        return {
            p1: b
        };
    }
    get_bv() {
        return true;
    }
    get bv() {
        return this.get_bv();
    }
    ge(a) {
        let b = a == this.dataChart;
        if (b) {
            a.m9 = this.j;
        }
        if (b) {
            a.nc = this.n;
        }
        a.na = this.l;
        a.nb = this.m;
        a.legend = this.legend;
        a.nr = this.bq;
        a.nt = this.bw && this.bv;
        a.seriesMouseEnter = delegateCombine(a.seriesMouseEnter, (c, d) => this.hb(d.series, d.item));
        a.seriesMouseLeave = delegateCombine(a.seriesMouseLeave, (c, d) => this.hc(d.series, d.item));
        a.seriesMouseMove = delegateCombine(a.seriesMouseMove, (c, d) => this.hd(d.series, d.item));
        a.seriesMouseLeftButtonDown = delegateCombine(a.seriesMouseLeftButtonDown, (c, d) => this.ha(d.series, d.item));
        a.seriesMouseLeftButtonUp = delegateCombine(a.seriesMouseLeftButtonUp, (c, d) => this.he(d.series, d.item));
        if (b) {
            a.m4 = this.h6;
        }
        if (b) {
            a.gq = this.fd;
        }
        a.lz = this.hu;
        if (b) {
            a.ge = this.e2;
        }
        a.ly = this.ht;
        a.nn = this.bf;
        a.cd = this.bg;
        a.ej = this.cs;
        a.el = this.cv;
        a.eu = this.c5;
        a.ef = this.cr;
        if (a == this.dataChart) {
            this.hj();
        }
        this.gf(a);
        this.gg(a);
    }
    gk(a, b) {
        if (!isNaN_(this.cu)) {
            a.er = this.cu;
        }
        a.ev = this.c0;
        if (a.isUsableInLegend) {
            a.legend = this.legend;
        }
        if (typeCast(IUnknownValuePlotting_$type, a) !== null) {
            a.unknownValuePlotting = this.ax;
        }
        a.cu = this.bs;
        if (this.bo(a) && this.ac.isCalloutLayer(a)) {
            this.ac.setCalloutStyleUpdatingEventEnabled(a, this.bi);
            this.ac.addCalloutStyleUpdating(a, runOn(this, this.g7));
        }
        this.f1(a, b);
        this.f2(a, b);
        this.gl(a, b);
        this.gm(a, b);
        this.g9(a);
    }
    get bh() {
        return this.a6;
    }
    f6() {
        if (!this.a6) {
            this.a6 = true;
            this.gb();
        }
    }
    gb() {
        this.gc();
        this.gd();
    }
    hg(a) {
        this.hm(a);
    }
    f2(a, b) {
        let c = typeCast(ITrendLineSeries_$type, a);
        if (c != null) {
            c.trendLineBrush = ArrayExtension.getModulus$1(Brush.$, this.o, b);
            c.trendLineThickness = this.c6;
            c.trendLineType = this.av;
            c.trendLinePeriod = this.df;
        }
    }
    ai(a, b) {
        if (this.ak == null || this.ak.count == 0) {
            if (this.b3 == null || this.b3.count == 0) {
                return a != null && a.cy ? 1 : 2;
            }
            let c = ArrayExtension.getModulus$1(MarkerType_$type, this.b3, b);
            return c == 2 && a != null && a.cy ? 1 : c;
        }
        return ArrayExtension.getModulus$1(MarkerType_$type, this.ak, b);
    }
    g1(a, b, c) {
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
        switch (a) {
            case "DataChart":
                this.hg(typeCast(XamDataChart.$, b));
                this.ge(typeCast(XamDataChart.$, c));
                break;
            case "ItemsSource":
                this.v.itemsSource = this.itemsSource;
                break;
            case "IncludedProperties":
                this.v.includedProperties = this.d;
                break;
            case "ExcludedProperties":
                this.v.excludedProperties = this.c;
                break;
            case "Brushes":
                this.gy((d) => d.m9 = this.j, true, a);
                break;
            case "Outlines":
                this.gy((d) => d.nc = this.n, true, a);
                break;
            case "Legend":
                this.gw((d) => d.legend = this.legend);
                break;
            case "IsHorizontalZoomEnabled":
                this.gw((d) => d.nr = this.bq);
                break;
            case "IsVerticalZoomEnabled":
                this.gw((d) => d.nt = this.bw);
                break;
            case "WindowRect":
                this.gx((d) => d.m4 = this.h6, false);
                break;
            case "Title":
                this.gx((d) => d.gq = this.fd, false);
                break;
            case "Subtitle":
                this.gx((d) => d.ge = this.e2, false);
                break;
            case "TitleAlignment":
                this.gw((d) => d.lz = this.hu);
                break;
            case "SubtitleAlignment":
                this.gw((d) => d.ly = this.ht);
                break;
            case "UnknownValuePlotting":
                this.f8((d) => {
                    if (typeCast(IUnknownValuePlotting_$type, d) !== null) {
                        d.unknownValuePlotting = this.ax;
                    }
                });
                break;
            case "IsSeriesHighlightingEnabled":
                this.f8((d) => d.cu = this.bs);
                break;
            case "Thickness":
                this.f8((d) => d.ev = this.c0);
                break;
            case "Resolution":
                if (!isNaN_(this.cu)) {
                    this.f8((d) => d.er = this.cu);
                }
                break;
            case "TrendLineBrushes":
            case "TrendLineType":
            case "TrendLineThickness":
            case "TrendLinePeriod":
                this.f9((d, e) => this.f2(d, e));
                break;
            case "MarkerMaxCount":
                this.f9((d, e) => this.f1(d, e));
                break;
            case "MarkerTypes":
                let d = typeCast(ObservableCollection$1.$.specialize(MarkerType_$type), b);
                if (d != null) {
                    d.collectionChanged = delegateRemove(d.collectionChanged, runOn(this, this.g0));
                }
                let e = typeCast(ObservableCollection$1.$.specialize(MarkerType_$type), c);
                if (e != null) {
                    e.collectionChanged = delegateCombine(e.collectionChanged, runOn(this, this.g0));
                }
                this.f9((f, g) => this.f1(f, g));
                break;
            case "MarkerBrushes":
                this.gw((f) => f.na = this.l);
                break;
            case "MarkerOutlines":
                this.gw((f) => f.nb = this.m);
                break;
            case "AlignsGridLinesToPixels":
                this.gw((f) => f.nn = this.bf);
                break;
            case "AnimateSeriesWhenAxisRangeChanges":
                this.gw((f) => f.cd = this.bg);
                break;
            case "ToolTipType":
            case "CrosshairsDisplayMode":
            case "CrosshairsSnapToData":
            case "CrosshairsAnnotationEnabled":
            case "FinalValueAnnotationsVisible":
            case "CalloutsVisible":
            case "CalloutsItemsSource":
            case "CalloutsXMemberPath":
            case "CalloutsYMemberPath":
            case "CalloutsLabelMemberPath":
            case "CalloutsContentMemberPath":
                let f = this.g6(runOn(this, this.f5), this.br);
                this.br = f.p1;
                break;
        }
        this.g2(a, b, c);
        this.g3(a, b, c);
    }
    g0(a, b) {
        this.f9((c, d) => this.f1(c, d));
    }
    get itemsSource() {
        return this.b8;
    }
    set itemsSource(a) {
        let b = this.itemsSource;
        if (b != a) {
            this.b8 = a;
            this.g1("ItemsSource", b, this.itemsSource);
        }
    }
    get d() {
        return this.b;
    }
    set d(a) {
        let b = this.b;
        this.b = a;
        if (b != this.b) {
            this.g1("IncludedProperties", b, this.b);
        }
    }
    get c() {
        return this.a;
    }
    set c(a) {
        let b = this.a;
        this.a = a;
        if (b != this.a) {
            this.g1("ExcludedProperties", b, this.a);
        }
    }
    get j() {
        return this.e;
    }
    set j(a) {
        let b = this.j;
        if (a != b) {
            this.e = a;
            this.g1("Brushes", b, this.j);
        }
    }
    get n() {
        return this.h;
    }
    set n(a) {
        let b = this.n;
        if (a != b) {
            this.h = a;
            this.g1("Outlines", b, this.n);
        }
    }
    get legend() {
        return this.ad;
    }
    set legend(a) {
        let b = this.legend;
        if (a != b) {
            this.ad = a;
            this.g1("Legend", b, this.legend);
        }
    }
    get_bq() {
        return this.bc;
    }
    set_bq(a) {
        let b = this.bq;
        if (a != b) {
            this.bc = a;
            this.g1("IsHorizontalZoomEnabled", b, this.bq);
        }
    }
    get bq() {
        return this.get_bq();
    }
    set bq(a) {
        this.set_bq(a);
    }
    get_bw() {
        return this.be;
    }
    set_bw(a) {
        let b = this.bw;
        if (a != b) {
            this.be = a;
            this.g1("IsVerticalZoomEnabled", b, this.bw);
        }
    }
    get bw() {
        return this.get_bw();
    }
    set bw(a) {
        this.set_bw(a);
    }
    get_bs() {
        return this.bd;
    }
    set_bs(a) {
        let b = this.bs;
        if (a != b) {
            this.bd = a;
            this.g1("IsSeriesHighlightingEnabled", b, this.bs);
        }
    }
    get bs() {
        return this.get_bs();
    }
    set bs(a) {
        this.set_bs(a);
    }
    get h6() {
        return this.h4;
    }
    set h6(a) {
        let b = this.h6;
        if (Rect.l_op_Inequality(a, b)) {
            this.h4 = a;
            this.g1("WindowRect", b, this.h6);
        }
    }
    get h5() {
        return this.dataChart != null ? this.dataChart.m3 : Rect.empty;
    }
    get fd() {
        return this.dx;
    }
    set fd(a) {
        let b = this.fd;
        if (a != b) {
            this.dx = a;
            this.g1("Title", b, this.fd);
        }
    }
    get e2() {
        return this.dv;
    }
    set e2(a) {
        let b = this.e2;
        if (a != b) {
            this.dv = a;
            this.g1("Subtitle", b, this.e2);
        }
    }
    get hu() {
        return this.hs;
    }
    set hu(a) {
        let b = this.hu;
        if (b != a) {
            this.hs = a;
            this.g1("TitleAlignment", enumGetBox(HorizontalAlignment_$type, b), enumGetBox(HorizontalAlignment_$type, this.hu));
        }
    }
    get ht() {
        return this.hr;
    }
    set ht(a) {
        let b = this.ht;
        if (b != a) {
            this.hr = a;
            this.g1("SubtitleAlignment", enumGetBox(HorizontalAlignment_$type, b), enumGetBox(HorizontalAlignment_$type, this.ht));
        }
    }
    get ax() {
        return this.aw;
    }
    set ax(a) {
        let b = this.ax;
        if (a != b) {
            this.aw = a;
            this.g1("UnknownValuePlotting", enumGetBox(UnknownValuePlotting_$type, b), enumGetBox(UnknownValuePlotting_$type, this.ax));
        }
    }
    get_cu() {
        return this.ce;
    }
    set_cu(a) {
        let b = this.cu;
        if (a != b) {
            this.ce = a;
            this.g1("Resolution", b, this.cu);
        }
    }
    get cu() {
        return this.get_cu();
    }
    set cu(a) {
        this.set_cu(a);
    }
    get c0() {
        return this.ck;
    }
    set c0(a) {
        let b = this.c0;
        if (a != b) {
            this.ck = a;
            this.g1("Thickness", b, this.c0);
        }
    }
    get ak() {
        return this.aj;
    }
    set ak(a) {
        let b = this.ak;
        if (a != b) {
            this.aj = a;
            this.g1("MarkerTypes", b, this.ak);
        }
    }
    get l() {
        return this.f;
    }
    set l(a) {
        let b = this.l;
        if (a != b) {
            this.f = a;
            this.g1("MarkerBrushes", b, this.l);
        }
    }
    get m() {
        return this.g;
    }
    set m(a) {
        let b = this.m;
        if (!Base.equalsStatic(a, b)) {
            this.g = a;
            this.g1("MarkerOutlines", b, this.m);
        }
    }
    get dd() {
        return this.c9;
    }
    set dd(a) {
        let b = this.c9;
        if (a != b) {
            this.c9 = a;
            this.g1("MarkerMaxCount", b, this.c9);
        }
    }
    get bg() {
        return this.a5;
    }
    set bg(a) {
        let b = this.a5;
        if (a != b) {
            this.a5 = a;
            this.g1("AnimateSeriesWhenAxisRangeChanges", b, this.a5);
        }
    }
    get o() {
        return this.i;
    }
    set o(a) {
        let b = this.o;
        if (a != b) {
            this.i = a;
            this.g1("TrendLineBrushes", b, this.o);
        }
    }
    get av() {
        return this.au;
    }
    set av(a) {
        let b = this.av;
        if (a != b) {
            this.au = a;
            this.g1("TrendLineType", enumGetBox(TrendLineType_$type, b), enumGetBox(TrendLineType_$type, this.av));
        }
    }
    get c6() {
        return this.cq;
    }
    set c6(a) {
        let b = this.c6;
        if (a != b) {
            this.cq = a;
            this.g1("TrendLineThickness", b, this.c6);
        }
    }
    get bf() {
        return this.a4;
    }
    set bf(a) {
        let b = this.bf;
        if (a != b) {
            this.a4 = a;
            this.g1("AlignsGridLinesToPixels", b, this.bf);
        }
    }
    get df() {
        return this.dc;
    }
    set df(a) {
        let b = this.df;
        if (a != b) {
            this.dc = a;
            this.g1("TrendLinePeriod", b, this.df);
        }
    }
    get at() {
        return this.as;
    }
    set at(a) {
        let b = this.at;
        if (a != b) {
            this.as = a;
            this.g1("ToolTipType", enumGetBox(ToolTipType_$type, b), enumGetBox(ToolTipType_$type, this.at));
        }
    }
    get t() {
        return this.s;
    }
    set t(a) {
        let b = this.t;
        if (a != b) {
            this.s = a;
            this.g1("CrosshairsDisplayMode", enumGetBox(CrosshairsDisplayMode_$type, b), enumGetBox(CrosshairsDisplayMode_$type, this.t));
        }
    }
    get bl() {
        return this.ba;
    }
    set bl(a) {
        let b = this.bl;
        if (a != b) {
            this.ba = a;
            this.g1("CrosshairsSnapToData", b, this.bl);
        }
    }
    get bk() {
        return this.a9;
    }
    set bk(a) {
        let b = this.bk;
        if (a != b) {
            this.a9 = a;
            this.g1("CrosshairsAnnotationEnabled", b, this.bk);
        }
    }
    get bm() {
        return this.bb;
    }
    set bm(a) {
        let b = this.bm;
        if (a != b) {
            this.bb = a;
            this.g1("FinalValueAnnotationsVisible", b, this.bm);
        }
    }
    get bj() {
        return this.a8;
    }
    set bj(a) {
        let b = this.bj;
        if (a != b) {
            this.a8 = a;
            this.g1("CalloutsVisible", b, this.bj);
        }
    }
    get bi() {
        return this.a7;
    }
    set bi(a) {
        let b = this.bi;
        if (a != b) {
            this.a7 = a;
            this.g1("CalloutStyleUpdatingEventEnabled", b, this.bi);
        }
    }
    get calloutsItemsSource() {
        return this.b7;
    }
    set calloutsItemsSource(a) {
        let b = this.calloutsItemsSource;
        if (a != b) {
            this.b7 = a;
            this.g1("CalloutsItemsSource", b, this.calloutsItemsSource);
        }
    }
    get ea() {
        return this.dt;
    }
    set ea(a) {
        let b = this.ea;
        if (a != b) {
            this.dt = a;
            this.g1("CalloutsXMemberPath", b, this.ea);
        }
    }
    get ec() {
        return this.du;
    }
    set ec(a) {
        let b = this.ec;
        if (a != b) {
            this.du = a;
            this.g1("CalloutsYMemberPath", b, this.ec);
        }
    }
    get d6() {
        return this.ds;
    }
    set d6(a) {
        let b = this.d6;
        if (a != b) {
            this.ds = a;
            this.g1("CalloutsLabelMemberPath", b, this.d6);
        }
    }
    get d3() {
        return this.dr;
    }
    set d3(a) {
        let b = this.d3;
        if (a != b) {
            this.dr = a;
            this.g1("CalloutsContentMemberPath", b, this.d3);
        }
    }
}
DomainChart.$t = markType(DomainChart, 'DomainChart', Base.$, [INotifyPropertyChanged_$type]);
DomainChart.dq = new Random(0);
