var _excluded = ["step", "steps"];
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
/* eslint-disable array-callback-return */
/* eslint-disable consistent-return */
/* eslint-disable react/no-array-index-key */
import React from 'react';
import { StatusEnum } from "../const";
import { useContextData } from "../store";
import { POS, Action } from "./config";
export default (function (_ref) {
  var api = _ref.api,
    onChange = _ref.onChange,
    children = _ref.children;
  var _useContextData = useContextData(),
    step = _useContextData.step,
    steps = _useContextData.steps,
    data = _objectWithoutProperties(_useContextData, _excluded);
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
    className: "pisell-lowcode__eft-pay-body "
  }, steps.map(function (item, idx) {
    var Comm;
    if (idx === 0) Comm = POS;
    if (!Comm) {
      throw new Error('no comm');
    }
    if (step >= idx) {
      return /*#__PURE__*/React.createElement(Comm, {
        key: "".concat(data.key, "-").concat(item.key, "-").concat(idx),
        api: api,
        onChange: onChange
      });
    }
  }), children), data.status !== StatusEnum.Success ? /*#__PURE__*/React.createElement(Action, {
    onChange: onChange
  }) : null);
});