const require_runtime = require("../../../../../../_virtual/_rolldown/runtime.js");
const require_status = require("../../status.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
//#region src/plus/productSelect/ProductCard/SkuCard/components/Stock/index.tsx
const Stock = ({ props }) => {
	const { dataSource, skuTextConfig } = props;
	const { isOpen, fontSize, fontWeight, color, customText } = (skuTextConfig === null || skuTextConfig === void 0 ? void 0 : skuTextConfig.skuStockConfig) || {};
	if (!isOpen) return null;
	if (customText) return customText;
	const finalStyle = (0, react.useMemo)(() => {
		return {
			fontSize,
			fontWeight,
			color
		};
	}, [
		fontSize,
		fontWeight,
		color
	]);
	/**
	* @title: 库存文本
	* @description:
	* @param {*} useMemo
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-09-08 15:31
	*/
	const stockText = (0, react.useMemo)(() => {
		if ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.is_track) === 0) return null;
		return `${_pisell_utils.locales.getText("pisell2.sku-card.stock")}: ${dataSource === null || dataSource === void 0 ? void 0 : dataSource.stock_quantity}`;
	}, [dataSource === null || dataSource === void 0 ? void 0 : dataSource.stock_quantity, dataSource === null || dataSource === void 0 ? void 0 : dataSource.is_track]);
	return !!(dataSource === null || dataSource === void 0 ? void 0 : dataSource.is_track) ? /* @__PURE__ */ react.default.createElement("div", {
		className: `${require_status.PREFIX}__card-stock`,
		style: finalStyle
	}, stockText) : null;
};
//#endregion
exports.default = Stock;
