@everymatrix/player-elevate-card-jojogroup 1.80.4

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 (100) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/general-styling-wrapper_6.cjs.entry.js +3570 -0
  3. package/dist/cjs/index-51874d29.js +1619 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/player-elevate-card-jojogroup.cjs.js +25 -0
  7. package/dist/collection/collection-manifest.json +23 -0
  8. package/dist/collection/components/player-elevate-card-data/player-elevate-card-data.css +192 -0
  9. package/dist/collection/components/player-elevate-card-data/player-elevate-card-data.js +244 -0
  10. package/dist/collection/components/player-elevate-card-jojogroup/index.js +1 -0
  11. package/dist/collection/components/player-elevate-card-jojogroup/player-elevate-card-jojogroup-items.js +23 -0
  12. package/dist/collection/components/player-elevate-card-jojogroup/player-elevate-card-jojogroup.css +64 -0
  13. package/dist/collection/components/player-elevate-card-jojogroup/player-elevate-card-jojogroup.js +297 -0
  14. package/dist/collection/components/player-elevate-loyaltycard-jojogroup/player-elevate-loyaltycard-jojogroup.css +98 -0
  15. package/dist/collection/components/player-elevate-loyaltycard-jojogroup/player-elevate-loyaltycard-jojogroup.js +310 -0
  16. package/dist/collection/components/player-elevate-pointcard/player-elevate-pointcard.css +70 -0
  17. package/dist/collection/components/player-elevate-pointcard/player-elevate-pointcard.js +334 -0
  18. package/dist/collection/components/player-rakeback-card/player-rakeback-card.css +87 -0
  19. package/dist/collection/components/player-rakeback-card/player-rakeback-card.js +357 -0
  20. package/dist/collection/components/static/button-default.svg +42 -0
  21. package/dist/collection/components/static/button-disabled.svg +4 -0
  22. package/dist/collection/components/static/button-hover.svg +4 -0
  23. package/dist/collection/components/static/button-level.svg +27 -0
  24. package/dist/collection/components/static/button-pressed.svg +18 -0
  25. package/dist/collection/components/static/button-redeem.svg +36 -0
  26. package/dist/collection/components/static/card-ground-over.png +0 -0
  27. package/dist/collection/components/static/card-ground-over.svg +903 -0
  28. package/dist/collection/components/static/card-ground.png +0 -0
  29. package/dist/collection/components/static/card-ground.svg +34 -0
  30. package/dist/collection/components/static/info.svg +4 -0
  31. package/dist/collection/components/static/level-badge.png +0 -0
  32. package/dist/collection/components/static/level-percent.svg +80 -0
  33. package/dist/collection/components/static/tips-info.svg +21 -0
  34. package/dist/collection/components/static/user.svg +3 -0
  35. package/dist/collection/index.js +1 -0
  36. package/dist/collection/models/player-elevate.js +1 -0
  37. package/dist/collection/utils/locale.utils.js +238 -0
  38. package/dist/collection/utils/utils.js +51 -0
  39. package/dist/esm/app-globals-0f993ce5.js +3 -0
  40. package/dist/esm/general-styling-wrapper_6.entry.js +3561 -0
  41. package/dist/esm/index-9498ebd7.js +1589 -0
  42. package/dist/esm/index.js +1 -0
  43. package/dist/esm/loader.js +11 -0
  44. package/dist/esm/player-elevate-card-jojogroup.js +20 -0
  45. package/dist/index.cjs.js +1 -0
  46. package/dist/index.js +1 -0
  47. package/dist/player-elevate-card-jojogroup/app-globals-0f993ce5.js +1 -0
  48. package/dist/player-elevate-card-jojogroup/general-styling-wrapper_6.entry.js +1 -0
  49. package/dist/player-elevate-card-jojogroup/index-9498ebd7.js +2 -0
  50. package/dist/player-elevate-card-jojogroup/index.esm.js +0 -0
  51. package/dist/player-elevate-card-jojogroup/player-elevate-card-jojogroup.esm.js +1 -0
  52. package/dist/static/button-default.svg +42 -0
  53. package/dist/static/button-disabled.svg +4 -0
  54. package/dist/static/button-hover.svg +4 -0
  55. package/dist/static/button-level.svg +27 -0
  56. package/dist/static/button-pressed.svg +18 -0
  57. package/dist/static/button-redeem.svg +36 -0
  58. package/dist/static/card-ground-over.png +0 -0
  59. package/dist/static/card-ground-over.svg +903 -0
  60. package/dist/static/card-ground.png +0 -0
  61. package/dist/static/card-ground.svg +34 -0
  62. package/dist/static/info.svg +4 -0
  63. package/dist/static/level-badge.png +0 -0
  64. package/dist/static/level-percent.svg +80 -0
  65. package/dist/static/tips-info.svg +21 -0
  66. package/dist/static/user.svg +3 -0
  67. package/dist/stencil.config.dev.js +18 -0
  68. package/dist/stencil.config.js +20 -0
  69. package/dist/storybook/main.js +47 -0
  70. package/dist/storybook/preview.js +9 -0
  71. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-card-jojogroup/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  72. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-card-jojogroup/.stencil/packages/stencil/player-elevate-card-jojogroup/stencil.config.d.ts +2 -0
  73. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-card-jojogroup/.stencil/packages/stencil/player-elevate-card-jojogroup/stencil.config.dev.d.ts +2 -0
  74. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-card-jojogroup/.stencil/packages/stencil/player-elevate-card-jojogroup/storybook/main.d.ts +3 -0
  75. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-card-jojogroup/.stencil/packages/stencil/player-elevate-card-jojogroup/storybook/preview.d.ts +70 -0
  76. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-card-jojogroup/.stencil/tools/plugins/index.d.ts +4 -0
  77. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-card-jojogroup/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  78. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-card-jojogroup/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  79. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-card-jojogroup/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  80. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-elevate-card-jojogroup/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  81. package/dist/types/components/player-elevate-card-data/player-elevate-card-data.d.ts +24 -0
  82. package/dist/types/components/player-elevate-card-jojogroup/index.d.ts +1 -0
  83. package/dist/types/components/player-elevate-card-jojogroup/player-elevate-card-jojogroup-items.d.ts +20 -0
  84. package/dist/types/components/player-elevate-card-jojogroup/player-elevate-card-jojogroup.d.ts +56 -0
  85. package/dist/types/components/player-elevate-loyaltycard-jojogroup/player-elevate-loyaltycard-jojogroup.d.ts +59 -0
  86. package/dist/types/components/player-elevate-pointcard/player-elevate-pointcard.d.ts +69 -0
  87. package/dist/types/components/player-rakeback-card/player-rakeback-card.d.ts +65 -0
  88. package/dist/types/components.d.ts +461 -0
  89. package/dist/types/index.d.ts +1 -0
  90. package/dist/types/models/player-elevate.d.ts +40 -0
  91. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  92. package/dist/types/utils/locale.utils.d.ts +15 -0
  93. package/dist/types/utils/utils.d.ts +1 -0
  94. package/loader/cdn.js +1 -0
  95. package/loader/index.cjs.js +1 -0
  96. package/loader/index.d.ts +24 -0
  97. package/loader/index.es2017.js +1 -0
  98. package/loader/index.js +2 -0
  99. package/loader/package.json +11 -0
  100. package/package.json +26 -0
@@ -0,0 +1,3561 @@
1
+ import { r as registerInstance, h, g as getElement, c as createEvent, a as getAssetPath, F as Fragment } from './index-9498ebd7.js';
2
+
3
+ const mergeTranslations = (url, target) => {
4
+ return new Promise((resolve) => {
5
+ fetch(url)
6
+ .then((res) => res.json())
7
+ .then((data) => {
8
+ Object.keys(data).forEach((item) => {
9
+ target[item] = target[item] || {};
10
+ Object.keys(data[item]).forEach((key) => {
11
+ //if there is no key in target, do nothing
12
+ if (!target['en'][key]) {
13
+ return;
14
+ }
15
+ const defaultTranslation = target['en'][key];
16
+ if (typeof data[item][key] === 'object') {
17
+ // if the key is not in target, then take from en
18
+ target[item][key] = target[item][key] || Object.assign({}, defaultTranslation);
19
+ Object.keys(data[item][key]).forEach((subKey) => {
20
+ target[item][key][subKey] = data[item][key][subKey];
21
+ });
22
+ }
23
+ else {
24
+ target[item][key] = data[item][key] || Object.assign({}, defaultTranslation);
25
+ }
26
+ });
27
+ });
28
+ resolve(true);
29
+ })
30
+ .catch(err => {
31
+ console.error("Failed to load translations:", err);
32
+ resolve(false);
33
+ });
34
+ });
35
+ };
36
+
37
+ /**
38
+ * @name setClientStyling
39
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
40
+ * @param {HTMLElement} stylingContainer The reference element of the widget
41
+ * @param {string} clientStyling The style content
42
+ */
43
+ function setClientStyling(stylingContainer, clientStyling) {
44
+ if (stylingContainer) {
45
+ const sheet = document.createElement('style');
46
+ sheet.innerHTML = clientStyling;
47
+ stylingContainer.appendChild(sheet);
48
+ }
49
+ }
50
+
51
+ /**
52
+ * @name setClientStylingURL
53
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
54
+ * @param {HTMLElement} stylingContainer The reference element of the widget
55
+ * @param {string} clientStylingUrl The URL of the style content
56
+ */
57
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
58
+ const url = new URL(clientStylingUrl);
59
+
60
+ fetch(url.href)
61
+ .then((res) => res.text())
62
+ .then((data) => {
63
+ const cssFile = document.createElement('style');
64
+ cssFile.innerHTML = data;
65
+ if (stylingContainer) {
66
+ stylingContainer.appendChild(cssFile);
67
+ }
68
+ })
69
+ .catch((err) => {
70
+ console.error('There was an error while trying to load client styling from URL', err);
71
+ });
72
+ }
73
+
74
+ /**
75
+ * @name setStreamLibrary
76
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
77
+ * @param {HTMLElement} stylingContainer The highest element of the widget
78
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
79
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
80
+ */
81
+ function setStreamStyling(stylingContainer, domain, subscription) {
82
+ if (window.emMessageBus) {
83
+ const sheet = document.createElement('style');
84
+
85
+ window.emMessageBus.subscribe(domain, (data) => {
86
+ sheet.innerHTML = data;
87
+ if (stylingContainer) {
88
+ stylingContainer.appendChild(sheet);
89
+ }
90
+ });
91
+ }
92
+ }
93
+
94
+ const generalStylingWrapperCss = ":host{display:block}";
95
+ const GeneralStylingWrapperStyle0 = generalStylingWrapperCss;
96
+
97
+ const GeneralStylingWrapper = class {
98
+ constructor(hostRef) {
99
+ registerInstance(this, hostRef);
100
+ this.stylingAppends = false;
101
+ this.clientStyling = '';
102
+ this.clientStylingUrl = '';
103
+ this.mbSource = undefined;
104
+ this.translationUrl = '';
105
+ this.targetTranslations = undefined;
106
+ }
107
+ componentDidLoad() {
108
+ if (this.el) {
109
+ if (window.emMessageBus != undefined) {
110
+ setStreamStyling(this.el, `${this.mbSource}.Style`);
111
+ }
112
+ else {
113
+ if (this.clientStyling)
114
+ setClientStyling(this.el, this.clientStyling);
115
+ if (this.clientStylingUrl)
116
+ setClientStylingURL(this.el, this.clientStylingUrl);
117
+ this.stylingAppends = true;
118
+ }
119
+ }
120
+ }
121
+ disconnectedCallback() {
122
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
123
+ }
124
+ handleClientStylingChange(newValue, oldValue) {
125
+ if (newValue != oldValue) {
126
+ setClientStyling(this.el, this.clientStyling);
127
+ }
128
+ }
129
+ handleClientStylingUrlChange(newValue, oldValue) {
130
+ if (newValue != oldValue) {
131
+ if (this.clientStylingUrl)
132
+ setClientStylingURL(this.el, this.clientStylingUrl);
133
+ }
134
+ }
135
+ componentDidRender() {
136
+ // start custom styling area
137
+ if (!this.stylingAppends) {
138
+ if (this.clientStyling)
139
+ setClientStyling(this.el, this.clientStyling);
140
+ if (this.clientStylingUrl)
141
+ setClientStylingURL(this.el, this.clientStylingUrl);
142
+ this.stylingAppends = true;
143
+ }
144
+ // end custom styling area
145
+ }
146
+ async componentWillLoad() {
147
+ const promises = [];
148
+ if (this.translationUrl) {
149
+ const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
150
+ promises.push(translationPromise);
151
+ }
152
+ return await Promise.all(promises);
153
+ }
154
+ render() {
155
+ return (h("div", { key: '09ad83748bbad518743c8671b986c541c52bf3f0', class: "StyleShell" }, h("slot", { key: '3b28b776d3944410c717b002b70946d274a4e8e7', name: "mainContent" })));
156
+ }
157
+ get el() { return getElement(this); }
158
+ static get watchers() { return {
159
+ "clientStyling": ["handleClientStylingChange"],
160
+ "clientStylingUrl": ["handleClientStylingUrlChange"]
161
+ }; }
162
+ };
163
+ GeneralStylingWrapper.style = GeneralStylingWrapperStyle0;
164
+
165
+ function _typeof(o) {
166
+ "@babel/helpers - typeof";
167
+
168
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
169
+ return typeof o;
170
+ } : function (o) {
171
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
172
+ }, _typeof(o);
173
+ }
174
+
175
+ function toInteger(dirtyNumber) {
176
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
177
+ return NaN;
178
+ }
179
+ var number = Number(dirtyNumber);
180
+ if (isNaN(number)) {
181
+ return number;
182
+ }
183
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
184
+ }
185
+
186
+ function requiredArgs(required, args) {
187
+ if (args.length < required) {
188
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
189
+ }
190
+ }
191
+
192
+ /**
193
+ * @name toDate
194
+ * @category Common Helpers
195
+ * @summary Convert the given argument to an instance of Date.
196
+ *
197
+ * @description
198
+ * Convert the given argument to an instance of Date.
199
+ *
200
+ * If the argument is an instance of Date, the function returns its clone.
201
+ *
202
+ * If the argument is a number, it is treated as a timestamp.
203
+ *
204
+ * If the argument is none of the above, the function returns Invalid Date.
205
+ *
206
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
207
+ *
208
+ * @param {Date|Number} argument - the value to convert
209
+ * @returns {Date} the parsed date in the local time zone
210
+ * @throws {TypeError} 1 argument required
211
+ *
212
+ * @example
213
+ * // Clone the date:
214
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
215
+ * //=> Tue Feb 11 2014 11:30:30
216
+ *
217
+ * @example
218
+ * // Convert the timestamp to date:
219
+ * const result = toDate(1392098430000)
220
+ * //=> Tue Feb 11 2014 11:30:30
221
+ */
222
+ function toDate(argument) {
223
+ requiredArgs(1, arguments);
224
+ var argStr = Object.prototype.toString.call(argument);
225
+
226
+ // Clone the date
227
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
228
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
229
+ return new Date(argument.getTime());
230
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
231
+ return new Date(argument);
232
+ } else {
233
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
234
+ // eslint-disable-next-line no-console
235
+ 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");
236
+ // eslint-disable-next-line no-console
237
+ console.warn(new Error().stack);
238
+ }
239
+ return new Date(NaN);
240
+ }
241
+ }
242
+
243
+ /**
244
+ * @name addMilliseconds
245
+ * @category Millisecond Helpers
246
+ * @summary Add the specified number of milliseconds to the given date.
247
+ *
248
+ * @description
249
+ * Add the specified number of milliseconds to the given date.
250
+ *
251
+ * @param {Date|Number} date - the date to be changed
252
+ * @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`.
253
+ * @returns {Date} the new date with the milliseconds added
254
+ * @throws {TypeError} 2 arguments required
255
+ *
256
+ * @example
257
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
258
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
259
+ * //=> Thu Jul 10 2014 12:45:30.750
260
+ */
261
+ function addMilliseconds(dirtyDate, dirtyAmount) {
262
+ requiredArgs(2, arguments);
263
+ var timestamp = toDate(dirtyDate).getTime();
264
+ var amount = toInteger(dirtyAmount);
265
+ return new Date(timestamp + amount);
266
+ }
267
+
268
+ var defaultOptions = {};
269
+ function getDefaultOptions() {
270
+ return defaultOptions;
271
+ }
272
+
273
+ /**
274
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
275
+ * They usually appear for dates that denote time before the timezones were introduced
276
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
277
+ * and GMT+01:00:00 after that date)
278
+ *
279
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
280
+ * which would lead to incorrect calculations.
281
+ *
282
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
283
+ */
284
+ function getTimezoneOffsetInMilliseconds(date) {
285
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
286
+ utcDate.setUTCFullYear(date.getFullYear());
287
+ return date.getTime() - utcDate.getTime();
288
+ }
289
+
290
+ /**
291
+ * @name startOfDay
292
+ * @category Day Helpers
293
+ * @summary Return the start of a day for the given date.
294
+ *
295
+ * @description
296
+ * Return the start of a day for the given date.
297
+ * The result will be in the local timezone.
298
+ *
299
+ * @param {Date|Number} date - the original date
300
+ * @returns {Date} the start of a day
301
+ * @throws {TypeError} 1 argument required
302
+ *
303
+ * @example
304
+ * // The start of a day for 2 September 2014 11:55:00:
305
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
306
+ * //=> Tue Sep 02 2014 00:00:00
307
+ */
308
+ function startOfDay(dirtyDate) {
309
+ requiredArgs(1, arguments);
310
+ var date = toDate(dirtyDate);
311
+ date.setHours(0, 0, 0, 0);
312
+ return date;
313
+ }
314
+
315
+ var MILLISECONDS_IN_DAY$1 = 86400000;
316
+
317
+ /**
318
+ * @name differenceInCalendarDays
319
+ * @category Day Helpers
320
+ * @summary Get the number of calendar days between the given dates.
321
+ *
322
+ * @description
323
+ * Get the number of calendar days between the given dates. This means that the times are removed
324
+ * from the dates and then the difference in days is calculated.
325
+ *
326
+ * @param {Date|Number} dateLeft - the later date
327
+ * @param {Date|Number} dateRight - the earlier date
328
+ * @returns {Number} the number of calendar days
329
+ * @throws {TypeError} 2 arguments required
330
+ *
331
+ * @example
332
+ * // How many calendar days are between
333
+ * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
334
+ * const result = differenceInCalendarDays(
335
+ * new Date(2012, 6, 2, 0, 0),
336
+ * new Date(2011, 6, 2, 23, 0)
337
+ * )
338
+ * //=> 366
339
+ * // How many calendar days are between
340
+ * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
341
+ * const result = differenceInCalendarDays(
342
+ * new Date(2011, 6, 3, 0, 1),
343
+ * new Date(2011, 6, 2, 23, 59)
344
+ * )
345
+ * //=> 1
346
+ */
347
+ function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {
348
+ requiredArgs(2, arguments);
349
+ var startOfDayLeft = startOfDay(dirtyDateLeft);
350
+ var startOfDayRight = startOfDay(dirtyDateRight);
351
+ var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);
352
+ var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight);
353
+
354
+ // Round the number of days to the nearest integer
355
+ // because the number of milliseconds in a day is not constant
356
+ // (e.g. it's different in the day of the daylight saving time clock shift)
357
+ return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY$1);
358
+ }
359
+
360
+ /**
361
+ * Days in 1 week.
362
+ *
363
+ * @name daysInWeek
364
+ * @constant
365
+ * @type {number}
366
+ * @default
367
+ */
368
+
369
+ /**
370
+ * Milliseconds in 1 minute
371
+ *
372
+ * @name millisecondsInMinute
373
+ * @constant
374
+ * @type {number}
375
+ * @default
376
+ */
377
+ var millisecondsInMinute = 60000;
378
+
379
+ /**
380
+ * Milliseconds in 1 hour
381
+ *
382
+ * @name millisecondsInHour
383
+ * @constant
384
+ * @type {number}
385
+ * @default
386
+ */
387
+ var millisecondsInHour = 3600000;
388
+
389
+ /**
390
+ * @name isDate
391
+ * @category Common Helpers
392
+ * @summary Is the given value a date?
393
+ *
394
+ * @description
395
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
396
+ *
397
+ * @param {*} value - the value to check
398
+ * @returns {boolean} true if the given value is a date
399
+ * @throws {TypeError} 1 arguments required
400
+ *
401
+ * @example
402
+ * // For a valid date:
403
+ * const result = isDate(new Date())
404
+ * //=> true
405
+ *
406
+ * @example
407
+ * // For an invalid date:
408
+ * const result = isDate(new Date(NaN))
409
+ * //=> true
410
+ *
411
+ * @example
412
+ * // For some value:
413
+ * const result = isDate('2014-02-31')
414
+ * //=> false
415
+ *
416
+ * @example
417
+ * // For an object:
418
+ * const result = isDate({})
419
+ * //=> false
420
+ */
421
+ function isDate(value) {
422
+ requiredArgs(1, arguments);
423
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
424
+ }
425
+
426
+ /**
427
+ * @name isValid
428
+ * @category Common Helpers
429
+ * @summary Is the given date valid?
430
+ *
431
+ * @description
432
+ * Returns false if argument is Invalid Date and true otherwise.
433
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
434
+ * Invalid Date is a Date, whose time value is NaN.
435
+ *
436
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
437
+ *
438
+ * @param {*} date - the date to check
439
+ * @returns {Boolean} the date is valid
440
+ * @throws {TypeError} 1 argument required
441
+ *
442
+ * @example
443
+ * // For the valid date:
444
+ * const result = isValid(new Date(2014, 1, 31))
445
+ * //=> true
446
+ *
447
+ * @example
448
+ * // For the value, convertable into a date:
449
+ * const result = isValid(1393804800000)
450
+ * //=> true
451
+ *
452
+ * @example
453
+ * // For the invalid date:
454
+ * const result = isValid(new Date(''))
455
+ * //=> false
456
+ */
457
+ function isValid(dirtyDate) {
458
+ requiredArgs(1, arguments);
459
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
460
+ return false;
461
+ }
462
+ var date = toDate(dirtyDate);
463
+ return !isNaN(Number(date));
464
+ }
465
+
466
+ /**
467
+ * @name differenceInMilliseconds
468
+ * @category Millisecond Helpers
469
+ * @summary Get the number of milliseconds between the given dates.
470
+ *
471
+ * @description
472
+ * Get the number of milliseconds between the given dates.
473
+ *
474
+ * @param {Date|Number} dateLeft - the later date
475
+ * @param {Date|Number} dateRight - the earlier date
476
+ * @returns {Number} the number of milliseconds
477
+ * @throws {TypeError} 2 arguments required
478
+ *
479
+ * @example
480
+ * // How many milliseconds are between
481
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
482
+ * const result = differenceInMilliseconds(
483
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
484
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
485
+ * )
486
+ * //=> 1100
487
+ */
488
+ function differenceInMilliseconds(dateLeft, dateRight) {
489
+ requiredArgs(2, arguments);
490
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
491
+ }
492
+
493
+ var roundingMap = {
494
+ ceil: Math.ceil,
495
+ round: Math.round,
496
+ floor: Math.floor,
497
+ trunc: function trunc(value) {
498
+ return value < 0 ? Math.ceil(value) : Math.floor(value);
499
+ } // Math.trunc is not supported by IE
500
+ };
501
+
502
+ var defaultRoundingMethod = 'trunc';
503
+ function getRoundingMethod(method) {
504
+ return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
505
+ }
506
+
507
+ /**
508
+ * @name differenceInHours
509
+ * @category Hour Helpers
510
+ * @summary Get the number of hours between the given dates.
511
+ *
512
+ * @description
513
+ * Get the number of hours between the given dates.
514
+ *
515
+ * @param {Date|Number} dateLeft - the later date
516
+ * @param {Date|Number} dateRight - the earlier date
517
+ * @param {Object} [options] - an object with options.
518
+ * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
519
+ * @returns {Number} the number of hours
520
+ * @throws {TypeError} 2 arguments required
521
+ *
522
+ * @example
523
+ * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?
524
+ * const result = differenceInHours(
525
+ * new Date(2014, 6, 2, 19, 0),
526
+ * new Date(2014, 6, 2, 6, 50)
527
+ * )
528
+ * //=> 12
529
+ */
530
+ function differenceInHours(dateLeft, dateRight, options) {
531
+ requiredArgs(2, arguments);
532
+ var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;
533
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
534
+ }
535
+
536
+ /**
537
+ * @name differenceInMinutes
538
+ * @category Minute Helpers
539
+ * @summary Get the number of minutes between the given dates.
540
+ *
541
+ * @description
542
+ * Get the signed number of full (rounded towards 0) minutes between the given dates.
543
+ *
544
+ * @param {Date|Number} dateLeft - the later date
545
+ * @param {Date|Number} dateRight - the earlier date
546
+ * @param {Object} [options] - an object with options.
547
+ * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
548
+ * @returns {Number} the number of minutes
549
+ * @throws {TypeError} 2 arguments required
550
+ *
551
+ * @example
552
+ * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?
553
+ * const result = differenceInMinutes(
554
+ * new Date(2014, 6, 2, 12, 20, 0),
555
+ * new Date(2014, 6, 2, 12, 7, 59)
556
+ * )
557
+ * //=> 12
558
+ *
559
+ * @example
560
+ * // How many minutes are between 10:01:59 and 10:00:00
561
+ * const result = differenceInMinutes(
562
+ * new Date(2000, 0, 1, 10, 0, 0),
563
+ * new Date(2000, 0, 1, 10, 1, 59)
564
+ * )
565
+ * //=> -1
566
+ */
567
+ function differenceInMinutes(dateLeft, dateRight, options) {
568
+ requiredArgs(2, arguments);
569
+ var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;
570
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
571
+ }
572
+
573
+ /**
574
+ * @name subMilliseconds
575
+ * @category Millisecond Helpers
576
+ * @summary Subtract the specified number of milliseconds from the given date.
577
+ *
578
+ * @description
579
+ * Subtract the specified number of milliseconds from the given date.
580
+ *
581
+ * @param {Date|Number} date - the date to be changed
582
+ * @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`.
583
+ * @returns {Date} the new date with the milliseconds subtracted
584
+ * @throws {TypeError} 2 arguments required
585
+ *
586
+ * @example
587
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
588
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
589
+ * //=> Thu Jul 10 2014 12:45:29.250
590
+ */
591
+ function subMilliseconds(dirtyDate, dirtyAmount) {
592
+ requiredArgs(2, arguments);
593
+ var amount = toInteger(dirtyAmount);
594
+ return addMilliseconds(dirtyDate, -amount);
595
+ }
596
+
597
+ var MILLISECONDS_IN_DAY = 86400000;
598
+ function getUTCDayOfYear(dirtyDate) {
599
+ requiredArgs(1, arguments);
600
+ var date = toDate(dirtyDate);
601
+ var timestamp = date.getTime();
602
+ date.setUTCMonth(0, 1);
603
+ date.setUTCHours(0, 0, 0, 0);
604
+ var startOfYearTimestamp = date.getTime();
605
+ var difference = timestamp - startOfYearTimestamp;
606
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
607
+ }
608
+
609
+ function startOfUTCISOWeek(dirtyDate) {
610
+ requiredArgs(1, arguments);
611
+ var weekStartsOn = 1;
612
+ var date = toDate(dirtyDate);
613
+ var day = date.getUTCDay();
614
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
615
+ date.setUTCDate(date.getUTCDate() - diff);
616
+ date.setUTCHours(0, 0, 0, 0);
617
+ return date;
618
+ }
619
+
620
+ function getUTCISOWeekYear(dirtyDate) {
621
+ requiredArgs(1, arguments);
622
+ var date = toDate(dirtyDate);
623
+ var year = date.getUTCFullYear();
624
+ var fourthOfJanuaryOfNextYear = new Date(0);
625
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
626
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
627
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
628
+ var fourthOfJanuaryOfThisYear = new Date(0);
629
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
630
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
631
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
632
+ if (date.getTime() >= startOfNextYear.getTime()) {
633
+ return year + 1;
634
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
635
+ return year;
636
+ } else {
637
+ return year - 1;
638
+ }
639
+ }
640
+
641
+ function startOfUTCISOWeekYear(dirtyDate) {
642
+ requiredArgs(1, arguments);
643
+ var year = getUTCISOWeekYear(dirtyDate);
644
+ var fourthOfJanuary = new Date(0);
645
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
646
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
647
+ var date = startOfUTCISOWeek(fourthOfJanuary);
648
+ return date;
649
+ }
650
+
651
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
652
+ function getUTCISOWeek(dirtyDate) {
653
+ requiredArgs(1, arguments);
654
+ var date = toDate(dirtyDate);
655
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
656
+
657
+ // Round the number of days to the nearest integer
658
+ // because the number of milliseconds in a week is not constant
659
+ // (e.g. it's different in the week of the daylight saving time clock shift)
660
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
661
+ }
662
+
663
+ function startOfUTCWeek(dirtyDate, options) {
664
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
665
+ requiredArgs(1, arguments);
666
+ var defaultOptions = getDefaultOptions();
667
+ 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);
668
+
669
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
670
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
671
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
672
+ }
673
+ var date = toDate(dirtyDate);
674
+ var day = date.getUTCDay();
675
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
676
+ date.setUTCDate(date.getUTCDate() - diff);
677
+ date.setUTCHours(0, 0, 0, 0);
678
+ return date;
679
+ }
680
+
681
+ function getUTCWeekYear(dirtyDate, options) {
682
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
683
+ requiredArgs(1, arguments);
684
+ var date = toDate(dirtyDate);
685
+ var year = date.getUTCFullYear();
686
+ var defaultOptions = getDefaultOptions();
687
+ 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);
688
+
689
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
690
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
691
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
692
+ }
693
+ var firstWeekOfNextYear = new Date(0);
694
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
695
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
696
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
697
+ var firstWeekOfThisYear = new Date(0);
698
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
699
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
700
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
701
+ if (date.getTime() >= startOfNextYear.getTime()) {
702
+ return year + 1;
703
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
704
+ return year;
705
+ } else {
706
+ return year - 1;
707
+ }
708
+ }
709
+
710
+ function startOfUTCWeekYear(dirtyDate, options) {
711
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
712
+ requiredArgs(1, arguments);
713
+ var defaultOptions = getDefaultOptions();
714
+ 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);
715
+ var year = getUTCWeekYear(dirtyDate, options);
716
+ var firstWeek = new Date(0);
717
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
718
+ firstWeek.setUTCHours(0, 0, 0, 0);
719
+ var date = startOfUTCWeek(firstWeek, options);
720
+ return date;
721
+ }
722
+
723
+ var MILLISECONDS_IN_WEEK = 604800000;
724
+ function getUTCWeek(dirtyDate, options) {
725
+ requiredArgs(1, arguments);
726
+ var date = toDate(dirtyDate);
727
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
728
+
729
+ // Round the number of days to the nearest integer
730
+ // because the number of milliseconds in a week is not constant
731
+ // (e.g. it's different in the week of the daylight saving time clock shift)
732
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
733
+ }
734
+
735
+ function addLeadingZeros(number, targetLength) {
736
+ var sign = number < 0 ? '-' : '';
737
+ var output = Math.abs(number).toString();
738
+ while (output.length < targetLength) {
739
+ output = '0' + output;
740
+ }
741
+ return sign + output;
742
+ }
743
+
744
+ /*
745
+ * | | Unit | | Unit |
746
+ * |-----|--------------------------------|-----|--------------------------------|
747
+ * | a | AM, PM | A* | |
748
+ * | d | Day of month | D | |
749
+ * | h | Hour [1-12] | H | Hour [0-23] |
750
+ * | m | Minute | M | Month |
751
+ * | s | Second | S | Fraction of second |
752
+ * | y | Year (abs) | Y | |
753
+ *
754
+ * Letters marked by * are not implemented but reserved by Unicode standard.
755
+ */
756
+ var formatters$2 = {
757
+ // Year
758
+ y: function y(date, token) {
759
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
760
+ // | Year | y | yy | yyy | yyyy | yyyyy |
761
+ // |----------|-------|----|-------|-------|-------|
762
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
763
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
764
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
765
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
766
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
767
+
768
+ var signedYear = date.getUTCFullYear();
769
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
770
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
771
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
772
+ },
773
+ // Month
774
+ M: function M(date, token) {
775
+ var month = date.getUTCMonth();
776
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
777
+ },
778
+ // Day of the month
779
+ d: function d(date, token) {
780
+ return addLeadingZeros(date.getUTCDate(), token.length);
781
+ },
782
+ // AM or PM
783
+ a: function a(date, token) {
784
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
785
+ switch (token) {
786
+ case 'a':
787
+ case 'aa':
788
+ return dayPeriodEnumValue.toUpperCase();
789
+ case 'aaa':
790
+ return dayPeriodEnumValue;
791
+ case 'aaaaa':
792
+ return dayPeriodEnumValue[0];
793
+ case 'aaaa':
794
+ default:
795
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
796
+ }
797
+ },
798
+ // Hour [1-12]
799
+ h: function h(date, token) {
800
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
801
+ },
802
+ // Hour [0-23]
803
+ H: function H(date, token) {
804
+ return addLeadingZeros(date.getUTCHours(), token.length);
805
+ },
806
+ // Minute
807
+ m: function m(date, token) {
808
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
809
+ },
810
+ // Second
811
+ s: function s(date, token) {
812
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
813
+ },
814
+ // Fraction of second
815
+ S: function S(date, token) {
816
+ var numberOfDigits = token.length;
817
+ var milliseconds = date.getUTCMilliseconds();
818
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
819
+ return addLeadingZeros(fractionalSeconds, token.length);
820
+ }
821
+ };
822
+ const formatters$3 = formatters$2;
823
+
824
+ var dayPeriodEnum = {
825
+ am: 'am',
826
+ pm: 'pm',
827
+ midnight: 'midnight',
828
+ noon: 'noon',
829
+ morning: 'morning',
830
+ afternoon: 'afternoon',
831
+ evening: 'evening',
832
+ night: 'night'
833
+ };
834
+ /*
835
+ * | | Unit | | Unit |
836
+ * |-----|--------------------------------|-----|--------------------------------|
837
+ * | a | AM, PM | A* | Milliseconds in day |
838
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
839
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
840
+ * | d | Day of month | D | Day of year |
841
+ * | e | Local day of week | E | Day of week |
842
+ * | f | | F* | Day of week in month |
843
+ * | g* | Modified Julian day | G | Era |
844
+ * | h | Hour [1-12] | H | Hour [0-23] |
845
+ * | i! | ISO day of week | I! | ISO week of year |
846
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
847
+ * | k | Hour [1-24] | K | Hour [0-11] |
848
+ * | l* | (deprecated) | L | Stand-alone month |
849
+ * | m | Minute | M | Month |
850
+ * | n | | N | |
851
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
852
+ * | p! | Long localized time | P! | Long localized date |
853
+ * | q | Stand-alone quarter | Q | Quarter |
854
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
855
+ * | s | Second | S | Fraction of second |
856
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
857
+ * | u | Extended year | U* | Cyclic year |
858
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
859
+ * | w | Local week of year | W* | Week of month |
860
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
861
+ * | y | Year (abs) | Y | Local week-numbering year |
862
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
863
+ *
864
+ * Letters marked by * are not implemented but reserved by Unicode standard.
865
+ *
866
+ * Letters marked by ! are non-standard, but implemented by date-fns:
867
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
868
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
869
+ * i.e. 7 for Sunday, 1 for Monday, etc.
870
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
871
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
872
+ * `R` is supposed to be used in conjunction with `I` and `i`
873
+ * for universal ISO week-numbering date, whereas
874
+ * `Y` is supposed to be used in conjunction with `w` and `e`
875
+ * for week-numbering date specific to the locale.
876
+ * - `P` is long localized date format
877
+ * - `p` is long localized time format
878
+ */
879
+
880
+ var formatters = {
881
+ // Era
882
+ G: function G(date, token, localize) {
883
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
884
+ switch (token) {
885
+ // AD, BC
886
+ case 'G':
887
+ case 'GG':
888
+ case 'GGG':
889
+ return localize.era(era, {
890
+ width: 'abbreviated'
891
+ });
892
+ // A, B
893
+ case 'GGGGG':
894
+ return localize.era(era, {
895
+ width: 'narrow'
896
+ });
897
+ // Anno Domini, Before Christ
898
+ case 'GGGG':
899
+ default:
900
+ return localize.era(era, {
901
+ width: 'wide'
902
+ });
903
+ }
904
+ },
905
+ // Year
906
+ y: function y(date, token, localize) {
907
+ // Ordinal number
908
+ if (token === 'yo') {
909
+ var signedYear = date.getUTCFullYear();
910
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
911
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
912
+ return localize.ordinalNumber(year, {
913
+ unit: 'year'
914
+ });
915
+ }
916
+ return formatters$3.y(date, token);
917
+ },
918
+ // Local week-numbering year
919
+ Y: function Y(date, token, localize, options) {
920
+ var signedWeekYear = getUTCWeekYear(date, options);
921
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
922
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
923
+
924
+ // Two digit year
925
+ if (token === 'YY') {
926
+ var twoDigitYear = weekYear % 100;
927
+ return addLeadingZeros(twoDigitYear, 2);
928
+ }
929
+
930
+ // Ordinal number
931
+ if (token === 'Yo') {
932
+ return localize.ordinalNumber(weekYear, {
933
+ unit: 'year'
934
+ });
935
+ }
936
+
937
+ // Padding
938
+ return addLeadingZeros(weekYear, token.length);
939
+ },
940
+ // ISO week-numbering year
941
+ R: function R(date, token) {
942
+ var isoWeekYear = getUTCISOWeekYear(date);
943
+
944
+ // Padding
945
+ return addLeadingZeros(isoWeekYear, token.length);
946
+ },
947
+ // Extended year. This is a single number designating the year of this calendar system.
948
+ // The main difference between `y` and `u` localizers are B.C. years:
949
+ // | Year | `y` | `u` |
950
+ // |------|-----|-----|
951
+ // | AC 1 | 1 | 1 |
952
+ // | BC 1 | 1 | 0 |
953
+ // | BC 2 | 2 | -1 |
954
+ // Also `yy` always returns the last two digits of a year,
955
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
956
+ u: function u(date, token) {
957
+ var year = date.getUTCFullYear();
958
+ return addLeadingZeros(year, token.length);
959
+ },
960
+ // Quarter
961
+ Q: function Q(date, token, localize) {
962
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
963
+ switch (token) {
964
+ // 1, 2, 3, 4
965
+ case 'Q':
966
+ return String(quarter);
967
+ // 01, 02, 03, 04
968
+ case 'QQ':
969
+ return addLeadingZeros(quarter, 2);
970
+ // 1st, 2nd, 3rd, 4th
971
+ case 'Qo':
972
+ return localize.ordinalNumber(quarter, {
973
+ unit: 'quarter'
974
+ });
975
+ // Q1, Q2, Q3, Q4
976
+ case 'QQQ':
977
+ return localize.quarter(quarter, {
978
+ width: 'abbreviated',
979
+ context: 'formatting'
980
+ });
981
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
982
+ case 'QQQQQ':
983
+ return localize.quarter(quarter, {
984
+ width: 'narrow',
985
+ context: 'formatting'
986
+ });
987
+ // 1st quarter, 2nd quarter, ...
988
+ case 'QQQQ':
989
+ default:
990
+ return localize.quarter(quarter, {
991
+ width: 'wide',
992
+ context: 'formatting'
993
+ });
994
+ }
995
+ },
996
+ // Stand-alone quarter
997
+ q: function q(date, token, localize) {
998
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
999
+ switch (token) {
1000
+ // 1, 2, 3, 4
1001
+ case 'q':
1002
+ return String(quarter);
1003
+ // 01, 02, 03, 04
1004
+ case 'qq':
1005
+ return addLeadingZeros(quarter, 2);
1006
+ // 1st, 2nd, 3rd, 4th
1007
+ case 'qo':
1008
+ return localize.ordinalNumber(quarter, {
1009
+ unit: 'quarter'
1010
+ });
1011
+ // Q1, Q2, Q3, Q4
1012
+ case 'qqq':
1013
+ return localize.quarter(quarter, {
1014
+ width: 'abbreviated',
1015
+ context: 'standalone'
1016
+ });
1017
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1018
+ case 'qqqqq':
1019
+ return localize.quarter(quarter, {
1020
+ width: 'narrow',
1021
+ context: 'standalone'
1022
+ });
1023
+ // 1st quarter, 2nd quarter, ...
1024
+ case 'qqqq':
1025
+ default:
1026
+ return localize.quarter(quarter, {
1027
+ width: 'wide',
1028
+ context: 'standalone'
1029
+ });
1030
+ }
1031
+ },
1032
+ // Month
1033
+ M: function M(date, token, localize) {
1034
+ var month = date.getUTCMonth();
1035
+ switch (token) {
1036
+ case 'M':
1037
+ case 'MM':
1038
+ return formatters$3.M(date, token);
1039
+ // 1st, 2nd, ..., 12th
1040
+ case 'Mo':
1041
+ return localize.ordinalNumber(month + 1, {
1042
+ unit: 'month'
1043
+ });
1044
+ // Jan, Feb, ..., Dec
1045
+ case 'MMM':
1046
+ return localize.month(month, {
1047
+ width: 'abbreviated',
1048
+ context: 'formatting'
1049
+ });
1050
+ // J, F, ..., D
1051
+ case 'MMMMM':
1052
+ return localize.month(month, {
1053
+ width: 'narrow',
1054
+ context: 'formatting'
1055
+ });
1056
+ // January, February, ..., December
1057
+ case 'MMMM':
1058
+ default:
1059
+ return localize.month(month, {
1060
+ width: 'wide',
1061
+ context: 'formatting'
1062
+ });
1063
+ }
1064
+ },
1065
+ // Stand-alone month
1066
+ L: function L(date, token, localize) {
1067
+ var month = date.getUTCMonth();
1068
+ switch (token) {
1069
+ // 1, 2, ..., 12
1070
+ case 'L':
1071
+ return String(month + 1);
1072
+ // 01, 02, ..., 12
1073
+ case 'LL':
1074
+ return addLeadingZeros(month + 1, 2);
1075
+ // 1st, 2nd, ..., 12th
1076
+ case 'Lo':
1077
+ return localize.ordinalNumber(month + 1, {
1078
+ unit: 'month'
1079
+ });
1080
+ // Jan, Feb, ..., Dec
1081
+ case 'LLL':
1082
+ return localize.month(month, {
1083
+ width: 'abbreviated',
1084
+ context: 'standalone'
1085
+ });
1086
+ // J, F, ..., D
1087
+ case 'LLLLL':
1088
+ return localize.month(month, {
1089
+ width: 'narrow',
1090
+ context: 'standalone'
1091
+ });
1092
+ // January, February, ..., December
1093
+ case 'LLLL':
1094
+ default:
1095
+ return localize.month(month, {
1096
+ width: 'wide',
1097
+ context: 'standalone'
1098
+ });
1099
+ }
1100
+ },
1101
+ // Local week of year
1102
+ w: function w(date, token, localize, options) {
1103
+ var week = getUTCWeek(date, options);
1104
+ if (token === 'wo') {
1105
+ return localize.ordinalNumber(week, {
1106
+ unit: 'week'
1107
+ });
1108
+ }
1109
+ return addLeadingZeros(week, token.length);
1110
+ },
1111
+ // ISO week of year
1112
+ I: function I(date, token, localize) {
1113
+ var isoWeek = getUTCISOWeek(date);
1114
+ if (token === 'Io') {
1115
+ return localize.ordinalNumber(isoWeek, {
1116
+ unit: 'week'
1117
+ });
1118
+ }
1119
+ return addLeadingZeros(isoWeek, token.length);
1120
+ },
1121
+ // Day of the month
1122
+ d: function d(date, token, localize) {
1123
+ if (token === 'do') {
1124
+ return localize.ordinalNumber(date.getUTCDate(), {
1125
+ unit: 'date'
1126
+ });
1127
+ }
1128
+ return formatters$3.d(date, token);
1129
+ },
1130
+ // Day of year
1131
+ D: function D(date, token, localize) {
1132
+ var dayOfYear = getUTCDayOfYear(date);
1133
+ if (token === 'Do') {
1134
+ return localize.ordinalNumber(dayOfYear, {
1135
+ unit: 'dayOfYear'
1136
+ });
1137
+ }
1138
+ return addLeadingZeros(dayOfYear, token.length);
1139
+ },
1140
+ // Day of week
1141
+ E: function E(date, token, localize) {
1142
+ var dayOfWeek = date.getUTCDay();
1143
+ switch (token) {
1144
+ // Tue
1145
+ case 'E':
1146
+ case 'EE':
1147
+ case 'EEE':
1148
+ return localize.day(dayOfWeek, {
1149
+ width: 'abbreviated',
1150
+ context: 'formatting'
1151
+ });
1152
+ // T
1153
+ case 'EEEEE':
1154
+ return localize.day(dayOfWeek, {
1155
+ width: 'narrow',
1156
+ context: 'formatting'
1157
+ });
1158
+ // Tu
1159
+ case 'EEEEEE':
1160
+ return localize.day(dayOfWeek, {
1161
+ width: 'short',
1162
+ context: 'formatting'
1163
+ });
1164
+ // Tuesday
1165
+ case 'EEEE':
1166
+ default:
1167
+ return localize.day(dayOfWeek, {
1168
+ width: 'wide',
1169
+ context: 'formatting'
1170
+ });
1171
+ }
1172
+ },
1173
+ // Local day of week
1174
+ e: function e(date, token, localize, options) {
1175
+ var dayOfWeek = date.getUTCDay();
1176
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1177
+ switch (token) {
1178
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
1179
+ case 'e':
1180
+ return String(localDayOfWeek);
1181
+ // Padded numerical value
1182
+ case 'ee':
1183
+ return addLeadingZeros(localDayOfWeek, 2);
1184
+ // 1st, 2nd, ..., 7th
1185
+ case 'eo':
1186
+ return localize.ordinalNumber(localDayOfWeek, {
1187
+ unit: 'day'
1188
+ });
1189
+ case 'eee':
1190
+ return localize.day(dayOfWeek, {
1191
+ width: 'abbreviated',
1192
+ context: 'formatting'
1193
+ });
1194
+ // T
1195
+ case 'eeeee':
1196
+ return localize.day(dayOfWeek, {
1197
+ width: 'narrow',
1198
+ context: 'formatting'
1199
+ });
1200
+ // Tu
1201
+ case 'eeeeee':
1202
+ return localize.day(dayOfWeek, {
1203
+ width: 'short',
1204
+ context: 'formatting'
1205
+ });
1206
+ // Tuesday
1207
+ case 'eeee':
1208
+ default:
1209
+ return localize.day(dayOfWeek, {
1210
+ width: 'wide',
1211
+ context: 'formatting'
1212
+ });
1213
+ }
1214
+ },
1215
+ // Stand-alone local day of week
1216
+ c: function c(date, token, localize, options) {
1217
+ var dayOfWeek = date.getUTCDay();
1218
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1219
+ switch (token) {
1220
+ // Numerical value (same as in `e`)
1221
+ case 'c':
1222
+ return String(localDayOfWeek);
1223
+ // Padded numerical value
1224
+ case 'cc':
1225
+ return addLeadingZeros(localDayOfWeek, token.length);
1226
+ // 1st, 2nd, ..., 7th
1227
+ case 'co':
1228
+ return localize.ordinalNumber(localDayOfWeek, {
1229
+ unit: 'day'
1230
+ });
1231
+ case 'ccc':
1232
+ return localize.day(dayOfWeek, {
1233
+ width: 'abbreviated',
1234
+ context: 'standalone'
1235
+ });
1236
+ // T
1237
+ case 'ccccc':
1238
+ return localize.day(dayOfWeek, {
1239
+ width: 'narrow',
1240
+ context: 'standalone'
1241
+ });
1242
+ // Tu
1243
+ case 'cccccc':
1244
+ return localize.day(dayOfWeek, {
1245
+ width: 'short',
1246
+ context: 'standalone'
1247
+ });
1248
+ // Tuesday
1249
+ case 'cccc':
1250
+ default:
1251
+ return localize.day(dayOfWeek, {
1252
+ width: 'wide',
1253
+ context: 'standalone'
1254
+ });
1255
+ }
1256
+ },
1257
+ // ISO day of week
1258
+ i: function i(date, token, localize) {
1259
+ var dayOfWeek = date.getUTCDay();
1260
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1261
+ switch (token) {
1262
+ // 2
1263
+ case 'i':
1264
+ return String(isoDayOfWeek);
1265
+ // 02
1266
+ case 'ii':
1267
+ return addLeadingZeros(isoDayOfWeek, token.length);
1268
+ // 2nd
1269
+ case 'io':
1270
+ return localize.ordinalNumber(isoDayOfWeek, {
1271
+ unit: 'day'
1272
+ });
1273
+ // Tue
1274
+ case 'iii':
1275
+ return localize.day(dayOfWeek, {
1276
+ width: 'abbreviated',
1277
+ context: 'formatting'
1278
+ });
1279
+ // T
1280
+ case 'iiiii':
1281
+ return localize.day(dayOfWeek, {
1282
+ width: 'narrow',
1283
+ context: 'formatting'
1284
+ });
1285
+ // Tu
1286
+ case 'iiiiii':
1287
+ return localize.day(dayOfWeek, {
1288
+ width: 'short',
1289
+ context: 'formatting'
1290
+ });
1291
+ // Tuesday
1292
+ case 'iiii':
1293
+ default:
1294
+ return localize.day(dayOfWeek, {
1295
+ width: 'wide',
1296
+ context: 'formatting'
1297
+ });
1298
+ }
1299
+ },
1300
+ // AM or PM
1301
+ a: function a(date, token, localize) {
1302
+ var hours = date.getUTCHours();
1303
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1304
+ switch (token) {
1305
+ case 'a':
1306
+ case 'aa':
1307
+ return localize.dayPeriod(dayPeriodEnumValue, {
1308
+ width: 'abbreviated',
1309
+ context: 'formatting'
1310
+ });
1311
+ case 'aaa':
1312
+ return localize.dayPeriod(dayPeriodEnumValue, {
1313
+ width: 'abbreviated',
1314
+ context: 'formatting'
1315
+ }).toLowerCase();
1316
+ case 'aaaaa':
1317
+ return localize.dayPeriod(dayPeriodEnumValue, {
1318
+ width: 'narrow',
1319
+ context: 'formatting'
1320
+ });
1321
+ case 'aaaa':
1322
+ default:
1323
+ return localize.dayPeriod(dayPeriodEnumValue, {
1324
+ width: 'wide',
1325
+ context: 'formatting'
1326
+ });
1327
+ }
1328
+ },
1329
+ // AM, PM, midnight, noon
1330
+ b: function b(date, token, localize) {
1331
+ var hours = date.getUTCHours();
1332
+ var dayPeriodEnumValue;
1333
+ if (hours === 12) {
1334
+ dayPeriodEnumValue = dayPeriodEnum.noon;
1335
+ } else if (hours === 0) {
1336
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
1337
+ } else {
1338
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1339
+ }
1340
+ switch (token) {
1341
+ case 'b':
1342
+ case 'bb':
1343
+ return localize.dayPeriod(dayPeriodEnumValue, {
1344
+ width: 'abbreviated',
1345
+ context: 'formatting'
1346
+ });
1347
+ case 'bbb':
1348
+ return localize.dayPeriod(dayPeriodEnumValue, {
1349
+ width: 'abbreviated',
1350
+ context: 'formatting'
1351
+ }).toLowerCase();
1352
+ case 'bbbbb':
1353
+ return localize.dayPeriod(dayPeriodEnumValue, {
1354
+ width: 'narrow',
1355
+ context: 'formatting'
1356
+ });
1357
+ case 'bbbb':
1358
+ default:
1359
+ return localize.dayPeriod(dayPeriodEnumValue, {
1360
+ width: 'wide',
1361
+ context: 'formatting'
1362
+ });
1363
+ }
1364
+ },
1365
+ // in the morning, in the afternoon, in the evening, at night
1366
+ B: function B(date, token, localize) {
1367
+ var hours = date.getUTCHours();
1368
+ var dayPeriodEnumValue;
1369
+ if (hours >= 17) {
1370
+ dayPeriodEnumValue = dayPeriodEnum.evening;
1371
+ } else if (hours >= 12) {
1372
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
1373
+ } else if (hours >= 4) {
1374
+ dayPeriodEnumValue = dayPeriodEnum.morning;
1375
+ } else {
1376
+ dayPeriodEnumValue = dayPeriodEnum.night;
1377
+ }
1378
+ switch (token) {
1379
+ case 'B':
1380
+ case 'BB':
1381
+ case 'BBB':
1382
+ return localize.dayPeriod(dayPeriodEnumValue, {
1383
+ width: 'abbreviated',
1384
+ context: 'formatting'
1385
+ });
1386
+ case 'BBBBB':
1387
+ return localize.dayPeriod(dayPeriodEnumValue, {
1388
+ width: 'narrow',
1389
+ context: 'formatting'
1390
+ });
1391
+ case 'BBBB':
1392
+ default:
1393
+ return localize.dayPeriod(dayPeriodEnumValue, {
1394
+ width: 'wide',
1395
+ context: 'formatting'
1396
+ });
1397
+ }
1398
+ },
1399
+ // Hour [1-12]
1400
+ h: function h(date, token, localize) {
1401
+ if (token === 'ho') {
1402
+ var hours = date.getUTCHours() % 12;
1403
+ if (hours === 0) hours = 12;
1404
+ return localize.ordinalNumber(hours, {
1405
+ unit: 'hour'
1406
+ });
1407
+ }
1408
+ return formatters$3.h(date, token);
1409
+ },
1410
+ // Hour [0-23]
1411
+ H: function H(date, token, localize) {
1412
+ if (token === 'Ho') {
1413
+ return localize.ordinalNumber(date.getUTCHours(), {
1414
+ unit: 'hour'
1415
+ });
1416
+ }
1417
+ return formatters$3.H(date, token);
1418
+ },
1419
+ // Hour [0-11]
1420
+ K: function K(date, token, localize) {
1421
+ var hours = date.getUTCHours() % 12;
1422
+ if (token === 'Ko') {
1423
+ return localize.ordinalNumber(hours, {
1424
+ unit: 'hour'
1425
+ });
1426
+ }
1427
+ return addLeadingZeros(hours, token.length);
1428
+ },
1429
+ // Hour [1-24]
1430
+ k: function k(date, token, localize) {
1431
+ var hours = date.getUTCHours();
1432
+ if (hours === 0) hours = 24;
1433
+ if (token === 'ko') {
1434
+ return localize.ordinalNumber(hours, {
1435
+ unit: 'hour'
1436
+ });
1437
+ }
1438
+ return addLeadingZeros(hours, token.length);
1439
+ },
1440
+ // Minute
1441
+ m: function m(date, token, localize) {
1442
+ if (token === 'mo') {
1443
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1444
+ unit: 'minute'
1445
+ });
1446
+ }
1447
+ return formatters$3.m(date, token);
1448
+ },
1449
+ // Second
1450
+ s: function s(date, token, localize) {
1451
+ if (token === 'so') {
1452
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1453
+ unit: 'second'
1454
+ });
1455
+ }
1456
+ return formatters$3.s(date, token);
1457
+ },
1458
+ // Fraction of second
1459
+ S: function S(date, token) {
1460
+ return formatters$3.S(date, token);
1461
+ },
1462
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1463
+ X: function X(date, token, _localize, options) {
1464
+ var originalDate = options._originalDate || date;
1465
+ var timezoneOffset = originalDate.getTimezoneOffset();
1466
+ if (timezoneOffset === 0) {
1467
+ return 'Z';
1468
+ }
1469
+ switch (token) {
1470
+ // Hours and optional minutes
1471
+ case 'X':
1472
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1473
+
1474
+ // Hours, minutes and optional seconds without `:` delimiter
1475
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1476
+ // so this token always has the same output as `XX`
1477
+ case 'XXXX':
1478
+ case 'XX':
1479
+ // Hours and minutes without `:` delimiter
1480
+ return formatTimezone(timezoneOffset);
1481
+
1482
+ // Hours, minutes and optional seconds with `:` delimiter
1483
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1484
+ // so this token always has the same output as `XXX`
1485
+ case 'XXXXX':
1486
+ case 'XXX': // Hours and minutes with `:` delimiter
1487
+ default:
1488
+ return formatTimezone(timezoneOffset, ':');
1489
+ }
1490
+ },
1491
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1492
+ x: function x(date, token, _localize, options) {
1493
+ var originalDate = options._originalDate || date;
1494
+ var timezoneOffset = originalDate.getTimezoneOffset();
1495
+ switch (token) {
1496
+ // Hours and optional minutes
1497
+ case 'x':
1498
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1499
+
1500
+ // Hours, minutes and optional seconds without `:` delimiter
1501
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1502
+ // so this token always has the same output as `xx`
1503
+ case 'xxxx':
1504
+ case 'xx':
1505
+ // Hours and minutes without `:` delimiter
1506
+ return formatTimezone(timezoneOffset);
1507
+
1508
+ // Hours, minutes and optional seconds with `:` delimiter
1509
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1510
+ // so this token always has the same output as `xxx`
1511
+ case 'xxxxx':
1512
+ case 'xxx': // Hours and minutes with `:` delimiter
1513
+ default:
1514
+ return formatTimezone(timezoneOffset, ':');
1515
+ }
1516
+ },
1517
+ // Timezone (GMT)
1518
+ O: function O(date, token, _localize, options) {
1519
+ var originalDate = options._originalDate || date;
1520
+ var timezoneOffset = originalDate.getTimezoneOffset();
1521
+ switch (token) {
1522
+ // Short
1523
+ case 'O':
1524
+ case 'OO':
1525
+ case 'OOO':
1526
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1527
+ // Long
1528
+ case 'OOOO':
1529
+ default:
1530
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1531
+ }
1532
+ },
1533
+ // Timezone (specific non-location)
1534
+ z: function z(date, token, _localize, options) {
1535
+ var originalDate = options._originalDate || date;
1536
+ var timezoneOffset = originalDate.getTimezoneOffset();
1537
+ switch (token) {
1538
+ // Short
1539
+ case 'z':
1540
+ case 'zz':
1541
+ case 'zzz':
1542
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1543
+ // Long
1544
+ case 'zzzz':
1545
+ default:
1546
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1547
+ }
1548
+ },
1549
+ // Seconds timestamp
1550
+ t: function t(date, token, _localize, options) {
1551
+ var originalDate = options._originalDate || date;
1552
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1553
+ return addLeadingZeros(timestamp, token.length);
1554
+ },
1555
+ // Milliseconds timestamp
1556
+ T: function T(date, token, _localize, options) {
1557
+ var originalDate = options._originalDate || date;
1558
+ var timestamp = originalDate.getTime();
1559
+ return addLeadingZeros(timestamp, token.length);
1560
+ }
1561
+ };
1562
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1563
+ var sign = offset > 0 ? '-' : '+';
1564
+ var absOffset = Math.abs(offset);
1565
+ var hours = Math.floor(absOffset / 60);
1566
+ var minutes = absOffset % 60;
1567
+ if (minutes === 0) {
1568
+ return sign + String(hours);
1569
+ }
1570
+ var delimiter = dirtyDelimiter || '';
1571
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1572
+ }
1573
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1574
+ if (offset % 60 === 0) {
1575
+ var sign = offset > 0 ? '-' : '+';
1576
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1577
+ }
1578
+ return formatTimezone(offset, dirtyDelimiter);
1579
+ }
1580
+ function formatTimezone(offset, dirtyDelimiter) {
1581
+ var delimiter = dirtyDelimiter || '';
1582
+ var sign = offset > 0 ? '-' : '+';
1583
+ var absOffset = Math.abs(offset);
1584
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1585
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1586
+ return sign + hours + delimiter + minutes;
1587
+ }
1588
+ const formatters$1 = formatters;
1589
+
1590
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1591
+ switch (pattern) {
1592
+ case 'P':
1593
+ return formatLong.date({
1594
+ width: 'short'
1595
+ });
1596
+ case 'PP':
1597
+ return formatLong.date({
1598
+ width: 'medium'
1599
+ });
1600
+ case 'PPP':
1601
+ return formatLong.date({
1602
+ width: 'long'
1603
+ });
1604
+ case 'PPPP':
1605
+ default:
1606
+ return formatLong.date({
1607
+ width: 'full'
1608
+ });
1609
+ }
1610
+ };
1611
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1612
+ switch (pattern) {
1613
+ case 'p':
1614
+ return formatLong.time({
1615
+ width: 'short'
1616
+ });
1617
+ case 'pp':
1618
+ return formatLong.time({
1619
+ width: 'medium'
1620
+ });
1621
+ case 'ppp':
1622
+ return formatLong.time({
1623
+ width: 'long'
1624
+ });
1625
+ case 'pppp':
1626
+ default:
1627
+ return formatLong.time({
1628
+ width: 'full'
1629
+ });
1630
+ }
1631
+ };
1632
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1633
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1634
+ var datePattern = matchResult[1];
1635
+ var timePattern = matchResult[2];
1636
+ if (!timePattern) {
1637
+ return dateLongFormatter(pattern, formatLong);
1638
+ }
1639
+ var dateTimeFormat;
1640
+ switch (datePattern) {
1641
+ case 'P':
1642
+ dateTimeFormat = formatLong.dateTime({
1643
+ width: 'short'
1644
+ });
1645
+ break;
1646
+ case 'PP':
1647
+ dateTimeFormat = formatLong.dateTime({
1648
+ width: 'medium'
1649
+ });
1650
+ break;
1651
+ case 'PPP':
1652
+ dateTimeFormat = formatLong.dateTime({
1653
+ width: 'long'
1654
+ });
1655
+ break;
1656
+ case 'PPPP':
1657
+ default:
1658
+ dateTimeFormat = formatLong.dateTime({
1659
+ width: 'full'
1660
+ });
1661
+ break;
1662
+ }
1663
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1664
+ };
1665
+ var longFormatters = {
1666
+ p: timeLongFormatter,
1667
+ P: dateTimeLongFormatter
1668
+ };
1669
+ const longFormatters$1 = longFormatters;
1670
+
1671
+ var protectedDayOfYearTokens = ['D', 'DD'];
1672
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1673
+ function isProtectedDayOfYearToken(token) {
1674
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1675
+ }
1676
+ function isProtectedWeekYearToken(token) {
1677
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1678
+ }
1679
+ function throwProtectedError(token, format, input) {
1680
+ if (token === 'YYYY') {
1681
+ 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"));
1682
+ } else if (token === 'YY') {
1683
+ 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"));
1684
+ } else if (token === 'D') {
1685
+ 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"));
1686
+ } else if (token === 'DD') {
1687
+ 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"));
1688
+ }
1689
+ }
1690
+
1691
+ var formatDistanceLocale = {
1692
+ lessThanXSeconds: {
1693
+ one: 'less than a second',
1694
+ other: 'less than {{count}} seconds'
1695
+ },
1696
+ xSeconds: {
1697
+ one: '1 second',
1698
+ other: '{{count}} seconds'
1699
+ },
1700
+ halfAMinute: 'half a minute',
1701
+ lessThanXMinutes: {
1702
+ one: 'less than a minute',
1703
+ other: 'less than {{count}} minutes'
1704
+ },
1705
+ xMinutes: {
1706
+ one: '1 minute',
1707
+ other: '{{count}} minutes'
1708
+ },
1709
+ aboutXHours: {
1710
+ one: 'about 1 hour',
1711
+ other: 'about {{count}} hours'
1712
+ },
1713
+ xHours: {
1714
+ one: '1 hour',
1715
+ other: '{{count}} hours'
1716
+ },
1717
+ xDays: {
1718
+ one: '1 day',
1719
+ other: '{{count}} days'
1720
+ },
1721
+ aboutXWeeks: {
1722
+ one: 'about 1 week',
1723
+ other: 'about {{count}} weeks'
1724
+ },
1725
+ xWeeks: {
1726
+ one: '1 week',
1727
+ other: '{{count}} weeks'
1728
+ },
1729
+ aboutXMonths: {
1730
+ one: 'about 1 month',
1731
+ other: 'about {{count}} months'
1732
+ },
1733
+ xMonths: {
1734
+ one: '1 month',
1735
+ other: '{{count}} months'
1736
+ },
1737
+ aboutXYears: {
1738
+ one: 'about 1 year',
1739
+ other: 'about {{count}} years'
1740
+ },
1741
+ xYears: {
1742
+ one: '1 year',
1743
+ other: '{{count}} years'
1744
+ },
1745
+ overXYears: {
1746
+ one: 'over 1 year',
1747
+ other: 'over {{count}} years'
1748
+ },
1749
+ almostXYears: {
1750
+ one: 'almost 1 year',
1751
+ other: 'almost {{count}} years'
1752
+ }
1753
+ };
1754
+ var formatDistance = function formatDistance(token, count, options) {
1755
+ var result;
1756
+ var tokenValue = formatDistanceLocale[token];
1757
+ if (typeof tokenValue === 'string') {
1758
+ result = tokenValue;
1759
+ } else if (count === 1) {
1760
+ result = tokenValue.one;
1761
+ } else {
1762
+ result = tokenValue.other.replace('{{count}}', count.toString());
1763
+ }
1764
+ if (options !== null && options !== void 0 && options.addSuffix) {
1765
+ if (options.comparison && options.comparison > 0) {
1766
+ return 'in ' + result;
1767
+ } else {
1768
+ return result + ' ago';
1769
+ }
1770
+ }
1771
+ return result;
1772
+ };
1773
+ const formatDistance$1 = formatDistance;
1774
+
1775
+ function buildFormatLongFn(args) {
1776
+ return function () {
1777
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1778
+ // TODO: Remove String()
1779
+ var width = options.width ? String(options.width) : args.defaultWidth;
1780
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1781
+ return format;
1782
+ };
1783
+ }
1784
+
1785
+ var dateFormats = {
1786
+ full: 'EEEE, MMMM do, y',
1787
+ long: 'MMMM do, y',
1788
+ medium: 'MMM d, y',
1789
+ short: 'MM/dd/yyyy'
1790
+ };
1791
+ var timeFormats = {
1792
+ full: 'h:mm:ss a zzzz',
1793
+ long: 'h:mm:ss a z',
1794
+ medium: 'h:mm:ss a',
1795
+ short: 'h:mm a'
1796
+ };
1797
+ var dateTimeFormats = {
1798
+ full: "{{date}} 'at' {{time}}",
1799
+ long: "{{date}} 'at' {{time}}",
1800
+ medium: '{{date}}, {{time}}',
1801
+ short: '{{date}}, {{time}}'
1802
+ };
1803
+ var formatLong = {
1804
+ date: buildFormatLongFn({
1805
+ formats: dateFormats,
1806
+ defaultWidth: 'full'
1807
+ }),
1808
+ time: buildFormatLongFn({
1809
+ formats: timeFormats,
1810
+ defaultWidth: 'full'
1811
+ }),
1812
+ dateTime: buildFormatLongFn({
1813
+ formats: dateTimeFormats,
1814
+ defaultWidth: 'full'
1815
+ })
1816
+ };
1817
+ const formatLong$1 = formatLong;
1818
+
1819
+ var formatRelativeLocale = {
1820
+ lastWeek: "'last' eeee 'at' p",
1821
+ yesterday: "'yesterday at' p",
1822
+ today: "'today at' p",
1823
+ tomorrow: "'tomorrow at' p",
1824
+ nextWeek: "eeee 'at' p",
1825
+ other: 'P'
1826
+ };
1827
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1828
+ return formatRelativeLocale[token];
1829
+ };
1830
+ const formatRelative$1 = formatRelative;
1831
+
1832
+ function buildLocalizeFn(args) {
1833
+ return function (dirtyIndex, options) {
1834
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1835
+ var valuesArray;
1836
+ if (context === 'formatting' && args.formattingValues) {
1837
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1838
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1839
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1840
+ } else {
1841
+ var _defaultWidth = args.defaultWidth;
1842
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1843
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1844
+ }
1845
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1846
+ // @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!
1847
+ return valuesArray[index];
1848
+ };
1849
+ }
1850
+
1851
+ var eraValues = {
1852
+ narrow: ['B', 'A'],
1853
+ abbreviated: ['BC', 'AD'],
1854
+ wide: ['Before Christ', 'Anno Domini']
1855
+ };
1856
+ var quarterValues = {
1857
+ narrow: ['1', '2', '3', '4'],
1858
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1859
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1860
+ };
1861
+
1862
+ // Note: in English, the names of days of the week and months are capitalized.
1863
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1864
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1865
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1866
+ var monthValues = {
1867
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1868
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1869
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1870
+ };
1871
+ var dayValues = {
1872
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1873
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1874
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1875
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1876
+ };
1877
+ var dayPeriodValues = {
1878
+ narrow: {
1879
+ am: 'a',
1880
+ pm: 'p',
1881
+ midnight: 'mi',
1882
+ noon: 'n',
1883
+ morning: 'morning',
1884
+ afternoon: 'afternoon',
1885
+ evening: 'evening',
1886
+ night: 'night'
1887
+ },
1888
+ abbreviated: {
1889
+ am: 'AM',
1890
+ pm: 'PM',
1891
+ midnight: 'midnight',
1892
+ noon: 'noon',
1893
+ morning: 'morning',
1894
+ afternoon: 'afternoon',
1895
+ evening: 'evening',
1896
+ night: 'night'
1897
+ },
1898
+ wide: {
1899
+ am: 'a.m.',
1900
+ pm: 'p.m.',
1901
+ midnight: 'midnight',
1902
+ noon: 'noon',
1903
+ morning: 'morning',
1904
+ afternoon: 'afternoon',
1905
+ evening: 'evening',
1906
+ night: 'night'
1907
+ }
1908
+ };
1909
+ var formattingDayPeriodValues = {
1910
+ narrow: {
1911
+ am: 'a',
1912
+ pm: 'p',
1913
+ midnight: 'mi',
1914
+ noon: 'n',
1915
+ morning: 'in the morning',
1916
+ afternoon: 'in the afternoon',
1917
+ evening: 'in the evening',
1918
+ night: 'at night'
1919
+ },
1920
+ abbreviated: {
1921
+ am: 'AM',
1922
+ pm: 'PM',
1923
+ midnight: 'midnight',
1924
+ noon: 'noon',
1925
+ morning: 'in the morning',
1926
+ afternoon: 'in the afternoon',
1927
+ evening: 'in the evening',
1928
+ night: 'at night'
1929
+ },
1930
+ wide: {
1931
+ am: 'a.m.',
1932
+ pm: 'p.m.',
1933
+ midnight: 'midnight',
1934
+ noon: 'noon',
1935
+ morning: 'in the morning',
1936
+ afternoon: 'in the afternoon',
1937
+ evening: 'in the evening',
1938
+ night: 'at night'
1939
+ }
1940
+ };
1941
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1942
+ var number = Number(dirtyNumber);
1943
+
1944
+ // If ordinal numbers depend on context, for example,
1945
+ // if they are different for different grammatical genders,
1946
+ // use `options.unit`.
1947
+ //
1948
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1949
+ // 'day', 'hour', 'minute', 'second'.
1950
+
1951
+ var rem100 = number % 100;
1952
+ if (rem100 > 20 || rem100 < 10) {
1953
+ switch (rem100 % 10) {
1954
+ case 1:
1955
+ return number + 'st';
1956
+ case 2:
1957
+ return number + 'nd';
1958
+ case 3:
1959
+ return number + 'rd';
1960
+ }
1961
+ }
1962
+ return number + 'th';
1963
+ };
1964
+ var localize = {
1965
+ ordinalNumber: ordinalNumber,
1966
+ era: buildLocalizeFn({
1967
+ values: eraValues,
1968
+ defaultWidth: 'wide'
1969
+ }),
1970
+ quarter: buildLocalizeFn({
1971
+ values: quarterValues,
1972
+ defaultWidth: 'wide',
1973
+ argumentCallback: function argumentCallback(quarter) {
1974
+ return quarter - 1;
1975
+ }
1976
+ }),
1977
+ month: buildLocalizeFn({
1978
+ values: monthValues,
1979
+ defaultWidth: 'wide'
1980
+ }),
1981
+ day: buildLocalizeFn({
1982
+ values: dayValues,
1983
+ defaultWidth: 'wide'
1984
+ }),
1985
+ dayPeriod: buildLocalizeFn({
1986
+ values: dayPeriodValues,
1987
+ defaultWidth: 'wide',
1988
+ formattingValues: formattingDayPeriodValues,
1989
+ defaultFormattingWidth: 'wide'
1990
+ })
1991
+ };
1992
+ const localize$1 = localize;
1993
+
1994
+ function buildMatchFn(args) {
1995
+ return function (string) {
1996
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1997
+ var width = options.width;
1998
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1999
+ var matchResult = string.match(matchPattern);
2000
+ if (!matchResult) {
2001
+ return null;
2002
+ }
2003
+ var matchedString = matchResult[0];
2004
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
2005
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
2006
+ return pattern.test(matchedString);
2007
+ }) : findKey(parsePatterns, function (pattern) {
2008
+ return pattern.test(matchedString);
2009
+ });
2010
+ var value;
2011
+ value = args.valueCallback ? args.valueCallback(key) : key;
2012
+ value = options.valueCallback ? options.valueCallback(value) : value;
2013
+ var rest = string.slice(matchedString.length);
2014
+ return {
2015
+ value: value,
2016
+ rest: rest
2017
+ };
2018
+ };
2019
+ }
2020
+ function findKey(object, predicate) {
2021
+ for (var key in object) {
2022
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
2023
+ return key;
2024
+ }
2025
+ }
2026
+ return undefined;
2027
+ }
2028
+ function findIndex(array, predicate) {
2029
+ for (var key = 0; key < array.length; key++) {
2030
+ if (predicate(array[key])) {
2031
+ return key;
2032
+ }
2033
+ }
2034
+ return undefined;
2035
+ }
2036
+
2037
+ function buildMatchPatternFn(args) {
2038
+ return function (string) {
2039
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2040
+ var matchResult = string.match(args.matchPattern);
2041
+ if (!matchResult) return null;
2042
+ var matchedString = matchResult[0];
2043
+ var parseResult = string.match(args.parsePattern);
2044
+ if (!parseResult) return null;
2045
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
2046
+ value = options.valueCallback ? options.valueCallback(value) : value;
2047
+ var rest = string.slice(matchedString.length);
2048
+ return {
2049
+ value: value,
2050
+ rest: rest
2051
+ };
2052
+ };
2053
+ }
2054
+
2055
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
2056
+ var parseOrdinalNumberPattern = /\d+/i;
2057
+ var matchEraPatterns = {
2058
+ narrow: /^(b|a)/i,
2059
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
2060
+ wide: /^(before christ|before common era|anno domini|common era)/i
2061
+ };
2062
+ var parseEraPatterns = {
2063
+ any: [/^b/i, /^(a|c)/i]
2064
+ };
2065
+ var matchQuarterPatterns = {
2066
+ narrow: /^[1234]/i,
2067
+ abbreviated: /^q[1234]/i,
2068
+ wide: /^[1234](th|st|nd|rd)? quarter/i
2069
+ };
2070
+ var parseQuarterPatterns = {
2071
+ any: [/1/i, /2/i, /3/i, /4/i]
2072
+ };
2073
+ var matchMonthPatterns = {
2074
+ narrow: /^[jfmasond]/i,
2075
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
2076
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
2077
+ };
2078
+ var parseMonthPatterns = {
2079
+ 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],
2080
+ 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]
2081
+ };
2082
+ var matchDayPatterns = {
2083
+ narrow: /^[smtwf]/i,
2084
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
2085
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
2086
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
2087
+ };
2088
+ var parseDayPatterns = {
2089
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
2090
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
2091
+ };
2092
+ var matchDayPeriodPatterns = {
2093
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
2094
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
2095
+ };
2096
+ var parseDayPeriodPatterns = {
2097
+ any: {
2098
+ am: /^a/i,
2099
+ pm: /^p/i,
2100
+ midnight: /^mi/i,
2101
+ noon: /^no/i,
2102
+ morning: /morning/i,
2103
+ afternoon: /afternoon/i,
2104
+ evening: /evening/i,
2105
+ night: /night/i
2106
+ }
2107
+ };
2108
+ var match = {
2109
+ ordinalNumber: buildMatchPatternFn({
2110
+ matchPattern: matchOrdinalNumberPattern,
2111
+ parsePattern: parseOrdinalNumberPattern,
2112
+ valueCallback: function valueCallback(value) {
2113
+ return parseInt(value, 10);
2114
+ }
2115
+ }),
2116
+ era: buildMatchFn({
2117
+ matchPatterns: matchEraPatterns,
2118
+ defaultMatchWidth: 'wide',
2119
+ parsePatterns: parseEraPatterns,
2120
+ defaultParseWidth: 'any'
2121
+ }),
2122
+ quarter: buildMatchFn({
2123
+ matchPatterns: matchQuarterPatterns,
2124
+ defaultMatchWidth: 'wide',
2125
+ parsePatterns: parseQuarterPatterns,
2126
+ defaultParseWidth: 'any',
2127
+ valueCallback: function valueCallback(index) {
2128
+ return index + 1;
2129
+ }
2130
+ }),
2131
+ month: buildMatchFn({
2132
+ matchPatterns: matchMonthPatterns,
2133
+ defaultMatchWidth: 'wide',
2134
+ parsePatterns: parseMonthPatterns,
2135
+ defaultParseWidth: 'any'
2136
+ }),
2137
+ day: buildMatchFn({
2138
+ matchPatterns: matchDayPatterns,
2139
+ defaultMatchWidth: 'wide',
2140
+ parsePatterns: parseDayPatterns,
2141
+ defaultParseWidth: 'any'
2142
+ }),
2143
+ dayPeriod: buildMatchFn({
2144
+ matchPatterns: matchDayPeriodPatterns,
2145
+ defaultMatchWidth: 'any',
2146
+ parsePatterns: parseDayPeriodPatterns,
2147
+ defaultParseWidth: 'any'
2148
+ })
2149
+ };
2150
+ const match$1 = match;
2151
+
2152
+ /**
2153
+ * @type {Locale}
2154
+ * @category Locales
2155
+ * @summary English locale (United States).
2156
+ * @language English
2157
+ * @iso-639-2 eng
2158
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
2159
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
2160
+ */
2161
+ var locale = {
2162
+ code: 'en-US',
2163
+ formatDistance: formatDistance$1,
2164
+ formatLong: formatLong$1,
2165
+ formatRelative: formatRelative$1,
2166
+ localize: localize$1,
2167
+ match: match$1,
2168
+ options: {
2169
+ weekStartsOn: 0 /* Sunday */,
2170
+ firstWeekContainsDate: 1
2171
+ }
2172
+ };
2173
+ const defaultLocale = locale;
2174
+
2175
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
2176
+ // (one of the certain letters followed by `o`)
2177
+ // - (\w)\1* matches any sequences of the same letter
2178
+ // - '' matches two quote characters in a row
2179
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
2180
+ // except a single quote symbol, which ends the sequence.
2181
+ // Two quote characters do not end the sequence.
2182
+ // If there is no matching single quote
2183
+ // then the sequence will continue until the end of the string.
2184
+ // - . matches any single character unmatched by previous parts of the RegExps
2185
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
2186
+
2187
+ // This RegExp catches symbols escaped by quotes, and also
2188
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
2189
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2190
+ var escapedStringRegExp = /^'([^]*?)'?$/;
2191
+ var doubleQuoteRegExp = /''/g;
2192
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2193
+
2194
+ /**
2195
+ * @name format
2196
+ * @category Common Helpers
2197
+ * @summary Format the date.
2198
+ *
2199
+ * @description
2200
+ * Return the formatted date string in the given format. The result may vary by locale.
2201
+ *
2202
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
2203
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2204
+ *
2205
+ * The characters wrapped between two single quotes characters (') are escaped.
2206
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
2207
+ * (see the last example)
2208
+ *
2209
+ * Format of the string is based on Unicode Technical Standard #35:
2210
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
2211
+ * with a few additions (see note 7 below the table).
2212
+ *
2213
+ * Accepted patterns:
2214
+ * | Unit | Pattern | Result examples | Notes |
2215
+ * |---------------------------------|---------|-----------------------------------|-------|
2216
+ * | Era | G..GGG | AD, BC | |
2217
+ * | | GGGG | Anno Domini, Before Christ | 2 |
2218
+ * | | GGGGG | A, B | |
2219
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
2220
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
2221
+ * | | yy | 44, 01, 00, 17 | 5 |
2222
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
2223
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
2224
+ * | | yyyyy | ... | 3,5 |
2225
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
2226
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
2227
+ * | | YY | 44, 01, 00, 17 | 5,8 |
2228
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
2229
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
2230
+ * | | YYYYY | ... | 3,5 |
2231
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
2232
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
2233
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
2234
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
2235
+ * | | RRRRR | ... | 3,5,7 |
2236
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
2237
+ * | | uu | -43, 01, 1900, 2017 | 5 |
2238
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
2239
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
2240
+ * | | uuuuu | ... | 3,5 |
2241
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
2242
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
2243
+ * | | QQ | 01, 02, 03, 04 | |
2244
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
2245
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
2246
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
2247
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
2248
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
2249
+ * | | qq | 01, 02, 03, 04 | |
2250
+ * | | qqq | Q1, Q2, Q3, Q4 | |
2251
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
2252
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
2253
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
2254
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
2255
+ * | | MM | 01, 02, ..., 12 | |
2256
+ * | | MMM | Jan, Feb, ..., Dec | |
2257
+ * | | MMMM | January, February, ..., December | 2 |
2258
+ * | | MMMMM | J, F, ..., D | |
2259
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
2260
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
2261
+ * | | LL | 01, 02, ..., 12 | |
2262
+ * | | LLL | Jan, Feb, ..., Dec | |
2263
+ * | | LLLL | January, February, ..., December | 2 |
2264
+ * | | LLLLL | J, F, ..., D | |
2265
+ * | Local week of year | w | 1, 2, ..., 53 | |
2266
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
2267
+ * | | ww | 01, 02, ..., 53 | |
2268
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
2269
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
2270
+ * | | II | 01, 02, ..., 53 | 7 |
2271
+ * | Day of month | d | 1, 2, ..., 31 | |
2272
+ * | | do | 1st, 2nd, ..., 31st | 7 |
2273
+ * | | dd | 01, 02, ..., 31 | |
2274
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
2275
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
2276
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
2277
+ * | | DDD | 001, 002, ..., 365, 366 | |
2278
+ * | | DDDD | ... | 3 |
2279
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
2280
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
2281
+ * | | EEEEE | M, T, W, T, F, S, S | |
2282
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
2283
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
2284
+ * | | io | 1st, 2nd, ..., 7th | 7 |
2285
+ * | | ii | 01, 02, ..., 07 | 7 |
2286
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
2287
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
2288
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
2289
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
2290
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
2291
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
2292
+ * | | ee | 02, 03, ..., 01 | |
2293
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
2294
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
2295
+ * | | eeeee | M, T, W, T, F, S, S | |
2296
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
2297
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
2298
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
2299
+ * | | cc | 02, 03, ..., 01 | |
2300
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
2301
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
2302
+ * | | ccccc | M, T, W, T, F, S, S | |
2303
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
2304
+ * | AM, PM | a..aa | AM, PM | |
2305
+ * | | aaa | am, pm | |
2306
+ * | | aaaa | a.m., p.m. | 2 |
2307
+ * | | aaaaa | a, p | |
2308
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
2309
+ * | | bbb | am, pm, noon, midnight | |
2310
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
2311
+ * | | bbbbb | a, p, n, mi | |
2312
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
2313
+ * | | BBBB | at night, in the morning, ... | 2 |
2314
+ * | | BBBBB | at night, in the morning, ... | |
2315
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
2316
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
2317
+ * | | hh | 01, 02, ..., 11, 12 | |
2318
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
2319
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
2320
+ * | | HH | 00, 01, 02, ..., 23 | |
2321
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
2322
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
2323
+ * | | KK | 01, 02, ..., 11, 00 | |
2324
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
2325
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
2326
+ * | | kk | 24, 01, 02, ..., 23 | |
2327
+ * | Minute | m | 0, 1, ..., 59 | |
2328
+ * | | mo | 0th, 1st, ..., 59th | 7 |
2329
+ * | | mm | 00, 01, ..., 59 | |
2330
+ * | Second | s | 0, 1, ..., 59 | |
2331
+ * | | so | 0th, 1st, ..., 59th | 7 |
2332
+ * | | ss | 00, 01, ..., 59 | |
2333
+ * | Fraction of second | S | 0, 1, ..., 9 | |
2334
+ * | | SS | 00, 01, ..., 99 | |
2335
+ * | | SSS | 000, 001, ..., 999 | |
2336
+ * | | SSSS | ... | 3 |
2337
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
2338
+ * | | XX | -0800, +0530, Z | |
2339
+ * | | XXX | -08:00, +05:30, Z | |
2340
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
2341
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
2342
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
2343
+ * | | xx | -0800, +0530, +0000 | |
2344
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
2345
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
2346
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
2347
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
2348
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
2349
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
2350
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
2351
+ * | Seconds timestamp | t | 512969520 | 7 |
2352
+ * | | tt | ... | 3,7 |
2353
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
2354
+ * | | TT | ... | 3,7 |
2355
+ * | Long localized date | P | 04/29/1453 | 7 |
2356
+ * | | PP | Apr 29, 1453 | 7 |
2357
+ * | | PPP | April 29th, 1453 | 7 |
2358
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
2359
+ * | Long localized time | p | 12:00 AM | 7 |
2360
+ * | | pp | 12:00:00 AM | 7 |
2361
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
2362
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
2363
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
2364
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
2365
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
2366
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
2367
+ * Notes:
2368
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
2369
+ * are the same as "stand-alone" units, but are different in some languages.
2370
+ * "Formatting" units are declined according to the rules of the language
2371
+ * in the context of a date. "Stand-alone" units are always nominative singular:
2372
+ *
2373
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
2374
+ *
2375
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
2376
+ *
2377
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2378
+ * the single quote characters (see below).
2379
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
2380
+ * the output will be the same as default pattern for this unit, usually
2381
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
2382
+ * are marked with "2" in the last column of the table.
2383
+ *
2384
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
2385
+ *
2386
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
2387
+ *
2388
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
2389
+ *
2390
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
2391
+ *
2392
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
2393
+ *
2394
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
2395
+ * The output will be padded with zeros to match the length of the pattern.
2396
+ *
2397
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
2398
+ *
2399
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2400
+ * These tokens represent the shortest form of the quarter.
2401
+ *
2402
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
2403
+ *
2404
+ * | Year | `y` | `u` |
2405
+ * |------|-----|-----|
2406
+ * | AC 1 | 1 | 1 |
2407
+ * | BC 1 | 1 | 0 |
2408
+ * | BC 2 | 2 | -1 |
2409
+ *
2410
+ * Also `yy` always returns the last two digits of a year,
2411
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
2412
+ *
2413
+ * | Year | `yy` | `uu` |
2414
+ * |------|------|------|
2415
+ * | 1 | 01 | 01 |
2416
+ * | 14 | 14 | 14 |
2417
+ * | 376 | 76 | 376 |
2418
+ * | 1453 | 53 | 1453 |
2419
+ *
2420
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2421
+ * except local week-numbering years are dependent on `options.weekStartsOn`
2422
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
2423
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
2424
+ *
2425
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
2426
+ * so right now these tokens fall back to GMT timezones.
2427
+ *
2428
+ * 7. These patterns are not in the Unicode Technical Standard #35:
2429
+ * - `i`: ISO day of week
2430
+ * - `I`: ISO week of year
2431
+ * - `R`: ISO week-numbering year
2432
+ * - `t`: seconds timestamp
2433
+ * - `T`: milliseconds timestamp
2434
+ * - `o`: ordinal number modifier
2435
+ * - `P`: long localized date
2436
+ * - `p`: long localized time
2437
+ *
2438
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2439
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2440
+ *
2441
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2442
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2443
+ *
2444
+ * @param {Date|Number} date - the original date
2445
+ * @param {String} format - the string of tokens
2446
+ * @param {Object} [options] - an object with options.
2447
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2448
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2449
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2450
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2451
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2452
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2453
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2454
+ * @returns {String} the formatted date string
2455
+ * @throws {TypeError} 2 arguments required
2456
+ * @throws {RangeError} `date` must not be Invalid Date
2457
+ * @throws {RangeError} `options.locale` must contain `localize` property
2458
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2459
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2460
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2461
+ * @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
2462
+ * @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
2463
+ * @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
2464
+ * @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
2465
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2466
+ *
2467
+ * @example
2468
+ * // Represent 11 February 2014 in middle-endian format:
2469
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2470
+ * //=> '02/11/2014'
2471
+ *
2472
+ * @example
2473
+ * // Represent 2 July 2014 in Esperanto:
2474
+ * import { eoLocale } from 'date-fns/locale/eo'
2475
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2476
+ * locale: eoLocale
2477
+ * })
2478
+ * //=> '2-a de julio 2014'
2479
+ *
2480
+ * @example
2481
+ * // Escape string by single quote characters:
2482
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2483
+ * //=> "3 o'clock"
2484
+ */
2485
+
2486
+ function format(dirtyDate, dirtyFormatStr, options) {
2487
+ 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;
2488
+ requiredArgs(2, arguments);
2489
+ var formatStr = String(dirtyFormatStr);
2490
+ var defaultOptions = getDefaultOptions();
2491
+ var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
2492
+ 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);
2493
+
2494
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2495
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2496
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2497
+ }
2498
+ 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);
2499
+
2500
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2501
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2502
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2503
+ }
2504
+ if (!locale.localize) {
2505
+ throw new RangeError('locale must contain localize property');
2506
+ }
2507
+ if (!locale.formatLong) {
2508
+ throw new RangeError('locale must contain formatLong property');
2509
+ }
2510
+ var originalDate = toDate(dirtyDate);
2511
+ if (!isValid(originalDate)) {
2512
+ throw new RangeError('Invalid time value');
2513
+ }
2514
+
2515
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2516
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2517
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2518
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2519
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2520
+ var formatterOptions = {
2521
+ firstWeekContainsDate: firstWeekContainsDate,
2522
+ weekStartsOn: weekStartsOn,
2523
+ locale: locale,
2524
+ _originalDate: originalDate
2525
+ };
2526
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2527
+ var firstCharacter = substring[0];
2528
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2529
+ var longFormatter = longFormatters$1[firstCharacter];
2530
+ return longFormatter(substring, locale.formatLong);
2531
+ }
2532
+ return substring;
2533
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2534
+ // Replace two single quote characters with one single quote character
2535
+ if (substring === "''") {
2536
+ return "'";
2537
+ }
2538
+ var firstCharacter = substring[0];
2539
+ if (firstCharacter === "'") {
2540
+ return cleanEscapedString(substring);
2541
+ }
2542
+ var formatter = formatters$1[firstCharacter];
2543
+ if (formatter) {
2544
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2545
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2546
+ }
2547
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2548
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2549
+ }
2550
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
2551
+ }
2552
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2553
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2554
+ }
2555
+ return substring;
2556
+ }).join('');
2557
+ return result;
2558
+ }
2559
+ function cleanEscapedString(input) {
2560
+ var matched = input.match(escapedStringRegExp);
2561
+ if (!matched) {
2562
+ return input;
2563
+ }
2564
+ return matched[1].replace(doubleQuoteRegExp, "'");
2565
+ }
2566
+
2567
+ /**
2568
+ * @name isBefore
2569
+ * @category Common Helpers
2570
+ * @summary Is the first date before the second one?
2571
+ *
2572
+ * @description
2573
+ * Is the first date before the second one?
2574
+ *
2575
+ * @param {Date|Number} date - the date that should be before the other one to return true
2576
+ * @param {Date|Number} dateToCompare - the date to compare with
2577
+ * @returns {Boolean} the first date is before the second date
2578
+ * @throws {TypeError} 2 arguments required
2579
+ *
2580
+ * @example
2581
+ * // Is 10 July 1989 before 11 February 1987?
2582
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
2583
+ * //=> false
2584
+ */
2585
+ function isBefore(dirtyDate, dirtyDateToCompare) {
2586
+ requiredArgs(2, arguments);
2587
+ var date = toDate(dirtyDate);
2588
+ var dateToCompare = toDate(dirtyDateToCompare);
2589
+ return date.getTime() < dateToCompare.getTime();
2590
+ }
2591
+
2592
+ const DEFAULT_LANGUAGE = 'en';
2593
+ const SUPPORTED_LANGUAGES = ['en', 'zh-hk', 'it', 'fr', 'tr', 'hr'];
2594
+ const TRANSLATIONS = {
2595
+ en: {
2596
+ redeem: 'Redeem',
2597
+ claim: 'Claim',
2598
+ expireOn: 'Expire on ',
2599
+ coinsToBeExpired: '${expirationPoints} coins to expire in ${expireDay} days',
2600
+ coinsToBeExpiredDay: '${expirationPoints} coins to expire in ${expireDay} day',
2601
+ coinsToBeExpiredHours: '${expirationPoints} coins to expire in ${expireDay} hours',
2602
+ coinsToBeExpiredHour: '${expirationPoints} coins to expire in ${expireDay} hour',
2603
+ coinsToBeExpiredMinutes: '${expirationPoints} coins to expire in ${expireDay} minutes',
2604
+ coinsToBeExpiredMinute: '${expirationPoints} coins to expire in ${expireDay} minute',
2605
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2606
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2607
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2608
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2609
+ pointsToBeExpiredMinutes: '${expirationPoints} points to expire in ${expireDay} minutes',
2610
+ pointsToBeExpiredMinute: '${expirationPoints} points to expire in ${expireDay} minute',
2611
+ tipsForNextLevel: 'Next level is ${levelName}. ${pointsToReach} XP to level up',
2612
+ spendablePoints: 'Spendable Points:',
2613
+ details: 'Details',
2614
+ earningRules: 'Earning Rules',
2615
+ xp: 'XP',
2616
+ sp: 'Coins',
2617
+ termAndConditions: 'Term & Conditions',
2618
+ rakebackTitle: 'Available Rakeback',
2619
+ loading: 'Loading',
2620
+ minutesCanClaim: 'Next Claim is available in ${minutes} minutes'
2621
+ },
2622
+ 'zh-hk': {
2623
+ redeem: '兑奖',
2624
+ claim: '返佣',
2625
+ expireOn: 'Expire on ',
2626
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2627
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2628
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2629
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2630
+ pointsToBeExpiredMinutes: '${expirationPoints} points to expire in ${expireDay} minutes',
2631
+ pointsToBeExpiredMinute: '${expirationPoints} points to expire in ${expireDay} minute',
2632
+ tipsForNextLevel: 'Next level is ${levelName}. ${pointsToReach} XP to level up',
2633
+ spendablePoints: 'Spendable Points:',
2634
+ details: '明细',
2635
+ earningRules: 'Earning Rules',
2636
+ xp: 'XP',
2637
+ sp: 'Coins',
2638
+ termAndConditions: 'Term & Conditions',
2639
+ rakebackTitle: '可用的返利',
2640
+ loading: '加載中',
2641
+ minutesCanClaim: '下次可領取時間為${minutes}分鐘後'
2642
+ },
2643
+ de: {
2644
+ redeem: 'Redeem',
2645
+ claim: 'Anspruch',
2646
+ expireOn: 'Expire on ',
2647
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2648
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2649
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2650
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2651
+ pointsToBeExpiredMinutes: '${expirationPoints} points to expire in ${expireDay} minutes',
2652
+ pointsToBeExpiredMinute: '${expirationPoints} points to expire in ${expireDay} minute',
2653
+ tipsForNextLevel: 'Next level is ${levelName}. ${pointsToReach} XP to level up',
2654
+ spendablePoints: 'Spendable Points:',
2655
+ details: 'Details',
2656
+ earningRules: 'Earning Rules',
2657
+ xp: 'XP',
2658
+ sp: 'Coins',
2659
+ termAndConditions: 'Term & Conditions',
2660
+ rakebackTitle: 'Verfügbarer Rakeback',
2661
+ loading: 'Laden',
2662
+ minutesCanClaim: 'Nächster Anspruch ist in ${minutes} Minuten verfügbar'
2663
+ },
2664
+ it: {
2665
+ redeem: 'Redeem',
2666
+ claim: 'Richiesta',
2667
+ expireOn: 'Expire on ',
2668
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2669
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2670
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2671
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2672
+ pointsToBeExpiredMinutes: '${expirationPoints} points to expire in ${expireDay} minutes',
2673
+ pointsToBeExpiredMinute: '${expirationPoints} points to expire in ${expireDay} minute',
2674
+ tipsForNextLevel: 'Next level is ${levelName}. ${pointsToReach} XP to level up',
2675
+ spendablePoints: 'Spendable Points:',
2676
+ details: 'Details',
2677
+ earningRules: 'Earning Rules',
2678
+ xp: 'XP',
2679
+ sp: 'Coins',
2680
+ termAndConditions: 'Term & Conditions',
2681
+ rakebackTitle: 'Rakeback Disponibile',
2682
+ loading: 'Caricamento',
2683
+ minutesCanClaim: 'La prossima richiesta sarà disponibile tra ${minutes} minuti'
2684
+ },
2685
+ fr: {
2686
+ redeem: 'Redeem',
2687
+ claim: 'Réclamer',
2688
+ expireOn: 'Expire on ',
2689
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2690
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2691
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2692
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2693
+ pointsToBeExpiredMinutes: '${expirationPoints} points to expire in ${expireDay} minutes',
2694
+ pointsToBeExpiredMinute: '${expirationPoints} points to expire in ${expireDay} minute',
2695
+ tipsForNextLevel: 'Next level is ${levelName}. ${pointsToReach} XP to level up',
2696
+ spendablePoints: 'Spendable Points:',
2697
+ details: 'Details',
2698
+ earningRules: 'Earning Rules',
2699
+ xp: 'XP',
2700
+ sp: 'Coins',
2701
+ termAndConditions: 'Term & Conditions',
2702
+ rakebackTitle: 'Rakeback Disponible',
2703
+ loading: 'Chargement',
2704
+ minutesCanClaim: 'La prochaine réclamation sera disponible dans ${minutes} minutes'
2705
+ },
2706
+ es: {
2707
+ redeem: 'Redeem',
2708
+ claim: 'Reclamar',
2709
+ rakebackTitle: 'Rakeback Disponible',
2710
+ loading: 'Cargando',
2711
+ minutesCanClaim: 'La próxima reclamación estará disponible en ${minutes} minutos'
2712
+ },
2713
+ tr: {
2714
+ redeem: 'Redeem',
2715
+ claim: 'Talep',
2716
+ expireOn: 'Expire on ',
2717
+ pointsToBeExpired: '${expirationPoints} points to expire in ${expireDay} days',
2718
+ pointsToBeExpiredDay: '${expirationPoints} points to expire in ${expireDay} day',
2719
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2720
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2721
+ pointsToBeExpiredMinutes: '${expirationPoints} points to expire in ${expireDay} minutes',
2722
+ pointsToBeExpiredMinute: '${expirationPoints} points to expire in ${expireDay} minute',
2723
+ tipsForNextLevel: 'Next level is ${levelName}. ${pointsToReach} XP to level up',
2724
+ spendablePoints: 'Spendable Points:',
2725
+ details: 'Details',
2726
+ earningRules: 'Earning Rules',
2727
+ xp: 'XP',
2728
+ sp: 'Coins',
2729
+ termAndConditions: 'Term & Conditions',
2730
+ rakebackTitle: 'Mevcut Rakeback',
2731
+ loading: 'Yükleniyor',
2732
+ minutesCanClaim: 'Sonraki talep ${minutes} dakika içinde kullanılabilir'
2733
+ },
2734
+ ru: {
2735
+ redeem: 'Redeem',
2736
+ claim: 'Требовать',
2737
+ rakebackTitle: 'Доступный Рейкбек',
2738
+ loading: 'Загрузка',
2739
+ minutesCanClaim: 'Следующее требование будет доступно через ${minutes} минут'
2740
+ },
2741
+ ro: {
2742
+ redeem: 'Redeem',
2743
+ claim: 'Revendicare',
2744
+ rakebackTitle: 'Rakeback Disponibil',
2745
+ loading: 'Se încarcă',
2746
+ minutesCanClaim: 'Următoarea revendicare va fi disponibilă în ${minutes} minute'
2747
+ },
2748
+ hr: {
2749
+ redeem: 'Otkupiti',
2750
+ claim: 'Zahtjev',
2751
+ expireOn: 'Istječe',
2752
+ pointsToBeExpired: '${expirationPoints} bodova ističe za ${expireDay} dana',
2753
+ pointsToBeExpiredHours: '${expirationPoints} points to expire in ${expireDay} hours',
2754
+ pointsToBeExpiredHour: '${expirationPoints} points to expire in ${expireDay} hour',
2755
+ pointsToBeExpiredMinutes: '${expirationPoints} points to expire in ${expireDay} minutes',
2756
+ pointsToBeExpiredMinute: '${expirationPoints} points to expire in ${expireDay} minute',
2757
+ tipsForNextLevel: 'Trebate ${pointsToReach} da dosegnete razinu ${levelName}',
2758
+ spendablePoints: 'Bodovi za potrošit:',
2759
+ details: 'Detalji',
2760
+ xp: 'XP',
2761
+ rakebackTitle: 'Dostupan Rakeback',
2762
+ loading: 'Učitavanje',
2763
+ minutesCanClaim: 'Sljedeći zahtjev bit će dostupan za ${minutes} minuta'
2764
+ },
2765
+ hu: {
2766
+ redeem: 'Redeem',
2767
+ claim: 'Igény',
2768
+ rakebackTitle: 'Elérhető Rakeback',
2769
+ loading: 'Betöltés',
2770
+ minutesCanClaim: 'A következő igény ${minutes} perc múlva lesz elérhető'
2771
+ },
2772
+ pl: {
2773
+ redeem: 'Redeem',
2774
+ claim: 'Roszczenie',
2775
+ rakebackTitle: 'Dostępny Rakeback',
2776
+ loading: 'Ładowanie',
2777
+ minutesCanClaim: 'Następne roszczenie będzie dostępne za ${minutes} minut'
2778
+ },
2779
+ pt: {
2780
+ redeem: 'Redeem',
2781
+ claim: 'Reivindicar',
2782
+ rakebackTitle: 'Rakeback Disponível',
2783
+ loading: 'Carregando',
2784
+ minutesCanClaim: 'Próxima reivindicação disponível em ${minutes} minutos'
2785
+ },
2786
+ sl: {
2787
+ redeem: 'Redeem',
2788
+ claim: 'Zahtevek',
2789
+ rakebackTitle: 'Razpoložljiv Rakeback',
2790
+ loading: 'Nalaganje',
2791
+ minutesCanClaim: 'Naslednji zahtevek bo na voljo čez ${minutes} minut'
2792
+ },
2793
+ sr: {
2794
+ redeem: 'Redeem',
2795
+ claim: 'Zahtev',
2796
+ rakebackTitle: 'Dostupan Rakeback',
2797
+ loading: 'Učitavanje',
2798
+ minutesCanClaim: 'Sledeći zahtev biće dostupan za ${minutes} minuta'
2799
+ }
2800
+ };
2801
+ const translate = (key, customLang) => {
2802
+ const lang = customLang;
2803
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
2804
+ };
2805
+ const translateWithParams = (key, params) => {
2806
+ const lang = params['lang'];
2807
+ let templateString = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
2808
+ if (!params) {
2809
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
2810
+ }
2811
+ Object.keys(params).forEach((paramName) => {
2812
+ templateString = templateString.replace(new RegExp('\\$\{' + paramName + '\}', 'gm'), params[paramName]);
2813
+ });
2814
+ return templateString;
2815
+ };
2816
+
2817
+ function updateProgressSvg(progressElementRef, percent) {
2818
+ const svgElement = progressElementRef.querySelector('#total_level');
2819
+ const endLockWidth = 17, pointR = 6.5;
2820
+ //Total Widget of the progress
2821
+ const barWidth = svgElement.getBBox().width;
2822
+ //The filled width according to current progress
2823
+ const levelPercent = percent > 1 ? 1 : percent;
2824
+ const widthOnBar = (levelPercent * barWidth - endLockWidth) < 0 ? 0 : levelPercent * barWidth - endLockWidth;
2825
+ //update bar's width, widthOnBar
2826
+ const levelBar = progressElementRef.querySelector('#current_level');
2827
+ //update filters, x = widthOnBar
2828
+ const levelFilter = progressElementRef.querySelector('#filter_current_level');
2829
+ //update circle, widthOnBar+10
2830
+ const levelCircle = progressElementRef.querySelector('#circle_current_level');
2831
+ svgElement.setAttribute('viewbox', `0 0 ${widthOnBar} 28`);
2832
+ levelBar.setAttribute('width', `${widthOnBar}`);
2833
+ levelCircle.setAttribute('cx', `${(widthOnBar < pointR ? pointR : widthOnBar)}`);
2834
+ levelFilter.setAttribute('x', `${widthOnBar - 8}`);
2835
+ //update lock location
2836
+ const endLockElement = progressElementRef.querySelector('#lock');
2837
+ // wrapper of endLock, include ball and heatfilter1_d_305_23
2838
+ const filter1 = progressElementRef.querySelector('#filter_heart_ball');
2839
+ // ball in endlockfilter2_i_305_23
2840
+ const filter2 = progressElementRef.querySelector('#filter_ball');
2841
+ // heart in endlockfilter3_d_305_23
2842
+ const filter3 = progressElementRef.querySelector('#filter_heart');
2843
+ //wrapper of lockfilter4_d_305_23
2844
+ const filterLock = progressElementRef.querySelector('#filter_lock');
2845
+ // shadow of ball paint0_linear_305_23
2846
+ const paint0 = progressElementRef.querySelector('#paint0_linear_ball');
2847
+ //paint in lockpaint1_linear_305_23
2848
+ const paint1 = progressElementRef.querySelector('#paint1_linear_lock');
2849
+ // box of lock and heart, for move position dynamically
2850
+ const lockBox = progressElementRef.querySelector('#lock_box');
2851
+ const heartBox = progressElementRef.querySelector('#heart_box');
2852
+ const rightPaddingOfLockWidth = 10, cxOfEndLockEle = barWidth - rightPaddingOfLockWidth;
2853
+ //set cx of lockElement
2854
+ endLockElement.setAttribute('cx', `${cxOfEndLockEle}`);
2855
+ //set cx of sub Elements
2856
+ paint1.setAttribute('x1', `${cxOfEndLockEle}`);
2857
+ paint1.setAttribute('x2', `${cxOfEndLockEle}`);
2858
+ paint0.setAttribute('x1', `${cxOfEndLockEle - 6}`);
2859
+ paint0.setAttribute('x2', `${cxOfEndLockEle - 6 + 11.2}`);
2860
+ filterLock.setAttribute('x', `${cxOfEndLockEle - 6}`);
2861
+ filter3.setAttribute('x', `${cxOfEndLockEle - 6 - 2}`);
2862
+ filter2.setAttribute('x', `${cxOfEndLockEle - 6 - 2 - 2}`);
2863
+ filter1.setAttribute('x', `${cxOfEndLockEle - 6 - 2 - 2 - 4}`);
2864
+ lockBox.setAttribute('x', `${cxOfEndLockEle - 6}`);
2865
+ heartBox.setAttribute('x', `${cxOfEndLockEle - 6}`);
2866
+ svgElement.parentElement.style.opacity = '1';
2867
+ }
2868
+
2869
+ const playerElevateCardDataCss = ":host {\n display: block;\n width: 360px;\n height: 230px;\n}\n\n.ElevateCardWrapper {\n contain: layout inline-size;\n width: 100%;\n height: fit-content;\n min-height: 218px;\n}\n\n.Outer {\n container-type: inline-size;\n font-size: 12px;\n background-size: cover;\n background-repeat: no-repeat;\n line-height: initial;\n width: 100%;\n height: 100%;\n}\n\n.Dark {\n color: var(--emw--color-gray150, #efefef);\n}\n\n.Light {\n color: var(--emw--color-black, #0e0e0e);\n}\n\n@container (min-width: 381px) {\n .Outer {\n background-size: cover;\n }\n .Outer .OuterCover {\n min-height: 190px;\n }\n}\n@container (min-width: 260px) {\n .Outer {\n background-size: contain;\n }\n}\n.OuterCover {\n width: 100%;\n height: 100%;\n content: \"\";\n background-repeat: no-repeat;\n background-size: cover;\n border-radius: 15px;\n}\n\n.Inner {\n display: flex;\n flex-direction: column;\n min-height: 158px;\n}\n.Inner .Content {\n padding: 15px;\n flex-wrap: wrap;\n gap: 8px;\n}\n.Inner .Row {\n display: flex;\n flex-direction: row;\n}\n.Inner .CardCell {\n display: flex;\n}\n.Inner .LevelProgress svg {\n transition: opacity 0.4s;\n}\n.Inner .LevelInfo {\n display: flex;\n flex-direction: column;\n}\n.Inner .LevelInfo .ElevateLevel .LevelName {\n height: 28px;\n border-radius: 5px;\n line-height: 28px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.Inner .LevelInfo.Level0 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level0button-shadow, rgba(191, 84, 6, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level0-bg0, #E2792C) 0%, var(--emw--elevate-color-level0-bg1, rgba(242, 151, 99, 0)) 100%);\n}\n.Inner .LevelInfo.Level1 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level1button-shadow, rgba(151, 151, 151, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level1-bg0, #BEBFED) 0%, var(--emw--elevate-color-level1-bg1, rgba(216, 217, 233, 0)) 100%);\n}\n.Inner .LevelInfo.Level2 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level2button-shadow, rgba(191, 120, 6, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level2-bg0, #FCC410) 0%, var(--emw--elevate-color-level2-bg1, rgba(255, 189, 43, 0)) 100%);\n}\n.Inner .LevelInfo.Level3 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level3button-shadow, rgba(65, 6, 191, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level3-bg0, #B1A2DB) 0%, var(--emw--elevate-color-level3-bg1, rgba(203, 202, 245, 0)) 100%);\n}\n.Inner .LevelInfo.Level4 .ElevateLevel .LevelName {\n box-shadow: -2px -2px 7px 0px var(--emw--elevate-color-level4button-shadow, rgba(65, 6, 191, 0.75));\n background: linear-gradient(180deg, var(--emw--elevate-color-level4-bg0, #B1A2DB) 0%, var(--emw--elevate-color-level4-bg1, rgba(203, 202, 245, 0)) 100%);\n}\n.Inner .LevelInfo .ElevateLevel {\n display: flex;\n}\n.Inner .LevelInfo {\n flex: 1;\n flex-grow: 1;\n min-width: 150px;\n}\n.Inner .PlayerImg {\n width: 29%;\n margin: auto;\n max-width: 100px;\n min-width: 30px;\n order: 0;\n}\n.Inner .PlayerAvatar {\n max-width: 100px;\n flex-basis: 100px;\n height: auto;\n margin: auto;\n padding-top: 10px;\n}\n.Inner .PlayerAvatar .Avatar, .Inner .PlayerAvatar .Badge {\n width: 100%;\n height: 100%;\n}\n.Inner .PlayerAvatar .Avatar {\n border-radius: 50%;\n background-size: contain;\n background-repeat: no-repeat;\n}\n.Inner .ElevateLevel .ExpirationDate {\n max-width: 138px;\n min-width: 118px;\n}\n.Inner .PlayerName, .Inner .RedeemButton, .Inner .ElevateLevel {\n text-transform: capitalize;\n width: 100%;\n}\n.Inner .PlayerName {\n font-size: 16px;\n}\n.Inner .Row .PointsInfo {\n display: table;\n font-weight: 600;\n}\n.Inner .Row .Redeem {\n justify-content: flex-end;\n margin-left: auto;\n}\n.Inner .Row .Redeem:hover {\n color: var(--emw--elevate-color-redeem-hover, #00ABA4);\n cursor: pointer;\n}\n.Inner .Row .RedeemButton:hover span {\n color: var(emfe-w-elevate-color-redeem-text-hover, #f1f1f1);\n font-weight: bold;\n}\n.Inner .Row .RedeemButton {\n width: 95px;\n height: 35px;\n display: flex;\n align-items: center;\n border-radius: var(--emw--border-radius-medium, 10px);\n background: var(--emw--elevate-color-redeem-bg, linear-gradient(0deg, #26CC37, #26CC37)), linear-gradient(117.99deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.89%), linear-gradient(283.85deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.47%), linear-gradient(268.18deg, rgba(255, 255, 255, 0.6) -17.36%, rgba(239, 239, 239, 0) 15.78%);\n box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.2509803922);\n}\n.Inner .Row .RedeemButton span {\n color: var(--emw--color-white, #fff);\n line-height: 18px;\n font-size: 15px;\n text-align: center;\n width: 100%;\n}\n.Inner .Row .Points {\n font-size: large;\n vertical-align: middle;\n}\n.Inner .Row .Points .XP {\n font-size: x-small;\n}\n.Inner .Row .ExpirationPoints {\n font-size: small;\n text-align: right;\n font-weight: bold;\n color: var(--emw--color-red, #9e595f);\n}";
2870
+ const PlayerElevateCardDataStyle0 = playerElevateCardDataCss;
2871
+
2872
+ const PlayerElevateCardData = class {
2873
+ constructor(hostRef) {
2874
+ registerInstance(this, hostRef);
2875
+ this.playerElevateLeveLoaded = createEvent(this, "playerElevateLeveLoaded", 7);
2876
+ this.params = undefined;
2877
+ this.playerElevateLevel = undefined;
2878
+ this.pointExpireString = undefined;
2879
+ }
2880
+ handleWindowResizs() {
2881
+ this.initLevelProgressbar();
2882
+ }
2883
+ onParamsChanged() {
2884
+ this.loadElevateInfo();
2885
+ }
2886
+ redeemGiftButtonHandler() {
2887
+ this.loadElevateInfo();
2888
+ }
2889
+ onRedeemClick() {
2890
+ window.postMessage({ type: 'BEERedeemClicked' }, window.location.href);
2891
+ }
2892
+ loadLevels() {
2893
+ let url = new URL(`${this.params.endpoint}/v1/elevate/levels?language=${this.params.language}`);
2894
+ return new Promise((resolve, reject) => {
2895
+ return fetch(url.href, {
2896
+ method: 'GET',
2897
+ })
2898
+ .then((res) => res.json())
2899
+ .then((res) => {
2900
+ this.levels = res.data;
2901
+ resolve(true);
2902
+ })
2903
+ .catch((err) => {
2904
+ reject(err);
2905
+ });
2906
+ });
2907
+ }
2908
+ calcuatePointsToBeExpired(walletTotalInfo, translationPrefix) {
2909
+ let pointExpireInfoAsString = '';
2910
+ if (!walletTotalInfo || !walletTotalInfo.aboutToExpire ||
2911
+ walletTotalInfo.aboutToExpire.length == 0 ||
2912
+ walletTotalInfo.aboutToExpire[0].points <= 0) {
2913
+ return pointExpireInfoAsString;
2914
+ }
2915
+ walletTotalInfo.aboutToExpire.sort((expire1, expire2) => {
2916
+ return isBefore(new Date(expire1.expireTime), new Date(expire2.expireTime))
2917
+ ? -1
2918
+ : 1;
2919
+ });
2920
+ const aboutToExpire = walletTotalInfo.aboutToExpire[0];
2921
+ const daysToExpried = differenceInCalendarDays(new Date(aboutToExpire.expireTime), new Date());
2922
+ let hoursToExpired = 0, minutesToExpired = 0, expiredTranslationKey = daysToExpried === 0 ? `${translationPrefix}Day` : translationPrefix;
2923
+ if (daysToExpried <= 0) {
2924
+ hoursToExpired = differenceInHours(new Date(aboutToExpire.expireTime), new Date(), { roundingMethod: 'floor' });
2925
+ expiredTranslationKey = hoursToExpired > 1 ? `${translationPrefix}Hours` : `${translationPrefix}Hour`;
2926
+ if (hoursToExpired <= 0) {
2927
+ minutesToExpired = differenceInMinutes(new Date(aboutToExpire.expireTime), new Date(), { roundingMethod: 'floor' });
2928
+ expiredTranslationKey = minutesToExpired > 1 ? `${translationPrefix}Minutes` : `${translationPrefix}Minute`;
2929
+ }
2930
+ }
2931
+ pointExpireInfoAsString = translateWithParams(expiredTranslationKey, {
2932
+ expirationPoints: aboutToExpire.points,
2933
+ expireDay: Math.max(daysToExpried, hoursToExpired, minutesToExpired),
2934
+ lang: this.params.language,
2935
+ });
2936
+ return pointExpireInfoAsString;
2937
+ }
2938
+ loadPlayerLevelInfo() {
2939
+ let url = new URL(`${this.params.endpoint}/v1/elevate/playerInfo?language=${this.params.language}`);
2940
+ return new Promise((resolve, reject) => {
2941
+ return fetch(url.href, {
2942
+ method: 'GET',
2943
+ headers: {
2944
+ 'X-Sessionid': this.params.session,
2945
+ 'Content-Type': 'application/json',
2946
+ },
2947
+ })
2948
+ .then((res) => res.json())
2949
+ .then((res) => {
2950
+ var _a, _b, _c, _d, _e;
2951
+ if (!res.success) {
2952
+ console.error('Exception when fetch user elevateinfo, ', res.errorCode, res.errorMessage);
2953
+ reject(true);
2954
+ return;
2955
+ }
2956
+ window.postMessage({ type: 'UpdateGamificationXp', points: (_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.level) === null || _b === void 0 ? void 0 : _b.loyaltyPoints }, window.location.href);
2957
+ let playerElevateInfo = res.data;
2958
+ this.playerElevateLevel = playerElevateInfo.level;
2959
+ this.playerElevateLevel.name = this.playerElevateLevel.presentation.displayName || this.playerElevateLevel.name;
2960
+ this.playerElevateLevel.spendablePoints = ((_c = playerElevateInfo.spendableWallet) === null || _c === void 0 ? void 0 : _c.total.points) || 0;
2961
+ this.playerElevateLeveLoaded.emit({ elevateLevel: this.playerElevateLevel });
2962
+ const spendableTotal = (_d = res.data.spendableWallet) === null || _d === void 0 ? void 0 : _d.total;
2963
+ const loyaltyWalletTotal = (_e = res.data.loyaltyWallet) === null || _e === void 0 ? void 0 : _e.total;
2964
+ this.playerElevateLeveLoaded.emit({
2965
+ elevateLevelWalletTotal: spendableTotal,
2966
+ loyaltyWalletTotal
2967
+ });
2968
+ let spExpireInfoAsString = this.calcuatePointsToBeExpired(spendableTotal, 'coinsToBeExpired');
2969
+ let xpExpireInfoAsString = this.calcuatePointsToBeExpired(loyaltyWalletTotal, 'pointsToBeExpired');
2970
+ if (spExpireInfoAsString || xpExpireInfoAsString) {
2971
+ this.playerElevateLeveLoaded.emit({
2972
+ pointExpireString: spExpireInfoAsString,
2973
+ xpExpireString: xpExpireInfoAsString
2974
+ });
2975
+ }
2976
+ resolve(this.playerElevateLevel);
2977
+ })
2978
+ .catch((err) => {
2979
+ console.log('error ', err);
2980
+ reject(true);
2981
+ });
2982
+ });
2983
+ }
2984
+ setLoyaltyProgress(percent) {
2985
+ updateProgressSvg(this.loyaltyProgressEle, percent);
2986
+ }
2987
+ initLevelProgressbar() {
2988
+ setTimeout(() => {
2989
+ this.loyaltyProgressEle =
2990
+ this.elevateCardRef.parentElement.querySelector('#LevelProgress');
2991
+ if (!this.loyaltyProgressEle) {
2992
+ return;
2993
+ }
2994
+ this.setLoyaltyProgress(!this.playerElevateLevel.nextLevel
2995
+ ? 1 : (this.playerElevateLevel.loyaltyPoints / this.playerElevateLevel.nextLevel.entryPoints));
2996
+ this.params['playerElevateLevel'] = this.playerElevateLevel;
2997
+ }, 80);
2998
+ }
2999
+ componentDidRender() {
3000
+ this.initLevelProgressbar();
3001
+ }
3002
+ loadElevateInfo() {
3003
+ if (!this.params.endpoint || !this.params.session) {
3004
+ return;
3005
+ }
3006
+ const promises = [];
3007
+ promises.push(this.loadPlayerLevelInfo());
3008
+ if (this.params.calculateLevelFlag) {
3009
+ promises.push(this.loadLevels());
3010
+ }
3011
+ Promise.all(promises).then((res) => {
3012
+ console.log('elevate-init', res);
3013
+ this.initLevelProgressbar();
3014
+ if (!this.levels) {
3015
+ return;
3016
+ }
3017
+ this.levels.sort((level1, level2) => {
3018
+ return level1.firstEntryPoints > level2.firstEntryPoints ? 1 : -1;
3019
+ });
3020
+ const playerPoints = this.playerElevateLevel.loyaltyPoints;
3021
+ let playerLevelNumber = 0;
3022
+ this.levels.forEach((elevateLevel, idx) => {
3023
+ if (playerPoints > elevateLevel.firstEntryPoints) {
3024
+ playerLevelNumber = idx;
3025
+ }
3026
+ });
3027
+ this.playerElevateLeveLoaded.emit({
3028
+ calculatedLevelFlag: playerLevelNumber,
3029
+ });
3030
+ });
3031
+ }
3032
+ componentWillLoad() {
3033
+ this.loadElevateInfo();
3034
+ }
3035
+ get elevateCardRef() { return getElement(this); }
3036
+ static get watchers() { return {
3037
+ "params": ["onParamsChanged"]
3038
+ }; }
3039
+ };
3040
+ PlayerElevateCardData.style = PlayerElevateCardDataStyle0;
3041
+
3042
+ const LoyaltyProgress = `<svg width="100%" height="28" style="opacity: 0" fill="none" xmlns="http://www.w3.org/2000/svg">
3043
+ <rect y="12" x="2" width="100%" id="total_level" height="5" rx="2.5" fill="white" fill-opacity="0.5"/>
3044
+ <rect y="12" x="2" id="current_level" width="64" height="5" rx="2.5" fill="white"/>
3045
+ <g filter="url(#filter_current_level)">
3046
+ <circle id="circle_current_level" cx="74.5" cy="14.5" r="6.5" fill="white"/>
3047
+ </g>
3048
+ <g filter="url(#filter_heart_ball)">
3049
+ <g filter="url(#filter_ball)">
3050
+ <circle cx="169" cy="14" r="10" id="lock" fill="url(#paint0_linear_ball)"/>
3051
+ </g>
3052
+ <g filter="url(#filter_heart)">
3053
+ <svg x="0" y="4" id="lock_box">
3054
+ <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"/>
3055
+ <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,
3056
+ -4.809l0.002,0.002z" fill="url(#paint1_linear_lock)"/>
3057
+ <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"/>
3058
+ </svg>
3059
+ </g>
3060
+ </g>
3061
+ <g filter="url(#filter_lock)">
3062
+ <svg x="100%" y="9" id="heart_box">
3063
+ <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"/>
3064
+ </svg>
3065
+ </g>
3066
+ <defs>
3067
+ <filter id="filter_current_level" x="64" y="4" width="21" height="21" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
3068
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
3069
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
3070
+ <feGaussianBlur stdDeviation="2" result="effect1_foregroundBlur_305_23"/>
3071
+ </filter>
3072
+ <filter id="filter_heart_ball" x="155" y="0" width="28" height="28" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
3073
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
3074
+ <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"/>
3075
+ <feOffset/>
3076
+ <feGaussianBlur stdDeviation="2"/>
3077
+ <feComposite in2="hardAlpha" operator="out"/>
3078
+ <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"/>
3079
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_305_23"/>
3080
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_305_23" result="shape"/>
3081
+ </filter>
3082
+ <filter id="filter_ball" x="159" y="4" width="20" height="21" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
3083
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
3084
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
3085
+ <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"/>
3086
+ <feOffset dy="1"/>
3087
+ <feGaussianBlur stdDeviation="1"/>
3088
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
3089
+ <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"/>
3090
+ <feBlend mode="normal" in2="shape" result="effect1_innerShadow_305_23"/>
3091
+ </filter>
3092
+ <filter id="filter_heart" x="161.636" y="5.72727" width="14.7271" height="15.6364" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
3093
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
3094
+ <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"/>
3095
+ <feOffset/>
3096
+ <feGaussianBlur stdDeviation="0.5"/>
3097
+ <feComposite in2="hardAlpha" operator="out"/>
3098
+ <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"/>
3099
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_305_23"/>
3100
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_305_23" result="shape"/>
3101
+ </filter>
3102
+ <filter id="filter_lock" x="50" y="7" width="12" height="14" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
3103
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
3104
+ <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"/>
3105
+ <feOffset/>
3106
+ <feGaussianBlur stdDeviation="0.5"/>
3107
+ <feComposite in2="hardAlpha" operator="out"/>
3108
+ <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"/>
3109
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_305_23"/>
3110
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_305_23" result="shape"/>
3111
+ </filter>
3112
+ <linearGradient id="paint0_linear_ball" x1="163" y1="6" x2="174.2" y2="22.6" gradientUnits="userSpaceOnUse">
3113
+ <stop stop-color="#946AD7"/>
3114
+ <stop offset="1" stop-color="#EFABEB"/>
3115
+ </linearGradient>
3116
+ <linearGradient id="paint1_linear_lock" x1="100%" y1="18.4056" x2="169.002" y2="10.2845" gradientUnits="userSpaceOnUse">
3117
+ <stop stop-color="#814FD6"/>
3118
+ <stop offset="1" stop-color="#D679D8"/>
3119
+ </linearGradient>
3120
+ </defs>
3121
+ </svg>
3122
+ `;
3123
+
3124
+ const TipsInfo = `<svg width="126" height="92" viewBox="0 0 126 92" fill="none" xmlns="http://www.w3.org/2000/svg">
3125
+ <g filter="url(#filter0_d_242_4231)">
3126
+ <rect x="24" y="20" width="78" height="36" rx="4" fill="white"/>
3127
+ <path d="M24 24C24 21.7909 25.7909 20 28 20H64V56H28C25.7909 56 24 54.2091 24 52V24Z" fill="#464646"/>
3128
+ <path d="M51 56H37L43.2474 63.1399C43.6458 63.5952 44.3542 63.5952 44.7526 63.1399L51 56Z" fill="#464646"/>
3129
+ <circle cx="44" cy="38" r="7" fill="white"/>
3130
+ <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"/>
3131
+ <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"/>
3132
+ </g>
3133
+ <defs>
3134
+ <filter id="filter0_d_242_4231" x="0" y="0" width="126" height="91.4814" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
3135
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
3136
+ <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"/>
3137
+ <feOffset dy="4"/>
3138
+ <feGaussianBlur stdDeviation="12"/>
3139
+ <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"/>
3140
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_242_4231"/>
3141
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_242_4231" result="shape"/>
3142
+ </filter>
3143
+ </defs>
3144
+ </svg>
3145
+ `;
3146
+
3147
+ const PlayerLoyaltyProcess = () => (h("span", { class: "LevelProgress", id: 'LevelProgress', innerHTML: LoyaltyProgress }));
3148
+ const PlayerPoints = ({ loyaltyPoints, spendablePoints, pointExpireString, language, }) => (h("div", { class: "PointsInfo" },
3149
+ (loyaltyPoints && loyaltyPoints >= 0) &&
3150
+ h("div", { class: 'Points' },
3151
+ loyaltyPoints,
3152
+ " ",
3153
+ h("sub", { class: "XP" }, translate('xp', language))),
3154
+ spendablePoints &&
3155
+ h("div", { class: 'Points' },
3156
+ spendablePoints,
3157
+ " ",
3158
+ h("sub", { class: "XP" }, translate('sp', language))),
3159
+ pointExpireString && (h("div", { class: 'ExpirationPoints' },
3160
+ pointExpireString,
3161
+ " "))));
3162
+ const PlayerElevateCardRedeem = ({ language, onRedeemClick }) => (h("div", { class: "CardCell Redeem" },
3163
+ h("div", { class: "RedeemButton", onClick: () => {
3164
+ onRedeemClick();
3165
+ } },
3166
+ h("span", null, translate('redeem', language)))));
3167
+ const PlayerNameDiv = (props) => (h("div", { class: 'CardCell PlayerName Txt' }, props.playerName));
3168
+ const PlayerElevateLoyaltyLevel = (props) => (h("div", { class: 'CardCell ElevateLevel' },
3169
+ h("span", { class: "LevelName", title: props.level }, props.level),
3170
+ props.expireTime && (h("div", { class: "CardCell ExpirationDate Txt" },
3171
+ translate('expireOn', props.language),
3172
+ h("span", { class: "ExpireTime" }, format(new Date(props.expireTime), props.dateFormat || 'yyyy-MM-dd')),
3173
+ !props.hideInfo && (h("span", { class: "fa Info", style: { 'background': `url(${getAssetPath('../static/info.svg')})` } },
3174
+ h("span", { class: "InfoTips", innerHTML: TipsInfo })))))));
3175
+ const LoyaltyLevelExpireDay = (props) => (h("div", { class: 'CardCell ElevateLevel Expire' },
3176
+ h("div", { class: "CardCell ExpirationDate Txt" },
3177
+ translate('expireOn', props.language),
3178
+ h("span", { class: "ExpireTime" }, format(new Date(props.expireTime), props.dateFormat || 'yyyy-MM-dd')))));
3179
+ const PlayerAvatar = (props) => {
3180
+ const badge = props.loyaltyIconUrl
3181
+ ? h("img", { class: "Badge", src: props.loyaltyIconUrl })
3182
+ : props.hideIfNull ? '' : h("div", { class: "Badge" });
3183
+ const avatarSrc = props.playerAvatarUrl || getAssetPath('../static/user.svg');
3184
+ return h("div", { class: "PlayerAvatar", style: { 'position': `${props.onlyBadge ? '' : 'relative'}` } },
3185
+ !props.onlyBadge && h("img", { class: "Avatar", src: avatarSrc }),
3186
+ badge);
3187
+ };
3188
+
3189
+ const playerElevateCardJojogroupCss = "@container (max-width: 270px) {\n .Card .Inner {\n flex-direction: column;\n }\n .Card .Inner .Content {\n padding: 9px;\n }\n .Inner .Row .ExpirationPoints {\n order: 1;\n }\n}\n.Card .PlayerImg {\n order: 0;\n}\n.Card .ExpirationPoints {\n order: 3;\n}\n.Card .LevelInfo {\n order: 2;\n}\n.Card .Inner .Row .PlayerImg {\n flex-direction: column;\n}\n.Card .Inner .Row .PointsInfo {\n width: 100%;\n text-align: center;\n display: flex;\n flex-direction: column;\n max-height: 50%;\n}\n.Card .Inner .PlayerAvatar .Badge {\n background-size: contain;\n background-repeat: no-repeat;\n position: absolute;\n right: 5px;\n bottom: -5px;\n width: 40%;\n height: 40%;\n overflow: visible;\n}\n.Card .Inner .Row .ExpirationPoints {\n text-align: left;\n color: var(--emw--color-red, red);\n}\n.Card .Inner .Row .Points {\n text-wrap: nowrap;\n}\n.Card .Inner .LevelInfo .ElevateLevel {\n flex-direction: column;\n}\n.Card .Inner .LevelInfo .ElevateLevel .LevelName {\n width: calc(100% - 20px);\n text-align: left;\n font-size: 13px;\n padding-left: 20px;\n margin: 10px 0;\n}\n.Card .Inner .LevelInfo .ElevateLevel .ExpirationDate {\n text-align: center;\n font-size: smaller;\n}\n.Card .Inner .LevelInfo .ElevateLevel .ExpireTime {\n margin-left: 5px;\n}";
3190
+ const PlayerElevateCardJojogroupStyle0 = playerElevateCardJojogroupCss;
3191
+
3192
+ const PlayerElevateCardJojogroup = class {
3193
+ constructor(hostRef) {
3194
+ registerInstance(this, hostRef);
3195
+ this.endpoint = undefined;
3196
+ this.theme = 'Dark';
3197
+ this.session = undefined;
3198
+ this.playerAvatarUrl = undefined;
3199
+ this.language = 'en';
3200
+ this.playerName = undefined;
3201
+ this.dateFormat = 'yyyy-MM-dd';
3202
+ this.mbSource = undefined;
3203
+ this.clientStyling = '';
3204
+ this.clientStylingUrl = '';
3205
+ this.translationUrl = '';
3206
+ this.pointExpireString = undefined;
3207
+ this.playerLevelFlag = 0;
3208
+ this.playerElevateLevel = undefined;
3209
+ this.elevateWalletTotal = undefined;
3210
+ }
3211
+ onSessionOrEndpointChange() {
3212
+ this.paramProxy = Object.assign(Object.assign({}, this.paramProxy), { session: this.session, endpoint: this.endpoint, language: this.language });
3213
+ }
3214
+ playerElevateLeveLoadedHandler(event) {
3215
+ if (!event.detail) {
3216
+ return;
3217
+ }
3218
+ if (event.detail['elevateLevelWalletTotal']) {
3219
+ this.elevateWalletTotal = event.detail['elevateLevelWalletTotal'];
3220
+ }
3221
+ if (event.detail['elevateLevel']) {
3222
+ this.playerElevateLevel = event.detail['elevateLevel'];
3223
+ }
3224
+ if (event.detail['pointExpireString']) {
3225
+ this.pointExpireString = event.detail.xpExpireString;
3226
+ }
3227
+ if (event.detail.calculatedLevelFlag) {
3228
+ this.playerLevelFlag = event.detail.calculatedLevelFlag;
3229
+ }
3230
+ }
3231
+ onRedeemClick() {
3232
+ window.postMessage({ type: 'BEERedeemClicked' }, window.location.href);
3233
+ }
3234
+ componentWillLoad() {
3235
+ this.paramProxy = {
3236
+ endpoint: this.endpoint,
3237
+ session: this.session,
3238
+ language: this.language,
3239
+ calculateLevelFlag: true,
3240
+ };
3241
+ }
3242
+ render() {
3243
+ const backgroundOuterImagePath = getAssetPath('../static/card-ground.svg');
3244
+ const backgroundInnerImagePath = getAssetPath('../static/card-ground-over.svg');
3245
+ return (h("div", { key: '8c86c146c8f68edbafcd7b24f611dc8078b987a3', class: `ElevateCardWrapper ${this.theme}` }, h("div", { key: '2273ad46cd7d12af9381b49abcef845e4fb2c1ea', class: "Card Outer", style: { 'backgroundImage': `url(${backgroundOuterImagePath}` } }, h("general-styling-wrapper", { key: '059a83126b0d72dcbb313cdd403af8f2017b0aa3', clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl, mbSource: this.mbSource }), h("player-elevate-card-data", { key: '2ad65d182873df99f9a64d0c749cf0b620e0d502', params: this.paramProxy }), h("div", { key: 'd2e992c3b04e547743efd7a669d7ac8095e85a93', class: "OuterCover Inner", style: { 'backgroundImage': `url(${backgroundInnerImagePath}` } }, this.playerElevateLevel && (h(Fragment, { key: '52d2392de4e1385a8b859e0707c93a4438aee7f8' }, h("div", { key: '2b30a05a04f62dc533efa3f499af6ad03a594fc1', class: 'Content Row' }, h("div", { key: 'f675cbcfd702d7661b90d243dc82d4ae44b6f1b2', class: "PlayerImg" }, h(PlayerAvatar, { key: 'e2cef080372b41b2fcc5031dcf71a7554c1aad20', playerAvatarUrl: this.playerAvatarUrl, loyaltyIconUrl: this.playerElevateLevel.presentation.asset }), h(PlayerPoints, { key: 'a51f2fa52a39cbbab786e2fa349c2125e8991df0', loyaltyPoints: this.playerElevateLevel.loyaltyPoints, language: this.language })), this.pointExpireString && (h("div", { key: 'fc5a55e079e36c9397ee3d3e48eca22133e92006', class: 'PointsInfo ExpirationPoints' }, this.pointExpireString, " ")), h("div", { key: '8afa183b3cb73c7309021f47d35199760b3068c4', class: `LevelInfo Level${this.playerLevelFlag} ${this.playerElevateLevel.presentation.displayName}` }, h(PlayerNameDiv, { key: '4f027b896cbeff8ee27c2d56b79664dac9269529', playerName: this.playerName }), h(PlayerElevateLoyaltyLevel, { key: '61f4c0124fb91c5ab2183cb9c249d01ff5f144df', hideInfo: true, level: this.playerElevateLevel.name, expireTime: this.playerElevateLevel.expireTime, dateFormat: this.dateFormat }), h(PlayerLoyaltyProcess, { key: '96ded134514a3f69f6192ab3e7645a7eef76da45' }), h(PlayerElevateCardRedeem, { key: '5c5df70825273a064533d660dfd35279c9832b42', onRedeemClick: this.onRedeemClick, language: this.language })))))))));
3246
+ }
3247
+ static get assetsDirs() { return ["../static"]; }
3248
+ static get watchers() { return {
3249
+ "session": ["onSessionOrEndpointChange"],
3250
+ "endpoint": ["onSessionOrEndpointChange"],
3251
+ "language": ["onSessionOrEndpointChange"]
3252
+ }; }
3253
+ };
3254
+ PlayerElevateCardJojogroup.style = PlayerElevateCardJojogroupStyle0;
3255
+
3256
+ const playerElevateLoyaltycardJojogroupCss = ":host{display:block}@media screen and (min-width: 501px){.LoyaltyCard .Inner .LevelInfo .ElevateLevel{flex-wrap:nowrap}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{padding-top:6px;margin-left:0px}}@media screen and (max-width: 500px){.LoyaltyCard .Inner .LevelInfo .ElevateLevel{flex-wrap:wrap}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{padding-top:0px;margin-left:0px}}.LoyaltyCard .Inner{min-height:auto}.LoyaltyCard .Inner .LevelProgress{margin-left:0px}.LoyaltyCard .Inner .Row .PointsInfo.ExpirationPoints{text-align:left;color:var(--emw--color-red-50, red)}.LoyaltyCard .Inner .PlayerAvatar{padding:0;flex-basis:auto;margin:0}.LoyaltyCard .Inner .PlayerContainer{display:flex}.LoyaltyCard .Inner .PlayerAvatar .Avatar{display:none}.LoyaltyCard .Inner .PlayerAvatar .Badge{border-radius:50%;background-size:contain;width:40px;height:40px}.LoyaltyCard .Inner .PlayerImg{max-width:none;width:auto;margin:0;justify-content:space-between;align-items:flex-end}.LoyaltyCard .Inner .PlayerInfo{display:flex;flex-direction:column;justify-content:center}.LoyaltyCard .Inner .LevelInfo .ElevateLevel{display:flex;flex:1;align-items:center}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate{position:relative;padding-left:0px}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .ExpirationDate .ExpireTime{margin-left:5px}.LoyaltyCard .Inner .LevelInfo .ElevateLevel .LevelName{padding-left:0;font-size:var(--emw--elevate-fontsize-2xlarge, 21px);position:relative;width:auto;color:var(--emw--elevate-color-levelname, #FFBD2B);font-weight:bold}.LoyaltyCard .LevelRange{justify-content:space-between}.LoyaltyCard .PointsRange{display:flex;justify-content:flex-end}.LoyaltyCard .PointsRange .PointsInfo{width:auto}.LoyaltyCard .NextLevelTip{text-align:right;font-size:11px;color:var(--emw--color-black, #000);opacity:0.8;font-weight:bold}";
3257
+ const PlayerElevateLoyaltycardJojogroupStyle0 = playerElevateLoyaltycardJojogroupCss;
3258
+
3259
+ const PlayerElevateLoyaltycardJojogroup = class {
3260
+ constructor(hostRef) {
3261
+ registerInstance(this, hostRef);
3262
+ this.endpoint = undefined;
3263
+ this.theme = 'Dark';
3264
+ this.session = undefined;
3265
+ this.playerAvatarUrl = undefined;
3266
+ this.language = 'en';
3267
+ this.playerName = undefined;
3268
+ this.dateFormat = 'yyyy-MM-dd';
3269
+ this.mbSource = undefined;
3270
+ this.clientStyling = '';
3271
+ this.clientStylingUrl = '';
3272
+ this.translationUrl = '';
3273
+ this.pointExpireString = undefined;
3274
+ this.playerElevateLevel = undefined;
3275
+ this.elevateWalletTotal = undefined;
3276
+ }
3277
+ onSessionOrEndpointChange() {
3278
+ this.paramProxy = Object.assign(Object.assign({}, this.paramProxy), { session: this.session, endpoint: this.endpoint, language: this.language });
3279
+ }
3280
+ playerElevateLeveLoadedHandler(event) {
3281
+ if (!event.detail) {
3282
+ return;
3283
+ }
3284
+ if (event.detail['elevateLevelWalletTotal']) {
3285
+ this.elevateWalletTotal = event.detail['elevateLevelWalletTotal'];
3286
+ }
3287
+ if (event.detail['elevateLevel']) {
3288
+ this.playerElevateLevel = event.detail['elevateLevel'];
3289
+ }
3290
+ if (event.detail['pointExpireString']) {
3291
+ this.pointExpireString = event.detail.xpExpireString;
3292
+ }
3293
+ }
3294
+ onRedeemClick() {
3295
+ window.postMessage({ type: 'BEERedeemClicked' }, window.location.href);
3296
+ }
3297
+ componentWillLoad() {
3298
+ this.paramProxy = {
3299
+ endpoint: this.endpoint,
3300
+ session: this.session,
3301
+ language: this.language,
3302
+ };
3303
+ }
3304
+ getNextLevelPoints() {
3305
+ var _a, _b;
3306
+ return ((_a = this.playerElevateLevel) === null || _a === void 0 ? void 0 : _a.nextLevel) ? (_b = this.playerElevateLevel) === null || _b === void 0 ? void 0 : _b.nextLevel.entryPoints : -1;
3307
+ }
3308
+ getNextLevelTips() {
3309
+ var _a;
3310
+ //need xx to reach Diamond
3311
+ let nextLevel = (_a = this.playerElevateLevel) === null || _a === void 0 ? void 0 : _a.nextLevel;
3312
+ if (this.playerElevateLevel && nextLevel) {
3313
+ const pointsToReach = (nextLevel.entryPoints - this.playerElevateLevel.loyaltyPoints).toFixed(2);
3314
+ return translateWithParams('tipsForNextLevel', {
3315
+ pointsToReach,
3316
+ levelName: nextLevel.name,
3317
+ lang: this.language
3318
+ });
3319
+ }
3320
+ return '';
3321
+ }
3322
+ render() {
3323
+ var _a, _b, _c;
3324
+ const backgroundOuterImagePath = getAssetPath('../static/card-ground.svg');
3325
+ const backgroundInnerImagePath = getAssetPath('../static/card-ground-over.svg');
3326
+ return (h("div", { key: 'ef2c203816bdbd8146ac0e02435bdf4ffcc75bec', class: `ElevateCardWrapper ${this.theme}` }, h("div", { key: '7078fdc223dc7ffaac850243f6a04e3d7c63d22d', class: "LoyaltyCard Outer", style: { 'backgroundImage': `url(${backgroundOuterImagePath}` } }, h("general-styling-wrapper", { key: '04480062cf7da6b511a43205d7bfb6398404bd6a', clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl, mbSource: this.mbSource }), h("player-elevate-card-data", { key: 'aa0c7abb7916865b404da21aa87ce6a7ba2f39d4', params: this.paramProxy }), h("div", { key: '900c8fba904daa860a456b38b4905ca8c5c30fa5', class: 'OuterCover Inner', style: { 'backgroundImage': `url(${backgroundInnerImagePath}` } }, h("div", { key: '1f1a6d6423f07eaba470fd2c95c8249213c346d2', class: 'Content' }, this.playerElevateLevel && (h(Fragment, { key: '2eada6942e44a5d14e5295b88a0d82f9f5372c57' }, h("div", { key: '49a29540d068555fb3fe23859e2f4d1f4f7f488a', class: "PlayerImg Row" }, h("div", { key: '68b195d5e4bf205922998d5479cdb6c14e6abfac', class: "PlayerContainer" }, h(PlayerAvatar, { key: '86123e3ded6ec5bcd62c5b339809f50b075ba4ab', onlyBadge: true, loyaltyIconUrl: this.playerElevateLevel.presentation.asset }), h("div", { key: '8e8b8ea0961c5596c3aff7d689431dc39faedd14', class: "PlayerInfo" }, h("div", { key: '92d8b6abceea88af846203f2aca7b95e3582e2ab', class: 'CardCell ElevateLevel' }, h("span", { key: 'ba74043443ed78fc8e3f34689b7410783e6137c8', class: "PlayerName", title: this.playerElevateLevel.name }, this.playerName || this.playerElevateLevel.name)), h("div", { key: '9e84f0ce13a02152e8a347b947ac35623625be9d' }, (((_a = this.playerElevateLevel) === null || _a === void 0 ? void 0 : _a.loyaltyPoints) / ((_c = (_b = this.playerElevateLevel) === null || _b === void 0 ? void 0 : _b.nextLevel) === null || _c === void 0 ? void 0 : _c.entryPoints)) * 100, "%"))), h("div", { key: '1cd88a2cfefbb2326ac13fdadcf448bac075c316', class: 'PointsRange' }, h(PlayerPoints, { key: '21e27273e2e43b672b55fa13997e7db109be8070', loyaltyPoints: this.playerElevateLevel.loyaltyPoints, language: this.language }), h("span", { key: '329844014f55bbd8bf35bff81626da66c0c9b91a' }, "/"), h(PlayerPoints, { key: 'e8cac4c5e5d6bd8f0da9d6c0de84dce36110a747', loyaltyPoints: this.getNextLevelPoints(), language: this.language }))), h("div", { key: '1051f633025bc516201dc1861b8404d5c9f6713b', class: `LevelInfo ${this.playerElevateLevel.name}` }, h(PlayerLoyaltyProcess, { key: 'b5cb209cfca2166b7848b3196067d9c39259f1ae' }), h("div", { key: 'd9820322d3087e8eebfc238f1668f4c11fdaef57', class: "Row LevelRange" }, h("div", { key: '36b14cfcf0a7d428da82557c4f96a3db45a6d454' }, this.playerElevateLevel.name), h("div", { key: '61c6d3ba379d5ec1184f46d5e6d782d3a196fcf2' }, this.playerElevateLevel.nextLevel.name)), h("div", { key: '5bb2a4994885b38df7882cdf7c5a738e14bccef0', class: "NextLevelTip" }, this.getNextLevelTips()), this.pointExpireString && (h("div", { key: 'f2ac7fc7a633d312e6aa355e8faaabadf43e6984', class: 'PointsInfo ExpirationPoints' }, this.pointExpireString, " ")), this.playerElevateLevel.expireTime &&
3327
+ h(LoyaltyLevelExpireDay, { key: 'a75969ed01f62def9c66a4c9b42c8e884b3f819b', expireTime: this.playerElevateLevel.expireTime, dateFormat: this.dateFormat, language: this.language })))))))));
3328
+ }
3329
+ static get watchers() { return {
3330
+ "session": ["onSessionOrEndpointChange"],
3331
+ "endpoint": ["onSessionOrEndpointChange"],
3332
+ "language": ["onSessionOrEndpointChange"]
3333
+ }; }
3334
+ };
3335
+ PlayerElevateLoyaltycardJojogroup.style = PlayerElevateLoyaltycardJojogroupStyle0;
3336
+
3337
+ const playerElevatePointcardCss = ":host{display:block}.PointsCard .Inner .Row .ExpirationPoints{text-align:left}.PointsCard .Inner .PlayerAvatar .Avatar{display:none}.PointsCard .Inner .PlayerAvatar .Badge{border-radius:50%;background-size:contain;width:100%;height:100%;position:inherit}.PointsCard .Inner .PointsTxt{display:flex;flex-direction:row;justify-content:space-between}.PointsCard .Inner .DetailButton{background:linear-gradient(283.85deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.47%), linear-gradient(117.99deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 33.89%), linear-gradient(268.18deg, rgba(255, 255, 255, 0.6) -17.36%, rgba(239, 239, 239, 0) 15.78%), linear-gradient(0deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6));border-radius:5px;box-shadow:0px 4px 4px 0px rgba(0, 0, 0, 0.25);border:2px solid;font-size:11px;width:108px;padding:4px;cursor:pointer;margin-top:5px;height:16px;min-width:45px;text-align:center}.PointsCard .Inner .DetailButton span{color:var(--emw--color-gray-150, #6D6D6D)}.PointsCard .Inner .DetailButton span{display:inline-block;vertical-align:middle}.PointsCard .Inner .DetailButton:hover span{color:var(--emw--color-gray-150, #6D6D6D)}.PointsCard .Inner .LevelInfo{gap:15px;width:70%}.PointsCard .Inner .LevelInfo .PointsTxt{font-size:15px}.PointsCard .Inner .LevelInfo .PointsTxt.Label{display:none}.PointsCard .Inner .LevelInfo .PointsTxt.SPPoints{padding-top:15px}.PointsCard .Inner .LevelInfo .PointsTxt .TC{font-size:x-small;color:var(--emw--color-gray-300, #58586B);display:flex;align-content:center;height:100%;flex-wrap:wrap;text-decoration:underline;cursor:pointer;display:none}";
3338
+ const PlayerElevatePointcardStyle0 = playerElevatePointcardCss;
3339
+
3340
+ const PlayerElevatePointcard = class {
3341
+ constructor(hostRef) {
3342
+ registerInstance(this, hostRef);
3343
+ this.isPointDetailCard = this.buttonType === 'earningRule';
3344
+ this.endpoint = undefined;
3345
+ this.theme = 'Dark';
3346
+ this.session = undefined;
3347
+ this.playerAvatarUrl = undefined;
3348
+ this.language = 'en';
3349
+ this.mbSource = undefined;
3350
+ this.playerName = undefined;
3351
+ this.cardTitle = undefined;
3352
+ this.buttonType = 'earningRule';
3353
+ this.dateFormat = 'yyyy-MM-dd';
3354
+ this.clientStyling = '';
3355
+ this.clientStylingUrl = '';
3356
+ this.translationUrl = '';
3357
+ this.pointExpireString = undefined;
3358
+ this.playerElevateLevel = undefined;
3359
+ this.elevateWalletTotal = undefined;
3360
+ this.elevateSPTotal = undefined;
3361
+ }
3362
+ onSessionOrEndpointChange() {
3363
+ this.paramProxy = Object.assign(Object.assign({}, this.paramProxy), { session: this.session, endpoint: this.endpoint, language: this.language });
3364
+ }
3365
+ playerElevateLeveLoadedHandler(event) {
3366
+ if (!event.detail) {
3367
+ return;
3368
+ }
3369
+ if (event.detail['elevateLevelWalletTotal']) {
3370
+ this.elevateWalletTotal = event.detail['elevateLevelWalletTotal'];
3371
+ this.elevateSPTotal = event.detail['loyaltyWalletTotal'];
3372
+ }
3373
+ if (event.detail['elevateLevel']) {
3374
+ this.playerElevateLevel = event.detail['elevateLevel'];
3375
+ }
3376
+ if (event.detail['pointExpireString']) {
3377
+ this.pointExpireString = event.detail.pointExpireString;
3378
+ }
3379
+ }
3380
+ onDetailsClick() {
3381
+ window.postMessage({ type: this.isPointDetailCard ? 'BEEPointRulesClicked' : 'BEEDetailsClicked',
3382
+ path: this.isPointDetailCard ? 'player-elevate-level' : 'player-elevate-point-details' }, window.location.href);
3383
+ }
3384
+ componentWillLoad() {
3385
+ this.paramProxy = {
3386
+ endpoint: this.endpoint,
3387
+ session: this.session,
3388
+ language: this.language,
3389
+ };
3390
+ }
3391
+ render() {
3392
+ const backgroundOuterImagePath = getAssetPath('../static/card-ground.svg');
3393
+ const backgroundInnerImagePath = getAssetPath('../static/card-ground-over.svg');
3394
+ return (h("div", { key: 'a1ed46e501d24f84ea23958d2108a9ad36df3083', class: `ElevateCardWrapper ${this.theme}` }, h("div", { key: 'e671bf40a9fa75dbf89e37ca9ca7668ddf1416cf', class: "PointsCard Outer ", style: { 'backgroundImage': `url(${backgroundOuterImagePath}` } }, h("general-styling-wrapper", { key: '95d373644d93160714c04abe5056122491e846a4', clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl, mbSource: this.mbSource }), h("player-elevate-card-data", { key: '653c503f9689f3d4a99ad59f4c534785210ecd3c', params: this.paramProxy }), h("div", { key: '025c5a40e8e75450ac9463182bc3600002a29943', class: 'OuterCover Inner', style: { 'backgroundImage': `url(${backgroundInnerImagePath}` } }, h("div", { key: '93c05e87b54c7d05ad0fd4b4878e8e8e2aa25abc', class: 'Content Row' }, this.playerElevateLevel && (h(Fragment, { key: '3fbc0bb622e07f29f94ffe33c747047c1f709cff' }, h("div", { key: '7ab9253f7445bc7f4f2bb26bb52563a23d3ab73e', class: "PlayerImg" }, h(PlayerAvatar, { key: '5098ab36b2a33f35e10b3b9e1f2eabfe60e3002d', onlyBadge: true, loyaltyIconUrl: this.playerElevateLevel.presentation.asset })), h("div", { key: '2f8e012352460a67a28cdb997a7dc68dbbdaea0b', class: `LevelInfo ${this.playerElevateLevel.name}` }, h("div", { key: '679d8edbe69f1cff3f18fe1f6742a13942417876', class: "PointsTxt Label" }, this.cardTitle ? this.cardTitle : translate('spendablePoints', this.language)), h("div", { key: 'ca49127c96c3d048015f1687102d8e4da46a76b5', class: 'PointsTxt SPPoints' }, h(PlayerPoints, { key: '3a7b03cada8b9629924504972d32ce8c4d573a06', spendablePoints: this.playerElevateLevel.spendablePoints, language: this.language }), h("a", { key: 'cb3bf9415204ef1ee7fe9653deb332d13d235e9b', class: "TC", onClick: () => {
3395
+ this.onDetailsClick();
3396
+ } }, translate('termAndConditions', this.language))), this.pointExpireString && (h("div", { key: '3fde19f5524ff6c5db9b23edfb1df6be112313e9', class: 'ExpirationPoints' }, this.pointExpireString, " "))))))))));
3397
+ }
3398
+ static get watchers() { return {
3399
+ "session": ["onSessionOrEndpointChange"],
3400
+ "endpoint": ["onSessionOrEndpointChange"],
3401
+ "language": ["onSessionOrEndpointChange"]
3402
+ }; }
3403
+ };
3404
+ PlayerElevatePointcard.style = PlayerElevatePointcardStyle0;
3405
+
3406
+ const playerRakebackCardCss = ":host{display:block}@keyframes rotate{from{transform:rotate(360deg)}to{transform:rotate(0deg)}}.RakebackCard{border:2px solid var(--em-color-border-primary, #003E5C);padding:32px;border-radius:var(--emw--border-radius-medium, 12px);overflow:hidden;font-family:inherit}.RakebackCard .RakebackCardContent .RakebackTitle{font-size:var(--emw--font-size-small, 14px);font-weight:var(--emw--font-weight-semibold, 500);color:var(--em-color-text-secondary, #727672)}.RakebackCard .RakebackCardContent .RakebackDetails{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;margin-top:17px}.RakebackCard .RakebackCardContent .RakebackDetails .RakebackInfo{display:flex;flex-wrap:wrap;align-items:center;gap:0 17px}.RakebackCard .RakebackCardContent .RakebackDetails .RakebackInfo .RakebackRefresh{width:52px;height:52px;cursor:pointer}.RakebackCard .RakebackCardContent .RakebackDetails .RakebackInfo .RakebackRefresh.RakebackLoading{animation:rotate 0.5s linear infinite}.RakebackCard .RakebackCardContent .RakebackDetails .RakebackInfo .RakebackNumContainer{color:var(--em-color-text-primary, #fff);display:flex;align-items:center;gap:8px}.RakebackCard .RakebackCardContent .RakebackDetails .RakebackInfo .RakebackNumContainer .RakebackNum{display:inline-block;font-weight:var(--emw--font-weight-bold, 700);font-size:var(--emw--font-size-2x-large, 36px)}.RakebackCard .RakebackCardContent .RakebackDetails .RakebackInfo .RakebackNumContainer .RakebackCurrency{display:inline-block;font-weight:var(--emw--font-weight-semibold, 500);font-size:var(--emw--font-size-small, 14px);margin-top:14px}.RakebackCard .RakebackCardContent .RakebackDetails .RakebackButton{font-family:inherit;cursor:pointer;width:90px;height:34px;border-radius:var(--emw--border-radius-large, 99px);border:2px solid var(--em-color-border-success, #083B17);display:flex;justify-content:center;align-items:center;color:var(--em-color-text-primary, #fff);background:linear-gradient(180deg, var(--em-color-gradient-1, #24B24E) 0%, var(--em-color-gradient-1, #24B24E) 100%)}.RakebackCard .RakebackCardContent .RakebackDetails .RakebackButton.disabled{cursor:not-allowed;opacity:0.4}.RakebackCard .RakebackCardContent .RakebackCoolOff,.RakebackCard .RakebackCardContent .RakebackError{margin-top:8px;font-weight:var(--emw--font-weight-semibold, 500);font-size:var(--emw--font-size-x-small, 12px);color:var(--em-color-text-error, #FF7A73);text-align:center}";
3407
+ const PlayerRakebackCardStyle0 = playerRakebackCardCss;
3408
+
3409
+ const PlayerRakebackCard = class {
3410
+ constructor(hostRef) {
3411
+ registerInstance(this, hostRef);
3412
+ /**
3413
+ * Truncate number to specified decimal places (without rounding)
3414
+ * @param num Number to be processed
3415
+ * @param digits Number of decimal places to keep
3416
+ */
3417
+ this.truncateNumber = (num, digits = 2) => {
3418
+ const str = num.toString();
3419
+ const [integer, decimal = ''] = str.split('.');
3420
+ return digits > 0 ? `${integer}.${decimal ? decimal.slice(0, digits) : '00'}` : `${integer}`;
3421
+ };
3422
+ this.sendRakebackClaimedEvent = () => {
3423
+ if (!this.endpoint || !this.session || !this.rakebackInfo.claimable || this.isLoading) {
3424
+ return;
3425
+ }
3426
+ window.postMessage({ type: 'RakebackClaimTrigger', points: this.rakebackInfo.points }, window.location.href);
3427
+ };
3428
+ this.endpoint = undefined;
3429
+ this.theme = 'Dark';
3430
+ this.session = undefined;
3431
+ this.language = 'en';
3432
+ this.mbSource = undefined;
3433
+ this.clientStyling = '';
3434
+ this.clientStylingUrl = '';
3435
+ this.translationUrl = '';
3436
+ this.show = true;
3437
+ this.rakebackInfo = {
3438
+ hasRakebackWallet: false,
3439
+ points: 0.0,
3440
+ currency: 'TRY',
3441
+ claimable: false,
3442
+ minutesCanClaim: 0,
3443
+ showCanClaim: false
3444
+ };
3445
+ this.isLoading = false;
3446
+ this.coolingOffPeriod = false;
3447
+ this.showTheWidget = false;
3448
+ }
3449
+ async onSessionOrEndpointChange() {
3450
+ await this.loadRakebackInfo();
3451
+ }
3452
+ async onShowOrHasRakebackWalletChange() {
3453
+ this.showTheWidget = this.show && this.rakebackInfo.hasRakebackWallet;
3454
+ }
3455
+ handleMessage(event) {
3456
+ const { type } = event === null || event === void 0 ? void 0 : event.data;
3457
+ if (type === 'RakebackClaimConfirmed') {
3458
+ this.claimRakeback();
3459
+ }
3460
+ }
3461
+ async loadRakebackInfo() {
3462
+ if (!this.endpoint || !this.session) {
3463
+ return;
3464
+ }
3465
+ this.isLoading = true;
3466
+ try {
3467
+ const url = new URL(`${this.endpoint}/v1/elevate/playerInfo?language=${this.language}`);
3468
+ const response = await fetch(url.href, {
3469
+ method: 'GET',
3470
+ headers: {
3471
+ 'X-Sessionid': this.session,
3472
+ 'Content-Type': 'application/json'
3473
+ }
3474
+ });
3475
+ if (!response.ok) {
3476
+ throw new Error(`HTTP error! status: ${response.status}`);
3477
+ }
3478
+ const data = await response.json();
3479
+ if (!data.success) {
3480
+ throw new Error(data.errorMessage || 'Failed to load rakeback info');
3481
+ }
3482
+ const { rakebackWallet } = data === null || data === void 0 ? void 0 : data.data;
3483
+ if (!rakebackWallet) {
3484
+ window.postMessage({ type: 'RakebackWalletMissing' }, window.location.href);
3485
+ return;
3486
+ }
3487
+ const { total, claimable, currency, minutesCanClaim } = rakebackWallet || {};
3488
+ this.rakebackInfo = {
3489
+ hasRakebackWallet: true,
3490
+ points: (total === null || total === void 0 ? void 0 : total.points) ? this.truncateNumber(total.points, 2) : `0.00`,
3491
+ currency: currency || '',
3492
+ claimable: claimable || false,
3493
+ showCanClaim: Boolean(minutesCanClaim && minutesCanClaim > 0),
3494
+ minutesCanClaim: minutesCanClaim
3495
+ ? minutesCanClaim <= 1 && minutesCanClaim > 0
3496
+ ? 1
3497
+ : this.truncateNumber(minutesCanClaim, 0)
3498
+ : 0
3499
+ };
3500
+ }
3501
+ catch (err) {
3502
+ console.error('Error loading rakeback info:', err);
3503
+ window.postMessage({ type: 'RakebackClaimError', message: err.message }, window.location.href);
3504
+ }
3505
+ finally {
3506
+ this.isLoading = false;
3507
+ }
3508
+ }
3509
+ async claimRakeback() {
3510
+ this.isLoading = true;
3511
+ try {
3512
+ const url = new URL(`${this.endpoint}/v1/elevate/rakeback/claim`);
3513
+ const response = await fetch(url.href, {
3514
+ method: 'PUT',
3515
+ headers: {
3516
+ 'X-Sessionid': this.session,
3517
+ 'Content-Type': 'application/json'
3518
+ },
3519
+ body: JSON.stringify({})
3520
+ });
3521
+ if (!response.ok) {
3522
+ throw new Error(`HTTP error! status: ${response.status}`);
3523
+ }
3524
+ const data = await response.json();
3525
+ if (!data.success) {
3526
+ throw new Error(data.errorMessage || 'Failed to claim rakeback');
3527
+ }
3528
+ // Refresh rakeback information
3529
+ await this.loadRakebackInfo();
3530
+ // Send event notification for successful redemption
3531
+ window.postMessage({ type: 'RakebackClaimed', points: this.rakebackInfo.points }, window.location.href);
3532
+ }
3533
+ catch (err) {
3534
+ console.error('Error claiming rakeback:', err);
3535
+ window.postMessage({ type: 'RakebackClaimError', message: err.message }, window.location.href);
3536
+ }
3537
+ finally {
3538
+ this.isLoading = false;
3539
+ }
3540
+ }
3541
+ async componentWillLoad() {
3542
+ await this.loadRakebackInfo();
3543
+ await this.onShowOrHasRakebackWalletChange();
3544
+ }
3545
+ render() {
3546
+ return this.showTheWidget ? (h("div", { class: "RakebackCard" }, h("general-styling-wrapper", { clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl, mbSource: this.mbSource }), h("div", { class: "RakebackCardContent" }, h("div", { class: "RakebackTitle" }, translate('rakebackTitle', this.language)), h("div", { class: "RakebackDetails" }, h("div", { class: "RakebackInfo" }, h("div", { class: "RakebackNumContainer" }, h("span", { class: "RakebackNum" }, this.rakebackInfo.points), h("span", { class: "RakebackCurrency" }, this.rakebackInfo.currency))), h("div", { class: `RakebackButton ${this.isLoading || !this.rakebackInfo.claimable ? 'disabled' : ''}`, onClick: this.sendRakebackClaimedEvent }, translate('claim', this.language))), !this.rakebackInfo.claimable && this.rakebackInfo.showCanClaim && (h("div", { class: "RakebackCoolOff" }, translateWithParams('minutesCanClaim', {
3547
+ lang: this.language,
3548
+ minutes: this.rakebackInfo.minutesCanClaim
3549
+ })))))) : null;
3550
+ }
3551
+ static get watchers() { return {
3552
+ "session": ["onSessionOrEndpointChange"],
3553
+ "endpoint": ["onSessionOrEndpointChange"],
3554
+ "language": ["onSessionOrEndpointChange"],
3555
+ "show": ["onShowOrHasRakebackWalletChange"],
3556
+ "rakebackInfo": ["onShowOrHasRakebackWalletChange"]
3557
+ }; }
3558
+ };
3559
+ PlayerRakebackCard.style = PlayerRakebackCardStyle0;
3560
+
3561
+ export { GeneralStylingWrapper as general_styling_wrapper, PlayerElevateCardData as player_elevate_card_data, PlayerElevateCardJojogroup as player_elevate_card_jojogroup, PlayerElevateLoyaltycardJojogroup as player_elevate_loyaltycard_jojogroup, PlayerElevatePointcard as player_elevate_pointcard, PlayerRakebackCard as player_rakeback_card };