'use strict';

var React = require('react');
var VerificationCheckDisplay = require('./vc.check.svg');
var CircleSpinner = require('./CircleSpinner-f518569a.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var VerificationCheckDisplay__default = /*#__PURE__*/_interopDefaultLegacy(VerificationCheckDisplay);

const VCVerificationCheck = ({ size = "44px" }) => {
  var _a;
  const imageSize = {
    width: size,
    height: size
  };
  return /* @__PURE__ */ React__default["default"].createElement("div", { className: "vc-verification-wrapper", style: { position: "relative" } }, /* @__PURE__ */ React__default["default"].createElement("div", { className: "flex items-center justify-center bg-white rounded-full overflow-hidden" }, /* @__PURE__ */ React__default["default"].createElement(
    "img",
    {
      className: "h-full w-full object-contain p-1",
      src: (_a = VerificationCheckDisplay__default["default"]) != null ? _a : "",
      style: imageSize,
      alt: "Verification Icon"
    }
  )));
};
const VCVerificationCheckWithSpinner = ({ size = "44px", spinnerSize = "60px", loading = true, withBorder = false }) => {
  const loadingState = loading ? CircleSpinner.CircleLoadingState.spin : CircleSpinner.CircleLoadingState.stop;
  const spinnerStyle = {
    position: "absolute",
    top: 0,
    left: 0,
    height: spinnerSize,
    width: spinnerSize
  };
  const spinnerSizeNumber = parseInt(spinnerSize.replace("px", ""));
  const offset = spinnerSizeNumber > 50 ? 3 : 2;
  return /* @__PURE__ */ React__default["default"].createElement(
    "div",
    {
      style: { width: spinnerSize, height: spinnerSize, position: "relative" },
      className: `flex items-center justify-center bg-white rounded-full overflow-hidden select-none ${withBorder ? " ml-3 mr-3" : ""}`
    },
    /* @__PURE__ */ React__default["default"].createElement(VCVerificationCheck, { size, loading }),
    /* @__PURE__ */ React__default["default"].createElement("div", { className: "vc-verification-spinner-overlay", style: spinnerStyle }, /* @__PURE__ */ React__default["default"].createElement(
      CircleSpinner.CircleSpinner,
      {
        loadingState,
        size: spinnerSizeNumber,
        marginOffset: offset
      }
    ))
  );
};
const VCVerificationCheckWithText = ({ size = "44px", spinnerSize = "60px", loading = true }) => {
  const [defaultLoading, setDefaultLoading] = React.useState(true);
  React.useEffect(() => {
    let timer1 = setTimeout(() => setDefaultLoading(false), 3 * 1e3);
    return () => {
      clearTimeout(timer1);
    };
  });
  return /* @__PURE__ */ React__default["default"].createElement("div", { className: "flex justify-center items-center translate-x-[10px] w-full vc-verification-full-wrapper" }, /* @__PURE__ */ React__default["default"].createElement("span", { className: "text-white font-bold tracking-wider" }, "Verified"), /* @__PURE__ */ React__default["default"].createElement(
    VCVerificationCheckWithSpinner,
    {
      size,
      spinnerSize,
      loading: loading || defaultLoading,
      withBorder: true
    }
  ), /* @__PURE__ */ React__default["default"].createElement("span", { className: "text-white font-bold tracking-wider" }, "Credential"));
};

exports.VCVerificationCheck = VCVerificationCheck;
exports.VCVerificationCheckWithSpinner = VCVerificationCheckWithSpinner;
exports.VCVerificationCheckWithText = VCVerificationCheckWithText;
//# sourceMappingURL=VCVerificationCheck-92198135.js.map
