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