import { _ as _define_property } from "@swc/helpers/_/_define_property";
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
import React from "react";
import classNames from "classnames";
import { View } from "@tarojs/components";
import { ComponentDefaults } from "../../utils/typings";
import { useRtl } from "../configprovider/index";
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
    contentPosition: 'center',
    direction: 'horizontal'
});
var classPrefix = "nut-divider";
export var Divider = function(props) {
    var _ref = _object_spread({}, defaultProps, props), children = _ref.children, contentPosition = _ref.contentPosition, style = _ref.style, className = _ref.className, direction = _ref.direction, rest = _object_without_properties(_ref, [
        "children",
        "contentPosition",
        "style",
        "className",
        "direction"
    ]);
    var rtl = useRtl();
    var _obj, _obj1;
    var classes = direction === 'horizontal' ? classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix), true), _define_property(_obj, "".concat(classPrefix, "-center"), children), _define_property(_obj, "".concat(classPrefix, "-left"), contentPosition === 'left'), _define_property(_obj, "".concat(classPrefix, "-right"), contentPosition === 'right'), _define_property(_obj, "".concat(classPrefix, "-rtl"), ([
        'left',
        'right'
    ].includes(contentPosition) || children) && rtl), _obj)) : classNames((_obj1 = {}, _define_property(_obj1, "".concat(classPrefix), true), _define_property(_obj1, "".concat(classPrefix, "-vertical"), direction === 'vertical'), _obj1));
    var getClassNames = function(direction) {
        return "".concat(classes.split(' ').map(function(item) {
            return "".concat(item, "-").concat(direction);
        }).join(' '));
    };
    return /*#__PURE__*/ React.createElement(View, {
        className: "".concat(classes, " ").concat(className || ''),
        style: style
    }, direction === 'horizontal' && /*#__PURE__*/ React.createElement(View, {
        className: getClassNames('before'),
        style: style
    }), children, direction === 'horizontal' && /*#__PURE__*/ React.createElement(View, {
        className: getClassNames('after'),
        style: style
    }));
};
Divider.displayName = 'NutDivider';
