import { mock } from "../../../../mock.js";
import OpenCard_default from "../../../OpenCard/index.js";
import Status from "../CalendarDate/Status/index.js";
import CalenDateWeek from "../CalendarDate/CalenDateWeek/index.js";
import CalendarDate_default from "../CalendarDate/index.js";
import "dayjs";
import React, { forwardRef, useImperativeHandle, useRef, useState } from "react";
import { Iconfont } from "@pisell/materials";
import classNames from "classnames";
import "./index.less";
//#region src/components/eventBooking/components/bookingAvailabilityCalendar/components/SelectDate/index.tsx
const SelectDate = ({ currentDate, detail, currentDateChange, setSurplusDisabledChange, cutTime, setCutTime, showCalendarPopup }, ref) => {
	const [dateLimitData, setDateLimitData] = useState(mock.availability_calendar.limitData);
	const calendarDateRef = useRef(null);
	useImperativeHandle(ref, () => {
		return {};
	});
	/**
	* @title: 头部额外内容
	* @description:
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-01-14 14:52
	*/
	const extraHeader = () => {
		return /* @__PURE__ */ React.createElement("div", { onClick: (e) => {
			var _calendarDateRef$curr;
			e.stopPropagation();
			calendarDateRef === null || calendarDateRef === void 0 || (_calendarDateRef$curr = calendarDateRef.current) === null || _calendarDateRef$curr === void 0 || _calendarDateRef$curr.open(currentDate, detail === null || detail === void 0 ? void 0 : detail.id);
		} }, /* @__PURE__ */ React.createElement(Iconfont, {
			type: "pisell2-calendar",
			className: classNames("calendar-icon")
		}));
	};
	return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(OpenCard_default, {
		title: "Select a date",
		initOpen: true,
		showArrow: false,
		isClick: false,
		extra: showCalendarPopup ? extraHeader() : null
	}, /* @__PURE__ */ React.createElement(CalenDateWeek, {
		currentDate,
		productId: detail === null || detail === void 0 ? void 0 : detail.id,
		cutTime,
		dateLimitData
	}), /* @__PURE__ */ React.createElement(Status, null)), /* @__PURE__ */ React.createElement(CalendarDate_default, {
		ref: calendarDateRef,
		cutTime,
		dateLimitData
	}));
};
var SelectDate_default = forwardRef(SelectDate);
//#endregion
export { SelectDate_default as default };
