@everymatrix/casino-challenges-player-history 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/casino-challenges-player-history/app-globals-0f993ce5.js +1 -0
  2. package/dist/casino-challenges-player-history/casino-challenges-player-history-67980c33.js +1 -0
  3. package/dist/casino-challenges-player-history/casino-challenges-player-history.esm.js +1 -0
  4. package/dist/casino-challenges-player-history/casino-challenges-player-history_2.entry.js +1 -0
  5. package/dist/casino-challenges-player-history/index-29d1f02c.js +2 -0
  6. package/dist/casino-challenges-player-history/index.esm.js +1 -0
  7. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  8. package/dist/cjs/casino-challenges-player-history-0b3c162e.js +2438 -0
  9. package/dist/cjs/casino-challenges-player-history.cjs.js +25 -0
  10. package/dist/cjs/casino-challenges-player-history_2.cjs.entry.js +183 -0
  11. package/dist/cjs/index-f241bc8a.js +1245 -0
  12. package/dist/cjs/index.cjs.js +10 -0
  13. package/dist/cjs/loader.cjs.js +15 -0
  14. package/dist/collection/assets/arrow-down.svg +3 -0
  15. package/dist/collection/assets/arrow-up.svg +3 -0
  16. package/dist/collection/assets/gift.svg +9 -0
  17. package/dist/collection/collection-manifest.json +19 -0
  18. package/dist/collection/components/casino-challenges-player-history/casino-challenges-player-history.css +122 -0
  19. package/dist/collection/components/casino-challenges-player-history/casino-challenges-player-history.js +306 -0
  20. package/dist/collection/components/casino-challenges-player-history/index.js +1 -0
  21. package/dist/collection/index.js +1 -0
  22. package/dist/collection/utils/locale.utils.js +54 -0
  23. package/dist/collection/utils/types.js +7 -0
  24. package/dist/collection/utils/utils.js +3 -0
  25. package/dist/esm/app-globals-0f993ce5.js +3 -0
  26. package/dist/esm/casino-challenges-player-history-67980c33.js +2436 -0
  27. package/dist/esm/casino-challenges-player-history.js +20 -0
  28. package/dist/esm/casino-challenges-player-history_2.entry.js +178 -0
  29. package/dist/esm/index-29d1f02c.js +1217 -0
  30. package/dist/esm/index.js +2 -0
  31. package/dist/esm/loader.js +11 -0
  32. package/dist/index.cjs.js +1 -0
  33. package/dist/index.js +1 -0
  34. package/dist/stencil.config.dev.js +19 -0
  35. package/dist/stencil.config.js +19 -0
  36. package/dist/storybook/main.js +43 -0
  37. package/dist/storybook/preview.js +9 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-player-history/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-player-history/.stencil/packages/stencil/casino-challenges-player-history/stencil.config.d.ts +2 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-player-history/.stencil/packages/stencil/casino-challenges-player-history/stencil.config.dev.d.ts +2 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-player-history/.stencil/packages/stencil/casino-challenges-player-history/storybook/main.d.ts +3 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-player-history/.stencil/packages/stencil/casino-challenges-player-history/storybook/preview.d.ts +70 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-player-history/.stencil/tools/plugins/index.d.ts +4 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-player-history/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  45. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-player-history/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  46. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-player-history/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  47. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-player-history/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  48. package/dist/types/components/casino-challenges-player-history/casino-challenges-player-history.d.ts +60 -0
  49. package/dist/types/components/casino-challenges-player-history/index.d.ts +1 -0
  50. package/dist/types/components.d.ts +122 -0
  51. package/dist/types/index.d.ts +1 -0
  52. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  53. package/dist/types/utils/locale.utils.d.ts +3 -0
  54. package/dist/types/utils/types.d.ts +27 -0
  55. package/dist/types/utils/utils.d.ts +1 -0
  56. package/loader/cdn.js +1 -0
  57. package/loader/index.cjs.js +1 -0
  58. package/loader/index.d.ts +24 -0
  59. package/loader/index.es2017.js +1 -0
  60. package/loader/index.js +2 -0
  61. package/loader/package.json +11 -0
  62. package/package.json +27 -0
@@ -0,0 +1,2436 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-29d1f02c.js';
2
+
3
+ /**
4
+ * @name setClientStyling
5
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
6
+ * @param {HTMLElement} stylingContainer The reference element of the widget
7
+ * @param {string} clientStyling The style content
8
+ */
9
+ function setClientStyling(stylingContainer, clientStyling) {
10
+ if (stylingContainer) {
11
+ const sheet = document.createElement('style');
12
+ sheet.innerHTML = clientStyling;
13
+ stylingContainer.appendChild(sheet);
14
+ }
15
+ }
16
+
17
+ /**
18
+ * @name setClientStylingURL
19
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
20
+ * @param {HTMLElement} stylingContainer The reference element of the widget
21
+ * @param {string} clientStylingUrl The URL of the style content
22
+ */
23
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
24
+ const url = new URL(clientStylingUrl);
25
+
26
+ fetch(url.href)
27
+ .then((res) => res.text())
28
+ .then((data) => {
29
+ const cssFile = document.createElement('style');
30
+ cssFile.innerHTML = data;
31
+ if (stylingContainer) {
32
+ stylingContainer.appendChild(cssFile);
33
+ }
34
+ })
35
+ .catch((err) => {
36
+ console.error('There was an error while trying to load client styling from URL', err);
37
+ });
38
+ }
39
+
40
+ /**
41
+ * @name setStreamLibrary
42
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
43
+ * @param {HTMLElement} stylingContainer The highest element of the widget
44
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
45
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
46
+ */
47
+ function setStreamStyling(stylingContainer, domain, subscription) {
48
+ if (window.emMessageBus) {
49
+ const sheet = document.createElement('style');
50
+
51
+ window.emMessageBus.subscribe(domain, (data) => {
52
+ sheet.innerHTML = data;
53
+ if (stylingContainer) {
54
+ stylingContainer.appendChild(sheet);
55
+ }
56
+ });
57
+ }
58
+ }
59
+
60
+ var EHistoryItemLevelStatus;
61
+ (function (EHistoryItemLevelStatus) {
62
+ EHistoryItemLevelStatus[EHistoryItemLevelStatus["Completed"] = 0] = "Completed";
63
+ EHistoryItemLevelStatus[EHistoryItemLevelStatus["Expired"] = 1] = "Expired";
64
+ EHistoryItemLevelStatus[EHistoryItemLevelStatus["Forfeited"] = 2] = "Forfeited";
65
+ })(EHistoryItemLevelStatus || (EHistoryItemLevelStatus = {}));
66
+ const HistoryItemLevelStatusDictionary = ['Completed', 'Expired', 'Forfeited'];
67
+
68
+ const DEFAULT_LANGUAGE = 'en';
69
+ const TRANSLATIONS = {
70
+ en: {
71
+ level: 'Level',
72
+ status: 'Status',
73
+ time: 'Time'
74
+ },
75
+ ro: {
76
+ level: 'Nivel',
77
+ status: 'Stare',
78
+ time: 'Timp'
79
+ },
80
+ fr: {
81
+ level: 'Niveau',
82
+ status: 'Statut',
83
+ time: 'Temps'
84
+ },
85
+ ar: {
86
+ level: 'المستوى',
87
+ status: 'الحالة',
88
+ time: 'الوقت'
89
+ },
90
+ hr: {
91
+ level: 'Razina',
92
+ status: 'Status',
93
+ time: 'Vrijeme'
94
+ }
95
+ };
96
+ const translate = (key, customLang) => {
97
+ const lang = customLang;
98
+ return TRANSLATIONS[lang !== undefined && lang in TRANSLATIONS ? lang : DEFAULT_LANGUAGE][key];
99
+ };
100
+ const getTranslations = (data) => {
101
+ Object.keys(data).forEach((item) => {
102
+ for (let key in data[item]) {
103
+ TRANSLATIONS[item][key] = data[item][key];
104
+ }
105
+ });
106
+ };
107
+ const resolveTranslationUrl = async (translationUrl) => {
108
+ if (translationUrl) {
109
+ try {
110
+ const response = await fetch(translationUrl);
111
+ if (!response.ok) {
112
+ throw new Error(`HTTP error! status: ${response.status}`);
113
+ }
114
+ const translations = await response.json();
115
+ getTranslations(translations);
116
+ }
117
+ catch (error) {
118
+ console.error('Failed to fetch or parse translations from URL:', error);
119
+ }
120
+ }
121
+ };
122
+
123
+ const arrowUpSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOCIgdmlld0JveD0iMCAwIDEyIDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNS40MTEwNyAwLjkxMDgyNkM1LjczNjUxIDAuNTg1Mzg5IDYuMjY0MTQgMC41ODUzODkgNi41ODk1OCAwLjkxMDgyNkwxMS41ODk2IDUuOTEwODNDMTEuOTE1IDYuMjM2MjYgMTEuOTE1IDYuNzYzOSAxMS41ODk2IDcuMDg5MzRDMTEuMjY0MSA3LjQxNDc3IDEwLjczNjUgNy40MTQ3NyAxMC40MTExIDcuMDg5MzRMNi4wMDAzMyAyLjY3ODU5TDEuNTg5NTggNy4wODkzNEMxLjI2NDE0IDcuNDE0NzcgMC43MzY1MDcgNy40MTQ3NyAwLjQxMTA3IDcuMDg5MzRDMC4wODU2MzI5IDYuNzYzOSAwLjA4NTYzMjkgNi4yMzYyNiAwLjQxMTA3IDUuOTEwODNMNS40MTEwNyAwLjkxMDgyNloiIGZpbGw9IiNDOEQ2Q0UiLz4KPC9zdmc+Cg==';
124
+
125
+ const arrowDownSvg = 'data:image/sv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gMS4zMDg3OCA5LjIwNzk0IDEuMjQ5OTIgOS4wNjIxOCAxLjI0OTkyQzguNTg5ODYgMS4yNDk5MiA4LjIyNjAzIDEuNTg1ODEgNy45NDI2MSAyLjExMDQ5QzcuODg3MTggMi4yMTMxIDcuODM4NTkgMi4zMTY2MyA3Ljc5NjM3IDIuNDE2NTlIOS4wNjIxOFoiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8xNTIwXzI5ODEpIi8+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfMTUyMF8yOTgxIiB4MT0iNi45OTk2OCIgeTE9IjAuMDgzMjUyIiB4Mj0iNi45OTk2OCIgeTI9IjEyLjkxNjYiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0VBOTAxOCIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNFMEE4NEUiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K';
128
+
129
+ function _typeof(o) {
130
+ "@babel/helpers - typeof";
131
+
132
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
133
+ return typeof o;
134
+ } : function (o) {
135
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
136
+ }, _typeof(o);
137
+ }
138
+
139
+ function toInteger(dirtyNumber) {
140
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
141
+ return NaN;
142
+ }
143
+ var number = Number(dirtyNumber);
144
+ if (isNaN(number)) {
145
+ return number;
146
+ }
147
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
148
+ }
149
+
150
+ function requiredArgs(required, args) {
151
+ if (args.length < required) {
152
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
153
+ }
154
+ }
155
+
156
+ /**
157
+ * @name toDate
158
+ * @category Common Helpers
159
+ * @summary Convert the given argument to an instance of Date.
160
+ *
161
+ * @description
162
+ * Convert the given argument to an instance of Date.
163
+ *
164
+ * If the argument is an instance of Date, the function returns its clone.
165
+ *
166
+ * If the argument is a number, it is treated as a timestamp.
167
+ *
168
+ * If the argument is none of the above, the function returns Invalid Date.
169
+ *
170
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
171
+ *
172
+ * @param {Date|Number} argument - the value to convert
173
+ * @returns {Date} the parsed date in the local time zone
174
+ * @throws {TypeError} 1 argument required
175
+ *
176
+ * @example
177
+ * // Clone the date:
178
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
179
+ * //=> Tue Feb 11 2014 11:30:30
180
+ *
181
+ * @example
182
+ * // Convert the timestamp to date:
183
+ * const result = toDate(1392098430000)
184
+ * //=> Tue Feb 11 2014 11:30:30
185
+ */
186
+ function toDate(argument) {
187
+ requiredArgs(1, arguments);
188
+ var argStr = Object.prototype.toString.call(argument);
189
+
190
+ // Clone the date
191
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
192
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
193
+ return new Date(argument.getTime());
194
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
195
+ return new Date(argument);
196
+ } else {
197
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
198
+ // eslint-disable-next-line no-console
199
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
200
+ // eslint-disable-next-line no-console
201
+ console.warn(new Error().stack);
202
+ }
203
+ return new Date(NaN);
204
+ }
205
+ }
206
+
207
+ /**
208
+ * @name addMilliseconds
209
+ * @category Millisecond Helpers
210
+ * @summary Add the specified number of milliseconds to the given date.
211
+ *
212
+ * @description
213
+ * Add the specified number of milliseconds to the given date.
214
+ *
215
+ * @param {Date|Number} date - the date to be changed
216
+ * @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`.
217
+ * @returns {Date} the new date with the milliseconds added
218
+ * @throws {TypeError} 2 arguments required
219
+ *
220
+ * @example
221
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
222
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
223
+ * //=> Thu Jul 10 2014 12:45:30.750
224
+ */
225
+ function addMilliseconds(dirtyDate, dirtyAmount) {
226
+ requiredArgs(2, arguments);
227
+ var timestamp = toDate(dirtyDate).getTime();
228
+ var amount = toInteger(dirtyAmount);
229
+ return new Date(timestamp + amount);
230
+ }
231
+
232
+ var defaultOptions = {};
233
+ function getDefaultOptions() {
234
+ return defaultOptions;
235
+ }
236
+
237
+ /**
238
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
239
+ * They usually appear for dates that denote time before the timezones were introduced
240
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
241
+ * and GMT+01:00:00 after that date)
242
+ *
243
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
244
+ * which would lead to incorrect calculations.
245
+ *
246
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
247
+ */
248
+ function getTimezoneOffsetInMilliseconds(date) {
249
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
250
+ utcDate.setUTCFullYear(date.getFullYear());
251
+ return date.getTime() - utcDate.getTime();
252
+ }
253
+
254
+ /**
255
+ * @name isDate
256
+ * @category Common Helpers
257
+ * @summary Is the given value a date?
258
+ *
259
+ * @description
260
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
261
+ *
262
+ * @param {*} value - the value to check
263
+ * @returns {boolean} true if the given value is a date
264
+ * @throws {TypeError} 1 arguments required
265
+ *
266
+ * @example
267
+ * // For a valid date:
268
+ * const result = isDate(new Date())
269
+ * //=> true
270
+ *
271
+ * @example
272
+ * // For an invalid date:
273
+ * const result = isDate(new Date(NaN))
274
+ * //=> true
275
+ *
276
+ * @example
277
+ * // For some value:
278
+ * const result = isDate('2014-02-31')
279
+ * //=> false
280
+ *
281
+ * @example
282
+ * // For an object:
283
+ * const result = isDate({})
284
+ * //=> false
285
+ */
286
+ function isDate(value) {
287
+ requiredArgs(1, arguments);
288
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
289
+ }
290
+
291
+ /**
292
+ * @name isValid
293
+ * @category Common Helpers
294
+ * @summary Is the given date valid?
295
+ *
296
+ * @description
297
+ * Returns false if argument is Invalid Date and true otherwise.
298
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
299
+ * Invalid Date is a Date, whose time value is NaN.
300
+ *
301
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
302
+ *
303
+ * @param {*} date - the date to check
304
+ * @returns {Boolean} the date is valid
305
+ * @throws {TypeError} 1 argument required
306
+ *
307
+ * @example
308
+ * // For the valid date:
309
+ * const result = isValid(new Date(2014, 1, 31))
310
+ * //=> true
311
+ *
312
+ * @example
313
+ * // For the value, convertable into a date:
314
+ * const result = isValid(1393804800000)
315
+ * //=> true
316
+ *
317
+ * @example
318
+ * // For the invalid date:
319
+ * const result = isValid(new Date(''))
320
+ * //=> false
321
+ */
322
+ function isValid(dirtyDate) {
323
+ requiredArgs(1, arguments);
324
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
325
+ return false;
326
+ }
327
+ var date = toDate(dirtyDate);
328
+ return !isNaN(Number(date));
329
+ }
330
+
331
+ /**
332
+ * @name subMilliseconds
333
+ * @category Millisecond Helpers
334
+ * @summary Subtract the specified number of milliseconds from the given date.
335
+ *
336
+ * @description
337
+ * Subtract the specified number of milliseconds from the given date.
338
+ *
339
+ * @param {Date|Number} date - the date to be changed
340
+ * @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`.
341
+ * @returns {Date} the new date with the milliseconds subtracted
342
+ * @throws {TypeError} 2 arguments required
343
+ *
344
+ * @example
345
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
346
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
347
+ * //=> Thu Jul 10 2014 12:45:29.250
348
+ */
349
+ function subMilliseconds(dirtyDate, dirtyAmount) {
350
+ requiredArgs(2, arguments);
351
+ var amount = toInteger(dirtyAmount);
352
+ return addMilliseconds(dirtyDate, -amount);
353
+ }
354
+
355
+ var MILLISECONDS_IN_DAY = 86400000;
356
+ function getUTCDayOfYear(dirtyDate) {
357
+ requiredArgs(1, arguments);
358
+ var date = toDate(dirtyDate);
359
+ var timestamp = date.getTime();
360
+ date.setUTCMonth(0, 1);
361
+ date.setUTCHours(0, 0, 0, 0);
362
+ var startOfYearTimestamp = date.getTime();
363
+ var difference = timestamp - startOfYearTimestamp;
364
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
365
+ }
366
+
367
+ function startOfUTCISOWeek(dirtyDate) {
368
+ requiredArgs(1, arguments);
369
+ var weekStartsOn = 1;
370
+ var date = toDate(dirtyDate);
371
+ var day = date.getUTCDay();
372
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
373
+ date.setUTCDate(date.getUTCDate() - diff);
374
+ date.setUTCHours(0, 0, 0, 0);
375
+ return date;
376
+ }
377
+
378
+ function getUTCISOWeekYear(dirtyDate) {
379
+ requiredArgs(1, arguments);
380
+ var date = toDate(dirtyDate);
381
+ var year = date.getUTCFullYear();
382
+ var fourthOfJanuaryOfNextYear = new Date(0);
383
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
384
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
385
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
386
+ var fourthOfJanuaryOfThisYear = new Date(0);
387
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
388
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
389
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
390
+ if (date.getTime() >= startOfNextYear.getTime()) {
391
+ return year + 1;
392
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
393
+ return year;
394
+ } else {
395
+ return year - 1;
396
+ }
397
+ }
398
+
399
+ function startOfUTCISOWeekYear(dirtyDate) {
400
+ requiredArgs(1, arguments);
401
+ var year = getUTCISOWeekYear(dirtyDate);
402
+ var fourthOfJanuary = new Date(0);
403
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
404
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
405
+ var date = startOfUTCISOWeek(fourthOfJanuary);
406
+ return date;
407
+ }
408
+
409
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
410
+ function getUTCISOWeek(dirtyDate) {
411
+ requiredArgs(1, arguments);
412
+ var date = toDate(dirtyDate);
413
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
414
+
415
+ // Round the number of days to the nearest integer
416
+ // because the number of milliseconds in a week is not constant
417
+ // (e.g. it's different in the week of the daylight saving time clock shift)
418
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
419
+ }
420
+
421
+ function startOfUTCWeek(dirtyDate, options) {
422
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
423
+ requiredArgs(1, arguments);
424
+ var defaultOptions = getDefaultOptions();
425
+ 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);
426
+
427
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
428
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
429
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
430
+ }
431
+ var date = toDate(dirtyDate);
432
+ var day = date.getUTCDay();
433
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
434
+ date.setUTCDate(date.getUTCDate() - diff);
435
+ date.setUTCHours(0, 0, 0, 0);
436
+ return date;
437
+ }
438
+
439
+ function getUTCWeekYear(dirtyDate, options) {
440
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
441
+ requiredArgs(1, arguments);
442
+ var date = toDate(dirtyDate);
443
+ var year = date.getUTCFullYear();
444
+ var defaultOptions = getDefaultOptions();
445
+ 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);
446
+
447
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
448
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
449
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
450
+ }
451
+ var firstWeekOfNextYear = new Date(0);
452
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
453
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
454
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
455
+ var firstWeekOfThisYear = new Date(0);
456
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
457
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
458
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
459
+ if (date.getTime() >= startOfNextYear.getTime()) {
460
+ return year + 1;
461
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
462
+ return year;
463
+ } else {
464
+ return year - 1;
465
+ }
466
+ }
467
+
468
+ function startOfUTCWeekYear(dirtyDate, options) {
469
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
470
+ requiredArgs(1, arguments);
471
+ var defaultOptions = getDefaultOptions();
472
+ 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);
473
+ var year = getUTCWeekYear(dirtyDate, options);
474
+ var firstWeek = new Date(0);
475
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
476
+ firstWeek.setUTCHours(0, 0, 0, 0);
477
+ var date = startOfUTCWeek(firstWeek, options);
478
+ return date;
479
+ }
480
+
481
+ var MILLISECONDS_IN_WEEK = 604800000;
482
+ function getUTCWeek(dirtyDate, options) {
483
+ requiredArgs(1, arguments);
484
+ var date = toDate(dirtyDate);
485
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
486
+
487
+ // Round the number of days to the nearest integer
488
+ // because the number of milliseconds in a week is not constant
489
+ // (e.g. it's different in the week of the daylight saving time clock shift)
490
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
491
+ }
492
+
493
+ function addLeadingZeros(number, targetLength) {
494
+ var sign = number < 0 ? '-' : '';
495
+ var output = Math.abs(number).toString();
496
+ while (output.length < targetLength) {
497
+ output = '0' + output;
498
+ }
499
+ return sign + output;
500
+ }
501
+
502
+ /*
503
+ * | | Unit | | Unit |
504
+ * |-----|--------------------------------|-----|--------------------------------|
505
+ * | a | AM, PM | A* | |
506
+ * | d | Day of month | D | |
507
+ * | h | Hour [1-12] | H | Hour [0-23] |
508
+ * | m | Minute | M | Month |
509
+ * | s | Second | S | Fraction of second |
510
+ * | y | Year (abs) | Y | |
511
+ *
512
+ * Letters marked by * are not implemented but reserved by Unicode standard.
513
+ */
514
+ var formatters$2 = {
515
+ // Year
516
+ y: function y(date, token) {
517
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
518
+ // | Year | y | yy | yyy | yyyy | yyyyy |
519
+ // |----------|-------|----|-------|-------|-------|
520
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
521
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
522
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
523
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
524
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
525
+
526
+ var signedYear = date.getUTCFullYear();
527
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
528
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
529
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
530
+ },
531
+ // Month
532
+ M: function M(date, token) {
533
+ var month = date.getUTCMonth();
534
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
535
+ },
536
+ // Day of the month
537
+ d: function d(date, token) {
538
+ return addLeadingZeros(date.getUTCDate(), token.length);
539
+ },
540
+ // AM or PM
541
+ a: function a(date, token) {
542
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
543
+ switch (token) {
544
+ case 'a':
545
+ case 'aa':
546
+ return dayPeriodEnumValue.toUpperCase();
547
+ case 'aaa':
548
+ return dayPeriodEnumValue;
549
+ case 'aaaaa':
550
+ return dayPeriodEnumValue[0];
551
+ case 'aaaa':
552
+ default:
553
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
554
+ }
555
+ },
556
+ // Hour [1-12]
557
+ h: function h(date, token) {
558
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
559
+ },
560
+ // Hour [0-23]
561
+ H: function H(date, token) {
562
+ return addLeadingZeros(date.getUTCHours(), token.length);
563
+ },
564
+ // Minute
565
+ m: function m(date, token) {
566
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
567
+ },
568
+ // Second
569
+ s: function s(date, token) {
570
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
571
+ },
572
+ // Fraction of second
573
+ S: function S(date, token) {
574
+ var numberOfDigits = token.length;
575
+ var milliseconds = date.getUTCMilliseconds();
576
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
577
+ return addLeadingZeros(fractionalSeconds, token.length);
578
+ }
579
+ };
580
+ const formatters$3 = formatters$2;
581
+
582
+ var dayPeriodEnum = {
583
+ am: 'am',
584
+ pm: 'pm',
585
+ midnight: 'midnight',
586
+ noon: 'noon',
587
+ morning: 'morning',
588
+ afternoon: 'afternoon',
589
+ evening: 'evening',
590
+ night: 'night'
591
+ };
592
+ /*
593
+ * | | Unit | | Unit |
594
+ * |-----|--------------------------------|-----|--------------------------------|
595
+ * | a | AM, PM | A* | Milliseconds in day |
596
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
597
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
598
+ * | d | Day of month | D | Day of year |
599
+ * | e | Local day of week | E | Day of week |
600
+ * | f | | F* | Day of week in month |
601
+ * | g* | Modified Julian day | G | Era |
602
+ * | h | Hour [1-12] | H | Hour [0-23] |
603
+ * | i! | ISO day of week | I! | ISO week of year |
604
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
605
+ * | k | Hour [1-24] | K | Hour [0-11] |
606
+ * | l* | (deprecated) | L | Stand-alone month |
607
+ * | m | Minute | M | Month |
608
+ * | n | | N | |
609
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
610
+ * | p! | Long localized time | P! | Long localized date |
611
+ * | q | Stand-alone quarter | Q | Quarter |
612
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
613
+ * | s | Second | S | Fraction of second |
614
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
615
+ * | u | Extended year | U* | Cyclic year |
616
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
617
+ * | w | Local week of year | W* | Week of month |
618
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
619
+ * | y | Year (abs) | Y | Local week-numbering year |
620
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
621
+ *
622
+ * Letters marked by * are not implemented but reserved by Unicode standard.
623
+ *
624
+ * Letters marked by ! are non-standard, but implemented by date-fns:
625
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
626
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
627
+ * i.e. 7 for Sunday, 1 for Monday, etc.
628
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
629
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
630
+ * `R` is supposed to be used in conjunction with `I` and `i`
631
+ * for universal ISO week-numbering date, whereas
632
+ * `Y` is supposed to be used in conjunction with `w` and `e`
633
+ * for week-numbering date specific to the locale.
634
+ * - `P` is long localized date format
635
+ * - `p` is long localized time format
636
+ */
637
+
638
+ var formatters = {
639
+ // Era
640
+ G: function G(date, token, localize) {
641
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
642
+ switch (token) {
643
+ // AD, BC
644
+ case 'G':
645
+ case 'GG':
646
+ case 'GGG':
647
+ return localize.era(era, {
648
+ width: 'abbreviated'
649
+ });
650
+ // A, B
651
+ case 'GGGGG':
652
+ return localize.era(era, {
653
+ width: 'narrow'
654
+ });
655
+ // Anno Domini, Before Christ
656
+ case 'GGGG':
657
+ default:
658
+ return localize.era(era, {
659
+ width: 'wide'
660
+ });
661
+ }
662
+ },
663
+ // Year
664
+ y: function y(date, token, localize) {
665
+ // Ordinal number
666
+ if (token === 'yo') {
667
+ var signedYear = date.getUTCFullYear();
668
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
669
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
670
+ return localize.ordinalNumber(year, {
671
+ unit: 'year'
672
+ });
673
+ }
674
+ return formatters$3.y(date, token);
675
+ },
676
+ // Local week-numbering year
677
+ Y: function Y(date, token, localize, options) {
678
+ var signedWeekYear = getUTCWeekYear(date, options);
679
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
680
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
681
+
682
+ // Two digit year
683
+ if (token === 'YY') {
684
+ var twoDigitYear = weekYear % 100;
685
+ return addLeadingZeros(twoDigitYear, 2);
686
+ }
687
+
688
+ // Ordinal number
689
+ if (token === 'Yo') {
690
+ return localize.ordinalNumber(weekYear, {
691
+ unit: 'year'
692
+ });
693
+ }
694
+
695
+ // Padding
696
+ return addLeadingZeros(weekYear, token.length);
697
+ },
698
+ // ISO week-numbering year
699
+ R: function R(date, token) {
700
+ var isoWeekYear = getUTCISOWeekYear(date);
701
+
702
+ // Padding
703
+ return addLeadingZeros(isoWeekYear, token.length);
704
+ },
705
+ // Extended year. This is a single number designating the year of this calendar system.
706
+ // The main difference between `y` and `u` localizers are B.C. years:
707
+ // | Year | `y` | `u` |
708
+ // |------|-----|-----|
709
+ // | AC 1 | 1 | 1 |
710
+ // | BC 1 | 1 | 0 |
711
+ // | BC 2 | 2 | -1 |
712
+ // Also `yy` always returns the last two digits of a year,
713
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
714
+ u: function u(date, token) {
715
+ var year = date.getUTCFullYear();
716
+ return addLeadingZeros(year, token.length);
717
+ },
718
+ // Quarter
719
+ Q: function Q(date, token, localize) {
720
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
721
+ switch (token) {
722
+ // 1, 2, 3, 4
723
+ case 'Q':
724
+ return String(quarter);
725
+ // 01, 02, 03, 04
726
+ case 'QQ':
727
+ return addLeadingZeros(quarter, 2);
728
+ // 1st, 2nd, 3rd, 4th
729
+ case 'Qo':
730
+ return localize.ordinalNumber(quarter, {
731
+ unit: 'quarter'
732
+ });
733
+ // Q1, Q2, Q3, Q4
734
+ case 'QQQ':
735
+ return localize.quarter(quarter, {
736
+ width: 'abbreviated',
737
+ context: 'formatting'
738
+ });
739
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
740
+ case 'QQQQQ':
741
+ return localize.quarter(quarter, {
742
+ width: 'narrow',
743
+ context: 'formatting'
744
+ });
745
+ // 1st quarter, 2nd quarter, ...
746
+ case 'QQQQ':
747
+ default:
748
+ return localize.quarter(quarter, {
749
+ width: 'wide',
750
+ context: 'formatting'
751
+ });
752
+ }
753
+ },
754
+ // Stand-alone quarter
755
+ q: function q(date, token, localize) {
756
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
757
+ switch (token) {
758
+ // 1, 2, 3, 4
759
+ case 'q':
760
+ return String(quarter);
761
+ // 01, 02, 03, 04
762
+ case 'qq':
763
+ return addLeadingZeros(quarter, 2);
764
+ // 1st, 2nd, 3rd, 4th
765
+ case 'qo':
766
+ return localize.ordinalNumber(quarter, {
767
+ unit: 'quarter'
768
+ });
769
+ // Q1, Q2, Q3, Q4
770
+ case 'qqq':
771
+ return localize.quarter(quarter, {
772
+ width: 'abbreviated',
773
+ context: 'standalone'
774
+ });
775
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
776
+ case 'qqqqq':
777
+ return localize.quarter(quarter, {
778
+ width: 'narrow',
779
+ context: 'standalone'
780
+ });
781
+ // 1st quarter, 2nd quarter, ...
782
+ case 'qqqq':
783
+ default:
784
+ return localize.quarter(quarter, {
785
+ width: 'wide',
786
+ context: 'standalone'
787
+ });
788
+ }
789
+ },
790
+ // Month
791
+ M: function M(date, token, localize) {
792
+ var month = date.getUTCMonth();
793
+ switch (token) {
794
+ case 'M':
795
+ case 'MM':
796
+ return formatters$3.M(date, token);
797
+ // 1st, 2nd, ..., 12th
798
+ case 'Mo':
799
+ return localize.ordinalNumber(month + 1, {
800
+ unit: 'month'
801
+ });
802
+ // Jan, Feb, ..., Dec
803
+ case 'MMM':
804
+ return localize.month(month, {
805
+ width: 'abbreviated',
806
+ context: 'formatting'
807
+ });
808
+ // J, F, ..., D
809
+ case 'MMMMM':
810
+ return localize.month(month, {
811
+ width: 'narrow',
812
+ context: 'formatting'
813
+ });
814
+ // January, February, ..., December
815
+ case 'MMMM':
816
+ default:
817
+ return localize.month(month, {
818
+ width: 'wide',
819
+ context: 'formatting'
820
+ });
821
+ }
822
+ },
823
+ // Stand-alone month
824
+ L: function L(date, token, localize) {
825
+ var month = date.getUTCMonth();
826
+ switch (token) {
827
+ // 1, 2, ..., 12
828
+ case 'L':
829
+ return String(month + 1);
830
+ // 01, 02, ..., 12
831
+ case 'LL':
832
+ return addLeadingZeros(month + 1, 2);
833
+ // 1st, 2nd, ..., 12th
834
+ case 'Lo':
835
+ return localize.ordinalNumber(month + 1, {
836
+ unit: 'month'
837
+ });
838
+ // Jan, Feb, ..., Dec
839
+ case 'LLL':
840
+ return localize.month(month, {
841
+ width: 'abbreviated',
842
+ context: 'standalone'
843
+ });
844
+ // J, F, ..., D
845
+ case 'LLLLL':
846
+ return localize.month(month, {
847
+ width: 'narrow',
848
+ context: 'standalone'
849
+ });
850
+ // January, February, ..., December
851
+ case 'LLLL':
852
+ default:
853
+ return localize.month(month, {
854
+ width: 'wide',
855
+ context: 'standalone'
856
+ });
857
+ }
858
+ },
859
+ // Local week of year
860
+ w: function w(date, token, localize, options) {
861
+ var week = getUTCWeek(date, options);
862
+ if (token === 'wo') {
863
+ return localize.ordinalNumber(week, {
864
+ unit: 'week'
865
+ });
866
+ }
867
+ return addLeadingZeros(week, token.length);
868
+ },
869
+ // ISO week of year
870
+ I: function I(date, token, localize) {
871
+ var isoWeek = getUTCISOWeek(date);
872
+ if (token === 'Io') {
873
+ return localize.ordinalNumber(isoWeek, {
874
+ unit: 'week'
875
+ });
876
+ }
877
+ return addLeadingZeros(isoWeek, token.length);
878
+ },
879
+ // Day of the month
880
+ d: function d(date, token, localize) {
881
+ if (token === 'do') {
882
+ return localize.ordinalNumber(date.getUTCDate(), {
883
+ unit: 'date'
884
+ });
885
+ }
886
+ return formatters$3.d(date, token);
887
+ },
888
+ // Day of year
889
+ D: function D(date, token, localize) {
890
+ var dayOfYear = getUTCDayOfYear(date);
891
+ if (token === 'Do') {
892
+ return localize.ordinalNumber(dayOfYear, {
893
+ unit: 'dayOfYear'
894
+ });
895
+ }
896
+ return addLeadingZeros(dayOfYear, token.length);
897
+ },
898
+ // Day of week
899
+ E: function E(date, token, localize) {
900
+ var dayOfWeek = date.getUTCDay();
901
+ switch (token) {
902
+ // Tue
903
+ case 'E':
904
+ case 'EE':
905
+ case 'EEE':
906
+ return localize.day(dayOfWeek, {
907
+ width: 'abbreviated',
908
+ context: 'formatting'
909
+ });
910
+ // T
911
+ case 'EEEEE':
912
+ return localize.day(dayOfWeek, {
913
+ width: 'narrow',
914
+ context: 'formatting'
915
+ });
916
+ // Tu
917
+ case 'EEEEEE':
918
+ return localize.day(dayOfWeek, {
919
+ width: 'short',
920
+ context: 'formatting'
921
+ });
922
+ // Tuesday
923
+ case 'EEEE':
924
+ default:
925
+ return localize.day(dayOfWeek, {
926
+ width: 'wide',
927
+ context: 'formatting'
928
+ });
929
+ }
930
+ },
931
+ // Local day of week
932
+ e: function e(date, token, localize, options) {
933
+ var dayOfWeek = date.getUTCDay();
934
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
935
+ switch (token) {
936
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
937
+ case 'e':
938
+ return String(localDayOfWeek);
939
+ // Padded numerical value
940
+ case 'ee':
941
+ return addLeadingZeros(localDayOfWeek, 2);
942
+ // 1st, 2nd, ..., 7th
943
+ case 'eo':
944
+ return localize.ordinalNumber(localDayOfWeek, {
945
+ unit: 'day'
946
+ });
947
+ case 'eee':
948
+ return localize.day(dayOfWeek, {
949
+ width: 'abbreviated',
950
+ context: 'formatting'
951
+ });
952
+ // T
953
+ case 'eeeee':
954
+ return localize.day(dayOfWeek, {
955
+ width: 'narrow',
956
+ context: 'formatting'
957
+ });
958
+ // Tu
959
+ case 'eeeeee':
960
+ return localize.day(dayOfWeek, {
961
+ width: 'short',
962
+ context: 'formatting'
963
+ });
964
+ // Tuesday
965
+ case 'eeee':
966
+ default:
967
+ return localize.day(dayOfWeek, {
968
+ width: 'wide',
969
+ context: 'formatting'
970
+ });
971
+ }
972
+ },
973
+ // Stand-alone local day of week
974
+ c: function c(date, token, localize, options) {
975
+ var dayOfWeek = date.getUTCDay();
976
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
977
+ switch (token) {
978
+ // Numerical value (same as in `e`)
979
+ case 'c':
980
+ return String(localDayOfWeek);
981
+ // Padded numerical value
982
+ case 'cc':
983
+ return addLeadingZeros(localDayOfWeek, token.length);
984
+ // 1st, 2nd, ..., 7th
985
+ case 'co':
986
+ return localize.ordinalNumber(localDayOfWeek, {
987
+ unit: 'day'
988
+ });
989
+ case 'ccc':
990
+ return localize.day(dayOfWeek, {
991
+ width: 'abbreviated',
992
+ context: 'standalone'
993
+ });
994
+ // T
995
+ case 'ccccc':
996
+ return localize.day(dayOfWeek, {
997
+ width: 'narrow',
998
+ context: 'standalone'
999
+ });
1000
+ // Tu
1001
+ case 'cccccc':
1002
+ return localize.day(dayOfWeek, {
1003
+ width: 'short',
1004
+ context: 'standalone'
1005
+ });
1006
+ // Tuesday
1007
+ case 'cccc':
1008
+ default:
1009
+ return localize.day(dayOfWeek, {
1010
+ width: 'wide',
1011
+ context: 'standalone'
1012
+ });
1013
+ }
1014
+ },
1015
+ // ISO day of week
1016
+ i: function i(date, token, localize) {
1017
+ var dayOfWeek = date.getUTCDay();
1018
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1019
+ switch (token) {
1020
+ // 2
1021
+ case 'i':
1022
+ return String(isoDayOfWeek);
1023
+ // 02
1024
+ case 'ii':
1025
+ return addLeadingZeros(isoDayOfWeek, token.length);
1026
+ // 2nd
1027
+ case 'io':
1028
+ return localize.ordinalNumber(isoDayOfWeek, {
1029
+ unit: 'day'
1030
+ });
1031
+ // Tue
1032
+ case 'iii':
1033
+ return localize.day(dayOfWeek, {
1034
+ width: 'abbreviated',
1035
+ context: 'formatting'
1036
+ });
1037
+ // T
1038
+ case 'iiiii':
1039
+ return localize.day(dayOfWeek, {
1040
+ width: 'narrow',
1041
+ context: 'formatting'
1042
+ });
1043
+ // Tu
1044
+ case 'iiiiii':
1045
+ return localize.day(dayOfWeek, {
1046
+ width: 'short',
1047
+ context: 'formatting'
1048
+ });
1049
+ // Tuesday
1050
+ case 'iiii':
1051
+ default:
1052
+ return localize.day(dayOfWeek, {
1053
+ width: 'wide',
1054
+ context: 'formatting'
1055
+ });
1056
+ }
1057
+ },
1058
+ // AM or PM
1059
+ a: function a(date, token, localize) {
1060
+ var hours = date.getUTCHours();
1061
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1062
+ switch (token) {
1063
+ case 'a':
1064
+ case 'aa':
1065
+ return localize.dayPeriod(dayPeriodEnumValue, {
1066
+ width: 'abbreviated',
1067
+ context: 'formatting'
1068
+ });
1069
+ case 'aaa':
1070
+ return localize.dayPeriod(dayPeriodEnumValue, {
1071
+ width: 'abbreviated',
1072
+ context: 'formatting'
1073
+ }).toLowerCase();
1074
+ case 'aaaaa':
1075
+ return localize.dayPeriod(dayPeriodEnumValue, {
1076
+ width: 'narrow',
1077
+ context: 'formatting'
1078
+ });
1079
+ case 'aaaa':
1080
+ default:
1081
+ return localize.dayPeriod(dayPeriodEnumValue, {
1082
+ width: 'wide',
1083
+ context: 'formatting'
1084
+ });
1085
+ }
1086
+ },
1087
+ // AM, PM, midnight, noon
1088
+ b: function b(date, token, localize) {
1089
+ var hours = date.getUTCHours();
1090
+ var dayPeriodEnumValue;
1091
+ if (hours === 12) {
1092
+ dayPeriodEnumValue = dayPeriodEnum.noon;
1093
+ } else if (hours === 0) {
1094
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
1095
+ } else {
1096
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1097
+ }
1098
+ switch (token) {
1099
+ case 'b':
1100
+ case 'bb':
1101
+ return localize.dayPeriod(dayPeriodEnumValue, {
1102
+ width: 'abbreviated',
1103
+ context: 'formatting'
1104
+ });
1105
+ case 'bbb':
1106
+ return localize.dayPeriod(dayPeriodEnumValue, {
1107
+ width: 'abbreviated',
1108
+ context: 'formatting'
1109
+ }).toLowerCase();
1110
+ case 'bbbbb':
1111
+ return localize.dayPeriod(dayPeriodEnumValue, {
1112
+ width: 'narrow',
1113
+ context: 'formatting'
1114
+ });
1115
+ case 'bbbb':
1116
+ default:
1117
+ return localize.dayPeriod(dayPeriodEnumValue, {
1118
+ width: 'wide',
1119
+ context: 'formatting'
1120
+ });
1121
+ }
1122
+ },
1123
+ // in the morning, in the afternoon, in the evening, at night
1124
+ B: function B(date, token, localize) {
1125
+ var hours = date.getUTCHours();
1126
+ var dayPeriodEnumValue;
1127
+ if (hours >= 17) {
1128
+ dayPeriodEnumValue = dayPeriodEnum.evening;
1129
+ } else if (hours >= 12) {
1130
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
1131
+ } else if (hours >= 4) {
1132
+ dayPeriodEnumValue = dayPeriodEnum.morning;
1133
+ } else {
1134
+ dayPeriodEnumValue = dayPeriodEnum.night;
1135
+ }
1136
+ switch (token) {
1137
+ case 'B':
1138
+ case 'BB':
1139
+ case 'BBB':
1140
+ return localize.dayPeriod(dayPeriodEnumValue, {
1141
+ width: 'abbreviated',
1142
+ context: 'formatting'
1143
+ });
1144
+ case 'BBBBB':
1145
+ return localize.dayPeriod(dayPeriodEnumValue, {
1146
+ width: 'narrow',
1147
+ context: 'formatting'
1148
+ });
1149
+ case 'BBBB':
1150
+ default:
1151
+ return localize.dayPeriod(dayPeriodEnumValue, {
1152
+ width: 'wide',
1153
+ context: 'formatting'
1154
+ });
1155
+ }
1156
+ },
1157
+ // Hour [1-12]
1158
+ h: function h(date, token, localize) {
1159
+ if (token === 'ho') {
1160
+ var hours = date.getUTCHours() % 12;
1161
+ if (hours === 0) hours = 12;
1162
+ return localize.ordinalNumber(hours, {
1163
+ unit: 'hour'
1164
+ });
1165
+ }
1166
+ return formatters$3.h(date, token);
1167
+ },
1168
+ // Hour [0-23]
1169
+ H: function H(date, token, localize) {
1170
+ if (token === 'Ho') {
1171
+ return localize.ordinalNumber(date.getUTCHours(), {
1172
+ unit: 'hour'
1173
+ });
1174
+ }
1175
+ return formatters$3.H(date, token);
1176
+ },
1177
+ // Hour [0-11]
1178
+ K: function K(date, token, localize) {
1179
+ var hours = date.getUTCHours() % 12;
1180
+ if (token === 'Ko') {
1181
+ return localize.ordinalNumber(hours, {
1182
+ unit: 'hour'
1183
+ });
1184
+ }
1185
+ return addLeadingZeros(hours, token.length);
1186
+ },
1187
+ // Hour [1-24]
1188
+ k: function k(date, token, localize) {
1189
+ var hours = date.getUTCHours();
1190
+ if (hours === 0) hours = 24;
1191
+ if (token === 'ko') {
1192
+ return localize.ordinalNumber(hours, {
1193
+ unit: 'hour'
1194
+ });
1195
+ }
1196
+ return addLeadingZeros(hours, token.length);
1197
+ },
1198
+ // Minute
1199
+ m: function m(date, token, localize) {
1200
+ if (token === 'mo') {
1201
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1202
+ unit: 'minute'
1203
+ });
1204
+ }
1205
+ return formatters$3.m(date, token);
1206
+ },
1207
+ // Second
1208
+ s: function s(date, token, localize) {
1209
+ if (token === 'so') {
1210
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1211
+ unit: 'second'
1212
+ });
1213
+ }
1214
+ return formatters$3.s(date, token);
1215
+ },
1216
+ // Fraction of second
1217
+ S: function S(date, token) {
1218
+ return formatters$3.S(date, token);
1219
+ },
1220
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1221
+ X: function X(date, token, _localize, options) {
1222
+ var originalDate = options._originalDate || date;
1223
+ var timezoneOffset = originalDate.getTimezoneOffset();
1224
+ if (timezoneOffset === 0) {
1225
+ return 'Z';
1226
+ }
1227
+ switch (token) {
1228
+ // Hours and optional minutes
1229
+ case 'X':
1230
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1231
+
1232
+ // Hours, minutes and optional seconds without `:` delimiter
1233
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1234
+ // so this token always has the same output as `XX`
1235
+ case 'XXXX':
1236
+ case 'XX':
1237
+ // Hours and minutes without `:` delimiter
1238
+ return formatTimezone(timezoneOffset);
1239
+
1240
+ // Hours, minutes and optional seconds with `:` delimiter
1241
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1242
+ // so this token always has the same output as `XXX`
1243
+ case 'XXXXX':
1244
+ case 'XXX': // Hours and minutes with `:` delimiter
1245
+ default:
1246
+ return formatTimezone(timezoneOffset, ':');
1247
+ }
1248
+ },
1249
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1250
+ x: function x(date, token, _localize, options) {
1251
+ var originalDate = options._originalDate || date;
1252
+ var timezoneOffset = originalDate.getTimezoneOffset();
1253
+ switch (token) {
1254
+ // Hours and optional minutes
1255
+ case 'x':
1256
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1257
+
1258
+ // Hours, minutes and optional seconds without `:` delimiter
1259
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1260
+ // so this token always has the same output as `xx`
1261
+ case 'xxxx':
1262
+ case 'xx':
1263
+ // Hours and minutes without `:` delimiter
1264
+ return formatTimezone(timezoneOffset);
1265
+
1266
+ // Hours, minutes and optional seconds with `:` delimiter
1267
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1268
+ // so this token always has the same output as `xxx`
1269
+ case 'xxxxx':
1270
+ case 'xxx': // Hours and minutes with `:` delimiter
1271
+ default:
1272
+ return formatTimezone(timezoneOffset, ':');
1273
+ }
1274
+ },
1275
+ // Timezone (GMT)
1276
+ O: function O(date, token, _localize, options) {
1277
+ var originalDate = options._originalDate || date;
1278
+ var timezoneOffset = originalDate.getTimezoneOffset();
1279
+ switch (token) {
1280
+ // Short
1281
+ case 'O':
1282
+ case 'OO':
1283
+ case 'OOO':
1284
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1285
+ // Long
1286
+ case 'OOOO':
1287
+ default:
1288
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1289
+ }
1290
+ },
1291
+ // Timezone (specific non-location)
1292
+ z: function z(date, token, _localize, options) {
1293
+ var originalDate = options._originalDate || date;
1294
+ var timezoneOffset = originalDate.getTimezoneOffset();
1295
+ switch (token) {
1296
+ // Short
1297
+ case 'z':
1298
+ case 'zz':
1299
+ case 'zzz':
1300
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1301
+ // Long
1302
+ case 'zzzz':
1303
+ default:
1304
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1305
+ }
1306
+ },
1307
+ // Seconds timestamp
1308
+ t: function t(date, token, _localize, options) {
1309
+ var originalDate = options._originalDate || date;
1310
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1311
+ return addLeadingZeros(timestamp, token.length);
1312
+ },
1313
+ // Milliseconds timestamp
1314
+ T: function T(date, token, _localize, options) {
1315
+ var originalDate = options._originalDate || date;
1316
+ var timestamp = originalDate.getTime();
1317
+ return addLeadingZeros(timestamp, token.length);
1318
+ }
1319
+ };
1320
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1321
+ var sign = offset > 0 ? '-' : '+';
1322
+ var absOffset = Math.abs(offset);
1323
+ var hours = Math.floor(absOffset / 60);
1324
+ var minutes = absOffset % 60;
1325
+ if (minutes === 0) {
1326
+ return sign + String(hours);
1327
+ }
1328
+ var delimiter = dirtyDelimiter || '';
1329
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1330
+ }
1331
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1332
+ if (offset % 60 === 0) {
1333
+ var sign = offset > 0 ? '-' : '+';
1334
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1335
+ }
1336
+ return formatTimezone(offset, dirtyDelimiter);
1337
+ }
1338
+ function formatTimezone(offset, dirtyDelimiter) {
1339
+ var delimiter = dirtyDelimiter || '';
1340
+ var sign = offset > 0 ? '-' : '+';
1341
+ var absOffset = Math.abs(offset);
1342
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1343
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1344
+ return sign + hours + delimiter + minutes;
1345
+ }
1346
+ const formatters$1 = formatters;
1347
+
1348
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1349
+ switch (pattern) {
1350
+ case 'P':
1351
+ return formatLong.date({
1352
+ width: 'short'
1353
+ });
1354
+ case 'PP':
1355
+ return formatLong.date({
1356
+ width: 'medium'
1357
+ });
1358
+ case 'PPP':
1359
+ return formatLong.date({
1360
+ width: 'long'
1361
+ });
1362
+ case 'PPPP':
1363
+ default:
1364
+ return formatLong.date({
1365
+ width: 'full'
1366
+ });
1367
+ }
1368
+ };
1369
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1370
+ switch (pattern) {
1371
+ case 'p':
1372
+ return formatLong.time({
1373
+ width: 'short'
1374
+ });
1375
+ case 'pp':
1376
+ return formatLong.time({
1377
+ width: 'medium'
1378
+ });
1379
+ case 'ppp':
1380
+ return formatLong.time({
1381
+ width: 'long'
1382
+ });
1383
+ case 'pppp':
1384
+ default:
1385
+ return formatLong.time({
1386
+ width: 'full'
1387
+ });
1388
+ }
1389
+ };
1390
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1391
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1392
+ var datePattern = matchResult[1];
1393
+ var timePattern = matchResult[2];
1394
+ if (!timePattern) {
1395
+ return dateLongFormatter(pattern, formatLong);
1396
+ }
1397
+ var dateTimeFormat;
1398
+ switch (datePattern) {
1399
+ case 'P':
1400
+ dateTimeFormat = formatLong.dateTime({
1401
+ width: 'short'
1402
+ });
1403
+ break;
1404
+ case 'PP':
1405
+ dateTimeFormat = formatLong.dateTime({
1406
+ width: 'medium'
1407
+ });
1408
+ break;
1409
+ case 'PPP':
1410
+ dateTimeFormat = formatLong.dateTime({
1411
+ width: 'long'
1412
+ });
1413
+ break;
1414
+ case 'PPPP':
1415
+ default:
1416
+ dateTimeFormat = formatLong.dateTime({
1417
+ width: 'full'
1418
+ });
1419
+ break;
1420
+ }
1421
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1422
+ };
1423
+ var longFormatters = {
1424
+ p: timeLongFormatter,
1425
+ P: dateTimeLongFormatter
1426
+ };
1427
+ const longFormatters$1 = longFormatters;
1428
+
1429
+ var protectedDayOfYearTokens = ['D', 'DD'];
1430
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1431
+ function isProtectedDayOfYearToken(token) {
1432
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1433
+ }
1434
+ function isProtectedWeekYearToken(token) {
1435
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1436
+ }
1437
+ function throwProtectedError(token, format, input) {
1438
+ if (token === 'YYYY') {
1439
+ 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"));
1440
+ } else if (token === 'YY') {
1441
+ 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"));
1442
+ } else if (token === 'D') {
1443
+ 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"));
1444
+ } else if (token === 'DD') {
1445
+ 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"));
1446
+ }
1447
+ }
1448
+
1449
+ var formatDistanceLocale = {
1450
+ lessThanXSeconds: {
1451
+ one: 'less than a second',
1452
+ other: 'less than {{count}} seconds'
1453
+ },
1454
+ xSeconds: {
1455
+ one: '1 second',
1456
+ other: '{{count}} seconds'
1457
+ },
1458
+ halfAMinute: 'half a minute',
1459
+ lessThanXMinutes: {
1460
+ one: 'less than a minute',
1461
+ other: 'less than {{count}} minutes'
1462
+ },
1463
+ xMinutes: {
1464
+ one: '1 minute',
1465
+ other: '{{count}} minutes'
1466
+ },
1467
+ aboutXHours: {
1468
+ one: 'about 1 hour',
1469
+ other: 'about {{count}} hours'
1470
+ },
1471
+ xHours: {
1472
+ one: '1 hour',
1473
+ other: '{{count}} hours'
1474
+ },
1475
+ xDays: {
1476
+ one: '1 day',
1477
+ other: '{{count}} days'
1478
+ },
1479
+ aboutXWeeks: {
1480
+ one: 'about 1 week',
1481
+ other: 'about {{count}} weeks'
1482
+ },
1483
+ xWeeks: {
1484
+ one: '1 week',
1485
+ other: '{{count}} weeks'
1486
+ },
1487
+ aboutXMonths: {
1488
+ one: 'about 1 month',
1489
+ other: 'about {{count}} months'
1490
+ },
1491
+ xMonths: {
1492
+ one: '1 month',
1493
+ other: '{{count}} months'
1494
+ },
1495
+ aboutXYears: {
1496
+ one: 'about 1 year',
1497
+ other: 'about {{count}} years'
1498
+ },
1499
+ xYears: {
1500
+ one: '1 year',
1501
+ other: '{{count}} years'
1502
+ },
1503
+ overXYears: {
1504
+ one: 'over 1 year',
1505
+ other: 'over {{count}} years'
1506
+ },
1507
+ almostXYears: {
1508
+ one: 'almost 1 year',
1509
+ other: 'almost {{count}} years'
1510
+ }
1511
+ };
1512
+ var formatDistance = function formatDistance(token, count, options) {
1513
+ var result;
1514
+ var tokenValue = formatDistanceLocale[token];
1515
+ if (typeof tokenValue === 'string') {
1516
+ result = tokenValue;
1517
+ } else if (count === 1) {
1518
+ result = tokenValue.one;
1519
+ } else {
1520
+ result = tokenValue.other.replace('{{count}}', count.toString());
1521
+ }
1522
+ if (options !== null && options !== void 0 && options.addSuffix) {
1523
+ if (options.comparison && options.comparison > 0) {
1524
+ return 'in ' + result;
1525
+ } else {
1526
+ return result + ' ago';
1527
+ }
1528
+ }
1529
+ return result;
1530
+ };
1531
+ const formatDistance$1 = formatDistance;
1532
+
1533
+ function buildFormatLongFn(args) {
1534
+ return function () {
1535
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1536
+ // TODO: Remove String()
1537
+ var width = options.width ? String(options.width) : args.defaultWidth;
1538
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1539
+ return format;
1540
+ };
1541
+ }
1542
+
1543
+ var dateFormats = {
1544
+ full: 'EEEE, MMMM do, y',
1545
+ long: 'MMMM do, y',
1546
+ medium: 'MMM d, y',
1547
+ short: 'MM/dd/yyyy'
1548
+ };
1549
+ var timeFormats = {
1550
+ full: 'h:mm:ss a zzzz',
1551
+ long: 'h:mm:ss a z',
1552
+ medium: 'h:mm:ss a',
1553
+ short: 'h:mm a'
1554
+ };
1555
+ var dateTimeFormats = {
1556
+ full: "{{date}} 'at' {{time}}",
1557
+ long: "{{date}} 'at' {{time}}",
1558
+ medium: '{{date}}, {{time}}',
1559
+ short: '{{date}}, {{time}}'
1560
+ };
1561
+ var formatLong = {
1562
+ date: buildFormatLongFn({
1563
+ formats: dateFormats,
1564
+ defaultWidth: 'full'
1565
+ }),
1566
+ time: buildFormatLongFn({
1567
+ formats: timeFormats,
1568
+ defaultWidth: 'full'
1569
+ }),
1570
+ dateTime: buildFormatLongFn({
1571
+ formats: dateTimeFormats,
1572
+ defaultWidth: 'full'
1573
+ })
1574
+ };
1575
+ const formatLong$1 = formatLong;
1576
+
1577
+ var formatRelativeLocale = {
1578
+ lastWeek: "'last' eeee 'at' p",
1579
+ yesterday: "'yesterday at' p",
1580
+ today: "'today at' p",
1581
+ tomorrow: "'tomorrow at' p",
1582
+ nextWeek: "eeee 'at' p",
1583
+ other: 'P'
1584
+ };
1585
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1586
+ return formatRelativeLocale[token];
1587
+ };
1588
+ const formatRelative$1 = formatRelative;
1589
+
1590
+ function buildLocalizeFn(args) {
1591
+ return function (dirtyIndex, options) {
1592
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1593
+ var valuesArray;
1594
+ if (context === 'formatting' && args.formattingValues) {
1595
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1596
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1597
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1598
+ } else {
1599
+ var _defaultWidth = args.defaultWidth;
1600
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1601
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1602
+ }
1603
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1604
+ // @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!
1605
+ return valuesArray[index];
1606
+ };
1607
+ }
1608
+
1609
+ var eraValues = {
1610
+ narrow: ['B', 'A'],
1611
+ abbreviated: ['BC', 'AD'],
1612
+ wide: ['Before Christ', 'Anno Domini']
1613
+ };
1614
+ var quarterValues = {
1615
+ narrow: ['1', '2', '3', '4'],
1616
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1617
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1618
+ };
1619
+
1620
+ // Note: in English, the names of days of the week and months are capitalized.
1621
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1622
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1623
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1624
+ var monthValues = {
1625
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1626
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1627
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1628
+ };
1629
+ var dayValues = {
1630
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1631
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1632
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1633
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1634
+ };
1635
+ var dayPeriodValues = {
1636
+ narrow: {
1637
+ am: 'a',
1638
+ pm: 'p',
1639
+ midnight: 'mi',
1640
+ noon: 'n',
1641
+ morning: 'morning',
1642
+ afternoon: 'afternoon',
1643
+ evening: 'evening',
1644
+ night: 'night'
1645
+ },
1646
+ abbreviated: {
1647
+ am: 'AM',
1648
+ pm: 'PM',
1649
+ midnight: 'midnight',
1650
+ noon: 'noon',
1651
+ morning: 'morning',
1652
+ afternoon: 'afternoon',
1653
+ evening: 'evening',
1654
+ night: 'night'
1655
+ },
1656
+ wide: {
1657
+ am: 'a.m.',
1658
+ pm: 'p.m.',
1659
+ midnight: 'midnight',
1660
+ noon: 'noon',
1661
+ morning: 'morning',
1662
+ afternoon: 'afternoon',
1663
+ evening: 'evening',
1664
+ night: 'night'
1665
+ }
1666
+ };
1667
+ var formattingDayPeriodValues = {
1668
+ narrow: {
1669
+ am: 'a',
1670
+ pm: 'p',
1671
+ midnight: 'mi',
1672
+ noon: 'n',
1673
+ morning: 'in the morning',
1674
+ afternoon: 'in the afternoon',
1675
+ evening: 'in the evening',
1676
+ night: 'at night'
1677
+ },
1678
+ abbreviated: {
1679
+ am: 'AM',
1680
+ pm: 'PM',
1681
+ midnight: 'midnight',
1682
+ noon: 'noon',
1683
+ morning: 'in the morning',
1684
+ afternoon: 'in the afternoon',
1685
+ evening: 'in the evening',
1686
+ night: 'at night'
1687
+ },
1688
+ wide: {
1689
+ am: 'a.m.',
1690
+ pm: 'p.m.',
1691
+ midnight: 'midnight',
1692
+ noon: 'noon',
1693
+ morning: 'in the morning',
1694
+ afternoon: 'in the afternoon',
1695
+ evening: 'in the evening',
1696
+ night: 'at night'
1697
+ }
1698
+ };
1699
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1700
+ var number = Number(dirtyNumber);
1701
+
1702
+ // If ordinal numbers depend on context, for example,
1703
+ // if they are different for different grammatical genders,
1704
+ // use `options.unit`.
1705
+ //
1706
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1707
+ // 'day', 'hour', 'minute', 'second'.
1708
+
1709
+ var rem100 = number % 100;
1710
+ if (rem100 > 20 || rem100 < 10) {
1711
+ switch (rem100 % 10) {
1712
+ case 1:
1713
+ return number + 'st';
1714
+ case 2:
1715
+ return number + 'nd';
1716
+ case 3:
1717
+ return number + 'rd';
1718
+ }
1719
+ }
1720
+ return number + 'th';
1721
+ };
1722
+ var localize = {
1723
+ ordinalNumber: ordinalNumber,
1724
+ era: buildLocalizeFn({
1725
+ values: eraValues,
1726
+ defaultWidth: 'wide'
1727
+ }),
1728
+ quarter: buildLocalizeFn({
1729
+ values: quarterValues,
1730
+ defaultWidth: 'wide',
1731
+ argumentCallback: function argumentCallback(quarter) {
1732
+ return quarter - 1;
1733
+ }
1734
+ }),
1735
+ month: buildLocalizeFn({
1736
+ values: monthValues,
1737
+ defaultWidth: 'wide'
1738
+ }),
1739
+ day: buildLocalizeFn({
1740
+ values: dayValues,
1741
+ defaultWidth: 'wide'
1742
+ }),
1743
+ dayPeriod: buildLocalizeFn({
1744
+ values: dayPeriodValues,
1745
+ defaultWidth: 'wide',
1746
+ formattingValues: formattingDayPeriodValues,
1747
+ defaultFormattingWidth: 'wide'
1748
+ })
1749
+ };
1750
+ const localize$1 = localize;
1751
+
1752
+ function buildMatchFn(args) {
1753
+ return function (string) {
1754
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1755
+ var width = options.width;
1756
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1757
+ var matchResult = string.match(matchPattern);
1758
+ if (!matchResult) {
1759
+ return null;
1760
+ }
1761
+ var matchedString = matchResult[0];
1762
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1763
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1764
+ return pattern.test(matchedString);
1765
+ }) : findKey(parsePatterns, function (pattern) {
1766
+ return pattern.test(matchedString);
1767
+ });
1768
+ var value;
1769
+ value = args.valueCallback ? args.valueCallback(key) : key;
1770
+ value = options.valueCallback ? options.valueCallback(value) : value;
1771
+ var rest = string.slice(matchedString.length);
1772
+ return {
1773
+ value: value,
1774
+ rest: rest
1775
+ };
1776
+ };
1777
+ }
1778
+ function findKey(object, predicate) {
1779
+ for (var key in object) {
1780
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
1781
+ return key;
1782
+ }
1783
+ }
1784
+ return undefined;
1785
+ }
1786
+ function findIndex(array, predicate) {
1787
+ for (var key = 0; key < array.length; key++) {
1788
+ if (predicate(array[key])) {
1789
+ return key;
1790
+ }
1791
+ }
1792
+ return undefined;
1793
+ }
1794
+
1795
+ function buildMatchPatternFn(args) {
1796
+ return function (string) {
1797
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1798
+ var matchResult = string.match(args.matchPattern);
1799
+ if (!matchResult) return null;
1800
+ var matchedString = matchResult[0];
1801
+ var parseResult = string.match(args.parsePattern);
1802
+ if (!parseResult) return null;
1803
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1804
+ value = options.valueCallback ? options.valueCallback(value) : value;
1805
+ var rest = string.slice(matchedString.length);
1806
+ return {
1807
+ value: value,
1808
+ rest: rest
1809
+ };
1810
+ };
1811
+ }
1812
+
1813
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1814
+ var parseOrdinalNumberPattern = /\d+/i;
1815
+ var matchEraPatterns = {
1816
+ narrow: /^(b|a)/i,
1817
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1818
+ wide: /^(before christ|before common era|anno domini|common era)/i
1819
+ };
1820
+ var parseEraPatterns = {
1821
+ any: [/^b/i, /^(a|c)/i]
1822
+ };
1823
+ var matchQuarterPatterns = {
1824
+ narrow: /^[1234]/i,
1825
+ abbreviated: /^q[1234]/i,
1826
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1827
+ };
1828
+ var parseQuarterPatterns = {
1829
+ any: [/1/i, /2/i, /3/i, /4/i]
1830
+ };
1831
+ var matchMonthPatterns = {
1832
+ narrow: /^[jfmasond]/i,
1833
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1834
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1835
+ };
1836
+ var parseMonthPatterns = {
1837
+ 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],
1838
+ 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]
1839
+ };
1840
+ var matchDayPatterns = {
1841
+ narrow: /^[smtwf]/i,
1842
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1843
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1844
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1845
+ };
1846
+ var parseDayPatterns = {
1847
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1848
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1849
+ };
1850
+ var matchDayPeriodPatterns = {
1851
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1852
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1853
+ };
1854
+ var parseDayPeriodPatterns = {
1855
+ any: {
1856
+ am: /^a/i,
1857
+ pm: /^p/i,
1858
+ midnight: /^mi/i,
1859
+ noon: /^no/i,
1860
+ morning: /morning/i,
1861
+ afternoon: /afternoon/i,
1862
+ evening: /evening/i,
1863
+ night: /night/i
1864
+ }
1865
+ };
1866
+ var match = {
1867
+ ordinalNumber: buildMatchPatternFn({
1868
+ matchPattern: matchOrdinalNumberPattern,
1869
+ parsePattern: parseOrdinalNumberPattern,
1870
+ valueCallback: function valueCallback(value) {
1871
+ return parseInt(value, 10);
1872
+ }
1873
+ }),
1874
+ era: buildMatchFn({
1875
+ matchPatterns: matchEraPatterns,
1876
+ defaultMatchWidth: 'wide',
1877
+ parsePatterns: parseEraPatterns,
1878
+ defaultParseWidth: 'any'
1879
+ }),
1880
+ quarter: buildMatchFn({
1881
+ matchPatterns: matchQuarterPatterns,
1882
+ defaultMatchWidth: 'wide',
1883
+ parsePatterns: parseQuarterPatterns,
1884
+ defaultParseWidth: 'any',
1885
+ valueCallback: function valueCallback(index) {
1886
+ return index + 1;
1887
+ }
1888
+ }),
1889
+ month: buildMatchFn({
1890
+ matchPatterns: matchMonthPatterns,
1891
+ defaultMatchWidth: 'wide',
1892
+ parsePatterns: parseMonthPatterns,
1893
+ defaultParseWidth: 'any'
1894
+ }),
1895
+ day: buildMatchFn({
1896
+ matchPatterns: matchDayPatterns,
1897
+ defaultMatchWidth: 'wide',
1898
+ parsePatterns: parseDayPatterns,
1899
+ defaultParseWidth: 'any'
1900
+ }),
1901
+ dayPeriod: buildMatchFn({
1902
+ matchPatterns: matchDayPeriodPatterns,
1903
+ defaultMatchWidth: 'any',
1904
+ parsePatterns: parseDayPeriodPatterns,
1905
+ defaultParseWidth: 'any'
1906
+ })
1907
+ };
1908
+ const match$1 = match;
1909
+
1910
+ /**
1911
+ * @type {Locale}
1912
+ * @category Locales
1913
+ * @summary English locale (United States).
1914
+ * @language English
1915
+ * @iso-639-2 eng
1916
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
1917
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
1918
+ */
1919
+ var locale = {
1920
+ code: 'en-US',
1921
+ formatDistance: formatDistance$1,
1922
+ formatLong: formatLong$1,
1923
+ formatRelative: formatRelative$1,
1924
+ localize: localize$1,
1925
+ match: match$1,
1926
+ options: {
1927
+ weekStartsOn: 0 /* Sunday */,
1928
+ firstWeekContainsDate: 1
1929
+ }
1930
+ };
1931
+ const defaultLocale = locale;
1932
+
1933
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
1934
+ // (one of the certain letters followed by `o`)
1935
+ // - (\w)\1* matches any sequences of the same letter
1936
+ // - '' matches two quote characters in a row
1937
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
1938
+ // except a single quote symbol, which ends the sequence.
1939
+ // Two quote characters do not end the sequence.
1940
+ // If there is no matching single quote
1941
+ // then the sequence will continue until the end of the string.
1942
+ // - . matches any single character unmatched by previous parts of the RegExps
1943
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
1944
+
1945
+ // This RegExp catches symbols escaped by quotes, and also
1946
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
1947
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
1948
+ var escapedStringRegExp = /^'([^]*?)'?$/;
1949
+ var doubleQuoteRegExp = /''/g;
1950
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
1951
+
1952
+ /**
1953
+ * @name format
1954
+ * @category Common Helpers
1955
+ * @summary Format the date.
1956
+ *
1957
+ * @description
1958
+ * Return the formatted date string in the given format. The result may vary by locale.
1959
+ *
1960
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
1961
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1962
+ *
1963
+ * The characters wrapped between two single quotes characters (') are escaped.
1964
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
1965
+ * (see the last example)
1966
+ *
1967
+ * Format of the string is based on Unicode Technical Standard #35:
1968
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
1969
+ * with a few additions (see note 7 below the table).
1970
+ *
1971
+ * Accepted patterns:
1972
+ * | Unit | Pattern | Result examples | Notes |
1973
+ * |---------------------------------|---------|-----------------------------------|-------|
1974
+ * | Era | G..GGG | AD, BC | |
1975
+ * | | GGGG | Anno Domini, Before Christ | 2 |
1976
+ * | | GGGGG | A, B | |
1977
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
1978
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
1979
+ * | | yy | 44, 01, 00, 17 | 5 |
1980
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
1981
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
1982
+ * | | yyyyy | ... | 3,5 |
1983
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
1984
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
1985
+ * | | YY | 44, 01, 00, 17 | 5,8 |
1986
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
1987
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
1988
+ * | | YYYYY | ... | 3,5 |
1989
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
1990
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
1991
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
1992
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
1993
+ * | | RRRRR | ... | 3,5,7 |
1994
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
1995
+ * | | uu | -43, 01, 1900, 2017 | 5 |
1996
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
1997
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
1998
+ * | | uuuuu | ... | 3,5 |
1999
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
2000
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
2001
+ * | | QQ | 01, 02, 03, 04 | |
2002
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
2003
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
2004
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
2005
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
2006
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
2007
+ * | | qq | 01, 02, 03, 04 | |
2008
+ * | | qqq | Q1, Q2, Q3, Q4 | |
2009
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
2010
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
2011
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
2012
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
2013
+ * | | MM | 01, 02, ..., 12 | |
2014
+ * | | MMM | Jan, Feb, ..., Dec | |
2015
+ * | | MMMM | January, February, ..., December | 2 |
2016
+ * | | MMMMM | J, F, ..., D | |
2017
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
2018
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
2019
+ * | | LL | 01, 02, ..., 12 | |
2020
+ * | | LLL | Jan, Feb, ..., Dec | |
2021
+ * | | LLLL | January, February, ..., December | 2 |
2022
+ * | | LLLLL | J, F, ..., D | |
2023
+ * | Local week of year | w | 1, 2, ..., 53 | |
2024
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
2025
+ * | | ww | 01, 02, ..., 53 | |
2026
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
2027
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
2028
+ * | | II | 01, 02, ..., 53 | 7 |
2029
+ * | Day of month | d | 1, 2, ..., 31 | |
2030
+ * | | do | 1st, 2nd, ..., 31st | 7 |
2031
+ * | | dd | 01, 02, ..., 31 | |
2032
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
2033
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
2034
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
2035
+ * | | DDD | 001, 002, ..., 365, 366 | |
2036
+ * | | DDDD | ... | 3 |
2037
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
2038
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
2039
+ * | | EEEEE | M, T, W, T, F, S, S | |
2040
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
2041
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
2042
+ * | | io | 1st, 2nd, ..., 7th | 7 |
2043
+ * | | ii | 01, 02, ..., 07 | 7 |
2044
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
2045
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
2046
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
2047
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
2048
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
2049
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
2050
+ * | | ee | 02, 03, ..., 01 | |
2051
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
2052
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
2053
+ * | | eeeee | M, T, W, T, F, S, S | |
2054
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
2055
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
2056
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
2057
+ * | | cc | 02, 03, ..., 01 | |
2058
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
2059
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
2060
+ * | | ccccc | M, T, W, T, F, S, S | |
2061
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
2062
+ * | AM, PM | a..aa | AM, PM | |
2063
+ * | | aaa | am, pm | |
2064
+ * | | aaaa | a.m., p.m. | 2 |
2065
+ * | | aaaaa | a, p | |
2066
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
2067
+ * | | bbb | am, pm, noon, midnight | |
2068
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
2069
+ * | | bbbbb | a, p, n, mi | |
2070
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
2071
+ * | | BBBB | at night, in the morning, ... | 2 |
2072
+ * | | BBBBB | at night, in the morning, ... | |
2073
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
2074
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
2075
+ * | | hh | 01, 02, ..., 11, 12 | |
2076
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
2077
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
2078
+ * | | HH | 00, 01, 02, ..., 23 | |
2079
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
2080
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
2081
+ * | | KK | 01, 02, ..., 11, 00 | |
2082
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
2083
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
2084
+ * | | kk | 24, 01, 02, ..., 23 | |
2085
+ * | Minute | m | 0, 1, ..., 59 | |
2086
+ * | | mo | 0th, 1st, ..., 59th | 7 |
2087
+ * | | mm | 00, 01, ..., 59 | |
2088
+ * | Second | s | 0, 1, ..., 59 | |
2089
+ * | | so | 0th, 1st, ..., 59th | 7 |
2090
+ * | | ss | 00, 01, ..., 59 | |
2091
+ * | Fraction of second | S | 0, 1, ..., 9 | |
2092
+ * | | SS | 00, 01, ..., 99 | |
2093
+ * | | SSS | 000, 001, ..., 999 | |
2094
+ * | | SSSS | ... | 3 |
2095
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
2096
+ * | | XX | -0800, +0530, Z | |
2097
+ * | | XXX | -08:00, +05:30, Z | |
2098
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
2099
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
2100
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
2101
+ * | | xx | -0800, +0530, +0000 | |
2102
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
2103
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
2104
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
2105
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
2106
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
2107
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
2108
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
2109
+ * | Seconds timestamp | t | 512969520 | 7 |
2110
+ * | | tt | ... | 3,7 |
2111
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
2112
+ * | | TT | ... | 3,7 |
2113
+ * | Long localized date | P | 04/29/1453 | 7 |
2114
+ * | | PP | Apr 29, 1453 | 7 |
2115
+ * | | PPP | April 29th, 1453 | 7 |
2116
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
2117
+ * | Long localized time | p | 12:00 AM | 7 |
2118
+ * | | pp | 12:00:00 AM | 7 |
2119
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
2120
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
2121
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
2122
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
2123
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
2124
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
2125
+ * Notes:
2126
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
2127
+ * are the same as "stand-alone" units, but are different in some languages.
2128
+ * "Formatting" units are declined according to the rules of the language
2129
+ * in the context of a date. "Stand-alone" units are always nominative singular:
2130
+ *
2131
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
2132
+ *
2133
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
2134
+ *
2135
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2136
+ * the single quote characters (see below).
2137
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
2138
+ * the output will be the same as default pattern for this unit, usually
2139
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
2140
+ * are marked with "2" in the last column of the table.
2141
+ *
2142
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
2143
+ *
2144
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
2145
+ *
2146
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
2147
+ *
2148
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
2149
+ *
2150
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
2151
+ *
2152
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
2153
+ * The output will be padded with zeros to match the length of the pattern.
2154
+ *
2155
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
2156
+ *
2157
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2158
+ * These tokens represent the shortest form of the quarter.
2159
+ *
2160
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
2161
+ *
2162
+ * | Year | `y` | `u` |
2163
+ * |------|-----|-----|
2164
+ * | AC 1 | 1 | 1 |
2165
+ * | BC 1 | 1 | 0 |
2166
+ * | BC 2 | 2 | -1 |
2167
+ *
2168
+ * Also `yy` always returns the last two digits of a year,
2169
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
2170
+ *
2171
+ * | Year | `yy` | `uu` |
2172
+ * |------|------|------|
2173
+ * | 1 | 01 | 01 |
2174
+ * | 14 | 14 | 14 |
2175
+ * | 376 | 76 | 376 |
2176
+ * | 1453 | 53 | 1453 |
2177
+ *
2178
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2179
+ * except local week-numbering years are dependent on `options.weekStartsOn`
2180
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
2181
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
2182
+ *
2183
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
2184
+ * so right now these tokens fall back to GMT timezones.
2185
+ *
2186
+ * 7. These patterns are not in the Unicode Technical Standard #35:
2187
+ * - `i`: ISO day of week
2188
+ * - `I`: ISO week of year
2189
+ * - `R`: ISO week-numbering year
2190
+ * - `t`: seconds timestamp
2191
+ * - `T`: milliseconds timestamp
2192
+ * - `o`: ordinal number modifier
2193
+ * - `P`: long localized date
2194
+ * - `p`: long localized time
2195
+ *
2196
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2197
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2198
+ *
2199
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2200
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2201
+ *
2202
+ * @param {Date|Number} date - the original date
2203
+ * @param {String} format - the string of tokens
2204
+ * @param {Object} [options] - an object with options.
2205
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2206
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2207
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2208
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2209
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2210
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2211
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2212
+ * @returns {String} the formatted date string
2213
+ * @throws {TypeError} 2 arguments required
2214
+ * @throws {RangeError} `date` must not be Invalid Date
2215
+ * @throws {RangeError} `options.locale` must contain `localize` property
2216
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2217
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2218
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2219
+ * @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
2220
+ * @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
2221
+ * @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
2222
+ * @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
2223
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2224
+ *
2225
+ * @example
2226
+ * // Represent 11 February 2014 in middle-endian format:
2227
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2228
+ * //=> '02/11/2014'
2229
+ *
2230
+ * @example
2231
+ * // Represent 2 July 2014 in Esperanto:
2232
+ * import { eoLocale } from 'date-fns/locale/eo'
2233
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2234
+ * locale: eoLocale
2235
+ * })
2236
+ * //=> '2-a de julio 2014'
2237
+ *
2238
+ * @example
2239
+ * // Escape string by single quote characters:
2240
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2241
+ * //=> "3 o'clock"
2242
+ */
2243
+
2244
+ function format(dirtyDate, dirtyFormatStr, options) {
2245
+ 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;
2246
+ requiredArgs(2, arguments);
2247
+ var formatStr = String(dirtyFormatStr);
2248
+ var defaultOptions = getDefaultOptions();
2249
+ 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;
2250
+ 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);
2251
+
2252
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2253
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2254
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2255
+ }
2256
+ 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);
2257
+
2258
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2259
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2260
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2261
+ }
2262
+ if (!locale.localize) {
2263
+ throw new RangeError('locale must contain localize property');
2264
+ }
2265
+ if (!locale.formatLong) {
2266
+ throw new RangeError('locale must contain formatLong property');
2267
+ }
2268
+ var originalDate = toDate(dirtyDate);
2269
+ if (!isValid(originalDate)) {
2270
+ throw new RangeError('Invalid time value');
2271
+ }
2272
+
2273
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2274
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2275
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2276
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2277
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2278
+ var formatterOptions = {
2279
+ firstWeekContainsDate: firstWeekContainsDate,
2280
+ weekStartsOn: weekStartsOn,
2281
+ locale: locale,
2282
+ _originalDate: originalDate
2283
+ };
2284
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2285
+ var firstCharacter = substring[0];
2286
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2287
+ var longFormatter = longFormatters$1[firstCharacter];
2288
+ return longFormatter(substring, locale.formatLong);
2289
+ }
2290
+ return substring;
2291
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2292
+ // Replace two single quote characters with one single quote character
2293
+ if (substring === "''") {
2294
+ return "'";
2295
+ }
2296
+ var firstCharacter = substring[0];
2297
+ if (firstCharacter === "'") {
2298
+ return cleanEscapedString(substring);
2299
+ }
2300
+ var formatter = formatters$1[firstCharacter];
2301
+ if (formatter) {
2302
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2303
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2304
+ }
2305
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2306
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2307
+ }
2308
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
2309
+ }
2310
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2311
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2312
+ }
2313
+ return substring;
2314
+ }).join('');
2315
+ return result;
2316
+ }
2317
+ function cleanEscapedString(input) {
2318
+ var matched = input.match(escapedStringRegExp);
2319
+ if (!matched) {
2320
+ return input;
2321
+ }
2322
+ return matched[1].replace(doubleQuoteRegExp, "'");
2323
+ }
2324
+
2325
+ const casinoChallengesPlayerHistoryCss = ".history {\n width: 100%;\n padding: 0 10%;\n box-sizing: border-box;\n display: flex;\n gap: 16px;\n flex-direction: column;\n}\n@container challenges-container (max-width: 800px) {\n .history {\n padding: 0;\n }\n}\n\n.item {\n background-color: var(--emw--history-item-background, rgba(114, 118, 114, 0.2));\n border-radius: 12px;\n padding: 20px;\n}\n\n.header {\n cursor: pointer;\n border: none;\n width: 100%;\n text-align: left;\n background: transparent;\n color: var(--emw--color-white, white);\n font-size: var(--emw--font-size-medium, 16px);\n font-weight: var(--emw--font-weight-bold, 700);\n display: flex;\n justify-content: space-between;\n padding: 0;\n}\n@container challenges-container (max-width: 800px) {\n .header {\n line-height: var(--emw--font-size-medium, 14px);\n }\n}\n\n.content {\n max-height: 0;\n overflow: auto;\n transition: max-height 0.3s ease;\n background: transparent;\n color: var(--emw--color-white, white);\n}\n.content.open {\n max-height: 400px;\n}\n.content .row {\n display: flex;\n font-size: var(--emw--font-size-medium, 14px);\n font-weight: var(--emw--font-weight-medium, 500);\n line-height: 24px;\n padding: 10px 12px 4px;\n box-sizing: border-box;\n color: var(--emw--color-gray-150, #c8d6ce);\n}\n.content .row .col-1 {\n flex-grow: 1;\n}\n.content .row .col-2 {\n width: 120px;\n}\n.content .row .col-2.errored {\n color: var(--emw--color-error, #D6421E);\n}\n@container challenges-container (max-width: 800px) {\n .content .row {\n font-size: var(--emw--font-size-small, 12px);\n line-height: 22px;\n }\n}\n@container challenges-container (max-width: 620px) {\n .content .row .col-1,\n .content .row .col-2 {\n width: 91px;\n }\n}\n.content .reward {\n margin: 0;\n padding: 0 12px 10px;\n box-sizing: border-box;\n font-size: var(--emw--font-size-small, 12px);\n font-weight: var(--emw--font-weight-medium, 500);\n line-height: 19px;\n color: var(--emw--color-valid, #03873e);\n border-bottom: 1px solid var(--emw--button-border-color, rgba(200, 214, 206, 0.1019607843));\n display: flex;\n gap: 8px;\n}\n.content .reward.grayed {\n color: var(--emw--color-gray-300, #555a57);\n}\n@container challenges-container (max-width: 800px) {\n .content .reward {\n font-size: var(--emw--font-size-small, 12px);\n line-height: 14px;\n }\n .content .reward img {\n width: 12px;\n height: 12px;\n }\n}\n.content .list-header {\n padding: 0 12px;\n margin-top: 20px;\n border-radius: 6px 6px 0 0;\n color: var(--emw--history-header-color, #727672);\n background: var(--emw--history-item-header-background, #202120);\n}\n.content .list-header span {\n font-size: var(--emw--font-size-small, 12px);\n font-weight: var(--emw--font-weight-bold, 700);\n line-height: 28px;\n}\n@container challenges-container (max-width: 800px) {\n .content .list-header span {\n font-size: var(--emw--font-size-x-small, 10px);\n line-height: 20px;\n }\n}";
2326
+ const CasinoChallengesPlayerHistoryStyle0 = casinoChallengesPlayerHistoryCss;
2327
+
2328
+ const skeletons = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
2329
+ const CasinoChallengesPlayerHistory = class {
2330
+ constructor(hostRef) {
2331
+ registerInstance(this, hostRef);
2332
+ this.loadMore = createEvent(this, "loadMore", 7);
2333
+ this.setLastItemRef = (el) => {
2334
+ if (this.lastItemRef && this.observer) {
2335
+ this.observer.unobserve(this.lastItemRef);
2336
+ }
2337
+ this.lastItemRef = el;
2338
+ if (el && this.observer && !this.loading) {
2339
+ this.observer.observe(el);
2340
+ }
2341
+ };
2342
+ this.mbSource = undefined;
2343
+ this.clientStyling = undefined;
2344
+ this.clientStylingUrl = undefined;
2345
+ this.translationUrl = '';
2346
+ this.language = 'en';
2347
+ this.playerHistory = [];
2348
+ this.loading = false;
2349
+ this.hasMore = false;
2350
+ this.openItems = [];
2351
+ }
2352
+ handleClientStylingChange(newValue, oldValue) {
2353
+ if (newValue != oldValue) {
2354
+ setClientStyling(this.stylingContainer, this.clientStyling);
2355
+ }
2356
+ }
2357
+ handleClientStylingUrlChange(newValue, oldValue) {
2358
+ if (newValue != oldValue) {
2359
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2360
+ }
2361
+ }
2362
+ handleMbSourceChange(newValue, oldValue) {
2363
+ if (newValue != oldValue) {
2364
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
2365
+ }
2366
+ }
2367
+ handlePlayerHistoryChange() {
2368
+ this.openItems = this.playerHistory.map(() => false);
2369
+ }
2370
+ setupObserver() {
2371
+ if (!this.lastItemRef || this.loading || !this.hasMore)
2372
+ return;
2373
+ if (!this.observer) {
2374
+ this.observer = new IntersectionObserver(([entry]) => {
2375
+ if (entry.isIntersecting && !this.loading && this.hasMore) {
2376
+ this.observer.unobserve(entry.target);
2377
+ this.loadMore.emit();
2378
+ }
2379
+ }, {
2380
+ root: null,
2381
+ rootMargin: '0px',
2382
+ threshold: 0.1
2383
+ });
2384
+ }
2385
+ this.observer.disconnect();
2386
+ this.observer.observe(this.lastItemRef);
2387
+ }
2388
+ componentDidLoad() {
2389
+ if (this.stylingContainer) {
2390
+ if (this.mbSource)
2391
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
2392
+ if (this.clientStyling)
2393
+ setClientStyling(this.stylingContainer, this.clientStyling);
2394
+ if (this.clientStylingUrl)
2395
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2396
+ }
2397
+ }
2398
+ componentWillLoad() {
2399
+ if (this.translationUrl) {
2400
+ resolveTranslationUrl(this.translationUrl);
2401
+ }
2402
+ }
2403
+ componentDidRender() {
2404
+ this.setupObserver();
2405
+ }
2406
+ disconnectedCallback() {
2407
+ var _a;
2408
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2409
+ (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
2410
+ this.observer = undefined;
2411
+ }
2412
+ toggle(index) {
2413
+ this.openItems = this.openItems.map((open, i) => (i === index ? !open : open));
2414
+ }
2415
+ renderLevel(level) {
2416
+ const rewards = Object.values(level.Rewards)
2417
+ .map((r) => r.RewardDescription)
2418
+ .join(', ');
2419
+ return (h("div", null, h("div", { class: "row" }, h("span", { class: "col-1" }, `${translate('level', this.language)} ${level.OrderNumber + 1}`), h("span", { class: `col-2 ${level.Status === EHistoryItemLevelStatus.Forfeited ? 'errored' : ''}` }, HistoryItemLevelStatusDictionary[level.Status]), h("span", { class: "col-2" }, format(new Date(level.Time), 'dd/MM/yy HH:mm'))), h("p", { class: `reward ${level.Status === EHistoryItemLevelStatus.Completed ? '' : 'grayed'}` }, h("img", { src: giftSvg }), rewards)));
2420
+ }
2421
+ renderSkeletons() {
2422
+ return skeletons.map((skeleton) => (h("div", { class: "loader", key: skeleton }, h("ui-skeleton", { structure: "title", width: "auto", height: "60px", marginBottom: 0 }))));
2423
+ }
2424
+ render() {
2425
+ return (h("div", { key: '0781f3ee74b3f3b8b5b09e3269974e876ece82ef', ref: (el) => (this.stylingContainer = el) }, h("div", { key: '78108ee5c86b0e87363e9ed980c242890f2453b1', class: "history" }, this.playerHistory.map((item, index) => (h("div", { class: "item", ref: index === this.playerHistory.length - 1 ? this.setLastItemRef : null }, h("button", { class: "header", onClick: () => this.toggle(index) }, h("span", null, item.Name), h("img", { src: this.openItems[index] ? arrowUpSvg : arrowDownSvg })), h("div", { class: `content ${this.openItems[index] ? 'open' : ''}` }, h("div", { class: "row list-header" }, h("span", { class: "col-1", style: { textTransform: 'uppercase' } }, translate('level', this.language)), h("span", { class: "col-2", style: { textTransform: 'uppercase' } }, translate('status', this.language)), h("span", { class: "col-2", style: { textTransform: 'uppercase' } }, translate('time', this.language))), item.Levels.map((level) => this.renderLevel(level)))))), this.loading && this.renderSkeletons())));
2426
+ }
2427
+ static get watchers() { return {
2428
+ "clientStyling": ["handleClientStylingChange"],
2429
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2430
+ "mbSource": ["handleMbSourceChange"],
2431
+ "playerHistory": ["handlePlayerHistoryChange"]
2432
+ }; }
2433
+ };
2434
+ CasinoChallengesPlayerHistory.style = CasinoChallengesPlayerHistoryStyle0;
2435
+
2436
+ export { CasinoChallengesPlayerHistory as C };