@everymatrix/casino-challenges-overlay-slider 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 (64) hide show
  1. package/dist/casino-challenges-overlay-slider/app-globals-0f993ce5.js +1 -0
  2. package/dist/casino-challenges-overlay-slider/casino-challenges-overlay-card_2.entry.js +1 -0
  3. package/dist/casino-challenges-overlay-slider/casino-challenges-overlay-slider-2eb80eb5.js +1 -0
  4. package/dist/casino-challenges-overlay-slider/casino-challenges-overlay-slider.esm.js +1 -0
  5. package/dist/casino-challenges-overlay-slider/index-9e63661c.js +2 -0
  6. package/dist/casino-challenges-overlay-slider/index.esm.js +1 -0
  7. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  8. package/dist/cjs/casino-challenges-overlay-card_2.cjs.entry.js +164 -0
  9. package/dist/cjs/casino-challenges-overlay-slider-bf3e8c30.js +412 -0
  10. package/dist/cjs/casino-challenges-overlay-slider.cjs.js +25 -0
  11. package/dist/cjs/index-180bdedd.js +1248 -0
  12. package/dist/cjs/index.cjs.js +10 -0
  13. package/dist/cjs/loader.cjs.js +15 -0
  14. package/dist/collection/assets/left_arrow.svg +3 -0
  15. package/dist/collection/assets/right_arrow.svg +3 -0
  16. package/dist/collection/collection-manifest.json +13 -0
  17. package/dist/collection/components/casino-challenges-overlay-slider/casino-challenges-overlay-slider.css +98 -0
  18. package/dist/collection/components/casino-challenges-overlay-slider/casino-challenges-overlay-slider.js +450 -0
  19. package/dist/collection/components/casino-challenges-overlay-slider/components/casino-challenges-overlay-card.css +107 -0
  20. package/dist/collection/components/casino-challenges-overlay-slider/components/casino-challenges-overlay-card.js +260 -0
  21. package/dist/collection/components/casino-challenges-overlay-slider/index.js +1 -0
  22. package/dist/collection/index.js +1 -0
  23. package/dist/collection/utils/locale.utils.js +48 -0
  24. package/dist/collection/utils/types.js +52 -0
  25. package/dist/collection/utils/utils.js +20 -0
  26. package/dist/esm/app-globals-0f993ce5.js +3 -0
  27. package/dist/esm/casino-challenges-overlay-card_2.entry.js +160 -0
  28. package/dist/esm/casino-challenges-overlay-slider-2eb80eb5.js +409 -0
  29. package/dist/esm/casino-challenges-overlay-slider.js +20 -0
  30. package/dist/esm/index-9e63661c.js +1220 -0
  31. package/dist/esm/index.js +2 -0
  32. package/dist/esm/loader.js +11 -0
  33. package/dist/index.cjs.js +1 -0
  34. package/dist/index.js +1 -0
  35. package/dist/stencil.config.dev.js +19 -0
  36. package/dist/stencil.config.js +19 -0
  37. package/dist/storybook/main.js +43 -0
  38. package/dist/storybook/preview.js +9 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/stencil.config.d.ts +2 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/stencil.config.dev.d.ts +2 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/storybook/main.d.ts +3 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/packages/stencil/casino-challenges-overlay-slider/storybook/preview.d.ts +70 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/index.d.ts +4 -0
  45. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  46. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  47. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  48. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/casino-challenges-overlay-slider/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  49. package/dist/types/components/casino-challenges-overlay-slider/casino-challenges-overlay-slider.d.ts +53 -0
  50. package/dist/types/components/casino-challenges-overlay-slider/components/casino-challenges-overlay-card.d.ts +22 -0
  51. package/dist/types/components/casino-challenges-overlay-slider/index.d.ts +1 -0
  52. package/dist/types/components.d.ts +118 -0
  53. package/dist/types/index.d.ts +1 -0
  54. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  55. package/dist/types/utils/locale.utils.d.ts +3 -0
  56. package/dist/types/utils/types.d.ts +120 -0
  57. package/dist/types/utils/utils.d.ts +2 -0
  58. package/loader/cdn.js +1 -0
  59. package/loader/index.cjs.js +1 -0
  60. package/loader/index.d.ts +24 -0
  61. package/loader/index.es2017.js +1 -0
  62. package/loader/index.js +2 -0
  63. package/loader/package.json +11 -0
  64. package/package.json +27 -0
@@ -0,0 +1,412 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-180bdedd.js');
4
+
5
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
6
+
7
+ /**
8
+ * @name setClientStyling
9
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
10
+ * @param {HTMLElement} stylingContainer The reference element of the widget
11
+ * @param {string} clientStyling The style content
12
+ */
13
+ function setClientStyling(stylingContainer, clientStyling) {
14
+ if (stylingContainer) {
15
+ const sheet = document.createElement('style');
16
+ sheet.innerHTML = clientStyling;
17
+ stylingContainer.appendChild(sheet);
18
+ }
19
+ }
20
+
21
+ /**
22
+ * @name setClientStylingURL
23
+ * @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
24
+ * @param {HTMLElement} stylingContainer The reference element of the widget
25
+ * @param {string} clientStylingUrl The URL of the style content
26
+ */
27
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
28
+ if (!stylingContainer || !clientStylingUrl) return;
29
+
30
+ const url = new URL(clientStylingUrl);
31
+
32
+ fetch(url.href)
33
+ .then((res) => res.text())
34
+ .then((data) => {
35
+ const cssFile = document.createElement('style');
36
+ cssFile.innerHTML = data;
37
+ if (stylingContainer) {
38
+ stylingContainer.appendChild(cssFile);
39
+ }
40
+ })
41
+ .catch((err) => {
42
+ console.error('There was an error while trying to load client styling from URL', err);
43
+ });
44
+ }
45
+
46
+ /**
47
+ * @name setStreamLibrary
48
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
49
+ * @param {HTMLElement} stylingContainer The highest element of the widget
50
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
51
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
52
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
53
+ */
54
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
55
+ if (!window.emMessageBus) return;
56
+
57
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
58
+
59
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
60
+ subscription = getStyleTagSubscription(stylingContainer, domain);
61
+
62
+ return subscription;
63
+ }
64
+
65
+ if (!window[StyleCacheKey]) {
66
+ window[StyleCacheKey] = {};
67
+ }
68
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
69
+
70
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
71
+ const wrappedUnsubscribe = () => {
72
+ if (window[StyleCacheKey][domain]) {
73
+ const cachedObject = window[StyleCacheKey][domain];
74
+ cachedObject.refCount > 1
75
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
76
+ : delete window[StyleCacheKey][domain];
77
+ }
78
+
79
+ originalUnsubscribe();
80
+ };
81
+ subscription.unsubscribe = wrappedUnsubscribe;
82
+
83
+ return subscription;
84
+ }
85
+
86
+ function getStyleTagSubscription(stylingContainer, domain) {
87
+ const sheet = document.createElement('style');
88
+
89
+ return window.emMessageBus.subscribe(domain, (data) => {
90
+ if (stylingContainer) {
91
+ sheet.innerHTML = data;
92
+ stylingContainer.appendChild(sheet);
93
+ }
94
+ });
95
+ }
96
+
97
+ function getAdoptStyleSubscription(stylingContainer, domain) {
98
+ return window.emMessageBus.subscribe(domain, (data) => {
99
+ if (!stylingContainer) return;
100
+
101
+ const shadowRoot = stylingContainer.getRootNode();
102
+ const cacheStyleObject = window[StyleCacheKey];
103
+ let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
104
+
105
+ if (!cachedStyle) {
106
+ cachedStyle = new CSSStyleSheet();
107
+ cachedStyle.replaceSync(data);
108
+ cacheStyleObject[domain] = {
109
+ sheet: cachedStyle,
110
+ refCount: 1
111
+ };
112
+ } else {
113
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
114
+ }
115
+
116
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
117
+ if (!currentSheets.includes(cachedStyle)) {
118
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
119
+ }
120
+ });
121
+ }
122
+
123
+ const DEFAULT_LANGUAGE = 'en';
124
+ const TRANSLATIONS = {
125
+ en: {
126
+ endsIn: 'Ends In',
127
+ expired: 'Expired',
128
+ forfeited: 'Forfeited',
129
+ finished: 'Finished',
130
+ suspended: 'Suspended',
131
+ unavailable: 'Unavailable'
132
+ },
133
+ da: {
134
+ endsIn: 'Ends In',
135
+ expired: 'Expired',
136
+ forfeited: 'Forfeited',
137
+ finished: 'Finished',
138
+ suspended: 'Suspended',
139
+ unavailable: 'Unavailable'
140
+ }
141
+ };
142
+ const translate = (key, customLang) => {
143
+ const lang = customLang;
144
+ return TRANSLATIONS[lang !== undefined && lang in TRANSLATIONS ? lang : DEFAULT_LANGUAGE][key];
145
+ };
146
+ const getTranslations = (data) => {
147
+ Object.keys(data).forEach((item) => {
148
+ if (!TRANSLATIONS[item]) {
149
+ TRANSLATIONS[item] = {};
150
+ }
151
+ for (let key in data[item]) {
152
+ TRANSLATIONS[item][key] = data[item][key];
153
+ }
154
+ });
155
+ };
156
+ const resolveTranslationUrl = async (translationUrl) => {
157
+ if (translationUrl) {
158
+ try {
159
+ const response = await fetch(translationUrl);
160
+ if (!response.ok) {
161
+ throw new Error(`HTTP error! status: ${response.status}`);
162
+ }
163
+ const translations = await response.json();
164
+ getTranslations(translations);
165
+ }
166
+ catch (error) {
167
+ console.error('Failed to fetch or parse translations from URL:', error);
168
+ }
169
+ }
170
+ };
171
+
172
+ const rightArrowSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOCIgaGVpZ2h0PSIxNSIgdmlld0JveD0iMCAwIDggMTUiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0wLjUwMTk1MyAxMy44MzUzTDcuMTY4NjIgNy4xNjg2MkwwLjUwMTk1MyAwLjUwMTk1MyIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjAwNDU5IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==';
173
+
174
+ const leftArrowSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOCIgaGVpZ2h0PSIxNSIgdmlld0JveD0iMCAwIDggMTUiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik03LjE2ODk1IDEzLjgzNTNMMC41MDIyNzggNy4xNjg2Mkw3LjE2ODk1IDAuNTAxOTUzIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjEuMDA0NTkiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K';
175
+
176
+ const casinoChallengesOverlaySliderCss = "@import url(\"https://fonts.googleapis.com/css2?family=Teachers:ital,wght@0,400..800;1,400..800&display=swap\"); .one-slide .challenges__slider{justify-content:center;cursor:pointer;transition:none}.slider-container{position:relative}.challenges__slider-wrapper{overflow:hidden;width:100%}.challenges__slider{display:flex;transition:transform 0.25s ease;will-change:transform;touch-action:pan-y;user-select:none;cursor:grab}.challenges__slider.active{cursor:grabbing}.challenges__slider-dots{display:flex;justify-content:center;margin-top:10px}.challenges__slider-dot{width:7px;height:7px;border-radius:50%;background:var(--emw--dot-button-bg, rgba(255, 255, 255, 0.1490196078));margin:4px;cursor:pointer;transition:0.2s}.challenges__slider-dot.active{width:29px;border-radius:8px;background:var(--emw--dot-button-active-bg, rgba(255, 255, 255, 0.2))}.action-button{position:absolute;top:42%;transform:translateY(-50%);stroke:white;width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;border:2px solid var(--emw--color-container-border, rgba(255, 255, 255, 0.0705882353));background:var(--emw--color-container-background, rgba(9, 9, 9, 0.5019607843));backdrop-filter:blur(9.5px);cursor:pointer}.action-button--prev{left:30px}.action-button--next{right:30px}.mobile .challenges__slider-dot{width:5px;height:5px;margin:2px}.mobile .challenges__slider-dot.active{width:18px}.mobile .challenges__slide__image-wrapper{width:240px;height:122px}.mobile .challenges__slide__title{bottom:8px;left:8px;font-size:var(--emw--font-size-small, 14px);max-width:224px}.mobile .challenges__slide__badge{top:8px;left:8px;font-size:var(--emw--font-size-2x-small, 11px)}.mobile .challenges__slide__badge .status{height:17px}.mobile .action-button{display:none}";
177
+ const CasinoChallengesOverlaySliderStyle0 = casinoChallengesOverlaySliderCss;
178
+
179
+ const CasinoChallengesOverlaySlider = class {
180
+ constructor(hostRef) {
181
+ index.registerInstance(this, hostRef);
182
+ this.activeChallengeChange = index.createEvent(this, "activeChallengeChange", 7);
183
+ this.slideGap = 0;
184
+ this.isDragging = false;
185
+ this.startX = 0;
186
+ this.currentTranslate = 0;
187
+ this.baseTranslate = 0;
188
+ this.slideWidthToContainer = 0.57; // 57%
189
+ this.slideHeightToContainer = 0.3; // 30%
190
+ this.next = () => {
191
+ this.currentIndex++;
192
+ this.setPositionByIndex();
193
+ const len = this.challenges.length;
194
+ if (this.currentIndex === len + 1) {
195
+ setTimeout(() => this.scheduleReset(1), 250);
196
+ }
197
+ };
198
+ this.prev = () => {
199
+ this.currentIndex--;
200
+ this.setPositionByIndex();
201
+ const len = this.challenges.length;
202
+ if (this.currentIndex === 0) {
203
+ setTimeout(() => this.scheduleReset(len), 250);
204
+ }
205
+ };
206
+ this.onPointerDown = (e) => {
207
+ var _a;
208
+ if (this.isOneSlide) {
209
+ return;
210
+ }
211
+ this.isDragging = true;
212
+ this.startX = e.clientX;
213
+ this.baseTranslate = this.getBaseTranslate();
214
+ (_a = this.sliderContainer) === null || _a === void 0 ? void 0 : _a.setPointerCapture(e.pointerId);
215
+ };
216
+ this.onPointerMove = (e) => {
217
+ if (!this.isDragging)
218
+ return;
219
+ this.currentTranslate = this.baseTranslate + (e.clientX - this.startX);
220
+ this.setSliderPosition(this.currentTranslate);
221
+ };
222
+ this.onPointerUp = (e) => {
223
+ var _a;
224
+ if (!this.isDragging)
225
+ return;
226
+ this.isDragging = false;
227
+ (_a = this.sliderContainer) === null || _a === void 0 ? void 0 : _a.releasePointerCapture(e.pointerId);
228
+ const moved = this.currentTranslate - this.getBaseTranslate();
229
+ const threshold = 50;
230
+ if (moved < -threshold)
231
+ this.next();
232
+ else if (moved > threshold)
233
+ this.prev();
234
+ else
235
+ this.setPositionByIndex();
236
+ };
237
+ this.mbSource = undefined;
238
+ this.clientStyling = undefined;
239
+ this.clientStylingUrl = undefined;
240
+ this.translationUrl = '';
241
+ this.language = 'en';
242
+ this.isMobile = false;
243
+ this.challenges = undefined;
244
+ this.initialProgressId = '';
245
+ this.activeTabIndex = '';
246
+ this.currentIndex = null;
247
+ this.slideWidth = 0;
248
+ this.slideHeight = 0;
249
+ this.isOneSlide = false;
250
+ }
251
+ handleClientStylingChange(newValue, oldValue) {
252
+ if (newValue != oldValue) {
253
+ setClientStyling(this.stylingContainer, this.clientStyling);
254
+ }
255
+ }
256
+ handleClientStylingUrlChange(newValue, oldValue) {
257
+ if (newValue != oldValue) {
258
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
259
+ }
260
+ }
261
+ handleMbSourceChange(newValue, oldValue) {
262
+ if (newValue != oldValue) {
263
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
264
+ }
265
+ }
266
+ onCurrentIndexChange(newValue, oldValue) {
267
+ if (oldValue !== null && newValue !== oldValue && newValue > 0) {
268
+ const activeChallenge = this.challenges[newValue - 1];
269
+ this.activeChallengeChange.emit(activeChallenge === null || activeChallenge === void 0 ? void 0 : activeChallenge.Id);
270
+ }
271
+ }
272
+ onChallengesChange(newValue) {
273
+ this.isOneSlide = newValue.length === 1;
274
+ }
275
+ onInitialProgressIdChange(newValue, oldValue) {
276
+ if (newValue != oldValue) {
277
+ this.updateCurrentIndex();
278
+ }
279
+ }
280
+ componentWillLoad() {
281
+ if (this.translationUrl) {
282
+ resolveTranslationUrl(this.translationUrl);
283
+ }
284
+ }
285
+ componentDidLoad() {
286
+ var _a;
287
+ this.isOneSlide = ((_a = this.challenges) === null || _a === void 0 ? void 0 : _a.length) === 1;
288
+ this.resizeObserver = new ResizeObserver(([entry]) => {
289
+ this.slideWidth = Math.round(entry.contentRect.width * this.slideWidthToContainer);
290
+ this.slideHeight = Math.round(entry.contentRect.width * this.slideHeightToContainer);
291
+ if (!this.isOneSlide) {
292
+ this.setPositionByIndex();
293
+ }
294
+ });
295
+ if (this.stylingContainer) {
296
+ if (this.mbSource)
297
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
298
+ if (this.clientStyling)
299
+ setClientStyling(this.stylingContainer, this.clientStyling);
300
+ if (this.clientStylingUrl)
301
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
302
+ this.resizeObserver.observe(this.stylingContainer);
303
+ }
304
+ this.updateCurrentIndex();
305
+ }
306
+ disconnectedCallback() {
307
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
308
+ this.resizeObserver && this.resizeObserver.disconnect();
309
+ }
310
+ updateCurrentIndex() {
311
+ if (this.isOneSlide) {
312
+ this.currentIndex = 0;
313
+ this.setSliderPosition(0);
314
+ }
315
+ else {
316
+ requestAnimationFrame(() => {
317
+ var _a;
318
+ const index = ((_a = this.challenges) === null || _a === void 0 ? void 0 : _a.findIndex((challenge) => (challenge === null || challenge === void 0 ? void 0 : challenge.Id) === this.initialProgressId)) || 0;
319
+ this.currentIndex = index + 1;
320
+ this.setPositionByIndex(false);
321
+ });
322
+ }
323
+ }
324
+ setSliderPosition(value) {
325
+ if (!this.sliderContainer)
326
+ return;
327
+ this.sliderContainer.style.transform = `translateX(${value}px)`;
328
+ }
329
+ getCarouselItems() {
330
+ const items = this.challenges;
331
+ if (items.length <= 1)
332
+ return items;
333
+ return [items[items.length - 1], ...items, items[0]];
334
+ }
335
+ scheduleReset(index) {
336
+ if (!this.sliderContainer)
337
+ return;
338
+ requestAnimationFrame(() => {
339
+ requestAnimationFrame(() => {
340
+ const el = this.sliderContainer;
341
+ el.style.transition = 'none';
342
+ this.currentIndex = index;
343
+ this.setPositionByIndex(false);
344
+ requestAnimationFrame(() => {
345
+ el.style.transition = '';
346
+ });
347
+ });
348
+ });
349
+ }
350
+ setPositionByIndex(withTransition = true) {
351
+ if (!this.sliderContainer)
352
+ return;
353
+ const gap = this.slideGap;
354
+ const offset = (this.sliderContainer.clientWidth - this.slideWidth) / 2;
355
+ this.currentTranslate = -(this.slideWidth + gap) * this.currentIndex + offset;
356
+ if (!withTransition) {
357
+ this.disableTransition();
358
+ }
359
+ this.setSliderPosition(this.currentTranslate);
360
+ }
361
+ getBaseTranslate() {
362
+ var _a, _b;
363
+ const slide = (_a = this.sliderContainer) === null || _a === void 0 ? void 0 : _a.querySelector('.challenges__slide');
364
+ const wrapper = (_b = this.sliderContainer) === null || _b === void 0 ? void 0 : _b.parentElement;
365
+ if (!slide || !wrapper)
366
+ return 0;
367
+ const slideWidth = slide.clientWidth;
368
+ const gap = this.slideGap;
369
+ const offset = (wrapper.clientWidth - slideWidth) / 2;
370
+ return -(slideWidth + gap) * this.currentIndex + offset;
371
+ }
372
+ disableTransition() {
373
+ if (!this.sliderContainer)
374
+ return;
375
+ this.sliderContainer.style.transition = 'none';
376
+ requestAnimationFrame(() => {
377
+ this.sliderContainer.style.transition = '';
378
+ });
379
+ }
380
+ goToSlide(index) {
381
+ this.currentIndex = index + 1;
382
+ this.setPositionByIndex();
383
+ }
384
+ getRealIndex() {
385
+ const len = this.challenges.length;
386
+ if (this.currentIndex === 0)
387
+ return len - 1;
388
+ if (this.currentIndex === len + 1)
389
+ return 0;
390
+ return this.currentIndex - 1;
391
+ }
392
+ render() {
393
+ return (index.h("div", { key: '25e34524b9a1fb6fcd4b164f5f3d58a58173ed09', class: { 'slider-container': true, mobile: this.isMobile, 'one-slide': this.isOneSlide }, ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '1f77218efd7201eb0de40405d7128168d5bb2a64', class: "challenges__slider-wrapper", onPointerDown: this.onPointerDown, onPointerMove: this.onPointerMove, onPointerUp: this.onPointerUp, onPointerLeave: this.onPointerUp }, index.h("div", { key: '623e0d69197edea0a4a01a670bc678e2c99af735', class: "challenges__slider", ref: (el) => (this.sliderContainer = el) }, this.getCarouselItems().map((item, index$1, arr) => (index.h("casino-challenges-overlay-card", { challenge: item, index: index$1, arrLength: arr.length, currentIndex: this.currentIndex, slideWidth: this.slideWidth, slideHeight: this.slideHeight }))))), this.challenges.length > 1 && (index.h("div", { key: 'ffc80e15f608761c6b830dd6f8ed19ebf7a2498e' }, index.h("button", { key: '0403fb4615605c33ef596c74ae2427b5e823b7d9', class: "action-button action-button--prev", onClick: this.prev }, index.h("img", { key: 'de3536ec00f15de6240d3c7da032b9584fffbc92', src: leftArrowSvg, alt: "" })), index.h("button", { key: '84cc6967ded946264bde8db938c8e5541ace145c', class: "action-button action-button--next", onClick: this.next }, index.h("img", { key: 'f6e8d44662f3ca55866001d90d41f66c4a5f6f04', src: rightArrowSvg, alt: "" })), index.h("div", { key: '25124a8bb6d0fc72086e69e20b6fc2f41986999e', class: "challenges__slider-dots" }, this.challenges.map((_, i) => (index.h("span", { class: {
394
+ 'challenges__slider-dot': true,
395
+ active: i === this.getRealIndex()
396
+ }, onClick: () => {
397
+ this.goToSlide(i);
398
+ } }))))))));
399
+ }
400
+ static get watchers() { return {
401
+ "clientStyling": ["handleClientStylingChange"],
402
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
403
+ "mbSource": ["handleMbSourceChange"],
404
+ "currentIndex": ["onCurrentIndexChange"],
405
+ "challenges": ["onChallengesChange"],
406
+ "initialProgressId": ["onInitialProgressIdChange"]
407
+ }; }
408
+ };
409
+ CasinoChallengesOverlaySlider.style = CasinoChallengesOverlaySliderStyle0;
410
+
411
+ exports.CasinoChallengesOverlaySlider = CasinoChallengesOverlaySlider;
412
+ exports.translate = translate;
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-180bdedd.js');
6
+ const appGlobals = require('./app-globals-3a1e7e63.js');
7
+
8
+ /*
9
+ Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
10
+ */
11
+ var patchBrowser = () => {
12
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('casino-challenges-overlay-slider.cjs.js', document.baseURI).href));
13
+ const opts = {};
14
+ if (importMeta !== "") {
15
+ opts.resourcesUrl = new URL(".", importMeta).href;
16
+ }
17
+ return index.promiseResolve(opts);
18
+ };
19
+
20
+ patchBrowser().then(async (options) => {
21
+ await appGlobals.globalScripts();
22
+ return index.bootstrapLazy([["casino-challenges-overlay-card_2.cjs",[[1,"casino-challenges-overlay-slider",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"isMobile":[516,"is-mobile"],"challenges":[16],"initialProgressId":[1,"initial-progress-id"],"activeTabIndex":[1,"active-tab-index"],"currentIndex":[32],"slideWidth":[32],"slideHeight":[32],"isOneSlide":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"currentIndex":["onCurrentIndexChange"],"challenges":["onChallengesChange"],"initialProgressId":["onInitialProgressIdChange"]}],[0,"casino-challenges-overlay-card",{"challenge":[16],"index":[2],"arrLength":[2,"arr-length"],"currentIndex":[2,"current-index"],"language":[1],"isOptedOut":[4,"is-opted-out"],"slideWidth":[2,"slide-width"],"slideHeight":[2,"slide-height"],"timeLeft":[32]}]]]], options);
23
+ });
24
+
25
+ exports.setNonce = index.setNonce;