export var WEIGHING_METRIC_CARD_MIN_WIDTH = 140;
var DEFAULT_METRIC_CARD_COUNT = 4;
var DEFAULT_COLUMNS = 2;
/**
 * 根据容器可用宽度计算四个指标卡片的列数。
 * 仅返回 1 / 2 / 4 列，避免 3+1 的视觉断层。
 */
export function getWeighingMetricGridColumns(params) {
  var containerWidth = params.containerWidth,
    gap = params.gap,
    _params$minCardWidth = params.minCardWidth,
    minCardWidth = _params$minCardWidth === void 0 ? WEIGHING_METRIC_CARD_MIN_WIDTH : _params$minCardWidth,
    _params$cardCount = params.cardCount,
    cardCount = _params$cardCount === void 0 ? DEFAULT_METRIC_CARD_COUNT : _params$cardCount;
  if (!Number.isFinite(containerWidth) || containerWidth <= 0) {
    return DEFAULT_COLUMNS;
  }
  var normalizedGap = Math.max(gap, 0);
  var twoColumnMinWidth = minCardWidth * 2 + normalizedGap;
  var singleRowMinWidth = minCardWidth * cardCount + normalizedGap * Math.max(cardCount - 1, 0);
  if (containerWidth >= singleRowMinWidth) {
    return cardCount;
  }
  if (containerWidth >= twoColumnMinWidth) {
    return 2;
  }
  return 1;
}
export function getWeighingMetricGridStyle(params) {
  var columns = getWeighingMetricGridColumns(params);
  return {
    gridTemplateColumns: "repeat(".concat(columns, ", minmax(0, 1fr))")
  };
}