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