/*!
 * Built by Revolist OU ❤️
 */
export function getRangeFillClipboardData(data, useClipboard) {
    var _a;
    if (!isClipboardRangeFillEnabled(useClipboard)) {
        return null;
    }
    const normalized = trimTrailingEmptyClipboardRows(data);
    return normalized.length === 1 && ((_a = normalized[0]) === null || _a === void 0 ? void 0 : _a.length) === 1
        ? normalized
        : null;
}
export function isClipboardRangeFillEnabled(useClipboard) {
    return (typeof useClipboard === 'object' && useClipboard.rangeFill === true);
}
function trimTrailingEmptyClipboardRows(data) {
    const rows = [...data];
    while (rows.length > 1 && isEmptyClipboardRow(rows[rows.length - 1])) {
        rows.pop();
    }
    return rows;
}
function isEmptyClipboardRow(row) {
    return !row || row.every(cell => cell === '');
}
