import * as e from "react";
import F from "../../../classnames/index.mjs";
import P from "../grid/col.mjs";
import { FormContext as E, FormItemPrefixContext as _ } from "./context.mjs";
import j from "./ErrorList.mjs";
import y from "./style/fallbackCmp.mjs";
const D = (c) => {
  const {
    prefixCls: r,
    status: n,
    wrapperCol: h,
    children: b,
    errors: i,
    warnings: p,
    _internalItemRender: o,
    extra: d,
    help: I,
    fieldId: a,
    marginBottom: l,
    onErrorVisibleChanged: v
  } = c, t = `${r}-item`, s = e.useContext(E), u = h || s.wrapperCol || {}, N = F(`${t}-control`, u.className), m = e.useMemo(() => Object.assign({}, s), [s]);
  delete m.labelCol, delete m.wrapperCol;
  const x = /* @__PURE__ */ e.createElement("div", {
    className: `${t}-control-input`
  }, /* @__PURE__ */ e.createElement("div", {
    className: `${t}-control-input-content`
  }, b)), $ = e.useMemo(() => ({
    prefixCls: r,
    status: n
  }), [r, n]), f = l !== null || i.length || p.length ? /* @__PURE__ */ e.createElement("div", {
    style: {
      display: "flex",
      flexWrap: "nowrap"
    }
  }, /* @__PURE__ */ e.createElement(_.Provider, {
    value: $
  }, /* @__PURE__ */ e.createElement(j, {
    fieldId: a,
    errors: i,
    warnings: p,
    help: I,
    helpStatus: n,
    className: `${t}-explain-connected`,
    onVisibleChanged: v
  })), !!l && /* @__PURE__ */ e.createElement("div", {
    style: {
      width: 0,
      height: l
    }
  })) : null, C = {};
  a && (C.id = `${a}_extra`);
  const g = d ? /* @__PURE__ */ e.createElement("div", Object.assign({}, C, {
    className: `${t}-extra`
  }), d) : null, w = o && o.mark === "pro_table_render" && o.render ? o.render(c, {
    input: x,
    errorList: f,
    extra: g
  }) : /* @__PURE__ */ e.createElement(e.Fragment, null, x, f, g);
  return /* @__PURE__ */ e.createElement(E.Provider, {
    value: m
  }, /* @__PURE__ */ e.createElement(P, Object.assign({}, u, {
    className: N
  }), w), /* @__PURE__ */ e.createElement(y, {
    prefixCls: r
  }));
}, V = D;
export {
  V as default
};
