@everymatrix/lottery-oddsbom-entrance 0.0.1

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.
Files changed (62) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-b0be9007.js +1245 -0
  3. package/dist/cjs/index.cjs.js +11 -0
  4. package/dist/cjs/loader.cjs.js +15 -0
  5. package/dist/cjs/lottery-oddsbom-bomb_2.cjs.entry.js +3000 -0
  6. package/dist/cjs/lottery-oddsbom-entrance-95c48b1c.js +6887 -0
  7. package/dist/cjs/lottery-oddsbom-entrance.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +19 -0
  9. package/dist/collection/components/lottery-oddsbom-entrance/index.js +1 -0
  10. package/dist/collection/components/lottery-oddsbom-entrance/lottery-oddsbom-entrance.css +77 -0
  11. package/dist/collection/components/lottery-oddsbom-entrance/lottery-oddsbom-entrance.js +295 -0
  12. package/dist/collection/components/static/oddsbomben-negative.svg +7 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/models/index.js +6 -0
  15. package/dist/collection/utils/locale.utils.js +65 -0
  16. package/dist/collection/utils/utils.js +9 -0
  17. package/dist/esm/app-globals-0f993ce5.js +3 -0
  18. package/dist/esm/index-275ec96c.js +1217 -0
  19. package/dist/esm/index.js +3 -0
  20. package/dist/esm/loader.js +11 -0
  21. package/dist/esm/lottery-oddsbom-bomb_2.entry.js +2996 -0
  22. package/dist/esm/lottery-oddsbom-entrance-89457e53.js +6882 -0
  23. package/dist/esm/lottery-oddsbom-entrance.js +20 -0
  24. package/dist/index.cjs.js +1 -0
  25. package/dist/index.js +1 -0
  26. package/dist/lottery-oddsbom-entrance/app-globals-0f993ce5.js +1 -0
  27. package/dist/lottery-oddsbom-entrance/index-275ec96c.js +2 -0
  28. package/dist/lottery-oddsbom-entrance/index.esm.js +1 -0
  29. package/dist/lottery-oddsbom-entrance/lottery-oddsbom-bomb_2.entry.js +1 -0
  30. package/dist/lottery-oddsbom-entrance/lottery-oddsbom-entrance-89457e53.js +6657 -0
  31. package/dist/lottery-oddsbom-entrance/lottery-oddsbom-entrance.esm.js +1 -0
  32. package/dist/static/empty-info.svg +1 -0
  33. package/dist/static/oddsbomben-negative.svg +7 -0
  34. package/dist/stencil.config.dev.js +19 -0
  35. package/dist/stencil.config.js +19 -0
  36. package/dist/storybook/main.js +43 -0
  37. package/dist/storybook/preview.js +9 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-entrance/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-entrance/.stencil/packages/stencil/lottery-oddsbom-entrance/stencil.config.d.ts +2 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-entrance/.stencil/packages/stencil/lottery-oddsbom-entrance/stencil.config.dev.d.ts +2 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-entrance/.stencil/packages/stencil/lottery-oddsbom-entrance/storybook/main.d.ts +3 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-entrance/.stencil/packages/stencil/lottery-oddsbom-entrance/storybook/preview.d.ts +70 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-entrance/.stencil/tools/plugins/index.d.ts +4 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-entrance/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  45. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-entrance/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  46. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-entrance/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  47. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-oddsbom-entrance/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  48. package/dist/types/components/lottery-oddsbom-entrance/index.d.ts +1 -0
  49. package/dist/types/components/lottery-oddsbom-entrance/lottery-oddsbom-entrance.d.ts +54 -0
  50. package/dist/types/components.d.ts +111 -0
  51. package/dist/types/index.d.ts +1 -0
  52. package/dist/types/models/index.d.ts +9 -0
  53. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  54. package/dist/types/utils/locale.utils.d.ts +2 -0
  55. package/dist/types/utils/utils.d.ts +5 -0
  56. package/loader/cdn.js +1 -0
  57. package/loader/index.cjs.js +1 -0
  58. package/loader/index.d.ts +24 -0
  59. package/loader/index.es2017.js +1 -0
  60. package/loader/index.js +2 -0
  61. package/loader/package.json +11 -0
  62. package/package.json +27 -0
@@ -0,0 +1,2996 @@
1
+ import { h, r as registerInstance, c as createEvent, g as getAssetPath } from './index-275ec96c.js';
2
+ import { s as setClientStyling, a as setClientStylingURL, b as setStreamStyling } from './lottery-oddsbom-entrance-89457e53.js';
3
+ export { L as lottery_oddsbom_entrance } from './lottery-oddsbom-entrance-89457e53.js';
4
+ import '@everymatrix/lottery-oddsbom-latest-result-group';
5
+
6
+ var Bomb;
7
+ (function (Bomb) {
8
+ Bomb["Football"] = "Football";
9
+ Bomb["IceHockey"] = "IceHockey";
10
+ Bomb["Mixed"] = "Mixed";
11
+ })(Bomb || (Bomb = {}));
12
+
13
+ function _typeof(o) {
14
+ "@babel/helpers - typeof";
15
+
16
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
17
+ return typeof o;
18
+ } : function (o) {
19
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
20
+ }, _typeof(o);
21
+ }
22
+
23
+ function toInteger(dirtyNumber) {
24
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
25
+ return NaN;
26
+ }
27
+ var number = Number(dirtyNumber);
28
+ if (isNaN(number)) {
29
+ return number;
30
+ }
31
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
32
+ }
33
+
34
+ function requiredArgs(required, args) {
35
+ if (args.length < required) {
36
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
37
+ }
38
+ }
39
+
40
+ /**
41
+ * @name toDate
42
+ * @category Common Helpers
43
+ * @summary Convert the given argument to an instance of Date.
44
+ *
45
+ * @description
46
+ * Convert the given argument to an instance of Date.
47
+ *
48
+ * If the argument is an instance of Date, the function returns its clone.
49
+ *
50
+ * If the argument is a number, it is treated as a timestamp.
51
+ *
52
+ * If the argument is none of the above, the function returns Invalid Date.
53
+ *
54
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
55
+ *
56
+ * @param {Date|Number} argument - the value to convert
57
+ * @returns {Date} the parsed date in the local time zone
58
+ * @throws {TypeError} 1 argument required
59
+ *
60
+ * @example
61
+ * // Clone the date:
62
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
63
+ * //=> Tue Feb 11 2014 11:30:30
64
+ *
65
+ * @example
66
+ * // Convert the timestamp to date:
67
+ * const result = toDate(1392098430000)
68
+ * //=> Tue Feb 11 2014 11:30:30
69
+ */
70
+ function toDate(argument) {
71
+ requiredArgs(1, arguments);
72
+ var argStr = Object.prototype.toString.call(argument);
73
+
74
+ // Clone the date
75
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
76
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
77
+ return new Date(argument.getTime());
78
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
79
+ return new Date(argument);
80
+ } else {
81
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
82
+ // eslint-disable-next-line no-console
83
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
84
+ // eslint-disable-next-line no-console
85
+ console.warn(new Error().stack);
86
+ }
87
+ return new Date(NaN);
88
+ }
89
+ }
90
+
91
+ /**
92
+ * @name addDays
93
+ * @category Day Helpers
94
+ * @summary Add the specified number of days to the given date.
95
+ *
96
+ * @description
97
+ * Add the specified number of days to the given date.
98
+ *
99
+ * @param {Date|Number} date - the date to be changed
100
+ * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
101
+ * @returns {Date} - the new date with the days added
102
+ * @throws {TypeError} - 2 arguments required
103
+ *
104
+ * @example
105
+ * // Add 10 days to 1 September 2014:
106
+ * const result = addDays(new Date(2014, 8, 1), 10)
107
+ * //=> Thu Sep 11 2014 00:00:00
108
+ */
109
+ function addDays(dirtyDate, dirtyAmount) {
110
+ requiredArgs(2, arguments);
111
+ var date = toDate(dirtyDate);
112
+ var amount = toInteger(dirtyAmount);
113
+ if (isNaN(amount)) {
114
+ return new Date(NaN);
115
+ }
116
+ if (!amount) {
117
+ // If 0 days, no-op to avoid changing times in the hour before end of DST
118
+ return date;
119
+ }
120
+ date.setDate(date.getDate() + amount);
121
+ return date;
122
+ }
123
+
124
+ /**
125
+ * @name addMilliseconds
126
+ * @category Millisecond Helpers
127
+ * @summary Add the specified number of milliseconds to the given date.
128
+ *
129
+ * @description
130
+ * Add the specified number of milliseconds to the given date.
131
+ *
132
+ * @param {Date|Number} date - the date to be changed
133
+ * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
134
+ * @returns {Date} the new date with the milliseconds added
135
+ * @throws {TypeError} 2 arguments required
136
+ *
137
+ * @example
138
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
139
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
140
+ * //=> Thu Jul 10 2014 12:45:30.750
141
+ */
142
+ function addMilliseconds(dirtyDate, dirtyAmount) {
143
+ requiredArgs(2, arguments);
144
+ var timestamp = toDate(dirtyDate).getTime();
145
+ var amount = toInteger(dirtyAmount);
146
+ return new Date(timestamp + amount);
147
+ }
148
+
149
+ var defaultOptions = {};
150
+ function getDefaultOptions() {
151
+ return defaultOptions;
152
+ }
153
+
154
+ /**
155
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
156
+ * They usually appear for dates that denote time before the timezones were introduced
157
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
158
+ * and GMT+01:00:00 after that date)
159
+ *
160
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
161
+ * which would lead to incorrect calculations.
162
+ *
163
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
164
+ */
165
+ function getTimezoneOffsetInMilliseconds(date) {
166
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
167
+ utcDate.setUTCFullYear(date.getFullYear());
168
+ return date.getTime() - utcDate.getTime();
169
+ }
170
+
171
+ /**
172
+ * @name startOfDay
173
+ * @category Day Helpers
174
+ * @summary Return the start of a day for the given date.
175
+ *
176
+ * @description
177
+ * Return the start of a day for the given date.
178
+ * The result will be in the local timezone.
179
+ *
180
+ * @param {Date|Number} date - the original date
181
+ * @returns {Date} the start of a day
182
+ * @throws {TypeError} 1 argument required
183
+ *
184
+ * @example
185
+ * // The start of a day for 2 September 2014 11:55:00:
186
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
187
+ * //=> Tue Sep 02 2014 00:00:00
188
+ */
189
+ function startOfDay(dirtyDate) {
190
+ requiredArgs(1, arguments);
191
+ var date = toDate(dirtyDate);
192
+ date.setHours(0, 0, 0, 0);
193
+ return date;
194
+ }
195
+
196
+ /**
197
+ * Days in 1 week.
198
+ *
199
+ * @name daysInWeek
200
+ * @constant
201
+ * @type {number}
202
+ * @default
203
+ */
204
+
205
+ /**
206
+ * Milliseconds in 1 minute
207
+ *
208
+ * @name millisecondsInMinute
209
+ * @constant
210
+ * @type {number}
211
+ * @default
212
+ */
213
+ var millisecondsInMinute = 60000;
214
+
215
+ /**
216
+ * Milliseconds in 1 hour
217
+ *
218
+ * @name millisecondsInHour
219
+ * @constant
220
+ * @type {number}
221
+ * @default
222
+ */
223
+ var millisecondsInHour = 3600000;
224
+
225
+ /**
226
+ * @name isSameDay
227
+ * @category Day Helpers
228
+ * @summary Are the given dates in the same day (and year and month)?
229
+ *
230
+ * @description
231
+ * Are the given dates in the same day (and year and month)?
232
+ *
233
+ * @param {Date|Number} dateLeft - the first date to check
234
+ * @param {Date|Number} dateRight - the second date to check
235
+ * @returns {Boolean} the dates are in the same day (and year and month)
236
+ * @throws {TypeError} 2 arguments required
237
+ *
238
+ * @example
239
+ * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
240
+ * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))
241
+ * //=> true
242
+ *
243
+ * @example
244
+ * // Are 4 September and 4 October in the same day?
245
+ * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))
246
+ * //=> false
247
+ *
248
+ * @example
249
+ * // Are 4 September, 2014 and 4 September, 2015 in the same day?
250
+ * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))
251
+ * //=> false
252
+ */
253
+ function isSameDay(dirtyDateLeft, dirtyDateRight) {
254
+ requiredArgs(2, arguments);
255
+ var dateLeftStartOfDay = startOfDay(dirtyDateLeft);
256
+ var dateRightStartOfDay = startOfDay(dirtyDateRight);
257
+ return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();
258
+ }
259
+
260
+ /**
261
+ * @name isDate
262
+ * @category Common Helpers
263
+ * @summary Is the given value a date?
264
+ *
265
+ * @description
266
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
267
+ *
268
+ * @param {*} value - the value to check
269
+ * @returns {boolean} true if the given value is a date
270
+ * @throws {TypeError} 1 arguments required
271
+ *
272
+ * @example
273
+ * // For a valid date:
274
+ * const result = isDate(new Date())
275
+ * //=> true
276
+ *
277
+ * @example
278
+ * // For an invalid date:
279
+ * const result = isDate(new Date(NaN))
280
+ * //=> true
281
+ *
282
+ * @example
283
+ * // For some value:
284
+ * const result = isDate('2014-02-31')
285
+ * //=> false
286
+ *
287
+ * @example
288
+ * // For an object:
289
+ * const result = isDate({})
290
+ * //=> false
291
+ */
292
+ function isDate(value) {
293
+ requiredArgs(1, arguments);
294
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
295
+ }
296
+
297
+ /**
298
+ * @name isValid
299
+ * @category Common Helpers
300
+ * @summary Is the given date valid?
301
+ *
302
+ * @description
303
+ * Returns false if argument is Invalid Date and true otherwise.
304
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
305
+ * Invalid Date is a Date, whose time value is NaN.
306
+ *
307
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
308
+ *
309
+ * @param {*} date - the date to check
310
+ * @returns {Boolean} the date is valid
311
+ * @throws {TypeError} 1 argument required
312
+ *
313
+ * @example
314
+ * // For the valid date:
315
+ * const result = isValid(new Date(2014, 1, 31))
316
+ * //=> true
317
+ *
318
+ * @example
319
+ * // For the value, convertable into a date:
320
+ * const result = isValid(1393804800000)
321
+ * //=> true
322
+ *
323
+ * @example
324
+ * // For the invalid date:
325
+ * const result = isValid(new Date(''))
326
+ * //=> false
327
+ */
328
+ function isValid(dirtyDate) {
329
+ requiredArgs(1, arguments);
330
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
331
+ return false;
332
+ }
333
+ var date = toDate(dirtyDate);
334
+ return !isNaN(Number(date));
335
+ }
336
+
337
+ /**
338
+ * @name subMilliseconds
339
+ * @category Millisecond Helpers
340
+ * @summary Subtract the specified number of milliseconds from the given date.
341
+ *
342
+ * @description
343
+ * Subtract the specified number of milliseconds from the given date.
344
+ *
345
+ * @param {Date|Number} date - the date to be changed
346
+ * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
347
+ * @returns {Date} the new date with the milliseconds subtracted
348
+ * @throws {TypeError} 2 arguments required
349
+ *
350
+ * @example
351
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
352
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
353
+ * //=> Thu Jul 10 2014 12:45:29.250
354
+ */
355
+ function subMilliseconds(dirtyDate, dirtyAmount) {
356
+ requiredArgs(2, arguments);
357
+ var amount = toInteger(dirtyAmount);
358
+ return addMilliseconds(dirtyDate, -amount);
359
+ }
360
+
361
+ var MILLISECONDS_IN_DAY = 86400000;
362
+ function getUTCDayOfYear(dirtyDate) {
363
+ requiredArgs(1, arguments);
364
+ var date = toDate(dirtyDate);
365
+ var timestamp = date.getTime();
366
+ date.setUTCMonth(0, 1);
367
+ date.setUTCHours(0, 0, 0, 0);
368
+ var startOfYearTimestamp = date.getTime();
369
+ var difference = timestamp - startOfYearTimestamp;
370
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
371
+ }
372
+
373
+ function startOfUTCISOWeek(dirtyDate) {
374
+ requiredArgs(1, arguments);
375
+ var weekStartsOn = 1;
376
+ var date = toDate(dirtyDate);
377
+ var day = date.getUTCDay();
378
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
379
+ date.setUTCDate(date.getUTCDate() - diff);
380
+ date.setUTCHours(0, 0, 0, 0);
381
+ return date;
382
+ }
383
+
384
+ function getUTCISOWeekYear(dirtyDate) {
385
+ requiredArgs(1, arguments);
386
+ var date = toDate(dirtyDate);
387
+ var year = date.getUTCFullYear();
388
+ var fourthOfJanuaryOfNextYear = new Date(0);
389
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
390
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
391
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
392
+ var fourthOfJanuaryOfThisYear = new Date(0);
393
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
394
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
395
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
396
+ if (date.getTime() >= startOfNextYear.getTime()) {
397
+ return year + 1;
398
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
399
+ return year;
400
+ } else {
401
+ return year - 1;
402
+ }
403
+ }
404
+
405
+ function startOfUTCISOWeekYear(dirtyDate) {
406
+ requiredArgs(1, arguments);
407
+ var year = getUTCISOWeekYear(dirtyDate);
408
+ var fourthOfJanuary = new Date(0);
409
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
410
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
411
+ var date = startOfUTCISOWeek(fourthOfJanuary);
412
+ return date;
413
+ }
414
+
415
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
416
+ function getUTCISOWeek(dirtyDate) {
417
+ requiredArgs(1, arguments);
418
+ var date = toDate(dirtyDate);
419
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
420
+
421
+ // Round the number of days to the nearest integer
422
+ // because the number of milliseconds in a week is not constant
423
+ // (e.g. it's different in the week of the daylight saving time clock shift)
424
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
425
+ }
426
+
427
+ function startOfUTCWeek(dirtyDate, options) {
428
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
429
+ requiredArgs(1, arguments);
430
+ var defaultOptions = getDefaultOptions();
431
+ var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
432
+
433
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
434
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
435
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
436
+ }
437
+ var date = toDate(dirtyDate);
438
+ var day = date.getUTCDay();
439
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
440
+ date.setUTCDate(date.getUTCDate() - diff);
441
+ date.setUTCHours(0, 0, 0, 0);
442
+ return date;
443
+ }
444
+
445
+ function getUTCWeekYear(dirtyDate, options) {
446
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
447
+ requiredArgs(1, arguments);
448
+ var date = toDate(dirtyDate);
449
+ var year = date.getUTCFullYear();
450
+ var defaultOptions = getDefaultOptions();
451
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
452
+
453
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
454
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
455
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
456
+ }
457
+ var firstWeekOfNextYear = new Date(0);
458
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
459
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
460
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
461
+ var firstWeekOfThisYear = new Date(0);
462
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
463
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
464
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
465
+ if (date.getTime() >= startOfNextYear.getTime()) {
466
+ return year + 1;
467
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
468
+ return year;
469
+ } else {
470
+ return year - 1;
471
+ }
472
+ }
473
+
474
+ function startOfUTCWeekYear(dirtyDate, options) {
475
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
476
+ requiredArgs(1, arguments);
477
+ var defaultOptions = getDefaultOptions();
478
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
479
+ var year = getUTCWeekYear(dirtyDate, options);
480
+ var firstWeek = new Date(0);
481
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
482
+ firstWeek.setUTCHours(0, 0, 0, 0);
483
+ var date = startOfUTCWeek(firstWeek, options);
484
+ return date;
485
+ }
486
+
487
+ var MILLISECONDS_IN_WEEK = 604800000;
488
+ function getUTCWeek(dirtyDate, options) {
489
+ requiredArgs(1, arguments);
490
+ var date = toDate(dirtyDate);
491
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
492
+
493
+ // Round the number of days to the nearest integer
494
+ // because the number of milliseconds in a week is not constant
495
+ // (e.g. it's different in the week of the daylight saving time clock shift)
496
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
497
+ }
498
+
499
+ function addLeadingZeros(number, targetLength) {
500
+ var sign = number < 0 ? '-' : '';
501
+ var output = Math.abs(number).toString();
502
+ while (output.length < targetLength) {
503
+ output = '0' + output;
504
+ }
505
+ return sign + output;
506
+ }
507
+
508
+ /*
509
+ * | | Unit | | Unit |
510
+ * |-----|--------------------------------|-----|--------------------------------|
511
+ * | a | AM, PM | A* | |
512
+ * | d | Day of month | D | |
513
+ * | h | Hour [1-12] | H | Hour [0-23] |
514
+ * | m | Minute | M | Month |
515
+ * | s | Second | S | Fraction of second |
516
+ * | y | Year (abs) | Y | |
517
+ *
518
+ * Letters marked by * are not implemented but reserved by Unicode standard.
519
+ */
520
+ var formatters$2 = {
521
+ // Year
522
+ y: function y(date, token) {
523
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
524
+ // | Year | y | yy | yyy | yyyy | yyyyy |
525
+ // |----------|-------|----|-------|-------|-------|
526
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
527
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
528
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
529
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
530
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
531
+
532
+ var signedYear = date.getUTCFullYear();
533
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
534
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
535
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
536
+ },
537
+ // Month
538
+ M: function M(date, token) {
539
+ var month = date.getUTCMonth();
540
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
541
+ },
542
+ // Day of the month
543
+ d: function d(date, token) {
544
+ return addLeadingZeros(date.getUTCDate(), token.length);
545
+ },
546
+ // AM or PM
547
+ a: function a(date, token) {
548
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
549
+ switch (token) {
550
+ case 'a':
551
+ case 'aa':
552
+ return dayPeriodEnumValue.toUpperCase();
553
+ case 'aaa':
554
+ return dayPeriodEnumValue;
555
+ case 'aaaaa':
556
+ return dayPeriodEnumValue[0];
557
+ case 'aaaa':
558
+ default:
559
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
560
+ }
561
+ },
562
+ // Hour [1-12]
563
+ h: function h(date, token) {
564
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
565
+ },
566
+ // Hour [0-23]
567
+ H: function H(date, token) {
568
+ return addLeadingZeros(date.getUTCHours(), token.length);
569
+ },
570
+ // Minute
571
+ m: function m(date, token) {
572
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
573
+ },
574
+ // Second
575
+ s: function s(date, token) {
576
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
577
+ },
578
+ // Fraction of second
579
+ S: function S(date, token) {
580
+ var numberOfDigits = token.length;
581
+ var milliseconds = date.getUTCMilliseconds();
582
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
583
+ return addLeadingZeros(fractionalSeconds, token.length);
584
+ }
585
+ };
586
+ const formatters$3 = formatters$2;
587
+
588
+ var dayPeriodEnum = {
589
+ am: 'am',
590
+ pm: 'pm',
591
+ midnight: 'midnight',
592
+ noon: 'noon',
593
+ morning: 'morning',
594
+ afternoon: 'afternoon',
595
+ evening: 'evening',
596
+ night: 'night'
597
+ };
598
+ /*
599
+ * | | Unit | | Unit |
600
+ * |-----|--------------------------------|-----|--------------------------------|
601
+ * | a | AM, PM | A* | Milliseconds in day |
602
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
603
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
604
+ * | d | Day of month | D | Day of year |
605
+ * | e | Local day of week | E | Day of week |
606
+ * | f | | F* | Day of week in month |
607
+ * | g* | Modified Julian day | G | Era |
608
+ * | h | Hour [1-12] | H | Hour [0-23] |
609
+ * | i! | ISO day of week | I! | ISO week of year |
610
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
611
+ * | k | Hour [1-24] | K | Hour [0-11] |
612
+ * | l* | (deprecated) | L | Stand-alone month |
613
+ * | m | Minute | M | Month |
614
+ * | n | | N | |
615
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
616
+ * | p! | Long localized time | P! | Long localized date |
617
+ * | q | Stand-alone quarter | Q | Quarter |
618
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
619
+ * | s | Second | S | Fraction of second |
620
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
621
+ * | u | Extended year | U* | Cyclic year |
622
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
623
+ * | w | Local week of year | W* | Week of month |
624
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
625
+ * | y | Year (abs) | Y | Local week-numbering year |
626
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
627
+ *
628
+ * Letters marked by * are not implemented but reserved by Unicode standard.
629
+ *
630
+ * Letters marked by ! are non-standard, but implemented by date-fns:
631
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
632
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
633
+ * i.e. 7 for Sunday, 1 for Monday, etc.
634
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
635
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
636
+ * `R` is supposed to be used in conjunction with `I` and `i`
637
+ * for universal ISO week-numbering date, whereas
638
+ * `Y` is supposed to be used in conjunction with `w` and `e`
639
+ * for week-numbering date specific to the locale.
640
+ * - `P` is long localized date format
641
+ * - `p` is long localized time format
642
+ */
643
+
644
+ var formatters = {
645
+ // Era
646
+ G: function G(date, token, localize) {
647
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
648
+ switch (token) {
649
+ // AD, BC
650
+ case 'G':
651
+ case 'GG':
652
+ case 'GGG':
653
+ return localize.era(era, {
654
+ width: 'abbreviated'
655
+ });
656
+ // A, B
657
+ case 'GGGGG':
658
+ return localize.era(era, {
659
+ width: 'narrow'
660
+ });
661
+ // Anno Domini, Before Christ
662
+ case 'GGGG':
663
+ default:
664
+ return localize.era(era, {
665
+ width: 'wide'
666
+ });
667
+ }
668
+ },
669
+ // Year
670
+ y: function y(date, token, localize) {
671
+ // Ordinal number
672
+ if (token === 'yo') {
673
+ var signedYear = date.getUTCFullYear();
674
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
675
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
676
+ return localize.ordinalNumber(year, {
677
+ unit: 'year'
678
+ });
679
+ }
680
+ return formatters$3.y(date, token);
681
+ },
682
+ // Local week-numbering year
683
+ Y: function Y(date, token, localize, options) {
684
+ var signedWeekYear = getUTCWeekYear(date, options);
685
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
686
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
687
+
688
+ // Two digit year
689
+ if (token === 'YY') {
690
+ var twoDigitYear = weekYear % 100;
691
+ return addLeadingZeros(twoDigitYear, 2);
692
+ }
693
+
694
+ // Ordinal number
695
+ if (token === 'Yo') {
696
+ return localize.ordinalNumber(weekYear, {
697
+ unit: 'year'
698
+ });
699
+ }
700
+
701
+ // Padding
702
+ return addLeadingZeros(weekYear, token.length);
703
+ },
704
+ // ISO week-numbering year
705
+ R: function R(date, token) {
706
+ var isoWeekYear = getUTCISOWeekYear(date);
707
+
708
+ // Padding
709
+ return addLeadingZeros(isoWeekYear, token.length);
710
+ },
711
+ // Extended year. This is a single number designating the year of this calendar system.
712
+ // The main difference between `y` and `u` localizers are B.C. years:
713
+ // | Year | `y` | `u` |
714
+ // |------|-----|-----|
715
+ // | AC 1 | 1 | 1 |
716
+ // | BC 1 | 1 | 0 |
717
+ // | BC 2 | 2 | -1 |
718
+ // Also `yy` always returns the last two digits of a year,
719
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
720
+ u: function u(date, token) {
721
+ var year = date.getUTCFullYear();
722
+ return addLeadingZeros(year, token.length);
723
+ },
724
+ // Quarter
725
+ Q: function Q(date, token, localize) {
726
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
727
+ switch (token) {
728
+ // 1, 2, 3, 4
729
+ case 'Q':
730
+ return String(quarter);
731
+ // 01, 02, 03, 04
732
+ case 'QQ':
733
+ return addLeadingZeros(quarter, 2);
734
+ // 1st, 2nd, 3rd, 4th
735
+ case 'Qo':
736
+ return localize.ordinalNumber(quarter, {
737
+ unit: 'quarter'
738
+ });
739
+ // Q1, Q2, Q3, Q4
740
+ case 'QQQ':
741
+ return localize.quarter(quarter, {
742
+ width: 'abbreviated',
743
+ context: 'formatting'
744
+ });
745
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
746
+ case 'QQQQQ':
747
+ return localize.quarter(quarter, {
748
+ width: 'narrow',
749
+ context: 'formatting'
750
+ });
751
+ // 1st quarter, 2nd quarter, ...
752
+ case 'QQQQ':
753
+ default:
754
+ return localize.quarter(quarter, {
755
+ width: 'wide',
756
+ context: 'formatting'
757
+ });
758
+ }
759
+ },
760
+ // Stand-alone quarter
761
+ q: function q(date, token, localize) {
762
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
763
+ switch (token) {
764
+ // 1, 2, 3, 4
765
+ case 'q':
766
+ return String(quarter);
767
+ // 01, 02, 03, 04
768
+ case 'qq':
769
+ return addLeadingZeros(quarter, 2);
770
+ // 1st, 2nd, 3rd, 4th
771
+ case 'qo':
772
+ return localize.ordinalNumber(quarter, {
773
+ unit: 'quarter'
774
+ });
775
+ // Q1, Q2, Q3, Q4
776
+ case 'qqq':
777
+ return localize.quarter(quarter, {
778
+ width: 'abbreviated',
779
+ context: 'standalone'
780
+ });
781
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
782
+ case 'qqqqq':
783
+ return localize.quarter(quarter, {
784
+ width: 'narrow',
785
+ context: 'standalone'
786
+ });
787
+ // 1st quarter, 2nd quarter, ...
788
+ case 'qqqq':
789
+ default:
790
+ return localize.quarter(quarter, {
791
+ width: 'wide',
792
+ context: 'standalone'
793
+ });
794
+ }
795
+ },
796
+ // Month
797
+ M: function M(date, token, localize) {
798
+ var month = date.getUTCMonth();
799
+ switch (token) {
800
+ case 'M':
801
+ case 'MM':
802
+ return formatters$3.M(date, token);
803
+ // 1st, 2nd, ..., 12th
804
+ case 'Mo':
805
+ return localize.ordinalNumber(month + 1, {
806
+ unit: 'month'
807
+ });
808
+ // Jan, Feb, ..., Dec
809
+ case 'MMM':
810
+ return localize.month(month, {
811
+ width: 'abbreviated',
812
+ context: 'formatting'
813
+ });
814
+ // J, F, ..., D
815
+ case 'MMMMM':
816
+ return localize.month(month, {
817
+ width: 'narrow',
818
+ context: 'formatting'
819
+ });
820
+ // January, February, ..., December
821
+ case 'MMMM':
822
+ default:
823
+ return localize.month(month, {
824
+ width: 'wide',
825
+ context: 'formatting'
826
+ });
827
+ }
828
+ },
829
+ // Stand-alone month
830
+ L: function L(date, token, localize) {
831
+ var month = date.getUTCMonth();
832
+ switch (token) {
833
+ // 1, 2, ..., 12
834
+ case 'L':
835
+ return String(month + 1);
836
+ // 01, 02, ..., 12
837
+ case 'LL':
838
+ return addLeadingZeros(month + 1, 2);
839
+ // 1st, 2nd, ..., 12th
840
+ case 'Lo':
841
+ return localize.ordinalNumber(month + 1, {
842
+ unit: 'month'
843
+ });
844
+ // Jan, Feb, ..., Dec
845
+ case 'LLL':
846
+ return localize.month(month, {
847
+ width: 'abbreviated',
848
+ context: 'standalone'
849
+ });
850
+ // J, F, ..., D
851
+ case 'LLLLL':
852
+ return localize.month(month, {
853
+ width: 'narrow',
854
+ context: 'standalone'
855
+ });
856
+ // January, February, ..., December
857
+ case 'LLLL':
858
+ default:
859
+ return localize.month(month, {
860
+ width: 'wide',
861
+ context: 'standalone'
862
+ });
863
+ }
864
+ },
865
+ // Local week of year
866
+ w: function w(date, token, localize, options) {
867
+ var week = getUTCWeek(date, options);
868
+ if (token === 'wo') {
869
+ return localize.ordinalNumber(week, {
870
+ unit: 'week'
871
+ });
872
+ }
873
+ return addLeadingZeros(week, token.length);
874
+ },
875
+ // ISO week of year
876
+ I: function I(date, token, localize) {
877
+ var isoWeek = getUTCISOWeek(date);
878
+ if (token === 'Io') {
879
+ return localize.ordinalNumber(isoWeek, {
880
+ unit: 'week'
881
+ });
882
+ }
883
+ return addLeadingZeros(isoWeek, token.length);
884
+ },
885
+ // Day of the month
886
+ d: function d(date, token, localize) {
887
+ if (token === 'do') {
888
+ return localize.ordinalNumber(date.getUTCDate(), {
889
+ unit: 'date'
890
+ });
891
+ }
892
+ return formatters$3.d(date, token);
893
+ },
894
+ // Day of year
895
+ D: function D(date, token, localize) {
896
+ var dayOfYear = getUTCDayOfYear(date);
897
+ if (token === 'Do') {
898
+ return localize.ordinalNumber(dayOfYear, {
899
+ unit: 'dayOfYear'
900
+ });
901
+ }
902
+ return addLeadingZeros(dayOfYear, token.length);
903
+ },
904
+ // Day of week
905
+ E: function E(date, token, localize) {
906
+ var dayOfWeek = date.getUTCDay();
907
+ switch (token) {
908
+ // Tue
909
+ case 'E':
910
+ case 'EE':
911
+ case 'EEE':
912
+ return localize.day(dayOfWeek, {
913
+ width: 'abbreviated',
914
+ context: 'formatting'
915
+ });
916
+ // T
917
+ case 'EEEEE':
918
+ return localize.day(dayOfWeek, {
919
+ width: 'narrow',
920
+ context: 'formatting'
921
+ });
922
+ // Tu
923
+ case 'EEEEEE':
924
+ return localize.day(dayOfWeek, {
925
+ width: 'short',
926
+ context: 'formatting'
927
+ });
928
+ // Tuesday
929
+ case 'EEEE':
930
+ default:
931
+ return localize.day(dayOfWeek, {
932
+ width: 'wide',
933
+ context: 'formatting'
934
+ });
935
+ }
936
+ },
937
+ // Local day of week
938
+ e: function e(date, token, localize, options) {
939
+ var dayOfWeek = date.getUTCDay();
940
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
941
+ switch (token) {
942
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
943
+ case 'e':
944
+ return String(localDayOfWeek);
945
+ // Padded numerical value
946
+ case 'ee':
947
+ return addLeadingZeros(localDayOfWeek, 2);
948
+ // 1st, 2nd, ..., 7th
949
+ case 'eo':
950
+ return localize.ordinalNumber(localDayOfWeek, {
951
+ unit: 'day'
952
+ });
953
+ case 'eee':
954
+ return localize.day(dayOfWeek, {
955
+ width: 'abbreviated',
956
+ context: 'formatting'
957
+ });
958
+ // T
959
+ case 'eeeee':
960
+ return localize.day(dayOfWeek, {
961
+ width: 'narrow',
962
+ context: 'formatting'
963
+ });
964
+ // Tu
965
+ case 'eeeeee':
966
+ return localize.day(dayOfWeek, {
967
+ width: 'short',
968
+ context: 'formatting'
969
+ });
970
+ // Tuesday
971
+ case 'eeee':
972
+ default:
973
+ return localize.day(dayOfWeek, {
974
+ width: 'wide',
975
+ context: 'formatting'
976
+ });
977
+ }
978
+ },
979
+ // Stand-alone local day of week
980
+ c: function c(date, token, localize, options) {
981
+ var dayOfWeek = date.getUTCDay();
982
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
983
+ switch (token) {
984
+ // Numerical value (same as in `e`)
985
+ case 'c':
986
+ return String(localDayOfWeek);
987
+ // Padded numerical value
988
+ case 'cc':
989
+ return addLeadingZeros(localDayOfWeek, token.length);
990
+ // 1st, 2nd, ..., 7th
991
+ case 'co':
992
+ return localize.ordinalNumber(localDayOfWeek, {
993
+ unit: 'day'
994
+ });
995
+ case 'ccc':
996
+ return localize.day(dayOfWeek, {
997
+ width: 'abbreviated',
998
+ context: 'standalone'
999
+ });
1000
+ // T
1001
+ case 'ccccc':
1002
+ return localize.day(dayOfWeek, {
1003
+ width: 'narrow',
1004
+ context: 'standalone'
1005
+ });
1006
+ // Tu
1007
+ case 'cccccc':
1008
+ return localize.day(dayOfWeek, {
1009
+ width: 'short',
1010
+ context: 'standalone'
1011
+ });
1012
+ // Tuesday
1013
+ case 'cccc':
1014
+ default:
1015
+ return localize.day(dayOfWeek, {
1016
+ width: 'wide',
1017
+ context: 'standalone'
1018
+ });
1019
+ }
1020
+ },
1021
+ // ISO day of week
1022
+ i: function i(date, token, localize) {
1023
+ var dayOfWeek = date.getUTCDay();
1024
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1025
+ switch (token) {
1026
+ // 2
1027
+ case 'i':
1028
+ return String(isoDayOfWeek);
1029
+ // 02
1030
+ case 'ii':
1031
+ return addLeadingZeros(isoDayOfWeek, token.length);
1032
+ // 2nd
1033
+ case 'io':
1034
+ return localize.ordinalNumber(isoDayOfWeek, {
1035
+ unit: 'day'
1036
+ });
1037
+ // Tue
1038
+ case 'iii':
1039
+ return localize.day(dayOfWeek, {
1040
+ width: 'abbreviated',
1041
+ context: 'formatting'
1042
+ });
1043
+ // T
1044
+ case 'iiiii':
1045
+ return localize.day(dayOfWeek, {
1046
+ width: 'narrow',
1047
+ context: 'formatting'
1048
+ });
1049
+ // Tu
1050
+ case 'iiiiii':
1051
+ return localize.day(dayOfWeek, {
1052
+ width: 'short',
1053
+ context: 'formatting'
1054
+ });
1055
+ // Tuesday
1056
+ case 'iiii':
1057
+ default:
1058
+ return localize.day(dayOfWeek, {
1059
+ width: 'wide',
1060
+ context: 'formatting'
1061
+ });
1062
+ }
1063
+ },
1064
+ // AM or PM
1065
+ a: function a(date, token, localize) {
1066
+ var hours = date.getUTCHours();
1067
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1068
+ switch (token) {
1069
+ case 'a':
1070
+ case 'aa':
1071
+ return localize.dayPeriod(dayPeriodEnumValue, {
1072
+ width: 'abbreviated',
1073
+ context: 'formatting'
1074
+ });
1075
+ case 'aaa':
1076
+ return localize.dayPeriod(dayPeriodEnumValue, {
1077
+ width: 'abbreviated',
1078
+ context: 'formatting'
1079
+ }).toLowerCase();
1080
+ case 'aaaaa':
1081
+ return localize.dayPeriod(dayPeriodEnumValue, {
1082
+ width: 'narrow',
1083
+ context: 'formatting'
1084
+ });
1085
+ case 'aaaa':
1086
+ default:
1087
+ return localize.dayPeriod(dayPeriodEnumValue, {
1088
+ width: 'wide',
1089
+ context: 'formatting'
1090
+ });
1091
+ }
1092
+ },
1093
+ // AM, PM, midnight, noon
1094
+ b: function b(date, token, localize) {
1095
+ var hours = date.getUTCHours();
1096
+ var dayPeriodEnumValue;
1097
+ if (hours === 12) {
1098
+ dayPeriodEnumValue = dayPeriodEnum.noon;
1099
+ } else if (hours === 0) {
1100
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
1101
+ } else {
1102
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1103
+ }
1104
+ switch (token) {
1105
+ case 'b':
1106
+ case 'bb':
1107
+ return localize.dayPeriod(dayPeriodEnumValue, {
1108
+ width: 'abbreviated',
1109
+ context: 'formatting'
1110
+ });
1111
+ case 'bbb':
1112
+ return localize.dayPeriod(dayPeriodEnumValue, {
1113
+ width: 'abbreviated',
1114
+ context: 'formatting'
1115
+ }).toLowerCase();
1116
+ case 'bbbbb':
1117
+ return localize.dayPeriod(dayPeriodEnumValue, {
1118
+ width: 'narrow',
1119
+ context: 'formatting'
1120
+ });
1121
+ case 'bbbb':
1122
+ default:
1123
+ return localize.dayPeriod(dayPeriodEnumValue, {
1124
+ width: 'wide',
1125
+ context: 'formatting'
1126
+ });
1127
+ }
1128
+ },
1129
+ // in the morning, in the afternoon, in the evening, at night
1130
+ B: function B(date, token, localize) {
1131
+ var hours = date.getUTCHours();
1132
+ var dayPeriodEnumValue;
1133
+ if (hours >= 17) {
1134
+ dayPeriodEnumValue = dayPeriodEnum.evening;
1135
+ } else if (hours >= 12) {
1136
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
1137
+ } else if (hours >= 4) {
1138
+ dayPeriodEnumValue = dayPeriodEnum.morning;
1139
+ } else {
1140
+ dayPeriodEnumValue = dayPeriodEnum.night;
1141
+ }
1142
+ switch (token) {
1143
+ case 'B':
1144
+ case 'BB':
1145
+ case 'BBB':
1146
+ return localize.dayPeriod(dayPeriodEnumValue, {
1147
+ width: 'abbreviated',
1148
+ context: 'formatting'
1149
+ });
1150
+ case 'BBBBB':
1151
+ return localize.dayPeriod(dayPeriodEnumValue, {
1152
+ width: 'narrow',
1153
+ context: 'formatting'
1154
+ });
1155
+ case 'BBBB':
1156
+ default:
1157
+ return localize.dayPeriod(dayPeriodEnumValue, {
1158
+ width: 'wide',
1159
+ context: 'formatting'
1160
+ });
1161
+ }
1162
+ },
1163
+ // Hour [1-12]
1164
+ h: function h(date, token, localize) {
1165
+ if (token === 'ho') {
1166
+ var hours = date.getUTCHours() % 12;
1167
+ if (hours === 0) hours = 12;
1168
+ return localize.ordinalNumber(hours, {
1169
+ unit: 'hour'
1170
+ });
1171
+ }
1172
+ return formatters$3.h(date, token);
1173
+ },
1174
+ // Hour [0-23]
1175
+ H: function H(date, token, localize) {
1176
+ if (token === 'Ho') {
1177
+ return localize.ordinalNumber(date.getUTCHours(), {
1178
+ unit: 'hour'
1179
+ });
1180
+ }
1181
+ return formatters$3.H(date, token);
1182
+ },
1183
+ // Hour [0-11]
1184
+ K: function K(date, token, localize) {
1185
+ var hours = date.getUTCHours() % 12;
1186
+ if (token === 'Ko') {
1187
+ return localize.ordinalNumber(hours, {
1188
+ unit: 'hour'
1189
+ });
1190
+ }
1191
+ return addLeadingZeros(hours, token.length);
1192
+ },
1193
+ // Hour [1-24]
1194
+ k: function k(date, token, localize) {
1195
+ var hours = date.getUTCHours();
1196
+ if (hours === 0) hours = 24;
1197
+ if (token === 'ko') {
1198
+ return localize.ordinalNumber(hours, {
1199
+ unit: 'hour'
1200
+ });
1201
+ }
1202
+ return addLeadingZeros(hours, token.length);
1203
+ },
1204
+ // Minute
1205
+ m: function m(date, token, localize) {
1206
+ if (token === 'mo') {
1207
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1208
+ unit: 'minute'
1209
+ });
1210
+ }
1211
+ return formatters$3.m(date, token);
1212
+ },
1213
+ // Second
1214
+ s: function s(date, token, localize) {
1215
+ if (token === 'so') {
1216
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1217
+ unit: 'second'
1218
+ });
1219
+ }
1220
+ return formatters$3.s(date, token);
1221
+ },
1222
+ // Fraction of second
1223
+ S: function S(date, token) {
1224
+ return formatters$3.S(date, token);
1225
+ },
1226
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1227
+ X: function X(date, token, _localize, options) {
1228
+ var originalDate = options._originalDate || date;
1229
+ var timezoneOffset = originalDate.getTimezoneOffset();
1230
+ if (timezoneOffset === 0) {
1231
+ return 'Z';
1232
+ }
1233
+ switch (token) {
1234
+ // Hours and optional minutes
1235
+ case 'X':
1236
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1237
+
1238
+ // Hours, minutes and optional seconds without `:` delimiter
1239
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1240
+ // so this token always has the same output as `XX`
1241
+ case 'XXXX':
1242
+ case 'XX':
1243
+ // Hours and minutes without `:` delimiter
1244
+ return formatTimezone(timezoneOffset);
1245
+
1246
+ // Hours, minutes and optional seconds with `:` delimiter
1247
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1248
+ // so this token always has the same output as `XXX`
1249
+ case 'XXXXX':
1250
+ case 'XXX': // Hours and minutes with `:` delimiter
1251
+ default:
1252
+ return formatTimezone(timezoneOffset, ':');
1253
+ }
1254
+ },
1255
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1256
+ x: function x(date, token, _localize, options) {
1257
+ var originalDate = options._originalDate || date;
1258
+ var timezoneOffset = originalDate.getTimezoneOffset();
1259
+ switch (token) {
1260
+ // Hours and optional minutes
1261
+ case 'x':
1262
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1263
+
1264
+ // Hours, minutes and optional seconds without `:` delimiter
1265
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1266
+ // so this token always has the same output as `xx`
1267
+ case 'xxxx':
1268
+ case 'xx':
1269
+ // Hours and minutes without `:` delimiter
1270
+ return formatTimezone(timezoneOffset);
1271
+
1272
+ // Hours, minutes and optional seconds with `:` delimiter
1273
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1274
+ // so this token always has the same output as `xxx`
1275
+ case 'xxxxx':
1276
+ case 'xxx': // Hours and minutes with `:` delimiter
1277
+ default:
1278
+ return formatTimezone(timezoneOffset, ':');
1279
+ }
1280
+ },
1281
+ // Timezone (GMT)
1282
+ O: function O(date, token, _localize, options) {
1283
+ var originalDate = options._originalDate || date;
1284
+ var timezoneOffset = originalDate.getTimezoneOffset();
1285
+ switch (token) {
1286
+ // Short
1287
+ case 'O':
1288
+ case 'OO':
1289
+ case 'OOO':
1290
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1291
+ // Long
1292
+ case 'OOOO':
1293
+ default:
1294
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1295
+ }
1296
+ },
1297
+ // Timezone (specific non-location)
1298
+ z: function z(date, token, _localize, options) {
1299
+ var originalDate = options._originalDate || date;
1300
+ var timezoneOffset = originalDate.getTimezoneOffset();
1301
+ switch (token) {
1302
+ // Short
1303
+ case 'z':
1304
+ case 'zz':
1305
+ case 'zzz':
1306
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1307
+ // Long
1308
+ case 'zzzz':
1309
+ default:
1310
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1311
+ }
1312
+ },
1313
+ // Seconds timestamp
1314
+ t: function t(date, token, _localize, options) {
1315
+ var originalDate = options._originalDate || date;
1316
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1317
+ return addLeadingZeros(timestamp, token.length);
1318
+ },
1319
+ // Milliseconds timestamp
1320
+ T: function T(date, token, _localize, options) {
1321
+ var originalDate = options._originalDate || date;
1322
+ var timestamp = originalDate.getTime();
1323
+ return addLeadingZeros(timestamp, token.length);
1324
+ }
1325
+ };
1326
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1327
+ var sign = offset > 0 ? '-' : '+';
1328
+ var absOffset = Math.abs(offset);
1329
+ var hours = Math.floor(absOffset / 60);
1330
+ var minutes = absOffset % 60;
1331
+ if (minutes === 0) {
1332
+ return sign + String(hours);
1333
+ }
1334
+ var delimiter = dirtyDelimiter || '';
1335
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1336
+ }
1337
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1338
+ if (offset % 60 === 0) {
1339
+ var sign = offset > 0 ? '-' : '+';
1340
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1341
+ }
1342
+ return formatTimezone(offset, dirtyDelimiter);
1343
+ }
1344
+ function formatTimezone(offset, dirtyDelimiter) {
1345
+ var delimiter = dirtyDelimiter || '';
1346
+ var sign = offset > 0 ? '-' : '+';
1347
+ var absOffset = Math.abs(offset);
1348
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1349
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1350
+ return sign + hours + delimiter + minutes;
1351
+ }
1352
+ const formatters$1 = formatters;
1353
+
1354
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1355
+ switch (pattern) {
1356
+ case 'P':
1357
+ return formatLong.date({
1358
+ width: 'short'
1359
+ });
1360
+ case 'PP':
1361
+ return formatLong.date({
1362
+ width: 'medium'
1363
+ });
1364
+ case 'PPP':
1365
+ return formatLong.date({
1366
+ width: 'long'
1367
+ });
1368
+ case 'PPPP':
1369
+ default:
1370
+ return formatLong.date({
1371
+ width: 'full'
1372
+ });
1373
+ }
1374
+ };
1375
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1376
+ switch (pattern) {
1377
+ case 'p':
1378
+ return formatLong.time({
1379
+ width: 'short'
1380
+ });
1381
+ case 'pp':
1382
+ return formatLong.time({
1383
+ width: 'medium'
1384
+ });
1385
+ case 'ppp':
1386
+ return formatLong.time({
1387
+ width: 'long'
1388
+ });
1389
+ case 'pppp':
1390
+ default:
1391
+ return formatLong.time({
1392
+ width: 'full'
1393
+ });
1394
+ }
1395
+ };
1396
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1397
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1398
+ var datePattern = matchResult[1];
1399
+ var timePattern = matchResult[2];
1400
+ if (!timePattern) {
1401
+ return dateLongFormatter(pattern, formatLong);
1402
+ }
1403
+ var dateTimeFormat;
1404
+ switch (datePattern) {
1405
+ case 'P':
1406
+ dateTimeFormat = formatLong.dateTime({
1407
+ width: 'short'
1408
+ });
1409
+ break;
1410
+ case 'PP':
1411
+ dateTimeFormat = formatLong.dateTime({
1412
+ width: 'medium'
1413
+ });
1414
+ break;
1415
+ case 'PPP':
1416
+ dateTimeFormat = formatLong.dateTime({
1417
+ width: 'long'
1418
+ });
1419
+ break;
1420
+ case 'PPPP':
1421
+ default:
1422
+ dateTimeFormat = formatLong.dateTime({
1423
+ width: 'full'
1424
+ });
1425
+ break;
1426
+ }
1427
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1428
+ };
1429
+ var longFormatters = {
1430
+ p: timeLongFormatter,
1431
+ P: dateTimeLongFormatter
1432
+ };
1433
+ const longFormatters$1 = longFormatters;
1434
+
1435
+ var protectedDayOfYearTokens = ['D', 'DD'];
1436
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1437
+ function isProtectedDayOfYearToken(token) {
1438
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1439
+ }
1440
+ function isProtectedWeekYearToken(token) {
1441
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1442
+ }
1443
+ function throwProtectedError(token, format, input) {
1444
+ if (token === 'YYYY') {
1445
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1446
+ } else if (token === 'YY') {
1447
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1448
+ } else if (token === 'D') {
1449
+ throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1450
+ } else if (token === 'DD') {
1451
+ throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1452
+ }
1453
+ }
1454
+
1455
+ var formatDistanceLocale = {
1456
+ lessThanXSeconds: {
1457
+ one: 'less than a second',
1458
+ other: 'less than {{count}} seconds'
1459
+ },
1460
+ xSeconds: {
1461
+ one: '1 second',
1462
+ other: '{{count}} seconds'
1463
+ },
1464
+ halfAMinute: 'half a minute',
1465
+ lessThanXMinutes: {
1466
+ one: 'less than a minute',
1467
+ other: 'less than {{count}} minutes'
1468
+ },
1469
+ xMinutes: {
1470
+ one: '1 minute',
1471
+ other: '{{count}} minutes'
1472
+ },
1473
+ aboutXHours: {
1474
+ one: 'about 1 hour',
1475
+ other: 'about {{count}} hours'
1476
+ },
1477
+ xHours: {
1478
+ one: '1 hour',
1479
+ other: '{{count}} hours'
1480
+ },
1481
+ xDays: {
1482
+ one: '1 day',
1483
+ other: '{{count}} days'
1484
+ },
1485
+ aboutXWeeks: {
1486
+ one: 'about 1 week',
1487
+ other: 'about {{count}} weeks'
1488
+ },
1489
+ xWeeks: {
1490
+ one: '1 week',
1491
+ other: '{{count}} weeks'
1492
+ },
1493
+ aboutXMonths: {
1494
+ one: 'about 1 month',
1495
+ other: 'about {{count}} months'
1496
+ },
1497
+ xMonths: {
1498
+ one: '1 month',
1499
+ other: '{{count}} months'
1500
+ },
1501
+ aboutXYears: {
1502
+ one: 'about 1 year',
1503
+ other: 'about {{count}} years'
1504
+ },
1505
+ xYears: {
1506
+ one: '1 year',
1507
+ other: '{{count}} years'
1508
+ },
1509
+ overXYears: {
1510
+ one: 'over 1 year',
1511
+ other: 'over {{count}} years'
1512
+ },
1513
+ almostXYears: {
1514
+ one: 'almost 1 year',
1515
+ other: 'almost {{count}} years'
1516
+ }
1517
+ };
1518
+ var formatDistance = function formatDistance(token, count, options) {
1519
+ var result;
1520
+ var tokenValue = formatDistanceLocale[token];
1521
+ if (typeof tokenValue === 'string') {
1522
+ result = tokenValue;
1523
+ } else if (count === 1) {
1524
+ result = tokenValue.one;
1525
+ } else {
1526
+ result = tokenValue.other.replace('{{count}}', count.toString());
1527
+ }
1528
+ if (options !== null && options !== void 0 && options.addSuffix) {
1529
+ if (options.comparison && options.comparison > 0) {
1530
+ return 'in ' + result;
1531
+ } else {
1532
+ return result + ' ago';
1533
+ }
1534
+ }
1535
+ return result;
1536
+ };
1537
+ const formatDistance$1 = formatDistance;
1538
+
1539
+ function buildFormatLongFn(args) {
1540
+ return function () {
1541
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1542
+ // TODO: Remove String()
1543
+ var width = options.width ? String(options.width) : args.defaultWidth;
1544
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1545
+ return format;
1546
+ };
1547
+ }
1548
+
1549
+ var dateFormats = {
1550
+ full: 'EEEE, MMMM do, y',
1551
+ long: 'MMMM do, y',
1552
+ medium: 'MMM d, y',
1553
+ short: 'MM/dd/yyyy'
1554
+ };
1555
+ var timeFormats = {
1556
+ full: 'h:mm:ss a zzzz',
1557
+ long: 'h:mm:ss a z',
1558
+ medium: 'h:mm:ss a',
1559
+ short: 'h:mm a'
1560
+ };
1561
+ var dateTimeFormats = {
1562
+ full: "{{date}} 'at' {{time}}",
1563
+ long: "{{date}} 'at' {{time}}",
1564
+ medium: '{{date}}, {{time}}',
1565
+ short: '{{date}}, {{time}}'
1566
+ };
1567
+ var formatLong = {
1568
+ date: buildFormatLongFn({
1569
+ formats: dateFormats,
1570
+ defaultWidth: 'full'
1571
+ }),
1572
+ time: buildFormatLongFn({
1573
+ formats: timeFormats,
1574
+ defaultWidth: 'full'
1575
+ }),
1576
+ dateTime: buildFormatLongFn({
1577
+ formats: dateTimeFormats,
1578
+ defaultWidth: 'full'
1579
+ })
1580
+ };
1581
+ const formatLong$1 = formatLong;
1582
+
1583
+ var formatRelativeLocale = {
1584
+ lastWeek: "'last' eeee 'at' p",
1585
+ yesterday: "'yesterday at' p",
1586
+ today: "'today at' p",
1587
+ tomorrow: "'tomorrow at' p",
1588
+ nextWeek: "eeee 'at' p",
1589
+ other: 'P'
1590
+ };
1591
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1592
+ return formatRelativeLocale[token];
1593
+ };
1594
+ const formatRelative$1 = formatRelative;
1595
+
1596
+ function buildLocalizeFn(args) {
1597
+ return function (dirtyIndex, options) {
1598
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1599
+ var valuesArray;
1600
+ if (context === 'formatting' && args.formattingValues) {
1601
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1602
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1603
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1604
+ } else {
1605
+ var _defaultWidth = args.defaultWidth;
1606
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1607
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1608
+ }
1609
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1610
+ // @ts-ignore: 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!
1611
+ return valuesArray[index];
1612
+ };
1613
+ }
1614
+
1615
+ var eraValues = {
1616
+ narrow: ['B', 'A'],
1617
+ abbreviated: ['BC', 'AD'],
1618
+ wide: ['Before Christ', 'Anno Domini']
1619
+ };
1620
+ var quarterValues = {
1621
+ narrow: ['1', '2', '3', '4'],
1622
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1623
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1624
+ };
1625
+
1626
+ // Note: in English, the names of days of the week and months are capitalized.
1627
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1628
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1629
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1630
+ var monthValues = {
1631
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1632
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1633
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1634
+ };
1635
+ var dayValues = {
1636
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1637
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1638
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1639
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1640
+ };
1641
+ var dayPeriodValues = {
1642
+ narrow: {
1643
+ am: 'a',
1644
+ pm: 'p',
1645
+ midnight: 'mi',
1646
+ noon: 'n',
1647
+ morning: 'morning',
1648
+ afternoon: 'afternoon',
1649
+ evening: 'evening',
1650
+ night: 'night'
1651
+ },
1652
+ abbreviated: {
1653
+ am: 'AM',
1654
+ pm: 'PM',
1655
+ midnight: 'midnight',
1656
+ noon: 'noon',
1657
+ morning: 'morning',
1658
+ afternoon: 'afternoon',
1659
+ evening: 'evening',
1660
+ night: 'night'
1661
+ },
1662
+ wide: {
1663
+ am: 'a.m.',
1664
+ pm: 'p.m.',
1665
+ midnight: 'midnight',
1666
+ noon: 'noon',
1667
+ morning: 'morning',
1668
+ afternoon: 'afternoon',
1669
+ evening: 'evening',
1670
+ night: 'night'
1671
+ }
1672
+ };
1673
+ var formattingDayPeriodValues = {
1674
+ narrow: {
1675
+ am: 'a',
1676
+ pm: 'p',
1677
+ midnight: 'mi',
1678
+ noon: 'n',
1679
+ morning: 'in the morning',
1680
+ afternoon: 'in the afternoon',
1681
+ evening: 'in the evening',
1682
+ night: 'at night'
1683
+ },
1684
+ abbreviated: {
1685
+ am: 'AM',
1686
+ pm: 'PM',
1687
+ midnight: 'midnight',
1688
+ noon: 'noon',
1689
+ morning: 'in the morning',
1690
+ afternoon: 'in the afternoon',
1691
+ evening: 'in the evening',
1692
+ night: 'at night'
1693
+ },
1694
+ wide: {
1695
+ am: 'a.m.',
1696
+ pm: 'p.m.',
1697
+ midnight: 'midnight',
1698
+ noon: 'noon',
1699
+ morning: 'in the morning',
1700
+ afternoon: 'in the afternoon',
1701
+ evening: 'in the evening',
1702
+ night: 'at night'
1703
+ }
1704
+ };
1705
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1706
+ var number = Number(dirtyNumber);
1707
+
1708
+ // If ordinal numbers depend on context, for example,
1709
+ // if they are different for different grammatical genders,
1710
+ // use `options.unit`.
1711
+ //
1712
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1713
+ // 'day', 'hour', 'minute', 'second'.
1714
+
1715
+ var rem100 = number % 100;
1716
+ if (rem100 > 20 || rem100 < 10) {
1717
+ switch (rem100 % 10) {
1718
+ case 1:
1719
+ return number + 'st';
1720
+ case 2:
1721
+ return number + 'nd';
1722
+ case 3:
1723
+ return number + 'rd';
1724
+ }
1725
+ }
1726
+ return number + 'th';
1727
+ };
1728
+ var localize = {
1729
+ ordinalNumber: ordinalNumber,
1730
+ era: buildLocalizeFn({
1731
+ values: eraValues,
1732
+ defaultWidth: 'wide'
1733
+ }),
1734
+ quarter: buildLocalizeFn({
1735
+ values: quarterValues,
1736
+ defaultWidth: 'wide',
1737
+ argumentCallback: function argumentCallback(quarter) {
1738
+ return quarter - 1;
1739
+ }
1740
+ }),
1741
+ month: buildLocalizeFn({
1742
+ values: monthValues,
1743
+ defaultWidth: 'wide'
1744
+ }),
1745
+ day: buildLocalizeFn({
1746
+ values: dayValues,
1747
+ defaultWidth: 'wide'
1748
+ }),
1749
+ dayPeriod: buildLocalizeFn({
1750
+ values: dayPeriodValues,
1751
+ defaultWidth: 'wide',
1752
+ formattingValues: formattingDayPeriodValues,
1753
+ defaultFormattingWidth: 'wide'
1754
+ })
1755
+ };
1756
+ const localize$1 = localize;
1757
+
1758
+ function buildMatchFn(args) {
1759
+ return function (string) {
1760
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1761
+ var width = options.width;
1762
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1763
+ var matchResult = string.match(matchPattern);
1764
+ if (!matchResult) {
1765
+ return null;
1766
+ }
1767
+ var matchedString = matchResult[0];
1768
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1769
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1770
+ return pattern.test(matchedString);
1771
+ }) : findKey(parsePatterns, function (pattern) {
1772
+ return pattern.test(matchedString);
1773
+ });
1774
+ var value;
1775
+ value = args.valueCallback ? args.valueCallback(key) : key;
1776
+ value = options.valueCallback ? options.valueCallback(value) : value;
1777
+ var rest = string.slice(matchedString.length);
1778
+ return {
1779
+ value: value,
1780
+ rest: rest
1781
+ };
1782
+ };
1783
+ }
1784
+ function findKey(object, predicate) {
1785
+ for (var key in object) {
1786
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
1787
+ return key;
1788
+ }
1789
+ }
1790
+ return undefined;
1791
+ }
1792
+ function findIndex(array, predicate) {
1793
+ for (var key = 0; key < array.length; key++) {
1794
+ if (predicate(array[key])) {
1795
+ return key;
1796
+ }
1797
+ }
1798
+ return undefined;
1799
+ }
1800
+
1801
+ function buildMatchPatternFn(args) {
1802
+ return function (string) {
1803
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1804
+ var matchResult = string.match(args.matchPattern);
1805
+ if (!matchResult) return null;
1806
+ var matchedString = matchResult[0];
1807
+ var parseResult = string.match(args.parsePattern);
1808
+ if (!parseResult) return null;
1809
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1810
+ value = options.valueCallback ? options.valueCallback(value) : value;
1811
+ var rest = string.slice(matchedString.length);
1812
+ return {
1813
+ value: value,
1814
+ rest: rest
1815
+ };
1816
+ };
1817
+ }
1818
+
1819
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1820
+ var parseOrdinalNumberPattern = /\d+/i;
1821
+ var matchEraPatterns = {
1822
+ narrow: /^(b|a)/i,
1823
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1824
+ wide: /^(before christ|before common era|anno domini|common era)/i
1825
+ };
1826
+ var parseEraPatterns = {
1827
+ any: [/^b/i, /^(a|c)/i]
1828
+ };
1829
+ var matchQuarterPatterns = {
1830
+ narrow: /^[1234]/i,
1831
+ abbreviated: /^q[1234]/i,
1832
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1833
+ };
1834
+ var parseQuarterPatterns = {
1835
+ any: [/1/i, /2/i, /3/i, /4/i]
1836
+ };
1837
+ var matchMonthPatterns = {
1838
+ narrow: /^[jfmasond]/i,
1839
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1840
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1841
+ };
1842
+ var parseMonthPatterns = {
1843
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
1844
+ any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
1845
+ };
1846
+ var matchDayPatterns = {
1847
+ narrow: /^[smtwf]/i,
1848
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1849
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1850
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1851
+ };
1852
+ var parseDayPatterns = {
1853
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1854
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1855
+ };
1856
+ var matchDayPeriodPatterns = {
1857
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1858
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1859
+ };
1860
+ var parseDayPeriodPatterns = {
1861
+ any: {
1862
+ am: /^a/i,
1863
+ pm: /^p/i,
1864
+ midnight: /^mi/i,
1865
+ noon: /^no/i,
1866
+ morning: /morning/i,
1867
+ afternoon: /afternoon/i,
1868
+ evening: /evening/i,
1869
+ night: /night/i
1870
+ }
1871
+ };
1872
+ var match = {
1873
+ ordinalNumber: buildMatchPatternFn({
1874
+ matchPattern: matchOrdinalNumberPattern,
1875
+ parsePattern: parseOrdinalNumberPattern,
1876
+ valueCallback: function valueCallback(value) {
1877
+ return parseInt(value, 10);
1878
+ }
1879
+ }),
1880
+ era: buildMatchFn({
1881
+ matchPatterns: matchEraPatterns,
1882
+ defaultMatchWidth: 'wide',
1883
+ parsePatterns: parseEraPatterns,
1884
+ defaultParseWidth: 'any'
1885
+ }),
1886
+ quarter: buildMatchFn({
1887
+ matchPatterns: matchQuarterPatterns,
1888
+ defaultMatchWidth: 'wide',
1889
+ parsePatterns: parseQuarterPatterns,
1890
+ defaultParseWidth: 'any',
1891
+ valueCallback: function valueCallback(index) {
1892
+ return index + 1;
1893
+ }
1894
+ }),
1895
+ month: buildMatchFn({
1896
+ matchPatterns: matchMonthPatterns,
1897
+ defaultMatchWidth: 'wide',
1898
+ parsePatterns: parseMonthPatterns,
1899
+ defaultParseWidth: 'any'
1900
+ }),
1901
+ day: buildMatchFn({
1902
+ matchPatterns: matchDayPatterns,
1903
+ defaultMatchWidth: 'wide',
1904
+ parsePatterns: parseDayPatterns,
1905
+ defaultParseWidth: 'any'
1906
+ }),
1907
+ dayPeriod: buildMatchFn({
1908
+ matchPatterns: matchDayPeriodPatterns,
1909
+ defaultMatchWidth: 'any',
1910
+ parsePatterns: parseDayPeriodPatterns,
1911
+ defaultParseWidth: 'any'
1912
+ })
1913
+ };
1914
+ const match$1 = match;
1915
+
1916
+ /**
1917
+ * @type {Locale}
1918
+ * @category Locales
1919
+ * @summary English locale (United States).
1920
+ * @language English
1921
+ * @iso-639-2 eng
1922
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
1923
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
1924
+ */
1925
+ var locale = {
1926
+ code: 'en-US',
1927
+ formatDistance: formatDistance$1,
1928
+ formatLong: formatLong$1,
1929
+ formatRelative: formatRelative$1,
1930
+ localize: localize$1,
1931
+ match: match$1,
1932
+ options: {
1933
+ weekStartsOn: 0 /* Sunday */,
1934
+ firstWeekContainsDate: 1
1935
+ }
1936
+ };
1937
+ const defaultLocale = locale;
1938
+
1939
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
1940
+ // (one of the certain letters followed by `o`)
1941
+ // - (\w)\1* matches any sequences of the same letter
1942
+ // - '' matches two quote characters in a row
1943
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
1944
+ // except a single quote symbol, which ends the sequence.
1945
+ // Two quote characters do not end the sequence.
1946
+ // If there is no matching single quote
1947
+ // then the sequence will continue until the end of the string.
1948
+ // - . matches any single character unmatched by previous parts of the RegExps
1949
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
1950
+
1951
+ // This RegExp catches symbols escaped by quotes, and also
1952
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
1953
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
1954
+ var escapedStringRegExp = /^'([^]*?)'?$/;
1955
+ var doubleQuoteRegExp = /''/g;
1956
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
1957
+
1958
+ /**
1959
+ * @name format
1960
+ * @category Common Helpers
1961
+ * @summary Format the date.
1962
+ *
1963
+ * @description
1964
+ * Return the formatted date string in the given format. The result may vary by locale.
1965
+ *
1966
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
1967
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1968
+ *
1969
+ * The characters wrapped between two single quotes characters (') are escaped.
1970
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
1971
+ * (see the last example)
1972
+ *
1973
+ * Format of the string is based on Unicode Technical Standard #35:
1974
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
1975
+ * with a few additions (see note 7 below the table).
1976
+ *
1977
+ * Accepted patterns:
1978
+ * | Unit | Pattern | Result examples | Notes |
1979
+ * |---------------------------------|---------|-----------------------------------|-------|
1980
+ * | Era | G..GGG | AD, BC | |
1981
+ * | | GGGG | Anno Domini, Before Christ | 2 |
1982
+ * | | GGGGG | A, B | |
1983
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
1984
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
1985
+ * | | yy | 44, 01, 00, 17 | 5 |
1986
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
1987
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
1988
+ * | | yyyyy | ... | 3,5 |
1989
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
1990
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
1991
+ * | | YY | 44, 01, 00, 17 | 5,8 |
1992
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
1993
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
1994
+ * | | YYYYY | ... | 3,5 |
1995
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
1996
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
1997
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
1998
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
1999
+ * | | RRRRR | ... | 3,5,7 |
2000
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
2001
+ * | | uu | -43, 01, 1900, 2017 | 5 |
2002
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
2003
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
2004
+ * | | uuuuu | ... | 3,5 |
2005
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
2006
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
2007
+ * | | QQ | 01, 02, 03, 04 | |
2008
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
2009
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
2010
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
2011
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
2012
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
2013
+ * | | qq | 01, 02, 03, 04 | |
2014
+ * | | qqq | Q1, Q2, Q3, Q4 | |
2015
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
2016
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
2017
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
2018
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
2019
+ * | | MM | 01, 02, ..., 12 | |
2020
+ * | | MMM | Jan, Feb, ..., Dec | |
2021
+ * | | MMMM | January, February, ..., December | 2 |
2022
+ * | | MMMMM | J, F, ..., D | |
2023
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
2024
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
2025
+ * | | LL | 01, 02, ..., 12 | |
2026
+ * | | LLL | Jan, Feb, ..., Dec | |
2027
+ * | | LLLL | January, February, ..., December | 2 |
2028
+ * | | LLLLL | J, F, ..., D | |
2029
+ * | Local week of year | w | 1, 2, ..., 53 | |
2030
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
2031
+ * | | ww | 01, 02, ..., 53 | |
2032
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
2033
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
2034
+ * | | II | 01, 02, ..., 53 | 7 |
2035
+ * | Day of month | d | 1, 2, ..., 31 | |
2036
+ * | | do | 1st, 2nd, ..., 31st | 7 |
2037
+ * | | dd | 01, 02, ..., 31 | |
2038
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
2039
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
2040
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
2041
+ * | | DDD | 001, 002, ..., 365, 366 | |
2042
+ * | | DDDD | ... | 3 |
2043
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
2044
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
2045
+ * | | EEEEE | M, T, W, T, F, S, S | |
2046
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
2047
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
2048
+ * | | io | 1st, 2nd, ..., 7th | 7 |
2049
+ * | | ii | 01, 02, ..., 07 | 7 |
2050
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
2051
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
2052
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
2053
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
2054
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
2055
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
2056
+ * | | ee | 02, 03, ..., 01 | |
2057
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
2058
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
2059
+ * | | eeeee | M, T, W, T, F, S, S | |
2060
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
2061
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
2062
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
2063
+ * | | cc | 02, 03, ..., 01 | |
2064
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
2065
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
2066
+ * | | ccccc | M, T, W, T, F, S, S | |
2067
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
2068
+ * | AM, PM | a..aa | AM, PM | |
2069
+ * | | aaa | am, pm | |
2070
+ * | | aaaa | a.m., p.m. | 2 |
2071
+ * | | aaaaa | a, p | |
2072
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
2073
+ * | | bbb | am, pm, noon, midnight | |
2074
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
2075
+ * | | bbbbb | a, p, n, mi | |
2076
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
2077
+ * | | BBBB | at night, in the morning, ... | 2 |
2078
+ * | | BBBBB | at night, in the morning, ... | |
2079
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
2080
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
2081
+ * | | hh | 01, 02, ..., 11, 12 | |
2082
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
2083
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
2084
+ * | | HH | 00, 01, 02, ..., 23 | |
2085
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
2086
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
2087
+ * | | KK | 01, 02, ..., 11, 00 | |
2088
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
2089
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
2090
+ * | | kk | 24, 01, 02, ..., 23 | |
2091
+ * | Minute | m | 0, 1, ..., 59 | |
2092
+ * | | mo | 0th, 1st, ..., 59th | 7 |
2093
+ * | | mm | 00, 01, ..., 59 | |
2094
+ * | Second | s | 0, 1, ..., 59 | |
2095
+ * | | so | 0th, 1st, ..., 59th | 7 |
2096
+ * | | ss | 00, 01, ..., 59 | |
2097
+ * | Fraction of second | S | 0, 1, ..., 9 | |
2098
+ * | | SS | 00, 01, ..., 99 | |
2099
+ * | | SSS | 000, 001, ..., 999 | |
2100
+ * | | SSSS | ... | 3 |
2101
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
2102
+ * | | XX | -0800, +0530, Z | |
2103
+ * | | XXX | -08:00, +05:30, Z | |
2104
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
2105
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
2106
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
2107
+ * | | xx | -0800, +0530, +0000 | |
2108
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
2109
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
2110
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
2111
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
2112
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
2113
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
2114
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
2115
+ * | Seconds timestamp | t | 512969520 | 7 |
2116
+ * | | tt | ... | 3,7 |
2117
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
2118
+ * | | TT | ... | 3,7 |
2119
+ * | Long localized date | P | 04/29/1453 | 7 |
2120
+ * | | PP | Apr 29, 1453 | 7 |
2121
+ * | | PPP | April 29th, 1453 | 7 |
2122
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
2123
+ * | Long localized time | p | 12:00 AM | 7 |
2124
+ * | | pp | 12:00:00 AM | 7 |
2125
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
2126
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
2127
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
2128
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
2129
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
2130
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
2131
+ * Notes:
2132
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
2133
+ * are the same as "stand-alone" units, but are different in some languages.
2134
+ * "Formatting" units are declined according to the rules of the language
2135
+ * in the context of a date. "Stand-alone" units are always nominative singular:
2136
+ *
2137
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
2138
+ *
2139
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
2140
+ *
2141
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2142
+ * the single quote characters (see below).
2143
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
2144
+ * the output will be the same as default pattern for this unit, usually
2145
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
2146
+ * are marked with "2" in the last column of the table.
2147
+ *
2148
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
2149
+ *
2150
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
2151
+ *
2152
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
2153
+ *
2154
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
2155
+ *
2156
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
2157
+ *
2158
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
2159
+ * The output will be padded with zeros to match the length of the pattern.
2160
+ *
2161
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
2162
+ *
2163
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2164
+ * These tokens represent the shortest form of the quarter.
2165
+ *
2166
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
2167
+ *
2168
+ * | Year | `y` | `u` |
2169
+ * |------|-----|-----|
2170
+ * | AC 1 | 1 | 1 |
2171
+ * | BC 1 | 1 | 0 |
2172
+ * | BC 2 | 2 | -1 |
2173
+ *
2174
+ * Also `yy` always returns the last two digits of a year,
2175
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
2176
+ *
2177
+ * | Year | `yy` | `uu` |
2178
+ * |------|------|------|
2179
+ * | 1 | 01 | 01 |
2180
+ * | 14 | 14 | 14 |
2181
+ * | 376 | 76 | 376 |
2182
+ * | 1453 | 53 | 1453 |
2183
+ *
2184
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2185
+ * except local week-numbering years are dependent on `options.weekStartsOn`
2186
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
2187
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
2188
+ *
2189
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
2190
+ * so right now these tokens fall back to GMT timezones.
2191
+ *
2192
+ * 7. These patterns are not in the Unicode Technical Standard #35:
2193
+ * - `i`: ISO day of week
2194
+ * - `I`: ISO week of year
2195
+ * - `R`: ISO week-numbering year
2196
+ * - `t`: seconds timestamp
2197
+ * - `T`: milliseconds timestamp
2198
+ * - `o`: ordinal number modifier
2199
+ * - `P`: long localized date
2200
+ * - `p`: long localized time
2201
+ *
2202
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2203
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2204
+ *
2205
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2206
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2207
+ *
2208
+ * @param {Date|Number} date - the original date
2209
+ * @param {String} format - the string of tokens
2210
+ * @param {Object} [options] - an object with options.
2211
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2212
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2213
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2214
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2215
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2216
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2217
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2218
+ * @returns {String} the formatted date string
2219
+ * @throws {TypeError} 2 arguments required
2220
+ * @throws {RangeError} `date` must not be Invalid Date
2221
+ * @throws {RangeError} `options.locale` must contain `localize` property
2222
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2223
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2224
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2225
+ * @throws {RangeError} 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
2226
+ * @throws {RangeError} 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
2227
+ * @throws {RangeError} 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
2228
+ * @throws {RangeError} 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
2229
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2230
+ *
2231
+ * @example
2232
+ * // Represent 11 February 2014 in middle-endian format:
2233
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2234
+ * //=> '02/11/2014'
2235
+ *
2236
+ * @example
2237
+ * // Represent 2 July 2014 in Esperanto:
2238
+ * import { eoLocale } from 'date-fns/locale/eo'
2239
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2240
+ * locale: eoLocale
2241
+ * })
2242
+ * //=> '2-a de julio 2014'
2243
+ *
2244
+ * @example
2245
+ * // Escape string by single quote characters:
2246
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2247
+ * //=> "3 o'clock"
2248
+ */
2249
+
2250
+ function format(dirtyDate, dirtyFormatStr, options) {
2251
+ var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
2252
+ requiredArgs(2, arguments);
2253
+ var formatStr = String(dirtyFormatStr);
2254
+ var defaultOptions = getDefaultOptions();
2255
+ var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
2256
+ var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
2257
+
2258
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2259
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2260
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2261
+ }
2262
+ var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
2263
+
2264
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2265
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2266
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2267
+ }
2268
+ if (!locale.localize) {
2269
+ throw new RangeError('locale must contain localize property');
2270
+ }
2271
+ if (!locale.formatLong) {
2272
+ throw new RangeError('locale must contain formatLong property');
2273
+ }
2274
+ var originalDate = toDate(dirtyDate);
2275
+ if (!isValid(originalDate)) {
2276
+ throw new RangeError('Invalid time value');
2277
+ }
2278
+
2279
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2280
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2281
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2282
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2283
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2284
+ var formatterOptions = {
2285
+ firstWeekContainsDate: firstWeekContainsDate,
2286
+ weekStartsOn: weekStartsOn,
2287
+ locale: locale,
2288
+ _originalDate: originalDate
2289
+ };
2290
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2291
+ var firstCharacter = substring[0];
2292
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2293
+ var longFormatter = longFormatters$1[firstCharacter];
2294
+ return longFormatter(substring, locale.formatLong);
2295
+ }
2296
+ return substring;
2297
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2298
+ // Replace two single quote characters with one single quote character
2299
+ if (substring === "''") {
2300
+ return "'";
2301
+ }
2302
+ var firstCharacter = substring[0];
2303
+ if (firstCharacter === "'") {
2304
+ return cleanEscapedString(substring);
2305
+ }
2306
+ var formatter = formatters$1[firstCharacter];
2307
+ if (formatter) {
2308
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2309
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2310
+ }
2311
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2312
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2313
+ }
2314
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
2315
+ }
2316
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2317
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2318
+ }
2319
+ return substring;
2320
+ }).join('');
2321
+ return result;
2322
+ }
2323
+ function cleanEscapedString(input) {
2324
+ var matched = input.match(escapedStringRegExp);
2325
+ if (!matched) {
2326
+ return input;
2327
+ }
2328
+ return matched[1].replace(doubleQuoteRegExp, "'");
2329
+ }
2330
+
2331
+ /**
2332
+ * @name isToday
2333
+ * @category Day Helpers
2334
+ * @summary Is the given date today?
2335
+ * @pure false
2336
+ *
2337
+ * @description
2338
+ * Is the given date today?
2339
+ *
2340
+ * > ⚠️ Please note that this function is not present in the FP submodule as
2341
+ * > it uses `Date.now()` internally hence impure and can't be safely curried.
2342
+ *
2343
+ * @param {Date|Number} date - the date to check
2344
+ * @returns {Boolean} the date is today
2345
+ * @throws {TypeError} 1 argument required
2346
+ *
2347
+ * @example
2348
+ * // If today is 6 October 2014, is 6 October 14:00:00 today?
2349
+ * const result = isToday(new Date(2014, 9, 6, 14, 0))
2350
+ * //=> true
2351
+ */
2352
+ function isToday(dirtyDate) {
2353
+ requiredArgs(1, arguments);
2354
+ return isSameDay(dirtyDate, Date.now());
2355
+ }
2356
+
2357
+ /**
2358
+ * @name isTomorrow
2359
+ * @category Day Helpers
2360
+ * @summary Is the given date tomorrow?
2361
+ * @pure false
2362
+ *
2363
+ * @description
2364
+ * Is the given date tomorrow?
2365
+ *
2366
+ * > ⚠️ Please note that this function is not present in the FP submodule as
2367
+ * > it uses `Date.now()` internally hence impure and can't be safely curried.
2368
+ *
2369
+ * @param {Date|Number} date - the date to check
2370
+ * @returns {Boolean} the date is tomorrow
2371
+ * @throws {TypeError} 1 argument required
2372
+ *
2373
+ * @example
2374
+ * // If today is 6 October 2014, is 7 October 14:00:00 tomorrow?
2375
+ * const result = isTomorrow(new Date(2014, 9, 7, 14, 0))
2376
+ * //=> true
2377
+ */
2378
+ function isTomorrow(dirtyDate) {
2379
+ requiredArgs(1, arguments);
2380
+ return isSameDay(dirtyDate, addDays(Date.now(), 1));
2381
+ }
2382
+
2383
+ /**
2384
+ * @name parseISO
2385
+ * @category Common Helpers
2386
+ * @summary Parse ISO string
2387
+ *
2388
+ * @description
2389
+ * Parse the given string in ISO 8601 format and return an instance of Date.
2390
+ *
2391
+ * Function accepts complete ISO 8601 formats as well as partial implementations.
2392
+ * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
2393
+ *
2394
+ * If the argument isn't a string, the function cannot parse the string or
2395
+ * the values are invalid, it returns Invalid Date.
2396
+ *
2397
+ * @param {String} argument - the value to convert
2398
+ * @param {Object} [options] - an object with options.
2399
+ * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
2400
+ * @returns {Date} the parsed date in the local time zone
2401
+ * @throws {TypeError} 1 argument required
2402
+ * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
2403
+ *
2404
+ * @example
2405
+ * // Convert string '2014-02-11T11:30:30' to date:
2406
+ * const result = parseISO('2014-02-11T11:30:30')
2407
+ * //=> Tue Feb 11 2014 11:30:30
2408
+ *
2409
+ * @example
2410
+ * // Convert string '+02014101' to date,
2411
+ * // if the additional number of digits in the extended year format is 1:
2412
+ * const result = parseISO('+02014101', { additionalDigits: 1 })
2413
+ * //=> Fri Apr 11 2014 00:00:00
2414
+ */
2415
+ function parseISO(argument, options) {
2416
+ var _options$additionalDi;
2417
+ requiredArgs(1, arguments);
2418
+ var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
2419
+ if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
2420
+ throw new RangeError('additionalDigits must be 0, 1 or 2');
2421
+ }
2422
+ if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
2423
+ return new Date(NaN);
2424
+ }
2425
+ var dateStrings = splitDateString(argument);
2426
+ var date;
2427
+ if (dateStrings.date) {
2428
+ var parseYearResult = parseYear(dateStrings.date, additionalDigits);
2429
+ date = parseDate(parseYearResult.restDateString, parseYearResult.year);
2430
+ }
2431
+ if (!date || isNaN(date.getTime())) {
2432
+ return new Date(NaN);
2433
+ }
2434
+ var timestamp = date.getTime();
2435
+ var time = 0;
2436
+ var offset;
2437
+ if (dateStrings.time) {
2438
+ time = parseTime(dateStrings.time);
2439
+ if (isNaN(time)) {
2440
+ return new Date(NaN);
2441
+ }
2442
+ }
2443
+ if (dateStrings.timezone) {
2444
+ offset = parseTimezone(dateStrings.timezone);
2445
+ if (isNaN(offset)) {
2446
+ return new Date(NaN);
2447
+ }
2448
+ } else {
2449
+ var dirtyDate = new Date(timestamp + time);
2450
+ // js parsed string assuming it's in UTC timezone
2451
+ // but we need it to be parsed in our timezone
2452
+ // so we use utc values to build date in our timezone.
2453
+ // Year values from 0 to 99 map to the years 1900 to 1999
2454
+ // so set year explicitly with setFullYear.
2455
+ var result = new Date(0);
2456
+ result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
2457
+ result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
2458
+ return result;
2459
+ }
2460
+ return new Date(timestamp + time + offset);
2461
+ }
2462
+ var patterns = {
2463
+ dateTimeDelimiter: /[T ]/,
2464
+ timeZoneDelimiter: /[Z ]/i,
2465
+ timezone: /([Z+-].*)$/
2466
+ };
2467
+ var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
2468
+ var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
2469
+ var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
2470
+ function splitDateString(dateString) {
2471
+ var dateStrings = {};
2472
+ var array = dateString.split(patterns.dateTimeDelimiter);
2473
+ var timeString;
2474
+
2475
+ // The regex match should only return at maximum two array elements.
2476
+ // [date], [time], or [date, time].
2477
+ if (array.length > 2) {
2478
+ return dateStrings;
2479
+ }
2480
+ if (/:/.test(array[0])) {
2481
+ timeString = array[0];
2482
+ } else {
2483
+ dateStrings.date = array[0];
2484
+ timeString = array[1];
2485
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
2486
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
2487
+ timeString = dateString.substr(dateStrings.date.length, dateString.length);
2488
+ }
2489
+ }
2490
+ if (timeString) {
2491
+ var token = patterns.timezone.exec(timeString);
2492
+ if (token) {
2493
+ dateStrings.time = timeString.replace(token[1], '');
2494
+ dateStrings.timezone = token[1];
2495
+ } else {
2496
+ dateStrings.time = timeString;
2497
+ }
2498
+ }
2499
+ return dateStrings;
2500
+ }
2501
+ function parseYear(dateString, additionalDigits) {
2502
+ var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
2503
+ var captures = dateString.match(regex);
2504
+ // Invalid ISO-formatted year
2505
+ if (!captures) return {
2506
+ year: NaN,
2507
+ restDateString: ''
2508
+ };
2509
+ var year = captures[1] ? parseInt(captures[1]) : null;
2510
+ var century = captures[2] ? parseInt(captures[2]) : null;
2511
+
2512
+ // either year or century is null, not both
2513
+ return {
2514
+ year: century === null ? year : century * 100,
2515
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
2516
+ };
2517
+ }
2518
+ function parseDate(dateString, year) {
2519
+ // Invalid ISO-formatted year
2520
+ if (year === null) return new Date(NaN);
2521
+ var captures = dateString.match(dateRegex);
2522
+ // Invalid ISO-formatted string
2523
+ if (!captures) return new Date(NaN);
2524
+ var isWeekDate = !!captures[4];
2525
+ var dayOfYear = parseDateUnit(captures[1]);
2526
+ var month = parseDateUnit(captures[2]) - 1;
2527
+ var day = parseDateUnit(captures[3]);
2528
+ var week = parseDateUnit(captures[4]);
2529
+ var dayOfWeek = parseDateUnit(captures[5]) - 1;
2530
+ if (isWeekDate) {
2531
+ if (!validateWeekDate(year, week, dayOfWeek)) {
2532
+ return new Date(NaN);
2533
+ }
2534
+ return dayOfISOWeekYear(year, week, dayOfWeek);
2535
+ } else {
2536
+ var date = new Date(0);
2537
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
2538
+ return new Date(NaN);
2539
+ }
2540
+ date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
2541
+ return date;
2542
+ }
2543
+ }
2544
+ function parseDateUnit(value) {
2545
+ return value ? parseInt(value) : 1;
2546
+ }
2547
+ function parseTime(timeString) {
2548
+ var captures = timeString.match(timeRegex);
2549
+ if (!captures) return NaN; // Invalid ISO-formatted time
2550
+
2551
+ var hours = parseTimeUnit(captures[1]);
2552
+ var minutes = parseTimeUnit(captures[2]);
2553
+ var seconds = parseTimeUnit(captures[3]);
2554
+ if (!validateTime(hours, minutes, seconds)) {
2555
+ return NaN;
2556
+ }
2557
+ return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
2558
+ }
2559
+ function parseTimeUnit(value) {
2560
+ return value && parseFloat(value.replace(',', '.')) || 0;
2561
+ }
2562
+ function parseTimezone(timezoneString) {
2563
+ if (timezoneString === 'Z') return 0;
2564
+ var captures = timezoneString.match(timezoneRegex);
2565
+ if (!captures) return 0;
2566
+ var sign = captures[1] === '+' ? -1 : 1;
2567
+ var hours = parseInt(captures[2]);
2568
+ var minutes = captures[3] && parseInt(captures[3]) || 0;
2569
+ if (!validateTimezone(hours, minutes)) {
2570
+ return NaN;
2571
+ }
2572
+ return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
2573
+ }
2574
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
2575
+ var date = new Date(0);
2576
+ date.setUTCFullYear(isoWeekYear, 0, 4);
2577
+ var fourthOfJanuaryDay = date.getUTCDay() || 7;
2578
+ var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
2579
+ date.setUTCDate(date.getUTCDate() + diff);
2580
+ return date;
2581
+ }
2582
+
2583
+ // Validation functions
2584
+
2585
+ // February is null to handle the leap year (using ||)
2586
+ var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2587
+ function isLeapYearIndex(year) {
2588
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
2589
+ }
2590
+ function validateDate(year, month, date) {
2591
+ return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
2592
+ }
2593
+ function validateDayOfYearDate(year, dayOfYear) {
2594
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
2595
+ }
2596
+ function validateWeekDate(_year, week, day) {
2597
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
2598
+ }
2599
+ function validateTime(hours, minutes, seconds) {
2600
+ if (hours === 24) {
2601
+ return minutes === 0 && seconds === 0;
2602
+ }
2603
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
2604
+ }
2605
+ function validateTimezone(_hours, minutes) {
2606
+ return minutes >= 0 && minutes <= 59;
2607
+ }
2608
+
2609
+ function fetchRequest(url, method = 'GET', body = null, headers = {}) {
2610
+ return new Promise((resolve, reject) => {
2611
+ const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
2612
+ const options = {
2613
+ method,
2614
+ headers: headersOrigin,
2615
+ body: null
2616
+ };
2617
+ if (body && method !== 'GET' && method !== 'HEAD') {
2618
+ options.body = JSON.stringify(body);
2619
+ }
2620
+ else {
2621
+ delete options.body;
2622
+ }
2623
+ fetch(url, options)
2624
+ .then((response) => {
2625
+ if (!response.ok) {
2626
+ return response.json().then((errorData) => {
2627
+ const error = {
2628
+ status: response.status,
2629
+ statusText: response.statusText,
2630
+ code: errorData.code || 'UNKNOWN_ERROR',
2631
+ message: errorData.message || 'An unknown error occurred',
2632
+ data: errorData.data || null
2633
+ };
2634
+ reject(error);
2635
+ }, () => reject({
2636
+ status: response.status,
2637
+ statusText: response.statusText,
2638
+ code: 'PARSE_ERROR',
2639
+ message: 'Failed to parse error response'
2640
+ }));
2641
+ }
2642
+ else {
2643
+ return response.json();
2644
+ }
2645
+ })
2646
+ .then((data) => resolve(data), (error) => reject(error));
2647
+ });
2648
+ }
2649
+ function formattedTime(date) {
2650
+ if (!date) {
2651
+ return '';
2652
+ }
2653
+ const parsedDate = parseISO(date);
2654
+ if (isNaN(parsedDate.getTime())) {
2655
+ return '';
2656
+ }
2657
+ const hhmm = format(parsedDate, 'HH:mm');
2658
+ if (isToday(parsedDate))
2659
+ return `Today at ${hhmm}`;
2660
+ if (isTomorrow(parsedDate))
2661
+ return `Tomorrow at ${hhmm}`;
2662
+ const weekday = format(parsedDate, 'EEEE');
2663
+ return `${weekday} at ${hhmm}`;
2664
+ }
2665
+ function toQueryParams(params) {
2666
+ const finalParams = {};
2667
+ Object.entries(params).forEach(([key, value]) => {
2668
+ if (!isEmptyValue(value, true)) {
2669
+ finalParams[key] = value;
2670
+ }
2671
+ });
2672
+ const queryString = Object.entries(finalParams)
2673
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
2674
+ .join('&');
2675
+ return queryString ? `?${queryString}` : '';
2676
+ }
2677
+ function isEmptyValue(value, allowZero) {
2678
+ if (value === null || value === undefined || value === '') {
2679
+ return true;
2680
+ }
2681
+ else if (value === 0 && allowZero) {
2682
+ return false;
2683
+ }
2684
+ else if (Array.isArray(value)) {
2685
+ return isEmptyValueOfArray(value);
2686
+ }
2687
+ else if (Object.prototype.toString.call(value) === '[object Object]') {
2688
+ return isEmptyValueOfObject(value);
2689
+ }
2690
+ else {
2691
+ return !value;
2692
+ }
2693
+ }
2694
+ function isEmptyValueOfArray(arr) {
2695
+ if (arr.length === 0) {
2696
+ return true;
2697
+ }
2698
+ const len = arr.length;
2699
+ let count = 0;
2700
+ for (let i = 0; i < len; i++) {
2701
+ if (isEmptyValue(arr[i])) {
2702
+ count++;
2703
+ }
2704
+ else {
2705
+ return false;
2706
+ }
2707
+ }
2708
+ if (count === len) {
2709
+ return true;
2710
+ }
2711
+ return false;
2712
+ }
2713
+ function isEmptyValueOfObject(obj) {
2714
+ if (Object.keys(obj).length === 0) {
2715
+ return true;
2716
+ }
2717
+ const len = Object.keys(obj).length;
2718
+ let count = 0;
2719
+ for (const val of Object.values(obj)) {
2720
+ if (isEmptyValue(val)) {
2721
+ count++;
2722
+ }
2723
+ else {
2724
+ return false;
2725
+ }
2726
+ }
2727
+ if (count === len) {
2728
+ return true;
2729
+ }
2730
+ return false;
2731
+ }
2732
+ const DEFAULT_ALL_BOMB = { name: 'All', code: 'All' };
2733
+ function thousandSeparator(value) {
2734
+ if (value === 0) {
2735
+ return '0';
2736
+ }
2737
+ if (!value) {
2738
+ return '';
2739
+ }
2740
+ value = value.toString();
2741
+ const parts = value.split('.');
2742
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
2743
+ return parts.join('.');
2744
+ }
2745
+
2746
+ async function fetchLiveDrawsByGroupId({ endpoint, groupId, params = {} }) {
2747
+ try {
2748
+ const res = await fetchRequest(`${endpoint}/groups/${groupId}/liveDraws${toQueryParams(params)}`);
2749
+ return res;
2750
+ }
2751
+ catch (error) {
2752
+ console.error('Failed to fetch game info:', error);
2753
+ return {};
2754
+ }
2755
+ }
2756
+ async function fetchSaleStatistics({ endpoint, gameId, drawId }) {
2757
+ try {
2758
+ const res = await fetchRequest(`${endpoint}/games/${gameId}/draws/${drawId}/saleStatistics`);
2759
+ return res;
2760
+ }
2761
+ catch (error) {
2762
+ return Promise.reject(error);
2763
+ }
2764
+ }
2765
+ async function fetchData({ endpoint, groupId, params }) {
2766
+ try {
2767
+ const { sportTags = [], liveDraws = [] } = await fetchLiveDrawsByGroupId({
2768
+ endpoint,
2769
+ groupId,
2770
+ params
2771
+ });
2772
+ return {
2773
+ sportTags: sportTags.map((i) => ({ name: i, code: i })),
2774
+ liveDraws: liveDraws.map((i) => ({
2775
+ title: i.gameName,
2776
+ subTitle: i.sportTag,
2777
+ icon: i.sportTag,
2778
+ date: formattedTime(i.drawCloseTime),
2779
+ turnover: formattedTurnover(null),
2780
+ matchList: i.matchs.map((i) => i.eventName),
2781
+ drawId: i.drawId,
2782
+ gameId: i.gameId
2783
+ }))
2784
+ };
2785
+ }
2786
+ catch (_a) {
2787
+ return {
2788
+ sportTags: [],
2789
+ liveDraws: []
2790
+ };
2791
+ }
2792
+ }
2793
+ async function getTurnoverForAll({ endpoint, configs }) {
2794
+ const fallback = { turnover: formattedTurnover(null) };
2795
+ const promises = configs.map(async ({ gameId, drawId }) => {
2796
+ var _a;
2797
+ const res = await fetchSaleStatistics({
2798
+ endpoint: endpoint,
2799
+ gameId,
2800
+ drawId
2801
+ });
2802
+ return { turnover: formattedTurnover((_a = res === null || res === void 0 ? void 0 : res.wagerSegment) === null || _a === void 0 ? void 0 : _a.totalSalesCrossDraw) };
2803
+ });
2804
+ const results = await Promise.allSettled(promises);
2805
+ return results.map((r) => (r.status === 'fulfilled' ? r.value : fallback));
2806
+ }
2807
+ function formattedTurnover(turnover) {
2808
+ if (turnover === null)
2809
+ return '';
2810
+ const unit = '€';
2811
+ return `${unit}${turnover ? thousandSeparator(turnover) : 0}`;
2812
+ }
2813
+
2814
+ const DEFAULT_LANGUAGE = 'en';
2815
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
2816
+ const TRANSLATIONS = {
2817
+ en: {
2818
+ logout: 'Log out',
2819
+ draws: 'DRAWS',
2820
+ latestResults: 'LATEST RESULTS',
2821
+ instruction: 'INSTRUCTION',
2822
+ howToWin: 'HOW TO WIN',
2823
+ selectDraws: 'Select Draws from the following bars:',
2824
+ gameNotAvailable: 'Sorry. The Game is not available now.',
2825
+ instructionContent: 'Instruction content goes here.',
2826
+ turnover: 'Turnover: '
2827
+ },
2828
+ ro: {
2829
+ logout: 'Deconectare',
2830
+ draws: 'EXTRAGERI',
2831
+ latestResults: 'ULTIMELE REZULTATE',
2832
+ instruction: 'INSTRUCȚIUNI',
2833
+ howToWin: 'CUM SĂ CÂȘTIGI',
2834
+ selectDraws: 'Selectați extrageri din barele următoare:',
2835
+ gameNotAvailable: 'Ne pare rău. Jocul nu este disponibil acum.',
2836
+ instructionContent: 'Conținutul instrucțiunilor se afișează aici.'
2837
+ },
2838
+ fr: {
2839
+ logout: 'Se déconnecter',
2840
+ draws: 'TIRAGES',
2841
+ latestResults: 'DERNIERS RÉSULTATS',
2842
+ instruction: 'INSTRUCTION',
2843
+ howToWin: 'COMMENT GAGNER',
2844
+ selectDraws: 'Sélectionnez les tirages dans les barres suivantes:',
2845
+ gameNotAvailable: 'Désolé. Le jeu nest pas disponible pour le moment.',
2846
+ instructionContent: 'Le contenu des instructions va ici.'
2847
+ },
2848
+ ar: {
2849
+ logout: 'تسجيل الخروج',
2850
+ draws: 'السحوبات',
2851
+ latestResults: 'أحدث النتائج',
2852
+ instruction: 'التعليمات',
2853
+ howToWin: 'كيفية الفوز',
2854
+ selectDraws: 'حدد السحوبات من الأشرطة التالية:',
2855
+ gameNotAvailable: 'آسف. اللعبة غير متوفرة الآن.',
2856
+ instructionContent: 'محتوى التعليمات يذهب هنا.'
2857
+ },
2858
+ hr: {
2859
+ logout: 'Odjava',
2860
+ draws: 'IZVLAČENJA',
2861
+ latestResults: 'NAJNOVIJI REZULTATI',
2862
+ instruction: 'UPUTE',
2863
+ howToWin: 'KAKO POBIJEDITI',
2864
+ selectDraws: 'Odaberite izvlačenja sa sljedećih traka:',
2865
+ gameNotAvailable: 'Žao nam je. Igra trenutno nije dostupna.',
2866
+ instructionContent: 'Sadržaj uputa ide ovdje.'
2867
+ }
2868
+ };
2869
+ const translate = (key, customLang) => {
2870
+ const lang = customLang;
2871
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
2872
+ };
2873
+
2874
+ const lotteryOddsbomBombCss = "/* --- Component: Bomb Card Grid --- */\n.lottery-oddsbom-bomb-wrapper {\n background: var(--emw--color-background, #fff);\n color: var(--emw--color-typography, #000);\n height: 100%;\n}\n\n.bomb-grid-container {\n width: 100%;\n display: flex;\n justify-content: center;\n container-type: inline-size;\n container-name: bomb-grid;\n background: var(--emw--color-background, #fff);\n color: var(--emw--color-typography, #000);\n /* --- Component: Bomb Card --- */\n}\n.bomb-grid-container .bomb-grid {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 0.75rem;\n place-items: center;\n}\n.bomb-grid-container .bomb-card-wrapper {\n width: 100%;\n max-width: 30rem;\n height: 100%;\n box-sizing: border-box;\n border-radius: 8px;\n padding: 1rem;\n border: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n.bomb-grid-container .bomb-card {\n height: 100%;\n min-width: 24rem;\n transition: transform 0.3s;\n}\n.bomb-grid-container .bomb-card:hover {\n transform: scale(1.02);\n cursor: pointer;\n}\n.bomb-grid-container .card-header {\n display: flex;\n align-items: center;\n gap: 1rem;\n margin-bottom: 0.8rem;\n}\n.bomb-grid-container .card-icon {\n width: 48px;\n height: 48px;\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.bomb-grid-container .card-icon svg {\n width: 28px;\n height: 28px;\n}\n.bomb-grid-container .card-title {\n flex-grow: 1;\n word-break: break-all;\n}\n.bomb-grid-container .card-title h2 {\n margin: 0;\n font-size: 1.25rem;\n font-weight: 700;\n word-wrap: break-word;\n}\n.bomb-grid-container .card-title p {\n margin: 0;\n color: var(--emw--color-typography-secondary, #333);\n font-size: 0.9rem;\n word-wrap: break-word;\n}\n.bomb-grid-container .card-info {\n display: flex;\n gap: 0.75rem;\n margin-bottom: 0.8rem;\n flex-wrap: wrap;\n}\n.bomb-grid-container .card-tag {\n background-color: var(--emw--color-tertiary, #e3f2fd);\n padding: 0.3rem 0.75rem;\n border-radius: 4px;\n font-size: 0.85rem;\n font-weight: 500;\n max-width: 120px;\n}\n.bomb-grid-container .card-matches {\n max-height: 6.8rem;\n overflow-y: auto;\n}\n.bomb-grid-container .card-matches ol {\n margin: 0;\n padding-left: 1.25rem;\n font-size: 0.85rem;\n line-height: 1.6;\n}\n.bomb-grid-container .card-matches li {\n padding-left: 0.2rem;\n word-wrap: break-word;\n}\n\n/* --- CONTAINER QUERIES FOR RESPONSIVENESS --- */\n@container bomb-grid (max-width: 768px) {\n .bomb-grid-container .bomb-grid {\n /* On smaller containers, switch to a single column */\n grid-template-columns: 1fr;\n }\n .bomb-card-wrapper .bomb-card {\n min-width: 200px;\n }\n}\n/* --- Component: Filter Controls --- */\n.OddsbomEntranceController__section {\n margin: 1.5rem 0;\n display: flex;\n gap: 12px;\n color: var(--emw--color-typography, #000);\n container-type: inline-size;\n container-name: controller;\n justify-content: center;\n}\n.OddsbomEntranceController__label {\n font-weight: 500;\n white-space: nowrap;\n width: 6rem;\n line-height: 2.2rem;\n}\n.OddsbomEntranceController__segmented-control {\n display: inline-flex;\n gap: 1rem;\n flex-wrap: wrap;\n}\n.OddsbomEntranceController__segment {\n height: 2.2rem;\n border: none;\n padding: 0.3rem 0.8rem;\n cursor: pointer;\n font-weight: 500;\n border-radius: 2rem;\n outline: none;\n white-space: nowrap;\n background-color: var(--emw--color-background, #ffffff);\n color: var(--emw--color-typography, #000);\n}\n.OddsbomEntranceController__segment--active {\n background-color: var(--emw--color-primary-variant, #1367e7);\n color: var(--emw--color-typography-reverse, #fff);\n font-weight: 600;\n}\n.OddsbomEntranceController__segment--disabled:hover {\n cursor: not-allowed !important;\n}\n.OddsbomEntranceController__segment:not(.OddsbomEntranceController__segment--active):hover {\n background-color: var(--emw--color-background-tertiary, #ccc);\n}\n\n.skeleton-content {\n display: flex;\n flex-direction: column;\n gap: 29px;\n align-items: center;\n}\n\n.skeleton-item {\n background: var(--emw--color-background-secondary, #f5f5f5);\n border-radius: 4px;\n height: 40px;\n width: 200px;\n}\n\n.skeleton-animated {\n animation: skeleton-shimmer 1.5s infinite linear;\n background: linear-gradient(90deg, var(--emw--color-background-secondary, #f5f5f5) 25%, var(--emw--color-background-tertiary, #ccc) 37%, var(--emw--color-background-secondary, #f5f5f5) 63%);\n background-size: 200% 100%;\n}\n\n@keyframes skeleton-shimmer {\n to {\n background-position: 100% 0;\n }\n}\n.loading-icon.scale {\n animation: scale 1s infinite ease-in-out;\n}\n\n@keyframes scale {\n 0%, 100% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.2);\n }\n}\n@container controller (max-width: 500px) {\n .OddsbomEntranceController__segmented-control {\n gap: 0rem;\n }\n .OddsbomEntranceController__segment {\n padding: 0.2rem 0.6rem;\n }\n .OddsbomEntranceController__label,\n .OddsbomEntranceController____segment {\n line-height: 1.8rem;\n }\n}\n.loading-wrap {\n margin: 20px 0;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 100px;\n}\n.loading-wrap .dots-container {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n}\n.loading-wrap .dot {\n height: 14px;\n width: 14px;\n margin-right: 14px;\n border-radius: 14px;\n background-color: var(--emw--color-gray-300, #333);\n animation: pulse 1.5s infinite ease-in-out;\n}\n.loading-wrap .dot:last-child {\n margin-right: 0;\n}\n.loading-wrap .dot:nth-child(1) {\n animation-delay: -0.3s;\n}\n.loading-wrap .dot:nth-child(2) {\n animation-delay: -0.1s;\n}\n.loading-wrap .dot:nth-child(3) {\n animation-delay: 0.1s;\n}\n@keyframes pulse {\n 0% {\n transform: scale(0.8);\n background-color: var(--emw--color-gray-300, #333);\n }\n 50% {\n transform: scale(1.2);\n background-color: var(--emw--color-gray-100, #e6e6e6);\n }\n 100% {\n transform: scale(0.8);\n background-color: var(--emw--color-gray-150, #6f6f6f);\n }\n}\n\n.empty-draw-wrap {\n padding-top: 100px;\n}\n.empty-draw-wrap .empty-draw {\n width: 240px;\n height: 160px;\n padding: 18px 12px 12px 12px;\n background: var(--emw--color-secondary-variant, #e3f2fd);\n position: relative;\n margin: 0 auto;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n border-radius: 12px;\n}\n.empty-draw-wrap .empty-draw img {\n position: absolute;\n top: -64%;\n left: 50%;\n transform: translateX(-50%);\n width: 200px;\n}\n.empty-draw-wrap .empty-draw-content {\n display: flex;\n gap: 4px;\n}\n.empty-draw-wrap .empty-draw-text {\n font-size: 14px;\n font-weight: bold;\n line-height: 20px;\n}";
2875
+ const LotteryOddsbomBombStyle0 = lotteryOddsbomBombCss;
2876
+
2877
+ const BombIcons = {
2878
+ [Bomb.Football]: (h("svg", { height: "18px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", class: "text-sm" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M19.063 19.072l-.81-.97-.117.083.385-2.43.136-.211 2.23-3.464.037-.057h1.075a9.964 9.964 0 01-2.936 7.049zM4.769 5.112l2.8.877-.072 3.246-2.427 2.95-1.561-.153L2.39 9.26a9.977 9.977 0 012.378-4.148zm7.745-3.086l-.72 1.645-3.798 1.404-2.395-.75A9.953 9.953 0 0112 2c.174 0 .343.017.514.026zm7.346 3.812l-1.128 1.29-3.402-.755-.033-.008-2.446-2.241.057.016.862-1.973a9.996 9.996 0 016.09 3.67zm-1.87 8.894l-3.385-.493-1.358-4.067 2.173-2.755 3.144.698 1.347 3.634-1.921 2.983zm-4.64 5.787l4.304-1.486.62.742a9.945 9.945 0 01-5.878 2.205l.954-1.461zm-6.314-2.84l3.91.873-.001.003 1.509 1.507-1.24 1.898a9.946 9.946 0 01-5.908-2.553l1.73-1.728zm1.16-7.72l4.168.725 1.302 3.9-2.552 2.98-3.97-.885-1.412-3.724L8.196 9.96zM2 12c0-.31.019-.615.047-.92l.485 1.203-.454.907A9.934 9.934 0 012 11.999zM12 1C5.934 1 1 5.935 1 12c0 6.067 4.935 11 11 11 6.066 0 11-4.933 11-11 0-6.065-4.934-11-11-11z", fill: "currentColor" })))
2879
+ };
2880
+ const LotteryOddsbomBomb = class {
2881
+ constructor(hostRef) {
2882
+ registerInstance(this, hostRef);
2883
+ this.handleBombItemClick = createEvent(this, "handleBombItemClick", 7);
2884
+ this.mbSource = undefined;
2885
+ this.clientStyling = undefined;
2886
+ this.clientStylingUrl = undefined;
2887
+ this.translationUrl = '';
2888
+ this.language = 'en';
2889
+ this.endpoint = undefined;
2890
+ this.groupId = undefined;
2891
+ this.activeBomb = 'All';
2892
+ this.bombList = [];
2893
+ this.gameList = [];
2894
+ this.liveDrawsInfoByGroupId = {};
2895
+ this.isLoading = false;
2896
+ }
2897
+ handleClientStylingChange(newValue, oldValue) {
2898
+ if (newValue != oldValue) {
2899
+ setClientStyling(this.stylingContainer, this.clientStyling);
2900
+ }
2901
+ }
2902
+ handleClientStylingUrlChange(newValue, oldValue) {
2903
+ if (newValue != oldValue) {
2904
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2905
+ }
2906
+ }
2907
+ handleMbSourceChange(newValue, oldValue) {
2908
+ if (newValue != oldValue) {
2909
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
2910
+ }
2911
+ }
2912
+ componentDidLoad() {
2913
+ if (this.stylingContainer) {
2914
+ if (this.mbSource)
2915
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
2916
+ if (this.clientStyling)
2917
+ setClientStyling(this.stylingContainer, this.clientStyling);
2918
+ if (this.clientStylingUrl)
2919
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2920
+ }
2921
+ }
2922
+ disconnectedCallback() {
2923
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2924
+ }
2925
+ connectedCallback() {
2926
+ this.doFetchData();
2927
+ }
2928
+ async doFetchData(params = {}) {
2929
+ try {
2930
+ this.isLoading = true;
2931
+ this.liveDrawsInfoByGroupId = await fetchData({
2932
+ endpoint: this.endpoint,
2933
+ groupId: this.groupId,
2934
+ params
2935
+ });
2936
+ this.gameList = this.liveDrawsInfoByGroupId.liveDraws;
2937
+ this.bombList = [DEFAULT_ALL_BOMB, ...this.liveDrawsInfoByGroupId.sportTags];
2938
+ this.isLoading = false;
2939
+ this.updateTurnoverForAll();
2940
+ }
2941
+ finally {
2942
+ this.isLoading = false;
2943
+ }
2944
+ }
2945
+ async updateTurnoverForAll() {
2946
+ const turnovers = getTurnoverForAll({
2947
+ endpoint: this.endpoint,
2948
+ configs: this.gameList.map((item) => ({ gameId: item.gameId, drawId: item.drawId }))
2949
+ });
2950
+ for (let i = 0; i < this.gameList.length; i++) {
2951
+ this.gameList[i].turnover = (await turnovers)[i].turnover;
2952
+ }
2953
+ this.gameList = [...this.gameList];
2954
+ }
2955
+ handleBombChange(code) {
2956
+ this.activeBomb = code;
2957
+ if (code === DEFAULT_ALL_BOMB.code) {
2958
+ this.doFetchData();
2959
+ }
2960
+ else {
2961
+ this.doFetchData({ sportTag: code });
2962
+ }
2963
+ }
2964
+ renderLoading() {
2965
+ return (h("div", { class: "loading-wrap" }, h("section", { class: "dots-container" }, h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }))));
2966
+ }
2967
+ renderEmpty() {
2968
+ const infoImagePath = getAssetPath('../static/empty-info.svg');
2969
+ return (h("div", { class: "empty-draw-wrap" }, h("div", { class: "empty-draw" }, h("img", { src: infoImagePath, class: "empty-draw-logo" }), h("div", { class: "empty-draw-content" }, h("div", { class: "empty-draw-text" }, "\u24D8 Sorry. The game is not available now.")))));
2970
+ }
2971
+ renderFilter() {
2972
+ return (h("div", { class: "OddsbomEntranceController__section" }, h("span", { class: "OddsbomEntranceController__label" }, "Select Bomb:"), !!this.bombList.length ? (h("div", { class: "OddsbomEntranceController__segmented-control" }, this.bombList.map(({ name, code }) => (h("button", { class: {
2973
+ OddsbomEntranceController__segment: true,
2974
+ 'OddsbomEntranceController__segment--active': this.activeBomb === code
2975
+ }, onClick: this.handleBombChange.bind(this, code) }, name))))) : (h("div", { class: "skeleton-content" }, h("div", { class: "skeleton-item skeleton-animated" })))));
2976
+ }
2977
+ renderMain() {
2978
+ if (!this.gameList.length)
2979
+ return this.renderEmpty();
2980
+ return (h("div", { class: "bomb-grid" }, this.gameList.map(({ title, subTitle, icon, date, turnover, matchList, drawId, gameId }) => (h("div", { class: "bomb-card-wrapper" }, h("div", { class: "bomb-card", onClick: () => {
2981
+ this.handleBombItemClick.emit({ drawId, gameId });
2982
+ } }, h("div", { class: "card-header" }, BombIcons[icon] && h("div", { class: "card-icon football" }, BombIcons[icon]), h("div", { class: "card-title" }, h("h2", null, title), h("p", null, subTitle)), h("div", { class: "card-jackpot" })), h("div", { class: "card-info" }, h("span", { class: "card-tag" }, date), h("span", { class: "card-tag" }, translate('turnover', this.language) + turnover)), h("div", { class: "card-matches" }, h("ol", null, matchList.map((item) => (h("li", null, item)))))))))));
2983
+ }
2984
+ render() {
2985
+ return (h("div", { key: 'ae8252d8cb1374af9bb8189bcd9edac313c7bc6a', ref: (el) => (this.stylingContainer = el), class: "lottery-oddsbom-bomb-wrapper" }, this.renderFilter(), h("div", { key: '3f673f335248057370e7e57076cc387a86dc4099', class: "bomb-grid-container" }, this.isLoading ? this.renderLoading() : this.renderMain())));
2986
+ }
2987
+ static get assetsDirs() { return ["../static"]; }
2988
+ static get watchers() { return {
2989
+ "clientStyling": ["handleClientStylingChange"],
2990
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2991
+ "mbSource": ["handleMbSourceChange"]
2992
+ }; }
2993
+ };
2994
+ LotteryOddsbomBomb.style = LotteryOddsbomBombStyle0;
2995
+
2996
+ export { LotteryOddsbomBomb as lottery_oddsbom_bomb };