var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { h } from '@stencil/core';
import { MapToComponentField, VegaSlimmer } from 'vega-slimmer/core';
import { pad } from '../../../../../utils/date';
/** The `VegaCalendarTimeLineRenderer` class in TypeScript React renders a time line with custom time format options and includes methods for rendering time markers and the time line itself. */
export class VegaCalendarTimeLineRenderer extends VegaSlimmer {
  /**
   * rendering the time line component as an HTML element
   *
   * @returns {HTMLElement} the html element
   */
  render() {
    const timeLineSource = this.getTimeLineTitles();
    return (h("div", { class: "time-line" },
      h("div", { class: "hour-empty" }),
      timeLineSource.map((time, index) => {
        return (h("div", { key: time },
          h("div", { class: "time-text", "data-time": index === 0 ? 24 : index }, time)));
      })));
  }
  /**
   * The function `getTimeLineTitles` generates a time line array based on the specified time format (24-hour) and stores it in the `timeLineSource` property.
   *
   * @returns {string[]} returns an array of strings representing the time line
   */
  getTimeLineTitles() {
    const timeLine = [];
    if (this.timeFormat === '12-hour') {
      timeLine.push('12 AM');
      for (let i = 1; i < 12; i++) {
        timeLine.push(`${i} AM`);
      }
      timeLine.push('12 PM');
      for (let i = 1; i < 12; i++) {
        timeLine.push(`${i} PM`);
      }
    }
    else {
      for (let i = 0; i < 24; i++) {
        timeLine.push(`${pad(i)}`);
      }
    }
    return timeLine;
  }
}
__decorate([
  MapToComponentField()
], VegaCalendarTimeLineRenderer.prototype, "timeFormat", void 0);
