// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

import { cloneElement, isValidElement, Children } from 'react';
import classNames from 'classnames';
import { CLS_PREFIX } from '../../constants';
import { jsx as _jsx } from "react/jsx-runtime";
/**
 * Auxiliary Actions component is used for executing additional (not primary) actions.
 * @since 0.4.1
 */
const AuxiliaryActions = _ref => {
  let {
    baseClassName = `${CLS_PREFIX}auxiliary-actions`,
    className,
    separator = /*#__PURE__*/_jsx("span", {
      className: `${baseClassName}__separator`,
      children: ' | '
    }),
    children,
    ...props
  } = _ref;
  return /*#__PURE__*/_jsx("span", {
    className: classNames(baseClassName, className),
    ...props,
    children: Children.toArray(children).reduce((accu, elem, index) => accu.length === 0 ? [elem] : [...accu, /*#__PURE__*/isValidElement(separator) ? /*#__PURE__*/cloneElement(separator, {
      key: index
    }) // eslint-disable-line react/no-array-index-key
    : separator, elem], [])
  });
};
export default AuxiliaryActions;