"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = useBlockLock;
var _data = require("@wordpress/data");
var _store = require("../../store");
/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

/**
 * Return details about the block lock status.
 *
 * @param {string} clientId The block client Id.
 *
 * @return {Object} Block lock status
 */
function useBlockLock(clientId) {
  return (0, _data.useSelect)(select => {
    const {
      canEditBlock,
      canMoveBlock,
      canRemoveBlock,
      canLockBlockType,
      getBlockName,
      getTemplateLock
    } = select(_store.store);
    const canEdit = canEditBlock(clientId);
    const canMove = canMoveBlock(clientId);
    const canRemove = canRemoveBlock(clientId);
    return {
      canEdit,
      canMove,
      canRemove,
      canLock: canLockBlockType(getBlockName(clientId)),
      isContentLocked: getTemplateLock(clientId) === 'contentOnly',
      isLocked: !canEdit || !canMove || !canRemove
    };
  }, [clientId]);
}
//# sourceMappingURL=use-block-lock.js.map