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/SaleDetailFooter.tsx
var SaleDetailFooter_exports = {};
__export(SaleDetailFooter_exports, {
  SaleDetailFooter: () => SaleDetailFooter,
  default: () => SaleDetailFooter_default
});
module.exports = __toCommonJS(SaleDetailFooter_exports);
var import_react = __toESM(require("react"));
var import_classnames = __toESM(require("classnames"));
var import_utils = require("@pisell/utils");
var import_pisellSaleSummaryDetail = __toESM(require("../../../../../plus/pisellSaleSummaryDetail"));
var import_Summary = require("../../../../../plus/saleDetail/components/Summary/index.less");
var PREFIX = "pisell-sale-detail-summary";
function getItemCountText(count) {
  const formatItemCount = import_utils.locales.getText("payment.result.item-count");
  if (typeof formatItemCount === "function") {
    return formatItemCount(count);
  }
  const unit = import_utils.locales.getText(
    count === 1 ? "payment.result.item" : "payment.result.items"
  );
  return `${count} ${unit}`;
}
var SaleDetailFooter = (0, import_react.memo)(function SaleDetailFooter2({
  footer
}) {
  const [expanded, setExpanded] = (0, import_react.useState)(false);
  const {
    itemCount,
    totalText,
    paidText,
    hasPaymentSurcharge,
    statusLabel,
    statusStyle,
    balanceDueText,
    isRefund,
    detailDataSource
  } = footer;
  const canExpand = !!detailDataSource;
  const showExpand = canExpand && expanded;
  return /* @__PURE__ */ import_react.default.createElement("section", { className: (0, import_classnames.default)(PREFIX, { [`${PREFIX}--open`]: expanded }) }, showExpand ? (
    // 内联展开（非 portal）。限高在 PaymentResultToastV2.less 中按 V2 作用域覆盖，
    // 避免在 toast 卡片内过高溢出，内部由 __popover-content 自带滚动。
    /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__popover-panel` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__popover-content` }, /* @__PURE__ */ import_react.default.createElement(import_pisellSaleSummaryDetail.default, { dataSource: detailDataSource })))
  ) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__bar` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__top` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__meta` }, /* @__PURE__ */ import_react.default.createElement("span", { className: `${PREFIX}__item-count` }, getItemCountText(itemCount)), /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("payment.result.total"), " ", totalText), /* @__PURE__ */ import_react.default.createElement("span", { className: `${PREFIX}__dot` }), /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("payment.result.paidLabel"), " ", paidText), hasPaymentSurcharge ? /* @__PURE__ */ import_react.default.createElement("span", { className: `${PREFIX}__payment-sc-note` }, import_utils.locales.getText("payment.result.exclPaymentSc")) : null), canExpand ? /* @__PURE__ */ import_react.default.createElement(
    "button",
    {
      type: "button",
      className: `${PREFIX}__detail-trigger`,
      "aria-expanded": expanded,
      onClick: () => setExpanded((prev) => !prev)
    },
    /* @__PURE__ */ import_react.default.createElement(
      "span",
      {
        className: (0, import_classnames.default)(`${PREFIX}__detail-icon`, {
          [`${PREFIX}__detail-icon--open`]: expanded
        }),
        "aria-hidden": true
      },
      /* @__PURE__ */ import_react.default.createElement("span", { className: `${PREFIX}__detail-chevron` })
    ),
    /* @__PURE__ */ import_react.default.createElement("span", { className: `${PREFIX}__detail-text` }, import_utils.locales.getText("payment.result.detail"))
  ) : null), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__bottom` }, statusLabel ? /* @__PURE__ */ import_react.default.createElement("span", { className: `${PREFIX}__status`, style: statusStyle }, String(statusLabel).toUpperCase()) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__balance` }, /* @__PURE__ */ import_react.default.createElement("span", { className: `${PREFIX}__balance-label` }, import_utils.locales.getText("payment.result.balanceDue")), /* @__PURE__ */ import_react.default.createElement(
    "span",
    {
      className: (0, import_classnames.default)(`${PREFIX}__amount`, {
        [`${PREFIX}__amount--refund`]: isRefund
      })
    },
    balanceDueText
  )))));
});
SaleDetailFooter.displayName = "PaymentResultToastV2SaleDetailFooter";
var SaleDetailFooter_default = SaleDetailFooter;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  SaleDetailFooter
});
