import E from "../../../../@babel/runtime/helpers/esm/extends.mjs";
import * as m from "react";
import { YEAR_DECADE_COUNT as n } from "./constant.mjs";
import h from "../../hooks/useCellClassName.mjs";
import { isSameYear as O, formatValue as b } from "../../utils/dateUtil.mjs";
import A from "../../RangeContext.mjs";
import T from "../PanelBody.mjs";
var g = 3, d = 4;
function L(r) {
  var c = r.prefixCls, s = r.value, i = r.viewDate, u = r.locale, e = r.generateConfig, C = r.cellRender, f = m.useContext(A), v = f.rangedValue, Y = f.hoverRangedValue, N = "".concat(c, "-cell"), R = e.getYear(i), o = Math.floor(R / n) * n, x = o + n - 1, V = e.setYear(i, o - Math.ceil((g * d - n) / 2)), y = e.getNow(), _ = function(a) {
    var t = e.getYear(a);
    return o <= t && t <= x;
  }, w = h({
    cellPrefixCls: N,
    value: s,
    generateConfig: e,
    rangedValue: v,
    hoverRangedValue: Y,
    isSameCell: function(a, t) {
      return O(e, a, t);
    },
    isInView: _,
    offsetCell: function(a, t) {
      return e.addYear(a, t);
    }
  }), D = C ? function(l, a) {
    return C(l, {
      originNode: a,
      today: y,
      type: "year",
      locale: u
    });
  } : void 0;
  return /* @__PURE__ */ m.createElement(T, E({}, r, {
    rowNum: d,
    colNum: g,
    baseDate: V,
    getCellNode: D,
    getCellText: e.getYear,
    getCellClassName: w,
    getCellDate: e.addYear,
    titleCell: function(a) {
      return b(a, {
        locale: u,
        format: "YYYY",
        generateConfig: e
      });
    }
  }));
}
export {
  g as YEAR_COL_COUNT,
  L as default
};
