import p from "../../../../@babel/runtime/helpers/esm/extends.mjs";
import u from "../../../../@babel/runtime/helpers/esm/defineProperty.mjs";
import E from "../../../../classnames/index.mjs";
import * as c from "react";
import L from "../../PanelContext.mjs";
import _ from "../../RangeContext.mjs";
import { getCellDateDisabled as h, isSameWeek as f, isInRange as V } from "../../utils/dateUtil.mjs";
import y from "../DatePanel/index.mjs";
function B(n) {
  var v = n.prefixCls, l = n.generateConfig, s = n.locale, M = n.value, N = n.disabledDate, S = n.onSelect, d = c.useContext(_), o = d.rangedValue, t = d.hoverRangedValue, C = c.useContext(L), g = C.onDateMouseEnter, x = C.onDateMouseLeave, k = (t == null ? void 0 : t[0]) || (o == null ? void 0 : o[0]), D = (t == null ? void 0 : t[1]) || (o == null ? void 0 : o[1]), m = "".concat(v, "-cell"), b = function(e) {
    var a = h({
      cellDate: e,
      mode: "week",
      disabledDate: N,
      generateConfig: l
    });
    return /* @__PURE__ */ c.createElement("td", {
      key: "week",
      className: E(m, "".concat(m, "-week")),
      onClick: function() {
        a || S(e, "mouse");
      },
      onMouseEnter: function() {
        !a && g && g(e);
      },
      onMouseLeave: function() {
        !a && x && x(e);
      }
    }, /* @__PURE__ */ c.createElement("div", {
      className: "".concat(m, "-inner")
    }, l.locale.getWeek(s.locale, e)));
  }, r = "".concat(v, "-week-panel-row"), P = function(e) {
    var a, i = f(l, s.locale, k, e), R = f(l, s.locale, D, e);
    return E(r, (a = {}, u(a, "".concat(r, "-selected"), !o && f(l, s.locale, M, e)), u(a, "".concat(r, "-range-start"), i), u(a, "".concat(r, "-range-end"), R), u(a, "".concat(r, "-range-hover"), !i && !R && V(l, k, D, e)), a));
  };
  return /* @__PURE__ */ c.createElement(y, p({}, n, {
    panelName: "week",
    prefixColumn: b,
    rowClassName: P,
    keyboardConfig: {
      onLeftRight: null
    },
    isSameCell: function() {
      return !1;
    }
  }));
}
export {
  B as default
};
