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/components/checkout/components/PaymentResultToastV2/components/ActionButtons.tsx
var ActionButtons_exports = {};
__export(ActionButtons_exports, {
  default: () => ActionButtons_default
});
module.exports = __toCommonJS(ActionButtons_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_classnames = __toESM(require("classnames"));
var import_materials = require("@pisell/materials");
var import_utils = require("@pisell/utils");
var PREFIX = "payment-result-toast-v2";
var ActionButtons = (0, import_react.memo)(
  ({ buttonGroupList = [], tone }) => {
    if (!buttonGroupList.length) return null;
    const isDanger = tone === "error";
    return /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__action-bar` }, buttonGroupList.map((row, rowIndex) => /* @__PURE__ */ import_react.default.createElement("div", { key: rowIndex, className: `${PREFIX}__action-row` }, row.map((item, index) => {
      const {
        isMore = false,
        id = `${rowIndex}-${index}`,
        menuData = [],
        buttonProps
      } = item;
      const { children, className, ...restButtonProps } = buttonProps || {};
      const isPrimary = typeof className === "string" && className.includes("primary-button");
      const btnClassName = (0, import_classnames.default)(`${PREFIX}__action-btn`, {
        [`${PREFIX}__action-btn--more`]: isMore,
        [`${PREFIX}__action-btn--grow`]: !isMore,
        [`${PREFIX}__action-btn--primary`]: isPrimary,
        [`${PREFIX}__action-btn--danger`]: isDanger
      });
      if (isMore) {
        const { icon: _icon, ...moreRest } = restButtonProps;
        const moreChildren = children ?? import_utils.locales.getText("payment.result.more");
        return /* @__PURE__ */ import_react.default.createElement(
          import_antd.Dropdown,
          {
            key: id,
            menu: { items: menuData },
            trigger: ["click"]
          },
          /* @__PURE__ */ import_react.default.createElement(
            import_materials.Button,
            {
              ...moreRest,
              className: btnClassName
            },
            moreChildren
          )
        );
      }
      return /* @__PURE__ */ import_react.default.createElement(
        import_materials.Button,
        {
          key: id,
          ...restButtonProps,
          className: btnClassName
        },
        children
      );
    }))));
  }
);
ActionButtons.displayName = "PaymentResultToastV2ActionButtons";
var ActionButtons_default = ActionButtons;
