import g from "../../../../@babel/runtime/helpers/esm/extends.mjs";
import P from "../../../../@babel/runtime/helpers/esm/defineProperty.mjs";
import Y from "../../../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import k from "../../../../classnames/index.mjs";
import * as u from "react";
import { WEEK_DAY_COUNT as M } from "../../utils/dateUtil.mjs";
import { createKeyDownHandler as _ } from "../../utils/uiUtil.mjs";
import R from "./DateBody.mjs";
import E from "./DateHeader.mjs";
var U = 6;
function A(e) {
  var m = e.prefixCls, C = e.panelName, w = C === void 0 ? "date" : C, y = e.keyboardConfig, x = e.active, N = e.operationRef, i = e.generateConfig, c = e.value, n = e.viewDate, d = e.onViewDateChange, l = e.onPanelChange, f = e.onSelect, v = "".concat(m, "-").concat(w, "-panel");
  N.current = {
    onKeyDown: function(a) {
      return _(a, Y({
        onLeftRight: function(r) {
          f(i.addDate(c || n, r), "key");
        },
        onCtrlLeftRight: function(r) {
          f(i.addYear(c || n, r), "key");
        },
        onUpDown: function(r) {
          f(i.addDate(c || n, r * M), "key");
        },
        onPageUpDown: function(r) {
          f(i.addMonth(c || n, r), "key");
        }
      }, y));
    }
  };
  var h = function(a) {
    var t = i.addYear(n, a);
    d(t), l(null, t);
  }, D = function(a) {
    var t = i.addMonth(n, a);
    d(t), l(null, t);
  };
  return /* @__PURE__ */ u.createElement("div", {
    className: k(v, P({}, "".concat(v, "-active"), x))
  }, /* @__PURE__ */ u.createElement(E, g({}, e, {
    prefixCls: m,
    value: c,
    viewDate: n,
    onPrevYear: function() {
      h(-1);
    },
    onNextYear: function() {
      h(1);
    },
    onPrevMonth: function() {
      D(-1);
    },
    onNextMonth: function() {
      D(1);
    },
    onMonthClick: function() {
      l("month", n);
    },
    onYearClick: function() {
      l("year", n);
    }
  })), /* @__PURE__ */ u.createElement(R, g({}, e, {
    onSelect: function(a) {
      return f(a, "mouse");
    },
    prefixCls: m,
    value: c,
    viewDate: n,
    rowCount: U
  })));
}
export {
  A as default
};
