/*
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, markDep } from "igniteui-react-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-react-core";
import { RenderingContext } from "igniteui-react-core";
import { SetAreaSizeMessage } from "./SetAreaSizeMessage";
import { RenderingMessage } from "./RenderingMessage";
import { Polygon } from "igniteui-react-core";
import { PointCollection } from "igniteui-react-core";
import { TextBlock } from "igniteui-react-core";
import { RenderSliceMessage } from "./RenderSliceMessage";
import { List$1 } from "igniteui-react-core";
import { Brush } from "igniteui-react-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-react-core";
import { CanvasViewRenderer } from "igniteui-react-core";
import { DOMEventProxy } from "igniteui-react-core";
import { BrushCollection } from "igniteui-react-core";
import { BrushUtil } from "igniteui-react-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-react-core";
import { Visibility_$type } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
import { stringReplace } from "igniteui-react-core";
import { SliceInfoList } from "./SliceInfoList";
import { DoubleAnimator } from "igniteui-react-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-react-core";
import { IChartLegend_$type } from "igniteui-react-core";
import { DataTemplate } from "igniteui-react-core";
import { DataUpdatedMessage } from "./DataUpdatedMessage";
import { UserSelectedItemsChangedMessage } from "./UserSelectedItemsChangedMessage";
import { LabelSizeChangedMessage } from "./LabelSizeChangedMessage";
import { NotifyCollectionChangedEventArgs } from "igniteui-react-core";
import { FrameRenderCompleteMessage } from "./FrameRenderCompleteMessage";
import { IntColumn } from "./IntColumn";
import { PointList } from "./PointList";
import { Convert } from "igniteui-react-core";
import { HighlightedValueDisplayMode_$type } from "igniteui-react-core";
import { ObservableCollection$1 } from "igniteui-react-core";
import { ILegendSeries_$type } from "igniteui-react-core";
import { UIElement } from "igniteui-react-core";
import { ContentControl } from "igniteui-react-core";
import { FunnelSliceDataContext } from "./FunnelSliceDataContext";
import { Control } from "igniteui-react-core";
import { SliceClickedMessage } from "./SliceClickedMessage";
import { SelectedItemsChangedMessage } from "./SelectedItemsChangedMessage";
import { SliceMouseMessage } from "./SliceMouseMessage";
import { ILegendOwner_$type } from "igniteui-react-core";
import { ILegendTemplateProvider_$type } from "igniteui-react-core";
import { DependencyProperty } from "igniteui-react-core";
import { FastItemsSource } from "igniteui-react-core";
import { Dictionary$2 } from "igniteui-react-core";
import { FunnelLegendTemplates } from "./FunnelLegendTemplates";
import { DeviceUtils } from "igniteui-react-core";
import { FunnelSliceClickedEventArgs } from "./FunnelSliceClickedEventArgs";
import { FunnelSliceEventArgs } from "./FunnelSliceEventArgs";
import { FunnelChartVisualData } from "./FunnelChartVisualData";
import { RectData } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
/**
 * @hidden
 */
export let XamFunnelView = /*@__PURE__*/ (() => {
    class XamFunnelView extends Base {
        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.ad(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.ad(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.f("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);
        }
        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();
        }
        av(a) {
            let b = a.b3;
            let c = a.bx;
            if (!isNaN_(b) && b != 0) {
                return;
            }
            if (window.devicePixelRatio != undefined && window.devicePixelRatio != c) {
                a.bx = 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.ad(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.ad(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 = /*@__PURE__*/ 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.br = null;
            this.ag = null;
            this.av = null;
            this.cj = null;
            this.ck = null;
            this.cf = null;
            this.cg = null;
            this.bd = false;
            this.bi = false;
            this.aw = null;
            this.aj = null;
            this.z = null;
            this.am = null;
            this.al = null;
            this.aq = null;
            this.ar = null;
            this.cp = null;
            this.cm = null;
            this.cl = null;
            this.a6 = false;
            this.by = 0;
            this.bx = 0;
            this.w = null;
            this.v = null;
            this.t = null;
            this.p = null;
            this.a2 = false;
            this.a5 = false;
            this.bw = 0;
            this.a4 = false;
            this.bs = 0;
            this.a = null;
            this.b = null;
            this.ad = 0;
            this.m = 0;
            this.az = false;
            this.bv = 0;
            this.a7 = false;
            this.dz = null;
            this.dy = null;
            this.ay = false;
            this.b9 = 0;
            this.ca = 0;
            this.r = null;
            this.ab = null;
            this.ah = null;
            this.g = null;
            this.e = null;
            this.f = null;
            this.d4 = null;
            this.d5 = null;
            this.a9 = false;
            this.a3 = false;
            this.a8 = false;
            this.a1 = false;
            this.d9 = 1;
            this.bt = 0.5;
            this.co = null;
            this.cn = null;
            this.bu = -1;
            this.a0 = false;
            this.l = null;
            this.o = null;
            this.dt = null;
            this.ds = null;
            this.d3 = null;
            this.ax = new DoubleAnimator(0, 1, 2000);
            let a = this.ax;
            a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.c3));
            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.di));
            this.aa.b(DataUpdatedMessage.$, runOn(this, this.cz));
            this.aa.b(ViewportChangedMessage.$, runOn(this, this.dq));
            this.aa.b(ViewPropertyChangedMessage.$, runOn(this, this.dr));
            this.aa.b(MouseMoveMessage.$, runOn(this, this.c9));
            this.aa.b(MouseButtonMessage.$, runOn(this, this.c7));
            this.aa.b(MouseLeaveMessage.$, runOn(this, this.c8));
            this.aa.b(UserSelectedItemsChangedMessage.$, runOn(this, this.dp));
            this.aa.b(LabelSizeChangedMessage.$, runOn(this, this.c5));
            this.aa.b(ContainerSizeChangedMessage.$, (b) => this.y.i(b));
            this.br = (b, c) => {
                this.bl = true;
                this.dj();
            };
        }
        c3(a, b) {
            this.b6 = this.ax.o;
            if (this.b6 == 1) {
                this.bb = false;
                this.c0(this.h);
            }
            if (this.bb) {
                let c = 1 - this.b6;
                FunnelFrame.k(this.j, this.k, this.h, this.b6);
                this.c0(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.cf);
            }
            return this.aq;
        }
        set at(a) {
            this.aq = a;
        }
        get au() {
            if (!this.bi && this.av != null) {
                this.bi = this.av.s(this.ar, this.cg);
            }
            return this.ar;
        }
        set au(a) {
            this.ar = a;
        }
        get cu() {
            return this.cp;
        }
        set cu(a) {
            this.cp = a;
        }
        get cr() {
            return this.cm;
        }
        set cr(a) {
            this.cm = a;
        }
        get cq() {
            return this.cl;
        }
        set cq(a) {
            this.cl = a;
        }
        get bl() {
            return this.a6;
        }
        set bl(a) {
            this.a6 = a;
        }
        get b8() {
            return this.by;
        }
        set b8(a) {
            this.by = a;
        }
        get b7() {
            return this.bx;
        }
        set b7(a) {
            this.bx = 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 bj() {
            return this.a5;
        }
        set bj(a) {
            this.a5 = a;
        }
        get b6() {
            return this.bw;
        }
        set b6(a) {
            this.bw = a;
        }
        get bg() {
            return this.a4;
        }
        set bg(a) {
            this.a4 = a;
        }
        get bz() {
            return this.bs;
        }
        set bz(a) {
            this.bs = 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 b5() {
            return this.bv;
        }
        set b5(a) {
            this.bv = a;
        }
        get bo() {
            return this.a7;
        }
        set bo(a) {
            this.a7 = a;
        }
        get d2() {
            return this.dz;
        }
        set d2(a) {
            this.dz = a;
        }
        get d1() {
            return this.dy;
        }
        set d1(a) {
            this.dy = a;
        }
        get ba() {
            return this.ay;
        }
        set ba(a) {
            this.ay = a;
        }
        get cd() {
            return this.b9;
        }
        set cd(a) {
            this.b9 = a;
        }
        get ce() {
            return this.ca;
        }
        set ce(a) {
            this.ca = 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.db(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 d7() {
            return this.d4;
        }
        set d7(a) {
            this.d4 = a;
        }
        get d8() {
            return this.d5;
        }
        set d8(a) {
            this.d5 = a;
        }
        get bq() {
            return this.a9;
        }
        set bq(a) {
            this.a9 = a;
        }
        get bf() {
            return this.a3;
        }
        set bf(a) {
            this.a3 = a;
        }
        get bp() {
            return this.a8;
        }
        set bp(a) {
            this.a8 = a;
        }
        get bc() {
            return this.a1;
        }
        set bc(a) {
            this.a1 = a;
        }
        get ea() {
            return this.d9;
        }
        set ea(a) {
            this.d9 = a;
        }
        get b2() {
            return this.bt;
        }
        set b2(a) {
            this.bt = a;
        }
        get ct() {
            return this.co;
        }
        set ct(a) {
            this.co = a;
        }
        get cs() {
            return this.cn;
        }
        set cs(a) {
            this.cn = a;
        }
        get b3() {
            let a = this.bu;
            if (a < 0 && this.av != null) {
                this.bu = this.av.aa();
                a = this.bu;
            }
            return a < 0 ? 1 : a;
        }
        db(a, b) {
            if (a != null) {
                let c = typeCast(MessageChannel.$, a.b("ConfigurationMessages"));
                if (c != null) {
                    c.h(runOn(this, this.c6));
                }
                c = typeCast(MessageChannel.$, a.b("InteractionMessages"));
                if (c != null) {
                    c.h(runOn(this, this.c6));
                }
                this.y.g();
                this.x.g();
            }
            if (b != null) {
                let d = typeCast(MessageChannel.$, b.b("ConfigurationMessages"));
                if (d != null) {
                    d.e(runOn(this, this.c6));
                }
                d = typeCast(MessageChannel.$, b.b("InteractionMessages"));
                if (d != null) {
                    d.e(runOn(this, this.c6));
                }
                let e = typeCast(MessageChannel.$, b.b("RenderingMessages"));
                this.y.f(e);
                let f = typeCast(MessageChannel.$, b.b("ModelUpdateMessages"));
                this.x.f(f);
            }
            this.bl = true;
        }
        c6(a) {
            this.aa.c(a);
            let b = typeCast(RenderingMessage.$, a);
            if (b != null) {
                this.bl = b.c;
            }
            this.dj();
        }
        bn() {
            return this.b7 >= 0 && this.b8 >= 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.bn();
        }
        dj() {
            if (!this.bl) {
                return;
            }
            if (!this.bh()) {
                this.cy();
                return;
            }
            this.bl = false;
            let a = this.u.decideWidth(this.as());
            if (a > this.b8) {
                a = 0;
            }
            if (!this.bj) {
                a = 0;
            }
            let b = this.b8 - a;
            let c = a > 0;
            let d = this.be;
            let e = b >= 0;
            if (e || c) {
                this.dg(e, c, d, b, a);
            }
        }
        cy() {
            if (this.bm() && this.b6 > 0) {
                this.ax.w();
            }
            this.dl("LeftLabels");
            this.dl("RightLabels");
            this.dl("SliceArea");
            this.cx();
            this.h.b.clear();
            this.j.b.clear();
            this.k.b.clear();
        }
        cx() {
            let a = new FrameRenderCompleteMessage();
            this.y.i(a);
        }
        dg(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.dh(this.h, a, b, c, d, e);
            this.ax.w();
            this.b6 = 0;
            if (this.bm()) {
                FunnelFrame.k(this.j, this.k, this.h, this.b6);
                this.c0(this.j);
                this.bb = true;
                this.ax.v();
            }
            else {
                this.c0(this.h);
            }
        }
        b4(a) {
            if (isNaN_(a)) {
                return 0;
            }
            return Math.abs(a);
        }
        dh(a, b, c, d, e, f) {
            let g = e / 2;
            this.a0 = this.bo;
            if (this.a0) {
                this.c4(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.b4(this.ao.a.item(k));
            }
            if (j == 0) {
                h = false;
            }
            let l = this.b7 / i.a.count;
            let m = 0;
            let n = 0;
            n = this.b3 / 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.b4(this.ao.a.item(p)) / j) * this.b7;
                }
                else {
                    q = l;
                }
                let r = this.b1(e, m + n);
                let s = m + q;
                let t = this.b1(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.ea;
                x.r = this.b2;
                x.ae(this.dw(p), this.dx(p), x.r, this.ea == 0);
                x.bj = this.d6(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.cv(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.ch(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.ch(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.ci(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.ci(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.dk(a);
            }
            a.b.ae();
        }
        cv(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.b3;
            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;
        }
        bk(a, b) {
            if (a.x != b.x || a.y != b.y) {
                return true;
            }
            return false;
        }
        c4(a, b) {
            let c;
            let d;
            let e = 0, f = this.b7;
            e = this.b3 / 2;
            f -= e;
            if (this.bf) {
                c = { $type: Point_$type, x: b - (a * this.bz / 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.bz / 2), y: f };
            }
            let g = this.d2.y < this.d1.y ? this.d2 : this.d1;
            let h = this.d1.y > this.d2.y ? this.d1 : this.d2;
            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.b7 * g.y };
            let k = { $type: Point_$type, x: a * h.x, y: this.b7 * h.y };
            if (this.ak == null || this.bk(c, this.ak.q) || this.bk(j, this.ak.r) || this.bk(k, this.ak.s) || this.bk(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;
            }
        }
        ci(a) {
            let b = this.au;
            let c = b == null ? null : b.a;
            return c == null || a >= c.count ? null : c.item(a);
        }
        ch(a) {
            let b = this.at;
            let c = b == null ? null : b.a;
            return c == null || a >= c.count ? null : c.item(a);
        }
        d6(a) {
            if (this.ai.c(a)) {
                return this.d7;
            }
            if (this.ai.d(a) && this.bq) {
                return this.d8;
            }
            return null;
        }
        dx(a) {
            return this.d.item(a % this.d.count);
        }
        dw(a) {
            return this.c.item(a % this.c.count);
        }
        b1(a, b) {
            let c = a * this.bz;
            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.b7 - b) / this.b7));
                }
                else {
                    return a - ((a - c) * (b / this.b7));
                }
            }
        }
        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;
        }
        c0(a) {
            this.c1(a);
        }
        c2() {
            if (this.l != null) {
                this.c1(this.l);
            }
        }
        c1(a) {
            this.dl("LeftLabels");
            this.dl("RightLabels");
            this.dl("SliceArea");
            if (a.g) {
                this.dm("LeftPanel", a.j);
                this.dm("RightPanel", 0);
            }
            else {
                this.dm("LeftPanel", 0);
                this.dm("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.b3;
                    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);
        }
        dm(a, b) {
            let c = new SetAreaSizeMessage();
            c.e = a;
            c.i = true;
            c.m = b;
            this.y.i(c);
        }
        bm() {
            return this.b5 > 0;
        }
        dl(a) {
            let b = new ClearMessage();
            b.e = a;
            this.y.i(b);
        }
        as() {
            return this.au;
        }
        cz(a) {
            this.bl = true;
        }
        cb(a) {
            return Convert.toInt32(a);
        }
        di(a) {
            let b = a;
            let c = b.d;
            switch (b.g) {
                case "TextStyle":
                    this.ct = c != null ? c.toString() : "";
                    let d = new PropertyChangedMessage();
                    d.g = b.g;
                    d.e = b.e;
                    d.d = c;
                    this.y.i(d);
                    this.bl = true;
                    break;
                case "OuterLabelTextStyle":
                    this.cs = c != null ? c.toString() : "";
                    let e = new PropertyChangedMessage();
                    e.g = b.g;
                    e.e = b.e;
                    e.d = c;
                    this.y.i(e);
                    this.bl = true;
                    break;
                case "ValueColumn":
                    this.ao.b(c);
                    this.bl = true;
                    break;
                case "HighlightValueColumn":
                    this.an.b(c);
                    this.bl = true;
                    break;
                case "ActualHighlightValueDisplayMode":
                    this.ea = EnumUtil.getEnumValue(HighlightedValueDisplayMode_$type, c) == 2 ? 0 : 1;
                    this.bl = true;
                    break;
                case "ActualHighlightValueOpacity":
                    this.b2 = c;
                    this.bl = true;
                    break;
                case "InnerLabelColumn":
                    this.bd = false;
                    this.cj = c;
                    this.at.b(c);
                    this.bl = true;
                    break;
                case "InnerLabelVisibility":
                    this.be = c;
                    this.bl = true;
                    break;
                case "OuterLabelVisibility":
                    this.bj = c;
                    this.bl = true;
                    break;
                case "OuterLabelColumn":
                    this.bi = false;
                    this.ck = c;
                    this.au.b(c);
                    this.bl = true;
                    break;
                case "ValueMemberPath":
                    this.cu = typeCast(String_$type, c);
                    break;
                case "OuterLabelMemberPath":
                    this.cr = typeCast(String_$type, c);
                    break;
                case "InnerLabelMemberPath":
                    this.cq = typeCast(String_$type, c);
                    break;
                case "BottomEdgeWidth":
                    this.bz = c;
                    if (this.bz > 1) {
                        this.bz = 1;
                    }
                    if (this.bz < 0.001) {
                        this.bz = 0.001;
                    }
                    this.bl = true;
                    break;
                case "Brushes":
                    if (b.e != null) {
                        let f = b.e;
                        f.collectionChanged = delegateRemove(f.collectionChanged, this.br);
                    }
                    if (c != null) {
                        let g = c;
                        g.collectionChanged = delegateCombine(g.collectionChanged, this.br);
                    }
                    this.c = typeCast(BrushCollection.$, c);
                    this.bl = true;
                    break;
                case "Outlines":
                    this.d = typeCast(BrushCollection.$, c);
                    this.bl = true;
                    break;
                case "OuterLabelAlignment":
                    this.ae = EnumUtil.getEnumValue(OuterLabelAlignment_$type, c);
                    this.bl = true;
                    break;
                case "FunnelSliceDisplay":
                    this.n = EnumUtil.getEnumValue(FunnelSliceDisplay_$type, c);
                    this.bl = true;
                    break;
                case "FormatInnerLabel":
                    this.at.b(this.cj);
                    this.bd = false;
                    this.cf = c;
                    this.bl = true;
                    break;
                case "FormatOuterLabel":
                    this.au.b(this.ck);
                    this.cg = c;
                    this.bi = false;
                    this.bl = true;
                    break;
                case "IsInverted":
                    this.bf = c;
                    this.bl = true;
                    break;
                case "TransitionDuration":
                    this.ax.r = this.cb(c);
                    this.b5 = this.ax.r;
                    break;
                case "AllowSliceSelection":
                    this.ba = c;
                    break;
                case "SelectedSliceStyle":
                    this.d7 = c;
                    this.bl = true;
                    break;
                case "UnselectedSliceStyle":
                    this.d8 = c;
                    this.bl = true;
                    break;
                case "UseUnselectedStyle":
                    this.bq = c;
                    this.bl = true;
                    break;
                case "UseBezierCurve":
                    this.bo = c;
                    this.bl = true;
                    break;
                case "UpperBezierControlPoint":
                    this.d2 = c;
                    this.bl = true;
                    break;
                case "LowerBezierControlPoint":
                    this.d1 = c;
                    this.bl = 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.da(c);
                    this.bl = true;
                    break;
                case "LegendItemTemplate":
                    this.dv = c;
                    this.bl = true;
                    break;
                case "LegendItemBadgeTemplate":
                    this.du = c;
                    this.bl = true;
                    break;
                case "UseOuterLabelsForLegend":
                    this.bp = c;
                    this.bl = true;
                    break;
                case "OutlineThickness":
                    this.bu = c;
                    this.bl = 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 dv() {
            return this.dt;
        }
        set dv(a) {
            this.dt = a;
        }
        get du() {
            return this.ds;
        }
        set du(a) {
            this.ds = a;
        }
        da(a) {
            if (this.o != null) {
                this.o.clearLegendItemsForSeries(this.ac.b("Model"));
            }
            this.o = a;
        }
        dk(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.bp && 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.b3;
                    $ret.outline = g;
                    $ret.itemOutline = g;
                    return $ret;
                })());
                d.ah = this.dv;
                b.add(d);
            }
            if (this.o != null) {
                if (this.o.isItemwise) {
                    let i = this.o;
                    i.createItemwiseLegendItems(b, this.ac.b("Model"));
                }
            }
        }
        dr(a) {
            let b = a;
            switch (b.g) {
                case "OuterLabelWidthDecider":
                    this.u = typeCast(IOuterLabelWidthDecider_$type, b.d);
                    this.bl = true;
                    break;
                case "FunnelLabelSizeDecider":
                    this.q = typeCast(IFunnelLabelSizeDecider_$type, b.d);
                    this.bl = true;
                    break;
            }
        }
        dq(a) {
            let b = a;
            this.b8 = b.e;
            this.b7 = b.d;
            this.bl = true;
        }
        c7(a) {
            let b = a;
            if (b.e == 1) {
                return;
            }
            if (b.c == 1) {
                this.ce = this.cd;
            }
            else if (b.c == 0) {
                let c = this.ce;
                this.ce = -1;
                if (b.f == 0) {
                }
                else if (b.f != 2) {
                    return;
                }
                if (c == this.cd) {
                    this.dc(c);
                }
            }
        }
        dc(a) {
            if (a < 0 || a > this.ao.a.count - 1) {
                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.bl = true;
            }
            let d = new SliceClickedMessage();
            d.c = a;
            d.item = this.ao.a.item(a);
            d.f = this.d3;
            this.x.i(d);
        }
        de(a) {
            if (this.ao != null && a >= 0 && a < this.ao.a.count) {
                let b = new SliceMouseMessage();
                b.e = a;
                b.item = this.ao.a.item(a);
                b.c = 0;
                b.i = this.d3;
                this.x.i(b);
            }
        }
        df(a, b) {
            if (this.ao != null && a >= 0 && a < this.ao.a.count) {
                let c = new SliceMouseMessage();
                c.e = a;
                c.item = this.ao.a.item(a);
                c.c = 2;
                c.i = this.d3;
                c.h = b;
                this.x.i(c);
            }
        }
        dd(a) {
            if (this.ao != null && a >= 0 && a < this.ao.a.count) {
                let b = new SliceMouseMessage();
                b.e = a;
                b.item = this.ao.a.item(a);
                b.c = 1;
                b.i = this.d3;
                this.x.i(b);
            }
        }
        c9(a) {
            let b = a;
            let c = this.cd;
            this.cd = this.cc(b.c);
            if (c != this.cd) {
                if (c != -1) {
                    this.de(c);
                }
                if (this.cd != -1) {
                    this.dd(this.cd);
                }
            }
            else {
                if (this.cd != -1) {
                    this.df(this.cd, b.c);
                }
            }
            if (this.bc) {
                this.dn(b.c);
            }
        }
        c8(a) {
            let b = this.cd;
            this.cd = -1;
            if (b != -1) {
                this.de(b);
            }
            let c = new ClearTooltipMessage();
            this.y.i(c);
        }
        dn(a) {
            let b = new FunnelDataContext();
            if (this.s != null && this.cd >= 0 && this.cd < this.s.count) {
                b.item = this.s.getItem(this.cd);
            }
            b.b = this.cd;
            if (b.b < 0) {
                let c = new ClearTooltipMessage();
                this.y.i(c);
                return;
            }
            let d = new TooltipUpdateMessage();
            d.g = b;
            d.i = this.d0(a, b);
            this.y.i(d);
        }
        d0(a, b) {
            let c = { $type: Point_$type, x: a.x + 10, y: a.y + 10 };
            return c;
        }
        cc(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.b0();
            let g = this.b1(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.d3 = j;
                return e.j;
            }
            else {
                return -1;
            }
        }
        b0() {
            let a = this.i();
            return this.b8 - 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;
        }
        dp(a) {
            let b = a;
            this.ai.i(b.c, this.ao);
            this.bl = true;
        }
        c5(a) {
            this.cw(a);
        }
        cw(a) {
            let b = this.i();
            if (a.c == -1) {
                this.bl = true;
            }
            else {
                let c = b.b._inner[a.c];
                if (a.b) {
                    if (a.d.width > b.j) {
                        this.bl = true;
                    }
                    if (a.d.height != a.e.height) {
                        this.bl = true;
                    }
                    if (a.d.height > c.b.a6.y - c.b.a9.y) {
                        this.bl = true;
                    }
                }
                else {
                    if (a.d.height > c.b.a6.y - c.b.a9.y) {
                        this.bl = true;
                    }
                }
            }
        }
    }
    XamFunnelController.$t = /*@__PURE__*/ markType(XamFunnelController, 'XamFunnelController');
    return XamFunnelController;
})();
/**
 * @hidden
 */
export let XamFunnelChart = /*@__PURE__*/ (() => {
    class XamFunnelChart extends Control {
        constructor() {
            super();
            this.aq = null;
            this.as = null;
            this.ap = null;
            this.ax = null;
            this.b4 = null;
            this.a7 = null;
            this.b5 = null;
            this.a4 = null;
            this.bt = 0.5;
            this.a1 = 1;
            this.a5 = null;
            this.a6 = null;
            this.b6 = null;
            this.b7 = null;
            this.bs = new ObservableCollection$1(Base.$, 0);
            this.bo = new Dictionary$2(Base.$, Base.$, 0);
            this.ce = null;
            this.cd = null;
            this.sliceClicked = null;
            this.sliceEnter = null;
            this.sliceLeave = null;
            this.sliceHover = null;
            this.cb = null;
            this.bv = NaN;
            this.bu = 1;
            this.fl = null;
            this.fm = null;
            this.bu = 1;
            this.bv = NaN;
            let a = this.bs;
            a.collectionChanged = delegateCombine(a.collectionChanged, runOn(this, this.eg));
            this.ar = new MessageHandler();
            this.ar.b(SliceClickedMessage.$, runOn(this, this.ek));
            this.ar.b(SliceMouseMessage.$, runOn(this, this.el));
            this.ar.b(SelectedItemsChangedMessage.$, runOn(this, this.eh));
            this.ap = new MessageChannel();
            this.b4 = (b, c) => this.dx(c.action, c.position, c.count, c.propertyName);
            this.b5 = (b, c) => this.d2(c.action, c.position, c.count, c.propertyName);
            this.ei();
            this.ab = XamFunnelChart.$;
            this.ax = 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 isLayer() {
            return false;
        }
        destroy() {
            this.provideContainer(null);
        }
        get ar() {
            return this.aq;
        }
        set ar(a) {
            this.aq = a;
        }
        ei() {
            this.ed(XamFunnelChart.$$p[1], 0, this.by);
            this.ed(XamFunnelChart.$$p[10], enumGetBox(Visibility_$type, this.ft), enumGetBox(Visibility_$type, this.ft));
            this.ed(XamFunnelChart.$$p[17], enumGetBox(OuterLabelAlignment_$type, this.au), enumGetBox(OuterLabelAlignment_$type, this.au));
            this.ed(XamFunnelChart.$$p[4], enumGetBox(FunnelSliceDisplay_$type, this.ak), enumGetBox(FunnelSliceDisplay_$type, this.ak));
            this.ed(XamFunnelChart.$$p[26], this.fq, this.fq);
            this.ed(XamFunnelChart.$$p[16], this.fp, this.fp);
            this.ej();
        }
        ej() {
            let a = new PropertyChangedMessage();
            a.g = "ItemProvider";
            a.e = null;
            a.d = this;
            this.ap.i(a);
        }
        get at() {
            return this.as;
        }
        set at(a) {
            let b = this.as;
            this.as = a;
            this.ee(b, this.as);
        }
        ee(a, b) {
            if (a != null) {
                let c = typeCast(MessageChannel.$, a.b("ModelUpdateMessages"));
                if (c != null) {
                    c.h(runOn(this, this.d4));
                }
                this.ap.g();
            }
            if (b != null) {
                let d = typeCast(MessageChannel.$, b.b("ModelUpdateMessages"));
                if (d != null) {
                    d.e(runOn(this, this.d4));
                }
                let e = typeCast(MessageChannel.$, b.b("ConfigurationMessages"));
                this.ap.f(e);
            }
        }
        d4(a) {
            this.ar.c(a);
        }
        dx(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.ed("ValueColumn", this.bd, this.bd);
            this.ed("InnerLabelColumn", this.a9, this.a9);
            this.ed("OuterLabelColumn", this.ba, this.ba);
            this.ap.i(e);
        }
        get bd() {
            return this.a7;
        }
        set bd(a) {
            if (this.a7 != a) {
                let b = this.a7;
                this.a7 = a;
                this.ed("ValueColumn", b, this.a7);
            }
        }
        d2(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.ed("HighlightValueColumn", this.a8, this.a8);
            this.ap.i(e);
        }
        get a8() {
            return this.a4;
        }
        set a8(a) {
            if (this.a4 != a) {
                let b = this.a4;
                this.a4 = a;
                this.en();
                this.ed("HighlightValueColumn", b, this.a4);
            }
        }
        get bw() {
            return this.bt;
        }
        set bw(a) {
            let b = this.bt;
            this.bt = a;
            if (b != this.bt) {
                this.ed("ActualHighlightValueOpacity", b, a);
            }
        }
        eo() {
            this.bw = isNaN_(this.b0) ? 0.5 : Math.max(0, Math.min(this.b0, 1));
        }
        get a2() {
            return this.a1;
        }
        set a2(a) {
            this.a1 = a;
        }
        en() {
            let a = this.a2;
            if (this.a3 != 1) {
                if (this.a8 == null || this.bd == null || this.a8.count != this.bd.count) {
                    this.a2 = 1;
                }
                else {
                    this.a2 = 2;
                }
            }
            else {
                this.a2 = 1;
            }
            if (this.a2 != a) {
                this.ed("ActualHighlightValueDisplayMode", enumGetBox(HighlightedValueDisplayMode_$type, a), enumGetBox(HighlightedValueDisplayMode_$type, this.a2));
            }
        }
        get a3() {
            return EnumUtil.getEnumValue(HighlightedValueDisplayMode_$type, this.c(XamFunnelChart.ex));
        }
        set a3(a) {
            this.h(XamFunnelChart.ex, enumGetBox(HighlightedValueDisplayMode_$type, a));
            this.en();
        }
        get a9() {
            return this.a5;
        }
        set a9(a) {
            if (this.a5 != a) {
                let b = this.a5;
                this.a5 = a;
                this.ed("InnerLabelColumn", b, this.a9);
            }
        }
        get ba() {
            return this.a6;
        }
        set ba(a) {
            if (this.a6 != a) {
                let b = this.a6;
                this.a6 = a;
                this.ed("OuterLabelColumn", b, this.ba);
            }
        }
        get b8() {
            return this.b6;
        }
        set b8(a) {
            let b = this.b6;
            this.b6 = a;
            this.ed("FormatInnerLabel", b, a);
        }
        get b9() {
            return this.b7;
        }
        set b9(a) {
            let b = this.b7;
            this.b7 = a;
            this.ed("FormatOuterLabel", b, a);
        }
        get br() {
            return this.bs;
        }
        get dk() {
            return this.ce;
        }
        set dk(a) {
            let b = this.ce;
            this.ce = a;
            this.ed("TextStyle", b, a);
        }
        get dc() {
            return this.cd;
        }
        set dc(a) {
            let b = this.cd;
            this.cd = a;
            this.ed("OuterLabelTextStyle", b, a);
        }
        onDetachedFromUI() {
            this.ax.e.az();
        }
        onAttachedToUI() {
            this.ax.e.ax(this);
        }
        ed(a, b, c) {
            if (this.bh(a, b, c) || this.bg(a, b, c) || this.bf(a, b, c) || this.bj(a, b, c) || this.bi(a, b, c)) {
                return;
            }
            if (a == "PixelScalingRatio") {
                if (isNaN_(DeviceUtils.a(this.b3))) {
                    this.bx = 1;
                }
                else {
                    this.bx = DeviceUtils.a(this.b3);
                }
            }
            if (a == XamFunnelChart.$$p[6]) {
                this.eo();
                return;
            }
            this.ap.i(((() => {
                let $ret = new PropertyChangedMessage();
                $ret.g = a;
                $ret.e = b;
                $ret.d = c;
                return $ret;
            })()));
        }
        bf(a, b, c) {
            if (a == XamFunnelChart.$$p[2] || a == XamFunnelChart.$$p[21]) {
                this.ap.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;
        }
        bh(a, b, c) {
            if (a == XamFunnelChart.$$p[12]) {
                if (b != null) {
                    this.az = null;
                    if (this.a0 != null && this.highlightedItemsSource == null) {
                        this.a0 = null;
                    }
                }
                if (c != null) {
                    this.br.clear();
                    this.az = ((() => {
                        let $ret = new FastItemsSource();
                        $ret.e = this.itemsSource;
                        return $ret;
                    })());
                    if (this.highlightedItemsSource == null) {
                        this.a0 = ((() => {
                            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.b4);
                }
                if (c != null) {
                    let e = c;
                    e.event = delegateCombine(e.event, this.b4);
                }
                this.d1(a, b, c);
                return true;
            }
            else if (a == XamFunnelChart.$$p[30] || a == XamFunnelChart.$$p[9] || a == XamFunnelChart.$$p[18]) {
                this.d1(a, b, c);
                return false;
            }
            return false;
        }
        bg(a, b, c) {
            if (a == XamFunnelChart.$$p[7]) {
                if (b != null) {
                    this.a0 = null;
                }
                if (c != null) {
                    this.br.clear();
                    this.a0 = ((() => {
                        let $ret = new FastItemsSource();
                        $ret.e = this.highlightedItemsSource;
                        return $ret;
                    })());
                }
                else if (this.itemsSource != null) {
                    this.br.clear();
                    this.a0 = ((() => {
                        let $ret = new FastItemsSource();
                        $ret.e = this.itemsSource;
                        return $ret;
                    })());
                }
                this.en();
                return true;
            }
            else if (a == XamFunnelChart.$$p[5]) {
                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.d0(a, b, c);
                return true;
            }
            else if (a == XamFunnelChart.$$p[8]) {
                this.d0(a, b, c);
                return false;
            }
            return false;
        }
        bb(a, b) {
            return a.registerColumn(b, null, false);
        }
        bc(a, b) {
            return a.registerColumnObject(b, null, false);
        }
        d1(a, b, c) {
            if (this.az == null) {
                let d = typeCast(FastItemsSource.$, b);
                if (d != null) {
                    if (this.bd != null) {
                        d.deregisterColumn(this.bd);
                    }
                    if (this.a9 != null) {
                        d.deregisterColumn(this.a9);
                    }
                    if (this.ba != null) {
                        d.deregisterColumn(this.ba);
                    }
                    this.bd = null;
                    this.a9 = null;
                    this.ba = null;
                }
                return;
            }
            if (b != null && typeof b === 'string') {
                switch (a) {
                    case XamFunnelChart.$$p[30]:
                        this.az.deregisterColumn(this.bd);
                        this.bd = null;
                        break;
                    case XamFunnelChart.$$p[9]:
                        this.az.deregisterColumn(this.a9);
                        this.a9 = null;
                        break;
                    case XamFunnelChart.$$p[18]:
                        this.az.deregisterColumn(this.ba);
                        this.ba = null;
                        break;
                }
            }
            if (c != null && typeCast(FastItemsSource.$, c) !== null) {
                if (this.dv != null) {
                    this.bd = this.bb(c, this.dv);
                }
                if (this.cy != null) {
                    this.a9 = this.bc(c, this.cy);
                }
                if (this.c9 != null) {
                    this.ba = this.bc(c, this.c9);
                }
            }
            if (c != null && typeof c === 'string') {
                switch (a) {
                    case XamFunnelChart.$$p[30]:
                        this.bd = this.bb(this.az, this.dv);
                        break;
                    case XamFunnelChart.$$p[9]:
                        this.a9 = this.bc(this.az, this.cy);
                        break;
                    case XamFunnelChart.$$p[18]:
                        this.ba = this.bc(this.az, this.c9);
                        break;
                }
            }
        }
        d0(a, b, c) {
            if (this.a0 == null) {
                let d = typeCast(FastItemsSource.$, b);
                if (d != null) {
                    if (this.a8 != null) {
                        d.deregisterColumn(this.a8);
                    }
                    this.a8 = null;
                }
                this.en();
                return;
            }
            if (b != null && typeof b === 'string') {
                switch (a) {
                    case XamFunnelChart.$$p[8]:
                        this.a0.deregisterColumn(this.a8);
                        this.a8 = null;
                        break;
                }
            }
            if (c != null && typeCast(FastItemsSource.$, c) !== null) {
                if (this.cr != null) {
                    this.a8 = this.bb(c, this.cr);
                }
            }
            if (c != null && typeof c === 'string') {
                switch (a) {
                    case XamFunnelChart.$$p[8]:
                        this.a8 = this.bb(this.a0, this.cr);
                        break;
                }
            }
            this.en();
        }
        bj(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.ap.i(((() => {
                    let $ret = new PropertyChangedMessage();
                    $ret.g = a;
                    $ret.d = e;
                    $ret.e = d;
                    return $ret;
                })()));
                return true;
            }
            return false;
        }
        bi(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.ap.i(d);
                return true;
            }
            return false;
        }
        ek(a) {
            let b = a;
            if (this.sliceClicked != null) {
                let c = new FunnelSliceClickedEventArgs();
                c.index = b.c;
                c.bounds = b.f;
                if (this.az.count > b.c && b.c >= 0) {
                    c.item = this.az.item(b.c);
                }
                this.sliceClicked(this, c);
            }
        }
        el(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.az.count > b.e && b.e >= 0) {
                                c.item = this.az.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.az.count > b.e && b.e >= 0) {
                                d.item = this.az.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.az.count > b.e && b.e >= 0) {
                                e.item = this.az.item(b.e);
                            }
                            this.sliceHover(this, e);
                        }
                        break;
                    }
            }
        }
        eh(a) {
        }
        eg(a, b) {
        }
        d3(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.az.item(a);
        }
        get count() {
            return this.az != null ? this.az.count : 0;
        }
        dz() {
            this.ax.i();
        }
        provideContainer(a) {
            let b = this.cb;
            this.cb = a;
            this.ed("Container", b, this.cb);
        }
        notifyResized() {
            this.ax.g();
            this.ap.i(new ContainerSizeChangedMessage());
        }
        ea(source_, a, b, c) {
            this.d6(source_, new NotifyCollectionChangedEventArgs(2, 2, c, b, a));
        }
        d5(source_) {
            this.d6(source_, new NotifyCollectionChangedEventArgs(0, 4));
        }
        d7(source_, a, b) {
            this.d6(source_, new NotifyCollectionChangedEventArgs(1, 0, b, a));
        }
        d8(source_, a, b) {
            this.d6(source_, new NotifyCollectionChangedEventArgs(1, 1, b, a));
        }
        d6(s_, a) {
            if (s_.dataView && s_.dataSource) {
                s_ = s_.dataView();
            }
            ;
            if (s_ == this.itemsSource) {
                let b = this.az;
                if (b != null) {
                    b.handleCollectionChanged(a);
                }
            }
        }
        ay() {
            let a = this.ax;
            return a == null ? null : a.c;
        }
        av() {
            let a = this.ay();
            return a == null ? null : a.ai;
        }
        get ag() {
            let a = this.av();
            return a == null ? null : a.a();
        }
        set ag(a) {
            let b = this.av();
            if (b == null) {
                return;
            }
            let c = this.ay();
            b.f();
            let d = a == null ? 0 : a.length;
            while (d-- > 0) {
                b.k(a[d], c.ao.a.item(a[d]));
            }
            c.bl = true;
            c.dj();
        }
        em(a) {
            let b = this.av();
            if (b == null) {
                return;
            }
            let c = this.ay();
            let d = c.ao.a.item(a);
            if (d != null) {
                c.ai.k(a, d);
                c.bl = true;
                c.dj();
            }
        }
        aw() {
            let a = new FunnelChartVisualData();
            let b = this.ax.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.bk;
            a.selectedItems = this.br;
            a.name = this.name;
            a.viewport = new RectData(0, 0, this.ax.c.b8, this.ax.c.b7);
            return a;
        }
        cl() {
            let a = this.aw();
            a.scaleByViewport();
            return a.serialize();
        }
        resolveLegendIndex() {
            return -1;
        }
        forSubItems(a) {
        }
        get b3() {
            return this.bv;
        }
        set b3(a) {
            if (isNaN_(a) || a == 0) {
                return;
            }
            let b = this.bv;
            this.bv = a;
            this.ed("PixelScalingRatio", b, this.bv);
        }
        get bx() {
            return this.bu;
        }
        set bx(a) {
            let b = this.bu;
            this.bu = a;
            if (this.bu != b) {
                this.ed("ActualPixelScalingRatio", b, this.bu);
            }
        }
        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 fn() {
            return this.fl;
        }
        set fn(a) {
            let b = this.fn;
            if (a != b) {
                this.fl = a;
                this.ed("OuterLabelTextColor", b, this.fn);
            }
        }
        get fo() {
            return this.fm;
        }
        set fo(a) {
            let b = this.fo;
            if (a != b) {
                this.fm = a;
                this.ed("LabelTextColor", b, this.fo);
            }
        }
    }
    XamFunnelChart.$t = /*@__PURE__*/ markType(XamFunnelChart, 'XamFunnelChart', Control.$, [IItemProvider_$type, ILegendOwner_$type, ILegendTemplateProvider_$type, ILegendSeries_$type]);
    XamFunnelChart.ex = /*@__PURE__*/ DependencyProperty.i("HighlightValueDisplayMode", HighlightedValueDisplayMode_$type, XamFunnelChart.$, /*@__PURE__*/ new PropertyMetadata(2, /*@__PURE__*/ enumGetBox(HighlightedValueDisplayMode_$type, 0), (a, b) => a.ed("HighlightValueDisplayMode", b.oldValue, b.newValue)));
    XamFunnelChart.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, XamFunnelChart, 'ed', ['AllowSliceSelection:be:ep', [0, false], 'BottomEdgeWidth:by:eq', [1, 0.35], 'Brushes:ah:er', [BrushCollection.$, null], 'FastItemsSource:az:es', [FastItemsSource.$], 'FunnelSliceDisplay:ak:et', [FunnelSliceDisplay_$type, /*@__PURE__*/ enumGetBox(FunnelSliceDisplay_$type, 0)], 'HighlightFastItemsSource:a0:ew', [FastItemsSource.$], 'HighlightValueOpacity:b0:ey', [1, 0.5], 'HighlightedItemsSource::eu', [IEnumerable_$type, null], 'HighlightedValueMemberPath:cr:ev', [2, null], 'InnerLabelMemberPath:cy:ez', [2, null], 'InnerLabelVisibility:ft:e0', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 0)], 'IsInverted:bk:e1', [0, false], 'ItemsSource::e2', [IEnumerable_$type, null], 'LegendItemBadgeTemplate::e3', [DataTemplate.$, null], 'LegendItemTemplate::e4', [DataTemplate.$, null], 'Legend::e5', [IChartLegend_$type, null], 'LowerBezierControlPoint:fp:e6', [Point_$type, { $type: Point_$type, x: 0.5, y: 1 }], 'OuterLabelAlignment:au:e7', [OuterLabelAlignment_$type, /*@__PURE__*/ enumGetBox(OuterLabelAlignment_$type, 0)], 'OuterLabelMemberPath:c9:e8', [2, null], 'OuterLabelVisibility:fu:e9', [Visibility_$type, /*@__PURE__*/ enumGetBox(Visibility_$type, 1)], 'OutlineThickness:b1:fb', [1, -1], 'Outlines:ai:fa', [BrushCollection.$, null], 'SelectedSliceStyle:fr:fc', [Style.$, null], 'ToolTip:cc:fd', [4, null], 'TransitionDuration:ca:fe', [1, 0], 'UnselectedSliceStyle:fs:ff', [Style.$, null], 'UpperBezierControlPoint:fq:fg', [Point_$type, { $type: Point_$type, x: 0.5, y: 0 }], 'UseBezierCurve:bl:fh', [0, false], 'UseOuterLabelsForLegend:bm:fi', [0, false], 'UseUnselectedStyle:bn:fj', [0, false], 'ValueMemberPath:dv:fk', [2, null]]);
    return XamFunnelChart;
})();
/**
 * @hidden
 */
export let XamFunnelConnector = /*@__PURE__*/ (() => {
    class XamFunnelConnector extends Base {
        get e() {
            return this.d;
        }
        get c() {
            return this.b;
        }
        g() {
            this.c.av.av(this.a);
        }
        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.at = c;
            this.a = b;
            c.c("Model", 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.dj();
        }
    }
    XamFunnelConnector.$t = /*@__PURE__*/ markType(XamFunnelConnector, 'XamFunnelConnector');
    return XamFunnelConnector;
})();
