import ScheduleTimeItem from "../ScheduleTimeItem/index.js";
import dayjs from "dayjs";
import React, { useEffect, useState } from "react";
import { PisellEmpty } from "@pisell/materials";
import "./index.less";
//#region src/components/eventBooking/components/scheduleCalendar/components/ScheduleTimes/index.tsx
const ScheduleTimes = ({ month, schedulesData }) => {
	const [timeList, setTimeList] = useState([]);
	useEffect(() => {
		const timeList = [];
		for (const item of schedulesData) {
			const date = dayjs(item.date);
			if (date.isAfter(month, "month")) break;
			if (date.isSame(month, "month")) timeList.push(...(item === null || item === void 0 ? void 0 : item.times) || []);
		}
		if ((timeList === null || timeList === void 0 ? void 0 : timeList.length) > 0) setTimeList(timeList);
		else setTimeList([]);
	}, [month, schedulesData]);
	return /* @__PURE__ */ React.createElement("div", { className: "schedule-times-container" }, (timeList === null || timeList === void 0 ? void 0 : timeList.length) > 0 ? /* @__PURE__ */ React.createElement(ScheduleTimeItem, {
		key: month,
		timeList
	}) : /* @__PURE__ */ React.createElement(PisellEmpty, null));
};
//#endregion
export { ScheduleTimes as default };
