"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SectionChecker = void 0;
const react_1 = __importDefault(require("react"));
/**
 * Higher-Order Component that takes a section based component as an argument and returns a new component
 * that checks if the 'section' prop is defined before rendering the SectionComponent.
 * If the 'section' prop is undefined, it returns an empty element.
 *
 * @template P - Props of the original SectionComponent
 * @param {React.FC<P>} SectionComponent - The original component that will be wrapped
 * @returns {React.FC<P | (Omit<P, 'section'> & { section?: undefined })>} - The wrapped component
 * @example
 * const CheckedComponent = SectionChecker(({section, ...props}) => {
 *   return <div>{section.title}</div>
 * })
 */
const SectionChecker = (SectionComponent) => {
    const CheckedSectionComponent = (props) => {
        return !props.section ? <></> : <SectionComponent {...props}/>;
    };
    return CheckedSectionComponent;
};
exports.SectionChecker = SectionChecker;
//# sourceMappingURL=SectionChecker.jsx.map