@everymatrix/lottery-tipping-ticket-buy 0.0.1

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 (65) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/app-tooltip_11.cjs.entry.js +3998 -0
  3. package/dist/cjs/index-8a0b513b.js +1364 -0
  4. package/dist/cjs/index.cjs.js +10 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/lottery-tipping-ticket-buy-164a217a.js +7953 -0
  7. package/dist/cjs/lottery-tipping-ticket-buy.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +63 -0
  9. package/dist/collection/components/lottery-segmented/lottery-segmented.css +52 -0
  10. package/dist/collection/components/lottery-segmented/lottery-segmented.js +151 -0
  11. package/dist/collection/components/lottery-tipping-ticket-buy/index.js +1 -0
  12. package/dist/collection/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.css +122 -0
  13. package/dist/collection/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.js +806 -0
  14. package/dist/collection/index.js +1 -0
  15. package/dist/collection/model/type.js +6 -0
  16. package/dist/collection/utils/api.js +72 -0
  17. package/dist/collection/utils/locale.utils.js +118 -0
  18. package/dist/collection/utils/utils.js +114 -0
  19. package/dist/esm/app-globals-0f993ce5.js +3 -0
  20. package/dist/esm/app-tooltip_11.entry.js +3985 -0
  21. package/dist/esm/index-c24f96b9.js +1335 -0
  22. package/dist/esm/index.js +2 -0
  23. package/dist/esm/loader.js +11 -0
  24. package/dist/esm/lottery-tipping-ticket-buy-04819204.js +7941 -0
  25. package/dist/esm/lottery-tipping-ticket-buy.js +20 -0
  26. package/dist/index.cjs.js +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/lottery-tipping-ticket-buy/app-globals-0f993ce5.js +1 -0
  29. package/dist/lottery-tipping-ticket-buy/app-tooltip_11.entry.js +1 -0
  30. package/dist/lottery-tipping-ticket-buy/index-c24f96b9.js +2 -0
  31. package/dist/lottery-tipping-ticket-buy/index.esm.js +1 -0
  32. package/dist/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy-04819204.js +6657 -0
  33. package/dist/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.esm.js +1 -0
  34. package/dist/static/poolGameLogo.webp +0 -0
  35. package/dist/stencil.config.dev.js +19 -0
  36. package/dist/stencil.config.js +19 -0
  37. package/dist/storybook/main.js +43 -0
  38. package/dist/storybook/preview.js +9 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/stencil.config.d.ts +2 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/stencil.config.dev.d.ts +2 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/storybook/main.d.ts +3 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/packages/stencil/lottery-tipping-ticket-buy/storybook/preview.d.ts +70 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/index.d.ts +4 -0
  45. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  46. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  47. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  48. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-ticket-buy/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  49. package/dist/types/components/lottery-segmented/lottery-segmented.d.ts +34 -0
  50. package/dist/types/components/lottery-tipping-ticket-buy/index.d.ts +1 -0
  51. package/dist/types/components/lottery-tipping-ticket-buy/lottery-tipping-ticket-buy.d.ts +165 -0
  52. package/dist/types/components.d.ts +228 -0
  53. package/dist/types/index.d.ts +1 -0
  54. package/dist/types/model/type.d.ts +203 -0
  55. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  56. package/dist/types/utils/api.d.ts +9 -0
  57. package/dist/types/utils/locale.utils.d.ts +3 -0
  58. package/dist/types/utils/utils.d.ts +13 -0
  59. package/loader/cdn.js +1 -0
  60. package/loader/index.cjs.js +1 -0
  61. package/loader/index.d.ts +24 -0
  62. package/loader/index.es2017.js +1 -0
  63. package/loader/index.js +2 -0
  64. package/loader/package.json +11 -0
  65. package/package.json +27 -0
@@ -0,0 +1,3985 @@
1
+ import { r as registerInstance, h, g as getElement, c as createEvent, a as getAssetPath } from './index-c24f96b9.js';
2
+ import { r as requiredArgs, t as toDate, a as toInteger, _ as _typeof, s as setClientStyling, b as setClientStylingURL, c as setStreamStyling, p as parseISO, i as isBefore } from './lottery-tipping-ticket-buy-04819204.js';
3
+ export { d as lottery_segmented, L as lottery_tipping_ticket_buy } from './lottery-tipping-ticket-buy-04819204.js';
4
+
5
+ /**
6
+ * @name addMilliseconds
7
+ * @category Millisecond Helpers
8
+ * @summary Add the specified number of milliseconds to the given date.
9
+ *
10
+ * @description
11
+ * Add the specified number of milliseconds to the given date.
12
+ *
13
+ * @param {Date|Number} date - the date to be changed
14
+ * @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`.
15
+ * @returns {Date} the new date with the milliseconds added
16
+ * @throws {TypeError} 2 arguments required
17
+ *
18
+ * @example
19
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
20
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
21
+ * //=> Thu Jul 10 2014 12:45:30.750
22
+ */
23
+ function addMilliseconds(dirtyDate, dirtyAmount) {
24
+ requiredArgs(2, arguments);
25
+ var timestamp = toDate(dirtyDate).getTime();
26
+ var amount = toInteger(dirtyAmount);
27
+ return new Date(timestamp + amount);
28
+ }
29
+
30
+ var defaultOptions = {};
31
+ function getDefaultOptions() {
32
+ return defaultOptions;
33
+ }
34
+
35
+ /**
36
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
37
+ * They usually appear for dates that denote time before the timezones were introduced
38
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
39
+ * and GMT+01:00:00 after that date)
40
+ *
41
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
42
+ * which would lead to incorrect calculations.
43
+ *
44
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
45
+ */
46
+ function getTimezoneOffsetInMilliseconds(date) {
47
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
48
+ utcDate.setUTCFullYear(date.getFullYear());
49
+ return date.getTime() - utcDate.getTime();
50
+ }
51
+
52
+ /**
53
+ * @name isDate
54
+ * @category Common Helpers
55
+ * @summary Is the given value a date?
56
+ *
57
+ * @description
58
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
59
+ *
60
+ * @param {*} value - the value to check
61
+ * @returns {boolean} true if the given value is a date
62
+ * @throws {TypeError} 1 arguments required
63
+ *
64
+ * @example
65
+ * // For a valid date:
66
+ * const result = isDate(new Date())
67
+ * //=> true
68
+ *
69
+ * @example
70
+ * // For an invalid date:
71
+ * const result = isDate(new Date(NaN))
72
+ * //=> true
73
+ *
74
+ * @example
75
+ * // For some value:
76
+ * const result = isDate('2014-02-31')
77
+ * //=> false
78
+ *
79
+ * @example
80
+ * // For an object:
81
+ * const result = isDate({})
82
+ * //=> false
83
+ */
84
+ function isDate(value) {
85
+ requiredArgs(1, arguments);
86
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
87
+ }
88
+
89
+ /**
90
+ * @name isValid
91
+ * @category Common Helpers
92
+ * @summary Is the given date valid?
93
+ *
94
+ * @description
95
+ * Returns false if argument is Invalid Date and true otherwise.
96
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
97
+ * Invalid Date is a Date, whose time value is NaN.
98
+ *
99
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
100
+ *
101
+ * @param {*} date - the date to check
102
+ * @returns {Boolean} the date is valid
103
+ * @throws {TypeError} 1 argument required
104
+ *
105
+ * @example
106
+ * // For the valid date:
107
+ * const result = isValid(new Date(2014, 1, 31))
108
+ * //=> true
109
+ *
110
+ * @example
111
+ * // For the value, convertable into a date:
112
+ * const result = isValid(1393804800000)
113
+ * //=> true
114
+ *
115
+ * @example
116
+ * // For the invalid date:
117
+ * const result = isValid(new Date(''))
118
+ * //=> false
119
+ */
120
+ function isValid(dirtyDate) {
121
+ requiredArgs(1, arguments);
122
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
123
+ return false;
124
+ }
125
+ var date = toDate(dirtyDate);
126
+ return !isNaN(Number(date));
127
+ }
128
+
129
+ /**
130
+ * @name subMilliseconds
131
+ * @category Millisecond Helpers
132
+ * @summary Subtract the specified number of milliseconds from the given date.
133
+ *
134
+ * @description
135
+ * Subtract the specified number of milliseconds from the given date.
136
+ *
137
+ * @param {Date|Number} date - the date to be changed
138
+ * @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`.
139
+ * @returns {Date} the new date with the milliseconds subtracted
140
+ * @throws {TypeError} 2 arguments required
141
+ *
142
+ * @example
143
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
144
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
145
+ * //=> Thu Jul 10 2014 12:45:29.250
146
+ */
147
+ function subMilliseconds(dirtyDate, dirtyAmount) {
148
+ requiredArgs(2, arguments);
149
+ var amount = toInteger(dirtyAmount);
150
+ return addMilliseconds(dirtyDate, -amount);
151
+ }
152
+
153
+ var MILLISECONDS_IN_DAY = 86400000;
154
+ function getUTCDayOfYear(dirtyDate) {
155
+ requiredArgs(1, arguments);
156
+ var date = toDate(dirtyDate);
157
+ var timestamp = date.getTime();
158
+ date.setUTCMonth(0, 1);
159
+ date.setUTCHours(0, 0, 0, 0);
160
+ var startOfYearTimestamp = date.getTime();
161
+ var difference = timestamp - startOfYearTimestamp;
162
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
163
+ }
164
+
165
+ function startOfUTCISOWeek(dirtyDate) {
166
+ requiredArgs(1, arguments);
167
+ var weekStartsOn = 1;
168
+ var date = toDate(dirtyDate);
169
+ var day = date.getUTCDay();
170
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
171
+ date.setUTCDate(date.getUTCDate() - diff);
172
+ date.setUTCHours(0, 0, 0, 0);
173
+ return date;
174
+ }
175
+
176
+ function getUTCISOWeekYear(dirtyDate) {
177
+ requiredArgs(1, arguments);
178
+ var date = toDate(dirtyDate);
179
+ var year = date.getUTCFullYear();
180
+ var fourthOfJanuaryOfNextYear = new Date(0);
181
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
182
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
183
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
184
+ var fourthOfJanuaryOfThisYear = new Date(0);
185
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
186
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
187
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
188
+ if (date.getTime() >= startOfNextYear.getTime()) {
189
+ return year + 1;
190
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
191
+ return year;
192
+ } else {
193
+ return year - 1;
194
+ }
195
+ }
196
+
197
+ function startOfUTCISOWeekYear(dirtyDate) {
198
+ requiredArgs(1, arguments);
199
+ var year = getUTCISOWeekYear(dirtyDate);
200
+ var fourthOfJanuary = new Date(0);
201
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
202
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
203
+ var date = startOfUTCISOWeek(fourthOfJanuary);
204
+ return date;
205
+ }
206
+
207
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
208
+ function getUTCISOWeek(dirtyDate) {
209
+ requiredArgs(1, arguments);
210
+ var date = toDate(dirtyDate);
211
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
212
+
213
+ // Round the number of days to the nearest integer
214
+ // because the number of milliseconds in a week is not constant
215
+ // (e.g. it's different in the week of the daylight saving time clock shift)
216
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
217
+ }
218
+
219
+ function startOfUTCWeek(dirtyDate, options) {
220
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
221
+ requiredArgs(1, arguments);
222
+ var defaultOptions = getDefaultOptions();
223
+ 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);
224
+
225
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
226
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
227
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
228
+ }
229
+ var date = toDate(dirtyDate);
230
+ var day = date.getUTCDay();
231
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
232
+ date.setUTCDate(date.getUTCDate() - diff);
233
+ date.setUTCHours(0, 0, 0, 0);
234
+ return date;
235
+ }
236
+
237
+ function getUTCWeekYear(dirtyDate, options) {
238
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
239
+ requiredArgs(1, arguments);
240
+ var date = toDate(dirtyDate);
241
+ var year = date.getUTCFullYear();
242
+ var defaultOptions = getDefaultOptions();
243
+ 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);
244
+
245
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
246
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
247
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
248
+ }
249
+ var firstWeekOfNextYear = new Date(0);
250
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
251
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
252
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
253
+ var firstWeekOfThisYear = new Date(0);
254
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
255
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
256
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
257
+ if (date.getTime() >= startOfNextYear.getTime()) {
258
+ return year + 1;
259
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
260
+ return year;
261
+ } else {
262
+ return year - 1;
263
+ }
264
+ }
265
+
266
+ function startOfUTCWeekYear(dirtyDate, options) {
267
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
268
+ requiredArgs(1, arguments);
269
+ var defaultOptions = getDefaultOptions();
270
+ 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);
271
+ var year = getUTCWeekYear(dirtyDate, options);
272
+ var firstWeek = new Date(0);
273
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
274
+ firstWeek.setUTCHours(0, 0, 0, 0);
275
+ var date = startOfUTCWeek(firstWeek, options);
276
+ return date;
277
+ }
278
+
279
+ var MILLISECONDS_IN_WEEK = 604800000;
280
+ function getUTCWeek(dirtyDate, options) {
281
+ requiredArgs(1, arguments);
282
+ var date = toDate(dirtyDate);
283
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
284
+
285
+ // Round the number of days to the nearest integer
286
+ // because the number of milliseconds in a week is not constant
287
+ // (e.g. it's different in the week of the daylight saving time clock shift)
288
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
289
+ }
290
+
291
+ function addLeadingZeros(number, targetLength) {
292
+ var sign = number < 0 ? '-' : '';
293
+ var output = Math.abs(number).toString();
294
+ while (output.length < targetLength) {
295
+ output = '0' + output;
296
+ }
297
+ return sign + output;
298
+ }
299
+
300
+ /*
301
+ * | | Unit | | Unit |
302
+ * |-----|--------------------------------|-----|--------------------------------|
303
+ * | a | AM, PM | A* | |
304
+ * | d | Day of month | D | |
305
+ * | h | Hour [1-12] | H | Hour [0-23] |
306
+ * | m | Minute | M | Month |
307
+ * | s | Second | S | Fraction of second |
308
+ * | y | Year (abs) | Y | |
309
+ *
310
+ * Letters marked by * are not implemented but reserved by Unicode standard.
311
+ */
312
+ var formatters$2 = {
313
+ // Year
314
+ y: function y(date, token) {
315
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
316
+ // | Year | y | yy | yyy | yyyy | yyyyy |
317
+ // |----------|-------|----|-------|-------|-------|
318
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
319
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
320
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
321
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
322
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
323
+
324
+ var signedYear = date.getUTCFullYear();
325
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
326
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
327
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
328
+ },
329
+ // Month
330
+ M: function M(date, token) {
331
+ var month = date.getUTCMonth();
332
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
333
+ },
334
+ // Day of the month
335
+ d: function d(date, token) {
336
+ return addLeadingZeros(date.getUTCDate(), token.length);
337
+ },
338
+ // AM or PM
339
+ a: function a(date, token) {
340
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
341
+ switch (token) {
342
+ case 'a':
343
+ case 'aa':
344
+ return dayPeriodEnumValue.toUpperCase();
345
+ case 'aaa':
346
+ return dayPeriodEnumValue;
347
+ case 'aaaaa':
348
+ return dayPeriodEnumValue[0];
349
+ case 'aaaa':
350
+ default:
351
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
352
+ }
353
+ },
354
+ // Hour [1-12]
355
+ h: function h(date, token) {
356
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
357
+ },
358
+ // Hour [0-23]
359
+ H: function H(date, token) {
360
+ return addLeadingZeros(date.getUTCHours(), token.length);
361
+ },
362
+ // Minute
363
+ m: function m(date, token) {
364
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
365
+ },
366
+ // Second
367
+ s: function s(date, token) {
368
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
369
+ },
370
+ // Fraction of second
371
+ S: function S(date, token) {
372
+ var numberOfDigits = token.length;
373
+ var milliseconds = date.getUTCMilliseconds();
374
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
375
+ return addLeadingZeros(fractionalSeconds, token.length);
376
+ }
377
+ };
378
+ const formatters$3 = formatters$2;
379
+
380
+ var dayPeriodEnum = {
381
+ am: 'am',
382
+ pm: 'pm',
383
+ midnight: 'midnight',
384
+ noon: 'noon',
385
+ morning: 'morning',
386
+ afternoon: 'afternoon',
387
+ evening: 'evening',
388
+ night: 'night'
389
+ };
390
+ /*
391
+ * | | Unit | | Unit |
392
+ * |-----|--------------------------------|-----|--------------------------------|
393
+ * | a | AM, PM | A* | Milliseconds in day |
394
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
395
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
396
+ * | d | Day of month | D | Day of year |
397
+ * | e | Local day of week | E | Day of week |
398
+ * | f | | F* | Day of week in month |
399
+ * | g* | Modified Julian day | G | Era |
400
+ * | h | Hour [1-12] | H | Hour [0-23] |
401
+ * | i! | ISO day of week | I! | ISO week of year |
402
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
403
+ * | k | Hour [1-24] | K | Hour [0-11] |
404
+ * | l* | (deprecated) | L | Stand-alone month |
405
+ * | m | Minute | M | Month |
406
+ * | n | | N | |
407
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
408
+ * | p! | Long localized time | P! | Long localized date |
409
+ * | q | Stand-alone quarter | Q | Quarter |
410
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
411
+ * | s | Second | S | Fraction of second |
412
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
413
+ * | u | Extended year | U* | Cyclic year |
414
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
415
+ * | w | Local week of year | W* | Week of month |
416
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
417
+ * | y | Year (abs) | Y | Local week-numbering year |
418
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
419
+ *
420
+ * Letters marked by * are not implemented but reserved by Unicode standard.
421
+ *
422
+ * Letters marked by ! are non-standard, but implemented by date-fns:
423
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
424
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
425
+ * i.e. 7 for Sunday, 1 for Monday, etc.
426
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
427
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
428
+ * `R` is supposed to be used in conjunction with `I` and `i`
429
+ * for universal ISO week-numbering date, whereas
430
+ * `Y` is supposed to be used in conjunction with `w` and `e`
431
+ * for week-numbering date specific to the locale.
432
+ * - `P` is long localized date format
433
+ * - `p` is long localized time format
434
+ */
435
+
436
+ var formatters = {
437
+ // Era
438
+ G: function G(date, token, localize) {
439
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
440
+ switch (token) {
441
+ // AD, BC
442
+ case 'G':
443
+ case 'GG':
444
+ case 'GGG':
445
+ return localize.era(era, {
446
+ width: 'abbreviated'
447
+ });
448
+ // A, B
449
+ case 'GGGGG':
450
+ return localize.era(era, {
451
+ width: 'narrow'
452
+ });
453
+ // Anno Domini, Before Christ
454
+ case 'GGGG':
455
+ default:
456
+ return localize.era(era, {
457
+ width: 'wide'
458
+ });
459
+ }
460
+ },
461
+ // Year
462
+ y: function y(date, token, localize) {
463
+ // Ordinal number
464
+ if (token === 'yo') {
465
+ var signedYear = date.getUTCFullYear();
466
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
467
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
468
+ return localize.ordinalNumber(year, {
469
+ unit: 'year'
470
+ });
471
+ }
472
+ return formatters$3.y(date, token);
473
+ },
474
+ // Local week-numbering year
475
+ Y: function Y(date, token, localize, options) {
476
+ var signedWeekYear = getUTCWeekYear(date, options);
477
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
478
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
479
+
480
+ // Two digit year
481
+ if (token === 'YY') {
482
+ var twoDigitYear = weekYear % 100;
483
+ return addLeadingZeros(twoDigitYear, 2);
484
+ }
485
+
486
+ // Ordinal number
487
+ if (token === 'Yo') {
488
+ return localize.ordinalNumber(weekYear, {
489
+ unit: 'year'
490
+ });
491
+ }
492
+
493
+ // Padding
494
+ return addLeadingZeros(weekYear, token.length);
495
+ },
496
+ // ISO week-numbering year
497
+ R: function R(date, token) {
498
+ var isoWeekYear = getUTCISOWeekYear(date);
499
+
500
+ // Padding
501
+ return addLeadingZeros(isoWeekYear, token.length);
502
+ },
503
+ // Extended year. This is a single number designating the year of this calendar system.
504
+ // The main difference between `y` and `u` localizers are B.C. years:
505
+ // | Year | `y` | `u` |
506
+ // |------|-----|-----|
507
+ // | AC 1 | 1 | 1 |
508
+ // | BC 1 | 1 | 0 |
509
+ // | BC 2 | 2 | -1 |
510
+ // Also `yy` always returns the last two digits of a year,
511
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
512
+ u: function u(date, token) {
513
+ var year = date.getUTCFullYear();
514
+ return addLeadingZeros(year, token.length);
515
+ },
516
+ // Quarter
517
+ Q: function Q(date, token, localize) {
518
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
519
+ switch (token) {
520
+ // 1, 2, 3, 4
521
+ case 'Q':
522
+ return String(quarter);
523
+ // 01, 02, 03, 04
524
+ case 'QQ':
525
+ return addLeadingZeros(quarter, 2);
526
+ // 1st, 2nd, 3rd, 4th
527
+ case 'Qo':
528
+ return localize.ordinalNumber(quarter, {
529
+ unit: 'quarter'
530
+ });
531
+ // Q1, Q2, Q3, Q4
532
+ case 'QQQ':
533
+ return localize.quarter(quarter, {
534
+ width: 'abbreviated',
535
+ context: 'formatting'
536
+ });
537
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
538
+ case 'QQQQQ':
539
+ return localize.quarter(quarter, {
540
+ width: 'narrow',
541
+ context: 'formatting'
542
+ });
543
+ // 1st quarter, 2nd quarter, ...
544
+ case 'QQQQ':
545
+ default:
546
+ return localize.quarter(quarter, {
547
+ width: 'wide',
548
+ context: 'formatting'
549
+ });
550
+ }
551
+ },
552
+ // Stand-alone quarter
553
+ q: function q(date, token, localize) {
554
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
555
+ switch (token) {
556
+ // 1, 2, 3, 4
557
+ case 'q':
558
+ return String(quarter);
559
+ // 01, 02, 03, 04
560
+ case 'qq':
561
+ return addLeadingZeros(quarter, 2);
562
+ // 1st, 2nd, 3rd, 4th
563
+ case 'qo':
564
+ return localize.ordinalNumber(quarter, {
565
+ unit: 'quarter'
566
+ });
567
+ // Q1, Q2, Q3, Q4
568
+ case 'qqq':
569
+ return localize.quarter(quarter, {
570
+ width: 'abbreviated',
571
+ context: 'standalone'
572
+ });
573
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
574
+ case 'qqqqq':
575
+ return localize.quarter(quarter, {
576
+ width: 'narrow',
577
+ context: 'standalone'
578
+ });
579
+ // 1st quarter, 2nd quarter, ...
580
+ case 'qqqq':
581
+ default:
582
+ return localize.quarter(quarter, {
583
+ width: 'wide',
584
+ context: 'standalone'
585
+ });
586
+ }
587
+ },
588
+ // Month
589
+ M: function M(date, token, localize) {
590
+ var month = date.getUTCMonth();
591
+ switch (token) {
592
+ case 'M':
593
+ case 'MM':
594
+ return formatters$3.M(date, token);
595
+ // 1st, 2nd, ..., 12th
596
+ case 'Mo':
597
+ return localize.ordinalNumber(month + 1, {
598
+ unit: 'month'
599
+ });
600
+ // Jan, Feb, ..., Dec
601
+ case 'MMM':
602
+ return localize.month(month, {
603
+ width: 'abbreviated',
604
+ context: 'formatting'
605
+ });
606
+ // J, F, ..., D
607
+ case 'MMMMM':
608
+ return localize.month(month, {
609
+ width: 'narrow',
610
+ context: 'formatting'
611
+ });
612
+ // January, February, ..., December
613
+ case 'MMMM':
614
+ default:
615
+ return localize.month(month, {
616
+ width: 'wide',
617
+ context: 'formatting'
618
+ });
619
+ }
620
+ },
621
+ // Stand-alone month
622
+ L: function L(date, token, localize) {
623
+ var month = date.getUTCMonth();
624
+ switch (token) {
625
+ // 1, 2, ..., 12
626
+ case 'L':
627
+ return String(month + 1);
628
+ // 01, 02, ..., 12
629
+ case 'LL':
630
+ return addLeadingZeros(month + 1, 2);
631
+ // 1st, 2nd, ..., 12th
632
+ case 'Lo':
633
+ return localize.ordinalNumber(month + 1, {
634
+ unit: 'month'
635
+ });
636
+ // Jan, Feb, ..., Dec
637
+ case 'LLL':
638
+ return localize.month(month, {
639
+ width: 'abbreviated',
640
+ context: 'standalone'
641
+ });
642
+ // J, F, ..., D
643
+ case 'LLLLL':
644
+ return localize.month(month, {
645
+ width: 'narrow',
646
+ context: 'standalone'
647
+ });
648
+ // January, February, ..., December
649
+ case 'LLLL':
650
+ default:
651
+ return localize.month(month, {
652
+ width: 'wide',
653
+ context: 'standalone'
654
+ });
655
+ }
656
+ },
657
+ // Local week of year
658
+ w: function w(date, token, localize, options) {
659
+ var week = getUTCWeek(date, options);
660
+ if (token === 'wo') {
661
+ return localize.ordinalNumber(week, {
662
+ unit: 'week'
663
+ });
664
+ }
665
+ return addLeadingZeros(week, token.length);
666
+ },
667
+ // ISO week of year
668
+ I: function I(date, token, localize) {
669
+ var isoWeek = getUTCISOWeek(date);
670
+ if (token === 'Io') {
671
+ return localize.ordinalNumber(isoWeek, {
672
+ unit: 'week'
673
+ });
674
+ }
675
+ return addLeadingZeros(isoWeek, token.length);
676
+ },
677
+ // Day of the month
678
+ d: function d(date, token, localize) {
679
+ if (token === 'do') {
680
+ return localize.ordinalNumber(date.getUTCDate(), {
681
+ unit: 'date'
682
+ });
683
+ }
684
+ return formatters$3.d(date, token);
685
+ },
686
+ // Day of year
687
+ D: function D(date, token, localize) {
688
+ var dayOfYear = getUTCDayOfYear(date);
689
+ if (token === 'Do') {
690
+ return localize.ordinalNumber(dayOfYear, {
691
+ unit: 'dayOfYear'
692
+ });
693
+ }
694
+ return addLeadingZeros(dayOfYear, token.length);
695
+ },
696
+ // Day of week
697
+ E: function E(date, token, localize) {
698
+ var dayOfWeek = date.getUTCDay();
699
+ switch (token) {
700
+ // Tue
701
+ case 'E':
702
+ case 'EE':
703
+ case 'EEE':
704
+ return localize.day(dayOfWeek, {
705
+ width: 'abbreviated',
706
+ context: 'formatting'
707
+ });
708
+ // T
709
+ case 'EEEEE':
710
+ return localize.day(dayOfWeek, {
711
+ width: 'narrow',
712
+ context: 'formatting'
713
+ });
714
+ // Tu
715
+ case 'EEEEEE':
716
+ return localize.day(dayOfWeek, {
717
+ width: 'short',
718
+ context: 'formatting'
719
+ });
720
+ // Tuesday
721
+ case 'EEEE':
722
+ default:
723
+ return localize.day(dayOfWeek, {
724
+ width: 'wide',
725
+ context: 'formatting'
726
+ });
727
+ }
728
+ },
729
+ // Local day of week
730
+ e: function e(date, token, localize, options) {
731
+ var dayOfWeek = date.getUTCDay();
732
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
733
+ switch (token) {
734
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
735
+ case 'e':
736
+ return String(localDayOfWeek);
737
+ // Padded numerical value
738
+ case 'ee':
739
+ return addLeadingZeros(localDayOfWeek, 2);
740
+ // 1st, 2nd, ..., 7th
741
+ case 'eo':
742
+ return localize.ordinalNumber(localDayOfWeek, {
743
+ unit: 'day'
744
+ });
745
+ case 'eee':
746
+ return localize.day(dayOfWeek, {
747
+ width: 'abbreviated',
748
+ context: 'formatting'
749
+ });
750
+ // T
751
+ case 'eeeee':
752
+ return localize.day(dayOfWeek, {
753
+ width: 'narrow',
754
+ context: 'formatting'
755
+ });
756
+ // Tu
757
+ case 'eeeeee':
758
+ return localize.day(dayOfWeek, {
759
+ width: 'short',
760
+ context: 'formatting'
761
+ });
762
+ // Tuesday
763
+ case 'eeee':
764
+ default:
765
+ return localize.day(dayOfWeek, {
766
+ width: 'wide',
767
+ context: 'formatting'
768
+ });
769
+ }
770
+ },
771
+ // Stand-alone local day of week
772
+ c: function c(date, token, localize, options) {
773
+ var dayOfWeek = date.getUTCDay();
774
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
775
+ switch (token) {
776
+ // Numerical value (same as in `e`)
777
+ case 'c':
778
+ return String(localDayOfWeek);
779
+ // Padded numerical value
780
+ case 'cc':
781
+ return addLeadingZeros(localDayOfWeek, token.length);
782
+ // 1st, 2nd, ..., 7th
783
+ case 'co':
784
+ return localize.ordinalNumber(localDayOfWeek, {
785
+ unit: 'day'
786
+ });
787
+ case 'ccc':
788
+ return localize.day(dayOfWeek, {
789
+ width: 'abbreviated',
790
+ context: 'standalone'
791
+ });
792
+ // T
793
+ case 'ccccc':
794
+ return localize.day(dayOfWeek, {
795
+ width: 'narrow',
796
+ context: 'standalone'
797
+ });
798
+ // Tu
799
+ case 'cccccc':
800
+ return localize.day(dayOfWeek, {
801
+ width: 'short',
802
+ context: 'standalone'
803
+ });
804
+ // Tuesday
805
+ case 'cccc':
806
+ default:
807
+ return localize.day(dayOfWeek, {
808
+ width: 'wide',
809
+ context: 'standalone'
810
+ });
811
+ }
812
+ },
813
+ // ISO day of week
814
+ i: function i(date, token, localize) {
815
+ var dayOfWeek = date.getUTCDay();
816
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
817
+ switch (token) {
818
+ // 2
819
+ case 'i':
820
+ return String(isoDayOfWeek);
821
+ // 02
822
+ case 'ii':
823
+ return addLeadingZeros(isoDayOfWeek, token.length);
824
+ // 2nd
825
+ case 'io':
826
+ return localize.ordinalNumber(isoDayOfWeek, {
827
+ unit: 'day'
828
+ });
829
+ // Tue
830
+ case 'iii':
831
+ return localize.day(dayOfWeek, {
832
+ width: 'abbreviated',
833
+ context: 'formatting'
834
+ });
835
+ // T
836
+ case 'iiiii':
837
+ return localize.day(dayOfWeek, {
838
+ width: 'narrow',
839
+ context: 'formatting'
840
+ });
841
+ // Tu
842
+ case 'iiiiii':
843
+ return localize.day(dayOfWeek, {
844
+ width: 'short',
845
+ context: 'formatting'
846
+ });
847
+ // Tuesday
848
+ case 'iiii':
849
+ default:
850
+ return localize.day(dayOfWeek, {
851
+ width: 'wide',
852
+ context: 'formatting'
853
+ });
854
+ }
855
+ },
856
+ // AM or PM
857
+ a: function a(date, token, localize) {
858
+ var hours = date.getUTCHours();
859
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
860
+ switch (token) {
861
+ case 'a':
862
+ case 'aa':
863
+ return localize.dayPeriod(dayPeriodEnumValue, {
864
+ width: 'abbreviated',
865
+ context: 'formatting'
866
+ });
867
+ case 'aaa':
868
+ return localize.dayPeriod(dayPeriodEnumValue, {
869
+ width: 'abbreviated',
870
+ context: 'formatting'
871
+ }).toLowerCase();
872
+ case 'aaaaa':
873
+ return localize.dayPeriod(dayPeriodEnumValue, {
874
+ width: 'narrow',
875
+ context: 'formatting'
876
+ });
877
+ case 'aaaa':
878
+ default:
879
+ return localize.dayPeriod(dayPeriodEnumValue, {
880
+ width: 'wide',
881
+ context: 'formatting'
882
+ });
883
+ }
884
+ },
885
+ // AM, PM, midnight, noon
886
+ b: function b(date, token, localize) {
887
+ var hours = date.getUTCHours();
888
+ var dayPeriodEnumValue;
889
+ if (hours === 12) {
890
+ dayPeriodEnumValue = dayPeriodEnum.noon;
891
+ } else if (hours === 0) {
892
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
893
+ } else {
894
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
895
+ }
896
+ switch (token) {
897
+ case 'b':
898
+ case 'bb':
899
+ return localize.dayPeriod(dayPeriodEnumValue, {
900
+ width: 'abbreviated',
901
+ context: 'formatting'
902
+ });
903
+ case 'bbb':
904
+ return localize.dayPeriod(dayPeriodEnumValue, {
905
+ width: 'abbreviated',
906
+ context: 'formatting'
907
+ }).toLowerCase();
908
+ case 'bbbbb':
909
+ return localize.dayPeriod(dayPeriodEnumValue, {
910
+ width: 'narrow',
911
+ context: 'formatting'
912
+ });
913
+ case 'bbbb':
914
+ default:
915
+ return localize.dayPeriod(dayPeriodEnumValue, {
916
+ width: 'wide',
917
+ context: 'formatting'
918
+ });
919
+ }
920
+ },
921
+ // in the morning, in the afternoon, in the evening, at night
922
+ B: function B(date, token, localize) {
923
+ var hours = date.getUTCHours();
924
+ var dayPeriodEnumValue;
925
+ if (hours >= 17) {
926
+ dayPeriodEnumValue = dayPeriodEnum.evening;
927
+ } else if (hours >= 12) {
928
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
929
+ } else if (hours >= 4) {
930
+ dayPeriodEnumValue = dayPeriodEnum.morning;
931
+ } else {
932
+ dayPeriodEnumValue = dayPeriodEnum.night;
933
+ }
934
+ switch (token) {
935
+ case 'B':
936
+ case 'BB':
937
+ case 'BBB':
938
+ return localize.dayPeriod(dayPeriodEnumValue, {
939
+ width: 'abbreviated',
940
+ context: 'formatting'
941
+ });
942
+ case 'BBBBB':
943
+ return localize.dayPeriod(dayPeriodEnumValue, {
944
+ width: 'narrow',
945
+ context: 'formatting'
946
+ });
947
+ case 'BBBB':
948
+ default:
949
+ return localize.dayPeriod(dayPeriodEnumValue, {
950
+ width: 'wide',
951
+ context: 'formatting'
952
+ });
953
+ }
954
+ },
955
+ // Hour [1-12]
956
+ h: function h(date, token, localize) {
957
+ if (token === 'ho') {
958
+ var hours = date.getUTCHours() % 12;
959
+ if (hours === 0) hours = 12;
960
+ return localize.ordinalNumber(hours, {
961
+ unit: 'hour'
962
+ });
963
+ }
964
+ return formatters$3.h(date, token);
965
+ },
966
+ // Hour [0-23]
967
+ H: function H(date, token, localize) {
968
+ if (token === 'Ho') {
969
+ return localize.ordinalNumber(date.getUTCHours(), {
970
+ unit: 'hour'
971
+ });
972
+ }
973
+ return formatters$3.H(date, token);
974
+ },
975
+ // Hour [0-11]
976
+ K: function K(date, token, localize) {
977
+ var hours = date.getUTCHours() % 12;
978
+ if (token === 'Ko') {
979
+ return localize.ordinalNumber(hours, {
980
+ unit: 'hour'
981
+ });
982
+ }
983
+ return addLeadingZeros(hours, token.length);
984
+ },
985
+ // Hour [1-24]
986
+ k: function k(date, token, localize) {
987
+ var hours = date.getUTCHours();
988
+ if (hours === 0) hours = 24;
989
+ if (token === 'ko') {
990
+ return localize.ordinalNumber(hours, {
991
+ unit: 'hour'
992
+ });
993
+ }
994
+ return addLeadingZeros(hours, token.length);
995
+ },
996
+ // Minute
997
+ m: function m(date, token, localize) {
998
+ if (token === 'mo') {
999
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1000
+ unit: 'minute'
1001
+ });
1002
+ }
1003
+ return formatters$3.m(date, token);
1004
+ },
1005
+ // Second
1006
+ s: function s(date, token, localize) {
1007
+ if (token === 'so') {
1008
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1009
+ unit: 'second'
1010
+ });
1011
+ }
1012
+ return formatters$3.s(date, token);
1013
+ },
1014
+ // Fraction of second
1015
+ S: function S(date, token) {
1016
+ return formatters$3.S(date, token);
1017
+ },
1018
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1019
+ X: function X(date, token, _localize, options) {
1020
+ var originalDate = options._originalDate || date;
1021
+ var timezoneOffset = originalDate.getTimezoneOffset();
1022
+ if (timezoneOffset === 0) {
1023
+ return 'Z';
1024
+ }
1025
+ switch (token) {
1026
+ // Hours and optional minutes
1027
+ case 'X':
1028
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1029
+
1030
+ // Hours, minutes and optional seconds without `:` delimiter
1031
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1032
+ // so this token always has the same output as `XX`
1033
+ case 'XXXX':
1034
+ case 'XX':
1035
+ // Hours and minutes without `:` delimiter
1036
+ return formatTimezone(timezoneOffset);
1037
+
1038
+ // Hours, minutes and optional seconds with `:` delimiter
1039
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1040
+ // so this token always has the same output as `XXX`
1041
+ case 'XXXXX':
1042
+ case 'XXX': // Hours and minutes with `:` delimiter
1043
+ default:
1044
+ return formatTimezone(timezoneOffset, ':');
1045
+ }
1046
+ },
1047
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1048
+ x: function x(date, token, _localize, options) {
1049
+ var originalDate = options._originalDate || date;
1050
+ var timezoneOffset = originalDate.getTimezoneOffset();
1051
+ switch (token) {
1052
+ // Hours and optional minutes
1053
+ case 'x':
1054
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1055
+
1056
+ // Hours, minutes and optional seconds without `:` delimiter
1057
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1058
+ // so this token always has the same output as `xx`
1059
+ case 'xxxx':
1060
+ case 'xx':
1061
+ // Hours and minutes without `:` delimiter
1062
+ return formatTimezone(timezoneOffset);
1063
+
1064
+ // Hours, minutes and optional seconds with `:` delimiter
1065
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1066
+ // so this token always has the same output as `xxx`
1067
+ case 'xxxxx':
1068
+ case 'xxx': // Hours and minutes with `:` delimiter
1069
+ default:
1070
+ return formatTimezone(timezoneOffset, ':');
1071
+ }
1072
+ },
1073
+ // Timezone (GMT)
1074
+ O: function O(date, token, _localize, options) {
1075
+ var originalDate = options._originalDate || date;
1076
+ var timezoneOffset = originalDate.getTimezoneOffset();
1077
+ switch (token) {
1078
+ // Short
1079
+ case 'O':
1080
+ case 'OO':
1081
+ case 'OOO':
1082
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1083
+ // Long
1084
+ case 'OOOO':
1085
+ default:
1086
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1087
+ }
1088
+ },
1089
+ // Timezone (specific non-location)
1090
+ z: function z(date, token, _localize, options) {
1091
+ var originalDate = options._originalDate || date;
1092
+ var timezoneOffset = originalDate.getTimezoneOffset();
1093
+ switch (token) {
1094
+ // Short
1095
+ case 'z':
1096
+ case 'zz':
1097
+ case 'zzz':
1098
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1099
+ // Long
1100
+ case 'zzzz':
1101
+ default:
1102
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1103
+ }
1104
+ },
1105
+ // Seconds timestamp
1106
+ t: function t(date, token, _localize, options) {
1107
+ var originalDate = options._originalDate || date;
1108
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1109
+ return addLeadingZeros(timestamp, token.length);
1110
+ },
1111
+ // Milliseconds timestamp
1112
+ T: function T(date, token, _localize, options) {
1113
+ var originalDate = options._originalDate || date;
1114
+ var timestamp = originalDate.getTime();
1115
+ return addLeadingZeros(timestamp, token.length);
1116
+ }
1117
+ };
1118
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1119
+ var sign = offset > 0 ? '-' : '+';
1120
+ var absOffset = Math.abs(offset);
1121
+ var hours = Math.floor(absOffset / 60);
1122
+ var minutes = absOffset % 60;
1123
+ if (minutes === 0) {
1124
+ return sign + String(hours);
1125
+ }
1126
+ var delimiter = dirtyDelimiter || '';
1127
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1128
+ }
1129
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1130
+ if (offset % 60 === 0) {
1131
+ var sign = offset > 0 ? '-' : '+';
1132
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1133
+ }
1134
+ return formatTimezone(offset, dirtyDelimiter);
1135
+ }
1136
+ function formatTimezone(offset, dirtyDelimiter) {
1137
+ var delimiter = dirtyDelimiter || '';
1138
+ var sign = offset > 0 ? '-' : '+';
1139
+ var absOffset = Math.abs(offset);
1140
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1141
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1142
+ return sign + hours + delimiter + minutes;
1143
+ }
1144
+ const formatters$1 = formatters;
1145
+
1146
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1147
+ switch (pattern) {
1148
+ case 'P':
1149
+ return formatLong.date({
1150
+ width: 'short'
1151
+ });
1152
+ case 'PP':
1153
+ return formatLong.date({
1154
+ width: 'medium'
1155
+ });
1156
+ case 'PPP':
1157
+ return formatLong.date({
1158
+ width: 'long'
1159
+ });
1160
+ case 'PPPP':
1161
+ default:
1162
+ return formatLong.date({
1163
+ width: 'full'
1164
+ });
1165
+ }
1166
+ };
1167
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1168
+ switch (pattern) {
1169
+ case 'p':
1170
+ return formatLong.time({
1171
+ width: 'short'
1172
+ });
1173
+ case 'pp':
1174
+ return formatLong.time({
1175
+ width: 'medium'
1176
+ });
1177
+ case 'ppp':
1178
+ return formatLong.time({
1179
+ width: 'long'
1180
+ });
1181
+ case 'pppp':
1182
+ default:
1183
+ return formatLong.time({
1184
+ width: 'full'
1185
+ });
1186
+ }
1187
+ };
1188
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1189
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1190
+ var datePattern = matchResult[1];
1191
+ var timePattern = matchResult[2];
1192
+ if (!timePattern) {
1193
+ return dateLongFormatter(pattern, formatLong);
1194
+ }
1195
+ var dateTimeFormat;
1196
+ switch (datePattern) {
1197
+ case 'P':
1198
+ dateTimeFormat = formatLong.dateTime({
1199
+ width: 'short'
1200
+ });
1201
+ break;
1202
+ case 'PP':
1203
+ dateTimeFormat = formatLong.dateTime({
1204
+ width: 'medium'
1205
+ });
1206
+ break;
1207
+ case 'PPP':
1208
+ dateTimeFormat = formatLong.dateTime({
1209
+ width: 'long'
1210
+ });
1211
+ break;
1212
+ case 'PPPP':
1213
+ default:
1214
+ dateTimeFormat = formatLong.dateTime({
1215
+ width: 'full'
1216
+ });
1217
+ break;
1218
+ }
1219
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1220
+ };
1221
+ var longFormatters = {
1222
+ p: timeLongFormatter,
1223
+ P: dateTimeLongFormatter
1224
+ };
1225
+ const longFormatters$1 = longFormatters;
1226
+
1227
+ var protectedDayOfYearTokens = ['D', 'DD'];
1228
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1229
+ function isProtectedDayOfYearToken(token) {
1230
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1231
+ }
1232
+ function isProtectedWeekYearToken(token) {
1233
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1234
+ }
1235
+ function throwProtectedError(token, format, input) {
1236
+ if (token === 'YYYY') {
1237
+ 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"));
1238
+ } else if (token === 'YY') {
1239
+ 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"));
1240
+ } else if (token === 'D') {
1241
+ 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"));
1242
+ } else if (token === 'DD') {
1243
+ 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"));
1244
+ }
1245
+ }
1246
+
1247
+ var formatDistanceLocale = {
1248
+ lessThanXSeconds: {
1249
+ one: 'less than a second',
1250
+ other: 'less than {{count}} seconds'
1251
+ },
1252
+ xSeconds: {
1253
+ one: '1 second',
1254
+ other: '{{count}} seconds'
1255
+ },
1256
+ halfAMinute: 'half a minute',
1257
+ lessThanXMinutes: {
1258
+ one: 'less than a minute',
1259
+ other: 'less than {{count}} minutes'
1260
+ },
1261
+ xMinutes: {
1262
+ one: '1 minute',
1263
+ other: '{{count}} minutes'
1264
+ },
1265
+ aboutXHours: {
1266
+ one: 'about 1 hour',
1267
+ other: 'about {{count}} hours'
1268
+ },
1269
+ xHours: {
1270
+ one: '1 hour',
1271
+ other: '{{count}} hours'
1272
+ },
1273
+ xDays: {
1274
+ one: '1 day',
1275
+ other: '{{count}} days'
1276
+ },
1277
+ aboutXWeeks: {
1278
+ one: 'about 1 week',
1279
+ other: 'about {{count}} weeks'
1280
+ },
1281
+ xWeeks: {
1282
+ one: '1 week',
1283
+ other: '{{count}} weeks'
1284
+ },
1285
+ aboutXMonths: {
1286
+ one: 'about 1 month',
1287
+ other: 'about {{count}} months'
1288
+ },
1289
+ xMonths: {
1290
+ one: '1 month',
1291
+ other: '{{count}} months'
1292
+ },
1293
+ aboutXYears: {
1294
+ one: 'about 1 year',
1295
+ other: 'about {{count}} years'
1296
+ },
1297
+ xYears: {
1298
+ one: '1 year',
1299
+ other: '{{count}} years'
1300
+ },
1301
+ overXYears: {
1302
+ one: 'over 1 year',
1303
+ other: 'over {{count}} years'
1304
+ },
1305
+ almostXYears: {
1306
+ one: 'almost 1 year',
1307
+ other: 'almost {{count}} years'
1308
+ }
1309
+ };
1310
+ var formatDistance = function formatDistance(token, count, options) {
1311
+ var result;
1312
+ var tokenValue = formatDistanceLocale[token];
1313
+ if (typeof tokenValue === 'string') {
1314
+ result = tokenValue;
1315
+ } else if (count === 1) {
1316
+ result = tokenValue.one;
1317
+ } else {
1318
+ result = tokenValue.other.replace('{{count}}', count.toString());
1319
+ }
1320
+ if (options !== null && options !== void 0 && options.addSuffix) {
1321
+ if (options.comparison && options.comparison > 0) {
1322
+ return 'in ' + result;
1323
+ } else {
1324
+ return result + ' ago';
1325
+ }
1326
+ }
1327
+ return result;
1328
+ };
1329
+ const formatDistance$1 = formatDistance;
1330
+
1331
+ function buildFormatLongFn(args) {
1332
+ return function () {
1333
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1334
+ // TODO: Remove String()
1335
+ var width = options.width ? String(options.width) : args.defaultWidth;
1336
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1337
+ return format;
1338
+ };
1339
+ }
1340
+
1341
+ var dateFormats = {
1342
+ full: 'EEEE, MMMM do, y',
1343
+ long: 'MMMM do, y',
1344
+ medium: 'MMM d, y',
1345
+ short: 'MM/dd/yyyy'
1346
+ };
1347
+ var timeFormats = {
1348
+ full: 'h:mm:ss a zzzz',
1349
+ long: 'h:mm:ss a z',
1350
+ medium: 'h:mm:ss a',
1351
+ short: 'h:mm a'
1352
+ };
1353
+ var dateTimeFormats = {
1354
+ full: "{{date}} 'at' {{time}}",
1355
+ long: "{{date}} 'at' {{time}}",
1356
+ medium: '{{date}}, {{time}}',
1357
+ short: '{{date}}, {{time}}'
1358
+ };
1359
+ var formatLong = {
1360
+ date: buildFormatLongFn({
1361
+ formats: dateFormats,
1362
+ defaultWidth: 'full'
1363
+ }),
1364
+ time: buildFormatLongFn({
1365
+ formats: timeFormats,
1366
+ defaultWidth: 'full'
1367
+ }),
1368
+ dateTime: buildFormatLongFn({
1369
+ formats: dateTimeFormats,
1370
+ defaultWidth: 'full'
1371
+ })
1372
+ };
1373
+ const formatLong$1 = formatLong;
1374
+
1375
+ var formatRelativeLocale = {
1376
+ lastWeek: "'last' eeee 'at' p",
1377
+ yesterday: "'yesterday at' p",
1378
+ today: "'today at' p",
1379
+ tomorrow: "'tomorrow at' p",
1380
+ nextWeek: "eeee 'at' p",
1381
+ other: 'P'
1382
+ };
1383
+ var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1384
+ return formatRelativeLocale[token];
1385
+ };
1386
+ const formatRelative$1 = formatRelative;
1387
+
1388
+ function buildLocalizeFn(args) {
1389
+ return function (dirtyIndex, options) {
1390
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1391
+ var valuesArray;
1392
+ if (context === 'formatting' && args.formattingValues) {
1393
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1394
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1395
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1396
+ } else {
1397
+ var _defaultWidth = args.defaultWidth;
1398
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1399
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1400
+ }
1401
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1402
+ // @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!
1403
+ return valuesArray[index];
1404
+ };
1405
+ }
1406
+
1407
+ var eraValues = {
1408
+ narrow: ['B', 'A'],
1409
+ abbreviated: ['BC', 'AD'],
1410
+ wide: ['Before Christ', 'Anno Domini']
1411
+ };
1412
+ var quarterValues = {
1413
+ narrow: ['1', '2', '3', '4'],
1414
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1415
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1416
+ };
1417
+
1418
+ // Note: in English, the names of days of the week and months are capitalized.
1419
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1420
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1421
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1422
+ var monthValues = {
1423
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1424
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1425
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1426
+ };
1427
+ var dayValues = {
1428
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1429
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1430
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1431
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1432
+ };
1433
+ var dayPeriodValues = {
1434
+ narrow: {
1435
+ am: 'a',
1436
+ pm: 'p',
1437
+ midnight: 'mi',
1438
+ noon: 'n',
1439
+ morning: 'morning',
1440
+ afternoon: 'afternoon',
1441
+ evening: 'evening',
1442
+ night: 'night'
1443
+ },
1444
+ abbreviated: {
1445
+ am: 'AM',
1446
+ pm: 'PM',
1447
+ midnight: 'midnight',
1448
+ noon: 'noon',
1449
+ morning: 'morning',
1450
+ afternoon: 'afternoon',
1451
+ evening: 'evening',
1452
+ night: 'night'
1453
+ },
1454
+ wide: {
1455
+ am: 'a.m.',
1456
+ pm: 'p.m.',
1457
+ midnight: 'midnight',
1458
+ noon: 'noon',
1459
+ morning: 'morning',
1460
+ afternoon: 'afternoon',
1461
+ evening: 'evening',
1462
+ night: 'night'
1463
+ }
1464
+ };
1465
+ var formattingDayPeriodValues = {
1466
+ narrow: {
1467
+ am: 'a',
1468
+ pm: 'p',
1469
+ midnight: 'mi',
1470
+ noon: 'n',
1471
+ morning: 'in the morning',
1472
+ afternoon: 'in the afternoon',
1473
+ evening: 'in the evening',
1474
+ night: 'at night'
1475
+ },
1476
+ abbreviated: {
1477
+ am: 'AM',
1478
+ pm: 'PM',
1479
+ midnight: 'midnight',
1480
+ noon: 'noon',
1481
+ morning: 'in the morning',
1482
+ afternoon: 'in the afternoon',
1483
+ evening: 'in the evening',
1484
+ night: 'at night'
1485
+ },
1486
+ wide: {
1487
+ am: 'a.m.',
1488
+ pm: 'p.m.',
1489
+ midnight: 'midnight',
1490
+ noon: 'noon',
1491
+ morning: 'in the morning',
1492
+ afternoon: 'in the afternoon',
1493
+ evening: 'in the evening',
1494
+ night: 'at night'
1495
+ }
1496
+ };
1497
+ var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1498
+ var number = Number(dirtyNumber);
1499
+
1500
+ // If ordinal numbers depend on context, for example,
1501
+ // if they are different for different grammatical genders,
1502
+ // use `options.unit`.
1503
+ //
1504
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1505
+ // 'day', 'hour', 'minute', 'second'.
1506
+
1507
+ var rem100 = number % 100;
1508
+ if (rem100 > 20 || rem100 < 10) {
1509
+ switch (rem100 % 10) {
1510
+ case 1:
1511
+ return number + 'st';
1512
+ case 2:
1513
+ return number + 'nd';
1514
+ case 3:
1515
+ return number + 'rd';
1516
+ }
1517
+ }
1518
+ return number + 'th';
1519
+ };
1520
+ var localize = {
1521
+ ordinalNumber: ordinalNumber,
1522
+ era: buildLocalizeFn({
1523
+ values: eraValues,
1524
+ defaultWidth: 'wide'
1525
+ }),
1526
+ quarter: buildLocalizeFn({
1527
+ values: quarterValues,
1528
+ defaultWidth: 'wide',
1529
+ argumentCallback: function argumentCallback(quarter) {
1530
+ return quarter - 1;
1531
+ }
1532
+ }),
1533
+ month: buildLocalizeFn({
1534
+ values: monthValues,
1535
+ defaultWidth: 'wide'
1536
+ }),
1537
+ day: buildLocalizeFn({
1538
+ values: dayValues,
1539
+ defaultWidth: 'wide'
1540
+ }),
1541
+ dayPeriod: buildLocalizeFn({
1542
+ values: dayPeriodValues,
1543
+ defaultWidth: 'wide',
1544
+ formattingValues: formattingDayPeriodValues,
1545
+ defaultFormattingWidth: 'wide'
1546
+ })
1547
+ };
1548
+ const localize$1 = localize;
1549
+
1550
+ function buildMatchFn(args) {
1551
+ return function (string) {
1552
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1553
+ var width = options.width;
1554
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1555
+ var matchResult = string.match(matchPattern);
1556
+ if (!matchResult) {
1557
+ return null;
1558
+ }
1559
+ var matchedString = matchResult[0];
1560
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1561
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1562
+ return pattern.test(matchedString);
1563
+ }) : findKey(parsePatterns, function (pattern) {
1564
+ return pattern.test(matchedString);
1565
+ });
1566
+ var value;
1567
+ value = args.valueCallback ? args.valueCallback(key) : key;
1568
+ value = options.valueCallback ? options.valueCallback(value) : value;
1569
+ var rest = string.slice(matchedString.length);
1570
+ return {
1571
+ value: value,
1572
+ rest: rest
1573
+ };
1574
+ };
1575
+ }
1576
+ function findKey(object, predicate) {
1577
+ for (var key in object) {
1578
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
1579
+ return key;
1580
+ }
1581
+ }
1582
+ return undefined;
1583
+ }
1584
+ function findIndex(array, predicate) {
1585
+ for (var key = 0; key < array.length; key++) {
1586
+ if (predicate(array[key])) {
1587
+ return key;
1588
+ }
1589
+ }
1590
+ return undefined;
1591
+ }
1592
+
1593
+ function buildMatchPatternFn(args) {
1594
+ return function (string) {
1595
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1596
+ var matchResult = string.match(args.matchPattern);
1597
+ if (!matchResult) return null;
1598
+ var matchedString = matchResult[0];
1599
+ var parseResult = string.match(args.parsePattern);
1600
+ if (!parseResult) return null;
1601
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1602
+ value = options.valueCallback ? options.valueCallback(value) : value;
1603
+ var rest = string.slice(matchedString.length);
1604
+ return {
1605
+ value: value,
1606
+ rest: rest
1607
+ };
1608
+ };
1609
+ }
1610
+
1611
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1612
+ var parseOrdinalNumberPattern = /\d+/i;
1613
+ var matchEraPatterns = {
1614
+ narrow: /^(b|a)/i,
1615
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1616
+ wide: /^(before christ|before common era|anno domini|common era)/i
1617
+ };
1618
+ var parseEraPatterns = {
1619
+ any: [/^b/i, /^(a|c)/i]
1620
+ };
1621
+ var matchQuarterPatterns = {
1622
+ narrow: /^[1234]/i,
1623
+ abbreviated: /^q[1234]/i,
1624
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1625
+ };
1626
+ var parseQuarterPatterns = {
1627
+ any: [/1/i, /2/i, /3/i, /4/i]
1628
+ };
1629
+ var matchMonthPatterns = {
1630
+ narrow: /^[jfmasond]/i,
1631
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1632
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1633
+ };
1634
+ var parseMonthPatterns = {
1635
+ 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],
1636
+ 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]
1637
+ };
1638
+ var matchDayPatterns = {
1639
+ narrow: /^[smtwf]/i,
1640
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1641
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1642
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1643
+ };
1644
+ var parseDayPatterns = {
1645
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1646
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1647
+ };
1648
+ var matchDayPeriodPatterns = {
1649
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1650
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1651
+ };
1652
+ var parseDayPeriodPatterns = {
1653
+ any: {
1654
+ am: /^a/i,
1655
+ pm: /^p/i,
1656
+ midnight: /^mi/i,
1657
+ noon: /^no/i,
1658
+ morning: /morning/i,
1659
+ afternoon: /afternoon/i,
1660
+ evening: /evening/i,
1661
+ night: /night/i
1662
+ }
1663
+ };
1664
+ var match = {
1665
+ ordinalNumber: buildMatchPatternFn({
1666
+ matchPattern: matchOrdinalNumberPattern,
1667
+ parsePattern: parseOrdinalNumberPattern,
1668
+ valueCallback: function valueCallback(value) {
1669
+ return parseInt(value, 10);
1670
+ }
1671
+ }),
1672
+ era: buildMatchFn({
1673
+ matchPatterns: matchEraPatterns,
1674
+ defaultMatchWidth: 'wide',
1675
+ parsePatterns: parseEraPatterns,
1676
+ defaultParseWidth: 'any'
1677
+ }),
1678
+ quarter: buildMatchFn({
1679
+ matchPatterns: matchQuarterPatterns,
1680
+ defaultMatchWidth: 'wide',
1681
+ parsePatterns: parseQuarterPatterns,
1682
+ defaultParseWidth: 'any',
1683
+ valueCallback: function valueCallback(index) {
1684
+ return index + 1;
1685
+ }
1686
+ }),
1687
+ month: buildMatchFn({
1688
+ matchPatterns: matchMonthPatterns,
1689
+ defaultMatchWidth: 'wide',
1690
+ parsePatterns: parseMonthPatterns,
1691
+ defaultParseWidth: 'any'
1692
+ }),
1693
+ day: buildMatchFn({
1694
+ matchPatterns: matchDayPatterns,
1695
+ defaultMatchWidth: 'wide',
1696
+ parsePatterns: parseDayPatterns,
1697
+ defaultParseWidth: 'any'
1698
+ }),
1699
+ dayPeriod: buildMatchFn({
1700
+ matchPatterns: matchDayPeriodPatterns,
1701
+ defaultMatchWidth: 'any',
1702
+ parsePatterns: parseDayPeriodPatterns,
1703
+ defaultParseWidth: 'any'
1704
+ })
1705
+ };
1706
+ const match$1 = match;
1707
+
1708
+ /**
1709
+ * @type {Locale}
1710
+ * @category Locales
1711
+ * @summary English locale (United States).
1712
+ * @language English
1713
+ * @iso-639-2 eng
1714
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
1715
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
1716
+ */
1717
+ var locale = {
1718
+ code: 'en-US',
1719
+ formatDistance: formatDistance$1,
1720
+ formatLong: formatLong$1,
1721
+ formatRelative: formatRelative$1,
1722
+ localize: localize$1,
1723
+ match: match$1,
1724
+ options: {
1725
+ weekStartsOn: 0 /* Sunday */,
1726
+ firstWeekContainsDate: 1
1727
+ }
1728
+ };
1729
+ const defaultLocale = locale;
1730
+
1731
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
1732
+ // (one of the certain letters followed by `o`)
1733
+ // - (\w)\1* matches any sequences of the same letter
1734
+ // - '' matches two quote characters in a row
1735
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
1736
+ // except a single quote symbol, which ends the sequence.
1737
+ // Two quote characters do not end the sequence.
1738
+ // If there is no matching single quote
1739
+ // then the sequence will continue until the end of the string.
1740
+ // - . matches any single character unmatched by previous parts of the RegExps
1741
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
1742
+
1743
+ // This RegExp catches symbols escaped by quotes, and also
1744
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
1745
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
1746
+ var escapedStringRegExp = /^'([^]*?)'?$/;
1747
+ var doubleQuoteRegExp = /''/g;
1748
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
1749
+
1750
+ /**
1751
+ * @name format
1752
+ * @category Common Helpers
1753
+ * @summary Format the date.
1754
+ *
1755
+ * @description
1756
+ * Return the formatted date string in the given format. The result may vary by locale.
1757
+ *
1758
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
1759
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1760
+ *
1761
+ * The characters wrapped between two single quotes characters (') are escaped.
1762
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
1763
+ * (see the last example)
1764
+ *
1765
+ * Format of the string is based on Unicode Technical Standard #35:
1766
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
1767
+ * with a few additions (see note 7 below the table).
1768
+ *
1769
+ * Accepted patterns:
1770
+ * | Unit | Pattern | Result examples | Notes |
1771
+ * |---------------------------------|---------|-----------------------------------|-------|
1772
+ * | Era | G..GGG | AD, BC | |
1773
+ * | | GGGG | Anno Domini, Before Christ | 2 |
1774
+ * | | GGGGG | A, B | |
1775
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
1776
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
1777
+ * | | yy | 44, 01, 00, 17 | 5 |
1778
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
1779
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
1780
+ * | | yyyyy | ... | 3,5 |
1781
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
1782
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
1783
+ * | | YY | 44, 01, 00, 17 | 5,8 |
1784
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
1785
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
1786
+ * | | YYYYY | ... | 3,5 |
1787
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
1788
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
1789
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
1790
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
1791
+ * | | RRRRR | ... | 3,5,7 |
1792
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
1793
+ * | | uu | -43, 01, 1900, 2017 | 5 |
1794
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
1795
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
1796
+ * | | uuuuu | ... | 3,5 |
1797
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
1798
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
1799
+ * | | QQ | 01, 02, 03, 04 | |
1800
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
1801
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
1802
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
1803
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
1804
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
1805
+ * | | qq | 01, 02, 03, 04 | |
1806
+ * | | qqq | Q1, Q2, Q3, Q4 | |
1807
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
1808
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
1809
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
1810
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
1811
+ * | | MM | 01, 02, ..., 12 | |
1812
+ * | | MMM | Jan, Feb, ..., Dec | |
1813
+ * | | MMMM | January, February, ..., December | 2 |
1814
+ * | | MMMMM | J, F, ..., D | |
1815
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
1816
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
1817
+ * | | LL | 01, 02, ..., 12 | |
1818
+ * | | LLL | Jan, Feb, ..., Dec | |
1819
+ * | | LLLL | January, February, ..., December | 2 |
1820
+ * | | LLLLL | J, F, ..., D | |
1821
+ * | Local week of year | w | 1, 2, ..., 53 | |
1822
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
1823
+ * | | ww | 01, 02, ..., 53 | |
1824
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
1825
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
1826
+ * | | II | 01, 02, ..., 53 | 7 |
1827
+ * | Day of month | d | 1, 2, ..., 31 | |
1828
+ * | | do | 1st, 2nd, ..., 31st | 7 |
1829
+ * | | dd | 01, 02, ..., 31 | |
1830
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
1831
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
1832
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
1833
+ * | | DDD | 001, 002, ..., 365, 366 | |
1834
+ * | | DDDD | ... | 3 |
1835
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
1836
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
1837
+ * | | EEEEE | M, T, W, T, F, S, S | |
1838
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
1839
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
1840
+ * | | io | 1st, 2nd, ..., 7th | 7 |
1841
+ * | | ii | 01, 02, ..., 07 | 7 |
1842
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
1843
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
1844
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
1845
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
1846
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
1847
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
1848
+ * | | ee | 02, 03, ..., 01 | |
1849
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
1850
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
1851
+ * | | eeeee | M, T, W, T, F, S, S | |
1852
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
1853
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
1854
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
1855
+ * | | cc | 02, 03, ..., 01 | |
1856
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
1857
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
1858
+ * | | ccccc | M, T, W, T, F, S, S | |
1859
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
1860
+ * | AM, PM | a..aa | AM, PM | |
1861
+ * | | aaa | am, pm | |
1862
+ * | | aaaa | a.m., p.m. | 2 |
1863
+ * | | aaaaa | a, p | |
1864
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
1865
+ * | | bbb | am, pm, noon, midnight | |
1866
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
1867
+ * | | bbbbb | a, p, n, mi | |
1868
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
1869
+ * | | BBBB | at night, in the morning, ... | 2 |
1870
+ * | | BBBBB | at night, in the morning, ... | |
1871
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
1872
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
1873
+ * | | hh | 01, 02, ..., 11, 12 | |
1874
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
1875
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
1876
+ * | | HH | 00, 01, 02, ..., 23 | |
1877
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
1878
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
1879
+ * | | KK | 01, 02, ..., 11, 00 | |
1880
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
1881
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
1882
+ * | | kk | 24, 01, 02, ..., 23 | |
1883
+ * | Minute | m | 0, 1, ..., 59 | |
1884
+ * | | mo | 0th, 1st, ..., 59th | 7 |
1885
+ * | | mm | 00, 01, ..., 59 | |
1886
+ * | Second | s | 0, 1, ..., 59 | |
1887
+ * | | so | 0th, 1st, ..., 59th | 7 |
1888
+ * | | ss | 00, 01, ..., 59 | |
1889
+ * | Fraction of second | S | 0, 1, ..., 9 | |
1890
+ * | | SS | 00, 01, ..., 99 | |
1891
+ * | | SSS | 000, 001, ..., 999 | |
1892
+ * | | SSSS | ... | 3 |
1893
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
1894
+ * | | XX | -0800, +0530, Z | |
1895
+ * | | XXX | -08:00, +05:30, Z | |
1896
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
1897
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
1898
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
1899
+ * | | xx | -0800, +0530, +0000 | |
1900
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
1901
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
1902
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
1903
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
1904
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
1905
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
1906
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
1907
+ * | Seconds timestamp | t | 512969520 | 7 |
1908
+ * | | tt | ... | 3,7 |
1909
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
1910
+ * | | TT | ... | 3,7 |
1911
+ * | Long localized date | P | 04/29/1453 | 7 |
1912
+ * | | PP | Apr 29, 1453 | 7 |
1913
+ * | | PPP | April 29th, 1453 | 7 |
1914
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
1915
+ * | Long localized time | p | 12:00 AM | 7 |
1916
+ * | | pp | 12:00:00 AM | 7 |
1917
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
1918
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
1919
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
1920
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
1921
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
1922
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
1923
+ * Notes:
1924
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
1925
+ * are the same as "stand-alone" units, but are different in some languages.
1926
+ * "Formatting" units are declined according to the rules of the language
1927
+ * in the context of a date. "Stand-alone" units are always nominative singular:
1928
+ *
1929
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
1930
+ *
1931
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
1932
+ *
1933
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
1934
+ * the single quote characters (see below).
1935
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
1936
+ * the output will be the same as default pattern for this unit, usually
1937
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
1938
+ * are marked with "2" in the last column of the table.
1939
+ *
1940
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
1941
+ *
1942
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
1943
+ *
1944
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
1945
+ *
1946
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
1947
+ *
1948
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
1949
+ *
1950
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
1951
+ * The output will be padded with zeros to match the length of the pattern.
1952
+ *
1953
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
1954
+ *
1955
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
1956
+ * These tokens represent the shortest form of the quarter.
1957
+ *
1958
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
1959
+ *
1960
+ * | Year | `y` | `u` |
1961
+ * |------|-----|-----|
1962
+ * | AC 1 | 1 | 1 |
1963
+ * | BC 1 | 1 | 0 |
1964
+ * | BC 2 | 2 | -1 |
1965
+ *
1966
+ * Also `yy` always returns the last two digits of a year,
1967
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
1968
+ *
1969
+ * | Year | `yy` | `uu` |
1970
+ * |------|------|------|
1971
+ * | 1 | 01 | 01 |
1972
+ * | 14 | 14 | 14 |
1973
+ * | 376 | 76 | 376 |
1974
+ * | 1453 | 53 | 1453 |
1975
+ *
1976
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
1977
+ * except local week-numbering years are dependent on `options.weekStartsOn`
1978
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
1979
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
1980
+ *
1981
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
1982
+ * so right now these tokens fall back to GMT timezones.
1983
+ *
1984
+ * 7. These patterns are not in the Unicode Technical Standard #35:
1985
+ * - `i`: ISO day of week
1986
+ * - `I`: ISO week of year
1987
+ * - `R`: ISO week-numbering year
1988
+ * - `t`: seconds timestamp
1989
+ * - `T`: milliseconds timestamp
1990
+ * - `o`: ordinal number modifier
1991
+ * - `P`: long localized date
1992
+ * - `p`: long localized time
1993
+ *
1994
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
1995
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1996
+ *
1997
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
1998
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1999
+ *
2000
+ * @param {Date|Number} date - the original date
2001
+ * @param {String} format - the string of tokens
2002
+ * @param {Object} [options] - an object with options.
2003
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2004
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2005
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2006
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2007
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2008
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2009
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2010
+ * @returns {String} the formatted date string
2011
+ * @throws {TypeError} 2 arguments required
2012
+ * @throws {RangeError} `date` must not be Invalid Date
2013
+ * @throws {RangeError} `options.locale` must contain `localize` property
2014
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2015
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2016
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2017
+ * @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
2018
+ * @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
2019
+ * @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
2020
+ * @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
2021
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2022
+ *
2023
+ * @example
2024
+ * // Represent 11 February 2014 in middle-endian format:
2025
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2026
+ * //=> '02/11/2014'
2027
+ *
2028
+ * @example
2029
+ * // Represent 2 July 2014 in Esperanto:
2030
+ * import { eoLocale } from 'date-fns/locale/eo'
2031
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2032
+ * locale: eoLocale
2033
+ * })
2034
+ * //=> '2-a de julio 2014'
2035
+ *
2036
+ * @example
2037
+ * // Escape string by single quote characters:
2038
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2039
+ * //=> "3 o'clock"
2040
+ */
2041
+
2042
+ function format(dirtyDate, dirtyFormatStr, options) {
2043
+ 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;
2044
+ requiredArgs(2, arguments);
2045
+ var formatStr = String(dirtyFormatStr);
2046
+ var defaultOptions = getDefaultOptions();
2047
+ 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;
2048
+ 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);
2049
+
2050
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2051
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2052
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2053
+ }
2054
+ 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);
2055
+
2056
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2057
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2058
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2059
+ }
2060
+ if (!locale.localize) {
2061
+ throw new RangeError('locale must contain localize property');
2062
+ }
2063
+ if (!locale.formatLong) {
2064
+ throw new RangeError('locale must contain formatLong property');
2065
+ }
2066
+ var originalDate = toDate(dirtyDate);
2067
+ if (!isValid(originalDate)) {
2068
+ throw new RangeError('Invalid time value');
2069
+ }
2070
+
2071
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2072
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2073
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2074
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2075
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2076
+ var formatterOptions = {
2077
+ firstWeekContainsDate: firstWeekContainsDate,
2078
+ weekStartsOn: weekStartsOn,
2079
+ locale: locale,
2080
+ _originalDate: originalDate
2081
+ };
2082
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2083
+ var firstCharacter = substring[0];
2084
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2085
+ var longFormatter = longFormatters$1[firstCharacter];
2086
+ return longFormatter(substring, locale.formatLong);
2087
+ }
2088
+ return substring;
2089
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2090
+ // Replace two single quote characters with one single quote character
2091
+ if (substring === "''") {
2092
+ return "'";
2093
+ }
2094
+ var firstCharacter = substring[0];
2095
+ if (firstCharacter === "'") {
2096
+ return cleanEscapedString(substring);
2097
+ }
2098
+ var formatter = formatters$1[firstCharacter];
2099
+ if (formatter) {
2100
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2101
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2102
+ }
2103
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2104
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2105
+ }
2106
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
2107
+ }
2108
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2109
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2110
+ }
2111
+ return substring;
2112
+ }).join('');
2113
+ return result;
2114
+ }
2115
+ function cleanEscapedString(input) {
2116
+ var matched = input.match(escapedStringRegExp);
2117
+ if (!matched) {
2118
+ return input;
2119
+ }
2120
+ return matched[1].replace(doubleQuoteRegExp, "'");
2121
+ }
2122
+
2123
+ const tooltipCss = ":host{display:inline-flex;position:relative}.tooltip-wrapper{position:relative;display:inline-flex}.tooltip-content-wrapper{position:absolute;z-index:10;bottom:125%;left:50%;transform:translateX(-50%);opacity:0;visibility:hidden;transition:opacity 0.2s, visibility 0.2s}.tooltip-content-wrapper.visible{opacity:1;visibility:visible}.tooltip-content{background-color:var(--emw--tooltip-background-color, #000);color:var(--emw--tooltip-text-color, #fff);border-radius:4px;box-shadow:0 2px 8px rgba(0, 0, 0, 0.15);white-space:nowrap;padding:4px}";
2124
+ const AppTooltipStyle0 = tooltipCss;
2125
+
2126
+ const Tooltip = class {
2127
+ constructor(hostRef) {
2128
+ registerInstance(this, hostRef);
2129
+ this.show = () => (this.visible = true);
2130
+ this.hide = () => (this.visible = false);
2131
+ this.visible = false;
2132
+ }
2133
+ componentDidLoad() {
2134
+ this.trigger = this.host.querySelector('[slot="trigger"]');
2135
+ if (this.trigger) {
2136
+ this.trigger.addEventListener('mouseenter', this.show);
2137
+ this.trigger.addEventListener('mouseleave', this.hide);
2138
+ this.trigger.addEventListener('focus', this.show);
2139
+ this.trigger.addEventListener('blur', this.hide);
2140
+ }
2141
+ }
2142
+ disconnectedCallback() {
2143
+ if (this.trigger) {
2144
+ this.trigger.removeEventListener('mouseenter', this.show);
2145
+ this.trigger.removeEventListener('mouseleave', this.hide);
2146
+ this.trigger.removeEventListener('focus', this.show);
2147
+ this.trigger.removeEventListener('blur', this.hide);
2148
+ }
2149
+ }
2150
+ render() {
2151
+ return (h("div", { key: 'e56695ac60fcd7903127179423e9954ef40f05c0', class: "tooltip-wrapper" }, h("slot", { key: '4e2472a395ceeb2b911692739d326c031df07e29', name: "trigger" }), h("div", { key: 'f77bd72da94eb17d12e42ebb86c395c55801b728', class: { 'tooltip-content-wrapper': true, visible: this.visible } }, h("div", { key: '988399e2b42988622d46eaf255f17c6221eb9697', class: "tooltip-content" }, h("slot", { key: '05de0572ab1331d965e61947c5c15775e225197a', name: "content" })))));
2152
+ }
2153
+ get host() { return getElement(this); }
2154
+ };
2155
+ Tooltip.style = AppTooltipStyle0;
2156
+
2157
+ const helperCountDownCss = ":host{display:block}.helper-count-down-container{display:flex;align-items:center}.helper-count-down-prefix{margin-right:4px}.helper-count-down-suffix{margin-left:4px}.helper-count-down-values{display:flex;align-items:center}.helper-count-down-item{display:flex;align-items:center;justify-content:center}.helper-count-down-item-num{font-variant-numeric:tabular-nums}";
2158
+ const HelperCountDownStyle0 = helperCountDownCss;
2159
+
2160
+ const HelperCountDown = class {
2161
+ constructor(hostRef) {
2162
+ registerInstance(this, hostRef);
2163
+ this.countDownChange = createEvent(this, "countDownChange", 7);
2164
+ this.countDownFinish = createEvent(this, "countDownFinish", 7);
2165
+ this.value = undefined;
2166
+ this.format = 'HH:mm:ss';
2167
+ this.prefix = undefined;
2168
+ this.suffix = undefined;
2169
+ this.mbSource = undefined;
2170
+ this.clientStyling = undefined;
2171
+ this.clientStylingUrl = undefined;
2172
+ this.endTime = undefined;
2173
+ this.timeObj = {
2174
+ day: { str: '00', unit: '' },
2175
+ hour: { str: '00', unit: '' },
2176
+ minute: { str: '00', unit: '' },
2177
+ second: { str: '00', unit: '' }
2178
+ };
2179
+ }
2180
+ handleClientStylingChange(newValue, oldValue) {
2181
+ if (newValue != oldValue) {
2182
+ setClientStyling(this.stylingContainer, this.clientStyling);
2183
+ }
2184
+ }
2185
+ handleClientStylingUrlChange(newValue, oldValue) {
2186
+ if (newValue != oldValue) {
2187
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2188
+ }
2189
+ }
2190
+ handleMbSourceChange(newValue, oldValue) {
2191
+ if (newValue != oldValue) {
2192
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2193
+ }
2194
+ }
2195
+ handleValueChange(newValue) {
2196
+ this.setEndTime(newValue);
2197
+ if (newValue) {
2198
+ this.startCountDown();
2199
+ }
2200
+ else {
2201
+ this.clearCountDown();
2202
+ }
2203
+ }
2204
+ componentDidLoad() {
2205
+ if (this.stylingContainer) {
2206
+ if (this.mbSource)
2207
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2208
+ if (this.clientStyling)
2209
+ setClientStyling(this.stylingContainer, this.clientStyling);
2210
+ if (this.clientStylingUrl)
2211
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2212
+ }
2213
+ this.setEndTime(this.value);
2214
+ if (this.value)
2215
+ this.startCountDown();
2216
+ }
2217
+ setEndTime(value) {
2218
+ if (typeof value === 'string') {
2219
+ // If it's a string, parse it and get the milliseconds
2220
+ const time = parseISO(value).getTime();
2221
+ this.endTime = isNaN(time) ? null : time;
2222
+ }
2223
+ else {
2224
+ // If it's a number, use it directly
2225
+ this.endTime = value;
2226
+ }
2227
+ }
2228
+ disconnectedCallback() {
2229
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2230
+ this.clearCountDown();
2231
+ }
2232
+ startCountDown() {
2233
+ this.clearCountDown();
2234
+ this.tick();
2235
+ this.timer = setInterval(() => {
2236
+ this.tick();
2237
+ }, 1000);
2238
+ }
2239
+ clearCountDown() {
2240
+ if (this.timer) {
2241
+ clearInterval(this.timer);
2242
+ this.timer = null;
2243
+ }
2244
+ }
2245
+ tick() {
2246
+ if (!this.endTime)
2247
+ return;
2248
+ let leftTime = this.endTime - Date.now();
2249
+ if (leftTime <= 0) {
2250
+ leftTime = 0;
2251
+ this.clearCountDown();
2252
+ this.countDownFinish.emit();
2253
+ }
2254
+ const d = Math.floor(leftTime / (1000 * 60 * 60 * 24));
2255
+ const h = Math.floor((leftTime / (1000 * 60 * 60)) % 24);
2256
+ const m = Math.floor((leftTime / 1000 / 60) % 60);
2257
+ const s = Math.floor((leftTime / 1000) % 60);
2258
+ const pad = (n) => (n < 10 ? `0${n}` : `${n}`);
2259
+ this.timeObj = {
2260
+ day: { str: pad(d), unit: 'd' },
2261
+ hour: { str: pad(h), unit: 'h' },
2262
+ minute: { str: pad(m), unit: 'm' },
2263
+ second: { str: pad(s), unit: 's' }
2264
+ };
2265
+ const formatTime = this.getFormatTime();
2266
+ this.countDownChange.emit({ leftTime, formatTime, legalTime: formatTime });
2267
+ }
2268
+ getFormatTime() {
2269
+ return this.format
2270
+ .replace('DD', this.timeObj.day.str)
2271
+ .replace('HH', this.timeObj.hour.str)
2272
+ .replace('mm', this.timeObj.minute.str)
2273
+ .replace('ss', this.timeObj.second.str);
2274
+ }
2275
+ renderItems() {
2276
+ const regex = /(DD|HH|mm|ss)|([\s\S]+?)(?=(DD|HH|mm|ss)|$)/g;
2277
+ const items = [];
2278
+ let match;
2279
+ while ((match = regex.exec(this.format)) !== null) {
2280
+ if (match[1]) {
2281
+ let val = '';
2282
+ switch (match[1]) {
2283
+ case 'DD':
2284
+ val = this.timeObj.day.str;
2285
+ break;
2286
+ case 'HH':
2287
+ val = this.timeObj.hour.str;
2288
+ break;
2289
+ case 'mm':
2290
+ val = this.timeObj.minute.str;
2291
+ break;
2292
+ case 'ss':
2293
+ val = this.timeObj.second.str;
2294
+ break;
2295
+ }
2296
+ items.push({ val, unit: '' });
2297
+ }
2298
+ else if (match[2]) {
2299
+ if (items.length > 0) {
2300
+ items[items.length - 1].unit = match[2];
2301
+ }
2302
+ }
2303
+ }
2304
+ return items.map((item, index) => {
2305
+ return (h("div", { key: index + item.unit, class: "helper-count-down-item", part: "item" }, h("div", { class: "helper-count-down-item-num" }, item.val), h("div", { class: "helper-count-down-item-unit" }, item.unit)));
2306
+ });
2307
+ }
2308
+ render() {
2309
+ return (h("div", { key: 'b360412e045020b5ac0263c6ca56458f31eedb2c', class: "helper-count-down-container", ref: (el) => (this.stylingContainer = el) }, h("slot", { key: 'c72bed87fba869c842407b04e0cbfe038e5b7ea8' }), this.prefix && h("div", { key: '8d3ba9d60577421f81bae7bc76f52a774b17e1fe', class: "helper-count-down-prefix" }, this.prefix), h("div", { key: '187edf3b8eb6de85efe1a748fd8ef47a68e19611', class: "helper-count-down-values", part: "values" }, this.renderItems()), this.suffix && h("div", { key: '3a8e5d9561ecd3f52eff423bd43c8b60a261a17c', class: "helper-count-down-suffix" }, this.suffix)));
2310
+ }
2311
+ static get watchers() { return {
2312
+ "clientStyling": ["handleClientStylingChange"],
2313
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2314
+ "mbSource": ["handleMbSourceChange"],
2315
+ "value": ["handleValueChange"]
2316
+ }; }
2317
+ };
2318
+ HelperCountDown.style = HelperCountDownStyle0;
2319
+
2320
+ const DEFAULT_LANGUAGE$4 = 'en';
2321
+ const SUPPORTED_LANGUAGES$4 = ['ro', 'en', 'fr', 'ar', 'hr'];
2322
+ const TRANSLATIONS$4 = {
2323
+ en: {
2324
+ stop: 'Stop',
2325
+ at: 'at',
2326
+ turnover: 'Turnover: ',
2327
+ startIn: 'Sales Start in:',
2328
+ },
2329
+ ro: {
2330
+ stop: 'Oprește',
2331
+ at: 'la'
2332
+ },
2333
+ fr: {
2334
+ stop: 'Arrêtez',
2335
+ at: 'à'
2336
+ },
2337
+ ar: {
2338
+ stop: 'توقف',
2339
+ at: 'في'
2340
+ },
2341
+ hr: {
2342
+ stop: 'Stop',
2343
+ at: 'u'
2344
+ }
2345
+ };
2346
+ const translate$4 = (key, customLang) => {
2347
+ const lang = customLang;
2348
+ return TRANSLATIONS$4[lang !== undefined && SUPPORTED_LANGUAGES$4.includes(lang) ? lang : DEFAULT_LANGUAGE$4][key];
2349
+ };
2350
+ const getTranslations$4 = (data) => {
2351
+ Object.keys(data).forEach((item) => {
2352
+ for (let key in data[item]) {
2353
+ TRANSLATIONS$4[item][key] = data[item][key];
2354
+ }
2355
+ });
2356
+ };
2357
+ const resolveTranslationUrl$3 = async (translationUrl) => {
2358
+ if (translationUrl) {
2359
+ try {
2360
+ const response = await fetch(translationUrl);
2361
+ if (!response.ok) {
2362
+ throw new Error(`HTTP error! status: ${response.status}`);
2363
+ }
2364
+ const translations = await response.json();
2365
+ getTranslations$4(translations);
2366
+ }
2367
+ catch (error) {
2368
+ console.error('Failed to fetch or parse translations from URL:', error);
2369
+ }
2370
+ }
2371
+ };
2372
+
2373
+ const lotteryBannerCss = ":host {\n display: block;\n container-type: inline-size;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n max-width: 32vw;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n letter-spacing: var(--lottery-banner-title-font-letter-spacing, 0.04em);\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-label__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-value__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\nhelper-count-down::part(values) {\n gap: 8px;\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem 0.2rem);\n }\n .lottery-banner__title {\n flex-basis: 100%;\n text-align: var(--lottery-banner-mobile-title-text-align, left);\n font-size: var(--emw--font-size-small, 0.875rem);\n }\n .lottery-banner__info {\n flex-direction: column;\n align-items: flex-start;\n gap: var(--lottery-banner-mobile-info-gap, 0.1rem);\n }\n .lottery-banner__info-item {\n font-size: var(--emw--font-size-x-small, 0.75rem);\n }\n}";
2374
+ const LotteryBannerStyle0 = lotteryBannerCss;
2375
+
2376
+ const LotteryBanner = class {
2377
+ constructor(hostRef) {
2378
+ registerInstance(this, hostRef);
2379
+ this.lotteryBannerWagerStarted = createEvent(this, "lotteryBannerWagerStarted", 7);
2380
+ this.handleCountdownFinish = () => {
2381
+ this.isWagerStarted = true;
2382
+ this.lotteryBannerWagerStarted.emit();
2383
+ };
2384
+ this.mbSource = undefined;
2385
+ this.clientStyling = undefined;
2386
+ this.clientStylingUrl = undefined;
2387
+ this.translationUrl = '';
2388
+ this.language = 'en';
2389
+ this.logoUrl = undefined;
2390
+ this.stopTime = '';
2391
+ this.startTime = '';
2392
+ this.bannerTitle = undefined;
2393
+ this.turnover = undefined;
2394
+ this.layout = 'logo,title,info';
2395
+ this.isWagerStarted = false;
2396
+ this.formattedStopTime = undefined;
2397
+ }
2398
+ handleClientStylingChange(newValue, oldValue) {
2399
+ if (newValue !== oldValue) {
2400
+ setClientStyling(this.stylingContainer, this.clientStyling);
2401
+ }
2402
+ }
2403
+ handleClientStylingUrlChange(newValue, oldValue) {
2404
+ if (newValue !== oldValue) {
2405
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2406
+ }
2407
+ }
2408
+ handleMbSourceChange(newValue, oldValue) {
2409
+ if (newValue !== oldValue) {
2410
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2411
+ }
2412
+ }
2413
+ handleTimeChange() {
2414
+ this.checkWagerStatus();
2415
+ }
2416
+ async componentWillLoad() {
2417
+ if (this.translationUrl) {
2418
+ resolveTranslationUrl$3(this.translationUrl);
2419
+ }
2420
+ this.checkWagerStatus();
2421
+ }
2422
+ checkWagerStatus() {
2423
+ if (this.startTime && isBefore(new Date(), parseISO(this.startTime))) {
2424
+ this.isWagerStarted = false;
2425
+ }
2426
+ else {
2427
+ this.isWagerStarted = true;
2428
+ }
2429
+ if (this.stopTime) {
2430
+ this.formattedStopTime = format(parseISO(this.stopTime), 'dd/MM/yyyy HH:mm');
2431
+ }
2432
+ }
2433
+ componentDidLoad() {
2434
+ if (this.stylingContainer) {
2435
+ if (this.mbSource)
2436
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2437
+ if (this.clientStyling)
2438
+ setClientStyling(this.stylingContainer, this.clientStyling);
2439
+ if (this.clientStylingUrl)
2440
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2441
+ }
2442
+ }
2443
+ disconnectedCallback() {
2444
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2445
+ }
2446
+ renderElement(item, className = '') {
2447
+ const poolGameLogo = getAssetPath('../static/poolGameLogo.webp');
2448
+ switch (item) {
2449
+ case 'logo':
2450
+ return (h("div", { class: `lottery-banner__logo-wrapper ${className}` }, poolGameLogo && h("img", { alt: "logo", src: poolGameLogo, class: "lottery-banner__logo" })));
2451
+ case 'title':
2452
+ return this.bannerTitle && h("div", { class: `lottery-banner__title ${className}` }, this.bannerTitle);
2453
+ case 'info':
2454
+ return (h("div", { class: `lottery-banner__info ${className}` }, !this.isWagerStarted ? (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, h("span", { class: "lottery-banner__info-item-label__strong" }, translate$4('startIn', this.language)), "\u00A0"), h("helper-count-down", { class: "lottery-banner__info-item-value lottery-banner__info-item-value__strong", value: this.startTime, format: "DDD HHH mmM ssS", onCountDownFinish: this.handleCountdownFinish }))) : (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, h("span", { class: "lottery-banner__info-item-label__strong" }, translate$4('stop', this.language)), "\u00A0", translate$4('at', this.language)), h("span", { class: "lottery-banner__info-item-value" }, this.formattedStopTime))), this.isWagerStarted && this.turnover !== null && this.turnover !== undefined && (h("div", { class: "lottery-banner__info-item" }, h("span", { class: "lottery-banner__info-item-label" }, translate$4('turnover', this.language)), h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
2455
+ default:
2456
+ return null;
2457
+ }
2458
+ }
2459
+ render() {
2460
+ const layoutItems = this.layout.split(',').map((item) => item.trim());
2461
+ return (h("section", { key: '8714d4136821b8afd6079da769bb9cc94149ed9d', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
2462
+ const isMiddle = layoutItems.length === 3 && index === 1;
2463
+ const className = isMiddle ? 'lottery-banner__item--center' : '';
2464
+ return this.renderElement(item, className);
2465
+ })));
2466
+ }
2467
+ static get assetsDirs() { return ["../static"]; }
2468
+ static get watchers() { return {
2469
+ "clientStyling": ["handleClientStylingChange"],
2470
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2471
+ "mbSource": ["handleMbSourceChange"],
2472
+ "startTime": ["handleTimeChange"],
2473
+ "stopTime": ["handleTimeChange"]
2474
+ }; }
2475
+ };
2476
+ LotteryBanner.style = LotteryBannerStyle0;
2477
+
2478
+ const DEFAULT_LANGUAGE$3 = 'en';
2479
+ const SUPPORTED_LANGUAGES$3 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
2480
+ const TRANSLATIONS$3 = {
2481
+ en: {
2482
+ loading: 'Loading'
2483
+ },
2484
+ ro: {},
2485
+ fr: {},
2486
+ ar: {},
2487
+ hr: {}
2488
+ };
2489
+ const translate$3 = (key, customLang, replacements) => {
2490
+ const lang = customLang;
2491
+ let translation = TRANSLATIONS$3[lang !== undefined && SUPPORTED_LANGUAGES$3.includes(lang) ? lang : DEFAULT_LANGUAGE$3][key];
2492
+ if (replacements) {
2493
+ Object.keys(replacements).forEach((placeholder) => {
2494
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
2495
+ });
2496
+ }
2497
+ return translation;
2498
+ };
2499
+ const getTranslations$3 = (data) => {
2500
+ Object.keys(data).forEach((item) => {
2501
+ for (let key in data[item]) {
2502
+ TRANSLATIONS$3[item][key] = data[item][key];
2503
+ }
2504
+ });
2505
+ };
2506
+ const resolveTranslationUrl$2 = async (translationUrl) => {
2507
+ if (translationUrl) {
2508
+ try {
2509
+ const response = await fetch(translationUrl);
2510
+ if (!response.ok) {
2511
+ throw new Error(`HTTP error! status: ${response.status}`);
2512
+ }
2513
+ const translations = await response.json();
2514
+ getTranslations$3(translations);
2515
+ }
2516
+ catch (error) {
2517
+ console.error('Failed to fetch or parse translations from URL:', error);
2518
+ }
2519
+ }
2520
+ };
2521
+
2522
+ const lotteryButtonCss = ":host{display:inline-block}.btn{font:inherit;position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--lottery-button-border-radius, 6px);font-weight:var(--lottery-button-font-weight, 500);cursor:pointer;outline:none;overflow:hidden;transition:var(--lottery-button-transition, background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s);user-select:none;-webkit-tap-highlight-color:transparent;box-shadow:var(--lottery-button-box-shadow, 0 2px 4px 0 rgba(0, 0, 0, 0.5))}.btn .content{position:relative;display:inline-flex;align-items:center;gap:var(--lottery-button-content-gap, 0.5em)}.btn .content ::slotted(span){display:inline-flex;align-items:center}.btn:hover:not(:disabled){box-shadow:var(--lottery-button-hover-box-shadow, 0 4px 8px 0 rgba(0, 0, 0, 0.5))}.btn:disabled{cursor:not-allowed;opacity:var(--lottery-button-disabled-opacity, 0.5)}.btn .loading-container{display:flex;align-items:center}.btn--loading{position:relative}.btn .spinner{display:inline-block;width:1em;height:1em;border:var(--lottery-button-spinner-border, 2px solid rgba(255, 255, 255, 0.3));border-radius:50%;border-top-color:var(--lottery-button-spinner-color, white);animation:spin 1s ease-in-out infinite;margin-left:0.5em;vertical-align:middle}.btn--small .spinner{width:0.8em;height:0.8em}.btn--large .spinner{width:1.2em;height:1.2em}@keyframes spin{to{transform:rotate(360deg)}}.btn--primary{background-color:var(--emw--color-primary, #0d196e);color:var(--emw--color-typography-inverse, #fff)}.btn--primary:hover:not(:disabled){background-color:var(--emw--color-primary-variant, #1367e7)}.btn--primary:active:not(:disabled){background-color:var(--lottery-button-primary-active-bg, #08104a)}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:var(--lottery-button-spinner-inverse-border-color, rgba(0, 0, 0, 0.2))}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:var(--lottery-button-outline-border-color, #dcdcdc);color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:var(--lottery-button-outline-hover-border-color, #a6a6a6)}.btn--outline:active:not(:disabled){background-color:var(--lottery-button-outline-active-bg, #e6e6e6)}.btn--dashed{background-color:transparent;border-style:dashed;border-color:var(--lottery-button-dashed-border-color, #dcdcdc);color:var(--lottery-button-dashed-color, #333)}.btn--dashed:hover:not(:disabled){border-color:var(--lottery-button-dashed-hover-border-color, #a6a6a6);color:var(--lottery-button-dashed-hover-color, #0052d9)}.btn--text{background-color:transparent;color:var(--lottery-button-text-color, #0052d9);border-color:transparent}.btn--text:hover:not(:disabled){background-color:var(--lottery-button-text-hover-bg, #f2f2f2)}.btn--text:active:not(:disabled){background-color:var(--lottery-button-text-active-bg, #e6e6e6)}.btn--custom-color:hover:not(:disabled){opacity:var(--lottery-button-custom-hover-opacity, 0.9)}.btn--custom-color:active:not(:disabled){opacity:var(--lottery-button-custom-active-opacity, 0.8)}.btn--small{height:var(--lottery-button-small-height, 28px);font-size:var(--lottery-button-small-font-size, 12px);padding:var(--lottery-button-small-padding, 0 12px)}.btn--medium{height:var(--lottery-button-medium-height, 34px);font-size:var(--lottery-button-medium-font-size, 14px);padding:var(--lottery-button-medium-padding, 0 18px)}.btn--large{height:var(--lottery-button-large-height, 40px);font-size:var(--lottery-button-large-font-size, 16px);padding:var(--lottery-button-large-padding, 0 24px)}.ripple-container{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;border-radius:inherit}.ripple{position:absolute;border-radius:50%;background-color:var(--lottery-button-ripple-light, rgba(255, 255, 255, 0.3));transform:scale(0);animation:ripple-animation 600ms linear}.btn--outline .ripple,.btn--dashed .ripple,.btn--text .ripple{background-color:var(--lottery-button-ripple-dark, rgba(0, 0, 0, 0.03))}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}";
2523
+ const LotteryButtonStyle0 = lotteryButtonCss;
2524
+
2525
+ const LotteryButton = class {
2526
+ constructor(hostRef) {
2527
+ registerInstance(this, hostRef);
2528
+ this.handleClick = (event) => {
2529
+ if (this.disabled) {
2530
+ return;
2531
+ }
2532
+ // Get the button element from the shadow root
2533
+ const button = this.host.shadowRoot.querySelector('.btn');
2534
+ if (!button)
2535
+ return;
2536
+ const rect = button.getBoundingClientRect();
2537
+ const size = Math.max(rect.width, rect.height);
2538
+ const top = event.clientY - rect.top - size / 2;
2539
+ const left = event.clientX - rect.left - size / 2;
2540
+ // Add the new ripple to the state, triggering a re-render
2541
+ const newRipple = { top, left, size };
2542
+ this.ripples = [...this.ripples, newRipple];
2543
+ // Set a timeout to clean up the ripple from the state after the animation ends
2544
+ // This prevents the DOM from filling up with old ripple elements
2545
+ setTimeout(() => {
2546
+ this.ripples = this.ripples.filter((r) => r !== newRipple);
2547
+ }, 600); // This duration should match the CSS animation duration
2548
+ };
2549
+ this.variant = 'primary';
2550
+ this.size = 'medium';
2551
+ this.color = undefined;
2552
+ this.disabled = false;
2553
+ this.loading = false;
2554
+ this.text = undefined;
2555
+ this.mbSource = undefined;
2556
+ this.language = 'en';
2557
+ this.clientStyling = undefined;
2558
+ this.clientStylingUrl = undefined;
2559
+ this.translationUrl = '';
2560
+ this.ripples = [];
2561
+ }
2562
+ handleClientStylingChange(newValue, oldValue) {
2563
+ if (newValue != oldValue) {
2564
+ setClientStyling(this.stylingContainer, this.clientStyling);
2565
+ }
2566
+ }
2567
+ handleClientStylingUrlChange(newValue, oldValue) {
2568
+ if (newValue != oldValue) {
2569
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2570
+ }
2571
+ }
2572
+ handleMbSourceChange(newValue, oldValue) {
2573
+ if (newValue != oldValue) {
2574
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2575
+ }
2576
+ }
2577
+ disconnectedCallback() {
2578
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2579
+ }
2580
+ componentDidLoad() {
2581
+ if (this.stylingContainer) {
2582
+ if (this.mbSource)
2583
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2584
+ if (this.clientStyling)
2585
+ setClientStyling(this.stylingContainer, this.clientStyling);
2586
+ if (this.clientStylingUrl)
2587
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2588
+ }
2589
+ }
2590
+ componentWillLoad() {
2591
+ if (this.translationUrl) {
2592
+ resolveTranslationUrl$2(this.translationUrl);
2593
+ }
2594
+ }
2595
+ render() {
2596
+ const { variant, disabled, size, color } = this;
2597
+ const isDisabled = disabled || this.loading;
2598
+ // Calculate styles based on variant and color
2599
+ const buttonStyles = {};
2600
+ if (color) {
2601
+ switch (variant) {
2602
+ case 'primary':
2603
+ Object.assign(buttonStyles, {
2604
+ backgroundColor: color,
2605
+ borderColor: color
2606
+ });
2607
+ break;
2608
+ case 'outline':
2609
+ case 'dashed':
2610
+ Object.assign(buttonStyles, {
2611
+ color: color,
2612
+ borderColor: color
2613
+ });
2614
+ break;
2615
+ case 'text':
2616
+ Object.assign(buttonStyles, {
2617
+ color: color
2618
+ });
2619
+ break;
2620
+ default:
2621
+ Object.assign(buttonStyles, {
2622
+ backgroundColor: color,
2623
+ borderColor: color
2624
+ });
2625
+ }
2626
+ }
2627
+ return (h("button", { key: 'aa74ad98c90e7548228557bf8a8d26b125d4a83a', class: {
2628
+ btn: true,
2629
+ [`btn--${variant}`]: true,
2630
+ [`btn--${size}`]: true,
2631
+ 'btn--loading': this.loading
2632
+ }, style: color ? buttonStyles : undefined, disabled: isDisabled, onClick: this.handleClick, ref: (el) => (this.stylingContainer = el) }, this.loading ? (h("div", { class: "loading-container" }, h("span", { class: "content" }, this.text || translate$3('loading', this.language)), h("span", { class: "spinner" }))) : (h("span", { class: "content" }, h("slot", { name: "icon-left" }), this.text || h("slot", null), h("slot", { name: "icon-right" }))), h("div", { key: '302ea02be395bb24989d4abc040a513e23fa029a', class: "ripple-container" }, this.ripples.map((ripple, index) => (h("span", { key: index, class: "ripple", style: {
2633
+ top: `${ripple.top}px`,
2634
+ left: `${ripple.left}px`,
2635
+ width: `${ripple.size}px`,
2636
+ height: `${ripple.size}px`
2637
+ } }))))));
2638
+ }
2639
+ get host() { return getElement(this); }
2640
+ static get watchers() { return {
2641
+ "clientStyling": ["handleClientStylingChange"],
2642
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2643
+ "mbSource": ["handleMbSourceChange"]
2644
+ }; }
2645
+ };
2646
+ LotteryButton.style = LotteryButtonStyle0;
2647
+
2648
+ const generateUUID = () => {
2649
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
2650
+ var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
2651
+ return v.toString(16);
2652
+ });
2653
+ };
2654
+ function fetchRequest(url, method = 'GET', body = null, headers = {}) {
2655
+ return new Promise((resolve, reject) => {
2656
+ const uuid = generateUUID();
2657
+ const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
2658
+ if (method !== 'GET' && method !== 'HEAD') {
2659
+ headersOrigin['X-Idempotency-Key'] = uuid;
2660
+ }
2661
+ const options = {
2662
+ method,
2663
+ headers: headersOrigin,
2664
+ body: null
2665
+ };
2666
+ if (body && method !== 'GET' && method !== 'HEAD') {
2667
+ options.body = JSON.stringify(body);
2668
+ }
2669
+ else {
2670
+ delete options.body;
2671
+ }
2672
+ fetch(url, options)
2673
+ .then((response) => {
2674
+ if (!response.ok) {
2675
+ return reject(response);
2676
+ }
2677
+ return response.json();
2678
+ })
2679
+ .then((data) => resolve(data))
2680
+ .catch((error) => reject(error));
2681
+ });
2682
+ }
2683
+
2684
+ var TicketStatus;
2685
+ (function (TicketStatus) {
2686
+ TicketStatus["PURCHASED"] = "Purchased";
2687
+ TicketStatus["SETTLED"] = "Settled";
2688
+ TicketStatus["CANCELED"] = "Canceled";
2689
+ TicketStatus["ERROR"] = "Error";
2690
+ })(TicketStatus || (TicketStatus = {}));
2691
+
2692
+ const lotteryOrderSummaryCss = ":host{width:100%}.order-summary{width:100%;background:var(--emw--color-background, #fff);border-radius:var(--lottery-order-summary-border-radius, 8px);border:var(--lottery-order-summary-border, none);box-shadow:var(--lottery-order-summary-box-shadow, none);box-sizing:border-box}.order-summary__title{margin:var(--lottery-order-summary-title-margin, 0 0 30px 0);text-align:var(--lottery-order-summary-title-text-align, center);color:var(--emw--color-typography, #000);text-transform:uppercase;font-weight:var(--lottery-order-summary-title-font-weight, 700)}.order-summary__ticket-info{display:flex;align-items:center;margin-bottom:var(--lottery-order-summary-row-gap, 16px);gap:var(--lottery-order-summary-col-gap, 10px);color:var(--emw--color-typography, #000)}.order-summary__ticket-label{display:flex;flex-direction:row;align-items:center;width:var(--lottery-order-summary-label-width, 50px);max-width:var(--lottery-order-summary-label-max-width, 100%);flex-shrink:0}.order-summary__colon{margin-left:2px}.order-summary__ticket{font-weight:var(--lottery-order-summary-label-font-weight, 500);color:var(--emw--color-typography, #000);overflow-wrap:break-word}.order-summary__details{display:flex;align-items:center;color:var(--emw--color-typography, #000);font-weight:var(--lottery-order-summary-details-font-weight, 400)}.order-summary__divider{border:none;border-top:var(--lottery-order-summary-divider-border, 1px solid var(--emw--color-gray-100, #e6e6e6));margin:var(--lottery-order-summary-divider-margin, 20px 0)}.order-summary__button-wrapper{display:flex;justify-content:center;margin:var(--lottery-order-summary-button-wrapper-margin, 0);padding:var(--lottery-order-summary-button-wrapper-padding, 0)}";
2693
+ const LotteryOrderSummaryStyle0 = lotteryOrderSummaryCss;
2694
+
2695
+ const LotteryOrderSummary = class {
2696
+ constructor(hostRef) {
2697
+ registerInstance(this, hostRef);
2698
+ this.orderSummarySubmit = createEvent(this, "orderSummarySubmit", 7);
2699
+ this.submitSuccess = createEvent(this, "lotteryTicketSubmitSuccess", 7);
2700
+ this.submitError = createEvent(this, "lotteryTicketSubmitError", 7);
2701
+ this.sessionExpired = createEvent(this, "sessionExpired", 7);
2702
+ this.endpoint = undefined;
2703
+ this.sessionId = undefined;
2704
+ this.mbSource = undefined;
2705
+ this.clientStyling = undefined;
2706
+ this.clientStylingUrl = undefined;
2707
+ this.language = 'en';
2708
+ this.orderSummaryTitle = undefined;
2709
+ this.ticketsLabel = undefined;
2710
+ this.totalLabel = undefined;
2711
+ this.showColon = true;
2712
+ this.showDivider = false;
2713
+ this.submitDisabled = false;
2714
+ this.submitButtonText = undefined;
2715
+ this.submitLoading = false;
2716
+ }
2717
+ handleClientStylingChange(newValue, oldValue) {
2718
+ if (newValue != oldValue) {
2719
+ setClientStyling(this.stylingContainer, this.clientStyling);
2720
+ }
2721
+ }
2722
+ handleClientStylingUrlChange(newValue, oldValue) {
2723
+ if (newValue != oldValue) {
2724
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2725
+ }
2726
+ }
2727
+ handleMbSourceChange(newValue, oldValue) {
2728
+ if (newValue != oldValue) {
2729
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2730
+ }
2731
+ }
2732
+ componentDidLoad() {
2733
+ if (this.stylingContainer) {
2734
+ if (this.mbSource)
2735
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2736
+ if (this.clientStyling)
2737
+ setClientStyling(this.stylingContainer, this.clientStyling);
2738
+ if (this.clientStylingUrl)
2739
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2740
+ }
2741
+ }
2742
+ disconnectedCallback() {
2743
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2744
+ }
2745
+ handleLotteryTicketParamsReady(event) {
2746
+ if (event.detail && this.isValidTicketSubmitParam(event.detail)) {
2747
+ this.handleSubmitTickets(event.detail);
2748
+ }
2749
+ else {
2750
+ const errorMessage = 'Invalid ticket data received before submission.';
2751
+ console.error(errorMessage, event.detail);
2752
+ this.submitError.emit({
2753
+ message: errorMessage,
2754
+ dataOrigin: event.detail,
2755
+ status: 400 // Bad Request
2756
+ });
2757
+ }
2758
+ }
2759
+ isValidTicketSubmitParam(detail) {
2760
+ return (detail &&
2761
+ Array.isArray(detail.tickets) &&
2762
+ detail.tickets.length > 0 &&
2763
+ detail.tickets.every((ticket) => this.isValidTicketParam(ticket)));
2764
+ }
2765
+ isValidTicketParam(ticket) {
2766
+ return (ticket &&
2767
+ ticket.gameName !== undefined &&
2768
+ ticket.startingDrawId !== undefined &&
2769
+ ticket.amount !== undefined &&
2770
+ ticket.currency !== undefined &&
2771
+ ticket.selection !== undefined);
2772
+ }
2773
+ async handleSubmitTickets(body) {
2774
+ try {
2775
+ this.submitLoading = true;
2776
+ const res = await fetchRequest(`${this.endpoint}/tickets`, 'POST', body, {
2777
+ Authorization: `Bearer ${this.sessionId}`
2778
+ });
2779
+ if (!res.tickets.every((ticket) => ticket.state === TicketStatus.PURCHASED)) {
2780
+ this.submitError.emit({
2781
+ message: 'Failed to purchase ticket',
2782
+ dataOrigin: res,
2783
+ status: 200
2784
+ });
2785
+ }
2786
+ else {
2787
+ this.submitSuccess.emit({
2788
+ dataOrigin: res,
2789
+ status: 200
2790
+ });
2791
+ }
2792
+ }
2793
+ catch (e) {
2794
+ if (e.status === 401) {
2795
+ this.sessionExpired.emit();
2796
+ }
2797
+ if (e.status > 300 || !e.status) {
2798
+ this.submitError.emit({
2799
+ dataOrigin: e,
2800
+ status: e.status || 0
2801
+ });
2802
+ }
2803
+ }
2804
+ finally {
2805
+ this.submitLoading = false;
2806
+ }
2807
+ }
2808
+ handleSubmit() {
2809
+ this.orderSummarySubmit.emit();
2810
+ }
2811
+ render() {
2812
+ return (h("div", { key: 'bdab321b9336f47e16057d240b3226d7cba59b97', ref: (el) => (this.stylingContainer = el) }, h("div", { key: 'de7ffcc9f96d8c7cfc7bdb3a3c7225ee78c33483', class: "order-summary" }, h("h3", { key: '9500cd69a6eba0855d4981cdad8eaa91b9c98567', class: "order-summary__title" }, this.orderSummaryTitle), h("div", { key: 'ce29c82eef1d12bc63e94e4fa2d5474700860af2', class: "order-summary__ticket" }, h("div", { key: '9db79da17590c7f847f46c3b3b66489ea9a0e268', class: "order-summary__ticket-info" }, h("div", { key: '4b5a2df807aeb421cf3c1ebf33f410a92f39ccaf', class: "order-summary__ticket-label" }, h("div", { key: 'feb73e9f849d2e3d6b77e4c848657f27e6a82323', class: "order-summary__ticket" }, this.ticketsLabel), h("span", { key: '51f70dcdda2154d8ce97d8e1a7c0f61a6198afbb', class: "order-summary__colon" }, this.showColon ? ':' : null)), h("div", { key: '4fed2d63cd7a881c8844055fe1fde99c8c7aa9fb', class: "order-summary__details" }, h("slot", { key: '6a7969738546ee4aca81a075f6174556e78d2c31', name: "orderSummaryTicketDetail" }))), this.showDivider && h("hr", { key: '029803fa93960d5098a24d5ca18e77e14562b29f', class: "order-summary__divider" }), h("div", { key: '738096c5b605a97851dbf24a972d93d9533ad48b', class: "order-summary__ticket-info" }, h("div", { key: 'acd8a7f3e64c97f58c79f57a90143151c996abf8', class: "order-summary__ticket-label" }, h("div", { key: '44e6b29978ca4fc2b22ca9d95ee4facfc883f292', class: "order-summary__ticket" }, this.totalLabel), h("span", { key: '330a00a4b39e578a1b0d80211d2b68d44c5235c9', class: "order-summary__colon" }, this.showColon ? ':' : null)), h("span", { key: '294046815a62a80366458aade4ec5d5476577a93', class: "order-summary__details" }, h("slot", { key: '02d129ef0caf523ec0c9da34318df46d3b008376', name: "orderSummaryTotalDetail" })))), h("slot", { key: '9395396883f0594ad8db216a9aa9fa0aeff45c10', name: "orderSummaryChoice" }), h("div", { key: '462672abc490cde00fea90ea585f48875ca2ec47', class: "order-summary__button-wrapper" }, h("lottery-button", { key: '1885bee3570ce6b58d4ae1977c635f418485fdbe', onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: this.submitDisabled, text: this.submitButtonText })))));
2813
+ }
2814
+ static get watchers() { return {
2815
+ "clientStyling": ["handleClientStylingChange"],
2816
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2817
+ "mbSource": ["handleMbSourceChange"]
2818
+ }; }
2819
+ };
2820
+ LotteryOrderSummary.style = LotteryOrderSummaryStyle0;
2821
+
2822
+ // This icon file is generated automatically.
2823
+ var DeleteFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M864 256H736v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zm-200 0H360v-72h304v72z" } }] }, "name": "delete", "theme": "filled" };
2824
+ const DeleteFilled$1 = DeleteFilled;
2825
+
2826
+ // This icon file is generated automatically.
2827
+ var DeleteOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
2828
+ const DeleteOutlined$1 = DeleteOutlined;
2829
+
2830
+ // This icon file is generated automatically.
2831
+ var InfoCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" } }] }, "name": "info-circle", "theme": "outlined" };
2832
+ const InfoCircleOutlined$1 = InfoCircleOutlined;
2833
+
2834
+ // This icon file is generated automatically.
2835
+ var LeftOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" } }] }, "name": "left", "theme": "outlined" };
2836
+ const LeftOutlined$1 = LeftOutlined;
2837
+
2838
+ // This icon file is generated automatically.
2839
+ var LoadingOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, "name": "loading", "theme": "outlined" };
2840
+ const LoadingOutlined$1 = LoadingOutlined;
2841
+
2842
+ // This icon file is generated automatically.
2843
+ var PlusSquareOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "plus-square", "theme": "outlined" };
2844
+ const PlusSquareOutlined$1 = PlusSquareOutlined;
2845
+
2846
+ // This icon file is generated automatically.
2847
+ var RightOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" };
2848
+ const RightOutlined$1 = RightOutlined;
2849
+
2850
+ var __assign = (undefined && undefined.__assign) || function () {
2851
+ __assign = Object.assign || function(t) {
2852
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
2853
+ s = arguments[i];
2854
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
2855
+ t[p] = s[p];
2856
+ }
2857
+ return t;
2858
+ };
2859
+ return __assign.apply(this, arguments);
2860
+ };
2861
+ var defaultColors = {
2862
+ primaryColor: '#333',
2863
+ secondaryColor: '#E6E6E6'
2864
+ };
2865
+ function renderIconDefinitionToSVGElement(icond, options) {
2866
+ if (options === void 0) { options = {}; }
2867
+ if (typeof icond.icon === 'function') {
2868
+ // two-tone
2869
+ var placeholders = options.placeholders || defaultColors;
2870
+ return renderAbstractNodeToSVGElement(icond.icon(placeholders.primaryColor, placeholders.secondaryColor), options);
2871
+ }
2872
+ // fill, outline
2873
+ return renderAbstractNodeToSVGElement(icond.icon, options);
2874
+ }
2875
+ function renderAbstractNodeToSVGElement(node, options) {
2876
+ var targetAttrs = node.tag === 'svg'
2877
+ ? __assign(__assign({}, node.attrs), (options.extraSVGAttrs || {})) : node.attrs;
2878
+ var attrs = Object.keys(targetAttrs).reduce(function (acc, nextKey) {
2879
+ var key = nextKey;
2880
+ var value = targetAttrs[key];
2881
+ var token = "".concat(key, "=\"").concat(value, "\"");
2882
+ acc.push(token);
2883
+ return acc;
2884
+ }, []);
2885
+ var attrsToken = attrs.length ? ' ' + attrs.join(' ') : '';
2886
+ var children = (node.children || [])
2887
+ .map(function (child) { return renderAbstractNodeToSVGElement(child, options); })
2888
+ .join('');
2889
+ if (children && children.length) {
2890
+ return "<".concat(node.tag).concat(attrsToken, ">").concat(children, "</").concat(node.tag, ">");
2891
+ }
2892
+ return "<".concat(node.tag).concat(attrsToken, " />");
2893
+ }
2894
+
2895
+ // Basic sanitization method for SVG content
2896
+ // This is NOT a complete XSS prevention for SVG, but prevents common attacks.
2897
+ function sanitizeSvg(svgString) {
2898
+ let sanitized = svgString.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // Remove <script> tags
2899
+ sanitized = sanitized.replace(/on[a-z]+=[\"'][^\"']*[\"']/gi, ''); // Remove on* attributes
2900
+ sanitized = sanitized.replace(/javascript:/gi, ''); // Remove javascript: URLs
2901
+ return sanitized;
2902
+ }
2903
+
2904
+ const lotterySelectionCss = ":host{display:inline-block}.lottery-selection__button{display:flex;align-items:center;justify-content:center;width:var(--lottery-selection-width, 32px);height:var(--lottery-selection-height, 32px);padding:var(--lottery-selection-padding, 0);box-sizing:border-box;background:var(--lottery-selection-background, var(--emw--color-background, #fff));border:var(--lottery-selection-border-width, 2px) var(--lottery-selection-border-style, solid) var(--lottery-selection-border-color, var(--emw--color-primary, #0d196e));border-radius:var(--lottery-selection-border-radius, var(--emw--border-radius-medium, 8px));color:var(--lottery-selection-color, var(--emw--color-typography, #000));font-weight:var(--lottery-selection-font-weight, bold);font-size:var(--lottery-selection-font-size, 1em);cursor:pointer;user-select:none;}.lottery-selection__button:hover{background:var(--lottery-selection-hover-background, var(--emw--color-background, #fff));border-color:var(--lottery-selection-hover-border-color, var(--emw--color-primary, #0d196e));color:var(--lottery-selection-hover-color, var(--emw--color-typography, #000))}.lottery-selection__button .lottery-selection__delete-icon{display:none}.lottery-selection__button.isDeleteByIcon:hover .lottery-selection__text{display:none}.lottery-selection__button.isDeleteByIcon:hover .lottery-selection__delete-icon{display:flex;align-items:center;justify-content:center;fill:var(--lottery-selection-delete-icon-color, var(--emw--color-typography, #000));vertical-align:middle}.lottery-selection__button.lottery-selection__button--selected{background-color:var(--lottery-selection-selected-background, var(--emw--color-primary, #0d196e));border-color:var(--lottery-selection-selected-border-color, var(--emw--color-primary, #0d196e));color:var(--lottery-selection-selected-color, var(--emw--color-typography-inverse, #fff))}.lottery-selection__button.lottery-selection__button--disabled{background-color:var(--lottery-selection-disabled-background, var(--emw--color-gray-50, #f5f5f5));border-color:var(--lottery-selection-disabled-border-color, var(--emw--color-gray-100, #e6e6e6));color:var(--lottery-selection-disabled-color, var(--emw--color-gray-150, #6f6f6f));cursor:not-allowed;pointer-events:none;}.lottery-selection__button.lottery-selection__button--no-border{border:none}.lottery-selection__button.lottery-selection__button--no-background{background:transparent}";
2905
+ const LotterySelectionStyle0 = lotterySelectionCss;
2906
+
2907
+ const LotterySelection = class {
2908
+ constructor(hostRef) {
2909
+ registerInstance(this, hostRef);
2910
+ this.lotteryBulletClickHandler = createEvent(this, "lotteryBulletClick", 7);
2911
+ this.value = 0;
2912
+ this.text = undefined;
2913
+ this.idx = undefined;
2914
+ this.type = 'toggle';
2915
+ this.mbSource = undefined;
2916
+ this.clientStyling = undefined;
2917
+ this.clientStylingUrl = undefined;
2918
+ this.hasBorder = true;
2919
+ this.hasBackground = true;
2920
+ this.deleteIconSvg = '';
2921
+ this.deleteIconWidth = '16px';
2922
+ this.deleteIconHeight = '16px';
2923
+ }
2924
+ handleClientStylingChange(newValue, oldValue) {
2925
+ if (newValue !== oldValue) {
2926
+ setClientStyling(this.stylingContainer, this.clientStyling);
2927
+ }
2928
+ }
2929
+ handleClientStylingUrlChange(newValue, oldValue) {
2930
+ if (newValue !== oldValue) {
2931
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2932
+ }
2933
+ }
2934
+ handleMbSourceChange(newValue, oldValue) {
2935
+ if (newValue !== oldValue) {
2936
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2937
+ }
2938
+ }
2939
+ componentDidLoad() {
2940
+ if (this.stylingContainer) {
2941
+ if (this.mbSource)
2942
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2943
+ if (this.clientStyling)
2944
+ setClientStyling(this.stylingContainer, this.clientStyling);
2945
+ if (this.clientStylingUrl)
2946
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2947
+ }
2948
+ }
2949
+ disconnectedCallback() {
2950
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2951
+ }
2952
+ handleClick() {
2953
+ if (this.type === 'disabled' || this.type === 'readonly') {
2954
+ return;
2955
+ }
2956
+ console.log('bullet clicked', this.type, this.idx, this.text, this.value);
2957
+ this.lotteryBulletClickHandler.emit({
2958
+ type: this.type,
2959
+ idx: this.idx,
2960
+ text: this.text,
2961
+ value: this.value
2962
+ });
2963
+ }
2964
+ render() {
2965
+ let iconToRender;
2966
+ if (this.deleteIconSvg) {
2967
+ iconToRender = sanitizeSvg(this.deleteIconSvg);
2968
+ }
2969
+ else {
2970
+ iconToRender = renderIconDefinitionToSVGElement(DeleteFilled$1, {
2971
+ extraSVGAttrs: {
2972
+ width: this.deleteIconWidth,
2973
+ height: this.deleteIconHeight,
2974
+ fill: 'currentColor'
2975
+ }
2976
+ });
2977
+ }
2978
+ return (h("div", { key: '0d1e8aaa80a907a7467410f6b27b4b6175e82299', class: "lottery-selection", ref: (el) => (this.stylingContainer = el) }, h("button", { key: '11a2402abbc290dc877ad95f3433092c3a0d8419', class: {
2979
+ 'lottery-selection__button': true,
2980
+ 'lottery-selection__button--selected': this.value == 1,
2981
+ 'lottery-selection__button--disabled': this.type === 'disabled',
2982
+ 'lottery-selection__button--no-border': !this.hasBorder,
2983
+ 'lottery-selection__button--no-background': !this.hasBackground,
2984
+ isDeleteByIcon: this.type === 'delete',
2985
+ isCallDialogBtn: this.type === 'input' || this.type === 'readonly'
2986
+ }, onClick: this.handleClick.bind(this), disabled: this.type === 'disabled' }, this.type === 'delete' && h("span", { key: 'f99001d936a8f7bdf8adc5c46e82caf730a9442a', class: "lottery-selection__delete-icon", innerHTML: iconToRender }), h("span", { key: '55775e2492a1fe45cc8a457ac0a0d206744461ab', class: "lottery-selection__text" }, this.text))));
2987
+ }
2988
+ static get watchers() { return {
2989
+ "clientStyling": ["handleClientStylingChange"],
2990
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2991
+ "mbSource": ["handleMbSourceChange"]
2992
+ }; }
2993
+ };
2994
+ LotterySelection.style = LotterySelectionStyle0;
2995
+
2996
+ const DEFAULT_LANGUAGE$2 = 'en';
2997
+ const SUPPORTED_LANGUAGES$2 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
2998
+ const TRANSLATIONS$2 = {
2999
+ en: {
3000
+ noTicketBoard: 'No ticket board available.',
3001
+ selectionCleared: 'Your selection has been cleared.',
3002
+ clearAll: 'Clear All',
3003
+ stopAt: 'Stop at',
3004
+ turnover: 'Turnover: ',
3005
+ pleaseFillIn: 'Please fill in all the selection input!',
3006
+ fillIn: 'Fill in',
3007
+ noBets: 'Sorry. No bets have been placed so far. Check back later!',
3008
+ search: 'Search',
3009
+ clear: 'Clear',
3010
+ oddsChart: 'Odds Chart',
3011
+ ticketSuccess: 'Ticket purchased successfully.',
3012
+ stakePerLine: 'Stake per Line:',
3013
+ lowestOdds: 'Lowest Odds:',
3014
+ highestOdds: 'Highest Odds:',
3015
+ orderSummary: 'ORDER SUMMARY',
3016
+ ticket: 'Ticket',
3017
+ lines: 'Lines',
3018
+ total: 'Total',
3019
+ submit: 'Submit',
3020
+ loading: 'Loading',
3021
+ enterValidNumber: 'Please enter a valid number.',
3022
+ enterNumberBetween: 'Please enter a number between {min} and {max}.',
3023
+ numberAlreadySelected: 'This number has already been selected.',
3024
+ enterScoreUpTo: 'Please enter the score (Up to {maxScore})',
3025
+ enterValue: 'Please enter a value',
3026
+ myChoices: 'My Choices',
3027
+ teams: 'Teams',
3028
+ scores: 'Scores',
3029
+ euro: 'Euro',
3030
+ cancel: 'Cancel',
3031
+ confirm: 'Confirm'
3032
+ },
3033
+ ro: {},
3034
+ fr: {},
3035
+ ar: {},
3036
+ hr: {}
3037
+ };
3038
+ const translate$2 = (key, customLang, replacements) => {
3039
+ const lang = customLang;
3040
+ let translation = TRANSLATIONS$2[lang !== undefined && SUPPORTED_LANGUAGES$2.includes(lang) ? lang : DEFAULT_LANGUAGE$2][key];
3041
+ if (replacements) {
3042
+ Object.keys(replacements).forEach((placeholder) => {
3043
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
3044
+ });
3045
+ }
3046
+ return translation;
3047
+ };
3048
+ const getTranslations$2 = (data) => {
3049
+ Object.keys(data).forEach((item) => {
3050
+ for (let key in data[item]) {
3051
+ TRANSLATIONS$2[item][key] = data[item][key];
3052
+ }
3053
+ });
3054
+ };
3055
+
3056
+ function getBulletTextsSet(bulletTexts, splitToken) {
3057
+ return new Set(bulletTexts ? bulletTexts.split(splitToken) : []);
3058
+ }
3059
+ function validateInput({ value, selectedSet, maxValue, minValue, language, type = 'integer' }) {
3060
+ const trimmedValue = value.trim();
3061
+ if (type === 'integer') {
3062
+ // Strict integer check
3063
+ if (!/^-?\d+$/.test(trimmedValue)) {
3064
+ return {
3065
+ valid: false,
3066
+ errorMessage: translate$2('enterValidNumber', language),
3067
+ value
3068
+ };
3069
+ }
3070
+ const numValue = Number(trimmedValue);
3071
+ if (isNaN(numValue)) {
3072
+ return {
3073
+ valid: false,
3074
+ errorMessage: translate$2('enterValidNumber', language),
3075
+ value
3076
+ };
3077
+ }
3078
+ if ((minValue !== undefined && numValue < minValue) || (maxValue !== undefined && numValue > maxValue)) {
3079
+ return {
3080
+ valid: false,
3081
+ errorMessage: translate$2('enterNumberBetween', language, {
3082
+ min: minValue,
3083
+ max: maxValue
3084
+ }),
3085
+ value
3086
+ };
3087
+ }
3088
+ // Normalize value (e.g. "05" -> "5") for set check
3089
+ const normalizedValue = String(numValue);
3090
+ if (selectedSet.has(normalizedValue)) {
3091
+ return {
3092
+ valid: false,
3093
+ errorMessage: translate$2('numberAlreadySelected', language),
3094
+ value
3095
+ };
3096
+ }
3097
+ }
3098
+ else {
3099
+ // Text mode validation
3100
+ if (selectedSet.has(trimmedValue)) {
3101
+ return {
3102
+ valid: false,
3103
+ errorMessage: translate$2('numberAlreadySelected', language), // Or generic 'alreadySelected' if available, but reusing key for now
3104
+ value
3105
+ };
3106
+ }
3107
+ }
3108
+ return {
3109
+ valid: true,
3110
+ errorMessage: '',
3111
+ value
3112
+ };
3113
+ }
3114
+ function removeBulletTexts(text, selectedArr) {
3115
+ return selectedArr.filter((s) => s !== text);
3116
+ }
3117
+ function addSelectedBulletTexts(text, selectedArr) {
3118
+ return selectedArr.concat([text]);
3119
+ }
3120
+ function removeAndAddSelectedBulletTexts(text, selectedArr, maxSelectedCount) {
3121
+ return selectedArr.slice(selectedArr.length - (maxSelectedCount - 1)).concat([text]);
3122
+ }
3123
+ function buildSelectedBulletTextsArr(item, selectedArr, maxSelectedCount) {
3124
+ if (item.type === 'delete') {
3125
+ return removeBulletTexts(item.text, selectedArr);
3126
+ }
3127
+ if (item.type === 'toggle') {
3128
+ if (selectedArr.includes(item.text)) {
3129
+ return removeBulletTexts(item.text, selectedArr);
3130
+ }
3131
+ if (selectedArr.length >= maxSelectedCount) {
3132
+ return removeAndAddSelectedBulletTexts(item.text, selectedArr, maxSelectedCount);
3133
+ }
3134
+ return addSelectedBulletTexts(item.text, selectedArr);
3135
+ }
3136
+ return [];
3137
+ }
3138
+
3139
+ const lotterySelectionGroupCss = ":host {\n width: 100%;\n}\n\n.lottery-selection-group {\n container-type: inline-size;\n padding: var(--lottery-selection-group-padding, 0);\n background: var(--lottery-selection-group-background, transparent);\n border: var(--lottery-selection-group-border, none);\n border-radius: var(--lottery-selection-group-border-radius, 0);\n}\n.lottery-selection-group__item {\n display: flex;\n flex-direction: var(--lottery-selection-group-flex-direction, row);\n align-items: var(--lottery-selection-group-item-align, center);\n justify-content: var(--lottery-selection-group-item-justify, flex-start);\n gap: var(--lottery-selection-group-item-gap, 16px);\n width: 100%;\n}\n.lottery-selection-group__item--left {\n width: var(--lottery-selection-group-label-width, 130px);\n min-width: var(--lottery-selection-group-label-min-width, auto);\n max-width: var(--lottery-selection-group-label-max-width, none);\n color: var(--lottery-selection-group-label-color, var(--emw--color-typography, #000));\n font-size: var(--lottery-selection-group-label-font-size, 1em);\n font-weight: var(--lottery-selection-group-label-font-weight, bold);\n text-align: var(--lottery-selection-group-label-align, left);\n white-space: var(--lottery-selection-group-label-white-space, normal);\n}\n.lottery-selection-group__item--right {\n flex: 1;\n display: flex;\n flex-wrap: var(--lottery-selection-group-bullets-wrap, wrap); /* Allow items to wrap */\n gap: var(--lottery-selection-group-bullets-gap, 8px); /* Gap between bullets */\n align-items: var(--lottery-selection-group-bullets-align, center);\n justify-content: var(--lottery-selection-group-bullets-justify, flex-start); /* Align bullets to start */\n}\n@container (max-width: 320px) {\n .lottery-selection-group__item--left {\n width: 100px;\n max-width: 100px;\n }\n}\n\n.dialog-input {\n width: 100%;\n padding: var(--lottery-selection-group-input-padding, 8px);\n border: var(--lottery-selection-group-input-border-width, 1px) var(--lottery-selection-group-input-border-style, solid) var(--lottery-selection-group-input-border-color, var(--emw--color-gray-100, #e6e6e6));\n border-radius: var(--lottery-selection-group-input-radius, 4px);\n background-color: var(--lottery-selection-group-input-bg, #fff);\n color: var(--lottery-selection-group-input-color, #000);\n box-sizing: border-box;\n margin-top: var(--lottery-selection-group-input-margin-top, 10px);\n font-size: var(--lottery-selection-group-input-font-size, 1em);\n}\n.dialog-input::placeholder {\n color: var(--lottery-selection-group-input-placeholder-color, #999);\n}\n\n.dialog-input.invalid,\n.dialog-input.invalid:focus {\n border-color: var(--emw--color-error, #ff3d00);\n outline-color: var(--emw--color-error, #ff3d00);\n}\n\n.error-message {\n color: var(--lottery-selection-group-error-color, var(--emw--color-error, #ff3d00));\n font-size: var(--lottery-selection-group-error-font-size, 12px);\n font-weight: var(--lottery-selection-group-error-font-weight, normal);\n margin-top: 4px;\n}\n\n.addSelectionDialog-title {\n color: var(--lottery-selection-group-dialog-title-color, var(--emw--color-typography, #000));\n font-size: var(--lottery-selection-group-dialog-title-font-size, 1.2em);\n font-weight: var(--lottery-selection-group-dialog-title-font-weight, bold);\n margin-bottom: var(--lottery-selection-group-dialog-title-margin-bottom, 0);\n}\n.addSelectionDialog-footer {\n display: flex;\n justify-content: var(--lottery-selection-group-dialog-footer-justify, flex-end);\n gap: var(--lottery-selection-group-dialog-footer-gap, 18px);\n margin-top: var(--lottery-selection-group-dialog-footer-margin-top, 0);\n}";
3140
+ const LotterySelectionGroupStyle0 = lotterySelectionGroupCss;
3141
+
3142
+ const LotterySelectionGroup = class {
3143
+ constructor(hostRef) {
3144
+ registerInstance(this, hostRef);
3145
+ this.bulletGroupUpdateSelectedBulletTexts = createEvent(this, "bulletGroupUpdateSelection", 7);
3146
+ this.mbSource = undefined;
3147
+ this.clientStyling = undefined;
3148
+ this.clientStylingUrl = undefined;
3149
+ this.language = 'en';
3150
+ this.translationUrl = '';
3151
+ this.splitToken = ',';
3152
+ this.selectionGroupId = undefined;
3153
+ this.selectionGroupLabel = undefined;
3154
+ this.type = 'bet';
3155
+ this.selectedBulletTexts = null;
3156
+ this.maxSelectedCount = null;
3157
+ this.maxDisplayBulletsCount = 11;
3158
+ this.bulletTexts = null;
3159
+ this.maxIntegerBulletText = null;
3160
+ this.minIntegerBulletText = 0;
3161
+ this.bulletTextType = 'integer';
3162
+ this.hasBorder = true;
3163
+ this.hasBackground = true;
3164
+ this.dialogTitle = undefined;
3165
+ this.dialogInputPlaceholder = undefined;
3166
+ this.disabledBulletTexts = '';
3167
+ this.dialogConfig = {
3168
+ width: '400px',
3169
+ visible: false,
3170
+ onConfirm: () => this.handleFillInAddMore(),
3171
+ onCancel: () => this.handleCloseAddMoreDialog()
3172
+ };
3173
+ this.inputInfo = { valid: true, errorMessage: '', value: '' };
3174
+ }
3175
+ handleClientStylingChange(newValue, oldValue) {
3176
+ if (newValue != oldValue) {
3177
+ setClientStyling(this.stylingContainer, this.clientStyling);
3178
+ }
3179
+ }
3180
+ handleClientStylingUrlChange(newValue, oldValue) {
3181
+ if (newValue != oldValue) {
3182
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
3183
+ }
3184
+ }
3185
+ handleMbSourceChange(newValue, oldValue) {
3186
+ if (newValue != oldValue) {
3187
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
3188
+ }
3189
+ }
3190
+ componentWillLoad() {
3191
+ if (this.translationUrl) {
3192
+ getTranslations$2(JSON.parse(this.translationUrl));
3193
+ }
3194
+ }
3195
+ componentDidLoad() {
3196
+ if (this.stylingContainer) {
3197
+ if (this.mbSource)
3198
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
3199
+ if (this.clientStyling)
3200
+ setClientStyling(this.stylingContainer, this.clientStyling);
3201
+ if (this.clientStylingUrl)
3202
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
3203
+ }
3204
+ }
3205
+ disconnectedCallback() {
3206
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
3207
+ }
3208
+ lotteryBulletClickHandler(event) {
3209
+ event.stopPropagation();
3210
+ // if it's input type, open the dialog
3211
+ if (event.detail.type === 'input') {
3212
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: true });
3213
+ return;
3214
+ }
3215
+ if (['delete', 'toggle'].includes(event.detail.type)) {
3216
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
3217
+ newSelectedBulletTexts: buildSelectedBulletTextsArr(event.detail, Array.from(this.selectedSet), this.maxSelectedCount).join(this.splitToken),
3218
+ selectionGroupId: this.selectionGroupId
3219
+ });
3220
+ return;
3221
+ }
3222
+ }
3223
+ get selectedSet() {
3224
+ return getBulletTextsSet(this.selectedBulletTexts, this.splitToken);
3225
+ }
3226
+ get disabledSet() {
3227
+ return getBulletTextsSet(this.disabledBulletTexts, this.splitToken);
3228
+ }
3229
+ get bulletTextsSet() {
3230
+ if (this.bulletTexts)
3231
+ return getBulletTextsSet(this.bulletTexts, this.splitToken);
3232
+ if (this.bulletTextType === 'integer' &&
3233
+ this.maxIntegerBulletText !== null &&
3234
+ this.maxIntegerBulletText !== undefined) {
3235
+ return getBulletTextsSet(Array.from({ length: Number(this.lastDisplayBulletText) - this.minIntegerBulletText + 1 }, (_, index) => this.minIntegerBulletText + index).join(this.splitToken), this.splitToken);
3236
+ }
3237
+ // If neither bulletTexts nor maxIntegerBulletText are provided,
3238
+ return new Set();
3239
+ }
3240
+ // the last bullet text
3241
+ get lastDisplayBulletText() {
3242
+ if (this.bulletTextType === 'integer') {
3243
+ if (this.maxIntegerBulletText !== null && this.maxIntegerBulletText !== undefined) {
3244
+ return Math.min(this.maxIntegerBulletText, this.minIntegerBulletText + this.maxDisplayBulletsCount - 1);
3245
+ }
3246
+ return this.minIntegerBulletText + this.maxDisplayBulletsCount - 1;
3247
+ }
3248
+ // Text mode: return the text at the max display index if available
3249
+ if (this.bulletTextsSet.size > 0) {
3250
+ const texts = Array.from(this.bulletTextsSet);
3251
+ if (texts.length >= this.maxDisplayBulletsCount) {
3252
+ return texts[this.maxDisplayBulletsCount - 1];
3253
+ }
3254
+ return texts[texts.length - 1]; // If fewer than maxDisplayBulletsCount, return the last one
3255
+ }
3256
+ return null;
3257
+ }
3258
+ get isSingleSelectionMode() {
3259
+ return this.maxSelectedCount === 1;
3260
+ }
3261
+ getBulletToRender() {
3262
+ const allBulletTexts = Array.from(this.bulletTextsSet);
3263
+ // Determine which bullets to display based on type and limit
3264
+ let bulletsToRender = allBulletTexts;
3265
+ let showInputButton = false;
3266
+ if (this.bulletTextType === 'text') {
3267
+ // For text, if we have more items than the limit, we need an input button.
3268
+ // The input button takes one slot, so we show (limit - 1) items.
3269
+ if (allBulletTexts.length > this.maxDisplayBulletsCount) {
3270
+ showInputButton = true;
3271
+ bulletsToRender = allBulletTexts.slice(0, this.maxDisplayBulletsCount - 1);
3272
+ }
3273
+ else {
3274
+ bulletsToRender = allBulletTexts;
3275
+ }
3276
+ }
3277
+ else {
3278
+ // For integer, logic is based on maxIntegerBulletText vs displayed range
3279
+ showInputButton =
3280
+ this.maxIntegerBulletText !== null &&
3281
+ this.maxIntegerBulletText !== undefined &&
3282
+ this.maxIntegerBulletText > Number(this.lastDisplayBulletText);
3283
+ // Integer bullets generation already respects the count, no slicing needed on the raw set
3284
+ bulletsToRender = allBulletTexts;
3285
+ }
3286
+ return {
3287
+ bulletsToRender,
3288
+ showInputButton
3289
+ };
3290
+ }
3291
+ renderBulletGroup() {
3292
+ let items = [];
3293
+ if (this.type === 'bet') {
3294
+ const isMaxSelected = this.maxSelectedCount !== null && this.selectedSet.size >= this.maxSelectedCount;
3295
+ const { bulletsToRender, showInputButton } = this.getBulletToRender();
3296
+ bulletsToRender.forEach((text, idx) => {
3297
+ let bulletType = 'toggle';
3298
+ if (this.disabledSet.has(String(text))) {
3299
+ bulletType = 'disabled';
3300
+ }
3301
+ else if (!this.selectedSet.has(String(text)) && isMaxSelected && !this.isSingleSelectionMode) {
3302
+ bulletType = 'disabled';
3303
+ }
3304
+ items.push({
3305
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
3306
+ text: String(text),
3307
+ idx,
3308
+ type: bulletType
3309
+ });
3310
+ });
3311
+ if (showInputButton) {
3312
+ let inputBulletType = 'input';
3313
+ if (isMaxSelected && !this.isSingleSelectionMode) {
3314
+ inputBulletType = 'disabled';
3315
+ }
3316
+ const inputButtonText = this.bulletTextType === 'text' ? '...' : `${this.lastDisplayBulletText}+`;
3317
+ const inputButtonIdx = this.bulletTextType === 'text' ? -1 : Number(this.lastDisplayBulletText) + 1;
3318
+ // Special handling for integer mode:
3319
+ // If the generated set is "full" (size == maxDisplayBulletsCount),
3320
+ // we need to remove the last item to make room for the "N+" button
3321
+ // so the total visual count remains consistent.
3322
+ if (this.bulletTextType === 'integer' && items.length >= this.maxDisplayBulletsCount) {
3323
+ items.pop();
3324
+ }
3325
+ items.push({
3326
+ value: 0,
3327
+ text: inputButtonText,
3328
+ idx: inputButtonIdx,
3329
+ type: inputBulletType
3330
+ });
3331
+ }
3332
+ }
3333
+ else if (['choice', 'preview'].includes(this.type)) {
3334
+ // For choice/preview, also respect the visual limit for text mode
3335
+ const { bulletsToRender } = this.getBulletToRender();
3336
+ bulletsToRender.forEach((text, idx) => {
3337
+ let bulletType = 'toggle';
3338
+ if (this.disabledSet.has(String(text))) {
3339
+ bulletType = 'disabled';
3340
+ }
3341
+ else if (this.type === 'preview') {
3342
+ bulletType = 'readonly';
3343
+ }
3344
+ else if (this.selectedSet.has(String(text))) {
3345
+ bulletType = 'delete';
3346
+ }
3347
+ items.push({
3348
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
3349
+ text,
3350
+ idx,
3351
+ type: bulletType
3352
+ });
3353
+ });
3354
+ }
3355
+ return (h("div", { class: "lottery-selection-group__item--right" }, items.map((item) => {
3356
+ return (h("lottery-selection", { clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource, text: item.text, idx: item.idx, value: item.value, type: item.type, hasBorder: this.hasBorder, hasBackground: this.hasBackground }));
3357
+ })));
3358
+ }
3359
+ handleCloseAddMoreDialog() {
3360
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: false });
3361
+ this.inputInfo = { value: '', errorMessage: '', valid: true };
3362
+ }
3363
+ handleInputChange(e) {
3364
+ const inputElement = e.target;
3365
+ const value = inputElement.value;
3366
+ this.inputInfo = Object.assign(Object.assign({}, this.inputInfo), { value: value });
3367
+ this.inputInfo = validateInput({
3368
+ value,
3369
+ selectedSet: this.selectedSet,
3370
+ maxValue: this.maxIntegerBulletText,
3371
+ minValue: this.bulletTextType === 'integer' ? Number(this.lastDisplayBulletText) + 1 : undefined,
3372
+ language: this.language,
3373
+ type: this.bulletTextType
3374
+ });
3375
+ }
3376
+ handleFillInAddMore() {
3377
+ if (this.inputInfo.valid) {
3378
+ const { value } = this.inputInfo;
3379
+ // Normalize the value (e.g., "05" -> "5") to match validation logic
3380
+ let normalizedValue = value;
3381
+ if (this.bulletTextType === 'integer') {
3382
+ normalizedValue = String(Number(value));
3383
+ }
3384
+ else {
3385
+ normalizedValue = value.trim();
3386
+ }
3387
+ let newSelectedBulletTexts;
3388
+ if (this.isSingleSelectionMode) {
3389
+ newSelectedBulletTexts = normalizedValue;
3390
+ }
3391
+ else {
3392
+ newSelectedBulletTexts = addSelectedBulletTexts(normalizedValue, Array.from(this.selectedSet)).join(this.splitToken);
3393
+ }
3394
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
3395
+ newSelectedBulletTexts,
3396
+ selectionGroupId: this.selectionGroupId
3397
+ });
3398
+ this.handleCloseAddMoreDialog();
3399
+ }
3400
+ }
3401
+ render() {
3402
+ return (h("div", { key: '39225bad75cf435b166269367df570732eff7ef4', class: "lottery-selection-group", ref: (el) => (this.stylingContainer = el) }, h("div", { key: '2bb2bc539c9fc05aeece7145b13f722756bc054e', class: "lottery-selection-group__item" }, this.selectionGroupLabel && (h("div", { key: 'dc15197dca90375bd4eb50e87d96402d1ef694d2', class: "lottery-selection-group__item--left" }, this.selectionGroupLabel)), this.renderBulletGroup()), h("lottery-tipping-dialog", { key: '9526dbb5d1656d6724e6566465febde778437c64', visible: this.dialogConfig.visible, width: this.dialogConfig.width, onCancel: this.dialogConfig.onCancel }, h("div", { key: 'ecf5800430e92be4a2af279f1d8c5075d5965b7e', class: "addSelectionDialog" }, h("div", { key: '3e8a2f445679ef5fe2ada60d4a6832f472f27dfa', class: "addSelectionDialog-title" }, this.dialogTitle ||
3403
+ (this.bulletTextType === 'text'
3404
+ ? translate$2('enterValue', this.language)
3405
+ : translate$2('enterScoreUpTo', this.language, {
3406
+ maxScore: this.maxIntegerBulletText
3407
+ }))), h("input", { key: '46462ee8f27410639d45970a76fc3d90a03f3a10', type: "text", class: {
3408
+ 'dialog-input': true,
3409
+ invalid: !this.inputInfo.valid
3410
+ }, value: this.inputInfo.value, onInput: this.handleInputChange.bind(this), placeholder: this.dialogInputPlaceholder }), h("div", { key: '2e66988e4186f8f4f773ed548fc76e53085be946', class: "error-message" }, this.inputInfo.errorMessage)), h("div", { key: '81dc64f0b7cba422a54af8ecff4734aa19832583', slot: "footer", class: "addSelectionDialog-footer" }, h("lottery-button", { key: '3027240894aef525dc9fc50db79597cf29f9cb99', onClick: this.dialogConfig.onCancel, text: translate$2('cancel', this.language), variant: "outline" }), h("lottery-button", { key: 'ab8c6deed9ab4a7d79d71ed6fe8122b23af5741b', onClick: this.dialogConfig.onConfirm, text: translate$2('confirm', this.language), variant: "primary", disabled: !this.inputInfo.valid || !this.inputInfo.value })))));
3411
+ }
3412
+ static get watchers() { return {
3413
+ "clientStyling": ["handleClientStylingChange"],
3414
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
3415
+ "mbSource": ["handleMbSourceChange"]
3416
+ }; }
3417
+ };
3418
+ LotterySelectionGroup.style = LotterySelectionGroupStyle0;
3419
+
3420
+ const DEFAULT_LANGUAGE$1 = 'en';
3421
+ const SUPPORTED_LANGUAGES$1 = ['ro', 'en', 'fr', 'ar', 'hr'];
3422
+ const TRANSLATIONS$1 = {
3423
+ en: {
3424
+ homeTeam: 'Home team:',
3425
+ awayTeam: 'Away team:',
3426
+ loading: 'Loading...',
3427
+ error: 'Error!',
3428
+ noData: 'No data available.',
3429
+ lineInfo: 'Line {currentPage} of {totalPages}',
3430
+ clearAll: 'Clear All'
3431
+ },
3432
+ ro: {
3433
+ homeTeam: 'Echipa gazdă:',
3434
+ awayTeam: 'Echipa oaspete:',
3435
+ selectionCleared: 'Selecția dvs. a fost ștearsă.',
3436
+ selectionOnLineCleared: 'Selecția dvs. de pe această linie va fi ștearsă.',
3437
+ loading: `Se încarcă...',n error: 'Eroare!`,
3438
+ noData: 'Nu sunt date disponibile.',
3439
+ lineInfo: 'Linia {currentPage} din {totalPages}',
3440
+ clearAll: 'Șterge tot',
3441
+ cancel: 'Anulează',
3442
+ confirm: 'Confirmă'
3443
+ },
3444
+ fr: {
3445
+ homeTeam: 'Équipe à domicile:',
3446
+ awayTeam: `Équipe à l'extérieur:`,
3447
+ selectionCleared: 'Votre sélection a été effacée.',
3448
+ selectionOnLineCleared: 'Votre sélection sur cette ligne sera effacée.',
3449
+ loading: `Chargement...',n error: 'Erreur!`,
3450
+ noData: 'Aucune donnée disponible.',
3451
+ lineInfo: 'Ligne {currentPage} sur {totalPages}',
3452
+ clearAll: 'Tout effacer',
3453
+ cancel: 'Annuler',
3454
+ confirm: 'Confirmer'
3455
+ },
3456
+ ar: {
3457
+ homeTeam: 'الفريق المضيف:',
3458
+ awayTeam: 'الفريق الضيف:',
3459
+ selectionCleared: 'تم مسح اختيارك.',
3460
+ selectionOnLineCleared: 'سيتم مسح اختيارك في هذا السطر.',
3461
+ loading: `جار التحميل...',n error: 'خطأ!`,
3462
+ noData: 'لا توجد بيانات متاحة.',
3463
+ lineInfo: 'السطر {currentPage} من {totalPages}',
3464
+ clearAll: 'مسح الكل',
3465
+ cancel: 'إلغاء',
3466
+ confirm: 'تأكيد'
3467
+ },
3468
+ hr: {
3469
+ homeTeam: 'Domaći tim:',
3470
+ awayTeam: 'Gostujući tim:',
3471
+ selectionCleared: 'Vaš odabir je obrisan.',
3472
+ selectionOnLineCleared: 'Vaš odabir na ovoj liniji bit će obrisan.',
3473
+ loading: `Učitavanje...',n error: 'Greška!`,
3474
+ noData: 'Nema dostupnih podataka.',
3475
+ lineInfo: 'Linija {currentPage} od {totalPages}',
3476
+ clearAll: 'Očisti sve',
3477
+ cancel: 'Odustani',
3478
+ confirm: 'Potvrdi'
3479
+ }
3480
+ };
3481
+ const translate$1 = (key, customLang, replacements) => {
3482
+ const lang = customLang;
3483
+ let translation = TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
3484
+ if (replacements) {
3485
+ Object.keys(replacements).forEach((placeholder) => {
3486
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
3487
+ });
3488
+ }
3489
+ return translation;
3490
+ };
3491
+ const getTranslations$1 = (data) => {
3492
+ Object.keys(data).forEach((item) => {
3493
+ for (let key in data[item]) {
3494
+ TRANSLATIONS$1[item][key] = data[item][key];
3495
+ }
3496
+ });
3497
+ };
3498
+ const resolveTranslationUrl$1 = async (translationUrl) => {
3499
+ if (translationUrl) {
3500
+ try {
3501
+ const response = await fetch(translationUrl);
3502
+ if (!response.ok) {
3503
+ throw new Error(`HTTP error! status: ${response.status}`);
3504
+ }
3505
+ const translations = await response.json();
3506
+ getTranslations$1(translations);
3507
+ }
3508
+ catch (error) {
3509
+ console.error('Failed to fetch or parse translations from URL:', error);
3510
+ }
3511
+ }
3512
+ };
3513
+
3514
+ const formatDate = ({ date, type = 'date', format: format$1 }) => {
3515
+ try {
3516
+ const parsedDate = parseISO(date);
3517
+ if (isNaN(parsedDate.getTime())) {
3518
+ throw new Error(`Invalid date: ${date}`);
3519
+ }
3520
+ if (format$1)
3521
+ return format(parsedDate, format$1);
3522
+ let formatStr = 'dd/MM/yyyy';
3523
+ if (type === 'time') {
3524
+ formatStr = 'dd/MM/yyyy HH:mm:ss';
3525
+ }
3526
+ else if (type === 'week') {
3527
+ formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
3528
+ }
3529
+ return format(parsedDate, formatStr);
3530
+ }
3531
+ catch (error) {
3532
+ console.error('Error formatting date:', error.message);
3533
+ return '';
3534
+ }
3535
+ };
3536
+
3537
+ const lotteryTippingBetSlipCss = ":host {\n --lottery-button-border-radius: 16px;\n}\n\n.LotteryTippingTicketBet__container {\n display: block; /* Or inline-block, depending on desired layout flow */\n font-size: 14px;\n padding: 12px;\n border: 1px solid var(--emw--color-gray-100, #e6e6e6);\n border-radius: var(--emw--button-border-radius, 4px);\n line-height: 1.5715;\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n overflow: hidden;\n min-width: 300px;\n container-type: inline-size;\n}\n@container (max-width: 375px) {\n .LotteryTippingTicketBet__container {\n font-size: 12px;\n }\n}\n\n.table-wrapper {\n overflow-x: auto; /* Handle horizontal scroll if content overflows */\n}\n\n.LotteryTippingTicketBet__main {\n overflow: hidden;\n}\n\n.table-scroll-wrapper {\n overflow-x: auto;\n flex-grow: 1;\n min-width: 0;\n}\n\n.my-table-component {\n width: 100%;\n border-collapse: collapse; /* Important for borders */\n text-align: left;\n border-radius: 0.1rem; /* Ant Design like subtle rounding */\n border-spacing: 0;\n}\n\n/* Header */\n.my-table-component th {\n background: var(--emw--color-background-secondary, #f5f5f5);\n color: var(--emw--color-typography, #000);\n font-weight: 500;\n padding: 0.4rem 0.5rem;\n transition: background 0.3s ease;\n}\n@container (max-width: 400px) {\n .my-table-component th {\n padding: 0.3rem 0.3rem;\n }\n}\n\n/* Cells */\n.my-table-component td {\n padding: 0.4rem 0.5rem;\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n transition: background 0.3s;\n}\n@container (max-width: 400px) {\n .my-table-component td {\n padding: 0.3rem 0.3rem;\n }\n}\n\n.my-table-component th:nth-child(1),\n.my-table-component td:nth-child(1) {\n /* index */\n min-width: 10px;\n}\n.my-table-component th:nth-child(3),\n.my-table-component td:nth-child(3) {\n /* startTime */\n min-width: 60px;\n}\n.my-table-component th:nth-child(4),\n.my-table-component td:nth-child(4) {\n /* results */\n min-width: 120px;\n}\n\n.my-table-component.bordered th,\n.my-table-component.bordered td {\n border-bottom: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n/* Bordered style */\n.my-table-component.grid th,\n.my-table-component.grid td {\n border: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n.my-table-component.grid th {\n border-bottom-width: 1px; /* Ensure bottom border is consistent */\n}\n\n.my-table-component.grid {\n border: 1px solid var(--emw--color-gray-100, #e6e6e6); /* Outer border */\n border-right-width: 0;\n border-bottom-width: 0;\n}\n\n.my-table-component.grid th:last-child,\n.my-table-component.grid td:last-child {\n border-right: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n.my-table-component.grid tr:last-child td {\n border-bottom: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n/* Striped style */\n.my-table-component.striped tbody tr:nth-child(even) td {\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n/* Hover (optional, but nice) */\n.my-table-component tbody tr:hover td {\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n.flex {\n display: flex;\n}\n\n.justify-end {\n justify-content: flex-end;\n}\n\n.gap-1 {\n gap: 4px;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.align-center {\n align-items: center;\n}\n\n.gap-1 {\n gap: 0.5rem;\n}\n\n.btn {\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n font-size: 14px;\n transition: all 0.2s ease;\n}\n.btn:hover {\n cursor: pointer;\n}\n\n.btn:hover {\n background-color: var(--emw--color-gray-100, #e6e6e6);\n}\n\n.btn.disabled {\n opacity: 0.5;\n pointer-events: none;\n}\n.btn.disabled:hover {\n cursor: not-allowed !important;\n}\n\n.LotteryTippingTicketBet__tableToolbar {\n width: 100%;\n margin-bottom: 1rem;\n}\n\n.LotteryTippingTicketBet__tableToolbar--item {\n margin-right: 2rem;\n}\n.LotteryTippingTicketBet__tableToolbar--item.mr-0 {\n margin-right: 0rem !important;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup {\n flex-basis: 2rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n border-radius: 8px;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 2rem;\n height: 2rem;\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n color: var(--emw--color-typography, #000);\n border-radius: 8px;\n border: none;\n transition: all 0.2s ease-in-out;\n cursor: pointer;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item:hover {\n transform: scale(1.1);\n box-shadow: 0 6px 14px var(--emw-calender-curday-box-shadow, rgba(0, 0, 0, 0.09));\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item .icon {\n width: 20px;\n height: 20px;\n transition: filter 0.2s ease-in-out;\n filter: grayscale(0.3);\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item:hover .icon {\n filter: grayscale(0);\n transform: rotate(3deg);\n}\n\ndiv.border-line {\n margin-top: 1rem;\n height: 1px;\n width: 100%;\n box-sizing: border-box;\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n transition: all 0.3s ease;\n}\n\n.LotteryTippingTicketBet__footer {\n padding: 0.5rem;\n}\n\n.my-pagination {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 1rem;\n font-size: 0.8rem;\n color: var(--emw--color-typography-secondary, #333);\n}\n\n.my-pagination span {\n font-weight: 500;\n user-select: none;\n}\n\n.my-pagination .btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n border: none;\n transition: all 0.3s ease;\n cursor: pointer;\n opacity: 0.9;\n color: var(--emw--color-typography, #000);\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n.my-pagination .btn .icon {\n width: 20px;\n height: 20px;\n transition: transform 0.2s ease;\n}\n\n.my-pagination .btn:hover {\n transform: scale(1.1);\n box-shadow: 0 6px 14px var(--emw-calender-curday-box-shadow, rgba(0, 0, 0, 0.09));\n}\n\n.my-pagination .btn.disabled {\n background-color: var(--emw--color-background-tertiary, #ccc);\n cursor: not-allowed;\n opacity: 0.5;\n transform: scale(1);\n}\n\n.match-info-item {\n display: flex;\n}\n\n.match-info-item-label {\n margin-right: 6px;\n}\n\n.info-icon:hover {\n cursor: pointer;\n}\n\n.LotteryTippingTicketBet__empty p {\n text-align: center;\n}\n\n.no-wrap {\n white-space: nowrap;\n overflow: hidden;\n}\n\n.eventNameContainer__item--title {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 300px;\n}\n@container (max-width: 600px) {\n .eventNameContainer__item--title {\n max-width: 180px;\n }\n}\n@container (max-width: 500px) {\n .eventNameContainer__item--title {\n max-width: 150px;\n }\n}\n@container (max-width: 400px) {\n .eventNameContainer__item--title {\n max-width: 100px;\n }\n}\n@container (max-width: 330px) {\n .eventNameContainer__item--title {\n max-width: 70px;\n }\n}\n\n.LotteryTippingTicketBet__main {\n perspective: 800px;\n will-change: transform, opacity;\n}\n\n@container (max-width: 520px) {\n .LotteryTippingTicketBet__main {\n flex-wrap: wrap;\n justify-content: center;\n }\n .LotteryTippingTicketBet__tableToolbar--item {\n margin-right: 0 !important;\n }\n}\n/* Fade-In Keyframes */\n@keyframes fadeInLeft {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n/* Fade-Out Keyframes */\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n@keyframes fadeInRight {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n@-webkit-keyframes slide-left {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n }\n 100% {\n -webkit-transform: translateX(-100px);\n transform: translateX(-100px);\n }\n}\n@keyframes slide-left {\n 0% {\n -webkit-transform: translateX(100%);\n transform: translateX(100%);\n }\n 100% {\n -webkit-transform: translateX(0px);\n transform: translateX(0px);\n }\n}\n@-webkit-keyframes slide-right {\n 0% {\n -webkit-transform: translateX(-100%);\n transform: translateX(-100%);\n }\n 100% {\n -webkit-transform: translateX(0px);\n transform: translateX(0px);\n }\n}\n@keyframes slide-right {\n 0% {\n -webkit-transform: translateX(-100px);\n transform: translateX(-100px);\n }\n 100% {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n }\n}\n@-webkit-keyframes slide-top {\n 0% {\n -webkit-transform: translateY(-100px);\n transform: translateY(-100px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slide-top {\n 0% {\n -webkit-transform: translateY(-100px);\n transform: translateY(-100px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n/* Apply to your card classes */\n.card-in-left {\n -webkit-animation: slide-left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-left {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.card-in-right {\n -webkit-animation: slide-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-right {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.card-in-up {\n -webkit-animation: slide-top 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-top 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-down {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.loading-wrap {\n margin: 20px 0;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 40vh;\n}\n.loading-wrap .dots-container {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n}\n.loading-wrap .dot {\n height: 14px;\n width: 14px;\n margin-right: 14px;\n border-radius: 14px;\n background-color: var(--emw--color-gray-300, #333);\n animation: pulse 1.5s infinite ease-in-out;\n}\n.loading-wrap .dot:last-child {\n margin-right: 0;\n}\n.loading-wrap .dot:nth-child(1) {\n animation-delay: -0.3s;\n}\n.loading-wrap .dot:nth-child(2) {\n animation-delay: -0.1s;\n}\n.loading-wrap .dot:nth-child(3) {\n animation-delay: 0.1s;\n}\n@keyframes pulse {\n 0% {\n transform: scale(0.8);\n background-color: var(--emw--color-gray-300, #333);\n }\n 50% {\n transform: scale(1.2);\n background-color: var(--emw--color-gray-100, #e6e6e6);\n }\n 100% {\n transform: scale(0.8);\n background-color: var(--emw--color-gray-150, #6f6f6f);\n }\n}\n\n.lottery-selection-group-table-header .lottery-selection__button {\n border: none;\n background: none;\n}";
3538
+ const LotteryTippingBetSlipStyle0 = lotteryTippingBetSlipCss;
3539
+
3540
+ const MyTable = ({ columns, dataSource, hideHead = false, grid = true, bordered = true }) => (h("table", { class: { bordered: bordered, grid: grid, 'my-table-component': true } }, !hideHead && (h("thead", null, h("tr", null, columns.map((column) => {
3541
+ var _a;
3542
+ return (h("th", { key: column.value, style: { width: column.width + '%', textAlign: column.align } }, typeof column.title === 'string' ? column.title : (_a = column.title) === null || _a === void 0 ? void 0 : _a.call(column)));
3543
+ })))), h("tbody", null, dataSource.map((row, index) => (h("tr", { key: index }, columns.map((column) => (h("td", { key: column.value, style: { width: column.width + '%', textAlign: column.align }, class: { 'no-wrap': column.nowrap } }, column.render ? column.render(row, row[column.value], index) : row[column.value])))))))));
3544
+ const LotteryTippingBetSlip = class {
3545
+ constructor(hostRef) {
3546
+ registerInstance(this, hostRef);
3547
+ this.selectionChangeHandler = createEvent(this, "lotteryTippingBetSelectionChange", 7);
3548
+ this.clearAll = createEvent(this, "lotteryTippingBetClearAll", 7);
3549
+ this.addLine = createEvent(this, "lotteryTippingBetAddLine", 7);
3550
+ this.removeLine = createEvent(this, "lotteryTippingBetRemoveLine", 7);
3551
+ this.pageChange = createEvent(this, "lotteryTippingBetPageChange", 7);
3552
+ this.columns = [
3553
+ { title: '', value: 'index', width: 3 },
3554
+ {
3555
+ title: '',
3556
+ value: 'eventName',
3557
+ width: 65,
3558
+ render: (item, value) => this.renderEventName(item, value)
3559
+ },
3560
+ {
3561
+ title: '',
3562
+ value: 'startTime',
3563
+ width: 22,
3564
+ align: 'right',
3565
+ nowrap: true,
3566
+ render: (_, value) => formatDate({ date: value, format: 'ccc HH:mm' })
3567
+ },
3568
+ {
3569
+ title: () => (h("lottery-selection-group", { language: this.language, "translation-url": this.translationUrl, "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, type: "preview", splitToken: this.bulletTextsSplitToken, "bullet-texts": this.bulletNames, bulletTextType: "text", hasBackground: false, hasBorder: false })),
3570
+ value: 'results',
3571
+ width: 10,
3572
+ render: (_, __, curRow) => (h("lottery-selection-group", { language: this.language, "translation-url": this.translationUrl, "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, "mb-source": this.mbSource, selectionGroupId: `${this.currentPage - 1}${this.bulletTextsSplitToken}${curRow}`, type: this.readPretty ? 'preview' : 'bet', "selected-bullet-texts": this.selectedBulletTexts(curRow), "disabled-bullet-texts": this.getBulletDisabledOptions(curRow), "max-selected-count": this.mode === 'single' ? 1 : this.bulletTexts.split(this.bulletTextsSplitToken).length, "bullet-texts": this.bulletTexts, splitToken: this.bulletTextsSplitToken, bulletTextType: "text" }))
3573
+ }
3574
+ ];
3575
+ this.mbSource = undefined;
3576
+ this.clientStyling = undefined;
3577
+ this.clientStylingUrl = undefined;
3578
+ this.translationUrl = '';
3579
+ this.language = 'en';
3580
+ this.totalPages = 1;
3581
+ this.minTotalPages = 1;
3582
+ this.maxTotalPages = 3;
3583
+ this.bulletTexts = '1,X,2';
3584
+ this.bulletNames = 'Home,Draw,Away';
3585
+ this.bulletTextsSplitToken = ',';
3586
+ this.showClearButton = true;
3587
+ this.addImage = renderIconDefinitionToSVGElement(PlusSquareOutlined$1, {
3588
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
3589
+ });
3590
+ this.deleteImage = renderIconDefinitionToSVGElement(DeleteOutlined$1, {
3591
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
3592
+ });
3593
+ this.infoImage = renderIconDefinitionToSVGElement(InfoCircleOutlined$1, {
3594
+ extraSVGAttrs: { width: '16px', height: '16px', fill: 'currentColor' }
3595
+ });
3596
+ this.leftImage = renderIconDefinitionToSVGElement(LeftOutlined$1, {
3597
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
3598
+ });
3599
+ this.rightImage = renderIconDefinitionToSVGElement(RightOutlined$1, {
3600
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
3601
+ });
3602
+ this.mode = 'multi';
3603
+ this.readPretty = false;
3604
+ this.ticketDataSourceStr = '[]';
3605
+ this.bulletSelectionsLineGroupStr = '[]';
3606
+ this.currentPage = 1;
3607
+ this.bulletSelectionsLineGroup = [];
3608
+ this.ticketDataSource = [];
3609
+ this.betIsLoading = false;
3610
+ this.betHasErrors = false;
3611
+ }
3612
+ renderEventName(_, value) {
3613
+ const [homeName, awayName] = value.split(' vs ');
3614
+ return (h("div", { class: "flex gap-1 eventNameContainer__item" }, h("span", { class: "eventNameContainer__item--title" }, value), h("app-tooltip", null, h("span", { slot: "trigger", class: "icon info-icon", innerHTML: this.infoImage, style: { width: '18px' } }), h("div", { slot: "content" }, h("div", { class: "match-info" }, h("div", { class: "match-info-item" }, h("div", { class: "match-info-item-label" }, translate$1('homeTeam', this.language)), h("div", { class: "match-info-item-value" }, homeName)), h("div", { class: "match-info-item" }, h("div", { class: "match-info-item-label" }, translate$1('awayTeam', this.language)), h("div", { class: "match-info-item-value" }, awayName)))))));
3615
+ }
3616
+ selectedBulletTexts(curRow) {
3617
+ var _a, _b, _c;
3618
+ return ((_c = (_b = (_a = this.bulletSelectionsLineGroup) === null || _a === void 0 ? void 0 : _a[this.currentPage - 1]) === null || _b === void 0 ? void 0 : _b[curRow]) === null || _c === void 0 ? void 0 : _c.join(this.bulletTextsSplitToken)) || '';
3619
+ }
3620
+ getBulletDisabledOptions(curRow) {
3621
+ const { outcomes } = this.ticketDataSource[curRow];
3622
+ const curActiveOptions = outcomes.map((ev) => ev.betOn);
3623
+ const bulletText = this.bulletTexts.split(this.bulletTextsSplitToken);
3624
+ const disabledOptions = bulletText.filter((bullet) => !curActiveOptions.includes(bullet));
3625
+ return disabledOptions.join(this.bulletTextsSplitToken);
3626
+ }
3627
+ handleNewTranslations() {
3628
+ resolveTranslationUrl$1(this.translationUrl);
3629
+ }
3630
+ handleClientStylingChange(newValue, oldValue) {
3631
+ if (newValue != oldValue) {
3632
+ setClientStyling(this.stylingContainer, this.clientStyling);
3633
+ }
3634
+ }
3635
+ handleClientStylingUrlChange(newValue, oldValue) {
3636
+ if (newValue != oldValue) {
3637
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
3638
+ }
3639
+ }
3640
+ handleMbSourceChange(newValue, oldValue) {
3641
+ if (newValue != oldValue) {
3642
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
3643
+ }
3644
+ }
3645
+ parseTicketDataSource(newValue) {
3646
+ try {
3647
+ this.ticketDataSource = JSON.parse(newValue || '[]');
3648
+ }
3649
+ catch (e) {
3650
+ console.error('Failed to parse ticketDataSourceStr:', e);
3651
+ }
3652
+ }
3653
+ parseBulletSelectionsLineGroup(newValue) {
3654
+ try {
3655
+ this.bulletSelectionsLineGroup = JSON.parse(newValue || '[]');
3656
+ }
3657
+ catch (e) {
3658
+ console.error('Failed to parse bulletSelectionsLineGroupStr:', e);
3659
+ }
3660
+ }
3661
+ connectedCallback() {
3662
+ this.boundMessageHandler = this.messageHandler.bind(this);
3663
+ window.addEventListener('message', this.boundMessageHandler);
3664
+ }
3665
+ disconnectedCallback() {
3666
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
3667
+ if (this.boundMessageHandler) {
3668
+ window.removeEventListener('message', this.boundMessageHandler);
3669
+ }
3670
+ }
3671
+ messageHandler() {
3672
+ // This handler can be kept for other potential messages, or removed if no longer needed.
3673
+ }
3674
+ componentWillLoad() {
3675
+ resolveTranslationUrl$1(this.translationUrl);
3676
+ this.parseTicketDataSource(this.ticketDataSourceStr);
3677
+ this.parseBulletSelectionsLineGroup(this.bulletSelectionsLineGroupStr);
3678
+ }
3679
+ componentDidLoad() {
3680
+ if (this.stylingContainer) {
3681
+ if (this.mbSource)
3682
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
3683
+ if (this.clientStyling)
3684
+ setClientStyling(this.stylingContainer, this.clientStyling);
3685
+ if (this.clientStylingUrl)
3686
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
3687
+ }
3688
+ }
3689
+ handleClearAll() {
3690
+ this.clearAll.emit();
3691
+ }
3692
+ bulletGroupUpdateSelectionHandler(event) {
3693
+ event.stopPropagation();
3694
+ const { newSelectedBulletTexts, selectionGroupId } = event.detail;
3695
+ if (!selectionGroupId) {
3696
+ console.error('Miss selectionGroupId');
3697
+ return;
3698
+ }
3699
+ const idParts = selectionGroupId.split(this.bulletTextsSplitToken);
3700
+ if (idParts.length !== 2) {
3701
+ console.error('Invalid selectionGroupId format:', selectionGroupId);
3702
+ return;
3703
+ }
3704
+ const [boardId, matchId] = idParts;
3705
+ this.selectionChangeHandler.emit({
3706
+ newSelections: newSelectedBulletTexts.split(this.bulletTextsSplitToken),
3707
+ matchId,
3708
+ boardId
3709
+ });
3710
+ }
3711
+ prevPage() {
3712
+ const doPrev = () => {
3713
+ this.pageChange.emit({ newPage: this.currentPage - 1 });
3714
+ };
3715
+ this.swapCard('prev', doPrev);
3716
+ }
3717
+ nextPage() {
3718
+ const doNext = () => {
3719
+ this.pageChange.emit({ newPage: this.currentPage + 1 });
3720
+ };
3721
+ this.swapCard('next', doNext);
3722
+ }
3723
+ handleAddLine() {
3724
+ const doAdd = () => {
3725
+ this.addLine.emit();
3726
+ };
3727
+ this.swapCard('add', doAdd);
3728
+ }
3729
+ handleRemoveLine() {
3730
+ this.removeLine.emit({
3731
+ boardId: this.currentPage - 1,
3732
+ close: (onClose) => {
3733
+ onClose && this.swapCard('remove', onClose);
3734
+ }
3735
+ });
3736
+ }
3737
+ swapCard(action, cb) {
3738
+ const wrapper = this.mainContainer;
3739
+ if (!wrapper)
3740
+ return;
3741
+ // Prevent new animations if one is already in progress
3742
+ const isAnimating = Array.from(wrapper.classList).some((cls) => cls.startsWith('card-out-') || cls.startsWith('card-in-'));
3743
+ if (isAnimating) {
3744
+ return;
3745
+ }
3746
+ const map = {
3747
+ next: { out: 'card-out-left', in: 'card-in-left' },
3748
+ prev: { out: 'card-out-right', in: 'card-in-right' },
3749
+ remove: { out: 'card-out-down', in: 'card-in-right' },
3750
+ add: { out: 'card-out-left', in: 'card-in-up' }
3751
+ };
3752
+ const { out: outCls, in: inCls } = map[action];
3753
+ wrapper.classList.add(outCls);
3754
+ wrapper.addEventListener('animationend', () => {
3755
+ wrapper.classList.remove(outCls);
3756
+ cb();
3757
+ const newWrapper = this.mainContainer;
3758
+ if (!newWrapper)
3759
+ return;
3760
+ newWrapper.classList.add(inCls);
3761
+ newWrapper.addEventListener('animationend', () => newWrapper.classList.remove(inCls), { once: true });
3762
+ }, { once: true });
3763
+ }
3764
+ renderLoading() {
3765
+ return (h("div", { class: "loading-wrap" }, h("section", { class: "dots-container" }, h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }), h("div", { class: "dot" }))));
3766
+ }
3767
+ renderErrorContent() {
3768
+ return h("p", null, translate$1('error', this.language));
3769
+ }
3770
+ renderEmptyContent() {
3771
+ return (h("div", { class: "LotteryTippingTicketBet__empty" }, h("p", null, translate$1('noData', this.language))));
3772
+ }
3773
+ renderPageFooter() {
3774
+ if (this.totalPages <= 1)
3775
+ return null;
3776
+ return (h("div", null, h("div", { class: 'border-line' }), h("div", { class: "LotteryTippingTicketBet__footer" }, h("div", { class: "my-pagination flex justify-between" }, h("span", null, translate$1('lineInfo', this.language, { currentPage: this.currentPage, totalPages: this.totalPages })), h("div", { class: 'flex gap-1' }, h("button", { type: "button", class: `btn ${this.currentPage === 1 ? 'disabled' : ''}`, onClick: () => this.prevPage(), disabled: this.currentPage === 1 }, h("span", { class: "icon", innerHTML: this.leftImage })), h("button", { type: "button", class: `btn ${this.currentPage === this.totalPages ? 'disabled' : ''}`, onClick: () => this.nextPage(), disabled: this.currentPage === this.totalPages }, h("span", { class: "icon", innerHTML: this.rightImage })))))));
3777
+ }
3778
+ renderReadPrettyContent() {
3779
+ var _a;
3780
+ return (h("div", { class: "LotteryTippingTicketBet__main", ref: (el) => (this.mainContainer = el) }, h("div", { class: "table-scroll-wrapper" }, h(MyTable, { columns: this.columns, dataSource: ((_a = this.ticketDataSource) === null || _a === void 0 ? void 0 : _a.map((item, index) => (Object.assign(Object.assign({}, item), { index: index + 1 })))) || [], hideHead: false, grid: false, bordered: false })), this.renderPageFooter()));
3781
+ }
3782
+ renderDefaultContent() {
3783
+ var _a;
3784
+ const lineOperatorAddShow = this.totalPages < this.maxTotalPages && this.currentPage === this.totalPages ? true : false;
3785
+ const lineOperatorRemoveShow = this.totalPages > this.minTotalPages ? true : false;
3786
+ return (h("div", null, h("div", { class: "LotteryTippingTicketBet__tableToolbar flex justify-end gap-1" }, this.showClearButton && (h("lottery-button", { class: {
3787
+ 'LotteryTippingTicketBet__tableToolbar--item': true,
3788
+ 'mr-0': !(lineOperatorAddShow || lineOperatorRemoveShow)
3789
+ }, text: translate$1('clearAll', this.language), onClick: () => this.handleClearAll(), variant: "text", clientStyling: this.clientStyling || '' }))), h("div", { class: "flex align-center LotteryTippingTicketBet__main", ref: (el) => (this.mainContainer = el) }, h("div", { class: "table-scroll-wrapper" }, h(MyTable, { columns: this.columns, dataSource: ((_a = this.ticketDataSource) === null || _a === void 0 ? void 0 : _a.map((item, index) => (Object.assign(Object.assign({}, item), { index: index + 1 })))) || [], hideHead: false, grid: false, bordered: false })), (lineOperatorAddShow || lineOperatorRemoveShow) && (h("div", { class: "LotteryTippingTicketBet__lineOperatorGroup" }, lineOperatorAddShow && (h("button", { type: "button", class: {
3790
+ 'LotteryTippingTicketBet__lineOperatorGroup--item': true
3791
+ }, onClick: () => this.handleAddLine() }, h("span", { class: "icon", innerHTML: this.addImage }))), lineOperatorRemoveShow && (h("button", { type: "button", class: {
3792
+ 'LotteryTippingTicketBet__lineOperatorGroup--item': true
3793
+ }, onClick: () => this.handleRemoveLine() }, h("span", { class: "icon", innerHTML: this.deleteImage })))))), this.renderPageFooter()));
3794
+ }
3795
+ render() {
3796
+ let content;
3797
+ if (this.betIsLoading) {
3798
+ content = this.renderLoading();
3799
+ }
3800
+ else if (this.betHasErrors) {
3801
+ content = this.renderErrorContent();
3802
+ }
3803
+ else if (this.ticketDataSource.length === 0) {
3804
+ content = this.renderEmptyContent();
3805
+ }
3806
+ else if (this.readPretty) {
3807
+ content = this.renderReadPrettyContent();
3808
+ }
3809
+ else {
3810
+ content = this.renderDefaultContent();
3811
+ }
3812
+ return (h("div", { key: '425f7f3d185616af3189857a9159868e3c57f100', ref: (el) => (this.stylingContainer = el), class: "LotteryTippingTicketBet__container" }, content));
3813
+ }
3814
+ static get watchers() { return {
3815
+ "translationUrl": ["handleNewTranslations"],
3816
+ "clientStyling": ["handleClientStylingChange"],
3817
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
3818
+ "mbSource": ["handleMbSourceChange"],
3819
+ "ticketDataSourceStr": ["parseTicketDataSource"],
3820
+ "bulletSelectionsLineGroupStr": ["parseBulletSelectionsLineGroup"]
3821
+ }; }
3822
+ };
3823
+ LotteryTippingBetSlip.style = LotteryTippingBetSlipStyle0;
3824
+
3825
+ const DEFAULT_LANGUAGE = 'en';
3826
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
3827
+ const TRANSLATIONS = {
3828
+ en: {
3829
+ cancel: 'Cancel',
3830
+ confirm: 'Confirm'
3831
+ },
3832
+ ro: {
3833
+ cancel: 'Anulează',
3834
+ confirm: 'Confirmă'
3835
+ },
3836
+ fr: {
3837
+ cancel: 'Annuler',
3838
+ confirm: 'Confirmer'
3839
+ },
3840
+ ar: {
3841
+ cancel: 'إلغاء',
3842
+ confirm: 'تأكيد'
3843
+ },
3844
+ hr: {
3845
+ cancel: 'Odustani',
3846
+ confirm: 'Potvrdi'
3847
+ }
3848
+ };
3849
+ const translate = (key, customLang) => {
3850
+ const lang = customLang;
3851
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
3852
+ };
3853
+ const getTranslations = (data) => {
3854
+ Object.keys(data).forEach((item) => {
3855
+ for (let key in data[item]) {
3856
+ TRANSLATIONS[item][key] = data[item][key];
3857
+ }
3858
+ });
3859
+ };
3860
+ const resolveTranslationUrl = async (translationUrl) => {
3861
+ if (translationUrl) {
3862
+ try {
3863
+ const response = await fetch(translationUrl);
3864
+ if (!response.ok) {
3865
+ throw new Error(`HTTP error! status: ${response.status}`);
3866
+ }
3867
+ const translations = await response.json();
3868
+ getTranslations(translations);
3869
+ }
3870
+ catch (error) {
3871
+ console.error('Failed to fetch or parse translations from URL:', error);
3872
+ }
3873
+ }
3874
+ };
3875
+
3876
+ const lotteryTippingDialogCss = ".dialog-wrapper{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;visibility:hidden;opacity:1;z-index:199}.dialog-wrapper-visible{visibility:visible}.mask{position:fixed;inset:0;background:var(--emw--color-mask-dialog-background, rgba(0, 0, 0, 0.5));opacity:0;z-index:1000;transition:opacity var(--duration) linear}.mask-enter{opacity:1}.mask-leave{opacity:0}.dialog{position:relative;background:var(--emw--color-background, #fff);border-radius:12px;box-shadow:0 4px 32px var(--emw--button-box-shadow-color-secondary, rgba(0, 0, 0, 0.15));opacity:0;transform:scale(0.9);transition:all var(--duration) linear;width:100%;max-width:100vw;overflow:hidden;z-index:1000}.dialog-enter{opacity:1;transform:scale(1)}.dialog-leave{opacity:0}.dialog.fullscreen{width:100vw !important;height:100vh;overflow:auto;max-height:none;border-radius:0;overflow:hidden}.dialog-header{padding:16px 16px 0 16px;display:flex;justify-content:space-between;align-items:center}.dialog-header .dialog-title{margin:0;font-size:1.25rem;font-weight:500;color:var(--emw--color-typography, #000)}.dialog-header .close-btn{background:transparent;border:none;font-size:1.5rem;width:2rem;height:2rem;color:var(--emw--color-gray-150, #6f6f6f);cursor:pointer;border-radius:4px}.dialog-header .close-btn:hover{background:var(--emw--color-gray-50, #f5f5f5);color:var(--emw--color-gray-300, #333)}.dialog-content{padding:24px;font-size:0.95rem;line-height:1.6;color:var(--emw--color-dialog-typography, #000);flex:1;overflow-y:auto;max-height:calc(100vh - 200px)}.dialog.fullscreen .dialog-content{max-height:none}.dialog-footer{padding:0 16px 16px 16px;display:flex;justify-content:center;gap:12px}.dialog-footer .cancel-btn,.dialog-footer .confirm-btn{padding:10px 24px;min-width:60px;border-radius:6px;font-size:0.9rem;cursor:pointer;transition:all 0.3s linear}.dialog-footer .cancel-btn{border:var(--emw--button-border, 1px solid rgba(221, 221, 221, 0.8666666667));background-color:var(--emw--color-background, #fff);color:var(--emw--color-typography, #000)}.dialog-footer .cancel-btn:hover{background-color:var(--emw--color-background-tertiary, #ccc)}.dialog-footer .confirm-btn{border:none;color:var(--emw--color-typography-normalized, #ffffff);background:var(--emw--color-primary, #009993)}.dialog-footer .confirm-btn:hover{background:var(--emw--color-primary-variant, #004d4a)}@media screen and (max-width: 480px){.dialog.fullscreen .dialog-content{padding:12px}}.Loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.Loading svg{animation:spin 1s linear infinite;transform-origin:center}@keyframes spin{100%{transform:rotate(360deg)}}";
3877
+ const LotteryTippingDialogStyle0 = lotteryTippingDialogCss;
3878
+
3879
+ const LotteryTippingDialog = class {
3880
+ constructor(hostRef) {
3881
+ registerInstance(this, hostRef);
3882
+ this.open = createEvent(this, "open", 7);
3883
+ this.close = createEvent(this, "close", 7);
3884
+ this.confirm = createEvent(this, "confirm", 7);
3885
+ this.cancel = createEvent(this, "cancel", 7);
3886
+ this.wasVisible = false;
3887
+ this.mbSource = undefined;
3888
+ this.clientStyling = '';
3889
+ this.clientStylingUrl = '';
3890
+ this.visible = undefined;
3891
+ this.dialogTitle = '';
3892
+ this.width = '520px';
3893
+ this.closable = true;
3894
+ this.mask = true;
3895
+ this.maskClosable = true;
3896
+ this.animationDuration = 300;
3897
+ this.fullscreen = false;
3898
+ this.showFooter = true;
3899
+ this.showCancelBtn = true;
3900
+ this.language = 'en';
3901
+ this.translationUrl = undefined;
3902
+ this.dialogClass = undefined;
3903
+ this.dialogStyle = undefined;
3904
+ this.confirmLoading = false;
3905
+ }
3906
+ handleClientStylingChange(newValue, oldValue) {
3907
+ if (newValue != oldValue) {
3908
+ setClientStyling(this.stylingContainer, this.clientStyling);
3909
+ }
3910
+ }
3911
+ handleClientStylingUrlChange(newValue, oldValue) {
3912
+ if (newValue != oldValue) {
3913
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
3914
+ }
3915
+ }
3916
+ handleMbSourceChange(newValue, oldValue) {
3917
+ if (newValue != oldValue) {
3918
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
3919
+ }
3920
+ }
3921
+ componentWillLoad() {
3922
+ if (this.translationUrl) {
3923
+ resolveTranslationUrl(this.translationUrl);
3924
+ }
3925
+ }
3926
+ componentWillUpdate() {
3927
+ if (this.visible && !this.wasVisible) {
3928
+ this.disableBodyScroll();
3929
+ }
3930
+ else if (!this.visible && this.wasVisible) {
3931
+ this.enableBodyScroll();
3932
+ }
3933
+ this.wasVisible = this.visible;
3934
+ }
3935
+ disconnectedCallback() {
3936
+ this.enableBodyScroll();
3937
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
3938
+ }
3939
+ disableBodyScroll() {
3940
+ document.body.style.overflow = 'hidden';
3941
+ }
3942
+ enableBodyScroll() {
3943
+ document.body.style.overflow = '';
3944
+ }
3945
+ handleClose() {
3946
+ this.cancel.emit();
3947
+ }
3948
+ handleMaskClick() {
3949
+ if (this.maskClosable) {
3950
+ this.cancel.emit();
3951
+ }
3952
+ }
3953
+ handleConfirm() {
3954
+ this.confirm.emit();
3955
+ }
3956
+ render() {
3957
+ const computedDialogStyle = Object.assign({ width: typeof this.width === 'number' ? `${this.width}px` : this.width, '--duration': `${this.animationDuration}ms` }, (this.dialogStyle || {}));
3958
+ const dialogWrapperClass = ['dialog-wrapper', this.visible ? 'dialog-wrapper-visible' : ''];
3959
+ const maskClass = ['mask', this.visible ? 'mask-enter' : 'mask-leave'];
3960
+ const computedDialogClass = [
3961
+ 'dialog',
3962
+ this.visible ? 'dialog-enter' : 'dialog-leave',
3963
+ this.fullscreen ? 'fullscreen' : '',
3964
+ this.dialogClass
3965
+ ]
3966
+ .filter(Boolean)
3967
+ .join(' ');
3968
+ const contentStyle = {
3969
+ maxHeight: 'calc(100vh - 62px)',
3970
+ overflowY: 'auto'
3971
+ };
3972
+ return (h("div", { key: '05dd671f10bdebda6f138e8f8039f4bc0533fe98', class: dialogWrapperClass.join(' '), ref: (el) => (this.stylingContainer = el) }, h("div", { key: '6e814e02770149de5495617039750461fc0a42d1', class: maskClass.join(' '), onClick: this.handleMaskClick.bind(this) }), h("div", { key: '4cbc5db20317ef1b0808fc4a91a53fa8b86c5f4f', part: "dialog", class: computedDialogClass, style: computedDialogStyle, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-title" }, (this.dialogTitle || this.closable) && (h("div", { key: '85dc705676a37e6ea2828a7b683fc54b0eb77d17', class: "dialog-header" }, h("h2", { key: '85b7472d2b72801dfae19a24fc2018f3c1f1529a', id: "dialog-title", class: "dialog-title" }, this.dialogTitle), this.closable && (h("button", { key: '8089aaecfe511558055ee9f64214ff97030eb2a9', class: "close-btn", onClick: this.handleClose.bind(this) }, "x")))), h("div", { key: '776255540f30d757caa3fcaee747c79ac638ae76', class: "dialog-content", style: contentStyle }, h("slot", { key: '5ef964615b6ab70a9e561f8efac8fe952fe47b4e' })), this.showFooter && (h("div", { key: '8927a0991d916caf7852d58db996b9818687da30', class: "dialog-footer" }, h("slot", { key: '84de0306994ec62220ae30fa2881dadbae5544ea', name: "footer" }, this.showCancelBtn && (h("button", { key: 'ee87b8c3918c1f4d007923a2498142b3af2740a0', class: "cancel-btn", onClick: this.handleClose.bind(this) }, translate('cancel', this.language))), h("button", { key: '935cff86381b21fff07c2d4156b29779c50e5ce3', class: "confirm-btn", onClick: this.handleConfirm.bind(this), disabled: this.confirmLoading }, this.confirmLoading ? (h("div", { class: "Loading", innerHTML: renderIconDefinitionToSVGElement(LoadingOutlined$1, {
3973
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
3974
+ }) })) : (translate('confirm', this.language)))))))));
3975
+ }
3976
+ get el() { return getElement(this); }
3977
+ static get watchers() { return {
3978
+ "clientStyling": ["handleClientStylingChange"],
3979
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
3980
+ "mbSource": ["handleMbSourceChange"]
3981
+ }; }
3982
+ };
3983
+ LotteryTippingDialog.style = LotteryTippingDialogStyle0;
3984
+
3985
+ export { Tooltip as app_tooltip, HelperCountDown as helper_count_down, LotteryBanner as lottery_banner, LotteryButton as lottery_button, LotteryOrderSummary as lottery_order_summary, LotterySelection as lottery_selection, LotterySelectionGroup as lottery_selection_group, LotteryTippingBetSlip as lottery_tipping_bet_slip, LotteryTippingDialog as lottery_tipping_dialog };