/*
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, delegateCombine, delegateRemove, runOn, markType } from "igniteui-angular-core";
import { Message } from "./Message";
import { Queue$1 } from "igniteui-angular-core";
/**
 * @hidden
 */
export let MessageChannel = /*@__PURE__*/ (() => {
    class MessageChannel extends Base {
        constructor() {
            super(...arguments);
            this.c = new Queue$1(Message.$);
            this.messageSent = null;
            this.a = null;
        }
        i(a) {
            if (this.messageSent != null) {
                this.messageSent(a);
            }
            else {
                this.c.g(a);
            }
        }
        e(a) {
            this.messageSent = delegateCombine(this.messageSent, a);
            while (this.c.count > 0) {
                let b = this.c.b();
                this.messageSent(b);
            }
        }
        h(a) {
            this.messageSent = delegateRemove(this.messageSent, a);
        }
        f(a) {
            this.a = a;
            this.e(runOn(this, this.j));
        }
        g() {
            if (this.a == null) {
                return;
            }
            this.h(runOn(this, this.j));
            this.a = null;
        }
        j(a) {
            if (this.a != null) {
                this.a.i(a);
            }
        }
        toString() {
            return "MessageQueue";
        }
    }
    MessageChannel.$t = markType(MessageChannel, 'MessageChannel');
    return MessageChannel;
})();
//# sourceMappingURL=MessageChannel.js.map
