import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
// @ts-nocheck
import * as React from 'react';
import classNames from 'classnames';
import ResizeObserver from '../rc-resize-observer';
export default function Item(props) {
  var prefixCls = props.prefixCls,
      item = props.item,
      renderItem = props.renderItem,
      responsive = props.responsive,
      registerSize = props.registerSize,
      itemKey = props.itemKey,
      className = props.className,
      style = props.style,
      children = props.children,
      display = props.display,
      order = props.order;
  var mergedHidden = responsive && !display; // ================================ Effect ================================

  function internalRegisterSize(width) {
    registerSize(itemKey, width);
  }

  React.useEffect(function () {
    return function () {
      internalRegisterSize(null);
    };
  }, []); // ================================ Render ================================

  var childNode = item !== undefined ? renderItem(item) : children;
  var itemNode = /*#__PURE__*/React.createElement("div", {
    className: classNames(prefixCls, className),
    style: _objectSpread({
      opacity: mergedHidden ? 0.2 : 1,
      height: mergedHidden ? 0 : undefined,
      overflowY: mergedHidden ? 'hidden' : undefined,
      order: responsive ? order : undefined,
      pointerEvents: mergedHidden ? 'none' : undefined
    }, style)
  }, childNode);

  if (responsive) {
    itemNode = /*#__PURE__*/React.createElement(ResizeObserver, {
      onResize: function onResize(_ref) {
        var offsetWidth = _ref.offsetWidth;
        internalRegisterSize(offsetWidth);
      }
    }, itemNode);
  }

  return itemNode;
}