"use client";
import { jsx as e, jsxs as r } from "react/jsx-runtime";
import "../../../_virtual/it.js";
import d from "../../../_virtual/dayjs.min.js";
import { l as h } from "../../../_virtual/lodash.js";
import { Button as g } from "../button.js";
import { Icon as a } from "../icon.js";
import { Typo as s } from "../typo.js";
import { useCalendar as v } from "./calendar-context.js";
d.locale("it");
const O = () => {
  const {
    todayString: l,
    currentWeekOffset: n,
    showNavigation: i,
    customActions: t,
    goToPreviousWeek: c,
    goToNextWeek: m,
    goToCurrentWeek: f
  } = v(), o = d().startOf("isoWeek").add(n, "week"), p = o.endOf("isoWeek"), u = n === 0;
  return !i && !t ? null : /* @__PURE__ */ e("div", { className: "border-d-border bg-d-card border-t border-r border-l px-4 py-2", children: i && /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
    /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
      /* @__PURE__ */ e(
        g,
        {
          onClick: f,
          variant: "ghost",
          size: "sm",
          iconLeft: "Calendar",
          disabled: u,
          children: l
        }
      ),
      /* @__PURE__ */ e("div", { className: "hover:bg-d-accent cursor-pointer rounded-full p-2", children: /* @__PURE__ */ e(a, { onClick: c, name: "ChevronLeft" }) }),
      /* @__PURE__ */ e("div", { className: "hover:bg-d-accent cursor-pointer rounded-full p-2", children: /* @__PURE__ */ e(a, { onClick: m, name: "ChevronRight" }) })
    ] }),
    /* @__PURE__ */ r("div", { className: "flex flex-col items-center py-2 text-center leading-tight", children: [
      /* @__PURE__ */ e(s, { variant: "h5", children: h.upperFirst(o.format("MMMM YYYY")) }),
      /* @__PURE__ */ r(s, { variant: "small", className: "text-d-muted-foreground", children: [
        o.format("D"),
        " – ",
        p.format("D MMM")
      ] })
    ] }),
    /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: t && t })
  ] }) });
};
export {
  O as CalendarHeader
};
