// (C) 2019-2026 GoodData Corporation
const JANUARY_OFFSET = -new Date(2011, 0, 1, 0, 0, 0, 0).getTimezoneOffset();
const JUNE_OFFSET = -new Date(2011, 5, 1, 0, 0, 0, 0).getTimezoneOffset();
const timezonesRaw = [
    ["Pacific/Midway", "GMT-11:00 International Date Line West", -660, -660],
    ["Pacific/Pago_Pago", "GMT-11:00 Samoa", -660, -660],
    ["Pacific/Honolulu", "GMT-10:00 Hawaii", -600, -600],
    ["America/Juneau", "GMT-09:00 Alaska", -540, -480],
    ["America/Los_Angeles", "GMT-08:00 Pacific Time (US & Canada)", -480, -420],
    ["America/Tijuana", "GMT-08:00 Tijuana", -480, -420],
    ["America/Phoenix", "GMT-07:00 Arizona", -420, -420],
    ["America/Chihuahua", "GMT-07:00 Chihuahua", -420, -360],
    ["America/Mazatlan", "GMT-07:00 Mazatlan", -420, -360],
    ["America/Denver", "GMT-07:00 Mountain Time (US & Canada)", -420, -360],
    ["America/Guatemala", "GMT-06:00 Central America", -360, -360],
    ["America/Chicago", "GMT-06:00 Central Time (US & Canada)", -360, -300],
    ["America/Mexico_City", "GMT-06:00 Mexico City", -360, -300],
    ["America/Monterrey", "GMT-06:00 Monterrey", -360, -300],
    ["America/Regina", "GMT-06:00 Saskatchewan", -360, -360],
    ["America/Bogota", "GMT-05:00 Bogota", -300, -300],
    ["America/New_York", "GMT-05:00 Eastern Time (US & Canada)", -300, -240],
    ["America/Indiana/Indianapolis", "GMT-05:00 Indiana (East)", -300, -240],
    ["America/Lima", "GMT-05:00 Lima", -300, -300],
    ["America/Caracas", "GMT-04:30 Caracas", -270, -270],
    ["America/Halifax", "GMT-04:00 Atlantic Time (Canada)", -240, -180],
    ["America/Guyana", "GMT-04:00 Georgetown", -240, -240],
    ["America/La_Paz", "GMT-04:00 La Paz", -240, -240],
    ["America/Santiago", "GMT-04:00 Santiago", -180, -240],
    ["America/St_Johns", "GMT-03:30 Newfoundland", -210, -150],
    ["America/Sao_Paulo", "GMT-03:00 Brasilia", -120, -180],
    ["America/Argentina/Buenos_Aires", "GMT-03:00 Buenos Aires", -180, -180],
    ["America/Godthab", "GMT-03:00 Greenland", -180, -120],
    ["Atlantic/South_Georgia", "GMT-02:00 Mid-Atlantic", -120, -120],
    ["Atlantic/Azores", "GMT-01:00 Azores", -60, 0],
    ["Atlantic/Cape_Verde", "GMT-01:00 Cape Verde Is.", -60, -60],
    ["Africa/Casablanca", "GMT+00:00 Casablanca", 0, 0],
    ["Europe/Dublin", "GMT+00:00 Dublin", 0, 60],
    ["Europe/Lisbon", "GMT+00:00 Lisbon", 0, 60],
    ["Europe/London", "GMT+00:00 London", 0, 60],
    ["Africa/Monrovia", "GMT+00:00 Monrovia", 0, 0],
    ["Etc/UTC", "GMT+00:00 UTC", 0, 0],
    ["Europe/Amsterdam", "GMT+01:00 Amsterdam", 60, 120],
    ["Europe/Belgrade", "GMT+01:00 Belgrade", 60, 120],
    ["Europe/Berlin", "GMT+01:00 Berlin", 60, 120],
    ["Europe/Bratislava", "GMT+01:00 Bratislava", 60, 120],
    ["Europe/Brussels", "GMT+01:00 Brussels", 60, 120],
    ["Europe/Budapest", "GMT+01:00 Budapest", 60, 120],
    ["Europe/Copenhagen", "GMT+01:00 Copenhagen", 60, 120],
    ["Europe/Ljubljana", "GMT+01:00 Ljubljana", 60, 120],
    ["Europe/Madrid", "GMT+01:00 Madrid", 60, 120],
    ["Europe/Paris", "GMT+01:00 Paris", 60, 120],
    ["Europe/Prague", "GMT+01:00 Prague", 60, 120],
    ["Europe/Rome", "GMT+01:00 Rome", 60, 120],
    ["Europe/Sarajevo", "GMT+01:00 Sarajevo", 60, 120],
    ["Europe/Skopje", "GMT+01:00 Skopje", 60, 120],
    ["Europe/Stockholm", "GMT+01:00 Stockholm", 60, 120],
    ["Europe/Vienna", "GMT+01:00 Vienna", 60, 120],
    ["Europe/Warsaw", "GMT+01:00 Warsaw", 60, 120],
    ["Africa/Algiers", "GMT+01:00 West Central Africa", 60, 60],
    ["Europe/Zagreb", "GMT+01:00 Zagreb", 60, 120],
    ["Europe/Athens", "GMT+02:00 Athens", 120, 180],
    ["Europe/Bucharest", "GMT+02:00 Bucharest", 120, 180],
    ["Africa/Cairo", "GMT+02:00 Cairo", 120, 180],
    ["Africa/Harare", "GMT+02:00 Harare", 120, 120],
    ["Europe/Helsinki", "GMT+02:00 Helsinki", 120, 180],
    ["Europe/Istanbul", "GMT+02:00 Istanbul", 120, 180],
    ["Asia/Jerusalem", "GMT+02:00 Jerusalem", 120, 180],
    ["Europe/Kiev", "GMT+02:00 Kyiv", 120, 180],
    ["Europe/Minsk", "GMT+02:00 Minsk", 120, 180],
    ["Africa/Johannesburg", "GMT+02:00 Pretoria", 120, 120],
    ["Europe/Riga", "GMT+02:00 Riga", 120, 180],
    ["Europe/Sofia", "GMT+02:00 Sofia", 120, 180],
    ["Europe/Tallinn", "GMT+02:00 Tallinn", 120, 180],
    ["Europe/Vilnius", "GMT+02:00 Vilnius", 120, 180],
    ["Asia/Baghdad", "GMT+03:00 Baghdad", 180, 180],
    ["Asia/Kuwait", "GMT+03:00 Kuwait", 180, 180],
    ["Europe/Moscow", "GMT+03:00 Moscow", 180, 240],
    ["Africa/Nairobi", "GMT+03:00 Nairobi", 180, 180],
    ["Asia/Riyadh", "GMT+03:00 Riyadh", 180, 180],
    ["Asia/Tehran", "GMT+03:30 Tehran", 210, 270],
    ["Asia/Baku", "GMT+04:00 Baku", 240, 300],
    ["Asia/Muscat", "GMT+04:00 Muscat", 240, 240],
    ["Asia/Tbilisi", "GMT+04:00 Tbilisi", 240, 240],
    ["Asia/Yerevan", "GMT+04:00 Yerevan", 240, 300],
    ["Asia/Kabul", "GMT+04:30 Kabul", 270, 270],
    ["Asia/Yekaterinburg", "GMT+05:00 Ekaterinburg", 300, 360],
    ["Asia/Karachi", "GMT+05:00 Karachi", 300, 300],
    ["Asia/Tashkent", "GMT+05:00 Tashkent", 300, 300],
    ["Asia/Kolkata", "GMT+05:30 Kolkata", 330, 330],
    ["Asia/Colombo", "GMT+05:30 Sri Jayawardenepura", 330, 330],
    ["Asia/Kathmandu", "GMT+05:45 Kathmandu", 345, 345],
    ["Asia/Almaty", "GMT+06:00 Almaty", 360, 360],
    ["Asia/Dhaka", "GMT+06:00 Dhaka", 360, 360],
    ["Asia/Novosibirsk", "GMT+06:00 Novosibirsk", 360, 420],
    ["Asia/Rangoon", "GMT+06:30 Rangoon", 390, 390],
    ["Asia/Bangkok", "GMT+07:00 Bangkok", 420, 420],
    ["Asia/Jakarta", "GMT+07:00 Jakarta", 420, 420],
    ["Asia/Krasnoyarsk", "GMT+07:00 Krasnoyarsk", 420, 480],
    ["Asia/Shanghai", "GMT+08:00 Beijing", 480, 480],
    ["Asia/Chongqing", "GMT+08:00 Chongqing", 480, 480],
    ["Asia/Hong_Kong", "GMT+08:00 Hong Kong", 480, 480],
    ["Asia/Irkutsk", "GMT+08:00 Irkutsk", 480, 540],
    ["Asia/Kuala_Lumpur", "GMT+08:00 Kuala Lumpur", 480, 480],
    ["Australia/Perth", "GMT+08:00 Perth", 480, 480],
    ["Asia/Singapore", "GMT+08:00 Singapore", 480, 480],
    ["Asia/Taipei", "GMT+08:00 Taipei", 480, 480],
    ["Asia/Ulaanbaatar", "GMT+08:00 Ulaan Bataar", 480, 480],
    ["Asia/Urumqi", "GMT+08:00 Urumqi", 480, 480],
    ["Asia/Seoul", "GMT+09:00 Seoul", 540, 540],
    ["Asia/Tokyo", "GMT+09:00 Tokyo", 540, 540],
    ["Asia/Yakutsk", "GMT+09:00 Yakutsk", 540, 600],
    ["Australia/Adelaide", "GMT+09:30 Adelaide", 630, 570],
    ["Australia/Darwin", "GMT+09:30 Darwin", 570, 570],
    ["Australia/Brisbane", "GMT+10:00 Brisbane", 600, 600],
    ["Pacific/Guam", "GMT+10:00 Guam", 600, 600],
    ["Australia/Hobart", "GMT+10:00 Hobart", 660, 600],
    ["Australia/Melbourne", "GMT+10:00 Melbourne", 660, 600],
    ["Pacific/Port_Moresby", "GMT+10:00 Port Moresby", 600, 600],
    ["Australia/Sydney", "GMT+10:00 Sydney", 660, 600],
    ["Asia/Vladivostok", "GMT+10:00 Vladivostok", 600, 660],
    ["Asia/Kamchatka", "GMT+11:00 Kamchatka", 660, 720],
    ["Asia/Magadan", "GMT+11:00 Magadan", 660, 720],
    ["Pacific/Noumea", "GMT+11:00 New Caledonia", 660, 660],
    ["Pacific/Auckland", "GMT+12:00 Auckland", 780, 720],
    ["Pacific/Fiji", "GMT+12:00 Fiji", 780, 720],
    ["Pacific/Majuro", "GMT+12:00 Marshall Is.", 720, 720],
    ["Pacific/Tongatapu", "GMT+13:00 Nuku'alofa", 780, 780],
];
const timezones = timezonesRaw.map((t) => ({
    identifier: t[0],
    title: t[1],
    januaryOffset: t[2],
    juneOffset: t[3],
}));
const TIMEZONE_BY_OFFSETS = timezones.find((tz) => tz.januaryOffset === JANUARY_OFFSET && tz.juneOffset === JUNE_OFFSET);
export const TIMEZONE_DEFAULT = getTimezoneByIdentifier("Etc/UTC");
export function getUserTimezone() {
    return TIMEZONE_BY_OFFSETS || TIMEZONE_DEFAULT;
}
export function getTimezoneByIdentifier(title) {
    return timezones.find((tz) => tz.identifier === title);
}
