"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isRuntimeMap = exports.isAction = exports.isCoordinate = exports.isMapView = exports.isLayer = exports.isMenu = exports.isComponentFlyout = exports.isMenuRef = exports.isInitError = exports.isError = exports.isModalComponentDisplayOptions = exports.isModalDisplayOptions = void 0;
/**
 * Indicates if the given argument is an IModalDisplayOptions
 *
 * @export
 * @param {*} arg
 * @returns {arg is IModalDisplayOptions}
 */
function isModalDisplayOptions(arg) {
    return typeof (arg.url) != 'undefined';
}
exports.isModalDisplayOptions = isModalDisplayOptions;
/**
 * Indicates if the given argument is an IModalComponentDisplayOptions
 *
 * @export
 * @param {*} arg
 * @returns {arg is IModalComponentDisplayOptions}
 */
function isModalComponentDisplayOptions(arg) {
    return typeof (arg.component) != 'undefined';
}
exports.isModalComponentDisplayOptions = isModalComponentDisplayOptions;
/**
 * Indicates if the given argument is an Error object
 *
 * @export
 * @param {*} err
 * @returns {err is Error}
 */
function isError(err) {
    return err instanceof Error;
}
exports.isError = isError;
/**
 * Indicates if the given argument is an InitError object
 *
 * @export
 * @param {*} item
 * @returns {item is InitError}
 */
function isInitError(item) {
    return typeof (item.message) != 'undefined' && typeof (item.stack) != undefined;
}
exports.isInitError = isInitError;
/**
 * Indicates if the given arguemnt has the shape of an IFlyoutMenu
 *
 * @export
 * @param {*} item
 * @returns {item is IFlyoutMenu}
 */
function isMenuRef(item) {
    return typeof (item.flyoutId) != 'undefined';
}
exports.isMenuRef = isMenuRef;
/**
 * Indicates if the given argument has the shape of an IComponentFlyoutItem
 *
 * @export
 * @param {*} item
 * @returns {item is IComponentFlyoutItem}
 */
function isComponentFlyout(item) {
    return typeof (item.componentName) != 'undefined';
}
exports.isComponentFlyout = isComponentFlyout;
/**
 * Indicates if the given argument has the shape of an IInlineMenu
 *
 * @export
 * @param {*} item
 * @returns {item is IInlineMenu}
 */
function isMenu(item) {
    return typeof (item.childItems) != 'undefined';
}
exports.isMenu = isMenu;
/**
 * Indicates if the given argument is a MapLayer object
 *
 * @export
 * @param {*} layer
 * @returns {layer is MapLayer}
 */
function isLayer(layer) {
    return layer.LayerDefinition !== undefined;
}
exports.isLayer = isLayer;
/**
 * Indicates if the given argument has the shape of an IMapView
 *
 * @export
 * @param {*} view
 * @returns {view is IMapView}
 */
function isMapView(view) {
    return typeof (view.x) == 'number'
        && typeof (view.y) == 'number'
        && typeof (view.scale) == 'number';
}
exports.isMapView = isMapView;
/**
 * Indicates if the given argument is a coordinate pair
 *
 * @export
 * @param {*} coord
 * @returns {coord is [number, number]}
 */
function isCoordinate(coord) {
    return coord instanceof Array
        && coord.length == 2
        && typeof (coord[0]) == 'number'
        && typeof (coord[1]) == 'number';
}
exports.isCoordinate = isCoordinate;
/**
 * Indicates if the given argument has the shape of a ViewerAction
 *
 * @export
 * @param {*} action
 * @returns {action is ViewerAction}
 */
function isAction(action) {
    return typeof (action.type) != 'undefined'
        && typeof (action.payload) != 'undefined';
}
exports.isAction = isAction;
/**
 * Indicates if the given argument is a RuntimeMap
 *
 * @param arg
 * @returns
 * @since 0.14
 */
function isRuntimeMap(arg) {
    return arg.Extents != null
        && arg.BackgroundColor != null
        && arg.CoordinateSystem != null
        && arg.MapDefinition != null
        && arg.DisplayDpi != null;
}
exports.isRuntimeMap = isRuntimeMap;
//# sourceMappingURL=type-guards.js.map