"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = isElementFullyVisible;
var _licitUiCommands = require("@modusoperandi/licit-ui-commands");
function isElementFullyVisible(el) {
  const {
    x,
    y,
    w,
    h
  } = (0, _licitUiCommands.fromHTMlElement)(el);
  // to handle the rounded border scenario.
  const factor = '10px' === el.style.borderRadius ? 3 : 1;
  // Only checks the top-left point.
  const nwEl = w && h ? el.ownerDocument.elementFromPoint(x + factor, y + factor) : null;
  if (!nwEl) {
    return false;
  }
  if (nwEl === el) {
    return true;
  }
  if (el.contains(nwEl)) {
    return true;
  }
  return false;
}