@everymatrix/lottery-tipping-page 1.94.4 → 1.94.6

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.
@@ -235,59 +235,6 @@ const GeneralTooltip = class {
235
235
  };
236
236
  GeneralTooltip.style = GeneralTooltipStyle0;
237
237
 
238
- const DEFAULT_LANGUAGE$5 = 'en';
239
- const SUPPORTED_LANGUAGES$5 = ['ro', 'en', 'fr', 'ar', 'hr'];
240
- const TRANSLATIONS$5 = {
241
- en: {
242
- stop: 'Stop',
243
- at: 'at',
244
- turnover: 'Turnover: ',
245
- startIn: 'Sales Start in:',
246
- },
247
- ro: {
248
- stop: 'Oprește',
249
- at: 'la'
250
- },
251
- fr: {
252
- stop: 'Arrêtez',
253
- at: 'à'
254
- },
255
- ar: {
256
- stop: 'توقف',
257
- at: 'في'
258
- },
259
- hr: {
260
- stop: 'Stop',
261
- at: 'u'
262
- }
263
- };
264
- const translate$5 = (key, customLang) => {
265
- const lang = customLang;
266
- return TRANSLATIONS$5[lang !== undefined && SUPPORTED_LANGUAGES$5.includes(lang) ? lang : DEFAULT_LANGUAGE$5][key];
267
- };
268
- const getTranslations$5 = (data) => {
269
- Object.keys(data).forEach((item) => {
270
- for (let key in data[item]) {
271
- TRANSLATIONS$5[item][key] = data[item][key];
272
- }
273
- });
274
- };
275
- const resolveTranslationUrl$3 = async (translationUrl) => {
276
- if (translationUrl) {
277
- try {
278
- const response = await fetch(translationUrl);
279
- if (!response.ok) {
280
- throw new Error(`HTTP error! status: ${response.status}`);
281
- }
282
- const translations = await response.json();
283
- getTranslations$5(translations);
284
- }
285
- catch (error) {
286
- console.error('Failed to fetch or parse translations from URL:', error);
287
- }
288
- }
289
- };
290
-
291
238
  function _typeof(o) {
292
239
  "@babel/helpers - typeof";
293
240
 
@@ -413,31 +360,6 @@ function getTimezoneOffsetInMilliseconds(date) {
413
360
  return date.getTime() - utcDate.getTime();
414
361
  }
415
362
 
416
- /**
417
- * @name startOfDay
418
- * @category Day Helpers
419
- * @summary Return the start of a day for the given date.
420
- *
421
- * @description
422
- * Return the start of a day for the given date.
423
- * The result will be in the local timezone.
424
- *
425
- * @param {Date|Number} date - the original date
426
- * @returns {Date} the start of a day
427
- * @throws {TypeError} 1 argument required
428
- *
429
- * @example
430
- * // The start of a day for 2 September 2014 11:55:00:
431
- * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
432
- * //=> Tue Sep 02 2014 00:00:00
433
- */
434
- function startOfDay(dirtyDate) {
435
- requiredArgs(1, arguments);
436
- var date = toDate(dirtyDate);
437
- date.setHours(0, 0, 0, 0);
438
- return date;
439
- }
440
-
441
363
  /**
442
364
  * Days in 1 week.
443
365
  *
@@ -467,41 +389,6 @@ var millisecondsInMinute = 60000;
467
389
  */
468
390
  var millisecondsInHour = 3600000;
469
391
 
470
- /**
471
- * @name isSameDay
472
- * @category Day Helpers
473
- * @summary Are the given dates in the same day (and year and month)?
474
- *
475
- * @description
476
- * Are the given dates in the same day (and year and month)?
477
- *
478
- * @param {Date|Number} dateLeft - the first date to check
479
- * @param {Date|Number} dateRight - the second date to check
480
- * @returns {Boolean} the dates are in the same day (and year and month)
481
- * @throws {TypeError} 2 arguments required
482
- *
483
- * @example
484
- * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
485
- * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))
486
- * //=> true
487
- *
488
- * @example
489
- * // Are 4 September and 4 October in the same day?
490
- * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))
491
- * //=> false
492
- *
493
- * @example
494
- * // Are 4 September, 2014 and 4 September, 2015 in the same day?
495
- * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))
496
- * //=> false
497
- */
498
- function isSameDay(dirtyDateLeft, dirtyDateRight) {
499
- requiredArgs(2, arguments);
500
- var dateLeftStartOfDay = startOfDay(dirtyDateLeft);
501
- var dateRightStartOfDay = startOfDay(dirtyDateRight);
502
- return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();
503
- }
504
-
505
392
  /**
506
393
  * @name isDate
507
394
  * @category Common Helpers
@@ -579,77 +466,6 @@ function isValid(dirtyDate) {
579
466
  return !isNaN(Number(date));
580
467
  }
581
468
 
582
- /**
583
- * @name differenceInMilliseconds
584
- * @category Millisecond Helpers
585
- * @summary Get the number of milliseconds between the given dates.
586
- *
587
- * @description
588
- * Get the number of milliseconds between the given dates.
589
- *
590
- * @param {Date|Number} dateLeft - the later date
591
- * @param {Date|Number} dateRight - the earlier date
592
- * @returns {Number} the number of milliseconds
593
- * @throws {TypeError} 2 arguments required
594
- *
595
- * @example
596
- * // How many milliseconds are between
597
- * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
598
- * const result = differenceInMilliseconds(
599
- * new Date(2014, 6, 2, 12, 30, 21, 700),
600
- * new Date(2014, 6, 2, 12, 30, 20, 600)
601
- * )
602
- * //=> 1100
603
- */
604
- function differenceInMilliseconds(dateLeft, dateRight) {
605
- requiredArgs(2, arguments);
606
- return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
607
- }
608
-
609
- var roundingMap = {
610
- ceil: Math.ceil,
611
- round: Math.round,
612
- floor: Math.floor,
613
- trunc: function trunc(value) {
614
- return value < 0 ? Math.ceil(value) : Math.floor(value);
615
- } // Math.trunc is not supported by IE
616
- };
617
-
618
- var defaultRoundingMethod = 'trunc';
619
- function getRoundingMethod(method) {
620
- return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
621
- }
622
-
623
- /**
624
- * @name differenceInSeconds
625
- * @category Second Helpers
626
- * @summary Get the number of seconds between the given dates.
627
- *
628
- * @description
629
- * Get the number of seconds between the given dates.
630
- *
631
- * @param {Date|Number} dateLeft - the later date
632
- * @param {Date|Number} dateRight - the earlier date
633
- * @param {Object} [options] - an object with options.
634
- * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
635
- * @returns {Number} the number of seconds
636
- * @throws {TypeError} 2 arguments required
637
- *
638
- * @example
639
- * // How many seconds are between
640
- * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
641
- * const result = differenceInSeconds(
642
- * new Date(2014, 6, 2, 12, 30, 20, 0),
643
- * new Date(2014, 6, 2, 12, 30, 7, 999)
644
- * )
645
- * //=> 12
646
- */
647
- function differenceInSeconds(dateLeft, dateRight, options) {
648
- requiredArgs(2, arguments);
649
- var diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;
650
- return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
651
- }
652
-
653
469
  /**
654
470
  * @name subMilliseconds
655
471
  * @category Millisecond Helpers
@@ -2645,106 +2461,53 @@ function cleanEscapedString(input) {
2645
2461
  }
2646
2462
 
2647
2463
  /**
2648
- * @name isBefore
2464
+ * @name isAfter
2649
2465
  * @category Common Helpers
2650
- * @summary Is the first date before the second one?
2466
+ * @summary Is the first date after the second one?
2651
2467
  *
2652
2468
  * @description
2653
- * Is the first date before the second one?
2469
+ * Is the first date after the second one?
2654
2470
  *
2655
- * @param {Date|Number} date - the date that should be before the other one to return true
2471
+ * @param {Date|Number} date - the date that should be after the other one to return true
2656
2472
  * @param {Date|Number} dateToCompare - the date to compare with
2657
- * @returns {Boolean} the first date is before the second date
2473
+ * @returns {Boolean} the first date is after the second date
2658
2474
  * @throws {TypeError} 2 arguments required
2659
2475
  *
2660
2476
  * @example
2661
- * // Is 10 July 1989 before 11 February 1987?
2662
- * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
2663
- * //=> false
2477
+ * // Is 10 July 1989 after 11 February 1987?
2478
+ * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
2479
+ * //=> true
2664
2480
  */
2665
- function isBefore(dirtyDate, dirtyDateToCompare) {
2481
+ function isAfter(dirtyDate, dirtyDateToCompare) {
2666
2482
  requiredArgs(2, arguments);
2667
2483
  var date = toDate(dirtyDate);
2668
2484
  var dateToCompare = toDate(dirtyDateToCompare);
2669
- return date.getTime() < dateToCompare.getTime();
2670
- }
2671
-
2672
- /**
2673
- * @name isToday
2674
- * @category Day Helpers
2675
- * @summary Is the given date today?
2676
- * @pure false
2677
- *
2678
- * @description
2679
- * Is the given date today?
2680
- *
2681
- * > ⚠️ Please note that this function is not present in the FP submodule as
2682
- * > it uses `Date.now()` internally hence impure and can't be safely curried.
2683
- *
2684
- * @param {Date|Number} date - the date to check
2685
- * @returns {Boolean} the date is today
2686
- * @throws {TypeError} 1 argument required
2687
- *
2688
- * @example
2689
- * // If today is 6 October 2014, is 6 October 14:00:00 today?
2690
- * const result = isToday(new Date(2014, 9, 6, 14, 0))
2691
- * //=> true
2692
- */
2693
- function isToday(dirtyDate) {
2694
- requiredArgs(1, arguments);
2695
- return isSameDay(dirtyDate, Date.now());
2485
+ return date.getTime() > dateToCompare.getTime();
2696
2486
  }
2697
2487
 
2698
2488
  /**
2699
- * @name isWithinInterval
2700
- * @category Interval Helpers
2701
- * @summary Is the given date within the interval?
2489
+ * @name isBefore
2490
+ * @category Common Helpers
2491
+ * @summary Is the first date before the second one?
2702
2492
  *
2703
2493
  * @description
2704
- * Is the given date within the interval? (Including start and end.)
2494
+ * Is the first date before the second one?
2705
2495
  *
2706
- * @param {Date|Number} date - the date to check
2707
- * @param {Interval} interval - the interval to check
2708
- * @returns {Boolean} the date is within the interval
2496
+ * @param {Date|Number} date - the date that should be before the other one to return true
2497
+ * @param {Date|Number} dateToCompare - the date to compare with
2498
+ * @returns {Boolean} the first date is before the second date
2709
2499
  * @throws {TypeError} 2 arguments required
2710
- * @throws {RangeError} The start of an interval cannot be after its end
2711
- * @throws {RangeError} Date in interval cannot be `Invalid Date`
2712
- *
2713
- * @example
2714
- * // For the date within the interval:
2715
- * isWithinInterval(new Date(2014, 0, 3), {
2716
- * start: new Date(2014, 0, 1),
2717
- * end: new Date(2014, 0, 7)
2718
- * })
2719
- * //=> true
2720
2500
  *
2721
2501
  * @example
2722
- * // For the date outside of the interval:
2723
- * isWithinInterval(new Date(2014, 0, 10), {
2724
- * start: new Date(2014, 0, 1),
2725
- * end: new Date(2014, 0, 7)
2726
- * })
2502
+ * // Is 10 July 1989 before 11 February 1987?
2503
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
2727
2504
  * //=> false
2728
- *
2729
- * @example
2730
- * // For date equal to interval start:
2731
- * isWithinInterval(date, { start, end: date }) // => true
2732
- *
2733
- * @example
2734
- * // For date equal to interval end:
2735
- * isWithinInterval(date, { start: date, end }) // => true
2736
2505
  */
2737
- function isWithinInterval(dirtyDate, interval) {
2506
+ function isBefore(dirtyDate, dirtyDateToCompare) {
2738
2507
  requiredArgs(2, arguments);
2739
- var time = toDate(dirtyDate).getTime();
2740
- var startTime = toDate(interval.start).getTime();
2741
- var endTime = toDate(interval.end).getTime();
2742
-
2743
- // Throw an exception if start date is after end date or if any date is `Invalid Date`
2744
- if (!(startTime <= endTime)) {
2745
- throw new RangeError('Invalid interval');
2746
- }
2747
- return time >= startTime && time <= endTime;
2508
+ var date = toDate(dirtyDate);
2509
+ var dateToCompare = toDate(dirtyDateToCompare);
2510
+ return date.getTime() < dateToCompare.getTime();
2748
2511
  }
2749
2512
 
2750
2513
  /**
@@ -2973,77 +2736,233 @@ function validateTimezone(_hours, minutes) {
2973
2736
  return minutes >= 0 && minutes <= 59;
2974
2737
  }
2975
2738
 
2976
- const formatDate$2 = ({ date, type = 'date', format: format$1 }) => {
2977
- try {
2978
- const parsedDate = parseISO(date);
2979
- if (isNaN(parsedDate.getTime())) {
2980
- throw new Error(`Invalid date: ${date}`);
2739
+ const helperCountDownCss = ":host{display:block}.helper-count-down-container{display:flex;align-items:center}.helper-count-down-prefix{margin-right:4px}.helper-count-down-suffix{margin-left:4px}.helper-count-down-values{display:flex;align-items:center}.helper-count-down-item{display:flex;align-items:center;justify-content:center}.helper-count-down-item-num{font-variant-numeric:tabular-nums}";
2740
+ const HelperCountDownStyle0 = helperCountDownCss;
2741
+
2742
+ const HelperCountDown = class {
2743
+ constructor(hostRef) {
2744
+ index.registerInstance(this, hostRef);
2745
+ this.countDownChange = index.createEvent(this, "countDownChange", 7);
2746
+ this.countDownFinish = index.createEvent(this, "countDownFinish", 7);
2747
+ this.value = undefined;
2748
+ this.format = 'HH:mm:ss';
2749
+ this.prefix = undefined;
2750
+ this.suffix = undefined;
2751
+ this.mbSource = undefined;
2752
+ this.clientStyling = undefined;
2753
+ this.clientStylingUrl = undefined;
2754
+ this.endTime = undefined;
2755
+ this.timeObj = {
2756
+ day: { str: '00', unit: '' },
2757
+ hour: { str: '00', unit: '' },
2758
+ minute: { str: '00', unit: '' },
2759
+ second: { str: '00', unit: '' }
2760
+ };
2761
+ }
2762
+ handleClientStylingChange(newValue, oldValue) {
2763
+ if (newValue != oldValue) {
2764
+ lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
2981
2765
  }
2982
- if (format$1)
2983
- return format(parsedDate, format$1);
2984
- let formatStr = 'dd/MM/yyyy';
2985
- if (type === 'time') {
2986
- formatStr = 'dd/MM/yyyy HH:mm:ss';
2766
+ }
2767
+ handleClientStylingUrlChange(newValue, oldValue) {
2768
+ if (newValue != oldValue) {
2769
+ lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2987
2770
  }
2988
- else if (type === 'week') {
2989
- formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
2771
+ }
2772
+ handleMbSourceChange(newValue, oldValue) {
2773
+ if (newValue != oldValue) {
2774
+ lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2990
2775
  }
2991
- return format(parsedDate, formatStr);
2992
2776
  }
2993
- catch (error) {
2994
- console.error('Error formatting date:', error.message);
2995
- return '';
2777
+ handleValueChange(newValue) {
2778
+ this.setEndTime(newValue);
2779
+ if (newValue) {
2780
+ this.startCountDown();
2781
+ }
2782
+ else {
2783
+ this.clearCountDown();
2784
+ }
2785
+ }
2786
+ componentDidLoad() {
2787
+ if (this.stylingContainer) {
2788
+ if (this.mbSource)
2789
+ lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2790
+ if (this.clientStyling)
2791
+ lotteryTippingPage.setClientStyling(this.stylingContainer, this.clientStyling);
2792
+ if (this.clientStylingUrl)
2793
+ lotteryTippingPage.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2794
+ }
2795
+ this.setEndTime(this.value);
2796
+ if (this.value)
2797
+ this.startCountDown();
2798
+ }
2799
+ setEndTime(value) {
2800
+ if (typeof value === 'string') {
2801
+ // If it's a string, parse it and get the milliseconds
2802
+ const time = parseISO(value).getTime();
2803
+ this.endTime = isNaN(time) ? null : time;
2804
+ }
2805
+ else {
2806
+ // If it's a number, use it directly
2807
+ this.endTime = value;
2808
+ }
2809
+ }
2810
+ disconnectedCallback() {
2811
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2812
+ this.clearCountDown();
2813
+ }
2814
+ startCountDown() {
2815
+ this.clearCountDown();
2816
+ this.tick();
2817
+ this.timer = setInterval(() => {
2818
+ this.tick();
2819
+ }, 1000);
2820
+ }
2821
+ clearCountDown() {
2822
+ if (this.timer) {
2823
+ clearInterval(this.timer);
2824
+ this.timer = null;
2825
+ }
2826
+ }
2827
+ tick() {
2828
+ if (!this.endTime)
2829
+ return;
2830
+ let leftTime = this.endTime - Date.now();
2831
+ if (leftTime <= 0) {
2832
+ leftTime = 0;
2833
+ this.clearCountDown();
2834
+ this.countDownFinish.emit();
2835
+ }
2836
+ const d = Math.floor(leftTime / (1000 * 60 * 60 * 24));
2837
+ const h = Math.floor((leftTime / (1000 * 60 * 60)) % 24);
2838
+ const m = Math.floor((leftTime / 1000 / 60) % 60);
2839
+ const s = Math.floor((leftTime / 1000) % 60);
2840
+ const pad = (n) => (n < 10 ? `0${n}` : `${n}`);
2841
+ this.timeObj = {
2842
+ day: { str: pad(d), unit: 'd' },
2843
+ hour: { str: pad(h), unit: 'h' },
2844
+ minute: { str: pad(m), unit: 'm' },
2845
+ second: { str: pad(s), unit: 's' }
2846
+ };
2847
+ const formatTime = this.getFormatTime();
2848
+ this.countDownChange.emit({ leftTime, formatTime, legalTime: formatTime });
2849
+ }
2850
+ getFormatTime() {
2851
+ return this.format
2852
+ .replace('DD', this.timeObj.day.str)
2853
+ .replace('HH', this.timeObj.hour.str)
2854
+ .replace('mm', this.timeObj.minute.str)
2855
+ .replace('ss', this.timeObj.second.str);
2856
+ }
2857
+ renderItems() {
2858
+ const regex = /(DD|HH|mm|ss)|([\s\S]+?)(?=(DD|HH|mm|ss)|$)/g;
2859
+ const items = [];
2860
+ let match;
2861
+ while ((match = regex.exec(this.format)) !== null) {
2862
+ if (match[1]) {
2863
+ let val = '';
2864
+ switch (match[1]) {
2865
+ case 'DD':
2866
+ val = this.timeObj.day.str;
2867
+ break;
2868
+ case 'HH':
2869
+ val = this.timeObj.hour.str;
2870
+ break;
2871
+ case 'mm':
2872
+ val = this.timeObj.minute.str;
2873
+ break;
2874
+ case 'ss':
2875
+ val = this.timeObj.second.str;
2876
+ break;
2877
+ }
2878
+ items.push({ val, unit: '' });
2879
+ }
2880
+ else if (match[2]) {
2881
+ if (items.length > 0) {
2882
+ items[items.length - 1].unit = match[2];
2883
+ }
2884
+ }
2885
+ }
2886
+ return items.map((item, index$1) => {
2887
+ return (index.h("div", { key: index$1 + item.unit, class: "helper-count-down-item", part: "item" }, index.h("div", { class: "helper-count-down-item-num" }, item.val), index.h("div", { class: "helper-count-down-item-unit" }, item.unit)));
2888
+ });
2996
2889
  }
2890
+ render() {
2891
+ return (index.h("div", { key: 'b360412e045020b5ac0263c6ca56458f31eedb2c', class: "helper-count-down-container", ref: (el) => (this.stylingContainer = el) }, index.h("slot", { key: 'c72bed87fba869c842407b04e0cbfe038e5b7ea8' }), this.prefix && index.h("div", { key: '8d3ba9d60577421f81bae7bc76f52a774b17e1fe', class: "helper-count-down-prefix" }, this.prefix), index.h("div", { key: '187edf3b8eb6de85efe1a748fd8ef47a68e19611', class: "helper-count-down-values", part: "values" }, this.renderItems()), this.suffix && index.h("div", { key: '3a8e5d9561ecd3f52eff423bd43c8b60a261a17c', class: "helper-count-down-suffix" }, this.suffix)));
2892
+ }
2893
+ static get watchers() { return {
2894
+ "clientStyling": ["handleClientStylingChange"],
2895
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2896
+ "mbSource": ["handleMbSourceChange"],
2897
+ "value": ["handleValueChange"]
2898
+ }; }
2997
2899
  };
2998
- function formatTime(time) {
2999
- if (!time)
3000
- return;
3001
- if (isToday(new Date(time))) {
3002
- return formatDate$2({ date: time, format: 'HH:mm' });
2900
+ HelperCountDown.style = HelperCountDownStyle0;
2901
+
2902
+ const DEFAULT_LANGUAGE$5 = 'en';
2903
+ const SUPPORTED_LANGUAGES$5 = ['ro', 'en', 'fr', 'ar', 'hr'];
2904
+ const TRANSLATIONS$5 = {
2905
+ en: {
2906
+ stop: 'Stop',
2907
+ at: 'at',
2908
+ turnover: 'Turnover: ',
2909
+ startIn: 'Sales Start in:',
2910
+ },
2911
+ ro: {
2912
+ stop: 'Oprește',
2913
+ at: 'la'
2914
+ },
2915
+ fr: {
2916
+ stop: 'Arrêtez',
2917
+ at: 'à'
2918
+ },
2919
+ ar: {
2920
+ stop: 'توقف',
2921
+ at: 'في'
2922
+ },
2923
+ hr: {
2924
+ stop: 'Stop',
2925
+ at: 'u'
3003
2926
  }
3004
- return formatDate$2({ date: time, format: 'dd/MM/yyyy HH:mm' });
3005
- }
3006
- function formatCountdown(stopTime, _now) {
3007
- if (!stopTime)
3008
- return;
3009
- const endTime = typeof stopTime === 'string' ? parseISO(stopTime) : stopTime;
3010
- const now = _now && new Date();
3011
- let totalSeconds = differenceInSeconds(endTime, now);
3012
- if (totalSeconds < 0)
3013
- return '0D 00H 00M 00S';
3014
- const days = Math.floor(totalSeconds / 86400);
3015
- totalSeconds %= 86400;
3016
- const hours = Math.floor(totalSeconds / 3600);
3017
- totalSeconds %= 3600;
3018
- const minutes = Math.floor(totalSeconds / 60);
3019
- const seconds = totalSeconds % 60;
3020
- return `${days}D ${hours.toString().padStart(2, '0')}H ${minutes.toString().padStart(2, '0')}M ${seconds
3021
- .toString()
3022
- .padStart(2, '0')}S`;
3023
- }
3024
- function getWagerTime(startTime, stopTime) {
3025
- const now = new Date();
3026
- if (startTime && isBefore(now, parseISO(startTime))) {
3027
- return { start: formatCountdown(startTime, now) };
3028
- }
3029
- if (startTime &&
3030
- stopTime &&
3031
- isWithinInterval(now, {
3032
- start: parseISO(startTime),
3033
- end: parseISO(stopTime)
3034
- })) {
3035
- return { end: formatTime(stopTime) };
2927
+ };
2928
+ const translate$5 = (key, customLang) => {
2929
+ const lang = customLang;
2930
+ return TRANSLATIONS$5[lang !== undefined && SUPPORTED_LANGUAGES$5.includes(lang) ? lang : DEFAULT_LANGUAGE$5][key];
2931
+ };
2932
+ const getTranslations$5 = (data) => {
2933
+ Object.keys(data).forEach((item) => {
2934
+ for (let key in data[item]) {
2935
+ TRANSLATIONS$5[item][key] = data[item][key];
2936
+ }
2937
+ });
2938
+ };
2939
+ const resolveTranslationUrl$3 = async (translationUrl) => {
2940
+ if (translationUrl) {
2941
+ try {
2942
+ const response = await fetch(translationUrl);
2943
+ if (!response.ok) {
2944
+ throw new Error(`HTTP error! status: ${response.status}`);
2945
+ }
2946
+ const translations = await response.json();
2947
+ getTranslations$5(translations);
2948
+ }
2949
+ catch (error) {
2950
+ console.error('Failed to fetch or parse translations from URL:', error);
2951
+ }
3036
2952
  }
3037
- return {};
3038
- }
2953
+ };
3039
2954
 
3040
- const lotteryBannerCss = ":host {\n display: block;\n container-type: inline-size;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n letter-spacing: var(--lottery-banner-title-font-letter-spacing, 0.04em);\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-label__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-value__strong {\n font-weight: 700;\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem 1rem);\n }\n .lottery-banner__title {\n flex-basis: 100%;\n text-align: var(--lottery-banner-mobile-title-text-align, left);\n }\n .lottery-banner__info {\n flex-direction: column;\n align-items: flex-start;\n gap: var(--lottery-banner-mobile-info-gap, 0.1rem);\n }\n}";
2955
+ const lotteryBannerCss = ":host {\n display: block;\n container-type: inline-size;\n}\n\n.lottery-banner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--lottery-banner-gap, 0.5rem);\n padding: var(--lottery-banner-padding, 0px 20px);\n background: var(--lottery-banner-background, var(--emw--color-primary, #fed275));\n border-top: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-bottom: var(--lottery-banner-border-width, 2px) var(--lottery-banner-border-style, solid) var(--lottery-banner-border-color, var(--emw--color-primary, #fed275));\n border-left: var(--lottery-banner-border-left, none);\n border-right: var(--lottery-banner-border-right, none);\n border-radius: var(--lottery-banner-border-radius, 0);\n white-space: nowrap;\n height: var(--lottery-banner-height, 50px);\n position: relative;\n box-sizing: border-box;\n}\n\n.lottery-banner__logo-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.lottery-banner__logo-wrapper img {\n height: 100%;\n object-fit: var(--lottery-banner-logo-object-fit, contain);\n}\n\n.lottery-banner__item--center {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.lottery-banner__title {\n text-align: center;\n font-size: var(--lottery-banner-title-font-size, 1.5rem);\n font-weight: 800;\n font-style: italic;\n letter-spacing: var(--lottery-banner-title-font-letter-spacing, 0.04em);\n color: var(--emw--color-typography, #000);\n}\n\n.lottery-banner__info {\n display: flex;\n align-items: center;\n gap: var(--lottery-banner-info-gap, 0.75rem);\n}\n\n.lottery-banner__info-item {\n font-size: var(--lottery-banner-info-font-size, 0.9rem);\n color: var(--lottery-banner-info-color, var(--emw--color-typography, #000));\n display: inline-flex;\n align-items: center;\n gap: 0.3rem;\n}\n\n.lottery-banner__info-item-label {\n color: var(--lottery-banner-info-label-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-label__strong {\n font-weight: var(--lottery-banner-info-label-font-weight, 700);\n}\n\n.lottery-banner__info-item-value {\n font-weight: var(--lottery-banner-info-value-font-weight, inherit);\n color: var(--lottery-banner-info-value-color, var(--emw--color-typography, #000));\n}\n.lottery-banner__info-item-value__strong {\n font-weight: 700;\n}\n\nhelper-count-down::part(values) {\n gap: 8px;\n}\n\n@container (max-width: 700px) {\n .lottery-banner {\n height: auto;\n padding: var(--lottery-banner-mobile-padding, 0.5rem 1rem);\n }\n .lottery-banner__title {\n flex-basis: 100%;\n text-align: var(--lottery-banner-mobile-title-text-align, left);\n }\n .lottery-banner__info {\n flex-direction: column;\n align-items: flex-start;\n gap: var(--lottery-banner-mobile-info-gap, 0.1rem);\n }\n}";
3041
2956
  const LotteryBannerStyle0 = lotteryBannerCss;
3042
2957
 
3043
2958
  const LotteryBanner = class {
3044
2959
  constructor(hostRef) {
3045
2960
  index.registerInstance(this, hostRef);
3046
- this.lotteryBannerTimerStop = index.createEvent(this, "lotteryBannerTimerStop", 7);
2961
+ this.lotteryBannerWagerStarted = index.createEvent(this, "lotteryBannerWagerStarted", 7);
2962
+ this.handleCountdownFinish = () => {
2963
+ this.isWagerStarted = true;
2964
+ this.lotteryBannerWagerStarted.emit();
2965
+ };
3047
2966
  this.mbSource = undefined;
3048
2967
  this.clientStyling = undefined;
3049
2968
  this.clientStylingUrl = undefined;
@@ -3055,7 +2974,8 @@ const LotteryBanner = class {
3055
2974
  this.bannerTitle = undefined;
3056
2975
  this.turnover = undefined;
3057
2976
  this.layout = 'logo,title,info';
3058
- this.formattedTime = undefined;
2977
+ this.isWagerStarted = false;
2978
+ this.formattedStopTime = undefined;
3059
2979
  }
3060
2980
  handleClientStylingChange(newValue, oldValue) {
3061
2981
  if (newValue !== oldValue) {
@@ -3073,29 +2993,23 @@ const LotteryBanner = class {
3073
2993
  }
3074
2994
  }
3075
2995
  handleTimeChange() {
3076
- this.startTimer();
2996
+ this.checkWagerStatus();
3077
2997
  }
3078
2998
  async componentWillLoad() {
3079
2999
  if (this.translationUrl) {
3080
3000
  resolveTranslationUrl$3(this.translationUrl);
3081
3001
  }
3082
- this.startTimer();
3002
+ this.checkWagerStatus();
3083
3003
  }
3084
- startTimer() {
3085
- if (this.timer) {
3086
- clearInterval(this.timer);
3004
+ checkWagerStatus() {
3005
+ if (this.startTime && isBefore(new Date(), parseISO(this.startTime))) {
3006
+ this.isWagerStarted = false;
3087
3007
  }
3088
- this.updateTime();
3089
- this.timer = setInterval(() => {
3090
- this.updateTime();
3091
- }, 1000);
3092
- }
3093
- updateTime() {
3094
- var _a;
3095
- this.formattedTime = getWagerTime(this.startTime, this.stopTime);
3096
- if ((_a = this.formattedTime) === null || _a === void 0 ? void 0 : _a.end) {
3097
- this.timer && clearInterval(this.timer);
3098
- this.lotteryBannerTimerStop.emit();
3008
+ else {
3009
+ this.isWagerStarted = true;
3010
+ }
3011
+ if (this.stopTime) {
3012
+ this.formattedStopTime = format(parseISO(this.stopTime), 'dd/MM/yyyy HH:mm');
3099
3013
  }
3100
3014
  }
3101
3015
  componentDidLoad() {
@@ -3110,10 +3024,8 @@ const LotteryBanner = class {
3110
3024
  }
3111
3025
  disconnectedCallback() {
3112
3026
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
3113
- this.timer && clearInterval(this.timer);
3114
3027
  }
3115
3028
  renderElement(item, className = '') {
3116
- var _a, _b, _c;
3117
3029
  const poolGameLogo = index.getAssetPath('../static/poolGameLogo.webp');
3118
3030
  switch (item) {
3119
3031
  case 'logo':
@@ -3121,14 +3033,14 @@ const LotteryBanner = class {
3121
3033
  case 'title':
3122
3034
  return this.bannerTitle && index.h("div", { class: `lottery-banner__title ${className}` }, this.bannerTitle);
3123
3035
  case 'info':
3124
- return (index.h("div", { class: `lottery-banner__info ${className}` }, ((_a = this.formattedTime) === null || _a === void 0 ? void 0 : _a.start) && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate$5('startIn', this.language)), "\u00A0"), index.h("span", { class: "lottery-banner__info-item-value lottery-banner__info-item-value__strong" }, this.formattedTime.start))), ((_b = this.formattedTime) === null || _b === void 0 ? void 0 : _b.end) && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate$5('stop', this.language)), "\u00A0", translate$5('at', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.formattedTime.end))), ((_c = this.formattedTime) === null || _c === void 0 ? void 0 : _c.end) && this.turnover !== null && this.turnover !== undefined && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, translate$5('turnover', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
3036
+ return (index.h("div", { class: `lottery-banner__info ${className}` }, !this.isWagerStarted ? (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate$5('startIn', this.language)), "\u00A0"), index.h("helper-count-down", { class: "lottery-banner__info-item-value lottery-banner__info-item-value__strong", value: this.startTime, format: "DDD HHH mmM ssS", onCountDownFinish: this.handleCountdownFinish }))) : (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, index.h("span", { class: "lottery-banner__info-item-label__strong" }, translate$5('stop', this.language)), "\u00A0", translate$5('at', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.formattedStopTime))), this.isWagerStarted && this.turnover !== null && this.turnover !== undefined && (index.h("div", { class: "lottery-banner__info-item" }, index.h("span", { class: "lottery-banner__info-item-label" }, translate$5('turnover', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
3125
3037
  default:
3126
3038
  return null;
3127
3039
  }
3128
3040
  }
3129
3041
  render() {
3130
3042
  const layoutItems = this.layout.split(',').map((item) => item.trim());
3131
- return (index.h("section", { key: 'fe2c807504069e45cf9b9f04b754710b49930caf', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
3043
+ return (index.h("section", { key: '3f14279ebff86c47ec5d5d7c4e1054c5899e8580', ref: (el) => (this.stylingContainer = el), class: "lottery-banner" }, layoutItems.map((item, index) => {
3132
3044
  const isMiddle = layoutItems.length === 3 && index === 1;
3133
3045
  const className = isMiddle ? 'lottery-banner__item--center' : '';
3134
3046
  return this.renderElement(item, className);
@@ -11431,6 +11343,7 @@ const DEFAULT_LANGUAGE = 'en';
11431
11343
  const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
11432
11344
  const TRANSLATIONS = {
11433
11345
  en: {
11346
+ gameNotAvailable: 'Sorry. The Game is not available now.',
11434
11347
  stop: 'Stop',
11435
11348
  at: 'at',
11436
11349
  turnover: 'Turnover: ',
@@ -11749,7 +11662,7 @@ async function fetchSaleStatistics({ endpoint, gameId, drawId }) {
11749
11662
  }
11750
11663
  }
11751
11664
 
11752
- const lotteryTippingTicketControllerCss = ".lottery-tipping-ticket-controller__container {\n display: block;\n box-sizing: border-box;\n font-size: 14px;\n container-type: inline-size;\n background: var(--emw--color-background, #fff);\n}\n@container (max-width: 375px) {\n .lottery-tipping-ticket-controller__container {\n font-size: 12px;\n }\n}\n\n.LotteryTippingTicketController__top {\n padding: 1.8rem;\n display: flex;\n flex-direction: column;\n gap: 2rem;\n margin: 0 auto;\n max-width: 800px;\n}\n.LotteryTippingTicketController__row {\n display: flex;\n align-items: center;\n gap: 1rem;\n justify-content: space-between;\n flex-wrap: wrap;\n}\n.LotteryTippingTicketController__section {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.LotteryTippingTicketController__label {\n font-weight: 500;\n white-space: nowrap;\n width: 6rem;\n color: var(--emw--color-typography-secondary, #333);\n}\n.LotteryTippingTicketController__segmented-control {\n height: 2.2rem;\n display: inline-flex;\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n border-radius: 2rem;\n padding: 0.2rem;\n}\n.LotteryTippingTicketController__segment {\n background-color: transparent;\n border: none;\n padding: 0.3rem 0.8rem;\n cursor: pointer;\n font-weight: 500;\n border-radius: 2rem;\n outline: none;\n transition: background-color 0.25s ease, color 0.25s ease;\n white-space: nowrap;\n color: var(--emw--color-typography, #000);\n}\n.LotteryTippingTicketController__segment--active {\n background-color: var(--emw--color-background, #ffffff);\n color: var(--emw--color-typography, #000);\n font-weight: 600;\n}\n.LotteryTippingTicketController__segment--disabled:hover {\n cursor: not-allowed !important;\n}\n.LotteryTippingTicketController__segment:not(.LotteryTippingTicketController__segment--active):hover {\n background-color: var(--emw--color-background-tertiary, #ccc);\n}\n\n.flex {\n display: flex;\n}\n\n.flex-wrap {\n flex-wrap: wrap;\n}\n\n.align-center {\n align-items: center;\n}\n\n.gap-1 {\n gap: 4px;\n}\n\n.LotteryTippingTicketController__main {\n align-items: flex-start;\n justify-content: center;\n gap: 2rem;\n max-width: 1200px;\n margin: 0 auto;\n padding: 0 20px;\n flex-wrap: wrap;\n}\n.LotteryTippingTicketController__main--left {\n border: 1px solid var(--emw--color-gray-50, #f5f5f5);\n padding: 1rem;\n border-radius: 1rem;\n flex: 1.5;\n}\n.LotteryTippingTicketController__main--right {\n padding: 1rem;\n border-radius: 1rem;\n flex: 1;\n}\n\n.order-summary {\n max-width: 360px;\n width: 100%;\n background: var(--emw--color-background, #fff);\n}\n\n.order-summary__title {\n margin-bottom: 16px;\n text-align: center;\n color: var(--emw--color-typography, #000);\n text-transform: uppercase;\n}\n\n.order-summary__ticket-info {\n display: flex;\n align-items: center;\n margin-bottom: 16px;\n gap: 10px;\n color: var(--emw--color-typography, #000);\n}\n\n.order-summary__ticket {\n font-weight: 500;\n width: 50px;\n text-align: right;\n color: var(--emw--color-typography, #000);\n}\n\n.order-summary__details {\n display: flex;\n align-items: center;\n color: var(--emw--color-typography, #000);\n}\n\n.order-summary__multiplier {\n color: var(--emw--color-typography-secondary, #333);\n margin: 0 8px;\n}\n\n.order-summary__divider {\n border: none;\n border-top: 1px solid var(--emw--color-gray-100, #e6e6e6);\n margin: 20px 0;\n}\n\n.order-summary__button-wrapper {\n display: flex;\n justify-content: center;\n}\n\n.order-summary__button {\n cursor: pointer;\n padding: 0.8rem 4rem;\n background: var(--emw--color-primary, #fed275);\n color: var(--emw--color-typography, #000);\n border-radius: var(--emw--button-border-radius, 4px);\n border: none;\n position: relative;\n}\n\n.loading-icon {\n position: absolute;\n right: 40px;\n top: 10px;\n}\n\n.order-summary__button:not(.order-summary__button--disabled):not(.order-summary__button--loading):hover {\n transform: translateY(-1px);\n background: var(--emw--color-primary-variant, #ffe66f);\n}\n\n.order-summary__button--loading {\n background: var(--emw--color-primary-variant, #ffe66f);\n cursor: not-allowed;\n}\n\n.order-summary__button--disabled {\n background: var(--emw--color-background-secondary, #f5f5f5);\n color: var(--emw--color-typography, #000);\n cursor: not-allowed;\n}\n\n.skeleton-content {\n display: flex;\n flex-direction: column;\n gap: 29px;\n align-items: center;\n}\n\n.skeleton-item {\n background: var(--emw--color-background-secondary, #f5f5f5);\n border-radius: 4px;\n height: 40px;\n width: 200px;\n}\n\n.skeleton-animated {\n animation: skeleton-shimmer 1.5s infinite linear;\n background: linear-gradient(90deg, var(--emw--color-background-secondary, #f5f5f5) 25%, var(--emw--color-background-tertiary, #ccc) 37%, var(--emw--color-background-secondary, #f5f5f5) 63%);\n background-size: 200% 100%;\n}\n\n@keyframes skeleton-shimmer {\n to {\n background-position: 100% 0;\n }\n}\n.loading-icon.scale {\n animation: scale 1s infinite ease-in-out;\n}\n\n@keyframes scale {\n 0%, 100% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.2);\n }\n}";
11665
+ const lotteryTippingTicketControllerCss = ".lottery-tipping-ticket-controller__container {\n display: block;\n box-sizing: border-box;\n font-size: 14px;\n container-type: inline-size;\n background: var(--emw--color-background, #fff);\n}\n@container (max-width: 375px) {\n .lottery-tipping-ticket-controller__container {\n font-size: 12px;\n }\n}\n\n.LotteryTippingTicketController__top {\n padding: 1.8rem;\n display: flex;\n flex-direction: column;\n gap: 2rem;\n margin: 0 auto;\n max-width: 800px;\n}\n.LotteryTippingTicketController__row {\n display: flex;\n align-items: center;\n gap: 1rem;\n justify-content: space-between;\n flex-wrap: wrap;\n}\n.LotteryTippingTicketController__section {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.LotteryTippingTicketController__label {\n font-weight: 500;\n white-space: nowrap;\n width: 6rem;\n color: var(--emw--color-typography-secondary, #333);\n}\n.LotteryTippingTicketController__segmented-control {\n height: 2.2rem;\n display: inline-flex;\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n border-radius: 2rem;\n padding: 0.2rem;\n}\n.LotteryTippingTicketController__segment {\n background-color: transparent;\n border: none;\n padding: 0.3rem 0.8rem;\n cursor: pointer;\n font-weight: 500;\n border-radius: 2rem;\n outline: none;\n transition: background-color 0.25s ease, color 0.25s ease;\n white-space: nowrap;\n color: var(--emw--color-typography, #000);\n}\n.LotteryTippingTicketController__segment--active {\n background-color: var(--emw--color-background, #ffffff);\n color: var(--emw--color-typography, #000);\n font-weight: 600;\n}\n.LotteryTippingTicketController__segment--disabled:hover {\n cursor: not-allowed !important;\n}\n.LotteryTippingTicketController__segment:not(.LotteryTippingTicketController__segment--active):hover {\n background-color: var(--emw--color-background-tertiary, #ccc);\n}\n\n.flex {\n display: flex;\n}\n\n.flex-wrap {\n flex-wrap: wrap;\n}\n\n.align-center {\n align-items: center;\n}\n\n.gap-1 {\n gap: 4px;\n}\n\n.LotteryTippingTicketController__main {\n align-items: flex-start;\n justify-content: center;\n gap: 2rem;\n max-width: 1200px;\n margin: 0 auto;\n padding: 0 20px;\n flex-wrap: wrap;\n}\n.LotteryTippingTicketController__main--left {\n border: 1px solid var(--emw--color-gray-50, #f5f5f5);\n padding: 1rem;\n border-radius: 1rem;\n flex: 1.5;\n}\n.LotteryTippingTicketController__main--right {\n padding: 1rem;\n border-radius: 1rem;\n flex: 1;\n}\n\n.order-summary {\n max-width: 360px;\n width: 100%;\n background: var(--emw--color-background, #fff);\n}\n\n.order-summary__title {\n margin-bottom: 16px;\n text-align: center;\n color: var(--emw--color-typography, #000);\n text-transform: uppercase;\n}\n\n.order-summary__ticket-info {\n display: flex;\n align-items: center;\n margin-bottom: 16px;\n gap: 10px;\n color: var(--emw--color-typography, #000);\n}\n\n.order-summary__ticket {\n font-weight: 500;\n width: 50px;\n text-align: right;\n color: var(--emw--color-typography, #000);\n}\n\n.order-summary__details {\n display: flex;\n align-items: center;\n color: var(--emw--color-typography, #000);\n}\n\n.order-summary__multiplier {\n color: var(--emw--color-typography-secondary, #333);\n margin: 0 8px;\n}\n\n.order-summary__divider {\n border: none;\n border-top: 1px solid var(--emw--color-gray-100, #e6e6e6);\n margin: 20px 0;\n}\n\n.order-summary__button-wrapper {\n display: flex;\n justify-content: center;\n}\n\n.order-summary__button {\n cursor: pointer;\n padding: 0.8rem 4rem;\n background: var(--emw--color-primary, #fed275);\n color: var(--emw--color-typography, #000);\n border-radius: var(--emw--button-border-radius, 4px);\n border: none;\n position: relative;\n}\n\n.loading-icon {\n position: absolute;\n right: 40px;\n top: 10px;\n}\n\n.order-summary__button:not(.order-summary__button--disabled):not(.order-summary__button--loading):hover {\n transform: translateY(-1px);\n background: var(--emw--color-primary-variant, #ffe66f);\n}\n\n.order-summary__button--loading {\n background: var(--emw--color-primary-variant, #ffe66f);\n cursor: not-allowed;\n}\n\n.order-summary__button--disabled {\n background: var(--emw--color-background-secondary, #f5f5f5);\n color: var(--emw--color-typography, #000);\n cursor: not-allowed;\n}\n\n.skeleton-content {\n display: flex;\n flex-direction: column;\n gap: 29px;\n align-items: center;\n}\n\n.skeleton-item {\n background: var(--emw--color-background-secondary, #f5f5f5);\n border-radius: 4px;\n height: 40px;\n width: 200px;\n}\n\n.skeleton-animated {\n animation: skeleton-shimmer 1.5s infinite linear;\n background: linear-gradient(90deg, var(--emw--color-background-secondary, #f5f5f5) 25%, var(--emw--color-background-tertiary, #ccc) 37%, var(--emw--color-background-secondary, #f5f5f5) 63%);\n background-size: 200% 100%;\n}\n\n@keyframes skeleton-shimmer {\n to {\n background-position: 100% 0;\n }\n}\n.loading-icon.scale {\n animation: scale 1s infinite ease-in-out;\n}\n\n@keyframes scale {\n 0%, 100% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.2);\n }\n}\n.noActiveDraw {\n margin: 30% auto 0px;\n padding: 24px;\n border: 2px solid var(--emw--color-primary, #fed275);\n border-radius: 4px;\n width: 280px;\n color: var(--emw--color-typography, #000);\n}";
11753
11666
  const LotteryTippingTicketControllerStyle0 = lotteryTippingTicketControllerCss;
11754
11667
 
11755
11668
  const LotteryTippingTicketController = class {
@@ -11778,12 +11691,14 @@ const LotteryTippingTicketController = class {
11778
11691
  this.hasSelectBullet = undefined;
11779
11692
  this.hasSelectAllBullet = undefined;
11780
11693
  this.totalLineCombination = 0;
11781
- this.submitLoading = undefined;
11694
+ this.submitLoading = false;
11695
+ this.isSalesActive = false;
11782
11696
  this.drawSubmitAvailable = false;
11783
11697
  this.rawData = {};
11784
11698
  this.saleStatisticsInfo = {};
11785
11699
  this.currentStake = undefined;
11786
11700
  this.dialogConfig = { visible: false };
11701
+ this.gameUnavailable = false;
11787
11702
  }
11788
11703
  async getLotteryTippingBulletResults() {
11789
11704
  return await this.childRef.getData();
@@ -11950,9 +11865,6 @@ const LotteryTippingTicketController = class {
11950
11865
  lotteryTippingPage.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
11951
11866
  }
11952
11867
  }
11953
- handleTimerStop() {
11954
- this.drawSubmitAvailable = true;
11955
- }
11956
11868
  componentWillLoad() {
11957
11869
  if (this.translationUrl) {
11958
11870
  resolveTranslationUrl(this.translationUrl);
@@ -11971,6 +11883,33 @@ const LotteryTippingTicketController = class {
11971
11883
  disconnectedCallback() {
11972
11884
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
11973
11885
  }
11886
+ updateDrawSalesStatus() {
11887
+ var _a;
11888
+ const currentDraw = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.currentDraw;
11889
+ if (!currentDraw) {
11890
+ this.gameUnavailable = true;
11891
+ this.isSalesActive = false;
11892
+ return;
11893
+ }
11894
+ const now = new Date();
11895
+ const wagerStartTime = currentDraw.wagerStartTime ? parseISO(currentDraw.wagerStartTime) : null;
11896
+ const wagerCloseTime = currentDraw.wagerCloseTime ? parseISO(currentDraw.wagerCloseTime) : null;
11897
+ // Rule 1: If the current time < the opening - sale time → display "Start in" countDown and disable the button.
11898
+ if (wagerStartTime && isBefore(now, wagerStartTime)) {
11899
+ this.isSalesActive = false;
11900
+ this.gameUnavailable = false;
11901
+ }
11902
+ // Rule 2: If the opening-sale time < the current time < the closing time → display "Stop at xx time" to remind the player.
11903
+ else if (wagerStartTime && wagerCloseTime && isAfter(now, wagerStartTime) && isBefore(now, wagerCloseTime)) {
11904
+ this.isSalesActive = true;
11905
+ this.gameUnavailable = false;
11906
+ }
11907
+ // Rule 3: If the current time > the closing time → the game is unavailable.
11908
+ else {
11909
+ this.gameUnavailable = true;
11910
+ this.isSalesActive = false;
11911
+ }
11912
+ }
11974
11913
  connectedCallback() {
11975
11914
  const fetchData = () => {
11976
11915
  let url = new URL(`${this.endpoint}/games/${this.gameId}`);
@@ -11991,6 +11930,7 @@ const LotteryTippingTicketController = class {
11991
11930
  });
11992
11931
  this.handleBettingTypeChange(bettingType);
11993
11932
  this.selectedPlayingMode = playMode;
11933
+ this.updateDrawSalesStatus();
11994
11934
  return this.updateSaleStatistics();
11995
11935
  })
11996
11936
  .catch((err) => {
@@ -12013,6 +11953,14 @@ const LotteryTippingTicketController = class {
12013
11953
  });
12014
11954
  }
12015
11955
  async handleSubmit() {
11956
+ this.updateDrawSalesStatus();
11957
+ if (!this.isSalesActive) {
11958
+ showNotification({
11959
+ message: 'Sales for this period have closed.',
11960
+ theme: 'error'
11961
+ });
11962
+ return;
11963
+ }
12016
11964
  const rawResults = await this.getLotteryTippingBulletResults();
12017
11965
  const { betTypeId, betType } = getPlayTypeConfig({
12018
11966
  rawData: this.rawData,
@@ -12078,11 +12026,14 @@ const LotteryTippingTicketController = class {
12078
12026
  return (index.h("div", { class: "LotteryTippingTicketController__main--right order-summary" }, index.h("h3", { class: "order-summary__title" }, translate('orderSummaryTitle', this.language)), index.h("div", { class: "order-summary__ticket-info" }, index.h("div", { class: "order-summary__ticket" }, translate('orderSummaryTickets', this.language), ":"), index.h("div", { class: "order-summary__details" }, index.h("span", { class: "order-summary__line-count" }, this.lineCountRender), index.h("div", null, this.currentStake && index.h("span", { class: "order-summary__multiplier" }, "x"), index.h("span", { class: "order-summary__stake" }, this.currentStakeFormatted)), this.isBothBettingType && (index.h("div", null, index.h("span", { class: "order-summary__multiplier" }, "x"), index.h("span", { class: "order-summary__stake" }, this.bothBettingTypeMultiplier))))), index.h("hr", { class: "order-summary__divider" }), index.h("div", { class: "order-summary__ticket-info" }, index.h("div", { class: "order-summary__ticket" }, translate('orderSummaryTotal', this.language), ":"), index.h("span", { class: "order-summary__details" }, this.totalAmountFormatted)), index.h("div", { class: "order-summary__button-wrapper" }, index.h("lottery-button", { onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: !this.hasSelectAllBullet ||
12079
12027
  this.submitLoading ||
12080
12028
  ((_a = this.currentStake) === null || _a === void 0 ? void 0 : _a.value) === undefined ||
12081
- !this.drawSubmitAvailable, text: translate('orderSummarySubmit', this.language) }))));
12029
+ !this.isSalesActive, text: translate('orderSummarySubmit', this.language) }))));
12082
12030
  }
12083
12031
  render() {
12084
12032
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
12085
- return (index.h("div", { key: '8f520b33fe0b935feb26e39baa840457ccc357df', class: "lottery-tipping-ticket-controller__container", ref: (el) => (this.stylingContainer = el) }, index.h("lottery-banner", { key: '10ddfb775cfe7c8f2c980414302123309a7ad7d1', "client-styling": this.clientStyling, "client-styling-Url": this.clientStylingUrl, stopTime: (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.currentDraw) === null || _b === void 0 ? void 0 : _b.wagerCloseTime, startTime: (_d = (_c = this.rawData) === null || _c === void 0 ? void 0 : _c.currentDraw) === null || _d === void 0 ? void 0 : _d.wagerStartTime, "banner-title": formattedWeekName((_f = (_e = this.rawData) === null || _e === void 0 ? void 0 : _e.currentDraw) === null || _f === void 0 ? void 0 : _f.date), turnover: formattedTurnover((_h = (_g = this.saleStatisticsInfo) === null || _g === void 0 ? void 0 : _g.wagerSegment) === null || _h === void 0 ? void 0 : _h.totalSalesCrossDraw), language: this.language, "translation-url": this.translationUrl, onLotteryBannerTimerStop: this.handleTimerStop.bind(this) }), this.renderBettingControls(), index.h("div", { key: 'add963c6aaa5f852f589fc1b20b31882d62ca8db', class: "flex flex-wrap LotteryTippingTicketController__main" }, index.h("div", { key: '55c990ea441ca3b2192c3dbaa328dd31046b6d9c', class: "LotteryTippingTicketController__main--left" }, index.h("lottery-tipping-ticket-bet", { key: '7511cd997bfef3688e60afd207c109bfe20637cd', ref: (el) => (this.childRef = el), endpoint: this.endpoint, "session-id": this.sessionId, "game-id": (_j = this.rawData) === null || _j === void 0 ? void 0 : _j.type, "draw-id": this.drawId, language: this.language, "translation-url": this.translationUrl, "max-total-pages": this.lineNumberRange.maxLineNumber, "min-total-pages": this.lineNumberRange.minLineNumber, "total-pages": this.lineNumberRange.defaultBoards, mode: this.selectedPlayingMode === PlayModeEnum.SingleBet ? 'single' : 'multi', "client-styling": this.clientStyling, "client-styling-Url": this.clientStylingUrl })), this.renderOrderSummary()), this.dialogConfig.visible && (index.h("vaadin-confirm-dialog", { key: 'dfc1353806484dc8614d19737f922113a18099af', rejectButtonVisible: true, rejectText: translate('cancel', this.language), confirmText: translate('confirm', this.language), opened: (_k = this.dialogConfig) === null || _k === void 0 ? void 0 : _k.visible, onConfirm: this.dialogConfig.onConfirm, onReject: this.dialogConfig.onCancel }, (_l = this.dialogConfig) === null || _l === void 0 ? void 0 : _l.content))));
12033
+ if (this.gameUnavailable) {
12034
+ return (index.h("div", { class: "lottery-tipping-ticket-controller__container", ref: (el) => (this.stylingContainer = el) }, index.h("div", { class: "noActiveDraw" }, translate('gameNotAvailable', this.language))));
12035
+ }
12036
+ return (index.h("div", { class: "lottery-tipping-ticket-controller__container", ref: (el) => (this.stylingContainer = el) }, index.h("lottery-banner", { "client-styling": this.clientStyling, "client-styling-Url": this.clientStylingUrl, stopTime: (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.currentDraw) === null || _b === void 0 ? void 0 : _b.wagerCloseTime, startTime: (_d = (_c = this.rawData) === null || _c === void 0 ? void 0 : _c.currentDraw) === null || _d === void 0 ? void 0 : _d.wagerStartTime, "banner-title": formattedWeekName((_f = (_e = this.rawData) === null || _e === void 0 ? void 0 : _e.currentDraw) === null || _f === void 0 ? void 0 : _f.date), turnover: formattedTurnover((_h = (_g = this.saleStatisticsInfo) === null || _g === void 0 ? void 0 : _g.wagerSegment) === null || _h === void 0 ? void 0 : _h.totalSalesCrossDraw), language: this.language, onLotteryBannerWagerStarted: () => this.updateDrawSalesStatus(), "translation-url": this.translationUrl }), this.renderBettingControls(), index.h("div", { class: "flex flex-wrap LotteryTippingTicketController__main" }, index.h("div", { class: "LotteryTippingTicketController__main--left" }, index.h("lottery-tipping-ticket-bet", { ref: (el) => (this.childRef = el), endpoint: this.endpoint, "session-id": this.sessionId, "game-id": (_j = this.rawData) === null || _j === void 0 ? void 0 : _j.type, "draw-id": this.drawId, language: this.language, "translation-url": this.translationUrl, "max-total-pages": this.lineNumberRange.maxLineNumber, "min-total-pages": this.lineNumberRange.minLineNumber, "total-pages": this.lineNumberRange.defaultBoards, mode: this.selectedPlayingMode === PlayModeEnum.SingleBet ? 'single' : 'multi', "client-styling": this.clientStyling, "client-styling-Url": this.clientStylingUrl })), this.renderOrderSummary()), this.dialogConfig.visible && (index.h("vaadin-confirm-dialog", { rejectButtonVisible: true, rejectText: translate('cancel', this.language), confirmText: translate('confirm', this.language), opened: (_k = this.dialogConfig) === null || _k === void 0 ? void 0 : _k.visible, onConfirm: this.dialogConfig.onConfirm, onReject: this.dialogConfig.onCancel }, (_l = this.dialogConfig) === null || _l === void 0 ? void 0 : _l.content))));
12086
12037
  }
12087
12038
  static get assetsDirs() { return ["../static"]; }
12088
12039
  static get watchers() { return {
@@ -17420,6 +17371,7 @@ LotteryTippingTicketHistory.style = LotteryTippingTicketHistoryStyle0;
17420
17371
  exports.lottery_tipping_page = lotteryTippingPage.LotteryTippingPage;
17421
17372
  exports.general_multi_select = GeneralMultiSelect;
17422
17373
  exports.general_tooltip = GeneralTooltip;
17374
+ exports.helper_count_down = HelperCountDown;
17423
17375
  exports.lottery_banner = LotteryBanner;
17424
17376
  exports.lottery_button = LotteryButton;
17425
17377
  exports.lottery_tipping_bullet = LotteryTippingBullet;