"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.name = void 0;

var React = _interopRequireWildcard(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _styles = require("@fluent-ui/styles");

var _propTypes = _interopRequireDefault(require("@styled-system/prop-types"));

var _Box = require("./Box.styled");

var _Box2 = require("./Box.type");

var _utils = require("../utils");

var _omitProps = require("./omitProps");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var name = 'Box';
exports.name = name;
var useStyles = (0, _styles.createUseStyles)(_Box.styles, {
  name: name
});
var Box = React.forwardRef(function (props, ref) {
  var _props$as = props.as,
      Component = _props$as === void 0 ? 'div' : _props$as,
      classNameProp = props.className,
      id = props.id,
      style = props.style,
      onClick = props.onClick,
      children = props.children,
      _props$acrylic = props.acrylic,
      acrylic = _props$acrylic === void 0 ? false : _props$acrylic,
      rest = _objectWithoutProperties(props, ["as", "className", "id", "style", "onClick", "children", "acrylic"]);

  var classes = useStyles(props);
  var className = (0, _classnames["default"])(classes.root, classes.system, _defineProperty({}, classes.acrylic, acrylic), classNameProp);
  var otherProps = (0, _utils.omit)(rest, _omitProps.omitProps);

  var _props = _objectSpread({
    className: className,
    ref: ref,
    id: id,
    style: style,
    onClick: onClick
  }, otherProps);

  return React.createElement(Component, _props, children);
});
Box.displayName = "F".concat(name);
Box.propTypes = _objectSpread({}, _propTypes["default"].space, {}, _propTypes["default"].color, {}, _propTypes["default"].typography, {}, _propTypes["default"].layout, {}, _propTypes["default"].background, {}, _propTypes["default"].border, {}, _propTypes["default"].position, {}, _propTypes["default"].shadow, {}, _propTypes["default"].flexbox, {}, _propTypes["default"].grid, {}, _Box2.BoxPropTypes); // @ts-ignore

var _default = (0, _styles.withTheme)(Box);

exports["default"] = _default;