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/PaymentMethods/GlobePayQrcode/index.tsx
var GlobePayQrcode_exports = {};
__export(GlobePayQrcode_exports, {
  default: () => GlobePayQrcode_default
});
module.exports = __toCommonJS(GlobePayQrcode_exports);
var import_react = require("react");
var import_model = require("../../model");
var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
var import_usePaymentLogger = __toESM(require("../../../../../hooks/usePaymentLogger"));
var import_index = require("./index.less");
var GlobePayQrcode = (props, ref) => {
  var _a;
  const { state } = (0, import_react.useContext)(import_model.Context);
  const context = (0, import_useEngineContext.default)();
  const paymentLogger = (0, import_usePaymentLogger.default)({
    orderId: ((_a = state.payGroup) == null ? void 0 : _a.order_id) || "unknown",
    step: "2"
  });
  const init = async ({ payGroup }) => {
    paymentLogger.addLog({
      key: "GlobePayQrcode初始化开始",
      value: ""
    });
    try {
      let _item = payGroup == null ? void 0 : payGroup.otherPayment;
      paymentLogger.addLog({
        key: "GlobePayQrcode获取支付配置",
        value: ""
      });
      paymentLogger.addLog({
        key: "GlobePayQrcode准备回调",
        value: ""
      });
      paymentLogger.sendLogs("GlobePayQrcode处理成功");
      state.payCallback({
        key: _item.service,
        data: payGroup
      });
      return;
    } catch (err) {
      paymentLogger.addLog({
        key: "GlobePayQrcode处理错误",
        value: {
          title: `订单${payGroup == null ? void 0 : payGroup.order_id} GlobePayQrcode处理失败: ${(err == null ? void 0 : err.message) || "未知错误"}`,
          data: {
            payGroup
          }
        }
      });
      paymentLogger.sendLogs("GlobePayQrcode处理失败", err);
    }
  };
  (0, import_react.useImperativeHandle)(
    ref,
    () => ({
      init
    })
  );
  return null;
};
var GlobePayQrcode_default = (0, import_react.forwardRef)(GlobePayQrcode);
