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/AdditionalModule/index.tsx
var AdditionalModule_exports = {};
__export(AdditionalModule_exports, {
  default: () => AdditionalModule_default
});
module.exports = __toCommonJS(AdditionalModule_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_icons = require("@ant-design/icons");
var import_utils = require("@pisell/utils");
var import_materials = require("@pisell/materials");
var import_index = require("./index.less");
var import_locales = require("../../../../utils/locales");
var import_locales2 = __toESM(require("./locales"));
var import_useToast = __toESM(require("../../../../hooks/useToast"));
function AdditionalModule({
  orderInfo,
  customAmount,
  handleButtonClick,
  hasOrderNote = false,
  disabled = false,
  showCashPayment = false
}) {
  import_utils.locales.init(import_locales2.default, (0, import_locales.getLocale)());
  const moreMenuItems = [
    {
      key: "send-link",
      label: import_utils.locales.getText("pisell2.text.send-link"),
      icon: /* @__PURE__ */ import_react.default.createElement(import_icons.LinkOutlined, null)
    }
  ];
  const Toast = (0, import_useToast.default)();
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "additional-module" }, showCashPayment && /* @__PURE__ */ import_react.default.createElement("div", { className: "additional-module-title" }, import_utils.locales.getText("pisell2.text.others")), /* @__PURE__ */ import_react.default.createElement("div", { className: "additional-module-buttons-container" }, showCashPayment ? (
    // Grid布局模式：两行布局（显示现金支付模块时）
    /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "additional-module-button-row" }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        className: `additional-module-button-base purple-theme ${hasOrderNote ? "note-button" : ""}`,
        onClick: () => {
          handleButtonClick("order-note");
        },
        icon: /* @__PURE__ */ import_react.default.createElement(
          import_materials.Icon,
          {
            type: "pisell2-clipboard-minus",
            className: "additional-module-button-icon"
          }
        ),
        size: "large"
      },
      import_utils.locales.getText("pisell2.text.order-note"),
      hasOrderNote && /* @__PURE__ */ import_react.default.createElement("span", { className: "note-indicator" }, /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { type: "pisell2-info-circle2" }))
    ), /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        className: "additional-module-button-base purple-theme",
        onClick: () => {
          handleButtonClick("print-receipt");
        },
        icon: /* @__PURE__ */ import_react.default.createElement(
          import_materials.Icon,
          {
            type: "pisell2-printer",
            className: "additional-module-button-icon"
          }
        ),
        size: "large"
      },
      import_utils.locales.getText("pisell2.text.print-receipt")
    )), /* @__PURE__ */ import_react.default.createElement("div", { className: "additional-module-button-row" }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        className: "additional-module-button-base purple-theme",
        onClick: () => {
          handleButtonClick("manual-discount");
        },
        icon: /* @__PURE__ */ import_react.default.createElement(
          import_materials.Icon,
          {
            type: "pisell2-sale-01",
            className: "additional-module-button-icon"
          }
        ),
        size: "large"
      },
      import_utils.locales.getText(
        "pisell2.text.additional-module.order-discount"
      )
    ), /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        className: `additional-module-button-base ${disabled ? "disabled-theme" : "orange-theme"}`,
        onClick: () => {
          handleButtonClick("save-pay-later");
        },
        disabled,
        size: "large",
        icon: /* @__PURE__ */ import_react.default.createElement(import_icons.ClockCircleOutlined, { className: "additional-module-button-icon" })
      },
      import_utils.locales.getText("pisell2.text.save-pay-later")
    ), /* @__PURE__ */ import_react.default.createElement(
      import_antd.Dropdown,
      {
        menu: {
          items: moreMenuItems,
          onClick: ({ key }) => {
            console.log("Menu item clicked:", key);
            if (key === "send-link") {
              if (!disabled) {
                handleButtonClick("send-link");
              } else {
                Toast.fail(
                  import_utils.locales.getText(
                    "pisell2.text.order-no-payment-cannot-send-link"
                  )
                );
              }
            }
          }
        },
        trigger: ["click"],
        placement: "bottomLeft",
        overlayStyle: { zIndex: 9999 },
        mouseEnterDelay: 0.1,
        mouseLeaveDelay: 0.1,
        onOpenChange: (open) => {
          console.log("Dropdown state changed:", open);
        }
      },
      /* @__PURE__ */ import_react.default.createElement(
        import_antd.Button,
        {
          size: "large",
          className: "additional-module-button-base more-button",
          icon: /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { type: "pisell2-dots-vertical", size: 20 })
        }
      )
    )))
  ) : (
    // Flex布局模式：一行布局（不显示现金支付模块时）
    /* @__PURE__ */ import_react.default.createElement("div", { className: "additional-module-button-row" }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        className: `additional-module-button-base purple-theme ${hasOrderNote ? "note-button" : ""}`,
        onClick: () => {
          handleButtonClick("order-note");
        },
        size: "large",
        icon: /* @__PURE__ */ import_react.default.createElement(
          import_materials.Icon,
          {
            type: "pisell2-clipboard-minus",
            className: "additional-module-button-icon"
          }
        )
      },
      import_utils.locales.getText("pisell2.text.order-note"),
      hasOrderNote && /* @__PURE__ */ import_react.default.createElement("span", { className: "note-indicator" }, /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { type: "pisell2-info-circle2" }))
    ), /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        className: "additional-module-button-base purple-theme",
        onClick: () => {
          handleButtonClick("print-receipt");
        },
        size: "large",
        icon: /* @__PURE__ */ import_react.default.createElement(
          import_materials.Icon,
          {
            type: "pisell2-printer",
            className: "additional-module-button-icon"
          }
        )
      },
      import_utils.locales.getText("pisell2.text.print-receipt")
    ), /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        className: "additional-module-button-base purple-theme",
        onClick: () => {
          handleButtonClick("manual-discount");
        },
        icon: /* @__PURE__ */ import_react.default.createElement(
          import_materials.Icon,
          {
            type: "pisell2-sale-01",
            className: "additional-module-button-icon"
          }
        ),
        size: "large"
      },
      import_utils.locales.getText("pisell2.text.additional-module.order-discount")
    ), /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        className: `additional-module-button-base ${disabled ? "disabled-theme" : "orange-theme"}`,
        onClick: () => {
          handleButtonClick("save-pay-later");
        },
        disabled,
        size: "large",
        icon: /* @__PURE__ */ import_react.default.createElement(import_icons.ClockCircleOutlined, { className: "additional-module-button-icon" })
      },
      import_utils.locales.getText("pisell2.text.save-pay-later")
    ), /* @__PURE__ */ import_react.default.createElement(
      import_antd.Dropdown,
      {
        menu: {
          items: moreMenuItems,
          onClick: ({ key }) => {
            console.log("Menu item clicked:", key);
            if (key === "send-link") {
              if (!disabled) {
                handleButtonClick("send-link");
              } else {
                Toast.fail(
                  import_utils.locales.getText(
                    "pisell2.text.order-no-payment-cannot-send-link"
                  )
                );
              }
            }
          }
        },
        trigger: ["click"],
        placement: "bottomLeft",
        overlayStyle: { zIndex: 9999 },
        mouseEnterDelay: 0.1,
        mouseLeaveDelay: 0.1,
        onOpenChange: (open) => {
          console.log("Dropdown state changed:", open);
        }
      },
      /* @__PURE__ */ import_react.default.createElement(
        import_antd.Button,
        {
          className: "additional-module-button-base more-button",
          size: "large",
          icon: /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { type: "pisell2-dots-vertical", size: 20 })
        }
      )
    ))
  )));
}
var AdditionalModule_default = AdditionalModule;
