import { Children, cloneElement, isValidElement } from "react";
export var updatePropsRecursively = function updatePropsRecursively(children, activeIndex, view, disabled, updateValue) {
    return Children.map(children || [], function(child, index) {
        if (!isValidElement(child)) {
            return child;
        }
        var props = {
            index: index,
            value: !!((activeIndex === null || activeIndex === void 0 ? void 0 : activeIndex.findIndex(function(i) {
                var _child_props_eventKey;
                return i === ((_child_props_eventKey = child.props.eventKey) !== null && _child_props_eventKey !== void 0 ? _child_props_eventKey : index);
            })) !== -1),
            view: view,
            disabled: disabled,
            onChange: updateValue
        };
        return cloneElement(child, props);
    });
};
export var getChildren = function getChildren(children, activeIndex, view, disabled, updateValue) {
    return updatePropsRecursively(children, activeIndex, view, disabled, updateValue);
};
