"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "Footer", {
    enumerable: true,
    get: function() {
        return Footer;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _layoutContext = require("./layoutContext");
const _reactslot = require("@radix-ui/react-slot");
const _ = require("..");
const Footer = (props)=>{
    const ref = (0, _react.useRef)(null);
    const { asChild, className, ...rest } = props;
    const { setFooterHeight, isTopLevel } = (0, _react.useContext)(_layoutContext.LayoutContext);
    if (!isTopLevel) {
        throw new Error("Footer component must be in top layout component.");
    }
    (0, _react.useEffect)(()=>{
        const boundingClientRect = ref.current?.getBoundingClientRect();
        if (boundingClientRect && boundingClientRect.height) {
            // console.log(boundingClientRect);
            setFooterHeight(boundingClientRect.height);
        }
    }, []);
    const Comp = asChild ? _reactslot.Slot : "div";
    return /*#__PURE__*/ (0, _jsxruntime.jsx)(Comp, {
        ...rest,
        className: (0, _.cn)("orderly-fixed orderly-bottom-0 orderly-left-0 orderly-right-0", className),
        ref: ref
    });
};
Footer.displayName = "Footer";

//# sourceMappingURL=footer.js.map