"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useDidUpdateDeepCompareLayoutEffect = void 0;
var react_1 = __importStar(require("react"));
var dequal_1 = require("dequal");
function useDeepCompareMemoize(value) {
    var ref = react_1.default.useRef();
    var signalRef = react_1.default.useRef(false);
    if (!dequal_1.dequal(value, ref.current)) {
        ref.current = value;
        signalRef.current = !signalRef.current;
    }
    return [signalRef.current];
}
exports.useDidUpdateDeepCompareLayoutEffect = function useDidUpdateDeepCompareEffect(effect, deps) {
    var didMountRef = react_1.useRef(false);
    react_1.useLayoutEffect(function () {
        if (didMountRef.current)
            effect();
        else
            didMountRef.current = true;
    }, useDeepCompareMemoize(deps));
};
//# sourceMappingURL=useDidUpdateDeepCompareLayoutEffect.js.map