@everymatrix/lottery-tipping-latest-result 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 (67) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/general-tooltip_6.cjs.entry.js +9968 -0
  3. package/dist/cjs/index-e5294eca.js +1376 -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-latest-result-c9dbebc8.js +650 -0
  7. package/dist/cjs/lottery-tipping-latest-result.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +28 -0
  9. package/dist/collection/components/lottery-tipping-calendar/lottery-tipping-calendar.css +130 -0
  10. package/dist/collection/components/lottery-tipping-calendar/lottery-tipping-calendar.js +306 -0
  11. package/dist/collection/components/lottery-tipping-latest-result/index.js +1 -0
  12. package/dist/collection/components/lottery-tipping-latest-result/lottery-tipping-latest-result.css +133 -0
  13. package/dist/collection/components/lottery-tipping-latest-result/lottery-tipping-latest-result.js +432 -0
  14. package/dist/collection/index.js +1 -0
  15. package/dist/collection/models/index.js +1 -0
  16. package/dist/collection/utils/locale.utils.js +67 -0
  17. package/dist/collection/utils/utils.js +159 -0
  18. package/dist/esm/app-globals-0f993ce5.js +3 -0
  19. package/dist/esm/general-tooltip_6.entry.js +9960 -0
  20. package/dist/esm/index-0975f224.js +1347 -0
  21. package/dist/esm/index.js +2 -0
  22. package/dist/esm/loader.js +11 -0
  23. package/dist/esm/lottery-tipping-latest-result-2ee900c2.js +639 -0
  24. package/dist/esm/lottery-tipping-latest-result.js +20 -0
  25. package/dist/index.cjs.js +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/lottery-tipping-latest-result/app-globals-0f993ce5.js +1 -0
  28. package/dist/lottery-tipping-latest-result/general-tooltip_6.entry.js +6656 -0
  29. package/dist/lottery-tipping-latest-result/index-0975f224.js +2 -0
  30. package/dist/lottery-tipping-latest-result/index.esm.js +1 -0
  31. package/dist/lottery-tipping-latest-result/lottery-tipping-latest-result-2ee900c2.js +1 -0
  32. package/dist/lottery-tipping-latest-result/lottery-tipping-latest-result.esm.js +1 -0
  33. package/dist/static/add.svg +8 -0
  34. package/dist/static/delete.svg +37 -0
  35. package/dist/static/info.svg +6 -0
  36. package/dist/static/left-arrow.svg +15 -0
  37. package/dist/static/loading.svg +10 -0
  38. package/dist/static/right-arrow.svg +15 -0
  39. package/dist/stencil.config.dev.js +19 -0
  40. package/dist/stencil.config.js +19 -0
  41. package/dist/storybook/main.js +43 -0
  42. package/dist/storybook/preview.js +9 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/packages/stencil/lottery-tipping-latest-result/stencil.config.d.ts +2 -0
  45. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/packages/stencil/lottery-tipping-latest-result/stencil.config.dev.d.ts +2 -0
  46. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/packages/stencil/lottery-tipping-latest-result/storybook/main.d.ts +3 -0
  47. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/packages/stencil/lottery-tipping-latest-result/storybook/preview.d.ts +70 -0
  48. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/tools/plugins/index.d.ts +3 -0
  49. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  50. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  51. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-tipping-latest-result/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  52. package/dist/types/components/lottery-tipping-calendar/lottery-tipping-calendar.d.ts +62 -0
  53. package/dist/types/components/lottery-tipping-latest-result/index.d.ts +1 -0
  54. package/dist/types/components/lottery-tipping-latest-result/lottery-tipping-latest-result.d.ts +74 -0
  55. package/dist/types/components.d.ts +148 -0
  56. package/dist/types/index.d.ts +1 -0
  57. package/dist/types/models/index.d.ts +130 -0
  58. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  59. package/dist/types/utils/locale.utils.d.ts +2 -0
  60. package/dist/types/utils/utils.d.ts +10 -0
  61. package/loader/cdn.js +1 -0
  62. package/loader/index.cjs.js +1 -0
  63. package/loader/index.d.ts +24 -0
  64. package/loader/index.es2017.js +1 -0
  65. package/loader/index.js +2 -0
  66. package/loader/package.json +11 -0
  67. package/package.json +27 -0
@@ -0,0 +1,650 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-e5294eca.js');
4
+
5
+ /**
6
+ * @name setClientStyling
7
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
8
+ * @param {HTMLElement} stylingContainer The reference element of the widget
9
+ * @param {string} clientStyling The style content
10
+ */
11
+ function setClientStyling(stylingContainer, clientStyling) {
12
+ if (stylingContainer) {
13
+ const sheet = document.createElement('style');
14
+ sheet.innerHTML = clientStyling;
15
+ stylingContainer.appendChild(sheet);
16
+ }
17
+ }
18
+
19
+ /**
20
+ * @name setClientStylingURL
21
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
22
+ * @param {HTMLElement} stylingContainer The reference element of the widget
23
+ * @param {string} clientStylingUrl The URL of the style content
24
+ */
25
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
26
+ const url = new URL(clientStylingUrl);
27
+
28
+ fetch(url.href)
29
+ .then((res) => res.text())
30
+ .then((data) => {
31
+ const cssFile = document.createElement('style');
32
+ cssFile.innerHTML = data;
33
+ if (stylingContainer) {
34
+ stylingContainer.appendChild(cssFile);
35
+ }
36
+ })
37
+ .catch((err) => {
38
+ console.error('There was an error while trying to load client styling from URL', err);
39
+ });
40
+ }
41
+
42
+ /**
43
+ * @name setStreamLibrary
44
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
45
+ * @param {HTMLElement} stylingContainer The highest element of the widget
46
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
47
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
48
+ */
49
+ function setStreamStyling(stylingContainer, domain, subscription) {
50
+ if (window.emMessageBus) {
51
+ const sheet = document.createElement('style');
52
+
53
+ window.emMessageBus.subscribe(domain, (data) => {
54
+ sheet.innerHTML = data;
55
+ if (stylingContainer) {
56
+ stylingContainer.appendChild(sheet);
57
+ }
58
+ });
59
+ }
60
+ }
61
+
62
+ // This icon file is generated automatically.
63
+ 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" };
64
+ const LeftOutlined$1 = LeftOutlined;
65
+
66
+ // This icon file is generated automatically.
67
+ 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" };
68
+ const RightOutlined$1 = RightOutlined;
69
+
70
+ var __assign = (undefined && undefined.__assign) || function () {
71
+ __assign = Object.assign || function(t) {
72
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
73
+ s = arguments[i];
74
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
75
+ t[p] = s[p];
76
+ }
77
+ return t;
78
+ };
79
+ return __assign.apply(this, arguments);
80
+ };
81
+ var defaultColors = {
82
+ primaryColor: '#333',
83
+ secondaryColor: '#E6E6E6'
84
+ };
85
+ function renderIconDefinitionToSVGElement(icond, options) {
86
+ if (options === void 0) { options = {}; }
87
+ if (typeof icond.icon === 'function') {
88
+ // two-tone
89
+ var placeholders = options.placeholders || defaultColors;
90
+ return renderAbstractNodeToSVGElement(icond.icon(placeholders.primaryColor, placeholders.secondaryColor), options);
91
+ }
92
+ // fill, outline
93
+ return renderAbstractNodeToSVGElement(icond.icon, options);
94
+ }
95
+ function renderAbstractNodeToSVGElement(node, options) {
96
+ var targetAttrs = node.tag === 'svg'
97
+ ? __assign(__assign({}, node.attrs), (options.extraSVGAttrs || {})) : node.attrs;
98
+ var attrs = Object.keys(targetAttrs).reduce(function (acc, nextKey) {
99
+ var key = nextKey;
100
+ var value = targetAttrs[key];
101
+ var token = "".concat(key, "=\"").concat(value, "\"");
102
+ acc.push(token);
103
+ return acc;
104
+ }, []);
105
+ var attrsToken = attrs.length ? ' ' + attrs.join(' ') : '';
106
+ var children = (node.children || [])
107
+ .map(function (child) { return renderAbstractNodeToSVGElement(child, options); })
108
+ .join('');
109
+ if (children && children.length) {
110
+ return "<".concat(node.tag).concat(attrsToken, ">").concat(children, "</").concat(node.tag, ">");
111
+ }
112
+ return "<".concat(node.tag).concat(attrsToken, " />");
113
+ }
114
+
115
+ const generateUUID = () => {
116
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
117
+ var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
118
+ return v.toString(16);
119
+ });
120
+ };
121
+ function fetchRequest(url, method = 'GET', body = null, headers = {}) {
122
+ return new Promise((resolve, reject) => {
123
+ const uuid = generateUUID();
124
+ const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
125
+ if (method !== 'GET' && method !== 'HEAD') {
126
+ headersOrigin['X-Idempotency-Key'] = uuid;
127
+ }
128
+ const options = {
129
+ method,
130
+ headers: headersOrigin,
131
+ body: null
132
+ };
133
+ if (body && method !== 'GET' && method !== 'HEAD') {
134
+ options.body = JSON.stringify(body);
135
+ }
136
+ else {
137
+ delete options.body;
138
+ }
139
+ fetch(url, options)
140
+ .then((response) => {
141
+ if (!response.ok) {
142
+ throw new Error(`HTTP error! Status: ${response.status}`);
143
+ }
144
+ return response.json();
145
+ })
146
+ .then((data) => resolve(data))
147
+ .catch((error) => reject(error));
148
+ });
149
+ }
150
+ function isEmptyValueOfArray(arr) {
151
+ if (arr.length === 0) {
152
+ return true;
153
+ }
154
+ const len = arr.length;
155
+ let count = 0;
156
+ for (let i = 0; i < len; i++) {
157
+ if (isEmptyValue(arr[i])) {
158
+ count++;
159
+ }
160
+ else {
161
+ return false;
162
+ }
163
+ }
164
+ if (count === len) {
165
+ return true;
166
+ }
167
+ return false;
168
+ }
169
+ function isEmptyValueOfObject(obj) {
170
+ if (Object.keys(obj).length === 0) {
171
+ return true;
172
+ }
173
+ const len = Object.keys(obj).length;
174
+ let count = 0;
175
+ for (const val of Object.values(obj)) {
176
+ if (isEmptyValue(val)) {
177
+ count++;
178
+ }
179
+ else {
180
+ return false;
181
+ }
182
+ }
183
+ if (count === len) {
184
+ return true;
185
+ }
186
+ return false;
187
+ }
188
+ function isEmptyValue(value, allowZero) {
189
+ if (value === null || value === undefined || value === '') {
190
+ return true;
191
+ }
192
+ else if (value === 0 && allowZero) {
193
+ return false;
194
+ }
195
+ else if (Array.isArray(value)) {
196
+ return isEmptyValueOfArray(value);
197
+ }
198
+ else if (Object.prototype.toString.call(value) === '[object Object]') {
199
+ return isEmptyValueOfObject(value);
200
+ }
201
+ else {
202
+ return !value;
203
+ }
204
+ }
205
+ function toQueryParams(params) {
206
+ const finalParams = {};
207
+ Object.entries(params).forEach(([key, value]) => {
208
+ if (!isEmptyValue(value, true)) {
209
+ finalParams[key] = value;
210
+ }
211
+ });
212
+ const queryString = Object.entries(finalParams)
213
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
214
+ .join('&');
215
+ return queryString ? `?${queryString}` : '';
216
+ }
217
+ const bulletMap = {
218
+ '0': '1',
219
+ '1': 'X',
220
+ '2': '2'
221
+ };
222
+ function parseBulletNumber(numberArr) {
223
+ const bulletArr = [];
224
+ Object.keys(bulletMap).forEach((key) => {
225
+ bulletArr.push({
226
+ isSelected: numberArr.includes(Number(key)),
227
+ value: bulletMap[key]
228
+ });
229
+ });
230
+ return bulletArr;
231
+ }
232
+ function parseEachLineNumber(numbers) {
233
+ const result = [];
234
+ const matchRes = [];
235
+ for (let i = 0; i < numbers.length; i += 2) {
236
+ const [resultNumber, matchNumber] = [numbers[i], numbers[i + 1]];
237
+ if (!matchRes[matchNumber]) {
238
+ matchRes[matchNumber] = [resultNumber];
239
+ }
240
+ else {
241
+ matchRes[matchNumber].push(resultNumber);
242
+ }
243
+ }
244
+ matchRes.forEach((matchArr) => {
245
+ result.push(parseBulletNumber(matchArr));
246
+ });
247
+ return result;
248
+ }
249
+ function thousandSeperator(value) {
250
+ if (value === 0) {
251
+ return '0';
252
+ }
253
+ if (!value) {
254
+ return '';
255
+ }
256
+ value = value.toString();
257
+ const parts = value.split('.');
258
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
259
+ return parts.join('.');
260
+ }
261
+ async function fetchGameInfo(endpoint, gameId) {
262
+ try {
263
+ const response = await fetchRequest(`${endpoint}/games/${gameId}`, 'GET', {});
264
+ return response;
265
+ }
266
+ catch (error) {
267
+ console.error('Failed to fetch game info:', error);
268
+ throw new Error('The game is currently not available. Please try again later.');
269
+ }
270
+ }
271
+
272
+ function _typeof(o) {
273
+ "@babel/helpers - typeof";
274
+
275
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
276
+ return typeof o;
277
+ } : function (o) {
278
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
279
+ }, _typeof(o);
280
+ }
281
+
282
+ function requiredArgs(required, args) {
283
+ if (args.length < required) {
284
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
285
+ }
286
+ }
287
+
288
+ /**
289
+ * @name toDate
290
+ * @category Common Helpers
291
+ * @summary Convert the given argument to an instance of Date.
292
+ *
293
+ * @description
294
+ * Convert the given argument to an instance of Date.
295
+ *
296
+ * If the argument is an instance of Date, the function returns its clone.
297
+ *
298
+ * If the argument is a number, it is treated as a timestamp.
299
+ *
300
+ * If the argument is none of the above, the function returns Invalid Date.
301
+ *
302
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
303
+ *
304
+ * @param {Date|Number} argument - the value to convert
305
+ * @returns {Date} the parsed date in the local time zone
306
+ * @throws {TypeError} 1 argument required
307
+ *
308
+ * @example
309
+ * // Clone the date:
310
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
311
+ * //=> Tue Feb 11 2014 11:30:30
312
+ *
313
+ * @example
314
+ * // Convert the timestamp to date:
315
+ * const result = toDate(1392098430000)
316
+ * //=> Tue Feb 11 2014 11:30:30
317
+ */
318
+ function toDate(argument) {
319
+ requiredArgs(1, arguments);
320
+ var argStr = Object.prototype.toString.call(argument);
321
+
322
+ // Clone the date
323
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
324
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
325
+ return new Date(argument.getTime());
326
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
327
+ return new Date(argument);
328
+ } else {
329
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
330
+ // eslint-disable-next-line no-console
331
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
332
+ // eslint-disable-next-line no-console
333
+ console.warn(new Error().stack);
334
+ }
335
+ return new Date(NaN);
336
+ }
337
+ }
338
+
339
+ /**
340
+ * @name differenceInMilliseconds
341
+ * @category Millisecond Helpers
342
+ * @summary Get the number of milliseconds between the given dates.
343
+ *
344
+ * @description
345
+ * Get the number of milliseconds between the given dates.
346
+ *
347
+ * @param {Date|Number} dateLeft - the later date
348
+ * @param {Date|Number} dateRight - the earlier date
349
+ * @returns {Number} the number of milliseconds
350
+ * @throws {TypeError} 2 arguments required
351
+ *
352
+ * @example
353
+ * // How many milliseconds are between
354
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
355
+ * const result = differenceInMilliseconds(
356
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
357
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
358
+ * )
359
+ * //=> 1100
360
+ */
361
+ function differenceInMilliseconds(dateLeft, dateRight) {
362
+ requiredArgs(2, arguments);
363
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
364
+ }
365
+
366
+ const DEFAULT_LANGUAGE = 'en';
367
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
368
+ const TRANSLATIONS = {
369
+ en: {
370
+ weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
371
+ bettingType: 'Betting Type:',
372
+ prizeAllocation: 'Prize Allocation (Turnover: € {turnover})',
373
+ prizes: 'Prizes',
374
+ numberOfWinners: 'Number of Winners',
375
+ prizeMoney: 'Prize Money',
376
+ noLatestResult: 'No latest result.',
377
+ loading: 'Loading....'
378
+ },
379
+ ro: {
380
+ bettingType: 'Tip de pariu:',
381
+ prizeAllocation: 'Alocarea premiilor (Cifră de afaceri: € {turnover})',
382
+ prizes: 'Premii',
383
+ numberOfWinners: 'Număr de câștigători',
384
+ prizeMoney: 'Bani de premiu',
385
+ noLatestResult: 'Niciun rezultat recent.',
386
+ loading: 'Se încarcă....'
387
+ },
388
+ fr: {
389
+ bettingType: 'Type de pari:',
390
+ prizeAllocation: "Répartition des prix (Chiffre d'affaires: € {turnover})",
391
+ prizes: 'Prix',
392
+ numberOfWinners: 'Nombre de gagnants',
393
+ prizeMoney: 'Prix en argent',
394
+ noLatestResult: 'Aucun résultat récent.',
395
+ loading: 'Chargement....'
396
+ },
397
+ ar: {
398
+ bettingType: 'نوع الرهان:',
399
+ prizeAllocation: 'تخصيص الجائزة (دوران: € {turnover})',
400
+ prizes: 'الجوائز',
401
+ numberOfWinners: 'عدد الفائزين',
402
+ prizeMoney: 'أموال الجائزة',
403
+ noLatestResult: 'لا يوجد أحدث نتيجة.',
404
+ loading: 'جار التحميل....'
405
+ },
406
+ hr: {
407
+ bettingType: 'Vrsta oklade:',
408
+ prizeAllocation: 'Raspodjela nagrada (Promet: € {turnover})',
409
+ prizes: 'Nagrade',
410
+ numberOfWinners: 'Broj pobjednika',
411
+ prizeMoney: 'Novčana nagrada',
412
+ noLatestResult: 'Nema najnovijih rezultata.',
413
+ loading: 'Učitavanje....'
414
+ }
415
+ };
416
+ const translate = (key, customLang, replacements) => {
417
+ const lang = customLang;
418
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
419
+ if (replacements) {
420
+ Object.keys(replacements).forEach((placeholder) => {
421
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
422
+ });
423
+ }
424
+ return translation;
425
+ };
426
+ const getTranslations = (data) => {
427
+ Object.keys(data).forEach((item) => {
428
+ for (let key in data[item]) {
429
+ TRANSLATIONS[item][key] = data[item][key];
430
+ }
431
+ });
432
+ };
433
+
434
+ const lotteryTippingLatestResultCss = ".lottery-tipping-latest-result {\n padding: 16px;\n container-type: inline-size;\n}\n.lottery-tipping-latest-result .date-selection {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 24px;\n width: 400px;\n}\n.lottery-tipping-latest-result .date-selection-leftIcon, .lottery-tipping-latest-result .date-selection-rightIcon {\n cursor: pointer;\n}\n\n.LotteryTippingTicketController__segmented-control {\n height: 2.2rem;\n display: inline-flex;\n background-color: var(--emw--color-gray-100, #e6e6e6);\n border-radius: 2rem;\n padding: 0.2rem;\n}\n.LotteryTippingTicketController__segment {\n background-color: transparent;\n border: none;\n padding: 0.3rem 0.8rem;\n cursor: pointer;\n font-weight: 500;\n border-radius: 2rem;\n outline: none;\n transition: background-color 0.25s ease, color 0.25s ease;\n white-space: nowrap;\n}\n.LotteryTippingTicketController__segment--active {\n background-color: var(--emw--color-background, #fff);\n color: #000000;\n font-weight: 600;\n}\n.LotteryTippingTicketController__segment:not(.LotteryTippingTicketController__segment--active):hover {\n background-color: var(--emw--button-box-shadow-color-secondary, rgba(0, 0, 0, 0.15));\n}\n\n.betting-type {\n margin-bottom: 16px;\n display: flex;\n align-items: center;\n gap: 20px;\n}\n.betting-type-title {\n font-weight: 600;\n font-size: 16px;\n}\n.betting-type-text {\n font-size: 16px;\n}\n\n.result-wrapper {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 60%;\n margin: 0 auto;\n}\n.result-wrapper .winning-result {\n width: 100%;\n margin-top: 20px;\n}\n.result-wrapper .prize-result {\n width: 100%;\n margin-top: 20px;\n}\n.result-wrapper .prize-result-title {\n font-size: 16px;\n font-weight: 600;\n margin-bottom: 12px;\n}\n.result-wrapper .prize-result-table {\n width: 100%;\n}\n.result-wrapper .prize-result-table-row {\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-evenly;\n}\n.result-wrapper .prize-result-table-column {\n text-align: left;\n padding: 12px 14px;\n width: 160px;\n color: rgb(85, 85, 85);\n font-size: 14px;\n width: calc((100% - 2px) / 3);\n}\n.result-wrapper .prize-result-table-header {\n width: 100%;\n background-color: var(--emw--color-gray-100, #e6e6e6);\n border-radius: 4px;\n}\n.result-wrapper .prize-result-table .prize-result-table-header .prize-result-table-column {\n color: var(--emw--color-gray-300, #333);\n font-weight: 600;\n border-right: 1px solid var(--emw--color-background, #fff);\n}\n.result-wrapper .prize-result-table .prize-result-table-body .prize-result-table-row:hover {\n background-color: var(--emw--color-gray-50, #f5f5f5);\n}\n\n@container (max-width: 980px) and (min-width: 780px) {\n .result-wrapper {\n width: 84%;\n }\n}\n@container (max-width: 780px) and (min-width: 480px) {\n .result-wrapper {\n width: 100%;\n }\n}\n@container (max-width: 480px) {\n .result-wrapper {\n width: 100%;\n }\n .result-wrapper .winning-result {\n width: 100%;\n margin-top: 14px;\n }\n .result-wrapper .prize-result {\n width: 100%;\n }\n .result-wrapper .prize-result-table-column {\n padding: 6px;\n width: 100px;\n }\n}";
435
+ const LotteryTippingLatestResultStyle0 = lotteryTippingLatestResultCss;
436
+
437
+ const leftArrowIcon = renderIconDefinitionToSVGElement(LeftOutlined$1, {
438
+ extraSVGAttrs: { width: '16px', height: '16px', fill: '' }
439
+ });
440
+ const rightArrowIcon = renderIconDefinitionToSVGElement(RightOutlined$1, {
441
+ extraSVGAttrs: { width: '16px', height: '16px', fill: '' }
442
+ });
443
+ const LotteryTippingLatestResult = class {
444
+ constructor(hostRef) {
445
+ index.registerInstance(this, hostRef);
446
+ this.mbSource = undefined;
447
+ this.clientStyling = undefined;
448
+ this.clientStylingUrl = undefined;
449
+ this.translationUrl = '';
450
+ this.language = 'en';
451
+ this.endpoint = undefined;
452
+ this.endpointTicket = undefined;
453
+ this.gameId = undefined;
454
+ this.playerId = undefined;
455
+ this.sessionId = undefined;
456
+ this.hasDrawDates = ['2025-05-28T02:00:00Z', '2025-05-16T02:00:00Z'];
457
+ this.lastestDate = '2025-05-28T02:00:00Z';
458
+ this.drawList = undefined;
459
+ this.curDrawItem = undefined;
460
+ this.curDrawItemIdx = 0;
461
+ this.curDrawSelection = [];
462
+ this.curDrawSelectionBettingType = undefined;
463
+ this.curDrawSelectionMap = {};
464
+ this.curPrizes = undefined;
465
+ this.curPrizeMap = {};
466
+ this.curTurnOver = 0;
467
+ this.isLoading = false;
468
+ this.playTypes = null;
469
+ this.bettingTypes = undefined;
470
+ this.vendorGameId = undefined;
471
+ }
472
+ handleClientStylingChange(newValue, oldValue) {
473
+ if (newValue != oldValue) {
474
+ setClientStyling(this.stylingContainer, this.clientStyling);
475
+ }
476
+ }
477
+ handleClientStylingUrlChange(newValue, oldValue) {
478
+ if (newValue != oldValue) {
479
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
480
+ }
481
+ }
482
+ handleMbSourceChange(newValue, oldValue) {
483
+ if (newValue != oldValue) {
484
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
485
+ }
486
+ }
487
+ componentWillLoad() {
488
+ if (this.translationUrl) {
489
+ getTranslations(JSON.parse(this.translationUrl));
490
+ }
491
+ this.getGameById();
492
+ this.fetDrawList();
493
+ }
494
+ componentDidLoad() {
495
+ if (this.stylingContainer) {
496
+ if (this.mbSource)
497
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
498
+ if (this.clientStyling)
499
+ setClientStyling(this.stylingContainer, this.clientStyling);
500
+ if (this.clientStylingUrl)
501
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
502
+ }
503
+ }
504
+ disconnectedCallback() {
505
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
506
+ }
507
+ async getGameById() {
508
+ var _a, _b, _c, _d;
509
+ try {
510
+ this.isLoading = true;
511
+ const gameInfo = await fetchGameInfo(this.endpoint, this.gameId);
512
+ this.vendorGameId = gameInfo === null || gameInfo === void 0 ? void 0 : gameInfo.type;
513
+ this.playTypes = (_b = (_a = gameInfo === null || gameInfo === void 0 ? void 0 : gameInfo.rules) === null || _a === void 0 ? void 0 : _a.poolGame) === null || _b === void 0 ? void 0 : _b.playTypes;
514
+ this.bettingTypes = (_d = (_c = gameInfo === null || gameInfo === void 0 ? void 0 : gameInfo.rules) === null || _c === void 0 ? void 0 : _c.poolGame) === null || _d === void 0 ? void 0 : _d.bettingTypes;
515
+ }
516
+ catch (e) {
517
+ console.log(e);
518
+ }
519
+ finally {
520
+ this.isLoading = false;
521
+ }
522
+ }
523
+ findLatestDateIdx(dateArr) {
524
+ const currentDate = new Date();
525
+ let closestIndex = 0;
526
+ let minDiff = Infinity;
527
+ dateArr.forEach((dateStr, index) => {
528
+ const date = new Date(dateStr);
529
+ const diff = Math.abs(differenceInMilliseconds(currentDate, date));
530
+ if (diff < minDiff) {
531
+ minDiff = diff;
532
+ closestIndex = index;
533
+ }
534
+ });
535
+ return closestIndex;
536
+ }
537
+ async fetDrawList() {
538
+ try {
539
+ this.isLoading = true;
540
+ const filterData = {
541
+ excludeStatus: 'INIT,OPEN,CANCELED'
542
+ };
543
+ const { items } = await fetchRequest(`${this.endpoint}/games/${this.gameId}/draws${toQueryParams(filterData)}`, 'GET');
544
+ if (!items || items.length === 0)
545
+ return;
546
+ const filteredItems = items.filter((item) => item.winningNumbers.length > 0);
547
+ filteredItems.sort((a, b) => a.date.localeCompare(b.date));
548
+ this.drawList = filteredItems;
549
+ this.hasDrawDates = filteredItems.map((item) => item.date);
550
+ this.curDrawItemIdx = this.findLatestDateIdx(this.hasDrawDates);
551
+ this.lastestDate = this.hasDrawDates[this.curDrawItemIdx];
552
+ //set the first draw as default value
553
+ this.curDrawItem = filteredItems[this.curDrawItemIdx];
554
+ this.curDrawSelectionBettingType = filteredItems[this.curDrawItemIdx].winningNumbers[0].winning_type;
555
+ this.curDrawItem.winningNumbers.forEach((item) => {
556
+ this.curDrawSelectionMap[item.winning_type] = [parseEachLineNumber(item.numbers)];
557
+ });
558
+ this.curDrawItem.prizes.forEach((prize) => {
559
+ const winningType = prize.winningType;
560
+ if (!this.curPrizeMap[winningType]) {
561
+ this.curPrizeMap[winningType] = [prize];
562
+ }
563
+ else {
564
+ this.curPrizeMap[winningType].push(prize);
565
+ this.curPrizeMap[winningType].sort((a, b) => b.totalAmount.value - a.totalAmount.value);
566
+ }
567
+ });
568
+ this.curDrawSelection = this.curDrawSelectionMap[this.curDrawSelectionBettingType];
569
+ this.curPrizes = this.curPrizeMap[this.curDrawSelectionBettingType];
570
+ this.curTurnOver = this.curPrizes.reduce((acc, cur) => acc + Number(cur.totalAmount.value), 0);
571
+ }
572
+ catch (e) {
573
+ console.log(e);
574
+ }
575
+ finally {
576
+ this.isLoading = false;
577
+ }
578
+ }
579
+ changeCurDateItem(idx) {
580
+ this.lastestDate = this.hasDrawDates[idx];
581
+ this.curDrawItemIdx = idx;
582
+ this.curDrawItem = this.drawList[idx];
583
+ this.curDrawSelectionBettingType = this.curDrawItem.winningNumbers[0].winning_type;
584
+ this.curDrawItem.winningNumbers.forEach((item) => {
585
+ this.curDrawSelectionMap[item.winning_type] = [parseEachLineNumber(item.numbers)];
586
+ });
587
+ this.curPrizeMap = {};
588
+ this.curDrawItem.prizes.forEach((prize) => {
589
+ const winningType = prize.winningType;
590
+ if (!this.curPrizeMap[winningType]) {
591
+ this.curPrizeMap[winningType] = [prize];
592
+ }
593
+ else {
594
+ this.curPrizeMap[winningType].push(prize);
595
+ this.curPrizeMap[winningType].sort((a, b) => b.totalAmount.value - a.totalAmount.value);
596
+ }
597
+ });
598
+ this.curDrawSelection = this.curDrawSelectionMap[this.curDrawSelectionBettingType];
599
+ this.curPrizes = this.curPrizeMap[this.curDrawSelectionBettingType];
600
+ this.curTurnOver = this.curPrizes.reduce((acc, cur) => acc + Number(cur.totalAmount.value), 0);
601
+ }
602
+ handleChangeDate(e) {
603
+ const idx = e.detail;
604
+ this.changeCurDateItem(idx);
605
+ }
606
+ preDraw() {
607
+ if (this.curDrawItemIdx > 0) {
608
+ this.changeCurDateItem(--this.curDrawItemIdx);
609
+ }
610
+ }
611
+ nextDraw() {
612
+ if (this.curDrawItemIdx < this.drawList.length - 1) {
613
+ this.changeCurDateItem(++this.curDrawItemIdx);
614
+ }
615
+ }
616
+ handleDrawBettingTypeChange(bettingType) {
617
+ this.curDrawSelectionBettingType = bettingType;
618
+ this.curDrawSelection = this.curDrawSelectionMap[this.curDrawSelectionBettingType];
619
+ this.curPrizes = this.curPrizeMap[this.curDrawSelectionBettingType];
620
+ this.curTurnOver = this.curPrizes.reduce((acc, cur) => acc + Number(cur.totalAmount.value), 0);
621
+ }
622
+ getBettingTypeName(bettingType) {
623
+ var _a, _b;
624
+ const name = (_b = (_a = this.bettingTypes) === null || _a === void 0 ? void 0 : _a.find((item) => item.code === bettingType)) === null || _b === void 0 ? void 0 : _b.name;
625
+ return name !== null && name !== void 0 ? name : bettingType;
626
+ }
627
+ render() {
628
+ return (index.h("div", { key: 'e745605e51cfb92c4503b5e96e0142c8c6b4a8d0', class: "lottery-tipping-latest-result", ref: (el) => (this.stylingContainer = el) }, this.curDrawSelection && this.curDrawSelection.length > 0 && (index.h("div", { key: 'ae825710096f1ec467379bd8c62ee57a7ed472e5', class: "result-wrapper" }, index.h("div", { key: '1bb57f7cce3985f991eecc95546d2716b7960b17', class: "date-selection" }, index.h("div", { key: '9798fd769521260bf8c8e264a6eda272fb4b2841', class: "date-selection-leftIcon", innerHTML: leftArrowIcon, onClick: this.preDraw.bind(this) }), index.h("div", { key: '8ba6a02c69cc4c3b943a8995deaa9d9ceeb2544a', class: "date-selection-calendar" }, index.h("lottery-tipping-calendar", { key: 'a8f1f1f44bc77cf5cfe65434c383b875d5594ed5', date: this.lastestDate, highLightDates: this.hasDrawDates, language: this.language, "translation-url": this.translationUrl })), index.h("div", { key: 'b525125953bba88d153b64ee3ff72112b1ccf80f', class: "date-selection-rightIcon", innerHTML: rightArrowIcon, onClick: this.nextDraw.bind(this) })), index.h("div", { key: 'fcfc5e6e072049f1279fb4388471d2b339849de0', class: "winning-result" }, index.h("div", { key: '00b4104f637649b1e2f31cb5087d3fa53c80f98d', class: "betting-type" }, index.h("div", { key: '1abcbb1189d30622dc9e8601cd57dcc2275e5524', class: "betting-type-title" }, translate('bettingType', this.language)), index.h("div", { key: '1a963bbb6558eb52e4b69bd17025435c6fc5f4f7', class: "betting-type-text" }, index.h("div", { key: '8eeffcdad2700e4ab82f10ad38715a3170812444', class: "LotteryTippingTicketController__segmented-control" }, Object.keys(this.curDrawSelectionMap).map((bettingType) => (index.h("button", { class: {
629
+ LotteryTippingTicketController__segment: true,
630
+ 'LotteryTippingTicketController__segment--active': this.curDrawSelectionBettingType === bettingType
631
+ }, onClick: this.handleDrawBettingTypeChange.bind(this, bettingType) }, this.getBettingTypeName(bettingType))))))), index.h("lottery-tipping-ticket-bet", { key: '723bbd8deda3681467d3cc3d391cf80df47f274b', "session-id": this.sessionId, endpoint: this.endpoint, "game-id": this.vendorGameId, "draw-id": this.curDrawItem.id, "default-bullet-config-line-group": JSON.stringify(this.curDrawSelection), "read-pretty": true, "total-pages": this.curDrawSelection.length, language: this.language, "translation-url": this.translationUrl })), index.h("div", { key: '1fd49aa75429a82e71721ff7da75ecb6b88a460b', class: "prize-result" }, index.h("div", { key: 'a4534c61808ec601e983cce8adda6971e91600cd', class: "prize-result-title" }, translate('prizeAllocation', this.language, { turnover: thousandSeperator(this.curTurnOver) })), index.h("div", { key: '515e207fcf899cb68d11bddb69522f9f5bfc6362', class: "prize-result-table" }, index.h("div", { key: 'd9d4b212c9d4ef6b5c2cf7b4d1aba7d710a73d5a', class: "prize-result-table-header" }, index.h("div", { key: '2daa570ac8e6b26d67003b1bfdb5d8af24a820a5', class: "prize-result-table-row" }, index.h("div", { key: 'ad5a06f05ab88d75608feaad5ab2f51ef3f02ad7', class: "prize-result-table-column" }, translate('prizes', this.language)), index.h("div", { key: '48fc4148c21d5c8fa51de77eea636ba19f5b518f', class: "prize-result-table-column" }, translate('numberOfWinners', this.language)), index.h("div", { key: '3d8880732e6d883f7f2b9a741be5b9c3aed86be2', class: "prize-result-table-column" }, translate('prizeMoney', this.language)))), index.h("div", { key: '85f554ac8100a75f95f61eee7d6df801b9c00d9b', class: "prize-result-table-body" }, this.curPrizes.map((prize) => (index.h("div", { class: "prize-result-table-row" }, index.h("div", { class: "prize-result-table-column" }, prize.divisionDisplayName), index.h("div", { class: "prize-result-table-column" }, prize.tickets), index.h("div", { class: "prize-result-table-column" }, thousandSeperator(prize.totalAmount.value)))))))))), this.curDrawSelection.length == 0 && !this.isLoading && (index.h("div", { key: 'a369e399406415a630a2bd33a1c5e495c57511f7' }, translate('noLatestResult', this.language))), this.isLoading && index.h("div", { key: 'd37433e1e86308b269612678b04d82440ce059a7', class: "loading-wrap" }, translate('loading', this.language))));
632
+ }
633
+ static get watchers() { return {
634
+ "clientStyling": ["handleClientStylingChange"],
635
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
636
+ "mbSource": ["handleMbSourceChange"]
637
+ }; }
638
+ };
639
+ LotteryTippingLatestResult.style = LotteryTippingLatestResultStyle0;
640
+
641
+ exports.LotteryTippingLatestResult = LotteryTippingLatestResult;
642
+ exports._typeof = _typeof;
643
+ exports.getTranslations = getTranslations;
644
+ exports.renderIconDefinitionToSVGElement = renderIconDefinitionToSVGElement;
645
+ exports.requiredArgs = requiredArgs;
646
+ exports.setClientStyling = setClientStyling;
647
+ exports.setClientStylingURL = setClientStylingURL;
648
+ exports.setStreamStyling = setStreamStyling;
649
+ exports.toDate = toDate;
650
+ exports.translate = translate;