function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
/**
 * element 消息事件名
 */
export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
  ElementPaymentEvent["RENDER_COMPONENT"] = "renderComponent";
  ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
  ElementPaymentEvent["SIGN_OUT"] = "onSignout";
  ElementPaymentEvent["BLUR"] = "onBlur";
  ElementPaymentEvent["SUBMIT_PAY"] = "submitPay";
  ElementPaymentEvent["VALIDATE"] = "onValidate";
  ElementPaymentEvent["SUBMIT_RISK"] = "onSubmitRisk";
  ElementPaymentEvent["AFTER_SUBMIT"] = "onAfterSubmit";
  ElementPaymentEvent["SIZE_CHANGE"] = "onSizeChange";
  ElementPaymentEvent["LAUNCH"] = "onLaunch";
  ElementPaymentEvent["CALLBACK"] = "callback";
  ElementPaymentEvent["SEND_MUITI_APP_EVENT_TO_SDK"] = "sendMuitiAppEventToSdk";
  ElementPaymentEvent["LOG"] = "log";
  ElementPaymentEvent["HANDLE_PAYMENT"] = "handlePayment";
  ElementPaymentEvent["ON_EVENT_CALLBACK"] = "onEventCallback";
  return ElementPaymentEvent;
}({});
export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
  ElementPaymentMethod["CONTAINER_ELEMENT"] = "CONTAINER_ELEMENT";
  ElementPaymentMethod["AUTH_ELEMENT"] = "AUTH_ELEMENT";
  ElementPaymentMethod["ADDRESS_ELEMENT"] = "ADDRESS_ELEMENT";
  ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
  return ElementPaymentMethod;
}({});
export var ElementType = /*#__PURE__*/function (ElementType) {
  ElementType["auth"] = "auth";
  ElementType["address"] = "address";
  ElementType["payment"] = "payment";
  return ElementType;
}({});

/**
 * TODO 替换外外网链接
 * 支付状态参考: https://yuque.antfin.com/antom_ka_team/yg9y7x/fe8xxqgbivnx5fd2#rGgE
 */
export var PaymentStatus = /*#__PURE__*/function (PaymentStatus) {
  PaymentStatus["SUCCESS"] = "SUCCESS";
  PaymentStatus["PROCESSING"] = "PROCESSING";
  PaymentStatus["CANCELLED"] = "CANCELLED";
  PaymentStatus["PENDING"] = "PENDING";
  PaymentStatus["S"] = "SUCCESS";
  PaymentStatus["F"] = "FAIL";
  PaymentStatus["U"] = "PROCESSING";
  PaymentStatus["FAIL"] = "FAIL";
  return PaymentStatus;
}({});
export var MountElementType = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ElementType.auth, ElementPaymentMethod.AUTH_ELEMENT), ElementType.address, ElementPaymentMethod.ADDRESS_ELEMENT), ElementType.payment, ElementPaymentMethod.PAYMENT_ELEMENT), ElementPaymentMethod.AUTH_ELEMENT, ElementType.auth), ElementPaymentMethod.ADDRESS_ELEMENT, ElementType.address), ElementPaymentMethod.PAYMENT_ELEMENT, ElementType.payment);
export var ThemeType = /*#__PURE__*/function (ThemeType) {
  ThemeType["NostalgicGray"] = "nostalgicGray";
  ThemeType["Default"] = "default";
  ThemeType["Night"] = "night";
  ThemeType["CherryBlossomPink"] = "cherryBlossomPink";
  ThemeType["GamingPurple"] = "gamingPurple";
  ThemeType["AgateGreen"] = "agateGreen";
  return ThemeType;
}({});
export var PaymentElementLayout = /*#__PURE__*/function (PaymentElementLayout) {
  PaymentElementLayout["Tabs"] = "tabs";
  PaymentElementLayout["Accordion"] = "Accordion";
  return PaymentElementLayout;
}({});
export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
  EventCallbackCode["SDK_CREATE_COMPONENT_ERROR"] = "SDK_CREATE_COMPONENT_ERROR";
  EventCallbackCode["SDK_CREATEPAYMENT_PARAMETER_ERROR"] = "SDK_CREATEPAYMENT_PARAMETER_ERROR";
  EventCallbackCode["SDK_PAYMENT_ERROR"] = "SDK_PAYMENT_ERROR";
  EventCallbackCode["SDK_PAYMENT_FAIL"] = "SDK_PAYMENT_FAIL";
  EventCallbackCode["SDK_PAYMENT_CANCEL"] = "SDK_PAYMENT_CANCEL";
  EventCallbackCode["SDK_PAYMENT_SUCCESSFUL"] = "SDK_PAYMENT_SUCCESSFUL";
  EventCallbackCode["SDK_PAYMENT_PROCESSING"] = "SDK_PAYMENT_PROCESSING";
  return EventCallbackCode;
}({});
export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
  ELEMENT_ENVIRONMENT["DEV"] = "DEV";
  ELEMENT_ENVIRONMENT["TEST"] = "TEST";
  ELEMENT_ENVIRONMENT["SIT"] = "SIT";
  ELEMENT_ENVIRONMENT["PRE"] = "PRE";
  ELEMENT_ENVIRONMENT["PROD"] = "PROD";
  ELEMENT_ENVIRONMENT["SANDBOX"] = "SANDBOX";
  return ELEMENT_ENVIRONMENT;
}({});

// environment集成代码都是小写，Element创建时也做了参数转为小写，但类型没处理

// 将短横线命名转为小驼峰

// 同时兼容短横线和小驼峰两种键名

// export type IMountOptions = AddressMountOptions | LinkAuthMountOptions | PaymentMountOptions;

export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbackName) {
  AddressEventCallbackName["SHIPPING_CHANGE"] = "SHIPPING_CHANGE";
  return AddressEventCallbackName;
}({});

/**
 * connect element之间通信的类型格式
 */

// export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
  AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
  AccountStatusEnum["UNREGISTERED"] = "UNREGISTERED";
  return AccountStatusEnum;
}(AccountStatusEnum || {}); // element 接口start
export var InvalidElementConfigError = /*#__PURE__*/function (_Error) {
  _inherits(InvalidElementConfigError, _Error);
  var _super = _createSuper(InvalidElementConfigError);
  function InvalidElementConfigError(errors) {
    var _this;
    _classCallCheck(this, InvalidElementConfigError);
    var errorMessages = errors.map(function (e) {
      return "".concat(e.field, ": ").concat(e.message);
    });
    _this = _super.call(this, "Invalid config:\n".concat(errorMessages.join('\n')));
    _this.errors = errors;
    _this.name = 'InvalidElementConfigError';
    return _this;
  }
  return _createClass(InvalidElementConfigError);
}( /*#__PURE__*/_wrapNativeSuper(Error));
export var EXPOSURE_API_EVENT = /*#__PURE__*/function (EXPOSURE_API_EVENT) {
  EXPOSURE_API_EVENT["DESTORY"] = "destroy";
  EXPOSURE_API_EVENT["MOUNT"] = "mount";
  EXPOSURE_API_EVENT["SUBMITPAYMENT"] = "submitPayment";
  EXPOSURE_API_EVENT["VALIDATAFIELDS"] = "validateFields";
  EXPOSURE_API_EVENT["UPDATEPAYMENT"] = "updatePayment";
  return EXPOSURE_API_EVENT;
}({});
export var EVENTNAME = /*#__PURE__*/function (EVENTNAME) {
  EVENTNAME["PAYMENTMETHODCHANGED"] = "paymentMethodChanged";
  EVENTNAME["BILLINGADDRESSCHANGED"] = "billingAddressChanged";
  return EVENTNAME;
}({});

// 支付方式改变的回调函数的数据结构