var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/venueBooking/components/VenueSelection/components/DateNavigator.tsx
var DateNavigator_exports = {};
__export(DateNavigator_exports, {
  default: () => DateNavigator
});
module.exports = __toCommonJS(DateNavigator_exports);
var import_react = __toESM(require("react"));
var import_dayjs = __toESM(require("dayjs"));
var import_utils = require("@pisell/utils");
var import_materials = require("@pisell/materials");
var import_context = require("../../../context");
var import_utils2 = require("../../../utils");
var import_MonthPicker = __toESM(require("./MonthPicker"));
function DateNavigator({ onPrevWeek, onNextWeek }) {
  const {
    anchorDate,
    monthPickerOpen,
    setMonthPickerOpen,
    goToNearestAvailableDate
  } = (0, import_context.useVenueBookingContext)();
  const today = (0, import_dayjs.default)();
  const isViewingToday = (0, import_utils2.formatDateKey)(anchorDate) === (0, import_utils2.formatDateKey)(today);
  async function goToday() {
    if (isViewingToday) return;
    setMonthPickerOpen(false);
    await goToNearestAvailableDate(today);
  }
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "relative flex w-full items-center gap-2 xl:w-auto" }, /* @__PURE__ */ import_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__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-chevron-left", style: { fontSize: 18 } })
  ), /* @__PURE__ */ import_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)
    },
    (0, import_utils2.getMonthLabel)(anchorDate)
  ), /* @__PURE__ */ import_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__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-chevron-right", style: { fontSize: 18 } })
  ), /* @__PURE__ */ import_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
    },
    import_utils.locales.getText("pisell2.venue.action.go.today") || "回到今天"
  ), monthPickerOpen ? /* @__PURE__ */ import_react.default.createElement(import_MonthPicker.default, null) : null);
}
