"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const components_1 = require("@react-email/components");
function ComposeItem({ data, style = {}, }) {
    return ((0, jsx_runtime_1.jsx)(components_1.Text, { style: Object.assign({ color: data.color || 'initial', margin: 0, whiteSpace: 'pre-line !important' }, style), children: data.text }));
}
function Compose({ data }) {
    let i = 0;
    let content = [];
    while (i < (data === null || data === void 0 ? void 0 : data.length)) {
        const firstCol = data[i];
        const secondCol = data[i + 1];
        if (firstCol && secondCol) {
            content.push((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ComposeItem, { data: firstCol.data, style: { whiteSpace: 'nowrap' } }) }), (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ComposeItem, { data: secondCol.data, style: { wordBreak: 'break-all' } }) })] }, i));
        }
        else if (firstCol) {
            content.push((0, jsx_runtime_1.jsx)("tr", { children: (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ComposeItem, { data: firstCol.data }) }) }, i));
        }
        i += 2;
    }
    return ((0, jsx_runtime_1.jsx)("table", { style: { width: '100%', margin: '1em 0' }, children: (0, jsx_runtime_1.jsx)("tbody", { children: content }) }));
}
exports.default = Compose;
