var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
import { useEffect, useState } from "react";
export var TimedRender = function (_a) {
    var children = _a.children, startRender = _a.startRender, stopRender = _a.stopRender, delay = _a.delay;
    var _b = __read(useState(false), 2), shouldRender = _b[0], setShouldRender = _b[1];
    useEffect(function () {
        startRender && setShouldRender(true);
        if (stopRender) {
            var timer_1 = setTimeout(function () {
                setShouldRender(false);
            }, delay);
            return function () { return clearTimeout(timer_1); };
        }
    }, [startRender, stopRender, delay]);
    if (shouldRender)
        return children;
    return _jsx(_Fragment, {});
};
//# sourceMappingURL=index.js.map