/*
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, Point_$type, typeCast, runOn, delegateCombine, fromEnum, markType, EnumUtil, String_$type, delegateRemove, IEnumerable_$type, enumGetBox, Number_$type, markDep } from "igniteui-angular-core";
import { IOuterLabelWidthDecider_$type } from "./IOuterLabelWidthDecider";
import { IFunnelLabelSizeDecider_$type } from "./IFunnelLabelSizeDecider";
import { ServiceProvider } from "./ServiceProvider";
import { MessageChannel } from "./MessageChannel";
import { MouseLeaveMessage } from "./MouseLeaveMessage";
import { MouseMoveMessage } from "./MouseMoveMessage";
import { MouseButtonMessage } from "./MouseButtonMessage";
import { Rect } from "igniteui-angular-core";
import { RenderingContext } from "igniteui-angular-core";
import { SetAreaSizeMessage } from "./SetAreaSizeMessage";
import { RenderingMessage } from "./RenderingMessage";
import { Polygon } from "igniteui-angular-core";
import { PointCollection } from "igniteui-angular-core";
import { TextBlock } from "igniteui-angular-core";
import { RenderSliceMessage } from "./RenderSliceMessage";
import { List$1 } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { RenderOuterLabelMessage } from "./RenderOuterLabelMessage";
import { SliceInfo } from "./SliceInfo";
import { TooltipValueChangedMessage } from "./TooltipValueChangedMessage";
import { TooltipUpdateMessage } from "./TooltipUpdateMessage";
import { FunnelDataContext } from "./FunnelDataContext";
import { PropertyChangedMessage } from "./PropertyChangedMessage";
import { FontUtil } from "igniteui-angular-core";
import { CanvasViewRenderer } from "igniteui-angular-core";
import { DOMEventProxy } from "igniteui-angular-core";
import { BrushCollection } from "igniteui-angular-core";
import { BrushUtil } from "igniteui-angular-core";
import { MessageHandler } from "./MessageHandler";
import { ClearMessage } from "./ClearMessage";
import { ClearTooltipMessage } from "./ClearTooltipMessage";
import { ContainerSizeChangedMessage } from "./ContainerSizeChangedMessage";
import { ViewportChangedMessage } from "./ViewportChangedMessage";
import { ViewPropertyChangedMessage } from "./ViewPropertyChangedMessage";
import { ObjectColumn } from "./ObjectColumn";
import { Size } from "igniteui-angular-core";
import { Visibility_$type } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
import { stringReplace } from "igniteui-angular-core";
import { SliceInfoList } from "./SliceInfoList";
import { DoubleAnimator } from "igniteui-angular-core";
import { Bezier } from "./Bezier";
import { DoubleColumn } from "./DoubleColumn";
import { OuterLabelAlignment_$type } from "./OuterLabelAlignment";
import { FunnelSliceDisplay_$type } from "./FunnelSliceDisplay";
import { IItemProvider_$type } from "./IItemProvider";
import { SliceSelectionManager } from "./SliceSelectionManager";
import { FunnelFrame } from "./FunnelFrame";
import { Style } from "igniteui-angular-core";
import { IChartLegend_$type } from "igniteui-angular-core";
import { DataTemplate } from "igniteui-angular-core";
import { DataUpdatedMessage } from "./DataUpdatedMessage";
import { UserSelectedItemsChangedMessage } from "./UserSelectedItemsChangedMessage";
import { LabelSizeChangedMessage } from "./LabelSizeChangedMessage";
import { NotifyCollectionChangedEventArgs } from "igniteui-angular-core";
import { FrameRenderCompleteMessage } from "./FrameRenderCompleteMessage";
import { IntColumn } from "./IntColumn";
import { PointList } from "./PointList";
import { Convert } from "igniteui-angular-core";
import { HighlightedValueDisplayMode_$type } from "igniteui-angular-core";
import { ILegendSeries_$type } from "igniteui-angular-core";
import { UIElement } from "igniteui-angular-core";
import { ContentControl } from "igniteui-angular-core";
import { FunnelSliceDataContext } from "./FunnelSliceDataContext";
import { Control } from "igniteui-angular-core";
import { SliceClickedMessage } from "./SliceClickedMessage";
import { SelectedItemsChangedMessage } from "./SelectedItemsChangedMessage";
import { SliceMouseMessage } from "./SliceMouseMessage";
import { ILegendOwner_$type } from "igniteui-angular-core";
import { ILegendTemplateProvider_$type } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { FastItemsSource } from "igniteui-angular-core";
import { FunnelChartSelectedItemsCollection } from "./FunnelChartSelectedItemsCollection";
import { Dictionary$2 } from "igniteui-angular-core";
import { FunnelLegendTemplates } from "./FunnelLegendTemplates";
import { FunnelChartSelectedItemsChangedEventArgs } from "./FunnelChartSelectedItemsChangedEventArgs";
import { DeviceUtils } from "igniteui-angular-core";
import { FunnelSliceClickedEventArgs } from "./FunnelSliceClickedEventArgs";
import { FunnelSliceEventArgs } from "./FunnelSliceEventArgs";
import { FunnelChartVisualData } from "./FunnelChartVisualData";
import { RectData } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
/**
 * @hidden
 */
export let XamFunnelView = /*@__PURE__*/ (() => {
    class XamFunnelView extends Base {
        constructor() {
            super();
            this.g = null;
            this.h = null;
            this.f = null;
            this.bg = null;
            this.ad = null;
            this.ae = null;
            this.ah = null;
            this.ai = null;
            this.ag = null;
            this.af = null;
            this.o = null;
            this.q = null;
            this.r = null;
            this.p = null;
            this.j = null;
            this.be = null;
            this.bf = null;
            this.k = null;
            this.l = null;
            this.x = -1;
            this.y = -1;
            this.z = -1;
            this.u = 0;
            this.v = 0;
            this.aj = null;
            this.c = null;
            this.e = null;
            this.t = 1;
            this.w = NaN;
            this.t = 1;
            this.w = NaN;
            this.f = new MessageChannel();
            this.a9();
            this.a8();
            let a = this.g = new MessageHandler();
            a.b(ClearMessage.$, runOn(this, this.ap));
            a.b(RenderSliceMessage.$, runOn(this, this.a6));
            a.b(RenderOuterLabelMessage.$, runOn(this, this.a5));
            a.b(SetAreaSizeMessage.$, runOn(this, this.ba));
            a.b(TooltipValueChangedMessage.$, runOn(this, this.bc));
            a.b(TooltipUpdateMessage.$, runOn(this, this.bb));
            a.b(ClearTooltipMessage.$, runOn(this, this.ar));
            a.b(PropertyChangedMessage.$, runOn(this, this.a3));
            a.b(ContainerSizeChangedMessage.$, (b) => this.as());
            this.as();
        }
        get i() {
            return this.h;
        }
        set i(a) {
            let b = this.h;
            this.h = a;
            this.a1(b, this.h);
        }
        am(a) {
            this.f.i(new MouseLeaveMessage());
        }
        an(a, b, c) {
            let d = new MouseMoveMessage();
            d.c = a;
            this.f.i(d);
        }
        al(a) {
            let b = new MouseButtonMessage();
            b.h = a;
            b.c = 1;
            b.e = this.j.al ? 1 : 0;
            b.f = this.j.bi;
            this.f.i(b);
        }
        ao(a) {
            let b = new MouseButtonMessage();
            b.h = a;
            b.c = 0;
            b.e = this.j.al ? 1 : 0;
            b.f = this.j.bi;
            this.f.i(b);
        }
        ap(a) {
            let b = this.bg;
            if (Rect.l_op_Equality(b, null)) {
                return;
            }
            let c = b.left, d = b.top, e = b.width, f = b.height;
            this.aq(this.q, c, d, e, f);
            this.aq(this.o, c, d, e, f);
            this.aq(this.p, c, d, e, f);
            this.aq(this.r, c, d, e, f);
        }
        aq(a, b, c, d, e) {
            if (a != null) {
                if (a.d && this.t != 1) {
                    a.aa();
                    a.ab(this.t, this.t);
                }
                a.l(b, c, d, e);
                if (a.d && this.t != 1) {
                    a.z();
                }
            }
        }
        ba(a) {
            let b = a.m;
            let c = a.e;
            if (c == "LeftPanel") {
                this.u = b;
            }
            if (c == "RightPanel") {
                this.v = b;
            }
        }
        a6(a) {
            let b = a.g;
            let c = this.q;
            if (c.d && this.t != 1) {
                c.aa();
                c.ab(this.t, this.t);
            }
            let d = new Polygon();
            let e = new PointCollection(0);
            for (let f = 0; f < b.bd.count; f++) {
                let g = b.bd._inner[f];
                e.add({ $type: Point_$type, x: g.x + this.u + b.a7.x, y: g.y + b.a7.y });
            }
            d.an = e;
            d.ad = a.h;
            d._opacity = b.t;
            d._fill = b.ao;
            d._stroke = a.h < 1 ? b.ao : b.at;
            if (b.bj != null) {
                c.j(d, b.bj);
                b.ao = d._fill;
                b.at = d._stroke;
                b.u = d.ad;
                b.t = d._opacity;
            }
            c.u(d);
            if (b.bm == 0) {
                let h = new Polygon();
                let i = new PointCollection(0);
                for (let j = 0; j < b.bc.count; j++) {
                    let k = b.bc._inner[j];
                    i.add({ $type: Point_$type, x: k.x + this.u + b.a7.x, y: k.y + b.a7.y });
                }
                h.an = i;
                h.ad = a.h;
                h._opacity = b.t;
                h._fill = b.ap;
                h._stroke = a.h < 1 ? b.ap : b.aq;
                if (b.bj != null) {
                    c.j(h, b.bj);
                    b.ao = h._fill;
                    b.at = h._stroke;
                    b.u = h.ad;
                    b.t = h._opacity;
                }
                c.u(h);
            }
            b.u = d.ad;
            if (b.i) {
                let l = new TextBlock();
                if (this.bf == null) {
                    this.bf = new Brush();
                    this.bf._fill = this.ak("ui-funnel-slice", "color", -1);
                }
                l.ao = this.bf;
                c.ae(this.m());
                let m = b.ab.toString();
                let n = c.g(m);
                let o = this.ab();
                l.al = m;
                l.o = b.a4.y + b.a7.y - (o / 2);
                l.n = b.a4.x + this.u + b.a7.x - (n / 2);
                b.bg = new Rect(0, l.n, l.o, n, o);
                b.bn = l._visibility;
                c.x(l);
            }
            if (c.d && this.t != 1) {
                c.z();
            }
        }
        a5(a) {
            let b = 0;
            if (this.v > 0) {
                b = this.bg.width - this.v;
            }
            let c = a;
            let d = this.p;
            if (d.d && this.t != 1) {
                d.aa();
                d.ab(this.t, this.t);
            }
            let e = new TextBlock();
            e.al = c.j.toString();
            d.ae(this.n());
            if (this.be == null) {
                this.be = new Brush();
                this.be._fill = this.ad.rootWrapper.getStyleProperty("color");
            }
            e.ao = this.be;
            let f = this.ac();
            let g = c.l.y - f / 2;
            let h = d.g(e.al);
            e.n = b;
            e.o = g;
            c.f.b.bh = new Rect(0, b, g, h, f);
            d.x(e);
            if (d.d && this.t != 1) {
                d.z();
            }
        }
        az() {
            if (this.j != null) {
                this.j.bh(this.ai, "");
            }
        }
        ax(a) {
            this.av(a);
            if (this.j != null) {
                this.j.at(this.ai, "");
            }
        }
        bc(a) {
            this.aj = a.g;
        }
        bb(a) {
            this.at(a);
        }
        ar(a) {
            this.at(null);
        }
        at(a) {
            let x_ = 0, y_ = 0;
            let t_ = null, v_ = null, i_ = this.ad;
            {
                if (a != null) {
                    t_ = this.aj;
                    x_ = a.i.x + 6;
                    y_ = a.i.y + 6;
                    v_ = a.g.item;
                }
                let ren_ = this.ad;
                let dc_ = null;
                if (a != null) {
                    dc_ = a.g;
                }
                if (dc_ == null) {
                    dc_ = new FunnelDataContext();
                }
                dc_.item = v_;
                let tt_ = this.aj;
                if (tt_ != null) {
                    if (v_ != null) {
                        tt_.updateToolTip(dc_);
                        tt_.setRawPosition(x_, y_);
                    }
                    else {
                        tt_.hideToolTip();
                    }
                }
            }
        }
        a3(a) {
            let b = a;
            let c = b.g;
            switch (c) {
                case "Container":
                    this.ay(b.d);
                    break;
                case "TextStyle":
                    this.l = FontUtil.toFontInfo(this.ad, b.d.toString());
                    break;
                case "OuterLabelTextStyle":
                    this.k = FontUtil.toFontInfo(this.ad, b.d.toString());
                    break;
                case "ActualPixelScalingRatio":
                    if (isNaN_(this.w) || this.w == 0) {
                        this.t = b.d;
                    }
                    break;
                case "OuterLabelTextColor":
                    this.be = typeCast(Brush.$, b.d);
                    break;
                case "LabelTextColor":
                    this.bf = typeCast(Brush.$, b.d);
                    break;
            }
        }
        a4(a) {
            if (this.ad != null) {
                this.ad.setTimeout(a, 0);
            }
            else {
                window.setTimeout(a, 0);
            }
        }
        ay(a) {
            if (a == null) {
                if (this.j != null) {
                    this.j.av();
                }
                this.ad = null;
                this.ae = this.ah = this.ag = this.ai = null;
                this.o = this.q = this.p = this.r = null;
                this.j = null;
                return;
            }
            let b = a;
            let c = this.ad = b;
            c.rootWrapper.setStyleProperty("position", "relative");
            for (let d = 0; d < 4; d++) {
                let e = this.ad.createElement("canvas");
                e.setStyleProperty("position", "absolute");
                c.append(e);
                let f = new RenderingContext(new CanvasViewRenderer(), this.ad.get2DCanvasContext(e));
                if (d == 0) {
                    this.ae = e;
                    this.o = f;
                }
                if (d == 1) {
                    this.ah = e;
                    this.q = f;
                }
                if (d == 2) {
                    this.ag = e;
                    this.p = f;
                }
                if (d == 3) {
                    this.ai = e;
                    this.r = f;
                }
            }
            this.af = this.ad.createElement("span");
            this.af.setStyleProperty("position", "absolute");
            this.af.setStyleProperty("display", "none");
            c.append(this.af);
            this.j = new DOMEventProxy(this.ai, this.ad, false);
            let g = this.j;
            g.onMouseOver = delegateCombine(g.onMouseOver, runOn(this, this.an));
            let h = this.j;
            h.onMouseLeave = delegateCombine(h.onMouseLeave, runOn(this, this.am));
            let i = this.j;
            i.onMouseDown = delegateCombine(i.onMouseDown, runOn(this, this.al));
            let j = this.j;
            j.onMouseUp = delegateCombine(j.onMouseUp, runOn(this, this.ao));
            this.as();
        }
        aa() {
            let a = this.ak("ui-funnel-slice", "border-top-width", -1);
            return (a == null) ? -1 : parseInt(a);
        }
        m() {
            let a = this.l;
            if (a == null) {
                this.l = FontUtil.getFontForClass(this.ad, "ui-funnel-slice");
                a = this.l;
            }
            return a;
        }
        n() {
            let a = this.k;
            if (a == null) {
                this.k = a = FontUtil.getFont(this.ad);
            }
            return a;
        }
        ab() {
            let a = this.z;
            if (a < 0) {
                let b = this.l;
                a = FontUtil.getCurrentFontHeight(this.ad, b);
                this.z = a;
            }
            return a;
        }
        ac() {
            let a = this.y;
            if (a < 0) {
                let b = this.k;
                a = FontUtil.getCurrentFontHeight(this.ad, b);
                this.y = a;
            }
            return a;
        }
        d(a) {
            if (this.c != null) {
                return a ? this.c : this.e;
            }
            let b = BrushUtil.h("chart", this.ad, this.c, this.e);
            this.c = b.p2;
            this.e = b.p3;
            return a ? this.c : this.e;
        }
        ak(a, b, c) {
            let d = this.af;
            if (d == null) {
                return null;
            }
            d.addClass(a);
            let e = d.getStyleProperty(b);
            if (e == null || e.length == 0 || e == "null" || e == "transparent") {
                e = null;
            }
            if (c >= 0) {
                let f = new Brush();
                if (e != null && e.length != stringReplace(e, "(0, 0, 0, 0", "").length) {
                    e = null;
                }
                f._fill = e == null ? XamFunnelView.a[c % XamFunnelView.a.length] : e;
                this.c.item(c, f);
                let g = null;
                if (e != null) {
                    g = d.getStyleProperty("border-top-color");
                    if (g == null || g.length == 0 || g == "null" || g == "transparent") {
                        g = e;
                    }
                }
                f = new Brush();
                f._fill = (g == null) ? XamFunnelView.b[c % XamFunnelView.b.length] : g;
                this.e.item(c, f);
            }
            d.removeClass(a);
            return e;
        }
        a7(a, b, c) {
            let d = new PropertyChangedMessage();
            d.g = a;
            d.e = b;
            d.d = c;
            this.f.i(d);
        }
        av(a) {
            let b = a.b4;
            let c = a.by;
            if (!isNaN_(b) && b != 0) {
                return;
            }
            if (window.devicePixelRatio != undefined && window.devicePixelRatio != c) {
                a.by = window.devicePixelRatio;
            }
        }
        aw(a) {
            this.g.c(a);
        }
        a1(a, b) {
            if (a != null) {
                let c = typeCast(MessageChannel.$, a.b("RenderingMessages"));
                if (c != null) {
                    c.h(runOn(this, this.aw));
                }
                this.f.g();
            }
            if (b != null) {
                let d = typeCast(MessageChannel.$, b.b("RenderingMessages"));
                if (d != null) {
                    d.e(runOn(this, this.aw));
                }
                let e = typeCast(MessageChannel.$, b.b("InteractionMessages"));
                this.f.f(e);
            }
        }
        bd(a, b, c, d, e) {
            a.setAttribute("width", b.toString());
            a.setAttribute("height", c.toString());
            a.setStyleProperty("width", d.toString() + "px");
            a.setStyleProperty("height", e.toString() + "px");
        }
        as() {
            if (this.ad == null) {
                return;
            }
            let a = this.ad.rootWrapper.width();
            let b = this.ad.rootWrapper.height();
            this.bg = new Rect(0, 0, 0, a, b);
            if (this.j != null) {
                this.j.bl = this.bg;
            }
            this.bd(this.ae, a * this.t, b * this.t, a, b);
            this.bd(this.ah, a * this.t, b * this.t, a, b);
            this.bd(this.ag, a * this.t, b * this.t, a, b);
            this.bd(this.ai, a * this.t, b * this.t, a, b);
            let c = new ViewportChangedMessage();
            c.e = a;
            c.d = b;
            this.f.i(c);
        }
        a0() {
            this.as();
        }
        a9() {
            let a = new ViewPropertyChangedMessage();
            a.g = "OuterLabelWidthDecider";
            a.e = null;
            a.d = typeCast(IOuterLabelWidthDecider_$type, this);
            this.f.i(a);
        }
        a8() {
            let a = new ViewPropertyChangedMessage();
            a.g = "FunnelLabelSizeDecider";
            a.e = null;
            a.d = typeCast(IFunnelLabelSizeDecider_$type, this);
            this.f.i(a);
        }
        decideWidth(a) {
            let b = a == null ? null : a.a;
            if (b == null) {
                return 0;
            }
            let c = 0;
            this.p.ae(this.n());
            for (let d of fromEnum(b)) {
                if (d != null) {
                    c = Math.max(this.p.g(d.toString()), c);
                }
            }
            return c;
        }
        decideLabelSize(a, b) {
            let c = 0;
            if (a.b.i) {
                this.p.ae(this.m());
                c = this.p.g(a.b.ab.toString());
            }
            return new Size(1, c, b ? this.ab() : this.ac());
        }
        s(a, f_) {
            if (f_ == null) {
                return true;
            }
            let b = a.a;
            let c_ = this.ad;
            c_ = c_ ? c_.data('igFunnelChart') : null;
            if (b == null || c_ == null) {
                return false;
            }
            let i_ = b.count;
            let c = new Array(i_);
            while (i_-- > 0) {
                let v_ = b.item(i_);
                c[i_] = f_(v_, i_, c_);
            }
            a.b(c);
            return true;
        }
        au() {
        }
        a2() {
        }
    }
    XamFunnelView.$t = markType(XamFunnelView, 'XamFunnelView', Base.$, [IOuterLabelWidthDecider_$type, IFunnelLabelSizeDecider_$type]);
    XamFunnelView.a = ["#7000ff", "#70ff00", "#00f0f0", "#ff0070", "#ff00ff"];
    XamFunnelView.b = ["#7000dd", "#70dd00", "#00d0d0", "#dd0070", "#dd00dd"];
    return XamFunnelView;
})();
/**
 * @hidden
 */
export let XamFunnelController = /*@__PURE__*/ (() => {
    class XamFunnelController extends Base {
        constructor() {
            super();
            this.bs = null;
            this.ag = null;
            this.av = null;
            this.ck = null;
            this.cl = null;
            this.cg = null;
            this.ch = null;
            this.bd = false;
            this.bj = false;
            this.aw = null;
            this.aj = null;
            this.z = null;
            this.am = null;
            this.al = null;
            this.aq = null;
            this.ar = null;
            this.cq = null;
            this.cn = null;
            this.cm = null;
            this.a6 = false;
            this.bz = 0;
            this.by = 0;
            this.w = null;
            this.v = null;
            this.t = null;
            this.p = null;
            this.a2 = false;
            this.a5 = false;
            this.bx = 0;
            this.a4 = false;
            this.bt = 0;
            this.a = null;
            this.b = null;
            this.ad = 0;
            this.m = 0;
            this.az = false;
            this.bw = 0;
            this.a7 = false;
            this.d0 = null;
            this.dz = null;
            this.ay = false;
            this.ca = 0;
            this.cb = 0;
            this.r = null;
            this.ab = null;
            this.ah = null;
            this.g = null;
            this.e = null;
            this.f = null;
            this.d5 = null;
            this.d6 = null;
            this.a9 = false;
            this.a3 = false;
            this.a8 = false;
            this.a1 = false;
            this.ea = 1;
            this.bu = 0.5;
            this.cp = null;
            this.co = null;
            this.bv = -1;
            this.a0 = false;
            this.l = null;
            this.o = null;
            this.du = null;
            this.dt = null;
            this.d4 = null;
            this.ax = new DoubleAnimator(0, 1, 2000);
            let a = this.ax;
            a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.c4));
            this.k = new FunnelFrame();
            this.j = new FunnelFrame();
            this.h = new FunnelFrame();
            this.ai = new SliceSelectionManager();
            this.ao = new DoubleColumn();
            this.an = new DoubleColumn();
            this.at = new ObjectColumn();
            this.au = new ObjectColumn();
            this.y = new MessageChannel();
            this.x = new MessageChannel();
            this.aa = new MessageHandler();
            this.aa.b(PropertyChangedMessage.$, runOn(this, this.dj));
            this.aa.b(DataUpdatedMessage.$, runOn(this, this.c0));
            this.aa.b(ViewportChangedMessage.$, runOn(this, this.dr));
            this.aa.b(ViewPropertyChangedMessage.$, runOn(this, this.ds));
            this.aa.b(MouseMoveMessage.$, runOn(this, this.da));
            this.aa.b(MouseButtonMessage.$, runOn(this, this.c8));
            this.aa.b(MouseLeaveMessage.$, runOn(this, this.c9));
            this.aa.b(UserSelectedItemsChangedMessage.$, runOn(this, this.dq));
            this.aa.b(LabelSizeChangedMessage.$, runOn(this, this.c6));
            this.aa.b(ContainerSizeChangedMessage.$, (b) => this.y.i(b));
            this.bs = (b, c) => {
                this.bm = true;
                this.dk();
            };
        }
        c4(a, b) {
            this.b7 = this.ax.o;
            if (this.b7 == 1) {
                this.bb = false;
                this.c1(this.h);
            }
            if (this.bb) {
                let c = 1 - this.b7;
                FunnelFrame.k(this.j, this.k, this.h, this.b7);
                this.c1(this.j);
            }
        }
        get ax() {
            return this.aw;
        }
        set ax(a) {
            this.aw = a;
        }
        get ak() {
            return this.aj;
        }
        set ak(a) {
            this.aj = a;
        }
        get aa() {
            return this.z;
        }
        set aa(a) {
            this.z = a;
        }
        get ao() {
            return this.am;
        }
        set ao(a) {
            this.am = a;
        }
        get an() {
            return this.al;
        }
        set an(a) {
            this.al = a;
        }
        get at() {
            if (!this.bd && this.av != null) {
                this.bd = this.av.s(this.aq, this.cg);
            }
            return this.aq;
        }
        set at(a) {
            this.aq = a;
        }
        get au() {
            if (!this.bj && this.av != null) {
                this.bj = this.av.s(this.ar, this.ch);
            }
            return this.ar;
        }
        set au(a) {
            this.ar = a;
        }
        get cv() {
            return this.cq;
        }
        set cv(a) {
            this.cq = a;
        }
        get cs() {
            return this.cn;
        }
        set cs(a) {
            this.cn = a;
        }
        get cr() {
            return this.cm;
        }
        set cr(a) {
            this.cm = a;
        }
        get bm() {
            return this.a6;
        }
        set bm(a) {
            this.a6 = a;
        }
        get b9() {
            return this.bz;
        }
        set b9(a) {
            this.bz = a;
        }
        get b8() {
            return this.by;
        }
        set b8(a) {
            this.by = a;
        }
        get y() {
            return this.w;
        }
        set y(a) {
            this.w = a;
        }
        get x() {
            return this.v;
        }
        set x(a) {
            this.v = a;
        }
        get u() {
            return this.t;
        }
        set u(a) {
            this.t = a;
        }
        get q() {
            return this.p;
        }
        set q(a) {
            this.p = a;
        }
        get be() {
            return this.a2;
        }
        set be(a) {
            this.a2 = a;
        }
        get bk() {
            return this.a5;
        }
        set bk(a) {
            this.a5 = a;
        }
        get b7() {
            return this.bx;
        }
        set b7(a) {
            this.bx = a;
        }
        get bg() {
            return this.a4;
        }
        set bg(a) {
            this.a4 = a;
        }
        get b0() {
            return this.bt;
        }
        set b0(a) {
            this.bt = a;
        }
        get c() {
            if ((this.a == null || this.a.count < 1) && this.av != null) {
                this.a = this.av.d(true);
            }
            return this.a;
        }
        set c(a) {
            this.a = a;
        }
        get d() {
            if ((this.b == null || this.b.count < 1) && this.av != null) {
                this.b = this.av.d(false);
            }
            return this.b;
        }
        set d(a) {
            this.b = a;
        }
        get ae() {
            return this.ad;
        }
        set ae(a) {
            this.ad = a;
        }
        get n() {
            return this.m;
        }
        set n(a) {
            this.m = a;
        }
        get bb() {
            return this.az;
        }
        set bb(a) {
            this.az = a;
        }
        get b6() {
            return this.bw;
        }
        set b6(a) {
            this.bw = a;
        }
        get bp() {
            return this.a7;
        }
        set bp(a) {
            this.a7 = a;
        }
        get d3() {
            return this.d0;
        }
        set d3(a) {
            this.d0 = a;
        }
        get d2() {
            return this.dz;
        }
        set d2(a) {
            this.dz = a;
        }
        get ba() {
            return this.ay;
        }
        set ba(a) {
            this.ay = a;
        }
        get ce() {
            return this.ca;
        }
        set ce(a) {
            this.ca = a;
        }
        get cf() {
            return this.cb;
        }
        set cf(a) {
            this.cb = a;
        }
        get s() {
            return this.r;
        }
        set s(a) {
            this.r = a;
        }
        get ac() {
            return this.ab;
        }
        set ac(a) {
            let b = this.ab;
            this.ab = a;
            this.dc(b, this.ab);
        }
        get ai() {
            return this.ah;
        }
        set ai(a) {
            this.ah = a;
        }
        get k() {
            return this.g;
        }
        set k(a) {
            this.g = a;
        }
        get h() {
            return this.e;
        }
        set h(a) {
            this.e = a;
        }
        get j() {
            return this.f;
        }
        set j(a) {
            this.f = a;
        }
        get d8() {
            return this.d5;
        }
        set d8(a) {
            this.d5 = a;
        }
        get d9() {
            return this.d6;
        }
        set d9(a) {
            this.d6 = a;
        }
        get br() {
            return this.a9;
        }
        set br(a) {
            this.a9 = a;
        }
        get bf() {
            return this.a3;
        }
        set bf(a) {
            this.a3 = a;
        }
        get bq() {
            return this.a8;
        }
        set bq(a) {
            this.a8 = a;
        }
        get bc() {
            return this.a1;
        }
        set bc(a) {
            this.a1 = a;
        }
        get eb() {
            return this.ea;
        }
        set eb(a) {
            this.ea = a;
        }
        get b3() {
            return this.bu;
        }
        set b3(a) {
            this.bu = a;
        }
        get cu() {
            return this.cp;
        }
        set cu(a) {
            this.cp = a;
        }
        get ct() {
            return this.co;
        }
        set ct(a) {
            this.co = a;
        }
        get b4() {
            let a = this.bv;
            if (a < 0 && this.av != null) {
                this.bv = this.av.aa();
                a = this.bv;
            }
            return a < 0 ? 1 : a;
        }
        dc(a, b) {
            if (a != null) {
                let c = typeCast(MessageChannel.$, a.b("ConfigurationMessages"));
                if (c != null) {
                    c.h(runOn(this, this.c7));
                }
                c = typeCast(MessageChannel.$, a.b("InteractionMessages"));
                if (c != null) {
                    c.h(runOn(this, this.c7));
                }
                this.y.g();
                this.x.g();
            }
            if (b != null) {
                let d = typeCast(MessageChannel.$, b.b("ConfigurationMessages"));
                if (d != null) {
                    d.e(runOn(this, this.c7));
                }
                d = typeCast(MessageChannel.$, b.b("InteractionMessages"));
                if (d != null) {
                    d.e(runOn(this, this.c7));
                }
                let e = typeCast(MessageChannel.$, b.b("RenderingMessages"));
                this.y.f(e);
                let f = typeCast(MessageChannel.$, b.b("ModelUpdateMessages"));
                this.x.f(f);
            }
            this.bm = true;
        }
        c7(a) {
            this.aa.c(a);
            let b = typeCast(RenderingMessage.$, a);
            if (b != null) {
                this.bm = b.c;
            }
            this.dk();
        }
        bo() {
            return this.b8 >= 0 && this.b9 >= 0;
        }
        bh() {
            return this.ao != null && this.ao.a != null && this.ao.a.count > 0 && (this.an == null || this.an.a == null || (this.an.a.count == 0 || this.an.a.count == this.ao.a.count)) && this.u != null && this.q != null && this.c != null && this.c.count > 0 && this.d != null && this.d.count > 0 && this.bo();
        }
        dk() {
            if (!this.bm) {
                return;
            }
            this.cz();
            if (!this.bh()) {
                return;
            }
            this.bm = false;
            let a = this.u.decideWidth(this.as());
            if (a > this.b9) {
                a = 0;
            }
            if (!this.bk) {
                a = 0;
            }
            let b = this.b9 - a;
            let c = a > 0;
            let d = this.be;
            let e = b >= 0;
            if (e || c) {
                this.dh(e, c, d, b, a);
            }
        }
        cz() {
            if (this.bn() && this.b7 > 0) {
                this.ax.w();
            }
            this.dm("LeftLabels");
            this.dm("RightLabels");
            this.dm("SliceArea");
            this.cy();
            this.h.b.clear();
            this.j.b.clear();
            this.k.b.clear();
        }
        cy() {
            let a = new FrameRenderCompleteMessage();
            this.y.i(a);
        }
        dh(a, b, c, d, e) {
            if (this.bb) {
                let f = this.k;
                this.k = this.j;
                this.j = f;
            }
            else {
                let g = this.k;
                this.k = this.h;
                this.h = g;
            }
            this.di(this.h, a, b, c, d, e);
            this.ax.w();
            this.b7 = 0;
            if (this.bn()) {
                FunnelFrame.k(this.j, this.k, this.h, this.b7);
                this.c1(this.j);
                this.bb = true;
                this.ax.v();
            }
            else {
                this.c1(this.h);
            }
        }
        b5(a) {
            if (isNaN_(a)) {
                return 0;
            }
            return Math.abs(a);
        }
        di(a, b, c, d, e, f) {
            let g = e / 2;
            this.a0 = this.bp;
            if (this.a0) {
                this.c5(e, g);
            }
            else {
                this.ak = null;
            }
            let h = this.n == 1;
            let i = this.ap();
            let j = 0;
            for (let k of fromEnum(i.a)) {
                j += this.b5(this.ao.a.item(k));
            }
            if (j == 0) {
                h = false;
            }
            let l = this.b8 / i.a.count;
            let m = 0;
            let n = 0;
            n = this.b4 / 2;
            a.j = f;
            a.f = d;
            a.h = c;
            a.g = this.ae == 0;
            a.b = new SliceInfoList();
            let o = 0;
            for (let p of fromEnum(i.a)) {
                let q;
                if (h) {
                    q = (this.b5(this.ao.a.item(p)) / j) * this.b8;
                }
                else {
                    q = l;
                }
                let r = this.b2(e, m + n);
                let s = m + q;
                let t = this.b2(e, s - n);
                let u = r / 2;
                let v = t / 2;
                let w = new SliceInfo();
                let x = w.b;
                x.q = m;
                x.p = s;
                let y = new Rect(4);
                let z = new Rect(4);
                let aa = 0;
                if (v > u) {
                    aa = g - v;
                }
                else {
                    aa = g - u;
                }
                let ab = m;
                x.bm = this.eb;
                x.r = this.b3;
                x.ae(this.dx(p), this.dy(p), x.r, this.eb == 0);
                x.bj = this.d7(p);
                x.j = this.ai.c(p);
                if (b) {
                    w.h = true;
                    x.a8 = { $type: Point_$type, x: g - u - aa + n, y: m - ab + n };
                    x.a9 = { $type: Point_$type, x: g + u - aa - n, y: m - ab + n };
                    x.a5 = { $type: Point_$type, x: g - v - aa + n, y: s - ab - n };
                    x.a6 = { $type: Point_$type, x: g + v - aa - n, y: s - ab - n };
                    x.a3 = x.a9;
                    x.a2 = x.a8;
                    if (this.a0) {
                        this.cw(x, m + n, s - n, g, aa - n, ab);
                    }
                }
                if (d) {
                    x.i = true;
                    x.a4 = { $type: Point_$type, x: g - aa, y: (m + s) / 2 - ab };
                    x.ab = this.ci(p);
                    let ac = this.q.decideLabelSize(w, true);
                    if (ac.width > e) {
                        x.i = false;
                    }
                    if (ac.height > q) {
                        x.i = false;
                    }
                    y.height = ac.height;
                    y.width = ac.width;
                    y.x = x.a4.x;
                    y.y = x.a4.y;
                    x.bg = y;
                }
                else {
                    x.i = false;
                    x.ab = this.ci(p);
                }
                if (d || b) {
                    x.a7 = { $type: Point_$type, x: aa, y: ab };
                    x.item = this.ao.a.item(p);
                    x.w = p;
                }
                if (b) {
                    if (this.an != null && this.an.a != null && !isNaN_(this.an.a.item(p))) {
                        x.aa = this.an.a.item(p);
                        x.af();
                        let ad = x.s;
                        let ae = x.a8;
                        let af = x.a5;
                        let ag = x.a6;
                        let ah = (af.x - ae.x) * ad;
                        let ai = af.y - (af.y - ae.y) * ad;
                        x.a2 = { $type: Point_$type, x: af.x - ah, y: ai };
                        x.a3 = { $type: Point_$type, x: ag.x + ah, y: ai };
                        x.ah();
                    }
                    x.ad();
                }
                if (c) {
                    w.g = true;
                    w.n = { $type: Point_$type, x: 0, y: (m + s) / 2 };
                    w.l = this.cj(p);
                    let aj = this.q.decideLabelSize(w, false);
                    if (aj.height > q) {
                        w.g = false;
                    }
                    z.height = aj.height;
                    z.width = aj.width;
                    y.x = w.n.x;
                    y.y = w.n.y;
                    x.bh = z;
                }
                else {
                    w.g = false;
                    w.l = this.cj(p);
                }
                w.j = p;
                a.b.add(w);
                m += q;
                o++;
            }
            if ((this.at != null && this.at.a != null && this.at.a.count > 0) || (this.au != null && this.au.a != null && this.au.a.count > 0)) {
                this.dl(a);
            }
            a.b.ae();
        }
        cw(a, b, c, d, e, f) {
            let g = this.ak.b(b);
            let h = this.ak.b(c);
            let i = new PointList();
            let j = new PointList();
            let k = g.b;
            let l = h.b;
            for (let m = k; m <= l; m++) {
                i.add({ $type: Point_$type, x: this.ak.e._inner[m].c.x - e, y: this.ak.e._inner[m].c.y - f });
            }
            e += this.b4;
            for (let n = l; n >= k; n--) {
                let o = this.ak.e._inner[n].c;
                j.add({ $type: Point_$type, x: d + d - o.x - e, y: o.y - f });
            }
            a.c = i;
            a.e = j;
        }
        bl(a, b) {
            if (a.x != b.x || a.y != b.y) {
                return true;
            }
            return false;
        }
        c5(a, b) {
            let c;
            let d;
            let e = 0, f = this.b8;
            e = this.b4 / 2;
            f -= e;
            if (this.bf) {
                c = { $type: Point_$type, x: b - (a * this.b0 / 2), y: e };
                d = { $type: Point_$type, x: b - (a / 2), y: f };
            }
            else {
                c = { $type: Point_$type, x: b - (a / 2), y: e };
                d = { $type: Point_$type, x: b - (a * this.b0 / 2), y: f };
            }
            let g = this.d3.y < this.d2.y ? this.d3 : this.d2;
            let h = this.d2.y > this.d3.y ? this.d2 : this.d3;
            if (g.y < 0) {
                g.y = 0;
            }
            if (h.y > 1) {
                h.y = 1;
            }
            if (this.bf) {
                let i = h.x;
                h.x = g.x;
                g.x = i;
                i = g.y;
                g.y = 1 - h.y;
                h.y = 1 - i;
            }
            let j = { $type: Point_$type, x: a * g.x, y: this.b8 * g.y };
            let k = { $type: Point_$type, x: a * h.x, y: this.b8 * h.y };
            if (this.ak == null || this.bl(c, this.ak.q) || this.bl(j, this.ak.r) || this.bl(k, this.ak.s) || this.bl(d, this.ak.t)) {
                this.ak = new Bezier(c, j, k, d, 2, b);
            }
            if (this.ak == null) {
                this.a0 = false;
            }
            else {
                this.a0 = this.ak.d;
            }
        }
        cj(a) {
            let b = this.au;
            let c = b == null ? null : b.a;
            return c == null || a >= c.count ? null : c.item(a);
        }
        ci(a) {
            let b = this.at;
            let c = b == null ? null : b.a;
            return c == null || a >= c.count ? null : c.item(a);
        }
        d7(a) {
            if (this.ai.c(a)) {
                return this.d8;
            }
            if (this.ai.d(a) && this.br) {
                return this.d9;
            }
            return null;
        }
        dy(a) {
            return this.d.item(a % this.d.count);
        }
        dx(a) {
            return this.c.item(a % this.c.count);
        }
        b2(a, b) {
            let c = a * this.b0;
            if (this.a0) {
                let d = this.ak.b(b).c.x;
                return ((a / 2) - d) * 2;
            }
            else {
                if (this.bf) {
                    return a - ((a - c) * ((this.b8 - b) / this.b8));
                }
                else {
                    return a - ((a - c) * (b / this.b8));
                }
            }
        }
        ap() {
            let a = new IntColumn();
            a.b(this.ao.a.count);
            a.c((b, c) => {
                if (this.ao.a.item(b) < this.ao.a.item(c)) {
                    return this.bf ? -1 : 1;
                }
                if (this.ao.a.item(b) > this.ao.a.item(c)) {
                    return this.bf ? 1 : -1;
                }
                return 0;
            });
            return a;
        }
        c1(a) {
            this.c2(a);
        }
        c3() {
            if (this.l != null) {
                this.c2(this.l);
            }
        }
        c2(a) {
            this.dm("LeftLabels");
            this.dm("RightLabels");
            this.dm("SliceArea");
            if (a.g) {
                this.dn("LeftPanel", a.j);
                this.dn("RightPanel", 0);
            }
            else {
                this.dn("LeftPanel", 0);
                this.dn("RightPanel", a.j);
            }
            this.ag = a.b;
            for (let b of fromEnum(a.b)) {
                if (b.h) {
                    let c = new RenderSliceMessage();
                    c.e = "SliceArea";
                    c.g = b.b;
                    c.h = this.b4;
                    this.y.i(c);
                }
            }
            for (let d of fromEnum(a.b)) {
                if (d.g) {
                    let e = new RenderOuterLabelMessage();
                    if (a.g) {
                        e.e = "LeftLabels";
                    }
                    else {
                        e.e = "RightLabels";
                    }
                    e.j = d.l;
                    e.l = d.n;
                    e.h = a.j;
                    e.f = d;
                    this.y.i(e);
                }
            }
            let f = new FrameRenderCompleteMessage();
            this.y.i(f);
        }
        dn(a, b) {
            let c = new SetAreaSizeMessage();
            c.e = a;
            c.i = true;
            c.m = b;
            this.y.i(c);
        }
        bn() {
            return this.b6 > 0;
        }
        dm(a) {
            let b = new ClearMessage();
            b.e = a;
            this.y.i(b);
        }
        as() {
            return this.au;
        }
        c0(a) {
            this.bm = true;
        }
        cc(a) {
            return Convert.toInt32(a);
        }
        dj(a) {
            let b = a;
            let c = b.d;
            switch (b.g) {
                case "TextStyle":
                    this.cu = c != null ? c.toString() : "";
                    let d = new PropertyChangedMessage();
                    d.g = b.g;
                    d.e = b.e;
                    d.d = c;
                    this.y.i(d);
                    this.bm = true;
                    break;
                case "OuterLabelTextStyle":
                    this.ct = c != null ? c.toString() : "";
                    let e = new PropertyChangedMessage();
                    e.g = b.g;
                    e.e = b.e;
                    e.d = c;
                    this.y.i(e);
                    this.bm = true;
                    break;
                case "ValueColumn":
                    this.ao.b(c);
                    this.bm = true;
                    break;
                case "HighlightValueColumn":
                    this.an.b(c);
                    this.bm = true;
                    break;
                case "ActualHighlightValueDisplayMode":
                    this.eb = EnumUtil.getEnumValue(HighlightedValueDisplayMode_$type, c) == 2 ? 0 : 1;
                    this.bm = true;
                    break;
                case "ActualHighlightValueOpacity":
                    this.b3 = c;
                    this.bm = true;
                    break;
                case "InnerLabelColumn":
                    this.bd = false;
                    this.ck = c;
                    this.at.b(c);
                    this.bm = true;
                    break;
                case "InnerLabelVisibility":
                    this.be = c;
                    this.bm = true;
                    break;
                case "OuterLabelVisibility":
                    this.bk = c;
                    this.bm = true;
                    break;
                case "OuterLabelColumn":
                    this.bj = false;
                    this.cl = c;
                    this.au.b(c);
                    this.bm = true;
                    break;
                case "ValueMemberPath":
                    this.cv = typeCast(String_$type, c);
                    break;
                case "OuterLabelMemberPath":
                    this.cs = typeCast(String_$type, c);
                    break;
                case "InnerLabelMemberPath":
                    this.cr = typeCast(String_$type, c);
                    break;
                case "BottomEdgeWidth":
                    this.b0 = c;
                    if (this.b0 > 1) {
                        this.b0 = 1;
                    }
                    if (this.b0 < 0.001) {
                        this.b0 = 0.001;
                    }
                    this.bm = true;
                    break;
                case "Brushes":
                    if (b.e != null) {
                        let f = b.e;
                        f.collectionChanged = delegateRemove(f.collectionChanged, this.bs);
                    }
                    if (c != null) {
                        let g = c;
                        g.collectionChanged = delegateCombine(g.collectionChanged, this.bs);
                    }
                    this.c = typeCast(BrushCollection.$, c);
                    this.bm = true;
                    break;
                case "Outlines":
                    this.d = typeCast(BrushCollection.$, c);
                    this.bm = true;
                    break;
                case "OuterLabelAlignment":
                    this.ae = EnumUtil.getEnumValue(OuterLabelAlignment_$type, c);
                    this.bm = true;
                    break;
                case "FunnelSliceDisplay":
                    this.n = EnumUtil.getEnumValue(FunnelSliceDisplay_$type, c);
                    this.bm = true;
                    break;
                case "FormatInnerLabel":
                    this.at.b(this.ck);
                    this.bd = false;
                    this.cg = c;
                    this.bm = true;
                    break;
                case "FormatOuterLabel":
                    this.au.b(this.cl);
                    this.ch = c;
                    this.bj = false;
                    this.bm = true;
                    break;
                case "IsInverted":
                    this.bf = c;
                    this.bm = true;
                    break;
                case "TransitionDuration":
                    this.ax.r = this.cc(c);
                    this.b6 = this.ax.r;
                    break;
                case "AllowSliceSelection":
                    this.ba = c;
                    break;
                case "SelectedSliceStyle":
                    this.d8 = c;
                    this.bm = true;
                    break;
                case "UnselectedSliceStyle":
                    this.d9 = c;
                    this.bm = true;
                    break;
                case "UseUnselectedStyle":
                    this.br = c;
                    this.bm = true;
                    break;
                case "UseBezierCurve":
                    this.bp = c;
                    this.bm = true;
                    break;
                case "UpperBezierControlPoint":
                    this.d3 = c;
                    this.bm = true;
                    break;
                case "LowerBezierControlPoint":
                    this.d2 = c;
                    this.bm = true;
                    break;
                case "ItemProvider":
                    this.s = c;
                    break;
                case "ToolTip":
                    let h = new TooltipValueChangedMessage();
                    if (c != null) {
                        this.bc = true;
                    }
                    else {
                        this.bc = false;
                        let i = new ClearTooltipMessage();
                        this.y.i(i);
                    }
                    h.g = c;
                    this.y.i(h);
                    break;
                case "Legend":
                    this.db(c);
                    this.bm = true;
                    break;
                case "LegendItemTemplate":
                    this.dw = c;
                    this.bm = true;
                    break;
                case "LegendItemBadgeTemplate":
                    this.dv = c;
                    this.bm = true;
                    break;
                case "UseOuterLabelsForLegend":
                    this.bq = c;
                    this.bm = true;
                    break;
                case "OutlineThickness":
                    this.bv = c;
                    this.bm = true;
                    this.y.i(b);
                    break;
                case "Container":
                case "PixelScalingRatio":
                case "ActualPixelScalingRatio":
                case "OuterLabelTextColor":
                case "LabelTextColor":
                    if (b.g == "Container") {
                        let j = b.d;
                        this.ax.u(j);
                    }
                    let k = new PropertyChangedMessage();
                    k.g = b.g;
                    k.e = b.e;
                    k.d = c;
                    this.y.i(k);
                    break;
            }
        }
        get dw() {
            return this.du;
        }
        set dw(a) {
            this.du = a;
        }
        get dv() {
            return this.dt;
        }
        set dv(a) {
            this.dt = a;
        }
        db(a) {
            if (this.o != null) {
                this.o.clearLegendItemsForSeries(this.ac.b("Model"));
            }
            this.o = a;
        }
        dl(a) {
            let b = new List$1(UIElement.$, 0);
            for (let c of fromEnum(a.b)) {
                let d = new ContentControl();
                let e = "";
                if (c.b.ab != null) {
                    if (this.bq && c.l != null) {
                        e = c.l.toString();
                    }
                    else {
                        e = c.b.ab.toString();
                    }
                }
                else if (c.l != null) {
                    e = c.l.toString();
                }
                let f = null;
                let g = null;
                if (f == null && c.b.ao != null) {
                    f = c.b.ao;
                }
                if (g == null && c.b.at != null) {
                    g = c.b.at;
                }
                let h = null;
                if (this.s != null) {
                    h = this.s.getItem(c.b.w);
                }
                d.content = ((() => {
                    let $ret = new FunnelSliceDataContext();
                    $ret.series = this.ac.b("Model");
                    $ret.item = h;
                    $ret.itemBrush = f;
                    $ret.itemLabel = e;
                    $ret.thickness = this.b4;
                    $ret.outline = g;
                    $ret.itemOutline = g;
                    return $ret;
                })());
                d.ah = this.dw;
                b.add(d);
            }
            if (this.o != null) {
                if (this.o.isItemwise) {
                    let i = this.o;
                    i.createItemwiseLegendItems(b, this.ac.b("Model"));
                }
            }
        }
        ds(a) {
            let b = a;
            switch (b.g) {
                case "OuterLabelWidthDecider":
                    this.u = typeCast(IOuterLabelWidthDecider_$type, b.d);
                    this.bm = true;
                    break;
                case "FunnelLabelSizeDecider":
                    this.q = typeCast(IFunnelLabelSizeDecider_$type, b.d);
                    this.bm = true;
                    break;
            }
        }
        dr(a) {
            let b = a;
            this.b9 = b.e;
            this.b8 = b.d;
            this.bm = true;
        }
        c8(a) {
            let b = a;
            if (b.e == 1) {
                return;
            }
            if (b.c == 1) {
                this.cf = this.ce;
            }
            else if (b.c == 0) {
                let c = this.cf;
                this.cf = -1;
                if (b.f == 0) {
                }
                else if (b.f != 2) {
                    return;
                }
                if (c == this.ce) {
                    this.dd(c);
                }
            }
        }
        bi(a) {
            if (this.ao == null) {
                return false;
            }
            if (this.ao.a == null) {
                return false;
            }
            if (this.ao.a.count == 0) {
                return false;
            }
            if (a < 0 || a > this.ao.a.count - 1) {
                return false;
            }
            return true;
        }
        dd(a) {
            if (!this.bi(a)) {
                return;
            }
            if (this.ba) {
                this.ai.k(a, this.ao.a.item(a));
                let b = this.ai.a();
                let c = new SelectedItemsChangedMessage();
                c.c = b;
                this.x.i(c);
                this.bm = true;
            }
            let d = new SliceClickedMessage();
            d.c = a;
            d.item = this.ao.a.item(a);
            d.f = this.d4;
            this.x.i(d);
        }
        df(a) {
            if (this.bi(a)) {
                let b = new SliceMouseMessage();
                b.e = a;
                b.item = this.ao.a.item(a);
                b.c = 0;
                b.i = this.d4;
                this.x.i(b);
            }
        }
        dg(a, b) {
            if (this.bi(a)) {
                let c = new SliceMouseMessage();
                c.e = a;
                c.item = this.ao.a.item(a);
                c.c = 2;
                c.i = this.d4;
                c.h = b;
                this.x.i(c);
            }
        }
        de(a) {
            if (this.bi(a)) {
                let b = new SliceMouseMessage();
                b.e = a;
                b.item = this.ao.a.item(a);
                b.c = 1;
                b.i = this.d4;
                this.x.i(b);
            }
        }
        da(a) {
            let b = a;
            let c = this.ce;
            this.ce = this.cd(b.c);
            if (c != this.ce) {
                if (c != -1) {
                    this.df(c);
                }
                if (this.ce != -1) {
                    this.de(this.ce);
                }
            }
            else {
                if (this.ce != -1) {
                    this.dg(this.ce, b.c);
                }
            }
            if (this.bc) {
                this.dp(b.c);
            }
        }
        c9(a) {
            let b = this.ce;
            this.ce = -1;
            if (b != -1) {
                this.df(b);
            }
            let c = new ClearTooltipMessage();
            this.y.i(c);
        }
        dp(a) {
            let b = new FunnelDataContext();
            if (this.s != null && this.ce >= 0 && this.ce < this.s.count) {
                b.item = this.s.getItem(this.ce);
            }
            b.b = this.ce;
            if (b.b < 0) {
                let c = new ClearTooltipMessage();
                this.y.i(c);
                return;
            }
            let d = new TooltipUpdateMessage();
            d.g = b;
            d.i = this.d1(a, b);
            this.y.i(d);
        }
        d1(a, b) {
            let c = { $type: Point_$type, x: a.x + 10, y: a.y + 10 };
            return c;
        }
        cd(a) {
            if (!this.bh()) {
                return -1;
            }
            let b = a.y;
            let c = a.x;
            let d = this.i();
            if (d.g) {
                c -= d.j;
            }
            let e = this.af(b);
            if (e == null) {
                return -1;
            }
            let f = this.b1();
            let g = this.b2(f, b);
            let h = g / 2;
            let i = f / 2;
            let j = new Rect(0, e.b.a8.x, e.b.a8.y, Math.max(e.b.a6.x - e.b.a8.x, 0), Math.max(e.b.a6.y - e.b.a8.y, 0));
            if (c >= (i - h) && c <= (i + h)) {
                this.d4 = j;
                return e.j;
            }
            else {
                return -1;
            }
        }
        b1() {
            let a = this.i();
            return this.b9 - a.j;
        }
        af(a) {
            let b = this.i();
            let c = b.b.ad(a);
            if (c >= 0 && c < b.b.count) {
                return b.b._inner[c];
            }
            return null;
        }
        i() {
            let a = null;
            if (this.bb) {
                a = this.j;
            }
            else {
                a = this.h;
            }
            return a;
        }
        dq(a) {
            let b = a;
            this.ai.i(b.c, this.ao);
            this.bm = true;
        }
        c6(a) {
            this.cx(a);
        }
        cx(a) {
            let b = this.i();
            if (a.c == -1) {
                this.bm = true;
            }
            else {
                let c = b.b._inner[a.c];
                if (a.b) {
                    if (a.d.width > b.j) {
                        this.bm = true;
                    }
                    if (a.d.height != a.e.height) {
                        this.bm = true;
                    }
                    if (a.d.height > c.b.a6.y - c.b.a9.y) {
                        this.bm = true;
                    }
                }
                else {
                    if (a.d.height > c.b.a6.y - c.b.a9.y) {
                        this.bm = true;
                    }
                }
            }
        }
    }
    XamFunnelController.$t = markType(XamFunnelController, 'XamFunnelController');
    return XamFunnelController;
})();
/**
 * @hidden
 */
export let XamFunnelChart = /*@__PURE__*/ (() => {
    class XamFunnelChart extends Control {
        constructor() {
            super();
            this.at = null;
            this.av = null;
            this.as = null;
            this.a0 = null;
            this.b5 = null;
            this.ba = null;
            this.b6 = null;
            this.a7 = null;
            this.bu = 0.5;
            this.a4 = 1;
            this.a8 = null;
            this.a9 = null;
            this.b7 = null;
            this.b8 = null;
            this.ak = new FunnelChartSelectedItemsCollection();
            this.br = new Dictionary$2(Base.$, Base.$, 0);
            this.selectedItemsChanged = null;
            this.cf = null;
            this.ce = null;
            this.sliceClicked = null;
            this.sliceEnter = null;
            this.sliceLeave = null;
            this.sliceHover = null;
            this.cc = null;
            this.bw = NaN;
            this.bv = 1;
            this.fn = null;
            this.fo = null;
            this.bv = 1;
            this.bw = NaN;
            this.ak.ag(runOn(this, this.ei));
            this.au = new MessageHandler();
            this.au.b(SliceClickedMessage.$, runOn(this, this.em));
            this.au.b(SliceMouseMessage.$, runOn(this, this.en));
            this.au.b(SelectedItemsChangedMessage.$, runOn(this, this.ej));
            this.as = new MessageChannel();
            this.b5 = (a, b) => this.dy(b.action, b.position, b.count, b.propertyName);
            this.b6 = (a, b) => this.d3(b.action, b.position, b.count, b.propertyName);
            this.ek();
            this.ab = XamFunnelChart.$;
            this.a0 = new XamFunnelConnector(new XamFunnelView(), this);
            this.legendItemTemplate = ((() => {
                let $ret = new DataTemplate();
                $ret.render = FunnelLegendTemplates.e;
                $ret.measure = FunnelLegendTemplates.c;
                return $ret;
            })());
            this.legendItemBadgeTemplate = ((() => {
                let $ret = new DataTemplate();
                $ret.render = FunnelLegendTemplates.d;
                $ret.measure = FunnelLegendTemplates.f;
                return $ret;
            })());
        }
        get isFragment() {
            return false;
        }
        get isLayer() {
            return false;
        }
        destroy() {
            this.provideContainer(null);
        }
        get au() {
            return this.at;
        }
        set au(a) {
            this.at = a;
        }
        ek() {
            this.ee(XamFunnelChart.$$p[1], 0, this.bz);
            this.ee(XamFunnelChart.$$p[10], enumGetBox(Visibility_$type, this.fv), enumGetBox(Visibility_$type, this.fv));
            this.ee(XamFunnelChart.$$p[17], enumGetBox(OuterLabelAlignment_$type, this.ax), enumGetBox(OuterLabelAlignment_$type, this.ax));
            this.ee(XamFunnelChart.$$p[4], enumGetBox(FunnelSliceDisplay_$type, this.an), enumGetBox(FunnelSliceDisplay_$type, this.an));
            this.ee(XamFunnelChart.$$p[26], this.fs, this.fs);
            this.ee(XamFunnelChart.$$p[16], this.fr, this.fr);
            this.el();
        }
        el() {
            let a = new PropertyChangedMessage();
            a.g = "ItemProvider";
            a.e = null;
            a.d = this;
            this.as.i(a);
        }
        get aw() {
            return this.av;
        }
        set aw(a) {
            let b = this.av;
            this.av = a;
            this.eg(b, this.av);
        }
        eg(a, b) {
            if (a != null) {
                let c = typeCast(MessageChannel.$, a.b("ModelUpdateMessages"));
                if (c != null) {
                    c.h(runOn(this, this.d5));
                }
                this.as.g();
            }
            if (b != null) {
                let d = typeCast(MessageChannel.$, b.b("ModelUpdateMessages"));
                if (d != null) {
                    d.e(runOn(this, this.d5));
                }
                let e = typeCast(MessageChannel.$, b.b("ConfigurationMessages"));
                this.as.f(e);
            }
        }
        d5(a) {
            this.au.c(a);
        }
        dy(a, b, c, d) {
            let e = ((() => {
                let $ret = new DataUpdatedMessage();
                $ret.g = b;
                $ret.f = c;
                $ret.i = d;
                return $ret;
            })());
            switch (a) {
                case 3:
                    e.c = 3;
                    break;
                case 1:
                    e.c = 1;
                    break;
                case 0:
                    e.c = 0;
                    break;
                case 2:
                    e.c = 2;
                    break;
                case 4:
                    e.c = 4;
                    break;
            }
            this.ee("ValueColumn", this.bg, this.bg);
            this.ee("InnerLabelColumn", this.bc, this.bc);
            this.ee("OuterLabelColumn", this.bd, this.bd);
            this.as.i(e);
        }
        get bg() {
            return this.ba;
        }
        set bg(a) {
            if (this.ba != a) {
                let b = this.ba;
                this.ba = a;
                this.ee("ValueColumn", b, this.ba);
            }
        }
        d3(a, b, c, d) {
            let e = ((() => {
                let $ret = new DataUpdatedMessage();
                $ret.g = b;
                $ret.f = c;
                $ret.i = d;
                return $ret;
            })());
            switch (a) {
                case 3:
                    e.c = 3;
                    break;
                case 1:
                    e.c = 1;
                    break;
                case 0:
                    e.c = 0;
                    break;
                case 2:
                    e.c = 2;
                    break;
                case 4:
                    e.c = 4;
                    break;
            }
            this.ee("HighlightValueColumn", this.bb, this.bb);
            this.as.i(e);
        }
        get bb() {
            return this.a7;
        }
        set bb(a) {
            if (this.a7 != a) {
                let b = this.a7;
                this.a7 = a;
                this.ep();
                this.ee("HighlightValueColumn", b, this.a7);
            }
        }
        get bx() {
            return this.bu;
        }
        set bx(a) {
            let b = this.bu;
            this.bu = a;
            if (b != this.bu) {
                this.ee("ActualHighlightValueOpacity", b, a);
            }
        }
        eq() {
            this.bx = isNaN_(this.b1) ? 0.5 : Math.max(0, Math.min(this.b1, 1));
        }
        get a5() {
            return this.a4;
        }
        set a5(a) {
            this.a4 = a;
        }
        ep() {
            let a = this.a5;
            if (this.a6 != 1) {
                if (this.bb == null || this.bg == null || this.bb.count != this.bg.count) {
                    this.a5 = 1;
                }
                else {
                    this.a5 = 2;
                }
            }
            else {
                this.a5 = 1;
            }
            if (this.a5 != a) {
                this.ee("ActualHighlightValueDisplayMode", enumGetBox(HighlightedValueDisplayMode_$type, a), enumGetBox(HighlightedValueDisplayMode_$type, this.a5));
            }
        }
        get a6() {
            return EnumUtil.getEnumValue(HighlightedValueDisplayMode_$type, this.c(XamFunnelChart.ez));
        }
        set a6(a) {
            this.h(XamFunnelChart.ez, enumGetBox(HighlightedValueDisplayMode_$type, a));
            this.ep();
        }
        get bc() {
            return this.a8;
        }
        set bc(a) {
            if (this.a8 != a) {
                let b = this.a8;
                this.a8 = a;
                this.ee("InnerLabelColumn", b, this.bc);
            }
        }
        get bd() {
            return this.a9;
        }
        set bd(a) {
            if (this.a9 != a) {
                let b = this.a9;
                this.a9 = a;
                this.ee("OuterLabelColumn", b, this.bd);
            }
        }
        get b9() {
            return this.b7;
        }
        set b9(a) {
            let b = this.b7;
            this.b7 = a;
            this.ee("FormatInnerLabel", b, a);
        }
        get ca() {
            return this.b8;
        }
        set ca(a) {
            let b = this.b8;
            this.b8 = a;
            this.ee("FormatOuterLabel", b, a);
        }
        get selectedItems() {
            return this.ak;
        }
        ef(a, b) {
            if (this.selectedItemsChanged != null) {
                this.selectedItemsChanged(a, b);
            }
        }
        get dl() {
            return this.cf;
        }
        set dl(a) {
            let b = this.cf;
            this.cf = a;
            this.ee("TextStyle", b, a);
        }
        get dd() {
            return this.ce;
        }
        set dd(a) {
            let b = this.ce;
            this.ce = a;
            this.ee("OuterLabelTextStyle", b, a);
        }
        onDetachedFromUI() {
            this.a0.e.az();
        }
        onAttachedToUI() {
            this.a0.e.ax(this);
        }
        ee(a, b, c) {
            if (this.bk(a, b, c) || this.bj(a, b, c) || this.bi(a, b, c) || this.bm(a, b, c) || this.bl(a, b, c)) {
                return;
            }
            if (a == "PixelScalingRatio") {
                if (isNaN_(DeviceUtils.a(this.b4))) {
                    this.by = 1;
                }
                else {
                    this.by = DeviceUtils.a(this.b4);
                }
            }
            if (a == XamFunnelChart.$$p[6]) {
                this.eq();
                return;
            }
            this.as.i(((() => {
                let $ret = new PropertyChangedMessage();
                $ret.g = a;
                $ret.e = b;
                $ret.d = c;
                return $ret;
            })()));
        }
        bi(a, b, c) {
            if (a == XamFunnelChart.$$p[2] || a == XamFunnelChart.$$p[21]) {
                this.as.i(((() => {
                    let $ret = new PropertyChangedMessage();
                    $ret.g = a;
                    $ret.e = b == null ? null : b;
                    $ret.d = c == null ? null : c;
                    return $ret;
                })()));
                return true;
            }
            return false;
        }
        bk(a, b, c) {
            if (a == XamFunnelChart.$$p[12]) {
                if (b != null) {
                    this.a2 = null;
                    if (this.a3 != null && this.highlightedItemsSource == null) {
                        this.a3 = null;
                    }
                }
                if (c != null) {
                    this.selectedItems.clear();
                    this.a2 = ((() => {
                        let $ret = new FastItemsSource();
                        $ret.e = this.itemsSource;
                        return $ret;
                    })());
                    if (this.highlightedItemsSource == null) {
                        this.a3 = ((() => {
                            let $ret = new FastItemsSource();
                            $ret.e = this.itemsSource;
                            return $ret;
                        })());
                    }
                }
                return true;
            }
            else if (a == XamFunnelChart.$$p[3]) {
                if (b != null) {
                    let d = b;
                    d.event = delegateRemove(d.event, this.b5);
                }
                if (c != null) {
                    let e = c;
                    e.event = delegateCombine(e.event, this.b5);
                }
                this.d2(a, b, c);
                return true;
            }
            else if (a == XamFunnelChart.$$p[30] || a == XamFunnelChart.$$p[9] || a == XamFunnelChart.$$p[18]) {
                this.d2(a, b, c);
                return false;
            }
            return false;
        }
        bj(a, b, c) {
            if (a == XamFunnelChart.$$p[7]) {
                if (b != null) {
                    this.a3 = null;
                }
                if (c != null) {
                    this.selectedItems.clear();
                    this.a3 = ((() => {
                        let $ret = new FastItemsSource();
                        $ret.e = this.highlightedItemsSource;
                        return $ret;
                    })());
                }
                else if (this.itemsSource != null) {
                    this.selectedItems.clear();
                    this.a3 = ((() => {
                        let $ret = new FastItemsSource();
                        $ret.e = this.itemsSource;
                        return $ret;
                    })());
                }
                this.ep();
                return true;
            }
            else if (a == XamFunnelChart.$$p[5]) {
                if (b != null) {
                    let d = b;
                    d.event = delegateRemove(d.event, this.b6);
                }
                if (c != null) {
                    let e = c;
                    e.event = delegateCombine(e.event, this.b6);
                }
                this.d1(a, b, c);
                return true;
            }
            else if (a == XamFunnelChart.$$p[8]) {
                this.d1(a, b, c);
                return false;
            }
            return false;
        }
        be(a, b) {
            return a.registerColumn(b, null, false);
        }
        bf(a, b) {
            return a.registerColumnObject(b, null, false);
        }
        d2(a, b, c) {
            if (this.a2 == null) {
                let d = typeCast(FastItemsSource.$, b);
                if (d != null) {
                    if (this.bg != null) {
                        d.deregisterColumn(this.bg);
                    }
                    if (this.bc != null) {
                        d.deregisterColumn(this.bc);
                    }
                    if (this.bd != null) {
                        d.deregisterColumn(this.bd);
                    }
                    this.bg = null;
                    this.bc = null;
                    this.bd = null;
                }
                return;
            }
            if (b != null && typeof b === 'string') {
                switch (a) {
                    case XamFunnelChart.$$p[30]:
                        this.a2.deregisterColumn(this.bg);
                        this.bg = null;
                        break;
                    case XamFunnelChart.$$p[9]:
                        this.a2.deregisterColumn(this.bc);
                        this.bc = null;
                        break;
                    case XamFunnelChart.$$p[18]:
                        this.a2.deregisterColumn(this.bd);
                        this.bd = null;
                        break;
                }
            }
            if (c != null && typeCast(FastItemsSource.$, c) !== null) {
                if (this.dw != null) {
                    this.bg = this.be(c, this.dw);
                }
                if (this.cz != null) {
                    this.bc = this.bf(c, this.cz);
                }
                if (this.da != null) {
                    this.bd = this.bf(c, this.da);
                }
            }
            if (c != null && typeof c === 'string') {
                switch (a) {
                    case XamFunnelChart.$$p[30]:
                        this.bg = this.be(this.a2, this.dw);
                        break;
                    case XamFunnelChart.$$p[9]:
                        this.bc = this.bf(this.a2, this.cz);
                        break;
                    case XamFunnelChart.$$p[18]:
                        this.bd = this.bf(this.a2, this.da);
                        break;
                }
            }
        }
        d1(a, b, c) {
            if (this.a3 == null) {
                let d = typeCast(FastItemsSource.$, b);
                if (d != null) {
                    if (this.bb != null) {
                        d.deregisterColumn(this.bb);
                    }
                    this.bb = null;
                }
                this.ep();
                return;
            }
            if (b != null && typeof b === 'string') {
                switch (a) {
                    case XamFunnelChart.$$p[8]:
                        this.a3.deregisterColumn(this.bb);
                        this.bb = null;
                        break;
                }
            }
            if (c != null && typeCast(FastItemsSource.$, c) !== null) {
                if (this.cs != null) {
                    this.bb = this.be(c, this.cs);
                }
            }
            if (c != null && typeof c === 'string') {
                switch (a) {
                    case XamFunnelChart.$$p[8]:
                        this.bb = this.be(this.a3, this.cs);
                        break;
                }
            }
            this.ep();
        }
        bm(a, b, c) {
            if (a == XamFunnelChart.$$p[10] || a == XamFunnelChart.$$p[19]) {
                let d = EnumUtil.getEnumValue(Visibility_$type, b) == 0;
                let e = EnumUtil.getEnumValue(Visibility_$type, c) == 0;
                this.as.i(((() => {
                    let $ret = new PropertyChangedMessage();
                    $ret.g = a;
                    $ret.d = e;
                    $ret.e = d;
                    return $ret;
                })()));
                return true;
            }
            return false;
        }
        bl(a, b, c) {
            if (a == XamFunnelChart.$$p[24]) {
                let d = new PropertyChangedMessage();
                d.g = a;
                if (b != null) {
                    d.e = b;
                }
                if (c != null) {
                    d.d = c;
                }
                this.as.i(d);
                return true;
            }
            return false;
        }
        em(a) {
            let b = a;
            if (this.sliceClicked != null) {
                let c = new FunnelSliceClickedEventArgs();
                c.index = b.c;
                c.bounds = b.f;
                if (this.a2.count > b.c && b.c >= 0) {
                    c.item = this.a2.item(b.c);
                }
                this.sliceClicked(this, c);
            }
        }
        en(a) {
            let b = a;
            switch (b.c) {
                case 1:
                    {
                        if (this.sliceEnter != null) {
                            let c = new FunnelSliceEventArgs();
                            c.index = b.e;
                            c.bounds = b.i;
                            if (this.a2.count > b.e && b.e >= 0) {
                                c.item = this.a2.item(b.e);
                            }
                            this.sliceEnter(this, c);
                        }
                        break;
                    }
                case 0:
                    {
                        if (this.sliceLeave != null) {
                            let d = new FunnelSliceEventArgs();
                            d.index = b.e;
                            d.bounds = b.i;
                            if (this.a2.count > b.e && b.e >= 0) {
                                d.item = this.a2.item(b.e);
                            }
                            this.sliceLeave(this, d);
                        }
                        break;
                    }
                case 2:
                    {
                        if (this.sliceHover != null) {
                            let e = new FunnelSliceEventArgs();
                            e.index = b.e;
                            e.bounds = b.i;
                            e.position = b.h;
                            if (this.a2.count > b.e && b.e >= 0) {
                                e.item = this.a2.item(b.e);
                            }
                            this.sliceHover(this, e);
                        }
                        break;
                    }
            }
        }
        ej(a) {
            let b = a;
            let c = this.a2;
            let d = new Dictionary$2(Base.$, Base.$, 0);
            let e = new List$1(Base.$, 0);
            let h = b.c;
            for (let g = 0; g < h.length; g++) {
                let f = h[g];
                if (f >= 0 && f < c.count) {
                    let i = c.item(f);
                    e.add1(i);
                    if (!d.containsKey(i)) {
                        d.addItem(i, i);
                    }
                }
            }
            this.d4(this.ak.ae, this.br, e, d);
        }
        ei(a, b) {
            let c = new List$1(Number_$type, 0);
            for (let d of fromEnum(this.ak.ae)) {
                let e = this.a2.indexOf(d);
                if (e >= 0 && !c.contains(e)) {
                    c.add(e);
                }
            }
            let f = new UserSelectedItemsChangedMessage();
            f.c = c.toArray();
            this.as.i(f);
            if (b.action == 4 && b.newItems == null && b.oldItems == null) {
                return;
            }
            let g = new FunnelChartSelectedItemsCollection();
            if (b.oldItems != null) {
                for (let h = 0; h < b.oldItems.count; h++) {
                    g.add1(b.oldItems.item(h));
                }
            }
            let i = new FunnelChartSelectedItemsCollection();
            if (b.newItems != null) {
                for (let j = 0; j < b.newItems.count; j++) {
                    i.add1(b.newItems.item(j));
                }
            }
            let k = this.selectedItems;
            this.ef(this, new FunnelChartSelectedItemsChangedEventArgs(g, i, k));
        }
        d4(a, b, c, d) {
            let e = new List$1(Base.$, 0);
            for (let f of fromEnum(a)) {
                if (!d.containsKey(f)) {
                    e.add1(f);
                }
            }
            for (let g of fromEnum(e)) {
                a.remove(g);
                b.removeItem(g);
            }
            for (let h of fromEnum(c)) {
                if (!b.containsKey(h)) {
                    a.add(h);
                    b.addItem(h, h);
                }
            }
        }
        getItem(a) {
            return this.a2.item(a);
        }
        get count() {
            return this.a2 != null ? this.a2.count : 0;
        }
        d0() {
            this.a0.i();
        }
        provideContainer(a) {
            let b = this.cc;
            this.cc = a;
            this.ee("Container", b, this.cc);
        }
        notifyResized() {
            this.a0.g();
            this.as.i(new ContainerSizeChangedMessage());
        }
        eb(source_, a, b, c) {
            this.d7(source_, new NotifyCollectionChangedEventArgs(2, 2, c, b, a));
        }
        d6(source_) {
            this.d7(source_, new NotifyCollectionChangedEventArgs(0, 4));
        }
        d8(source_, a, b) {
            this.d7(source_, new NotifyCollectionChangedEventArgs(1, 0, b, a));
        }
        d9(source_, a, b) {
            this.d7(source_, new NotifyCollectionChangedEventArgs(1, 1, b, a));
        }
        d7(s_, a) {
            if (s_.dataView && s_.dataSource) {
                s_ = s_.dataView();
            }
            ;
            if (s_ == this.itemsSource) {
                let b = this.a2;
                if (b != null) {
                    b.handleCollectionChanged(a);
                }
            }
        }
        a1() {
            let a = this.a0;
            return a == null ? null : a.c;
        }
        ay() {
            let a = this.a1();
            return a == null ? null : a.ai;
        }
        get ag() {
            let a = this.ay();
            return a == null ? null : a.a();
        }
        set ag(a) {
            let b = this.ay();
            if (b == null) {
                return;
            }
            let c = this.a1();
            b.f();
            let d = a == null ? 0 : a.length;
            while (d-- > 0) {
                b.k(a[d], c.ao.a.item(a[d]));
            }
            c.bm = true;
            c.dk();
        }
        eo(a) {
            let b = this.ay();
            if (b == null) {
                return;
            }
            let c = this.a1();
            let d = c.ao.a.item(a);
            if (d != null) {
                c.ai.k(a, d);
                c.bm = true;
                c.dk();
            }
        }
        az() {
            let a = new FunnelChartVisualData();
            let b = this.a0.c.ag;
            if (b != null) {
                for (let c = 0; c < b.count; c++) {
                    let d = b._inner[c].d();
                    a.slices.add(d);
                }
            }
            a.opacity = this._opacity;
            a.isInverted = this.bn;
            a.selectedItems = this.selectedItems.ae;
            a.name = this.name;
            a.viewport = new RectData(0, 0, this.a0.c.b9, this.a0.c.b8);
            return a;
        }
        cm() {
            let a = this.az();
            a.scaleByViewport();
            return a.serialize();
        }
        resolveLegendIndex() {
            return -1;
        }
        forSubItems(a) {
        }
        get b4() {
            return this.bw;
        }
        set b4(a) {
            if (isNaN_(a) || a == 0) {
                return;
            }
            let b = this.bw;
            this.bw = a;
            this.ee("PixelScalingRatio", b, this.bw);
        }
        get by() {
            return this.bv;
        }
        set by(a) {
            let b = this.bv;
            this.bv = a;
            if (this.bv != b) {
                this.ee("ActualPixelScalingRatio", b, this.bv);
            }
        }
        get container() {
            return this;
        }
        get isStacked() {
            return false;
        }
        get isVertical() {
            return false;
        }
        get isUsableInLegend() {
            return true;
        }
        get hasSubItems() {
            return false;
        }
        get hasMarkers() {
            return false;
        }
        get fp() {
            return this.fn;
        }
        set fp(a) {
            let b = this.fp;
            if (a != b) {
                this.fn = a;
                this.ee("OuterLabelTextColor", b, this.fp);
            }
        }
        get fq() {
            return this.fo;
        }
        set fq(a) {
            let b = this.fq;
            if (a != b) {
                this.fo = a;
                this.ee("LabelTextColor", b, this.fq);
            }
        }
    }
    XamFunnelChart.$t = markType(XamFunnelChart, 'XamFunnelChart', Control.$, [IItemProvider_$type, ILegendOwner_$type, ILegendTemplateProvider_$type, ILegendSeries_$type]);
    XamFunnelChart.ez = DependencyProperty.i("HighlightValueDisplayMode", HighlightedValueDisplayMode_$type, XamFunnelChart.$, new PropertyMetadata(2, enumGetBox(HighlightedValueDisplayMode_$type, 0), (a, b) => a.ee("HighlightValueDisplayMode", b.oldValue, b.newValue)));
    XamFunnelChart.$$p = markDep(DependencyProperty, PropertyMetadata, XamFunnelChart, 'ee', ['AllowSliceSelection:bh:er', [0, false], 'BottomEdgeWidth:bz:es', [1, 0.35], 'Brushes:ah:et', [BrushCollection.$, null], 'FastItemsSource:a2:eu', [FastItemsSource.$], 'FunnelSliceDisplay:an:ev', [FunnelSliceDisplay_$type, enumGetBox(FunnelSliceDisplay_$type, 0)], 'HighlightFastItemsSource:a3:ey', [FastItemsSource.$], 'HighlightValueOpacity:b1:e0', [1, 0.5], 'HighlightedItemsSource::ew', [IEnumerable_$type, null], 'HighlightedValueMemberPath:cs:ex', [2, null], 'InnerLabelMemberPath:cz:e1', [2, null], 'InnerLabelVisibility:fv:e2', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'IsInverted:bn:e3', [0, false], 'ItemsSource::e4', [IEnumerable_$type, null], 'LegendItemBadgeTemplate::e5', [DataTemplate.$, null], 'LegendItemTemplate::e6', [DataTemplate.$, null], 'Legend::e7', [IChartLegend_$type, null], 'LowerBezierControlPoint:fr:e8', [Point_$type, { $type: Point_$type, x: 0.5, y: 1 }], 'OuterLabelAlignment:ax:e9', [OuterLabelAlignment_$type, enumGetBox(OuterLabelAlignment_$type, 0)], 'OuterLabelMemberPath:da:fa', [2, null], 'OuterLabelVisibility:fw:fb', [Visibility_$type, enumGetBox(Visibility_$type, 1)], 'OutlineThickness:b2:fd', [1, -1], 'Outlines:ai:fc', [BrushCollection.$, null], 'SelectedSliceStyle:ft:fe', [Style.$, null], 'ToolTip:cd:ff', [4, null], 'TransitionDuration:cb:fg', [1, 0], 'UnselectedSliceStyle:fu:fh', [Style.$, null], 'UpperBezierControlPoint:fs:fi', [Point_$type, { $type: Point_$type, x: 0.5, y: 0 }], 'UseBezierCurve:bo:fj', [0, false], 'UseOuterLabelsForLegend:bp:fk', [0, false], 'UseUnselectedStyle:bq:fl', [0, false], 'ValueMemberPath:dw:fm', [2, null]]);
    return XamFunnelChart;
})();
/**
 * @hidden
 */
export let XamFunnelConnector = /*@__PURE__*/ (() => {
    class XamFunnelConnector extends Base {
        constructor(a, b) {
            super();
            this.d = null;
            this.b = null;
            this.a = null;
            let c = new ServiceProvider();
            c.c("ConfigurationMessages", new MessageChannel());
            c.c("RenderingMessages", new MessageChannel());
            c.c("InteractionMessages", new MessageChannel());
            c.c("ModelUpdateMessages", new MessageChannel());
            a.av(b);
            let d = new XamFunnelController();
            d.av = a;
            d.ac = c;
            a.i = c;
            this.b = d;
            this.d = a;
            b.aw = c;
            this.a = b;
            c.c("Model", this.a);
        }
        get e() {
            return this.d;
        }
        get c() {
            return this.b;
        }
        g() {
            this.c.av.av(this.a);
        }
        h(a) {
            this.d = a;
            let b = this.b.ac;
            this.b.ac = null;
            this.b.ac = b;
            this.d.i = b;
        }
        f() {
            if (this.d != null) {
                this.d.i = null;
            }
        }
        i() {
            this.b.dk();
        }
    }
    XamFunnelConnector.$t = markType(XamFunnelConnector, 'XamFunnelConnector');
    return XamFunnelConnector;
})();
