import { jsx } from 'react/jsx-runtime';
import * as React from 'react';
import FloatingRect from './FloatingRect.js';
import useSelector from './use-selector.js';
import { getRangeDimensions } from './util.js';

const Copied = ({ scrollPos = { top: 0, left: 0 } }) => {
    const fullRange = useSelector((state) => state.copied);
    const hidden = fullRange === null;
    const dimensions = useSelector((state) => fullRange &&
        getRangeDimensions(state.rowDimensions, state.columnDimensions, fullRange));
    const adjustedDimensions = React.useMemo(() => {
        if (!dimensions)
            return undefined;
        return {
            ...dimensions,
            top: dimensions.top - 1,
            left: dimensions.left - 1,
            height: dimensions.height - 1,
            width: dimensions.width - 1,
        };
    }, [dimensions, scrollPos]);
    return (jsx(FloatingRect, { variant: "copied", dimensions: adjustedDimensions, hidden: hidden || !dimensions, dragging: false }));
};

export { Copied as default };
//# sourceMappingURL=Copied.js.map
