import React__default, { useContext } from "react";
import cs from "../_util/classNames.js";
import { TabsContext } from "./tabs.js";
import { jsx } from "../../../../../../@emotion_react@11.10.4_3toe27fv7etiytxb5kxc7fxaw4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
function TabContent(props) {
  var _a;
  var animation = props.animation, activeTab = props.activeTab, prefixCls = props.prefixCls, paneChildren = props.paneChildren, direction = props.direction, lazyload = props.lazyload, destroyOnHide = props.destroyOnHide;
  var activeIndex = paneChildren.findIndex(function(p) {
    return p.key === activeTab;
  });
  var ctxProps = useContext(TabsContext);
  if (paneChildren.every(function(x) {
    return (x === null || x === void 0 ? void 0 : x.props) && (!("children" in x.props) || x.props.children === null);
  })) {
    return null;
  }
  var classNamesContentInner = cs(prefixCls + "-content-inner", (_a = {}, _a[prefixCls + "-animation"] = animation, _a));
  return /* @__PURE__ */ jsx("div", {
    className: prefixCls + "-content " + prefixCls + "-content-" + direction,
    children: /* @__PURE__ */ jsx("div", {
      className: classNamesContentInner,
      style: {
        marginLeft: "-" + activeIndex * 100 + "%"
      },
      children: paneChildren.map(function(child, index) {
        var _a2;
        var _b = ctxProps.getIdPrefix(index), tabpane = _b.tabpane, tab = _b.tab;
        var mergedDestroyOnHide = "destroyOnHide" in child.props ? child.props.destroyOnHide : destroyOnHide;
        var isActive = child.key === activeTab;
        return /* @__PURE__ */ jsx("div", {
          className: cs(prefixCls + "-content-item", (_a2 = {}, _a2[prefixCls + "-content-item-active"] = isActive, _a2)),
          role: "tabpanel",
          id: tabpane,
          "aria-hidden": isActive ? void 0 : true,
          tabIndex: isActive ? 0 : -1,
          "aria-labelledby": tab,
          children: activeIndex !== index && mergedDestroyOnHide ? null : React__default.cloneElement(child, {
            lazyload,
            isActive
          })
        }, child.key);
      })
    })
  });
}
export {
  TabContent as default
};
//# sourceMappingURL=tab-content.js.map
