const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_utils = require("./utils.js");
let react = require("react");
react = require_runtime.__toESM(react);
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./ReadPretty.less");
//#region src/components/dataSourceComponents/fields/InputNumber/ReadPretty.tsx
const ReadPretty = (props) => {
	const { value, useThousandsSeparator, previewFormatter, precision = 0, addonAfter, renderMode } = props;
	const className = (0, classnames.default)("pisell-input-number-read-pretty", { "pisell-input-number-read-pretty-table-view": renderMode === "tableView" });
	if (!value && value !== 0) return /* @__PURE__ */ react.default.createElement("span", { className }, "-");
	const formattedValue = require_utils.formatNumberWithUnit(Number(value), precision, previewFormatter);
	if (useThousandsSeparator && (!previewFormatter || previewFormatter === "none")) {
		const parts = formattedValue.split(".");
		parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
		return /* @__PURE__ */ react.default.createElement("span", { className }, parts.join("."), addonAfter);
	}
	return /* @__PURE__ */ react.default.createElement("span", { className }, formattedValue, addonAfter);
};
//#endregion
exports.default = ReadPretty;
