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_index = require("../group/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
//#region src/components/eftpos/deviceList/index.tsx
const _excluded = ["input"], _excluded2 = ["input"];
const DeviceList = (props) => {
	const [form] = antd.Form.useForm();
	const { list, onChange } = props;
	console.log(list);
	const onValuesChange = () => {
		onChange(Object.values(form.getFieldsValue()).flat());
	};
	const initialValues = (0, react.useMemo)(() => {
		return list.reduce((target, item) => {
			var _item$input, _item$input2;
			return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, target), {}, { [item.name]: (item === null || item === void 0 || (_item$input = item.input) === null || _item$input === void 0 ? void 0 : _item$input.value) || (item === null || item === void 0 || (_item$input2 = item.input) === null || _item$input2 === void 0 ? void 0 : _item$input2.defaultValue) });
		}, {});
	}, [list]);
	return /* @__PURE__ */ react.default.createElement(antd.Form, {
		layout: "vertical",
		onValuesChange,
		form,
		initialValues
	}, list.map((_ref) => {
		let { input } = _ref, formItemProps = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
		return /* @__PURE__ */ react.default.createElement(antd.Form.Item, formItemProps, /* @__PURE__ */ react.default.createElement(require_index.CheckboxGroup, input));
	}));
};
var deviceList_default = (_ref2) => {
	let { input } = _ref2, formItemProps = require_objectWithoutProperties._objectWithoutProperties(_ref2, _excluded2);
	return /* @__PURE__ */ react.default.createElement(antd.Form.Item, formItemProps, /* @__PURE__ */ react.default.createElement(DeviceList, input));
};
//#endregion
exports.default = deviceList_default;
