"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseRows = void 0;
const react_1 = __importDefault(require("react"));
const utils_external_1 = require("../../utils-external");
const parseRows = (rowChildren) => {
    const parsedChildren = [];
    rowChildren === null || rowChildren === void 0 ? void 0 : rowChildren.forEach((row) => {
        const periods = [];
        if (!react_1.default.isValidElement(row) ||
            !row.props.children) {
            return;
        }
        react_1.default.Children.toArray(row.props.children).forEach((period) => {
            if (!react_1.default.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: (0, utils_external_1.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: (0, utils_external_1.omit)(row.props, ["label", "icon", "headingTag"]),
            ref: getChildRef(row),
        });
    });
    return parsedChildren;
};
exports.parseRows = parseRows;
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