/*
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 { FinancialChartDropDownControlView } from "./FinancialChartDropDownControlView";
import { EnumUtil, markType } from "igniteui-angular-core";
import { FinancialIndicatorType_$type } from "./FinancialIndicatorType";
import { FinancialOverlayType_$type } from "./FinancialOverlayType";
import { TrendLineType_$type } from "igniteui-angular-core";
import { FinancialChartVolumeType_$type } from "./FinancialChartVolumeType";
import { FinancialIndicatorTypeCollection } from "./FinancialIndicatorTypeCollection";
import { FinancialOverlayTypeCollection } from "./FinancialOverlayTypeCollection";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
export let FinancialChartIndicatorMenuView = /*@__PURE__*/ (() => {
    class FinancialChartIndicatorMenuView extends FinancialChartDropDownControlView {
        f(a, b, c, d) {
            super.f(a, b, c, d);
        }
        k(a) {
            super.k(a);
            let b = a;
            if (b.tagName != "LI") {
                return;
            }
            let c = b.parentNode.parentNode;
            let d;
            let e = false;
            switch (c.getAttribute("data-value")) {
                case "FinancialOverlayType":
                    d = FinancialOverlayType_$type;
                    e = false;
                    break;
                case "TrendLineType":
                    d = TrendLineType_$type;
                    e = true;
                    break;
                case "FinancialChartVolumeType":
                    d = FinancialChartVolumeType_$type;
                    e = true;
                    break;
                default:
                case "FinancialIndicatorType":
                    d = FinancialIndicatorType_$type;
                    e = false;
                    break;
            }
            let f = b.classList.toggle("checked");
            let g = b.parentNode;
            if (e) {
                for (let h = 0; h < g.children.length; h++) {
                    let i = g.children.item(h);
                    if (i != b) {
                        i.classList.remove("checked");
                    }
                }
                let j = f ? b.getAttribute("data-value") : "None";
                if (stringIsNullOrEmpty(j)) {
                    return;
                }
                let k = EnumUtil.parse(d, j, true);
                if (d == FinancialChartVolumeType_$type) {
                    this.l.i = EnumUtil.getEnumValue(FinancialChartVolumeType_$type, k);
                }
                else {
                    this.l.l = EnumUtil.getEnumValue(TrendLineType_$type, k);
                }
            }
            else {
                if (d == FinancialIndicatorType_$type) {
                    this.l.j = new FinancialIndicatorTypeCollection(0);
                    ;
                }
                else {
                    this.l.k = new FinancialOverlayTypeCollection(0);
                }
                for (let l = 0; l < g.children.length; l++) {
                    let m = g.children.item(l);
                    if (m.classList.contains("checked")) {
                        let n = m.getAttribute("data-value");
                        if (stringIsNullOrEmpty(n)) {
                            continue;
                        }
                        let o = EnumUtil.parse(d, n, true);
                        if (d == FinancialIndicatorType_$type) {
                            let p = EnumUtil.getEnumValue(FinancialIndicatorType_$type, o);
                            this.l.j.add(p);
                        }
                        else {
                            let q = EnumUtil.getEnumValue(FinancialOverlayType_$type, o);
                            this.l.k.add(q);
                        }
                    }
                }
            }
            this.a.onSelectionChanged();
        }
        get l() {
            return this.a;
        }
    }
    FinancialChartIndicatorMenuView.$t = markType(FinancialChartIndicatorMenuView, 'FinancialChartIndicatorMenuView', FinancialChartDropDownControlView.$);
    return FinancialChartIndicatorMenuView;
})();
