@kong-ui-public/analytics-utilities 12.6.1 → 12.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"vitals-utilities.umd.js","sources":["../src/constants.ts","../src/types/timeframe-keys.ts","../src/types/timeframe-options.ts","../src/types/chart-types.ts","../src/types/explore/common.ts","../src/types/explore/util.ts","../src/types/explore/basic.ts","../src/types/explore/advanced.ts","../src/types/explore/ai.ts","../src/types/explore/requests.ts","../src/types/explore/all.ts","../src/types/country-codes.ts","../src/dashboardSchema.v2.ts","../src/filters.ts","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatLong.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatRelative.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/localize.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchFn.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/match.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constants.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDayOfYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeek.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeekYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeekYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeek.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/addLeadingZeros.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/lightFormatters.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/formatters.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/longFormatters.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/protectedTokens.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/format.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addDays.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addMonths.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfMonth.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDaysInMonth.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDefaultOptions.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getTime.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getUnixTime.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/hoursToSeconds.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/minutesToHours.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/subMonths.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/tzIntlTimeZoneName/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/tzTokenizeDate/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/newDateUTC/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/tzParseTimezone/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/format/formatters/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/getTimezoneOffsetInMilliseconds/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/tzPattern/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/toDate/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/format/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/toZonedTime/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/formatInTimeZone/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/fromZonedTime/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/getTimezoneOffset/index.js","../src/format.ts","../src/granularity.ts","../src/queryTime.ts","../../../../node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.js","../src/timeframes.ts","../src/utils/SeedRandom.ts","../src/utils/chartDataGenerator.ts","../src/utils/helpers.ts","../src/utils/GeoLookup.ts","../../../../node_modules/.pnpm/approximate-number@2.1.1/node_modules/approximate-number/lib/approximate-number.js","../src/utils/formatUnit.ts"],"sourcesContent":["export const REFRESH_INTERVAL_MS = 30 * 1000\n\nexport const EXPORT_RECORD_LIMIT = 1000\n\nexport const INJECT_QUERY_PROVIDER = 'analytics-query-provider'\n","\nexport enum TimeframeKeys {\n FIFTEEN_MIN = '15m',\n ONE_HOUR = '1h',\n SIX_HOUR = '6h',\n TWELVE_HOUR = '12h',\n ONE_DAY = '24h',\n SEVEN_DAY = '7d',\n THIRTY_DAY = '30d',\n NINETY_DAY = '90d',\n ONE_HUNDRED_EIGHTY_DAY = '180d',\n ONE_YEAR = '365d',\n CURRENT_WEEK = 'current_week',\n CURRENT_MONTH = 'current_month',\n CURRENT_QUARTER = 'current_quarter',\n CURRENT_YEAR = 'current_year',\n PREVIOUS_WEEK = 'previous_week',\n PREVIOUS_MONTH = 'previous_month',\n PREVIOUS_QUARTER = 'previous_quarter',\n PREVIOUS_YEAR = 'previous_year',\n}\n","import type { GranularityValues, RelativeTimeRangeValuesV4 } from './explore'\n\nexport interface TimeframeOptions {\n key: RelativeTimeRangeValuesV4 | ExtendedRelativeTimeRangeValues | 'custom'\n timeframeText: string\n display: string\n defaultResponseGranularity: GranularityValues\n dataGranularity: GranularityValues\n isRelative: boolean\n timeframeLength: () => number\n allowedTiers: string[]\n startCustom?: Date\n endCustom?: Date\n allowedGranularitiesOverride?: GranularityValues[]\n fineGrainedDefaultGranularity?: GranularityValues\n}\n\n// Supported by time periods, but not supported in Explore APIs.\nexport const extendedRelativeTimeRangeValues = ['90d', '180d', '365d', 'current_year', 'previous_year'] as const\nexport type ExtendedRelativeTimeRangeValues = typeof extendedRelativeTimeRangeValues[number]\n","export const reportChartTypes = [\n 'horizontal_bar',\n 'vertical_bar',\n 'timeseries_line',\n 'choropleth_map',\n 'timeseries_bar',\n 'donut',\n 'single_value',\n] as const\n\nexport type ReportChartTypes = typeof reportChartTypes[number]\n","\nexport const exploreFilterTypesV2 = ['in', 'not_in', 'selector'] as const\n\nexport type ExploreFilterTypesV2 = typeof exploreFilterTypesV2[number]\n\nexport const requestFilterTypeEqualsV2 = ['=', '!='] as const\n\nexport type RequestFilterTypeEqualsV2 = typeof requestFilterTypeEqualsV2[number]\n\nexport const requestFilterTypeMetricV2 = ['=', '!=', '<', '>', '<=', '>='] as const\n\nexport type RequestFilterTypeMetricV2 = typeof requestFilterTypeMetricV2[number]\n\nexport const requestFilterTypeEmptyV2 = ['empty', 'not_empty'] as const\n\nexport type RequestFilterTypeEmptyV2 = typeof requestFilterTypeEmptyV2[number]\n\nexport const requestFilterTypeWildcardV2 = ['starts_with', 'ends_with'] as const\n\nexport type RequestFilterTypeWildcardV2 = typeof requestFilterTypeWildcardV2[number]\n\n\n// Note: time types are common to all of the datasources.\n// If a datasource doesn't support a certain time range / time spec, it returns no records\n// rather than failing.\n// If a datasource doesn't support a certain granularity, it rounds to the nearest granularity it does support.\n\nexport const timeRangeTypeV2 = ['absolute', 'relative'] as const\n\nexport type TimeRangeTypeV2 = typeof timeRangeTypeV2[number]\n\n\nexport interface AbsoluteTimeRangeV4 {\n type: 'absolute'\n tz?: string\n start: Date\n end: Date\n}\n\nexport const relativeTimeRangeValuesV4 = [\n '15m',\n '1h',\n '6h',\n '12h',\n '24h',\n '7d',\n 'current_week',\n 'previous_week',\n '30d',\n 'current_month',\n 'previous_month',\n] as const\n\nexport type RelativeTimeRangeValuesV4 = typeof relativeTimeRangeValuesV4[number]\n\nexport interface RelativeTimeRangeV4 {\n type: 'relative'\n tz?: string\n time_range: RelativeTimeRangeValuesV4\n}\n\nexport type TimeRangeV4 = AbsoluteTimeRangeV4 | RelativeTimeRangeV4\n\nexport interface TimeRangeMetaResponse {\n start: string\n end: string\n min_granularity_ms: number\n}\n\nexport const granularityValues = [\n 'secondly',\n 'tenSecondly',\n 'thirtySecondly',\n 'minutely',\n 'fiveMinutely',\n 'tenMinutely',\n 'thirtyMinutely',\n 'hourly',\n 'twoHourly',\n 'twelveHourly',\n 'daily',\n 'weekly',\n 'trend',\n] as const\n\nexport type GranularityValues = typeof granularityValues[number]\n","// Utility types for `makeFilterable`.\n// In essence: recurse through the tuple type `T` and exclude elements that match `E`.\n// https://stackoverflow.com/questions/58984164/typescript-filter-tuple-type-by-an-arbitrary-type\ntype ExcludeFromTuple<T extends readonly any[], E> =\n T extends readonly [infer F, ...infer R] ? [F] extends readonly [E] ? ExcludeFromTuple<R, E> :\n [F, ...ExcludeFromTuple<R, E>] : []\n\n// Basically, all dimensions are filterable except for time.\ntype ExceptTime<T extends readonly any[]> = ExcludeFromTuple<T, 'time'>\n\n// Utility for deriving filterable dimensions from queryable dimensions with correct types.\nexport const makeFilterable = <T extends readonly unknown[]>(queryable: T) =>\n queryable.filter(d => d !== 'time') as ExceptTime<T>\n","import { makeFilterable } from './util'\nimport type { ExploreFilterTypesV2, GranularityValues, RequestFilterTypeEmptyV2, TimeRangeV4 } from './common'\n\nexport const queryableBasicExploreDimensions = [\n 'api',\n 'api_package',\n 'api_product',\n 'api_product_version',\n 'control_plane',\n 'control_plane_group',\n 'data_plane_node',\n 'gateway_service',\n 'portal',\n 'route',\n 'status_code',\n 'status_code_grouped',\n 'time',\n] as const\n\nexport type QueryableBasicExploreDimensions = typeof queryableBasicExploreDimensions[number]\n\nexport const filterableBasicExploreDimensions = makeFilterable(queryableBasicExploreDimensions)\n\nexport type FilterableBasicExploreDimensions = typeof filterableBasicExploreDimensions[number]\n\nexport interface BasicExploreInFilterV2 {\n operator: ExploreFilterTypesV2\n field: FilterableBasicExploreDimensions\n value: Array<string | number | null>\n}\n\nexport interface BasicExploreEmptyFilterV2 {\n operator: RequestFilterTypeEmptyV2\n field: FilterableBasicExploreDimensions\n}\nexport const basicExploreAggregations = [\n 'active_services',\n 'request_count',\n 'request_per_minute',\n 'response_latency_average',\n] as const\n\nexport type BasicExploreAggregations = typeof basicExploreAggregations[number]\n\nexport type BasicExploreFilterAll = BasicExploreInFilterV2 | BasicExploreEmptyFilterV2\n\nexport interface BasicExploreQuery {\n metrics?: BasicExploreAggregations[]\n dimensions?: QueryableBasicExploreDimensions[]\n filters?: BasicExploreFilterAll[]\n granularity?: GranularityValues\n time_range?: TimeRangeV4\n limit?: number\n descending?: boolean\n short_name?: boolean\n meta?: {\n query_id: string\n }\n}\n","import { makeFilterable } from './util'\nimport type { BasicExploreEmptyFilterV2, BasicExploreInFilterV2, BasicExploreQuery } from './basic'\nimport { basicExploreAggregations, queryableBasicExploreDimensions } from './basic'\n\nexport const queryableExploreDimensions = [\n ...queryableBasicExploreDimensions,\n 'application',\n 'consumer',\n 'country_code',\n 'upstream_status_code',\n 'upstream_status_code_grouped',\n 'response_source',\n 'data_plane_node_version',\n 'realm',\n] as const\n\nexport type QueryableExploreDimensions = typeof queryableExploreDimensions[number]\n\nexport const filterableExploreDimensions = makeFilterable(queryableExploreDimensions)\n\nexport type FilterableExploreDimensions = typeof filterableExploreDimensions[number]\n\nexport interface ExploreInFilterV2 extends Omit<BasicExploreInFilterV2, 'field'> {\n field: FilterableExploreDimensions\n}\n\nexport interface ExploreEmptyFilterV2 extends Omit<BasicExploreEmptyFilterV2, 'field'> {\n field: FilterableExploreDimensions\n}\n\nexport const exploreAggregations = [\n ...basicExploreAggregations,\n 'response_latency_p99',\n 'response_latency_p95',\n 'response_latency_p50',\n 'upstream_latency_p99',\n 'upstream_latency_p95',\n 'upstream_latency_p50',\n 'upstream_latency_average',\n 'kong_latency_p99',\n 'kong_latency_p95',\n 'kong_latency_p50',\n 'kong_latency_average',\n 'response_size_p99',\n 'response_size_p95',\n 'response_size_p50',\n 'response_size_average',\n 'response_size_sum',\n 'request_size_p99',\n 'request_size_p95',\n 'request_size_p50',\n 'request_size_average',\n 'request_size_sum',\n] as const\n\nexport type ExploreAggregations = typeof exploreAggregations[number]\n\nexport type ExploreFilterAll = ExploreInFilterV2 | ExploreEmptyFilterV2\n\nexport interface ExploreQuery extends Omit<BasicExploreQuery, 'metrics' | 'dimensions' | 'filters'> {\n metrics?: ExploreAggregations[]\n dimensions?: QueryableExploreDimensions[]\n filters?: ExploreFilterAll[]\n}\n","import { makeFilterable } from './util'\nimport type { BasicExploreEmptyFilterV2, BasicExploreInFilterV2, BasicExploreQuery } from './basic'\n\nexport const queryableAiExploreDimensions = [\n 'control_plane',\n 'control_plane_group',\n 'gateway_service',\n 'consumer',\n 'application',\n 'route',\n 'ai_provider',\n 'ai_response_model',\n 'ai_request_model',\n 'llm_cache_status',\n 'llm_embeddings_provider',\n 'llm_embeddings_model',\n 'time',\n 'realm',\n 'status_code',\n 'status_code_grouped',\n 'ai_plugin',\n] as const\n\nexport type QueryableAiExploreDimensions = typeof queryableAiExploreDimensions[number]\n\nexport const filterableAiExploreDimensions = makeFilterable(queryableAiExploreDimensions)\n\nexport type FilterableAiExploreDimensions = typeof queryableAiExploreDimensions[number]\n\nexport interface AiExploreInFilterV2 extends Omit<BasicExploreInFilterV2, 'field'> {\n field: FilterableAiExploreDimensions\n}\n\nexport interface AiExploreEmptyFilterV2 extends Omit<BasicExploreEmptyFilterV2, 'field'> {\n field: FilterableAiExploreDimensions\n}\n\nexport const aiExploreAggregations = [\n 'total_tokens',\n 'prompt_tokens',\n 'completion_tokens',\n 'ai_request_count',\n 'cost',\n 'llm_cache_embeddings_latency_average',\n 'llm_cache_fetch_latency_average',\n 'llm_latency_average',\n 'llm_embeddings_tokens',\n 'llm_embeddings_cost',\n] as const\n\nexport type AiExploreAggregations = typeof aiExploreAggregations[number]\n\nexport type AiExploreFilterAll = AiExploreInFilterV2 | AiExploreEmptyFilterV2\n\nexport interface AiExploreQuery extends Omit<BasicExploreQuery, 'metrics' | 'dimensions' | 'filters'> {\n metrics?: AiExploreAggregations[]\n dimensions?: QueryableAiExploreDimensions[]\n filters?: AiExploreFilterAll[]\n}\n\n","import { makeFilterable } from './util'\nimport type { AbsoluteTimeRangeV4, ExploreFilterTypesV2, RequestFilterTypeEmptyV2, RequestFilterTypeEqualsV2, RequestFilterTypeMetricV2, RequestFilterTypeWildcardV2 } from './common'\n\n// status_code and upstream_status_code are treated as metric filters\nexport const queryableRequestDimensions = [\n 'api',\n 'api_package',\n 'api_product',\n 'api_product_version',\n 'application',\n 'auth_type',\n 'client_ip',\n 'consumer',\n 'consumer_group',\n 'control_plane',\n 'control_plane_group',\n 'country_code',\n 'data_plane_node',\n 'data_plane_node_version',\n 'gateway_service',\n 'header_host',\n 'header_user_agent',\n 'http_method',\n 'portal',\n 'realm',\n 'request_id',\n 'request_uri',\n 'response_header_content_type',\n 'response_source',\n 'route',\n 'service_port',\n 'service_protocol',\n 'sse',\n 'status_code_grouped',\n 'time',\n 'trace_id',\n 'upstream_uri',\n 'upstream_status_code_grouped',\n 'websocket',\n] as const\n\nexport type QueryableRequestDimensions = typeof queryableRequestDimensions[number]\n\nexport const filterableRequestDimensions = makeFilterable(queryableRequestDimensions)\n\nexport type FilterableRequestDimensions = typeof filterableRequestDimensions[number]\n\nexport const queryableRequestWildcardDimensions = [\n 'auth_type',\n 'client_ip',\n 'data_plane_node_version',\n 'header_host',\n 'header_user_agent',\n 'http_method',\n 'request_id',\n 'request_uri',\n 'response_header_content_type',\n 'response_source',\n 'service_port',\n 'service_protocol',\n 'trace_id',\n 'upstream_uri',\n] as const\n\nexport type QueryableRequestWildcardDimensions = typeof queryableRequestWildcardDimensions[number]\n\nexport const filterableRequestWildcardDimensions = queryableRequestWildcardDimensions\n\nexport type FilterableRequestWildcardDimensions = typeof filterableRequestWildcardDimensions[number]\n\nexport const queryableRequestMetrics = [\n 'ai_count',\n 'latencies_response_ms',\n 'latencies_upstream_ms',\n 'latencies_kong_gateway_ms',\n 'request_body_size',\n 'response_body_size',\n 'response_header_content_length',\n 'status_code',\n 'upstream_status_code',\n] as const\n\nexport type QueryableRequestMetrics = typeof queryableRequestMetrics[number]\n\nexport const filterableRequestMetrics = makeFilterable(queryableRequestMetrics)\n\nexport type FilterableRequestMetrics = typeof filterableRequestMetrics[number]\n\nexport interface RequestInFilter {\n operator: ExploreFilterTypesV2\n field: FilterableRequestDimensions | FilterableRequestWildcardDimensions | FilterableRequestMetrics\n value: Array<string | number>\n}\nexport interface RequestEqualsFilter {\n operator: RequestFilterTypeEqualsV2\n field: FilterableRequestDimensions | FilterableRequestWildcardDimensions\n value: string\n}\nexport interface RequestMetricFilter {\n operator: RequestFilterTypeMetricV2\n field: FilterableRequestMetrics\n value: number\n}\nexport interface RequestEmptyFilter {\n operator: RequestFilterTypeEmptyV2\n field: FilterableRequestDimensions | FilterableRequestWildcardDimensions | FilterableRequestMetrics\n}\nexport interface RequestWildcardFilter {\n operator: RequestFilterTypeWildcardV2\n field: FilterableRequestWildcardDimensions\n value: string\n}\n\nexport type RequestFilter = RequestInFilter |\n RequestEqualsFilter |\n RequestMetricFilter |\n RequestEmptyFilter |\n RequestWildcardFilter\n\nexport const relativeTimeRangeValuesRequestV2 = [\n '15M',\n '1H',\n '6H',\n '12H',\n '24H',\n '7D',\n] as const\n\nexport type RelativeTimeRangeValuesRequestV2 = typeof relativeTimeRangeValuesRequestV2[number]\n\nexport interface RelativeTimeRangeRequestV2 {\n type: 'relative'\n tz?: string\n time_range: RelativeTimeRangeValuesRequestV2\n}\n\nexport type TimeRangeRequestV2 = AbsoluteTimeRangeV4 | RelativeTimeRangeRequestV2\n\nexport interface RequestQuery {\n filters: RequestFilter[]\n time_range: TimeRangeRequestV2\n order?: string\n offset?: number\n size?: number\n query_id?: string\n limit?: number\n classified?: boolean\n}\n","import { type BasicExploreAggregations, type BasicExploreFilterAll, type FilterableBasicExploreDimensions, filterableBasicExploreDimensions } from './basic'\nimport { type AiExploreAggregations, type AiExploreFilterAll, type FilterableAiExploreDimensions, filterableAiExploreDimensions } from './ai'\nimport { type ExploreAggregations, type ExploreFilterAll, type FilterableExploreDimensions, filterableExploreDimensions } from './advanced'\nimport { type FilterableRequestDimensions, type FilterableRequestMetrics, type FilterableRequestWildcardDimensions } from './requests'\n\nexport type AllAggregations = BasicExploreAggregations | AiExploreAggregations | ExploreAggregations\nexport type AllFilters = BasicExploreFilterAll | AiExploreFilterAll | ExploreFilterAll\nexport type AllFilterableDimensionsAndMetrics = FilterableExploreDimensions\n | FilterableAiExploreDimensions\n | FilterableBasicExploreDimensions\n | FilterableRequestDimensions\n | FilterableRequestMetrics\n | FilterableRequestWildcardDimensions\n\nexport const queryDatasources = ['basic', 'api_usage', 'llm_usage'] as const\n\nexport type QueryDatasource = typeof queryDatasources[number]\n\nexport type FilterDatasource = QueryDatasource | 'requests'\n\nexport interface FilterTypeMap extends Record<QueryDatasource, AllFilters> {\n basic: BasicExploreFilterAll\n api_usage: ExploreFilterAll\n llm_usage: AiExploreFilterAll\n}\n\nexport const datasourceToFilterableDimensions: Record<QueryDatasource, Set<string>> = {\n basic: new Set(filterableBasicExploreDimensions),\n api_usage: new Set(filterableExploreDimensions),\n llm_usage: new Set(filterableAiExploreDimensions),\n} as const\n\n// Utility for stripping unknown filters\nexport const stripUnknownFilters = <K extends keyof typeof datasourceToFilterableDimensions>(datasource: K, filters: AllFilters[]): Array<FilterTypeMap[K]> => {\n if (datasource.startsWith('goap')) {\n // We currently can't determine the type for goap datasources as it could be\n // anything so we have to just trust that valid filters were applied\n return filters as any\n }\n\n // Note: once we extend API request filters, this may need to look at more than just dimensions.\n // Note the cast; we could potentially try to derive the type, but it doesn't seem worth it.\n return filters.filter(f => datasourceToFilterableDimensions[datasource].has(f.field)) as Array<FilterTypeMap[K]>\n}\n\n// TODO: Add utility func for marking unknown filters (but not stripping them).\n","export const COUNTRIES = [\n { code: 'AF', name: 'Afghanistan' },\n { code: 'AX', name: 'Aland Islands' },\n { code: 'AL', name: 'Albania' },\n { code: 'DZ', name: 'Algeria' },\n { code: 'AS', name: 'American Samoa' },\n { code: 'AD', name: 'Andorra' },\n { code: 'AO', name: 'Angola' },\n { code: 'AI', name: 'Anguilla' },\n { code: 'AQ', name: 'Antarctica' },\n { code: 'AG', name: 'Antigua and Barbuda' },\n { code: 'AR', name: 'Argentina' },\n { code: 'AM', name: 'Armenia' },\n { code: 'AW', name: 'Aruba' },\n { code: 'AU', name: 'Australia' },\n { code: 'AT', name: 'Austria' },\n { code: 'AZ', name: 'Azerbaijan' },\n { code: 'BS', name: 'Bahamas' },\n { code: 'BH', name: 'Bahrain' },\n { code: 'BD', name: 'Bangladesh' },\n { code: 'BB', name: 'Barbados' },\n { code: 'BY', name: 'Belarus' },\n { code: 'BE', name: 'Belgium' },\n { code: 'BZ', name: 'Belize' },\n { code: 'BJ', name: 'Benin' },\n { code: 'BM', name: 'Bermuda' },\n { code: 'BT', name: 'Bhutan' },\n { code: 'BO', name: 'Bolivia' },\n { code: 'BA', name: 'Bosnia and Herzegovina' },\n { code: 'BW', name: 'Botswana' },\n { code: 'BV', name: 'Bouvet Island' },\n { code: 'BR', name: 'Brazil' },\n { code: 'IO', name: 'British Indian Ocean Territory' },\n { code: 'BN', name: 'Brunei Darussalam' },\n { code: 'BG', name: 'Bulgaria' },\n { code: 'BF', name: 'Burkina Faso' },\n { code: 'BI', name: 'Burundi' },\n { code: 'KH', name: 'Cambodia' },\n { code: 'CM', name: 'Cameroon' },\n { code: 'CA', name: 'Canada' },\n { code: 'CV', name: 'Cape Verde' },\n { code: 'KY', name: 'Cayman Islands' },\n { code: 'CF', name: 'Central African Republic' },\n { code: 'TD', name: 'Chad' },\n { code: 'CL', name: 'Chile' },\n { code: 'CN', name: 'China' },\n { code: 'CX', name: 'Christmas Island' },\n { code: 'CC', name: 'Cocos (Keeling) Islands' },\n { code: 'CO', name: 'Colombia' },\n { code: 'KM', name: 'Comoros' },\n { code: 'CG', name: 'Congo' },\n { code: 'CD', name: 'Democratic Republic of the Congo' },\n { code: 'CK', name: 'Cook Islands' },\n { code: 'CR', name: 'Costa Rica' },\n { code: 'CI', name: \"Cote d'Ivoire\" },\n { code: 'HR', name: 'Croatia' },\n { code: 'CU', name: 'Cuba' },\n { code: 'CY', name: 'Cyprus' },\n { code: 'CZ', name: 'Czech Republic' },\n { code: 'DK', name: 'Denmark' },\n { code: 'DJ', name: 'Djibouti' },\n { code: 'DM', name: 'Dominica' },\n { code: 'DO', name: 'Dominican Republic' },\n { code: 'EC', name: 'Ecuador' },\n { code: 'EG', name: 'Egypt' },\n { code: 'SV', name: 'El Salvador' },\n { code: 'GQ', name: 'Equatorial Guinea' },\n { code: 'ER', name: 'Eritrea' },\n { code: 'EE', name: 'Estonia' },\n { code: 'ET', name: 'Ethiopia' },\n { code: 'FK', name: 'Falkland Islands (Malvinas)' },\n { code: 'FO', name: 'Faroe Islands' },\n { code: 'FJ', name: 'Fiji' },\n { code: 'FI', name: 'Finland' },\n { code: 'FR', name: 'France' },\n { code: 'GF', name: 'French Guiana' },\n { code: 'PF', name: 'French Polynesia' },\n { code: 'TF', name: 'French Southern Territories' },\n { code: 'GA', name: 'Gabon' },\n { code: 'GM', name: 'Gambia' },\n { code: 'GE', name: 'Georgia' },\n { code: 'DE', name: 'Germany' },\n { code: 'GH', name: 'Ghana' },\n { code: 'GI', name: 'Gibraltar' },\n { code: 'GR', name: 'Greece' },\n { code: 'GL', name: 'Greenland' },\n { code: 'GD', name: 'Grenada' },\n { code: 'GP', name: 'Guadeloupe' },\n { code: 'GU', name: 'Guam' },\n { code: 'GT', name: 'Guatemala' },\n { code: 'GG', name: 'Guernsey' },\n { code: 'GN', name: 'Guinea' },\n { code: 'GW', name: 'Guinea-Bissau' },\n { code: 'GY', name: 'Guyana' },\n { code: 'HT', name: 'Haiti' },\n { code: 'HM', name: 'Heard Island and McDonald Islands' },\n { code: 'VA', name: 'The Vatican' },\n { code: 'HN', name: 'Honduras' },\n { code: 'HK', name: 'Hong Kong' },\n { code: 'HU', name: 'Hungary' },\n { code: 'IS', name: 'Iceland' },\n { code: 'IN', name: 'India' },\n { code: 'ID', name: 'Indonesia' },\n { code: 'IR', name: 'Iran' },\n { code: 'IQ', name: 'Iraq' },\n { code: 'IE', name: 'Ireland' },\n { code: 'IM', name: 'Isle of Man' },\n { code: 'IL', name: 'Israel' },\n { code: 'IT', name: 'Italy' },\n { code: 'JM', name: 'Jamaica' },\n { code: 'JP', name: 'Japan' },\n { code: 'JE', name: 'Jersey' },\n { code: 'JO', name: 'Jordan' },\n { code: 'KZ', name: 'Kazakhstan' },\n { code: 'KE', name: 'Kenya' },\n { code: 'KI', name: 'Kiribati' },\n { code: 'KP', name: 'North Korea' },\n { code: 'KR', name: 'South Korea' },\n { code: 'KW', name: 'Kuwait' },\n { code: 'KG', name: 'Kyrgyzstan' },\n { code: 'LA', name: 'Laos' },\n { code: 'LV', name: 'Latvia' },\n { code: 'LB', name: 'Lebanon' },\n { code: 'LS', name: 'Lesotho' },\n { code: 'LR', name: 'Liberia' },\n { code: 'LY', name: 'Libya' },\n { code: 'LI', name: 'Liechtenstein' },\n { code: 'LT', name: 'Lithuania' },\n { code: 'LU', name: 'Luxembourg' },\n { code: 'MO', name: 'Macao' },\n { code: 'MK', name: 'Macedonia' },\n { code: 'MG', name: 'Madagascar' },\n { code: 'MW', name: 'Malawi' },\n { code: 'MY', name: 'Malaysia' },\n { code: 'MV', name: 'Maldives' },\n { code: 'ML', name: 'Mali' },\n { code: 'MT', name: 'Malta' },\n { code: 'MH', name: 'Marshall Islands' },\n { code: 'MQ', name: 'Martinique' },\n { code: 'MR', name: 'Mauritania' },\n { code: 'MU', name: 'Mauritius' },\n { code: 'YT', name: 'Mayotte' },\n { code: 'MX', name: 'Mexico' },\n { code: 'FM', name: 'Micronesia, ' },\n { code: 'MD', name: 'Moldova,' },\n { code: 'MC', name: 'Monaco' },\n { code: 'MN', name: 'Mongolia' },\n { code: 'ME', name: 'Montenegro' },\n { code: 'MS', name: 'Montserrat' },\n { code: 'MA', name: 'Morocco' },\n { code: 'MZ', name: 'Mozambique' },\n { code: 'MM', name: 'Myanmar' },\n { code: 'NA', name: 'Namibia' },\n { code: 'NR', name: 'Nauru' },\n { code: 'NP', name: 'Nepal' },\n { code: 'NL', name: 'Netherlands' },\n { code: 'NC', name: 'New Caledonia' },\n { code: 'NZ', name: 'New Zealand' },\n { code: 'NI', name: 'Nicaragua' },\n { code: 'NE', name: 'Niger' },\n { code: 'NG', name: 'Nigeria' },\n { code: 'NU', name: 'Niue' },\n { code: 'NF', name: 'Norfolk Island' },\n { code: 'MP', name: 'Northern Mariana Islands' },\n { code: 'NO', name: 'Norway' },\n { code: 'OM', name: 'Oman' },\n { code: 'PK', name: 'Pakistan' },\n { code: 'PW', name: 'Palau' },\n { code: 'PA', name: 'Panama' },\n { code: 'PG', name: 'Papua New Guinea' },\n { code: 'PY', name: 'Paraguay' },\n { code: 'PE', name: 'Peru' },\n { code: 'PH', name: 'Philippines' },\n { code: 'PN', name: 'Pitcairn' },\n { code: 'PL', name: 'Poland' },\n { code: 'PT', name: 'Portugal' },\n { code: 'PR', name: 'Puerto Rico' },\n { code: 'QA', name: 'Qatar' },\n { code: 'RE', name: 'Reunion' },\n { code: 'RO', name: 'Romania' },\n { code: 'RU', name: 'Russia' },\n { code: 'RW', name: 'Rwanda' },\n { code: 'BL', name: 'Saint Barthelemy' },\n { code: 'SH', name: 'Saint Helena' },\n { code: 'KN', name: 'Saint Kitts and Nevis' },\n { code: 'LC', name: 'Saint Lucia' },\n { code: 'MF', name: 'Saint Martin' },\n { code: 'PM', name: 'Saint Pierre and Miquelon' },\n { code: 'VC', name: 'Saint Vincent and the Grenadines' },\n { code: 'WS', name: 'Samoa' },\n { code: 'SM', name: 'San Marino' },\n { code: 'ST', name: 'Sao Tome and Principe' },\n { code: 'SA', name: 'Saudi Arabia' },\n { code: 'SN', name: 'Senegal' },\n { code: 'RS', name: 'Serbia' },\n { code: 'SC', name: 'Seychelles' },\n { code: 'SL', name: 'Sierra Leone' },\n { code: 'SG', name: 'Singapore' },\n { code: 'SX', name: 'Sint Maarten' },\n { code: 'SK', name: 'Slovakia' },\n { code: 'SI', name: 'Slovenia' },\n { code: 'SB', name: 'Solomon Islands' },\n { code: 'SO', name: 'Somalia' },\n { code: 'ZA', name: 'South Africa' },\n { code: 'GS', name: 'South Georgia and the South Sandwich Islands' },\n { code: 'SS', name: 'South Sudan' },\n { code: 'ES', name: 'Spain' },\n { code: 'LK', name: 'Sri Lanka' },\n { code: 'SD', name: 'Sudan' },\n { code: 'SR', name: 'Suriname' },\n { code: 'SJ', name: 'Svalbard and Jan Mayen' },\n { code: 'SZ', name: 'Swaziland' },\n { code: 'SE', name: 'Sweden' },\n { code: 'CH', name: 'Switzerland' },\n { code: 'SY', name: 'Syria' },\n { code: 'TW', name: 'Taiwan' },\n { code: 'TJ', name: 'Tajikistan' },\n { code: 'TZ', name: 'Tanzania' },\n { code: 'TH', name: 'Thailand' },\n { code: 'TL', name: 'Timor-Leste' },\n { code: 'TG', name: 'Togo' },\n { code: 'TK', name: 'Tokelau' },\n { code: 'TO', name: 'Tonga' },\n { code: 'TT', name: 'Trinidad and Tobago' },\n { code: 'TN', name: 'Tunisia' },\n { code: 'TR', name: 'Turkey' },\n { code: 'TM', name: 'Turkmenistan' },\n { code: 'TC', name: 'Turks and Caicos Islands' },\n { code: 'TV', name: 'Tuvalu' },\n { code: 'UG', name: 'Uganda' },\n { code: 'UA', name: 'Ukraine' },\n { code: 'AE', name: 'United Arab Emirates' },\n { code: 'GB', name: 'United Kingdom' },\n { code: 'US', name: 'United States' },\n { code: 'UM', name: 'United States Minor Outlying Islands' },\n { code: 'UY', name: 'Uruguay' },\n { code: 'UZ', name: 'Uzbekistan' },\n { code: 'VU', name: 'Vanuatu' },\n { code: 'VE', name: 'Venezuela' },\n { code: 'VN', name: 'Vietnam' },\n { code: 'VG', name: 'British Virgin Islands' },\n { code: 'VI', name: 'U.S. Virgin Islands' },\n { code: 'WF', name: 'Wallis and Futuna' },\n { code: 'EH', name: 'Western Sahara' },\n { code: 'YE', name: 'Yemen' },\n { code: 'ZM', name: 'Zambia' },\n { code: 'ZW', name: 'Zimbabwe' },\n] as const\n\nexport type CountryISOA2 = typeof COUNTRIES[number]['code']\nexport type CountryIsoMap = { code: CountryISOA2, name: string }\n","import type { FromSchema, JSONSchema } from 'json-schema-to-ts'\nimport {\n aiExploreAggregations,\n basicExploreAggregations,\n exploreAggregations,\n exploreFilterTypesV2,\n filterableAiExploreDimensions,\n filterableBasicExploreDimensions,\n filterableExploreDimensions,\n granularityValues,\n queryableAiExploreDimensions,\n queryableBasicExploreDimensions,\n queryableExploreDimensions,\n relativeTimeRangeValuesV4,\n requestFilterTypeEmptyV2,\n} from './types'\nimport { COUNTRIES } from './types/country-codes'\n\ntype FromSchemaWithOptions<T extends JSONSchema> = FromSchema<T, { keepDefaultedPropertiesOptional: true }>\n\n// TODO: Once we support all chart types, this could potentially be replaced with a direct reference to `chartTypes`.\n// This is partially overlapping with analytics chart types, but not strictly so.\nexport const dashboardTileTypes = [\n 'horizontal_bar',\n 'vertical_bar',\n 'gauge',\n 'donut',\n 'timeseries_line',\n 'timeseries_bar',\n 'golden_signals',\n 'top_n',\n 'slottable',\n 'single_value',\n 'choropleth_map',\n] as const\nexport type DashboardTileType = typeof dashboardTileTypes[number]\n\n// Common definition for many ChartJS tiles.\nconst syntheticsDataKey = {\n type: 'string',\n} as const\n\nconst chartTitle = {\n type: 'string',\n} as const\n\nconst allowCsvExport = {\n type: 'boolean',\n} as const\n\nconst chartDatasetColorsSchema = {\n type: ['object', 'array'],\n items: {\n type: 'string',\n },\n additionalProperties: {\n type: 'string',\n },\n} as const satisfies JSONSchema\n\nexport const slottableSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['slottable'],\n },\n id: {\n type: 'string',\n },\n },\n required: ['type', 'id'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type SlottableOptions = FromSchemaWithOptions<typeof slottableSchema>\n\nexport const barChartSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['horizontal_bar', 'vertical_bar'],\n },\n stacked: {\n type: 'boolean',\n },\n chart_dataset_colors: chartDatasetColorsSchema,\n synthetics_data_key: syntheticsDataKey,\n chart_title: chartTitle,\n allow_csv_export: allowCsvExport,\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type BarChartOptions = FromSchemaWithOptions<typeof barChartSchema>\n\nexport const thresholdSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['warning', 'error', 'neutral'],\n },\n value: {\n type: 'number',\n },\n label: {\n type: 'string',\n },\n highlightIntersections: {\n type: 'boolean',\n default: false,\n },\n },\n required: ['type', 'value'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport const timeseriesChartSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['timeseries_line', 'timeseries_bar'],\n },\n stacked: {\n type: 'boolean',\n },\n threshold: {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: thresholdSchema,\n },\n },\n chart_dataset_colors: chartDatasetColorsSchema,\n synthetics_data_key: syntheticsDataKey,\n chart_title: chartTitle,\n allow_csv_export: allowCsvExport,\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type TimeseriesChartOptions = FromSchemaWithOptions<typeof timeseriesChartSchema>\n\nexport const gaugeChartSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['gauge'],\n },\n metric_display: {\n type: 'string',\n enum: ['hidden', 'single', 'full'], // This matches the SimpleChartMetricDisplay type.\n },\n reverse_dataset: {\n type: 'boolean',\n },\n numerator: {\n type: 'number',\n },\n synthetics_data_key: syntheticsDataKey,\n chart_title: chartTitle,\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type GaugeChartOptions = FromSchemaWithOptions<typeof gaugeChartSchema>\n\nexport const donutChartSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['donut'],\n },\n synthetics_data_key: syntheticsDataKey,\n chart_title: chartTitle,\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type DonutChartOptions = FromSchemaWithOptions<typeof donutChartSchema>\n\nexport const topNTableSchema = {\n type: 'object',\n properties: {\n chart_title: chartTitle,\n synthetics_data_key: syntheticsDataKey,\n type: {\n type: 'string',\n enum: ['top_n'],\n },\n description: {\n type: 'string',\n },\n entity_link: {\n type: 'string',\n },\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type TopNTableOptions = FromSchemaWithOptions<typeof topNTableSchema>\n\nexport const metricCardSchema = {\n type: 'object',\n properties: {\n chart_title: chartTitle,\n type: {\n type: 'string',\n enum: ['golden_signals'],\n },\n long_card_titles: {\n type: 'boolean',\n },\n description: {\n type: 'string',\n },\n percentile_latency: {\n type: 'boolean',\n },\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type MetricCardOptions = FromSchemaWithOptions<typeof metricCardSchema>\n\nexport const singleValueSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['single_value'],\n },\n decimal_points: {\n type: 'number',\n },\n chart_title: chartTitle,\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type SingleValueOptions = FromSchemaWithOptions<typeof singleValueSchema>\n\nexport const choroplethMapSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['choropleth_map'],\n },\n chart_title: chartTitle,\n fit_to_country: {\n type: 'string',\n enum: COUNTRIES.map(c => c.code),\n },\n legend: {\n type: 'boolean',\n default: false,\n },\n bounds: {\n type: 'array',\n minItems: 2,\n maxItems: 2,\n items: {\n type: 'array',\n minItems: 2,\n maxItems: 2,\n items: [\n { type: 'number', minimum: -180, maximum: 180 },\n { type: 'number', minimum: -90, maximum: 90 },\n ],\n },\n },\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type ChoroplethMapOptions = FromSchemaWithOptions<typeof choroplethMapSchema>\n\nconst exploreV4RelativeTimeSchema = {\n type: 'object',\n properties: {\n tz: {\n type: 'string',\n default: 'Etc/UTC',\n },\n type: {\n type: 'string',\n enum: [\n 'relative',\n ],\n },\n time_range: {\n type: 'string',\n enum: relativeTimeRangeValuesV4,\n default: '1h',\n },\n },\n required: [\n 'type',\n 'time_range',\n ],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nconst exploreV4AbsoluteTimeSchema = {\n type: 'object',\n description: 'A duration representing an exact start and end time.',\n properties: {\n tz: {\n type: 'string',\n },\n type: {\n type: 'string',\n enum: [\n 'absolute',\n ],\n },\n start: {\n type: 'string',\n },\n end: {\n type: 'string',\n },\n },\n required: [\n 'type',\n 'start',\n 'end',\n ],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nconst baseQueryProperties = {\n granularity: {\n type: 'string',\n description: 'Force time grouping into buckets of this duration. Only has an effect if \"time\" is in the \"dimensions\" list.',\n enum: granularityValues,\n },\n time_range: {\n type: 'object',\n description: 'The time range to query.',\n anyOf: [\n exploreV4RelativeTimeSchema,\n exploreV4AbsoluteTimeSchema,\n ],\n default: {\n type: 'relative',\n time_range: '1h',\n },\n },\n limit: {\n type: 'number',\n },\n meta: {\n type: 'object',\n },\n} as const\n\nconst metricsFn = <T extends readonly string[]>(aggregations: T) => ({\n type: 'array',\n description: 'List of aggregated metrics to collect across the requested time span.',\n items: {\n type: 'string',\n enum: aggregations,\n },\n} as const satisfies JSONSchema)\n\nconst dimensionsFn = <T extends readonly string[]>(dimensions: T) => ({\n type: 'array',\n description: 'List of attributes or entity types to group by.',\n minItems: 0,\n maxItems: 2,\n items: {\n type: 'string',\n enum: dimensions,\n },\n} as const satisfies JSONSchema)\n\nconst filtersFn = <T extends readonly string[]>(filterableDimensions: T) => ({\n type: 'array',\n description: 'A list of filters to apply to the query',\n items: {\n oneOf: [\n {\n type: 'object',\n description: 'In filter',\n properties: {\n field: {\n type: 'string',\n enum: filterableDimensions,\n },\n operator: {\n type: 'string',\n enum: exploreFilterTypesV2,\n },\n value: {\n type: 'array',\n items: {\n type: ['string', 'number', 'null'],\n },\n },\n },\n required: [\n 'field',\n 'operator',\n 'value',\n ],\n additionalProperties: false,\n },\n {\n type: 'object',\n description: 'Empty filter',\n properties: {\n field: {\n type: 'string',\n enum: filterableDimensions,\n },\n operator: {\n type: 'string',\n enum: requestFilterTypeEmptyV2,\n },\n },\n required: [\n 'field',\n 'operator',\n ],\n additionalProperties: false,\n },\n ],\n },\n} as const satisfies JSONSchema)\n\nexport const apiUsageQuerySchema = {\n type: 'object',\n description: 'A query to launch at the advanced explore API',\n properties: {\n datasource: {\n type: 'string',\n enum: [\n 'api_usage',\n ],\n },\n metrics: metricsFn(exploreAggregations),\n dimensions: dimensionsFn(queryableExploreDimensions),\n filters: filtersFn(filterableExploreDimensions),\n ...baseQueryProperties,\n },\n required: ['datasource'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport const basicQuerySchema = {\n type: 'object',\n description: 'A query to launch at the basic explore API',\n properties: {\n datasource: {\n type: 'string',\n enum: [\n 'basic',\n ],\n },\n metrics: metricsFn(basicExploreAggregations),\n dimensions: dimensionsFn(queryableBasicExploreDimensions),\n filters: filtersFn(filterableBasicExploreDimensions),\n ...baseQueryProperties,\n },\n required: ['datasource'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport const llmUsageSchema = {\n type: 'object',\n description: 'A query to launch at the AI explore API',\n properties: {\n datasource: {\n type: 'string',\n enum: [\n 'llm_usage',\n ],\n },\n metrics: metricsFn(aiExploreAggregations),\n dimensions: dimensionsFn(queryableAiExploreDimensions),\n filters: filtersFn(filterableAiExploreDimensions),\n ...baseQueryProperties,\n },\n required: ['datasource'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport const validDashboardQuery = {\n anyOf: [apiUsageQuerySchema, basicQuerySchema, llmUsageSchema],\n} as const satisfies JSONSchema\n\nexport type ValidDashboardQuery = FromSchemaWithOptions<typeof validDashboardQuery>\n\n// Note: `datasource` may need to end up somewhere else for sane type definitions?\nexport const tileDefinitionSchema = {\n type: 'object',\n properties: {\n query: validDashboardQuery,\n chart: {\n anyOf: [\n barChartSchema,\n gaugeChartSchema,\n donutChartSchema,\n timeseriesChartSchema,\n metricCardSchema,\n topNTableSchema,\n slottableSchema,\n singleValueSchema,\n choroplethMapSchema,\n ],\n },\n },\n required: ['query', 'chart'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type TileDefinition = FromSchemaWithOptions<typeof tileDefinitionSchema>\n\nexport const tileLayoutSchema = {\n type: 'object',\n properties: {\n position: {\n type: 'object',\n properties: {\n col: {\n type: 'number',\n },\n row: {\n type: 'number',\n },\n },\n description: 'Position of the tile in the grid.',\n required: ['col', 'row'],\n additionalProperties: false,\n },\n size: {\n type: 'object',\n properties: {\n cols: {\n type: 'number',\n },\n rows: {\n type: 'number',\n },\n fit_to_content: {\n type: 'boolean',\n },\n },\n description: 'Number of columns and rows the tile occupies. If fitToContent is true for every tile in a row, ' +\n 'and each tile only occupies 1 row, then the row will auto-fit to its content.',\n required: ['cols', 'rows'],\n additionalProperties: false,\n },\n },\n required: ['position', 'size'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type TileLayout = FromSchemaWithOptions<typeof tileLayoutSchema>\n\nexport const tileConfigSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['chart'],\n },\n definition: tileDefinitionSchema,\n layout: tileLayoutSchema,\n id: {\n type: 'string',\n description: 'Unique identifier for the tile. If not provided, one will be generated.',\n },\n },\n required: ['type', 'definition', 'layout'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type TileConfig = FromSchemaWithOptions<typeof tileConfigSchema>\n\nexport const dashboardConfigSchema = {\n type: 'object',\n properties: {\n tiles: {\n type: 'array',\n items: tileConfigSchema,\n },\n tile_height: {\n type: 'number',\n description: 'Height of each tile in pixels.',\n },\n preset_filters: filtersFn([...new Set([...filterableExploreDimensions, ...filterableBasicExploreDimensions, ...filterableAiExploreDimensions])]),\n template_id: {\n type: ['string', 'null'],\n description: 'Template id which was used to instantiate this dashboard.',\n },\n },\n required: ['tiles'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type DashboardConfig = FromSchemaWithOptions<typeof dashboardConfigSchema>\n","import type { AllFilterableDimensionsAndMetrics, FilterDatasource } from './types'\nimport {\n filterableAiExploreDimensions,\n filterableBasicExploreDimensions,\n filterableExploreDimensions,\n filterableRequestDimensions,\n filterableRequestMetrics,\n} from './types'\n\n\nexport const getFieldDataSources = (\n dimension: AllFilterableDimensionsAndMetrics,\n): FilterDatasource[] => {\n const datasources: FilterDatasource[] = []\n\n if ((filterableBasicExploreDimensions as string[]).includes(dimension)) {\n datasources.push('basic')\n }\n if ((filterableExploreDimensions as string[]).includes(dimension)) {\n datasources.push('api_usage')\n }\n if ((filterableAiExploreDimensions as string[]).includes(dimension)) {\n datasources.push('llm_usage')\n }\n if ((filterableRequestDimensions as string[]).includes(dimension) || (filterableRequestMetrics as string[]).includes(dimension)) {\n datasources.push('requests')\n }\n\n return datasources\n}\n","const formatDistanceLocale = {\n lessThanXSeconds: {\n one: \"less than a second\",\n other: \"less than {{count}} seconds\",\n },\n\n xSeconds: {\n one: \"1 second\",\n other: \"{{count}} seconds\",\n },\n\n halfAMinute: \"half a minute\",\n\n lessThanXMinutes: {\n one: \"less than a minute\",\n other: \"less than {{count}} minutes\",\n },\n\n xMinutes: {\n one: \"1 minute\",\n other: \"{{count}} minutes\",\n },\n\n aboutXHours: {\n one: \"about 1 hour\",\n other: \"about {{count}} hours\",\n },\n\n xHours: {\n one: \"1 hour\",\n other: \"{{count}} hours\",\n },\n\n xDays: {\n one: \"1 day\",\n other: \"{{count}} days\",\n },\n\n aboutXWeeks: {\n one: \"about 1 week\",\n other: \"about {{count}} weeks\",\n },\n\n xWeeks: {\n one: \"1 week\",\n other: \"{{count}} weeks\",\n },\n\n aboutXMonths: {\n one: \"about 1 month\",\n other: \"about {{count}} months\",\n },\n\n xMonths: {\n one: \"1 month\",\n other: \"{{count}} months\",\n },\n\n aboutXYears: {\n one: \"about 1 year\",\n other: \"about {{count}} years\",\n },\n\n xYears: {\n one: \"1 year\",\n other: \"{{count}} years\",\n },\n\n overXYears: {\n one: \"over 1 year\",\n other: \"over {{count}} years\",\n },\n\n almostXYears: {\n one: \"almost 1 year\",\n other: \"almost {{count}} years\",\n },\n};\n\nexport const formatDistance = (token, count, options) => {\n let result;\n\n const tokenValue = formatDistanceLocale[token];\n if (typeof tokenValue === \"string\") {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace(\"{{count}}\", count.toString());\n }\n\n if (options?.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return \"in \" + result;\n } else {\n return result + \" ago\";\n }\n }\n\n return result;\n};\n","export function buildFormatLongFn(args) {\n return (options = {}) => {\n // TODO: Remove String()\n const width = options.width ? String(options.width) : args.defaultWidth;\n const format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}\n","import { buildFormatLongFn } from \"../../_lib/buildFormatLongFn.js\";\n\nconst dateFormats = {\n full: \"EEEE, MMMM do, y\",\n long: \"MMMM do, y\",\n medium: \"MMM d, y\",\n short: \"MM/dd/yyyy\",\n};\n\nconst timeFormats = {\n full: \"h:mm:ss a zzzz\",\n long: \"h:mm:ss a z\",\n medium: \"h:mm:ss a\",\n short: \"h:mm a\",\n};\n\nconst dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: \"{{date}}, {{time}}\",\n short: \"{{date}}, {{time}}\",\n};\n\nexport const formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: \"full\",\n }),\n\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: \"full\",\n }),\n\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: \"full\",\n }),\n};\n","const formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: \"P\",\n};\n\nexport const formatRelative = (token, _date, _baseDate, _options) =>\n formatRelativeLocale[token];\n","/**\n * The localize function argument callback which allows to convert raw value to\n * the actual type.\n *\n * @param value - The value to convert\n *\n * @returns The converted value\n */\n\n/**\n * The map of localized values for each width.\n */\n\n/**\n * The index type of the locale unit value. It types conversion of units of\n * values that don't start at 0 (i.e. quarters).\n */\n\n/**\n * Converts the unit value to the tuple of values.\n */\n\n/**\n * The tuple of localized era values. The first element represents BC,\n * the second element represents AD.\n */\n\n/**\n * The tuple of localized quarter values. The first element represents Q1.\n */\n\n/**\n * The tuple of localized day values. The first element represents Sunday.\n */\n\n/**\n * The tuple of localized month values. The first element represents January.\n */\n\nexport function buildLocalizeFn(args) {\n return (value, options) => {\n const context = options?.context ? String(options.context) : \"standalone\";\n\n let valuesArray;\n if (context === \"formatting\" && args.formattingValues) {\n const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;\n const width = options?.width ? String(options.width) : defaultWidth;\n\n valuesArray =\n args.formattingValues[width] || args.formattingValues[defaultWidth];\n } else {\n const defaultWidth = args.defaultWidth;\n const width = options?.width ? String(options.width) : args.defaultWidth;\n\n valuesArray = args.values[width] || args.values[defaultWidth];\n }\n const index = args.argumentCallback ? args.argumentCallback(value) : value;\n\n // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!\n return valuesArray[index];\n };\n}\n","import { buildLocalizeFn } from \"../../_lib/buildLocalizeFn.js\";\n\nconst eraValues = {\n narrow: [\"B\", \"A\"],\n abbreviated: [\"BC\", \"AD\"],\n wide: [\"Before Christ\", \"Anno Domini\"],\n};\n\nconst quarterValues = {\n narrow: [\"1\", \"2\", \"3\", \"4\"],\n abbreviated: [\"Q1\", \"Q2\", \"Q3\", \"Q4\"],\n wide: [\"1st quarter\", \"2nd quarter\", \"3rd quarter\", \"4th quarter\"],\n};\n\n// Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\nconst monthValues = {\n narrow: [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"],\n abbreviated: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n\n wide: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n ],\n};\n\nconst dayValues = {\n narrow: [\"S\", \"M\", \"T\", \"W\", \"T\", \"F\", \"S\"],\n short: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n abbreviated: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n wide: [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n ],\n};\n\nconst dayPeriodValues = {\n narrow: {\n am: \"a\",\n pm: \"p\",\n midnight: \"mi\",\n noon: \"n\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n abbreviated: {\n am: \"AM\",\n pm: \"PM\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n wide: {\n am: \"a.m.\",\n pm: \"p.m.\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n};\n\nconst formattingDayPeriodValues = {\n narrow: {\n am: \"a\",\n pm: \"p\",\n midnight: \"mi\",\n noon: \"n\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n abbreviated: {\n am: \"AM\",\n pm: \"PM\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n wide: {\n am: \"a.m.\",\n pm: \"p.m.\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n};\n\nconst ordinalNumber = (dirtyNumber, _options) => {\n const number = Number(dirtyNumber);\n\n // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`.\n //\n // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'.\n\n const rem100 = number % 100;\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + \"st\";\n case 2:\n return number + \"nd\";\n case 3:\n return number + \"rd\";\n }\n }\n return number + \"th\";\n};\n\nexport const localize = {\n ordinalNumber,\n\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: \"wide\",\n }),\n\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: \"wide\",\n argumentCallback: (quarter) => quarter - 1,\n }),\n\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: \"wide\",\n }),\n\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: \"wide\",\n }),\n\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: \"wide\",\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: \"wide\",\n }),\n};\n","export function buildMatchFn(args) {\n return (string, options = {}) => {\n const width = options.width;\n\n const matchPattern =\n (width && args.matchPatterns[width]) ||\n args.matchPatterns[args.defaultMatchWidth];\n const matchResult = string.match(matchPattern);\n\n if (!matchResult) {\n return null;\n }\n const matchedString = matchResult[0];\n\n const parsePatterns =\n (width && args.parsePatterns[width]) ||\n args.parsePatterns[args.defaultParseWidth];\n\n const key = Array.isArray(parsePatterns)\n ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))\n : // [TODO] -- I challenge you to fix the type\n findKey(parsePatterns, (pattern) => pattern.test(matchedString));\n\n let value;\n\n value = args.valueCallback ? args.valueCallback(key) : key;\n value = options.valueCallback\n ? // [TODO] -- I challenge you to fix the type\n options.valueCallback(value)\n : value;\n\n const rest = string.slice(matchedString.length);\n\n return { value, rest };\n };\n}\n\nfunction findKey(object, predicate) {\n for (const key in object) {\n if (\n Object.prototype.hasOwnProperty.call(object, key) &&\n predicate(object[key])\n ) {\n return key;\n }\n }\n return undefined;\n}\n\nfunction findIndex(array, predicate) {\n for (let key = 0; key < array.length; key++) {\n if (predicate(array[key])) {\n return key;\n }\n }\n return undefined;\n}\n","export function buildMatchPatternFn(args) {\n return (string, options = {}) => {\n const matchResult = string.match(args.matchPattern);\n if (!matchResult) return null;\n const matchedString = matchResult[0];\n\n const parseResult = string.match(args.parsePattern);\n if (!parseResult) return null;\n let value = args.valueCallback\n ? args.valueCallback(parseResult[0])\n : parseResult[0];\n\n // [TODO] I challenge you to fix the type\n value = options.valueCallback ? options.valueCallback(value) : value;\n\n const rest = string.slice(matchedString.length);\n\n return { value, rest };\n };\n}\n","import { buildMatchFn } from \"../../_lib/buildMatchFn.js\";\nimport { buildMatchPatternFn } from \"../../_lib/buildMatchPatternFn.js\";\n\nconst matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nconst parseOrdinalNumberPattern = /\\d+/i;\n\nconst matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i,\n};\nconst parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i],\n};\n\nconst matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i,\n};\nconst parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i],\n};\n\nconst matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,\n};\nconst parseMonthPatterns = {\n narrow: [\n /^j/i,\n /^f/i,\n /^m/i,\n /^a/i,\n /^m/i,\n /^j/i,\n /^j/i,\n /^a/i,\n /^s/i,\n /^o/i,\n /^n/i,\n /^d/i,\n ],\n\n any: [\n /^ja/i,\n /^f/i,\n /^mar/i,\n /^ap/i,\n /^may/i,\n /^jun/i,\n /^jul/i,\n /^au/i,\n /^s/i,\n /^o/i,\n /^n/i,\n /^d/i,\n ],\n};\n\nconst matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,\n};\nconst parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],\n};\n\nconst matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,\n};\nconst parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i,\n },\n};\n\nexport const match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: (value) => parseInt(value, 10),\n }),\n\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseEraPatterns,\n defaultParseWidth: \"any\",\n }),\n\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: \"any\",\n valueCallback: (index) => index + 1,\n }),\n\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: \"any\",\n }),\n\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseDayPatterns,\n defaultParseWidth: \"any\",\n }),\n\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: \"any\",\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: \"any\",\n }),\n};\n","import { formatDistance } from \"./en-US/_lib/formatDistance.js\";\nimport { formatLong } from \"./en-US/_lib/formatLong.js\";\nimport { formatRelative } from \"./en-US/_lib/formatRelative.js\";\nimport { localize } from \"./en-US/_lib/localize.js\";\nimport { match } from \"./en-US/_lib/match.js\";\n\n/**\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)\n * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)\n */\nexport const enUS = {\n code: \"en-US\",\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0 /* Sunday */,\n firstWeekContainsDate: 1,\n },\n};\n\n// Fallback for modularized imports:\nexport default enUS;\n","let defaultOptions = {};\n\nexport function getDefaultOptions() {\n return defaultOptions;\n}\n\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}\n","/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n","import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate<DateType extends Date>(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n","import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n","import { toDate } from \"../toDate.js\";\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const _date = toDate(date);\n const utcDate = new Date(\n Date.UTC(\n _date.getFullYear(),\n _date.getMonth(),\n _date.getDate(),\n _date.getHours(),\n _date.getMinutes(),\n _date.getSeconds(),\n _date.getMilliseconds(),\n ),\n );\n utcDate.setUTCFullYear(_date.getFullYear());\n return +date - +utcDate;\n}\n","import { constructFrom } from \"../constructFrom.js\";\n\nexport function normalizeDates(context, ...dates) {\n const normalize = constructFrom.bind(\n null,\n context || dates.find((date) => typeof date === \"object\"),\n );\n return dates.map(normalize);\n}\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfDay} function options.\n */\n\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a day\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport function startOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfDay;\n","import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInDay } from \"./constants.js\";\nimport { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link differenceInCalendarDays} function options.\n */\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - The options object\n *\n * @returns The number of calendar days\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport function differenceInCalendarDays(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfDay = startOfDay(laterDate_);\n const earlierStartOfDay = startOfDay(earlierDate_);\n\n const laterTimestamp =\n +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);\n const earlierTimestamp =\n +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);\n\n // Round the number of days to the nearest integer because the number of\n // milliseconds in a day is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarDays;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfYear} function options.\n */\n\n/**\n * @name startOfYear\n * @category Year Helpers\n * @summary Return the start of a year for the given date.\n *\n * @description\n * Return the start of a year for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a year\n *\n * @example\n * // The start of a year for 2 September 2014 11:55:00:\n * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Jan 01 2014 00:00:00\n */\nexport function startOfYear(date, options) {\n const date_ = toDate(date, options?.in);\n date_.setFullYear(date_.getFullYear(), 0, 1);\n date_.setHours(0, 0, 0, 0);\n return date_;\n}\n\n// Fallback for modularized imports:\nexport default startOfYear;\n","import { differenceInCalendarDays } from \"./differenceInCalendarDays.js\";\nimport { startOfYear } from \"./startOfYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getDayOfYear} function options.\n */\n\n/**\n * @name getDayOfYear\n * @category Day Helpers\n * @summary Get the day of the year of the given date.\n *\n * @description\n * Get the day of the year of the given date.\n *\n * @param date - The given date\n * @param options - The options\n *\n * @returns The day of year\n *\n * @example\n * // Which day of the year is 2 July 2014?\n * const result = getDayOfYear(new Date(2014, 6, 2))\n * //=> 183\n */\nexport function getDayOfYear(date, options) {\n const _date = toDate(date, options?.in);\n const diff = differenceInCalendarDays(_date, startOfYear(_date));\n const dayOfYear = diff + 1;\n return dayOfYear;\n}\n\n// Fallback for modularized imports:\nexport default getDayOfYear;\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfWeek} function options.\n */\n\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a week\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfWeek(date, options) {\n const defaultOptions = getDefaultOptions();\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const _date = toDate(date, options?.in);\n const day = _date.getDay();\n const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n\n _date.setDate(_date.getDate() - diff);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfWeek;\n","import { startOfWeek } from \"./startOfWeek.js\";\n\n/**\n * The {@link startOfISOWeek} function options.\n */\n\n/**\n * @name startOfISOWeek\n * @category ISO Week Helpers\n * @summary Return the start of an ISO week for the given date.\n *\n * @description\n * Return the start of an ISO week for the given date.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of an ISO week\n *\n * @example\n * // The start of an ISO week for 2 September 2014 11:55:00:\n * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfISOWeek(date, options) {\n return startOfWeek(date, { ...options, weekStartsOn: 1 });\n}\n\n// Fallback for modularized imports:\nexport default startOfISOWeek;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getISOWeekYear} function options.\n */\n\n/**\n * @name getISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Get the ISO week-numbering year of the given date.\n *\n * @description\n * Get the ISO week-numbering year of the given date,\n * which always starts 3 days before the year's first Thursday.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param date - The given date\n *\n * @returns The ISO week-numbering year\n *\n * @example\n * // Which ISO-week numbering year is 2 January 2005?\n * const result = getISOWeekYear(new Date(2005, 0, 2))\n * //=> 2004\n */\nexport function getISOWeekYear(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n\n const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);\n fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);\n const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);\n\n const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);\n fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);\n const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);\n\n if (_date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (_date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}\n\n// Fallback for modularized imports:\nexport default getISOWeekYear;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { getISOWeekYear } from \"./getISOWeekYear.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\n\n/**\n * The {@link startOfISOWeekYear} function options.\n */\n\n/**\n * @name startOfISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Return the start of an ISO week-numbering year for the given date.\n *\n * @description\n * Return the start of an ISO week-numbering year,\n * which always starts 3 days before the year's first Thursday.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of an ISO week-numbering year\n *\n * @example\n * // The start of an ISO week-numbering year for 2 July 2005:\n * const result = startOfISOWeekYear(new Date(2005, 6, 2))\n * //=> Mon Jan 03 2005 00:00:00\n */\nexport function startOfISOWeekYear(date, options) {\n const year = getISOWeekYear(date, options);\n const fourthOfJanuary = constructFrom(options?.in || date, 0);\n fourthOfJanuary.setFullYear(year, 0, 4);\n fourthOfJanuary.setHours(0, 0, 0, 0);\n return startOfISOWeek(fourthOfJanuary);\n}\n\n// Fallback for modularized imports:\nexport default startOfISOWeekYear;\n","import { millisecondsInWeek } from \"./constants.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\nimport { startOfISOWeekYear } from \"./startOfISOWeekYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getISOWeek} function options.\n */\n\n/**\n * @name getISOWeek\n * @category ISO Week Helpers\n * @summary Get the ISO week of the given date.\n *\n * @description\n * Get the ISO week of the given date.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param date - The given date\n * @param options - The options\n *\n * @returns The ISO week\n *\n * @example\n * // Which week of the ISO-week numbering year is 2 January 2005?\n * const result = getISOWeek(new Date(2005, 0, 2))\n * //=> 53\n */\nexport function getISOWeek(date, options) {\n const _date = toDate(date, options?.in);\n const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);\n\n // Round the number of weeks to the nearest integer because the number of\n // milliseconds in a week is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round(diff / millisecondsInWeek) + 1;\n}\n\n// Fallback for modularized imports:\nexport default getISOWeek;\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { constructFrom } from \"./constructFrom.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getWeekYear} function options.\n */\n\n/**\n * @name getWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Get the local week-numbering year of the given date.\n *\n * @description\n * Get the local week-numbering year of the given date.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @param date - The given date\n * @param options - An object with options.\n *\n * @returns The local week-numbering year\n *\n * @example\n * // Which week numbering year is 26 December 2004 with the default settings?\n * const result = getWeekYear(new Date(2004, 11, 26))\n * //=> 2005\n *\n * @example\n * // Which week numbering year is 26 December 2004 if week starts on Saturday?\n * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })\n * //=> 2004\n *\n * @example\n * // Which week numbering year is 26 December 2004 if the first week contains 4 January?\n * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })\n * //=> 2004\n */\nexport function getWeekYear(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n\n const defaultOptions = getDefaultOptions();\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const firstWeekOfNextYear = constructFrom(options?.in || date, 0);\n firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setHours(0, 0, 0, 0);\n const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);\n\n const firstWeekOfThisYear = constructFrom(options?.in || date, 0);\n firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setHours(0, 0, 0, 0);\n const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);\n\n if (+_date >= +startOfNextYear) {\n return year + 1;\n } else if (+_date >= +startOfThisYear) {\n return year;\n } else {\n return year - 1;\n }\n}\n\n// Fallback for modularized imports:\nexport default getWeekYear;\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { constructFrom } from \"./constructFrom.js\";\nimport { getWeekYear } from \"./getWeekYear.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\n\n/**\n * The {@link startOfWeekYear} function options.\n */\n\n/**\n * @name startOfWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Return the start of a local week-numbering year for the given date.\n *\n * @description\n * Return the start of a local week-numbering year.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a week-numbering year\n *\n * @example\n * // The start of an a week-numbering year for 2 July 2005 with default settings:\n * const result = startOfWeekYear(new Date(2005, 6, 2))\n * //=> Sun Dec 26 2004 00:00:00\n *\n * @example\n * // The start of a week-numbering year for 2 July 2005\n * // if Monday is the first day of week\n * // and 4 January is always in the first week of the year:\n * const result = startOfWeekYear(new Date(2005, 6, 2), {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> Mon Jan 03 2005 00:00:00\n */\nexport function startOfWeekYear(date, options) {\n const defaultOptions = getDefaultOptions();\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const year = getWeekYear(date, options);\n const firstWeek = constructFrom(options?.in || date, 0);\n firstWeek.setFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setHours(0, 0, 0, 0);\n const _date = startOfWeek(firstWeek, options);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfWeekYear;\n","import { millisecondsInWeek } from \"./constants.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\nimport { startOfWeekYear } from \"./startOfWeekYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getWeek} function options.\n */\n\n/**\n * @name getWeek\n * @category Week Helpers\n * @summary Get the local week index of the given date.\n *\n * @description\n * Get the local week index of the given date.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The week\n *\n * @example\n * // Which week of the local week numbering year is 2 January 2005 with default options?\n * const result = getWeek(new Date(2005, 0, 2))\n * //=> 2\n *\n * @example\n * // Which week of the local week numbering year is 2 January 2005,\n * // if Monday is the first day of the week,\n * // and the first week of the year always contains 4 January?\n * const result = getWeek(new Date(2005, 0, 2), {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> 53\n */\nexport function getWeek(date, options) {\n const _date = toDate(date, options?.in);\n const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);\n\n // Round the number of weeks to the nearest integer because the number of\n // milliseconds in a week is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round(diff / millisecondsInWeek) + 1;\n}\n\n// Fallback for modularized imports:\nexport default getWeek;\n","export function addLeadingZeros(number, targetLength) {\n const sign = number < 0 ? \"-\" : \"\";\n const output = Math.abs(number).toString().padStart(targetLength, \"0\");\n return sign + output;\n}\n","import { addLeadingZeros } from \"../addLeadingZeros.js\";\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | |\n * | d | Day of month | D | |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | m | Minute | M | Month |\n * | s | Second | S | Fraction of second |\n * | y | Year (abs) | Y | |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n */\n\nexport const lightFormatters = {\n // Year\n y(date, token) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n\n const signedYear = date.getFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const year = signedYear > 0 ? signedYear : 1 - signedYear;\n return addLeadingZeros(token === \"yy\" ? year % 100 : year, token.length);\n },\n\n // Month\n M(date, token) {\n const month = date.getMonth();\n return token === \"M\" ? String(month + 1) : addLeadingZeros(month + 1, 2);\n },\n\n // Day of the month\n d(date, token) {\n return addLeadingZeros(date.getDate(), token.length);\n },\n\n // AM or PM\n a(date, token) {\n const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? \"pm\" : \"am\";\n\n switch (token) {\n case \"a\":\n case \"aa\":\n return dayPeriodEnumValue.toUpperCase();\n case \"aaa\":\n return dayPeriodEnumValue;\n case \"aaaaa\":\n return dayPeriodEnumValue[0];\n case \"aaaa\":\n default:\n return dayPeriodEnumValue === \"am\" ? \"a.m.\" : \"p.m.\";\n }\n },\n\n // Hour [1-12]\n h(date, token) {\n return addLeadingZeros(date.getHours() % 12 || 12, token.length);\n },\n\n // Hour [0-23]\n H(date, token) {\n return addLeadingZeros(date.getHours(), token.length);\n },\n\n // Minute\n m(date, token) {\n return addLeadingZeros(date.getMinutes(), token.length);\n },\n\n // Second\n s(date, token) {\n return addLeadingZeros(date.getSeconds(), token.length);\n },\n\n // Fraction of second\n S(date, token) {\n const numberOfDigits = token.length;\n const milliseconds = date.getMilliseconds();\n const fractionalSeconds = Math.trunc(\n milliseconds * Math.pow(10, numberOfDigits - 3),\n );\n return addLeadingZeros(fractionalSeconds, token.length);\n },\n};\n","import { getDayOfYear } from \"../../getDayOfYear.js\";\nimport { getISOWeek } from \"../../getISOWeek.js\";\nimport { getISOWeekYear } from \"../../getISOWeekYear.js\";\nimport { getWeek } from \"../../getWeek.js\";\nimport { getWeekYear } from \"../../getWeekYear.js\";\n\nimport { addLeadingZeros } from \"../addLeadingZeros.js\";\nimport { lightFormatters } from \"./lightFormatters.js\";\n\nconst dayPeriodEnum = {\n am: \"am\",\n pm: \"pm\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n};\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\n\nexport const formatters = {\n // Era\n G: function (date, token, localize) {\n const era = date.getFullYear() > 0 ? 1 : 0;\n switch (token) {\n // AD, BC\n case \"G\":\n case \"GG\":\n case \"GGG\":\n return localize.era(era, { width: \"abbreviated\" });\n // A, B\n case \"GGGGG\":\n return localize.era(era, { width: \"narrow\" });\n // Anno Domini, Before Christ\n case \"GGGG\":\n default:\n return localize.era(era, { width: \"wide\" });\n }\n },\n\n // Year\n y: function (date, token, localize) {\n // Ordinal number\n if (token === \"yo\") {\n const signedYear = date.getFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const year = signedYear > 0 ? signedYear : 1 - signedYear;\n return localize.ordinalNumber(year, { unit: \"year\" });\n }\n\n return lightFormatters.y(date, token);\n },\n\n // Local week-numbering year\n Y: function (date, token, localize, options) {\n const signedWeekYear = getWeekYear(date, options);\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;\n\n // Two digit year\n if (token === \"YY\") {\n const twoDigitYear = weekYear % 100;\n return addLeadingZeros(twoDigitYear, 2);\n }\n\n // Ordinal number\n if (token === \"Yo\") {\n return localize.ordinalNumber(weekYear, { unit: \"year\" });\n }\n\n // Padding\n return addLeadingZeros(weekYear, token.length);\n },\n\n // ISO week-numbering year\n R: function (date, token) {\n const isoWeekYear = getISOWeekYear(date);\n\n // Padding\n return addLeadingZeros(isoWeekYear, token.length);\n },\n\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function (date, token) {\n const year = date.getFullYear();\n return addLeadingZeros(year, token.length);\n },\n\n // Quarter\n Q: function (date, token, localize) {\n const quarter = Math.ceil((date.getMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case \"Q\":\n return String(quarter);\n // 01, 02, 03, 04\n case \"QQ\":\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case \"Qo\":\n return localize.ordinalNumber(quarter, { unit: \"quarter\" });\n // Q1, Q2, Q3, Q4\n case \"QQQ\":\n return localize.quarter(quarter, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case \"QQQQQ\":\n return localize.quarter(quarter, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // 1st quarter, 2nd quarter, ...\n case \"QQQQ\":\n default:\n return localize.quarter(quarter, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Stand-alone quarter\n q: function (date, token, localize) {\n const quarter = Math.ceil((date.getMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case \"q\":\n return String(quarter);\n // 01, 02, 03, 04\n case \"qq\":\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case \"qo\":\n return localize.ordinalNumber(quarter, { unit: \"quarter\" });\n // Q1, Q2, Q3, Q4\n case \"qqq\":\n return localize.quarter(quarter, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case \"qqqqq\":\n return localize.quarter(quarter, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // 1st quarter, 2nd quarter, ...\n case \"qqqq\":\n default:\n return localize.quarter(quarter, {\n width: \"wide\",\n context: \"standalone\",\n });\n }\n },\n\n // Month\n M: function (date, token, localize) {\n const month = date.getMonth();\n switch (token) {\n case \"M\":\n case \"MM\":\n return lightFormatters.M(date, token);\n // 1st, 2nd, ..., 12th\n case \"Mo\":\n return localize.ordinalNumber(month + 1, { unit: \"month\" });\n // Jan, Feb, ..., Dec\n case \"MMM\":\n return localize.month(month, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // J, F, ..., D\n case \"MMMMM\":\n return localize.month(month, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // January, February, ..., December\n case \"MMMM\":\n default:\n return localize.month(month, { width: \"wide\", context: \"formatting\" });\n }\n },\n\n // Stand-alone month\n L: function (date, token, localize) {\n const month = date.getMonth();\n switch (token) {\n // 1, 2, ..., 12\n case \"L\":\n return String(month + 1);\n // 01, 02, ..., 12\n case \"LL\":\n return addLeadingZeros(month + 1, 2);\n // 1st, 2nd, ..., 12th\n case \"Lo\":\n return localize.ordinalNumber(month + 1, { unit: \"month\" });\n // Jan, Feb, ..., Dec\n case \"LLL\":\n return localize.month(month, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // J, F, ..., D\n case \"LLLLL\":\n return localize.month(month, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // January, February, ..., December\n case \"LLLL\":\n default:\n return localize.month(month, { width: \"wide\", context: \"standalone\" });\n }\n },\n\n // Local week of year\n w: function (date, token, localize, options) {\n const week = getWeek(date, options);\n\n if (token === \"wo\") {\n return localize.ordinalNumber(week, { unit: \"week\" });\n }\n\n return addLeadingZeros(week, token.length);\n },\n\n // ISO week of year\n I: function (date, token, localize) {\n const isoWeek = getISOWeek(date);\n\n if (token === \"Io\") {\n return localize.ordinalNumber(isoWeek, { unit: \"week\" });\n }\n\n return addLeadingZeros(isoWeek, token.length);\n },\n\n // Day of the month\n d: function (date, token, localize) {\n if (token === \"do\") {\n return localize.ordinalNumber(date.getDate(), { unit: \"date\" });\n }\n\n return lightFormatters.d(date, token);\n },\n\n // Day of year\n D: function (date, token, localize) {\n const dayOfYear = getDayOfYear(date);\n\n if (token === \"Do\") {\n return localize.ordinalNumber(dayOfYear, { unit: \"dayOfYear\" });\n }\n\n return addLeadingZeros(dayOfYear, token.length);\n },\n\n // Day of week\n E: function (date, token, localize) {\n const dayOfWeek = date.getDay();\n switch (token) {\n // Tue\n case \"E\":\n case \"EE\":\n case \"EEE\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"EEEEE\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"EEEEEE\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"EEEE\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Local day of week\n e: function (date, token, localize, options) {\n const dayOfWeek = date.getDay();\n const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case \"e\":\n return String(localDayOfWeek);\n // Padded numerical value\n case \"ee\":\n return addLeadingZeros(localDayOfWeek, 2);\n // 1st, 2nd, ..., 7th\n case \"eo\":\n return localize.ordinalNumber(localDayOfWeek, { unit: \"day\" });\n case \"eee\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"eeeee\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"eeeeee\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"eeee\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Stand-alone local day of week\n c: function (date, token, localize, options) {\n const dayOfWeek = date.getDay();\n const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (same as in `e`)\n case \"c\":\n return String(localDayOfWeek);\n // Padded numerical value\n case \"cc\":\n return addLeadingZeros(localDayOfWeek, token.length);\n // 1st, 2nd, ..., 7th\n case \"co\":\n return localize.ordinalNumber(localDayOfWeek, { unit: \"day\" });\n case \"ccc\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // T\n case \"ccccc\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // Tu\n case \"cccccc\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"standalone\",\n });\n // Tuesday\n case \"cccc\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"standalone\",\n });\n }\n },\n\n // ISO day of week\n i: function (date, token, localize) {\n const dayOfWeek = date.getDay();\n const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n switch (token) {\n // 2\n case \"i\":\n return String(isoDayOfWeek);\n // 02\n case \"ii\":\n return addLeadingZeros(isoDayOfWeek, token.length);\n // 2nd\n case \"io\":\n return localize.ordinalNumber(isoDayOfWeek, { unit: \"day\" });\n // Tue\n case \"iii\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"iiiii\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"iiiiii\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"iiii\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // AM or PM\n a: function (date, token, localize) {\n const hours = date.getHours();\n const dayPeriodEnumValue = hours / 12 >= 1 ? \"pm\" : \"am\";\n\n switch (token) {\n case \"a\":\n case \"aa\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"aaa\":\n return localize\n .dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n })\n .toLowerCase();\n case \"aaaaa\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"aaaa\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // AM, PM, midnight, noon\n b: function (date, token, localize) {\n const hours = date.getHours();\n let dayPeriodEnumValue;\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? \"pm\" : \"am\";\n }\n\n switch (token) {\n case \"b\":\n case \"bb\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"bbb\":\n return localize\n .dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n })\n .toLowerCase();\n case \"bbbbb\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"bbbb\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // in the morning, in the afternoon, in the evening, at night\n B: function (date, token, localize) {\n const hours = date.getHours();\n let dayPeriodEnumValue;\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n\n switch (token) {\n case \"B\":\n case \"BB\":\n case \"BBB\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"BBBBB\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"BBBB\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Hour [1-12]\n h: function (date, token, localize) {\n if (token === \"ho\") {\n let hours = date.getHours() % 12;\n if (hours === 0) hours = 12;\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return lightFormatters.h(date, token);\n },\n\n // Hour [0-23]\n H: function (date, token, localize) {\n if (token === \"Ho\") {\n return localize.ordinalNumber(date.getHours(), { unit: \"hour\" });\n }\n\n return lightFormatters.H(date, token);\n },\n\n // Hour [0-11]\n K: function (date, token, localize) {\n const hours = date.getHours() % 12;\n\n if (token === \"Ko\") {\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n\n // Hour [1-24]\n k: function (date, token, localize) {\n let hours = date.getHours();\n if (hours === 0) hours = 24;\n\n if (token === \"ko\") {\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n\n // Minute\n m: function (date, token, localize) {\n if (token === \"mo\") {\n return localize.ordinalNumber(date.getMinutes(), { unit: \"minute\" });\n }\n\n return lightFormatters.m(date, token);\n },\n\n // Second\n s: function (date, token, localize) {\n if (token === \"so\") {\n return localize.ordinalNumber(date.getSeconds(), { unit: \"second\" });\n }\n\n return lightFormatters.s(date, token);\n },\n\n // Fraction of second\n S: function (date, token) {\n return lightFormatters.S(date, token);\n },\n\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n if (timezoneOffset === 0) {\n return \"Z\";\n }\n\n switch (token) {\n // Hours and optional minutes\n case \"X\":\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n case \"XXXX\":\n case \"XX\": // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n case \"XXXXX\":\n case \"XXX\": // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Hours and optional minutes\n case \"x\":\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n case \"xxxx\":\n case \"xx\": // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n case \"xxxxx\":\n case \"xxx\": // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (GMT)\n O: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Short\n case \"O\":\n case \"OO\":\n case \"OOO\":\n return \"GMT\" + formatTimezoneShort(timezoneOffset, \":\");\n // Long\n case \"OOOO\":\n default:\n return \"GMT\" + formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (specific non-location)\n z: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Short\n case \"z\":\n case \"zz\":\n case \"zzz\":\n return \"GMT\" + formatTimezoneShort(timezoneOffset, \":\");\n // Long\n case \"zzzz\":\n default:\n return \"GMT\" + formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Seconds timestamp\n t: function (date, token, _localize) {\n const timestamp = Math.trunc(+date / 1000);\n return addLeadingZeros(timestamp, token.length);\n },\n\n // Milliseconds timestamp\n T: function (date, token, _localize) {\n return addLeadingZeros(+date, token.length);\n },\n};\n\nfunction formatTimezoneShort(offset, delimiter = \"\") {\n const sign = offset > 0 ? \"-\" : \"+\";\n const absOffset = Math.abs(offset);\n const hours = Math.trunc(absOffset / 60);\n const minutes = absOffset % 60;\n if (minutes === 0) {\n return sign + String(hours);\n }\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);\n}\n\nfunction formatTimezoneWithOptionalMinutes(offset, delimiter) {\n if (offset % 60 === 0) {\n const sign = offset > 0 ? \"-\" : \"+\";\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n return formatTimezone(offset, delimiter);\n}\n\nfunction formatTimezone(offset, delimiter = \"\") {\n const sign = offset > 0 ? \"-\" : \"+\";\n const absOffset = Math.abs(offset);\n const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);\n const minutes = addLeadingZeros(absOffset % 60, 2);\n return sign + hours + delimiter + minutes;\n}\n","const dateLongFormatter = (pattern, formatLong) => {\n switch (pattern) {\n case \"P\":\n return formatLong.date({ width: \"short\" });\n case \"PP\":\n return formatLong.date({ width: \"medium\" });\n case \"PPP\":\n return formatLong.date({ width: \"long\" });\n case \"PPPP\":\n default:\n return formatLong.date({ width: \"full\" });\n }\n};\n\nconst timeLongFormatter = (pattern, formatLong) => {\n switch (pattern) {\n case \"p\":\n return formatLong.time({ width: \"short\" });\n case \"pp\":\n return formatLong.time({ width: \"medium\" });\n case \"ppp\":\n return formatLong.time({ width: \"long\" });\n case \"pppp\":\n default:\n return formatLong.time({ width: \"full\" });\n }\n};\n\nconst dateTimeLongFormatter = (pattern, formatLong) => {\n const matchResult = pattern.match(/(P+)(p+)?/) || [];\n const datePattern = matchResult[1];\n const timePattern = matchResult[2];\n\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong);\n }\n\n let dateTimeFormat;\n\n switch (datePattern) {\n case \"P\":\n dateTimeFormat = formatLong.dateTime({ width: \"short\" });\n break;\n case \"PP\":\n dateTimeFormat = formatLong.dateTime({ width: \"medium\" });\n break;\n case \"PPP\":\n dateTimeFormat = formatLong.dateTime({ width: \"long\" });\n break;\n case \"PPPP\":\n default:\n dateTimeFormat = formatLong.dateTime({ width: \"full\" });\n break;\n }\n\n return dateTimeFormat\n .replace(\"{{date}}\", dateLongFormatter(datePattern, formatLong))\n .replace(\"{{time}}\", timeLongFormatter(timePattern, formatLong));\n};\n\nexport const longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter,\n};\n","const dayOfYearTokenRE = /^D+$/;\nconst weekYearTokenRE = /^Y+$/;\n\nconst throwTokens = [\"D\", \"DD\", \"YY\", \"YYYY\"];\n\nexport function isProtectedDayOfYearToken(token) {\n return dayOfYearTokenRE.test(token);\n}\n\nexport function isProtectedWeekYearToken(token) {\n return weekYearTokenRE.test(token);\n}\n\nexport function warnOrThrowProtectedError(token, format, input) {\n const _message = message(token, format, input);\n console.warn(_message);\n if (throwTokens.includes(token)) throw new RangeError(_message);\n}\n\nfunction message(token, format, input) {\n const subject = token[0] === \"Y\" ? \"years\" : \"days of the month\";\n return `Use \\`${token.toLowerCase()}\\` instead of \\`${token}\\` (in \\`${format}\\`) for formatting ${subject} to the input \\`${input}\\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;\n}\n","/**\n * @name isDate\n * @category Common Helpers\n * @summary Is the given value a date?\n *\n * @description\n * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.\n *\n * @param value - The value to check\n *\n * @returns True if the given value is a date\n *\n * @example\n * // For a valid date:\n * const result = isDate(new Date())\n * //=> true\n *\n * @example\n * // For an invalid date:\n * const result = isDate(new Date(NaN))\n * //=> true\n *\n * @example\n * // For some value:\n * const result = isDate('2014-02-31')\n * //=> false\n *\n * @example\n * // For an object:\n * const result = isDate({})\n * //=> false\n */\nexport function isDate(value) {\n return (\n value instanceof Date ||\n (typeof value === \"object\" &&\n Object.prototype.toString.call(value) === \"[object Date]\")\n );\n}\n\n// Fallback for modularized imports:\nexport default isDate;\n","import { isDate } from \"./isDate.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param date - The date to check\n *\n * @returns The date is valid\n *\n * @example\n * // For the valid date:\n * const result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertible into a date:\n * const result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * const result = isValid(new Date(''))\n * //=> false\n */\nexport function isValid(date) {\n return !((!isDate(date) && typeof date !== \"number\") || isNaN(+toDate(date)));\n}\n\n// Fallback for modularized imports:\nexport default isValid;\n","import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { formatters } from \"./_lib/format/formatters.js\";\nimport { longFormatters } from \"./_lib/format/longFormatters.js\";\nimport {\n isProtectedDayOfYearToken,\n isProtectedWeekYearToken,\n warnOrThrowProtectedError,\n} from \"./_lib/protectedTokens.js\";\nimport { isValid } from \"./isValid.js\";\nimport { toDate } from \"./toDate.js\";\n\n// Rexports of internal for libraries to use.\n// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874\nexport { formatters, longFormatters };\n\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nconst formattingTokensRegExp =\n /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nconst longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\n\nconst escapedStringRegExp = /^'([^]*?)'?$/;\nconst doubleQuoteRegExp = /''/g;\nconst unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n\nexport { format as formatDate };\n\n/**\n * The {@link format} function options.\n */\n\n/**\n * @name format\n * @alias formatDate\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)\n * and [getWeekYear](https://date-fns.org/docs/getWeekYear)).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param date - The original date\n * @param format - The string of tokens\n * @param options - An object with options\n *\n * @returns The formatted date string\n *\n * @throws `date` must not be Invalid Date\n * @throws `options.locale` must contain `localize` property\n * @throws `options.locale` must contain `formatLong` property\n * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\nexport function format(date, formatStr, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const originalDate = toDate(date, options?.in);\n\n if (!isValid(originalDate)) {\n throw new RangeError(\"Invalid time value\");\n }\n\n let parts = formatStr\n .match(longFormattingTokensRegExp)\n .map((substring) => {\n const firstCharacter = substring[0];\n if (firstCharacter === \"p\" || firstCharacter === \"P\") {\n const longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n return substring;\n })\n .join(\"\")\n .match(formattingTokensRegExp)\n .map((substring) => {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return { isToken: false, value: \"'\" };\n }\n\n const firstCharacter = substring[0];\n if (firstCharacter === \"'\") {\n return { isToken: false, value: cleanEscapedString(substring) };\n }\n\n if (formatters[firstCharacter]) {\n return { isToken: true, value: substring };\n }\n\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError(\n \"Format string contains an unescaped latin alphabet character `\" +\n firstCharacter +\n \"`\",\n );\n }\n\n return { isToken: false, value: substring };\n });\n\n // invoke localize preprocessor (only for french locales at the moment)\n if (locale.localize.preprocessor) {\n parts = locale.localize.preprocessor(originalDate, parts);\n }\n\n const formatterOptions = {\n firstWeekContainsDate,\n weekStartsOn,\n locale,\n };\n\n return parts\n .map((part) => {\n if (!part.isToken) return part.value;\n\n const token = part.value;\n\n if (\n (!options?.useAdditionalWeekYearTokens &&\n isProtectedWeekYearToken(token)) ||\n (!options?.useAdditionalDayOfYearTokens &&\n isProtectedDayOfYearToken(token))\n ) {\n warnOrThrowProtectedError(token, formatStr, String(date));\n }\n\n const formatter = formatters[token[0]];\n return formatter(originalDate, token, locale.localize, formatterOptions);\n })\n .join(\"\");\n}\n\nfunction cleanEscapedString(input) {\n const matched = input.match(escapedStringRegExp);\n\n if (!matched) {\n return input;\n }\n\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}\n\n// Fallback for modularized imports:\nexport default format;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addDays} function options.\n */\n\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of days to be added.\n * @param options - An object with options\n *\n * @returns The new date with the days added\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport function addDays(date, amount, options) {\n const _date = toDate(date, options?.in);\n if (isNaN(amount)) return constructFrom(options?.in || date, NaN);\n\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n if (!amount) return _date;\n\n _date.setDate(_date.getDate() + amount);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default addDays;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addMonths} function options.\n */\n\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be added.\n * @param options - The options object\n *\n * @returns The new date with the months added\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * const result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n *\n * // Add one month to 30 January 2023:\n * const result = addMonths(new Date(2023, 0, 30), 1)\n * //=> Tue Feb 28 2023 00:00:00\n */\nexport function addMonths(date, amount, options) {\n const _date = toDate(date, options?.in);\n if (isNaN(amount)) return constructFrom(options?.in || date, NaN);\n if (!amount) {\n // If 0 months, no-op to avoid changing times in the hour before end of DST\n return _date;\n }\n const dayOfMonth = _date.getDate();\n\n // The JS Date object supports date math by accepting out-of-bounds values for\n // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and\n // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we\n // want except that dates will wrap around the end of a month, meaning that\n // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So\n // we'll default to the end of the desired month by adding 1 to the desired\n // month and using a date of 0 to back up one day to the end of the desired\n // month.\n const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());\n endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);\n const daysInMonth = endOfDesiredMonth.getDate();\n if (dayOfMonth >= daysInMonth) {\n // If we're already at the end of the month, then this is the correct date\n // and we're done.\n return endOfDesiredMonth;\n } else {\n // Otherwise, we now know that setting the original day-of-month value won't\n // cause an overflow, so set the desired day-of-month. Note that we can't\n // just set the date of `endOfDesiredMonth` because that object may have had\n // its time changed in the unusual case where where a DST transition was on\n // the last day of the month and its local time was in the hour skipped or\n // repeated next to a DST transition. So we use `date` instead which is\n // guaranteed to still have the original time.\n _date.setFullYear(\n endOfDesiredMonth.getFullYear(),\n endOfDesiredMonth.getMonth(),\n dayOfMonth,\n );\n return _date;\n }\n}\n\n// Fallback for modularized imports:\nexport default addMonths;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfMonth} function options.\n */\n\n/**\n * @name startOfMonth\n * @category Month Helpers\n * @summary Return the start of a month for the given date.\n *\n * @description\n * Return the start of a month for the given date. The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments.\n * Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed,\n * or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a month\n *\n * @example\n * // The start of a month for 2 September 2014 11:55:00:\n * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfMonth(date, options) {\n const _date = toDate(date, options?.in);\n _date.setDate(1);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfMonth;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getDaysInMonth} function options.\n */\n\n/**\n * @name getDaysInMonth\n * @category Month Helpers\n * @summary Get the number of days in a month of the given date.\n *\n * @description\n * Get the number of days in a month of the given date, considering the context if provided.\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The number of days in a month\n *\n * @example\n * // How many days are in February 2000?\n * const result = getDaysInMonth(new Date(2000, 1))\n * //=> 29\n */\nexport function getDaysInMonth(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n const monthIndex = _date.getMonth();\n const lastDayOfMonth = constructFrom(_date, 0);\n lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);\n lastDayOfMonth.setHours(0, 0, 0, 0);\n return lastDayOfMonth.getDate();\n}\n\n// Fallback for modularized imports:\nexport default getDaysInMonth;\n","import { getDefaultOptions as getInternalDefaultOptions } from \"./_lib/defaultOptions.js\";\n\n/**\n * @name getDefaultOptions\n * @category Common Helpers\n * @summary Get default options.\n * @pure false\n *\n * @description\n * Returns an object that contains defaults for\n * `options.locale`, `options.weekStartsOn` and `options.firstWeekContainsDate`\n * arguments for all functions.\n *\n * You can change these with [setDefaultOptions](https://date-fns.org/docs/setDefaultOptions).\n *\n * @returns The default options\n *\n * @example\n * const result = getDefaultOptions()\n * //=> {}\n *\n * @example\n * setDefaultOptions({ weekStarsOn: 1, firstWeekContainsDate: 4 })\n * const result = getDefaultOptions()\n * //=> { weekStarsOn: 1, firstWeekContainsDate: 4 }\n */\nexport function getDefaultOptions() {\n return Object.assign({}, getInternalDefaultOptions());\n}\n\n// Fallback for modularized imports:\nexport default getDefaultOptions;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * @name getTime\n * @category Timestamp Helpers\n * @summary Get the milliseconds timestamp of the given date.\n *\n * @description\n * Get the milliseconds timestamp of the given date.\n *\n * @param date - The given date\n *\n * @returns The timestamp\n *\n * @example\n * // Get the timestamp of 29 February 2012 11:45:05.123:\n * const result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123))\n * //=> 1330515905123\n */\nexport function getTime(date) {\n return +toDate(date);\n}\n\n// Fallback for modularized imports:\nexport default getTime;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * @name getUnixTime\n * @category Timestamp Helpers\n * @summary Get the seconds timestamp of the given date.\n *\n * @description\n * Get the seconds timestamp of the given date.\n *\n * @param date - The given date\n *\n * @returns The timestamp\n *\n * @example\n * // Get the timestamp of 29 February 2012 11:45:05 CET:\n * const result = getUnixTime(new Date(2012, 1, 29, 11, 45, 5))\n * //=> 1330512305\n */\nexport function getUnixTime(date) {\n return Math.trunc(+toDate(date) / 1000);\n}\n\n// Fallback for modularized imports:\nexport default getUnixTime;\n","import { secondsInHour } from \"./constants.js\";\n\n/**\n * @name hoursToSeconds\n * @category Conversion Helpers\n * @summary Convert hours to seconds.\n *\n * @description\n * Convert a number of hours to a full number of seconds.\n *\n * @param hours - The number of hours to be converted\n *\n * @returns The number of hours converted in seconds\n *\n * @example\n * // Convert 2 hours to seconds:\n * const result = hoursToSeconds(2)\n * //=> 7200\n */\nexport function hoursToSeconds(hours) {\n return Math.trunc(hours * secondsInHour);\n}\n\n// Fallback for modularized imports:\nexport default hoursToSeconds;\n","import { minutesInHour } from \"./constants.js\";\n\n/**\n * @name minutesToHours\n * @category Conversion Helpers\n * @summary Convert minutes to hours.\n *\n * @description\n * Convert a number of minutes to a full number of hours.\n *\n * @param minutes - The number of minutes to be converted\n *\n * @returns The number of minutes converted in hours\n *\n * @example\n * // Convert 140 minutes to hours:\n * const result = minutesToHours(120)\n * //=> 2\n *\n * @example\n * // It uses floor rounding:\n * const result = minutesToHours(179)\n * //=> 2\n */\nexport function minutesToHours(minutes) {\n const hours = minutes / minutesInHour;\n return Math.trunc(hours);\n}\n\n// Fallback for modularized imports:\nexport default minutesToHours;\n","import { addMonths } from \"./addMonths.js\";\n\n/**\n * The subMonths function options.\n */\n\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the months subtracted\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * const result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function subMonths(date, amount, options) {\n return addMonths(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subMonths;\n","import { getDefaultOptions } from 'date-fns';\n/**\n * Returns the formatted time zone name of the provided `timeZone` or the current\n * system time zone if omitted, accounting for DST according to the UTC value of\n * the date.\n */\nexport function tzIntlTimeZoneName(length, date, options) {\n const defaultOptions = getDefaultOptions();\n const dtf = getDTF(length, options.timeZone, options.locale ?? defaultOptions.locale);\n return 'formatToParts' in dtf ? partsTimeZone(dtf, date) : hackyTimeZone(dtf, date);\n}\nfunction partsTimeZone(dtf, date) {\n const formatted = dtf.formatToParts(date);\n for (let i = formatted.length - 1; i >= 0; --i) {\n if (formatted[i].type === 'timeZoneName') {\n return formatted[i].value;\n }\n }\n return undefined;\n}\nfunction hackyTimeZone(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, '');\n const tzNameMatch = / [\\w-+ ]+$/.exec(formatted);\n return tzNameMatch ? tzNameMatch[0].substr(1) : '';\n}\n// If a locale has been provided `en-US` is used as a fallback in case it is an\n// invalid locale, otherwise the locale is left undefined to use the system locale.\nfunction getDTF(length, timeZone, locale) {\n return new Intl.DateTimeFormat(locale ? [locale.code, 'en-US'] : undefined, {\n timeZone: timeZone,\n timeZoneName: length,\n });\n}\n","/**\n * Returns the [year, month, day, hour, minute, seconds] tokens of the provided\n * `date` as it will be rendered in the `timeZone`.\n */\nexport function tzTokenizeDate(date, timeZone) {\n const dtf = getDateTimeFormat(timeZone);\n return 'formatToParts' in dtf ? partsOffset(dtf, date) : hackyOffset(dtf, date);\n}\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n hour: 3,\n minute: 4,\n second: 5,\n};\nfunction partsOffset(dtf, date) {\n try {\n const formatted = dtf.formatToParts(date);\n const filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const pos = typeToPos[formatted[i].type];\n if (pos !== undefined) {\n filled[pos] = parseInt(formatted[i].value, 10);\n }\n }\n return filled;\n }\n catch (error) {\n if (error instanceof RangeError) {\n return [NaN];\n }\n throw error;\n }\n}\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const parsed = /(\\d+)\\/(\\d+)\\/(\\d+),? (\\d+):(\\d+):(\\d+)/.exec(formatted);\n // const [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed\n // return [fYear, fMonth, fDay, fHour, fMinute, fSecond]\n return [\n parseInt(parsed[3], 10),\n parseInt(parsed[1], 10),\n parseInt(parsed[2], 10),\n parseInt(parsed[4], 10),\n parseInt(parsed[5], 10),\n parseInt(parsed[6], 10),\n ];\n}\n// Get a cached Intl.DateTimeFormat instance for the IANA `timeZone`. This can be used\n// to get deterministic local date/time output according to the `en-US` locale which\n// can be used to extract local time parts as necessary.\nconst dtfCache = {};\n// New browsers use `hourCycle`, IE and Chrome <73 does not support it and uses `hour12`\nconst testDateFormatted = new Intl.DateTimeFormat('en-US', {\n hourCycle: 'h23',\n timeZone: 'America/New_York',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n}).format(new Date('2014-06-25T04:00:00.123Z'));\nconst hourCycleSupported = testDateFormatted === '06/25/2014, 00:00:00' ||\n testDateFormatted === '‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00';\nfunction getDateTimeFormat(timeZone) {\n if (!dtfCache[timeZone]) {\n dtfCache[timeZone] = hourCycleSupported\n ? new Intl.DateTimeFormat('en-US', {\n hourCycle: 'h23',\n timeZone: timeZone,\n year: 'numeric',\n month: 'numeric',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n })\n : new Intl.DateTimeFormat('en-US', {\n hour12: false,\n timeZone: timeZone,\n year: 'numeric',\n month: 'numeric',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n });\n }\n return dtfCache[timeZone];\n}\n","/**\n * Use instead of `new Date(Date.UTC(...))` to support years below 100 which doesn't work\n * otherwise due to the nature of the\n * [`Date` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years.\n *\n * For `Date.UTC(...)`, use `newDateUTC(...).getTime()`.\n */\nexport function newDateUTC(fullYear, month, day, hour, minute, second, millisecond) {\n const utcDate = new Date(0);\n utcDate.setUTCFullYear(fullYear, month, day);\n utcDate.setUTCHours(hour, minute, second, millisecond);\n return utcDate;\n}\n","import { tzTokenizeDate } from '../tzTokenizeDate/index.js';\nimport { newDateUTC } from '../newDateUTC/index.js';\nconst MILLISECONDS_IN_HOUR = 3600000;\nconst MILLISECONDS_IN_MINUTE = 60000;\nconst patterns = {\n timezone: /([Z+-].*)$/,\n timezoneZ: /^(Z)$/,\n timezoneHH: /^([+-]\\d{2})$/,\n timezoneHHMM: /^([+-])(\\d{2}):?(\\d{2})$/,\n};\n// Parse constious time zone offset formats to an offset in milliseconds\nexport function tzParseTimezone(timezoneString, date, isUtcDate) {\n // Empty string\n if (!timezoneString) {\n return 0;\n }\n // Z\n let token = patterns.timezoneZ.exec(timezoneString);\n if (token) {\n return 0;\n }\n let hours;\n let absoluteOffset;\n // ±hh\n token = patterns.timezoneHH.exec(timezoneString);\n if (token) {\n hours = parseInt(token[1], 10);\n if (!validateTimezone(hours)) {\n return NaN;\n }\n return -(hours * MILLISECONDS_IN_HOUR);\n }\n // ±hh:mm or ±hhmm\n token = patterns.timezoneHHMM.exec(timezoneString);\n if (token) {\n hours = parseInt(token[2], 10);\n const minutes = parseInt(token[3], 10);\n if (!validateTimezone(hours, minutes)) {\n return NaN;\n }\n absoluteOffset = Math.abs(hours) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE;\n return token[1] === '+' ? -absoluteOffset : absoluteOffset;\n }\n // IANA time zone\n if (isValidTimezoneIANAString(timezoneString)) {\n date = new Date(date || Date.now());\n const utcDate = isUtcDate ? date : toUtcDate(date);\n const offset = calcOffset(utcDate, timezoneString);\n const fixedOffset = isUtcDate ? offset : fixOffset(date, offset, timezoneString);\n return -fixedOffset;\n }\n return NaN;\n}\nfunction toUtcDate(date) {\n return newDateUTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n}\nfunction calcOffset(date, timezoneString) {\n const tokens = tzTokenizeDate(date, timezoneString);\n // ms dropped because it's not provided by tzTokenizeDate\n const asUTC = newDateUTC(tokens[0], tokens[1] - 1, tokens[2], tokens[3] % 24, tokens[4], tokens[5], 0).getTime();\n let asTS = date.getTime();\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return asUTC - asTS;\n}\nfunction fixOffset(date, offset, timezoneString) {\n const localTS = date.getTime();\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - offset;\n // Test whether the zone matches the offset for this ts\n const o2 = calcOffset(new Date(utcGuess), timezoneString);\n // If so, offset didn't change, and we're done\n if (offset === o2) {\n return offset;\n }\n // If not, change the ts by the difference in the offset\n utcGuess -= o2 - offset;\n // If that gives us the local time we want, we're done\n const o3 = calcOffset(new Date(utcGuess), timezoneString);\n if (o2 === o3) {\n return o2;\n }\n // If it's different, we're in a hole time. The offset has changed, but we don't adjust the time\n return Math.max(o2, o3);\n}\nfunction validateTimezone(hours, minutes) {\n return -23 <= hours && hours <= 23 && (minutes == null || (0 <= minutes && minutes <= 59));\n}\nconst validIANATimezoneCache = {};\nfunction isValidTimezoneIANAString(timeZoneString) {\n if (validIANATimezoneCache[timeZoneString])\n return true;\n try {\n new Intl.DateTimeFormat(undefined, { timeZone: timeZoneString });\n validIANATimezoneCache[timeZoneString] = true;\n return true;\n }\n catch (error) {\n return false;\n }\n}\n","import { tzIntlTimeZoneName } from '../../_lib/tzIntlTimeZoneName/index.js';\nimport { tzParseTimezone } from '../../_lib/tzParseTimezone/index.js';\nconst MILLISECONDS_IN_MINUTE = 60 * 1000;\nexport const formatters = {\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function (date, token, options) {\n const timezoneOffset = getTimeZoneOffset(options.timeZone, date);\n if (timezoneOffset === 0) {\n return 'Z';\n }\n switch (token) {\n // Hours and optional minutes\n case 'X':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n case 'XXXX':\n case 'XX': // Hours and minutes without `:` delimeter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n case 'XXXXX':\n case 'XXX': // Hours and minutes with `:` delimeter\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function (date, token, options) {\n const timezoneOffset = getTimeZoneOffset(options.timeZone, date);\n switch (token) {\n // Hours and optional minutes\n case 'x':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n case 'xxxx':\n case 'xx': // Hours and minutes without `:` delimeter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n case 'xxxxx':\n case 'xxx': // Hours and minutes with `:` delimeter\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (GMT)\n O: function (date, token, options) {\n const timezoneOffset = getTimeZoneOffset(options.timeZone, date);\n switch (token) {\n // Short\n case 'O':\n case 'OO':\n case 'OOO':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n case 'OOOO':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (specific non-location)\n z: function (date, token, options) {\n switch (token) {\n // Short\n case 'z':\n case 'zz':\n case 'zzz':\n return tzIntlTimeZoneName('short', date, options);\n // Long\n case 'zzzz':\n default:\n return tzIntlTimeZoneName('long', date, options);\n }\n },\n};\nfunction getTimeZoneOffset(timeZone, originalDate) {\n const timeZoneOffset = timeZone\n ? tzParseTimezone(timeZone, originalDate, true) / MILLISECONDS_IN_MINUTE\n : originalDate?.getTimezoneOffset() ?? 0;\n if (Number.isNaN(timeZoneOffset)) {\n throw new RangeError('Invalid time zone specified: ' + timeZone);\n }\n return timeZoneOffset;\n}\nfunction addLeadingZeros(number, targetLength) {\n const sign = number < 0 ? '-' : '';\n let output = Math.abs(number).toString();\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return sign + output;\n}\nfunction formatTimezone(offset, delimiter = '') {\n const sign = offset > 0 ? '-' : '+';\n const absOffset = Math.abs(offset);\n const hours = addLeadingZeros(Math.floor(absOffset / 60), 2);\n const minutes = addLeadingZeros(Math.floor(absOffset % 60), 2);\n return sign + hours + delimiter + minutes;\n}\nfunction formatTimezoneWithOptionalMinutes(offset, delimiter) {\n if (offset % 60 === 0) {\n const sign = offset > 0 ? '-' : '+';\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n return formatTimezone(offset, delimiter);\n}\nfunction formatTimezoneShort(offset, delimiter = '') {\n const sign = offset > 0 ? '-' : '+';\n const absOffset = Math.abs(offset);\n const hours = Math.floor(absOffset / 60);\n const minutes = absOffset % 60;\n if (minutes === 0) {\n return sign + String(hours);\n }\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);\n}\n","/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));\n utcDate.setUTCFullYear(date.getFullYear());\n return +date - +utcDate;\n}\n","/** Regex to identify the presence of a time zone specifier in a date string */\nexport const tzPattern = /(Z|[+-]\\d{2}(?::?\\d{2})?| UTC| [a-zA-Z]+\\/[a-zA-Z_]+(?:\\/[a-zA-Z_]+)?)$/;\n","import { getTimezoneOffsetInMilliseconds } from '../_lib/getTimezoneOffsetInMilliseconds/index.js';\nimport { tzParseTimezone } from '../_lib/tzParseTimezone/index.js';\nimport { tzPattern } from '../_lib/tzPattern/index.js';\nconst MILLISECONDS_IN_HOUR = 3600000;\nconst MILLISECONDS_IN_MINUTE = 60000;\nconst DEFAULT_ADDITIONAL_DIGITS = 2;\nconst patterns = {\n dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,\n datePattern: /^([0-9W+-]+)(.*)/,\n plainTime: /:/,\n // year tokens\n YY: /^(\\d{2})$/,\n YYY: [\n /^([+-]\\d{2})$/, // 0 additional digits\n /^([+-]\\d{3})$/, // 1 additional digit\n /^([+-]\\d{4})$/, // 2 additional digits\n ],\n YYYY: /^(\\d{4})/,\n YYYYY: [\n /^([+-]\\d{4})/, // 0 additional digits\n /^([+-]\\d{5})/, // 1 additional digit\n /^([+-]\\d{6})/, // 2 additional digits\n ],\n // date tokens\n MM: /^-(\\d{2})$/,\n DDD: /^-?(\\d{3})$/,\n MMDD: /^-?(\\d{2})-?(\\d{2})$/,\n Www: /^-?W(\\d{2})$/,\n WwwD: /^-?W(\\d{2})-?(\\d{1})$/,\n HH: /^(\\d{2}([.,]\\d*)?)$/,\n HHMM: /^(\\d{2}):?(\\d{2}([.,]\\d*)?)$/,\n HHMMSS: /^(\\d{2}):?(\\d{2}):?(\\d{2}([.,]\\d*)?)$/,\n // time zone tokens (to identify the presence of a tz)\n timeZone: tzPattern,\n};\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If an argument is a string, the function tries to parse it.\n * Function accepts complete ISO 8601 formats as well as partial implementations.\n * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601\n * If the function cannot parse the string or the values are invalid, it returns Invalid Date.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n * All *date-fns* functions will throw `RangeError` if `options.additionalDigits` is not 0, 1, 2 or undefined.\n *\n * @param argument the value to convert\n * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format\n * @param {string} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.\n *\n * @returns the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Convert string '2014-02-11T11:30:30' to date:\n * const result = toDate('2014-02-11T11:30:30')\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert string '+02014101' to date,\n * // if the additional number of digits in the extended year format is 1:\n * const result = toDate('+02014101', {additionalDigits: 1})\n * //=> Fri Apr 11 2014 00:00:00\n */\nexport function toDate(argument, options = {}) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n if (argument === null) {\n return new Date(NaN);\n }\n const additionalDigits = options.additionalDigits == null ? DEFAULT_ADDITIONAL_DIGITS : Number(options.additionalDigits);\n if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {\n throw new RangeError('additionalDigits must be 0, 1 or 2');\n }\n // Clone the date\n if (argument instanceof Date ||\n (typeof argument === 'object' && Object.prototype.toString.call(argument) === '[object Date]')) {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n }\n else if (typeof argument === 'number' ||\n Object.prototype.toString.call(argument) === '[object Number]') {\n return new Date(argument);\n }\n else if (!(Object.prototype.toString.call(argument) === '[object String]')) {\n return new Date(NaN);\n }\n const dateStrings = splitDateString(argument);\n const { year, restDateString } = parseYear(dateStrings.date, additionalDigits);\n const date = parseDate(restDateString, year);\n if (date === null || isNaN(date.getTime())) {\n return new Date(NaN);\n }\n if (date) {\n const timestamp = date.getTime();\n let time = 0;\n let offset;\n if (dateStrings.time) {\n time = parseTime(dateStrings.time);\n if (time === null || isNaN(time)) {\n return new Date(NaN);\n }\n }\n if (dateStrings.timeZone || options.timeZone) {\n offset = tzParseTimezone(dateStrings.timeZone || options.timeZone, new Date(timestamp + time));\n if (isNaN(offset)) {\n return new Date(NaN);\n }\n }\n else {\n // get offset accurate to hour in time zones that change offset\n offset = getTimezoneOffsetInMilliseconds(new Date(timestamp + time));\n offset = getTimezoneOffsetInMilliseconds(new Date(timestamp + time + offset));\n }\n return new Date(timestamp + time + offset);\n }\n else {\n return new Date(NaN);\n }\n}\nfunction splitDateString(dateString) {\n const dateStrings = {};\n let parts = patterns.dateTimePattern.exec(dateString);\n let timeString;\n if (!parts) {\n parts = patterns.datePattern.exec(dateString);\n if (parts) {\n dateStrings.date = parts[1];\n timeString = parts[2];\n }\n else {\n dateStrings.date = null;\n timeString = dateString;\n }\n }\n else {\n dateStrings.date = parts[1];\n timeString = parts[3];\n }\n if (timeString) {\n const token = patterns.timeZone.exec(timeString);\n if (token) {\n dateStrings.time = timeString.replace(token[1], '');\n dateStrings.timeZone = token[1].trim();\n }\n else {\n dateStrings.time = timeString;\n }\n }\n return dateStrings;\n}\nfunction parseYear(dateString, additionalDigits) {\n if (dateString) {\n const patternYYY = patterns.YYY[additionalDigits];\n const patternYYYYY = patterns.YYYYY[additionalDigits];\n // YYYY or ±YYYYY\n let token = patterns.YYYY.exec(dateString) || patternYYYYY.exec(dateString);\n if (token) {\n const yearString = token[1];\n return {\n year: parseInt(yearString, 10),\n restDateString: dateString.slice(yearString.length),\n };\n }\n // YY or ±YYY\n token = patterns.YY.exec(dateString) || patternYYY.exec(dateString);\n if (token) {\n const centuryString = token[1];\n return {\n year: parseInt(centuryString, 10) * 100,\n restDateString: dateString.slice(centuryString.length),\n };\n }\n }\n // Invalid ISO-formatted year\n return {\n year: null,\n };\n}\nfunction parseDate(dateString, year) {\n // Invalid ISO-formatted year\n if (year === null) {\n return null;\n }\n let date;\n let month;\n let week;\n // YYYY\n if (!dateString || !dateString.length) {\n date = new Date(0);\n date.setUTCFullYear(year);\n return date;\n }\n // YYYY-MM\n let token = patterns.MM.exec(dateString);\n if (token) {\n date = new Date(0);\n month = parseInt(token[1], 10) - 1;\n if (!validateDate(year, month)) {\n return new Date(NaN);\n }\n date.setUTCFullYear(year, month);\n return date;\n }\n // YYYY-DDD or YYYYDDD\n token = patterns.DDD.exec(dateString);\n if (token) {\n date = new Date(0);\n const dayOfYear = parseInt(token[1], 10);\n if (!validateDayOfYearDate(year, dayOfYear)) {\n return new Date(NaN);\n }\n date.setUTCFullYear(year, 0, dayOfYear);\n return date;\n }\n // yyyy-MM-dd or YYYYMMDD\n token = patterns.MMDD.exec(dateString);\n if (token) {\n date = new Date(0);\n month = parseInt(token[1], 10) - 1;\n const day = parseInt(token[2], 10);\n if (!validateDate(year, month, day)) {\n return new Date(NaN);\n }\n date.setUTCFullYear(year, month, day);\n return date;\n }\n // YYYY-Www or YYYYWww\n token = patterns.Www.exec(dateString);\n if (token) {\n week = parseInt(token[1], 10) - 1;\n if (!validateWeekDate(week)) {\n return new Date(NaN);\n }\n return dayOfISOWeekYear(year, week);\n }\n // YYYY-Www-D or YYYYWwwD\n token = patterns.WwwD.exec(dateString);\n if (token) {\n week = parseInt(token[1], 10) - 1;\n const dayOfWeek = parseInt(token[2], 10) - 1;\n if (!validateWeekDate(week, dayOfWeek)) {\n return new Date(NaN);\n }\n return dayOfISOWeekYear(year, week, dayOfWeek);\n }\n // Invalid ISO-formatted date\n return null;\n}\nfunction parseTime(timeString) {\n let hours;\n let minutes;\n // hh\n let token = patterns.HH.exec(timeString);\n if (token) {\n hours = parseFloat(token[1].replace(',', '.'));\n if (!validateTime(hours)) {\n return NaN;\n }\n return (hours % 24) * MILLISECONDS_IN_HOUR;\n }\n // hh:mm or hhmm\n token = patterns.HHMM.exec(timeString);\n if (token) {\n hours = parseInt(token[1], 10);\n minutes = parseFloat(token[2].replace(',', '.'));\n if (!validateTime(hours, minutes)) {\n return NaN;\n }\n return (hours % 24) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE;\n }\n // hh:mm:ss or hhmmss\n token = patterns.HHMMSS.exec(timeString);\n if (token) {\n hours = parseInt(token[1], 10);\n minutes = parseInt(token[2], 10);\n const seconds = parseFloat(token[3].replace(',', '.'));\n if (!validateTime(hours, minutes, seconds)) {\n return NaN;\n }\n return (hours % 24) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * 1000;\n }\n // Invalid ISO-formatted time\n return null;\n}\nfunction dayOfISOWeekYear(isoWeekYear, week, day) {\n week = week || 0;\n day = day || 0;\n const date = new Date(0);\n date.setUTCFullYear(isoWeekYear, 0, 4);\n const fourthOfJanuaryDay = date.getUTCDay() || 7;\n const diff = week * 7 + day + 1 - fourthOfJanuaryDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}\n// Validation functions\nconst DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nconst DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nfunction isLeapYearIndex(year) {\n return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);\n}\nfunction validateDate(year, month, date) {\n if (month < 0 || month > 11) {\n return false;\n }\n if (date != null) {\n if (date < 1) {\n return false;\n }\n const isLeapYear = isLeapYearIndex(year);\n if (isLeapYear && date > DAYS_IN_MONTH_LEAP_YEAR[month]) {\n return false;\n }\n if (!isLeapYear && date > DAYS_IN_MONTH[month]) {\n return false;\n }\n }\n return true;\n}\nfunction validateDayOfYearDate(year, dayOfYear) {\n if (dayOfYear < 1) {\n return false;\n }\n const isLeapYear = isLeapYearIndex(year);\n if (isLeapYear && dayOfYear > 366) {\n return false;\n }\n if (!isLeapYear && dayOfYear > 365) {\n return false;\n }\n return true;\n}\nfunction validateWeekDate(week, day) {\n if (week < 0 || week > 52) {\n return false;\n }\n if (day != null && (day < 0 || day > 6)) {\n return false;\n }\n return true;\n}\nfunction validateTime(hours, minutes, seconds) {\n if (hours < 0 || hours >= 25) {\n return false;\n }\n if (minutes != null && (minutes < 0 || minutes >= 60)) {\n return false;\n }\n if (seconds != null && (seconds < 0 || seconds >= 60)) {\n return false;\n }\n return true;\n}\n","import { format as dateFnsFormat } from 'date-fns/format';\nimport { formatters } from './formatters/index.js';\nimport { toDate } from '../toDate/index.js';\nconst tzFormattingTokensRegExp = /([xXOz]+)|''|'(''|[^'])+('|$)/g;\n/**\n * @name format\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may consty by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://git.io/fxCyr\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 8 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 8 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Su | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Su | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Su | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Su | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | AM, PM | a..aaa | AM, PM | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 1, 2, ..., 11, 0 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 0001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | PDT, EST, CEST | 6 |\n * | | zzzz | Pacific Daylight Time | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 05/29/1453 | 7 |\n * | | PP | May 29, 1453 | 7 |\n * | | PPP | May 29th, 1453 | 7 |\n * | | PPPP | Sunday, May 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |\n * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | May 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}\n * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).\n *\n * 6. Specific non-location timezones are created using the Intl browser API. The output is determined by the\n * preferred standard of the current locale (en-US by default) which may not always give the expected result.\n * For this reason it is recommended to supply a `locale` in the format options when formatting a time zone name.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. These tokens are often confused with others. See: https://git.io/fxCyr\n *\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole\n * library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The second argument is now required for the sake of explicitness.\n *\n * ```javascript\n * // Before v2.0.0\n * format(new Date(2016, 0, 1))\n *\n * // v2.0.0 onward\n * format(new Date(2016, 0, 1), \"yyyy-MM-dd'T'HH:mm:ss.SSSxxx\")\n * ```\n *\n * - New format string API for `format` function\n * which is based on [Unicode Technical Standard\n * #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table). See [this\n * post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.\n *\n * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.\n *\n * @param date the original date\n * @param formatStr the string of tokens\n * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link\n * https://date-fns.org/docs/toDate}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See\n * [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:\n * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).\n * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens\n * (`yy`, `yyyy`). See: https://git.io/fxCyr\n * @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.\n * @param {Date|Number} [options.originalDate] - can be used to pass the original unmodified date to `format` to\n * improve correctness of the replaced timezone token close to the DST threshold.\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see:\n * https://git.io/fxCyr\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\nexport function format(date, formatStr, options = {}) {\n formatStr = String(formatStr);\n const matches = formatStr.match(tzFormattingTokensRegExp);\n if (matches) {\n const d = toDate(options.originalDate || date, options);\n // Work through each match and replace the tz token in the format string with the quoted\n // formatted time zone so the remaining tokens can be filled in by date-fns#format.\n formatStr = matches.reduce(function (result, token) {\n if (token[0] === \"'\") {\n return result; // This is a quoted portion, matched only to ensure we don't match inside it\n }\n const pos = result.indexOf(token);\n const precededByQuotedSection = result[pos - 1] === \"'\";\n const replaced = result.replace(token, \"'\" + formatters[token[0]](d, token, options) + \"'\");\n // If the replacement results in two adjoining quoted strings, the back to back quotes\n // are removed, so it doesn't look like an escaped quote.\n return precededByQuotedSection\n ? replaced.substring(0, pos - 1) + replaced.substring(pos + 1)\n : replaced;\n }, formatStr);\n }\n return dateFnsFormat(date, formatStr, options);\n}\n","import { tzParseTimezone } from '../_lib/tzParseTimezone/index.js';\nimport { toDate } from '../toDate/index.js';\n/**\n * @name toZonedTime\n * @category Time Zone Helpers\n * @summary Get a date/time representing local time in a given time zone from the UTC date\n *\n * @description\n * Returns a date instance with values representing the local time in the time zone\n * specified of the UTC time from the date provided. In other words, when the new date\n * is formatted it will show the equivalent hours in the target time zone regardless\n * of the current system time zone.\n *\n * @param date the date with the relevant UTC time\n * @param timeZone the time zone to get local time for, can be an offset or IANA time zone\n * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n *\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // In June 10am UTC is 6am in New York (-04:00)\n * const result = toZonedTime('2014-06-25T10:00:00.000Z', 'America/New_York')\n * //=> Jun 25 2014 06:00:00\n */\nexport function toZonedTime(date, timeZone, options) {\n date = toDate(date, options);\n const offsetMilliseconds = tzParseTimezone(timeZone, date, true);\n const d = new Date(date.getTime() - offsetMilliseconds);\n const resultDate = new Date(0);\n resultDate.setFullYear(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());\n resultDate.setHours(d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());\n return resultDate;\n}\n","import { format } from '../format/index.js';\nimport { toZonedTime } from '../toZonedTime/index.js';\n/**\n * @name formatInTimeZone\n * @category Time Zone Helpers\n * @summary Gets the offset in milliseconds between the time zone and Universal Coordinated Time (UTC)\n *\n * @param date the date representing the local time / real UTC time\n * @param timeZone the time zone this date should be formatted for; can be an offset or IANA time zone\n * @param formatStr the string of tokens\n * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link\n * https://date-fns.org/docs/toDate}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See\n * [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:\n * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).\n * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens\n * (`yy`, `yyyy`). See: https://git.io/fxCyr\n * @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.\n */\nexport function formatInTimeZone(date, timeZone, formatStr, options) {\n options = {\n ...options,\n timeZone,\n originalDate: date,\n };\n return format(toZonedTime(date, timeZone, { timeZone: options.timeZone }), formatStr, options);\n}\n","import { toDate } from '../toDate/index.js';\nimport { tzPattern } from '../_lib/tzPattern/index.js';\nimport { tzParseTimezone } from '../_lib/tzParseTimezone/index.js';\nimport { newDateUTC } from '../_lib/newDateUTC/index.js';\n/**\n * @name fromZonedTime\n * @category Time Zone Helpers\n * @summary Get the UTC date/time from a date representing local time in a given time zone\n *\n * @description\n * Returns a date instance with the UTC time of the provided date of which the values\n * represented the local time in the time zone specified. In other words, if the input\n * date represented local time in time zone, the timestamp of the output date will\n * give the equivalent UTC of that local time regardless of the current system time zone.\n *\n * @param date the date with values representing the local time\n * @param timeZone the time zone of this local time, can be an offset or IANA time zone\n * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // In June 10am in Los Angeles is 5pm UTC\n * const result = fromZonedTime(new Date(2014, 5, 25, 10, 0, 0), 'America/Los_Angeles')\n * //=> 2014-06-25T17:00:00.000Z\n */\nexport function fromZonedTime(date, timeZone, options) {\n if (typeof date === 'string' && !date.match(tzPattern)) {\n return toDate(date, { ...options, timeZone });\n }\n date = toDate(date, options);\n const utc = newDateUTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()).getTime();\n const offsetMilliseconds = tzParseTimezone(timeZone, new Date(utc));\n return new Date(utc + offsetMilliseconds);\n}\n","import { tzParseTimezone } from '../_lib/tzParseTimezone/index.js';\n/**\n * @name getTimezoneOffset\n * @category Time Zone Helpers\n * @summary Gets the offset in milliseconds between the time zone and Universal Coordinated Time (UTC)\n *\n * @description\n * Returns the time zone offset from UTC time in milliseconds for IANA time zones as well\n * as other time zone offset string formats.\n *\n * For time zones where daylight savings time is applicable a `Date` should be passed on\n * the second parameter to ensure the offset correctly accounts for DST at that time of\n * year. When omitted, the current date is used.\n *\n * @param timeZone the time zone of this local time, can be an offset or IANA time zone\n * @param date the date with values representing the local time\n *\n * @example\n * const result = getTimezoneOffset('-07:00')\n * //=> -18000000 (-7 * 60 * 60 * 1000)\n * const result = getTimezoneOffset('Africa/Johannesburg')\n * //=> 7200000 (2 * 60 * 60 * 1000)\n * const result = getTimezoneOffset('America/New_York', new Date(2016, 0, 1))\n * //=> -18000000 (-5 * 60 * 60 * 1000)\n * const result = getTimezoneOffset('America/New_York', new Date(2016, 6, 1))\n * //=> -14400000 (-4 * 60 * 60 * 1000)\n */\nexport function getTimezoneOffset(timeZone, date) {\n return -tzParseTimezone(timeZone, date);\n}\n","import { formatInTimeZone } from 'date-fns-tz'\n\nexport interface TimeFormatOptions {\n includeTZ?: boolean\n tz?: string\n short?: boolean\n format?: 'default' | 'short' | 'full'\n}\n\n/**\n *Formats a timestamp according to the specified options\n *\n * @param ts - timestamp as number or Date\n * @param options - formatting options\n * @param options.format - format of the timestamp representing the granularity\n * 'MMM dd, yyyy hh:mm a' (default)\n * Possible values:\n * - short: 'MMM dd, yyyy'\n * - default: 'MMM dd, yyyy hh:mm a'\n * - full: 'MMM dd, yyyy hh:mm:ss.SSS a'\n * @param options.includeTZ: whether to include the timezone abbreviation in the formatted string\n * @param options.tz: timezone to use for formatting (defaults to system timezone)\n * @returns Formatted timestamp string\n */\nexport function formatTimestamp(ts: number | Date, options: TimeFormatOptions = {}) {\n const tz = options?.tz || Intl.DateTimeFormat().resolvedOptions().timeZone\n let format = 'MMM dd, yyy hh:mm a'\n\n switch (options.format) {\n case 'short':\n format = 'MMM dd, yyyy'\n break\n case 'default':\n format = 'MMM dd, yyyy hh:mm a'\n break\n case 'full':\n format = 'MMM dd, yyyy hh:mm:ss.SSS a'\n break\n }\n\n if (options.includeTZ) {\n format += ' (z)'\n }\n\n return formatInTimeZone(ts, tz, format)\n}\n\n/**\n * @deprecated use `formatTimestamp` instead\n */\nexport function formatTime(ts: number | string, options: TimeFormatOptions = {}) {\n if (!ts) {\n return ts\n }\n\n const tz = options.tz || Intl.DateTimeFormat().resolvedOptions().timeZone\n\n try {\n let timeFormat = 'MMM dd, yyy hh:mm a'\n if (options.short) {\n timeFormat = 'MMM dd, yyy'\n }\n\n if (options.includeTZ) {\n timeFormat += ' (z)'\n }\n\n const date = new Date(ts)\n\n // Note: We always need to use `formatInTimeZone` (rather than plain `format`)\n // in order to achieve consistent results based on the tz of the current computer.\n // Otherwise, unit tests can fail depending on the tz of the dev's computer (or in CI), etc.\n // Even if we don't care about timezones, timezones care about us. :/\n return formatInTimeZone(date, tz, timeFormat)\n } catch {\n console.error('Invalid value passed to formatTime', ts)\n\n return '(invalid date)'\n }\n}\n\n/**\n * Formatted display for a start and end time range\n * @param start Date from\n * @param end Date to\n * @returns Human-readable date range string\n */\nexport function formatTimeRange(start: Date, end: Date) {\n return `${formatTime(start.getTime())} - ${formatTime(end.getTime(), { includeTZ: true })}`\n}\n","import type { DruidGranularity, GranularityValues } from './types'\nimport { granularityValues } from './types'\nimport { getTimezoneOffset } from 'date-fns-tz'\n\n// Units are milliseconds, which are what Druid expects.\nexport const Granularities = {\n secondly: 1000,\n tenSecondly: 10 * 1000,\n thirtySecondly: 30 * 1000,\n minutely: 60 * 1000,\n fiveMinutely: 5 * 60 * 1000,\n tenMinutely: 10 * 60 * 1000,\n thirtyMinutely: 30 * 60 * 1000,\n hourly: 60 * 60 * 1000,\n twoHourly: 2 * 60 * 60 * 1000,\n twelveHourly: 12 * 60 * 60 * 1000,\n daily: 60 * 60 * 24 * 1000,\n weekly: 60 * 60 * 24 * 7 * 1000,\n trend: 0,\n}\n\nexport function granularitiesToOptions(\n values: GranularityValues[],\n i18n: { t: (v: string) => string },\n) {\n return values.map((v) => ({\n value: v,\n label: i18n.t(`configuration.vitals.reports.granularity.${v}`),\n }))\n}\n\nexport function granularityMsToQuery(\n granularity: number,\n origin: string,\n): DruidGranularity {\n return {\n duration: granularity,\n type: 'duration',\n origin,\n }\n}\n\nexport function msToGranularity(ms?: number): GranularityValues | null {\n if (!ms) {\n return null\n }\n\n // Note that this folds weird granularity values into known values.\n const key = granularityValues.find((k: GranularityValues) => ms <= Granularities[k])\n\n return key || null\n}\n\nfunction toNearestTimeGrain(\n op: (x: number) => number,\n date: Date,\n granularity: GranularityValues,\n tz?: string,\n): Date {\n // Days and weeks need special handling because naively trying to `ceil` or `floor` them results in a date ending\n // in midnight UTC, whereas as of now we want dates ending in midnight local time.\n // Note: right now we treat daily and weekly granularities the same way, because it's OK to request an\n // incomplete week (i.e., if it's currently Monday at noon, it's OK to request data up to Tuesday midnight for the current week).\n // Druid will just limit its query range accordingly.\n const granularityMs = Granularities[granularity]\n let tzOffsetMs = 0\n\n if (granularityMs >= Granularities.daily) {\n if (tz) {\n tzOffsetMs = -getTimezoneOffset(tz, date)\n } else {\n tzOffsetMs = date.getTimezoneOffset() * 60 * 1000\n }\n }\n\n return new Date(op((date.getTime() - tzOffsetMs) / granularityMs) * granularityMs + tzOffsetMs)\n}\n\nexport function floorToNearestTimeGrain(date: Date, granularity: GranularityValues, tz?: string): Date {\n return toNearestTimeGrain(Math.floor, date, granularity, tz)\n}\n\nexport function ceilToNearestTimeGrain(date: Date, granularity: GranularityValues, tz?: string): Date {\n return toNearestTimeGrain(Math.ceil, date, granularity, tz)\n}\n","import { getTime, getUnixTime } from 'date-fns'\n\nimport {\n ceilToNearestTimeGrain,\n floorToNearestTimeGrain,\n Granularities,\n granularityMsToQuery,\n} from './granularity'\nimport type { DruidGranularity, GranularityValues, QueryTime } from './types'\nimport type { Timeframe } from './timeframes'\n\nabstract class BaseQueryTime implements QueryTime {\n protected readonly timeframe: Timeframe\n protected readonly tz?: string\n protected readonly dataGranularity: GranularityValues\n\n constructor(timeframe: Timeframe, tz?: string, dataGranularity?: GranularityValues) {\n // This is an abstract class.\n if (this.constructor === BaseQueryTime) {\n throw new Error('BaseQueryTime is not meant to be used directly.')\n }\n\n this.timeframe = timeframe\n this.tz = tz\n this.dataGranularity = dataGranularity ?? timeframe.dataGranularity\n }\n\n abstract startDate(): Date\n\n abstract endDate(): Date\n\n abstract granularityMs(): number\n\n protected calculateStartDate(isRelative: boolean, granularity: GranularityValues, periods = 1) {\n // `periods` is greater than 1 if we're doing a delta time query.\n if (isRelative) {\n return new Date(this.endDate().getTime() - this.timeframe.timeframeLengthMs() * periods)\n } else {\n // Custom timeframes need special handling since it's hard to calculate the timeframe length.\n // For example, a custom timeframe that starts on 1/1 and ends on 1/1 has a length of 1 day, not 0.\n const ceilEnd = this.endDate()\n const rawStart = this.timeframe.rawStart(this.tz)\n const floorStart = floorToNearestTimeGrain(rawStart, granularity, this.tz)\n const timeframeLengthMs = ceilEnd.getTime() - floorStart.getTime()\n const periodOffset = timeframeLengthMs * (periods - 1)\n\n return new Date(floorStart.getTime() - periodOffset)\n }\n }\n\n granularitySeconds(): number {\n return Math.floor(this.granularityMs() / 1000)\n }\n\n granularityDruid(): DruidGranularity {\n return granularityMsToQuery(this.granularityMs(), this.startDate().toISOString())\n }\n\n // Return a UNIX timestamp suitable for use in the `start` query param.\n startSeconds(): number {\n return getUnixTime(this.startDate())\n }\n\n // Return a UNIX timestamp suitable for use in the `end` query param.\n endSeconds(): number {\n return getUnixTime(this.endDate())\n }\n\n // Return epoch time in milliseconds, suitable for use in the `startMs` query param.\n startMs(): number {\n return getTime(this.startDate())\n }\n\n // Return epoch time in milliseconds, suitable for use in the `endMs` query param.\n endMs(): number {\n return getTime(this.endDate())\n }\n}\n\n// We expect to get back a number of values, depending on the selected timeframe and granularity.\nexport class TimeseriesQueryTime extends BaseQueryTime {\n private readonly granularity: GranularityValues\n\n constructor(timeframe: Timeframe, granularity?: GranularityValues, tz?: string, dataGranularity?: GranularityValues, fineGrain?: boolean) {\n super(timeframe, tz, dataGranularity)\n\n if (granularity && timeframe.allowedGranularities(fineGrain).has(granularity)) {\n this.granularity = granularity\n } else if (fineGrain) {\n this.granularity = timeframe.fineGrainedDefaultGranularity ?? timeframe.defaultResponseGranularity\n } else {\n this.granularity = timeframe.defaultResponseGranularity\n }\n }\n\n startDate(): Date {\n return this.calculateStartDate(this.timeframe.isRelative, this.granularity)\n }\n\n endDate(): Date {\n return ceilToNearestTimeGrain(this.timeframe.rawEnd(), this.granularity, this.tz)\n }\n\n granularityMs(): number {\n return Granularities[this.granularity]\n }\n}\n\n// We expect to get back 1 value, such that we can just show a big number without any trend information.\nexport class UnaryQueryTime extends BaseQueryTime {\n startDate(): Date {\n return this.calculateStartDate(this.timeframe.isRelative, this.dataGranularity)\n }\n\n endDate(): Date {\n return ceilToNearestTimeGrain(this.timeframe.rawEnd(this.tz), this.dataGranularity, this.tz)\n }\n\n granularityMs(): number {\n return this.endDate().getTime() - this.startDate().getTime()\n }\n}\n\n// We expect to get back 2 values, such that we can make a comparison between them.\n// Note that depending on the user's tier, they might not have permission to request double their current\n// timeframe to calculate a trend.\nexport class DeltaQueryTime extends UnaryQueryTime {\n startDate(): Date {\n return this.calculateStartDate(this.timeframe.isRelative, this.dataGranularity, 2)\n }\n\n granularityMs(): number {\n // Note the `super` call -- the granularity for a DeltaQueryTime is the same as for an\n // equivalent UnaryQueryTime, despite the fact that the start time for a Delta query is earlier.\n // This property must hold in order for the current period's numbers to not change between unary\n // and delta query times.\n return this.endDate().getTime() - super.startDate().getTime()\n }\n}\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/**\n * Adds the key-value `pair` to `map`.\n *\n * @private\n * @param {Object} map The map to modify.\n * @param {Array} pair The key-value pair to add.\n * @returns {Object} Returns `map`.\n */\nfunction addMapEntry(map, pair) {\n // Don't return `map.set` because it's not chainable in IE 11.\n map.set(pair[0], pair[1]);\n return map;\n}\n\n/**\n * Adds `value` to `set`.\n *\n * @private\n * @param {Object} set The set to modify.\n * @param {*} value The value to add.\n * @returns {Object} Returns `set`.\n */\nfunction addSetEntry(set, value) {\n // Don't return `set.add` because it's not chainable in IE 11.\n set.add(value);\n return set;\n}\n\n/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array ? array.length : 0;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\n/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array ? array.length : 0;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Checks if `value` is a host object in IE < 9.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\n */\nfunction isHostObject(value) {\n // Many host objects are `Object` objects that can coerce to strings\n // despite having improperly defined `toString` methods.\n var result = false;\n if (value != null && typeof value.toString != 'function') {\n try {\n result = !!(value + '');\n } catch (e) {}\n }\n return result;\n}\n\n/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeKeys = overArg(Object.keys, Object);\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView'),\n Map = getNative(root, 'Map'),\n Promise = getNative(root, 'Promise'),\n Set = getNative(root, 'Set'),\n WeakMap = getNative(root, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n return this.has(key) && delete this.__data__[key];\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n return getMapData(this, key)['delete'](key);\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n getMapData(this, key).set(key, value);\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n this.__data__ = new ListCache(entries);\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n return this.__data__['delete'](key);\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var cache = this.__data__;\n if (cache instanceof ListCache) {\n var pairs = cache.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n return this;\n }\n cache = this.__data__ = new MapCache(pairs);\n }\n cache.set(key, value);\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {boolean} [isFull] Specify a clone including symbols.\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, isDeep, isFull, customizer, key, object, stack) {\n var result;\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n if (isHostObject(value)) {\n return object ? value : {};\n }\n result = initCloneObject(isFunc ? {} : value);\n if (!isDeep) {\n return copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, baseClone, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (!isArr) {\n var props = isFull ? getAllKeys(value) : keys(value);\n }\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));\n });\n return result;\n}\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} prototype The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nfunction baseCreate(proto) {\n return isObject(proto) ? objectCreate(proto) : {};\n}\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\n/**\n * The base implementation of `getTag`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n return objectToString.call(value);\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var result = new buffer.constructor(buffer.length);\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\n/**\n * Creates a clone of `map`.\n *\n * @private\n * @param {Object} map The map to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned map.\n */\nfunction cloneMap(map, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);\n return arrayReduce(array, addMapEntry, new map.constructor);\n}\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\n/**\n * Creates a clone of `set`.\n *\n * @private\n * @param {Object} set The set to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned set.\n */\nfunction cloneSet(set, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);\n return arrayReduce(array, addSetEntry, new set.constructor);\n}\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n assignValue(object, key, newValue === undefined ? source[key] : newValue);\n }\n return object;\n}\n\n/**\n * Copies own symbol properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * Creates an array of the own enumerable symbol properties of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11,\n// for data views in Edge < 14, and promises in Node.js.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = objectToString.call(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : undefined;\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, cloneFunc, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return cloneMap(object, isDeep, cloneFunc);\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return cloneSet(object, isDeep, cloneFunc);\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to process.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, true, true);\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = cloneDeep;\n","import {\n addDays,\n getDaysInMonth,\n hoursToSeconds,\n minutesToHours,\n startOfDay,\n startOfMonth,\n startOfWeek,\n subMonths,\n} from 'date-fns'\n\nimport {\n type ExtendedRelativeTimeRangeValues,\n relativeTimeRangeValuesV4,\n TimeframeKeys,\n} from './types'\n\nimport type {\n DatePickerSelection,\n TimeframeOptions,\n TimePeriod,\n RelativeTimeRangeValuesV4, TimeRangeV4,\n GranularityValues,\n} from './types'\nimport { getTimezoneOffset, toZonedTime, fromZonedTime } from 'date-fns-tz'\nimport type { ITimeframe } from './types/timeframe'\nimport cloneDeep from 'lodash.clonedeep'\n\nconst adjustForTz = (d: Date, tz: string) => {\n // Adjust the given date by the given TZ offset.\n return new Date(d.getTime() - getTimezoneOffset(tz, d))\n}\n\n\nexport class Timeframe implements ITimeframe {\n readonly timeframeText: string\n\n readonly key: RelativeTimeRangeValuesV4 | ExtendedRelativeTimeRangeValues | 'custom'\n\n readonly display: string\n\n readonly timeframeLength: () => number\n\n readonly allowedTiers: string[]\n\n // defaultResponseGranularity tracks which of the allowed granularities is picked for a given\n // timeframe if the user does not or cannot specify a granularity.\n readonly defaultResponseGranularity: GranularityValues\n\n // dataGranularity tracks the granularity of the available data on the server for a specific timeframe.\n // As of writing, it's always the same as the default response granularity, but it may not always be.\n // It controls how timeframes are rounded to ensure complete time buckets from the server.\n readonly dataGranularity: GranularityValues\n\n // isRelative impacts whether we take the `floor` or the `ceil` of the start time.\n // If the time range is relative, we want the ceil -- because we take the ceil of the\n // end time to make sure we're showing all the data we can for the last time bucket.\n // If the time range is absolute, we want the floor -- because otherwise we wouldn't be including\n // the first time bucket.\n readonly isRelative: boolean\n\n readonly fineGrainedDefaultGranularity?: GranularityValues\n\n private _startCustom?: Date\n\n private _endCustom?: Date\n\n private _allowedGranularitiesOverride?: GranularityValues[]\n\n constructor(opts: TimeframeOptions) {\n this.display = opts.display\n this.timeframeText = opts.timeframeText\n this.key = opts.key\n this.timeframeLength = opts.timeframeLength\n this.allowedTiers = opts.allowedTiers\n this.defaultResponseGranularity = opts.defaultResponseGranularity\n this.dataGranularity = opts.dataGranularity\n this.isRelative = opts.isRelative\n this._startCustom = opts.startCustom\n this._endCustom = opts.endCustom\n this._allowedGranularitiesOverride = opts.allowedGranularitiesOverride\n this.fineGrainedDefaultGranularity = opts.fineGrainedDefaultGranularity\n }\n\n // rawEnd does not consider granularity and should not be used directly in queries.\n // Use `new QueryTime(timeframe, granularity?).queryEndSeconds()` instead.\n // eslint-disable-next-line -- `tz` is required because it's used in subclasses.\n rawEnd(_tz?: string): Date {\n return this._endCustom || new Date()\n }\n\n // rawStart does not consider granularity and should not be used directly in queries.\n // Use `new QueryTime(timeframe, granularity?).queryStartSeconds()` instead.\n // eslint-disable-next-line -- `tz` is required because it's used in subclasses.\n rawStart(_tz?: string): Date {\n return this._startCustom || new Date(this.rawEnd().getTime() - this.timeframeLengthMs())\n }\n\n timeframeLengthMs() {\n return this.timeframeLength() * 1000\n }\n\n maximumTimeframeLength() {\n // This is overriden in the variable-length subclasses.\n return this.timeframeLength()\n }\n\n allowedGranularities(fineGrain?: boolean) {\n if (this._allowedGranularitiesOverride && fineGrain) {\n // Note: queryTime's granularity determination currently expects this to be sorted from fine to coarse.\n return new Set(this._allowedGranularitiesOverride)\n }\n\n const allowedValues: Set<GranularityValues> = new Set()\n const hours = this.maximumTimeframeLength() / 3600\n\n // Minutely is allowed for under 6 hours.\n if (hours <= 6) {\n allowedValues.add('minutely')\n }\n\n // Hourly is allowed for 1 week and under, as long as it's more than just 1 hour.\n if (hours >= 2 && hours <= 7 * 24) {\n allowedValues.add('hourly')\n }\n\n // Daily is allowed for everything over 2 days.\n if (hours >= 2 * 24) {\n allowedValues.add('daily')\n }\n\n // Weekly is allowed for everything over 2 weeks.\n if (hours >= 2 * 24 * 14) {\n allowedValues.add('weekly')\n }\n\n return allowedValues\n }\n\n cacheKey(): string {\n if (this.key !== 'custom') {\n // Right now, `key === custom` is our flag for whether we're dealing with an absolute or relative timeframe.\n return this.key\n }\n\n return `${this.rawStart().toISOString()}-${this.rawEnd().toISOString()}`\n }\n\n v4Query(tz?: string): TimeRangeV4 {\n if (this.key === 'custom') {\n // Right now, `key === custom` is our flag for whether we're dealing with an absolute or relative timeframe.\n return {\n type: 'absolute',\n start: this.rawStart(),\n end: this.rawEnd(),\n tz,\n }\n }\n\n if (relativeTimeRangeValuesV4.includes(this.key as any)) {\n return {\n type: 'relative',\n // Safe assertion; we just checked that key is a member of the union.\n time_range: this.key as RelativeTimeRangeValuesV4,\n tz,\n }\n }\n\n throw new Error('Unsupported relative time value for Explore')\n }\n\n protected tzAdjustedDate(tz?: string): Date {\n if (!tz) {\n return new Date()\n }\n\n // Take `new Date()` and adjust it so that it's within the given TZ\n // instead of the current environment's TZ.\n const tzNeutral = fromZonedTime(new Date(), (new Intl.DateTimeFormat()).resolvedOptions().timeZone)\n return toZonedTime(tzNeutral, tz)\n }\n}\n\nclass CurrentWeek extends Timeframe {\n rawStart(tz?: string): Date {\n // `startOfWeek` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let thisMonday = startOfWeek(this.tzAdjustedDate(tz), { weekStartsOn: 1 })\n\n if (tz) {\n thisMonday = adjustForTz(thisMonday, tz)\n }\n\n return thisMonday\n }\n\n maximumTimeframeLength() {\n return 60 * 60 * 24 * 7\n }\n}\n\nclass CurrentMonth extends Timeframe {\n rawStart(tz?: string): Date {\n // `startOfMonth` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let firstOfTheMonth = startOfMonth(this.tzAdjustedDate(tz))\n\n if (tz) {\n firstOfTheMonth = adjustForTz(firstOfTheMonth, tz)\n }\n\n return firstOfTheMonth\n }\n\n maximumTimeframeLength() {\n return 60 * 60 * 24 * 31\n }\n}\n\nclass CurrentYear extends Timeframe {\n rawStart(tz?: string): Date {\n let firstOfTheYear = new Date(this.tzAdjustedDate(tz).getFullYear(), 0, 1)\n\n if (tz) {\n firstOfTheYear = adjustForTz(firstOfTheYear, tz)\n }\n\n return firstOfTheYear\n }\n\n maximumTimeframeLength() {\n return 60 * 60 * 24 * 366\n }\n}\n\nclass PreviousWeek extends Timeframe {\n rawEnd(tz?: string): Date {\n // `startOfWeek` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let thisMonday = startOfWeek(this.tzAdjustedDate(tz), { weekStartsOn: 1 })\n\n if (tz) {\n thisMonday = adjustForTz(thisMonday, tz)\n }\n\n return thisMonday\n }\n\n rawStart(tz?: string): Date {\n const date = this.tzAdjustedDate(tz)\n\n // `startOfWeek` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let lastMonday = startOfWeek(date.setDate(date.getDate() - 7), {\n weekStartsOn: 1,\n })\n\n if (tz) {\n lastMonday = adjustForTz(lastMonday, tz)\n }\n\n return lastMonday\n }\n}\n\nclass PreviousMonth extends Timeframe {\n rawEnd(tz?: string): Date {\n // `startOfMonth` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let thisMonth = startOfMonth(this.tzAdjustedDate(tz))\n\n if (tz) {\n thisMonth = adjustForTz(thisMonth, tz)\n }\n\n return thisMonth\n }\n\n rawStart(tz?: string): Date {\n // `startOfMonth` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let lastMonth = startOfMonth(subMonths(this.tzAdjustedDate(tz), 1))\n\n if (tz) {\n lastMonth = adjustForTz(lastMonth, tz)\n }\n\n return lastMonth\n }\n}\n\nclass PreviousYear extends Timeframe {\n rawEnd(tz?: string): Date {\n let thisYear = new Date(this.tzAdjustedDate(tz).getFullYear(), 0, 1)\n\n if (tz) {\n thisYear = adjustForTz(thisYear, tz)\n }\n\n return thisYear\n }\n\n rawStart(tz?: string): Date {\n let lastYear = new Date(this.tzAdjustedDate(tz).getFullYear() - 1, 0, 1)\n\n if (tz) {\n lastYear = adjustForTz(lastYear, tz)\n }\n\n return lastYear\n }\n}\n\n// These TimePeriod definitions request a default granularity and can be adjusted\n//\n// Using <string, any> as a temp workaround for TimePeriods.get() potentially returning `undefined` lint issue.\n// This means we opt out of safety checks; similar to this workaround:\n// https://github.com/microsoft/TypeScript/issues/41045#issuecomment-706717682\n\nexport const TimePeriods = new Map<string, Timeframe>([\n [\n TimeframeKeys.FIFTEEN_MIN,\n new Timeframe({\n key: TimeframeKeys.FIFTEEN_MIN,\n display: 'Last 15 minutes',\n timeframeText: '15 minutes',\n timeframeLength: () => 60 * 15,\n defaultResponseGranularity: 'minutely',\n dataGranularity: 'minutely',\n isRelative: true,\n fineGrainedDefaultGranularity: 'thirtySecondly',\n allowedTiers: ['free', 'trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['tenSecondly', 'thirtySecondly', 'minutely'],\n }),\n ],\n [\n TimeframeKeys.ONE_HOUR,\n new Timeframe({\n key: TimeframeKeys.ONE_HOUR,\n display: 'Last hour',\n timeframeText: 'One hour',\n timeframeLength: () => 60 * 60 * 1,\n defaultResponseGranularity: 'minutely',\n dataGranularity: 'minutely',\n isRelative: true,\n fineGrainedDefaultGranularity: 'minutely',\n allowedTiers: ['free', 'trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['tenSecondly', 'thirtySecondly', 'minutely', 'fiveMinutely', 'tenMinutely'],\n }),\n ],\n [\n TimeframeKeys.SIX_HOUR,\n new Timeframe({\n key: TimeframeKeys.SIX_HOUR,\n display: 'Last 6 hours',\n timeframeText: '6 hours',\n timeframeLength: () => 60 * 60 * 6,\n defaultResponseGranularity: 'hourly',\n dataGranularity: 'hourly',\n isRelative: true,\n fineGrainedDefaultGranularity: 'fiveMinutely',\n allowedTiers: ['free', 'trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['thirtySecondly', 'minutely', 'fiveMinutely', 'tenMinutely', 'thirtyMinutely', 'hourly'],\n }),\n ],\n [\n TimeframeKeys.TWELVE_HOUR,\n new Timeframe({\n key: TimeframeKeys.TWELVE_HOUR,\n display: 'Last 12 hours',\n timeframeText: '12 hours',\n timeframeLength: () => 60 * 60 * 12,\n defaultResponseGranularity: 'hourly',\n dataGranularity: 'hourly',\n isRelative: true,\n fineGrainedDefaultGranularity: 'tenMinutely',\n allowedTiers: ['free', 'trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['minutely', 'fiveMinutely', 'tenMinutely', 'thirtyMinutely', 'hourly'],\n }),\n ],\n [\n TimeframeKeys.ONE_DAY,\n new Timeframe({\n key: TimeframeKeys.ONE_DAY,\n display: 'Last 24 hours',\n timeframeText: '24 hours',\n timeframeLength: () => 60 * 60 * 24,\n defaultResponseGranularity: 'hourly',\n dataGranularity: 'hourly',\n isRelative: true,\n fineGrainedDefaultGranularity: 'thirtyMinutely',\n allowedTiers: ['free', 'trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['fiveMinutely', 'tenMinutely', 'thirtyMinutely', 'hourly'],\n }),\n ],\n [\n TimeframeKeys.SEVEN_DAY,\n new Timeframe({\n key: TimeframeKeys.SEVEN_DAY,\n display: 'Last 7 days',\n timeframeText: '7 days',\n timeframeLength: () => 60 * 60 * 24 * 7,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: true,\n fineGrainedDefaultGranularity: 'twoHourly',\n allowedTiers: ['trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['thirtyMinutely', 'hourly', 'twoHourly', 'twelveHourly', 'daily'],\n }),\n ],\n [\n TimeframeKeys.THIRTY_DAY,\n new Timeframe({\n key: TimeframeKeys.THIRTY_DAY,\n display: 'Last 30 days',\n timeframeText: '30 days',\n timeframeLength: () => 60 * 60 * 24 * 30,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: true,\n fineGrainedDefaultGranularity: 'twelveHourly',\n allowedTiers: ['trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['hourly', 'twoHourly', 'twelveHourly', 'daily', 'weekly'],\n }),\n ],\n [\n TimeframeKeys.NINETY_DAY,\n new Timeframe({\n key: TimeframeKeys.NINETY_DAY,\n display: 'Last 90 days',\n timeframeText: '90 days',\n timeframeLength: () => 60 * 60 * 24 * 90,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: true,\n fineGrainedDefaultGranularity: 'daily',\n allowedTiers: ['trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['hourly', 'twoHourly', 'twelveHourly', 'daily', 'weekly'],\n }),\n ],\n [\n TimeframeKeys.ONE_HUNDRED_EIGHTY_DAY,\n new Timeframe({\n key: TimeframeKeys.ONE_HUNDRED_EIGHTY_DAY,\n display: 'Last 180 days',\n timeframeText: '180 days',\n timeframeLength: () => 60 * 60 * 24 * 180,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: true,\n fineGrainedDefaultGranularity: 'daily',\n allowedTiers: ['trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['hourly', 'twoHourly', 'twelveHourly', 'daily', 'weekly'],\n }),\n ],\n [\n TimeframeKeys.ONE_YEAR,\n new Timeframe({\n key: TimeframeKeys.ONE_YEAR,\n display: 'Last 365 days',\n timeframeText: '365 days',\n timeframeLength: () => 60 * 60 * 24 * 365,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: true,\n fineGrainedDefaultGranularity: 'daily',\n allowedTiers: ['trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['hourly', 'twoHourly', 'twelveHourly', 'daily', 'weekly'],\n }),\n ],\n [\n TimeframeKeys.CURRENT_WEEK,\n new CurrentWeek({\n key: TimeframeKeys.CURRENT_WEEK,\n display: 'This week',\n timeframeText: 'Week',\n timeframeLength: () => {\n // Monday -> now\n const prevMonday = startOfWeek(new Date(), { weekStartsOn: 1 })\n const end = startOfDay(addDays(new Date(), 1))\n\n return (end.getTime() - prevMonday.getTime()) / 1000\n },\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n fineGrainedDefaultGranularity: 'twoHourly',\n allowedTiers: ['plus', 'enterprise'],\n allowedGranularitiesOverride: ['thirtyMinutely', 'hourly', 'twoHourly', 'twelveHourly', 'daily'],\n }),\n ],\n [\n TimeframeKeys.CURRENT_MONTH,\n new CurrentMonth({\n key: TimeframeKeys.CURRENT_MONTH,\n display: 'This month',\n timeframeText: 'Month',\n timeframeLength: () => {\n // First of the month -> now\n const firstOfTheMonth = startOfMonth(new Date())\n const end = startOfDay(addDays(new Date(), 1))\n\n return (end.getTime() - firstOfTheMonth.getTime()) / 1000\n },\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n allowedTiers: ['plus', 'enterprise'],\n }),\n ],\n [\n TimeframeKeys.CURRENT_YEAR,\n new CurrentYear({\n key: TimeframeKeys.CURRENT_YEAR,\n display: 'This year',\n timeframeText: 'Year',\n timeframeLength: () => {\n // Jan 1 -> now\n const firstOfTheYear = new Date(new Date().getFullYear(), 0, 1)\n const end = startOfDay(addDays(new Date(), 1))\n\n return (end.getTime() - firstOfTheYear.getTime()) / 1000\n },\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n allowedTiers: ['plus', 'enterprise'],\n }),\n ],\n [\n TimeframeKeys.PREVIOUS_WEEK,\n new PreviousWeek({\n key: TimeframeKeys.PREVIOUS_WEEK,\n display: 'Previous week',\n timeframeText: 'Week',\n timeframeLength: () => 60 * 60 * 24 * 7,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n fineGrainedDefaultGranularity: 'twoHourly',\n allowedTiers: ['plus', 'enterprise'],\n allowedGranularitiesOverride: ['thirtyMinutely', 'hourly', 'twoHourly', 'twelveHourly', 'daily'],\n }),\n ],\n [\n TimeframeKeys.PREVIOUS_MONTH,\n new PreviousMonth({\n key: TimeframeKeys.PREVIOUS_MONTH,\n display: 'Previous month',\n timeframeText: 'Month',\n timeframeLength: () => {\n let offset = 0\n const end = startOfMonth(new Date())\n const start = startOfMonth(subMonths(new Date(), 1))\n if (end.getTimezoneOffset() !== start.getTimezoneOffset()) {\n offset = dstOffsetHours(end, start)\n }\n\n // Not all months have the same number of days.\n // Current month may be observing DST while previous is not\n // take this into account when calculating the timeframe length for previous month\n return (\n 60 * 60 * 24 * getDaysInMonth(new Date().setMonth(new Date().getMonth() - 1)) + hoursToSeconds(offset)\n )\n },\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n allowedTiers: ['plus', 'enterprise'],\n }),\n ],\n [\n TimeframeKeys.PREVIOUS_YEAR,\n new PreviousYear({\n key: TimeframeKeys.PREVIOUS_YEAR,\n display: 'Previous year',\n timeframeText: 'Year',\n timeframeLength: () => {\n // Not all years have the same number of days (leap years).\n const end = new Date(new Date().getFullYear(), 0, 1)\n const start = new Date(new Date().getFullYear() - 1, 0, 1)\n let offset = 0\n if (end.getTimezoneOffset() !== start.getTimezoneOffset()) {\n offset = dstOffsetHours(end, start)\n }\n\n return 60 * 60 * 24 * (365 + (start.getFullYear() % 4 === 0 ? 1 : 0)) + hoursToSeconds(offset)\n },\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n allowedTiers: ['plus', 'enterprise'],\n }),\n ],\n])\n\nexport function datePickerSelectionToTimeframe(datePickerSelection: DatePickerSelection): Timeframe {\n const start = new Date(datePickerSelection.start)\n const end = new Date(datePickerSelection.end)\n const timeframeLength = (end.getTime() - start.getTime()) / 1000\n\n const selectedTimePeriod =\n datePickerSelection.timePeriodsKey && cloneDeep(TimePeriods.get(datePickerSelection.timePeriodsKey))\n\n // Note: for custom timeframes, the timeframeLength is approximate: due to rounding\n // based on granularity, the actual length will be slightly greater.\n\n return (\n selectedTimePeriod ||\n new Timeframe({\n key: 'custom',\n timeframeText: 'custom',\n display: 'custom',\n startCustom: start,\n endCustom: end,\n timeframeLength: () => timeframeLength,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n allowedTiers: ['free', 'plus', 'enterprise'],\n })\n )\n}\n\nexport function timeframeToDatepickerSelection(timeframe: Timeframe): DatePickerSelection {\n // Only set `timePeriodsKey` if a relative time frame is chosen\n // Custom time ranges are denoted by the absence of this key\n return {\n ...(timeframe.key !== 'custom' && { timePeriodsKey: timeframe.key }),\n start: timeframe.rawStart(),\n end: timeframe.rawEnd(),\n }\n}\n\nexport function timeframeToDatepickerTimeperiod(timeframe: Timeframe): TimePeriod {\n // The datepicker needs `start` and `end` functions for its timeperiods.\n return {\n key: timeframe.key,\n display: timeframe.display,\n timeframeText: timeframe.timeframeText,\n timeframeLength: () => timeframe.key, // Used to generate test IDs for the Kongponent.\n start: () => timeframe.rawStart(),\n end: () => timeframe.rawEnd(),\n }\n}\n\nexport function dstOffsetHours(d1: Date, d2: Date): number {\n return minutesToHours(d1.getTimezoneOffset() - d2.getTimezoneOffset())\n}\n\nexport const TIMEFRAME_LOOKUP: Record<string, TimeframeKeys> = {\n '15M': TimeframeKeys.FIFTEEN_MIN,\n '1H': TimeframeKeys.ONE_HOUR,\n '6H': TimeframeKeys.SIX_HOUR,\n '12H': TimeframeKeys.TWELVE_HOUR,\n '24H': TimeframeKeys.ONE_DAY,\n '7D': TimeframeKeys.SEVEN_DAY,\n '15m': TimeframeKeys.FIFTEEN_MIN,\n '1h': TimeframeKeys.ONE_HOUR,\n '6h': TimeframeKeys.SIX_HOUR,\n '12h': TimeframeKeys.TWELVE_HOUR,\n '24h': TimeframeKeys.ONE_DAY,\n '7d': TimeframeKeys.SEVEN_DAY,\n '30d': TimeframeKeys.THIRTY_DAY,\n '90d': TimeframeKeys.NINETY_DAY,\n '180d': TimeframeKeys.ONE_HUNDRED_EIGHTY_DAY,\n '365d': TimeframeKeys.ONE_YEAR,\n current_week: TimeframeKeys.CURRENT_WEEK,\n current_month: TimeframeKeys.CURRENT_MONTH,\n current_year: TimeframeKeys.CURRENT_YEAR,\n previous_week: TimeframeKeys.PREVIOUS_WEEK,\n previous_month: TimeframeKeys.PREVIOUS_MONTH,\n previous_year: TimeframeKeys.PREVIOUS_YEAR,\n}\n","export class SeededRandom {\n\n private _seed: number\n\n constructor(seed: number) {\n this._seed = seed\n }\n\n next(min: number, max: number) {\n const x = Math.sin(this._seed++) * 10000\n const res = x - Math.floor(x)\n\n return Math.floor(res * (max - min + 1)) + min\n }\n}\n","import type {\n DimensionMap,\n ExploreAggregations,\n MetricUnit,\n DisplayBlob,\n RecordEvent,\n QueryResponseMeta,\n ExploreResultV4,\n} from '../types'\nimport { SeededRandom } from './SeedRandom'\nimport { rand } from '../utils'\n\nexport interface Metric {\n name: string\n unit: string\n}\n\nexport const generateSingleMetricTimeSeriesData = (metric: Metric, dimensionMap?: DimensionMap, metaOverrides?: Partial<QueryResponseMeta>) => {\n const seed = rand(10, 10000)\n const rng = new SeededRandom(seed)\n\n const start = Date.now() - 6 * 60 * 60 * 1000 // 6 hours ago\n const end = Date.now()\n const data = []\n let totalRequests = 0\n\n for (let i = start; i <= end; i += 60 * 60 * 1000) { // 1 hour apart\n if (dimensionMap) {\n // If dimensionMap is provided, create an event for each dimension value\n for (const dimension in dimensionMap) {\n dimensionMap[dimension].forEach(dimensionValue => {\n totalRequests += rng.next(50, 500)\n\n const event = {\n [dimension]: dimensionValue,\n [metric.name]: totalRequests,\n }\n\n const record = {\n version: '1.0',\n timestamp: new Date(i).toISOString(),\n event,\n }\n data.push(record)\n })\n }\n } else {\n // If no dimensionMap is provided, create a single event\n totalRequests += rng.next(50, 500)\n\n const record = {\n version: '1.0',\n timestamp: new Date(i).toISOString(),\n event: {\n [metric.name]: totalRequests,\n },\n }\n data.push(record)\n }\n }\n\n // V4 display blob\n const displayBlob: DisplayBlob = {}\n\n if (dimensionMap) {\n for (const dimension in dimensionMap) {\n displayBlob[dimension] = {}\n dimensionMap[dimension].forEach(dimensionValue => {\n displayBlob[dimension][dimensionValue] = {\n name: dimensionValue,\n deleted: false,\n }\n })\n }\n }\n\n const meta: QueryResponseMeta = {\n start_ms: start,\n end_ms: end,\n start: new Date(start).toISOString(),\n end: new Date(end).toISOString(),\n query_id: '12345',\n metric_names: [metric.name] as ExploreAggregations[],\n metric_units: {\n [metric.name]: metric.unit,\n },\n granularity_ms: 60 * 60 * 1000, // 1 hour in ms\n display: displayBlob,\n ...(metaOverrides ?? {}),\n }\n\n return {\n data,\n meta,\n } as ExploreResultV4\n}\n\nexport const generateMultipleMetricTimeSeriesData = (metrics: Metric[], metaOverrides?: Partial<QueryResponseMeta>) => {\n const seed = rand(10, 10000)\n const rng = new SeededRandom(seed)\n\n const start = Date.now() - 6 * 60 * 60 * 1000 // 6 hours ago\n const end = Date.now()\n const data = []\n const metricValues: { [metric: string]: number } = {}\n\n metrics.forEach(metric => {\n metricValues[metric.name] = 0\n })\n\n for (let i = start; i <= end; i += 60 * 60 * 1000) { // 1 hour apart\n const event: RecordEvent = {}\n\n metrics.forEach(metric => {\n metricValues[metric.name] += rng.next(50, 500)\n event[metric.name] = metricValues[metric.name]\n })\n\n const record = {\n version: '1.0',\n timestamp: new Date(i).toISOString(),\n event,\n }\n data.push(record)\n }\n\n const meta: QueryResponseMeta = {\n start_ms: start,\n end_ms: end,\n start: new Date(start).toISOString(),\n end: new Date(end).toISOString(),\n query_id: '12345',\n metric_names: metrics.map(metric => metric.name) as ExploreAggregations[],\n metric_units: metrics.reduce((units: MetricUnit, metric) => {\n units[metric.name as ExploreAggregations] = metric.unit\n return units\n }, {}),\n granularity_ms: 60 * 60 * 1000, // 1 hour in ms\n display: {},\n ...(metaOverrides ?? {}),\n }\n\n return {\n data,\n meta,\n } as ExploreResultV4\n}\n\nexport const generateCrossSectionalData = (metrics: Metric[], dimensionMap?: DimensionMap, metaOverrides?: Partial<QueryResponseMeta>) => {\n const seed = Math.floor(Math.random() * (10000 - 10 + 1)) + 10\n const rng = new SeededRandom(seed)\n\n const start = Date.now() - 6 * 60 * 60 * 1000 // 6 hours ago\n const end = Date.now()\n const timestamp = new Date((start + end) / 2).toISOString()\n\n const data = []\n\n if (dimensionMap) {\n const dimensions = Object.keys(dimensionMap)\n const dimensionValues = Object.values(dimensionMap)\n\n // Recursively create a record for each combination of dimension values\n const createRecords = (currentEvent: RecordEvent, index: number) => {\n if (index === dimensions.length) {\n // All dimensions have been added to the event, add metrics and push the record\n metrics.forEach(metric => {\n currentEvent[metric.name] = rng.next(1000, 50000000)\n })\n data.push({\n version: '1.0',\n timestamp: new Date().toISOString(),\n event: { ...currentEvent },\n })\n return\n }\n\n dimensionValues[index].forEach(value => {\n createRecords({ ...currentEvent, [dimensions[index]]: value }, index + 1)\n })\n }\n\n createRecords({}, 0)\n } else {\n // If no dimensionMap is provided, create a single event with all metrics\n const event: RecordEvent = {}\n metrics.forEach(metric => {\n event[metric.name] = rng.next(50, 500)\n })\n\n data.push({\n version: '1.0',\n timestamp,\n event,\n })\n }\n\n // V4 display blob\n const displayBlob: DisplayBlob = {}\n\n if (dimensionMap) {\n for (const dimension in dimensionMap) {\n displayBlob[dimension] = {}\n dimensionMap[dimension].forEach(dimensionValue => {\n displayBlob[dimension][dimensionValue] = {\n name: dimensionValue,\n deleted: false,\n }\n })\n }\n }\n\n const meta: QueryResponseMeta = {\n start_ms: start,\n end_ms: end,\n start: new Date(start).toISOString(),\n end: new Date(end).toISOString(),\n query_id: '12345',\n metric_names: metrics.map(metric => metric.name) as ExploreAggregations[],\n metric_units: metrics.reduce((units: MetricUnit, metric) => {\n units[metric.name as ExploreAggregations] = metric.unit\n return units\n }, {}),\n truncated: false,\n limit: 50,\n display: displayBlob,\n granularity_ms: end - start,\n ...(metaOverrides ?? {}),\n }\n\n return {\n data,\n meta,\n } as ExploreResultV4\n}\n","export function rand(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min + 1) + min)\n}\n","import type { CountryIsoMap, CountryISOA2 } from '../types'\n\nimport { COUNTRIES } from '../types'\n\nexport const countries: Map<string, CountryIsoMap> = new Map(COUNTRIES.map(country => [country.code, { code: country.code, name: country.name }]))\n\nexport const getCountryName = (country_code: CountryISOA2) => {\n return countries.get(country_code)?.name || country_code\n}\n","/* Approximate Number - outputs numbers in human-readable format, similar to ls -lh or Stack Overflow's reputation\n *\n * https://github.com/nfriedly/approximate-number\n *\n * Copyright (c) 2014 Nathan Friedly\n * Licensed under the MIT license.\n */\n(function() {\n 'use strict';\n\n function addCommas(num, opts) {\n if (opts.separator === false) {\n return num.toString();\n }\n\n if (num < 1000) {\n return num.toString();\n }\n\n var separator = (typeof opts.separator === 'string' ? opts.separator : ',');\n\n var out = [],\n digits = Math.round(num).toString().split('');\n\n digits.reverse().forEach(function(digit, i){\n if (i && i%3 === 0) {\n out.push(separator);\n }\n out.push(digit);\n });\n\n return out.reverse().join('');\n }\n\n function formatDec(num, base, opts) {\n var workingNum = num/base;\n var ROUND = opts.round ? 'round' : 'floor';\n if (opts.decimal === false) {\n num = Math[ROUND](workingNum);\n return num.toString();\n }\n if (opts.precision) {\n num = workingNum;\n } else {\n num = workingNum < 10 ? (Math[ROUND](workingNum * 10) / 10) : Math[ROUND](workingNum);\n }\n num = num.toString();\n if (typeof opts.decimal === 'string') {\n num = num.replace('.', opts.decimal);\n }\n return num;\n }\n\n var THOUSAND = 1000;\n var TEN_THOUSAND = 10000;\n var MILLION = 1000000;\n var BILLION = 1000000000;\n var TRILLION = 1000000000000;\n\n /**\n * Converts big numbers into human-readable forms\n * @param {Number} num\n * @param {Object} [opts]\n * @param {String|Boolean} [opts.separator=','] Thousands separator - set to a string (e.g. '.') to use that string or false to not use any separator\n * @param {String|Boolean} [opts.decimal='.'] Decimal - set to a string (e.g. ',') to use that or set to false to avoid outputting values with a decimal\n * @param {Boolean} [opts.round=false] Round numbers off rather than flooring/truncating. When true, 105000 would become '11m', when false it becomes '10m'\n * @param {Boolean} [opts.min10k=false] Do not abbreviate numbers below 10000. E.g. 9999 would become '9,999' rather than '9k'. (Stack Overflow-style)\n * @param {String} [opts.prefix=''] Optional string to prepend to the value, e.g. '$'\n * @param {String} [opts.suffix=''] Optional string to append to the value, e.g. '%'\n * @param {Boolean} [opts.capital=false] Set to true to use capital letters, e.g. 3.9M instead of 3.9m\n * @param {Number} [opts.precision] Optional number of significant digits. Must be greater than 0.\n *\n * @returns {String}\n */\n function approximateNumber(num, opts) {\n var numString;\n opts = opts || {};\n\n // if we're working on a negative number, convert it to positive and then prefix the final result with a -\n var negative = num < 0;\n if (negative) {\n num = Math.abs(num);\n }\n\n if (opts.precision) {\n num = parseFloat(num.toPrecision(opts.precision));\n }\n\n var thousandsBreak = opts.min10k ? TEN_THOUSAND : THOUSAND;\n\n if (num < thousandsBreak) {\n numString = addCommas(formatDec(num, 1, opts), opts);\n } else if (opts.precision && opts.precision > Math.log10(num)) {\n numString = addCommas(formatDec(num, 1, opts), opts);\n } else if (num < MILLION) {\n numString = formatDec(num, THOUSAND, opts) + 'k';\n } else if (num < BILLION) {\n numString = formatDec(num, MILLION, opts) + 'm';\n } else if (num < TRILLION) {\n numString = addCommas(formatDec(num, BILLION, opts), opts) + 'b';\n } else {\n numString = addCommas(formatDec(num, TRILLION, opts), opts) + 't';\n }\n\n if (negative) {\n numString = '-' + numString;\n }\n\n if (opts.capital) {\n numString = numString.toUpperCase();\n }\n\n if (opts.prefix) {\n numString = opts.prefix + numString;\n }\n if (opts.suffix) {\n numString = numString + opts.suffix;\n }\n\n return numString;\n }\n\n approximateNumber.addCommas = addCommas;\n\n if (typeof module === 'object') {\n // node.js/common js\n module.exports = approximateNumber;\n } else if (typeof define === 'function') {\n // require.js/amd\n define([], approximateNumber);\n } else if(typeof window !== 'undefined') {\n window.approximateNumber = approximateNumber;\n }\n}());\n","import type { IntlShapeEx } from '@kong-ui-public/i18n'\n// @ts-ignore - approximate-number no exported module\nimport approxNum from 'approximate-number'\n\n// Guard against SSR/non-browser contexts where `document` is undefined\nconst defaultLocale = (typeof document !== 'undefined' && document.documentElement?.lang) || 'en-US'\n\nexport const numberFormatter = new Intl.NumberFormat(defaultLocale)\n\nexport function unitFormatter<T extends Record<string, any>>({\n i18n,\n} : {\n i18n: IntlShapeEx<T>\n}) {\n\n const formatBytes = (value: number, isBytes1024?: boolean): string => {\n if (isNaN(value)) {\n return '0 B'\n }\n\n const pb = isBytes1024 ? Math.pow(2, 50) : 1e15\n const tb = isBytes1024 ? Math.pow(2, 40) : 1e12\n const gb = isBytes1024 ? Math.pow(2, 30) : 1e9\n const mb = isBytes1024 ? Math.pow(2, 20) : 1e6\n const kb = isBytes1024 ? Math.pow(2, 10) : 1e3\n\n let out\n\n if (value >= pb) {\n out = i18n.formatNumber(\n Number.parseFloat((value / pb).toPrecision(3)),\n { style: 'unit', unit: 'petabyte', unitDisplay: 'narrow' },\n )\n } else if (value >= tb) {\n out = i18n.formatNumber(\n Number.parseFloat((value / tb).toPrecision(3)),\n { style: 'unit', unit: 'terabyte', unitDisplay: 'narrow' },\n )\n } else if (value >= gb) {\n out = i18n.formatNumber(\n Number.parseFloat((value / gb).toPrecision(3)),\n { style: 'unit', unit: 'gigabyte', unitDisplay: 'narrow' },\n )\n } else if (value >= mb) {\n out = i18n.formatNumber(\n Number.parseFloat((value / mb).toPrecision(3)),\n { style: 'unit', unit: 'megabyte', unitDisplay: 'narrow' },\n )\n } else if (value >= kb) {\n out = i18n.formatNumber(\n Number.parseFloat((value / kb).toPrecision(3)),\n { style: 'unit', unit: 'kilobyte', unitDisplay: 'narrow' },\n )\n } else {\n out = i18n.formatNumber(\n Number.parseFloat((value).toPrecision(3)),\n { style: 'unit', unit: 'byte', unitDisplay: 'narrow' },\n )\n }\n\n // i18n.formatNumber formats it as `10.77kB` but we want `10.77 kB`\n return out.replace(/([a-zA-Z]*)$/, ' $1')\n }\n\n const formatCost = (value: number, currency: string = 'USD'): string => {\n if (isNaN(value)) {\n return currency === 'USD' ? '$0.00' : `${value}`\n }\n\n if (value >= 0.01 || currency !== 'USD') {\n return i18n.formatNumber(value, { style: 'currency', currency })\n }\n\n if (value < 0.0001) {\n return '< $0.0001'\n }\n\n // when currency is USD, special case handling for 0.0001 to 0.01\n return `$${Number.parseFloat(value.toPrecision(4))}`\n\n }\n\n type FormatNumberOptions = {\n isBytes1024?: boolean\n currency?: string\n // not supported for bytes or currency formatting\n approximate?: boolean\n translateUnit?: (unit: string, value: number) => string\n }\n\n /*\n * currently the units supported are those returned from\n * https://github.com/Kong/kanalytics/blob/main/src/druid/druid.service.ts#L58-L73\n */\n const formatUnit = (value: number, unit: string, {\n isBytes1024 = false,\n currency = 'USD',\n approximate = false,\n translateUnit = (unit: string) => unit,\n }: FormatNumberOptions = {}): string => {\n const translatedUnit = translateUnit(unit, value)\n\n switch (unit) {\n case 'bytes':\n return formatBytes(value, isBytes1024)\n case 'usd':\n return formatCost(value, currency)\n case 'ms':\n case 'count/minute':\n case 'token count':\n case 'count':\n default:\n if (isNaN(value)) {\n return `${value}`\n }\n if (approximate) {\n return `${approxNum(value, { capital: true })} ${translatedUnit}`\n }\n return value >= 0.01\n ? `${numberFormatter.format(Number.parseFloat(value.toFixed(2)))} ${translatedUnit}`\n : `${Number.parseFloat(value.toPrecision(4))} ${translatedUnit}`\n }\n }\n\n const formatRange = (min: number, max: number, unit: string, {\n isBytes1024 = false,\n currency = 'USD',\n approximate = false,\n translateUnit = (unit: string) => unit,\n }: FormatNumberOptions = {}): string => {\n\n const translatedUnit = translateUnit(unit, max)\n\n switch (unit) {\n case 'bytes':\n return `${formatBytes(min, isBytes1024)} - ${formatBytes(max, isBytes1024)}`\n case 'usd':\n return `${formatCost(min, currency)} - ${formatCost(max, currency)}`\n case 'ms':\n case 'count/minute':\n case 'token count':\n case 'count':\n default:\n if (isNaN(min) || isNaN(max)) {\n return `${min} - ${max}`\n }\n if (approximate) {\n return `${approxNum(min, { capital: true })} - ${approxNum(max, { capital: true })} ${translatedUnit}`\n }\n }\n const minVal = min >= 0.01\n ? `${numberFormatter.format(Number.parseFloat(min.toFixed(2)))}`\n : `${Number.parseFloat(min.toPrecision(4))}`\n\n const maxVal = max >= 0.01\n ? `${numberFormatter.format(Number.parseFloat(max.toFixed(2)))}`\n : `${Number.parseFloat(max.toPrecision(4))}`\n\n return `${minVal} - ${maxVal} ${translatedUnit}`\n }\n\n return { formatUnit, formatBytes, formatCost, formatRange }\n}\n"],"names":["INJECT_QUERY_PROVIDER","TimeframeKeys","extendedRelativeTimeRangeValues","reportChartTypes","exploreFilterTypesV2","requestFilterTypeEqualsV2","requestFilterTypeMetricV2","requestFilterTypeEmptyV2","requestFilterTypeWildcardV2","timeRangeTypeV2","relativeTimeRangeValuesV4","granularityValues","makeFilterable","queryable","d","queryableBasicExploreDimensions","filterableBasicExploreDimensions","basicExploreAggregations","queryableExploreDimensions","filterableExploreDimensions","exploreAggregations","queryableAiExploreDimensions","filterableAiExploreDimensions","aiExploreAggregations","queryableRequestDimensions","filterableRequestDimensions","queryableRequestWildcardDimensions","filterableRequestWildcardDimensions","queryableRequestMetrics","filterableRequestMetrics","relativeTimeRangeValuesRequestV2","queryDatasources","datasourceToFilterableDimensions","stripUnknownFilters","datasource","filters","f","COUNTRIES","dashboardTileTypes","syntheticsDataKey","chartTitle","allowCsvExport","chartDatasetColorsSchema","slottableSchema","barChartSchema","thresholdSchema","timeseriesChartSchema","gaugeChartSchema","donutChartSchema","topNTableSchema","metricCardSchema","singleValueSchema","choroplethMapSchema","c","baseQueryProperties","metricsFn","aggregations","dimensionsFn","dimensions","filtersFn","filterableDimensions","apiUsageQuerySchema","basicQuerySchema","llmUsageSchema","validDashboardQuery","tileDefinitionSchema","tileLayoutSchema","tileConfigSchema","dashboardConfigSchema","getFieldDataSources","dimension","datasources","formatDistanceLocale","formatDistance","token","count","options","result","tokenValue","buildFormatLongFn","args","width","dateFormats","timeFormats","dateTimeFormats","formatLong","formatRelativeLocale","formatRelative","_date","_baseDate","_options","buildLocalizeFn","value","context","valuesArray","defaultWidth","index","eraValues","quarterValues","monthValues","dayValues","dayPeriodValues","formattingDayPeriodValues","localize","dirtyNumber","number","rem100","quarter","buildMatchFn","string","matchPattern","matchResult","matchedString","parsePatterns","key","findIndex","pattern","findKey","rest","object","predicate","array","buildMatchPatternFn","parseResult","matchOrdinalNumberPattern","parseOrdinalNumberPattern","matchEraPatterns","parseEraPatterns","matchQuarterPatterns","parseQuarterPatterns","matchMonthPatterns","parseMonthPatterns","matchDayPatterns","parseDayPatterns","matchDayPeriodPatterns","parseDayPeriodPatterns","match","enUS","defaultOptions","getDefaultOptions","millisecondsInWeek","millisecondsInDay","minutesInHour","secondsInHour","constructFromSymbol","constructFrom","date","toDate","argument","getTimezoneOffsetInMilliseconds","utcDate","normalizeDates","dates","normalize","startOfDay","differenceInCalendarDays","laterDate","earlierDate","laterDate_","earlierDate_","laterStartOfDay","earlierStartOfDay","laterTimestamp","earlierTimestamp","startOfYear","date_","getDayOfYear","startOfWeek","weekStartsOn","_b","_a","_d","_c","day","diff","startOfISOWeek","getISOWeekYear","year","fourthOfJanuaryOfNextYear","startOfNextYear","fourthOfJanuaryOfThisYear","startOfThisYear","startOfISOWeekYear","fourthOfJanuary","getISOWeek","getWeekYear","firstWeekContainsDate","firstWeekOfNextYear","firstWeekOfThisYear","startOfWeekYear","firstWeek","getWeek","addLeadingZeros","targetLength","sign","output","lightFormatters","signedYear","month","dayPeriodEnumValue","numberOfDigits","milliseconds","fractionalSeconds","dayPeriodEnum","formatters","era","signedWeekYear","weekYear","twoDigitYear","isoWeekYear","week","isoWeek","dayOfYear","dayOfWeek","localDayOfWeek","isoDayOfWeek","hours","_localize","timezoneOffset","formatTimezoneWithOptionalMinutes","formatTimezone","formatTimezoneShort","timestamp","offset","delimiter","absOffset","minutes","dateLongFormatter","timeLongFormatter","longFormatters","datePattern","timePattern","dateTimeFormat","dayOfYearTokenRE","weekYearTokenRE","throwTokens","isProtectedDayOfYearToken","isProtectedWeekYearToken","warnOrThrowProtectedError","format","input","_message","message","subject","isDate","isValid","formattingTokensRegExp","longFormattingTokensRegExp","escapedStringRegExp","doubleQuoteRegExp","unescapedLatinCharacterRegExp","formatStr","locale","defaultLocale","_f","_e","_h","_g","originalDate","parts","substring","firstCharacter","longFormatter","cleanEscapedString","formatterOptions","part","formatter","matched","addDays","amount","addMonths","dayOfMonth","endOfDesiredMonth","daysInMonth","startOfMonth","getDaysInMonth","monthIndex","lastDayOfMonth","getInternalDefaultOptions","getTime","getUnixTime","hoursToSeconds","minutesToHours","subMonths","tzIntlTimeZoneName","length","dtf","getDTF","partsTimeZone","hackyTimeZone","formatted","i","tzNameMatch","timeZone","tzTokenizeDate","getDateTimeFormat","partsOffset","hackyOffset","typeToPos","filled","pos","error","parsed","dtfCache","testDateFormatted","hourCycleSupported","newDateUTC","fullYear","hour","minute","second","millisecond","MILLISECONDS_IN_HOUR","MILLISECONDS_IN_MINUTE","patterns","tzParseTimezone","timezoneString","isUtcDate","absoluteOffset","validateTimezone","isValidTimezoneIANAString","toUtcDate","calcOffset","fixOffset","tokens","asUTC","asTS","over","utcGuess","o2","o3","validIANATimezoneCache","timeZoneString","getTimeZoneOffset","timeZoneOffset","tzPattern","DEFAULT_ADDITIONAL_DIGITS","additionalDigits","dateStrings","splitDateString","restDateString","parseYear","parseDate","time","parseTime","dateString","timeString","patternYYY","patternYYYYY","yearString","centuryString","validateDate","validateDayOfYearDate","validateWeekDate","dayOfISOWeekYear","validateTime","seconds","fourthOfJanuaryDay","DAYS_IN_MONTH","DAYS_IN_MONTH_LEAP_YEAR","isLeapYearIndex","isLeapYear","tzFormattingTokensRegExp","matches","precededByQuotedSection","replaced","dateFnsFormat","toZonedTime","offsetMilliseconds","resultDate","formatInTimeZone","fromZonedTime","utc","getTimezoneOffset","formatTimestamp","ts","tz","formatTime","timeFormat","formatTimeRange","start","end","Granularities","granularitiesToOptions","values","i18n","v","granularityMsToQuery","granularity","origin","msToGranularity","ms","k","toNearestTimeGrain","op","granularityMs","tzOffsetMs","floorToNearestTimeGrain","ceilToNearestTimeGrain","BaseQueryTime","timeframe","dataGranularity","__publicField","isRelative","periods","ceilEnd","rawStart","floorStart","periodOffset","TimeseriesQueryTime","fineGrain","UnaryQueryTime","DeltaQueryTime","LARGE_ARRAY_SIZE","HASH_UNDEFINED","MAX_SAFE_INTEGER","argsTag","arrayTag","boolTag","dateTag","errorTag","funcTag","genTag","mapTag","numberTag","objectTag","promiseTag","regexpTag","setTag","stringTag","symbolTag","weakMapTag","arrayBufferTag","dataViewTag","float32Tag","float64Tag","int8Tag","int16Tag","int32Tag","uint8Tag","uint8ClampedTag","uint16Tag","uint32Tag","reRegExpChar","reFlags","reIsHostCtor","reIsUint","cloneableTags","freeGlobal","global","freeSelf","root","freeExports","exports","freeModule","module","moduleExports","addMapEntry","map","pair","addSetEntry","set","arrayEach","iteratee","arrayPush","arrayReduce","accumulator","initAccum","baseTimes","n","getValue","isHostObject","mapToArray","overArg","func","transform","arg","setToArray","arrayProto","funcProto","objectProto","coreJsData","maskSrcKey","uid","funcToString","hasOwnProperty","objectToString","reIsNative","Buffer","Symbol","Uint8Array","getPrototype","objectCreate","propertyIsEnumerable","splice","nativeGetSymbols","nativeIsBuffer","nativeKeys","DataView","getNative","Map","Promise","Set","WeakMap","nativeCreate","dataViewCtorString","toSource","mapCtorString","promiseCtorString","setCtorString","weakMapCtorString","symbolProto","symbolValueOf","Hash","entries","entry","hashClear","hashDelete","hashGet","data","hashHas","hashSet","ListCache","listCacheClear","listCacheDelete","assocIndexOf","lastIndex","listCacheGet","listCacheHas","listCacheSet","MapCache","mapCacheClear","mapCacheDelete","getMapData","mapCacheGet","mapCacheHas","mapCacheSet","Stack","stackClear","stackDelete","stackGet","stackHas","stackSet","cache","pairs","arrayLikeKeys","inherited","isArray","isArguments","skipIndexes","isIndex","assignValue","objValue","eq","baseAssign","source","copyObject","keys","baseClone","isDeep","isFull","customizer","stack","isObject","isArr","initCloneArray","copyArray","tag","getTag","isFunc","isBuffer","cloneBuffer","initCloneObject","copySymbols","initCloneByTag","stacked","props","getAllKeys","subValue","baseCreate","proto","baseGetAllKeys","keysFunc","symbolsFunc","baseGetTag","baseIsNative","isMasked","isFunction","baseKeys","isPrototype","buffer","cloneArrayBuffer","arrayBuffer","cloneDataView","dataView","cloneMap","cloneFunc","cloneRegExp","regexp","cloneSet","cloneSymbol","symbol","cloneTypedArray","typedArray","newValue","getSymbols","isKeyable","stubArray","Ctor","ctorString","type","cloneDeep","other","isArrayLikeObject","isArrayLike","isLength","isObjectLike","stubFalse","adjustForTz","Timeframe","opts","_tz","allowedValues","tzNeutral","CurrentWeek","thisMonday","CurrentMonth","firstOfTheMonth","CurrentYear","firstOfTheYear","PreviousWeek","lastMonday","PreviousMonth","thisMonth","lastMonth","PreviousYear","thisYear","lastYear","TimePeriods","prevMonday","dstOffsetHours","datePickerSelectionToTimeframe","datePickerSelection","timeframeLength","timeframeToDatepickerSelection","timeframeToDatepickerTimeperiod","d1","d2","TIMEFRAME_LOOKUP","SeededRandom","seed","min","max","x","res","generateSingleMetricTimeSeriesData","metric","dimensionMap","metaOverrides","rand","rng","totalRequests","dimensionValue","event","record","displayBlob","meta","generateMultipleMetricTimeSeriesData","metrics","metricValues","units","generateCrossSectionalData","dimensionValues","createRecords","currentEvent","countries","country","getCountryName","country_code","addCommas","num","separator","out","digits","digit","formatDec","base","workingNum","ROUND","THOUSAND","TEN_THOUSAND","MILLION","BILLION","TRILLION","approximateNumber","numString","negative","thousandsBreak","numberFormatter","unitFormatter","formatBytes","isBytes1024","pb","tb","gb","mb","kb","formatCost","currency","unit","approximate","translateUnit","translatedUnit","approxNum","minVal","maxVal"],"mappings":"8aAIO,MAAMA,GAAwB,2BCH9B,IAAKC,GAAAA,IACVA,EAAA,YAAc,MACdA,EAAA,SAAW,KACXA,EAAA,SAAW,KACXA,EAAA,YAAc,MACdA,EAAA,QAAU,MACVA,EAAA,UAAY,KACZA,EAAA,WAAa,MACbA,EAAA,WAAa,MACbA,EAAA,uBAAyB,OACzBA,EAAA,SAAW,OACXA,EAAA,aAAe,eACfA,EAAA,cAAgB,gBAChBA,EAAA,gBAAkB,kBAClBA,EAAA,aAAe,eACfA,EAAA,cAAgB,gBAChBA,EAAA,eAAiB,iBACjBA,EAAA,iBAAmB,mBACnBA,EAAA,cAAgB,gBAlBNA,IAAAA,GAAA,CAAA,CAAA,ECiBL,MAAMC,GAAkC,CAAC,MAAO,OAAQ,OAAQ,eAAgB,eAAe,EClBzFC,GAAmB,CAC9B,iBACA,eACA,kBACA,iBACA,iBACA,QACA,cACF,ECPaC,GAAuB,CAAC,KAAM,SAAU,UAAU,EAIlDC,GAA4B,CAAC,IAAK,IAAI,EAItCC,GAA4B,CAAC,IAAK,KAAM,IAAK,IAAK,KAAM,IAAI,EAI5DC,GAA2B,CAAC,QAAS,WAAW,EAIhDC,GAA8B,CAAC,cAAe,WAAW,EAUzDC,GAAkB,CAAC,WAAY,UAAU,EAYzCC,GAA4B,CACvC,MACA,KACA,KACA,MACA,MACA,KACA,eACA,gBACA,MACA,gBACA,gBACF,EAkBaC,GAAoB,CAC/B,WACA,cACA,iBACA,WACA,eACA,cACA,iBACA,SACA,YACA,eACA,QACA,SACA,OACF,ECxEaC,GAAgDC,GAC3DA,EAAU,OAAOC,GAAKA,IAAM,MAAM,ECTvBC,GAAkC,CAC7C,MACA,cACA,cACA,sBACA,gBACA,sBACA,kBACA,kBACA,SACA,QACA,cACA,sBACA,MACF,EAIaC,GAAmCJ,GAAeG,EAA+B,EAcjFE,GAA2B,CACtC,kBACA,gBACA,qBACA,0BACF,ECpCaC,GAA6B,CACxC,GAAGH,GACH,cACA,WACA,eACA,uBACA,+BACA,kBACA,0BACA,OACF,EAIaI,GAA8BP,GAAeM,EAA0B,EAYvEE,GAAsB,CACjC,GAAGH,GACH,uBACA,uBACA,uBACA,uBACA,uBACA,uBACA,2BACA,mBACA,mBACA,mBACA,uBACA,oBACA,oBACA,oBACA,wBACA,oBACA,mBACA,mBACA,mBACA,uBACA,kBACF,EClDaI,GAA+B,CAC1C,gBACA,sBACA,kBACA,WACA,cACA,QACA,cACA,oBACA,mBACA,mBACA,0BACA,uBACA,OACA,QACA,cACA,sBACA,WACF,EAIaC,GAAgCV,GAAeS,EAA4B,EAY3EE,GAAwB,CACnC,eACA,gBACA,oBACA,mBACA,OACA,uCACA,kCACA,sBACA,wBACA,qBACF,EC5CaC,GAA6B,CACxC,MACA,cACA,cACA,sBACA,cACA,YACA,YACA,WACA,iBACA,gBACA,sBACA,eACA,kBACA,0BACA,kBACA,cACA,oBACA,cACA,SACA,QACA,aACA,cACA,+BACA,kBACA,QACA,eACA,mBACA,MACA,sBACA,OACA,WACA,eACA,+BACA,WACF,EAIaC,GAA8Bb,GAAeY,EAA0B,EAIvEE,GAAqC,CAChD,YACA,YACA,0BACA,cACA,oBACA,cACA,aACA,cACA,+BACA,kBACA,eACA,mBACA,WACA,cACF,EA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,MAAO,GAAGT,EAAYjD,EAAKkD,CAAW,CAAC,MAAMD,EAAYhD,EAAKiD,CAAW,CAAC,GAC5E,IAAK,MACH,MAAO,GAAGM,EAAWxD,EAAKyD,CAAQ,CAAC,MAAMD,EAAWvD,EAAKwD,CAAQ,CAAC,GACpE,IAAK,KACL,IAAK,eACL,IAAK,cACL,IAAK,QACL,QACE,GAAI,MAAMzD,CAAG,GAAK,MAAMC,CAAG,EACzB,MAAO,GAAGD,CAAG,MAAMC,CAAG,GAExB,GAAI0D,EACF,MAAO,GAAGG,GAAU9D,EAAK,CAAE,QAAS,GAAM,CAAC,MAAM8D,GAAU7D,EAAK,CAAE,QAAS,GAAM,CAAC,IAAI4D,CAAc,EACtG,CAEJ,MAAME,EAAS/D,GAAO,IAClB,GAAG+C,GAAgB,OAAO,OAAO,WAAW/C,EAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,GAC5D,GAAG,OAAO,WAAWA,EAAI,YAAY,CAAC,CAAC,CAAC,GAEtCgE,EAAS/D,GAAO,IAClB,GAAG8C,GAAgB,OAAO,OAAO,WAAW9C,EAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,GAC5D,GAAG,OAAO,WAAWA,EAAI,YAAY,CAAC,CAAC,CAAC,GAE5C,MAAO,GAAG8D,CAAM,MAAMC,CAAM,IAAIH,CAAc,EAChD,CAE8C,CAChD","x_google_ignoreList":[14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,76,82]}
1
+ {"version":3,"file":"vitals-utilities.umd.js","sources":["../src/constants.ts","../src/types/timeframe-keys.ts","../src/types/timeframe-options.ts","../src/types/chart-types.ts","../src/types/explore/common.ts","../src/types/explore/util.ts","../src/types/explore/basic.ts","../src/types/explore/advanced.ts","../src/types/explore/ai.ts","../src/types/explore/requests.ts","../src/types/explore/all.ts","../src/types/country-codes.ts","../src/dashboardSchema.v2.ts","../src/filters.ts","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatLong.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatRelative.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/localize.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchFn.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/match.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constants.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDayOfYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeek.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeekYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeekYear.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeek.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/addLeadingZeros.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/lightFormatters.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/formatters.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/longFormatters.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/protectedTokens.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/format.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addDays.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addMonths.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfMonth.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDaysInMonth.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDefaultOptions.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getTime.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getUnixTime.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/hoursToSeconds.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/minutesToHours.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/subMonths.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/tzIntlTimeZoneName/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/tzTokenizeDate/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/newDateUTC/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/tzParseTimezone/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/format/formatters/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/getTimezoneOffsetInMilliseconds/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/_lib/tzPattern/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/toDate/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/format/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/toZonedTime/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/formatInTimeZone/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/fromZonedTime/index.js","../../../../node_modules/.pnpm/date-fns-tz@3.2.0_date-fns@4.1.0/node_modules/date-fns-tz/dist/esm/getTimezoneOffset/index.js","../src/format.ts","../src/granularity.ts","../src/queryTime.ts","../../../../node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.js","../src/timeframes.ts","../src/utils/SeedRandom.ts","../src/utils/chartDataGenerator.ts","../src/utils/helpers.ts","../src/utils/GeoLookup.ts","../../../../node_modules/.pnpm/approximate-number@2.1.1/node_modules/approximate-number/lib/approximate-number.js","../src/utils/formatUnit.ts"],"sourcesContent":["export const REFRESH_INTERVAL_MS = 30 * 1000\n\nexport const EXPORT_RECORD_LIMIT = 1000\n\nexport const INJECT_QUERY_PROVIDER = 'analytics-query-provider'\n","\nexport enum TimeframeKeys {\n FIFTEEN_MIN = '15m',\n ONE_HOUR = '1h',\n SIX_HOUR = '6h',\n TWELVE_HOUR = '12h',\n ONE_DAY = '24h',\n SEVEN_DAY = '7d',\n THIRTY_DAY = '30d',\n NINETY_DAY = '90d',\n ONE_HUNDRED_EIGHTY_DAY = '180d',\n ONE_YEAR = '365d',\n CURRENT_WEEK = 'current_week',\n CURRENT_MONTH = 'current_month',\n CURRENT_QUARTER = 'current_quarter',\n CURRENT_YEAR = 'current_year',\n PREVIOUS_WEEK = 'previous_week',\n PREVIOUS_MONTH = 'previous_month',\n PREVIOUS_QUARTER = 'previous_quarter',\n PREVIOUS_YEAR = 'previous_year',\n}\n","import type { GranularityValues, RelativeTimeRangeValuesV4 } from './explore'\n\nexport interface TimeframeOptions {\n key: RelativeTimeRangeValuesV4 | ExtendedRelativeTimeRangeValues | 'custom'\n timeframeText: string\n display: string\n defaultResponseGranularity: GranularityValues\n dataGranularity: GranularityValues\n isRelative: boolean\n timeframeLength: () => number\n allowedTiers: string[]\n startCustom?: Date\n endCustom?: Date\n allowedGranularitiesOverride?: GranularityValues[]\n fineGrainedDefaultGranularity?: GranularityValues\n}\n\n// Supported by time periods, but not supported in Explore APIs.\nexport const extendedRelativeTimeRangeValues = ['90d', '180d', '365d', 'current_year', 'previous_year'] as const\nexport type ExtendedRelativeTimeRangeValues = typeof extendedRelativeTimeRangeValues[number]\n","export const reportChartTypes = [\n 'horizontal_bar',\n 'vertical_bar',\n 'timeseries_line',\n 'choropleth_map',\n 'timeseries_bar',\n 'donut',\n 'single_value',\n] as const\n\nexport type ReportChartTypes = typeof reportChartTypes[number]\n","\nexport const exploreFilterTypesV2 = ['in', 'not_in', 'selector'] as const\n\nexport type ExploreFilterTypesV2 = typeof exploreFilterTypesV2[number]\n\nexport const requestFilterTypeEqualsV2 = ['=', '!='] as const\n\nexport type RequestFilterTypeEqualsV2 = typeof requestFilterTypeEqualsV2[number]\n\nexport const requestFilterTypeMetricV2 = ['=', '!=', '<', '>', '<=', '>='] as const\n\nexport type RequestFilterTypeMetricV2 = typeof requestFilterTypeMetricV2[number]\n\nexport const requestFilterTypeEmptyV2 = ['empty', 'not_empty'] as const\n\nexport type RequestFilterTypeEmptyV2 = typeof requestFilterTypeEmptyV2[number]\n\nexport const requestFilterTypeWildcardV2 = ['starts_with', 'ends_with'] as const\n\nexport type RequestFilterTypeWildcardV2 = typeof requestFilterTypeWildcardV2[number]\n\n\n// Note: time types are common to all of the datasources.\n// If a datasource doesn't support a certain time range / time spec, it returns no records\n// rather than failing.\n// If a datasource doesn't support a certain granularity, it rounds to the nearest granularity it does support.\n\nexport const timeRangeTypeV2 = ['absolute', 'relative'] as const\n\nexport type TimeRangeTypeV2 = typeof timeRangeTypeV2[number]\n\n\nexport interface AbsoluteTimeRangeV4 {\n type: 'absolute'\n tz?: string\n start: Date\n end: Date\n}\n\nexport const relativeTimeRangeValuesV4 = [\n '15m',\n '1h',\n '6h',\n '12h',\n '24h',\n '7d',\n 'current_week',\n 'previous_week',\n '30d',\n 'current_month',\n 'previous_month',\n] as const\n\nexport type RelativeTimeRangeValuesV4 = typeof relativeTimeRangeValuesV4[number]\n\nexport interface RelativeTimeRangeV4 {\n type: 'relative'\n tz?: string\n time_range: RelativeTimeRangeValuesV4\n}\n\nexport type TimeRangeV4 = AbsoluteTimeRangeV4 | RelativeTimeRangeV4\n\nexport interface TimeRangeMetaResponse {\n start: string\n end: string\n min_granularity_ms: number\n}\n\nexport const granularityValues = [\n 'secondly',\n 'tenSecondly',\n 'thirtySecondly',\n 'minutely',\n 'fiveMinutely',\n 'tenMinutely',\n 'thirtyMinutely',\n 'hourly',\n 'twoHourly',\n 'twelveHourly',\n 'daily',\n 'weekly',\n 'trend',\n] as const\n\nexport type GranularityValues = typeof granularityValues[number]\n","// Utility types for `makeFilterable`.\n// In essence: recurse through the tuple type `T` and exclude elements that match `E`.\n// https://stackoverflow.com/questions/58984164/typescript-filter-tuple-type-by-an-arbitrary-type\ntype ExcludeFromTuple<T extends readonly any[], E> =\n T extends readonly [infer F, ...infer R] ? [F] extends readonly [E] ? ExcludeFromTuple<R, E> :\n [F, ...ExcludeFromTuple<R, E>] : []\n\n// Basically, all dimensions are filterable except for time.\ntype ExceptTime<T extends readonly any[]> = ExcludeFromTuple<T, 'time'>\n\n// Utility for deriving filterable dimensions from queryable dimensions with correct types.\nexport const makeFilterable = <T extends readonly unknown[]>(queryable: T) =>\n queryable.filter(d => d !== 'time') as ExceptTime<T>\n","import { makeFilterable } from './util'\nimport type { ExploreFilterTypesV2, GranularityValues, RequestFilterTypeEmptyV2, TimeRangeV4 } from './common'\n\nexport const queryableBasicExploreDimensions = [\n 'api',\n 'api_package',\n 'api_product',\n 'api_product_version',\n 'control_plane',\n 'control_plane_group',\n 'data_plane_node',\n 'gateway_service',\n 'portal',\n 'route',\n 'status_code',\n 'status_code_grouped',\n 'time',\n] as const\n\nexport type QueryableBasicExploreDimensions = typeof queryableBasicExploreDimensions[number]\n\nexport const filterableBasicExploreDimensions = makeFilterable(queryableBasicExploreDimensions)\n\nexport type FilterableBasicExploreDimensions = typeof filterableBasicExploreDimensions[number]\n\nexport interface BasicExploreInFilterV2 {\n operator: ExploreFilterTypesV2\n field: FilterableBasicExploreDimensions\n value: Array<string | number | null>\n}\n\nexport interface BasicExploreEmptyFilterV2 {\n operator: RequestFilterTypeEmptyV2\n field: FilterableBasicExploreDimensions\n}\nexport const basicExploreAggregations = [\n 'active_services',\n 'request_count',\n 'request_per_minute',\n 'response_latency_average',\n] as const\n\nexport type BasicExploreAggregations = typeof basicExploreAggregations[number]\n\nexport type BasicExploreFilterAll = BasicExploreInFilterV2 | BasicExploreEmptyFilterV2\n\nexport interface BasicExploreQuery {\n metrics?: BasicExploreAggregations[]\n dimensions?: QueryableBasicExploreDimensions[]\n filters?: BasicExploreFilterAll[]\n granularity?: GranularityValues\n time_range?: TimeRangeV4\n limit?: number\n descending?: boolean\n short_name?: boolean\n meta?: {\n query_id: string\n }\n}\n","import { makeFilterable } from './util'\nimport type { BasicExploreEmptyFilterV2, BasicExploreInFilterV2, BasicExploreQuery } from './basic'\nimport { basicExploreAggregations, queryableBasicExploreDimensions } from './basic'\n\nexport const queryableExploreDimensions = [\n ...queryableBasicExploreDimensions,\n 'application',\n 'consumer',\n 'country_code',\n 'upstream_status_code',\n 'upstream_status_code_grouped',\n 'response_source',\n 'data_plane_node_version',\n 'realm',\n 'portal_api',\n] as const\n\nexport type QueryableExploreDimensions = typeof queryableExploreDimensions[number]\n\nexport const filterableExploreDimensions = makeFilterable(queryableExploreDimensions)\n\nexport type FilterableExploreDimensions = typeof filterableExploreDimensions[number]\n\nexport interface ExploreInFilterV2 extends Omit<BasicExploreInFilterV2, 'field'> {\n field: FilterableExploreDimensions\n}\n\nexport interface ExploreEmptyFilterV2 extends Omit<BasicExploreEmptyFilterV2, 'field'> {\n field: FilterableExploreDimensions\n}\n\nexport const exploreAggregations = [\n ...basicExploreAggregations,\n 'response_latency_p99',\n 'response_latency_p95',\n 'response_latency_p50',\n 'upstream_latency_p99',\n 'upstream_latency_p95',\n 'upstream_latency_p50',\n 'upstream_latency_average',\n 'kong_latency_p99',\n 'kong_latency_p95',\n 'kong_latency_p50',\n 'kong_latency_average',\n 'response_size_p99',\n 'response_size_p95',\n 'response_size_p50',\n 'response_size_average',\n 'response_size_sum',\n 'request_size_p99',\n 'request_size_p95',\n 'request_size_p50',\n 'request_size_average',\n 'request_size_sum',\n] as const\n\nexport type ExploreAggregations = typeof exploreAggregations[number]\n\nexport type ExploreFilterAll = ExploreInFilterV2 | ExploreEmptyFilterV2\n\nexport interface ExploreQuery extends Omit<BasicExploreQuery, 'metrics' | 'dimensions' | 'filters'> {\n metrics?: ExploreAggregations[]\n dimensions?: QueryableExploreDimensions[]\n filters?: ExploreFilterAll[]\n}\n","import { makeFilterable } from './util'\nimport type { BasicExploreEmptyFilterV2, BasicExploreInFilterV2, BasicExploreQuery } from './basic'\n\nexport const queryableAiExploreDimensions = [\n 'control_plane',\n 'control_plane_group',\n 'gateway_service',\n 'consumer',\n 'application',\n 'route',\n 'ai_provider',\n 'ai_response_model',\n 'ai_request_model',\n 'llm_cache_status',\n 'llm_embeddings_provider',\n 'llm_embeddings_model',\n 'time',\n 'realm',\n 'status_code',\n 'status_code_grouped',\n 'ai_plugin',\n] as const\n\nexport type QueryableAiExploreDimensions = typeof queryableAiExploreDimensions[number]\n\nexport const filterableAiExploreDimensions = makeFilterable(queryableAiExploreDimensions)\n\nexport type FilterableAiExploreDimensions = typeof queryableAiExploreDimensions[number]\n\nexport interface AiExploreInFilterV2 extends Omit<BasicExploreInFilterV2, 'field'> {\n field: FilterableAiExploreDimensions\n}\n\nexport interface AiExploreEmptyFilterV2 extends Omit<BasicExploreEmptyFilterV2, 'field'> {\n field: FilterableAiExploreDimensions\n}\n\nexport const aiExploreAggregations = [\n 'total_tokens',\n 'prompt_tokens',\n 'completion_tokens',\n 'ai_request_count',\n 'cost',\n 'llm_cache_embeddings_latency_average',\n 'llm_cache_fetch_latency_average',\n 'llm_latency_average',\n 'llm_embeddings_tokens',\n 'llm_embeddings_cost',\n] as const\n\nexport type AiExploreAggregations = typeof aiExploreAggregations[number]\n\nexport type AiExploreFilterAll = AiExploreInFilterV2 | AiExploreEmptyFilterV2\n\nexport interface AiExploreQuery extends Omit<BasicExploreQuery, 'metrics' | 'dimensions' | 'filters'> {\n metrics?: AiExploreAggregations[]\n dimensions?: QueryableAiExploreDimensions[]\n filters?: AiExploreFilterAll[]\n}\n\n","import { makeFilterable } from './util'\nimport type { AbsoluteTimeRangeV4, ExploreFilterTypesV2, RequestFilterTypeEmptyV2, RequestFilterTypeEqualsV2, RequestFilterTypeMetricV2, RequestFilterTypeWildcardV2 } from './common'\n\n// status_code and upstream_status_code are treated as metric filters\nexport const queryableRequestDimensions = [\n 'api',\n 'api_package',\n 'api_product',\n 'api_product_version',\n 'application',\n 'auth_type',\n 'client_ip',\n 'consumer',\n 'consumer_group',\n 'control_plane',\n 'control_plane_group',\n 'country_code',\n 'data_plane_node',\n 'data_plane_node_version',\n 'gateway_service',\n 'header_host',\n 'header_user_agent',\n 'http_method',\n 'portal',\n 'realm',\n 'request_id',\n 'request_uri',\n 'response_header_content_type',\n 'response_source',\n 'route',\n 'service_port',\n 'service_protocol',\n 'sse',\n 'status_code_grouped',\n 'time',\n 'trace_id',\n 'upstream_uri',\n 'upstream_status_code_grouped',\n 'websocket',\n] as const\n\nexport type QueryableRequestDimensions = typeof queryableRequestDimensions[number]\n\nexport const filterableRequestDimensions = makeFilterable(queryableRequestDimensions)\n\nexport type FilterableRequestDimensions = typeof filterableRequestDimensions[number]\n\nexport const queryableRequestWildcardDimensions = [\n 'auth_type',\n 'client_ip',\n 'data_plane_node_version',\n 'header_host',\n 'header_user_agent',\n 'http_method',\n 'request_id',\n 'request_uri',\n 'response_header_content_type',\n 'response_source',\n 'service_port',\n 'service_protocol',\n 'trace_id',\n 'upstream_uri',\n] as const\n\nexport type QueryableRequestWildcardDimensions = typeof queryableRequestWildcardDimensions[number]\n\nexport const filterableRequestWildcardDimensions = queryableRequestWildcardDimensions\n\nexport type FilterableRequestWildcardDimensions = typeof filterableRequestWildcardDimensions[number]\n\nexport const queryableRequestMetrics = [\n 'ai_count',\n 'latencies_response_ms',\n 'latencies_upstream_ms',\n 'latencies_kong_gateway_ms',\n 'request_body_size',\n 'response_body_size',\n 'response_header_content_length',\n 'status_code',\n 'upstream_status_code',\n] as const\n\nexport type QueryableRequestMetrics = typeof queryableRequestMetrics[number]\n\nexport const filterableRequestMetrics = makeFilterable(queryableRequestMetrics)\n\nexport type FilterableRequestMetrics = typeof filterableRequestMetrics[number]\n\nexport interface RequestInFilter {\n operator: ExploreFilterTypesV2\n field: FilterableRequestDimensions | FilterableRequestWildcardDimensions | FilterableRequestMetrics\n value: Array<string | number>\n}\nexport interface RequestEqualsFilter {\n operator: RequestFilterTypeEqualsV2\n field: FilterableRequestDimensions | FilterableRequestWildcardDimensions\n value: string\n}\nexport interface RequestMetricFilter {\n operator: RequestFilterTypeMetricV2\n field: FilterableRequestMetrics\n value: number\n}\nexport interface RequestEmptyFilter {\n operator: RequestFilterTypeEmptyV2\n field: FilterableRequestDimensions | FilterableRequestWildcardDimensions | FilterableRequestMetrics\n}\nexport interface RequestWildcardFilter {\n operator: RequestFilterTypeWildcardV2\n field: FilterableRequestWildcardDimensions\n value: string\n}\n\nexport type RequestFilter = RequestInFilter |\n RequestEqualsFilter |\n RequestMetricFilter |\n RequestEmptyFilter |\n RequestWildcardFilter\n\nexport const relativeTimeRangeValuesRequestV2 = [\n '15M',\n '1H',\n '6H',\n '12H',\n '24H',\n '7D',\n] as const\n\nexport type RelativeTimeRangeValuesRequestV2 = typeof relativeTimeRangeValuesRequestV2[number]\n\nexport interface RelativeTimeRangeRequestV2 {\n type: 'relative'\n tz?: string\n time_range: RelativeTimeRangeValuesRequestV2\n}\n\nexport type TimeRangeRequestV2 = AbsoluteTimeRangeV4 | RelativeTimeRangeRequestV2\n\nexport interface RequestQuery {\n filters: RequestFilter[]\n time_range: TimeRangeRequestV2\n order?: string\n offset?: number\n size?: number\n query_id?: string\n limit?: number\n classified?: boolean\n}\n","import { type BasicExploreAggregations, type BasicExploreFilterAll, type FilterableBasicExploreDimensions, filterableBasicExploreDimensions } from './basic'\nimport { type AiExploreAggregations, type AiExploreFilterAll, type FilterableAiExploreDimensions, filterableAiExploreDimensions } from './ai'\nimport { type ExploreAggregations, type ExploreFilterAll, type FilterableExploreDimensions, filterableExploreDimensions } from './advanced'\nimport { type FilterableRequestDimensions, type FilterableRequestMetrics, type FilterableRequestWildcardDimensions } from './requests'\n\nexport type AllAggregations = BasicExploreAggregations | AiExploreAggregations | ExploreAggregations\nexport type AllFilters = BasicExploreFilterAll | AiExploreFilterAll | ExploreFilterAll\nexport type AllFilterableDimensionsAndMetrics = FilterableExploreDimensions\n | FilterableAiExploreDimensions\n | FilterableBasicExploreDimensions\n | FilterableRequestDimensions\n | FilterableRequestMetrics\n | FilterableRequestWildcardDimensions\n\nexport const queryDatasources = ['basic', 'api_usage', 'llm_usage'] as const\n\nexport type QueryDatasource = typeof queryDatasources[number]\n\nexport type FilterDatasource = QueryDatasource | 'requests'\n\nexport interface FilterTypeMap extends Record<QueryDatasource, AllFilters> {\n basic: BasicExploreFilterAll\n api_usage: ExploreFilterAll\n llm_usage: AiExploreFilterAll\n}\n\nexport const datasourceToFilterableDimensions: Record<QueryDatasource, Set<string>> = {\n basic: new Set(filterableBasicExploreDimensions),\n api_usage: new Set(filterableExploreDimensions),\n llm_usage: new Set(filterableAiExploreDimensions),\n} as const\n\n// Utility for stripping unknown filters\nexport const stripUnknownFilters = <K extends keyof typeof datasourceToFilterableDimensions>(datasource: K, filters: AllFilters[]): Array<FilterTypeMap[K]> => {\n if (datasource.startsWith('goap')) {\n // We currently can't determine the type for goap datasources as it could be\n // anything so we have to just trust that valid filters were applied\n return filters as any\n }\n\n // Note: once we extend API request filters, this may need to look at more than just dimensions.\n // Note the cast; we could potentially try to derive the type, but it doesn't seem worth it.\n return filters.filter(f => datasourceToFilterableDimensions[datasource].has(f.field)) as Array<FilterTypeMap[K]>\n}\n\n// TODO: Add utility func for marking unknown filters (but not stripping them).\n","export const COUNTRIES = [\n { code: 'AF', name: 'Afghanistan' },\n { code: 'AX', name: 'Aland Islands' },\n { code: 'AL', name: 'Albania' },\n { code: 'DZ', name: 'Algeria' },\n { code: 'AS', name: 'American Samoa' },\n { code: 'AD', name: 'Andorra' },\n { code: 'AO', name: 'Angola' },\n { code: 'AI', name: 'Anguilla' },\n { code: 'AQ', name: 'Antarctica' },\n { code: 'AG', name: 'Antigua and Barbuda' },\n { code: 'AR', name: 'Argentina' },\n { code: 'AM', name: 'Armenia' },\n { code: 'AW', name: 'Aruba' },\n { code: 'AU', name: 'Australia' },\n { code: 'AT', name: 'Austria' },\n { code: 'AZ', name: 'Azerbaijan' },\n { code: 'BS', name: 'Bahamas' },\n { code: 'BH', name: 'Bahrain' },\n { code: 'BD', name: 'Bangladesh' },\n { code: 'BB', name: 'Barbados' },\n { code: 'BY', name: 'Belarus' },\n { code: 'BE', name: 'Belgium' },\n { code: 'BZ', name: 'Belize' },\n { code: 'BJ', name: 'Benin' },\n { code: 'BM', name: 'Bermuda' },\n { code: 'BT', name: 'Bhutan' },\n { code: 'BO', name: 'Bolivia' },\n { code: 'BA', name: 'Bosnia and Herzegovina' },\n { code: 'BW', name: 'Botswana' },\n { code: 'BV', name: 'Bouvet Island' },\n { code: 'BR', name: 'Brazil' },\n { code: 'IO', name: 'British Indian Ocean Territory' },\n { code: 'BN', name: 'Brunei Darussalam' },\n { code: 'BG', name: 'Bulgaria' },\n { code: 'BF', name: 'Burkina Faso' },\n { code: 'BI', name: 'Burundi' },\n { code: 'KH', name: 'Cambodia' },\n { code: 'CM', name: 'Cameroon' },\n { code: 'CA', name: 'Canada' },\n { code: 'CV', name: 'Cape Verde' },\n { code: 'KY', name: 'Cayman Islands' },\n { code: 'CF', name: 'Central African Republic' },\n { code: 'TD', name: 'Chad' },\n { code: 'CL', name: 'Chile' },\n { code: 'CN', name: 'China' },\n { code: 'CX', name: 'Christmas Island' },\n { code: 'CC', name: 'Cocos (Keeling) Islands' },\n { code: 'CO', name: 'Colombia' },\n { code: 'KM', name: 'Comoros' },\n { code: 'CG', name: 'Congo' },\n { code: 'CD', name: 'Democratic Republic of the Congo' },\n { code: 'CK', name: 'Cook Islands' },\n { code: 'CR', name: 'Costa Rica' },\n { code: 'CI', name: \"Cote d'Ivoire\" },\n { code: 'HR', name: 'Croatia' },\n { code: 'CU', name: 'Cuba' },\n { code: 'CY', name: 'Cyprus' },\n { code: 'CZ', name: 'Czech Republic' },\n { code: 'DK', name: 'Denmark' },\n { code: 'DJ', name: 'Djibouti' },\n { code: 'DM', name: 'Dominica' },\n { code: 'DO', name: 'Dominican Republic' },\n { code: 'EC', name: 'Ecuador' },\n { code: 'EG', name: 'Egypt' },\n { code: 'SV', name: 'El Salvador' },\n { code: 'GQ', name: 'Equatorial Guinea' },\n { code: 'ER', name: 'Eritrea' },\n { code: 'EE', name: 'Estonia' },\n { code: 'ET', name: 'Ethiopia' },\n { code: 'FK', name: 'Falkland Islands (Malvinas)' },\n { code: 'FO', name: 'Faroe Islands' },\n { code: 'FJ', name: 'Fiji' },\n { code: 'FI', name: 'Finland' },\n { code: 'FR', name: 'France' },\n { code: 'GF', name: 'French Guiana' },\n { code: 'PF', name: 'French Polynesia' },\n { code: 'TF', name: 'French Southern Territories' },\n { code: 'GA', name: 'Gabon' },\n { code: 'GM', name: 'Gambia' },\n { code: 'GE', name: 'Georgia' },\n { code: 'DE', name: 'Germany' },\n { code: 'GH', name: 'Ghana' },\n { code: 'GI', name: 'Gibraltar' },\n { code: 'GR', name: 'Greece' },\n { code: 'GL', name: 'Greenland' },\n { code: 'GD', name: 'Grenada' },\n { code: 'GP', name: 'Guadeloupe' },\n { code: 'GU', name: 'Guam' },\n { code: 'GT', name: 'Guatemala' },\n { code: 'GG', name: 'Guernsey' },\n { code: 'GN', name: 'Guinea' },\n { code: 'GW', name: 'Guinea-Bissau' },\n { code: 'GY', name: 'Guyana' },\n { code: 'HT', name: 'Haiti' },\n { code: 'HM', name: 'Heard Island and McDonald Islands' },\n { code: 'VA', name: 'The Vatican' },\n { code: 'HN', name: 'Honduras' },\n { code: 'HK', name: 'Hong Kong' },\n { code: 'HU', name: 'Hungary' },\n { code: 'IS', name: 'Iceland' },\n { code: 'IN', name: 'India' },\n { code: 'ID', name: 'Indonesia' },\n { code: 'IR', name: 'Iran' },\n { code: 'IQ', name: 'Iraq' },\n { code: 'IE', name: 'Ireland' },\n { code: 'IM', name: 'Isle of Man' },\n { code: 'IL', name: 'Israel' },\n { code: 'IT', name: 'Italy' },\n { code: 'JM', name: 'Jamaica' },\n { code: 'JP', name: 'Japan' },\n { code: 'JE', name: 'Jersey' },\n { code: 'JO', name: 'Jordan' },\n { code: 'KZ', name: 'Kazakhstan' },\n { code: 'KE', name: 'Kenya' },\n { code: 'KI', name: 'Kiribati' },\n { code: 'KP', name: 'North Korea' },\n { code: 'KR', name: 'South Korea' },\n { code: 'KW', name: 'Kuwait' },\n { code: 'KG', name: 'Kyrgyzstan' },\n { code: 'LA', name: 'Laos' },\n { code: 'LV', name: 'Latvia' },\n { code: 'LB', name: 'Lebanon' },\n { code: 'LS', name: 'Lesotho' },\n { code: 'LR', name: 'Liberia' },\n { code: 'LY', name: 'Libya' },\n { code: 'LI', name: 'Liechtenstein' },\n { code: 'LT', name: 'Lithuania' },\n { code: 'LU', name: 'Luxembourg' },\n { code: 'MO', name: 'Macao' },\n { code: 'MK', name: 'Macedonia' },\n { code: 'MG', name: 'Madagascar' },\n { code: 'MW', name: 'Malawi' },\n { code: 'MY', name: 'Malaysia' },\n { code: 'MV', name: 'Maldives' },\n { code: 'ML', name: 'Mali' },\n { code: 'MT', name: 'Malta' },\n { code: 'MH', name: 'Marshall Islands' },\n { code: 'MQ', name: 'Martinique' },\n { code: 'MR', name: 'Mauritania' },\n { code: 'MU', name: 'Mauritius' },\n { code: 'YT', name: 'Mayotte' },\n { code: 'MX', name: 'Mexico' },\n { code: 'FM', name: 'Micronesia, ' },\n { code: 'MD', name: 'Moldova,' },\n { code: 'MC', name: 'Monaco' },\n { code: 'MN', name: 'Mongolia' },\n { code: 'ME', name: 'Montenegro' },\n { code: 'MS', name: 'Montserrat' },\n { code: 'MA', name: 'Morocco' },\n { code: 'MZ', name: 'Mozambique' },\n { code: 'MM', name: 'Myanmar' },\n { code: 'NA', name: 'Namibia' },\n { code: 'NR', name: 'Nauru' },\n { code: 'NP', name: 'Nepal' },\n { code: 'NL', name: 'Netherlands' },\n { code: 'NC', name: 'New Caledonia' },\n { code: 'NZ', name: 'New Zealand' },\n { code: 'NI', name: 'Nicaragua' },\n { code: 'NE', name: 'Niger' },\n { code: 'NG', name: 'Nigeria' },\n { code: 'NU', name: 'Niue' },\n { code: 'NF', name: 'Norfolk Island' },\n { code: 'MP', name: 'Northern Mariana Islands' },\n { code: 'NO', name: 'Norway' },\n { code: 'OM', name: 'Oman' },\n { code: 'PK', name: 'Pakistan' },\n { code: 'PW', name: 'Palau' },\n { code: 'PA', name: 'Panama' },\n { code: 'PG', name: 'Papua New Guinea' },\n { code: 'PY', name: 'Paraguay' },\n { code: 'PE', name: 'Peru' },\n { code: 'PH', name: 'Philippines' },\n { code: 'PN', name: 'Pitcairn' },\n { code: 'PL', name: 'Poland' },\n { code: 'PT', name: 'Portugal' },\n { code: 'PR', name: 'Puerto Rico' },\n { code: 'QA', name: 'Qatar' },\n { code: 'RE', name: 'Reunion' },\n { code: 'RO', name: 'Romania' },\n { code: 'RU', name: 'Russia' },\n { code: 'RW', name: 'Rwanda' },\n { code: 'BL', name: 'Saint Barthelemy' },\n { code: 'SH', name: 'Saint Helena' },\n { code: 'KN', name: 'Saint Kitts and Nevis' },\n { code: 'LC', name: 'Saint Lucia' },\n { code: 'MF', name: 'Saint Martin' },\n { code: 'PM', name: 'Saint Pierre and Miquelon' },\n { code: 'VC', name: 'Saint Vincent and the Grenadines' },\n { code: 'WS', name: 'Samoa' },\n { code: 'SM', name: 'San Marino' },\n { code: 'ST', name: 'Sao Tome and Principe' },\n { code: 'SA', name: 'Saudi Arabia' },\n { code: 'SN', name: 'Senegal' },\n { code: 'RS', name: 'Serbia' },\n { code: 'SC', name: 'Seychelles' },\n { code: 'SL', name: 'Sierra Leone' },\n { code: 'SG', name: 'Singapore' },\n { code: 'SX', name: 'Sint Maarten' },\n { code: 'SK', name: 'Slovakia' },\n { code: 'SI', name: 'Slovenia' },\n { code: 'SB', name: 'Solomon Islands' },\n { code: 'SO', name: 'Somalia' },\n { code: 'ZA', name: 'South Africa' },\n { code: 'GS', name: 'South Georgia and the South Sandwich Islands' },\n { code: 'SS', name: 'South Sudan' },\n { code: 'ES', name: 'Spain' },\n { code: 'LK', name: 'Sri Lanka' },\n { code: 'SD', name: 'Sudan' },\n { code: 'SR', name: 'Suriname' },\n { code: 'SJ', name: 'Svalbard and Jan Mayen' },\n { code: 'SZ', name: 'Swaziland' },\n { code: 'SE', name: 'Sweden' },\n { code: 'CH', name: 'Switzerland' },\n { code: 'SY', name: 'Syria' },\n { code: 'TW', name: 'Taiwan' },\n { code: 'TJ', name: 'Tajikistan' },\n { code: 'TZ', name: 'Tanzania' },\n { code: 'TH', name: 'Thailand' },\n { code: 'TL', name: 'Timor-Leste' },\n { code: 'TG', name: 'Togo' },\n { code: 'TK', name: 'Tokelau' },\n { code: 'TO', name: 'Tonga' },\n { code: 'TT', name: 'Trinidad and Tobago' },\n { code: 'TN', name: 'Tunisia' },\n { code: 'TR', name: 'Turkey' },\n { code: 'TM', name: 'Turkmenistan' },\n { code: 'TC', name: 'Turks and Caicos Islands' },\n { code: 'TV', name: 'Tuvalu' },\n { code: 'UG', name: 'Uganda' },\n { code: 'UA', name: 'Ukraine' },\n { code: 'AE', name: 'United Arab Emirates' },\n { code: 'GB', name: 'United Kingdom' },\n { code: 'US', name: 'United States' },\n { code: 'UM', name: 'United States Minor Outlying Islands' },\n { code: 'UY', name: 'Uruguay' },\n { code: 'UZ', name: 'Uzbekistan' },\n { code: 'VU', name: 'Vanuatu' },\n { code: 'VE', name: 'Venezuela' },\n { code: 'VN', name: 'Vietnam' },\n { code: 'VG', name: 'British Virgin Islands' },\n { code: 'VI', name: 'U.S. Virgin Islands' },\n { code: 'WF', name: 'Wallis and Futuna' },\n { code: 'EH', name: 'Western Sahara' },\n { code: 'YE', name: 'Yemen' },\n { code: 'ZM', name: 'Zambia' },\n { code: 'ZW', name: 'Zimbabwe' },\n] as const\n\nexport type CountryISOA2 = typeof COUNTRIES[number]['code']\nexport type CountryIsoMap = { code: CountryISOA2, name: string }\n","import type { FromSchema, JSONSchema } from 'json-schema-to-ts'\nimport {\n aiExploreAggregations,\n basicExploreAggregations,\n exploreAggregations,\n exploreFilterTypesV2,\n filterableAiExploreDimensions,\n filterableBasicExploreDimensions,\n filterableExploreDimensions,\n granularityValues,\n queryableAiExploreDimensions,\n queryableBasicExploreDimensions,\n queryableExploreDimensions,\n relativeTimeRangeValuesV4,\n requestFilterTypeEmptyV2,\n} from './types'\nimport { COUNTRIES } from './types/country-codes'\n\ntype FromSchemaWithOptions<T extends JSONSchema> = FromSchema<T, { keepDefaultedPropertiesOptional: true }>\n\n// TODO: Once we support all chart types, this could potentially be replaced with a direct reference to `chartTypes`.\n// This is partially overlapping with analytics chart types, but not strictly so.\nexport const dashboardTileTypes = [\n 'horizontal_bar',\n 'vertical_bar',\n 'gauge',\n 'donut',\n 'timeseries_line',\n 'timeseries_bar',\n 'golden_signals',\n 'top_n',\n 'slottable',\n 'single_value',\n 'choropleth_map',\n] as const\nexport type DashboardTileType = typeof dashboardTileTypes[number]\n\n// Common definition for many ChartJS tiles.\nconst syntheticsDataKey = {\n type: 'string',\n} as const\n\nconst chartTitle = {\n type: 'string',\n} as const\n\nconst allowCsvExport = {\n type: 'boolean',\n} as const\n\nconst chartDatasetColorsSchema = {\n type: ['object', 'array'],\n items: {\n type: 'string',\n },\n additionalProperties: {\n type: 'string',\n },\n} as const satisfies JSONSchema\n\nexport const slottableSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['slottable'],\n },\n id: {\n type: 'string',\n },\n },\n required: ['type', 'id'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type SlottableOptions = FromSchemaWithOptions<typeof slottableSchema>\n\nexport const barChartSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['horizontal_bar', 'vertical_bar'],\n },\n stacked: {\n type: 'boolean',\n },\n chart_dataset_colors: chartDatasetColorsSchema,\n synthetics_data_key: syntheticsDataKey,\n chart_title: chartTitle,\n allow_csv_export: allowCsvExport,\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type BarChartOptions = FromSchemaWithOptions<typeof barChartSchema>\n\nexport const thresholdSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['warning', 'error', 'neutral'],\n },\n value: {\n type: 'number',\n },\n label: {\n type: 'string',\n },\n highlightIntersections: {\n type: 'boolean',\n default: false,\n },\n },\n required: ['type', 'value'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport const timeseriesChartSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['timeseries_line', 'timeseries_bar'],\n },\n stacked: {\n type: 'boolean',\n },\n threshold: {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: thresholdSchema,\n },\n },\n chart_dataset_colors: chartDatasetColorsSchema,\n synthetics_data_key: syntheticsDataKey,\n chart_title: chartTitle,\n allow_csv_export: allowCsvExport,\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type TimeseriesChartOptions = FromSchemaWithOptions<typeof timeseriesChartSchema>\n\nexport const gaugeChartSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['gauge'],\n },\n metric_display: {\n type: 'string',\n enum: ['hidden', 'single', 'full'], // This matches the SimpleChartMetricDisplay type.\n },\n reverse_dataset: {\n type: 'boolean',\n },\n numerator: {\n type: 'number',\n },\n synthetics_data_key: syntheticsDataKey,\n chart_title: chartTitle,\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type GaugeChartOptions = FromSchemaWithOptions<typeof gaugeChartSchema>\n\nexport const donutChartSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['donut'],\n },\n synthetics_data_key: syntheticsDataKey,\n chart_title: chartTitle,\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type DonutChartOptions = FromSchemaWithOptions<typeof donutChartSchema>\n\nexport const topNTableSchema = {\n type: 'object',\n properties: {\n chart_title: chartTitle,\n synthetics_data_key: syntheticsDataKey,\n type: {\n type: 'string',\n enum: ['top_n'],\n },\n description: {\n type: 'string',\n },\n entity_link: {\n type: 'string',\n },\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type TopNTableOptions = FromSchemaWithOptions<typeof topNTableSchema>\n\nexport const metricCardSchema = {\n type: 'object',\n properties: {\n chart_title: chartTitle,\n type: {\n type: 'string',\n enum: ['golden_signals'],\n },\n long_card_titles: {\n type: 'boolean',\n },\n description: {\n type: 'string',\n },\n percentile_latency: {\n type: 'boolean',\n },\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type MetricCardOptions = FromSchemaWithOptions<typeof metricCardSchema>\n\nexport const singleValueSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['single_value'],\n },\n decimal_points: {\n type: 'number',\n },\n chart_title: chartTitle,\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type SingleValueOptions = FromSchemaWithOptions<typeof singleValueSchema>\n\nexport const choroplethMapSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['choropleth_map'],\n },\n chart_title: chartTitle,\n fit_to_country: {\n type: 'string',\n enum: COUNTRIES.map(c => c.code),\n },\n legend: {\n type: 'boolean',\n default: false,\n },\n bounds: {\n type: 'array',\n minItems: 2,\n maxItems: 2,\n items: {\n type: 'array',\n minItems: 2,\n maxItems: 2,\n items: [\n { type: 'number', minimum: -180, maximum: 180 },\n { type: 'number', minimum: -90, maximum: 90 },\n ],\n },\n },\n },\n required: ['type'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type ChoroplethMapOptions = FromSchemaWithOptions<typeof choroplethMapSchema>\n\nconst exploreV4RelativeTimeSchema = {\n type: 'object',\n properties: {\n tz: {\n type: 'string',\n default: 'Etc/UTC',\n },\n type: {\n type: 'string',\n enum: [\n 'relative',\n ],\n },\n time_range: {\n type: 'string',\n enum: relativeTimeRangeValuesV4,\n default: '1h',\n },\n },\n required: [\n 'type',\n 'time_range',\n ],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nconst exploreV4AbsoluteTimeSchema = {\n type: 'object',\n description: 'A duration representing an exact start and end time.',\n properties: {\n tz: {\n type: 'string',\n },\n type: {\n type: 'string',\n enum: [\n 'absolute',\n ],\n },\n start: {\n type: 'string',\n },\n end: {\n type: 'string',\n },\n },\n required: [\n 'type',\n 'start',\n 'end',\n ],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nconst baseQueryProperties = {\n granularity: {\n type: 'string',\n description: 'Force time grouping into buckets of this duration. Only has an effect if \"time\" is in the \"dimensions\" list.',\n enum: granularityValues,\n },\n time_range: {\n type: 'object',\n description: 'The time range to query.',\n anyOf: [\n exploreV4RelativeTimeSchema,\n exploreV4AbsoluteTimeSchema,\n ],\n default: {\n type: 'relative',\n time_range: '1h',\n },\n },\n limit: {\n type: 'number',\n },\n meta: {\n type: 'object',\n },\n} as const\n\nconst metricsFn = <T extends readonly string[]>(aggregations: T) => ({\n type: 'array',\n description: 'List of aggregated metrics to collect across the requested time span.',\n items: {\n type: 'string',\n enum: aggregations,\n },\n} as const satisfies JSONSchema)\n\nconst dimensionsFn = <T extends readonly string[]>(dimensions: T) => ({\n type: 'array',\n description: 'List of attributes or entity types to group by.',\n minItems: 0,\n maxItems: 2,\n items: {\n type: 'string',\n enum: dimensions,\n },\n} as const satisfies JSONSchema)\n\nconst filtersFn = <T extends readonly string[]>(filterableDimensions: T) => ({\n type: 'array',\n description: 'A list of filters to apply to the query',\n items: {\n oneOf: [\n {\n type: 'object',\n description: 'In filter',\n properties: {\n field: {\n type: 'string',\n enum: filterableDimensions,\n },\n operator: {\n type: 'string',\n enum: exploreFilterTypesV2,\n },\n value: {\n type: 'array',\n items: {\n type: ['string', 'number', 'null'],\n },\n },\n },\n required: [\n 'field',\n 'operator',\n 'value',\n ],\n additionalProperties: false,\n },\n {\n type: 'object',\n description: 'Empty filter',\n properties: {\n field: {\n type: 'string',\n enum: filterableDimensions,\n },\n operator: {\n type: 'string',\n enum: requestFilterTypeEmptyV2,\n },\n },\n required: [\n 'field',\n 'operator',\n ],\n additionalProperties: false,\n },\n ],\n },\n} as const satisfies JSONSchema)\n\nexport const apiUsageQuerySchema = {\n type: 'object',\n description: 'A query to launch at the advanced explore API',\n properties: {\n datasource: {\n type: 'string',\n enum: [\n 'api_usage',\n ],\n },\n metrics: metricsFn(exploreAggregations),\n dimensions: dimensionsFn(queryableExploreDimensions),\n filters: filtersFn(filterableExploreDimensions),\n ...baseQueryProperties,\n },\n required: ['datasource'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport const basicQuerySchema = {\n type: 'object',\n description: 'A query to launch at the basic explore API',\n properties: {\n datasource: {\n type: 'string',\n enum: [\n 'basic',\n ],\n },\n metrics: metricsFn(basicExploreAggregations),\n dimensions: dimensionsFn(queryableBasicExploreDimensions),\n filters: filtersFn(filterableBasicExploreDimensions),\n ...baseQueryProperties,\n },\n required: ['datasource'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport const llmUsageSchema = {\n type: 'object',\n description: 'A query to launch at the AI explore API',\n properties: {\n datasource: {\n type: 'string',\n enum: [\n 'llm_usage',\n ],\n },\n metrics: metricsFn(aiExploreAggregations),\n dimensions: dimensionsFn(queryableAiExploreDimensions),\n filters: filtersFn(filterableAiExploreDimensions),\n ...baseQueryProperties,\n },\n required: ['datasource'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport const validDashboardQuery = {\n anyOf: [apiUsageQuerySchema, basicQuerySchema, llmUsageSchema],\n} as const satisfies JSONSchema\n\nexport type ValidDashboardQuery = FromSchemaWithOptions<typeof validDashboardQuery>\n\n// Note: `datasource` may need to end up somewhere else for sane type definitions?\nexport const tileDefinitionSchema = {\n type: 'object',\n properties: {\n query: validDashboardQuery,\n chart: {\n anyOf: [\n barChartSchema,\n gaugeChartSchema,\n donutChartSchema,\n timeseriesChartSchema,\n metricCardSchema,\n topNTableSchema,\n slottableSchema,\n singleValueSchema,\n choroplethMapSchema,\n ],\n },\n },\n required: ['query', 'chart'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type TileDefinition = FromSchemaWithOptions<typeof tileDefinitionSchema>\n\nexport const tileLayoutSchema = {\n type: 'object',\n properties: {\n position: {\n type: 'object',\n properties: {\n col: {\n type: 'number',\n },\n row: {\n type: 'number',\n },\n },\n description: 'Position of the tile in the grid.',\n required: ['col', 'row'],\n additionalProperties: false,\n },\n size: {\n type: 'object',\n properties: {\n cols: {\n type: 'number',\n },\n rows: {\n type: 'number',\n },\n fit_to_content: {\n type: 'boolean',\n },\n },\n description: 'Number of columns and rows the tile occupies. If fitToContent is true for every tile in a row, ' +\n 'and each tile only occupies 1 row, then the row will auto-fit to its content.',\n required: ['cols', 'rows'],\n additionalProperties: false,\n },\n },\n required: ['position', 'size'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type TileLayout = FromSchemaWithOptions<typeof tileLayoutSchema>\n\nexport const tileConfigSchema = {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['chart'],\n },\n definition: tileDefinitionSchema,\n layout: tileLayoutSchema,\n id: {\n type: 'string',\n description: 'Unique identifier for the tile. If not provided, one will be generated.',\n },\n },\n required: ['type', 'definition', 'layout'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type TileConfig = FromSchemaWithOptions<typeof tileConfigSchema>\n\nexport const dashboardConfigSchema = {\n type: 'object',\n properties: {\n tiles: {\n type: 'array',\n items: tileConfigSchema,\n },\n tile_height: {\n type: 'number',\n description: 'Height of each tile in pixels.',\n },\n preset_filters: filtersFn([...new Set([...filterableExploreDimensions, ...filterableBasicExploreDimensions, ...filterableAiExploreDimensions])]),\n template_id: {\n type: ['string', 'null'],\n description: 'Template id which was used to instantiate this dashboard.',\n },\n },\n required: ['tiles'],\n additionalProperties: false,\n} as const satisfies JSONSchema\n\nexport type DashboardConfig = FromSchemaWithOptions<typeof dashboardConfigSchema>\n","import type { AllFilterableDimensionsAndMetrics, FilterDatasource } from './types'\nimport {\n filterableAiExploreDimensions,\n filterableBasicExploreDimensions,\n filterableExploreDimensions,\n filterableRequestDimensions,\n filterableRequestMetrics,\n} from './types'\n\n\nexport const getFieldDataSources = (\n dimension: AllFilterableDimensionsAndMetrics,\n): FilterDatasource[] => {\n const datasources: FilterDatasource[] = []\n\n if ((filterableBasicExploreDimensions as string[]).includes(dimension)) {\n datasources.push('basic')\n }\n if ((filterableExploreDimensions as string[]).includes(dimension)) {\n datasources.push('api_usage')\n }\n if ((filterableAiExploreDimensions as string[]).includes(dimension)) {\n datasources.push('llm_usage')\n }\n if ((filterableRequestDimensions as string[]).includes(dimension) || (filterableRequestMetrics as string[]).includes(dimension)) {\n datasources.push('requests')\n }\n\n return datasources\n}\n","const formatDistanceLocale = {\n lessThanXSeconds: {\n one: \"less than a second\",\n other: \"less than {{count}} seconds\",\n },\n\n xSeconds: {\n one: \"1 second\",\n other: \"{{count}} seconds\",\n },\n\n halfAMinute: \"half a minute\",\n\n lessThanXMinutes: {\n one: \"less than a minute\",\n other: \"less than {{count}} minutes\",\n },\n\n xMinutes: {\n one: \"1 minute\",\n other: \"{{count}} minutes\",\n },\n\n aboutXHours: {\n one: \"about 1 hour\",\n other: \"about {{count}} hours\",\n },\n\n xHours: {\n one: \"1 hour\",\n other: \"{{count}} hours\",\n },\n\n xDays: {\n one: \"1 day\",\n other: \"{{count}} days\",\n },\n\n aboutXWeeks: {\n one: \"about 1 week\",\n other: \"about {{count}} weeks\",\n },\n\n xWeeks: {\n one: \"1 week\",\n other: \"{{count}} weeks\",\n },\n\n aboutXMonths: {\n one: \"about 1 month\",\n other: \"about {{count}} months\",\n },\n\n xMonths: {\n one: \"1 month\",\n other: \"{{count}} months\",\n },\n\n aboutXYears: {\n one: \"about 1 year\",\n other: \"about {{count}} years\",\n },\n\n xYears: {\n one: \"1 year\",\n other: \"{{count}} years\",\n },\n\n overXYears: {\n one: \"over 1 year\",\n other: \"over {{count}} years\",\n },\n\n almostXYears: {\n one: \"almost 1 year\",\n other: \"almost {{count}} years\",\n },\n};\n\nexport const formatDistance = (token, count, options) => {\n let result;\n\n const tokenValue = formatDistanceLocale[token];\n if (typeof tokenValue === \"string\") {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace(\"{{count}}\", count.toString());\n }\n\n if (options?.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return \"in \" + result;\n } else {\n return result + \" ago\";\n }\n }\n\n return result;\n};\n","export function buildFormatLongFn(args) {\n return (options = {}) => {\n // TODO: Remove String()\n const width = options.width ? String(options.width) : args.defaultWidth;\n const format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}\n","import { buildFormatLongFn } from \"../../_lib/buildFormatLongFn.js\";\n\nconst dateFormats = {\n full: \"EEEE, MMMM do, y\",\n long: \"MMMM do, y\",\n medium: \"MMM d, y\",\n short: \"MM/dd/yyyy\",\n};\n\nconst timeFormats = {\n full: \"h:mm:ss a zzzz\",\n long: \"h:mm:ss a z\",\n medium: \"h:mm:ss a\",\n short: \"h:mm a\",\n};\n\nconst dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: \"{{date}}, {{time}}\",\n short: \"{{date}}, {{time}}\",\n};\n\nexport const formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: \"full\",\n }),\n\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: \"full\",\n }),\n\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: \"full\",\n }),\n};\n","const formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: \"P\",\n};\n\nexport const formatRelative = (token, _date, _baseDate, _options) =>\n formatRelativeLocale[token];\n","/**\n * The localize function argument callback which allows to convert raw value to\n * the actual type.\n *\n * @param value - The value to convert\n *\n * @returns The converted value\n */\n\n/**\n * The map of localized values for each width.\n */\n\n/**\n * The index type of the locale unit value. It types conversion of units of\n * values that don't start at 0 (i.e. quarters).\n */\n\n/**\n * Converts the unit value to the tuple of values.\n */\n\n/**\n * The tuple of localized era values. The first element represents BC,\n * the second element represents AD.\n */\n\n/**\n * The tuple of localized quarter values. The first element represents Q1.\n */\n\n/**\n * The tuple of localized day values. The first element represents Sunday.\n */\n\n/**\n * The tuple of localized month values. The first element represents January.\n */\n\nexport function buildLocalizeFn(args) {\n return (value, options) => {\n const context = options?.context ? String(options.context) : \"standalone\";\n\n let valuesArray;\n if (context === \"formatting\" && args.formattingValues) {\n const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;\n const width = options?.width ? String(options.width) : defaultWidth;\n\n valuesArray =\n args.formattingValues[width] || args.formattingValues[defaultWidth];\n } else {\n const defaultWidth = args.defaultWidth;\n const width = options?.width ? String(options.width) : args.defaultWidth;\n\n valuesArray = args.values[width] || args.values[defaultWidth];\n }\n const index = args.argumentCallback ? args.argumentCallback(value) : value;\n\n // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!\n return valuesArray[index];\n };\n}\n","import { buildLocalizeFn } from \"../../_lib/buildLocalizeFn.js\";\n\nconst eraValues = {\n narrow: [\"B\", \"A\"],\n abbreviated: [\"BC\", \"AD\"],\n wide: [\"Before Christ\", \"Anno Domini\"],\n};\n\nconst quarterValues = {\n narrow: [\"1\", \"2\", \"3\", \"4\"],\n abbreviated: [\"Q1\", \"Q2\", \"Q3\", \"Q4\"],\n wide: [\"1st quarter\", \"2nd quarter\", \"3rd quarter\", \"4th quarter\"],\n};\n\n// Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\nconst monthValues = {\n narrow: [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"],\n abbreviated: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n\n wide: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n ],\n};\n\nconst dayValues = {\n narrow: [\"S\", \"M\", \"T\", \"W\", \"T\", \"F\", \"S\"],\n short: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n abbreviated: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n wide: [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n ],\n};\n\nconst dayPeriodValues = {\n narrow: {\n am: \"a\",\n pm: \"p\",\n midnight: \"mi\",\n noon: \"n\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n abbreviated: {\n am: \"AM\",\n pm: \"PM\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n wide: {\n am: \"a.m.\",\n pm: \"p.m.\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n};\n\nconst formattingDayPeriodValues = {\n narrow: {\n am: \"a\",\n pm: \"p\",\n midnight: \"mi\",\n noon: \"n\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n abbreviated: {\n am: \"AM\",\n pm: \"PM\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n wide: {\n am: \"a.m.\",\n pm: \"p.m.\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n};\n\nconst ordinalNumber = (dirtyNumber, _options) => {\n const number = Number(dirtyNumber);\n\n // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`.\n //\n // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'.\n\n const rem100 = number % 100;\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + \"st\";\n case 2:\n return number + \"nd\";\n case 3:\n return number + \"rd\";\n }\n }\n return number + \"th\";\n};\n\nexport const localize = {\n ordinalNumber,\n\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: \"wide\",\n }),\n\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: \"wide\",\n argumentCallback: (quarter) => quarter - 1,\n }),\n\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: \"wide\",\n }),\n\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: \"wide\",\n }),\n\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: \"wide\",\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: \"wide\",\n }),\n};\n","export function buildMatchFn(args) {\n return (string, options = {}) => {\n const width = options.width;\n\n const matchPattern =\n (width && args.matchPatterns[width]) ||\n args.matchPatterns[args.defaultMatchWidth];\n const matchResult = string.match(matchPattern);\n\n if (!matchResult) {\n return null;\n }\n const matchedString = matchResult[0];\n\n const parsePatterns =\n (width && args.parsePatterns[width]) ||\n args.parsePatterns[args.defaultParseWidth];\n\n const key = Array.isArray(parsePatterns)\n ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))\n : // [TODO] -- I challenge you to fix the type\n findKey(parsePatterns, (pattern) => pattern.test(matchedString));\n\n let value;\n\n value = args.valueCallback ? args.valueCallback(key) : key;\n value = options.valueCallback\n ? // [TODO] -- I challenge you to fix the type\n options.valueCallback(value)\n : value;\n\n const rest = string.slice(matchedString.length);\n\n return { value, rest };\n };\n}\n\nfunction findKey(object, predicate) {\n for (const key in object) {\n if (\n Object.prototype.hasOwnProperty.call(object, key) &&\n predicate(object[key])\n ) {\n return key;\n }\n }\n return undefined;\n}\n\nfunction findIndex(array, predicate) {\n for (let key = 0; key < array.length; key++) {\n if (predicate(array[key])) {\n return key;\n }\n }\n return undefined;\n}\n","export function buildMatchPatternFn(args) {\n return (string, options = {}) => {\n const matchResult = string.match(args.matchPattern);\n if (!matchResult) return null;\n const matchedString = matchResult[0];\n\n const parseResult = string.match(args.parsePattern);\n if (!parseResult) return null;\n let value = args.valueCallback\n ? args.valueCallback(parseResult[0])\n : parseResult[0];\n\n // [TODO] I challenge you to fix the type\n value = options.valueCallback ? options.valueCallback(value) : value;\n\n const rest = string.slice(matchedString.length);\n\n return { value, rest };\n };\n}\n","import { buildMatchFn } from \"../../_lib/buildMatchFn.js\";\nimport { buildMatchPatternFn } from \"../../_lib/buildMatchPatternFn.js\";\n\nconst matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nconst parseOrdinalNumberPattern = /\\d+/i;\n\nconst matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i,\n};\nconst parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i],\n};\n\nconst matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i,\n};\nconst parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i],\n};\n\nconst matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,\n};\nconst parseMonthPatterns = {\n narrow: [\n /^j/i,\n /^f/i,\n /^m/i,\n /^a/i,\n /^m/i,\n /^j/i,\n /^j/i,\n /^a/i,\n /^s/i,\n /^o/i,\n /^n/i,\n /^d/i,\n ],\n\n any: [\n /^ja/i,\n /^f/i,\n /^mar/i,\n /^ap/i,\n /^may/i,\n /^jun/i,\n /^jul/i,\n /^au/i,\n /^s/i,\n /^o/i,\n /^n/i,\n /^d/i,\n ],\n};\n\nconst matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,\n};\nconst parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],\n};\n\nconst matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,\n};\nconst parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i,\n },\n};\n\nexport const match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: (value) => parseInt(value, 10),\n }),\n\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseEraPatterns,\n defaultParseWidth: \"any\",\n }),\n\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: \"any\",\n valueCallback: (index) => index + 1,\n }),\n\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: \"any\",\n }),\n\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseDayPatterns,\n defaultParseWidth: \"any\",\n }),\n\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: \"any\",\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: \"any\",\n }),\n};\n","import { formatDistance } from \"./en-US/_lib/formatDistance.js\";\nimport { formatLong } from \"./en-US/_lib/formatLong.js\";\nimport { formatRelative } from \"./en-US/_lib/formatRelative.js\";\nimport { localize } from \"./en-US/_lib/localize.js\";\nimport { match } from \"./en-US/_lib/match.js\";\n\n/**\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)\n * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)\n */\nexport const enUS = {\n code: \"en-US\",\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0 /* Sunday */,\n firstWeekContainsDate: 1,\n },\n};\n\n// Fallback for modularized imports:\nexport default enUS;\n","let defaultOptions = {};\n\nexport function getDefaultOptions() {\n return defaultOptions;\n}\n\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}\n","/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n","import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate<DateType extends Date>(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n","import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n","import { toDate } from \"../toDate.js\";\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const _date = toDate(date);\n const utcDate = new Date(\n Date.UTC(\n _date.getFullYear(),\n _date.getMonth(),\n _date.getDate(),\n _date.getHours(),\n _date.getMinutes(),\n _date.getSeconds(),\n _date.getMilliseconds(),\n ),\n );\n utcDate.setUTCFullYear(_date.getFullYear());\n return +date - +utcDate;\n}\n","import { constructFrom } from \"../constructFrom.js\";\n\nexport function normalizeDates(context, ...dates) {\n const normalize = constructFrom.bind(\n null,\n context || dates.find((date) => typeof date === \"object\"),\n );\n return dates.map(normalize);\n}\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfDay} function options.\n */\n\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a day\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport function startOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfDay;\n","import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInDay } from \"./constants.js\";\nimport { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link differenceInCalendarDays} function options.\n */\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - The options object\n *\n * @returns The number of calendar days\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport function differenceInCalendarDays(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfDay = startOfDay(laterDate_);\n const earlierStartOfDay = startOfDay(earlierDate_);\n\n const laterTimestamp =\n +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);\n const earlierTimestamp =\n +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);\n\n // Round the number of days to the nearest integer because the number of\n // milliseconds in a day is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarDays;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfYear} function options.\n */\n\n/**\n * @name startOfYear\n * @category Year Helpers\n * @summary Return the start of a year for the given date.\n *\n * @description\n * Return the start of a year for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a year\n *\n * @example\n * // The start of a year for 2 September 2014 11:55:00:\n * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Jan 01 2014 00:00:00\n */\nexport function startOfYear(date, options) {\n const date_ = toDate(date, options?.in);\n date_.setFullYear(date_.getFullYear(), 0, 1);\n date_.setHours(0, 0, 0, 0);\n return date_;\n}\n\n// Fallback for modularized imports:\nexport default startOfYear;\n","import { differenceInCalendarDays } from \"./differenceInCalendarDays.js\";\nimport { startOfYear } from \"./startOfYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getDayOfYear} function options.\n */\n\n/**\n * @name getDayOfYear\n * @category Day Helpers\n * @summary Get the day of the year of the given date.\n *\n * @description\n * Get the day of the year of the given date.\n *\n * @param date - The given date\n * @param options - The options\n *\n * @returns The day of year\n *\n * @example\n * // Which day of the year is 2 July 2014?\n * const result = getDayOfYear(new Date(2014, 6, 2))\n * //=> 183\n */\nexport function getDayOfYear(date, options) {\n const _date = toDate(date, options?.in);\n const diff = differenceInCalendarDays(_date, startOfYear(_date));\n const dayOfYear = diff + 1;\n return dayOfYear;\n}\n\n// Fallback for modularized imports:\nexport default getDayOfYear;\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfWeek} function options.\n */\n\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a week\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfWeek(date, options) {\n const defaultOptions = getDefaultOptions();\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const _date = toDate(date, options?.in);\n const day = _date.getDay();\n const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n\n _date.setDate(_date.getDate() - diff);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfWeek;\n","import { startOfWeek } from \"./startOfWeek.js\";\n\n/**\n * The {@link startOfISOWeek} function options.\n */\n\n/**\n * @name startOfISOWeek\n * @category ISO Week Helpers\n * @summary Return the start of an ISO week for the given date.\n *\n * @description\n * Return the start of an ISO week for the given date.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of an ISO week\n *\n * @example\n * // The start of an ISO week for 2 September 2014 11:55:00:\n * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfISOWeek(date, options) {\n return startOfWeek(date, { ...options, weekStartsOn: 1 });\n}\n\n// Fallback for modularized imports:\nexport default startOfISOWeek;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getISOWeekYear} function options.\n */\n\n/**\n * @name getISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Get the ISO week-numbering year of the given date.\n *\n * @description\n * Get the ISO week-numbering year of the given date,\n * which always starts 3 days before the year's first Thursday.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param date - The given date\n *\n * @returns The ISO week-numbering year\n *\n * @example\n * // Which ISO-week numbering year is 2 January 2005?\n * const result = getISOWeekYear(new Date(2005, 0, 2))\n * //=> 2004\n */\nexport function getISOWeekYear(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n\n const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);\n fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);\n const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);\n\n const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);\n fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);\n const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);\n\n if (_date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (_date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}\n\n// Fallback for modularized imports:\nexport default getISOWeekYear;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { getISOWeekYear } from \"./getISOWeekYear.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\n\n/**\n * The {@link startOfISOWeekYear} function options.\n */\n\n/**\n * @name startOfISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Return the start of an ISO week-numbering year for the given date.\n *\n * @description\n * Return the start of an ISO week-numbering year,\n * which always starts 3 days before the year's first Thursday.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of an ISO week-numbering year\n *\n * @example\n * // The start of an ISO week-numbering year for 2 July 2005:\n * const result = startOfISOWeekYear(new Date(2005, 6, 2))\n * //=> Mon Jan 03 2005 00:00:00\n */\nexport function startOfISOWeekYear(date, options) {\n const year = getISOWeekYear(date, options);\n const fourthOfJanuary = constructFrom(options?.in || date, 0);\n fourthOfJanuary.setFullYear(year, 0, 4);\n fourthOfJanuary.setHours(0, 0, 0, 0);\n return startOfISOWeek(fourthOfJanuary);\n}\n\n// Fallback for modularized imports:\nexport default startOfISOWeekYear;\n","import { millisecondsInWeek } from \"./constants.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\nimport { startOfISOWeekYear } from \"./startOfISOWeekYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getISOWeek} function options.\n */\n\n/**\n * @name getISOWeek\n * @category ISO Week Helpers\n * @summary Get the ISO week of the given date.\n *\n * @description\n * Get the ISO week of the given date.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param date - The given date\n * @param options - The options\n *\n * @returns The ISO week\n *\n * @example\n * // Which week of the ISO-week numbering year is 2 January 2005?\n * const result = getISOWeek(new Date(2005, 0, 2))\n * //=> 53\n */\nexport function getISOWeek(date, options) {\n const _date = toDate(date, options?.in);\n const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);\n\n // Round the number of weeks to the nearest integer because the number of\n // milliseconds in a week is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round(diff / millisecondsInWeek) + 1;\n}\n\n// Fallback for modularized imports:\nexport default getISOWeek;\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { constructFrom } from \"./constructFrom.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getWeekYear} function options.\n */\n\n/**\n * @name getWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Get the local week-numbering year of the given date.\n *\n * @description\n * Get the local week-numbering year of the given date.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @param date - The given date\n * @param options - An object with options.\n *\n * @returns The local week-numbering year\n *\n * @example\n * // Which week numbering year is 26 December 2004 with the default settings?\n * const result = getWeekYear(new Date(2004, 11, 26))\n * //=> 2005\n *\n * @example\n * // Which week numbering year is 26 December 2004 if week starts on Saturday?\n * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })\n * //=> 2004\n *\n * @example\n * // Which week numbering year is 26 December 2004 if the first week contains 4 January?\n * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })\n * //=> 2004\n */\nexport function getWeekYear(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n\n const defaultOptions = getDefaultOptions();\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const firstWeekOfNextYear = constructFrom(options?.in || date, 0);\n firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setHours(0, 0, 0, 0);\n const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);\n\n const firstWeekOfThisYear = constructFrom(options?.in || date, 0);\n firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setHours(0, 0, 0, 0);\n const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);\n\n if (+_date >= +startOfNextYear) {\n return year + 1;\n } else if (+_date >= +startOfThisYear) {\n return year;\n } else {\n return year - 1;\n }\n}\n\n// Fallback for modularized imports:\nexport default getWeekYear;\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { constructFrom } from \"./constructFrom.js\";\nimport { getWeekYear } from \"./getWeekYear.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\n\n/**\n * The {@link startOfWeekYear} function options.\n */\n\n/**\n * @name startOfWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Return the start of a local week-numbering year for the given date.\n *\n * @description\n * Return the start of a local week-numbering year.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a week-numbering year\n *\n * @example\n * // The start of an a week-numbering year for 2 July 2005 with default settings:\n * const result = startOfWeekYear(new Date(2005, 6, 2))\n * //=> Sun Dec 26 2004 00:00:00\n *\n * @example\n * // The start of a week-numbering year for 2 July 2005\n * // if Monday is the first day of week\n * // and 4 January is always in the first week of the year:\n * const result = startOfWeekYear(new Date(2005, 6, 2), {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> Mon Jan 03 2005 00:00:00\n */\nexport function startOfWeekYear(date, options) {\n const defaultOptions = getDefaultOptions();\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const year = getWeekYear(date, options);\n const firstWeek = constructFrom(options?.in || date, 0);\n firstWeek.setFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setHours(0, 0, 0, 0);\n const _date = startOfWeek(firstWeek, options);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfWeekYear;\n","import { millisecondsInWeek } from \"./constants.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\nimport { startOfWeekYear } from \"./startOfWeekYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getWeek} function options.\n */\n\n/**\n * @name getWeek\n * @category Week Helpers\n * @summary Get the local week index of the given date.\n *\n * @description\n * Get the local week index of the given date.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The week\n *\n * @example\n * // Which week of the local week numbering year is 2 January 2005 with default options?\n * const result = getWeek(new Date(2005, 0, 2))\n * //=> 2\n *\n * @example\n * // Which week of the local week numbering year is 2 January 2005,\n * // if Monday is the first day of the week,\n * // and the first week of the year always contains 4 January?\n * const result = getWeek(new Date(2005, 0, 2), {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> 53\n */\nexport function getWeek(date, options) {\n const _date = toDate(date, options?.in);\n const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);\n\n // Round the number of weeks to the nearest integer because the number of\n // milliseconds in a week is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round(diff / millisecondsInWeek) + 1;\n}\n\n// Fallback for modularized imports:\nexport default getWeek;\n","export function addLeadingZeros(number, targetLength) {\n const sign = number < 0 ? \"-\" : \"\";\n const output = Math.abs(number).toString().padStart(targetLength, \"0\");\n return sign + output;\n}\n","import { addLeadingZeros } from \"../addLeadingZeros.js\";\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | |\n * | d | Day of month | D | |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | m | Minute | M | Month |\n * | s | Second | S | Fraction of second |\n * | y | Year (abs) | Y | |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n */\n\nexport const lightFormatters = {\n // Year\n y(date, token) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n\n const signedYear = date.getFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const year = signedYear > 0 ? signedYear : 1 - signedYear;\n return addLeadingZeros(token === \"yy\" ? year % 100 : year, token.length);\n },\n\n // Month\n M(date, token) {\n const month = date.getMonth();\n return token === \"M\" ? String(month + 1) : addLeadingZeros(month + 1, 2);\n },\n\n // Day of the month\n d(date, token) {\n return addLeadingZeros(date.getDate(), token.length);\n },\n\n // AM or PM\n a(date, token) {\n const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? \"pm\" : \"am\";\n\n switch (token) {\n case \"a\":\n case \"aa\":\n return dayPeriodEnumValue.toUpperCase();\n case \"aaa\":\n return dayPeriodEnumValue;\n case \"aaaaa\":\n return dayPeriodEnumValue[0];\n case \"aaaa\":\n default:\n return dayPeriodEnumValue === \"am\" ? \"a.m.\" : \"p.m.\";\n }\n },\n\n // Hour [1-12]\n h(date, token) {\n return addLeadingZeros(date.getHours() % 12 || 12, token.length);\n },\n\n // Hour [0-23]\n H(date, token) {\n return addLeadingZeros(date.getHours(), token.length);\n },\n\n // Minute\n m(date, token) {\n return addLeadingZeros(date.getMinutes(), token.length);\n },\n\n // Second\n s(date, token) {\n return addLeadingZeros(date.getSeconds(), token.length);\n },\n\n // Fraction of second\n S(date, token) {\n const numberOfDigits = token.length;\n const milliseconds = date.getMilliseconds();\n const fractionalSeconds = Math.trunc(\n milliseconds * Math.pow(10, numberOfDigits - 3),\n );\n return addLeadingZeros(fractionalSeconds, token.length);\n },\n};\n","import { getDayOfYear } from \"../../getDayOfYear.js\";\nimport { getISOWeek } from \"../../getISOWeek.js\";\nimport { getISOWeekYear } from \"../../getISOWeekYear.js\";\nimport { getWeek } from \"../../getWeek.js\";\nimport { getWeekYear } from \"../../getWeekYear.js\";\n\nimport { addLeadingZeros } from \"../addLeadingZeros.js\";\nimport { lightFormatters } from \"./lightFormatters.js\";\n\nconst dayPeriodEnum = {\n am: \"am\",\n pm: \"pm\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n};\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\n\nexport const formatters = {\n // Era\n G: function (date, token, localize) {\n const era = date.getFullYear() > 0 ? 1 : 0;\n switch (token) {\n // AD, BC\n case \"G\":\n case \"GG\":\n case \"GGG\":\n return localize.era(era, { width: \"abbreviated\" });\n // A, B\n case \"GGGGG\":\n return localize.era(era, { width: \"narrow\" });\n // Anno Domini, Before Christ\n case \"GGGG\":\n default:\n return localize.era(era, { width: \"wide\" });\n }\n },\n\n // Year\n y: function (date, token, localize) {\n // Ordinal number\n if (token === \"yo\") {\n const signedYear = date.getFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const year = signedYear > 0 ? signedYear : 1 - signedYear;\n return localize.ordinalNumber(year, { unit: \"year\" });\n }\n\n return lightFormatters.y(date, token);\n },\n\n // Local week-numbering year\n Y: function (date, token, localize, options) {\n const signedWeekYear = getWeekYear(date, options);\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;\n\n // Two digit year\n if (token === \"YY\") {\n const twoDigitYear = weekYear % 100;\n return addLeadingZeros(twoDigitYear, 2);\n }\n\n // Ordinal number\n if (token === \"Yo\") {\n return localize.ordinalNumber(weekYear, { unit: \"year\" });\n }\n\n // Padding\n return addLeadingZeros(weekYear, token.length);\n },\n\n // ISO week-numbering year\n R: function (date, token) {\n const isoWeekYear = getISOWeekYear(date);\n\n // Padding\n return addLeadingZeros(isoWeekYear, token.length);\n },\n\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function (date, token) {\n const year = date.getFullYear();\n return addLeadingZeros(year, token.length);\n },\n\n // Quarter\n Q: function (date, token, localize) {\n const quarter = Math.ceil((date.getMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case \"Q\":\n return String(quarter);\n // 01, 02, 03, 04\n case \"QQ\":\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case \"Qo\":\n return localize.ordinalNumber(quarter, { unit: \"quarter\" });\n // Q1, Q2, Q3, Q4\n case \"QQQ\":\n return localize.quarter(quarter, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case \"QQQQQ\":\n return localize.quarter(quarter, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // 1st quarter, 2nd quarter, ...\n case \"QQQQ\":\n default:\n return localize.quarter(quarter, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Stand-alone quarter\n q: function (date, token, localize) {\n const quarter = Math.ceil((date.getMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case \"q\":\n return String(quarter);\n // 01, 02, 03, 04\n case \"qq\":\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case \"qo\":\n return localize.ordinalNumber(quarter, { unit: \"quarter\" });\n // Q1, Q2, Q3, Q4\n case \"qqq\":\n return localize.quarter(quarter, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case \"qqqqq\":\n return localize.quarter(quarter, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // 1st quarter, 2nd quarter, ...\n case \"qqqq\":\n default:\n return localize.quarter(quarter, {\n width: \"wide\",\n context: \"standalone\",\n });\n }\n },\n\n // Month\n M: function (date, token, localize) {\n const month = date.getMonth();\n switch (token) {\n case \"M\":\n case \"MM\":\n return lightFormatters.M(date, token);\n // 1st, 2nd, ..., 12th\n case \"Mo\":\n return localize.ordinalNumber(month + 1, { unit: \"month\" });\n // Jan, Feb, ..., Dec\n case \"MMM\":\n return localize.month(month, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // J, F, ..., D\n case \"MMMMM\":\n return localize.month(month, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // January, February, ..., December\n case \"MMMM\":\n default:\n return localize.month(month, { width: \"wide\", context: \"formatting\" });\n }\n },\n\n // Stand-alone month\n L: function (date, token, localize) {\n const month = date.getMonth();\n switch (token) {\n // 1, 2, ..., 12\n case \"L\":\n return String(month + 1);\n // 01, 02, ..., 12\n case \"LL\":\n return addLeadingZeros(month + 1, 2);\n // 1st, 2nd, ..., 12th\n case \"Lo\":\n return localize.ordinalNumber(month + 1, { unit: \"month\" });\n // Jan, Feb, ..., Dec\n case \"LLL\":\n return localize.month(month, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // J, F, ..., D\n case \"LLLLL\":\n return localize.month(month, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // January, February, ..., December\n case \"LLLL\":\n default:\n return localize.month(month, { width: \"wide\", context: \"standalone\" });\n }\n },\n\n // Local week of year\n w: function (date, token, localize, options) {\n const week = getWeek(date, options);\n\n if (token === \"wo\") {\n return localize.ordinalNumber(week, { unit: \"week\" });\n }\n\n return addLeadingZeros(week, token.length);\n },\n\n // ISO week of year\n I: function (date, token, localize) {\n const isoWeek = getISOWeek(date);\n\n if (token === \"Io\") {\n return localize.ordinalNumber(isoWeek, { unit: \"week\" });\n }\n\n return addLeadingZeros(isoWeek, token.length);\n },\n\n // Day of the month\n d: function (date, token, localize) {\n if (token === \"do\") {\n return localize.ordinalNumber(date.getDate(), { unit: \"date\" });\n }\n\n return lightFormatters.d(date, token);\n },\n\n // Day of year\n D: function (date, token, localize) {\n const dayOfYear = getDayOfYear(date);\n\n if (token === \"Do\") {\n return localize.ordinalNumber(dayOfYear, { unit: \"dayOfYear\" });\n }\n\n return addLeadingZeros(dayOfYear, token.length);\n },\n\n // Day of week\n E: function (date, token, localize) {\n const dayOfWeek = date.getDay();\n switch (token) {\n // Tue\n case \"E\":\n case \"EE\":\n case \"EEE\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"EEEEE\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"EEEEEE\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"EEEE\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Local day of week\n e: function (date, token, localize, options) {\n const dayOfWeek = date.getDay();\n const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case \"e\":\n return String(localDayOfWeek);\n // Padded numerical value\n case \"ee\":\n return addLeadingZeros(localDayOfWeek, 2);\n // 1st, 2nd, ..., 7th\n case \"eo\":\n return localize.ordinalNumber(localDayOfWeek, { unit: \"day\" });\n case \"eee\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"eeeee\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"eeeeee\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"eeee\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Stand-alone local day of week\n c: function (date, token, localize, options) {\n const dayOfWeek = date.getDay();\n const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (same as in `e`)\n case \"c\":\n return String(localDayOfWeek);\n // Padded numerical value\n case \"cc\":\n return addLeadingZeros(localDayOfWeek, token.length);\n // 1st, 2nd, ..., 7th\n case \"co\":\n return localize.ordinalNumber(localDayOfWeek, { unit: \"day\" });\n case \"ccc\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // T\n case \"ccccc\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // Tu\n case \"cccccc\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"standalone\",\n });\n // Tuesday\n case \"cccc\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"standalone\",\n });\n }\n },\n\n // ISO day of week\n i: function (date, token, localize) {\n const dayOfWeek = date.getDay();\n const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n switch (token) {\n // 2\n case \"i\":\n return String(isoDayOfWeek);\n // 02\n case \"ii\":\n return addLeadingZeros(isoDayOfWeek, token.length);\n // 2nd\n case \"io\":\n return localize.ordinalNumber(isoDayOfWeek, { unit: \"day\" });\n // Tue\n case \"iii\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"iiiii\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"iiiiii\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"iiii\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // AM or PM\n a: function (date, token, localize) {\n const hours = date.getHours();\n const dayPeriodEnumValue = hours / 12 >= 1 ? \"pm\" : \"am\";\n\n switch (token) {\n case \"a\":\n case \"aa\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"aaa\":\n return localize\n .dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n })\n .toLowerCase();\n case \"aaaaa\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"aaaa\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // AM, PM, midnight, noon\n b: function (date, token, localize) {\n const hours = date.getHours();\n let dayPeriodEnumValue;\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? \"pm\" : \"am\";\n }\n\n switch (token) {\n case \"b\":\n case \"bb\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"bbb\":\n return localize\n .dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n })\n .toLowerCase();\n case \"bbbbb\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"bbbb\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // in the morning, in the afternoon, in the evening, at night\n B: function (date, token, localize) {\n const hours = date.getHours();\n let dayPeriodEnumValue;\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n\n switch (token) {\n case \"B\":\n case \"BB\":\n case \"BBB\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"BBBBB\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"BBBB\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Hour [1-12]\n h: function (date, token, localize) {\n if (token === \"ho\") {\n let hours = date.getHours() % 12;\n if (hours === 0) hours = 12;\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return lightFormatters.h(date, token);\n },\n\n // Hour [0-23]\n H: function (date, token, localize) {\n if (token === \"Ho\") {\n return localize.ordinalNumber(date.getHours(), { unit: \"hour\" });\n }\n\n return lightFormatters.H(date, token);\n },\n\n // Hour [0-11]\n K: function (date, token, localize) {\n const hours = date.getHours() % 12;\n\n if (token === \"Ko\") {\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n\n // Hour [1-24]\n k: function (date, token, localize) {\n let hours = date.getHours();\n if (hours === 0) hours = 24;\n\n if (token === \"ko\") {\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n\n // Minute\n m: function (date, token, localize) {\n if (token === \"mo\") {\n return localize.ordinalNumber(date.getMinutes(), { unit: \"minute\" });\n }\n\n return lightFormatters.m(date, token);\n },\n\n // Second\n s: function (date, token, localize) {\n if (token === \"so\") {\n return localize.ordinalNumber(date.getSeconds(), { unit: \"second\" });\n }\n\n return lightFormatters.s(date, token);\n },\n\n // Fraction of second\n S: function (date, token) {\n return lightFormatters.S(date, token);\n },\n\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n if (timezoneOffset === 0) {\n return \"Z\";\n }\n\n switch (token) {\n // Hours and optional minutes\n case \"X\":\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n case \"XXXX\":\n case \"XX\": // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n case \"XXXXX\":\n case \"XXX\": // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Hours and optional minutes\n case \"x\":\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n case \"xxxx\":\n case \"xx\": // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n case \"xxxxx\":\n case \"xxx\": // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (GMT)\n O: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Short\n case \"O\":\n case \"OO\":\n case \"OOO\":\n return \"GMT\" + formatTimezoneShort(timezoneOffset, \":\");\n // Long\n case \"OOOO\":\n default:\n return \"GMT\" + formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (specific non-location)\n z: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Short\n case \"z\":\n case \"zz\":\n case \"zzz\":\n return \"GMT\" + formatTimezoneShort(timezoneOffset, \":\");\n // Long\n case \"zzzz\":\n default:\n return \"GMT\" + formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Seconds timestamp\n t: function (date, token, _localize) {\n const timestamp = Math.trunc(+date / 1000);\n return addLeadingZeros(timestamp, token.length);\n },\n\n // Milliseconds timestamp\n T: function (date, token, _localize) {\n return addLeadingZeros(+date, token.length);\n },\n};\n\nfunction formatTimezoneShort(offset, delimiter = \"\") {\n const sign = offset > 0 ? \"-\" : \"+\";\n const absOffset = Math.abs(offset);\n const hours = Math.trunc(absOffset / 60);\n const minutes = absOffset % 60;\n if (minutes === 0) {\n return sign + String(hours);\n }\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);\n}\n\nfunction formatTimezoneWithOptionalMinutes(offset, delimiter) {\n if (offset % 60 === 0) {\n const sign = offset > 0 ? \"-\" : \"+\";\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n return formatTimezone(offset, delimiter);\n}\n\nfunction formatTimezone(offset, delimiter = \"\") {\n const sign = offset > 0 ? \"-\" : \"+\";\n const absOffset = Math.abs(offset);\n const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);\n const minutes = addLeadingZeros(absOffset % 60, 2);\n return sign + hours + delimiter + minutes;\n}\n","const dateLongFormatter = (pattern, formatLong) => {\n switch (pattern) {\n case \"P\":\n return formatLong.date({ width: \"short\" });\n case \"PP\":\n return formatLong.date({ width: \"medium\" });\n case \"PPP\":\n return formatLong.date({ width: \"long\" });\n case \"PPPP\":\n default:\n return formatLong.date({ width: \"full\" });\n }\n};\n\nconst timeLongFormatter = (pattern, formatLong) => {\n switch (pattern) {\n case \"p\":\n return formatLong.time({ width: \"short\" });\n case \"pp\":\n return formatLong.time({ width: \"medium\" });\n case \"ppp\":\n return formatLong.time({ width: \"long\" });\n case \"pppp\":\n default:\n return formatLong.time({ width: \"full\" });\n }\n};\n\nconst dateTimeLongFormatter = (pattern, formatLong) => {\n const matchResult = pattern.match(/(P+)(p+)?/) || [];\n const datePattern = matchResult[1];\n const timePattern = matchResult[2];\n\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong);\n }\n\n let dateTimeFormat;\n\n switch (datePattern) {\n case \"P\":\n dateTimeFormat = formatLong.dateTime({ width: \"short\" });\n break;\n case \"PP\":\n dateTimeFormat = formatLong.dateTime({ width: \"medium\" });\n break;\n case \"PPP\":\n dateTimeFormat = formatLong.dateTime({ width: \"long\" });\n break;\n case \"PPPP\":\n default:\n dateTimeFormat = formatLong.dateTime({ width: \"full\" });\n break;\n }\n\n return dateTimeFormat\n .replace(\"{{date}}\", dateLongFormatter(datePattern, formatLong))\n .replace(\"{{time}}\", timeLongFormatter(timePattern, formatLong));\n};\n\nexport const longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter,\n};\n","const dayOfYearTokenRE = /^D+$/;\nconst weekYearTokenRE = /^Y+$/;\n\nconst throwTokens = [\"D\", \"DD\", \"YY\", \"YYYY\"];\n\nexport function isProtectedDayOfYearToken(token) {\n return dayOfYearTokenRE.test(token);\n}\n\nexport function isProtectedWeekYearToken(token) {\n return weekYearTokenRE.test(token);\n}\n\nexport function warnOrThrowProtectedError(token, format, input) {\n const _message = message(token, format, input);\n console.warn(_message);\n if (throwTokens.includes(token)) throw new RangeError(_message);\n}\n\nfunction message(token, format, input) {\n const subject = token[0] === \"Y\" ? \"years\" : \"days of the month\";\n return `Use \\`${token.toLowerCase()}\\` instead of \\`${token}\\` (in \\`${format}\\`) for formatting ${subject} to the input \\`${input}\\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;\n}\n","/**\n * @name isDate\n * @category Common Helpers\n * @summary Is the given value a date?\n *\n * @description\n * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.\n *\n * @param value - The value to check\n *\n * @returns True if the given value is a date\n *\n * @example\n * // For a valid date:\n * const result = isDate(new Date())\n * //=> true\n *\n * @example\n * // For an invalid date:\n * const result = isDate(new Date(NaN))\n * //=> true\n *\n * @example\n * // For some value:\n * const result = isDate('2014-02-31')\n * //=> false\n *\n * @example\n * // For an object:\n * const result = isDate({})\n * //=> false\n */\nexport function isDate(value) {\n return (\n value instanceof Date ||\n (typeof value === \"object\" &&\n Object.prototype.toString.call(value) === \"[object Date]\")\n );\n}\n\n// Fallback for modularized imports:\nexport default isDate;\n","import { isDate } from \"./isDate.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param date - The date to check\n *\n * @returns The date is valid\n *\n * @example\n * // For the valid date:\n * const result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertible into a date:\n * const result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * const result = isValid(new Date(''))\n * //=> false\n */\nexport function isValid(date) {\n return !((!isDate(date) && typeof date !== \"number\") || isNaN(+toDate(date)));\n}\n\n// Fallback for modularized imports:\nexport default isValid;\n","import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { formatters } from \"./_lib/format/formatters.js\";\nimport { longFormatters } from \"./_lib/format/longFormatters.js\";\nimport {\n isProtectedDayOfYearToken,\n isProtectedWeekYearToken,\n warnOrThrowProtectedError,\n} from \"./_lib/protectedTokens.js\";\nimport { isValid } from \"./isValid.js\";\nimport { toDate } from \"./toDate.js\";\n\n// Rexports of internal for libraries to use.\n// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874\nexport { formatters, longFormatters };\n\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nconst formattingTokensRegExp =\n /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nconst longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\n\nconst escapedStringRegExp = /^'([^]*?)'?$/;\nconst doubleQuoteRegExp = /''/g;\nconst unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n\nexport { format as formatDate };\n\n/**\n * The {@link format} function options.\n */\n\n/**\n * @name format\n * @alias formatDate\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)\n * and [getWeekYear](https://date-fns.org/docs/getWeekYear)).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param date - The original date\n * @param format - The string of tokens\n * @param options - An object with options\n *\n * @returns The formatted date string\n *\n * @throws `date` must not be Invalid Date\n * @throws `options.locale` must contain `localize` property\n * @throws `options.locale` must contain `formatLong` property\n * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\nexport function format(date, formatStr, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const originalDate = toDate(date, options?.in);\n\n if (!isValid(originalDate)) {\n throw new RangeError(\"Invalid time value\");\n }\n\n let parts = formatStr\n .match(longFormattingTokensRegExp)\n .map((substring) => {\n const firstCharacter = substring[0];\n if (firstCharacter === \"p\" || firstCharacter === \"P\") {\n const longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n return substring;\n })\n .join(\"\")\n .match(formattingTokensRegExp)\n .map((substring) => {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return { isToken: false, value: \"'\" };\n }\n\n const firstCharacter = substring[0];\n if (firstCharacter === \"'\") {\n return { isToken: false, value: cleanEscapedString(substring) };\n }\n\n if (formatters[firstCharacter]) {\n return { isToken: true, value: substring };\n }\n\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError(\n \"Format string contains an unescaped latin alphabet character `\" +\n firstCharacter +\n \"`\",\n );\n }\n\n return { isToken: false, value: substring };\n });\n\n // invoke localize preprocessor (only for french locales at the moment)\n if (locale.localize.preprocessor) {\n parts = locale.localize.preprocessor(originalDate, parts);\n }\n\n const formatterOptions = {\n firstWeekContainsDate,\n weekStartsOn,\n locale,\n };\n\n return parts\n .map((part) => {\n if (!part.isToken) return part.value;\n\n const token = part.value;\n\n if (\n (!options?.useAdditionalWeekYearTokens &&\n isProtectedWeekYearToken(token)) ||\n (!options?.useAdditionalDayOfYearTokens &&\n isProtectedDayOfYearToken(token))\n ) {\n warnOrThrowProtectedError(token, formatStr, String(date));\n }\n\n const formatter = formatters[token[0]];\n return formatter(originalDate, token, locale.localize, formatterOptions);\n })\n .join(\"\");\n}\n\nfunction cleanEscapedString(input) {\n const matched = input.match(escapedStringRegExp);\n\n if (!matched) {\n return input;\n }\n\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}\n\n// Fallback for modularized imports:\nexport default format;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addDays} function options.\n */\n\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of days to be added.\n * @param options - An object with options\n *\n * @returns The new date with the days added\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport function addDays(date, amount, options) {\n const _date = toDate(date, options?.in);\n if (isNaN(amount)) return constructFrom(options?.in || date, NaN);\n\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n if (!amount) return _date;\n\n _date.setDate(_date.getDate() + amount);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default addDays;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addMonths} function options.\n */\n\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be added.\n * @param options - The options object\n *\n * @returns The new date with the months added\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * const result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n *\n * // Add one month to 30 January 2023:\n * const result = addMonths(new Date(2023, 0, 30), 1)\n * //=> Tue Feb 28 2023 00:00:00\n */\nexport function addMonths(date, amount, options) {\n const _date = toDate(date, options?.in);\n if (isNaN(amount)) return constructFrom(options?.in || date, NaN);\n if (!amount) {\n // If 0 months, no-op to avoid changing times in the hour before end of DST\n return _date;\n }\n const dayOfMonth = _date.getDate();\n\n // The JS Date object supports date math by accepting out-of-bounds values for\n // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and\n // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we\n // want except that dates will wrap around the end of a month, meaning that\n // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So\n // we'll default to the end of the desired month by adding 1 to the desired\n // month and using a date of 0 to back up one day to the end of the desired\n // month.\n const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());\n endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);\n const daysInMonth = endOfDesiredMonth.getDate();\n if (dayOfMonth >= daysInMonth) {\n // If we're already at the end of the month, then this is the correct date\n // and we're done.\n return endOfDesiredMonth;\n } else {\n // Otherwise, we now know that setting the original day-of-month value won't\n // cause an overflow, so set the desired day-of-month. Note that we can't\n // just set the date of `endOfDesiredMonth` because that object may have had\n // its time changed in the unusual case where where a DST transition was on\n // the last day of the month and its local time was in the hour skipped or\n // repeated next to a DST transition. So we use `date` instead which is\n // guaranteed to still have the original time.\n _date.setFullYear(\n endOfDesiredMonth.getFullYear(),\n endOfDesiredMonth.getMonth(),\n dayOfMonth,\n );\n return _date;\n }\n}\n\n// Fallback for modularized imports:\nexport default addMonths;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfMonth} function options.\n */\n\n/**\n * @name startOfMonth\n * @category Month Helpers\n * @summary Return the start of a month for the given date.\n *\n * @description\n * Return the start of a month for the given date. The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments.\n * Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed,\n * or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a month\n *\n * @example\n * // The start of a month for 2 September 2014 11:55:00:\n * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfMonth(date, options) {\n const _date = toDate(date, options?.in);\n _date.setDate(1);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfMonth;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getDaysInMonth} function options.\n */\n\n/**\n * @name getDaysInMonth\n * @category Month Helpers\n * @summary Get the number of days in a month of the given date.\n *\n * @description\n * Get the number of days in a month of the given date, considering the context if provided.\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The number of days in a month\n *\n * @example\n * // How many days are in February 2000?\n * const result = getDaysInMonth(new Date(2000, 1))\n * //=> 29\n */\nexport function getDaysInMonth(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n const monthIndex = _date.getMonth();\n const lastDayOfMonth = constructFrom(_date, 0);\n lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);\n lastDayOfMonth.setHours(0, 0, 0, 0);\n return lastDayOfMonth.getDate();\n}\n\n// Fallback for modularized imports:\nexport default getDaysInMonth;\n","import { getDefaultOptions as getInternalDefaultOptions } from \"./_lib/defaultOptions.js\";\n\n/**\n * @name getDefaultOptions\n * @category Common Helpers\n * @summary Get default options.\n * @pure false\n *\n * @description\n * Returns an object that contains defaults for\n * `options.locale`, `options.weekStartsOn` and `options.firstWeekContainsDate`\n * arguments for all functions.\n *\n * You can change these with [setDefaultOptions](https://date-fns.org/docs/setDefaultOptions).\n *\n * @returns The default options\n *\n * @example\n * const result = getDefaultOptions()\n * //=> {}\n *\n * @example\n * setDefaultOptions({ weekStarsOn: 1, firstWeekContainsDate: 4 })\n * const result = getDefaultOptions()\n * //=> { weekStarsOn: 1, firstWeekContainsDate: 4 }\n */\nexport function getDefaultOptions() {\n return Object.assign({}, getInternalDefaultOptions());\n}\n\n// Fallback for modularized imports:\nexport default getDefaultOptions;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * @name getTime\n * @category Timestamp Helpers\n * @summary Get the milliseconds timestamp of the given date.\n *\n * @description\n * Get the milliseconds timestamp of the given date.\n *\n * @param date - The given date\n *\n * @returns The timestamp\n *\n * @example\n * // Get the timestamp of 29 February 2012 11:45:05.123:\n * const result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123))\n * //=> 1330515905123\n */\nexport function getTime(date) {\n return +toDate(date);\n}\n\n// Fallback for modularized imports:\nexport default getTime;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * @name getUnixTime\n * @category Timestamp Helpers\n * @summary Get the seconds timestamp of the given date.\n *\n * @description\n * Get the seconds timestamp of the given date.\n *\n * @param date - The given date\n *\n * @returns The timestamp\n *\n * @example\n * // Get the timestamp of 29 February 2012 11:45:05 CET:\n * const result = getUnixTime(new Date(2012, 1, 29, 11, 45, 5))\n * //=> 1330512305\n */\nexport function getUnixTime(date) {\n return Math.trunc(+toDate(date) / 1000);\n}\n\n// Fallback for modularized imports:\nexport default getUnixTime;\n","import { secondsInHour } from \"./constants.js\";\n\n/**\n * @name hoursToSeconds\n * @category Conversion Helpers\n * @summary Convert hours to seconds.\n *\n * @description\n * Convert a number of hours to a full number of seconds.\n *\n * @param hours - The number of hours to be converted\n *\n * @returns The number of hours converted in seconds\n *\n * @example\n * // Convert 2 hours to seconds:\n * const result = hoursToSeconds(2)\n * //=> 7200\n */\nexport function hoursToSeconds(hours) {\n return Math.trunc(hours * secondsInHour);\n}\n\n// Fallback for modularized imports:\nexport default hoursToSeconds;\n","import { minutesInHour } from \"./constants.js\";\n\n/**\n * @name minutesToHours\n * @category Conversion Helpers\n * @summary Convert minutes to hours.\n *\n * @description\n * Convert a number of minutes to a full number of hours.\n *\n * @param minutes - The number of minutes to be converted\n *\n * @returns The number of minutes converted in hours\n *\n * @example\n * // Convert 140 minutes to hours:\n * const result = minutesToHours(120)\n * //=> 2\n *\n * @example\n * // It uses floor rounding:\n * const result = minutesToHours(179)\n * //=> 2\n */\nexport function minutesToHours(minutes) {\n const hours = minutes / minutesInHour;\n return Math.trunc(hours);\n}\n\n// Fallback for modularized imports:\nexport default minutesToHours;\n","import { addMonths } from \"./addMonths.js\";\n\n/**\n * The subMonths function options.\n */\n\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the months subtracted\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * const result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function subMonths(date, amount, options) {\n return addMonths(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subMonths;\n","import { getDefaultOptions } from 'date-fns';\n/**\n * Returns the formatted time zone name of the provided `timeZone` or the current\n * system time zone if omitted, accounting for DST according to the UTC value of\n * the date.\n */\nexport function tzIntlTimeZoneName(length, date, options) {\n const defaultOptions = getDefaultOptions();\n const dtf = getDTF(length, options.timeZone, options.locale ?? defaultOptions.locale);\n return 'formatToParts' in dtf ? partsTimeZone(dtf, date) : hackyTimeZone(dtf, date);\n}\nfunction partsTimeZone(dtf, date) {\n const formatted = dtf.formatToParts(date);\n for (let i = formatted.length - 1; i >= 0; --i) {\n if (formatted[i].type === 'timeZoneName') {\n return formatted[i].value;\n }\n }\n return undefined;\n}\nfunction hackyTimeZone(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, '');\n const tzNameMatch = / [\\w-+ ]+$/.exec(formatted);\n return tzNameMatch ? tzNameMatch[0].substr(1) : '';\n}\n// If a locale has been provided `en-US` is used as a fallback in case it is an\n// invalid locale, otherwise the locale is left undefined to use the system locale.\nfunction getDTF(length, timeZone, locale) {\n return new Intl.DateTimeFormat(locale ? [locale.code, 'en-US'] : undefined, {\n timeZone: timeZone,\n timeZoneName: length,\n });\n}\n","/**\n * Returns the [year, month, day, hour, minute, seconds] tokens of the provided\n * `date` as it will be rendered in the `timeZone`.\n */\nexport function tzTokenizeDate(date, timeZone) {\n const dtf = getDateTimeFormat(timeZone);\n return 'formatToParts' in dtf ? partsOffset(dtf, date) : hackyOffset(dtf, date);\n}\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n hour: 3,\n minute: 4,\n second: 5,\n};\nfunction partsOffset(dtf, date) {\n try {\n const formatted = dtf.formatToParts(date);\n const filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const pos = typeToPos[formatted[i].type];\n if (pos !== undefined) {\n filled[pos] = parseInt(formatted[i].value, 10);\n }\n }\n return filled;\n }\n catch (error) {\n if (error instanceof RangeError) {\n return [NaN];\n }\n throw error;\n }\n}\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const parsed = /(\\d+)\\/(\\d+)\\/(\\d+),? (\\d+):(\\d+):(\\d+)/.exec(formatted);\n // const [, fMonth, fDay, fYear, fHour, fMinute, fSecond] = parsed\n // return [fYear, fMonth, fDay, fHour, fMinute, fSecond]\n return [\n parseInt(parsed[3], 10),\n parseInt(parsed[1], 10),\n parseInt(parsed[2], 10),\n parseInt(parsed[4], 10),\n parseInt(parsed[5], 10),\n parseInt(parsed[6], 10),\n ];\n}\n// Get a cached Intl.DateTimeFormat instance for the IANA `timeZone`. This can be used\n// to get deterministic local date/time output according to the `en-US` locale which\n// can be used to extract local time parts as necessary.\nconst dtfCache = {};\n// New browsers use `hourCycle`, IE and Chrome <73 does not support it and uses `hour12`\nconst testDateFormatted = new Intl.DateTimeFormat('en-US', {\n hourCycle: 'h23',\n timeZone: 'America/New_York',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n}).format(new Date('2014-06-25T04:00:00.123Z'));\nconst hourCycleSupported = testDateFormatted === '06/25/2014, 00:00:00' ||\n testDateFormatted === '‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00';\nfunction getDateTimeFormat(timeZone) {\n if (!dtfCache[timeZone]) {\n dtfCache[timeZone] = hourCycleSupported\n ? new Intl.DateTimeFormat('en-US', {\n hourCycle: 'h23',\n timeZone: timeZone,\n year: 'numeric',\n month: 'numeric',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n })\n : new Intl.DateTimeFormat('en-US', {\n hour12: false,\n timeZone: timeZone,\n year: 'numeric',\n month: 'numeric',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n });\n }\n return dtfCache[timeZone];\n}\n","/**\n * Use instead of `new Date(Date.UTC(...))` to support years below 100 which doesn't work\n * otherwise due to the nature of the\n * [`Date` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years.\n *\n * For `Date.UTC(...)`, use `newDateUTC(...).getTime()`.\n */\nexport function newDateUTC(fullYear, month, day, hour, minute, second, millisecond) {\n const utcDate = new Date(0);\n utcDate.setUTCFullYear(fullYear, month, day);\n utcDate.setUTCHours(hour, minute, second, millisecond);\n return utcDate;\n}\n","import { tzTokenizeDate } from '../tzTokenizeDate/index.js';\nimport { newDateUTC } from '../newDateUTC/index.js';\nconst MILLISECONDS_IN_HOUR = 3600000;\nconst MILLISECONDS_IN_MINUTE = 60000;\nconst patterns = {\n timezone: /([Z+-].*)$/,\n timezoneZ: /^(Z)$/,\n timezoneHH: /^([+-]\\d{2})$/,\n timezoneHHMM: /^([+-])(\\d{2}):?(\\d{2})$/,\n};\n// Parse constious time zone offset formats to an offset in milliseconds\nexport function tzParseTimezone(timezoneString, date, isUtcDate) {\n // Empty string\n if (!timezoneString) {\n return 0;\n }\n // Z\n let token = patterns.timezoneZ.exec(timezoneString);\n if (token) {\n return 0;\n }\n let hours;\n let absoluteOffset;\n // ±hh\n token = patterns.timezoneHH.exec(timezoneString);\n if (token) {\n hours = parseInt(token[1], 10);\n if (!validateTimezone(hours)) {\n return NaN;\n }\n return -(hours * MILLISECONDS_IN_HOUR);\n }\n // ±hh:mm or ±hhmm\n token = patterns.timezoneHHMM.exec(timezoneString);\n if (token) {\n hours = parseInt(token[2], 10);\n const minutes = parseInt(token[3], 10);\n if (!validateTimezone(hours, minutes)) {\n return NaN;\n }\n absoluteOffset = Math.abs(hours) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE;\n return token[1] === '+' ? -absoluteOffset : absoluteOffset;\n }\n // IANA time zone\n if (isValidTimezoneIANAString(timezoneString)) {\n date = new Date(date || Date.now());\n const utcDate = isUtcDate ? date : toUtcDate(date);\n const offset = calcOffset(utcDate, timezoneString);\n const fixedOffset = isUtcDate ? offset : fixOffset(date, offset, timezoneString);\n return -fixedOffset;\n }\n return NaN;\n}\nfunction toUtcDate(date) {\n return newDateUTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n}\nfunction calcOffset(date, timezoneString) {\n const tokens = tzTokenizeDate(date, timezoneString);\n // ms dropped because it's not provided by tzTokenizeDate\n const asUTC = newDateUTC(tokens[0], tokens[1] - 1, tokens[2], tokens[3] % 24, tokens[4], tokens[5], 0).getTime();\n let asTS = date.getTime();\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return asUTC - asTS;\n}\nfunction fixOffset(date, offset, timezoneString) {\n const localTS = date.getTime();\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - offset;\n // Test whether the zone matches the offset for this ts\n const o2 = calcOffset(new Date(utcGuess), timezoneString);\n // If so, offset didn't change, and we're done\n if (offset === o2) {\n return offset;\n }\n // If not, change the ts by the difference in the offset\n utcGuess -= o2 - offset;\n // If that gives us the local time we want, we're done\n const o3 = calcOffset(new Date(utcGuess), timezoneString);\n if (o2 === o3) {\n return o2;\n }\n // If it's different, we're in a hole time. The offset has changed, but we don't adjust the time\n return Math.max(o2, o3);\n}\nfunction validateTimezone(hours, minutes) {\n return -23 <= hours && hours <= 23 && (minutes == null || (0 <= minutes && minutes <= 59));\n}\nconst validIANATimezoneCache = {};\nfunction isValidTimezoneIANAString(timeZoneString) {\n if (validIANATimezoneCache[timeZoneString])\n return true;\n try {\n new Intl.DateTimeFormat(undefined, { timeZone: timeZoneString });\n validIANATimezoneCache[timeZoneString] = true;\n return true;\n }\n catch (error) {\n return false;\n }\n}\n","import { tzIntlTimeZoneName } from '../../_lib/tzIntlTimeZoneName/index.js';\nimport { tzParseTimezone } from '../../_lib/tzParseTimezone/index.js';\nconst MILLISECONDS_IN_MINUTE = 60 * 1000;\nexport const formatters = {\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function (date, token, options) {\n const timezoneOffset = getTimeZoneOffset(options.timeZone, date);\n if (timezoneOffset === 0) {\n return 'Z';\n }\n switch (token) {\n // Hours and optional minutes\n case 'X':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n case 'XXXX':\n case 'XX': // Hours and minutes without `:` delimeter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n case 'XXXXX':\n case 'XXX': // Hours and minutes with `:` delimeter\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function (date, token, options) {\n const timezoneOffset = getTimeZoneOffset(options.timeZone, date);\n switch (token) {\n // Hours and optional minutes\n case 'x':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n case 'xxxx':\n case 'xx': // Hours and minutes without `:` delimeter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n case 'xxxxx':\n case 'xxx': // Hours and minutes with `:` delimeter\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (GMT)\n O: function (date, token, options) {\n const timezoneOffset = getTimeZoneOffset(options.timeZone, date);\n switch (token) {\n // Short\n case 'O':\n case 'OO':\n case 'OOO':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n case 'OOOO':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (specific non-location)\n z: function (date, token, options) {\n switch (token) {\n // Short\n case 'z':\n case 'zz':\n case 'zzz':\n return tzIntlTimeZoneName('short', date, options);\n // Long\n case 'zzzz':\n default:\n return tzIntlTimeZoneName('long', date, options);\n }\n },\n};\nfunction getTimeZoneOffset(timeZone, originalDate) {\n const timeZoneOffset = timeZone\n ? tzParseTimezone(timeZone, originalDate, true) / MILLISECONDS_IN_MINUTE\n : originalDate?.getTimezoneOffset() ?? 0;\n if (Number.isNaN(timeZoneOffset)) {\n throw new RangeError('Invalid time zone specified: ' + timeZone);\n }\n return timeZoneOffset;\n}\nfunction addLeadingZeros(number, targetLength) {\n const sign = number < 0 ? '-' : '';\n let output = Math.abs(number).toString();\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return sign + output;\n}\nfunction formatTimezone(offset, delimiter = '') {\n const sign = offset > 0 ? '-' : '+';\n const absOffset = Math.abs(offset);\n const hours = addLeadingZeros(Math.floor(absOffset / 60), 2);\n const minutes = addLeadingZeros(Math.floor(absOffset % 60), 2);\n return sign + hours + delimiter + minutes;\n}\nfunction formatTimezoneWithOptionalMinutes(offset, delimiter) {\n if (offset % 60 === 0) {\n const sign = offset > 0 ? '-' : '+';\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n return formatTimezone(offset, delimiter);\n}\nfunction formatTimezoneShort(offset, delimiter = '') {\n const sign = offset > 0 ? '-' : '+';\n const absOffset = Math.abs(offset);\n const hours = Math.floor(absOffset / 60);\n const minutes = absOffset % 60;\n if (minutes === 0) {\n return sign + String(hours);\n }\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);\n}\n","/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));\n utcDate.setUTCFullYear(date.getFullYear());\n return +date - +utcDate;\n}\n","/** Regex to identify the presence of a time zone specifier in a date string */\nexport const tzPattern = /(Z|[+-]\\d{2}(?::?\\d{2})?| UTC| [a-zA-Z]+\\/[a-zA-Z_]+(?:\\/[a-zA-Z_]+)?)$/;\n","import { getTimezoneOffsetInMilliseconds } from '../_lib/getTimezoneOffsetInMilliseconds/index.js';\nimport { tzParseTimezone } from '../_lib/tzParseTimezone/index.js';\nimport { tzPattern } from '../_lib/tzPattern/index.js';\nconst MILLISECONDS_IN_HOUR = 3600000;\nconst MILLISECONDS_IN_MINUTE = 60000;\nconst DEFAULT_ADDITIONAL_DIGITS = 2;\nconst patterns = {\n dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,\n datePattern: /^([0-9W+-]+)(.*)/,\n plainTime: /:/,\n // year tokens\n YY: /^(\\d{2})$/,\n YYY: [\n /^([+-]\\d{2})$/, // 0 additional digits\n /^([+-]\\d{3})$/, // 1 additional digit\n /^([+-]\\d{4})$/, // 2 additional digits\n ],\n YYYY: /^(\\d{4})/,\n YYYYY: [\n /^([+-]\\d{4})/, // 0 additional digits\n /^([+-]\\d{5})/, // 1 additional digit\n /^([+-]\\d{6})/, // 2 additional digits\n ],\n // date tokens\n MM: /^-(\\d{2})$/,\n DDD: /^-?(\\d{3})$/,\n MMDD: /^-?(\\d{2})-?(\\d{2})$/,\n Www: /^-?W(\\d{2})$/,\n WwwD: /^-?W(\\d{2})-?(\\d{1})$/,\n HH: /^(\\d{2}([.,]\\d*)?)$/,\n HHMM: /^(\\d{2}):?(\\d{2}([.,]\\d*)?)$/,\n HHMMSS: /^(\\d{2}):?(\\d{2}):?(\\d{2}([.,]\\d*)?)$/,\n // time zone tokens (to identify the presence of a tz)\n timeZone: tzPattern,\n};\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If an argument is a string, the function tries to parse it.\n * Function accepts complete ISO 8601 formats as well as partial implementations.\n * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601\n * If the function cannot parse the string or the values are invalid, it returns Invalid Date.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n * All *date-fns* functions will throw `RangeError` if `options.additionalDigits` is not 0, 1, 2 or undefined.\n *\n * @param argument the value to convert\n * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format\n * @param {string} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.\n *\n * @returns the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Convert string '2014-02-11T11:30:30' to date:\n * const result = toDate('2014-02-11T11:30:30')\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert string '+02014101' to date,\n * // if the additional number of digits in the extended year format is 1:\n * const result = toDate('+02014101', {additionalDigits: 1})\n * //=> Fri Apr 11 2014 00:00:00\n */\nexport function toDate(argument, options = {}) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n if (argument === null) {\n return new Date(NaN);\n }\n const additionalDigits = options.additionalDigits == null ? DEFAULT_ADDITIONAL_DIGITS : Number(options.additionalDigits);\n if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {\n throw new RangeError('additionalDigits must be 0, 1 or 2');\n }\n // Clone the date\n if (argument instanceof Date ||\n (typeof argument === 'object' && Object.prototype.toString.call(argument) === '[object Date]')) {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n }\n else if (typeof argument === 'number' ||\n Object.prototype.toString.call(argument) === '[object Number]') {\n return new Date(argument);\n }\n else if (!(Object.prototype.toString.call(argument) === '[object String]')) {\n return new Date(NaN);\n }\n const dateStrings = splitDateString(argument);\n const { year, restDateString } = parseYear(dateStrings.date, additionalDigits);\n const date = parseDate(restDateString, year);\n if (date === null || isNaN(date.getTime())) {\n return new Date(NaN);\n }\n if (date) {\n const timestamp = date.getTime();\n let time = 0;\n let offset;\n if (dateStrings.time) {\n time = parseTime(dateStrings.time);\n if (time === null || isNaN(time)) {\n return new Date(NaN);\n }\n }\n if (dateStrings.timeZone || options.timeZone) {\n offset = tzParseTimezone(dateStrings.timeZone || options.timeZone, new Date(timestamp + time));\n if (isNaN(offset)) {\n return new Date(NaN);\n }\n }\n else {\n // get offset accurate to hour in time zones that change offset\n offset = getTimezoneOffsetInMilliseconds(new Date(timestamp + time));\n offset = getTimezoneOffsetInMilliseconds(new Date(timestamp + time + offset));\n }\n return new Date(timestamp + time + offset);\n }\n else {\n return new Date(NaN);\n }\n}\nfunction splitDateString(dateString) {\n const dateStrings = {};\n let parts = patterns.dateTimePattern.exec(dateString);\n let timeString;\n if (!parts) {\n parts = patterns.datePattern.exec(dateString);\n if (parts) {\n dateStrings.date = parts[1];\n timeString = parts[2];\n }\n else {\n dateStrings.date = null;\n timeString = dateString;\n }\n }\n else {\n dateStrings.date = parts[1];\n timeString = parts[3];\n }\n if (timeString) {\n const token = patterns.timeZone.exec(timeString);\n if (token) {\n dateStrings.time = timeString.replace(token[1], '');\n dateStrings.timeZone = token[1].trim();\n }\n else {\n dateStrings.time = timeString;\n }\n }\n return dateStrings;\n}\nfunction parseYear(dateString, additionalDigits) {\n if (dateString) {\n const patternYYY = patterns.YYY[additionalDigits];\n const patternYYYYY = patterns.YYYYY[additionalDigits];\n // YYYY or ±YYYYY\n let token = patterns.YYYY.exec(dateString) || patternYYYYY.exec(dateString);\n if (token) {\n const yearString = token[1];\n return {\n year: parseInt(yearString, 10),\n restDateString: dateString.slice(yearString.length),\n };\n }\n // YY or ±YYY\n token = patterns.YY.exec(dateString) || patternYYY.exec(dateString);\n if (token) {\n const centuryString = token[1];\n return {\n year: parseInt(centuryString, 10) * 100,\n restDateString: dateString.slice(centuryString.length),\n };\n }\n }\n // Invalid ISO-formatted year\n return {\n year: null,\n };\n}\nfunction parseDate(dateString, year) {\n // Invalid ISO-formatted year\n if (year === null) {\n return null;\n }\n let date;\n let month;\n let week;\n // YYYY\n if (!dateString || !dateString.length) {\n date = new Date(0);\n date.setUTCFullYear(year);\n return date;\n }\n // YYYY-MM\n let token = patterns.MM.exec(dateString);\n if (token) {\n date = new Date(0);\n month = parseInt(token[1], 10) - 1;\n if (!validateDate(year, month)) {\n return new Date(NaN);\n }\n date.setUTCFullYear(year, month);\n return date;\n }\n // YYYY-DDD or YYYYDDD\n token = patterns.DDD.exec(dateString);\n if (token) {\n date = new Date(0);\n const dayOfYear = parseInt(token[1], 10);\n if (!validateDayOfYearDate(year, dayOfYear)) {\n return new Date(NaN);\n }\n date.setUTCFullYear(year, 0, dayOfYear);\n return date;\n }\n // yyyy-MM-dd or YYYYMMDD\n token = patterns.MMDD.exec(dateString);\n if (token) {\n date = new Date(0);\n month = parseInt(token[1], 10) - 1;\n const day = parseInt(token[2], 10);\n if (!validateDate(year, month, day)) {\n return new Date(NaN);\n }\n date.setUTCFullYear(year, month, day);\n return date;\n }\n // YYYY-Www or YYYYWww\n token = patterns.Www.exec(dateString);\n if (token) {\n week = parseInt(token[1], 10) - 1;\n if (!validateWeekDate(week)) {\n return new Date(NaN);\n }\n return dayOfISOWeekYear(year, week);\n }\n // YYYY-Www-D or YYYYWwwD\n token = patterns.WwwD.exec(dateString);\n if (token) {\n week = parseInt(token[1], 10) - 1;\n const dayOfWeek = parseInt(token[2], 10) - 1;\n if (!validateWeekDate(week, dayOfWeek)) {\n return new Date(NaN);\n }\n return dayOfISOWeekYear(year, week, dayOfWeek);\n }\n // Invalid ISO-formatted date\n return null;\n}\nfunction parseTime(timeString) {\n let hours;\n let minutes;\n // hh\n let token = patterns.HH.exec(timeString);\n if (token) {\n hours = parseFloat(token[1].replace(',', '.'));\n if (!validateTime(hours)) {\n return NaN;\n }\n return (hours % 24) * MILLISECONDS_IN_HOUR;\n }\n // hh:mm or hhmm\n token = patterns.HHMM.exec(timeString);\n if (token) {\n hours = parseInt(token[1], 10);\n minutes = parseFloat(token[2].replace(',', '.'));\n if (!validateTime(hours, minutes)) {\n return NaN;\n }\n return (hours % 24) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE;\n }\n // hh:mm:ss or hhmmss\n token = patterns.HHMMSS.exec(timeString);\n if (token) {\n hours = parseInt(token[1], 10);\n minutes = parseInt(token[2], 10);\n const seconds = parseFloat(token[3].replace(',', '.'));\n if (!validateTime(hours, minutes, seconds)) {\n return NaN;\n }\n return (hours % 24) * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * 1000;\n }\n // Invalid ISO-formatted time\n return null;\n}\nfunction dayOfISOWeekYear(isoWeekYear, week, day) {\n week = week || 0;\n day = day || 0;\n const date = new Date(0);\n date.setUTCFullYear(isoWeekYear, 0, 4);\n const fourthOfJanuaryDay = date.getUTCDay() || 7;\n const diff = week * 7 + day + 1 - fourthOfJanuaryDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}\n// Validation functions\nconst DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nconst DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nfunction isLeapYearIndex(year) {\n return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);\n}\nfunction validateDate(year, month, date) {\n if (month < 0 || month > 11) {\n return false;\n }\n if (date != null) {\n if (date < 1) {\n return false;\n }\n const isLeapYear = isLeapYearIndex(year);\n if (isLeapYear && date > DAYS_IN_MONTH_LEAP_YEAR[month]) {\n return false;\n }\n if (!isLeapYear && date > DAYS_IN_MONTH[month]) {\n return false;\n }\n }\n return true;\n}\nfunction validateDayOfYearDate(year, dayOfYear) {\n if (dayOfYear < 1) {\n return false;\n }\n const isLeapYear = isLeapYearIndex(year);\n if (isLeapYear && dayOfYear > 366) {\n return false;\n }\n if (!isLeapYear && dayOfYear > 365) {\n return false;\n }\n return true;\n}\nfunction validateWeekDate(week, day) {\n if (week < 0 || week > 52) {\n return false;\n }\n if (day != null && (day < 0 || day > 6)) {\n return false;\n }\n return true;\n}\nfunction validateTime(hours, minutes, seconds) {\n if (hours < 0 || hours >= 25) {\n return false;\n }\n if (minutes != null && (minutes < 0 || minutes >= 60)) {\n return false;\n }\n if (seconds != null && (seconds < 0 || seconds >= 60)) {\n return false;\n }\n return true;\n}\n","import { format as dateFnsFormat } from 'date-fns/format';\nimport { formatters } from './formatters/index.js';\nimport { toDate } from '../toDate/index.js';\nconst tzFormattingTokensRegExp = /([xXOz]+)|''|'(''|[^'])+('|$)/g;\n/**\n * @name format\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may consty by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://git.io/fxCyr\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 8 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 8 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Su | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Su | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Su | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Su | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | AM, PM | a..aaa | AM, PM | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 1, 2, ..., 11, 0 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 0001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | PDT, EST, CEST | 6 |\n * | | zzzz | Pacific Daylight Time | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 05/29/1453 | 7 |\n * | | PP | May 29, 1453 | 7 |\n * | | PPP | May 29th, 1453 | 7 |\n * | | PPPP | Sunday, May 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |\n * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | May 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}\n * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).\n *\n * 6. Specific non-location timezones are created using the Intl browser API. The output is determined by the\n * preferred standard of the current locale (en-US by default) which may not always give the expected result.\n * For this reason it is recommended to supply a `locale` in the format options when formatting a time zone name.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. These tokens are often confused with others. See: https://git.io/fxCyr\n *\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole\n * library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The second argument is now required for the sake of explicitness.\n *\n * ```javascript\n * // Before v2.0.0\n * format(new Date(2016, 0, 1))\n *\n * // v2.0.0 onward\n * format(new Date(2016, 0, 1), \"yyyy-MM-dd'T'HH:mm:ss.SSSxxx\")\n * ```\n *\n * - New format string API for `format` function\n * which is based on [Unicode Technical Standard\n * #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table). See [this\n * post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.\n *\n * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.\n *\n * @param date the original date\n * @param formatStr the string of tokens\n * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link\n * https://date-fns.org/docs/toDate}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See\n * [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:\n * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).\n * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens\n * (`yy`, `yyyy`). See: https://git.io/fxCyr\n * @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.\n * @param {Date|Number} [options.originalDate] - can be used to pass the original unmodified date to `format` to\n * improve correctness of the replaced timezone token close to the DST threshold.\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see:\n * https://git.io/fxCyr\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\nexport function format(date, formatStr, options = {}) {\n formatStr = String(formatStr);\n const matches = formatStr.match(tzFormattingTokensRegExp);\n if (matches) {\n const d = toDate(options.originalDate || date, options);\n // Work through each match and replace the tz token in the format string with the quoted\n // formatted time zone so the remaining tokens can be filled in by date-fns#format.\n formatStr = matches.reduce(function (result, token) {\n if (token[0] === \"'\") {\n return result; // This is a quoted portion, matched only to ensure we don't match inside it\n }\n const pos = result.indexOf(token);\n const precededByQuotedSection = result[pos - 1] === \"'\";\n const replaced = result.replace(token, \"'\" + formatters[token[0]](d, token, options) + \"'\");\n // If the replacement results in two adjoining quoted strings, the back to back quotes\n // are removed, so it doesn't look like an escaped quote.\n return precededByQuotedSection\n ? replaced.substring(0, pos - 1) + replaced.substring(pos + 1)\n : replaced;\n }, formatStr);\n }\n return dateFnsFormat(date, formatStr, options);\n}\n","import { tzParseTimezone } from '../_lib/tzParseTimezone/index.js';\nimport { toDate } from '../toDate/index.js';\n/**\n * @name toZonedTime\n * @category Time Zone Helpers\n * @summary Get a date/time representing local time in a given time zone from the UTC date\n *\n * @description\n * Returns a date instance with values representing the local time in the time zone\n * specified of the UTC time from the date provided. In other words, when the new date\n * is formatted it will show the equivalent hours in the target time zone regardless\n * of the current system time zone.\n *\n * @param date the date with the relevant UTC time\n * @param timeZone the time zone to get local time for, can be an offset or IANA time zone\n * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n *\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // In June 10am UTC is 6am in New York (-04:00)\n * const result = toZonedTime('2014-06-25T10:00:00.000Z', 'America/New_York')\n * //=> Jun 25 2014 06:00:00\n */\nexport function toZonedTime(date, timeZone, options) {\n date = toDate(date, options);\n const offsetMilliseconds = tzParseTimezone(timeZone, date, true);\n const d = new Date(date.getTime() - offsetMilliseconds);\n const resultDate = new Date(0);\n resultDate.setFullYear(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());\n resultDate.setHours(d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());\n return resultDate;\n}\n","import { format } from '../format/index.js';\nimport { toZonedTime } from '../toZonedTime/index.js';\n/**\n * @name formatInTimeZone\n * @category Time Zone Helpers\n * @summary Gets the offset in milliseconds between the time zone and Universal Coordinated Time (UTC)\n *\n * @param date the date representing the local time / real UTC time\n * @param timeZone the time zone this date should be formatted for; can be an offset or IANA time zone\n * @param formatStr the string of tokens\n * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link\n * https://date-fns.org/docs/toDate}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See\n * [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:\n * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).\n * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens\n * (`yy`, `yyyy`). See: https://git.io/fxCyr\n * @param {String} [options.timeZone=''] - used to specify the IANA time zone offset of a date String.\n */\nexport function formatInTimeZone(date, timeZone, formatStr, options) {\n options = {\n ...options,\n timeZone,\n originalDate: date,\n };\n return format(toZonedTime(date, timeZone, { timeZone: options.timeZone }), formatStr, options);\n}\n","import { toDate } from '../toDate/index.js';\nimport { tzPattern } from '../_lib/tzPattern/index.js';\nimport { tzParseTimezone } from '../_lib/tzParseTimezone/index.js';\nimport { newDateUTC } from '../_lib/newDateUTC/index.js';\n/**\n * @name fromZonedTime\n * @category Time Zone Helpers\n * @summary Get the UTC date/time from a date representing local time in a given time zone\n *\n * @description\n * Returns a date instance with the UTC time of the provided date of which the values\n * represented the local time in the time zone specified. In other words, if the input\n * date represented local time in time zone, the timestamp of the output date will\n * give the equivalent UTC of that local time regardless of the current system time zone.\n *\n * @param date the date with values representing the local time\n * @param timeZone the time zone of this local time, can be an offset or IANA time zone\n * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // In June 10am in Los Angeles is 5pm UTC\n * const result = fromZonedTime(new Date(2014, 5, 25, 10, 0, 0), 'America/Los_Angeles')\n * //=> 2014-06-25T17:00:00.000Z\n */\nexport function fromZonedTime(date, timeZone, options) {\n if (typeof date === 'string' && !date.match(tzPattern)) {\n return toDate(date, { ...options, timeZone });\n }\n date = toDate(date, options);\n const utc = newDateUTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()).getTime();\n const offsetMilliseconds = tzParseTimezone(timeZone, new Date(utc));\n return new Date(utc + offsetMilliseconds);\n}\n","import { tzParseTimezone } from '../_lib/tzParseTimezone/index.js';\n/**\n * @name getTimezoneOffset\n * @category Time Zone Helpers\n * @summary Gets the offset in milliseconds between the time zone and Universal Coordinated Time (UTC)\n *\n * @description\n * Returns the time zone offset from UTC time in milliseconds for IANA time zones as well\n * as other time zone offset string formats.\n *\n * For time zones where daylight savings time is applicable a `Date` should be passed on\n * the second parameter to ensure the offset correctly accounts for DST at that time of\n * year. When omitted, the current date is used.\n *\n * @param timeZone the time zone of this local time, can be an offset or IANA time zone\n * @param date the date with values representing the local time\n *\n * @example\n * const result = getTimezoneOffset('-07:00')\n * //=> -18000000 (-7 * 60 * 60 * 1000)\n * const result = getTimezoneOffset('Africa/Johannesburg')\n * //=> 7200000 (2 * 60 * 60 * 1000)\n * const result = getTimezoneOffset('America/New_York', new Date(2016, 0, 1))\n * //=> -18000000 (-5 * 60 * 60 * 1000)\n * const result = getTimezoneOffset('America/New_York', new Date(2016, 6, 1))\n * //=> -14400000 (-4 * 60 * 60 * 1000)\n */\nexport function getTimezoneOffset(timeZone, date) {\n return -tzParseTimezone(timeZone, date);\n}\n","import { formatInTimeZone } from 'date-fns-tz'\n\nexport interface TimeFormatOptions {\n includeTZ?: boolean\n tz?: string\n short?: boolean\n format?: 'default' | 'short' | 'full'\n}\n\n/**\n *Formats a timestamp according to the specified options\n *\n * @param ts - timestamp as number or Date\n * @param options - formatting options\n * @param options.format - format of the timestamp representing the granularity\n * 'MMM dd, yyyy hh:mm a' (default)\n * Possible values:\n * - short: 'MMM dd, yyyy'\n * - default: 'MMM dd, yyyy hh:mm a'\n * - full: 'MMM dd, yyyy hh:mm:ss.SSS a'\n * @param options.includeTZ: whether to include the timezone abbreviation in the formatted string\n * @param options.tz: timezone to use for formatting (defaults to system timezone)\n * @returns Formatted timestamp string\n */\nexport function formatTimestamp(ts: number | Date, options: TimeFormatOptions = {}) {\n const tz = options?.tz || Intl.DateTimeFormat().resolvedOptions().timeZone\n let format = 'MMM dd, yyy hh:mm a'\n\n switch (options.format) {\n case 'short':\n format = 'MMM dd, yyyy'\n break\n case 'default':\n format = 'MMM dd, yyyy hh:mm a'\n break\n case 'full':\n format = 'MMM dd, yyyy hh:mm:ss.SSS a'\n break\n }\n\n if (options.includeTZ) {\n format += ' (z)'\n }\n\n return formatInTimeZone(ts, tz, format)\n}\n\n/**\n * @deprecated use `formatTimestamp` instead\n */\nexport function formatTime(ts: number | string, options: TimeFormatOptions = {}) {\n if (!ts) {\n return ts\n }\n\n const tz = options.tz || Intl.DateTimeFormat().resolvedOptions().timeZone\n\n try {\n let timeFormat = 'MMM dd, yyy hh:mm a'\n if (options.short) {\n timeFormat = 'MMM dd, yyy'\n }\n\n if (options.includeTZ) {\n timeFormat += ' (z)'\n }\n\n const date = new Date(ts)\n\n // Note: We always need to use `formatInTimeZone` (rather than plain `format`)\n // in order to achieve consistent results based on the tz of the current computer.\n // Otherwise, unit tests can fail depending on the tz of the dev's computer (or in CI), etc.\n // Even if we don't care about timezones, timezones care about us. :/\n return formatInTimeZone(date, tz, timeFormat)\n } catch {\n console.error('Invalid value passed to formatTime', ts)\n\n return '(invalid date)'\n }\n}\n\n/**\n * Formatted display for a start and end time range\n * @param start Date from\n * @param end Date to\n * @returns Human-readable date range string\n */\nexport function formatTimeRange(start: Date, end: Date) {\n return `${formatTime(start.getTime())} - ${formatTime(end.getTime(), { includeTZ: true })}`\n}\n","import type { DruidGranularity, GranularityValues } from './types'\nimport { granularityValues } from './types'\nimport { getTimezoneOffset } from 'date-fns-tz'\n\n// Units are milliseconds, which are what Druid expects.\nexport const Granularities = {\n secondly: 1000,\n tenSecondly: 10 * 1000,\n thirtySecondly: 30 * 1000,\n minutely: 60 * 1000,\n fiveMinutely: 5 * 60 * 1000,\n tenMinutely: 10 * 60 * 1000,\n thirtyMinutely: 30 * 60 * 1000,\n hourly: 60 * 60 * 1000,\n twoHourly: 2 * 60 * 60 * 1000,\n twelveHourly: 12 * 60 * 60 * 1000,\n daily: 60 * 60 * 24 * 1000,\n weekly: 60 * 60 * 24 * 7 * 1000,\n trend: 0,\n}\n\nexport function granularitiesToOptions(\n values: GranularityValues[],\n i18n: { t: (v: string) => string },\n) {\n return values.map((v) => ({\n value: v,\n label: i18n.t(`configuration.vitals.reports.granularity.${v}`),\n }))\n}\n\nexport function granularityMsToQuery(\n granularity: number,\n origin: string,\n): DruidGranularity {\n return {\n duration: granularity,\n type: 'duration',\n origin,\n }\n}\n\nexport function msToGranularity(ms?: number): GranularityValues | null {\n if (!ms) {\n return null\n }\n\n // Note that this folds weird granularity values into known values.\n const key = granularityValues.find((k: GranularityValues) => ms <= Granularities[k])\n\n return key || null\n}\n\nfunction toNearestTimeGrain(\n op: (x: number) => number,\n date: Date,\n granularity: GranularityValues,\n tz?: string,\n): Date {\n // Days and weeks need special handling because naively trying to `ceil` or `floor` them results in a date ending\n // in midnight UTC, whereas as of now we want dates ending in midnight local time.\n // Note: right now we treat daily and weekly granularities the same way, because it's OK to request an\n // incomplete week (i.e., if it's currently Monday at noon, it's OK to request data up to Tuesday midnight for the current week).\n // Druid will just limit its query range accordingly.\n const granularityMs = Granularities[granularity]\n let tzOffsetMs = 0\n\n if (granularityMs >= Granularities.daily) {\n if (tz) {\n tzOffsetMs = -getTimezoneOffset(tz, date)\n } else {\n tzOffsetMs = date.getTimezoneOffset() * 60 * 1000\n }\n }\n\n return new Date(op((date.getTime() - tzOffsetMs) / granularityMs) * granularityMs + tzOffsetMs)\n}\n\nexport function floorToNearestTimeGrain(date: Date, granularity: GranularityValues, tz?: string): Date {\n return toNearestTimeGrain(Math.floor, date, granularity, tz)\n}\n\nexport function ceilToNearestTimeGrain(date: Date, granularity: GranularityValues, tz?: string): Date {\n return toNearestTimeGrain(Math.ceil, date, granularity, tz)\n}\n","import { getTime, getUnixTime } from 'date-fns'\n\nimport {\n ceilToNearestTimeGrain,\n floorToNearestTimeGrain,\n Granularities,\n granularityMsToQuery,\n} from './granularity'\nimport type { DruidGranularity, GranularityValues, QueryTime } from './types'\nimport type { Timeframe } from './timeframes'\n\nabstract class BaseQueryTime implements QueryTime {\n protected readonly timeframe: Timeframe\n protected readonly tz?: string\n protected readonly dataGranularity: GranularityValues\n\n constructor(timeframe: Timeframe, tz?: string, dataGranularity?: GranularityValues) {\n // This is an abstract class.\n if (this.constructor === BaseQueryTime) {\n throw new Error('BaseQueryTime is not meant to be used directly.')\n }\n\n this.timeframe = timeframe\n this.tz = tz\n this.dataGranularity = dataGranularity ?? timeframe.dataGranularity\n }\n\n abstract startDate(): Date\n\n abstract endDate(): Date\n\n abstract granularityMs(): number\n\n protected calculateStartDate(isRelative: boolean, granularity: GranularityValues, periods = 1) {\n // `periods` is greater than 1 if we're doing a delta time query.\n if (isRelative) {\n return new Date(this.endDate().getTime() - this.timeframe.timeframeLengthMs() * periods)\n } else {\n // Custom timeframes need special handling since it's hard to calculate the timeframe length.\n // For example, a custom timeframe that starts on 1/1 and ends on 1/1 has a length of 1 day, not 0.\n const ceilEnd = this.endDate()\n const rawStart = this.timeframe.rawStart(this.tz)\n const floorStart = floorToNearestTimeGrain(rawStart, granularity, this.tz)\n const timeframeLengthMs = ceilEnd.getTime() - floorStart.getTime()\n const periodOffset = timeframeLengthMs * (periods - 1)\n\n return new Date(floorStart.getTime() - periodOffset)\n }\n }\n\n granularitySeconds(): number {\n return Math.floor(this.granularityMs() / 1000)\n }\n\n granularityDruid(): DruidGranularity {\n return granularityMsToQuery(this.granularityMs(), this.startDate().toISOString())\n }\n\n // Return a UNIX timestamp suitable for use in the `start` query param.\n startSeconds(): number {\n return getUnixTime(this.startDate())\n }\n\n // Return a UNIX timestamp suitable for use in the `end` query param.\n endSeconds(): number {\n return getUnixTime(this.endDate())\n }\n\n // Return epoch time in milliseconds, suitable for use in the `startMs` query param.\n startMs(): number {\n return getTime(this.startDate())\n }\n\n // Return epoch time in milliseconds, suitable for use in the `endMs` query param.\n endMs(): number {\n return getTime(this.endDate())\n }\n}\n\n// We expect to get back a number of values, depending on the selected timeframe and granularity.\nexport class TimeseriesQueryTime extends BaseQueryTime {\n private readonly granularity: GranularityValues\n\n constructor(timeframe: Timeframe, granularity?: GranularityValues, tz?: string, dataGranularity?: GranularityValues, fineGrain?: boolean) {\n super(timeframe, tz, dataGranularity)\n\n if (granularity && timeframe.allowedGranularities(fineGrain).has(granularity)) {\n this.granularity = granularity\n } else if (fineGrain) {\n this.granularity = timeframe.fineGrainedDefaultGranularity ?? timeframe.defaultResponseGranularity\n } else {\n this.granularity = timeframe.defaultResponseGranularity\n }\n }\n\n startDate(): Date {\n return this.calculateStartDate(this.timeframe.isRelative, this.granularity)\n }\n\n endDate(): Date {\n return ceilToNearestTimeGrain(this.timeframe.rawEnd(), this.granularity, this.tz)\n }\n\n granularityMs(): number {\n return Granularities[this.granularity]\n }\n}\n\n// We expect to get back 1 value, such that we can just show a big number without any trend information.\nexport class UnaryQueryTime extends BaseQueryTime {\n startDate(): Date {\n return this.calculateStartDate(this.timeframe.isRelative, this.dataGranularity)\n }\n\n endDate(): Date {\n return ceilToNearestTimeGrain(this.timeframe.rawEnd(this.tz), this.dataGranularity, this.tz)\n }\n\n granularityMs(): number {\n return this.endDate().getTime() - this.startDate().getTime()\n }\n}\n\n// We expect to get back 2 values, such that we can make a comparison between them.\n// Note that depending on the user's tier, they might not have permission to request double their current\n// timeframe to calculate a trend.\nexport class DeltaQueryTime extends UnaryQueryTime {\n startDate(): Date {\n return this.calculateStartDate(this.timeframe.isRelative, this.dataGranularity, 2)\n }\n\n granularityMs(): number {\n // Note the `super` call -- the granularity for a DeltaQueryTime is the same as for an\n // equivalent UnaryQueryTime, despite the fact that the start time for a Delta query is earlier.\n // This property must hold in order for the current period's numbers to not change between unary\n // and delta query times.\n return this.endDate().getTime() - super.startDate().getTime()\n }\n}\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/**\n * Adds the key-value `pair` to `map`.\n *\n * @private\n * @param {Object} map The map to modify.\n * @param {Array} pair The key-value pair to add.\n * @returns {Object} Returns `map`.\n */\nfunction addMapEntry(map, pair) {\n // Don't return `map.set` because it's not chainable in IE 11.\n map.set(pair[0], pair[1]);\n return map;\n}\n\n/**\n * Adds `value` to `set`.\n *\n * @private\n * @param {Object} set The set to modify.\n * @param {*} value The value to add.\n * @returns {Object} Returns `set`.\n */\nfunction addSetEntry(set, value) {\n // Don't return `set.add` because it's not chainable in IE 11.\n set.add(value);\n return set;\n}\n\n/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array ? array.length : 0;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\n/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array ? array.length : 0;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Checks if `value` is a host object in IE < 9.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\n */\nfunction isHostObject(value) {\n // Many host objects are `Object` objects that can coerce to strings\n // despite having improperly defined `toString` methods.\n var result = false;\n if (value != null && typeof value.toString != 'function') {\n try {\n result = !!(value + '');\n } catch (e) {}\n }\n return result;\n}\n\n/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeKeys = overArg(Object.keys, Object);\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView'),\n Map = getNative(root, 'Map'),\n Promise = getNative(root, 'Promise'),\n Set = getNative(root, 'Set'),\n WeakMap = getNative(root, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n return this.has(key) && delete this.__data__[key];\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n return getMapData(this, key)['delete'](key);\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n getMapData(this, key).set(key, value);\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n this.__data__ = new ListCache(entries);\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n return this.__data__['delete'](key);\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var cache = this.__data__;\n if (cache instanceof ListCache) {\n var pairs = cache.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n return this;\n }\n cache = this.__data__ = new MapCache(pairs);\n }\n cache.set(key, value);\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {boolean} [isFull] Specify a clone including symbols.\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, isDeep, isFull, customizer, key, object, stack) {\n var result;\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n if (isHostObject(value)) {\n return object ? value : {};\n }\n result = initCloneObject(isFunc ? {} : value);\n if (!isDeep) {\n return copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, baseClone, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (!isArr) {\n var props = isFull ? getAllKeys(value) : keys(value);\n }\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));\n });\n return result;\n}\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} prototype The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nfunction baseCreate(proto) {\n return isObject(proto) ? objectCreate(proto) : {};\n}\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\n/**\n * The base implementation of `getTag`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n return objectToString.call(value);\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var result = new buffer.constructor(buffer.length);\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\n/**\n * Creates a clone of `map`.\n *\n * @private\n * @param {Object} map The map to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned map.\n */\nfunction cloneMap(map, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);\n return arrayReduce(array, addMapEntry, new map.constructor);\n}\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\n/**\n * Creates a clone of `set`.\n *\n * @private\n * @param {Object} set The set to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned set.\n */\nfunction cloneSet(set, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);\n return arrayReduce(array, addSetEntry, new set.constructor);\n}\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n assignValue(object, key, newValue === undefined ? source[key] : newValue);\n }\n return object;\n}\n\n/**\n * Copies own symbol properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * Creates an array of the own enumerable symbol properties of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11,\n// for data views in Edge < 14, and promises in Node.js.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = objectToString.call(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : undefined;\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, cloneFunc, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return cloneMap(object, isDeep, cloneFunc);\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return cloneSet(object, isDeep, cloneFunc);\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to process.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, true, true);\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = cloneDeep;\n","import {\n addDays,\n getDaysInMonth,\n hoursToSeconds,\n minutesToHours,\n startOfDay,\n startOfMonth,\n startOfWeek,\n subMonths,\n} from 'date-fns'\n\nimport {\n type ExtendedRelativeTimeRangeValues,\n relativeTimeRangeValuesV4,\n TimeframeKeys,\n} from './types'\n\nimport type {\n DatePickerSelection,\n TimeframeOptions,\n TimePeriod,\n RelativeTimeRangeValuesV4, TimeRangeV4,\n GranularityValues,\n} from './types'\nimport { getTimezoneOffset, toZonedTime, fromZonedTime } from 'date-fns-tz'\nimport type { ITimeframe } from './types/timeframe'\nimport cloneDeep from 'lodash.clonedeep'\n\nconst adjustForTz = (d: Date, tz: string) => {\n // Adjust the given date by the given TZ offset.\n return new Date(d.getTime() - getTimezoneOffset(tz, d))\n}\n\n\nexport class Timeframe implements ITimeframe {\n readonly timeframeText: string\n\n readonly key: RelativeTimeRangeValuesV4 | ExtendedRelativeTimeRangeValues | 'custom'\n\n readonly display: string\n\n readonly timeframeLength: () => number\n\n readonly allowedTiers: string[]\n\n // defaultResponseGranularity tracks which of the allowed granularities is picked for a given\n // timeframe if the user does not or cannot specify a granularity.\n readonly defaultResponseGranularity: GranularityValues\n\n // dataGranularity tracks the granularity of the available data on the server for a specific timeframe.\n // As of writing, it's always the same as the default response granularity, but it may not always be.\n // It controls how timeframes are rounded to ensure complete time buckets from the server.\n readonly dataGranularity: GranularityValues\n\n // isRelative impacts whether we take the `floor` or the `ceil` of the start time.\n // If the time range is relative, we want the ceil -- because we take the ceil of the\n // end time to make sure we're showing all the data we can for the last time bucket.\n // If the time range is absolute, we want the floor -- because otherwise we wouldn't be including\n // the first time bucket.\n readonly isRelative: boolean\n\n readonly fineGrainedDefaultGranularity?: GranularityValues\n\n private _startCustom?: Date\n\n private _endCustom?: Date\n\n private _allowedGranularitiesOverride?: GranularityValues[]\n\n constructor(opts: TimeframeOptions) {\n this.display = opts.display\n this.timeframeText = opts.timeframeText\n this.key = opts.key\n this.timeframeLength = opts.timeframeLength\n this.allowedTiers = opts.allowedTiers\n this.defaultResponseGranularity = opts.defaultResponseGranularity\n this.dataGranularity = opts.dataGranularity\n this.isRelative = opts.isRelative\n this._startCustom = opts.startCustom\n this._endCustom = opts.endCustom\n this._allowedGranularitiesOverride = opts.allowedGranularitiesOverride\n this.fineGrainedDefaultGranularity = opts.fineGrainedDefaultGranularity\n }\n\n // rawEnd does not consider granularity and should not be used directly in queries.\n // Use `new QueryTime(timeframe, granularity?).queryEndSeconds()` instead.\n // eslint-disable-next-line -- `tz` is required because it's used in subclasses.\n rawEnd(_tz?: string): Date {\n return this._endCustom || new Date()\n }\n\n // rawStart does not consider granularity and should not be used directly in queries.\n // Use `new QueryTime(timeframe, granularity?).queryStartSeconds()` instead.\n // eslint-disable-next-line -- `tz` is required because it's used in subclasses.\n rawStart(_tz?: string): Date {\n return this._startCustom || new Date(this.rawEnd().getTime() - this.timeframeLengthMs())\n }\n\n timeframeLengthMs() {\n return this.timeframeLength() * 1000\n }\n\n maximumTimeframeLength() {\n // This is overriden in the variable-length subclasses.\n return this.timeframeLength()\n }\n\n allowedGranularities(fineGrain?: boolean) {\n if (this._allowedGranularitiesOverride && fineGrain) {\n // Note: queryTime's granularity determination currently expects this to be sorted from fine to coarse.\n return new Set(this._allowedGranularitiesOverride)\n }\n\n const allowedValues: Set<GranularityValues> = new Set()\n const hours = this.maximumTimeframeLength() / 3600\n\n // Minutely is allowed for under 6 hours.\n if (hours <= 6) {\n allowedValues.add('minutely')\n }\n\n // Hourly is allowed for 1 week and under, as long as it's more than just 1 hour.\n if (hours >= 2 && hours <= 7 * 24) {\n allowedValues.add('hourly')\n }\n\n // Daily is allowed for everything over 2 days.\n if (hours >= 2 * 24) {\n allowedValues.add('daily')\n }\n\n // Weekly is allowed for everything over 2 weeks.\n if (hours >= 2 * 24 * 14) {\n allowedValues.add('weekly')\n }\n\n return allowedValues\n }\n\n cacheKey(): string {\n if (this.key !== 'custom') {\n // Right now, `key === custom` is our flag for whether we're dealing with an absolute or relative timeframe.\n return this.key\n }\n\n return `${this.rawStart().toISOString()}-${this.rawEnd().toISOString()}`\n }\n\n v4Query(tz?: string): TimeRangeV4 {\n if (this.key === 'custom') {\n // Right now, `key === custom` is our flag for whether we're dealing with an absolute or relative timeframe.\n return {\n type: 'absolute',\n start: this.rawStart(),\n end: this.rawEnd(),\n tz,\n }\n }\n\n if (relativeTimeRangeValuesV4.includes(this.key as any)) {\n return {\n type: 'relative',\n // Safe assertion; we just checked that key is a member of the union.\n time_range: this.key as RelativeTimeRangeValuesV4,\n tz,\n }\n }\n\n throw new Error('Unsupported relative time value for Explore')\n }\n\n protected tzAdjustedDate(tz?: string): Date {\n if (!tz) {\n return new Date()\n }\n\n // Take `new Date()` and adjust it so that it's within the given TZ\n // instead of the current environment's TZ.\n const tzNeutral = fromZonedTime(new Date(), (new Intl.DateTimeFormat()).resolvedOptions().timeZone)\n return toZonedTime(tzNeutral, tz)\n }\n}\n\nclass CurrentWeek extends Timeframe {\n rawStart(tz?: string): Date {\n // `startOfWeek` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let thisMonday = startOfWeek(this.tzAdjustedDate(tz), { weekStartsOn: 1 })\n\n if (tz) {\n thisMonday = adjustForTz(thisMonday, tz)\n }\n\n return thisMonday\n }\n\n maximumTimeframeLength() {\n return 60 * 60 * 24 * 7\n }\n}\n\nclass CurrentMonth extends Timeframe {\n rawStart(tz?: string): Date {\n // `startOfMonth` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let firstOfTheMonth = startOfMonth(this.tzAdjustedDate(tz))\n\n if (tz) {\n firstOfTheMonth = adjustForTz(firstOfTheMonth, tz)\n }\n\n return firstOfTheMonth\n }\n\n maximumTimeframeLength() {\n return 60 * 60 * 24 * 31\n }\n}\n\nclass CurrentYear extends Timeframe {\n rawStart(tz?: string): Date {\n let firstOfTheYear = new Date(this.tzAdjustedDate(tz).getFullYear(), 0, 1)\n\n if (tz) {\n firstOfTheYear = adjustForTz(firstOfTheYear, tz)\n }\n\n return firstOfTheYear\n }\n\n maximumTimeframeLength() {\n return 60 * 60 * 24 * 366\n }\n}\n\nclass PreviousWeek extends Timeframe {\n rawEnd(tz?: string): Date {\n // `startOfWeek` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let thisMonday = startOfWeek(this.tzAdjustedDate(tz), { weekStartsOn: 1 })\n\n if (tz) {\n thisMonday = adjustForTz(thisMonday, tz)\n }\n\n return thisMonday\n }\n\n rawStart(tz?: string): Date {\n const date = this.tzAdjustedDate(tz)\n\n // `startOfWeek` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let lastMonday = startOfWeek(date.setDate(date.getDate() - 7), {\n weekStartsOn: 1,\n })\n\n if (tz) {\n lastMonday = adjustForTz(lastMonday, tz)\n }\n\n return lastMonday\n }\n}\n\nclass PreviousMonth extends Timeframe {\n rawEnd(tz?: string): Date {\n // `startOfMonth` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let thisMonth = startOfMonth(this.tzAdjustedDate(tz))\n\n if (tz) {\n thisMonth = adjustForTz(thisMonth, tz)\n }\n\n return thisMonth\n }\n\n rawStart(tz?: string): Date {\n // `startOfMonth` isn't aware of timezones, so the resulting \"start of month\" time is in the local timezone.\n let lastMonth = startOfMonth(subMonths(this.tzAdjustedDate(tz), 1))\n\n if (tz) {\n lastMonth = adjustForTz(lastMonth, tz)\n }\n\n return lastMonth\n }\n}\n\nclass PreviousYear extends Timeframe {\n rawEnd(tz?: string): Date {\n let thisYear = new Date(this.tzAdjustedDate(tz).getFullYear(), 0, 1)\n\n if (tz) {\n thisYear = adjustForTz(thisYear, tz)\n }\n\n return thisYear\n }\n\n rawStart(tz?: string): Date {\n let lastYear = new Date(this.tzAdjustedDate(tz).getFullYear() - 1, 0, 1)\n\n if (tz) {\n lastYear = adjustForTz(lastYear, tz)\n }\n\n return lastYear\n }\n}\n\n// These TimePeriod definitions request a default granularity and can be adjusted\n//\n// Using <string, any> as a temp workaround for TimePeriods.get() potentially returning `undefined` lint issue.\n// This means we opt out of safety checks; similar to this workaround:\n// https://github.com/microsoft/TypeScript/issues/41045#issuecomment-706717682\n\nexport const TimePeriods = new Map<string, Timeframe>([\n [\n TimeframeKeys.FIFTEEN_MIN,\n new Timeframe({\n key: TimeframeKeys.FIFTEEN_MIN,\n display: 'Last 15 minutes',\n timeframeText: '15 minutes',\n timeframeLength: () => 60 * 15,\n defaultResponseGranularity: 'minutely',\n dataGranularity: 'minutely',\n isRelative: true,\n fineGrainedDefaultGranularity: 'thirtySecondly',\n allowedTiers: ['free', 'trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['tenSecondly', 'thirtySecondly', 'minutely'],\n }),\n ],\n [\n TimeframeKeys.ONE_HOUR,\n new Timeframe({\n key: TimeframeKeys.ONE_HOUR,\n display: 'Last hour',\n timeframeText: 'One hour',\n timeframeLength: () => 60 * 60 * 1,\n defaultResponseGranularity: 'minutely',\n dataGranularity: 'minutely',\n isRelative: true,\n fineGrainedDefaultGranularity: 'minutely',\n allowedTiers: ['free', 'trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['tenSecondly', 'thirtySecondly', 'minutely', 'fiveMinutely', 'tenMinutely'],\n }),\n ],\n [\n TimeframeKeys.SIX_HOUR,\n new Timeframe({\n key: TimeframeKeys.SIX_HOUR,\n display: 'Last 6 hours',\n timeframeText: '6 hours',\n timeframeLength: () => 60 * 60 * 6,\n defaultResponseGranularity: 'hourly',\n dataGranularity: 'hourly',\n isRelative: true,\n fineGrainedDefaultGranularity: 'fiveMinutely',\n allowedTiers: ['free', 'trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['thirtySecondly', 'minutely', 'fiveMinutely', 'tenMinutely', 'thirtyMinutely', 'hourly'],\n }),\n ],\n [\n TimeframeKeys.TWELVE_HOUR,\n new Timeframe({\n key: TimeframeKeys.TWELVE_HOUR,\n display: 'Last 12 hours',\n timeframeText: '12 hours',\n timeframeLength: () => 60 * 60 * 12,\n defaultResponseGranularity: 'hourly',\n dataGranularity: 'hourly',\n isRelative: true,\n fineGrainedDefaultGranularity: 'tenMinutely',\n allowedTiers: ['free', 'trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['minutely', 'fiveMinutely', 'tenMinutely', 'thirtyMinutely', 'hourly'],\n }),\n ],\n [\n TimeframeKeys.ONE_DAY,\n new Timeframe({\n key: TimeframeKeys.ONE_DAY,\n display: 'Last 24 hours',\n timeframeText: '24 hours',\n timeframeLength: () => 60 * 60 * 24,\n defaultResponseGranularity: 'hourly',\n dataGranularity: 'hourly',\n isRelative: true,\n fineGrainedDefaultGranularity: 'thirtyMinutely',\n allowedTiers: ['free', 'trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['fiveMinutely', 'tenMinutely', 'thirtyMinutely', 'hourly'],\n }),\n ],\n [\n TimeframeKeys.SEVEN_DAY,\n new Timeframe({\n key: TimeframeKeys.SEVEN_DAY,\n display: 'Last 7 days',\n timeframeText: '7 days',\n timeframeLength: () => 60 * 60 * 24 * 7,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: true,\n fineGrainedDefaultGranularity: 'twoHourly',\n allowedTiers: ['trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['thirtyMinutely', 'hourly', 'twoHourly', 'twelveHourly', 'daily'],\n }),\n ],\n [\n TimeframeKeys.THIRTY_DAY,\n new Timeframe({\n key: TimeframeKeys.THIRTY_DAY,\n display: 'Last 30 days',\n timeframeText: '30 days',\n timeframeLength: () => 60 * 60 * 24 * 30,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: true,\n fineGrainedDefaultGranularity: 'twelveHourly',\n allowedTiers: ['trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['hourly', 'twoHourly', 'twelveHourly', 'daily', 'weekly'],\n }),\n ],\n [\n TimeframeKeys.NINETY_DAY,\n new Timeframe({\n key: TimeframeKeys.NINETY_DAY,\n display: 'Last 90 days',\n timeframeText: '90 days',\n timeframeLength: () => 60 * 60 * 24 * 90,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: true,\n fineGrainedDefaultGranularity: 'daily',\n allowedTiers: ['trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['hourly', 'twoHourly', 'twelveHourly', 'daily', 'weekly'],\n }),\n ],\n [\n TimeframeKeys.ONE_HUNDRED_EIGHTY_DAY,\n new Timeframe({\n key: TimeframeKeys.ONE_HUNDRED_EIGHTY_DAY,\n display: 'Last 180 days',\n timeframeText: '180 days',\n timeframeLength: () => 60 * 60 * 24 * 180,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: true,\n fineGrainedDefaultGranularity: 'daily',\n allowedTiers: ['trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['hourly', 'twoHourly', 'twelveHourly', 'daily', 'weekly'],\n }),\n ],\n [\n TimeframeKeys.ONE_YEAR,\n new Timeframe({\n key: TimeframeKeys.ONE_YEAR,\n display: 'Last 365 days',\n timeframeText: '365 days',\n timeframeLength: () => 60 * 60 * 24 * 365,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: true,\n fineGrainedDefaultGranularity: 'daily',\n allowedTiers: ['trial', 'plus', 'enterprise'],\n allowedGranularitiesOverride: ['hourly', 'twoHourly', 'twelveHourly', 'daily', 'weekly'],\n }),\n ],\n [\n TimeframeKeys.CURRENT_WEEK,\n new CurrentWeek({\n key: TimeframeKeys.CURRENT_WEEK,\n display: 'This week',\n timeframeText: 'Week',\n timeframeLength: () => {\n // Monday -> now\n const prevMonday = startOfWeek(new Date(), { weekStartsOn: 1 })\n const end = startOfDay(addDays(new Date(), 1))\n\n return (end.getTime() - prevMonday.getTime()) / 1000\n },\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n fineGrainedDefaultGranularity: 'twoHourly',\n allowedTiers: ['plus', 'enterprise'],\n allowedGranularitiesOverride: ['thirtyMinutely', 'hourly', 'twoHourly', 'twelveHourly', 'daily'],\n }),\n ],\n [\n TimeframeKeys.CURRENT_MONTH,\n new CurrentMonth({\n key: TimeframeKeys.CURRENT_MONTH,\n display: 'This month',\n timeframeText: 'Month',\n timeframeLength: () => {\n // First of the month -> now\n const firstOfTheMonth = startOfMonth(new Date())\n const end = startOfDay(addDays(new Date(), 1))\n\n return (end.getTime() - firstOfTheMonth.getTime()) / 1000\n },\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n allowedTiers: ['plus', 'enterprise'],\n }),\n ],\n [\n TimeframeKeys.CURRENT_YEAR,\n new CurrentYear({\n key: TimeframeKeys.CURRENT_YEAR,\n display: 'This year',\n timeframeText: 'Year',\n timeframeLength: () => {\n // Jan 1 -> now\n const firstOfTheYear = new Date(new Date().getFullYear(), 0, 1)\n const end = startOfDay(addDays(new Date(), 1))\n\n return (end.getTime() - firstOfTheYear.getTime()) / 1000\n },\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n allowedTiers: ['plus', 'enterprise'],\n }),\n ],\n [\n TimeframeKeys.PREVIOUS_WEEK,\n new PreviousWeek({\n key: TimeframeKeys.PREVIOUS_WEEK,\n display: 'Previous week',\n timeframeText: 'Week',\n timeframeLength: () => 60 * 60 * 24 * 7,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n fineGrainedDefaultGranularity: 'twoHourly',\n allowedTiers: ['plus', 'enterprise'],\n allowedGranularitiesOverride: ['thirtyMinutely', 'hourly', 'twoHourly', 'twelveHourly', 'daily'],\n }),\n ],\n [\n TimeframeKeys.PREVIOUS_MONTH,\n new PreviousMonth({\n key: TimeframeKeys.PREVIOUS_MONTH,\n display: 'Previous month',\n timeframeText: 'Month',\n timeframeLength: () => {\n let offset = 0\n const end = startOfMonth(new Date())\n const start = startOfMonth(subMonths(new Date(), 1))\n if (end.getTimezoneOffset() !== start.getTimezoneOffset()) {\n offset = dstOffsetHours(end, start)\n }\n\n // Not all months have the same number of days.\n // Current month may be observing DST while previous is not\n // take this into account when calculating the timeframe length for previous month\n return (\n 60 * 60 * 24 * getDaysInMonth(new Date().setMonth(new Date().getMonth() - 1)) + hoursToSeconds(offset)\n )\n },\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n allowedTiers: ['plus', 'enterprise'],\n }),\n ],\n [\n TimeframeKeys.PREVIOUS_YEAR,\n new PreviousYear({\n key: TimeframeKeys.PREVIOUS_YEAR,\n display: 'Previous year',\n timeframeText: 'Year',\n timeframeLength: () => {\n // Not all years have the same number of days (leap years).\n const end = new Date(new Date().getFullYear(), 0, 1)\n const start = new Date(new Date().getFullYear() - 1, 0, 1)\n let offset = 0\n if (end.getTimezoneOffset() !== start.getTimezoneOffset()) {\n offset = dstOffsetHours(end, start)\n }\n\n return 60 * 60 * 24 * (365 + (start.getFullYear() % 4 === 0 ? 1 : 0)) + hoursToSeconds(offset)\n },\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n allowedTiers: ['plus', 'enterprise'],\n }),\n ],\n])\n\nexport function datePickerSelectionToTimeframe(datePickerSelection: DatePickerSelection): Timeframe {\n const start = new Date(datePickerSelection.start)\n const end = new Date(datePickerSelection.end)\n const timeframeLength = (end.getTime() - start.getTime()) / 1000\n\n const selectedTimePeriod =\n datePickerSelection.timePeriodsKey && cloneDeep(TimePeriods.get(datePickerSelection.timePeriodsKey))\n\n // Note: for custom timeframes, the timeframeLength is approximate: due to rounding\n // based on granularity, the actual length will be slightly greater.\n\n return (\n selectedTimePeriod ||\n new Timeframe({\n key: 'custom',\n timeframeText: 'custom',\n display: 'custom',\n startCustom: start,\n endCustom: end,\n timeframeLength: () => timeframeLength,\n defaultResponseGranularity: 'daily',\n dataGranularity: 'daily',\n isRelative: false,\n allowedTiers: ['free', 'plus', 'enterprise'],\n })\n )\n}\n\nexport function timeframeToDatepickerSelection(timeframe: Timeframe): DatePickerSelection {\n // Only set `timePeriodsKey` if a relative time frame is chosen\n // Custom time ranges are denoted by the absence of this key\n return {\n ...(timeframe.key !== 'custom' && { timePeriodsKey: timeframe.key }),\n start: timeframe.rawStart(),\n end: timeframe.rawEnd(),\n }\n}\n\nexport function timeframeToDatepickerTimeperiod(timeframe: Timeframe): TimePeriod {\n // The datepicker needs `start` and `end` functions for its timeperiods.\n return {\n key: timeframe.key,\n display: timeframe.display,\n timeframeText: timeframe.timeframeText,\n timeframeLength: () => timeframe.key, // Used to generate test IDs for the Kongponent.\n start: () => timeframe.rawStart(),\n end: () => timeframe.rawEnd(),\n }\n}\n\nexport function dstOffsetHours(d1: Date, d2: Date): number {\n return minutesToHours(d1.getTimezoneOffset() - d2.getTimezoneOffset())\n}\n\nexport const TIMEFRAME_LOOKUP: Record<string, TimeframeKeys> = {\n '15M': TimeframeKeys.FIFTEEN_MIN,\n '1H': TimeframeKeys.ONE_HOUR,\n '6H': TimeframeKeys.SIX_HOUR,\n '12H': TimeframeKeys.TWELVE_HOUR,\n '24H': TimeframeKeys.ONE_DAY,\n '7D': TimeframeKeys.SEVEN_DAY,\n '15m': TimeframeKeys.FIFTEEN_MIN,\n '1h': TimeframeKeys.ONE_HOUR,\n '6h': TimeframeKeys.SIX_HOUR,\n '12h': TimeframeKeys.TWELVE_HOUR,\n '24h': TimeframeKeys.ONE_DAY,\n '7d': TimeframeKeys.SEVEN_DAY,\n '30d': TimeframeKeys.THIRTY_DAY,\n '90d': TimeframeKeys.NINETY_DAY,\n '180d': TimeframeKeys.ONE_HUNDRED_EIGHTY_DAY,\n '365d': TimeframeKeys.ONE_YEAR,\n current_week: TimeframeKeys.CURRENT_WEEK,\n current_month: TimeframeKeys.CURRENT_MONTH,\n current_year: TimeframeKeys.CURRENT_YEAR,\n previous_week: TimeframeKeys.PREVIOUS_WEEK,\n previous_month: TimeframeKeys.PREVIOUS_MONTH,\n previous_year: TimeframeKeys.PREVIOUS_YEAR,\n}\n","export class SeededRandom {\n\n private _seed: number\n\n constructor(seed: number) {\n this._seed = seed\n }\n\n next(min: number, max: number) {\n const x = Math.sin(this._seed++) * 10000\n const res = x - Math.floor(x)\n\n return Math.floor(res * (max - min + 1)) + min\n }\n}\n","import type {\n DimensionMap,\n ExploreAggregations,\n MetricUnit,\n DisplayBlob,\n RecordEvent,\n QueryResponseMeta,\n ExploreResultV4,\n} from '../types'\nimport { SeededRandom } from './SeedRandom'\nimport { rand } from '../utils'\n\nexport interface Metric {\n name: string\n unit: string\n}\n\nexport const generateSingleMetricTimeSeriesData = (metric: Metric, dimensionMap?: DimensionMap, metaOverrides?: Partial<QueryResponseMeta>) => {\n const seed = rand(10, 10000)\n const rng = new SeededRandom(seed)\n\n const start = Date.now() - 6 * 60 * 60 * 1000 // 6 hours ago\n const end = Date.now()\n const data = []\n let totalRequests = 0\n\n for (let i = start; i <= end; i += 60 * 60 * 1000) { // 1 hour apart\n if (dimensionMap) {\n // If dimensionMap is provided, create an event for each dimension value\n for (const dimension in dimensionMap) {\n dimensionMap[dimension].forEach(dimensionValue => {\n totalRequests += rng.next(50, 500)\n\n const event = {\n [dimension]: dimensionValue,\n [metric.name]: totalRequests,\n }\n\n const record = {\n version: '1.0',\n timestamp: new Date(i).toISOString(),\n event,\n }\n data.push(record)\n })\n }\n } else {\n // If no dimensionMap is provided, create a single event\n totalRequests += rng.next(50, 500)\n\n const record = {\n version: '1.0',\n timestamp: new Date(i).toISOString(),\n event: {\n [metric.name]: totalRequests,\n },\n }\n data.push(record)\n }\n }\n\n // V4 display blob\n const displayBlob: DisplayBlob = {}\n\n if (dimensionMap) {\n for (const dimension in dimensionMap) {\n displayBlob[dimension] = {}\n dimensionMap[dimension].forEach(dimensionValue => {\n displayBlob[dimension][dimensionValue] = {\n name: dimensionValue,\n deleted: false,\n }\n })\n }\n }\n\n const meta: QueryResponseMeta = {\n start_ms: start,\n end_ms: end,\n start: new Date(start).toISOString(),\n end: new Date(end).toISOString(),\n query_id: '12345',\n metric_names: [metric.name] as ExploreAggregations[],\n metric_units: {\n [metric.name]: metric.unit,\n },\n granularity_ms: 60 * 60 * 1000, // 1 hour in ms\n display: displayBlob,\n ...(metaOverrides ?? {}),\n }\n\n return {\n data,\n meta,\n } as ExploreResultV4\n}\n\nexport const generateMultipleMetricTimeSeriesData = (metrics: Metric[], metaOverrides?: Partial<QueryResponseMeta>) => {\n const seed = rand(10, 10000)\n const rng = new SeededRandom(seed)\n\n const start = Date.now() - 6 * 60 * 60 * 1000 // 6 hours ago\n const end = Date.now()\n const data = []\n const metricValues: { [metric: string]: number } = {}\n\n metrics.forEach(metric => {\n metricValues[metric.name] = 0\n })\n\n for (let i = start; i <= end; i += 60 * 60 * 1000) { // 1 hour apart\n const event: RecordEvent = {}\n\n metrics.forEach(metric => {\n metricValues[metric.name] += rng.next(50, 500)\n event[metric.name] = metricValues[metric.name]\n })\n\n const record = {\n version: '1.0',\n timestamp: new Date(i).toISOString(),\n event,\n }\n data.push(record)\n }\n\n const meta: QueryResponseMeta = {\n start_ms: start,\n end_ms: end,\n start: new Date(start).toISOString(),\n end: new Date(end).toISOString(),\n query_id: '12345',\n metric_names: metrics.map(metric => metric.name) as ExploreAggregations[],\n metric_units: metrics.reduce((units: MetricUnit, metric) => {\n units[metric.name as ExploreAggregations] = metric.unit\n return units\n }, {}),\n granularity_ms: 60 * 60 * 1000, // 1 hour in ms\n display: {},\n ...(metaOverrides ?? {}),\n }\n\n return {\n data,\n meta,\n } as ExploreResultV4\n}\n\nexport const generateCrossSectionalData = (metrics: Metric[], dimensionMap?: DimensionMap, metaOverrides?: Partial<QueryResponseMeta>) => {\n const seed = Math.floor(Math.random() * (10000 - 10 + 1)) + 10\n const rng = new SeededRandom(seed)\n\n const start = Date.now() - 6 * 60 * 60 * 1000 // 6 hours ago\n const end = Date.now()\n const timestamp = new Date((start + end) / 2).toISOString()\n\n const data = []\n\n if (dimensionMap) {\n const dimensions = Object.keys(dimensionMap)\n const dimensionValues = Object.values(dimensionMap)\n\n // Recursively create a record for each combination of dimension values\n const createRecords = (currentEvent: RecordEvent, index: number) => {\n if (index === dimensions.length) {\n // All dimensions have been added to the event, add metrics and push the record\n metrics.forEach(metric => {\n currentEvent[metric.name] = rng.next(1000, 50000000)\n })\n data.push({\n version: '1.0',\n timestamp: new Date().toISOString(),\n event: { ...currentEvent },\n })\n return\n }\n\n dimensionValues[index].forEach(value => {\n createRecords({ ...currentEvent, [dimensions[index]]: value }, index + 1)\n })\n }\n\n createRecords({}, 0)\n } else {\n // If no dimensionMap is provided, create a single event with all metrics\n const event: RecordEvent = {}\n metrics.forEach(metric => {\n event[metric.name] = rng.next(50, 500)\n })\n\n data.push({\n version: '1.0',\n timestamp,\n event,\n })\n }\n\n // V4 display blob\n const displayBlob: DisplayBlob = {}\n\n if (dimensionMap) {\n for (const dimension in dimensionMap) {\n displayBlob[dimension] = {}\n dimensionMap[dimension].forEach(dimensionValue => {\n displayBlob[dimension][dimensionValue] = {\n name: dimensionValue,\n deleted: false,\n }\n })\n }\n }\n\n const meta: QueryResponseMeta = {\n start_ms: start,\n end_ms: end,\n start: new Date(start).toISOString(),\n end: new Date(end).toISOString(),\n query_id: '12345',\n metric_names: metrics.map(metric => metric.name) as ExploreAggregations[],\n metric_units: metrics.reduce((units: MetricUnit, metric) => {\n units[metric.name as ExploreAggregations] = metric.unit\n return units\n }, {}),\n truncated: false,\n limit: 50,\n display: displayBlob,\n granularity_ms: end - start,\n ...(metaOverrides ?? {}),\n }\n\n return {\n data,\n meta,\n } as ExploreResultV4\n}\n","export function rand(min: number, max: number): number {\n min = Math.ceil(min)\n max = Math.floor(max)\n return Math.floor(Math.random() * (max - min + 1) + min)\n}\n","import type { CountryIsoMap, CountryISOA2 } from '../types'\n\nimport { COUNTRIES } from '../types'\n\nexport const countries: Map<string, CountryIsoMap> = new Map(COUNTRIES.map(country => [country.code, { code: country.code, name: country.name }]))\n\nexport const getCountryName = (country_code: CountryISOA2) => {\n return countries.get(country_code)?.name || country_code\n}\n","/* Approximate Number - outputs numbers in human-readable format, similar to ls -lh or Stack Overflow's reputation\n *\n * https://github.com/nfriedly/approximate-number\n *\n * Copyright (c) 2014 Nathan Friedly\n * Licensed under the MIT license.\n */\n(function() {\n 'use strict';\n\n function addCommas(num, opts) {\n if (opts.separator === false) {\n return num.toString();\n }\n\n if (num < 1000) {\n return num.toString();\n }\n\n var separator = (typeof opts.separator === 'string' ? opts.separator : ',');\n\n var out = [],\n digits = Math.round(num).toString().split('');\n\n digits.reverse().forEach(function(digit, i){\n if (i && i%3 === 0) {\n out.push(separator);\n }\n out.push(digit);\n });\n\n return out.reverse().join('');\n }\n\n function formatDec(num, base, opts) {\n var workingNum = num/base;\n var ROUND = opts.round ? 'round' : 'floor';\n if (opts.decimal === false) {\n num = Math[ROUND](workingNum);\n return num.toString();\n }\n if (opts.precision) {\n num = workingNum;\n } else {\n num = workingNum < 10 ? (Math[ROUND](workingNum * 10) / 10) : Math[ROUND](workingNum);\n }\n num = num.toString();\n if (typeof opts.decimal === 'string') {\n num = num.replace('.', opts.decimal);\n }\n return num;\n }\n\n var THOUSAND = 1000;\n var TEN_THOUSAND = 10000;\n var MILLION = 1000000;\n var BILLION = 1000000000;\n var TRILLION = 1000000000000;\n\n /**\n * Converts big numbers into human-readable forms\n * @param {Number} num\n * @param {Object} [opts]\n * @param {String|Boolean} [opts.separator=','] Thousands separator - set to a string (e.g. '.') to use that string or false to not use any separator\n * @param {String|Boolean} [opts.decimal='.'] Decimal - set to a string (e.g. ',') to use that or set to false to avoid outputting values with a decimal\n * @param {Boolean} [opts.round=false] Round numbers off rather than flooring/truncating. When true, 105000 would become '11m', when false it becomes '10m'\n * @param {Boolean} [opts.min10k=false] Do not abbreviate numbers below 10000. E.g. 9999 would become '9,999' rather than '9k'. (Stack Overflow-style)\n * @param {String} [opts.prefix=''] Optional string to prepend to the value, e.g. '$'\n * @param {String} [opts.suffix=''] Optional string to append to the value, e.g. '%'\n * @param {Boolean} [opts.capital=false] Set to true to use capital letters, e.g. 3.9M instead of 3.9m\n * @param {Number} [opts.precision] Optional number of significant digits. Must be greater than 0.\n *\n * @returns {String}\n */\n function approximateNumber(num, opts) {\n var numString;\n opts = opts || {};\n\n // if we're working on a negative number, convert it to positive and then prefix the final result with a -\n var negative = num < 0;\n if (negative) {\n num = Math.abs(num);\n }\n\n if (opts.precision) {\n num = parseFloat(num.toPrecision(opts.precision));\n }\n\n var thousandsBreak = opts.min10k ? TEN_THOUSAND : THOUSAND;\n\n if (num < thousandsBreak) {\n numString = addCommas(formatDec(num, 1, opts), opts);\n } else if (opts.precision && opts.precision > Math.log10(num)) {\n numString = addCommas(formatDec(num, 1, opts), opts);\n } else if (num < MILLION) {\n numString = formatDec(num, THOUSAND, opts) + 'k';\n } else if (num < BILLION) {\n numString = formatDec(num, MILLION, opts) + 'm';\n } else if (num < TRILLION) {\n numString = addCommas(formatDec(num, BILLION, opts), opts) + 'b';\n } else {\n numString = addCommas(formatDec(num, TRILLION, opts), opts) + 't';\n }\n\n if (negative) {\n numString = '-' + numString;\n }\n\n if (opts.capital) {\n numString = numString.toUpperCase();\n }\n\n if (opts.prefix) {\n numString = opts.prefix + numString;\n }\n if (opts.suffix) {\n numString = numString + opts.suffix;\n }\n\n return numString;\n }\n\n approximateNumber.addCommas = addCommas;\n\n if (typeof module === 'object') {\n // node.js/common js\n module.exports = approximateNumber;\n } else if (typeof define === 'function') {\n // require.js/amd\n define([], approximateNumber);\n } else if(typeof window !== 'undefined') {\n window.approximateNumber = approximateNumber;\n }\n}());\n","import type { IntlShapeEx } from '@kong-ui-public/i18n'\n// @ts-ignore - approximate-number no exported module\nimport approxNum from 'approximate-number'\n\n// Guard against SSR/non-browser contexts where `document` is undefined\nconst defaultLocale = (typeof document !== 'undefined' && document.documentElement?.lang) || 'en-US'\n\nexport const numberFormatter = new Intl.NumberFormat(defaultLocale)\n\nexport function unitFormatter<T extends Record<string, any>>({\n i18n,\n} : {\n i18n: IntlShapeEx<T>\n}) {\n\n const formatBytes = (value: number, isBytes1024?: boolean): string => {\n if (isNaN(value)) {\n return '0 B'\n }\n\n const pb = isBytes1024 ? Math.pow(2, 50) : 1e15\n const tb = isBytes1024 ? Math.pow(2, 40) : 1e12\n const gb = isBytes1024 ? Math.pow(2, 30) : 1e9\n const mb = isBytes1024 ? Math.pow(2, 20) : 1e6\n const kb = isBytes1024 ? Math.pow(2, 10) : 1e3\n\n let out\n\n if (value >= pb) {\n out = i18n.formatNumber(\n Number.parseFloat((value / pb).toPrecision(3)),\n { style: 'unit', unit: 'petabyte', unitDisplay: 'narrow' },\n )\n } else if (value >= tb) {\n out = i18n.formatNumber(\n Number.parseFloat((value / tb).toPrecision(3)),\n { style: 'unit', unit: 'terabyte', unitDisplay: 'narrow' },\n )\n } else if (value >= gb) {\n out = i18n.formatNumber(\n Number.parseFloat((value / gb).toPrecision(3)),\n { style: 'unit', unit: 'gigabyte', unitDisplay: 'narrow' },\n )\n } else if (value >= mb) {\n out = i18n.formatNumber(\n Number.parseFloat((value / mb).toPrecision(3)),\n { style: 'unit', unit: 'megabyte', unitDisplay: 'narrow' },\n )\n } else if (value >= kb) {\n out = i18n.formatNumber(\n Number.parseFloat((value / kb).toPrecision(3)),\n { style: 'unit', unit: 'kilobyte', unitDisplay: 'narrow' },\n )\n } else {\n out = i18n.formatNumber(\n Number.parseFloat((value).toPrecision(3)),\n { style: 'unit', unit: 'byte', unitDisplay: 'narrow' },\n )\n }\n\n // i18n.formatNumber formats it as `10.77kB` but we want `10.77 kB`\n return out.replace(/([a-zA-Z]*)$/, ' $1')\n }\n\n const formatCost = (value: number, currency: string = 'USD'): string => {\n if (isNaN(value)) {\n return currency === 'USD' ? '$0.00' : `${value}`\n }\n\n if (value >= 0.01 || currency !== 'USD') {\n return i18n.formatNumber(value, { style: 'currency', currency })\n }\n\n if (value < 0.0001) {\n return '< $0.0001'\n }\n\n // when currency is USD, special case handling for 0.0001 to 0.01\n return `$${Number.parseFloat(value.toPrecision(4))}`\n\n }\n\n type FormatNumberOptions = {\n isBytes1024?: boolean\n currency?: string\n // not supported for bytes or currency formatting\n approximate?: boolean\n translateUnit?: (unit: string, value: number) => string\n }\n\n /*\n * currently the units supported are those returned from\n * https://github.com/Kong/kanalytics/blob/main/src/druid/druid.service.ts#L58-L73\n */\n const formatUnit = (value: number, unit: string, {\n isBytes1024 = false,\n currency = 'USD',\n approximate = false,\n translateUnit = (unit: string) => unit,\n }: FormatNumberOptions = {}): string => {\n const translatedUnit = translateUnit(unit, value)\n\n switch (unit) {\n case 'bytes':\n return formatBytes(value, isBytes1024)\n case 'usd':\n return formatCost(value, currency)\n case 'ms':\n case 'count/minute':\n case 'token count':\n case 'count':\n default:\n if (isNaN(value)) {\n return `${value}`\n }\n if (approximate) {\n return `${approxNum(value, { capital: true })} ${translatedUnit}`\n }\n return value >= 0.01\n ? `${numberFormatter.format(Number.parseFloat(value.toFixed(2)))} ${translatedUnit}`\n : `${Number.parseFloat(value.toPrecision(4))} ${translatedUnit}`\n }\n }\n\n const formatRange = (min: number, max: number, unit: string, {\n isBytes1024 = false,\n currency = 'USD',\n approximate = false,\n translateUnit = (unit: string) => unit,\n }: FormatNumberOptions = {}): string => {\n\n const translatedUnit = translateUnit(unit, max)\n\n switch (unit) {\n case 'bytes':\n return `${formatBytes(min, isBytes1024)} - ${formatBytes(max, isBytes1024)}`\n case 'usd':\n return `${formatCost(min, currency)} - ${formatCost(max, currency)}`\n case 'ms':\n case 'count/minute':\n case 'token count':\n case 'count':\n default:\n if (isNaN(min) || isNaN(max)) {\n return `${min} - ${max}`\n }\n if (approximate) {\n return `${approxNum(min, { capital: true })} - ${approxNum(max, { capital: true })} ${translatedUnit}`\n }\n }\n const minVal = min >= 0.01\n ? `${numberFormatter.format(Number.parseFloat(min.toFixed(2)))}`\n : `${Number.parseFloat(min.toPrecision(4))}`\n\n const maxVal = max >= 0.01\n ? `${numberFormatter.format(Number.parseFloat(max.toFixed(2)))}`\n : `${Number.parseFloat(max.toPrecision(4))}`\n\n return `${minVal} - ${maxVal} ${translatedUnit}`\n }\n\n return { formatUnit, formatBytes, formatCost, formatRange }\n}\n"],"names":["INJECT_QUERY_PROVIDER","TimeframeKeys","extendedRelativeTimeRangeValues","reportChartTypes","exploreFilterTypesV2","requestFilterTypeEqualsV2","requestFilterTypeMetricV2","requestFilterTypeEmptyV2","requestFilterTypeWildcardV2","timeRangeTypeV2","relativeTimeRangeValuesV4","granularityValues","makeFilterable","queryable","d","queryableBasicExploreDimensions","filterableBasicExploreDimensions","basicExploreAggregations","queryableExploreDimensions","filterableExploreDimensions","exploreAggregations","queryableAiExploreDimensions","filterableAiExploreDimensions","aiExploreAggregations","queryableRequestDimensions","filterableRequestDimensions","queryableRequestWildcardDimensions","filterableRequestWildcardDimensions","queryableRequestMetrics","filterableRequestMetrics","relativeTimeRangeValuesRequestV2","queryDatasources","datasourceToFilterableDimensions","stripUnknownFilters","datasource","filters","f","COUNTRIES","dashboardTileTypes","syntheticsDataKey","chartTitle","allowCsvExport","chartDatasetColorsSchema","slottableSchema","barChartSchema","thresholdSchema","timeseriesChartSchema","gaugeChartSchema","donutChartSchema","topNTableSchema","metricCardSchema","singleValueSchema","choroplethMapSchema","c","baseQueryProperties","metricsFn","aggregations","dimensionsFn","dimensions","filtersFn","filterableDimensions","apiUsageQuerySchema","basicQuerySchema","llmUsageSchema","validDashboardQuery","tileDefinitionSchema","tileLayoutSchema","tileConfigSchema","dashboardConfigSchema","getFieldDataSources","dimension","datasources","formatDistanceLocale","formatDistance","token","count","options","result","tokenValue","buildFormatLongFn","args","width","dateFormats","timeFormats","dateTimeFormats","formatLong","formatRelativeLocale","formatRelative","_date","_baseDate","_options","buildLocalizeFn","value","context","valuesArray","defaultWidth","index","eraValues","quarterValues","monthValues","dayValues","dayPeriodValues","formattingDayPeriodValues","localize","dirtyNumber","number","rem100","quarter","buildMatchFn","string","matchPattern","matchResult","matchedString","parsePatterns","key","findIndex","pattern","findKey","rest","object","predicate","array","buildMatchPatternFn","parseResult","matchOrdinalNumberPattern","parseOrdinalNumberPattern","matchEraPatterns","parseEraPatterns","matchQuarterPatterns","parseQuarterPatterns","matchMonthPatterns","parseMonthPatterns","matchDayPatterns","parseDayPatterns","matchDayPeriodPatterns","parseDayPeriodPatterns","match","enUS","defaultOptions","getDefaultOptions","millisecondsInWeek","millisecondsInDay","minutesInHour","secondsInHour","constructFromSymbol","constructFrom","date","toDate","argument","getTimezoneOffsetInMilliseconds","utcDate","normalizeDates","dates","normalize","startOfDay","differenceInCalendarDays","laterDate","earlierDate","laterDate_","earlierDate_","laterStartOfDay","earlierStartOfDay","laterTimestamp","earlierTimestamp","startOfYear","date_","getDayOfYear","startOfWeek","weekStartsOn","_b","_a","_d","_c","day","diff","startOfISOWeek","getISOWeekYear","year","fourthOfJanuaryOfNextYear","startOfNextYear","fourthOfJanuaryOfThisYear","startOfThisYear","startOfISOWeekYear","fourthOfJanuary","getISOWeek","getWeekYear","firstWeekContainsDate","firstWeekOfNextYear","firstWeekOfThisYear","startOfWeekYear","firstWeek","getWeek","addLeadingZeros","targetLength","sign","output","lightFormatters","signedYear","month","dayPeriodEnumValue","numberOfDigits","milliseconds","fractionalSeconds","dayPeriodEnum","formatters","era","signedWeekYear","weekYear","twoDigitYear","isoWeekYear","week","isoWeek","dayOfYear","dayOfWeek","localDayOfWeek","isoDayOfWeek","hours","_localize","timezoneOffset","formatTimezoneWithOptionalMinutes","formatTimezone","formatTimezoneShort","timestamp","offset","delimiter","absOffset","minutes","dateLongFormatter","timeLongFormatter","longFormatters","datePattern","timePattern","dateTimeFormat","dayOfYearTokenRE","weekYearTokenRE","throwTokens","isProtectedDayOfYearToken","isProtectedWeekYearToken","warnOrThrowProtectedError","format","input","_message","message","subject","isDate","isValid","formattingTokensRegExp","longFormattingTokensRegExp","escapedStringRegExp","doubleQuoteRegExp","unescapedLatinCharacterRegExp","formatStr","locale","defaultLocale","_f","_e","_h","_g","originalDate","parts","substring","firstCharacter","longFormatter","cleanEscapedString","formatterOptions","part","formatter","matched","addDays","amount","addMonths","dayOfMonth","endOfDesiredMonth","daysInMonth","startOfMonth","getDaysInMonth","monthIndex","lastDayOfMonth","getInternalDefaultOptions","getTime","getUnixTime","hoursToSeconds","minutesToHours","subMonths","tzIntlTimeZoneName","length","dtf","getDTF","partsTimeZone","hackyTimeZone","formatted","i","tzNameMatch","timeZone","tzTokenizeDate","getDateTimeFormat","partsOffset","hackyOffset","typeToPos","filled","pos","error","parsed","dtfCache","testDateFormatted","hourCycleSupported","newDateUTC","fullYear","hour","minute","second","millisecond","MILLISECONDS_IN_HOUR","MILLISECONDS_IN_MINUTE","patterns","tzParseTimezone","timezoneString","isUtcDate","absoluteOffset","validateTimezone","isValidTimezoneIANAString","toUtcDate","calcOffset","fixOffset","tokens","asUTC","asTS","over","utcGuess","o2","o3","validIANATimezoneCache","timeZoneString","getTimeZoneOffset","timeZoneOffset","tzPattern","DEFAULT_ADDITIONAL_DIGITS","additionalDigits","dateStrings","splitDateString","restDateString","parseYear","parseDate","time","parseTime","dateString","timeString","patternYYY","patternYYYYY","yearString","centuryString","validateDate","validateDayOfYearDate","validateWeekDate","dayOfISOWeekYear","validateTime","seconds","fourthOfJanuaryDay","DAYS_IN_MONTH","DAYS_IN_MONTH_LEAP_YEAR","isLeapYearIndex","isLeapYear","tzFormattingTokensRegExp","matches","precededByQuotedSection","replaced","dateFnsFormat","toZonedTime","offsetMilliseconds","resultDate","formatInTimeZone","fromZonedTime","utc","getTimezoneOffset","formatTimestamp","ts","tz","formatTime","timeFormat","formatTimeRange","start","end","Granularities","granularitiesToOptions","values","i18n","v","granularityMsToQuery","granularity","origin","msToGranularity","ms","k","toNearestTimeGrain","op","granularityMs","tzOffsetMs","floorToNearestTimeGrain","ceilToNearestTimeGrain","BaseQueryTime","timeframe","dataGranularity","__publicField","isRelative","periods","ceilEnd","rawStart","floorStart","periodOffset","TimeseriesQueryTime","fineGrain","UnaryQueryTime","DeltaQueryTime","LARGE_ARRAY_SIZE","HASH_UNDEFINED","MAX_SAFE_INTEGER","argsTag","arrayTag","boolTag","dateTag","errorTag","funcTag","genTag","mapTag","numberTag","objectTag","promiseTag","regexpTag","setTag","stringTag","symbolTag","weakMapTag","arrayBufferTag","dataViewTag","float32Tag","float64Tag","int8Tag","int16Tag","int32Tag","uint8Tag","uint8ClampedTag","uint16Tag","uint32Tag","reRegExpChar","reFlags","reIsHostCtor","reIsUint","cloneableTags","freeGlobal","global","freeSelf","root","freeExports","exports","freeModule","module","moduleExports","addMapEntry","map","pair","addSetEntry","set","arrayEach","iteratee","arrayPush","arrayReduce","accumulator","initAccum","baseTimes","n","getValue","isHostObject","mapToArray","overArg","func","transform","arg","setToArray","arrayProto","funcProto","objectProto","coreJsData","maskSrcKey","uid","funcToString","hasOwnProperty","objectToString","reIsNative","Buffer","Symbol","Uint8Array","getPrototype","objectCreate","propertyIsEnumerable","splice","nativeGetSymbols","nativeIsBuffer","nativeKeys","DataView","getNative","Map","Promise","Set","WeakMap","nativeCreate","dataViewCtorString","toSource","mapCtorString","promiseCtorString","setCtorString","weakMapCtorString","symbolProto","symbolValueOf","Hash","entries","entry","hashClear","hashDelete","hashGet","data","hashHas","hashSet","ListCache","listCacheClear","listCacheDelete","assocIndexOf","lastIndex","listCacheGet","listCacheHas","listCacheSet","MapCache","mapCacheClear","mapCacheDelete","getMapData","mapCacheGet","mapCacheHas","mapCacheSet","Stack","stackClear","stackDelete","stackGet","stackHas","stackSet","cache","pairs","arrayLikeKeys","inherited","isArray","isArguments","skipIndexes","isIndex","assignValue","objValue","eq","baseAssign","source","copyObject","keys","baseClone","isDeep","isFull","customizer","stack","isObject","isArr","initCloneArray","copyArray","tag","getTag","isFunc","isBuffer","cloneBuffer","initCloneObject","copySymbols","initCloneByTag","stacked","props","getAllKeys","subValue","baseCreate","proto","baseGetAllKeys","keysFunc","symbolsFunc","baseGetTag","baseIsNative","isMasked","isFunction","baseKeys","isPrototype","buffer","cloneArrayBuffer","arrayBuffer","cloneDataView","dataView","cloneMap","cloneFunc","cloneRegExp","regexp","cloneSet","cloneSymbol","symbol","cloneTypedArray","typedArray","newValue","getSymbols","isKeyable","stubArray","Ctor","ctorString","type","cloneDeep","other","isArrayLikeObject","isArrayLike","isLength","isObjectLike","stubFalse","adjustForTz","Timeframe","opts","_tz","allowedValues","tzNeutral","CurrentWeek","thisMonday","CurrentMonth","firstOfTheMonth","CurrentYear","firstOfTheYear","PreviousWeek","lastMonday","PreviousMonth","thisMonth","lastMonth","PreviousYear","thisYear","lastYear","TimePeriods","prevMonday","dstOffsetHours","datePickerSelectionToTimeframe","datePickerSelection","timeframeLength","timeframeToDatepickerSelection","timeframeToDatepickerTimeperiod","d1","d2","TIMEFRAME_LOOKUP","SeededRandom","seed","min","max","x","res","generateSingleMetricTimeSeriesData","metric","dimensionMap","metaOverrides","rand","rng","totalRequests","dimensionValue","event","record","displayBlob","meta","generateMultipleMetricTimeSeriesData","metrics","metricValues","units","generateCrossSectionalData","dimensionValues","createRecords","currentEvent","countries","country","getCountryName","country_code","addCommas","num","separator","out","digits","digit","formatDec","base","workingNum","ROUND","THOUSAND","TEN_THOUSAND","MILLION","BILLION","TRILLION","approximateNumber","numString","negative","thousandsBreak","numberFormatter","unitFormatter","formatBytes","isBytes1024","pb","tb","gb","mb","kb","formatCost","currency","unit","approximate","translateUnit","translatedUnit","approxNum","minVal","maxVal"],"mappings":"8aAIO,MAAMA,GAAwB,2BCH9B,IAAKC,GAAAA,IACVA,EAAA,YAAc,MACdA,EAAA,SAAW,KACXA,EAAA,SAAW,KACXA,EAAA,YAAc,MACdA,EAAA,QAAU,MACVA,EAAA,UAAY,KACZA,EAAA,WAAa,MACbA,EAAA,WAAa,MACbA,EAAA,uBAAyB,OACzBA,EAAA,SAAW,OACXA,EAAA,aAAe,eACfA,EAAA,cAAgB,gBAChBA,EAAA,gBAAkB,kBAClBA,EAAA,aAAe,eACfA,EAAA,cAAgB,gBAChBA,EAAA,eAAiB,iBACjBA,EAAA,iBAAmB,mBACnBA,EAAA,cAAgB,gBAlBNA,IAAAA,GAAA,CAAA,CAAA,ECiBL,MAAMC,GAAkC,CAAC,MAAO,OAAQ,OAAQ,eAAgB,eAAe,EClBzFC,GAAmB,CAC9B,iBACA,eACA,kBACA,iBACA,iBACA,QACA,cACF,ECPaC,GAAuB,CAAC,KAAM,SAAU,UAAU,EAIlDC,GAA4B,CAAC,IAAK,IAAI,EAItCC,GAA4B,CAAC,IAAK,KAAM,IAAK,IAAK,KAAM,IAAI,EAI5DC,GAA2B,CAAC,QAAS,WAAW,EAIhDC,GAA8B,CAAC,cAAe,WAAW,EAUzDC,GAAkB,CAAC,WAAY,UAAU,EAYzCC,GAA4B,CACvC,MACA,KACA,KACA,MACA,MACA,KACA,eACA,gBACA,MACA,gBACA,gBACF,EAkBaC,GAAoB,CAC/B,WACA,cACA,iBACA,WACA,eACA,cACA,iBACA,SACA,YACA,eACA,QACA,SACA,OACF,ECxEaC,GAAgDC,GAC3DA,EAAU,OAAOC,GAAKA,IAAM,MAAM,ECTvBC,GAAkC,CAC7C,MACA,cACA,cACA,sBACA,gBACA,sBACA,kBACA,kBACA,SACA,QACA,cACA,sBACA,MACF,EAIaC,GAAmCJ,GAAeG,EAA+B,EAcjFE,GAA2B,CACtC,kBACA,gBACA,qBACA,0BACF,ECpCaC,GAA6B,CACxC,GAAGH,GACH,cACA,WACA,eACA,uBACA,+BACA,kBACA,0BACA,QACA,YACF,EAIaI,GAA8BP,GAAeM,EAA0B,EAYvEE,GAAsB,CACjC,GAAGH,GACH,uBACA,uBACA,uBACA,uBACA,uBACA,uBACA,2BACA,mBACA,mBACA,mBACA,uBACA,oBACA,oBACA,oBACA,wBACA,oBACA,mBACA,mBACA,mBACA,uBACA,kBACF,ECnDaI,GAA+B,CAC1C,gBACA,sBACA,kBACA,WACA,cACA,QACA,cACA,oBACA,mBACA,mBACA,0BACA,uBACA,OACA,QACA,cACA,sBACA,WACF,EAIaC,GAAgCV,GAAeS,EAA4B,EAY3EE,GAAwB,CACnC,eACA,gBACA,oBACA,mBACA,OACA,uCACA,kCACA,sBACA,wBACA,qBACF,EC5CaC,GAA6B,CACxC,MACA,cACA,cACA,sBACA,cACA,YACA,YACA,WACA,iBACA,gBACA,sBACA,eACA,kBACA,0BACA,kBACA,cACA,oBACA,cACA,SACA,QACA,aACA,cACA,+BACA,kBACA,QACA,eACA,mBACA,MACA,sBACA,OACA,WACA,eACA,+BACA,WACF,EAIaC,GAA8Bb,GAAeY,EAA0B,EAIvEE,GAAqC,CAChD,YACA,YACA,0BACA,cACA,oBACA,cACA,aACA,cACA,+BACA,kBACA,eACA,mBACA,WACA,cACF,EAIaC,GAAsCD,GAItCE,GAA0B,CACrC,WACA,wBACA,wBACA,4BACA,oBACA,qBACA,iCACA,cACA,sBACF,EAIaC,GAA2BjB,GAAegB,EAAuB,EAmCjEE,GAAmC,CAC9C,MACA,KACA,KACA,MACA,MACA,IACF,EChHaC,GAAmB,CAAC,QAAS,YAAa,WAAW,EAYrDC,GAAyE,CACpF,MAAO,IAAI,IAAIhB,EAAgC,EAC/C,UAAW,IAAI,IAAIG,EAA2B,EAC9C,UAAW,IAAI,IAAIG,EAA6B,CAClD,EAGaW,GA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