import * as _vue from "vue";

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; }

import { inject } from 'vue';
import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider';
import { getSlot } from '../_util/props-util';
var Divider = {
  name: 'ADivider',
  props: {
    prefixCls: PropTypes.string,
    type: PropTypes.oneOf(['horizontal', 'vertical', '']).def('horizontal'),
    dashed: PropTypes.bool,
    orientation: PropTypes.oneOf(['left', 'right', 'center'])
  },
  setup: function setup() {
    return {
      configProvider: inject('configProvider', ConfigConsumerProps)
    };
  },
  render: function render() {
    var _classString;

    var customizePrefixCls = this.prefixCls,
        type = this.type,
        dashed = this.dashed,
        _this$orientation = this.orientation,
        orientation = _this$orientation === void 0 ? 'center' : _this$orientation;
    var getPrefixCls = this.configProvider.getPrefixCls;
    var prefixCls = getPrefixCls('divider', customizePrefixCls);
    var orientationPrefix = orientation.length > 0 ? '-' + orientation : orientation;
    var children = getSlot(this);
    var classString = (_classString = {}, _defineProperty(_classString, prefixCls, true), _defineProperty(_classString, "".concat(prefixCls, "-").concat(type), true), _defineProperty(_classString, "".concat(prefixCls, "-with-text").concat(orientationPrefix), children.length), _defineProperty(_classString, "".concat(prefixCls, "-dashed"), !!dashed), _classString);
    return _vue.createVNode("div", {
      "class": classString,
      "role": "separator"
    }, [!!children.length && _vue.createVNode("span", {
      "class": "".concat(prefixCls, "-inner-text")
    }, [children])]);
  }
};
/* istanbul ignore next */

Divider.install = function (app) {
  app.component(Divider.name, Divider);
};

export default Divider;