(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "../App", "../core/AtomBridge", "../services/BusyIndicatorService", "../services/NavigationService", "../web/styles/AtomStyleSheet", "./services/XFBusyIndicatorService", "./services/XFNavigationService"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const A = require("../App");
    const AtomBridge_1 = require("../core/AtomBridge");
    const BusyIndicatorService_1 = require("../services/BusyIndicatorService");
    const NavigationService_1 = require("../services/NavigationService");
    const AtomStyleSheet_1 = require("../web/styles/AtomStyleSheet");
    const XFBusyIndicatorService_1 = require("./services/XFBusyIndicatorService");
    const XFNavigationService_1 = require("./services/XFNavigationService");
    class XFApp extends A.App {
        constructor() {
            super();
            this.mLastStyle = null;
            AtomBridge_1.AtomBridge.instance = bridge;
            this.put(NavigationService_1.NavigationService, this.resolve(XFNavigationService_1.default));
            this.put(BusyIndicatorService_1.BusyIndicatorService, this.resolve(XFBusyIndicatorService_1.default));
            this.put(AtomStyleSheet_1.AtomStyleSheet, new AtomStyleSheet_1.AtomStyleSheet(this, "WA_"));
            const s = bridge.subscribe((channel, data) => {
                this.broadcast(channel, data);
            });
            // register for messaging...
            const oldDispose = this.dispose;
            this.dispose = () => {
                s.dispose();
                oldDispose.call(this);
            };
        }
        get root() {
            return this.mRoot;
        }
        set root(v) {
            this.mRoot = v;
            bridge.setRoot(v.element);
        }
        updateDefaultStyle(textContent) {
            if (!textContent) {
                return;
            }
            if (this.mLastStyle && this.mLastStyle === textContent) {
                return;
            }
            this.mLastStyle = textContent;
            bridge.updateDefaultStyle(textContent);
        }
        broadcast(channel, data) {
            super.broadcast(channel, data);
            bridge.broadcast(channel, data);
        }
    }
    exports.default = XFApp;
});
//# sourceMappingURL=XFApp.js.map