@everymatrix/tournament-details-page 0.1.0 → 0.1.2

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.
@@ -0,0 +1,376 @@
1
+ import { a as Fe, $ as qe, j as Je, b as Ke, p as _, u as Xe, d as ue, y as L, L as Qe, P as Ve, k as x, i as B, t as S, l as y, G as N, r as a, e as p, f as Ye, w as Ze, x as $e, s as et, q as f, h as w, v as l, g, m as tt, n as at, A as s, D as Q, E as V, B as Y, C as Z, z as ie, N as de } from "./TournamentDetailsPage-BL5YSX6c.js";
2
+ function fe(D, c) {
3
+ Fe(D, c);
4
+ }
5
+ function ge(D) {
6
+ qe.set(D);
7
+ }
8
+ const be = {
9
+ en: {
10
+ previousButton: "Previous",
11
+ nextButton: "Next",
12
+ casinoTab: "Casino",
13
+ sportsbookTab: "Sportsbook",
14
+ gamesDescriptionTitle: "Participating games",
15
+ gamesDescriptionSubtitle: "Discover the games",
16
+ sportsRulesParseError: "Error parsing tournament rules",
17
+ noAvailableGames: "No games have been configured yet!"
18
+ },
19
+ tr: {
20
+ previousButton: "Önceki",
21
+ nextButton: "Sonraki",
22
+ casinoTab: "Casino",
23
+ sportsbookTab: "Spor Bahisleri",
24
+ gamesDescriptionTitle: "Katılımcı oyunlar",
25
+ gamesDescriptionSubtitle: "Oyunları keşfedin",
26
+ sportsRulesParseError: "Turnuva kuralları ayrıştırma hatası",
27
+ noAvailableGames: "Henüz oyun yapılandırılmamış!"
28
+ }
29
+ }, nt = () => typeof window > "u";
30
+ var ot = g('<div class="TournamentGamesTabs svelte-p7mf8l"><button> </button> <button> </button></div>'), rt = g('<p class="svelte-p7mf8l"> </p>'), st = g("<div></div>"), it = g('<div class="TournamentGameThumbnailSkeleton svelte-p7mf8l"></div>'), lt = g("<p> </p>"), pt = g('<div class="TournamentGameThumbnail svelte-p7mf8l"><div class="ImageContainer svelte-p7mf8l"><img class="svelte-p7mf8l"/> <div class="PlayButtonOverlay svelte-p7mf8l"><button class="PlayGameButton svelte-p7mf8l"> </button></div></div></div>'), mt = g('<span class="PaginationButton Elipsis svelte-p7mf8l">...</span>'), ct = g("<button> </button>"), vt = g('<div><button class="PaginationButton svelte-p7mf8l"> </button> <div class="PageNumberWrapper svelte-p7mf8l"></div> <button class="PaginationButton svelte-p7mf8l"> </button></div>'), ut = g('<div class="PaginationSkeleton svelte-p7mf8l"><div class="PaginationSkeletonButton svelte-p7mf8l"></div> <div class="PaginationNumberSkeleton svelte-p7mf8l"></div> <div class="PaginationNumberSkeleton svelte-p7mf8l"></div> <div class="PaginationNumberSkeleton svelte-p7mf8l"></div> <div class="PaginationNumberSkeleton svelte-p7mf8l"></div> <div class="PaginationNumberSkeleton svelte-p7mf8l"></div> <div class="PaginationSkeletonButton svelte-p7mf8l"></div></div>'), dt = g('<div class="TournamentGamesWrapper svelte-p7mf8l"><div class="GamesDescription svelte-p7mf8l"><p class="GamesDescriptionTitle svelte-p7mf8l"> </p> <p class="GamesDescriptionSubTitle svelte-p7mf8l"> </p></div> <!> <!> <div><!></div> <!> <!></div>');
31
+ const ft = {
32
+ hash: "svelte-p7mf8l",
33
+ code: `.svelte-p7mf8l,
34
+ .svelte-p7mf8l::before,
35
+ .svelte-p7mf8l::after {margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box;font-family:inherit;}.GamesDescription.svelte-p7mf8l {display:flex;flex-direction:column;gap:6px;margin:10px 0;.GamesDescriptionTitle:where(.svelte-p7mf8l) {color:var(--emw-color-typography, #ffffff);font-size:16px;font-weight:600;}.GamesDescriptionSubTitle:where(.svelte-p7mf8l) {color:var(--emw-color-typography, #ffffff);font-size:14px;font-weight:200;}}.TournamentGamesTabs.svelte-p7mf8l {display:flex;border-radius:50px;background-color:var(--emw-color-bg-section, #434343);padding:6px;margin-bottom:6px;width:100%;justify-content:center;.Tab:where(.svelte-p7mf8l) {padding:5px 20px;color:var(--emw-color-typography, #ffffff);width:100%;border-radius:50px;background-color:transparent;border:none;cursor:pointer;}.Active:where(.svelte-p7mf8l) {background-color:var(--emw-color-bg-elements, #4A4A4A);border:none;}}.TournamentRulesWrapper.svelte-p7mf8l {display:flex;flex-direction:column;color:var(--emw-color-typography, #ffffff);font-size:14px;font-weight:400;margin:10px 0;min-height:150px;}.TournamentGamesWrapper.svelte-p7mf8l {display:flex;flex-direction:column;gap:10px;background-color:var(--emw-color-bg-secondary, #333232);padding:10px;border-radius:6px;}.TournamentGamesContainer.svelte-p7mf8l {display:grid;gap:12px;grid-template-columns:repeat(auto-fill, minmax(min(170px, 100%), 1fr));.TournamentGameThumbnailSkeleton:where(.svelte-p7mf8l) {position:relative;width:100%;aspect-ratio:4 / 3;overflow:hidden;border-radius:6px;background:linear-gradient(
36
+ to top,
37
+ var(--emw-color-primary, #FF1D4E),
38
+ transparent
39
+ );background-size:100% 200%;
40
+ animation: svelte-p7mf8l-pulse 1.5s ease-in-out infinite;}.ImageContainer:where(.svelte-p7mf8l) {position:relative;width:100%;aspect-ratio:4 / 3;overflow:hidden;border-radius:6px;}img:where(.svelte-p7mf8l) {position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;border-radius:6px;}.PlayButtonOverlay:where(.svelte-p7mf8l) {position:absolute;top:0;left:0;bottom:0;right:0;background-color:rgba(0, 0, 0, 0.6);display:flex;justify-content:center;align-items:center;opacity:0;&:hover {opacity:1;transition:opacity 0.5s;}.PlayGameButton:where(.svelte-p7mf8l) {background-color:var(--emw-color-primary, #FF1D4E);border-radius:6px;color:var(--emw-color-typography, #ffffff);padding:10px;border:none;outline:none;min-width:50%;cursor:pointer;&:hover {background-color:var(--emw-color-primary-hover, #ff3a65);cursor:pointer;}&:active {transform:scale(0.9);}}}}.PaginationWrapper.svelte-p7mf8l {display:flex;justify-content:space-between;.PageNumberWrapper:where(.svelte-p7mf8l) {display:flex;gap:3px;}.PaginationButton:where(.svelte-p7mf8l) {background-color:var(--emw-color-bg-section, #434343);color:var(--emw-color-typography, #ffffff);border-radius:6px;border:none;outline:none;padding:10px;width:auto;cursor:pointer;&.Number {background-color:transparent;min-width:0;padding:0 10px;}&:hover {background-color:var(--emw-color-bg-elements, #4A4A4A);cursor:pointer;}&:active {transform:scale(0.9);}&:disabled {opacity:60%;pointer-events:none;}&.Active {background-color:var(--emw-color-bg-elements, #4A4A4A);}&.Elipsis {pointer-events:none;background-color:transparent;min-width:0;padding:0;align-self:center;}}}.NoGamesAvailable.svelte-p7mf8l {color:var(--emw-color-typography, #ffffff);font-size:14px;font-weight:300;}.PaginationSkeleton.svelte-p7mf8l {display:flex;justify-content:space-between;gap:6px;.PaginationSkeletonButton:where(.svelte-p7mf8l) {width:60px;height:35px;border-radius:6px;background-color:var(--emw-color-skeleton, #535353);overflow:hidden;position:relative;
41
+ animation: svelte-p7mf8l-pulse 1s infinite;}.PaginationNumberSkeleton:where(.svelte-p7mf8l) {width:40px;height:35px;border-radius:6px;background-color:var(--emw-color-skeleton, #535353);overflow:hidden;position:relative;
42
+ animation: svelte-p7mf8l-pulse 1s infinite;}}
43
+
44
+ @keyframes svelte-p7mf8l-pulse {
45
+ 0% {
46
+ opacity: 0;
47
+ }
48
+ 50% {
49
+ opacity: 1;
50
+ }
51
+ 100% {
52
+ opacity: 0;
53
+ }
54
+ }
55
+
56
+
57
+ @media (min-width: 750px) {.TournamentGamesTabs.svelte-p7mf8l {width:fit-content;}.PaginationWrapper.svelte-p7mf8l, .PaginationSkeleton.svelte-p7mf8l {justify-content:end;gap:10px;}.PaginationButton.svelte-p7mf8l {min-width:75px;}.PaginationSkeleton.svelte-p7mf8l {justify-content:end;gap:10px;.PaginationSkeletonButton:where(.svelte-p7mf8l) {width:auto;min-width:55px;}.PaginationNumberSkeleton:where(.svelte-p7mf8l) {width:35px;}}
58
+
59
+ }.Hidden.svelte-p7mf8l {display:none;}`
60
+ };
61
+ function gt(D, c) {
62
+ Je(c, !0), Ke(D, ft);
63
+ const b = () => Ze($e, "$_", he), [he, _e] = et(), R = _(c, "initialGames"), $ = _(c, "endpoint"), j = _(c, "language", 7, "en"), W = _(c, "session"), z = _(c, "tournamentid"), v = _(c, "gamesLimit", 7, 6), M = _(c, "totalGames"), ee = _(c, "platformProp", 7, null), E = _(c, "tournamentMetadata"), C = _(c, "translationurl"), xe = () => {
64
+ let e = new URL(C());
65
+ fetch(e.href).then((t) => t.json()).then((t) => {
66
+ Object.keys(t).forEach((n) => {
67
+ fe(n, t[n]);
68
+ });
69
+ }).catch((t) => {
70
+ console.log(t);
71
+ });
72
+ };
73
+ Object.keys(be).forEach((e) => {
74
+ fe(e, be[e]);
75
+ }), ge(j());
76
+ const ye = () => {
77
+ ge(j());
78
+ };
79
+ Xe(() => {
80
+ C() && xe();
81
+ }), ue(() => {
82
+ ye();
83
+ });
84
+ let te = L(Qe(R() || [])), H = L(!1), u = L(0), I = L(void 0), U = L(!0);
85
+ const we = nt() ? ee() ?? "dk" : Ve(window.navigator.userAgent), ae = async () => {
86
+ if (ne.has(a(F)))
87
+ return;
88
+ f(H, !0);
89
+ const e = new URL(`${$()}/v1/tournaments/${z()}`), t = new Headers();
90
+ W() && t.append("X-SessionId", W());
91
+ const n = { method: "GET", headers: t };
92
+ e.searchParams.append("filter", `id=${z()}`), e.searchParams.append("language", j()), e.searchParams.append("expand", "games"), e.searchParams.append("pagination", `games(limit=${v()},offset=${a(u)})`), e.searchParams.append("platform", we), fetch(e, n).then((o) => o.json()).then((o) => {
93
+ f(te, o?.item?.games?.items, !0), ne.set(a(F), a(te)), a(U) || f(U, !0);
94
+ }).catch((o) => console.log(o)).finally(() => f(H, !1));
95
+ }, ke = () => {
96
+ const e = Math.ceil(M() / v()), t = Math.floor(a(u) / v()) + 1;
97
+ if (e <= 5)
98
+ return Array.from({ length: e }, (o, h) => h + 1);
99
+ const n = [];
100
+ return n.push(1), t <= 3 ? (n.push(2, 3), n.push("..."), n.push(e)) : t >= e - 2 ? (n.push("..."), n.push(e - 2, e - 1, e)) : (n.push("..."), n.push(t - 1, t, t + 1), n.push("..."), n.push(e)), n;
101
+ }, Pe = () => {
102
+ a(u) < M() && (f(u, a(u) + v()), ae());
103
+ }, Te = () => {
104
+ a(u) !== 0 && (f(u, a(u) - v()), ae());
105
+ }, Ge = (e) => {
106
+ f(u, (e - 1) * v()), ae();
107
+ }, Se = ie(ke), F = ie(() => Math.floor(a(u) / v()) + 1);
108
+ let ne = /* @__PURE__ */ new Map([[1, R()]]), Ae = ie(() => ne.get(a(F)) ?? []), G = L("casino");
109
+ const Be = () => {
110
+ if (!E()) return;
111
+ const e = E().sports?.rules;
112
+ let t;
113
+ if (e)
114
+ try {
115
+ t = JSON.parse(e), f(I, t[j()] || t["*"], !0);
116
+ } catch (n) {
117
+ console.log(n), f(I, `${b()("sportsRulesParseError")}`);
118
+ }
119
+ }, Ne = (e) => {
120
+ window.postMessage(
121
+ {
122
+ type: "Tournaments:PlayGame",
123
+ launchUrl: e.launchUrl,
124
+ id: e.gameId,
125
+ thumbnail: e.thumbnail,
126
+ name: e.name
127
+ },
128
+ window.location.href
129
+ );
130
+ };
131
+ ue(() => {
132
+ Object.keys(E()).length !== 0 && Be();
133
+ });
134
+ var De = {
135
+ get initialGames() {
136
+ return R();
137
+ },
138
+ set initialGames(e) {
139
+ R(e), w();
140
+ },
141
+ get endpoint() {
142
+ return $();
143
+ },
144
+ set endpoint(e) {
145
+ $(e), w();
146
+ },
147
+ get language() {
148
+ return j();
149
+ },
150
+ set language(e = "en") {
151
+ j(e), w();
152
+ },
153
+ get session() {
154
+ return W();
155
+ },
156
+ set session(e) {
157
+ W(e), w();
158
+ },
159
+ get tournamentid() {
160
+ return z();
161
+ },
162
+ set tournamentid(e) {
163
+ z(e), w();
164
+ },
165
+ get gamesLimit() {
166
+ return v();
167
+ },
168
+ set gamesLimit(e = 6) {
169
+ v(e), w();
170
+ },
171
+ get totalGames() {
172
+ return M();
173
+ },
174
+ set totalGames(e) {
175
+ M(e), w();
176
+ },
177
+ get platformProp() {
178
+ return ee();
179
+ },
180
+ set platformProp(e = null) {
181
+ ee(e), w();
182
+ },
183
+ get tournamentMetadata() {
184
+ return E();
185
+ },
186
+ set tournamentMetadata(e) {
187
+ E(e), w();
188
+ },
189
+ get translationurl() {
190
+ return C();
191
+ },
192
+ set translationurl(e) {
193
+ C(e), w();
194
+ }
195
+ }, oe = dt(), re = l(oe), se = l(re), je = l(se, !0);
196
+ s(se);
197
+ var le = x(se, 2), Me = l(le, !0);
198
+ s(le), s(re);
199
+ var pe = x(re, 2);
200
+ {
201
+ var Ee = (e) => {
202
+ var t = ot(), n = l(t);
203
+ let o;
204
+ n.__click = () => f(G, "casino");
205
+ var h = l(n, !0);
206
+ s(n);
207
+ var r = x(n, 2);
208
+ let i;
209
+ r.__click = () => f(G, "sports");
210
+ var d = l(r, !0);
211
+ s(r), s(t), S(
212
+ (k, m) => {
213
+ o = N(n, 1, "Tab svelte-p7mf8l", null, o, { Active: a(G) === "casino" }), y(h, k), i = N(r, 1, "Tab svelte-p7mf8l", null, i, { Active: a(G) === "sports" }), y(d, m);
214
+ },
215
+ [() => b()("casinoTab"), () => b()("sportsbookTab")]
216
+ ), p(e, t);
217
+ };
218
+ B(pe, (e) => {
219
+ Object.keys(E()).length !== 0 && e(Ee);
220
+ });
221
+ }
222
+ var me = x(pe, 2);
223
+ {
224
+ var Le = (e) => {
225
+ var t = st();
226
+ let n;
227
+ Q(t, 21, () => a(I), V, (o, h) => {
228
+ var r = rt(), i = l(r);
229
+ s(r), S((d) => y(i, `${a(h).rule ?? ""} ${d ?? ""}`), [() => b()("contribution")]), p(o, r);
230
+ }), s(t), S(() => n = N(t, 1, "TournamentRulesWrapper svelte-p7mf8l", null, n, { Hidden: a(G) === "casino" })), p(e, t);
231
+ };
232
+ B(me, (e) => {
233
+ a(I) && e(Le);
234
+ });
235
+ }
236
+ var q = x(me, 2);
237
+ let ce;
238
+ var Oe = l(q);
239
+ {
240
+ var Re = (e) => {
241
+ var t = Y(), n = Z(t);
242
+ Q(n, 17, () => Array(v()), V, (o, h, r, i) => {
243
+ var d = it();
244
+ p(o, d);
245
+ }), p(e, t);
246
+ }, We = (e) => {
247
+ var t = Y(), n = Z(t);
248
+ {
249
+ var o = (r) => {
250
+ var i = lt();
251
+ let d;
252
+ var k = l(i, !0);
253
+ s(i), S(
254
+ (m) => {
255
+ d = N(i, 1, "NoGamesAvailable svelte-p7mf8l", null, d, { Hidden: a(G) === "sports" }), y(k, m);
256
+ },
257
+ [() => b()("noAvailableGames")]
258
+ ), p(r, i);
259
+ }, h = (r) => {
260
+ var i = Y(), d = Z(i);
261
+ Q(d, 17, () => a(Ae), V, (k, m) => {
262
+ var A = pt();
263
+ A.__click = () => Ne(a(m));
264
+ var J = l(A), O = l(J), K = x(O, 2), P = l(K), T = l(P, !0);
265
+ s(P), s(K), s(J), s(A), S(
266
+ (X) => {
267
+ de(O, "src", `https:${a(m).thumbnail}`), de(O, "alt", a(m).name), y(T, X);
268
+ },
269
+ [() => b()("play")]
270
+ ), p(k, A);
271
+ }), p(r, i);
272
+ };
273
+ B(
274
+ n,
275
+ (r) => {
276
+ !a(H) && a(te)?.length === 0 ? r(o) : r(h, !1);
277
+ },
278
+ !0
279
+ );
280
+ }
281
+ p(e, t);
282
+ };
283
+ B(Oe, (e) => {
284
+ a(H) ? e(Re) : e(We, !1);
285
+ });
286
+ }
287
+ s(q);
288
+ var ve = x(q, 2);
289
+ {
290
+ var ze = (e) => {
291
+ var t = vt();
292
+ let n;
293
+ var o = l(t);
294
+ o.__click = Te;
295
+ var h = l(o, !0);
296
+ s(o);
297
+ var r = x(o, 2);
298
+ Q(r, 21, () => a(Se), V, (k, m) => {
299
+ var A = Y(), J = Z(A);
300
+ {
301
+ var O = (P) => {
302
+ var T = mt();
303
+ p(P, T);
304
+ }, K = (P) => {
305
+ var T = ct();
306
+ let X;
307
+ T.__click = () => Ge(a(m));
308
+ var Ue = l(T, !0);
309
+ s(T), S(() => {
310
+ X = N(T, 1, "PaginationButton Number svelte-p7mf8l", null, X, { Active: a(m) === a(F) }), y(Ue, a(m));
311
+ }), p(P, T);
312
+ };
313
+ B(J, (P) => {
314
+ typeof a(m) != "number" ? P(O) : P(K, !1);
315
+ });
316
+ }
317
+ p(k, A);
318
+ }), s(r);
319
+ var i = x(r, 2);
320
+ i.__click = Pe;
321
+ var d = l(i, !0);
322
+ s(i), s(t), S(
323
+ (k, m) => {
324
+ n = N(t, 1, "PaginationWrapper svelte-p7mf8l", null, n, { Hidden: a(G) === "sports" }), o.disabled = a(u) === 0, y(h, k), i.disabled = a(u) >= M() - v(), y(d, m);
325
+ },
326
+ [() => b()("previousButton"), () => b()("nextButton")]
327
+ ), p(e, t);
328
+ };
329
+ B(ve, (e) => {
330
+ a(U) && M() > v() && e(ze);
331
+ });
332
+ }
333
+ var Ce = x(ve, 2);
334
+ {
335
+ var He = (e) => {
336
+ var t = ut();
337
+ p(e, t);
338
+ };
339
+ B(Ce, (e) => {
340
+ a(U) || e(He);
341
+ });
342
+ }
343
+ s(oe), S(
344
+ (e, t) => {
345
+ y(je, e), y(Me, t), ce = N(q, 1, "TournamentGamesContainer svelte-p7mf8l", null, ce, { Hidden: a(G) === "sports" });
346
+ },
347
+ [
348
+ () => b()("gamesDescriptionTitle"),
349
+ () => b()("gamesDescriptionSubtitle")
350
+ ]
351
+ ), p(D, oe);
352
+ var Ie = Ye(De);
353
+ return _e(), Ie;
354
+ }
355
+ tt(["click"]);
356
+ customElements.define("tournament-games", at(
357
+ gt,
358
+ {
359
+ initialGames: {},
360
+ endpoint: {},
361
+ language: {},
362
+ session: {},
363
+ tournamentid: {},
364
+ gamesLimit: {},
365
+ totalGames: {},
366
+ platformProp: {},
367
+ tournamentMetadata: {},
368
+ translationurl: {}
369
+ },
370
+ [],
371
+ [],
372
+ !1
373
+ ));
374
+ export {
375
+ gt as default
376
+ };