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