"use strict";
const getBadgeValue = function(props) {
  if (props.dot) {
    return "";
  }
  if (isNaN(props.count) || isNaN(props.maxCount)) {
    return props.count;
  }
  return parseInt(props.count, 10) > props.maxCount ? `${props.maxCount}+` : props.count;
};
const hasUnit = function(unit) {
  return unit.indexOf("px") > 0 || unit.indexOf("rpx") > 0 || unit.indexOf("em") > 0 || unit.indexOf("rem") > 0 || unit.indexOf("%") > 0 || unit.indexOf("vh") > 0 || unit.indexOf("vm") > 0;
};
const getBadgeStyles = function(props) {
  var _a, _b;
  let styleStr = "";
  if (props.color) {
    styleStr += `background:${props.color};`;
  }
  if ((_a = props.offset) == null ? void 0 : _a[0]) {
    styleStr += `left: calc(100% + ${hasUnit(props.offset[0].toString()) ? props.offset[0] : `${props.offset[0]}px`});`;
  }
  if ((_b = props.offset) == null ? void 0 : _b[1]) {
    styleStr += `top:${hasUnit(props.offset[1].toString()) ? props.offset[1] : `${props.offset[1]}px`};`;
  }
  return styleStr;
};
const getBadgeInnerClass = function(props) {
  const baseClass = props.classPrefix;
  const classNames = [
    `${baseClass}--basic`,
    props.dot ? `${baseClass}--dot` : "",
    `${baseClass}--${props.size}`,
    `${baseClass}--${props.shape}`,
    !props.dot ? `${baseClass}--count` : ""
  ];
  return classNames.join(" ");
};
const isShowBadge = function(props) {
  if (props.dot) {
    return true;
  }
  if (!props.showZero && !isNaN(props.count) && parseInt(props.count, 10) === 0) {
    return false;
  }
  if (props.count == null)
    return false;
  return true;
};
exports.getBadgeInnerClass = getBadgeInnerClass;
exports.getBadgeStyles = getBadgeStyles;
exports.getBadgeValue = getBadgeValue;
exports.isShowBadge = isShowBadge;
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/badge/computed.js.map
