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_usePisellConfig = require("../../pisell-config-provider/hooks/usePisellConfig.js");
const require_index = require("../BaseNumberKeyboard/index.js");
const require_themeConfig = require("./themeConfig.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
let ahooks = require("ahooks");
require("./index.less");
//#region src/components/virtual-keyboard/Number/index.tsx
const _excluded = [
	"min",
	"max",
	"doneText",
	"resetText",
	"defaultValue",
	"placeholder",
	"onEnter",
	"selectType",
	"defaultSelect"
];
const Number = (props) => {
	const { min, max, doneText, resetText, defaultValue, placeholder, onEnter, selectType = "light", defaultSelect } = props;
	require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	require_usePisellConfig.default();
	const [value, setValue] = (0, ahooks.useControllableValue)(props, { defaultValue: defaultValue || "" });
	(0, react.useEffect)(() => {
		document.body.id = "body";
	}, []);
	/**
	* 配置颜色
	* 根据 props 和 selectType 生成最终的配置颜色
	*/
	const configColor = (0, react.useMemo)(() => {
		const currentConfig = require_themeConfig.numberThemeConfig[selectType];
		const validProps = Object.entries(props).reduce((acc, [key, value]) => {
			if (value !== void 0 && key in currentConfig) acc[key] = value;
			return acc;
		}, {});
		return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, currentConfig), validProps);
	}, [selectType, props]);
	(0, react.useEffect)(() => {
		(0, _pisell_utils.setTheme)({
			"--pisell-number-background-color": configColor.backgroundColor,
			"--pisell-number-container-background-color": configColor.containerBackgroundColor,
			"--pisell-number-text-color": configColor.textColor,
			"--pisell-number-keyboard-background-color": configColor.keyboardBackgroundColor,
			"--pisell-number-keyboard-button-background-color": configColor.keyboardButtonBackgroundColor,
			"--pisell-number-keyboard-button-text-color": configColor.keyboardButtonTextColor,
			"--pisell-number-keyboard-button-hover-color": configColor.keyboardButtonHoverColor,
			"--pisell-number-reset-button-background-color": configColor.resetButtonBackgroundColor,
			"--pisell-number-reset-button-text-color": configColor.resetButtonTextColor,
			"--pisell-number-done-button-background-color": configColor.doneButtonBackgroundColor,
			"--pisell-number-done-button-text-color": configColor.doneButtonTextColor
		});
	}, [configColor]);
	return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("pisell-number-keyboard-wrap", {
		"pisell-number-keyboard-dark": selectType === "dark",
		"pisell-number-keyboard-light": selectType === "light"
	}) }, /* @__PURE__ */ react.default.createElement(require_index.default, {
		max,
		min,
		value,
		defaultValue,
		onChange: setValue,
		placeholder,
		doneText,
		resetText,
		onEnter,
		defaultSelect,
		rightItemsStyle: {
			buttonBackgroundColor: configColor.buttonBackgroundColor,
			textColor: configColor.textColor,
			resetButtonBackgroundColor: configColor.resetButtonBackgroundColor,
			resetButtonTextColor: configColor.resetButtonTextColor,
			isDoneButtonFollowTheme: configColor.isDoneButtonFollowTheme,
			doneButtonBackgroundColor: configColor.doneButtonBackgroundColor,
			doneButtonTextColor: configColor.doneButtonTextColor
		}
	}));
};
//#endregion
exports.default = Number;
