@everymatrix/lottery-banner 0.0.17 → 0.0.19

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