"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _vue = _interopRequireWildcard(require("vue"));

var _DateConstants = _interopRequireDefault(require("./DateConstants"));

var _moment = _interopRequireDefault(require("moment"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var DateTHead = function DateTHead(_, _ref) {
  var attrs = _ref.attrs;
  var value = attrs.value;
  var localeData = value.localeData();
  var prefixCls = attrs.prefixCls;
  var veryShortWeekdays = [];
  var weekDays = [];
  var firstDayOfWeek = localeData.firstDayOfWeek();
  var showWeekNumberEl;
  var now = (0, _moment.default)();

  for (var dateColIndex = 0; dateColIndex < _DateConstants.default.DATE_COL_COUNT; dateColIndex++) {
    var index = (firstDayOfWeek + dateColIndex) % _DateConstants.default.DATE_COL_COUNT;
    now.day(index);
    veryShortWeekdays[dateColIndex] = localeData.weekdaysMin(now);
    weekDays[dateColIndex] = localeData.weekdaysShort(now);
  }

  if (attrs.showWeekNumber) {
    showWeekNumberEl = _vue.createVNode("th", {
      "role": "columnheader",
      "class": "".concat(prefixCls, "-column-header ").concat(prefixCls, "-week-number-header")
    }, [_vue.createVNode("span", {
      "class": "".concat(prefixCls, "-column-header-inner")
    }, [_vue.createTextVNode("x")])]);
  }

  var weekDaysEls = weekDays.map(function (day, xindex) {
    return _vue.createVNode("th", {
      "key": xindex,
      "role": "columnheader",
      "title": day,
      "class": "".concat(prefixCls, "-column-header")
    }, [_vue.createVNode("span", {
      "class": "".concat(prefixCls, "-column-header-inner")
    }, [veryShortWeekdays[xindex]])]);
  });
  return _vue.createVNode("thead", null, [_vue.createVNode("tr", {
    "role": "row"
  }, [showWeekNumberEl, weekDaysEls])]);
};

DateTHead.inheritAttrs = false;
var _default = DateTHead;
exports.default = _default;