const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_utils = require("../../dataSourceForm/utils.js");
const require_ReadPretty = require("./ReadPretty.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
//#region src/components/dataSourceComponents/fields/InputNumber/WithMode.tsx
const _excluded = [
	"useThousandsSeparator",
	"formatter",
	"parser"
];
const InputNumber = (props) => {
	const { useThousandsSeparator, formatter: propsFormatter, parser: propsParser } = props, rest = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	const formatter = (0, react.useCallback)((value, info) => {
		if (!value) return "";
		if (useThousandsSeparator) {
			const parts = value.toString().split(".");
			parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
			return parts.join(".");
		}
		return propsFormatter ? propsFormatter(value, info) : value.toString();
	}, [useThousandsSeparator, propsFormatter]);
	const parser = (0, react.useCallback)((value) => {
		if (!value) return null;
		if (useThousandsSeparator) return value.replace(/,/g, "");
		return propsParser ? propsParser(value) : value;
	}, [useThousandsSeparator, propsParser]);
	return /* @__PURE__ */ react.default.createElement(antd.InputNumber, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, rest), {}, {
		formatter,
		parser
	}));
};
const InputNumberWithMode = require_utils.withMode(InputNumber, require_ReadPretty.default);
//#endregion
exports.default = InputNumberWithMode;
