const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../../productSelect/components/pisellPriceText/index.js");
const require_Detail = require("../../../../Sales/Event/Detail.js");
const require_index$1 = require("../../OpenCard/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let decimal_js = require("decimal.js");
decimal_js = require_runtime.__toESM(decimal_js);
let _pisell_materials = require("@pisell/materials");
//#region src/components/eventBooking/components/bookingDetailModal/components/BookingOptions.tsx
const BookingOptions = (props) => {
	var _detail$bookingOption, _detail$bookingOption2;
	const { detail, currentBookingOption, selectEventDetailBookingOptions } = require_Detail.useEventDetail();
	const onChange = (value, item) => {
		var _props$onChangeBookin;
		selectEventDetailBookingOptions(value);
		props === null || props === void 0 || (_props$onChangeBookin = props.onChangeBookingOption) === null || _props$onChangeBookin === void 0 || _props$onChangeBookin.call(props, item);
	};
	return /* @__PURE__ */ react.default.createElement(require_index$1.default, {
		title: _pisell_utils.locales.getText("pisell2.event.booking.options"),
		showBorder: true,
		showArrow: false,
		isClick: false,
		className: "detail-option-wrap"
	}, /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellCheckboxGroup, {
		mode: "single",
		iconPosition: (detail === null || detail === void 0 || (_detail$bookingOption = detail.bookingOptions) === null || _detail$bookingOption === void 0 ? void 0 : _detail$bookingOption.length) > 1 ? "right" : "hide",
		options: (detail === null || detail === void 0 ? void 0 : detail.bookingOptions) || [],
		optionClassName: `option-item ${(detail === null || detail === void 0 || (_detail$bookingOption2 = detail.bookingOptions) === null || _detail$bookingOption2 === void 0 ? void 0 : _detail$bookingOption2.length) > 1 ? "option-item-pointer" : ""}`,
		value: currentBookingOption,
		renderOption: (option) => {
			const { price, is_bundle, minimum_markup_price } = option._originData || {};
			if (!option._originData || !is_bundle) return /* @__PURE__ */ react.default.createElement("div", { className: "item" }, /* @__PURE__ */ react.default.createElement("span", null, option.label), /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellText.Amount, {
				value: option.price,
				showCurrencySymbol: true,
				className: "price"
			}));
			let _price = price;
			if (is_bundle) _price = new decimal_js.default(price).plus(new decimal_js.default(minimum_markup_price)).toFixed(2);
			return /* @__PURE__ */ react.default.createElement("div", { className: "item" }, /* @__PURE__ */ react.default.createElement("span", null, option.label), /* @__PURE__ */ react.default.createElement(require_index.default, {
				className: "price",
				value: _price,
				isMini: true
			}));
		},
		onChange
	}));
};
//#endregion
exports.default = BookingOptions;
