/*
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, PropertyChangedEventArgs, runOn, delegateCombine, typeCast, fromEnum, String_$type, delegateRemove, enumGetBox, markType } from "./type";
import { IDataSource_$type } from "./IDataSource";
import { IEditableDataSource_$type } from "./IEditableDataSource";
import { TransactionService } from "./TransactionService";
import { IDataSourceDataProviderUpdateNotifier_$type } from "./IDataSourceDataProviderUpdateNotifier";
import { SortDescriptionCollection } from "./SortDescriptionCollection";
import { FilterExpressionCollection } from "./FilterExpressionCollection";
import { SummaryDescriptionCollection } from "./SummaryDescriptionCollection";
import { DataSourceSummaryScope_$type } from "./DataSourceSummaryScope";
import { DataSourceSectionHeaderDisplayMode_$type } from "./DataSourceSectionHeaderDisplayMode";
import { TransactionKeyEqualityComparer } from "./TransactionKeyEqualityComparer";
import { Transaction } from "./Transaction";
import { DataSourceSpecialRow } from "./DataSourceSpecialRow";
import { List$1 } from "./List$1";
import { Dictionary$2 } from "./Dictionary$2";
import { DataSourceAggregatedResult } from "./DataSourceAggregatedResult";
import { DataSourceDataCommittedEventArgs } from "./DataSourceDataCommittedEventArgs";
import { DataSourceRowExpansionChangedEventArgs } from "./DataSourceRowExpansionChangedEventArgs";
import { DataSourceSchemaChangedEventArgs } from "./DataSourceSchemaChangedEventArgs";
import { TransactionType } from "./TransactionType";
/**
 * @hidden
 */
export let BaseDataSource = /*@__PURE__*/ (() => {
    class BaseDataSource extends Base {
        constructor() {
            super();
            this.t = null;
            this._isReadOnly = false;
            this.y = false;
            this.dataCommitted = null;
            this.an = false;
            this.aw = null;
            this._externalDataSource = null;
            this.r = null;
            this.q = null;
            this.h = null;
            this.s = null;
            this.i = null;
            this.n = null;
            this.ar = 0;
            this.as = 0;
            this.at = 0;
            this.o = null;
            this.propertyChanged = null;
            this.k = null;
            this.m = null;
            this.schemaChanged = null;
            this.rowExpansionChanged = null;
            this.z = false;
            this.g = 0;
            this.w = false;
            this.b = null;
            this.a = null;
            this.c = null;
            this.af = false;
            this.ag = false;
            this.u = false;
            this.f = 0;
            this.aa = false;
            this.ac = true;
            this.x = false;
            this.ae = false;
            this.ad = false;
            this.ab = true;
            this.ai = true;
            this.ah = false;
            this.aj = true;
            this.v = false;
            this.d = null;
            this.k = new DefaultDataSourceDataProviderUpdateNotifier(this);
            this.r = new SortDescriptionCollection();
            this.q = new SortDescriptionCollection();
            this.s = new SummaryDescriptionCollection();
            this.r.n(runOn(this, this.cn));
            this.q.n(runOn(this, this.br));
            this.s.n(runOn(this, this.co));
            this.h = new FilterExpressionCollection();
            this.h.m(runOn(this, this.bp));
            this.t = new TransactionService(runOn(this, this.bt), runOn(this, this.clone1), new TransactionKeyEqualityComparer());
            let a = this.t;
            a.stateChanged = delegateCombine(a.stateChanged, runOn(this, this.cj));
        }
        cj(a, b) {
            if (a == 0 || a == 1) {
                if (this.updateNotifier != null) {
                    let c = b;
                    let d = c.transactions._inner[0];
                    if (d.type == 1 || d.type == TransactionType.Delete) {
                        let e = d.id;
                        let f = this.indexOfKey(e);
                        if (f > -1) {
                            let g = this.getItemAtIndex(f);
                            this.updateNotifier.notifySetItem(f, g, g);
                            let h = this.getStickyRows();
                            if (h != null) {
                                for (let i = 0; i < h.length; i++) {
                                    let j = h[i];
                                    let k = typeCast(DataSourceSpecialRow.$, this.getItemAtIndex(j));
                                    if (k != null && k.rowType == 3 && k.targetRow == g) {
                                        this.updateNotifier.notifySetItem(j, k, k);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else if (d.type == 0) {
                    }
                }
            }
            this.ci(a, b);
        }
        ci(a, b) {
        }
        ao() {
            return !this.isReadOnly && this.actualPrimaryKey != null && this.actualBaseDataProvider != null && this.t != null;
        }
        bt(a, b) {
            if (a != null && b != null) {
                let c = a;
                let d = b;
                for (let e of fromEnum(d)) {
                    if (c.containsKey(e.key)) {
                        c.item(e.key, e.value);
                    }
                    else {
                        c.addItem(e.key, e.value);
                    }
                }
            }
        }
        clone1(a) {
            if (a != null) {
                let b = a;
                let c = new Dictionary$2(String_$type, Base.$, 0);
                for (let d of fromEnum(b)) {
                    c.addItem(d.key, d.value);
                }
                return c;
            }
            return null;
        }
        get isReadOnly() {
            return this._isReadOnly;
        }
        set isReadOnly(a) {
            this._isReadOnly = a;
        }
        get_isBatchingEnabled() {
            return this.y;
        }
        set_isBatchingEnabled(a) {
            this.y = a;
        }
        get isBatchingEnabled() {
            return this.get_isBatchingEnabled();
        }
        set isBatchingEnabled(a) {
            this.set_isBatchingEnabled(a);
        }
        get canUndo() {
            return this.t.k;
        }
        get canRedo() {
            return this.t.j;
        }
        get canCommit() {
            return this.t.a(-1).length > 0;
        }
        updatePropertyAtKey(a, b, c, d = false) {
            if (this.ao()) {
                let e = null;
                if (a.length == 1 && typeCast(DataSourceSpecialRow.$, a[0]) !== null) {
                    let f = typeCast(DataSourceSpecialRow.$, a[0]);
                    if (f.rowType == 3) {
                        e = f;
                        if (this.actualPrimaryKey != null) {
                            a = new Array(this.actualPrimaryKey.length);
                            this.getPrimaryKeyValue(e.targetRow, a);
                        }
                        else {
                            a = ((() => {
                                let $ret = new Array(1);
                                $ret.push(e.targetRow);
                                return $ret;
                            })());
                        }
                    }
                }
                let g = new Dictionary$2(String_$type, Base.$, 0);
                g.addItem(b, c);
                let h = new Transaction();
                h.id = a;
                h.value = g;
                h.type = 1;
                this.t.v(h, d);
                if (this.isBatchingEnabled || d) {
                    if (this.updateNotifier != null) {
                        let i = this.indexOfKey(a);
                        if (i > -1) {
                            let j = this.getItemAtIndex(i);
                            this.updateNotifier.notifySetItem(i, j, j);
                        }
                        if (this.isRowPinned(i)) {
                            let k = -1;
                            if (e != null) {
                                k = this.indexOfItem(e);
                            }
                            else {
                                let l = this.getStickyRows();
                                if (l != null) {
                                    for (let m = 0; m < l.length; m++) {
                                        let n = typeCast(DataSourceSpecialRow.$, this.getItemAtIndex(l[m]));
                                        if (n != null && n.rowType == 3) {
                                            e = n;
                                            k = l[m];
                                            break;
                                        }
                                    }
                                }
                            }
                            if (k > -1) {
                                this.updateNotifier.notifySetItem(k, e, e);
                            }
                        }
                    }
                }
                return h.transactionID;
            }
            return -1;
        }
        removeItemByKey(a) {
            if (this.ao()) {
                let b = null;
                if (a.length == 1 && typeCast(DataSourceSpecialRow.$, a[0]) !== null) {
                    let c = typeCast(DataSourceSpecialRow.$, a[0]);
                    if (c.rowType == 3) {
                        b = c;
                        if (this.actualPrimaryKey != null) {
                            a = new Array(this.actualPrimaryKey.length);
                            this.getPrimaryKeyValue(b.targetRow, a);
                        }
                        else {
                            a = ((() => {
                                let $ret = new Array(1);
                                $ret.push(b.targetRow);
                                return $ret;
                            })());
                        }
                    }
                }
                let d = new Transaction();
                d.id = a;
                d.type = TransactionType.Delete;
                this.t.v(d, false);
                if (this.isBatchingEnabled) {
                    if (this.updateNotifier != null) {
                        let e = this.indexOfKey(a);
                        if (e > -1) {
                            let f = this.getItemAtIndex(e);
                            this.updateNotifier.notifySetItem(e, f, f);
                        }
                        if (this.isRowPinned(e)) {
                            let g = -1;
                            if (b != null) {
                                g = this.indexOfItem(b);
                            }
                            else {
                                let h = this.getStickyRows();
                                if (h != null) {
                                    for (let i = 0; i < h.length; i++) {
                                        let j = typeCast(DataSourceSpecialRow.$, this.getItemAtIndex(h[i]));
                                        if (j != null && j.rowType == 3) {
                                            b = j;
                                            g = h[i];
                                            break;
                                        }
                                    }
                                }
                            }
                            if (g > -1) {
                                this.updateNotifier.notifySetItem(g, b, b);
                            }
                        }
                    }
                }
            }
        }
        removeItem(a) {
            if (this.ao()) {
                let b;
                if (typeCast(DataSourceSpecialRow.$, a) !== null) {
                    b = [a];
                }
                else if (this.actualPrimaryKey == null || this.actualPrimaryKey.length < 1) {
                    b = [a];
                }
                else {
                    b = new Array(this.actualPrimaryKey.length);
                    this.getPrimaryKeyValue(a, b);
                }
                this.removeItemByKey(b);
            }
        }
        addItem(a) {
            if (this.ao()) {
                if (typeCast(DataSourceSpecialRow.$, a) !== null) {
                    return;
                }
                let b = new Transaction();
                b.id = [a];
                b.type = 0;
                this.t.v(b, false);
            }
        }
        acceptPendingTransaction(a) {
            if (this.ao()) {
                let b = this.t.d(a);
                if (b != null) {
                    this.t.ap(a);
                }
            }
        }
        rejectPendingTransaction(a) {
            if (this.ao()) {
                let b = this.t.d(a);
                if (b != null) {
                    this.t.x(a);
                    if (this.updateNotifier != null) {
                        if (b.type != 0) {
                            let c = b.id;
                            let d = this.indexOfKey(c);
                            if (d > -1) {
                                let e = this.getItemAtIndex(d);
                                this.updateNotifier.notifySetItem(d, e, e);
                                let f = this.getStickyRows();
                                if (f != null) {
                                    for (let g = 0; g < f.length; g++) {
                                        let h = typeCast(DataSourceSpecialRow.$, this.getItemAtIndex(f[g]));
                                        if (h != null && h.rowType == 3) {
                                            if (h.targetRow == e) {
                                                this.updateNotifier.notifySetItem(f[g], h, h);
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        commitEdits(a) {
            if (this.ao()) {
                let b = this.t.c(null).length > 0;
                let c = this.t.s(a, this.isBatchingEnabled);
                if (c == -1 && b) {
                    if (this.updateNotifier != null) {
                        this.updateNotifier.notifyClearItems();
                    }
                }
                return c;
            }
            return -1;
        }
        cancelEdits() {
            if (this.ao()) {
                this.t.w(true, null);
                if (this.updateNotifier != null) {
                    this.updateNotifier.notifyClearItems();
                }
            }
        }
        acceptPendingCommit(a) {
            if (this.ao()) {
                let b = this.t.e(a);
                if (b != null) {
                    this.t.u(a);
                    if (this.updateNotifier != null) {
                        for (let c = 0; c < b.a.length; c++) {
                            if (b.a[c].transactionType != 0) {
                                let d = b.a[c].id;
                                let e = this.indexOfKey(d);
                                if (e > -1) {
                                    let f = this.getItemAtIndex(e);
                                    this.updateNotifier.notifySetItem(e, f, f);
                                }
                            }
                        }
                    }
                }
            }
        }
        rejectPendingCommit(a) {
            if (this.ao()) {
                let b = this.t.e(a);
                if (b != null) {
                    this.t.ac(a);
                    if (this.updateNotifier != null) {
                        for (let c = 0; c < b.a.length; c++) {
                            if (b.a[c].transactionType != 0) {
                                let d = b.a[c].id;
                                let e = this.indexOfKey(d);
                                if (e > -1) {
                                    let f = this.getItemAtIndex(e);
                                    this.updateNotifier.notifySetItem(e, f, f);
                                }
                            }
                        }
                    }
                }
            }
        }
        undo() {
            if (this.ao()) {
                this.t.ae();
            }
        }
        redo() {
            if (this.ao()) {
                this.t.ab();
            }
        }
        hasEdit(a, b) {
            if (this.ao()) {
                a = this.e(a);
                let c = this.t.g(a);
                if (c != null) {
                    let d = typeCast(Dictionary$2.$.specialize(String_$type, Base.$), c.value);
                    if (d != null && d.containsKey(b)) {
                        return true;
                    }
                }
                c = this.t.ah(a);
                if (c != null) {
                    let e = typeCast(Dictionary$2.$.specialize(String_$type, Base.$), c.value);
                    if (e != null && e.containsKey(b)) {
                        return true;
                    }
                }
                c = this.t.ag(a);
                if (c != null) {
                    let f = typeCast(Dictionary$2.$.specialize(String_$type, Base.$), c.value);
                    if (f != null && f.containsKey(b)) {
                        return true;
                    }
                }
            }
            return false;
        }
        hasDelete(a) {
            if (this.ao()) {
                a = this.e(a);
                let b = this.t.g(a);
                if (b != null && b.transactionType == TransactionType.Delete) {
                    return true;
                }
                b = this.t.ah(a);
                if (b != null && b.transactionType == TransactionType.Delete) {
                    return true;
                }
                b = this.t.ag(a);
                if (b != null && b.transactionType == TransactionType.Delete) {
                    return true;
                }
            }
            return false;
        }
        hasAdd(a) {
            if (this.ao()) {
                let b = this.t.g(a);
                if (b != null && b.transactionType == 0) {
                    return true;
                }
                b = this.t.ah(a);
                if (b != null && b.transactionType == 0) {
                    return true;
                }
            }
            return false;
        }
        getAggregatedChanges(a) {
            if (this.ao()) {
                let b = this.t.a(a);
                let c = new List$1(DataSourceAggregatedResult.$, 0);
                for (let d = 0; d < b.length; d++) {
                    let e = b[d].id;
                    let f = new DataSourceAggregatedResult();
                    if (b[d].transactionType == 0) {
                        f.transactionType = 0;
                        f.item = e[0];
                    }
                    else if (b[d].transactionType == TransactionType.Delete) {
                        f.transactionType = TransactionType.Delete;
                        let g = this.indexOfKey(e);
                        if (g > -1) {
                            f.item = this.getItemAtIndex(g);
                        }
                        else {
                            f.item = e;
                        }
                    }
                    else if (b[d].transactionType == 1) {
                        f.transactionType = 1;
                        let h = b[d].value;
                        f.keys = new Array(h.count);
                        f.values = new Array(h.count);
                        let i = 0;
                        for (let j of fromEnum(h)) {
                            f.keys[i] = j.key;
                            f.values[i] = j.value;
                            i++;
                        }
                        let k = this.indexOfKey(e);
                        if (k > -1) {
                            f.item = this.getItemAtIndex(k);
                        }
                        else {
                            f.item = e;
                        }
                    }
                    c.add(f);
                }
                return c.toArray();
            }
            return new Array(0);
        }
        isPendingTransaction(a) {
            return this.t.d(a) != null;
        }
        isPendingCommit(a) {
            return this.t.e(a) != null;
        }
        setTransactionError(a, b) {
            let c = this.t.d(a);
            if (c != null) {
                c.error = b;
                if (this.updateNotifier != null) {
                    let d = c.id;
                    let e = this.indexOfKey(d);
                    if (e > -1) {
                        let f = this.getItemAtIndex(e);
                        this.updateNotifier.notifySetItem(e, f, f);
                    }
                }
            }
        }
        getTransactionErrorByKey(a, b) {
            a = this.e(a);
            let c = this.t.c(a);
            for (let d = 0; d < c.length; d++) {
                if (c[d].error != null) {
                    if (c[d].type == 1) {
                        let e = c[d].value;
                        if (e.containsKey(b)) {
                            return c[d].error;
                        }
                    }
                }
            }
            return null;
        }
        getTransactionErrorByID(a) {
            let b = this.t.d(a);
            if (b != null) {
                return b.error;
            }
            return null;
        }
        getTransactionID(a, b) {
            a = this.e(a);
            let c = this.t.c(a);
            for (let d = 0; d < c.length; d++) {
                if (c[d].type == 1) {
                    let e = c[d].value;
                    if (e.containsKey(b)) {
                        return c[d].transactionID;
                    }
                }
            }
            return -1;
        }
        e(a) {
            if (a.length == 1 && typeCast(DataSourceSpecialRow.$, a[0]) !== null) {
                let b = typeCast(DataSourceSpecialRow.$, a[0]);
                if (b.rowType == 3) {
                    if (this.actualPrimaryKey != null) {
                        a = new Array(this.actualPrimaryKey.length);
                        this.getPrimaryKeyValue(b.targetRow, a);
                    }
                    else {
                        a = ((() => {
                            let $ret = new Array(1);
                            $ret.push(b.targetRow);
                            return $ret;
                        })());
                    }
                }
            }
            return a;
        }
        bu(a, b) {
            if (this.dataCommitted != null) {
                this.dataCommitted(this, new DataSourceDataCommittedEventArgs(a, b));
            }
        }
        cn(a, b) {
            this.onSortDescriptionsChanged(b);
        }
        br(a, b) {
            this.onGroupDescriptionsChanged(b);
        }
        co(a, b) {
            this.onSummaryDescriptionsChanged(b);
        }
        bp(a, b) {
            this.onFilterExpressionsChanged(b);
        }
        onSortDescriptionsChanged(a) {
            this.queueAutoRefresh();
        }
        onGroupDescriptionsChanged(a) {
            if (this.isGroupingSupported) {
                if (this.groupDescriptions != null && this.groupDescriptions.k.count > 0) {
                    this.an = true;
                }
                else {
                    this.an = false;
                }
                this.queueAutoRefresh();
            }
        }
        onSummaryDescriptionsChanged(a) {
            this.queueAutoRefresh();
        }
        onFilterExpressionsChanged(a) {
            this.queueAutoRefresh();
        }
        onRowExpansionChanged(a, b, c) {
            if (this.rowExpansionChanged != null) {
                this.rowExpansionChanged(this, new DataSourceRowExpansionChangedEventArgs(a, b, c));
            }
        }
        isPlaceholderItem(a) {
            return false;
        }
        get externalDataSource() {
            return this._externalDataSource;
        }
        set externalDataSource(a) {
            this._externalDataSource = a;
        }
        get actualSchema() {
            return this.n;
        }
        set actualSchema(a) {
            let b = this.n;
            this.n = a;
            if (b != this.n) {
                this.onPropertyUpdated("ActualSchema", b, this.n);
            }
        }
        get actualCount() {
            return this.ar;
        }
        set actualCount(a) {
            let b = this.ar;
            this.ar = a;
            if (b != this.ar) {
                this.onPropertyUpdated("ActualCount", b, this.ar);
            }
        }
        get firstVisibleIndexRequested() {
            return this.as;
        }
        set firstVisibleIndexRequested(a) {
            let b = this.as;
            this.as = a;
            if (b != this.as) {
                this.onPropertyUpdated("FirstVisibleIndexRequested", b, this.as);
            }
        }
        get lastVisibleIndexRequested() {
            return this.at;
        }
        set lastVisibleIndexRequested(a) {
            let b = this.at;
            this.at = a;
            if (b != this.at) {
                this.onPropertyUpdated("LastVisibleIndexRequested", b, this.at);
            }
        }
        get updateNotifier() {
            return this.o;
        }
        set updateNotifier(a) {
            let b = this.o;
            this.o = a;
            if (b != this.o) {
                this.onPropertyUpdated("UpdateNotifier", b, this.o);
            }
        }
        getItemAtIndex(a) {
            return null;
        }
        getItemProperty(a, b) {
            if (this.actualBaseDataProvider != null) {
                let item_ = a;
                if ((item_ != null && item_.$$isSpecialRow !== undefined)) {
                    return this.getSpecialRowItemValue(a, b);
                }
                return this.actualBaseDataProvider.getItemValue(a, b);
            }
            return null;
        }
        getSpecialRowItemValue(a, b) {
            if (a.rowType == 3) {
                if (this.ao()) {
                    let c = this.ax(a.targetRow, b);
                    if (c != null) {
                        return c;
                    }
                }
                return this.getItemProperty(a.targetRow, b);
            }
            return a.n(b);
        }
        ax(a, b) {
            let c;
            if (this.actualPrimaryKey == null || this.actualPrimaryKey.length < 1) {
                c = [a];
            }
            else {
                c = new Array(this.actualPrimaryKey.length);
                this.getPrimaryKeyValue(a, c);
            }
            let d = this.t.g(c);
            if (d != null && d.transactionType == 1) {
                let e = d.value;
                if (e.containsKey(b)) {
                    return e.item(b);
                }
            }
            d = this.t.ah(c);
            if (d != null && d.transactionType == 1) {
                let f = d.value;
                if (f.containsKey(b)) {
                    return f.item(b);
                }
            }
            d = this.t.ag(c);
            if (d != null && d.transactionType == 1) {
                let g = d.value;
                if (g.containsKey(b)) {
                    return g.item(b);
                }
            }
            return null;
        }
        al(a, b) {
            let c;
            if (this.actualPrimaryKey == null || this.actualPrimaryKey.length < 1) {
                c = [a];
            }
            else {
                c = new Array(this.actualPrimaryKey.length);
                this.getPrimaryKeyValue(a, c);
            }
            let d = this.t.g(c);
            if (d != null && d.transactionType == 1) {
                let e = d.value;
                if (e.containsKey(b)) {
                    return true;
                }
            }
            d = this.t.ah(c);
            if (d != null && d.transactionType == 1) {
                let f = d.value;
                if (f.containsKey(b)) {
                    return true;
                }
            }
            d = this.t.ag(c);
            if (d != null && d.transactionType == 1) {
                let g = d.value;
                if (g.containsKey(b)) {
                    return true;
                }
            }
            return false;
        }
        getItemPropertyAtIndex(a, b) {
            return null;
        }
        get_fullSectionInformationWillForceLoad() {
            return false;
        }
        get fullSectionInformationWillForceLoad() {
            return this.get_fullSectionInformationWillForceLoad();
        }
        onPropertyUpdated(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            this.propertyUpdatedOverride(a, b, c);
        }
        propertyUpdatedOverride(a, b, c) {
            switch (a) {
                case "PrimaryKey":
                    this.actualPrimaryKey = this.primaryKey;
                    break;
                case "ActualPrimaryKey":
                    this.onActualPrimaryKeyChanged(b, c);
                    break;
                case "ExecutionContext":
                    if (this.actualBaseDataProvider != null) {
                        this.actualBaseDataProvider.executionContext = this.executionContext;
                    }
                    this.queueAutoRefresh();
                    break;
                case "LastVisibleIndexRequested":
                case "FirstVisibleIndexRequested":
                    this.onRequestedVisibleRangeChanged();
                    break;
                case "ActualDataProvider":
                    this.onActualDataProviderChanged(b, c);
                    break;
                case "DeferAutoRefresh":
                    if (this.actualBaseDataProvider != null) {
                        this.actualBaseDataProvider.deferAutoRefresh = this.deferAutoRefresh;
                    }
                    if (!c) {
                        this.queueAutoRefresh();
                    }
                    break;
                case "PropertiesRequested":
                    if (this.actualBaseDataProvider != null) {
                        this.actualBaseDataProvider.propertiesRequested = this.propertiesRequested;
                    }
                    break;
                case "ShouldEmitSectionFooters":
                case "ShouldEmitSectionHeaders":
                case "ShouldEmitShiftedRows":
                case "SectionHeaderDisplayMode":
                case "IsSectionCollapsable":
                case "IncludeSummaryRowsInSection":
                case "IsSectionSummaryRowsAtBottom":
                case "IsSectionContentVisible":
                    this.queueAutoRefresh();
                    break;
                case "SummaryScope":
                    if (this.actualBaseDataProvider != null) {
                        this.actualBaseDataProvider.summaryScope = this.summaryScope;
                    }
                    this.queueAutoRefresh();
                    break;
            }
        }
        onActualPrimaryKeyChanged(a, b) {
            this.onActualPrimaryKeyChangedOverrride(a, b);
        }
        onActualPrimaryKeyChangedOverrride(a, b) {
        }
        get_isVirtual() {
            return false;
        }
        get isVirtual() {
            return this.get_isVirtual();
        }
        get dataProviderUpdateNotifier() {
            return this.k;
        }
        onActualDataProviderChanged(a, b) {
            let c = a;
            let d = b;
            if (c != null) {
                c.updateNotifier = null;
            }
            if (d != null) {
                d.updateNotifier = this.k;
            }
            if (c != null) {
                c.schemaChanged = delegateRemove(c.schemaChanged, runOn(this, this.bl));
            }
            if (d != null) {
                d.schemaChanged = delegateCombine(d.schemaChanged, runOn(this, this.bl));
                d.executionContext = this.executionContext;
                this.notifyUsingSourceIndexes = this.actualBaseDataProvider.notifyUsingSourceIndexes;
            }
            else {
                this.notifyUsingSourceIndexes = false;
            }
            if (c != null) {
                this.sortDescriptions.syncTarget = null;
                this.groupDescriptions.syncTarget = null;
                this.filterExpressions.syncTarget = null;
                this.summaryDescriptions.syncTarget = null;
            }
            if (d != null) {
                this.sortDescriptions.syncTarget = d.sortDescriptions;
                this.groupDescriptions.syncTarget = d.groupDescriptions;
                this.filterExpressions.syncTarget = d.filterExpressions;
                this.summaryDescriptions.syncTarget = d.summaryDescriptions;
                if (this.propertiesRequested != null) {
                    d.propertiesRequested = this.propertiesRequested;
                }
                d.summaryScope = this.summaryScope;
            }
            this.queueAutoRefresh();
        }
        onRequestedVisibleRangeChanged() {
        }
        get executionContext() {
            return this.m;
        }
        set executionContext(a) {
            let b = this.m;
            this.m = a;
            if (this.m != b) {
                this.onPropertyUpdated("ExecutionContext", b, this.m);
            }
        }
        canInitialize() {
            if (this.m != null && this.actualBaseDataProvider != null) {
                return true;
            }
            return false;
        }
        get isInitializing() {
            return this.z;
        }
        get_isSortingSupported() {
            return false;
        }
        get isSortingSupported() {
            return this.get_isSortingSupported();
        }
        get_isFilteringSupported() {
            return false;
        }
        get isFilteringSupported() {
            return this.get_isFilteringSupported();
        }
        get sortDescriptions() {
            return this.r;
        }
        get groupDescriptions() {
            return this.q;
        }
        get filterExpressions() {
            return this.h;
        }
        get summaryDescriptions() {
            return this.s;
        }
        get summaryScope() {
            return this.g;
        }
        set summaryScope(a) {
            let b = this.g;
            this.g = a;
            if (this.g != b) {
                this.onPropertyUpdated("SummaryScope", enumGetBox(DataSourceSummaryScope_$type, b), enumGetBox(DataSourceSummaryScope_$type, this.g));
            }
        }
        get deferAutoRefresh() {
            return this.w;
        }
        set deferAutoRefresh(a) {
            let b = this.w;
            this.w = a;
            if (this.w != b) {
                this.onPropertyUpdated("DeferAutoRefresh", b, this.w);
            }
        }
        get primaryKey() {
            return this.b;
        }
        set primaryKey(a) {
            let b = this.b;
            this.b = a;
            if (this.b != b) {
                this.onPropertyUpdated("PrimaryKey", b, this.b);
            }
        }
        get actualPrimaryKey() {
            return this.a;
        }
        set actualPrimaryKey(a) {
            let b = this.a;
            this.a = a;
            if (this.a != b) {
                this.onPropertyUpdated("ActualPrimaryKey", b, this.a);
            }
        }
        get propertiesRequested() {
            return this.c;
        }
        set propertiesRequested(a) {
            let b = this.c;
            this.c = a;
            if (this.c != b) {
                this.onPropertyUpdated("PropertiesRequested", b, this.c);
            }
        }
        get notifyUsingSourceIndexes() {
            return this.af;
        }
        set notifyUsingSourceIndexes(a) {
            let b = this.af;
            this.af = a;
            if (this.af != b) {
                this.onPropertyUpdated("NotifyUsingSourceIndexes", b, this.af);
            }
        }
        get_isItemIndexLookupSupported() {
            return false;
        }
        get isItemIndexLookupSupported() {
            return this.get_isItemIndexLookupSupported();
        }
        get_isKeyIndexLookupSupported() {
            return false;
        }
        get isKeyIndexLookupSupported() {
            return this.get_isKeyIndexLookupSupported();
        }
        initializeOverride() {
        }
        resolveFullCount(a) {
            return a;
        }
        bl(a, b) {
            let c = this.executionContext;
            c.execute(() => {
                this.ag = true;
                this.v = true;
                this.queueAutoRefresh();
                if (this.deferAutoRefresh) {
                    this.actualSchema = b.schema;
                    this.actualCount = this.resolveFullCount(b.count);
                    this.bv();
                }
            });
        }
        bv() {
            if (this.schemaChanged != null) {
                this.schemaChanged(this, new DataSourceSchemaChangedEventArgs(this.actualSchema, this.actualCount));
            }
        }
        onSetItem(a, b, c) {
            this.onSetItemOverride(a, b, c);
        }
        onBroadcastSetItem(a, b, c) {
            if (this.updateNotifier != null) {
                this.updateNotifier.notifySetItem(a, b, c);
            }
        }
        onSetItemOverride(a, b, c) {
            if (this.actualBaseDataProvider != null) {
                this.actualCount = this.resolveFullCount(this.actualBaseDataProvider.actualCount);
            }
            this.onBroadcastSetItem(a, b, c);
        }
        onClearItems() {
            this.onClearItemsOverride();
        }
        onBroadcastClearItems() {
            if (this.updateNotifier != null) {
                this.updateNotifier.notifyClearItems();
            }
        }
        onClearItemsOverride() {
            if (this.actualBaseDataProvider != null) {
                this.actualCount = this.resolveFullCount(this.actualBaseDataProvider.actualCount);
            }
            this.onBroadcastClearItems();
        }
        onInsertItem(a, b) {
            this.onInsertItemOverride(a, b);
        }
        onBroadcastInsertItem(a, b) {
            if (this.updateNotifier != null) {
                this.updateNotifier.notifyInsertItem(a, b);
            }
        }
        onInsertItemOverride(a, b) {
            if (this.actualBaseDataProvider != null) {
                this.actualCount = this.resolveFullCount(this.actualBaseDataProvider.actualCount);
            }
            this.onBroadcastInsertItem(a, b);
        }
        onRemoveItem(a, b) {
            this.onRemoveItemOverride(a, b);
        }
        onBroadcastRemoveItem(a, b) {
            if (this.updateNotifier != null) {
                this.updateNotifier.notifyRemoveItem(a, b);
            }
        }
        onRemoveItemOverride(a, b) {
            if (this.actualBaseDataProvider != null) {
                this.actualCount = this.resolveFullCount(this.actualBaseDataProvider.actualCount);
            }
            this.onBroadcastRemoveItem(a, b);
        }
        notifySetItem(a, b, c) {
            if (this.actualBaseDataProvider != null) {
                this.actualBaseDataProvider.notifySetItem(a, b, c);
            }
        }
        notifyClearItems() {
            if (this.actualBaseDataProvider != null) {
                this.actualBaseDataProvider.notifyClearItems();
            }
        }
        notifyInsertItem(a, b) {
            if (this.actualBaseDataProvider != null) {
                this.actualBaseDataProvider.notifyInsertItem(a, b);
            }
            ;
        }
        notifyRemoveItem(a, b) {
            if (this.actualBaseDataProvider != null) {
                this.actualBaseDataProvider.notifyRemoveItem(a, b);
            }
            ;
        }
        queueAutoRefresh() {
            if (this.deferAutoRefresh) {
                return;
            }
            if (this.actualBaseDataProvider != null) {
                this.actualBaseDataProvider.queueAutoRefresh();
            }
            if (this.u) {
                return;
            }
            if (this.executionContext != null) {
                this.u = true;
                this.executionContext.enqueueAction(runOn(this, this.bn));
            }
        }
        bn() {
            if (this.deferAutoRefresh) {
                this.u = false;
                return;
            }
            if (this.actualBaseDataProvider != null) {
                this.actualBaseDataProvider.flushAutoRefresh();
            }
            if (!this.u) {
                return;
            }
            this.u = false;
            this.cl();
        }
        cl() {
            if (this.actualBaseDataProvider != null) {
                this.actualSchema = this.actualBaseDataProvider.actualSchema;
                this.actualCount = this.resolveFullCount(this.actualBaseDataProvider.actualCount);
            }
            if (this.actualSchema != null && this.primaryKey == null) {
                this.actualPrimaryKey = this.actualSchema.primaryKey;
            }
            this.refreshInternalOverride();
            if (this.ag) {
                this.ag = false;
                this.bv();
            }
        }
        refreshInternalOverride() {
        }
        flushAutoRefresh() {
            this.bn();
        }
        refresh() {
            if (this.actualBaseDataProvider != null) {
                this.actualBaseDataProvider.refresh();
            }
            this.cl();
        }
        indexOfItem(a) {
            return -1;
        }
        indexOfKey(a) {
            return -1;
        }
        getPrimaryKeyValue(a, b) {
            let c = this.actualPrimaryKey;
            if (c == null || c.length < 1 || this.actualBaseDataProvider == null) {
                return;
            }
            for (let d = 0; d < c.length; d++) {
                b[d] = this.actualBaseDataProvider.getItemValue(a, c[d]);
            }
        }
        getRowType(a) {
            return 0;
        }
        getMainValuePath(a) {
            return "SectionInformation";
        }
        getStickyRows() {
            return this.getStickyRowsInRange(this.firstVisibleIndexRequested, this.lastVisibleIndexRequested);
        }
        getStickyRowsInRange(a, b) {
            return null;
        }
        isRowSpanning(a) {
            return a == 1 || a == 2;
        }
        getStickyRowPriority(a) {
            return -1;
        }
        isExclusivelySticky(a) {
            return false;
        }
        pinRow(a) {
        }
        unpinRow(a) {
        }
        clearPinnedRows() {
        }
        isRowPinned(a) {
            return false;
        }
        get_isGroupingSupported() {
            return false;
        }
        get isGroupingSupported() {
            return this.get_isGroupingSupported();
        }
        get_sectionHeaderDisplayMode() {
            return this.f;
        }
        set_sectionHeaderDisplayMode(a) {
            let b = this.f;
            this.f = a;
            if (b != this.f) {
                this.onPropertyUpdated("SectionHeaderDisplayMode", enumGetBox(DataSourceSectionHeaderDisplayMode_$type, b), enumGetBox(DataSourceSectionHeaderDisplayMode_$type, this.f));
            }
        }
        get sectionHeaderDisplayMode() {
            return this.get_sectionHeaderDisplayMode();
        }
        set sectionHeaderDisplayMode(a) {
            this.set_sectionHeaderDisplayMode(a);
        }
        get_isSectionCollapsable() {
            return this.aa;
        }
        set_isSectionCollapsable(a) {
            let b = this.aa;
            this.aa = a;
            if (this.aa != b) {
                this.onPropertyUpdated("IsSectionCollapsable", b, this.aa);
            }
        }
        get isSectionCollapsable() {
            return this.get_isSectionCollapsable();
        }
        set isSectionCollapsable(a) {
            this.set_isSectionCollapsable(a);
        }
        get_isSectionExpandedDefault() {
            return this.ac;
        }
        set_isSectionExpandedDefault(a) {
            this.ac = a;
        }
        get isSectionExpandedDefault() {
            return this.get_isSectionExpandedDefault();
        }
        set isSectionExpandedDefault(a) {
            this.set_isSectionExpandedDefault(a);
        }
        get_includeSummaryRowsInSection() {
            return this.x;
        }
        set_includeSummaryRowsInSection(a) {
            let b = this.x;
            this.x = a;
            if (this.x != b) {
                this.onPropertyUpdated("IncludeSummaryRowsInSection", b, this.x);
            }
        }
        get includeSummaryRowsInSection() {
            return this.get_includeSummaryRowsInSection();
        }
        set includeSummaryRowsInSection(a) {
            this.set_includeSummaryRowsInSection(a);
        }
        get_isSectionSummaryRowsAtBottom() {
            return this.ae;
        }
        set_isSectionSummaryRowsAtBottom(a) {
            let b = this.ae;
            this.ae = a;
            if (this.ae != b) {
                this.onPropertyUpdated("IsSectionSummaryRowsAtBottom", b, this.ae);
            }
        }
        get isSectionSummaryRowsAtBottom() {
            return this.get_isSectionSummaryRowsAtBottom();
        }
        set isSectionSummaryRowsAtBottom(a) {
            this.set_isSectionSummaryRowsAtBottom(a);
        }
        get_isSectionHeaderNormalRow() {
            return this.ad;
        }
        set_isSectionHeaderNormalRow(a) {
            let b = this.ad;
            this.ad = a;
            if (this.ad != b) {
                this.onPropertyUpdated("IsSectionHeaderNormalRow", b, this.ad);
            }
        }
        get isSectionHeaderNormalRow() {
            return this.get_isSectionHeaderNormalRow();
        }
        set isSectionHeaderNormalRow(a) {
            this.set_isSectionHeaderNormalRow(a);
        }
        get_isSectionContentVisible() {
            return this.ab;
        }
        set_isSectionContentVisible(a) {
            let b = this.ab;
            this.ab = a;
            if (this.ab != b) {
                this.onPropertyUpdated("IsSectionContentVisible", b, this.ab);
            }
        }
        get isSectionContentVisible() {
            return this.get_isSectionContentVisible();
        }
        set isSectionContentVisible(a) {
            this.set_isSectionContentVisible(a);
        }
        get shouldEmitSectionHeaders() {
            return this.ai;
        }
        set shouldEmitSectionHeaders(a) {
            let b = this.ai;
            this.ai = a;
            if (this.ai != b) {
                this.onPropertyUpdated("ShouldEmitSectionHeaders", b, this.ai);
            }
        }
        get shouldEmitSectionFooters() {
            return this.ah;
        }
        set shouldEmitSectionFooters(a) {
            let b = this.ah;
            this.ah = a;
            if (this.ah != b) {
                this.onPropertyUpdated("ShouldEmitSectionFooters", b, this.ah);
            }
        }
        get shouldEmitShiftedRows() {
            return this.aj;
        }
        set shouldEmitShiftedRows(a) {
            let b = this.aj;
            this.aj = a;
            if (this.aj != b) {
                this.onPropertyUpdated("ShouldEmitShiftedRows", b, this.aj);
            }
        }
        ensureComparables(a) {
            if (this.v && this.actualCount > 0 && this.actualBaseDataProvider != null) {
                this.d = new Array(a.propertyNames.length);
                this.v = false;
            }
        }
        resolveSchemaPropertyType(a) {
            return this.actualBaseDataProvider.resolveSchemaPropertyType(a);
        }
        setIsRowExpandedAtIndex(a, b) {
        }
        getIsRowExpandedAtIndex(a) {
            return true;
        }
        getRowLevel(a) {
            return 0;
        }
        getRootSummaryRowCount() {
            return 0;
        }
        getRootSummaryResults() {
            return null;
        }
        getSectionSummaryResults(a) {
            return null;
        }
        clone() {
            return null;
        }
        cloneProperties(a) {
            let b = typeCast(BaseDataSource.$, a);
            if (b != null) {
                b.executionContext = this.executionContext;
                b.includeSummaryRowsInSection = this.includeSummaryRowsInSection;
                b.isSectionCollapsable = this.isSectionCollapsable;
                b.isSectionExpandedDefault = this.isSectionExpandedDefault;
                b.isSectionHeaderNormalRow = this.isSectionHeaderNormalRow;
                b.isSectionSummaryRowsAtBottom = this.isSectionSummaryRowsAtBottom;
                b.isSectionContentVisible = this.isSectionContentVisible;
                b.primaryKey = this.primaryKey;
                b.propertiesRequested = this.propertiesRequested;
                b.sectionHeaderDisplayMode = this.sectionHeaderDisplayMode;
                b.shouldEmitSectionFooters = this.shouldEmitSectionFooters;
                b.shouldEmitSectionHeaders = this.shouldEmitSectionHeaders;
                b.shouldEmitShiftedRows = this.shouldEmitShiftedRows;
                b.summaryScope = this.summaryScope;
                for (let c = 0; c < this.groupDescriptions.k.count; c++) {
                    b.groupDescriptions.add(this.groupDescriptions.k.item(c));
                }
                for (let d = 0; d < this.sortDescriptions.k.count; d++) {
                    b.sortDescriptions.add(this.sortDescriptions.k.item(d));
                }
                for (let e = 0; e < this.filterExpressions.j.count; e++) {
                    b.filterExpressions.add(this.filterExpressions.j.item(e));
                }
                for (let f = 0; f < this.summaryDescriptions.k.count; f++) {
                    b.summaryDescriptions.add(this.summaryDescriptions.k.item(f));
                }
            }
        }
    }
    BaseDataSource.$t = /*@__PURE__*/ markType(BaseDataSource, 'BaseDataSource', Base.$, [IDataSource_$type, IEditableDataSource_$type]);
    return BaseDataSource;
})();
/**
 * @hidden
 */
export let DefaultDataSourceDataProviderUpdateNotifier = /*@__PURE__*/ (() => {
    class DefaultDataSourceDataProviderUpdateNotifier extends Base {
        constructor(a) {
            super();
            this.a = null;
            this.a = a;
        }
        notifySetItem(a, b, c) {
            this.a.onSetItem(a, b, c);
        }
        notifyClearItems() {
            this.a.onClearItems();
        }
        notifyInsertItem(a, b) {
            this.a.onInsertItem(a, b);
        }
        notifyRemoveItem(a, b) {
            this.a.onRemoveItem(a, b);
        }
    }
    DefaultDataSourceDataProviderUpdateNotifier.$t = /*@__PURE__*/ markType(DefaultDataSourceDataProviderUpdateNotifier, 'DefaultDataSourceDataProviderUpdateNotifier', Base.$, [IDataSourceDataProviderUpdateNotifier_$type]);
    return DefaultDataSourceDataProviderUpdateNotifier;
})();
//# sourceMappingURL=BaseDataSource_combined.js.map
