@everymatrix/lottery-draw-results 1.65.1 → 1.65.2

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