
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/


/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

export function weightToTickMarkType(weight, timeVisible, secondsVisible) {
  switch (weight) {
    case 0 /* LessThanSecond */:
    case 10 /* Second */:
      return timeVisible ? secondsVisible ? 4 /* TimeWithSeconds */ : 3 /* Time */ : 2 /* DayOfMonth */;
    case 20 /* Minute1 */:
    case 21 /* Minute5 */:
    case 22 /* Minute30 */:
    case 30 /* Hour1 */:
    case 31 /* Hour3 */:
    case 32 /* Hour6 */:
    case 33 /* Hour12 */:
      return timeVisible ? 3 /* Time */ : 2 /* DayOfMonth */;
    case 50 /* Day */:
      return 2 /* DayOfMonth */;
    case 60 /* Month */:
      return 1 /* Month */;
    case 70 /* Year */:
      return 0 /* Year */;
  }
}

var dateTimeFormatCache = {};
function getDateTimeFormat(locale, timeZone, tickMarkType) {
  var key = locale + '\0' + timeZone + '\0' + tickMarkType;
  var fmt = dateTimeFormatCache[key];
  if (!fmt) {
    var options = {
      timeZone: timeZone
    };
    switch (tickMarkType) {
      case 0 /* Year */:
        options.year = 'numeric';
        break;
      case 1 /* Month */:
        options.month = 'short';
        break;
      case 2 /* DayOfMonth */:
        options.day = 'numeric';
        break;
      case 3 /* Time */:
        options.hour12 = false;
        options.hour = '2-digit';
        options.minute = '2-digit';
        break;
      case 4 /* TimeWithSeconds */:
        options.hour12 = false;
        options.hour = '2-digit';
        options.minute = '2-digit';
        options.second = '2-digit';
        break;
    }
    fmt = new Intl.DateTimeFormat(locale, options);
    dateTimeFormatCache[key] = fmt;
  }
  return fmt;
}
export function defaultTickMarkFormatter(timePoint, tickMarkType, locale, timeZone) {
  if (timeZone === void 0) {
    timeZone = 'Asia/Shanghai';
  }
  var date = new Date(timePoint.timestamp * 1000);
  return getDateTimeFormat(locale, timeZone, tickMarkType).format(date);
}