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