var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/pay/toC/PaymentMethods/OfflinePayment/index.tsx
var OfflinePayment_exports = {};
__export(OfflinePayment_exports, {
  default: () => OfflinePayment_default
});
module.exports = __toCommonJS(OfflinePayment_exports);
var import_react = require("react");
var import_serve = require("./serve");
var import_model = require("../../model");
var import_payGroup = require("../../payGroup");
var import_index = require("./index.less");
var OfflinePayment = (props, ref) => {
  const { state } = (0, import_react.useContext)(import_model.Context);
  const init = async ({ payGroup }) => {
    var _a;
    const _item = payGroup == null ? void 0 : payGroup.otherPayment;
    const params = (0, import_payGroup.getPayGroupParamsFromStorage)(payGroup == null ? void 0 : payGroup.order_id, {
      order_id: payGroup == null ? void 0 : payGroup.order_id,
      payment_method: (_a = _item == null ? void 0 : _item.params) == null ? void 0 : _a.payment_method
    });
    if (!params) {
      return;
    }
    await (0, import_serve.offlinePayment)(params);
    state.payCallback({ key: "success" });
  };
  (0, import_react.useImperativeHandle)(
    ref,
    () => ({
      init
    })
  );
  return null;
};
var OfflinePayment_default = (0, import_react.forwardRef)(OfflinePayment);
