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/pay/toC/WalletPassBlock/components/WalletBestValueFound/index.tsx
var WalletBestValueFound_exports = {};
__export(WalletBestValueFound_exports, {
  default: () => WalletBestValueFound_default
});
module.exports = __toCommonJS(WalletBestValueFound_exports);
var import_react = __toESM(require("react"));
var import_materials = require("@pisell/materials");
var import_antd = require("antd");
var import_utils = require("@pisell/utils");
var import_WalletUseList = __toESM(require("../WalletUseList"));
var import_index = require("./index.less");
var WalletBestValueFound = (props, ref) => {
  var _a, _b;
  const { onEdit, walletSetting, payGroup, onUnused } = props;
  const [open, setOpen] = (0, import_react.useState)(false);
  (0, import_react.useImperativeHandle)(ref, () => ({
    open: () => {
      setOpen(true);
    }
  }));
  const handleEdit = () => {
    setOpen(false);
    onEdit();
  };
  return /* @__PURE__ */ import_react.default.createElement(
    import_materials.PisellModal,
    {
      title: import_utils.locales.getText("tocPay.text.bestValueFound"),
      open,
      footer: null,
      headerDivider: false,
      closable: true,
      onCancel: () => setOpen(false),
      onOk: () => setOpen(false),
      wrapClassName: "toc-pay-wallet-best-value-found-modal",
      mobileModalHeight: "auto"
    },
    /* @__PURE__ */ import_react.default.createElement("div", { className: "toc-pay-wallet-best-value-found-container" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "toc-pay-wallet-best-value-found-header" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "toc-pay-wallet-best-value-found-wallet-icon" }, /* @__PURE__ */ import_react.default.createElement(
      import_materials.Icon,
      {
        type: "pisell2-a-wallet-021",
        className: "toc-pay-wallet-best-value-found-icon"
      }
    )), /* @__PURE__ */ import_react.default.createElement("h3", { className: "toc-pay-wallet-best-value-found-subtitle" }, import_utils.locales.getText("tocPay.text.welcomeToUseWalletPass")(
      walletSetting.name
    ))), /* @__PURE__ */ import_react.default.createElement("div", { className: "toc-pay-wallet-best-value-found-savings-card" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "toc-pay-wallet-best-value-found-savings-row" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "toc-pay-wallet-best-value-found-label" }, import_utils.locales.getText("tocPay.text.totalSavings")), /* @__PURE__ */ import_react.default.createElement("span", { className: "toc-pay-wallet-best-value-found-amount" }, /* @__PURE__ */ import_react.default.createElement(import_materials.PisellText.Amount, { value: (_a = payGroup == null ? void 0 : payGroup.walletPass) == null ? void 0 : _a.amount }))), /* @__PURE__ */ import_react.default.createElement("div", { className: "toc-pay-wallet-best-value-found-description" }, import_utils.locales.getText("tocPay.text.bestCombination")(walletSetting.name))), /* @__PURE__ */ import_react.default.createElement("div", { className: "toc-pay-wallet-best-value-found-recommended-section" }, /* @__PURE__ */ import_react.default.createElement("h4", { className: "toc-pay-wallet-best-value-found-section-title" }, import_utils.locales.getText("tocPay.text.recommended")), /* @__PURE__ */ import_react.default.createElement("div", { className: "toc-pay-wallet-best-value-found-option-list" }, /* @__PURE__ */ import_react.default.createElement(import_WalletUseList.default, { walletPass: ((_b = payGroup == null ? void 0 : payGroup.walletPass) == null ? void 0 : _b.cards) || [] }))), /* @__PURE__ */ import_react.default.createElement("div", { className: "toc-pay-wallet-best-value-found-actions" }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        className: "toc-pay-wallet-best-value-found-edit-button",
        onClick: handleEdit
      },
      import_utils.locales.getText("tocPay.text.edit")
    ), /* @__PURE__ */ import_react.default.createElement(
      import_antd.Button,
      {
        type: "primary",
        className: "toc-pay-wallet-best-value-found-confirm-button",
        onClick: () => setOpen(false)
      },
      import_utils.locales.getText("tocPay.text.confirm")
    )), /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: "toc-pay-wallet-best-value-found-footer",
        onClick: () => {
          setOpen(false);
          onUnused();
        }
      },
      import_utils.locales.getText("tocPay.text.unusedAndContinueToPayment")
    ))
  );
};
var WalletBestValueFound_default = (0, import_react.forwardRef)(WalletBestValueFound);
