import _extends from "@babel/runtime/helpers/extends";
import React from 'react';
export default (function (children) {
  var getColumns = function getColumns(children) {
    var columns = [];
    var getCols = function getCols(children) {
      React.Children.map(children, function (item) {
        var _ref = item,
          props = _ref.props;
        if (props.children && props.children.length) {
          columns.push({
            isGroup: true,
            title: props.align ? /*#__PURE__*/React.createElement("div", {
              style: {
                textAlign: props.align
              }
            }, props.title || '') : props.title || '',
            children: getColumns(props.children)
          });
        } else {
          columns.push(_extends({}, props));
        }
      });
    };
    getCols(children);
    return columns;
  };
  return getColumns(children);
});