const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_locales = require("../../utils/locales.js");
const require_locales$1 = require("./locales.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
require("./index.less");
let _pisell_utils = require("@pisell/utils");
//#region src/components/login/index.tsx
const Login = (props) => {
	const { title, style, onLogin } = props;
	const [loading, setLoading] = (0, react.useState)(false);
	const onFinish = (values) => {
		setLoading(true);
		onLogin && onLogin(values, (data) => {
			setLoading(false);
		});
	};
	(0, react.useMemo)(() => {
		console.log(require_locales.getLocale(), "getLocale()");
		_pisell_utils.locales.init(require_locales$1.default, require_locales.getLocale());
	}, []);
	return /* @__PURE__ */ react.default.createElement("div", {
		className: "pisell-lowcode__login-wrap",
		style
	}, /* @__PURE__ */ react.default.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode__login-title" }, title || "Login"), /* @__PURE__ */ react.default.createElement(antd.Form, { onFinish }, /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "email",
		rules: [{
			required: true,
			message: _pisell_utils.locales.getText("pisell2.text.email-placeholder")
		}, {
			pattern: /^\w+((.\w+)|(-\w+))@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+).[A-Za-z0-9]+$/,
			message: _pisell_utils.locales.getText("pisell2.text.email-error")
		}]
	}, /* @__PURE__ */ react.default.createElement(antd.Input, {
		placeholder: _pisell_utils.locales.getText("pisell2.text.email-placeholder"),
		className: "pisell-lowcode__login-input pisell-lowcode__field-style"
	})), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "password",
		rules: [{
			required: true,
			message: _pisell_utils.locales.getText("pisell2.text.password-placeholder")
		}, {
			pattern: /* @__PURE__ */ new RegExp(/^[^\s]*$/, "g"),
			message: _pisell_utils.locales.getText("pisell2.text.password-error")
		}]
	}, /* @__PURE__ */ react.default.createElement(antd.Input, {
		className: "pisell-lowcode__login-input pisell-lowcode__field-style",
		placeholder: _pisell_utils.locales.getText("pisell2.text.password-placeholder"),
		type: "Password",
		autoComplete: "new-password"
	})), /* @__PURE__ */ react.default.createElement(antd.Form.Item, { noStyle: true }, /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: "pisell-lowcode__login-button pisell-lowcode__field-style",
		type: "primary",
		htmlType: "submit",
		size: "large",
		loading
	}, _pisell_utils.locales.getText("pisell2.text.login"))))));
};
//#endregion
exports.default = Login;
