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/Input.Json/WithMode.tsx
const _excluded = [
	"onChange",
	"onBlur",
	"value"
];
const JsonInput = (props) => {
	const { onChange, onBlur, value } = props, restProps = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	const [innerValue, setInnerValue] = (0, react.useState)(value);
	(0, react.useEffect)(() => {
		setInnerValue(value);
	}, [value]);
	const handleChange = (e) => {
		setInnerValue(e.target.value);
	};
	const handleBlur = (e) => {
		if (onBlur) onBlur(e);
		if (onChange) onChange(e.target.value);
	};
	return /* @__PURE__ */ react.default.createElement(antd.Input.TextArea, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, restProps), {}, {
		value: innerValue,
		onChange: handleChange,
		onBlur: handleBlur
	}));
};
const JsonWithMode = require_utils.withMode(JsonInput, require_ReadPretty.default);
//#endregion
exports.default = JsonWithMode;
