const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_asyncToGenerator = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
const require_useEngineContext = require("../../../../../hooks/useEngineContext.js");
const require_context = require("../../../context.js");
const require_hooks = require("../../../hooks.js");
const require_utils = require("../utils.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let _pisell_materials = require("@pisell/materials");
require("./index.less");
//#region src/components/appointmentBooking/components/Cart/ContinueButton/index.tsx
const ContinueButton = ({ onNext }) => {
	var _appointmentBooking$s2;
	const utils = require_useEngineContext.default().appHelper.utils || {};
	const { isLogin, openLoginModal } = require_hooks.useAppointmentBookingLogin();
	const { accountLists, getHolders, checkAccount } = require_hooks.useAppointmentBookingAccount();
	const { currentStep, carts, appointmentBooking, setCarts, loading, setIsErrorHolder, isLastStep } = require_context.useAppointmentBookingContext();
	const { isFormSubject, isRetailTemplate } = require_hooks.useAppointmentBookingSetting();
	(0, react.useMemo)(() => {
		var _appointmentBooking$s;
		return appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s = appointmentBooking.store) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.step) === null || _appointmentBooking$s === void 0 || (_appointmentBooking$s = _appointmentBooking$s.store) === null || _appointmentBooking$s === void 0 ? void 0 : _appointmentBooking$s.stepList;
	}, [appointmentBooking === null || appointmentBooking === void 0 || (_appointmentBooking$s2 = appointmentBooking.store) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.step) === null || _appointmentBooking$s2 === void 0 || (_appointmentBooking$s2 = _appointmentBooking$s2.store) === null || _appointmentBooking$s2 === void 0 ? void 0 : _appointmentBooking$s2.stepList]);
	(function() {
		var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
			return yield require_utils.checkLogin({
				isLogin,
				openLoginModal,
				isFormSubject,
				utils,
				accountLists,
				appointmentBooking,
				getHolders
			});
		});
		return function handleLoginCheck() {
			return _ref.apply(this, arguments);
		};
	})();
	/**
	* @title: 点击继续
	* @description:
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-01-16 16:30
	*/
	const handleContinue = function() {
		var _ref2 = require_asyncToGenerator._asyncToGenerator(function* () {
			try {
				return onNext && onNext();
			} catch (error) {
				console.log(error, "handleContinue_error");
			}
		});
		return function handleContinue() {
			return _ref2.apply(this, arguments);
		};
	}();
	/**
	* @title: 确认按钮文案
	* @description:
	* @param {*} useMemo
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-01-17 16:10
	*/
	const continueText = (0, react.useMemo)(() => {
		if (isLastStep) return _pisell_utils.locales.getText("pisell2.event.checkout");
		else return _pisell_utils.locales.getText("pisell2.event.close.continue");
	}, [isLastStep]);
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(_pisell_materials.Button, {
		disabled: !(carts === null || carts === void 0 ? void 0 : carts.length),
		size: "large",
		type: "primary",
		onClick: () => handleContinue(),
		loading
	}, continueText));
};
//#endregion
exports.default = ContinueButton;
