@everymatrix/player-elevate-level 1.31.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.
Files changed (86) hide show
  1. package/dist/cjs/bonus-elevate-levels_8.cjs.entry.js +919 -0
  2. package/dist/cjs/index-c706b0d2.js +1726 -0
  3. package/dist/cjs/index.cjs.js +2 -0
  4. package/dist/cjs/loader.cjs.js +21 -0
  5. package/dist/cjs/player-elevate-card-items-31eb5d57.js +2477 -0
  6. package/dist/cjs/player-elevate-card.cjs.entry.js +77 -0
  7. package/dist/cjs/player-elevate-level.cjs.js +19 -0
  8. package/dist/cjs/player-elevate-pointcard.cjs.entry.js +84 -0
  9. package/dist/collection/collection-manifest.json +37 -0
  10. package/dist/collection/components/player-elevate-level/player-elevate-level.css +13 -0
  11. package/dist/collection/components/player-elevate-level/player-elevate-level.js +212 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/utils.js +0 -0
  14. package/dist/components/bonus-elevate-levels.js +6 -0
  15. package/dist/components/bonus-elevate-levels2.js +133 -0
  16. package/dist/components/elevate-level-list.js +6 -0
  17. package/dist/components/elevate-level-list2.js +177 -0
  18. package/dist/components/elevate-level-presentation.js +6 -0
  19. package/dist/components/elevate-level-presentation2.js +31 -0
  20. package/dist/components/elevate-levels-data.js +6 -0
  21. package/dist/components/elevate-levels-data2.js +102 -0
  22. package/dist/components/general-styling-wrapper.js +6 -0
  23. package/dist/components/general-styling-wrapper2.js +103 -0
  24. package/dist/components/index.d.ts +26 -0
  25. package/dist/components/index.js +1 -0
  26. package/dist/components/player-elevate-card-data.js +6 -0
  27. package/dist/components/player-elevate-card-data2.js +624 -0
  28. package/dist/components/player-elevate-card-items.js +2250 -0
  29. package/dist/components/player-elevate-card.js +118 -0
  30. package/dist/components/player-elevate-level.d.ts +11 -0
  31. package/dist/components/player-elevate-level.js +107 -0
  32. package/dist/components/player-elevate-loyaltycard.js +6 -0
  33. package/dist/components/player-elevate-loyaltycard2.js +121 -0
  34. package/dist/components/player-elevate-pointcard.js +127 -0
  35. package/dist/esm/bonus-elevate-levels_8.entry.js +908 -0
  36. package/dist/esm/index-104132db.js +1696 -0
  37. package/dist/esm/index.js +1 -0
  38. package/dist/esm/loader.js +17 -0
  39. package/dist/esm/player-elevate-card-items-289d91dc.js +2464 -0
  40. package/dist/esm/player-elevate-card.entry.js +73 -0
  41. package/dist/esm/player-elevate-level.js +17 -0
  42. package/dist/esm/player-elevate-pointcard.entry.js +80 -0
  43. package/dist/esm/polyfills/core-js.js +11 -0
  44. package/dist/esm/polyfills/css-shim.js +1 -0
  45. package/dist/esm/polyfills/dom.js +79 -0
  46. package/dist/esm/polyfills/es5-html-element.js +1 -0
  47. package/dist/esm/polyfills/index.js +34 -0
  48. package/dist/esm/polyfills/system.js +6 -0
  49. package/dist/index.cjs.js +1 -0
  50. package/dist/index.js +1 -0
  51. package/dist/player-elevate-level/index.esm.js +0 -0
  52. package/dist/player-elevate-level/p-34b6a7b6.entry.js +1 -0
  53. package/dist/player-elevate-level/p-46fd6f51.js +1 -0
  54. package/dist/player-elevate-level/p-b67b6b93.entry.js +1 -0
  55. package/dist/player-elevate-level/p-c73cc225.entry.js +1 -0
  56. package/dist/player-elevate-level/p-f43f6ed2.js +1 -0
  57. package/dist/player-elevate-level/player-elevate-level.esm.js +1 -0
  58. package/dist/static/button-default.svg +42 -0
  59. package/dist/static/button-disabled.svg +4 -0
  60. package/dist/static/button-hover.svg +4 -0
  61. package/dist/static/button-level.svg +27 -0
  62. package/dist/static/button-pressed.svg +18 -0
  63. package/dist/static/button-redeem.svg +36 -0
  64. package/dist/static/card-ground-over.png +0 -0
  65. package/dist/static/card-ground-over.svg +903 -0
  66. package/dist/static/card-ground.png +0 -0
  67. package/dist/static/card-ground.svg +34 -0
  68. package/dist/static/info.svg +4 -0
  69. package/dist/static/level-badge.png +0 -0
  70. package/dist/static/level-percent.svg +80 -0
  71. package/dist/static/tips-info.svg +21 -0
  72. package/dist/static/user.svg +3 -0
  73. package/dist/stencil.config.js +25 -0
  74. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/player-elevate-level/.stencil/packages/player-elevate-level/stencil.config.d.ts +2 -0
  75. package/dist/types/components/player-elevate-level/player-elevate-level.d.ts +43 -0
  76. package/dist/types/components.d.ts +109 -0
  77. package/dist/types/index.d.ts +1 -0
  78. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  79. package/dist/types/utils/utils.d.ts +0 -0
  80. package/loader/cdn.js +3 -0
  81. package/loader/index.cjs.js +3 -0
  82. package/loader/index.d.ts +12 -0
  83. package/loader/index.es2017.js +3 -0
  84. package/loader/index.js +4 -0
  85. package/loader/package.json +10 -0
  86. package/package.json +23 -0
@@ -0,0 +1,2464 @@
1
+ import { h, a as getAssetPath } from './index-104132db.js';
2
+
3
+ function _typeof(o) {
4
+ "@babel/helpers - typeof";
5
+
6
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
7
+ return typeof o;
8
+ } : function (o) {
9
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
10
+ }, _typeof(o);
11
+ }
12
+
13
+ function toInteger(dirtyNumber) {
14
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
15
+ return NaN;
16
+ }
17
+ var number = Number(dirtyNumber);
18
+ if (isNaN(number)) {
19
+ return number;
20
+ }
21
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
22
+ }
23
+
24
+ function requiredArgs(required, args) {
25
+ if (args.length < required) {
26
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
27
+ }
28
+ }
29
+
30
+ /**
31
+ * @name toDate
32
+ * @category Common Helpers
33
+ * @summary Convert the given argument to an instance of Date.
34
+ *
35
+ * @description
36
+ * Convert the given argument to an instance of Date.
37
+ *
38
+ * If the argument is an instance of Date, the function returns its clone.
39
+ *
40
+ * If the argument is a number, it is treated as a timestamp.
41
+ *
42
+ * If the argument is none of the above, the function returns Invalid Date.
43
+ *
44
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
45
+ *
46
+ * @param {Date|Number} argument - the value to convert
47
+ * @returns {Date} the parsed date in the local time zone
48
+ * @throws {TypeError} 1 argument required
49
+ *
50
+ * @example
51
+ * // Clone the date:
52
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
53
+ * //=> Tue Feb 11 2014 11:30:30
54
+ *
55
+ * @example
56
+ * // Convert the timestamp to date:
57
+ * const result = toDate(1392098430000)
58
+ * //=> Tue Feb 11 2014 11:30:30
59
+ */
60
+ function toDate(argument) {
61
+ requiredArgs(1, arguments);
62
+ var argStr = Object.prototype.toString.call(argument);
63
+
64
+ // Clone the date
65
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
66
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
67
+ return new Date(argument.getTime());
68
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
69
+ return new Date(argument);
70
+ } else {
71
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
72
+ // eslint-disable-next-line no-console
73
+ 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");
74
+ // eslint-disable-next-line no-console
75
+ console.warn(new Error().stack);
76
+ }
77
+ return new Date(NaN);
78
+ }
79
+ }
80
+
81
+ /**
82
+ * @name addMilliseconds
83
+ * @category Millisecond Helpers
84
+ * @summary Add the specified number of milliseconds to the given date.
85
+ *
86
+ * @description
87
+ * Add the specified number of milliseconds to the given date.
88
+ *
89
+ * @param {Date|Number} date - the date to be changed
90
+ * @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`.
91
+ * @returns {Date} the new date with the milliseconds added
92
+ * @throws {TypeError} 2 arguments required
93
+ *
94
+ * @example
95
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
96
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
97
+ * //=> Thu Jul 10 2014 12:45:30.750
98
+ */
99
+ function addMilliseconds(dirtyDate, dirtyAmount) {
100
+ requiredArgs(2, arguments);
101
+ var timestamp = toDate(dirtyDate).getTime();
102
+ var amount = toInteger(dirtyAmount);
103
+ return new Date(timestamp + amount);
104
+ }
105
+
106
+ var defaultOptions = {};
107
+ function getDefaultOptions() {
108
+ return defaultOptions;
109
+ }
110
+
111
+ /**
112
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
113
+ * They usually appear for dates that denote time before the timezones were introduced
114
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
115
+ * and GMT+01:00:00 after that date)
116
+ *
117
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
118
+ * which would lead to incorrect calculations.
119
+ *
120
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
121
+ */
122
+ function getTimezoneOffsetInMilliseconds(date) {
123
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
124
+ utcDate.setUTCFullYear(date.getFullYear());
125
+ return date.getTime() - utcDate.getTime();
126
+ }
127
+
128
+ /**
129
+ * @name isDate
130
+ * @category Common Helpers
131
+ * @summary Is the given value a date?
132
+ *
133
+ * @description
134
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
135
+ *
136
+ * @param {*} value - the value to check
137
+ * @returns {boolean} true if the given value is a date
138
+ * @throws {TypeError} 1 arguments required
139
+ *
140
+ * @example
141
+ * // For a valid date:
142
+ * const result = isDate(new Date())
143
+ * //=> true
144
+ *
145
+ * @example
146
+ * // For an invalid date:
147
+ * const result = isDate(new Date(NaN))
148
+ * //=> true
149
+ *
150
+ * @example
151
+ * // For some value:
152
+ * const result = isDate('2014-02-31')
153
+ * //=> false
154
+ *
155
+ * @example
156
+ * // For an object:
157
+ * const result = isDate({})
158
+ * //=> false
159
+ */
160
+ function isDate(value) {
161
+ requiredArgs(1, arguments);
162
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
163
+ }
164
+
165
+ /**
166
+ * @name isValid
167
+ * @category Common Helpers
168
+ * @summary Is the given date valid?
169
+ *
170
+ * @description
171
+ * Returns false if argument is Invalid Date and true otherwise.
172
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
173
+ * Invalid Date is a Date, whose time value is NaN.
174
+ *
175
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
176
+ *
177
+ * @param {*} date - the date to check
178
+ * @returns {Boolean} the date is valid
179
+ * @throws {TypeError} 1 argument required
180
+ *
181
+ * @example
182
+ * // For the valid date:
183
+ * const result = isValid(new Date(2014, 1, 31))
184
+ * //=> true
185
+ *
186
+ * @example
187
+ * // For the value, convertable into a date:
188
+ * const result = isValid(1393804800000)
189
+ * //=> true
190
+ *
191
+ * @example
192
+ * // For the invalid date:
193
+ * const result = isValid(new Date(''))
194
+ * //=> false
195
+ */
196
+ function isValid(dirtyDate) {
197
+ requiredArgs(1, arguments);
198
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
199
+ return false;
200
+ }
201
+ var date = toDate(dirtyDate);
202
+ return !isNaN(Number(date));
203
+ }
204
+
205
+ /**
206
+ * @name subMilliseconds
207
+ * @category Millisecond Helpers
208
+ * @summary Subtract the specified number of milliseconds from the given date.
209
+ *
210
+ * @description
211
+ * Subtract the specified number of milliseconds from the given date.
212
+ *
213
+ * @param {Date|Number} date - the date to be changed
214
+ * @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`.
215
+ * @returns {Date} the new date with the milliseconds subtracted
216
+ * @throws {TypeError} 2 arguments required
217
+ *
218
+ * @example
219
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
220
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
221
+ * //=> Thu Jul 10 2014 12:45:29.250
222
+ */
223
+ function subMilliseconds(dirtyDate, dirtyAmount) {
224
+ requiredArgs(2, arguments);
225
+ var amount = toInteger(dirtyAmount);
226
+ return addMilliseconds(dirtyDate, -amount);
227
+ }
228
+
229
+ var MILLISECONDS_IN_DAY = 86400000;
230
+ function getUTCDayOfYear(dirtyDate) {
231
+ requiredArgs(1, arguments);
232
+ var date = toDate(dirtyDate);
233
+ var timestamp = date.getTime();
234
+ date.setUTCMonth(0, 1);
235
+ date.setUTCHours(0, 0, 0, 0);
236
+ var startOfYearTimestamp = date.getTime();
237
+ var difference = timestamp - startOfYearTimestamp;
238
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
239
+ }
240
+
241
+ function startOfUTCISOWeek(dirtyDate) {
242
+ requiredArgs(1, arguments);
243
+ var weekStartsOn = 1;
244
+ var date = toDate(dirtyDate);
245
+ var day = date.getUTCDay();
246
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
247
+ date.setUTCDate(date.getUTCDate() - diff);
248
+ date.setUTCHours(0, 0, 0, 0);
249
+ return date;
250
+ }
251
+
252
+ function getUTCISOWeekYear(dirtyDate) {
253
+ requiredArgs(1, arguments);
254
+ var date = toDate(dirtyDate);
255
+ var year = date.getUTCFullYear();
256
+ var fourthOfJanuaryOfNextYear = new Date(0);
257
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
258
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
259
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
260
+ var fourthOfJanuaryOfThisYear = new Date(0);
261
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
262
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
263
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
264
+ if (date.getTime() >= startOfNextYear.getTime()) {
265
+ return year + 1;
266
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
267
+ return year;
268
+ } else {
269
+ return year - 1;
270
+ }
271
+ }
272
+
273
+ function startOfUTCISOWeekYear(dirtyDate) {
274
+ requiredArgs(1, arguments);
275
+ var year = getUTCISOWeekYear(dirtyDate);
276
+ var fourthOfJanuary = new Date(0);
277
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
278
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
279
+ var date = startOfUTCISOWeek(fourthOfJanuary);
280
+ return date;
281
+ }
282
+
283
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
284
+ function getUTCISOWeek(dirtyDate) {
285
+ requiredArgs(1, arguments);
286
+ var date = toDate(dirtyDate);
287
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
288
+
289
+ // Round the number of days to the nearest integer
290
+ // because the number of milliseconds in a week is not constant
291
+ // (e.g. it's different in the week of the daylight saving time clock shift)
292
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
293
+ }
294
+
295
+ function startOfUTCWeek(dirtyDate, options) {
296
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
297
+ requiredArgs(1, arguments);
298
+ var defaultOptions = getDefaultOptions();
299
+ 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);
300
+
301
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
302
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
303
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
304
+ }
305
+ var date = toDate(dirtyDate);
306
+ var day = date.getUTCDay();
307
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
308
+ date.setUTCDate(date.getUTCDate() - diff);
309
+ date.setUTCHours(0, 0, 0, 0);
310
+ return date;
311
+ }
312
+
313
+ function getUTCWeekYear(dirtyDate, options) {
314
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
315
+ requiredArgs(1, arguments);
316
+ var date = toDate(dirtyDate);
317
+ var year = date.getUTCFullYear();
318
+ var defaultOptions = getDefaultOptions();
319
+ 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);
320
+
321
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
322
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
323
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
324
+ }
325
+ var firstWeekOfNextYear = new Date(0);
326
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
327
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
328
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
329
+ var firstWeekOfThisYear = new Date(0);
330
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
331
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
332
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
333
+ if (date.getTime() >= startOfNextYear.getTime()) {
334
+ return year + 1;
335
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
336
+ return year;
337
+ } else {
338
+ return year - 1;
339
+ }
340
+ }
341
+
342
+ function startOfUTCWeekYear(dirtyDate, options) {
343
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
344
+ requiredArgs(1, arguments);
345
+ var defaultOptions = getDefaultOptions();
346
+ 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);
347
+ var year = getUTCWeekYear(dirtyDate, options);
348
+ var firstWeek = new Date(0);
349
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
350
+ firstWeek.setUTCHours(0, 0, 0, 0);
351
+ var date = startOfUTCWeek(firstWeek, options);
352
+ return date;
353
+ }
354
+
355
+ var MILLISECONDS_IN_WEEK = 604800000;
356
+ function getUTCWeek(dirtyDate, options) {
357
+ requiredArgs(1, arguments);
358
+ var date = toDate(dirtyDate);
359
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
360
+
361
+ // Round the number of days to the nearest integer
362
+ // because the number of milliseconds in a week is not constant
363
+ // (e.g. it's different in the week of the daylight saving time clock shift)
364
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
365
+ }
366
+
367
+ function addLeadingZeros(number, targetLength) {
368
+ var sign = number < 0 ? '-' : '';
369
+ var output = Math.abs(number).toString();
370
+ while (output.length < targetLength) {
371
+ output = '0' + output;
372
+ }
373
+ return sign + output;
374
+ }
375
+
376
+ /*
377
+ * | | Unit | | Unit |
378
+ * |-----|--------------------------------|-----|--------------------------------|
379
+ * | a | AM, PM | A* | |
380
+ * | d | Day of month | D | |
381
+ * | h | Hour [1-12] | H | Hour [0-23] |
382
+ * | m | Minute | M | Month |
383
+ * | s | Second | S | Fraction of second |
384
+ * | y | Year (abs) | Y | |
385
+ *
386
+ * Letters marked by * are not implemented but reserved by Unicode standard.
387
+ */
388
+ var formatters$1 = {
389
+ // Year
390
+ y: function y(date, token) {
391
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
392
+ // | Year | y | yy | yyy | yyyy | yyyyy |
393
+ // |----------|-------|----|-------|-------|-------|
394
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
395
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
396
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
397
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
398
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
399
+
400
+ var signedYear = date.getUTCFullYear();
401
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
402
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
403
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
404
+ },
405
+ // Month
406
+ M: function M(date, token) {
407
+ var month = date.getUTCMonth();
408
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
409
+ },
410
+ // Day of the month
411
+ d: function d(date, token) {
412
+ return addLeadingZeros(date.getUTCDate(), token.length);
413
+ },
414
+ // AM or PM
415
+ a: function a(date, token) {
416
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
417
+ switch (token) {
418
+ case 'a':
419
+ case 'aa':
420
+ return dayPeriodEnumValue.toUpperCase();
421
+ case 'aaa':
422
+ return dayPeriodEnumValue;
423
+ case 'aaaaa':
424
+ return dayPeriodEnumValue[0];
425
+ case 'aaaa':
426
+ default:
427
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
428
+ }
429
+ },
430
+ // Hour [1-12]
431
+ h: function h(date, token) {
432
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
433
+ },
434
+ // Hour [0-23]
435
+ H: function H(date, token) {
436
+ return addLeadingZeros(date.getUTCHours(), token.length);
437
+ },
438
+ // Minute
439
+ m: function m(date, token) {
440
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
441
+ },
442
+ // Second
443
+ s: function s(date, token) {
444
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
445
+ },
446
+ // Fraction of second
447
+ S: function S(date, token) {
448
+ var numberOfDigits = token.length;
449
+ var milliseconds = date.getUTCMilliseconds();
450
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
451
+ return addLeadingZeros(fractionalSeconds, token.length);
452
+ }
453
+ };
454
+
455
+ var dayPeriodEnum = {
456
+ am: 'am',
457
+ pm: 'pm',
458
+ midnight: 'midnight',
459
+ noon: 'noon',
460
+ morning: 'morning',
461
+ afternoon: 'afternoon',
462
+ evening: 'evening',
463
+ night: 'night'
464
+ };
465
+ /*
466
+ * | | Unit | | Unit |
467
+ * |-----|--------------------------------|-----|--------------------------------|
468
+ * | a | AM, PM | A* | Milliseconds in day |
469
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
470
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
471
+ * | d | Day of month | D | Day of year |
472
+ * | e | Local day of week | E | Day of week |
473
+ * | f | | F* | Day of week in month |
474
+ * | g* | Modified Julian day | G | Era |
475
+ * | h | Hour [1-12] | H | Hour [0-23] |
476
+ * | i! | ISO day of week | I! | ISO week of year |
477
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
478
+ * | k | Hour [1-24] | K | Hour [0-11] |
479
+ * | l* | (deprecated) | L | Stand-alone month |
480
+ * | m | Minute | M | Month |
481
+ * | n | | N | |
482
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
483
+ * | p! | Long localized time | P! | Long localized date |
484
+ * | q | Stand-alone quarter | Q | Quarter |
485
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
486
+ * | s | Second | S | Fraction of second |
487
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
488
+ * | u | Extended year | U* | Cyclic year |
489
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
490
+ * | w | Local week of year | W* | Week of month |
491
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
492
+ * | y | Year (abs) | Y | Local week-numbering year |
493
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
494
+ *
495
+ * Letters marked by * are not implemented but reserved by Unicode standard.
496
+ *
497
+ * Letters marked by ! are non-standard, but implemented by date-fns:
498
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
499
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
500
+ * i.e. 7 for Sunday, 1 for Monday, etc.
501
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
502
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
503
+ * `R` is supposed to be used in conjunction with `I` and `i`
504
+ * for universal ISO week-numbering date, whereas
505
+ * `Y` is supposed to be used in conjunction with `w` and `e`
506
+ * for week-numbering date specific to the locale.
507
+ * - `P` is long localized date format
508
+ * - `p` is long localized time format
509
+ */
510
+
511
+ var formatters = {
512
+ // Era
513
+ G: function G(date, token, localize) {
514
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
515
+ switch (token) {
516
+ // AD, BC
517
+ case 'G':
518
+ case 'GG':
519
+ case 'GGG':
520
+ return localize.era(era, {
521
+ width: 'abbreviated'
522
+ });
523
+ // A, B
524
+ case 'GGGGG':
525
+ return localize.era(era, {
526
+ width: 'narrow'
527
+ });
528
+ // Anno Domini, Before Christ
529
+ case 'GGGG':
530
+ default:
531
+ return localize.era(era, {
532
+ width: 'wide'
533
+ });
534
+ }
535
+ },
536
+ // Year
537
+ y: function y(date, token, localize) {
538
+ // Ordinal number
539
+ if (token === 'yo') {
540
+ var signedYear = date.getUTCFullYear();
541
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
542
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
543
+ return localize.ordinalNumber(year, {
544
+ unit: 'year'
545
+ });
546
+ }
547
+ return formatters$1.y(date, token);
548
+ },
549
+ // Local week-numbering year
550
+ Y: function Y(date, token, localize, options) {
551
+ var signedWeekYear = getUTCWeekYear(date, options);
552
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
553
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
554
+
555
+ // Two digit year
556
+ if (token === 'YY') {
557
+ var twoDigitYear = weekYear % 100;
558
+ return addLeadingZeros(twoDigitYear, 2);
559
+ }
560
+
561
+ // Ordinal number
562
+ if (token === 'Yo') {
563
+ return localize.ordinalNumber(weekYear, {
564
+ unit: 'year'
565
+ });
566
+ }
567
+
568
+ // Padding
569
+ return addLeadingZeros(weekYear, token.length);
570
+ },
571
+ // ISO week-numbering year
572
+ R: function R(date, token) {
573
+ var isoWeekYear = getUTCISOWeekYear(date);
574
+
575
+ // Padding
576
+ return addLeadingZeros(isoWeekYear, token.length);
577
+ },
578
+ // Extended year. This is a single number designating the year of this calendar system.
579
+ // The main difference between `y` and `u` localizers are B.C. years:
580
+ // | Year | `y` | `u` |
581
+ // |------|-----|-----|
582
+ // | AC 1 | 1 | 1 |
583
+ // | BC 1 | 1 | 0 |
584
+ // | BC 2 | 2 | -1 |
585
+ // Also `yy` always returns the last two digits of a year,
586
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
587
+ u: function u(date, token) {
588
+ var year = date.getUTCFullYear();
589
+ return addLeadingZeros(year, token.length);
590
+ },
591
+ // Quarter
592
+ Q: function Q(date, token, localize) {
593
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
594
+ switch (token) {
595
+ // 1, 2, 3, 4
596
+ case 'Q':
597
+ return String(quarter);
598
+ // 01, 02, 03, 04
599
+ case 'QQ':
600
+ return addLeadingZeros(quarter, 2);
601
+ // 1st, 2nd, 3rd, 4th
602
+ case 'Qo':
603
+ return localize.ordinalNumber(quarter, {
604
+ unit: 'quarter'
605
+ });
606
+ // Q1, Q2, Q3, Q4
607
+ case 'QQQ':
608
+ return localize.quarter(quarter, {
609
+ width: 'abbreviated',
610
+ context: 'formatting'
611
+ });
612
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
613
+ case 'QQQQQ':
614
+ return localize.quarter(quarter, {
615
+ width: 'narrow',
616
+ context: 'formatting'
617
+ });
618
+ // 1st quarter, 2nd quarter, ...
619
+ case 'QQQQ':
620
+ default:
621
+ return localize.quarter(quarter, {
622
+ width: 'wide',
623
+ context: 'formatting'
624
+ });
625
+ }
626
+ },
627
+ // Stand-alone quarter
628
+ q: function q(date, token, localize) {
629
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
630
+ switch (token) {
631
+ // 1, 2, 3, 4
632
+ case 'q':
633
+ return String(quarter);
634
+ // 01, 02, 03, 04
635
+ case 'qq':
636
+ return addLeadingZeros(quarter, 2);
637
+ // 1st, 2nd, 3rd, 4th
638
+ case 'qo':
639
+ return localize.ordinalNumber(quarter, {
640
+ unit: 'quarter'
641
+ });
642
+ // Q1, Q2, Q3, Q4
643
+ case 'qqq':
644
+ return localize.quarter(quarter, {
645
+ width: 'abbreviated',
646
+ context: 'standalone'
647
+ });
648
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
649
+ case 'qqqqq':
650
+ return localize.quarter(quarter, {
651
+ width: 'narrow',
652
+ context: 'standalone'
653
+ });
654
+ // 1st quarter, 2nd quarter, ...
655
+ case 'qqqq':
656
+ default:
657
+ return localize.quarter(quarter, {
658
+ width: 'wide',
659
+ context: 'standalone'
660
+ });
661
+ }
662
+ },
663
+ // Month
664
+ M: function M(date, token, localize) {
665
+ var month = date.getUTCMonth();
666
+ switch (token) {
667
+ case 'M':
668
+ case 'MM':
669
+ return formatters$1.M(date, token);
670
+ // 1st, 2nd, ..., 12th
671
+ case 'Mo':
672
+ return localize.ordinalNumber(month + 1, {
673
+ unit: 'month'
674
+ });
675
+ // Jan, Feb, ..., Dec
676
+ case 'MMM':
677
+ return localize.month(month, {
678
+ width: 'abbreviated',
679
+ context: 'formatting'
680
+ });
681
+ // J, F, ..., D
682
+ case 'MMMMM':
683
+ return localize.month(month, {
684
+ width: 'narrow',
685
+ context: 'formatting'
686
+ });
687
+ // January, February, ..., December
688
+ case 'MMMM':
689
+ default:
690
+ return localize.month(month, {
691
+ width: 'wide',
692
+ context: 'formatting'
693
+ });
694
+ }
695
+ },
696
+ // Stand-alone month
697
+ L: function L(date, token, localize) {
698
+ var month = date.getUTCMonth();
699
+ switch (token) {
700
+ // 1, 2, ..., 12
701
+ case 'L':
702
+ return String(month + 1);
703
+ // 01, 02, ..., 12
704
+ case 'LL':
705
+ return addLeadingZeros(month + 1, 2);
706
+ // 1st, 2nd, ..., 12th
707
+ case 'Lo':
708
+ return localize.ordinalNumber(month + 1, {
709
+ unit: 'month'
710
+ });
711
+ // Jan, Feb, ..., Dec
712
+ case 'LLL':
713
+ return localize.month(month, {
714
+ width: 'abbreviated',
715
+ context: 'standalone'
716
+ });
717
+ // J, F, ..., D
718
+ case 'LLLLL':
719
+ return localize.month(month, {
720
+ width: 'narrow',
721
+ context: 'standalone'
722
+ });
723
+ // January, February, ..., December
724
+ case 'LLLL':
725
+ default:
726
+ return localize.month(month, {
727
+ width: 'wide',
728
+ context: 'standalone'
729
+ });
730
+ }
731
+ },
732
+ // Local week of year
733
+ w: function w(date, token, localize, options) {
734
+ var week = getUTCWeek(date, options);
735
+ if (token === 'wo') {
736
+ return localize.ordinalNumber(week, {
737
+ unit: 'week'
738
+ });
739
+ }
740
+ return addLeadingZeros(week, token.length);
741
+ },
742
+ // ISO week of year
743
+ I: function I(date, token, localize) {
744
+ var isoWeek = getUTCISOWeek(date);
745
+ if (token === 'Io') {
746
+ return localize.ordinalNumber(isoWeek, {
747
+ unit: 'week'
748
+ });
749
+ }
750
+ return addLeadingZeros(isoWeek, token.length);
751
+ },
752
+ // Day of the month
753
+ d: function d(date, token, localize) {
754
+ if (token === 'do') {
755
+ return localize.ordinalNumber(date.getUTCDate(), {
756
+ unit: 'date'
757
+ });
758
+ }
759
+ return formatters$1.d(date, token);
760
+ },
761
+ // Day of year
762
+ D: function D(date, token, localize) {
763
+ var dayOfYear = getUTCDayOfYear(date);
764
+ if (token === 'Do') {
765
+ return localize.ordinalNumber(dayOfYear, {
766
+ unit: 'dayOfYear'
767
+ });
768
+ }
769
+ return addLeadingZeros(dayOfYear, token.length);
770
+ },
771
+ // Day of week
772
+ E: function E(date, token, localize) {
773
+ var dayOfWeek = date.getUTCDay();
774
+ switch (token) {
775
+ // Tue
776
+ case 'E':
777
+ case 'EE':
778
+ case 'EEE':
779
+ return localize.day(dayOfWeek, {
780
+ width: 'abbreviated',
781
+ context: 'formatting'
782
+ });
783
+ // T
784
+ case 'EEEEE':
785
+ return localize.day(dayOfWeek, {
786
+ width: 'narrow',
787
+ context: 'formatting'
788
+ });
789
+ // Tu
790
+ case 'EEEEEE':
791
+ return localize.day(dayOfWeek, {
792
+ width: 'short',
793
+ context: 'formatting'
794
+ });
795
+ // Tuesday
796
+ case 'EEEE':
797
+ default:
798
+ return localize.day(dayOfWeek, {
799
+ width: 'wide',
800
+ context: 'formatting'
801
+ });
802
+ }
803
+ },
804
+ // Local day of week
805
+ e: function e(date, token, localize, options) {
806
+ var dayOfWeek = date.getUTCDay();
807
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
808
+ switch (token) {
809
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
810
+ case 'e':
811
+ return String(localDayOfWeek);
812
+ // Padded numerical value
813
+ case 'ee':
814
+ return addLeadingZeros(localDayOfWeek, 2);
815
+ // 1st, 2nd, ..., 7th
816
+ case 'eo':
817
+ return localize.ordinalNumber(localDayOfWeek, {
818
+ unit: 'day'
819
+ });
820
+ case 'eee':
821
+ return localize.day(dayOfWeek, {
822
+ width: 'abbreviated',
823
+ context: 'formatting'
824
+ });
825
+ // T
826
+ case 'eeeee':
827
+ return localize.day(dayOfWeek, {
828
+ width: 'narrow',
829
+ context: 'formatting'
830
+ });
831
+ // Tu
832
+ case 'eeeeee':
833
+ return localize.day(dayOfWeek, {
834
+ width: 'short',
835
+ context: 'formatting'
836
+ });
837
+ // Tuesday
838
+ case 'eeee':
839
+ default:
840
+ return localize.day(dayOfWeek, {
841
+ width: 'wide',
842
+ context: 'formatting'
843
+ });
844
+ }
845
+ },
846
+ // Stand-alone local day of week
847
+ c: function c(date, token, localize, options) {
848
+ var dayOfWeek = date.getUTCDay();
849
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
850
+ switch (token) {
851
+ // Numerical value (same as in `e`)
852
+ case 'c':
853
+ return String(localDayOfWeek);
854
+ // Padded numerical value
855
+ case 'cc':
856
+ return addLeadingZeros(localDayOfWeek, token.length);
857
+ // 1st, 2nd, ..., 7th
858
+ case 'co':
859
+ return localize.ordinalNumber(localDayOfWeek, {
860
+ unit: 'day'
861
+ });
862
+ case 'ccc':
863
+ return localize.day(dayOfWeek, {
864
+ width: 'abbreviated',
865
+ context: 'standalone'
866
+ });
867
+ // T
868
+ case 'ccccc':
869
+ return localize.day(dayOfWeek, {
870
+ width: 'narrow',
871
+ context: 'standalone'
872
+ });
873
+ // Tu
874
+ case 'cccccc':
875
+ return localize.day(dayOfWeek, {
876
+ width: 'short',
877
+ context: 'standalone'
878
+ });
879
+ // Tuesday
880
+ case 'cccc':
881
+ default:
882
+ return localize.day(dayOfWeek, {
883
+ width: 'wide',
884
+ context: 'standalone'
885
+ });
886
+ }
887
+ },
888
+ // ISO day of week
889
+ i: function i(date, token, localize) {
890
+ var dayOfWeek = date.getUTCDay();
891
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
892
+ switch (token) {
893
+ // 2
894
+ case 'i':
895
+ return String(isoDayOfWeek);
896
+ // 02
897
+ case 'ii':
898
+ return addLeadingZeros(isoDayOfWeek, token.length);
899
+ // 2nd
900
+ case 'io':
901
+ return localize.ordinalNumber(isoDayOfWeek, {
902
+ unit: 'day'
903
+ });
904
+ // Tue
905
+ case 'iii':
906
+ return localize.day(dayOfWeek, {
907
+ width: 'abbreviated',
908
+ context: 'formatting'
909
+ });
910
+ // T
911
+ case 'iiiii':
912
+ return localize.day(dayOfWeek, {
913
+ width: 'narrow',
914
+ context: 'formatting'
915
+ });
916
+ // Tu
917
+ case 'iiiiii':
918
+ return localize.day(dayOfWeek, {
919
+ width: 'short',
920
+ context: 'formatting'
921
+ });
922
+ // Tuesday
923
+ case 'iiii':
924
+ default:
925
+ return localize.day(dayOfWeek, {
926
+ width: 'wide',
927
+ context: 'formatting'
928
+ });
929
+ }
930
+ },
931
+ // AM or PM
932
+ a: function a(date, token, localize) {
933
+ var hours = date.getUTCHours();
934
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
935
+ switch (token) {
936
+ case 'a':
937
+ case 'aa':
938
+ return localize.dayPeriod(dayPeriodEnumValue, {
939
+ width: 'abbreviated',
940
+ context: 'formatting'
941
+ });
942
+ case 'aaa':
943
+ return localize.dayPeriod(dayPeriodEnumValue, {
944
+ width: 'abbreviated',
945
+ context: 'formatting'
946
+ }).toLowerCase();
947
+ case 'aaaaa':
948
+ return localize.dayPeriod(dayPeriodEnumValue, {
949
+ width: 'narrow',
950
+ context: 'formatting'
951
+ });
952
+ case 'aaaa':
953
+ default:
954
+ return localize.dayPeriod(dayPeriodEnumValue, {
955
+ width: 'wide',
956
+ context: 'formatting'
957
+ });
958
+ }
959
+ },
960
+ // AM, PM, midnight, noon
961
+ b: function b(date, token, localize) {
962
+ var hours = date.getUTCHours();
963
+ var dayPeriodEnumValue;
964
+ if (hours === 12) {
965
+ dayPeriodEnumValue = dayPeriodEnum.noon;
966
+ } else if (hours === 0) {
967
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
968
+ } else {
969
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
970
+ }
971
+ switch (token) {
972
+ case 'b':
973
+ case 'bb':
974
+ return localize.dayPeriod(dayPeriodEnumValue, {
975
+ width: 'abbreviated',
976
+ context: 'formatting'
977
+ });
978
+ case 'bbb':
979
+ return localize.dayPeriod(dayPeriodEnumValue, {
980
+ width: 'abbreviated',
981
+ context: 'formatting'
982
+ }).toLowerCase();
983
+ case 'bbbbb':
984
+ return localize.dayPeriod(dayPeriodEnumValue, {
985
+ width: 'narrow',
986
+ context: 'formatting'
987
+ });
988
+ case 'bbbb':
989
+ default:
990
+ return localize.dayPeriod(dayPeriodEnumValue, {
991
+ width: 'wide',
992
+ context: 'formatting'
993
+ });
994
+ }
995
+ },
996
+ // in the morning, in the afternoon, in the evening, at night
997
+ B: function B(date, token, localize) {
998
+ var hours = date.getUTCHours();
999
+ var dayPeriodEnumValue;
1000
+ if (hours >= 17) {
1001
+ dayPeriodEnumValue = dayPeriodEnum.evening;
1002
+ } else if (hours >= 12) {
1003
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
1004
+ } else if (hours >= 4) {
1005
+ dayPeriodEnumValue = dayPeriodEnum.morning;
1006
+ } else {
1007
+ dayPeriodEnumValue = dayPeriodEnum.night;
1008
+ }
1009
+ switch (token) {
1010
+ case 'B':
1011
+ case 'BB':
1012
+ case 'BBB':
1013
+ return localize.dayPeriod(dayPeriodEnumValue, {
1014
+ width: 'abbreviated',
1015
+ context: 'formatting'
1016
+ });
1017
+ case 'BBBBB':
1018
+ return localize.dayPeriod(dayPeriodEnumValue, {
1019
+ width: 'narrow',
1020
+ context: 'formatting'
1021
+ });
1022
+ case 'BBBB':
1023
+ default:
1024
+ return localize.dayPeriod(dayPeriodEnumValue, {
1025
+ width: 'wide',
1026
+ context: 'formatting'
1027
+ });
1028
+ }
1029
+ },
1030
+ // Hour [1-12]
1031
+ h: function h(date, token, localize) {
1032
+ if (token === 'ho') {
1033
+ var hours = date.getUTCHours() % 12;
1034
+ if (hours === 0) hours = 12;
1035
+ return localize.ordinalNumber(hours, {
1036
+ unit: 'hour'
1037
+ });
1038
+ }
1039
+ return formatters$1.h(date, token);
1040
+ },
1041
+ // Hour [0-23]
1042
+ H: function H(date, token, localize) {
1043
+ if (token === 'Ho') {
1044
+ return localize.ordinalNumber(date.getUTCHours(), {
1045
+ unit: 'hour'
1046
+ });
1047
+ }
1048
+ return formatters$1.H(date, token);
1049
+ },
1050
+ // Hour [0-11]
1051
+ K: function K(date, token, localize) {
1052
+ var hours = date.getUTCHours() % 12;
1053
+ if (token === 'Ko') {
1054
+ return localize.ordinalNumber(hours, {
1055
+ unit: 'hour'
1056
+ });
1057
+ }
1058
+ return addLeadingZeros(hours, token.length);
1059
+ },
1060
+ // Hour [1-24]
1061
+ k: function k(date, token, localize) {
1062
+ var hours = date.getUTCHours();
1063
+ if (hours === 0) hours = 24;
1064
+ if (token === 'ko') {
1065
+ return localize.ordinalNumber(hours, {
1066
+ unit: 'hour'
1067
+ });
1068
+ }
1069
+ return addLeadingZeros(hours, token.length);
1070
+ },
1071
+ // Minute
1072
+ m: function m(date, token, localize) {
1073
+ if (token === 'mo') {
1074
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1075
+ unit: 'minute'
1076
+ });
1077
+ }
1078
+ return formatters$1.m(date, token);
1079
+ },
1080
+ // Second
1081
+ s: function s(date, token, localize) {
1082
+ if (token === 'so') {
1083
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1084
+ unit: 'second'
1085
+ });
1086
+ }
1087
+ return formatters$1.s(date, token);
1088
+ },
1089
+ // Fraction of second
1090
+ S: function S(date, token) {
1091
+ return formatters$1.S(date, token);
1092
+ },
1093
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1094
+ X: function X(date, token, _localize, options) {
1095
+ var originalDate = options._originalDate || date;
1096
+ var timezoneOffset = originalDate.getTimezoneOffset();
1097
+ if (timezoneOffset === 0) {
1098
+ return 'Z';
1099
+ }
1100
+ switch (token) {
1101
+ // Hours and optional minutes
1102
+ case 'X':
1103
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1104
+
1105
+ // Hours, minutes and optional seconds without `:` delimiter
1106
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1107
+ // so this token always has the same output as `XX`
1108
+ case 'XXXX':
1109
+ case 'XX':
1110
+ // Hours and minutes without `:` delimiter
1111
+ return formatTimezone(timezoneOffset);
1112
+
1113
+ // Hours, minutes and optional seconds with `:` delimiter
1114
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1115
+ // so this token always has the same output as `XXX`
1116
+ case 'XXXXX':
1117
+ case 'XXX': // Hours and minutes with `:` delimiter
1118
+ default:
1119
+ return formatTimezone(timezoneOffset, ':');
1120
+ }
1121
+ },
1122
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1123
+ x: function x(date, token, _localize, options) {
1124
+ var originalDate = options._originalDate || date;
1125
+ var timezoneOffset = originalDate.getTimezoneOffset();
1126
+ switch (token) {
1127
+ // Hours and optional minutes
1128
+ case 'x':
1129
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1130
+
1131
+ // Hours, minutes and optional seconds without `:` delimiter
1132
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1133
+ // so this token always has the same output as `xx`
1134
+ case 'xxxx':
1135
+ case 'xx':
1136
+ // Hours and minutes without `:` delimiter
1137
+ return formatTimezone(timezoneOffset);
1138
+
1139
+ // Hours, minutes and optional seconds with `:` delimiter
1140
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1141
+ // so this token always has the same output as `xxx`
1142
+ case 'xxxxx':
1143
+ case 'xxx': // Hours and minutes with `:` delimiter
1144
+ default:
1145
+ return formatTimezone(timezoneOffset, ':');
1146
+ }
1147
+ },
1148
+ // Timezone (GMT)
1149
+ O: function O(date, token, _localize, options) {
1150
+ var originalDate = options._originalDate || date;
1151
+ var timezoneOffset = originalDate.getTimezoneOffset();
1152
+ switch (token) {
1153
+ // Short
1154
+ case 'O':
1155
+ case 'OO':
1156
+ case 'OOO':
1157
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1158
+ // Long
1159
+ case 'OOOO':
1160
+ default:
1161
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1162
+ }
1163
+ },
1164
+ // Timezone (specific non-location)
1165
+ z: function z(date, token, _localize, options) {
1166
+ var originalDate = options._originalDate || date;
1167
+ var timezoneOffset = originalDate.getTimezoneOffset();
1168
+ switch (token) {
1169
+ // Short
1170
+ case 'z':
1171
+ case 'zz':
1172
+ case 'zzz':
1173
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1174
+ // Long
1175
+ case 'zzzz':
1176
+ default:
1177
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1178
+ }
1179
+ },
1180
+ // Seconds timestamp
1181
+ t: function t(date, token, _localize, options) {
1182
+ var originalDate = options._originalDate || date;
1183
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1184
+ return addLeadingZeros(timestamp, token.length);
1185
+ },
1186
+ // Milliseconds timestamp
1187
+ T: function T(date, token, _localize, options) {
1188
+ var originalDate = options._originalDate || date;
1189
+ var timestamp = originalDate.getTime();
1190
+ return addLeadingZeros(timestamp, token.length);
1191
+ }
1192
+ };
1193
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1194
+ var sign = offset > 0 ? '-' : '+';
1195
+ var absOffset = Math.abs(offset);
1196
+ var hours = Math.floor(absOffset / 60);
1197
+ var minutes = absOffset % 60;
1198
+ if (minutes === 0) {
1199
+ return sign + String(hours);
1200
+ }
1201
+ var delimiter = dirtyDelimiter || '';
1202
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1203
+ }
1204
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1205
+ if (offset % 60 === 0) {
1206
+ var sign = offset > 0 ? '-' : '+';
1207
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1208
+ }
1209
+ return formatTimezone(offset, dirtyDelimiter);
1210
+ }
1211
+ function formatTimezone(offset, dirtyDelimiter) {
1212
+ var delimiter = dirtyDelimiter || '';
1213
+ var sign = offset > 0 ? '-' : '+';
1214
+ var absOffset = Math.abs(offset);
1215
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1216
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1217
+ return sign + hours + delimiter + minutes;
1218
+ }
1219
+
1220
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1221
+ switch (pattern) {
1222
+ case 'P':
1223
+ return formatLong.date({
1224
+ width: 'short'
1225
+ });
1226
+ case 'PP':
1227
+ return formatLong.date({
1228
+ width: 'medium'
1229
+ });
1230
+ case 'PPP':
1231
+ return formatLong.date({
1232
+ width: 'long'
1233
+ });
1234
+ case 'PPPP':
1235
+ default:
1236
+ return formatLong.date({
1237
+ width: 'full'
1238
+ });
1239
+ }
1240
+ };
1241
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1242
+ switch (pattern) {
1243
+ case 'p':
1244
+ return formatLong.time({
1245
+ width: 'short'
1246
+ });
1247
+ case 'pp':
1248
+ return formatLong.time({
1249
+ width: 'medium'
1250
+ });
1251
+ case 'ppp':
1252
+ return formatLong.time({
1253
+ width: 'long'
1254
+ });
1255
+ case 'pppp':
1256
+ default:
1257
+ return formatLong.time({
1258
+ width: 'full'
1259
+ });
1260
+ }
1261
+ };
1262
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1263
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1264
+ var datePattern = matchResult[1];
1265
+ var timePattern = matchResult[2];
1266
+ if (!timePattern) {
1267
+ return dateLongFormatter(pattern, formatLong);
1268
+ }
1269
+ var dateTimeFormat;
1270
+ switch (datePattern) {
1271
+ case 'P':
1272
+ dateTimeFormat = formatLong.dateTime({
1273
+ width: 'short'
1274
+ });
1275
+ break;
1276
+ case 'PP':
1277
+ dateTimeFormat = formatLong.dateTime({
1278
+ width: 'medium'
1279
+ });
1280
+ break;
1281
+ case 'PPP':
1282
+ dateTimeFormat = formatLong.dateTime({
1283
+ width: 'long'
1284
+ });
1285
+ break;
1286
+ case 'PPPP':
1287
+ default:
1288
+ dateTimeFormat = formatLong.dateTime({
1289
+ width: 'full'
1290
+ });
1291
+ break;
1292
+ }
1293
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1294
+ };
1295
+ var longFormatters = {
1296
+ p: timeLongFormatter,
1297
+ P: dateTimeLongFormatter
1298
+ };
1299
+
1300
+ var protectedDayOfYearTokens = ['D', 'DD'];
1301
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1302
+ function isProtectedDayOfYearToken(token) {
1303
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1304
+ }
1305
+ function isProtectedWeekYearToken(token) {
1306
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1307
+ }
1308
+ function throwProtectedError(token, format, input) {
1309
+ if (token === 'YYYY') {
1310
+ 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"));
1311
+ } else if (token === 'YY') {
1312
+ 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"));
1313
+ } else if (token === 'D') {
1314
+ 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"));
1315
+ } else if (token === 'DD') {
1316
+ 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"));
1317
+ }
1318
+ }
1319
+
1320
+ var formatDistanceLocale = {
1321
+ lessThanXSeconds: {
1322
+ one: 'less than a second',
1323
+ other: 'less than {{count}} seconds'
1324
+ },
1325
+ xSeconds: {
1326
+ one: '1 second',
1327
+ other: '{{count}} seconds'
1328
+ },
1329
+ halfAMinute: 'half a minute',
1330
+ lessThanXMinutes: {
1331
+ one: 'less than a minute',
1332
+ other: 'less than {{count}} minutes'
1333
+ },
1334
+ xMinutes: {
1335
+ one: '1 minute',
1336
+ other: '{{count}} minutes'
1337
+ },
1338
+ aboutXHours: {
1339
+ one: 'about 1 hour',
1340
+ other: 'about {{count}} hours'
1341
+ },
1342
+ xHours: {
1343
+ one: '1 hour',
1344
+ other: '{{count}} hours'
1345
+ },
1346
+ xDays: {
1347
+ one: '1 day',
1348
+ other: '{{count}} days'
1349
+ },
1350
+ aboutXWeeks: {
1351
+ one: 'about 1 week',
1352
+ other: 'about {{count}} weeks'
1353
+ },
1354
+ xWeeks: {
1355
+ one: '1 week',
1356
+ other: '{{count}} weeks'
1357
+ },
1358
+ aboutXMonths: {
1359
+ one: 'about 1 month',
1360
+ other: 'about {{count}} months'
1361
+ },
1362
+ xMonths: {
1363
+ one: '1 month',
1364
+ other: '{{count}} months'
1365
+ },
1366
+ aboutXYears: {
1367
+ one: 'about 1 year',
1368
+ other: 'about {{count}} years'
1369
+ },
1370
+ xYears: {
1371
+ one: '1 year',
1372
+ other: '{{count}} years'
1373
+ },
1374
+ overXYears: {
1375
+ one: 'over 1 year',
1376
+ other: 'over {{count}} years'
1377
+ },
1378
+ almostXYears: {
1379
+ one: 'almost 1 year',
1380
+ other: 'almost {{count}} years'
1381
+ }
1382
+ };
1383
+ var formatDistance = function formatDistance(token, count, options) {
1384
+ var result;
1385
+ var tokenValue = formatDistanceLocale[token];
1386
+ if (typeof tokenValue === 'string') {
1387
+ result = tokenValue;
1388
+ } else if (count === 1) {
1389
+ result = tokenValue.one;
1390
+ } else {
1391
+ result = tokenValue.other.replace('{{count}}', count.toString());
1392
+ }
1393
+ if (options !== null && options !== void 0 && options.addSuffix) {
1394
+ if (options.comparison && options.comparison > 0) {
1395
+ return 'in ' + result;
1396
+ } else {
1397
+ return result + ' ago';
1398
+ }
1399
+ }
1400
+ return result;
1401
+ };
1402
+
1403
+ function buildFormatLongFn(args) {
1404
+ return function () {
1405
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1406
+ // TODO: Remove String()
1407
+ var width = options.width ? String(options.width) : args.defaultWidth;
1408
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1409
+ return format;
1410
+ };
1411
+ }
1412
+
1413
+ var dateFormats = {
1414
+ full: 'EEEE, MMMM do, y',
1415
+ long: 'MMMM do, y',
1416
+ medium: 'MMM d, y',
1417
+ short: 'MM/dd/yyyy'
1418
+ };
1419
+ var timeFormats = {
1420
+ full: 'h:mm:ss a zzzz',
1421
+ long: 'h:mm:ss a z',
1422
+ medium: 'h:mm:ss a',
1423
+ short: 'h:mm a'
1424
+ };
1425
+ var dateTimeFormats = {
1426
+ full: "{{date}} 'at' {{time}}",
1427
+ long: "{{date}} 'at' {{time}}",
1428
+ medium: '{{date}}, {{time}}',
1429
+ short: '{{date}}, {{time}}'
1430
+ };
1431
+ var formatLong = {
1432
+ date: buildFormatLongFn({
1433
+ formats: dateFormats,
1434
+ defaultWidth: 'full'
1435
+ }),
1436
+ time: buildFormatLongFn({
1437
+ formats: timeFormats,
1438
+ defaultWidth: 'full'
1439
+ }),
1440
+ dateTime: buildFormatLongFn({
1441
+ formats: dateTimeFormats,
1442
+ defaultWidth: 'full'
1443
+ })
1444
+ };
1445
+
1446
+ var formatRelativeLocale = {
1447
+ lastWeek: "'last' eeee 'at' p",
1448
+ yesterday: "'yesterday at' p",
1449
+ today: "'today at' p",
1450
+ tomorrow: "'tomorrow at' p",
1451
+ nextWeek: "eeee 'at' p",
1452
+ other: 'P'
1453
+ };
1454
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1455
+ return formatRelativeLocale[token];
1456
+ };
1457
+
1458
+ function buildLocalizeFn(args) {
1459
+ return function (dirtyIndex, options) {
1460
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1461
+ var valuesArray;
1462
+ if (context === 'formatting' && args.formattingValues) {
1463
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1464
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1465
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1466
+ } else {
1467
+ var _defaultWidth = args.defaultWidth;
1468
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1469
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1470
+ }
1471
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1472
+ // @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!
1473
+ return valuesArray[index];
1474
+ };
1475
+ }
1476
+
1477
+ var eraValues = {
1478
+ narrow: ['B', 'A'],
1479
+ abbreviated: ['BC', 'AD'],
1480
+ wide: ['Before Christ', 'Anno Domini']
1481
+ };
1482
+ var quarterValues = {
1483
+ narrow: ['1', '2', '3', '4'],
1484
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1485
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1486
+ };
1487
+
1488
+ // Note: in English, the names of days of the week and months are capitalized.
1489
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1490
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1491
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1492
+ var monthValues = {
1493
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1494
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1495
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1496
+ };
1497
+ var dayValues = {
1498
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1499
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1500
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1501
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1502
+ };
1503
+ var dayPeriodValues = {
1504
+ narrow: {
1505
+ am: 'a',
1506
+ pm: 'p',
1507
+ midnight: 'mi',
1508
+ noon: 'n',
1509
+ morning: 'morning',
1510
+ afternoon: 'afternoon',
1511
+ evening: 'evening',
1512
+ night: 'night'
1513
+ },
1514
+ abbreviated: {
1515
+ am: 'AM',
1516
+ pm: 'PM',
1517
+ midnight: 'midnight',
1518
+ noon: 'noon',
1519
+ morning: 'morning',
1520
+ afternoon: 'afternoon',
1521
+ evening: 'evening',
1522
+ night: 'night'
1523
+ },
1524
+ wide: {
1525
+ am: 'a.m.',
1526
+ pm: 'p.m.',
1527
+ midnight: 'midnight',
1528
+ noon: 'noon',
1529
+ morning: 'morning',
1530
+ afternoon: 'afternoon',
1531
+ evening: 'evening',
1532
+ night: 'night'
1533
+ }
1534
+ };
1535
+ var formattingDayPeriodValues = {
1536
+ narrow: {
1537
+ am: 'a',
1538
+ pm: 'p',
1539
+ midnight: 'mi',
1540
+ noon: 'n',
1541
+ morning: 'in the morning',
1542
+ afternoon: 'in the afternoon',
1543
+ evening: 'in the evening',
1544
+ night: 'at night'
1545
+ },
1546
+ abbreviated: {
1547
+ am: 'AM',
1548
+ pm: 'PM',
1549
+ midnight: 'midnight',
1550
+ noon: 'noon',
1551
+ morning: 'in the morning',
1552
+ afternoon: 'in the afternoon',
1553
+ evening: 'in the evening',
1554
+ night: 'at night'
1555
+ },
1556
+ wide: {
1557
+ am: 'a.m.',
1558
+ pm: 'p.m.',
1559
+ midnight: 'midnight',
1560
+ noon: 'noon',
1561
+ morning: 'in the morning',
1562
+ afternoon: 'in the afternoon',
1563
+ evening: 'in the evening',
1564
+ night: 'at night'
1565
+ }
1566
+ };
1567
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1568
+ var number = Number(dirtyNumber);
1569
+
1570
+ // If ordinal numbers depend on context, for example,
1571
+ // if they are different for different grammatical genders,
1572
+ // use `options.unit`.
1573
+ //
1574
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1575
+ // 'day', 'hour', 'minute', 'second'.
1576
+
1577
+ var rem100 = number % 100;
1578
+ if (rem100 > 20 || rem100 < 10) {
1579
+ switch (rem100 % 10) {
1580
+ case 1:
1581
+ return number + 'st';
1582
+ case 2:
1583
+ return number + 'nd';
1584
+ case 3:
1585
+ return number + 'rd';
1586
+ }
1587
+ }
1588
+ return number + 'th';
1589
+ };
1590
+ var localize = {
1591
+ ordinalNumber: ordinalNumber,
1592
+ era: buildLocalizeFn({
1593
+ values: eraValues,
1594
+ defaultWidth: 'wide'
1595
+ }),
1596
+ quarter: buildLocalizeFn({
1597
+ values: quarterValues,
1598
+ defaultWidth: 'wide',
1599
+ argumentCallback: function argumentCallback(quarter) {
1600
+ return quarter - 1;
1601
+ }
1602
+ }),
1603
+ month: buildLocalizeFn({
1604
+ values: monthValues,
1605
+ defaultWidth: 'wide'
1606
+ }),
1607
+ day: buildLocalizeFn({
1608
+ values: dayValues,
1609
+ defaultWidth: 'wide'
1610
+ }),
1611
+ dayPeriod: buildLocalizeFn({
1612
+ values: dayPeriodValues,
1613
+ defaultWidth: 'wide',
1614
+ formattingValues: formattingDayPeriodValues,
1615
+ defaultFormattingWidth: 'wide'
1616
+ })
1617
+ };
1618
+
1619
+ function buildMatchFn(args) {
1620
+ return function (string) {
1621
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1622
+ var width = options.width;
1623
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1624
+ var matchResult = string.match(matchPattern);
1625
+ if (!matchResult) {
1626
+ return null;
1627
+ }
1628
+ var matchedString = matchResult[0];
1629
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1630
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1631
+ return pattern.test(matchedString);
1632
+ }) : findKey(parsePatterns, function (pattern) {
1633
+ return pattern.test(matchedString);
1634
+ });
1635
+ var value;
1636
+ value = args.valueCallback ? args.valueCallback(key) : key;
1637
+ value = options.valueCallback ? options.valueCallback(value) : value;
1638
+ var rest = string.slice(matchedString.length);
1639
+ return {
1640
+ value: value,
1641
+ rest: rest
1642
+ };
1643
+ };
1644
+ }
1645
+ function findKey(object, predicate) {
1646
+ for (var key in object) {
1647
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
1648
+ return key;
1649
+ }
1650
+ }
1651
+ return undefined;
1652
+ }
1653
+ function findIndex(array, predicate) {
1654
+ for (var key = 0; key < array.length; key++) {
1655
+ if (predicate(array[key])) {
1656
+ return key;
1657
+ }
1658
+ }
1659
+ return undefined;
1660
+ }
1661
+
1662
+ function buildMatchPatternFn(args) {
1663
+ return function (string) {
1664
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1665
+ var matchResult = string.match(args.matchPattern);
1666
+ if (!matchResult) return null;
1667
+ var matchedString = matchResult[0];
1668
+ var parseResult = string.match(args.parsePattern);
1669
+ if (!parseResult) return null;
1670
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1671
+ value = options.valueCallback ? options.valueCallback(value) : value;
1672
+ var rest = string.slice(matchedString.length);
1673
+ return {
1674
+ value: value,
1675
+ rest: rest
1676
+ };
1677
+ };
1678
+ }
1679
+
1680
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1681
+ var parseOrdinalNumberPattern = /\d+/i;
1682
+ var matchEraPatterns = {
1683
+ narrow: /^(b|a)/i,
1684
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1685
+ wide: /^(before christ|before common era|anno domini|common era)/i
1686
+ };
1687
+ var parseEraPatterns = {
1688
+ any: [/^b/i, /^(a|c)/i]
1689
+ };
1690
+ var matchQuarterPatterns = {
1691
+ narrow: /^[1234]/i,
1692
+ abbreviated: /^q[1234]/i,
1693
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1694
+ };
1695
+ var parseQuarterPatterns = {
1696
+ any: [/1/i, /2/i, /3/i, /4/i]
1697
+ };
1698
+ var matchMonthPatterns = {
1699
+ narrow: /^[jfmasond]/i,
1700
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1701
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1702
+ };
1703
+ var parseMonthPatterns = {
1704
+ 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],
1705
+ 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]
1706
+ };
1707
+ var matchDayPatterns = {
1708
+ narrow: /^[smtwf]/i,
1709
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1710
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1711
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1712
+ };
1713
+ var parseDayPatterns = {
1714
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1715
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1716
+ };
1717
+ var matchDayPeriodPatterns = {
1718
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1719
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1720
+ };
1721
+ var parseDayPeriodPatterns = {
1722
+ any: {
1723
+ am: /^a/i,
1724
+ pm: /^p/i,
1725
+ midnight: /^mi/i,
1726
+ noon: /^no/i,
1727
+ morning: /morning/i,
1728
+ afternoon: /afternoon/i,
1729
+ evening: /evening/i,
1730
+ night: /night/i
1731
+ }
1732
+ };
1733
+ var match = {
1734
+ ordinalNumber: buildMatchPatternFn({
1735
+ matchPattern: matchOrdinalNumberPattern,
1736
+ parsePattern: parseOrdinalNumberPattern,
1737
+ valueCallback: function valueCallback(value) {
1738
+ return parseInt(value, 10);
1739
+ }
1740
+ }),
1741
+ era: buildMatchFn({
1742
+ matchPatterns: matchEraPatterns,
1743
+ defaultMatchWidth: 'wide',
1744
+ parsePatterns: parseEraPatterns,
1745
+ defaultParseWidth: 'any'
1746
+ }),
1747
+ quarter: buildMatchFn({
1748
+ matchPatterns: matchQuarterPatterns,
1749
+ defaultMatchWidth: 'wide',
1750
+ parsePatterns: parseQuarterPatterns,
1751
+ defaultParseWidth: 'any',
1752
+ valueCallback: function valueCallback(index) {
1753
+ return index + 1;
1754
+ }
1755
+ }),
1756
+ month: buildMatchFn({
1757
+ matchPatterns: matchMonthPatterns,
1758
+ defaultMatchWidth: 'wide',
1759
+ parsePatterns: parseMonthPatterns,
1760
+ defaultParseWidth: 'any'
1761
+ }),
1762
+ day: buildMatchFn({
1763
+ matchPatterns: matchDayPatterns,
1764
+ defaultMatchWidth: 'wide',
1765
+ parsePatterns: parseDayPatterns,
1766
+ defaultParseWidth: 'any'
1767
+ }),
1768
+ dayPeriod: buildMatchFn({
1769
+ matchPatterns: matchDayPeriodPatterns,
1770
+ defaultMatchWidth: 'any',
1771
+ parsePatterns: parseDayPeriodPatterns,
1772
+ defaultParseWidth: 'any'
1773
+ })
1774
+ };
1775
+
1776
+ /**
1777
+ * @type {Locale}
1778
+ * @category Locales
1779
+ * @summary English locale (United States).
1780
+ * @language English
1781
+ * @iso-639-2 eng
1782
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
1783
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
1784
+ */
1785
+ var locale = {
1786
+ code: 'en-US',
1787
+ formatDistance: formatDistance,
1788
+ formatLong: formatLong,
1789
+ formatRelative: formatRelative,
1790
+ localize: localize,
1791
+ match: match,
1792
+ options: {
1793
+ weekStartsOn: 0 /* Sunday */,
1794
+ firstWeekContainsDate: 1
1795
+ }
1796
+ };
1797
+
1798
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
1799
+ // (one of the certain letters followed by `o`)
1800
+ // - (\w)\1* matches any sequences of the same letter
1801
+ // - '' matches two quote characters in a row
1802
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
1803
+ // except a single quote symbol, which ends the sequence.
1804
+ // Two quote characters do not end the sequence.
1805
+ // If there is no matching single quote
1806
+ // then the sequence will continue until the end of the string.
1807
+ // - . matches any single character unmatched by previous parts of the RegExps
1808
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
1809
+
1810
+ // This RegExp catches symbols escaped by quotes, and also
1811
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
1812
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
1813
+ var escapedStringRegExp = /^'([^]*?)'?$/;
1814
+ var doubleQuoteRegExp = /''/g;
1815
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
1816
+
1817
+ /**
1818
+ * @name format
1819
+ * @category Common Helpers
1820
+ * @summary Format the date.
1821
+ *
1822
+ * @description
1823
+ * Return the formatted date string in the given format. The result may vary by locale.
1824
+ *
1825
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
1826
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1827
+ *
1828
+ * The characters wrapped between two single quotes characters (') are escaped.
1829
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
1830
+ * (see the last example)
1831
+ *
1832
+ * Format of the string is based on Unicode Technical Standard #35:
1833
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
1834
+ * with a few additions (see note 7 below the table).
1835
+ *
1836
+ * Accepted patterns:
1837
+ * | Unit | Pattern | Result examples | Notes |
1838
+ * |---------------------------------|---------|-----------------------------------|-------|
1839
+ * | Era | G..GGG | AD, BC | |
1840
+ * | | GGGG | Anno Domini, Before Christ | 2 |
1841
+ * | | GGGGG | A, B | |
1842
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
1843
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
1844
+ * | | yy | 44, 01, 00, 17 | 5 |
1845
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
1846
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
1847
+ * | | yyyyy | ... | 3,5 |
1848
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
1849
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
1850
+ * | | YY | 44, 01, 00, 17 | 5,8 |
1851
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
1852
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
1853
+ * | | YYYYY | ... | 3,5 |
1854
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
1855
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
1856
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
1857
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
1858
+ * | | RRRRR | ... | 3,5,7 |
1859
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
1860
+ * | | uu | -43, 01, 1900, 2017 | 5 |
1861
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
1862
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
1863
+ * | | uuuuu | ... | 3,5 |
1864
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
1865
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
1866
+ * | | QQ | 01, 02, 03, 04 | |
1867
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
1868
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
1869
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
1870
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
1871
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
1872
+ * | | qq | 01, 02, 03, 04 | |
1873
+ * | | qqq | Q1, Q2, Q3, Q4 | |
1874
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
1875
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
1876
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
1877
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
1878
+ * | | MM | 01, 02, ..., 12 | |
1879
+ * | | MMM | Jan, Feb, ..., Dec | |
1880
+ * | | MMMM | January, February, ..., December | 2 |
1881
+ * | | MMMMM | J, F, ..., D | |
1882
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
1883
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
1884
+ * | | LL | 01, 02, ..., 12 | |
1885
+ * | | LLL | Jan, Feb, ..., Dec | |
1886
+ * | | LLLL | January, February, ..., December | 2 |
1887
+ * | | LLLLL | J, F, ..., D | |
1888
+ * | Local week of year | w | 1, 2, ..., 53 | |
1889
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
1890
+ * | | ww | 01, 02, ..., 53 | |
1891
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
1892
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
1893
+ * | | II | 01, 02, ..., 53 | 7 |
1894
+ * | Day of month | d | 1, 2, ..., 31 | |
1895
+ * | | do | 1st, 2nd, ..., 31st | 7 |
1896
+ * | | dd | 01, 02, ..., 31 | |
1897
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
1898
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
1899
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
1900
+ * | | DDD | 001, 002, ..., 365, 366 | |
1901
+ * | | DDDD | ... | 3 |
1902
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
1903
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
1904
+ * | | EEEEE | M, T, W, T, F, S, S | |
1905
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
1906
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
1907
+ * | | io | 1st, 2nd, ..., 7th | 7 |
1908
+ * | | ii | 01, 02, ..., 07 | 7 |
1909
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
1910
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
1911
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
1912
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
1913
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
1914
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
1915
+ * | | ee | 02, 03, ..., 01 | |
1916
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
1917
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
1918
+ * | | eeeee | M, T, W, T, F, S, S | |
1919
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
1920
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
1921
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
1922
+ * | | cc | 02, 03, ..., 01 | |
1923
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
1924
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
1925
+ * | | ccccc | M, T, W, T, F, S, S | |
1926
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
1927
+ * | AM, PM | a..aa | AM, PM | |
1928
+ * | | aaa | am, pm | |
1929
+ * | | aaaa | a.m., p.m. | 2 |
1930
+ * | | aaaaa | a, p | |
1931
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
1932
+ * | | bbb | am, pm, noon, midnight | |
1933
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
1934
+ * | | bbbbb | a, p, n, mi | |
1935
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
1936
+ * | | BBBB | at night, in the morning, ... | 2 |
1937
+ * | | BBBBB | at night, in the morning, ... | |
1938
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
1939
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
1940
+ * | | hh | 01, 02, ..., 11, 12 | |
1941
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
1942
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
1943
+ * | | HH | 00, 01, 02, ..., 23 | |
1944
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
1945
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
1946
+ * | | KK | 01, 02, ..., 11, 00 | |
1947
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
1948
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
1949
+ * | | kk | 24, 01, 02, ..., 23 | |
1950
+ * | Minute | m | 0, 1, ..., 59 | |
1951
+ * | | mo | 0th, 1st, ..., 59th | 7 |
1952
+ * | | mm | 00, 01, ..., 59 | |
1953
+ * | Second | s | 0, 1, ..., 59 | |
1954
+ * | | so | 0th, 1st, ..., 59th | 7 |
1955
+ * | | ss | 00, 01, ..., 59 | |
1956
+ * | Fraction of second | S | 0, 1, ..., 9 | |
1957
+ * | | SS | 00, 01, ..., 99 | |
1958
+ * | | SSS | 000, 001, ..., 999 | |
1959
+ * | | SSSS | ... | 3 |
1960
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
1961
+ * | | XX | -0800, +0530, Z | |
1962
+ * | | XXX | -08:00, +05:30, Z | |
1963
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
1964
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
1965
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
1966
+ * | | xx | -0800, +0530, +0000 | |
1967
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
1968
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
1969
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
1970
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
1971
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
1972
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
1973
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
1974
+ * | Seconds timestamp | t | 512969520 | 7 |
1975
+ * | | tt | ... | 3,7 |
1976
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
1977
+ * | | TT | ... | 3,7 |
1978
+ * | Long localized date | P | 04/29/1453 | 7 |
1979
+ * | | PP | Apr 29, 1453 | 7 |
1980
+ * | | PPP | April 29th, 1453 | 7 |
1981
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
1982
+ * | Long localized time | p | 12:00 AM | 7 |
1983
+ * | | pp | 12:00:00 AM | 7 |
1984
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
1985
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
1986
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
1987
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
1988
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
1989
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
1990
+ * Notes:
1991
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
1992
+ * are the same as "stand-alone" units, but are different in some languages.
1993
+ * "Formatting" units are declined according to the rules of the language
1994
+ * in the context of a date. "Stand-alone" units are always nominative singular:
1995
+ *
1996
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
1997
+ *
1998
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
1999
+ *
2000
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2001
+ * the single quote characters (see below).
2002
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
2003
+ * the output will be the same as default pattern for this unit, usually
2004
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
2005
+ * are marked with "2" in the last column of the table.
2006
+ *
2007
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
2008
+ *
2009
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
2010
+ *
2011
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
2012
+ *
2013
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
2014
+ *
2015
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
2016
+ *
2017
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
2018
+ * The output will be padded with zeros to match the length of the pattern.
2019
+ *
2020
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
2021
+ *
2022
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2023
+ * These tokens represent the shortest form of the quarter.
2024
+ *
2025
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
2026
+ *
2027
+ * | Year | `y` | `u` |
2028
+ * |------|-----|-----|
2029
+ * | AC 1 | 1 | 1 |
2030
+ * | BC 1 | 1 | 0 |
2031
+ * | BC 2 | 2 | -1 |
2032
+ *
2033
+ * Also `yy` always returns the last two digits of a year,
2034
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
2035
+ *
2036
+ * | Year | `yy` | `uu` |
2037
+ * |------|------|------|
2038
+ * | 1 | 01 | 01 |
2039
+ * | 14 | 14 | 14 |
2040
+ * | 376 | 76 | 376 |
2041
+ * | 1453 | 53 | 1453 |
2042
+ *
2043
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2044
+ * except local week-numbering years are dependent on `options.weekStartsOn`
2045
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
2046
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
2047
+ *
2048
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
2049
+ * so right now these tokens fall back to GMT timezones.
2050
+ *
2051
+ * 7. These patterns are not in the Unicode Technical Standard #35:
2052
+ * - `i`: ISO day of week
2053
+ * - `I`: ISO week of year
2054
+ * - `R`: ISO week-numbering year
2055
+ * - `t`: seconds timestamp
2056
+ * - `T`: milliseconds timestamp
2057
+ * - `o`: ordinal number modifier
2058
+ * - `P`: long localized date
2059
+ * - `p`: long localized time
2060
+ *
2061
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2062
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2063
+ *
2064
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2065
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2066
+ *
2067
+ * @param {Date|Number} date - the original date
2068
+ * @param {String} format - the string of tokens
2069
+ * @param {Object} [options] - an object with options.
2070
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2071
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2072
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2073
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2074
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2075
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2076
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2077
+ * @returns {String} the formatted date string
2078
+ * @throws {TypeError} 2 arguments required
2079
+ * @throws {RangeError} `date` must not be Invalid Date
2080
+ * @throws {RangeError} `options.locale` must contain `localize` property
2081
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2082
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2083
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2084
+ * @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
2085
+ * @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
2086
+ * @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
2087
+ * @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
2088
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2089
+ *
2090
+ * @example
2091
+ * // Represent 11 February 2014 in middle-endian format:
2092
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2093
+ * //=> '02/11/2014'
2094
+ *
2095
+ * @example
2096
+ * // Represent 2 July 2014 in Esperanto:
2097
+ * import { eoLocale } from 'date-fns/locale/eo'
2098
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2099
+ * locale: eoLocale
2100
+ * })
2101
+ * //=> '2-a de julio 2014'
2102
+ *
2103
+ * @example
2104
+ * // Escape string by single quote characters:
2105
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2106
+ * //=> "3 o'clock"
2107
+ */
2108
+
2109
+ function format(dirtyDate, dirtyFormatStr, options) {
2110
+ 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;
2111
+ requiredArgs(2, arguments);
2112
+ var formatStr = String(dirtyFormatStr);
2113
+ var defaultOptions = getDefaultOptions();
2114
+ var locale$1 = (_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 : locale;
2115
+ 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);
2116
+
2117
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2118
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2119
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2120
+ }
2121
+ 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);
2122
+
2123
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2124
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2125
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2126
+ }
2127
+ if (!locale$1.localize) {
2128
+ throw new RangeError('locale must contain localize property');
2129
+ }
2130
+ if (!locale$1.formatLong) {
2131
+ throw new RangeError('locale must contain formatLong property');
2132
+ }
2133
+ var originalDate = toDate(dirtyDate);
2134
+ if (!isValid(originalDate)) {
2135
+ throw new RangeError('Invalid time value');
2136
+ }
2137
+
2138
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2139
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2140
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2141
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2142
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2143
+ var formatterOptions = {
2144
+ firstWeekContainsDate: firstWeekContainsDate,
2145
+ weekStartsOn: weekStartsOn,
2146
+ locale: locale$1,
2147
+ _originalDate: originalDate
2148
+ };
2149
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2150
+ var firstCharacter = substring[0];
2151
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2152
+ var longFormatter = longFormatters[firstCharacter];
2153
+ return longFormatter(substring, locale$1.formatLong);
2154
+ }
2155
+ return substring;
2156
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2157
+ // Replace two single quote characters with one single quote character
2158
+ if (substring === "''") {
2159
+ return "'";
2160
+ }
2161
+ var firstCharacter = substring[0];
2162
+ if (firstCharacter === "'") {
2163
+ return cleanEscapedString(substring);
2164
+ }
2165
+ var formatter = formatters[firstCharacter];
2166
+ if (formatter) {
2167
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2168
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2169
+ }
2170
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2171
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2172
+ }
2173
+ return formatter(utcDate, substring, locale$1.localize, formatterOptions);
2174
+ }
2175
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2176
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2177
+ }
2178
+ return substring;
2179
+ }).join('');
2180
+ return result;
2181
+ }
2182
+ function cleanEscapedString(input) {
2183
+ var matched = input.match(escapedStringRegExp);
2184
+ if (!matched) {
2185
+ return input;
2186
+ }
2187
+ return matched[1].replace(doubleQuoteRegExp, "'");
2188
+ }
2189
+
2190
+ const DEFAULT_LANGUAGE = 'en';
2191
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
2192
+ const TRANSLATIONS = {
2193
+ en: {
2194
+ redeem: 'Redeem',
2195
+ expireOn: 'Expire on ',
2196
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2197
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2198
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2199
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2200
+ tipsForNextLevel: 'Need ${pointsToReach} to reach ${levelName}',
2201
+ spendablePoints: 'Spendable Points:',
2202
+ details: 'Details',
2203
+ earningRules: 'Earning Rules',
2204
+ xp: 'XP',
2205
+ sp: 'Coins',
2206
+ termAndConditions: 'Term & Conditions',
2207
+ },
2208
+ 'zh-hk': {
2209
+ redeem: '兑奖',
2210
+ expireOn: 'Expire on ',
2211
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2212
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2213
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2214
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2215
+ tipsForNextLevel: 'Need ${pointsToReach} to reach ${levelName}',
2216
+ spendablePoints: 'Spendable Points:',
2217
+ details: '明细',
2218
+ earningRules: 'Earning Rules',
2219
+ xp: 'XP',
2220
+ sp: 'Coins',
2221
+ termAndConditions: 'Term & Conditions',
2222
+ },
2223
+ de: {
2224
+ redeem: 'Redeem',
2225
+ expireOn: 'Expire on ',
2226
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2227
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2228
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2229
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2230
+ tipsForNextLevel: 'Need ${pointsToReach} to reach ${levelName}',
2231
+ spendablePoints: 'Spendable Points:',
2232
+ details: 'Details',
2233
+ earningRules: 'Earning Rules',
2234
+ xp: 'XP',
2235
+ sp: 'Coins',
2236
+ termAndConditions: 'Term & Conditions',
2237
+ },
2238
+ it: {
2239
+ redeem: 'Redeem',
2240
+ expireOn: 'Expire on ',
2241
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2242
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2243
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2244
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2245
+ tipsForNextLevel: 'Need ${pointsToReach} to reach ${levelName}',
2246
+ spendablePoints: 'Spendable Points:',
2247
+ details: 'Details',
2248
+ earningRules: 'Earning Rules',
2249
+ xp: 'XP',
2250
+ sp: 'Coins',
2251
+ termAndConditions: 'Term & Conditions',
2252
+ },
2253
+ fr: {
2254
+ redeem: 'Redeem',
2255
+ expireOn: 'Expire on ',
2256
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2257
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2258
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2259
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2260
+ tipsForNextLevel: 'Need ${pointsToReach} to reach ${levelName}',
2261
+ spendablePoints: 'Spendable Points:',
2262
+ details: 'Details',
2263
+ earningRules: 'Earning Rules',
2264
+ xp: 'XP',
2265
+ sp: 'Coins',
2266
+ termAndConditions: 'Term & Conditions',
2267
+ },
2268
+ es: {
2269
+ redeem: 'Redeem'
2270
+ },
2271
+ tr: {
2272
+ redeem: 'Redeem'
2273
+ },
2274
+ ru: {
2275
+ redeem: 'Redeem'
2276
+ },
2277
+ ro: {
2278
+ redeem: 'Redeem'
2279
+ },
2280
+ hr: {
2281
+ redeem: 'Otkupiti',
2282
+ expireOn: 'Istječe',
2283
+ pointsToBeExpired: '${expirationPoints} bodova ističe za ${expireDay} dana',
2284
+ tipsForNextLevel: 'Trebate ${pointsToReach} da dosegnete razinu ${levelName}',
2285
+ spendablePoints: 'Bodovi za potrošit:',
2286
+ details: 'Detalji',
2287
+ xp: 'XP',
2288
+ },
2289
+ hu: {
2290
+ redeem: 'Redeem'
2291
+ },
2292
+ pl: {
2293
+ redeem: 'Redeem'
2294
+ },
2295
+ pt: {
2296
+ redeem: 'Redeem'
2297
+ },
2298
+ sl: {
2299
+ redeem: 'Redeem'
2300
+ },
2301
+ sr: {
2302
+ redeem: 'Redeem'
2303
+ }
2304
+ };
2305
+ const translate = (key, customLang) => {
2306
+ const lang = customLang;
2307
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
2308
+ };
2309
+ const translateWithParams = (key, params) => {
2310
+ const lang = params['lang'];
2311
+ let templateString = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
2312
+ if (!params) {
2313
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
2314
+ }
2315
+ Object.keys(params).forEach((paramName) => {
2316
+ templateString = templateString.replace(new RegExp('\\$\{' + paramName + '\}', 'gm'), params[paramName]);
2317
+ });
2318
+ return templateString;
2319
+ };
2320
+
2321
+ const LoyaltyProgress = `<svg width="100%" height="28" fill="none" xmlns="http://www.w3.org/2000/svg">
2322
+ <rect y="12" width="100%" id="total_level" height="5" rx="2.5" fill="white" fill-opacity="0.5"/>
2323
+ <rect y="12" id="current_level" width="64" height="5" rx="2.5" fill="white"/>
2324
+ <g filter="url(#filter_current_level)">
2325
+ <circle id="circle_current_level" cx="74.5" cy="14.5" r="6.5" fill="white"/>
2326
+ </g>
2327
+ <g filter="url(#filter_heart_ball)">
2328
+ <g filter="url(#filter_ball)">
2329
+ <circle cx="169" cy="14" r="10" id="lock" fill="url(#paint0_linear_ball)"/>
2330
+ </g>
2331
+ <g filter="url(#filter_heart)">
2332
+ <svg x="0" y="4" id="lock_box">
2333
+ <path d="M10.217 6.42442c-0.713,-0.574,-1.304,-1.083,-1.928,-1.622c-0.348,-0.299,-0.707,-0.611,-1.101,-0.943l-0.013,-0.01c0,0,-0.023,-0.017,-0.04,-0.027l-0.167,-0.095l-0.15,0.12c0,0,-0.015,0.012,-0.024,0.02c-0.391,0.33,-0.749,0.64,-1.094,0.939c-0.622,0.539,-1.211,1.048,-1.924,1.624c-1.816,1.463,-3.598,3.263,-3.033,5.506c0.404,1.601,2.104,2.905,3.789,2.905c0.211,0,0.423,-0.02,0.626,-0.061c0.286,-0.058,0.572,-0.145,0.864,-0.265c-0.079,0.962,-0.413,1.864,-0.881,2.369l-0.423,0.459h0.633c0.633,0,1.018,-0.007,1.356,-0.013c0.248,-0.004,0.462,-0.008,0.72,-0.008c0.335,0,0.709,0.006,1.215,0.021l0.686,0.02l-0.474,-0.483c-0.504,-0.514,-0.847,-1.403,-0.923,-2.385c0.311,0.132,0.616,0.227,0.916,0.287c0.204,0.039,0.411,0.059,0.623,0.059c1.687,0,3.386,-1.304,3.789,-2.909c0.56,-2.243,-1.224,-4.041,-3.042,-5.504v-0.004z" fill="#933CBF"/>
2334
+ <path d="M9.727,6.98459c-1.004,-0.83,-1.741,-1.515,-2.723,-2.365c-0.002,0,-0.004,-0.004,-0.007,-0.006c-0.002,0,-0.004,0.004,-0.006,0.006c-0.98,0.85,-1.715,1.537,-2.721,2.367c-1.455,1.202,-3.126,2.821,-2.638,4.81c0.37,1.511,2.091,2.751,3.665,2.43c0.389,-0.08,0.75,-0.224,1.094,-0.402c0,0.116,-0.004,0.233,-0.012,0.353c-0.064,0.991,-0.398,1.892,-0.86,2.401c1.481,0,1.481,-0.043,2.961,0c-0.481,-0.503,-0.834,-1.382,-0.9,-2.401c-0.008,-0.127,-0.012,-0.253,-0.012,-0.378c0.357,0.19,0.733,0.342,1.14,0.425c1.574,0.319,3.292,-0.922,3.661,-2.433c0.486,-1.992,-1.189,-3.609,-2.644,
2335
+ -4.809l0.002,0.002z" fill="url(#paint1_linear_lock)"/>
2336
+ <path d="M9.255,7.551c-0.844,-0.716,-1.462,-1.309,-2.286,-2.045c-0.002,0,-0.004,-0.004,-0.006,-0.006c0,0,-0.004,0.004,-0.006,0.006c-0.824,0.736,-1.44,1.329,-2.284,2.047c-0.919,0.782,-1.94,1.769,-2.214,2.943c-0.115,0.021,-0.914,0.044,-0.914,0.044l0.887,0.083c-0.039,0.206,-0.055,0.418,-0.041,0.638c0.087,-1.371,1.25,-2.507,2.282,-3.384c0.844,-0.718,1.462,-1.313,2.284,-2.047c0.002,-0.002,0.004,-0.004,0.006,-0.006c0.002,0,0.004,0.004,0.006,0.004c0.824,0.734,1.442,1.329,2.286,2.045c1.034,0.879,2.198,2.013,2.286,3.386c0.093,-1.517,-1.173,-2.761,-2.286,-3.708z" fill="#9040C9"/>
2337
+ </svg>
2338
+ </g>
2339
+ </g>
2340
+ <g filter="url(#filter_lock)">
2341
+ <svg x="100%" y="9" id="heart_box">
2342
+ <path d="M7,6c-0.19,-0.002,-0.377,0.052,-0.534,0.154c-0.158,0.103,-0.278,0.25,-0.346,0.42c-0.069,0.171,-0.081,0.357,-0.035,0.535c0.046,0.177,0.147,0.337,0.29,0.457v0.834c0,0.159,0.066,0.312,0.183,0.424c0.117,0.113,0.276,0.176,0.442,0.176c0.166,0,0.325,-0.063,0.442,-0.176c0.117,-0.112,0.183,-0.265,0.183,-0.424v-0.834c0.143,-0.12,0.244,-0.28,0.29,-0.457c0.046,-0.178,0.034,-0.364,-0.035,-0.535c-0.068,-0.17,-0.188,-0.317,-0.346,-0.42c-0.157,-0.102,-0.344,-0.156,-0.534,-0.154zm3.125,-2.4v-1.2c0,-0.796,-0.329,-1.559,-0.915,-2.121c-0.586,-0.563,-1.381,-0.879,-2.21,-0.879c-0.829,0,-1.624,0.316,-2.21,0.879c-0.586,0.562,-0.915,1.325,-0.915,2.121v1.2c-0.497,0,-0.974,0.19,-1.326,0.527c-0.351,0.338,-0.549,0.796,-0.549,1.273v4.2c0,0.477,0.198,0.935,0.549,1.273c0.352,0.337,0.829,0.527,1.326,0.527h6.25c0.497,0,0.974,-0.19,1.326,-0.527c0.351,-0.338,0.549,-0.796,0.549,-1.273v-4.2c0,-0.477,-0.198,-0.935,-0.549,-1.273c-0.352,-0.337,-0.829,-0.527,-1.326,-0.527zm-5,-1.2c0,-0.477,0.198,-0.935,0.549,-1.273c0.352,-0.337,0.829,-0.527,1.326,-0.527c0.497,0,0.974,0.19,1.326,0.527c0.351,0.338,0.549,0.796,0.549,1.273v1.2h-3.75v-1.2zm5.625,7.2c0,0.159,-0.066,0.312,-0.183,0.424c-0.117,0.113,-0.276,0.176,-0.442,0.176h-6.25c-0.166,0,-0.325,-0.063,-0.442,-0.176c-0.117,-0.112,-0.183,-0.265,-0.183,-0.424v-4.2c0,-0.159,0.066,-0.312,0.183,-0.424c0.117,-0.113,0.276,-0.176,0.442,-0.176h6.25c0.166,0,0.325,0.063,0.442,0.176c0.117,0.112,0.183,0.265,0.183,0.424v4.2z" fill="white"/>
2343
+ </svg>
2344
+ </g>
2345
+ <defs>
2346
+ <filter id="filter_current_level" x="64" y="4" width="21" height="21" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2347
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2348
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
2349
+ <feGaussianBlur stdDeviation="2" result="effect1_foregroundBlur_305_23"/>
2350
+ </filter>
2351
+ <filter id="filter_heart_ball" x="155" y="0" width="28" height="28" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2352
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2353
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
2354
+ <feOffset/>
2355
+ <feGaussianBlur stdDeviation="2"/>
2356
+ <feComposite in2="hardAlpha" operator="out"/>
2357
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
2358
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_305_23"/>
2359
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_305_23" result="shape"/>
2360
+ </filter>
2361
+ <filter id="filter_ball" x="159" y="4" width="20" height="21" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2362
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2363
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
2364
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
2365
+ <feOffset dy="1"/>
2366
+ <feGaussianBlur stdDeviation="1"/>
2367
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
2368
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.55 0"/>
2369
+ <feBlend mode="normal" in2="shape" result="effect1_innerShadow_305_23"/>
2370
+ </filter>
2371
+ <filter id="filter_heart" x="161.636" y="5.72727" width="14.7271" height="15.6364" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2372
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2373
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
2374
+ <feOffset/>
2375
+ <feGaussianBlur stdDeviation="0.5"/>
2376
+ <feComposite in2="hardAlpha" operator="out"/>
2377
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
2378
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_305_23"/>
2379
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_305_23" result="shape"/>
2380
+ </filter>
2381
+ <filter id="filter_lock" x="50" y="7" width="12" height="14" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2382
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2383
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
2384
+ <feOffset/>
2385
+ <feGaussianBlur stdDeviation="0.5"/>
2386
+ <feComposite in2="hardAlpha" operator="out"/>
2387
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
2388
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_305_23"/>
2389
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_305_23" result="shape"/>
2390
+ </filter>
2391
+ <linearGradient id="paint0_linear_ball" x1="163" y1="6" x2="174.2" y2="22.6" gradientUnits="userSpaceOnUse">
2392
+ <stop stop-color="#946AD7"/>
2393
+ <stop offset="1" stop-color="#EFABEB"/>
2394
+ </linearGradient>
2395
+ <linearGradient id="paint1_linear_lock" x1="100%" y1="18.4056" x2="169.002" y2="10.2845" gradientUnits="userSpaceOnUse">
2396
+ <stop stop-color="#814FD6"/>
2397
+ <stop offset="1" stop-color="#D679D8"/>
2398
+ </linearGradient>
2399
+ </defs>
2400
+ </svg>
2401
+ `;
2402
+
2403
+ const TipsInfo = `<svg width="126" height="92" viewBox="0 0 126 92" fill="none" xmlns="http://www.w3.org/2000/svg">
2404
+ <g filter="url(#filter0_d_242_4231)">
2405
+ <rect x="24" y="20" width="78" height="36" rx="4" fill="white"/>
2406
+ <path d="M24 24C24 21.7909 25.7909 20 28 20H64V56H28C25.7909 56 24 54.2091 24 52V24Z" fill="#464646"/>
2407
+ <path d="M51 56H37L43.2474 63.1399C43.6458 63.5952 44.3542 63.5952 44.7526 63.1399L51 56Z" fill="#464646"/>
2408
+ <circle cx="44" cy="38" r="7" fill="white"/>
2409
+ <path d="M43.9405 34C44.5456 34 45.0362 34.4906 45.0362 35.0957C45.0362 35.7009 44.5456 36.1915 43.9405 36.1915C43.3353 36.1915 42.8447 35.7009 42.8447 35.0957C42.8447 34.4906 43.3353 34 43.9405 34Z" fill="#464646"/>
2410
+ <path d="M45.8801 41.3737C45.8801 41.7617 45.5626 42.0791 45.1746 42.0791H44.3233H43.551H42.7055C42.3175 42.0791 42 41.7617 42 41.3737V41.3575C42 40.9695 42.3175 40.6521 42.7055 40.6521H42.8455V37.8714H42.3528C42.1588 37.8714 42 37.7127 42 37.5187V37.4936C42 37.2996 42.1588 37.1409 42.3528 37.1409H43.551H44.031H44.3233C44.7113 37.1409 45.0287 37.4583 45.0287 37.8463V40.6521H45.1746C45.5626 40.6521 45.8801 40.9696 45.8801 41.3576V41.3737Z" fill="#464646"/>
2411
+ </g>
2412
+ <defs>
2413
+ <filter id="filter0_d_242_4231" x="0" y="0" width="126" height="91.4814" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
2414
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
2415
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
2416
+ <feOffset dy="4"/>
2417
+ <feGaussianBlur stdDeviation="12"/>
2418
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
2419
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_242_4231"/>
2420
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_242_4231" result="shape"/>
2421
+ </filter>
2422
+ </defs>
2423
+ </svg>
2424
+ `;
2425
+
2426
+ const PlayerLoyaltyProcess = () => (h("span", { class: "LevelProgress", id: 'LevelProgress', innerHTML: LoyaltyProgress }));
2427
+ const PlayerPoints = ({ loyaltyPoints, spendablePoints, pointExpireString, language, }) => (h("div", { class: "PointsInfo" },
2428
+ loyaltyPoints &&
2429
+ h("div", { class: 'Points' },
2430
+ loyaltyPoints,
2431
+ " ",
2432
+ h("sub", { class: "XP" }, translate('xp', language))),
2433
+ spendablePoints &&
2434
+ h("div", { class: 'Points' },
2435
+ spendablePoints,
2436
+ " ",
2437
+ h("sub", { class: "XP" }, translate('sp', language))),
2438
+ pointExpireString && (h("div", { class: 'ExpirationPoints' },
2439
+ pointExpireString,
2440
+ " "))));
2441
+ const PlayerElevateCardRedeem = ({ language, onRedeemClick }) => (h("div", { class: "CardCell Redeem" },
2442
+ h("div", { class: "RedeemButton", onClick: () => {
2443
+ onRedeemClick();
2444
+ } },
2445
+ h("span", null, translate('redeem', language)))));
2446
+ const PlayerNameDiv = (props) => (h("div", { class: 'CardCell PlayerName Txt' }, props.playerName));
2447
+ const PlayerElevateLoyaltyLevel = (props) => (h("div", { class: 'CardCell ElevateLevel' },
2448
+ h("span", { class: "LevelName", title: props.level }, props.level),
2449
+ props.expireTime && (h("div", { class: "CardCell ExpirationDate Txt" },
2450
+ translate('expireOn', props.language),
2451
+ h("span", { class: "ExpireTime" }, format(new Date(props.expireTime), props.dateFormat || 'yyyy-MM-dd')),
2452
+ !props.hideInfo && (h("span", { class: "fa Info", style: { 'background': `url(${getAssetPath('../static/info.svg')})` } },
2453
+ h("span", { class: "InfoTips", innerHTML: TipsInfo })))))));
2454
+ const PlayerAvatar = (props) => {
2455
+ const badge = props.loyaltyIconUrl
2456
+ ? h("img", { class: "Badge", src: props.loyaltyIconUrl })
2457
+ : props.hideIfNull ? '' : h("div", { class: "Badge" });
2458
+ const avatarSrc = props.playerAvatarUrl || getAssetPath('../static/user.svg');
2459
+ return h("div", { class: "PlayerAvatar", style: { 'position': `${props.onlyBadge ? '' : 'relative'}` } },
2460
+ !props.onlyBadge && h("img", { class: "Avatar", src: avatarSrc }),
2461
+ badge);
2462
+ };
2463
+
2464
+ export { PlayerAvatar as P, TRANSLATIONS as T, translateWithParams as a, PlayerElevateLoyaltyLevel as b, PlayerPoints as c, PlayerLoyaltyProcess as d, PlayerNameDiv as e, PlayerElevateCardRedeem as f, getTimezoneOffsetInMilliseconds as g, translate as h, requiredArgs as r, toDate as t };