import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import { sliceDayIntoFiveMinutes } from "../../utils.js";
import React, { useCallback, useEffect, useMemo } from "react";
import { Select } from "antd";
//#region src/components/booking/materiels/startTime/index.tsx
const _excluded = [
	"locale",
	"slice",
	"timeObjChange",
	"selectProps"
];
const StartTime = (props) => {
	const { locale = "en", slice = 5, timeObjChange, selectProps } = props, resetProps = _objectWithoutProperties(props, _excluded);
	/**
	* @title: 时间切片
	* @description:
	* @return {*}
	* @Author: zhiwei.Wang
	* @Date: 2024-01-09 13:37
	*/
	const timeObj = useMemo(() => sliceDayIntoFiveMinutes(slice, locale), [slice, locale]);
	useEffect(() => {
		timeObjChange === null || timeObjChange === void 0 || timeObjChange(timeObj);
	}, [timeObj]);
	const renderOptions = useCallback((array, value = "value", label = "label") => {
		return array.map((d) => {
			return /* @__PURE__ */ React.createElement(Select.Option, {
				value: d[value],
				key: d[value]
			}, d[label]);
		});
	}, []);
	return /* @__PURE__ */ React.createElement(Select, _objectSpread2(_objectSpread2({}, selectProps), resetProps), renderOptions(timeObj === null || timeObj === void 0 ? void 0 : timeObj.timeSlices));
};
//#endregion
export { StartTime as default };
