"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.usePCEditorItemWrap = usePCEditorItemWrap;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const blockIdContext_1 = require("../context/blockIdContext/index.js");
const usePCEditorBlockMouseEvents_1 = tslib_1.__importDefault(require("./usePCEditorBlockMouseEvents.js"));
const usePCEditorBlockSelection_1 = tslib_1.__importDefault(require("./usePCEditorBlockSelection.js"));
function usePCEditorItemWrap(index = 0) {
    const [element, setElement] = React.useState();
    const blockRef = React.useCallback((node) => {
        if (node !== null) {
            setElement(node);
        }
    }, []);
    const parentBlockId = React.useContext(blockIdContext_1.BlockIdContext);
    const adminBlockMouseEvents = (0, usePCEditorBlockMouseEvents_1.default)([...parentBlockId, index], element);
    (0, usePCEditorBlockSelection_1.default)([...parentBlockId, index], element);
    return { adminBlockMouseEvents, blockRef };
}
//# sourceMappingURL=usePCEditorItemWrap.js.map
