var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/plus/saleDetail/shared/SaleDetailTabs/index.tsx
var SaleDetailTabs_exports = {};
__export(SaleDetailTabs_exports, {
  SaleDetailTabs: () => SaleDetailTabs
});
module.exports = __toCommonJS(SaleDetailTabs_exports);
var import_react = __toESM(require("react"));
var import_classnames = __toESM(require("classnames"));
function SaleDetailTabs({
  activeKey: controlledActiveKey,
  className,
  defaultActiveKey,
  items,
  onActiveKeyChange
}) {
  var _a;
  const initialActiveKey = defaultActiveKey || ((_a = items[0]) == null ? void 0 : _a.key);
  const [innerActiveKey, setInnerActiveKey] = (0, import_react.useState)(initialActiveKey);
  const activeKey = controlledActiveKey ?? innerActiveKey;
  const activeItem = (0, import_react.useMemo)(
    () => items.find((item) => item.key === activeKey) || items[0],
    [activeKey, items]
  );
  const handleActiveKeyChange = (key) => {
    if (controlledActiveKey === void 0) {
      setInnerActiveKey(key);
    }
    onActiveKeyChange == null ? void 0 : onActiveKeyChange(key);
  };
  if (!items.length) {
    return null;
  }
  return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-sale-detail-tabs", className) }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-sale-detail-tabs__nav", role: "tablist" }, items.map((item) => {
    const active = item.key === (activeItem == null ? void 0 : activeItem.key);
    return /* @__PURE__ */ import_react.default.createElement(
      "button",
      {
        key: item.key,
        type: "button",
        role: "tab",
        "aria-selected": active,
        className: (0, import_classnames.default)("pisell-sale-detail-tabs__tab", {
          "pisell-sale-detail-tabs__tab--active": active
        }),
        onClick: () => handleActiveKeyChange(item.key)
      },
      item.title
    );
  })), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-sale-detail-tabs__content", role: "tabpanel" }, activeItem == null ? void 0 : activeItem.content));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  SaleDetailTabs
});
