require("../../../_virtual/_rolldown/runtime.js");
let react = require("react");
let _pisell_utils = require("@pisell/utils");
//#region src/components/dataSourceComponents/hooks/useValueMap.ts
/**
* 将 options 转换为 valueMap
* 使用在 ReadPretty Select Radio Checkbox 组件中
* @param options 
* @returns 
*/
const useValueMap = (options) => {
	return (0, react.useMemo)(() => {
		return (options === null || options === void 0 ? void 0 : options.reduce((acc, item) => {
			const itemValue = item.value;
			const itemLabel = item.label;
			if (((0, _pisell_utils.isString)(itemValue) || (0, _pisell_utils.isNumber)(itemValue)) && (0, _pisell_utils.isString)(itemLabel)) acc[itemValue] = itemLabel;
			return acc;
		}, {})) || {};
	}, [options]);
};
//#endregion
exports.default = useValueMap;
