const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_asyncToGenerator = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
const require_utils = require("../../../utils.js");
const require_context = require("../../../context.js");
const require_MonthPicker = require("./MonthPicker.js");
let dayjs = require("dayjs");
dayjs = require_runtime.__toESM(dayjs);
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let _pisell_materials = require("@pisell/materials");
//#region src/components/venueBooking/components/VenueSelection/components/DateNavigator.tsx
/**
* 日期导航器
* 前后翻周按钮、月份名称（点击展开月历选择器）、回到今天按钮
*/
function DateNavigator({ onPrevWeek, onNextWeek }) {
	const { anchorDate, monthPickerOpen, setMonthPickerOpen, goToNearestAvailableDate } = require_context.useVenueBookingContext();
	const today = (0, dayjs.default)();
	const isViewingToday = require_utils.formatDateKey(anchorDate) === require_utils.formatDateKey(today);
	function goToday() {
		return _goToday.apply(this, arguments);
	}
	function _goToday() {
		_goToday = require_asyncToGenerator._asyncToGenerator(function* () {
			if (isViewingToday) return;
			setMonthPickerOpen(false);
			yield goToNearestAvailableDate(today);
		});
		return _goToday.apply(this, arguments);
	}
	return /* @__PURE__ */ react.default.createElement("div", { className: "relative flex w-full items-center gap-2 xl:w-auto" }, /* @__PURE__ */ react.default.createElement("button", {
		className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-[#fafafa] ring-1 ring-black/8 md:h-12 md:w-12",
		onClick: onPrevWeek
	}, /* @__PURE__ */ react.default.createElement(_pisell_materials.Iconfont, {
		type: "pisell2-chevron-left",
		style: { fontSize: 18 }
	})), /* @__PURE__ */ react.default.createElement("button", {
		className: "min-w-0 flex-1 rounded-2xl bg-[#fafafa] px-4 py-3 text-sm font-bold text-zinc-900 ring-1 ring-black/8 xl:min-w-[200px] xl:flex-none",
		onClick: () => setMonthPickerOpen(!monthPickerOpen)
	}, require_utils.getMonthLabel(anchorDate)), /* @__PURE__ */ react.default.createElement("button", {
		className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-[#fafafa] ring-1 ring-black/8 md:h-12 md:w-12",
		onClick: onNextWeek
	}, /* @__PURE__ */ react.default.createElement(_pisell_materials.Iconfont, {
		type: "pisell2-chevron-right",
		style: { fontSize: 18 }
	})), /* @__PURE__ */ react.default.createElement("button", {
		className: `rounded-2xl px-4 py-3 text-sm font-bold shadow-sm ${isViewingToday ? "bg-zinc-200 text-zinc-500 cursor-not-allowed" : "text-white"}`,
		style: isViewingToday ? void 0 : { backgroundColor: "var(--vb-primary)" },
		onClick: goToday,
		disabled: isViewingToday
	}, _pisell_utils.locales.getText("pisell2.venue.action.go.today") || "回到今天"), monthPickerOpen ? /* @__PURE__ */ react.default.createElement(require_MonthPicker.default, null) : null);
}
//#endregion
exports.default = DateNavigator;
