const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_context = require("../../context.js");
const require_index = require("../Cart/ContinueButton/index.js");
const require_index$1 = require("../Cart/index.js");
const require_Total = require("../Cart/Item/Total.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_materials = require("@pisell/materials");
let src_components_appointmentBooking_assets_shopping_cart_svg = require("../../assets/shopping-cart.svg");
src_components_appointmentBooking_assets_shopping_cart_svg = require_runtime.__toESM(src_components_appointmentBooking_assets_shopping_cart_svg);
require("./index.less");
//#region src/components/appointmentBooking/components/Footer/index.tsx
const Footer = ({ onNext, isOpen }) => {
	var _currentStep$step;
	const { carts, currentStep, isErrorHolder, setIsErrorHolder } = require_context.useAppointmentBookingContext();
	const [open, setOpen] = (0, react.useState)(false);
	(0, react.useEffect)(() => {
		setOpen(isErrorHolder || false);
	}, [currentStep === null || currentStep === void 0 || (_currentStep$step = currentStep.step) === null || _currentStep$step === void 0 ? void 0 : _currentStep$step.key, isErrorHolder]);
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(_pisell_materials.SectionFooters, {
		className: "section-footer-wrap",
		left: /* @__PURE__ */ react.default.createElement(require_Total.default, {
			className: "section-footer-left",
			isFooter: true
		}),
		right: /* @__PURE__ */ react.default.createElement("div", { className: "section-footer-right" }, /* @__PURE__ */ react.default.createElement(_pisell_materials.Badge, { count: (carts === null || carts === void 0 ? void 0 : carts.length) || 0 }, /* @__PURE__ */ react.default.createElement(_pisell_materials.Button, {
			size: "large",
			onClick: () => setOpen(true),
			className: "section-footer-btn"
		}, /* @__PURE__ */ react.default.createElement(_pisell_materials.Image, {
			src: src_components_appointmentBooking_assets_shopping_cart_svg.default,
			preview: false
		}))), /* @__PURE__ */ react.default.createElement(require_index.default, { onNext }))
	}), /* @__PURE__ */ react.default.createElement(require_index$1.default, {
		open,
		onCancel: () => {
			setOpen(false);
			setIsErrorHolder(false);
		},
		onNext
	}));
};
//#endregion
exports.default = Footer;
