"use strict";
const React = require("react");
const meta = require("./meta.js");
const index = require("../ConfigProvider/index.js");
const classNames = require("../_util/classNames.js");
const useMergeProps = require("../_util/hooks/useMergeProps.js");
const emotionReactJsxRuntime_browser_esm = require("../../../../../../@emotion_react@11.10.4_3toe27fv7etiytxb5kxc7fxaw4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");
const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
const React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
var __assign = globalThis && globalThis.__assign || function() {
  __assign = Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];
      for (var p in s)
        if (Object.prototype.hasOwnProperty.call(s, p))
          t[p] = s[p];
    }
    return t;
  };
  return __assign.apply(this, arguments);
};
var __rest = globalThis && globalThis.__rest || function(s, e) {
  var t = {};
  for (var p in s)
    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
      t[p] = s[p];
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
      if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
        t[p[i]] = s[p[i]];
    }
  return t;
};
var defaultProps = {
  actionLayout: "horizontal"
};
function Item(baseProps, ref) {
  var _a = React.useContext(index.ConfigContext), getPrefixCls = _a.getPrefixCls, componentConfig = _a.componentConfig;
  var props = useMergeProps(baseProps, defaultProps, componentConfig && componentConfig["List.Item"]);
  var children = props.children, className = props.className, actions = props.actions, extra = props.extra, actionLayout = props.actionLayout, rest = __rest(props, ["children", "className", "actions", "extra", "actionLayout"]);
  var prefixCls = getPrefixCls("list");
  var baseClassName = prefixCls + "-item";
  var metaContent = [];
  var mainContent = [];
  React__default.default.Children.forEach(children, function(element) {
    if (element && element.type && element.type === meta) {
      metaContent.push(element);
    } else {
      mainContent.push(element);
    }
  });
  var content = mainContent.length ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
    className: baseClassName + "-content",
    children: mainContent
  }) : null;
  var extraContent = extra ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
    className: baseClassName + "-extra-content",
    children: extra
  }) : null;
  var actionsContent = actions && actions.length ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
    className: baseClassName + "-action",
    children: actions.map(function(action, i) {
      return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("li", {
        children: action
      }, baseClassName + "-action-" + i);
    })
  }) : null;
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
    ...__assign({
      role: "listitem",
      ref,
      className: classNames(baseClassName, className)
    }, rest),
    children: [/* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
      className: baseClassName + "-main",
      children: [metaContent, content, actionLayout === "vertical" ? actionsContent : null]
    }), actionLayout === "horizontal" ? actionsContent : null, extraContent]
  });
}
var ForwardRefItem = React__default.default.forwardRef(Item);
var ItemComponent = ForwardRefItem;
ItemComponent.displayName = "ListItem";
ItemComponent.Meta = meta;
const Item$1 = ItemComponent;
module.exports = Item$1;
//# sourceMappingURL=item.js.map
