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/plus/saasRegister/components/EntryInfo.tsx
var EntryInfo_exports = {};
__export(EntryInfo_exports, {
  default: () => EntryInfo_default
});
module.exports = __toCommonJS(EntryInfo_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_utils = require("@pisell/utils");
var import__ = require("../index.less");
var EntryInfo = (props) => {
  const {
    passwordLabel = import_utils.locales.getText("pisell-saas-register-password-label"),
    passwordPlaceholder = import_utils.locales.getText(
      "pisell-saas-register-password-placeholder"
    ),
    showDivider = true,
    dividerText = import_utils.locales.getText("pisell-saas-register-divider-text"),
    showFirstName = true,
    showLastName = true,
    form
  } = props;
  const [loading, setLoading] = (0, import_react.useState)(false);
  const _handleEntryInfo = async () => {
    var _a;
    if (loading) {
      return;
    }
    setLoading(true);
    try {
      const values = await form.validateFields() || {};
      await ((_a = props == null ? void 0 : props.onEntryInfo) == null ? void 0 : _a.call(props, { ...values, token: props.emailToken }));
    } catch (error) {
      console.error("handleEntryInfo_failed:", error);
    } finally {
      setLoading(false);
    }
  };
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: "pisell-saas-register-form-email",
      style: { marginTop: "12px" }
    },
    form.getFieldValue("email")
  ), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-saas-register-form" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "form-item-label" }, passwordLabel), /* @__PURE__ */ import_react.default.createElement(
    import_antd.Form.Item,
    {
      name: "password",
      rules: [
        {
          required: true,
          message: import_utils.locales.getText(
            "pisell-saas-register-password-required"
          )
        }
      ]
    },
    /* @__PURE__ */ import_react.default.createElement(
      import_antd.Input.Password,
      {
        placeholder: passwordPlaceholder,
        size: "large",
        className: "pisell-saas-register-input"
      }
    )
  ), showDivider && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-saas-register-divider" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-saas-register-divider-text" }, dividerText)), /* @__PURE__ */ import_react.default.createElement("div", null, showFirstName && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "form-item-label" }, import_utils.locales.getText("pisell-saas-register-first-name-label")), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "firstName", rules: [{ required: false }] }, /* @__PURE__ */ import_react.default.createElement(
    import_antd.Input,
    {
      placeholder: import_utils.locales.getText(
        "pisell-saas-register-first-name-placeholder"
      ),
      size: "large",
      className: "pisell-saas-register-input",
      maxLength: 50
    }
  ))), showLastName && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "form-item-label" }, import_utils.locales.getText("pisell-saas-register-last-name-label")), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "lastName", rules: [{ required: false }] }, /* @__PURE__ */ import_react.default.createElement(
    import_antd.Input,
    {
      placeholder: import_utils.locales.getText(
        "pisell-saas-register-last-name-placeholder"
      ),
      size: "large",
      className: "pisell-saas-register-input",
      maxLength: 50
    }
  ))), /* @__PURE__ */ import_react.default.createElement(
    import_antd.Button,
    {
      type: "primary",
      block: true,
      size: "large",
      className: "pisell-saas-register-button",
      loading,
      onClick: _handleEntryInfo
    },
    import_utils.locales.getText("pisell-saas-register-button")
  ))));
};
var EntryInfo_default = EntryInfo;
