require("../../../../../../_virtual/_rolldown/runtime.js");
const require_bookingCalendarDateUtils = require("../../utils/bookingCalendarDateUtils.js");
let react = require("react");
//#region src/components/pisellRecordBoard/shellFrame/Calendar/view/day/useBookingCalendarDayHourRemaining.ts
/**
* 日视图表头：每列整点仍空闲资源占比。
*/
function useBookingCalendarDayHourRemaining(visibleCourts, dayKey, bookings, hourSlots, slotStepHours, isBusinessHour) {
	return (0, react.useMemo)(() => {
		const total = visibleCourts.length;
		return Object.fromEntries(hourSlots.map((hour) => {
			if (!isBusinessHour(hour)) return [hour, {
				remaining: 0,
				total,
				ratio: 0
			}];
			const remaining = visibleCourts.filter((court) => !require_bookingCalendarDateUtils.dayOccupancy(court.id, dayKey, bookings, hourSlots, slotStepHours)[hour]).length;
			return [hour, {
				remaining,
				total,
				ratio: total > 0 ? remaining / total : 0
			}];
		}));
	}, [
		visibleCourts,
		dayKey,
		bookings,
		hourSlots,
		slotStepHours,
		isBusinessHour
	]);
}
//#endregion
exports.useBookingCalendarDayHourRemaining = useBookingCalendarDayHourRemaining;
