@everymatrix/player-elevate-card 1.0.69

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