const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_asyncToGenerator = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _pisell_utils = require("@pisell/utils");
require("../index.less");
//#region src/plus/saasRegister/components/EntryInfo.tsx
const EntryInfo = (props) => {
	const { passwordLabel = _pisell_utils.locales.getText("pisell-saas-register-password-label"), passwordPlaceholder = _pisell_utils.locales.getText("pisell-saas-register-password-placeholder"), showDivider = true, dividerText = _pisell_utils.locales.getText("pisell-saas-register-divider-text"), showFirstName = true, showLastName = true, form } = props;
	const [loading, setLoading] = (0, react.useState)(false);
	const _handleEntryInfo = function() {
		var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
			if (loading) return;
			setLoading(true);
			try {
				var _props$onEntryInfo;
				const values = (yield form.validateFields()) || {};
				yield props === null || props === void 0 || (_props$onEntryInfo = props.onEntryInfo) === null || _props$onEntryInfo === void 0 ? void 0 : _props$onEntryInfo.call(props, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, values), {}, { token: props.emailToken }));
			} catch (error) {
				console.error("handleEntryInfo_failed:", error);
			} finally {
				setLoading(false);
			}
		});
		return function _handleEntryInfo() {
			return _ref.apply(this, arguments);
		};
	}();
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", {
		className: "pisell-saas-register-form-email",
		style: { marginTop: "12px" }
	}, form.getFieldValue("email")), /* @__PURE__ */ react.default.createElement("div", { className: "pisell-saas-register-form" }, /* @__PURE__ */ react.default.createElement("div", { className: "form-item-label" }, passwordLabel), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "password",
		rules: [{
			required: true,
			message: _pisell_utils.locales.getText("pisell-saas-register-password-required")
		}]
	}, /* @__PURE__ */ react.default.createElement(antd.Input.Password, {
		placeholder: passwordPlaceholder,
		size: "large",
		className: "pisell-saas-register-input"
	})), showDivider && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-saas-register-divider" }, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-saas-register-divider-text" }, dividerText)), /* @__PURE__ */ react.default.createElement("div", null, showFirstName && /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: "form-item-label" }, _pisell_utils.locales.getText("pisell-saas-register-first-name-label")), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "firstName",
		rules: [{ required: false }]
	}, /* @__PURE__ */ react.default.createElement(antd.Input, {
		placeholder: _pisell_utils.locales.getText("pisell-saas-register-first-name-placeholder"),
		size: "large",
		className: "pisell-saas-register-input",
		maxLength: 50
	}))), showLastName && /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: "form-item-label" }, _pisell_utils.locales.getText("pisell-saas-register-last-name-label")), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "lastName",
		rules: [{ required: false }]
	}, /* @__PURE__ */ react.default.createElement(antd.Input, {
		placeholder: _pisell_utils.locales.getText("pisell-saas-register-last-name-placeholder"),
		size: "large",
		className: "pisell-saas-register-input",
		maxLength: 50
	}))), /* @__PURE__ */ react.default.createElement(antd.Button, {
		type: "primary",
		block: true,
		size: "large",
		className: "pisell-saas-register-button",
		loading,
		onClick: _handleEntryInfo
	}, _pisell_utils.locales.getText("pisell-saas-register-button")))));
};
//#endregion
exports.default = EntryInfo;
