var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
(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 });
    var A = require("../App");
    var AtomBridge_1 = require("../core/AtomBridge");
    var BusyIndicatorService_1 = require("../services/BusyIndicatorService");
    var NavigationService_1 = require("../services/NavigationService");
    var AtomStyleSheet_1 = require("../web/styles/AtomStyleSheet");
    var XFBusyIndicatorService_1 = require("./services/XFBusyIndicatorService");
    var XFNavigationService_1 = require("./services/XFNavigationService");
    var XFApp = /** @class */ (function (_super) {
        __extends(XFApp, _super);
        function XFApp() {
            var _this = _super.call(this) || this;
            _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_"));
            var s = bridge.subscribe(function (channel, data) {
                _this.broadcast(channel, data);
            });
            // register for messaging...
            var oldDispose = _this.dispose;
            _this.dispose = function () {
                s.dispose();
                oldDispose.call(_this);
            };
            return _this;
        }
        Object.defineProperty(XFApp.prototype, "root", {
            get: function () {
                return this.mRoot;
            },
            set: function (v) {
                this.mRoot = v;
                bridge.setRoot(v.element);
            },
            enumerable: false,
            configurable: true
        });
        XFApp.prototype.updateDefaultStyle = function (textContent) {
            if (!textContent) {
                return;
            }
            if (this.mLastStyle && this.mLastStyle === textContent) {
                return;
            }
            this.mLastStyle = textContent;
            bridge.updateDefaultStyle(textContent);
        };
        XFApp.prototype.broadcast = function (channel, data) {
            _super.prototype.broadcast.call(this, channel, data);
            bridge.broadcast(channel, data);
        };
        return XFApp;
    }(A.App));
    exports.default = XFApp;
});
//# sourceMappingURL=XFApp.js.map