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