import React from "react";
import { omit } from "../../utils-external/index.js";
export const parseRows = (rowChildren) => {
    const parsedChildren = [];
    rowChildren === null || rowChildren === void 0 ? void 0 : rowChildren.forEach((row) => {
        const periods = [];
        if (!React.isValidElement(row) ||
            !row.props.children) {
            return;
        }
        React.Children.toArray(row.props.children).forEach((period) => {
            if (!React.isValidElement(period)) {
                return;
            }
            periods.push({
                start: period.props.start,
                end: period.props.end,
                status: period.props.status || "neutral",
                onSelectPeriod: period.props.onSelectPeriod,
                icon: period.props.icon,
                children: period.props.children,
                isActive: period.props.isActive,
                statusLabel: period.props.statusLabel,
                restProps: omit(period.props, [
                    "start",
                    "end",
                    "status",
                    "onSelectPeriod",
                    "icon",
                    "children",
                    "isActive",
                    "statusLabel",
                    "placement",
                ]),
                ref: getChildRef(period),
            });
        });
        parsedChildren.push({
            label: row.props.label,
            icon: row.props.icon,
            headingTag: row.props.headingTag,
            periods,
            restProps: omit(row.props, ["label", "icon", "headingTag"]),
            ref: getChildRef(row),
        });
    });
    return parsedChildren;
};
function getChildRef(children) {
    return Object.prototype.propertyIsEnumerable.call(children.props, "ref")
        ? children.props.ref // React 19 (children.ref still works, but gives a warning)
        : children.ref; // React <19
}
//# sourceMappingURL=timeline.js.map