var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: !0 });
}, __copyProps = (to, from, except, desc) => {
  if (from && typeof from == "object" || typeof from == "function")
    for (let key of __getOwnPropNames(from))
      !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var Month_exports = {};
__export(Month_exports, {
  Month: () => Month
});
module.exports = __toCommonJS(Month_exports);
var import_hooks = require("@datepicker-react/hooks"), import_tamagui = require("tamagui"), import_react = require("react"), import_Day = require("./Day"), import_jsx_runtime = require("react/jsx-runtime");
function Month({ year, ...props }) {
  const { days, weekdayLabels } = (0, import_hooks.useMonth)({
    ...props,
    year,
    dayLabelFormat: (date) => new Intl.DateTimeFormat(void 0, {
      day: "numeric"
    }).format(date),
    weekdayLabelFormat: (date) => new Intl.DateTimeFormat(void 0, {
      weekday: "narrow"
    }).format(date)
  }), weeks = (0, import_react.useMemo)(() => splitIntoWeeks(days), [days]);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tamagui.Stack, { maxWidth: "100%", flexDirection: "column", gap: 12, children: [
    /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.XStack, { pb: 16, children: weekdayLabels.map((dayLabel, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
      import_tamagui.SizableText,
      {
        w: "14%",
        ta: "center",
        col: "$onSurfaceVariant",
        children: dayLabel
      },
      `day-label-${index}`
    )) }),
    weeks.map((week, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.XStack, { children: week.map((day, index2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Stack, { w: "14%", ai: "center", children: typeof day == "object" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
      import_Day.Day,
      {
        dayLabel: day.dayLabel,
        date: day.date
      },
      day.date.toString()
    ) }, `month-day-${index2}`)) }, `week-${index}`))
  ] });
}
function splitIntoWeeks(array) {
  const result = [];
  for (let i = 0; i < array.length; i += 7) {
    const week = array.slice(i, i + 7);
    result.push(week);
  }
  return result;
}
//# sourceMappingURL=Month.js.map
