const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_utils = require("../../../utils.js");
const require_index = require("../../../../productSelect/components/pisellPriceText/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 classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/components/booking/components/TabProduct/productItem/index.tsx
const ProductItem = ({ item, onClick, amountSymbol, style, className }) => {
	const { price, is_bundle, minimum_markup_price } = item;
	let _price = price;
	if (is_bundle) _price = new decimal_js.default(price).plus(new decimal_js.default(minimum_markup_price)).toFixed(2);
	const stockText = (0, react.useMemo)(() => {
		if (item.is_track === 0) return false;
		return `${item.stock_quantity} ${_pisell_utils.locales.getText("pisell2.text.stock")}`;
	}, [item.stock_quantity, item.is_track]);
	return /* @__PURE__ */ react.default.createElement("div", {
		style,
		className: (0, classnames.default)("server-product", className),
		onClick: () => {
			onClick(item, "select");
		}
	}, item.cover ? /* @__PURE__ */ react.default.createElement("img", {
		src: _pisell_utils.image.ali(item.cover, 100),
		className: "server-product-cover",
		loading: "lazy"
	}) : null, /* @__PURE__ */ react.default.createElement("div", { className: "server-product-content" }, /* @__PURE__ */ react.default.createElement("span", { className: "server-product-title" }, item.title), /* @__PURE__ */ react.default.createElement("div", { className: "server-product-time" }, require_utils.getDiscountTime(item.service_times)), stockText && /* @__PURE__ */ react.default.createElement("div", { className: "server-product-time" }, stockText), /* @__PURE__ */ react.default.createElement("div", { className: "server-product-price" }, /* @__PURE__ */ react.default.createElement(require_index.default, {
		value: _price,
		isMini: is_bundle
	}))));
};
//#endregion
exports.default = ProductItem;
