"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useLogic = void 0;
const react_1 = require("react");
const utils_1 = require("../../utils");
const useLogic = ({ sections, }) => {
    const leftColumns = sections.find((section) => section.position === 'left')?.columns;
    const rightColumns = sections.find((section) => section.position === 'right')?.columns;
    const pinnedContainerStyles = {
        '--left-columns-count': leftColumns
            ? (0, utils_1.getFlattenColumns)(leftColumns).length
            : 0,
        '--right-columns-count': rightColumns
            ? (0, utils_1.getFlattenColumns)(rightColumns).length
            : 0,
    };
    const sectionOffsets = (0, react_1.useMemo)(() => {
        const offsets = {};
        let currentOffset = 0;
        sections.forEach((section) => {
            offsets[section.position] = currentOffset;
            currentOffset += (0, utils_1.getFlattenColumns)(section.columns).length;
        });
        return offsets;
    }, [sections]);
    return { pinnedContainerStyles, sectionOffsets };
};
exports.useLogic = useLogic;
