@everymatrix/casino-engagement-suite-tournament 1.46.0 → 1.47.0

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 (58) hide show
  1. package/dist/casino-engagement-suite-tournament/casino-engagement-suite-tournament.esm.js +1 -1
  2. package/dist/casino-engagement-suite-tournament/index.esm.js +1 -1
  3. package/dist/casino-engagement-suite-tournament/p-2dc46ff5.js +2 -0
  4. package/dist/casino-engagement-suite-tournament/{p-0f4e94ab.entry.js → p-e969a6a6.entry.js} +1 -1
  5. package/dist/casino-engagement-suite-tournament/p-ecf7465a.js +1 -0
  6. package/dist/cjs/casino-engagement-suite-progress-bar_3.cjs.entry.js +2 -2
  7. package/dist/cjs/casino-engagement-suite-tournament-81cbca40.js +733 -0
  8. package/dist/cjs/casino-engagement-suite-tournament.cjs.js +2 -2
  9. package/dist/cjs/{index-16d5d7c3.js → index-6f030cde.js} +28 -43
  10. package/dist/cjs/index.cjs.js +2 -2
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.css +101 -68
  13. package/dist/collection/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.js +168 -313
  14. package/dist/collection/shared/GradientRoundedButton.js +1 -1
  15. package/dist/collection/shared/renderBar.js +2 -2
  16. package/dist/collection/shared/renders.dialog.js +49 -0
  17. package/dist/collection/shared/renders.js +8 -0
  18. package/dist/collection/shared/renders.page.js +117 -0
  19. package/dist/collection/shared/renders.tab.js +30 -0
  20. package/dist/collection/shared/renders.util.js +18 -0
  21. package/dist/collection/utils/api.apdater.js +2 -2
  22. package/dist/collection/utils/bussiness.js +38 -0
  23. package/dist/collection/utils/message.js +63 -0
  24. package/dist/collection/utils/translations.js +8 -9
  25. package/dist/collection/utils/types.js +5 -5
  26. package/dist/collection/utils/util.date.js +1 -1
  27. package/dist/collection/utils/utils.js +6 -2
  28. package/dist/esm/casino-engagement-suite-progress-bar_3.entry.js +2 -2
  29. package/dist/esm/casino-engagement-suite-tournament-65c77450.js +731 -0
  30. package/dist/esm/casino-engagement-suite-tournament.js +3 -3
  31. package/dist/esm/{index-3962add4.js → index-224e880a.js} +29 -43
  32. package/dist/esm/index.js +2 -2
  33. package/dist/esm/loader.js +3 -3
  34. package/dist/stencil.config.dev.js +2 -0
  35. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.d.ts +2 -0
  36. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/components/casino-engagement-suite-tournament/casino-engagement-suite-tournament.d.ts +27 -52
  38. package/dist/types/components.d.ts +16 -0
  39. package/dist/types/shared/GradientRoundedButton.d.ts +1 -1
  40. package/dist/types/shared/renderBar.d.ts +1 -1
  41. package/dist/types/shared/renders.d.ts +6 -0
  42. package/dist/types/shared/renders.dialog.d.ts +2 -0
  43. package/dist/types/shared/renders.page.d.ts +2 -0
  44. package/dist/types/shared/renders.tab.d.ts +3 -0
  45. package/dist/types/shared/renders.util.d.ts +2 -0
  46. package/dist/types/utils/api.apdater.d.ts +1 -1
  47. package/dist/types/utils/bussiness.d.ts +32 -0
  48. package/dist/types/utils/message.d.ts +17 -0
  49. package/dist/types/utils/translations.d.ts +8 -9
  50. package/dist/types/utils/types.d.ts +14 -5
  51. package/dist/types/utils/utils.d.ts +1 -0
  52. package/package.json +1 -1
  53. package/dist/casino-engagement-suite-tournament/p-1bf11325.js +0 -2
  54. package/dist/casino-engagement-suite-tournament/p-5df3ac81.js +0 -1
  55. package/dist/cjs/casino-engagement-suite-tournament-1b738bb2.js +0 -560
  56. package/dist/esm/casino-engagement-suite-tournament-d8471680.js +0 -558
  57. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.d.ts +0 -2
  58. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-engagement-suite-tournament/.stencil/packages/stencil/casino-engagement-suite-tournament/stencil.config.dev.d.ts +0 -2
@@ -0,0 +1,733 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-6f030cde.js');
4
+
5
+ /******************************************************************************
6
+ Copyright (c) Microsoft Corporation.
7
+
8
+ Permission to use, copy, modify, and/or distribute this software for any
9
+ purpose with or without fee is hereby granted.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ ***************************************************************************** */
19
+
20
+ function __rest(s, e) {
21
+ var t = {};
22
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
23
+ t[p] = s[p];
24
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
26
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
27
+ t[p[i]] = s[p[i]];
28
+ }
29
+ return t;
30
+ }
31
+
32
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
33
+ var e = new Error(message);
34
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
35
+ };
36
+
37
+ var Tab;
38
+ (function (Tab) {
39
+ Tab["info"] = "info";
40
+ Tab["leaderboard"] = "leaderboard";
41
+ Tab["games"] = "games";
42
+ })(Tab || (Tab = {}));
43
+ var Time;
44
+ (function (Time) {
45
+ Time["Starts"] = "Starts";
46
+ Time["Ends"] = "Ends";
47
+ })(Time || (Time = {}));
48
+ const localePostprocess = (translationText, props) => {
49
+ Object.keys(props).map((key) => {
50
+ translationText = translationText.replace(`{${key}}`, props[key]);
51
+ });
52
+ return translationText;
53
+ };
54
+ const TRANSLATIONS = Object.assign(Object.assign(Object.assign({ Join: 'Join', Unjoin: 'Unjoin' }, Tab), Time), { TC: 'Terms & Conditions', ScoreCriteria: 'Score Criteria', MinimumBetCriteria: 'Minimum bet criteria', Place: 'place', Prizes: 'Rewards', LeaderboardDetails: 'Leaderboard Details', UnjoinDialog: {
55
+ Title: 'Quit Leaderboard?',
56
+ Description: 'Any progress on the current Leaderboard won’t be kept and you can not rejoin the Leaderboard any more. <br /><br />Would you still like to quit?',
57
+ ButtonYes: 'Yes, I want to quit leaderboard',
58
+ ButtonNo: 'No, Stay on the leaderboard'
59
+ }, WinDialog: {
60
+ Tile: 'Congratulations!',
61
+ Description: 'You won <span>{tournamentName}</span>!',
62
+ ButtonContinue: 'Continue'
63
+ }, NoLeaderboards: 'No Leaderboards yet', NoLeaderboardsTip: 'Try winning tickets to Leaderboards as rewards or launching other booster games', Leaderboards: 'Leaderboards', TipPrize: 'You took <span>{place}</span> place and win <span>{prize}</span>', Tip: 'Competition where your real money bets contribute towards the leaderboard score calculation to win the leaderboard reward.' });
64
+
65
+ const classnames = (...args) => {
66
+ let classnameArray = [];
67
+ args.map((arg) => {
68
+ switch (typeof arg) {
69
+ case 'string':
70
+ classnameArray.push(arg);
71
+ break;
72
+ case 'object':
73
+ Object.keys(arg).map((k) => {
74
+ if (arg[k]) {
75
+ classnameArray.push(k);
76
+ }
77
+ });
78
+ break;
79
+ }
80
+ });
81
+ return classnameArray.join(' ');
82
+ };
83
+ const getNewItems = (newList, oldList, getCondition) => {
84
+ const newItems = newList.filter((newItem) => !oldList.some((oldItem) => getCondition(newItem, oldItem)));
85
+ return newItems;
86
+ };
87
+
88
+ var LeaderboardPage;
89
+ (function (LeaderboardPage) {
90
+ LeaderboardPage["list"] = "list";
91
+ LeaderboardPage["item"] = "item";
92
+ })(LeaderboardPage || (LeaderboardPage = {}));
93
+ var TournamentState;
94
+ (function (TournamentState) {
95
+ TournamentState["Running"] = "Running";
96
+ TournamentState["Unstarted"] = "Unstarted";
97
+ TournamentState["Closed"] = "Closed";
98
+ TournamentState["Closing"] = "Closing";
99
+ })(TournamentState || (TournamentState = {}));
100
+ var DialogType;
101
+ (function (DialogType) {
102
+ DialogType["unjoin"] = "unjoin";
103
+ DialogType["tip"] = "tip";
104
+ DialogType["gift"] = "gift";
105
+ })(DialogType || (DialogType = {}));
106
+
107
+ const getMaxRankStr = (list) => {
108
+ let itemHaveMaxRank;
109
+ list.map((item) => {
110
+ var _a;
111
+ const rank = (_a = item.leaderBoard) === null || _a === void 0 ? void 0 : _a.rank;
112
+ if (!rank) {
113
+ return;
114
+ }
115
+ if (!itemHaveMaxRank) {
116
+ itemHaveMaxRank = item;
117
+ return;
118
+ }
119
+ else {
120
+ if (rank < itemHaveMaxRank.leaderBoard.rank) {
121
+ itemHaveMaxRank = item;
122
+ }
123
+ }
124
+ });
125
+ if (!itemHaveMaxRank) {
126
+ return '-';
127
+ }
128
+ const maxRankStr = `${itemHaveMaxRank.leaderBoard.rank} / ${itemHaveMaxRank.endRank}`;
129
+ return maxRankStr;
130
+ };
131
+ const isTournamentClosed = (tournament) => {
132
+ return [TournamentState.Closed, TournamentState.Closing].includes(tournament.state);
133
+ };
134
+
135
+ const iconClose = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/close.svg" });
136
+ const iconQuestion = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/help.svg" });
137
+ const iconEyeOpen = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/eye-open.svg" });
138
+ const iconEyeClose = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/eye-closed.svg" });
139
+ const iconBack = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/back.svg" });
140
+ const iconReward = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/reward.svg" });
141
+ const iconTrophy = index.h("img", { src: "https://static.everymatrix.com/gic/img/engagement-suite/cup-congras.svg" });
142
+
143
+ const renderGradientRoundedButton = (_a) => {
144
+ var { statedClasses, innerHTML } = _a, props = __rest(_a, ["statedClasses", "innerHTML"]);
145
+ const { isHollow, isPending } = statedClasses;
146
+ return (index.h("button", Object.assign({ class: classnames('GradientRoundedButton', 'GradientRounded', {
147
+ Hollow: isHollow || false,
148
+ Pending: isPending || false,
149
+ }) }, props),
150
+ index.h("span", null, innerHTML)));
151
+ };
152
+
153
+ var GradientButton;
154
+ (function (GradientButton) {
155
+ GradientButton["normal"] = "normal";
156
+ GradientButton["unjoinYes"] = "unjoinYes";
157
+ GradientButton["unjoinNo"] = "unjoinNo";
158
+ })(GradientButton || (GradientButton = {}));
159
+ const renderButton = (instance, buttonType) => {
160
+ const { locale } = instance;
161
+ const buttonCollector = {
162
+ normal: {
163
+ innerHTML: locale.WinDialog.ButtonContinue
164
+ },
165
+ unjoinYes: {
166
+ onClick: () => instance.actionJoin(instance.dialog.data),
167
+ innerHTML: locale.UnjoinDialog.ButtonYes
168
+ },
169
+ unjoinNo: {
170
+ statedClasses: {
171
+ isHollow: true,
172
+ },
173
+ innerHTML: locale.UnjoinDialog.ButtonNo,
174
+ }
175
+ };
176
+ const props = buttonCollector[buttonType];
177
+ return renderGradientRoundedButton({
178
+ statedClasses: Object.assign({ isPending: instance.isActionJoinPending }, props.statedClasses),
179
+ onClick: () => {
180
+ var _a;
181
+ (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call();
182
+ instance.closeDialog();
183
+ },
184
+ innerHTML: props.innerHTML,
185
+ });
186
+ };
187
+ const dialog = {
188
+ gift(instance) {
189
+ const { name: tournamentName } = instance.gifts[0];
190
+ const { locale } = instance;
191
+ return (index.h("div", { class: "PageConfirmContainer" },
192
+ index.h("div", { class: "PageConfirm" },
193
+ index.h("div", null, iconTrophy),
194
+ index.h("div", { class: "Title" }, locale.WinDialog.Tile),
195
+ index.h("div", { class: "Description", innerHTML: localePostprocess(locale.WinDialog.Description, { tournamentName }) }),
196
+ index.h("div", { class: "PageConfirmButtonsGroup" }, renderButton(instance, GradientButton.normal)))));
197
+ },
198
+ unjoin(instance) {
199
+ const { locale } = instance;
200
+ return (index.h("div", { class: "DialogContentUnjoin" },
201
+ index.h("div", { class: "DialogContentUnjoinTitle" }, locale.UnjoinDialog.Title),
202
+ index.h("div", { class: "DialogContentUnjoinDescription", innerHTML: locale.UnjoinDialog.Description }),
203
+ renderButton(instance, GradientButton.unjoinYes),
204
+ renderButton(instance, GradientButton.unjoinNo)));
205
+ }
206
+ };
207
+
208
+ const tournamentAdapter = (tournamentApi) => {
209
+ const keysTime = [
210
+ 'startTime',
211
+ 'endTime',
212
+ 'closeTime',
213
+ 'exhibitionStartTime',
214
+ 'exhibitionEndTime'
215
+ ];
216
+ const tournament = {};
217
+ Object.keys(tournamentApi).map((key) => {
218
+ const value = tournamentApi[key];
219
+ switch (key) {
220
+ case 'games':
221
+ tournament[key] = value.items;
222
+ break;
223
+ default:
224
+ tournament[key] = keysTime.includes(key) ? new Date(value) : value;
225
+ }
226
+ });
227
+ return tournament;
228
+ };
229
+ const leaderboardsAdapter = (leaderboardRes) => {
230
+ let { item, items: leaderboards } = leaderboardRes;
231
+ if (!item) {
232
+ return leaderboards;
233
+ }
234
+ return leaderboards.map((leaderboard) => {
235
+ if (item && item.userID === leaderboard.userID) {
236
+ return Object.assign(Object.assign({}, leaderboard), { isMe: true });
237
+ }
238
+ else {
239
+ return leaderboard;
240
+ }
241
+ });
242
+ };
243
+
244
+ const renderCloseBar = (attr) => {
245
+ const { left, middle, right } = attr;
246
+ const slots = {
247
+ left,
248
+ middle,
249
+ right,
250
+ };
251
+ const getFirstLetterUppercase = (str) => str
252
+ .split('')
253
+ .map((letter, index) => index === 0 ? letter.toUpperCase() : letter)
254
+ .join('');
255
+ return (index.h("div", { class: "WrapperBar" }, Object.keys(slots).map(slotKey => (index.h("div", { class: "WrapperBar" + getFirstLetterUppercase(slotKey) }, slots[slotKey] || '')))));
256
+ };
257
+
258
+ function formatDate(date) {
259
+ const options = {
260
+ year: 'numeric',
261
+ month: 'long',
262
+ day: 'numeric',
263
+ hour: '2-digit',
264
+ minute: '2-digit',
265
+ hour12: false
266
+ };
267
+ return date.toLocaleDateString('en-US', options).replace(' at', ',');
268
+ }
269
+ function addSeconds(date, seconds) {
270
+ const result = new Date(date);
271
+ result.setSeconds(result.getSeconds() + seconds);
272
+ return result;
273
+ }
274
+ function getDifference(startDate, endDate) {
275
+ const diffMs = Math.abs(endDate.getTime() - startDate.getTime()); // Difference in milliseconds
276
+ const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); // Difference in days
277
+ const diffHours = Math.floor((diffMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); // Remaining hours
278
+ const diffMinutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60)); // Remaining minutes
279
+ // Format the output
280
+ const formattedDiff = `${String(diffDays).padStart(2, '0')}d:${String(diffHours).padStart(2, '0')}h:${String(diffMinutes).padStart(2, '0')}m`;
281
+ return formattedDiff;
282
+ }
283
+ function getProgress(startDate, endDate) {
284
+ return ((100 * (new Date().getTime() - startDate.getTime())) / (endDate.getTime() - startDate.getTime())).toFixed(0);
285
+ }
286
+
287
+ const renderTimeBar = (instance, tournament) => {
288
+ return (index.h("section", { class: "TimeContainer" },
289
+ index.h("div", { class: 'Time' }, tournament.playerEnrolled ? ([
290
+ index.h("div", null, getDifference(addSeconds(tournament.startTime, instance.time), tournament.endTime)),
291
+ index.h("div", null, renderGradientRoundedButton({
292
+ statedClasses: {
293
+ isHollow: true,
294
+ isPendding: false,
295
+ },
296
+ innerHTML: `${getProgress(tournament.startTime, tournament.endTime)}%`
297
+ }))
298
+ ]) : ([
299
+ index.h("div", null, formatDate(tournament.startTime)),
300
+ index.h("div", null, formatDate(tournament.endTime))
301
+ ])),
302
+ index.h("casino-engagement-suite-progress-bar", { value: Number(getProgress(tournament.startTime, tournament.endTime)), "hide-percent": true })));
303
+ };
304
+
305
+ const messageSender = {
306
+ UpdateSuiteBarState: (labels) => window.postMessage({ type: 'UpdateLeaderboardState', labels }),
307
+ JoinTournamentReq: (tournament) => { var _a, _b; return window.postMessage({ type: 'JoinTournamentReq', bonusCode: (_b = (_a = tournament.wallets) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.code }); },
308
+ UnjoinTournamentReq: (tournament) => window.postMessage({ type: 'UnjoinTournamentReq', id: tournament.id }),
309
+ UpdateTournamentsItemReq: (tournament) => window.postMessage({ type: 'UpdateTournamentsItemReq', id: tournament.id }),
310
+ UpdateLeaderboardsReq: (tournament, query) => window.postMessage({ type: 'UpdateLeaderboardsReq', id: tournament.id, query }),
311
+ UpdateLeaderboardsPlayerReq: () => window.postMessage({ type: 'UpdateLeaderboardsPlayerReq' })
312
+ };
313
+ const messageReceiver = (instance) => {
314
+ const receiver = {
315
+ UpdateLeaderboardsPlayerRes: (rest) => {
316
+ const rankStr = getMaxRankStr(rest.data.items);
317
+ window.postMessage({ type: 'UpdateLeaderboardState', rank: rankStr });
318
+ },
319
+ UpdateLeaderboardStateReq: () => {
320
+ window.postMessage({ type: 'UpdateLeaderboardState', labels: ['win', 'new'] });
321
+ },
322
+ UpdateTournamentsItemRes: (rest) => {
323
+ const tournamentNew = tournamentAdapter(rest.data.item);
324
+ instance.tournamentItem = tournamentNew;
325
+ updateTournamentListByItem(instance, tournamentNew);
326
+ },
327
+ UpdateLeaderboardsRes: (rest) => {
328
+ instance.leaderboards = leaderboardsAdapter(rest.data);
329
+ },
330
+ JoinTournamentRes: (rest) => commonJoinRes(instance, rest),
331
+ UnjoinTournamentRes: (rest) => commonJoinRes(instance, rest)
332
+ };
333
+ return receiver;
334
+ };
335
+ const commonJoinRes = (instance, rest) => {
336
+ const { success } = rest;
337
+ if (success) {
338
+ instance.tournamentItem = Object.assign(Object.assign({}, instance.tournamentItem), { playerEnrolled: !!!instance.tournamentItem.playerEnrolled });
339
+ switch (instance.page) {
340
+ case LeaderboardPage.item: {
341
+ break;
342
+ }
343
+ case LeaderboardPage.list: {
344
+ updateTournamentListByItem(instance, instance.tournamentItem);
345
+ break;
346
+ }
347
+ }
348
+ }
349
+ if (instance.nextPage) {
350
+ instance.setPage(instance.nextPage);
351
+ instance.nextPage = undefined;
352
+ }
353
+ instance.isActionJoinPending = false;
354
+ };
355
+ const updateTournamentListByItem = (instance, tournament) => {
356
+ instance.tournamentList = instance.tournamentList.map((_tournament) => {
357
+ if (_tournament.id === tournament.id) {
358
+ return tournamentAdapter(tournament);
359
+ }
360
+ else {
361
+ return _tournament;
362
+ }
363
+ });
364
+ };
365
+
366
+ const page = {
367
+ list(instance) {
368
+ var _a;
369
+ if (!instance.tournamentList) {
370
+ instance.tournamentList = (_a = instance.leaderboardsInit) === null || _a === void 0 ? void 0 : _a.map(item => tournamentAdapter(item));
371
+ return index.h("general-animation-loading", null);
372
+ }
373
+ const { locale } = instance;
374
+ if (instance.tournamentList.length) {
375
+ const onClickListItemChangePage = (tournament) => {
376
+ instance.setPage(LeaderboardPage.item, { tournament });
377
+ instance.newIdList = instance.newIdList.filter(id => id !== tournament.id);
378
+ };
379
+ return renderLeaderboardContainer(instance, index.h("div", { class: "Leaderboards Row" }, instance.tournamentList.map(_tournament => (index.h("div", { class: classnames("LeaderboardsItem", _tournament.playerEnrolled ? ' GradientRounded Hollow' : ''), onClick: () => onClickListItemChangePage(_tournament) },
380
+ index.h("div", { class: "LeaderboardsItemContainer" },
381
+ renderTitleContainer(instance, _tournament),
382
+ renderTimeBar(instance, _tournament)),
383
+ index.h("div", { class: "LeaderboardLabels" }, instance.newIdList.includes(_tournament.id) && (index.h("div", { class: "LeaderboardLabel" },
384
+ index.h("span", null, "new")))))))));
385
+ }
386
+ else {
387
+ return renderLeaderboardContainer(instance, index.h("div", { class: "NoLeaderboards Row" },
388
+ index.h("div", null, locale.NoLeaderboards),
389
+ index.h("div", null, locale.NoLeaderboardsTip)));
390
+ }
391
+ },
392
+ item(instance) {
393
+ if (!instance.tournamentItem)
394
+ return index.h("general-animation-loading", null);
395
+ const renderTabs = () => {
396
+ const { locale, tab } = instance;
397
+ const onClickTab = (tab) => {
398
+ instance.tab = tab;
399
+ switch (tab) {
400
+ case Tab.leaderboard:
401
+ instance.leaderboards = undefined;
402
+ messageSender.UpdateLeaderboardsReq(instance.tournamentItem);
403
+ break;
404
+ case Tab.games:
405
+ messageSender.UpdateTournamentsItemReq(instance.tournamentItem);
406
+ break;
407
+ }
408
+ };
409
+ return (index.h("div", { class: "TabsContainer" },
410
+ index.h("div", { class: "Tabs" }, Object.keys(Tab).map((_tab) => (index.h("div", { class: classnames({ active: tab === _tab }),
411
+ onClick: () => onClickTab(_tab) }, locale[_tab]))))));
412
+ };
413
+ return renderLeaderboardContainer(instance, [
414
+ renderTitleContainer(instance, instance.tournamentItem),
415
+ renderTabs(),
416
+ instance.renders.tab[instance.tab]()
417
+ ]);
418
+ },
419
+ };
420
+ const renderTitleContainer = (instance, tournament) => {
421
+ const { locale } = instance;
422
+ const onClickItemJoin = (tournament) => {
423
+ if (tournament.playerEnrolled) {
424
+ instance.openDialog(DialogType.unjoin, tournament);
425
+ }
426
+ else {
427
+ instance.actionJoin(tournament);
428
+ instance.tournamentItem = tournament;
429
+ }
430
+ };
431
+ return (index.h("div", { class: "TitleContainer" },
432
+ index.h("div", { class: "Title" }, tournament.nameOrTitle),
433
+ tournament.state !== TournamentState.Closed && (index.h("div", null, renderGradientRoundedButton({
434
+ statedClasses: {
435
+ isHollow: tournament.playerEnrolled,
436
+ isPending: instance.isActionJoinPending,
437
+ },
438
+ onClick: (e) => {
439
+ e.stopPropagation();
440
+ onClickItemJoin(tournament);
441
+ },
442
+ innerHTML: tournament.playerEnrolled ? locale.Unjoin : locale.Join,
443
+ })))));
444
+ };
445
+ const renderLeaderboardContainer = (instance, render) => {
446
+ const { dialog: { isOpen } } = instance;
447
+ const renderBar = renderCloseBar({
448
+ right: (index.h("span", { onClick: () => instance.closeDialog() }, iconClose))
449
+ });
450
+ const renderDialogContent = () => {
451
+ switch (instance.dialog.type) {
452
+ case DialogType.unjoin:
453
+ return instance.renders.dialog.unjoin(); //renderDialogContentUnjoin()
454
+ case DialogType.tip:
455
+ return (index.h("div", { class: "Tip" }, instance.locale.Tip));
456
+ case DialogType.gift:
457
+ return instance.renders.dialog.gift();
458
+ }
459
+ };
460
+ const getWrapperBarData = () => {
461
+ const { page, locale } = instance;
462
+ switch (page) {
463
+ case LeaderboardPage.list:
464
+ return {
465
+ left: index.h("span", { onClick: () => instance.openDialog(DialogType.tip) }, iconQuestion),
466
+ middle: locale.Leaderboards
467
+ };
468
+ case LeaderboardPage.item:
469
+ return {
470
+ left: (index.h("span", { onClick: () => instance.setPage(LeaderboardPage.list) }, iconBack)),
471
+ middle: '',
472
+ };
473
+ }
474
+ };
475
+ const renderCloseBarInLayout = () => {
476
+ const { left, middle } = getWrapperBarData();
477
+ return renderCloseBar({ left, middle,
478
+ right: (index.h("span", { onClick: () => instance.close.emit() }, iconClose))
479
+ });
480
+ };
481
+ return (index.h("div", { class: `Wrapper ${instance.device}` },
482
+ index.h("div", { class: classnames("WrapperContent", { faded: isOpen }) },
483
+ renderCloseBarInLayout(),
484
+ index.h("div", { class: "Root" },
485
+ index.h("div", { class: "Main" }, render))),
486
+ index.h("div", { class: "WrapperUtil" },
487
+ index.h("dialog", { open: isOpen },
488
+ index.h("div", { class: "GradientRounded Hollow" },
489
+ renderBar,
490
+ isOpen && renderDialogContent())))));
491
+ };
492
+
493
+ const tab = {
494
+ info(instance) {
495
+ var _a, _b;
496
+ const { locale, tournamentItem: tournament, isShowInfo } = instance;
497
+ return (index.h("div", { class: "InfoContainer" },
498
+ renderTimeBar(instance, tournament),
499
+ (index.h("section", { class: "ShowInfo", onClick: () => instance.isShowInfo = !instance.isShowInfo },
500
+ index.h("p", null,
501
+ index.h("span", null, isShowInfo ? iconEyeClose : iconEyeOpen),
502
+ index.h("span", null, locale.LeaderboardDetails)))),
503
+ isShowInfo && (index.h("section", { class: "Info" },
504
+ index.h("div", null, tournament.description),
505
+ index.h("div", { class: "Criterias" },
506
+ index.h("div", null,
507
+ locale.ScoreCriteria,
508
+ ": ",
509
+ index.h("span", null, tournament.scoreCriteria)),
510
+ index.h("div", null,
511
+ locale.MinimumBetCriteria,
512
+ ": ",
513
+ index.h("span", null, tournament.minBetCount))),
514
+ index.h("div", { class: "TC" },
515
+ index.h("a", { href: tournament.termsUrl, target: '_blank' }, locale.TC)))),
516
+ isTournamentClosed(instance.tournamentItem) && ((_a = instance.leaderboards) === null || _a === void 0 ? void 0 : _a.find(l => l.isMe)) && (index.h("section", { class: "ResultPrize", innerHTML: localePostprocess(locale.TipPrize, getResultPrize((_b = instance.leaderboards) === null || _b === void 0 ? void 0 : _b.find(l => l.isMe))) })),
517
+ index.h("section", { class: "Prizes" },
518
+ index.h("div", { class: "PrizesHeader" },
519
+ iconReward,
520
+ index.h("span", { class: "PrizesText" }, locale.Prizes)),
521
+ tournament.prizes.map((prize, index$1) => (index.h("div", { class: "Prize" },
522
+ index$1 + 1,
523
+ " ",
524
+ locale.Place,
525
+ ": ",
526
+ index.h("span", { class: "PrizeText" }, prize.name)))))));
527
+ },
528
+ leaderboard(instance) {
529
+ if (!instance.leaderboards)
530
+ return index.h("general-animation-loading", null);
531
+ if (!instance.leaderboards.length)
532
+ return '';
533
+ return (index.h("table", { class: "Leaderboards" }, instance.leaderboards.map(leaderboard => (index.h("tr", { class: classnames({ isMe: leaderboard.isMe }) },
534
+ index.h("td", { class: "LeaderboardRank" },
535
+ index.h("span", null, leaderboard.rank)),
536
+ index.h("td", { class: "LeaderboardName" }, leaderboard.shortName),
537
+ index.h("td", { class: "LeaderboardScore" }, leaderboard.score),
538
+ index.h("td", { class: "LeaderboardPrize" }, leaderboard.prizeName))))));
539
+ },
540
+ games(instance) {
541
+ var _a;
542
+ return (index.h("div", { class: "Games" }, (_a = instance.tournamentItem.games) === null || _a === void 0 ? void 0 : _a.map(game => (index.h("div", null,
543
+ index.h("img", { src: game.defaultThumbnail, alt: "" }))))));
544
+ },
545
+ };
546
+ const getResultPrize = (leaderboard) => {
547
+ return {
548
+ prize: leaderboard.prizeName,
549
+ place: leaderboard.rank,
550
+ };
551
+ };
552
+
553
+ const renders = {
554
+ dialog,
555
+ page,
556
+ tab
557
+ };
558
+
559
+ var GeneralAnimationLoadingCczQRHih = {};
560
+
561
+ (function (exports) {
562
+ var V=Object.defineProperty,z=Object.defineProperties;var F=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var x=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t)=>{for(var n in t||(t={}))G.call(t,n)&&x(e,n,t[n]);if(N)for(var n of N(t))q.call(t,n)&&x(e,n,t[n]);return e},M=(e,t)=>z(e,F(t));var $=(e,t,n)=>x(e,typeof t!="symbol"?t+"":t,n);var T=(e,t,n)=>new Promise((s,l)=>{var i=o=>{try{u(n.next(o));}catch(r){l(r);}},c=o=>{try{u(n.throw(o));}catch(r){l(r);}},u=o=>o.done?s(o.value):Promise.resolve(o.value).then(i,c);u((n=n.apply(e,t)).next());});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function _(){}function H(e){return e()}function B(){return Object.create(null)}function b(e){e.forEach(H);}function I(e){return typeof e=="function"}function K(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Q(e){return Object.keys(e).length===0}function W(e,t){e.appendChild(t);}function X(e,t,n){const s=Y(e);if(!s.getElementById(t)){const l=L("style");l.id=t,l.textContent=n,Z(s,l);}}function Y(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function Z(e,t){return W(e.head||e,t),t.sheet}function U(e,t,n){e.insertBefore(t,n||null);}function C(e){e.parentNode&&e.parentNode.removeChild(e);}function L(e){return document.createElement(e)}function tt(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n);}function et(e){return Array.from(e.childNodes)}function nt(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0;}),t}let j;function g(e){j=e;}const h=[],k=[];let p=[];const R=[],it=Promise.resolve();let v=!1;function st(){v||(v=!0,it.then(y));}function E(e){p.push(e);}const w=new Set;let a=0;function y(){if(a!==0)return;const e=j;do{try{for(;a<h.length;){const t=h[a];a++,g(t),rt(t.$$);}}catch(t){throw h.length=0,a=0,t}for(g(null),h.length=0,a=0;k.length;)k.pop()();for(let t=0;t<p.length;t+=1){const n=p[t];w.has(n)||(w.add(n),n());}p.length=0;}while(h.length);for(;R.length;)R.pop()();v=!1,w.clear(),g(e);}function rt(e){if(e.fragment!==null){e.update(),b(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(E);}}function lt(e){const t=[],n=[];p.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),p=t;}const ct=new Set;function ot(e,t){e&&e.i&&(ct.delete(e),e.i(t));}function ut(e,t,n){const{fragment:s,after_update:l}=e.$$;s&&s.m(t,n),E(()=>{const i=e.$$.on_mount.map(H).filter(I);e.$$.on_destroy?e.$$.on_destroy.push(...i):b(i),e.$$.on_mount=[];}),l.forEach(E);}function dt(e,t){const n=e.$$;n.fragment!==null&&(lt(n.after_update),b(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[]);}function $t(e,t){e.$$.dirty[0]===-1&&(h.push(e),st(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31;}function ft(e,t,n,s,l,i,c=null,u=[-1]){const o=j;g(e);const r=e.$$={fragment:null,ctx:[],props:i,update:_,not_equal:l,bound:B(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(o?o.$$.context:[])),callbacks:B(),dirty:u,skip_bound:!1,root:t.target||o.$$.root};c&&c(r.root);let f=!1;if(r.ctx=n?n(e,t.props||{},(d,O,...S)=>{const A=S.length?S[0]:O;return r.ctx&&l(r.ctx[d],r.ctx[d]=A)&&(!r.skip_bound&&r.bound[d]&&r.bound[d](A),f&&$t(e,d)),O}):[],r.update(),f=!0,b(r.before_update),r.fragment=s?s(r.ctx):!1,t.target){if(t.hydrate){const d=et(t.target);r.fragment&&r.fragment.l(d),d.forEach(C);}else r.fragment&&r.fragment.c();t.intro&&ot(e.$$.fragment),ut(e,t.target,t.anchor),y();}g(o);}let D;typeof HTMLElement=="function"&&(D=class extends HTMLElement{constructor(t,n,s){super();$(this,"$$ctor");$(this,"$$s");$(this,"$$c");$(this,"$$cn",!1);$(this,"$$d",{});$(this,"$$r",!1);$(this,"$$p_d",{});$(this,"$$l",{});$(this,"$$l_u",new Map);this.$$ctor=t,this.$$s=n,s&&this.attachShadow({mode:"open"});}addEventListener(t,n,s){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(n),this.$$c){const l=this.$$c.$on(t,n);this.$$l_u.set(n,l);}super.addEventListener(t,n,s);}removeEventListener(t,n,s){if(super.removeEventListener(t,n,s),this.$$c){const l=this.$$l_u.get(n);l&&(l(),this.$$l_u.delete(n));}}connectedCallback(){return T(this,null,function*(){if(this.$$cn=!0,!this.$$c){let t=function(i){return ()=>{let c;return {c:function(){c=L("slot"),i!=="default"&&tt(c,"name",i);},m:function(r,f){U(r,c,f);},d:function(r){r&&C(c);}}}};if(yield Promise.resolve(),!this.$$cn||this.$$c)return;const n={},s=nt(this);for(const i of this.$$s)i in s&&(n[i]=[t(i)]);for(const i of this.attributes){const c=this.$$g_p(i.name);c in this.$$d||(this.$$d[c]=m(c,i.value,this.$$p_d,"toProp"));}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:M(P({},this.$$d),{$$slots:n,$$scope:{ctx:[]}})});const l=()=>{this.$$r=!0;for(const i in this.$$p_d)if(this.$$d[i]=this.$$c.$$.ctx[this.$$c.$$.props[i]],this.$$p_d[i].reflect){const c=m(i,this.$$d[i],this.$$p_d,"toAttribute");c==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,c);}this.$$r=!1;};this.$$c.$$.after_update.push(l),l();for(const i in this.$$l)for(const c of this.$$l[i]){const u=this.$$c.$on(i,c);this.$$l_u.set(c,u);}this.$$l={};}})}attributeChangedCallback(t,n,s){var l;this.$$r||(t=this.$$g_p(t),this.$$d[t]=m(t,s,this.$$p_d,"toProp"),(l=this.$$c)==null||l.$set({[t]:this.$$d[t]}));}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0);});}$$g_p(t){return Object.keys(this.$$p_d).find(n=>this.$$p_d[n].attribute===t||!this.$$p_d[n].attribute&&n.toLowerCase()===t)||t}});function m(e,t,n,s){var i;const l=(i=n[e])==null?void 0:i.type;if(t=l==="Boolean"&&typeof t!="boolean"?t!=null:t,!s||!n[e])return t;if(s==="toAttribute")switch(l){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t==null?null:t;default:return t}else switch(l){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function at(e,t,n,s,l,i){let c=class extends D{constructor(){super(e,n,l),this.$$p_d=t;}static get observedAttributes(){return Object.keys(t).map(u=>(t[u].attribute||u).toLowerCase())}};return Object.keys(t).forEach(u=>{Object.defineProperty(c.prototype,u,{get(){return this.$$c&&u in this.$$c?this.$$c[u]:this.$$d[u]},set(o){var r;o=m(u,o,t),this.$$d[u]=o,(r=this.$$c)==null||r.$set({[u]:o});}});}),s.forEach(u=>{Object.defineProperty(c.prototype,u,{get(){var o;return (o=this.$$c)==null?void 0:o[u]}});}),e.element=c,c}class ht{constructor(){$(this,"$$");$(this,"$$set");}$destroy(){dt(this,1),this.$destroy=_;}$on(t,n){if(!I(n))return _;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(n),()=>{const l=s.indexOf(n);l!==-1&&s.splice(l,1);}}$set(t){this.$$set&&!Q(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1);}}const _t="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(_t);function pt(e){X(e,"svelte-gnt082",".LoaderContainer{display:flex;justify-content:center}.lds-ellipsis{display:inline-block;position:relative;width:80px;height:80px}.lds-ellipsis div{position:absolute;top:33px;width:13px;height:13px;border-radius:50%;background:#d1d1d1;animation-timing-function:cubic-bezier(0, 1, 1, 0)}.lds-ellipsis div:nth-child(1){left:8px;animation:lds-ellipsis1 0.6s infinite}.lds-ellipsis div:nth-child(2){left:8px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(3){left:32px;animation:lds-ellipsis2 0.6s infinite}.lds-ellipsis div:nth-child(4){left:56px;animation:lds-ellipsis3 0.6s infinite}@keyframes lds-ellipsis1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}100%{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}");}function gt(e){let t;return {c(){t=L("div"),t.innerHTML='<section class="LoaderContainer" part="LoaderContainer"><div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div></section>';},m(n,s){U(n,t,s),e[3](t);},p:_,i:_,o:_,d(n){n&&C(t),e[3](null);}}}function mt(e,t,n){let{clientstyling:s=""}=t,{clientstylingurl:l=""}=t,i;const c=()=>{let r=document.createElement("style");r.innerHTML=s,i.appendChild(r);},u=()=>{let r=new URL(l),f=document.createElement("style");fetch(r.href).then(d=>d.text()).then(d=>{f.innerHTML=d,setTimeout(()=>{i.appendChild(f);},1),setTimeout(()=>{},500);});};function o(r){k[r?"unshift":"push"](()=>{i=r,n(0,i);});}return e.$$set=r=>{"clientstyling"in r&&n(1,s=r.clientstyling),"clientstylingurl"in r&&n(2,l=r.clientstylingurl);},e.$$.update=()=>{e.$$.dirty&3&&s&&i&&c(),e.$$.dirty&5&&l&&i&&u();},[i,s,l,o]}class J extends ht{constructor(t){super(),ft(this,t,mt,gt,K,{clientstyling:1,clientstylingurl:2},pt);}get clientstyling(){return this.$$.ctx[1]}set clientstyling(t){this.$$set({clientstyling:t}),y();}get clientstylingurl(){return this.$$.ctx[2]}set clientstylingurl(t){this.$$set({clientstylingurl:t}),y();}}at(J,{clientstyling:{},clientstylingurl:{}},[],[],!0);exports.default=J;
563
+ }(GeneralAnimationLoadingCczQRHih));
564
+
565
+ if(typeof window!="undefined"){let n=function(t){return function(...i){try{return t.apply(this,i)}catch(e){if(e instanceof DOMException&&e.message.includes("has already been used with this registry")||e.message.includes("Cannot define multiple custom elements with the same tag name"))return !1;throw e}}};customElements.define=n(customElements.define),Promise.resolve().then(()=>GeneralAnimationLoadingCczQRHih).then(({default:t})=>{!customElements.get("general-animation-loading")&&customElements.define("general-animation-loading",t.element);});}
566
+
567
+ const casinoEngagementSuiteTournamentCss = ".Wrapper{height:100%;position:relative;color:var(--emw--color-typography, #FFFFFF);display:flex;background-color:var(--emw--color-background, hsl(254, 44%, 15%));flex-direction:column;border-radius:24px;overflow-y:auto}.Wrapper.Mobile{border-radius:16px}.WrapperContent{padding-bottom:20px;transition:0.5s filter}.WrapperContent.faded{filter:brightness(53.3333333333%)}.Wrapper.Mobile .WrapperBar{padding:20px 8px 8px}.WrapperBar{display:flex;width:100%;padding:32px 20px 20px}.WrapperBarLeft,.WrapperBarRight{cursor:pointer;z-index:1}.WrapperBarMiddle{flex-grow:1;text-align:center;font-size:var(--emw--font-size-medium, 16px);line-height:16px;font-weight:500;color:var(--emw--color-secondary, rgb(187, 185, 195))}:host{display:block;font-size:var(--emw--font-size-x-small, 12px);font-family:Inter}.Row{margin:24px 0;padding:0 20px}.Row:first-child{margin:0}.LeaderboardsItem{position:relative;margin:10px 0;border:1px solid rgb(64, 57, 86);border-radius:16px}.LeaderboardsItem.Hollow{border-color:transparent}.LeaderboardsItem:first-child{margin-top:0}.LeaderboardsItemContainer{padding-top:16px}.Info{margin:24px 0;padding:0 20px}.TimeContainer{margin:24px 0;padding:0 20px}.TimeContainer .Time{display:flex;justify-content:space-between;font-size:var(--emw--font-size-x-small, 12px);align-items:center;color:var(--emw--color-secondary, rgb(187, 185, 195))}.TimeContainer .Time button{font-size:var(--emw--font-size-x-small, 12px);height:20px;padding:0}.TimeContainer .Time button::before{inset:inherit;border:0}.ShowInfo{margin:24px 0;padding:0 20px;cursor:pointer;color:rgb(102, 97, 120)}.ShowInfo p{display:flex;gap:4px}.TitleContainer{display:flex;justify-content:space-between;margin:24px 0;padding:0 20px;margin-top:0;gap:10px;font-family:Montserrat}.TitleContainer .GradientRoundedButton{width:120px}.TabsContainer{margin:24px 0;padding:0 20px;margin:0 20px;padding:0;border-bottom:1px solid #575757}.Tabs{display:flex;justify-content:space-between;justify-content:start;font-size:var(--emw--font-size-x-small, 12px);margin-bottom:-1px}.Tabs>div{padding:10px;color:rgb(102, 97, 120);cursor:pointer}.Tabs>div.active{color:var(--emw--color-typography, #FFF);border-bottom:2px solid var(--emw--color-typography, #FFF)}.Title{font-size:var(--emw--font-size-medium, 16px);font-weight:700;line-height:19.5px;text-align:left;word-break:break-word}.TC{margin-top:12px}.TC a{color:rgb(89, 209, 255)}.Criterias{margin:12px 0}.Criterias span{color:var(--emw--color-primary, rgb(255, 214, 47));font-weight:400}.ResultPrize{margin:24px 0;padding:0 20px}.ResultPrize span{color:var(--emw--color-primary, rgb(255, 214, 47));font-weight:400}.Prizes{margin:24px 0;padding:0 20px}.Prizes .PrizesText{margin-left:3px;font-weight:600}.Prizes .PrizesHeader{align-items:center;display:flex}.Prizes .PrizesHeader img{width:12px}.Prizes .Prize{margin:8px 0}.Prizes .Prize .PrizeText{color:var(--emw--color-primary, rgb(255, 214, 47));font-weight:400}*{box-sizing:border-box}.Leaderboards{width:100%;text-align:center;border-collapse:collapse}.Leaderboards td{opacity:0.6;padding:20px 5px}.Leaderboards td:first-child{padding-left:20px}.Leaderboards td:last-child{padding-right:20px}.Leaderboards .LeaderboardName{color:var(--emw--color-typography, #FFF);opacity:1}.Leaderboards tr.isMe{background:rgba(0, 0, 0, 0.2)}.Leaderboards tr.isMe .LeaderboardRank span{padding:0px 3px;opacity:1;border:1px solid var(--emw--color-primary, rgb(255, 214, 47));border-radius:11px}.Leaderboards tr.isMe td{color:var(--emw--color-primary, rgb(255, 214, 47))}.LeaderboardLabels{position:absolute;top:-6px;right:18px;display:flex;gap:4px}.LeaderboardLabel{width:30px;height:15px;background:var(--emw--engagement-suite-gradient-golden, linear-gradient(180deg, #FFB801 15.86%, #FEF746 31.36%, #FBFFE0 36.86%, #FFFA60 47.86%, #FF9400 87.36%));border-radius:var(--emw--border-radius-x-small, 2px);display:inline-flex;padding:0 2px;align-items:center;justify-content:center}.LeaderboardLabel span{display:inline-block;text-transform:uppercase;font-size:var(--emw--font-size-3x-small, 7px);line-height:7px;font-weight:var(--emw--font-weight-bold, 700);font-family:var(--emw--font-family-secondary, \"Montserrat\", sans-serif);color:var(--emw--color-background, #1E1638)}.Games{margin:24px 0;padding:0 20px;display:flex;flex-wrap:wrap;justify-content:space-evenly;gap:4px 7.25px}.Games img{width:60px}dialog{position:absolute;top:30px;width:100%;height:100%;background:transparent;border:0;padding:0;color:var(--emw--color-typography, #FFFFFF)}dialog>div{margin:32px;border-radius:8px;background:var(--emw--color-background, hsl(254, 44%, 15%));border:1px solid hsl(254, 20%, 28%);align-items:center}.DialogContentUnjoin{padding:32px;padding-top:10px;display:flex;gap:10px;flex-direction:column}.DialogContentUnjoinTitle{font-family:Montserrat;font-size:var(--emw--font-size-large, 20px);font-weight:600;line-height:24.38px;text-align:center}.DialogContentUnjoinDescription{color:var(--emw--color-secondary, rgb(187, 185, 195));margin-bottom:30px}.Tip{padding:32px;padding-top:10px;color:var(--emw--color-secondary, rgb(187, 185, 195));font-size:var(--emw--font-size-small, 14px)}.PageConfirmContainer{text-align:center;width:80%;margin:0 auto}.PageConfirm{padding:40px 32px;display:flex;flex-direction:column;gap:20px}.PageConfirm .Title{font-size:var(--emw--font-size-large, 20px);text-align:center}.PageConfirm .Description{color:var(--emw--color-secondary, rgb(187, 185, 195));font-weight:400}.PageConfirm .Description span{color:var(--emw--color-typography, #FFF);font-weight:600}.PageConfirmButtonsGroup{width:150px;margin:0 auto;display:flex;flex-direction:column;gap:10px}.GradientRounded{display:block;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%);color:rgb(30, 22, 56);position:relative;border-radius:16px}.GradientRounded.Hollow{background:rgb(30, 22, 56);color:#FFFFFF}.GradientRounded.Hollow::before{content:\"\";position:absolute;inset:0;border-radius:15px;border:1px solid transparent;background:linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%) border-box;-webkit-mask:linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);-webkit-mask-composite:destination-out;mask-composite:exclude}.GradientRoundedButton{border:none;padding:7px;height:32px;width:100%;font-size:var(--emw--font-size-small, 14px);font-weight:700;line-height:17.07px;text-align:center;transition:0.5s opacity;cursor:pointer}.GradientRoundedButton.Pending{cursor:not-allowed;opacity:0.3}.GradientRoundedButton.Hollow span{background:-webkit-linear-gradient(98.25deg, rgb(255, 148, 0) 22.48%, rgb(254, 247, 70) 131.02%, rgb(255, 226, 74) 131.9%);-webkit-background-clip:text;-webkit-text-fill-color:transparent}";
568
+ const CasinoEngagementSuiteTournamentStyle0 = casinoEngagementSuiteTournamentCss;
569
+
570
+ const CasinoEngagementSuiteTournament = class {
571
+ handleEvent(e) {
572
+ var _a, _b;
573
+ const _c = e.data, { type } = _c, rest = __rest(_c, ["type"]);
574
+ (_b = (_a = messageReceiver(this)) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b.call(null, rest);
575
+ }
576
+ checkNewIdList() {
577
+ if (this.newIdList.length > 0) {
578
+ this.addLabel('new');
579
+ }
580
+ else {
581
+ this.removeLabel('new');
582
+ }
583
+ }
584
+ syncBarState(newTournamentList, oldTournamentList) {
585
+ if (!oldTournamentList) {
586
+ // init
587
+ this.checkNewIdList();
588
+ if (this.gifts.length) {
589
+ this.addLabel('win');
590
+ }
591
+ }
592
+ else {
593
+ const items = getNewItems(newTournamentList, oldTournamentList, (newItem, oldItem) => newItem.id === oldItem.id);
594
+ this.newIdList = [...this.newIdList, ...items.map((item) => item.id)];
595
+ }
596
+ }
597
+ showPropWatcher(newValue, oldValue) {
598
+ if (oldValue == false && newValue == true) {
599
+ this.checkGift();
600
+ }
601
+ }
602
+ addLabel(tag) {
603
+ if (!this.labels.includes(tag)) {
604
+ this.labels.push(tag);
605
+ }
606
+ messageSender.UpdateSuiteBarState(this.labels);
607
+ }
608
+ removeLabel(tag) {
609
+ this.labels = this.labels.filter((label) => label != tag);
610
+ messageSender.UpdateSuiteBarState(this.labels);
611
+ }
612
+ setTimeInterval() {
613
+ this.timeHolder = setInterval(() => {
614
+ this.time = (this.tournamentList || this.tournamentItem) ? this.time + 1 : 0;
615
+ }, 1000);
616
+ }
617
+ checkGift() {
618
+ //check gift
619
+ if (this.gifts.length) {
620
+ const onClose = () => {
621
+ if (this.dialog.type === DialogType.gift) {
622
+ this.gifts = this.gifts.slice(1);
623
+ setTimeout(() => {
624
+ this.checkGift();
625
+ }, 300);
626
+ }
627
+ };
628
+ this.openDialog(DialogType.gift, this.gifts[0], onClose);
629
+ }
630
+ else {
631
+ this.removeLabel('win');
632
+ }
633
+ }
634
+ connectedCallback() {
635
+ this.setTimeInterval();
636
+ messageSender.UpdateLeaderboardsPlayerReq();
637
+ }
638
+ disconnectedCallback() {
639
+ clearInterval(this.timeHolder);
640
+ }
641
+ actionJoin(tournament) {
642
+ if (this.isActionJoinPending)
643
+ return;
644
+ this.isActionJoinPending = true;
645
+ try {
646
+ if (tournament.playerEnrolled) {
647
+ messageSender.UnjoinTournamentReq(tournament);
648
+ }
649
+ else {
650
+ messageSender.JoinTournamentReq(tournament);
651
+ }
652
+ }
653
+ catch (e) {
654
+ console.log('error', e);
655
+ return;
656
+ }
657
+ }
658
+ setPage(page, metaData) {
659
+ if (page == LeaderboardPage.item) {
660
+ this.tournamentItem = metaData.tournament;
661
+ if (!this.tournamentItem) {
662
+ messageSender.UpdateTournamentsItemReq(metaData.tournament);
663
+ }
664
+ if (isTournamentClosed(this.tournamentItem)) {
665
+ messageSender.UpdateLeaderboardsReq(this.tournamentItem);
666
+ }
667
+ }
668
+ this.tab = Tab.info;
669
+ this.page = page;
670
+ }
671
+ render() {
672
+ return (index.h(index.Host, { key: 'f9e9ea96e0fddd20d3f12141c7cf66588ab94ccd' }, index.h("general-styling-wrapper", { key: 'aea948ea6c8f8cc5e4aaea5812873d3fe7045568', clientStylingUrl: this.clientStylingUrl, clientStyling: this.clientStyling,
673
+ // @ts-ignore
674
+ targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl }), this.renders.page[this.page]()));
675
+ }
676
+ openDialog(type, data = undefined, onClose = undefined) {
677
+ this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: true, onClose,
678
+ type,
679
+ data });
680
+ }
681
+ closeDialog() {
682
+ var _a;
683
+ (_a = this.dialog.onClose) === null || _a === void 0 ? void 0 : _a.call(this);
684
+ this.dialog = Object.assign(Object.assign({}, this.dialog), { isOpen: false, onClose: undefined });
685
+ }
686
+ constructor(hostRef) {
687
+ index.registerInstance(this, hostRef);
688
+ this.close = index.createEvent(this, "close", 7);
689
+ this.gifts = [];
690
+ this.labels = [];
691
+ this.language = 'en';
692
+ this.show = false;
693
+ this.clientStyling = '';
694
+ this.clientStylingUrl = '';
695
+ this.translationUrl = '';
696
+ this.device = 'Mobile';
697
+ this.leaderboardsInit = undefined;
698
+ this.tab = Tab.info;
699
+ this.locale = TRANSLATIONS;
700
+ this.tournamentItem = undefined;
701
+ this.tournamentList = undefined;
702
+ this.leaderboards = [];
703
+ this.isActionJoinPending = false;
704
+ this.isDialogOpen = false;
705
+ this.isShowInfo = false;
706
+ this.page = LeaderboardPage.list;
707
+ this.tournamentInDialog = undefined;
708
+ this.dialog = {
709
+ isOpen: false,
710
+ type: undefined,
711
+ data: undefined,
712
+ onClose: undefined
713
+ };
714
+ this.time = 0;
715
+ this.newIdList = [];
716
+ // bind all renders
717
+ this.renders = {};
718
+ Object.keys(renders).forEach((key) => {
719
+ this.renders[key] = {};
720
+ Object.keys(renders[key]).forEach((subKey) => {
721
+ this.renders[key][subKey] = renders[key][subKey].bind(this, this);
722
+ });
723
+ });
724
+ }
725
+ static get watchers() { return {
726
+ "newIdList": ["checkNewIdList"],
727
+ "tournamentList": ["syncBarState"],
728
+ "show": ["showPropWatcher"]
729
+ }; }
730
+ };
731
+ CasinoEngagementSuiteTournament.style = CasinoEngagementSuiteTournamentStyle0;
732
+
733
+ exports.CasinoEngagementSuiteTournament = CasinoEngagementSuiteTournament;