/**
 * DevExtreme (renovation/viz/core/utils.js)
 * Version: 21.1.0 (build 21016-0316)
 * Build date: Sat Jan 16 2021
 *
 * Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
exports.getElementWidth = getElementWidth;
exports.getElementHeight = getElementHeight;
exports.pickPositiveValue = exports.sizeIsValid = void 0;
var _get_computed_style = _interopRequireDefault(require("../../utils/get_computed_style"));
var _type_conversion = require("../../utils/type_conversion");

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}

function getElementWidth(element) {
    var style = (0, _get_computed_style.default)(element);
    return (0, _type_conversion.toNumber)(null === style || void 0 === style ? void 0 : style.width) - (0, _type_conversion.toNumber)(null === style || void 0 === style ? void 0 : style.paddingLeft) - (0, _type_conversion.toNumber)(null === style || void 0 === style ? void 0 : style.paddingRight)
}

function getElementHeight(element) {
    var style = (0, _get_computed_style.default)(element);
    return (0, _type_conversion.toNumber)(null === style || void 0 === style ? void 0 : style.height) - (0, _type_conversion.toNumber)(null === style || void 0 === style ? void 0 : style.paddingTop) - (0, _type_conversion.toNumber)(null === style || void 0 === style ? void 0 : style.paddingBottom)
}
var sizeIsValid = function(value) {
    return !!(null !== value && void 0 !== value ? value : value > 0)
};
exports.sizeIsValid = sizeIsValid;
var pickPositiveValue = function(values) {
    return values.reduce((function(result, value) {
        return value > 0 && !result ? value : result
    }), 0)
};
exports.pickPositiveValue = pickPositiveValue;
