/*
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 { DependencyObject } from "igniteui-react-core";
import { INotifyPropertyChanged_$type, PropertyChangedEventArgs, runOn, delegateCombine, fromEnum, typeCast, delegateRemove, markType } from "igniteui-react-core";
import { BrushCollection } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { Series } from "./Series";
import { PropertyUpdatedEventArgs } from "igniteui-react-core";
import { ISupportsFillScale_$type } from "./ISupportsFillScale";
import { BrushCollectionUtil } from "igniteui-react-core";
import { isNaN_, isInfinity } from "igniteui-react-core";
/**
 * @hidden
 */
export let BrushScale = /*@__PURE__*/ (() => {
    class BrushScale extends DependencyObject {
        constructor() {
            super();
            this.j = null;
            this.o = null;
            this.propertyChanged = null;
            this.propertyUpdated = null;
            this.q = 0;
            this.p = 0;
            this.o = new List$1(Series.$, 0);
            this.brushes = new BrushCollection();
            let a = this.brushes;
            a.collectionChanged = delegateCombine(a.collectionChanged, runOn(this, this.r));
            this.propertyUpdated = delegateCombine(this.propertyUpdated, (b, c) => this.u(b, c.propertyName, c.oldValue, c.newValue));
        }
        r(a, b) {
            for (let c of fromEnum(this.o)) {
                c.rm(false);
                c.p8();
                c.qg();
            }
        }
        s() {
            if (isNaN_(this.q) || isNaN_(this.p)) {
                for (let a of fromEnum(this.o)) {
                    if (typeCast(ISupportsFillScale_$type, a) !== null) {
                        a.updateFillScaleGlobals();
                    }
                }
            }
        }
        get brushes() {
            return this.j;
        }
        set brushes(a) {
            let b = this.j;
            if (this.j != null) {
                let c = this.j;
                c.collectionChanged = delegateRemove(c.collectionChanged, runOn(this, this.r));
            }
            this.j = a;
            if (this.j != null) {
                let d = this.j;
                d.collectionChanged = delegateCombine(d.collectionChanged, runOn(this, this.r));
            }
            this.notifySeries();
        }
        registerSeries(a) {
            let b = this.o.contains(a);
            if (!b) {
                this.o.add(a);
            }
        }
        unregisterSeries(a) {
            let b = this.o.contains(a);
            if (b) {
                this.o.remove(a);
            }
        }
        getBrush(a) {
            if (this.brushes == null || a < 0 || a >= this.brushes.count) {
                return null;
            }
            return this.brushes.item(a);
        }
        get_isReady() {
            return true;
        }
        get isReady() {
            return this.get_isReady();
        }
        ab(a) {
            if (this.brushes == null || this.brushes.count == 0 || a < 0) {
                return null;
            }
            return BrushCollectionUtil.b(this.brushes, a);
        }
        v(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            if (this.propertyUpdated != null) {
                this.propertyUpdated(this, new PropertyUpdatedEventArgs(a, b, c));
            }
        }
        u(a, b, c, d) {
            this.notifySeries();
        }
        notifySeries() {
            for (let a of fromEnum(this.o)) {
                a.qb();
                a.rm(false);
                a.p8();
                a.qg();
            }
        }
        z(a, b) {
            if (!isNaN_(a) && !isInfinity(a)) {
                if (isNaN_(this.q)) {
                    this.q = a;
                }
                else {
                    this.q = Math.min(a, this.q);
                }
            }
            if (!isNaN_(b) && !isInfinity(b)) {
                if (isNaN_(this.p)) {
                    this.p = b;
                }
                else {
                    this.p = Math.max(b, this.p);
                }
            }
        }
        x() {
            this.q = NaN;
            this.p = NaN;
        }
        get_isBrushScale() {
            return true;
        }
        get isBrushScale() {
            return this.get_isBrushScale();
        }
    }
    BrushScale.$t = /*@__PURE__*/ markType(BrushScale, 'BrushScale', DependencyObject.$, [INotifyPropertyChanged_$type]);
    return BrushScale;
})();
