"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getViewer = exports.isReady = exports.setViewer = exports.getFusionRoot = exports.setFusionRoot = void 0;
var logger_1 = require("../utils/logger");
var _fusionRoot;
var _viewer;
/**
 * Sets the Fusion base URL
 *
 * @export
 * @param {string} root
 */
function setFusionRoot(root) {
    _fusionRoot = root;
    (0, logger_1.debug)("Fusion root set to: ".concat(root, ". Access to Fusion backend services and widget content will be relative to this value"));
}
exports.setFusionRoot = setFusionRoot;
/**
 * Gets the Fusion base URL
 *
 * @export
 * @returns {string}
 */
function getFusionRoot() {
    return _fusionRoot || "../fusion";
}
exports.getFusionRoot = getFusionRoot;
/**
 * Sets the viewer instance. Called by the map viewer component when it has mounted.
 *
 * DO NOT CALL DIRECTLY
 *
 * @hidden
 * @param {IMapViewer} viewer
 */
function setViewer(viewer) {
    _viewer = viewer;
}
exports.setViewer = setViewer;
/**
 * Gets whether the runtime environment is ready
 *
 * @export
 * @returns {boolean}
 */
function isReady() {
    return _viewer != null;
}
exports.isReady = isReady;
/**
 * Gets the map viewer in this runtime environment
 *
 * @export
 * @returns {IMapViewer}
 * @deprecated You should be using the map provider context accessed via the {@link useMapProviderContext} hook where possible
 */
function getViewer() {
    return _viewer;
}
exports.getViewer = getViewer;
//# sourceMappingURL=runtime.js.map