import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { isBooking4Shop } from "../utils.js";
import useEngineContext from "../../../../hooks/useEngineContext.js";
import Info from "../../info2/service/addService/index.js";
import Info$1 from "../service/addService/index.js";
import React, { useRef } from "react";
//#region src/components/booking/info/addServiceVariant/index.tsx
const AddServiceVariant = (props) => {
	var _context$appHelper, _context$appHelper$ge, _context$appHelper$ut, _context$appHelper$ut2, _props$globalState, _context$appHelper$ut3;
	const { globalState, setGlobalState } = props;
	const context = useEngineContext();
	const stateRef = useRef(globalState);
	stateRef.current = globalState;
	const dispatch = ({ type, payload }) => {
		if (type === "setService") setGlobalState({ service: _objectSpread2(_objectSpread2({}, stateRef.current.service), payload) });
		if (type === "setDate") setGlobalState({ date: _objectSpread2(_objectSpread2({}, stateRef.current.date), payload) });
	};
	let Cpt = Info$1;
	if (isBooking4Shop(((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getData) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.call(_context$appHelper, "shop_id")) || ((_context$appHelper$ut = context.appHelper.utils.store) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getState) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.global) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.globalConfig) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.id), props === null || props === void 0 || (_props$globalState = props.globalState) === null || _props$globalState === void 0 ? void 0 : _props$globalState.renderType, (_context$appHelper$ut3 = context.appHelper.utils) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.businessUtils)) Cpt = Info;
	return /* @__PURE__ */ React.createElement(Cpt, {
		renderMode: "current",
		dispatch,
		state: globalState,
		drawerProps: {
			open: true,
			getContainer: false
		}
	});
};
//#endregion
export { AddServiceVariant as default };
