import * as _vue from "vue";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

import UpOutlined from '@ant-design/icons-vue/UpOutlined';
import DownOutlined from '@ant-design/icons-vue/DownOutlined';
import LeftOutlined from '@ant-design/icons-vue/LeftOutlined';
import RightOutlined from '@ant-design/icons-vue/RightOutlined';
import ScrollableInkTabBar from '../vc-tabs/src/ScrollableInkTabBar';
import PropTypes from '../_util/vue-types';
var TabBar = {
  name: 'TabBar',
  inheritAttrs: false,
  props: {
    prefixCls: PropTypes.string,
    tabBarStyle: PropTypes.object,
    tabBarExtraContent: PropTypes.any,
    type: PropTypes.oneOf(['line', 'card', 'editable-card']),
    tabPosition: PropTypes.oneOf(['top', 'right', 'bottom', 'left']).def('top'),
    tabBarPosition: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
    size: PropTypes.oneOf(['default', 'small', 'large']),
    animated: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
    renderTabBar: PropTypes.func,
    panels: PropTypes.array.def([]),
    activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
    tabBarGutter: PropTypes.number
  },
  render: function render() {
    var _cls;

    var _this$$props = this.$props,
        tabBarStyle = _this$$props.tabBarStyle,
        _this$$props$animated = _this$$props.animated,
        animated = _this$$props$animated === void 0 ? true : _this$$props$animated,
        renderTabBar = _this$$props.renderTabBar,
        tabBarExtraContent = _this$$props.tabBarExtraContent,
        tabPosition = _this$$props.tabPosition,
        prefixCls = _this$$props.prefixCls,
        _this$$props$type = _this$$props.type,
        type = _this$$props$type === void 0 ? 'line' : _this$$props$type,
        size = _this$$props.size;
    var inkBarAnimated = _typeof(animated) === 'object' ? animated.inkBar : animated;
    var isVertical = tabPosition === 'left' || tabPosition === 'right';

    var prevIcon = _vue.createVNode("span", {
      "class": "".concat(prefixCls, "-tab-prev-icon")
    }, [isVertical ? _vue.createVNode(UpOutlined, {
      "class": "".concat(prefixCls, "-tab-prev-icon-target")
    }, null) : _vue.createVNode(LeftOutlined, {
      "class": "".concat(prefixCls, "-tab-prev-icon-target")
    }, null)]);

    var nextIcon = _vue.createVNode("span", {
      "class": "".concat(prefixCls, "-tab-next-icon")
    }, [isVertical ? _vue.createVNode(DownOutlined, {
      "class": "".concat(prefixCls, "-tab-next-icon-target")
    }, null) : _vue.createVNode(RightOutlined, {
      "class": "".concat(prefixCls, "-tab-next-icon-target")
    }, null)]); // Additional className for style usage


    var cls = (_cls = {}, _defineProperty(_cls, this.$attrs.class, this.$attrs.class), _defineProperty(_cls, "".concat(prefixCls, "-").concat(tabPosition, "-bar"), true), _defineProperty(_cls, "".concat(prefixCls, "-").concat(size, "-bar"), !!size), _defineProperty(_cls, "".concat(prefixCls, "-card-bar"), type && type.indexOf('card') >= 0), _cls);

    var renderProps = _objectSpread(_objectSpread(_objectSpread({}, this.$props), this.$attrs), {}, {
      children: null,
      inkBarAnimated: inkBarAnimated,
      extraContent: tabBarExtraContent,
      prevIcon: prevIcon,
      nextIcon: nextIcon,
      style: tabBarStyle,
      class: cls
    });

    if (renderTabBar) {
      return renderTabBar(_objectSpread(_objectSpread({}, renderProps), {}, {
        DefaultTabBar: ScrollableInkTabBar
      }));
    } else {
      return _vue.createVNode(ScrollableInkTabBar, renderProps, null);
    }
  }
};
export default TabBar;