/*
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 * as tslib_1 from "tslib";
import { DependencyObject } from "igniteui-react-core/ES5/DependencyObject";
import { INotifyPropertyChanged_$type, PropertyChangedEventArgs, runOn, delegateCombine, fromEnum, delegateRemove, markType } from "igniteui-react-core/ES5/type";
import { BrushCollection } from "igniteui-react-core/ES5/BrushCollection";
import { Series } from "./Series";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { PropertyUpdatedEventArgs } from "igniteui-react-core/ES5/PropertyUpdatedEventArgs";
import { BrushCollectionUtil } from "igniteui-react-core/ES5/BrushCollectionUtil";
/**
 * @hidden
 */
var BrushScale = /** @class */ (function (_super) {
    tslib_1.__extends(BrushScale, _super);
    function BrushScale() {
        var _this = _super.call(this) || this;
        _this.j = null;
        _this.o = null;
        _this.propertyChanged = null;
        _this.propertyUpdated = null;
        _this.o = new List$1(Series.$, 0);
        _this.brushes = new BrushCollection();
        var a = _this.brushes;
        a.collectionChanged = delegateCombine(a.collectionChanged, runOn(_this, _this.p));
        _this.propertyUpdated = delegateCombine(_this.propertyUpdated, function (b, c) { return _this.q(b, c.propertyName, c.oldValue, c.newValue); });
        return _this;
    }
    BrushScale.prototype.p = function (a, b) {
        var e_1, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.o)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                c.i6(false);
                c.h6();
                c.ic();
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
    };
    Object.defineProperty(BrushScale.prototype, "brushes", {
        get: function () {
            return this.j;
        },
        set: function (a) {
            var e_2, _a;
            var b = this.j;
            if (this.j != null) {
                var c = this.j;
                c.collectionChanged = delegateRemove(c.collectionChanged, runOn(this, this.p));
            }
            this.j = a;
            if (this.j != null) {
                var d = this.j;
                d.collectionChanged = delegateCombine(d.collectionChanged, runOn(this, this.p));
            }
            try {
                for (var _b = tslib_1.__values(fromEnum(this.o)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var e = _c.value;
                    e.i6(false);
                    e.h6();
                    e.ic();
                }
            }
            catch (e_2_1) { e_2 = { error: e_2_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_2) throw e_2.error; }
            }
        },
        enumerable: true,
        configurable: true
    });
    BrushScale.prototype.registerSeries = function (a) {
        var b = this.o.contains(a);
        if (!b) {
            this.o.add(a);
        }
    };
    BrushScale.prototype.unregisterSeries = function (a) {
        var b = this.o.contains(a);
        if (b) {
            this.o.remove(a);
        }
    };
    BrushScale.prototype.getBrush = function (a) {
        if (this.brushes == null || a < 0 || a >= this.brushes.count) {
            return null;
        }
        return this.brushes.item(a);
    };
    BrushScale.prototype.get_isReady = function () {
        return true;
    };
    Object.defineProperty(BrushScale.prototype, "isReady", {
        get: function () {
            return this.get_isReady();
        },
        enumerable: true,
        configurable: true
    });
    BrushScale.prototype.v = function (a) {
        if (this.brushes == null || this.brushes.count == 0 || a < 0) {
            return null;
        }
        return BrushCollectionUtil.b(this.brushes, a);
    };
    BrushScale.prototype.r = function (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));
        }
    };
    BrushScale.prototype.q = function (a, b, c, d) {
        var e_3, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.o)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var e = _c.value;
                e.i6(false);
                e.h6();
                e.ic();
            }
        }
        catch (e_3_1) { e_3 = { error: e_3_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_3) throw e_3.error; }
        }
    };
    BrushScale.prototype.get_isBrushScale = function () {
        return true;
    };
    Object.defineProperty(BrushScale.prototype, "isBrushScale", {
        get: function () {
            return this.get_isBrushScale();
        },
        enumerable: true,
        configurable: true
    });
    BrushScale.$t = markType(BrushScale, 'BrushScale', DependencyObject.$, [INotifyPropertyChanged_$type]);
    return BrushScale;
}(DependencyObject));
export { BrushScale };
