@everymatrix/general-slider-navigation 1.77.14 → 1.77.15

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.
@@ -254,6 +254,7 @@ const CarouselComponent = class {
254
254
  this.language = 'en';
255
255
  this.slideTimer = undefined;
256
256
  this.translationUrl = '';
257
+ this.startFrom = 'middle';
257
258
  this.currIndex = 0;
258
259
  this.width = undefined;
259
260
  this.height = undefined;
@@ -277,6 +278,12 @@ const CarouselComponent = class {
277
278
  handleNewTranslations() {
278
279
  getTranslations(this.translationUrl);
279
280
  }
281
+ handleContentChange() {
282
+ if (Array.isArray(this.content) && this.content.length) {
283
+ this.applyStartIndex();
284
+ this.resize();
285
+ }
286
+ }
280
287
  async componentWillLoad() {
281
288
  if (this.translationUrl.length > 2) {
282
289
  await getTranslations(this.translationUrl);
@@ -297,7 +304,7 @@ const CarouselComponent = class {
297
304
  }
298
305
  }
299
306
  init() {
300
- this.moveSliderIndex(Math.floor(this.content.length / 2));
307
+ this.applyStartIndex();
301
308
  this.bindEvents();
302
309
  if (this.slideTimer > 0) {
303
310
  this.timer();
@@ -305,6 +312,25 @@ const CarouselComponent = class {
305
312
  this.calcInnerWidth();
306
313
  this.resize();
307
314
  }
315
+ applyStartIndex() {
316
+ if (!this.content || !this.content.length)
317
+ return;
318
+ let index = 1;
319
+ switch (this.startFrom) {
320
+ case 'start':
321
+ index = 1;
322
+ break;
323
+ case 'end':
324
+ index = this.content.length;
325
+ break;
326
+ case 'middle':
327
+ default:
328
+ // proper "middle": 5 -> 3, 4 -> 2
329
+ index = Math.ceil(this.content.length / 2);
330
+ break;
331
+ }
332
+ this.moveSliderIndex(index);
333
+ }
308
334
  calcInnerWidth() {
309
335
  const parent = this.el.parentElement;
310
336
  // Check if the parent element exists and then get its width
@@ -316,6 +342,7 @@ const CarouselComponent = class {
316
342
  }
317
343
  }
318
344
  resize() {
345
+ var _a;
319
346
  this.calcInnerWidth();
320
347
  if (this.isMobile) {
321
348
  this.width = Math.max(innerWidth * 0.3, 200);
@@ -328,7 +355,7 @@ const CarouselComponent = class {
328
355
  this.totalWidth = this.width * this.content.length;
329
356
  //this is where the margin gap between slides is calculated with the animation
330
357
  this.margin = -5;
331
- const children = this.sliderElement.children;
358
+ const children = ((_a = this.sliderElement) === null || _a === void 0 ? void 0 : _a.children) || [];
332
359
  for (let i = 0; i < children.length; i++) {
333
360
  const item = children[i];
334
361
  item.style.margin = `0 ${this.margin}px`;
@@ -394,7 +421,7 @@ const CarouselComponent = class {
394
421
  }, onClick: this.moveSliderIndex.bind(this, index$1 + 1) })))));
395
422
  }
396
423
  render() {
397
- return (index.h("div", { key: '84ee06d891aca129d0b806915f837c95113aceec', ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '8421b660dab67eb20551042e395bb01095df9c7d', class: "Carousel" }, index.h("div", { key: 'a0f544c2d0aa51f9a2db14889bbc5f5cc90e13d1', class: "CarouselBody" }, index.h("div", { key: '726ef4ae8a3d38d693ddf2fb002f3c874ecf9270', class: "CarouselSlider", ref: (el) => (this.sliderElement = el), style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.content.map((item, index$1) => {
424
+ return (index.h("div", { key: '0855a42f630d9f753ae9e915c0805dd67e24fd6a', ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '9491db52d401e8f38301636e15ae73899013aa8e', class: "Carousel" }, index.h("div", { key: '74e5f37fd0af7104a34942f3b54afbd3714834ea', class: "CarouselBody" }, index.h("div", { key: '40299537e362a112ebbcdce6548a51f2a2be8286', class: "CarouselSlider", ref: (el) => (this.sliderElement = el), style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.content.map((item, index$1) => {
398
425
  const isActive = index$1 === this.currIndex - 1;
399
426
  const buttonStyle = !isActive ? { cursor: 'unset' } : {};
400
427
  const activeItemHeight = !isActive
@@ -419,7 +446,8 @@ const CarouselComponent = class {
419
446
  static get watchers() { return {
420
447
  "clientStyling": ["handleClientStylingChange"],
421
448
  "clientStylingUrl": ["handleClientStylingChangeURL"],
422
- "translationUrl": ["handleNewTranslations"]
449
+ "translationUrl": ["handleNewTranslations"],
450
+ "content": ["handleContentChange"]
423
451
  }; }
424
452
  };
425
453
  CarouselComponent.style = CarouselComponentStyle0;
@@ -440,6 +468,7 @@ const GeneralSliderNavigation = class {
440
468
  this.bulletNavigation = true;
441
469
  this.slideTimer = undefined;
442
470
  this.translationUrl = '';
471
+ this.startFrom = 'middle';
443
472
  this.isLoading = true;
444
473
  this.hasErrors = false;
445
474
  this.device = '';
@@ -517,7 +546,7 @@ const GeneralSliderNavigation = class {
517
546
  return (index.h("div", { class: "PageError" }, index.h("div", { class: "TitleError" }, translate('error', this.language))));
518
547
  }
519
548
  if (!this.isLoading) {
520
- return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("carousel-component", { content: this.sliderData, language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl })));
549
+ return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("carousel-component", { content: this.sliderData, language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl, "start-from": this.startFrom })));
521
550
  }
522
551
  }
523
552
  static get watchers() { return {
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["carousel-component_2.cjs",[[1,"general-slider-navigation",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"content":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"innerWidth":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"]}]]]], options);
22
+ return index.bootstrapLazy([["carousel-component_2.cjs",[[1,"general-slider-navigation",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"startFrom":[513,"start-from"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"content":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"startFrom":[513,"start-from"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"innerWidth":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"content":["handleContentChange"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["carousel-component_2.cjs",[[1,"general-slider-navigation",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"content":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"innerWidth":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"]}]]]], options);
11
+ return index.bootstrapLazy([["carousel-component_2.cjs",[[1,"general-slider-navigation",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"startFrom":[513,"start-from"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"content":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"startFrom":[513,"start-from"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"innerWidth":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"content":["handleContentChange"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -61,6 +61,7 @@ export class CarouselComponent {
61
61
  this.language = 'en';
62
62
  this.slideTimer = undefined;
63
63
  this.translationUrl = '';
64
+ this.startFrom = 'middle';
64
65
  this.currIndex = 0;
65
66
  this.width = undefined;
66
67
  this.height = undefined;
@@ -84,6 +85,12 @@ export class CarouselComponent {
84
85
  handleNewTranslations() {
85
86
  getTranslations(this.translationUrl);
86
87
  }
88
+ handleContentChange() {
89
+ if (Array.isArray(this.content) && this.content.length) {
90
+ this.applyStartIndex();
91
+ this.resize();
92
+ }
93
+ }
87
94
  async componentWillLoad() {
88
95
  if (this.translationUrl.length > 2) {
89
96
  await getTranslations(this.translationUrl);
@@ -104,7 +111,7 @@ export class CarouselComponent {
104
111
  }
105
112
  }
106
113
  init() {
107
- this.moveSliderIndex(Math.floor(this.content.length / 2));
114
+ this.applyStartIndex();
108
115
  this.bindEvents();
109
116
  if (this.slideTimer > 0) {
110
117
  this.timer();
@@ -112,6 +119,25 @@ export class CarouselComponent {
112
119
  this.calcInnerWidth();
113
120
  this.resize();
114
121
  }
122
+ applyStartIndex() {
123
+ if (!this.content || !this.content.length)
124
+ return;
125
+ let index = 1;
126
+ switch (this.startFrom) {
127
+ case 'start':
128
+ index = 1;
129
+ break;
130
+ case 'end':
131
+ index = this.content.length;
132
+ break;
133
+ case 'middle':
134
+ default:
135
+ // proper "middle": 5 -> 3, 4 -> 2
136
+ index = Math.ceil(this.content.length / 2);
137
+ break;
138
+ }
139
+ this.moveSliderIndex(index);
140
+ }
115
141
  calcInnerWidth() {
116
142
  const parent = this.el.parentElement;
117
143
  // Check if the parent element exists and then get its width
@@ -123,6 +149,7 @@ export class CarouselComponent {
123
149
  }
124
150
  }
125
151
  resize() {
152
+ var _a;
126
153
  this.calcInnerWidth();
127
154
  if (this.isMobile) {
128
155
  this.width = Math.max(innerWidth * 0.3, 200);
@@ -135,7 +162,7 @@ export class CarouselComponent {
135
162
  this.totalWidth = this.width * this.content.length;
136
163
  //this is where the margin gap between slides is calculated with the animation
137
164
  this.margin = -5;
138
- const children = this.sliderElement.children;
165
+ const children = ((_a = this.sliderElement) === null || _a === void 0 ? void 0 : _a.children) || [];
139
166
  for (let i = 0; i < children.length; i++) {
140
167
  const item = children[i];
141
168
  item.style.margin = `0 ${this.margin}px`;
@@ -201,7 +228,7 @@ export class CarouselComponent {
201
228
  }, onClick: this.moveSliderIndex.bind(this, index + 1) })))));
202
229
  }
203
230
  render() {
204
- return (h("div", { key: '84ee06d891aca129d0b806915f837c95113aceec', ref: (el) => (this.stylingContainer = el) }, h("div", { key: '8421b660dab67eb20551042e395bb01095df9c7d', class: "Carousel" }, h("div", { key: 'a0f544c2d0aa51f9a2db14889bbc5f5cc90e13d1', class: "CarouselBody" }, h("div", { key: '726ef4ae8a3d38d693ddf2fb002f3c874ecf9270', class: "CarouselSlider", ref: (el) => (this.sliderElement = el), style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.content.map((item, index) => {
231
+ return (h("div", { key: '0855a42f630d9f753ae9e915c0805dd67e24fd6a', ref: (el) => (this.stylingContainer = el) }, h("div", { key: '9491db52d401e8f38301636e15ae73899013aa8e', class: "Carousel" }, h("div", { key: '74e5f37fd0af7104a34942f3b54afbd3714834ea', class: "CarouselBody" }, h("div", { key: '40299537e362a112ebbcdce6548a51f2a2be8286', class: "CarouselSlider", ref: (el) => (this.sliderElement = el), style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.content.map((item, index) => {
205
232
  const isActive = index === this.currIndex - 1;
206
233
  const buttonStyle = !isActive ? { cursor: 'unset' } : {};
207
234
  const activeItemHeight = !isActive
@@ -379,6 +406,24 @@ export class CarouselComponent {
379
406
  "attribute": "translation-url",
380
407
  "reflect": true,
381
408
  "defaultValue": "''"
409
+ },
410
+ "startFrom": {
411
+ "type": "string",
412
+ "mutable": false,
413
+ "complexType": {
414
+ "original": "'start' | 'middle' | 'end'",
415
+ "resolved": "\"end\" | \"middle\" | \"start\"",
416
+ "references": {}
417
+ },
418
+ "required": false,
419
+ "optional": false,
420
+ "docs": {
421
+ "tags": [],
422
+ "text": "Where to start from. Defaults to middle."
423
+ },
424
+ "attribute": "start-from",
425
+ "reflect": true,
426
+ "defaultValue": "'middle'"
382
427
  }
383
428
  };
384
429
  }
@@ -405,6 +450,9 @@ export class CarouselComponent {
405
450
  }, {
406
451
  "propName": "translationUrl",
407
452
  "methodName": "handleNewTranslations"
453
+ }, {
454
+ "propName": "content",
455
+ "methodName": "handleContentChange"
408
456
  }];
409
457
  }
410
458
  }
@@ -14,6 +14,7 @@ export class GeneralSliderNavigation {
14
14
  this.bulletNavigation = true;
15
15
  this.slideTimer = undefined;
16
16
  this.translationUrl = '';
17
+ this.startFrom = 'middle';
17
18
  this.isLoading = true;
18
19
  this.hasErrors = false;
19
20
  this.device = '';
@@ -91,7 +92,7 @@ export class GeneralSliderNavigation {
91
92
  return (h("div", { class: "PageError" }, h("div", { class: "TitleError" }, translate('error', this.language))));
92
93
  }
93
94
  if (!this.isLoading) {
94
- return (h("div", { ref: el => this.stylingContainer = el }, h("carousel-component", { content: this.sliderData, language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl })));
95
+ return (h("div", { ref: el => this.stylingContainer = el }, h("carousel-component", { content: this.sliderData, language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl, "start-from": this.startFrom })));
95
96
  }
96
97
  }
97
98
  static get is() { return "general-slider-navigation"; }
@@ -284,6 +285,24 @@ export class GeneralSliderNavigation {
284
285
  "attribute": "translation-url",
285
286
  "reflect": true,
286
287
  "defaultValue": "''"
288
+ },
289
+ "startFrom": {
290
+ "type": "string",
291
+ "mutable": false,
292
+ "complexType": {
293
+ "original": "'start' | 'middle' | 'end'",
294
+ "resolved": "\"end\" | \"middle\" | \"start\"",
295
+ "references": {}
296
+ },
297
+ "required": false,
298
+ "optional": false,
299
+ "docs": {
300
+ "tags": [],
301
+ "text": "Where to start from the carousel. Default is middle"
302
+ },
303
+ "attribute": "start-from",
304
+ "reflect": true,
305
+ "defaultValue": "'middle'"
287
306
  }
288
307
  };
289
308
  }
@@ -250,6 +250,7 @@ const CarouselComponent = class {
250
250
  this.language = 'en';
251
251
  this.slideTimer = undefined;
252
252
  this.translationUrl = '';
253
+ this.startFrom = 'middle';
253
254
  this.currIndex = 0;
254
255
  this.width = undefined;
255
256
  this.height = undefined;
@@ -273,6 +274,12 @@ const CarouselComponent = class {
273
274
  handleNewTranslations() {
274
275
  getTranslations(this.translationUrl);
275
276
  }
277
+ handleContentChange() {
278
+ if (Array.isArray(this.content) && this.content.length) {
279
+ this.applyStartIndex();
280
+ this.resize();
281
+ }
282
+ }
276
283
  async componentWillLoad() {
277
284
  if (this.translationUrl.length > 2) {
278
285
  await getTranslations(this.translationUrl);
@@ -293,7 +300,7 @@ const CarouselComponent = class {
293
300
  }
294
301
  }
295
302
  init() {
296
- this.moveSliderIndex(Math.floor(this.content.length / 2));
303
+ this.applyStartIndex();
297
304
  this.bindEvents();
298
305
  if (this.slideTimer > 0) {
299
306
  this.timer();
@@ -301,6 +308,25 @@ const CarouselComponent = class {
301
308
  this.calcInnerWidth();
302
309
  this.resize();
303
310
  }
311
+ applyStartIndex() {
312
+ if (!this.content || !this.content.length)
313
+ return;
314
+ let index = 1;
315
+ switch (this.startFrom) {
316
+ case 'start':
317
+ index = 1;
318
+ break;
319
+ case 'end':
320
+ index = this.content.length;
321
+ break;
322
+ case 'middle':
323
+ default:
324
+ // proper "middle": 5 -> 3, 4 -> 2
325
+ index = Math.ceil(this.content.length / 2);
326
+ break;
327
+ }
328
+ this.moveSliderIndex(index);
329
+ }
304
330
  calcInnerWidth() {
305
331
  const parent = this.el.parentElement;
306
332
  // Check if the parent element exists and then get its width
@@ -312,6 +338,7 @@ const CarouselComponent = class {
312
338
  }
313
339
  }
314
340
  resize() {
341
+ var _a;
315
342
  this.calcInnerWidth();
316
343
  if (this.isMobile) {
317
344
  this.width = Math.max(innerWidth * 0.3, 200);
@@ -324,7 +351,7 @@ const CarouselComponent = class {
324
351
  this.totalWidth = this.width * this.content.length;
325
352
  //this is where the margin gap between slides is calculated with the animation
326
353
  this.margin = -5;
327
- const children = this.sliderElement.children;
354
+ const children = ((_a = this.sliderElement) === null || _a === void 0 ? void 0 : _a.children) || [];
328
355
  for (let i = 0; i < children.length; i++) {
329
356
  const item = children[i];
330
357
  item.style.margin = `0 ${this.margin}px`;
@@ -390,7 +417,7 @@ const CarouselComponent = class {
390
417
  }, onClick: this.moveSliderIndex.bind(this, index + 1) })))));
391
418
  }
392
419
  render() {
393
- return (h("div", { key: '84ee06d891aca129d0b806915f837c95113aceec', ref: (el) => (this.stylingContainer = el) }, h("div", { key: '8421b660dab67eb20551042e395bb01095df9c7d', class: "Carousel" }, h("div", { key: 'a0f544c2d0aa51f9a2db14889bbc5f5cc90e13d1', class: "CarouselBody" }, h("div", { key: '726ef4ae8a3d38d693ddf2fb002f3c874ecf9270', class: "CarouselSlider", ref: (el) => (this.sliderElement = el), style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.content.map((item, index) => {
420
+ return (h("div", { key: '0855a42f630d9f753ae9e915c0805dd67e24fd6a', ref: (el) => (this.stylingContainer = el) }, h("div", { key: '9491db52d401e8f38301636e15ae73899013aa8e', class: "Carousel" }, h("div", { key: '74e5f37fd0af7104a34942f3b54afbd3714834ea', class: "CarouselBody" }, h("div", { key: '40299537e362a112ebbcdce6548a51f2a2be8286', class: "CarouselSlider", ref: (el) => (this.sliderElement = el), style: { width: `${this.totalWidth}px`, transform: this.getSliderTransformStyle() } }, this.content.map((item, index) => {
394
421
  const isActive = index === this.currIndex - 1;
395
422
  const buttonStyle = !isActive ? { cursor: 'unset' } : {};
396
423
  const activeItemHeight = !isActive
@@ -415,7 +442,8 @@ const CarouselComponent = class {
415
442
  static get watchers() { return {
416
443
  "clientStyling": ["handleClientStylingChange"],
417
444
  "clientStylingUrl": ["handleClientStylingChangeURL"],
418
- "translationUrl": ["handleNewTranslations"]
445
+ "translationUrl": ["handleNewTranslations"],
446
+ "content": ["handleContentChange"]
419
447
  }; }
420
448
  };
421
449
  CarouselComponent.style = CarouselComponentStyle0;
@@ -436,6 +464,7 @@ const GeneralSliderNavigation = class {
436
464
  this.bulletNavigation = true;
437
465
  this.slideTimer = undefined;
438
466
  this.translationUrl = '';
467
+ this.startFrom = 'middle';
439
468
  this.isLoading = true;
440
469
  this.hasErrors = false;
441
470
  this.device = '';
@@ -513,7 +542,7 @@ const GeneralSliderNavigation = class {
513
542
  return (h("div", { class: "PageError" }, h("div", { class: "TitleError" }, translate('error', this.language))));
514
543
  }
515
544
  if (!this.isLoading) {
516
- return (h("div", { ref: el => this.stylingContainer = el }, h("carousel-component", { content: this.sliderData, language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl })));
545
+ return (h("div", { ref: el => this.stylingContainer = el }, h("carousel-component", { content: this.sliderData, language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "bullet-navigation": this.bulletNavigation, "slide-timer": this.slideTimer, "translation-url": this.translationUrl, "start-from": this.startFrom })));
517
546
  }
518
547
  }
519
548
  static get watchers() { return {
@@ -16,5 +16,5 @@ var patchBrowser = () => {
16
16
 
17
17
  patchBrowser().then(async (options) => {
18
18
  await globalScripts();
19
- return bootstrapLazy([["carousel-component_2",[[1,"general-slider-navigation",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"content":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"innerWidth":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"]}]]]], options);
19
+ return bootstrapLazy([["carousel-component_2",[[1,"general-slider-navigation",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"startFrom":[513,"start-from"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"content":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"startFrom":[513,"start-from"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"innerWidth":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"content":["handleContentChange"]}]]]], options);
20
20
  });
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["carousel-component_2",[[1,"general-slider-navigation",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"content":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"innerWidth":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"]}]]]], options);
8
+ return bootstrapLazy([["carousel-component_2",[[1,"general-slider-navigation",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"cmsEndpoint":[513,"cms-endpoint"],"cmsEnv":[513,"cms-env"],"language":[513],"userRoles":[513,"user-roles"],"bulletNavigation":[516,"bullet-navigation"],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"startFrom":[513,"start-from"],"isLoading":[32],"hasErrors":[32],"device":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"]}],[1,"carousel-component",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"content":[16],"bulletNavigation":[516,"bullet-navigation"],"language":[513],"slideTimer":[514,"slide-timer"],"translationUrl":[513,"translation-url"],"startFrom":[513,"start-from"],"currIndex":[32],"width":[32],"height":[32],"margin":[32],"sliderElement":[32],"totalWidth":[32],"device":[32],"innerWidth":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"content":["handleContentChange"]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -1 +1 @@
1
- import{r as t,h as i,g as e}from"./index-1af267c3.js";const s={en:{error:"Error",noResults:"Loading, please wait ...",joinNow:"Join now"},hu:{error:"Error",noResults:"Loading, please wait ...",joinNow:"Join now"},ro:{error:"Eroare",noResults:"Loading, please wait ...",joinNow:"Join now"},fr:{error:"Error",noResults:"Loading, please wait ...",joinNow:"Join now"},ar:{error:"خطأ",noResults:"Loading, please wait ...",joinNow:"Join now"},hr:{error:"Greška",noResults:"Učitavanje, molimo pričekajte ...",joinNow:"Join now"},"pt-br":{error:"Erro",noResults:"Carregando, espere por favor…",joinNow:"Join now"},"es-mx":{error:"Error",noResults:"Cargando, espere por favor…",joinNow:"Join now"}},o=t=>new Promise((i=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((i=>{s[i]||(s[i]={});for(let e in t[i])s[i][e]=t[i][e]})),i(!0)}))})),r=(t,i)=>s[void 0!==i&&i in s?i:"en"][t];function n(t,i){if(t){const e=document.createElement("style");e.innerHTML=i,t.appendChild(e)}}function a(t,i){const e=new URL(i);fetch(e.href).then((t=>t.text())).then((i=>{const e=document.createElement("style");e.innerHTML=i,t&&t.appendChild(e)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function h(t,i){if(window.emMessageBus){const e=document.createElement("style");window.emMessageBus.subscribe(i,(i=>{e.innerHTML=i,t&&t.appendChild(e)}))}}const l=(t,i)=>function(...e){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>{t.apply(this,e)}),i)},d=class{constructor(i){var e;t(this,i),this.userAgent=window.navigator.userAgent,this.isMobile=!!((e=this.userAgent).toLowerCase().match(/android/i)||e.toLowerCase().match(/blackberry|bb/i)||e.toLowerCase().match(/iphone|ipad|ipod/i)||e.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),this.touchStartX=0,this.touchEndX=0,this.moveSliderIndex=t=>{t<1&&(t=this.content.length),t>this.content.length&&(t=1),this.currIndex=t,this.sliderElement&&(this.sliderElement.style.transform=this.getSliderTransformStyle())},this.handleTouchStart=t=>{this.touchStartX=t.changedTouches[0].screenX},this.handleTouchEnd=t=>{this.touchEndX=t.changedTouches[0].screenX,this.handleSwipe()},this.navigationTo=(t,i,e)=>{window.postMessage({type:"NavigateTo",path:t,target:i||null,externalLink:e||!1},window.location.href)},this.changeSlider=t=>{t>this.currIndex-1?this.next():t<this.currIndex-1&&this.prev()},this.setImage=t=>{let i="";switch(this.device=function(){const t=navigator.userAgent.toLowerCase(),i=screen.availWidth,e=screen.availHeight;if(t.includes("iphone"))return"mobile";if(t.includes("android")){if(e>i&&i<800)return"mobile";if(i>e&&e<800)return"tablet"}return"desktop"}(),this.device){case"mobile":i=t.srcMobile;break;case"tablet":i=t.srcTablet;break;case"desktop":i=t.srcDesktop}return i},this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.content=void 0,this.bulletNavigation=!0,this.language="en",this.slideTimer=void 0,this.translationUrl="",this.currIndex=0,this.width=void 0,this.height=void 0,this.margin=void 0,this.sliderElement=void 0,this.totalWidth=void 0,this.device="",this.innerWidth=void 0}handleClientStylingChange(t,i){t!=i&&n(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!=i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}handleNewTranslations(){o(this.translationUrl)}async componentWillLoad(){this.translationUrl.length>2&&await o(this.translationUrl)}componentDidLoad(){this.init(),this.stylingContainer&&(this.mbSource?h(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)))}init(){this.moveSliderIndex(Math.floor(this.content.length/2)),this.bindEvents(),this.slideTimer>0&&this.timer(),this.calcInnerWidth(),this.resize()}calcInnerWidth(){const t=this.el.parentElement;this.innerWidth=t?t.offsetWidth:window.innerWidth}resize(){this.calcInnerWidth(),this.isMobile?(this.width=Math.max(.3*innerWidth,200),this.height=.4*window.innerHeight):(this.width=this.innerWidth>1200?Math.max(.1*this.innerWidth,300):Math.max(.2*this.innerWidth,200),this.height=.55*window.innerHeight),this.totalWidth=this.width*this.content.length,this.margin=-5;const t=this.sliderElement.children;for(let i=0;i<t.length;i++){const e=t[i];e.style.margin=`0 ${this.margin}px`,e.style.width=this.width-2*this.margin+"px"}this.sliderElement&&(this.sliderElement.style.transform=this.getSliderTransformStyle())}timer(){this.clearTimer(),this.interval=setInterval((()=>{this.moveSliderIndex(++this.currIndex)}),1e3*this.slideTimer)}disconnectedCallback(){this.clearTimer()}clearTimer(){this.interval&&clearInterval(this.interval)}prev(){this.moveSliderIndex(--this.currIndex),this.slideTimer>0&&this.timer()}next(){this.moveSliderIndex(++this.currIndex),this.slideTimer>0&&this.timer()}bindEvents(){window.onresize=l(this.resize,150).bind(this),this.el.addEventListener("touchstart",this.handleTouchStart,!1),this.el.addEventListener("touchend",this.handleTouchEnd,!1)}handleSwipe(){this.touchEndX<this.touchStartX&&this.next(),this.touchEndX>this.touchStartX&&this.prev()}getTransformStyle(t){const i=t===this.currIndex-1?"1200px":"900px";return t===this.currIndex-1?`perspective(${i})`:`perspective(${i}) rotateY(${t<this.currIndex-1?"20deg":"-20deg"})`}getSliderTransformStyle(){return`translate3d(${this.currIndex*-this.width+this.width/2+this.innerWidth/2}px, 0, 0)`}renderNavigation(){return i("div",{class:"CarouselNavigation"},this.content.map(((t,e)=>i("div",{class:{CarouselNavigationBullet:!0,CarouselNavigationBulletActive:e===this.currIndex-1},onClick:this.moveSliderIndex.bind(this,e+1)}))))}render(){return i("div",{key:"84ee06d891aca129d0b806915f837c95113aceec",ref:t=>this.stylingContainer=t},i("div",{key:"8421b660dab67eb20551042e395bb01095df9c7d",class:"Carousel"},i("div",{key:"a0f544c2d0aa51f9a2db14889bbc5f5cc90e13d1",class:"CarouselBody"},i("div",{key:"726ef4ae8a3d38d693ddf2fb002f3c874ecf9270",class:"CarouselSlider",ref:t=>this.sliderElement=t,style:{width:`${this.totalWidth}px`,transform:this.getSliderTransformStyle()}},this.content.map(((t,e)=>{const s=e===this.currIndex-1,o=s?{}:{cursor:"unset"},n=s?{height:`${this.height}px`}:{height:this.height-70+"px"};return i("div",{class:{CarouselSliderItem:!0,CarouselSliderItemActive:s},onClick:this.changeSlider.bind(this,e),style:n},i("div",{class:"Item3dFrame",style:{backgroundSize:"cover",backgroundPosition:"center",backgroundImage:`url(${this.setImage(t.image)})`,transform:this.getTransformStyle(e)}},i("div",{class:"ItemSection"},i("div",{class:"TopSection"},i("button",{onClick:()=>{s&&this.navigationTo(t.url,t.targetType,t.externalLink)},style:o,class:"JoinButton"},i("span",null,r("joinNow",this.language)),i("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{d:"M5 3L10 8L5 13",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})))),i("hr",{class:"Divider"}),i("div",{class:"BottomSection"},i("h3",null,t.title.toUpperCase())))))})))),this.bulletNavigation?this.renderNavigation():null))}get el(){return e(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"]}}};d.style=':host{display:block;font-family:"Roboto", sans-serif}html,body{padding:0;margin:0;width:100%;height:100%}.Carousel{position:relative;display:block;width:100%}.carousel__prev,.carousel__next{position:absolute;bottom:-15%;transition:transform 0.25s ease}.carousel__prev i,.carousel__next i{font-size:var(--emw--font-size-x-large, 60px);color:var(--emw--color-white, #FFFFFF);cursor:pointer}.carousel__prev:hover,.carousel__next:hover{transform:scale(1.25)}.carousel__prev{left:40%}.carousel__next{right:40%}.CarouselBody{width:100%;padding:80px 0px;overflow:hidden}.CarouselSlider{position:relative;transition:transform 1s ease-in-out;background:transparent;display:flex;align-items:center}.CarouselSliderItem{opacity:0.7;position:relative;display:block;float:left;box-sizing:border-box}.Item3dFrame{position:relative;width:100%;height:100%;transition:transform 1s ease-in-out, box-shadow 0.5s ease-in-out;transform-style:preserve-3d;display:flex;flex-direction:column;justify-content:flex-end;border-radius:var(--emw--button-border-radius, 20px)}.CarouselSliderItemActive .Item3dFrame{animation:glow 4s linear infinite}@keyframes glow{0%{box-shadow:0 0 50px 5px var(--emw--color-primary, #22B04E)}50%{box-shadow:0 0 50px 5px var(--emw--color-secondary, #F2711C)}100%{box-shadow:0 0 50px 5px var(--emw--color-primary, #22B04E)}}.TopSection{display:flex;justify-content:flex-start;align-items:center}.JoinButton{background-image:linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, var(--emw--color-white, #FFFFFF) 30%));color:var(--emw--color-typography, #FFFFFF);height:42px;width:110px;border-radius:var(--emw--button-border-radius, 20px);cursor:pointer;font-size:var(--emw--size-small, 14px);border:2px solid var(--emw--button-border-color, #0E5924);display:flex;align-items:center;justify-content:center;gap:2px}.ItemSection{padding:12px 20px;display:flex;flex-direction:column;gap:2px}.Divider{border:none;border-top:2px solid var(--emw--color-white, #FFFFFF);width:100%;opacity:0.3}.BottomSection{display:flex;justify-content:flex-start;align-items:flex-start;width:50%;height:60px}.BottomSection h3{font-size:var(--emw--size-large, 24px);margin:0;color:var(--emw--color-typography, #FFFFFF)}.CarouselNavigation{display:flex;justify-content:center;align-items:center;position:absolute;bottom:20px;left:50%;transform:translateX(-50%)}.CarouselNavigationBullet{width:12px;height:12px;background-color:var(--emw--color-grey-100, rgba(255, 255, 255, 0.5));border-radius:50%;margin:0 5px;cursor:pointer;transition:background-color 0.3s}.CarouselNavigationBulletActive{background-color:var(--emw--color-primary, #22B04E)}.CarouselSliderItemActive{opacity:1}';const c=class{constructor(i){t(this,i),this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.cmsEndpoint=void 0,this.cmsEnv="stage",this.language="en",this.userRoles="everyone",this.bulletNavigation=!0,this.slideTimer=void 0,this.translationUrl="",this.isLoading=!0,this.hasErrors=!1,this.device=""}handleClientStylingChange(t,i){t!=i&&n(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!=i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}handleNewTranslations(){o(this.translationUrl)}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getGeneralSliderNavigation().then((t=>{this.sliderData=t}))}async componentWillLoad(){if(this.translationUrl.length>2&&await o(this.translationUrl),this.cmsEndpoint&&this.language)return this.getGeneralSliderNavigation().then((t=>{this.sliderData=t}))}componentDidLoad(){this.stylingContainer&&(this.mbSource?h(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}getGeneralSliderNavigation(){let t=new URL(`${this.cmsEndpoint}/${this.language}/homepage`);return t.searchParams.append("env",this.cmsEnv),t.searchParams.append("userRoles",this.userRoles),t.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t)return"PC"===t?"dk":"iPad"===t||"iPhone"===t?"ios":"mtWeb"})()),new Promise(((i,e)=>{this.isLoading=!0,fetch(t.href).then((t=>t.json())).then((t=>{i(t.banners)})).catch((t=>{console.error(t),this.hasErrors=!0,e(t)})).finally((()=>{this.isLoading=!1}))}))}render(){return this.hasErrors?i("div",{class:"PageError"},i("div",{class:"TitleError"},r("error",this.language))):this.isLoading?void 0:i("div",{ref:t=>this.stylingContainer=t},i("carousel-component",{content:this.sliderData,language:this.language,"mb-source":this.mbSource,"client-styling":this.clientStyling,"client-styling-url":this.clientStylingUrl,"bullet-navigation":this.bulletNavigation,"slide-timer":this.slideTimer,"translation-url":this.translationUrl}))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"],cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};c.style="";export{d as carousel_component,c as general_slider_navigation}
1
+ import{r as t,h as i,g as e}from"./index-1af267c3.js";const s={en:{error:"Error",noResults:"Loading, please wait ...",joinNow:"Join now"},hu:{error:"Error",noResults:"Loading, please wait ...",joinNow:"Join now"},ro:{error:"Eroare",noResults:"Loading, please wait ...",joinNow:"Join now"},fr:{error:"Error",noResults:"Loading, please wait ...",joinNow:"Join now"},ar:{error:"خطأ",noResults:"Loading, please wait ...",joinNow:"Join now"},hr:{error:"Greška",noResults:"Učitavanje, molimo pričekajte ...",joinNow:"Join now"},"pt-br":{error:"Erro",noResults:"Carregando, espere por favor…",joinNow:"Join now"},"es-mx":{error:"Error",noResults:"Cargando, espere por favor…",joinNow:"Join now"}},o=t=>new Promise((i=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((i=>{s[i]||(s[i]={});for(let e in t[i])s[i][e]=t[i][e]})),i(!0)}))})),r=(t,i)=>s[void 0!==i&&i in s?i:"en"][t];function n(t,i){if(t){const e=document.createElement("style");e.innerHTML=i,t.appendChild(e)}}function a(t,i){const e=new URL(i);fetch(e.href).then((t=>t.text())).then((i=>{const e=document.createElement("style");e.innerHTML=i,t&&t.appendChild(e)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function h(t,i){if(window.emMessageBus){const e=document.createElement("style");window.emMessageBus.subscribe(i,(i=>{e.innerHTML=i,t&&t.appendChild(e)}))}}const l=(t,i)=>function(...e){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>{t.apply(this,e)}),i)},d=class{constructor(i){var e;t(this,i),this.userAgent=window.navigator.userAgent,this.isMobile=!!((e=this.userAgent).toLowerCase().match(/android/i)||e.toLowerCase().match(/blackberry|bb/i)||e.toLowerCase().match(/iphone|ipad|ipod/i)||e.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),this.touchStartX=0,this.touchEndX=0,this.moveSliderIndex=t=>{t<1&&(t=this.content.length),t>this.content.length&&(t=1),this.currIndex=t,this.sliderElement&&(this.sliderElement.style.transform=this.getSliderTransformStyle())},this.handleTouchStart=t=>{this.touchStartX=t.changedTouches[0].screenX},this.handleTouchEnd=t=>{this.touchEndX=t.changedTouches[0].screenX,this.handleSwipe()},this.navigationTo=(t,i,e)=>{window.postMessage({type:"NavigateTo",path:t,target:i||null,externalLink:e||!1},window.location.href)},this.changeSlider=t=>{t>this.currIndex-1?this.next():t<this.currIndex-1&&this.prev()},this.setImage=t=>{let i="";switch(this.device=function(){const t=navigator.userAgent.toLowerCase(),i=screen.availWidth,e=screen.availHeight;if(t.includes("iphone"))return"mobile";if(t.includes("android")){if(e>i&&i<800)return"mobile";if(i>e&&e<800)return"tablet"}return"desktop"}(),this.device){case"mobile":i=t.srcMobile;break;case"tablet":i=t.srcTablet;break;case"desktop":i=t.srcDesktop}return i},this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.content=void 0,this.bulletNavigation=!0,this.language="en",this.slideTimer=void 0,this.translationUrl="",this.startFrom="middle",this.currIndex=0,this.width=void 0,this.height=void 0,this.margin=void 0,this.sliderElement=void 0,this.totalWidth=void 0,this.device="",this.innerWidth=void 0}handleClientStylingChange(t,i){t!=i&&n(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!=i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}handleNewTranslations(){o(this.translationUrl)}handleContentChange(){Array.isArray(this.content)&&this.content.length&&(this.applyStartIndex(),this.resize())}async componentWillLoad(){this.translationUrl.length>2&&await o(this.translationUrl)}componentDidLoad(){this.init(),this.stylingContainer&&(this.mbSource?h(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)))}init(){this.applyStartIndex(),this.bindEvents(),this.slideTimer>0&&this.timer(),this.calcInnerWidth(),this.resize()}applyStartIndex(){if(!this.content||!this.content.length)return;let t=1;switch(this.startFrom){case"start":t=1;break;case"end":t=this.content.length;break;default:t=Math.ceil(this.content.length/2)}this.moveSliderIndex(t)}calcInnerWidth(){const t=this.el.parentElement;this.innerWidth=t?t.offsetWidth:window.innerWidth}resize(){var t;this.calcInnerWidth(),this.isMobile?(this.width=Math.max(.3*innerWidth,200),this.height=.4*window.innerHeight):(this.width=this.innerWidth>1200?Math.max(.1*this.innerWidth,300):Math.max(.2*this.innerWidth,200),this.height=.55*window.innerHeight),this.totalWidth=this.width*this.content.length,this.margin=-5;const i=(null===(t=this.sliderElement)||void 0===t?void 0:t.children)||[];for(let t=0;t<i.length;t++){const e=i[t];e.style.margin=`0 ${this.margin}px`,e.style.width=this.width-2*this.margin+"px"}this.sliderElement&&(this.sliderElement.style.transform=this.getSliderTransformStyle())}timer(){this.clearTimer(),this.interval=setInterval((()=>{this.moveSliderIndex(++this.currIndex)}),1e3*this.slideTimer)}disconnectedCallback(){this.clearTimer()}clearTimer(){this.interval&&clearInterval(this.interval)}prev(){this.moveSliderIndex(--this.currIndex),this.slideTimer>0&&this.timer()}next(){this.moveSliderIndex(++this.currIndex),this.slideTimer>0&&this.timer()}bindEvents(){window.onresize=l(this.resize,150).bind(this),this.el.addEventListener("touchstart",this.handleTouchStart,!1),this.el.addEventListener("touchend",this.handleTouchEnd,!1)}handleSwipe(){this.touchEndX<this.touchStartX&&this.next(),this.touchEndX>this.touchStartX&&this.prev()}getTransformStyle(t){const i=t===this.currIndex-1?"1200px":"900px";return t===this.currIndex-1?`perspective(${i})`:`perspective(${i}) rotateY(${t<this.currIndex-1?"20deg":"-20deg"})`}getSliderTransformStyle(){return`translate3d(${this.currIndex*-this.width+this.width/2+this.innerWidth/2}px, 0, 0)`}renderNavigation(){return i("div",{class:"CarouselNavigation"},this.content.map(((t,e)=>i("div",{class:{CarouselNavigationBullet:!0,CarouselNavigationBulletActive:e===this.currIndex-1},onClick:this.moveSliderIndex.bind(this,e+1)}))))}render(){return i("div",{key:"0855a42f630d9f753ae9e915c0805dd67e24fd6a",ref:t=>this.stylingContainer=t},i("div",{key:"9491db52d401e8f38301636e15ae73899013aa8e",class:"Carousel"},i("div",{key:"74e5f37fd0af7104a34942f3b54afbd3714834ea",class:"CarouselBody"},i("div",{key:"40299537e362a112ebbcdce6548a51f2a2be8286",class:"CarouselSlider",ref:t=>this.sliderElement=t,style:{width:`${this.totalWidth}px`,transform:this.getSliderTransformStyle()}},this.content.map(((t,e)=>{const s=e===this.currIndex-1,o=s?{}:{cursor:"unset"},n=s?{height:`${this.height}px`}:{height:this.height-70+"px"};return i("div",{class:{CarouselSliderItem:!0,CarouselSliderItemActive:s},onClick:this.changeSlider.bind(this,e),style:n},i("div",{class:"Item3dFrame",style:{backgroundSize:"cover",backgroundPosition:"center",backgroundImage:`url(${this.setImage(t.image)})`,transform:this.getTransformStyle(e)}},i("div",{class:"ItemSection"},i("div",{class:"TopSection"},i("button",{onClick:()=>{s&&this.navigationTo(t.url,t.targetType,t.externalLink)},style:o,class:"JoinButton"},i("span",null,r("joinNow",this.language)),i("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{d:"M5 3L10 8L5 13",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})))),i("hr",{class:"Divider"}),i("div",{class:"BottomSection"},i("h3",null,t.title.toUpperCase())))))})))),this.bulletNavigation?this.renderNavigation():null))}get el(){return e(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"],content:["handleContentChange"]}}};d.style=':host{display:block;font-family:"Roboto", sans-serif}html,body{padding:0;margin:0;width:100%;height:100%}.Carousel{position:relative;display:block;width:100%}.carousel__prev,.carousel__next{position:absolute;bottom:-15%;transition:transform 0.25s ease}.carousel__prev i,.carousel__next i{font-size:var(--emw--font-size-x-large, 60px);color:var(--emw--color-white, #FFFFFF);cursor:pointer}.carousel__prev:hover,.carousel__next:hover{transform:scale(1.25)}.carousel__prev{left:40%}.carousel__next{right:40%}.CarouselBody{width:100%;padding:80px 0px;overflow:hidden}.CarouselSlider{position:relative;transition:transform 1s ease-in-out;background:transparent;display:flex;align-items:center}.CarouselSliderItem{opacity:0.7;position:relative;display:block;float:left;box-sizing:border-box}.Item3dFrame{position:relative;width:100%;height:100%;transition:transform 1s ease-in-out, box-shadow 0.5s ease-in-out;transform-style:preserve-3d;display:flex;flex-direction:column;justify-content:flex-end;border-radius:var(--emw--button-border-radius, 20px)}.CarouselSliderItemActive .Item3dFrame{animation:glow 4s linear infinite}@keyframes glow{0%{box-shadow:0 0 50px 5px var(--emw--color-primary, #22B04E)}50%{box-shadow:0 0 50px 5px var(--emw--color-secondary, #F2711C)}100%{box-shadow:0 0 50px 5px var(--emw--color-primary, #22B04E)}}.TopSection{display:flex;justify-content:flex-start;align-items:center}.JoinButton{background-image:linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, var(--emw--color-white, #FFFFFF) 30%));color:var(--emw--color-typography, #FFFFFF);height:42px;width:110px;border-radius:var(--emw--button-border-radius, 20px);cursor:pointer;font-size:var(--emw--size-small, 14px);border:2px solid var(--emw--button-border-color, #0E5924);display:flex;align-items:center;justify-content:center;gap:2px}.ItemSection{padding:12px 20px;display:flex;flex-direction:column;gap:2px}.Divider{border:none;border-top:2px solid var(--emw--color-white, #FFFFFF);width:100%;opacity:0.3}.BottomSection{display:flex;justify-content:flex-start;align-items:flex-start;width:50%;height:60px}.BottomSection h3{font-size:var(--emw--size-large, 24px);margin:0;color:var(--emw--color-typography, #FFFFFF)}.CarouselNavigation{display:flex;justify-content:center;align-items:center;position:absolute;bottom:20px;left:50%;transform:translateX(-50%)}.CarouselNavigationBullet{width:12px;height:12px;background-color:var(--emw--color-grey-100, rgba(255, 255, 255, 0.5));border-radius:50%;margin:0 5px;cursor:pointer;transition:background-color 0.3s}.CarouselNavigationBulletActive{background-color:var(--emw--color-primary, #22B04E)}.CarouselSliderItemActive{opacity:1}';const c=class{constructor(i){t(this,i),this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.cmsEndpoint=void 0,this.cmsEnv="stage",this.language="en",this.userRoles="everyone",this.bulletNavigation=!0,this.slideTimer=void 0,this.translationUrl="",this.startFrom="middle",this.isLoading=!0,this.hasErrors=!1,this.device=""}handleClientStylingChange(t,i){t!=i&&n(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!=i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}handleNewTranslations(){o(this.translationUrl)}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getGeneralSliderNavigation().then((t=>{this.sliderData=t}))}async componentWillLoad(){if(this.translationUrl.length>2&&await o(this.translationUrl),this.cmsEndpoint&&this.language)return this.getGeneralSliderNavigation().then((t=>{this.sliderData=t}))}componentDidLoad(){this.stylingContainer&&(this.mbSource?h(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}getGeneralSliderNavigation(){let t=new URL(`${this.cmsEndpoint}/${this.language}/homepage`);return t.searchParams.append("env",this.cmsEnv),t.searchParams.append("userRoles",this.userRoles),t.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t)return"PC"===t?"dk":"iPad"===t||"iPhone"===t?"ios":"mtWeb"})()),new Promise(((i,e)=>{this.isLoading=!0,fetch(t.href).then((t=>t.json())).then((t=>{i(t.banners)})).catch((t=>{console.error(t),this.hasErrors=!0,e(t)})).finally((()=>{this.isLoading=!1}))}))}render(){return this.hasErrors?i("div",{class:"PageError"},i("div",{class:"TitleError"},r("error",this.language))):this.isLoading?void 0:i("div",{ref:t=>this.stylingContainer=t},i("carousel-component",{content:this.sliderData,language:this.language,"mb-source":this.mbSource,"client-styling":this.clientStyling,"client-styling-url":this.clientStylingUrl,"bullet-navigation":this.bulletNavigation,"slide-timer":this.slideTimer,"translation-url":this.translationUrl,"start-from":this.startFrom}))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"],cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};c.style="";export{d as carousel_component,c as general_slider_navigation}
@@ -1 +1 @@
1
- import{p as n,b as l}from"./index-1af267c3.js";export{s as setNonce}from"./index-1af267c3.js";import{g as t}from"./app-globals-0f993ce5.js";(()=>{const l=import.meta.url,t={};return""!==l&&(t.resourcesUrl=new URL(".",l).href),n(t)})().then((async n=>(await t(),l([["carousel-component_2",[[1,"general-slider-navigation",{mbSource:[1,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],cmsEndpoint:[513,"cms-endpoint"],cmsEnv:[513,"cms-env"],language:[513],userRoles:[513,"user-roles"],bulletNavigation:[516,"bullet-navigation"],slideTimer:[514,"slide-timer"],translationUrl:[513,"translation-url"],isLoading:[32],hasErrors:[32],device:[32]},null,{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"],cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}],[1,"carousel-component",{mbSource:[1,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],content:[16],bulletNavigation:[516,"bullet-navigation"],language:[513],slideTimer:[514,"slide-timer"],translationUrl:[513,"translation-url"],currIndex:[32],width:[32],height:[32],margin:[32],sliderElement:[32],totalWidth:[32],device:[32],innerWidth:[32]},null,{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"]}]]]],n))));
1
+ import{p as n,b as t}from"./index-1af267c3.js";export{s as setNonce}from"./index-1af267c3.js";import{g as l}from"./app-globals-0f993ce5.js";(()=>{const t=import.meta.url,l={};return""!==t&&(l.resourcesUrl=new URL(".",t).href),n(l)})().then((async n=>(await l(),t([["carousel-component_2",[[1,"general-slider-navigation",{mbSource:[1,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],cmsEndpoint:[513,"cms-endpoint"],cmsEnv:[513,"cms-env"],language:[513],userRoles:[513,"user-roles"],bulletNavigation:[516,"bullet-navigation"],slideTimer:[514,"slide-timer"],translationUrl:[513,"translation-url"],startFrom:[513,"start-from"],isLoading:[32],hasErrors:[32],device:[32]},null,{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"],cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}],[1,"carousel-component",{mbSource:[1,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],content:[16],bulletNavigation:[516,"bullet-navigation"],language:[513],slideTimer:[514,"slide-timer"],translationUrl:[513,"translation-url"],startFrom:[513,"start-from"],currIndex:[32],width:[32],height:[32],margin:[32],sliderElement:[32],totalWidth:[32],device:[32],innerWidth:[32]},null,{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"],content:["handleContentChange"]}]]]],n))));
@@ -31,6 +31,10 @@ export declare class CarouselComponent {
31
31
  * Translation via url
32
32
  */
33
33
  translationUrl: string;
34
+ /**
35
+ * Where to start from. Defaults to middle.
36
+ */
37
+ startFrom: 'start' | 'middle' | 'end';
34
38
  currIndex: number;
35
39
  width: number;
36
40
  height: number;
@@ -51,9 +55,11 @@ export declare class CarouselComponent {
51
55
  handleClientStylingChange(newValue: any, oldValue: any): void;
52
56
  handleClientStylingChangeURL(newValue: any, oldValue: any): void;
53
57
  handleNewTranslations(): void;
58
+ handleContentChange(): void;
54
59
  componentWillLoad(): Promise<void>;
55
60
  componentDidLoad(): void;
56
61
  private init;
62
+ private applyStartIndex;
57
63
  private calcInnerWidth;
58
64
  private resize;
59
65
  moveSliderIndex: (index: number) => any;
@@ -39,6 +39,10 @@ export declare class GeneralSliderNavigation {
39
39
  * Translation via url
40
40
  */
41
41
  translationUrl: string;
42
+ /**
43
+ * Where to start from the carousel. Default is middle
44
+ */
45
+ startFrom: 'start' | 'middle' | 'end';
42
46
  private isLoading;
43
47
  hasErrors: boolean;
44
48
  device: string;
@@ -35,6 +35,10 @@ export namespace Components {
35
35
  * Timer for auto sliding
36
36
  */
37
37
  "slideTimer": number;
38
+ /**
39
+ * Where to start from. Defaults to middle.
40
+ */
41
+ "startFrom": 'start' | 'middle' | 'end';
38
42
  /**
39
43
  * Translation via url
40
44
  */
@@ -73,6 +77,10 @@ export namespace Components {
73
77
  * Timer for auto sliding
74
78
  */
75
79
  "slideTimer": number;
80
+ /**
81
+ * Where to start from the carousel. Default is middle
82
+ */
83
+ "startFrom": 'start' | 'middle' | 'end';
76
84
  /**
77
85
  * Translation via url
78
86
  */
@@ -131,6 +139,10 @@ declare namespace LocalJSX {
131
139
  * Timer for auto sliding
132
140
  */
133
141
  "slideTimer"?: number;
142
+ /**
143
+ * Where to start from. Defaults to middle.
144
+ */
145
+ "startFrom"?: 'start' | 'middle' | 'end';
134
146
  /**
135
147
  * Translation via url
136
148
  */
@@ -169,6 +181,10 @@ declare namespace LocalJSX {
169
181
  * Timer for auto sliding
170
182
  */
171
183
  "slideTimer"?: number;
184
+ /**
185
+ * Where to start from the carousel. Default is middle
186
+ */
187
+ "startFrom"?: 'start' | 'middle' | 'end';
172
188
  /**
173
189
  * Translation via url
174
190
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/general-slider-navigation",
3
- "version": "1.77.14",
3
+ "version": "1.77.15",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",