"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useIframeClickBlock = void 0;
const react_1 = require("react");
const useIframeClickBlock = () => {
    const iframeClickRef = (0, react_1.useRef)({});
    (0, react_1.useEffect)(() => {
        const onMessage = (e) => {
            const data = e.data;
            if (!data || typeof data !== 'object')
                return;
            if (data.type === 'IFRAME_CLICK' && data.id) {
                iframeClickRef.current[data.id] = true;
                setTimeout(() => {
                    iframeClickRef.current[data.id] = false;
                }, 0);
            }
        };
        window.addEventListener('message', onMessage);
        return () => window.removeEventListener('message', onMessage);
    }, []);
    return iframeClickRef;
};
exports.useIframeClickBlock = useIframeClickBlock;
//# sourceMappingURL=useIframeClickBlock.js.map