import { __exportAll } from "../../../_virtual/_rolldown/runtime.mjs";
import { BaseTextPropertyWidget } from "./TextPropertyWidget.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { InputAdornment } from "@material-ui/core";
import pluralize from "pluralize";
//#region src/UI/property/widgets/IntegerPropertyWidget.jsx
var IntegerPropertyWidget_exports = /* @__PURE__ */ __exportAll({ default: () => IntegerPropertyWidget });
const parse = (value) => value && parseInt(value);
/**
* `integer` property widget
*
* Outputs a type=number TextField with an optional unit
*/
const IntegerPropertyWidget = (props) => {
	const $ = c(9);
	const { property } = props;
	const { unit } = property;
	let endAdornment;
	if (unit) {
		let t0;
		if ($[0] !== unit) {
			t0 = pluralize(unit);
			$[0] = unit;
			$[1] = t0;
		} else t0 = $[1];
		let t1;
		if ($[2] !== t0) {
			t1 = /* @__PURE__ */ React.createElement(InputAdornment, { position: "end" }, t0);
			$[2] = t0;
			$[3] = t1;
		} else t1 = $[3];
		endAdornment = t1;
	}
	let t0;
	if ($[4] !== endAdornment) {
		t0 = { endAdornment };
		$[4] = endAdornment;
		$[5] = t0;
	} else t0 = $[5];
	let t1;
	if ($[6] !== props || $[7] !== t0) {
		t1 = /* @__PURE__ */ React.createElement(BaseTextPropertyWidget, {
			type: "number",
			step: 1,
			InputProps: t0,
			parse,
			...props
		});
		$[6] = props;
		$[7] = t0;
		$[8] = t1;
	} else t1 = $[8];
	return t1;
};
//#endregion
export { IntegerPropertyWidget_exports, IntegerPropertyWidget as default };

//# sourceMappingURL=IntegerPropertyWidget.mjs.map