'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var iconsVue = require('@ant-design/icons-vue');
require('../../../../utils/index.cjs');
var is = require('../../../../utils/is.cjs');

function renderSwitcherIcon(prefixCls, switcherIcon, props, leafIcon, showLine) {
  const {
    isLeaf,
    expanded,
    loading
  } = props;
  let icon = switcherIcon;
  if (loading)
    return vue.createVNode(iconsVue.LoadingOutlined, {
      "class": `${prefixCls}-switcher-loading-icon`
    }, null);
  let showLeafIcon;
  if (showLine && typeof showLine === "object")
    showLeafIcon = showLine.showLeafIcon;
  let defaultIcon = null;
  const switcherCls = `${prefixCls}-switcher-icon`;
  if (isLeaf) {
    if (!showLine)
      return null;
    if (showLeafIcon && leafIcon)
      return leafIcon(props);
    if (typeof showLine === "object" && !showLeafIcon)
      defaultIcon = vue.createVNode("span", {
        "class": `${prefixCls}-switcher-leaf-line`
      }, null);
    else
      defaultIcon = vue.createVNode(iconsVue.FileOutlined, {
        "class": `${prefixCls}-switcher-line-icon`
      }, null);
    return defaultIcon;
  } else {
    defaultIcon = vue.createVNode(iconsVue.CaretDownFilled, {
      "class": switcherCls
    }, null);
    if (showLine) {
      defaultIcon = expanded ? vue.createVNode(iconsVue.MinusSquareOutlined, {
        "class": `${prefixCls}-switcher-line-icon`
      }, null) : vue.createVNode(iconsVue.PlusSquareOutlined, {
        "class": `${prefixCls}-switcher-line-icon`
      }, null);
    }
  }
  if (typeof switcherIcon === "function") {
    icon = switcherIcon({
      ...props,
      defaultIcon,
      switcherCls
    });
  } else if (is.isValidElement(icon)) {
    icon = vue.cloneVNode(icon, {
      class: switcherCls
    });
  }
  return icon || defaultIcon;
}

exports.default = renderSwitcherIcon;
//# sourceMappingURL=iconUtil.cjs.map
