/**
 * ldesign v0.4.6
 * (c) 2023 ldesign
 * @license MIT
 */

import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';

function getFakeArrowIconClass(prefix, STATUS, cascaderContext) {
  var disabled = cascaderContext.disabled;
  return ["".concat(prefix, "-cascader__icon"), _defineProperty({}, STATUS.disabled, disabled)];
}
function getNodeStatusClass(node, STATUS, cascaderContext) {
  var _ref2;
  var checkStrictly = cascaderContext.checkStrictly,
    multiple = cascaderContext.multiple,
    value = cascaderContext.value,
    max = cascaderContext.max;
  var expandedActive = !checkStrictly && node.expanded && (multiple ? !node.isLeaf() : true) || checkStrictly && node.expanded;
  var isLeaf = node.isLeaf();
  var isDisabled = node.disabled || multiple && value.length >= max && max !== 0;
  var isSelected = node.checked || multiple && !checkStrictly && node.expanded && !isLeaf;
  return [(_ref2 = {}, _defineProperty(_ref2, STATUS.selected, !isDisabled && isSelected), _defineProperty(_ref2, STATUS.expanded, !isDisabled && expandedActive), _defineProperty(_ref2, STATUS.disabled, isDisabled), _ref2)];
}
function getCascaderItemClass(prefix, node, SIZE, STATUS, cascaderContext) {
  var _ref3;
  var size = cascaderContext.size;
  return ["".concat(prefix, "-cascader__item")].concat(_toConsumableArray(getNodeStatusClass(node, STATUS, cascaderContext)), [SIZE[size], (_ref3 = {}, _defineProperty(_ref3, "".concat(prefix, "-cascader__item--with-icon"), !!node.children), _defineProperty(_ref3, "".concat(prefix, "-cascader__item--leaf"), node.isLeaf()), _ref3)]);
}
function getCascaderItemIconClass(prefix, node, STATUS, cascaderContext) {
  return ["".concat(prefix, "-cascader__item-icon"), "".concat(prefix, "-icon")].concat(_toConsumableArray(getNodeStatusClass(node, STATUS, cascaderContext)));
}

export { getCascaderItemClass, getCascaderItemIconClass, getFakeArrowIconClass, getNodeStatusClass };
//# sourceMappingURL=className.js.map
