@everymatrix/lottery-tipping-entrance 1.94.62 → 1.94.63

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.
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-2a5f420f.js');
6
- const lotteryTippingEntrance = require('./lottery-tipping-entrance-d0c92753.js');
5
+ const index = require('./index-cfe49ce0.js');
6
+ const lotteryTippingEntrance = require('./lottery-tipping-entrance-5d99622f.js');
7
7
 
8
8
  /**
9
9
  * @name addDays
@@ -115,6 +115,40 @@ function isBefore(dirtyDate, dirtyDateToCompare) {
115
115
  return date.getTime() < dateToCompare.getTime();
116
116
  }
117
117
 
118
+ const tooltipCss = ":host{display:inline-flex;position:relative}.tooltip-wrapper{position:relative;display:inline-flex}.tooltip-content-wrapper{position:absolute;z-index:10;bottom:125%;left:50%;transform:translateX(-50%);opacity:0;visibility:hidden;transition:opacity 0.2s, visibility 0.2s}.tooltip-content-wrapper.visible{opacity:1;visibility:visible}.tooltip-content{background-color:var(--emw--tooltip-background-color, #000);color:var(--emw--tooltip-text-color, #fff);border-radius:4px;box-shadow:0 2px 8px rgba(0, 0, 0, 0.15);white-space:nowrap;padding:4px}";
119
+ const AppTooltipStyle0 = tooltipCss;
120
+
121
+ const Tooltip = class {
122
+ constructor(hostRef) {
123
+ index.registerInstance(this, hostRef);
124
+ this.show = () => (this.visible = true);
125
+ this.hide = () => (this.visible = false);
126
+ this.visible = false;
127
+ }
128
+ componentDidLoad() {
129
+ this.trigger = this.host.querySelector('[slot="trigger"]');
130
+ if (this.trigger) {
131
+ this.trigger.addEventListener('mouseenter', this.show);
132
+ this.trigger.addEventListener('mouseleave', this.hide);
133
+ this.trigger.addEventListener('focus', this.show);
134
+ this.trigger.addEventListener('blur', this.hide);
135
+ }
136
+ }
137
+ disconnectedCallback() {
138
+ if (this.trigger) {
139
+ this.trigger.removeEventListener('mouseenter', this.show);
140
+ this.trigger.removeEventListener('mouseleave', this.hide);
141
+ this.trigger.removeEventListener('focus', this.show);
142
+ this.trigger.removeEventListener('blur', this.hide);
143
+ }
144
+ }
145
+ render() {
146
+ return (index.h("div", { key: 'e56695ac60fcd7903127179423e9954ef40f05c0', class: "tooltip-wrapper" }, index.h("slot", { key: '4e2472a395ceeb2b911692739d326c031df07e29', name: "trigger" }), index.h("div", { key: 'f77bd72da94eb17d12e42ebb86c395c55801b728', class: { 'tooltip-content-wrapper': true, visible: this.visible } }, index.h("div", { key: '988399e2b42988622d46eaf255f17c6221eb9697', class: "tooltip-content" }, index.h("slot", { key: '05de0572ab1331d965e61947c5c15775e225197a', name: "content" })))));
147
+ }
148
+ get host() { return index.getElement(this); }
149
+ };
150
+ Tooltip.style = AppTooltipStyle0;
151
+
118
152
  const infoImage = `<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg height="1024" node-id="1" sillyvg="true" template-height="1024" template-width="1024" version="1.1" viewBox="0 0 1024 1024" width="1024" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs node-id="52"></defs><g node-id="165"><g node-id="176"><path d="M 715.70 689.10 L 724.50 691.70 L 724.10 693.20 L 715.20 690.50 L 715.70 689.10 Z M 733.50 693.80 L 742.60 695.40 L 742.40 696.90 L 733.20 695.30 L 733.50 693.80 Z M 751.70 696.50 L 760.90 697.00 L 760.90 698.60 L 751.60 698.10 L 751.70 696.50 Z M 901.10 462.70 L 902.50 461.90 L 906.90 470.10 L 905.50 470.80 L 901.10 462.70 Z M 770.10 697.00 L 779.30 696.40 L 779.40 698.00 L 770.10 698.60 L 770.10 697.00 Z M 909.30 479.20 L 910.70 478.60 L 914.10 487.30 L 912.60 487.80 L 909.30 479.20 Z M 788.40 695.30 L 797.50 693.70 L 797.80 695.20 L 788.60 696.80 L 788.40 695.30 Z M 915.50 496.50 L 917.00 496.10 L 918.30 500.60 L 919.30 505.10 L 917.80 505.40 L 915.50 496.50 Z M 806.40 691.50 L 815.20 688.80 L 815.70 690.30 L 806.80 693.00 L 806.40 691.50 Z M 919.60 514.50 L 921.10 514.20 L 922.40 523.40 L 920.80 523.60 L 919.60 514.50 Z M 823.90 685.60 L 832.30 681.90 L 833.00 683.30 L 824.50 687.00 L 823.90 685.60 Z M 921.50 532.80 L 923.10 532.70 L 923.30 542.00 L 921.70 542.00 L 921.50 532.80 Z M 840.50 677.70 L 848.40 673.00 L 849.20 674.30 L 841.20 679.00 L 840.50 677.70 Z M 921.30 551.20 L 922.90 551.30 L 922.00 560.60 L 920.40 560.40 L 921.30 551.20 Z M 856.10 667.90 L 863.40 662.30 L 864.40 663.50 L 857.00 669.10 L 856.10 667.90 Z M 919.00 569.50 L 920.50 569.80 L 918.50 578.90 L 917.00 578.50 L 919.00 569.50 Z M 870.40 656.30 L 877.00 649.90 L 878.10 651.00 L 871.40 657.50 L 870.40 656.30 Z M 914.60 587.30 L 916.10 587.80 L 913.10 596.60 L 911.60 596.00 L 914.60 587.30 Z M 883.30 643.20 L 889.10 636.10 L 890.30 637.10 L 884.40 644.30 L 883.30 643.20 Z M 908.00 604.50 L 909.40 605.10 L 905.40 613.50 L 904.00 612.80 L 908.00 604.50 Z M 894.60 628.60 L 899.60 620.80 L 900.90 621.60 L 895.90 629.40 L 894.60 628.60 Z" fill="#777f99" fill-rule="nonzero" group-id="1,12" node-id="60" stroke="none" target-height="236.69998" target-width="208.09998" target-x="715.2" target-y="461.9"></path></g><path d="M 702.70 684.10 L 707.00 685.90 L 706.40 687.40 L 702.00 685.60 L 702.70 684.10 Z" fill="#777f99" fill-rule="nonzero" group-id="1,13" node-id="65" stroke="none" target-height="3.3000488" target-width="5" target-x="702" target-y="684.1"></path></g><g node-id="166"><g node-id="178"><path d="M 198.90 515.60 L 196.00 511.80 L 197.30 510.90 L 200.10 514.60 L 198.90 515.60 Z" fill="#777f99" fill-rule="nonzero" group-id="2,14" node-id="73" stroke="none" target-height="4.6999817" target-width="4.100006" target-x="196" target-y="510.9"></path></g><g node-id="179"><path d="M 190.90 503.80 L 186.80 495.20 L 188.30 494.60 L 192.30 503.00 L 190.90 503.80 Z M 183.90 486.20 L 182.10 476.90 L 183.60 476.70 L 185.40 485.80 L 183.90 486.20 Z M 181.30 467.50 L 181.80 458.00 L 183.40 458.20 L 182.90 467.50 L 181.30 467.50 Z M 183.40 448.70 L 186.20 439.60 L 187.70 440.10 L 185.00 449.00 L 183.40 448.70 Z M 190.00 430.90 L 194.90 422.70 L 196.20 423.60 L 191.40 431.60 L 190.00 430.90 Z M 202.00 416.40 L 200.80 415.40 L 207.50 408.70 L 208.50 409.90 L 202.00 416.40 Z M 215.90 404.10 L 215.00 402.80 L 219.00 400.20 L 223.10 397.90 L 223.80 399.30 L 215.90 404.10 Z M 232.40 395.60 L 231.90 394.10 L 236.40 392.60 L 241.00 391.40 L 241.40 392.90 L 232.40 395.60 Z M 250.40 391.40 L 250.20 389.80 L 254.90 389.50 L 259.70 389.40 L 259.70 391.00 L 250.40 391.40 Z M 269.00 391.70 L 269.20 390.20 L 273.80 391.00 L 278.50 392.10 L 278.10 393.60 L 269.00 391.70 Z" fill="#777f99" fill-rule="nonzero" group-id="2,15" node-id="78" stroke="none" target-height="114.399994" target-width="97.2" target-x="181.3" target-y="389.4"></path></g><path d="M 286.90 396.50 L 287.50 395.10 L 291.80 397.00 L 291.10 398.40 L 286.90 396.50 Z" fill="#777f99" fill-rule="nonzero" group-id="2,16" node-id="83" stroke="none" target-height="3.2999878" target-width="4.899994" target-x="286.9" target-y="395.1"></path></g><g node-id="167"><path d="M 308.80 594.00 L 679.00 594.00 L 685.10 593.20 L 688.00 592.20 L 693.30 589.20 L 695.70 587.10 L 697.70 584.80 L 700.80 579.50 L 702.40 573.50 L 702.60 570.40 L 702.60 422.00 L 702.30 411.60 L 701.60 401.40 L 700.40 391.30 L 698.70 381.50 L 696.50 371.80 L 693.90 362.20 L 690.90 352.80 L 687.40 343.70 L 683.50 334.80 L 679.30 326.00 L 674.60 317.50 L 669.50 309.30 L 664.10 301.30 L 658.40 293.60 L 652.30 286.10 L 645.80 279.00 L 639.10 272.10 L 632.00 265.60 L 624.70 259.40 L 617.00 253.50 L 609.10 248.00 L 601.00 242.90 L 592.50 238.10 L 583.90 233.70 L 574.90 229.70 L 565.90 226.10 L 556.60 223.00 L 547.10 220.20 L 537.40 218.00 L 527.50 216.10 L 528.80 211.90 L 529.60 207.60 L 529.90 203.20 L 529.60 198.40 L 528.70 193.90 L 527.20 189.50 L 525.10 185.30 L 522.60 181.50 L 519.60 178.00 L 516.10 174.90 L 512.30 172.30 L 508.00 170.10 L 503.50 168.50 L 498.90 167.60 L 494.30 167.30 L 489.60 167.50 L 485.10 168.30 L 480.70 169.70 L 476.50 171.70 L 472.60 174.20 L 468.90 177.30 L 465.70 180.90 L 463.00 184.70 L 460.90 188.80 L 459.30 193.20 L 458.30 197.60 L 457.90 202.30 L 458.10 206.90 L 458.90 211.50 L 460.30 216.10 L 450.40 218.00 L 440.70 220.30 L 431.20 223.00 L 421.90 226.20 L 412.90 229.70 L 403.90 233.80 L 395.30 238.20 L 386.80 242.90 L 378.70 248.10 L 370.80 253.60 L 363.10 259.50 L 355.80 265.70 L 348.70 272.20 L 342.00 279.00 L 335.50 286.20 L 329.40 293.70 L 323.60 301.40 L 318.30 309.30 L 313.20 317.60 L 308.50 326.10 L 304.30 334.80 L 300.40 343.70 L 296.90 352.90 L 293.90 362.20 L 291.30 371.90 L 289.10 381.50 L 287.40 391.40 L 286.20 401.40 L 285.50 411.60 L 285.20 422.00 L 285.20 570.40 L 285.40 573.60 L 286.00 576.70 L 287.10 579.60 L 288.40 582.30 L 292.10 587.10 L 296.90 590.80 L 299.60 592.10 L 302.50 593.20 L 305.60 593.80 L 308.80 594.00 Z" fill="#bad6f7" fill-rule="nonzero" group-id="3" node-id="89" stroke="none" target-height="426.7" target-width="417.39996" target-x="285.2" target-y="167.3"></path></g><g node-id="168"><path d="M 493.80 798.40 L 503.30 797.60 L 512.20 795.40 L 517.80 793.20 L 523.20 790.40 L 528.20 787.20 L 532.80 783.40 L 537.00 779.20 L 540.80 774.60 L 544.00 769.60 L 546.80 764.20 L 549.00 758.60 L 550.30 754.20 L 551.80 745.00 L 552.00 740.20 L 435.60 740.20 L 435.80 745.30 L 436.50 750.30 L 437.60 755.30 L 439.10 760.10 L 441.00 764.80 L 443.30 769.30 L 446.10 773.50 L 449.10 777.60 L 452.60 781.40 L 456.40 784.90 L 460.40 788.00 L 464.70 790.70 L 469.20 793.00 L 473.90 794.90 L 478.70 796.40 L 483.60 797.50 L 488.70 798.20 L 493.80 798.40 Z" fill="#3a3a77" fill-rule="nonzero" group-id="4" node-id="94" stroke="none" target-height="58.200012" target-width="116.399994" target-x="435.6" target-y="740.2"></path></g><path d="M 782.90 675.10 L 770.80 651.00 L 767.90 645.70 L 764.50 640.80 L 760.60 636.00 L 756.30 631.60 L 751.80 627.60 L 747.10 624.00 L 742.00 620.80 L 737.00 618.20 L 731.90 616.10 L 726.70 614.50 L 721.70 613.50 L 716.80 613.20 L 270.90 613.20 L 266.00 613.50 L 261.00 614.50 L 255.80 616.10 L 250.70 618.20 L 245.70 620.80 L 240.60 624.00 L 235.90 627.60 L 231.40 631.60 L 227.10 636.00 L 223.20 640.70 L 219.80 645.70 L 216.90 651.00 L 204.80 675.10 L 202.60 680.00 L 200.90 684.70 L 199.80 689.10 L 199.10 693.30 L 198.80 697.60 L 199.00 701.60 L 199.60 705.20 L 200.60 708.50 L 202.10 711.70 L 203.90 714.50 L 206.20 716.90 L 208.90 719.00 L 211.90 720.60 L 215.30 721.80 L 219.10 722.60 L 223.60 722.90 L 764.20 722.90 L 768.60 722.60 L 772.50 721.80 L 775.90 720.60 L 778.80 719.00 L 781.50 716.90 L 783.80 714.40 L 785.70 711.70 L 787.20 708.50 L 788.20 705.20 L 788.80 701.50 L 789.00 697.60 L 788.70 693.30 L 788.00 689.10 L 786.80 684.70 L 785.10 680.00 L 782.90 675.10 Z" fill="#bad6f7" fill-rule="nonzero" node-id="97" stroke="none" target-height="109.70001" target-width="590.2" target-x="198.8" target-y="613.2"></path><path d="M 499.30 798.20 L 504.90 797.40 L 510.20 796.10 L 515.30 794.40 L 520.20 792.20 L 524.80 789.50 L 529.20 786.50 L 533.20 783.20 L 536.90 779.40 L 540.30 775.40 L 543.30 771.10 L 545.90 766.50 L 548.10 761.60 L 549.80 756.50 L 551.00 751.30 L 551.80 745.90 L 552.10 740.20 L 499.30 740.20 L 499.30 798.20 Z" fill="#3a3a77" fill-rule="nonzero" node-id="99" stroke="none" target-height="58" target-width="52.799988" target-x="499.3" target-y="740.2"></path><g node-id="169"><path d="M 770.80 650.90 L 767.90 645.60 L 764.50 640.70 L 760.60 635.90 L 756.30 631.50 L 751.80 627.50 L 747.10 623.90 L 742.00 620.70 L 737.00 618.10 L 731.90 616.00 L 726.70 614.40 L 721.70 613.40 L 716.80 613.10 L 499.30 613.10 L 499.30 722.80 L 764.20 722.80 L 768.70 722.50 L 772.50 721.70 L 775.90 720.50 L 778.90 718.90 L 781.60 716.80 L 783.90 714.40 L 785.70 711.60 L 787.20 708.50 L 788.20 705.10 L 788.80 701.50 L 789.00 697.60 L 788.70 693.20 L 788.00 689.00 L 786.90 684.60 L 785.20 680.00 L 783.00 675.00 L 770.80 650.90 Z" fill="#cedfff" fill-rule="nonzero" group-id="5" node-id="103" stroke="none" target-height="109.70001" target-width="289.7" target-x="499.3" target-y="613.1"></path></g><path d="M 729.60 182.10 L 765.70 216.40 L 694.00 242.10 L 729.60 182.10 Z" fill="#d3dcf4" fill-rule="nonzero" node-id="106" stroke="none" target-height="60" target-width="71.70001" target-x="694" target-y="182.1"></path><path d="M 704.20 261.10 L 808.40 236.60 L 808.40 288.70 L 704.20 261.10 Z" fill="#d3dcf4" fill-rule="nonzero" node-id="108" stroke="none" target-height="52.100006" target-width="104.20001" target-x="704.2" target-y="236.6"></path><path d="M 916.20 528.70 L 881.90 501.00 L 746.80 491.40 L 743.30 490.90 L 740.00 490.00 L 736.90 488.70 L 734.10 487.00 L 731.50 484.90 L 729.20 482.60 L 727.20 480.00 L 725.60 477.10 L 724.30 474.00 L 723.40 470.80 L 723.00 467.40 L 723.00 463.90 L 726.90 408.90 L 727.40 405.40 L 728.30 402.10 L 729.60 399.10 L 731.30 396.20 L 733.40 393.60 L 735.70 391.30 L 738.30 389.30 L 741.20 387.70 L 744.30 386.40 L 747.50 385.50 L 750.90 385.10 L 754.40 385.10 L 901.10 395.60 L 904.60 396.10 L 907.90 397.00 L 911.00 398.40 L 913.80 400.10 L 916.40 402.10 L 918.70 404.40 L 920.70 407.10 L 922.30 409.90 L 923.60 413.00 L 924.50 416.20 L 924.90 419.60 L 924.90 423.10 L 921.00 478.10 L 916.20 528.70 Z" fill="#4c96ec" fill-rule="nonzero" node-id="110" stroke="none" target-height="143.6" target-width="201.90002" target-x="723" target-y="385.1"></path><path d="M 796.50 440.10 L 796.20 443.70 L 795.30 446.90 L 793.80 450.00 L 791.90 452.70 L 789.50 455.10 L 786.80 457.00 L 783.70 458.50 L 780.50 459.40 L 776.90 459.70 L 773.30 459.40 L 770.10 458.50 L 767.00 457.00 L 764.30 455.10 L 761.90 452.70 L 760.00 450.00 L 758.50 446.90 L 757.60 443.70 L 757.30 440.10 L 757.60 436.50 L 758.50 433.30 L 760.00 430.20 L 761.90 427.50 L 764.30 425.10 L 767.00 423.20 L 770.10 421.70 L 773.30 420.80 L 776.90 420.50 L 780.50 420.80 L 783.70 421.70 L 786.80 423.20 L 789.50 425.10 L 791.90 427.50 L 793.80 430.20 L 795.30 433.30 L 796.20 436.50 L 796.50 440.10 Z" fill="#fe9f39" fill-rule="nonzero" node-id="112" stroke="none" target-height="39.200012" target-width="39.200012" target-x="757.3" target-y="420.5"></path><path d="M 823.30 435.40 L 883.20 439.70 L 886.20 440.50 L 888.60 442.10 L 890.30 444.50 L 891.10 447.40 L 891.10 449.00 L 890.30 452.00 L 888.70 454.40 L 886.30 456.10 L 883.40 456.90 L 820.30 452.30 L 817.60 451.10 L 815.60 449.10 L 814.30 446.40 L 814.00 443.30 L 814.80 440.30 L 816.40 437.90 L 818.80 436.20 L 821.70 435.40 Z" fill="#ebf0ff" fill-rule="nonzero" node-id="114" stroke="none" target-height="21.5" target-width="77.099976" target-x="814" target-y="435.4"></path><g node-id="170"><path d="M 151.30 615.80 L 151.80 610.50 L 154.90 595.30 L 158.70 582.20 L 161.30 575.30 L 164.20 568.50 L 170.10 557.70 L 172.90 553.80 L 180.50 544.30 L 185.40 538.60 L 196.10 528.10 L 201.80 523.30 L 207.90 518.80 L 214.30 514.70 L 221.10 510.90 L 228.00 507.50 L 235.40 504.50 L 243.30 501.90 L 251.60 499.70 L 259.90 498.00 L 268.80 496.80 L 278.30 496.00 L 288.50 495.70 L 297.90 496.00 L 307.00 496.70 L 315.70 497.80 L 324.10 499.40 L 332.60 501.40 L 340.50 503.80 L 348.00 506.50 L 355.10 509.50 L 362.00 513.10 L 368.40 516.80 L 374.20 520.80 L 379.50 525.10 L 384.50 529.80 L 388.70 534.60 L 392.40 539.60 L 395.50 544.70 L 397.50 549.10 L 399.10 553.50 L 400.20 558.10 L 400.90 562.70 L 401.20 567.40 L 400.90 572.10 L 400.20 576.70 L 399.10 581.30 L 397.50 585.70 L 395.50 590.10 L 392.40 595.20 L 388.70 600.20 L 384.40 605.00 L 379.40 609.70 L 374.20 614.00 L 368.40 618.00 L 362.00 621.70 L 355.00 625.30 L 348.00 628.30 L 340.50 631.00 L 332.50 633.40 L 324.10 635.40 L 315.70 637.00 L 307.00 638.10 L 297.90 638.80 L 288.50 639.10 L 277.00 638.80 L 266.30 638.10 L 256.30 636.90 L 246.90 635.20 L 239.30 633.40 L 232.20 631.30 L 225.60 628.90 L 219.50 626.20 L 213.80 623.20 L 208.20 619.80 L 203.10 616.10 L 198.50 612.00 L 194.30 607.70 L 190.50 603.00 L 187.80 602.10 L 185.00 601.70 L 182.20 601.90 L 176.50 603.30 L 169.50 606.70 L 155.70 615.70 L 153.70 616.70 L 152.50 616.90 L 151.80 616.60 L 151.30 615.80 Z" fill="#e0eaff" fill-rule="nonzero" group-id="6" node-id="118" stroke="none" target-height="143.39996" target-width="249.90001" target-x="151.3" target-y="495.7"></path></g><g node-id="171"><path d="M 237.00 541.10 L 300.10 541.10 L 302.10 541.40 L 303.80 542.10 L 305.30 543.30 L 306.50 544.80 L 307.20 546.50 L 307.50 548.50 L 307.20 550.50 L 306.50 552.20 L 305.30 553.70 L 303.80 554.90 L 302.10 555.60 L 300.10 555.90 L 237.00 555.90 L 235.00 555.60 L 233.30 554.90 L 231.80 553.70 L 230.60 552.20 L 229.90 550.50 L 229.60 548.50 L 229.90 546.50 L 230.70 544.80 L 231.80 543.30 L 233.30 542.10 L 235.10 541.40 L 237.00 541.10 Z" fill="#3a3a77" fill-rule="nonzero" group-id="7" node-id="123" stroke="none" target-height="14.800049" target-width="77.899994" target-x="229.6" target-y="541.1"></path></g><g node-id="172"><path d="M 346.70 547.80 L 346.00 551.70 L 344.10 554.90 L 341.30 557.30 L 339.60 558.10 L 335.70 558.80 L 331.80 558.10 L 330.10 557.30 L 327.30 554.90 L 325.40 551.70 L 324.70 547.80 L 325.40 543.90 L 327.30 540.70 L 330.10 538.30 L 331.80 537.50 L 335.70 536.80 L 339.60 537.50 L 342.80 539.40 L 345.20 542.20 L 346.00 543.90 L 346.70 547.80 Z" fill="#fe9f39" fill-rule="nonzero" group-id="8" node-id="128" stroke="none" target-height="22" target-width="22" target-x="324.7" target-y="536.8"></path></g><g node-id="173"><path d="M 237.00 579.10 L 300.10 579.10 L 302.10 579.40 L 303.80 580.10 L 305.30 581.30 L 306.50 582.80 L 307.20 584.50 L 307.50 586.50 L 307.20 588.50 L 306.50 590.20 L 305.30 591.70 L 303.80 592.90 L 302.10 593.60 L 300.10 593.90 L 237.00 593.90 L 235.00 593.60 L 233.30 592.90 L 231.80 591.70 L 230.60 590.20 L 229.90 588.50 L 229.60 586.50 L 229.90 584.50 L 230.70 582.80 L 231.80 581.30 L 233.30 580.10 L 235.10 579.40 L 237.00 579.10 Z" fill="#3a3a77" fill-rule="nonzero" group-id="9" node-id="133" stroke="none" target-height="14.800049" target-width="77.899994" target-x="229.6" target-y="579.1"></path></g><g node-id="174"><path d="M 346.70 584.00 L 346.00 587.90 L 344.10 591.10 L 341.30 593.50 L 339.60 594.30 L 335.70 595.00 L 331.80 594.30 L 328.60 592.40 L 326.20 589.60 L 324.90 586.00 L 324.90 582.00 L 326.20 578.40 L 327.30 576.90 L 330.10 574.50 L 333.70 573.20 L 337.70 573.20 L 339.60 573.70 L 342.80 575.60 L 345.20 578.40 L 346.00 580.10 L 346.70 584.00 Z" fill="#fe9f39" fill-rule="nonzero" group-id="10" node-id="138" stroke="none" target-height="21.799988" target-width="21.800018" target-x="324.9" target-y="573.2"></path></g><path d="M 746.70 838.40 L 746.70 767.10 L 699.10 767.10 L 699.10 838.40 L 699.40 839.30 L 720.20 851.50 L 721.50 852.00 L 723.10 852.10 L 726.10 851.30 L 745.20 840.30 L 746.20 839.50 L 746.70 838.40 Z" fill="#949fff" fill-rule="nonzero" node-id="141" stroke="none" target-height="85" target-width="47.600037" target-x="699.1" target-y="767.1"></path><path d="M 720.20 780.40 L 700.10 768.80 L 699.30 768.00 L 699.10 767.10 L 699.50 766.30 L 700.50 765.40 L 719.60 754.40 L 721.10 753.80 L 724.20 753.70 L 725.50 754.10 L 745.60 765.70 L 746.40 766.50 L 746.60 767.40 L 746.20 768.20 L 745.20 769.10 L 726.10 780.10 L 723.10 780.90 L 720.20 780.40 Z" fill="#dee6ff" fill-rule="nonzero" node-id="143" stroke="none" target-height="27.200012" target-width="47.5" target-x="699.1" target-y="753.7"></path><path d="M 115.50 836.70 L 115.50 662.50 L 67.90 662.50 L 67.90 836.70 L 68.20 837.60 L 68.90 838.20 L 89.00 849.80 L 90.30 850.30 L 91.90 850.40 L 94.90 849.60 L 114.00 838.60 L 114.90 837.80 L 115.50 836.70 Z" fill="#dee1f0" fill-rule="nonzero" node-id="145" stroke="none" target-height="187.90002" target-width="47.6" target-x="67.9" target-y="662.5"></path><path d="M 89.00 675.70 L 68.90 664.10 L 68.10 663.30 L 67.90 662.40 L 68.30 661.60 L 69.30 660.70 L 88.40 649.70 L 91.40 648.90 L 94.30 649.40 L 114.40 661.00 L 115.20 661.80 L 115.40 662.70 L 115.00 663.50 L 114.00 664.40 L 94.90 675.40 L 93.50 676.00 L 91.90 676.30 L 90.30 676.20 L 89.00 675.70 Z" fill="#fafbfd" fill-rule="nonzero" node-id="147" stroke="none" target-height="27.399963" target-width="47.5" target-x="67.9" target-y="648.9"></path><g node-id="175"><g node-id="181"><path d="M 977.00 861.10 L 30.00 861.10 L 30.30 854.90 L 31.10 852.00 L 32.30 849.40 L 34.00 847.00 L 36.00 845.00 L 38.40 843.30 L 41.00 842.10 L 43.90 841.30 L 47.00 841.00 L 960.00 841.00 L 963.10 841.30 L 966.00 842.10 L 968.60 843.30 L 971.00 845.00 L 973.00 847.00 L 974.70 849.40 L 975.90 852.00 L 976.70 854.90 L 977.00 861.10 Z" fill="#b7cdeb" fill-rule="nonzero" group-id="11,17" node-id="153" stroke="none" target-height="20.099976" target-width="947" target-x="30" target-y="841"></path></g></g><path d="M 781.10 806.50 L 779.10 811.10 L 777.70 815.60 L 777.10 818.80 L 777.40 831.00 L 777.90 833.60 L 778.80 836.00 L 780.20 838.20 L 782.10 840.10 L 784.20 841.70 L 787.10 843.00 L 790.60 843.90 L 795.30 844.40 L 821.60 845.20 L 827.70 844.70 L 833.50 843.60 L 839.10 842.00 L 844.50 839.90 L 849.70 837.30 L 854.80 834.10 L 858.70 831.20 L 860.40 829.50 L 862.30 826.00 L 862.90 818.70 L 863.50 817.10 L 864.70 815.50 L 875.40 811.70 L 897.10 805.20 L 901.90 803.00 L 903.80 801.50 L 905.20 799.60 L 906.40 796.30 L 906.90 792.40 L 907.60 790.90 L 910.10 788.30 L 913.30 786.20 L 918.60 783.50 L 937.90 775.70 L 947.90 770.00 L 949.50 768.20 L 949.90 767.20 L 949.90 763.00 L 950.30 760.40 L 951.00 758.20 L 953.50 754.10 L 958.00 750.00 L 965.80 743.90 L 970.10 739.70 L 974.00 735.10 L 974.00 729.20 L 972.70 726.80 L 971.10 724.70 L 969.20 723.00 L 964.80 720.40 L 962.30 719.60 L 958.40 718.90 L 954.40 718.80 L 950.50 719.30 L 940.30 722.20 L 934.40 722.50 L 931.60 722.00 L 926.10 720.00 L 917.70 714.60 L 914.80 713.50 L 911.70 712.90 L 908.60 712.90 L 905.30 713.40 L 902.00 714.50 L 898.90 715.90 L 895.80 717.90 L 892.90 720.30 L 882.90 730.00 L 880.20 731.70 L 877.40 732.70 L 874.40 733.30 L 871.20 733.30 L 864.40 732.30 L 861.20 732.30 L 858.40 732.90 L 855.60 733.90 L 852.90 735.50 L 850.20 737.80 L 845.80 742.50 L 833.90 757.60 L 830.50 761.10 L 826.60 763.30 L 824.40 763.80 L 819.90 763.90 L 818.10 764.30 L 814.80 765.90 L 809.20 769.90 L 804.00 774.10 L 799.30 778.70 L 794.90 783.60 L 790.90 788.80 L 787.30 794.40 L 784.00 800.30 L 781.10 806.50" fill="#b1c6d9" fill-rule="nonzero" node-id="157" stroke="none" target-height="132.29999" target-width="196.90002" target-x="777.1" target-y="712.9"></path><path d="M 190.10 807.80 L 185.40 803.00 L 182.70 800.90 L 179.80 799.10 L 176.60 797.90 L 171.40 796.70 L 170.00 795.90 L 167.00 792.70 L 163.30 787.30 L 160.90 784.40 L 155.90 780.00 L 153.50 778.70 L 151.70 778.20 L 149.80 778.20 L 145.50 779.00 L 143.60 779.10 L 140.00 778.00 L 138.40 776.90 L 134.40 772.80 L 131.80 770.60 L 126.00 767.00 L 123.30 766.30 L 119.10 767.00 L 117.30 767.70 L 112.50 771.10 L 110.30 772.30 L 108.20 772.90 L 106.00 772.80 L 99.70 771.20 L 92.60 770.90 L 90.20 771.30 L 88.10 772.20 L 86.30 773.60 L 84.70 775.40 L 82.90 779.00 L 83.40 780.90 L 85.70 783.50 L 96.10 792.90 L 98.20 795.70 L 98.10 798.60 L 99.70 801.20 L 101.20 802.70 L 103.80 804.40 L 114.90 809.00 L 120.80 812.10 L 123.20 814.40 L 123.90 815.90 L 124.50 819.10 L 125.00 820.10 L 127.20 821.80 L 148.40 828.70 L 150.20 830.30 L 151.00 834.90 L 151.80 836.80 L 153.00 838.50 L 156.30 841.00 L 162.70 843.80 L 167.10 845.30 L 176.20 847.10 L 185.50 847.30 L 195.00 845.90 L 197.20 845.20 L 198.90 844.30 L 200.20 843.00 L 201.20 841.40 L 201.90 839.40 L 202.30 836.90 L 202.30 833.00 L 201.90 829.40 L 201.10 826.00 L 198.40 819.50 L 196.70 816.40 L 193.60 812.00 L 190.10 807.80 Z" fill="#b0c6da" fill-rule="nonzero" node-id="159" stroke="none" target-height="81" target-width="119.4" target-x="82.9" target-y="766.3"></path><path d="M 191.00 838.00 L 190.30 837.90 L 179.70 827.80 L 170.10 819.20 L 161.40 812.00 L 152.40 805.10 L 137.40 794.80 L 130.10 790.50 L 118.20 784.50 L 110.20 781.20 L 104.20 779.10 L 94.30 776.60 L 93.90 776.40 L 94.20 775.70 L 99.00 776.60 L 104.50 778.10 L 110.60 780.20 L 118.70 783.60 L 130.60 789.60 L 137.90 793.90 L 153.10 804.30 L 162.10 811.20 L 170.80 818.40 L 180.50 827.00 L 191.10 837.20 L 191.00 838.00 Z" fill="#95b4ce" fill-rule="nonzero" node-id="161" stroke="none" target-height="62.299988" target-width="97.200005" target-x="93.9" target-y="775.7"></path><path d="M 787.20 834.60 L 788.30 834.40 L 802.90 820.40 L 816.30 808.20 L 828.70 797.60 L 841.40 787.40 L 852.90 778.60 L 863.50 771.20 L 874.30 764.10 L 884.00 758.20 L 892.70 753.40 L 909.30 745.20 L 926.10 738.60 L 933.80 736.20 L 947.10 733.00 L 947.70 732.60 L 947.70 732.00 L 947.30 731.50 L 946.60 731.40 L 940.30 732.80 L 925.50 737.10 L 908.60 743.70 L 891.80 751.90 L 883.10 756.80 L 873.30 762.70 L 862.50 769.80 L 851.90 777.30 L 840.20 786.10 L 827.50 796.30 L 815.00 807.00 L 801.50 819.20 L 786.90 833.30 L 786.70 833.80 L 787.20 834.60 Z" fill="#95b4ce" fill-rule="nonzero" node-id="163" stroke="none" target-height="103.19995" target-width="161" target-x="786.7" target-y="731.4"></path></svg>`;
119
153
 
120
154
  const drawSelectionCss = ".draw-page{width:100%;position:relative}.draw-page .draw-page__background{width:100%;height:100%;position:absolute;z-index:0;background:linear-gradient(to right, var(--emw--color-primary, #fed275), var(--emw--color-primary-variant, #ffe66f))}.draw-page .draw-page__background .top-waves{position:absolute;top:30px;left:20px;width:100px;height:60px}.draw-page .draw-page__background .wave{position:absolute;width:80px;height:4px;background:rgba(255, 255, 255, 0.7);border-radius:20px}.draw-page .draw-page__background .wave:nth-child(1){top:0;transform:rotate(-5deg);clip-path:polygon(0 0, 25% 100%, 50% 0, 75% 100%, 100% 0, 100% 100%, 0% 100%)}.draw-page .draw-page__background .wave:nth-child(2){top:20px;transform:rotate(-3deg);clip-path:polygon(0 0, 25% 100%, 50% 0, 75% 100%, 100% 0, 100% 100%, 0% 100%)}.draw-page .draw-page__background .wave:nth-child(3){top:40px;transform:rotate(-1deg);clip-path:polygon(0 0, 25% 100%, 50% 0, 75% 100%, 100% 0, 100% 100%, 0% 100%)}.draw-page .draw-page__background .wave-svg{position:absolute;width:100px;height:8px}.draw-page .draw-page__background .wave-svg:nth-child(1){top:0}.draw-page .draw-page__background .wave-svg:nth-child(2){top:20px}.draw-page .draw-page__background .wave-svg:nth-child(3){top:40px}.draw-page .draw-page__background .dots-cluster{position:absolute;bottom:100px;right:80px;width:120px;height:80px}.draw-page .draw-page__background .dot{position:absolute;border-radius:50%;background-color:rgba(255, 255, 255, 0.6)}.draw-page .draw-page__background .dot:nth-child(1){width:6px;height:6px;top:0px;left:0px}.draw-page .draw-page__background .dot:nth-child(2){width:8px;height:8px;top:0px;left:15px}.draw-page .draw-page__background .dot:nth-child(3){width:5px;height:5px;top:0px;left:32px}.draw-page .draw-page__background .dot:nth-child(4){width:7px;height:7px;top:0px;left:46px}.draw-page .draw-page__background .dot:nth-child(5){width:6px;height:6px;top:0px;left:62px}.draw-page .draw-page__background .dot:nth-child(6){width:8px;height:8px;top:0px;left:78px}.draw-page .draw-page__background .dot:nth-child(7){width:5px;height:5px;top:0px;left:95px}.draw-page .draw-page__background .dot:nth-child(8){width:7px;height:7px;top:15px;left:5px}.draw-page .draw-page__background .dot:nth-child(9){width:6px;height:6px;top:15px;left:20px}.draw-page .draw-page__background .dot:nth-child(10){width:8px;height:8px;top:15px;left:35px}.draw-page .draw-page__background .dot:nth-child(11){width:5px;height:5px;top:15px;left:52px}.draw-page .draw-page__background .dot:nth-child(12){width:7px;height:7px;top:15px;left:67px}.draw-page .draw-page__background .dot:nth-child(13){width:6px;height:6px;top:15px;left:83px}.draw-page .draw-page__background .dot:nth-child(14){width:8px;height:8px;top:30px;left:8px}.draw-page .draw-page__background .dot:nth-child(15){width:5px;height:5px;top:30px;left:25px}.draw-page .draw-page__background .dot:nth-child(16){width:7px;height:7px;top:30px;left:40px}.draw-page .draw-page__background .dot:nth-child(17){width:6px;height:6px;top:30px;left:55px}.draw-page .draw-page__background .dot:nth-child(18){width:8px;height:8px;top:30px;left:72px}.draw-page .draw-page__background .dot:nth-child(19){width:6px;height:6px;top:45px;left:12px}.draw-page .draw-page__background .dot:nth-child(20){width:7px;height:7px;top:45px;left:28px}.draw-page .draw-page__background .dot:nth-child(21){width:5px;height:5px;top:45px;left:44px}.draw-page .draw-page__background .dot:nth-child(22){width:8px;height:8px;top:45px;left:58px}.draw-page .draw-page__background .dot:nth-child(23){width:7px;height:7px;top:60px;left:15px}.draw-page .draw-page__background .dot:nth-child(24){width:6px;height:6px;top:60px;left:32px}.draw-page .draw-page__background .dot:nth-child(25){width:8px;height:8px;top:60px;left:48px}.draw-page .draw-page__background .dot:nth-child(26){width:5px;height:5px;top:75px;left:20px}.draw-page .draw-page__background .dot:nth-child(27){width:7px;height:7px;top:75px;left:35px}.draw-info{padding:16px}.draw-info-title{margin-bottom:36px;display:flex;justify-content:center;flex-direction:column;align-items:center;position:relative;color:var(--emw--color-typography, #000)}.draw-info-title-main{font-size:30px;font-weight:bold}.draw-info-title-sub{position:absolute;bottom:24px;font-weight:600}.draw-info-item-list{display:flex;justify-content:center;flex-wrap:wrap;gap:26px}.draw-info-item{cursor:pointer;text-align:center;padding:20px;width:164px;height:152px;background-color:var(--emw--color-background, #fff);color:var(--emw--color-typography, #000);border-radius:21% 25% 19% 22%/30% 30% 34% 27%;position:relative;display:flex;align-items:center;justify-content:center;flex-direction:column}.draw-info-item:hover{animation:jelly 0.6s ease}.draw-info-item:hover .draw-info-item-projector{animation:shadow-jelly 0.6s ease}.draw-info-item-day{font-size:10px;font-weight:bold;position:absolute;left:calc(50% - 31px);top:-28px;width:64px;height:64px;background:var(--emw--color-secondary-variant, rgb(255, 152, 0));border-radius:50%;display:flex;align-items:center;color:var(--emw--color-typography-tertiary, #fff);justify-content:center;font-style:italic}.draw-info-item-day.reverse{top:unset;bottom:-28px}.draw-info-item-date,.draw-info-item-turnover{margin-top:8px;font-size:16px;color:var(--emw--color-typography, #000);font-family:Arial, Helvetica, sans-serif}.draw-info-item-projecter{content:\"\";position:absolute;top:calc(100% + 40px);left:50%;transform:translateX(-50%);width:120px;height:20px;background:var(--emw--color-background, #fff);border-radius:50%;filter:blur(12px)}.draw-info-footer{width:100%;margin:0 auto;margin-top:100px;position:relative}.draw-info-footer-text{text-align:center;margin-top:12px;font-size:22px;color:var(--emw--color-typography, #000);font-family:\"Comic Sans MS\";font-weight:600}.empty-draw-wrap{display:flex;justify-content:center;align-items:center;width:100%;min-height:calc(100vh - 104px)}.empty-draw{width:240px;height:160px;padding:18px 12px 12px 12px;background:var(--emw--color-secondary, #fff3b9);position:relative;margin:0 auto;display:flex;justify-content:center;align-items:center;text-align:center;border-radius:12px}.empty-draw .empty-draw-logo{position:absolute;top:-64%;left:50%;transform:translateX(-50%);width:200px;height:200px}.empty-draw .empty-draw-logo svg{width:100%;height:100%}.empty-draw-content{display:flex;gap:4px}.empty-draw-text{font-size:14px;font-weight:bold;color:var(--emw--color-typography, #000)}.empty-draw svg{fill:var(--emw--color-typography, #000)}.loading-indicator{z-index:1;display:flex;justify-content:center;padding-top:40px;color:var(--emw--color-typography, #000)}.empty-draw-text{color:var(--emw--color-typography, #000)}@keyframes jelly{0%,100%{transform:scale(1)}25%{transform:scale(1.05, 0.95)}50%{transform:scale(0.95, 1.05)}75%{transform:scale(1.03, 0.97)}}@keyframes shadow-jelly{0%,100%{transform:translateX(-50%) scale(1);opacity:0.1}25%{transform:translateX(-50%) scale(1.1, 0.9);opacity:0.08}50%{transform:translateX(-50%) scale(0.9, 1.1);opacity:0.12}75%{transform:translateX(-50%) scale(1.05, 0.95);opacity:0.09}}";
@@ -604,9 +638,9 @@ const HelperCountDown = class {
604
638
  };
605
639
  HelperCountDown.style = HelperCountDownStyle0;
606
640
 
607
- const DEFAULT_LANGUAGE$7 = 'en';
608
- const SUPPORTED_LANGUAGES$7 = ['ro', 'en', 'fr', 'ar', 'hr'];
609
- const TRANSLATIONS$7 = {
641
+ const DEFAULT_LANGUAGE$9 = 'en';
642
+ const SUPPORTED_LANGUAGES$9 = ['ro', 'en', 'fr', 'ar', 'hr'];
643
+ const TRANSLATIONS$9 = {
610
644
  en: {
611
645
  stop: 'Stop',
612
646
  at: 'at',
@@ -630,18 +664,18 @@ const TRANSLATIONS$7 = {
630
664
  at: 'u'
631
665
  }
632
666
  };
633
- const translate$7 = (key, customLang) => {
667
+ const translate$9 = (key, customLang) => {
634
668
  const lang = customLang;
635
- return TRANSLATIONS$7[lang !== undefined && SUPPORTED_LANGUAGES$7.includes(lang) ? lang : DEFAULT_LANGUAGE$7][key];
669
+ return TRANSLATIONS$9[lang !== undefined && SUPPORTED_LANGUAGES$9.includes(lang) ? lang : DEFAULT_LANGUAGE$9][key];
636
670
  };
637
- const getTranslations$7 = (data) => {
671
+ const getTranslations$9 = (data) => {
638
672
  Object.keys(data).forEach((item) => {
639
673
  for (let key in data[item]) {
640
- TRANSLATIONS$7[item][key] = data[item][key];
674
+ TRANSLATIONS$9[item][key] = data[item][key];
641
675
  }
642
676
  });
643
677
  };
644
- const resolveTranslationUrl$4 = async (translationUrl) => {
678
+ const resolveTranslationUrl$5 = async (translationUrl) => {
645
679
  if (translationUrl) {
646
680
  try {
647
681
  const response = await fetch(translationUrl);
@@ -649,7 +683,7 @@ const resolveTranslationUrl$4 = async (translationUrl) => {
649
683
  throw new Error(`HTTP error! status: ${response.status}`);
650
684
  }
651
685
  const translations = await response.json();
652
- getTranslations$7(translations);
686
+ getTranslations$9(translations);
653
687
  }
654
688
  catch (error) {
655
689
  console.error('Failed to fetch or parse translations from URL:', error);
@@ -702,7 +736,7 @@ const LotteryBanner = class {
702
736
  }
703
737
  async componentWillLoad() {
704
738
  if (this.translationUrl) {
705
- resolveTranslationUrl$4(this.translationUrl);
739
+ resolveTranslationUrl$5(this.translationUrl);
706
740
  }
707
741
  this.checkWagerStatus();
708
742
  }
@@ -738,7 +772,7 @@ const LotteryBanner = class {
738
772
  case 'title':
739
773
  return this.bannerTitle && index.h("div", { class: `lottery-banner__title ${className}` }, this.bannerTitle);
740
774
  case 'info':
741
- 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$7('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$7('stop', this.language)), "\u00A0", translate$7('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$7('turnover', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
775
+ 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$9('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$9('stop', this.language)), "\u00A0", translate$9('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$9('turnover', this.language)), index.h("span", { class: "lottery-banner__info-item-value" }, this.turnover)))));
742
776
  default:
743
777
  return null;
744
778
  }
@@ -762,9 +796,9 @@ const LotteryBanner = class {
762
796
  };
763
797
  LotteryBanner.style = LotteryBannerStyle0;
764
798
 
765
- const DEFAULT_LANGUAGE$6 = 'en';
766
- const SUPPORTED_LANGUAGES$6 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
767
- const TRANSLATIONS$6 = {
799
+ const DEFAULT_LANGUAGE$8 = 'en';
800
+ const SUPPORTED_LANGUAGES$8 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
801
+ const TRANSLATIONS$8 = {
768
802
  en: {
769
803
  loading: 'Loading'
770
804
  },
@@ -773,9 +807,9 @@ const TRANSLATIONS$6 = {
773
807
  ar: {},
774
808
  hr: {}
775
809
  };
776
- const translate$6 = (key, customLang, replacements) => {
810
+ const translate$8 = (key, customLang, replacements) => {
777
811
  const lang = customLang;
778
- let translation = TRANSLATIONS$6[lang !== undefined && SUPPORTED_LANGUAGES$6.includes(lang) ? lang : DEFAULT_LANGUAGE$6][key];
812
+ let translation = TRANSLATIONS$8[lang !== undefined && SUPPORTED_LANGUAGES$8.includes(lang) ? lang : DEFAULT_LANGUAGE$8][key];
779
813
  if (replacements) {
780
814
  Object.keys(replacements).forEach((placeholder) => {
781
815
  translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
@@ -783,14 +817,14 @@ const translate$6 = (key, customLang, replacements) => {
783
817
  }
784
818
  return translation;
785
819
  };
786
- const getTranslations$6 = (data) => {
820
+ const getTranslations$8 = (data) => {
787
821
  Object.keys(data).forEach((item) => {
788
822
  for (let key in data[item]) {
789
- TRANSLATIONS$6[item][key] = data[item][key];
823
+ TRANSLATIONS$8[item][key] = data[item][key];
790
824
  }
791
825
  });
792
826
  };
793
- const resolveTranslationUrl$3 = async (translationUrl) => {
827
+ const resolveTranslationUrl$4 = async (translationUrl) => {
794
828
  if (translationUrl) {
795
829
  try {
796
830
  const response = await fetch(translationUrl);
@@ -798,7 +832,7 @@ const resolveTranslationUrl$3 = async (translationUrl) => {
798
832
  throw new Error(`HTTP error! status: ${response.status}`);
799
833
  }
800
834
  const translations = await response.json();
801
- getTranslations$6(translations);
835
+ getTranslations$8(translations);
802
836
  }
803
837
  catch (error) {
804
838
  console.error('Failed to fetch or parse translations from URL:', error);
@@ -876,7 +910,7 @@ const LotteryButton = class {
876
910
  }
877
911
  componentWillLoad() {
878
912
  if (this.translationUrl) {
879
- resolveTranslationUrl$3(this.translationUrl);
913
+ resolveTranslationUrl$4(this.translationUrl);
880
914
  }
881
915
  }
882
916
  render() {
@@ -916,7 +950,7 @@ const LotteryButton = class {
916
950
  [`btn--${variant}`]: true,
917
951
  [`btn--${size}`]: true,
918
952
  'btn--loading': this.loading
919
- }, style: color ? buttonStyles : undefined, disabled: isDisabled, onClick: this.handleClick, ref: (el) => (this.stylingContainer = el) }, this.loading ? (index.h("div", { class: "loading-container" }, index.h("span", { class: "content" }, this.text || translate$6('loading', this.language)), index.h("span", { class: "spinner" }))) : (index.h("span", { class: "content" }, index.h("slot", { name: "icon-left" }), this.text || index.h("slot", null), index.h("slot", { name: "icon-right" }))), index.h("div", { key: '302ea02be395bb24989d4abc040a513e23fa029a', class: "ripple-container" }, this.ripples.map((ripple, index$1) => (index.h("span", { key: index$1, class: "ripple", style: {
953
+ }, style: color ? buttonStyles : undefined, disabled: isDisabled, onClick: this.handleClick, ref: (el) => (this.stylingContainer = el) }, this.loading ? (index.h("div", { class: "loading-container" }, index.h("span", { class: "content" }, this.text || translate$8('loading', this.language)), index.h("span", { class: "spinner" }))) : (index.h("span", { class: "content" }, index.h("slot", { name: "icon-left" }), this.text || index.h("slot", null), index.h("slot", { name: "icon-right" }))), index.h("div", { key: '302ea02be395bb24989d4abc040a513e23fa029a', class: "ripple-container" }, this.ripples.map((ripple, index$1) => (index.h("span", { key: index$1, class: "ripple", style: {
920
954
  top: `${ripple.top}px`,
921
955
  left: `${ripple.left}px`,
922
956
  width: `${ripple.size}px`,
@@ -932,21 +966,74 @@ const LotteryButton = class {
932
966
  };
933
967
  LotteryButton.style = LotteryButtonStyle0;
934
968
 
935
- const lotteryTippingBulletCss = ".LotteryTippingBullet__segment{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;font-size:16px;line-height:1;font-weight:500;color:var(--emw--color-typography, #000);background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-gray-100, #e6e6e6);border-radius:6px;cursor:pointer;transition:all 0.2s ease;user-select:none}.LotteryTippingBullet__segment:not(.LotteryTippingBullet__segment--disabled):hover{cursor:pointer;animation:jelly 0.3s ease-in-out;transform:scale(1.02)}.LotteryTippingBullet__segment--text{border:none;color:var(--emw--color-typography, #000);background:transparent;font-weight:400}.LotteryTippingBullet__segment--text:hover{cursor:not-allowed !important}.LotteryTippingBullet__segment--active{font-weight:600;background-color:var(--emw--color-background-inverse, #000);color:var(--emw--color-primary, #fed275)}.LotteryTippingBullet__segment--disabled:not(.LotteryTippingBullet__segment--active){background-color:var(--emw--color-background-tertiary, #ccc);color:var(--emw--color-gray-150, #6f6f6f);border-color:var(--emw--color-gray-100, #e6e6e6)}.LotteryTippingBullet__segment--disabled:hover{cursor:not-allowed}@keyframes jelly{0%{transform:translate(0, 0)}20%{transform:translate(-0.5px, -0.5px)}40%{transform:translate(0.5px, 0.5px)}60%{transform:translate(-0.25px, -0.25px)}80%{transform:translate(0.25px, 0.25px)}100%{transform:translate(0, 0)}}";
936
- const LotteryTippingBulletStyle0 = lotteryTippingBulletCss;
969
+ const generateUUID$3 = () => {
970
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
971
+ var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
972
+ return v.toString(16);
973
+ });
974
+ };
975
+ function fetchRequest$3(url, method = 'GET', body = null, headers = {}) {
976
+ return new Promise((resolve, reject) => {
977
+ const uuid = generateUUID$3();
978
+ const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
979
+ if (method !== 'GET' && method !== 'HEAD') {
980
+ headersOrigin['X-Idempotency-Key'] = uuid;
981
+ }
982
+ const options = {
983
+ method,
984
+ headers: headersOrigin,
985
+ body: null
986
+ };
987
+ if (body && method !== 'GET' && method !== 'HEAD') {
988
+ options.body = JSON.stringify(body);
989
+ }
990
+ else {
991
+ delete options.body;
992
+ }
993
+ fetch(url, options)
994
+ .then((response) => {
995
+ if (!response.ok) {
996
+ return reject(response);
997
+ }
998
+ return response.json();
999
+ })
1000
+ .then((data) => resolve(data))
1001
+ .catch((error) => reject(error));
1002
+ });
1003
+ }
937
1004
 
938
- const LotteryTippingBullet = class {
1005
+ var TicketStatus;
1006
+ (function (TicketStatus) {
1007
+ TicketStatus["PURCHASED"] = "Purchased";
1008
+ TicketStatus["SETTLED"] = "Settled";
1009
+ TicketStatus["CANCELED"] = "Canceled";
1010
+ TicketStatus["ERROR"] = "Error";
1011
+ })(TicketStatus || (TicketStatus = {}));
1012
+
1013
+ const lotteryOrderSummaryCss = ":host{width:100%}.order-summary{width:100%;background:var(--emw--color-background, #fff);border-radius:var(--lottery-order-summary-border-radius, 8px);border:var(--lottery-order-summary-border, none);box-shadow:var(--lottery-order-summary-box-shadow, none);box-sizing:border-box}.order-summary__title{margin:var(--lottery-order-summary-title-margin, 0 0 30px 0);text-align:var(--lottery-order-summary-title-text-align, center);color:var(--emw--color-typography, #000);text-transform:uppercase;font-weight:var(--lottery-order-summary-title-font-weight, 700)}.order-summary__ticket-info{display:flex;align-items:center;margin-bottom:var(--lottery-order-summary-row-gap, 16px);gap:var(--lottery-order-summary-col-gap, 10px);color:var(--emw--color-typography, #000)}.order-summary__ticket-label{display:flex;flex-direction:row;align-items:center;width:var(--lottery-order-summary-label-width, 50px);max-width:var(--lottery-order-summary-label-max-width, 100%);flex-shrink:0}.order-summary__colon{margin-left:2px}.order-summary__ticket{font-weight:var(--lottery-order-summary-label-font-weight, 500);color:var(--emw--color-typography, #000);overflow-wrap:break-word}.order-summary__details{display:flex;align-items:center;color:var(--emw--color-typography, #000);font-weight:var(--lottery-order-summary-details-font-weight, 400)}.order-summary__divider{border:none;border-top:var(--lottery-order-summary-divider-border, 1px solid var(--emw--color-gray-100, #e6e6e6));margin:var(--lottery-order-summary-divider-margin, 20px 0)}.order-summary__button-wrapper{display:flex;justify-content:center;margin:var(--lottery-order-summary-button-wrapper-margin, 0);padding:var(--lottery-order-summary-button-wrapper-padding, 0)}";
1014
+ const LotteryOrderSummaryStyle0 = lotteryOrderSummaryCss;
1015
+
1016
+ const LotteryOrderSummary = class {
939
1017
  constructor(hostRef) {
940
1018
  index.registerInstance(this, hostRef);
941
- this.lotteryTippingBulletToggleEvent = index.createEvent(this, "lotteryTippingBulletToggle", 7);
1019
+ this.orderSummarySubmit = index.createEvent(this, "orderSummarySubmit", 7);
1020
+ this.submitSuccess = index.createEvent(this, "lotteryTicketSubmitSuccess", 7);
1021
+ this.submitError = index.createEvent(this, "lotteryTicketSubmitError", 7);
1022
+ this.sessionExpired = index.createEvent(this, "sessionExpired", 7);
1023
+ this.endpoint = undefined;
1024
+ this.sessionId = undefined;
942
1025
  this.mbSource = undefined;
943
1026
  this.clientStyling = undefined;
944
1027
  this.clientStylingUrl = undefined;
945
- this.positionIdx = undefined;
946
- this.theme = 'default';
947
- this.value = '';
948
- this.disabled = false;
949
- this.isSelected = false;
1028
+ this.language = 'en';
1029
+ this.orderSummaryTitle = undefined;
1030
+ this.ticketsLabel = undefined;
1031
+ this.totalLabel = undefined;
1032
+ this.showColon = true;
1033
+ this.showDivider = false;
1034
+ this.submitDisabled = false;
1035
+ this.submitButtonText = undefined;
1036
+ this.submitLoading = false;
950
1037
  }
951
1038
  handleClientStylingChange(newValue, oldValue) {
952
1039
  if (newValue != oldValue) {
@@ -973,23 +1060,77 @@ const LotteryTippingBullet = class {
973
1060
  lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
974
1061
  }
975
1062
  }
976
- handleClick() {
977
- if (!this.disabled) {
978
- this.lotteryTippingBulletToggleEvent.emit({ positionIdx: this.positionIdx });
979
- }
980
- }
981
1063
  disconnectedCallback() {
982
1064
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
983
1065
  }
1066
+ handleLotteryTicketParamsReady(event) {
1067
+ if (event.detail && this.isValidTicketSubmitParam(event.detail)) {
1068
+ this.handleSubmitTickets(event.detail);
1069
+ }
1070
+ else {
1071
+ const errorMessage = 'Invalid ticket data received before submission.';
1072
+ console.error(errorMessage, event.detail);
1073
+ this.submitError.emit({
1074
+ message: errorMessage,
1075
+ dataOrigin: event.detail,
1076
+ status: 400 // Bad Request
1077
+ });
1078
+ }
1079
+ }
1080
+ isValidTicketSubmitParam(detail) {
1081
+ return (detail &&
1082
+ Array.isArray(detail.tickets) &&
1083
+ detail.tickets.length > 0 &&
1084
+ detail.tickets.every((ticket) => this.isValidTicketParam(ticket)));
1085
+ }
1086
+ isValidTicketParam(ticket) {
1087
+ return (ticket &&
1088
+ ticket.gameName !== undefined &&
1089
+ ticket.startingDrawId !== undefined &&
1090
+ ticket.amount !== undefined &&
1091
+ ticket.currency !== undefined &&
1092
+ ticket.selection !== undefined);
1093
+ }
1094
+ async handleSubmitTickets(body) {
1095
+ try {
1096
+ this.submitLoading = true;
1097
+ const res = await fetchRequest$3(`${this.endpoint}/tickets`, 'POST', body, {
1098
+ Authorization: `Bearer ${this.sessionId}`
1099
+ });
1100
+ if (!res.tickets.every((ticket) => ticket.state === TicketStatus.PURCHASED)) {
1101
+ this.submitError.emit({
1102
+ message: 'Failed to purchase ticket',
1103
+ dataOrigin: res,
1104
+ status: 200
1105
+ });
1106
+ }
1107
+ else {
1108
+ this.submitSuccess.emit({
1109
+ dataOrigin: res,
1110
+ status: 200
1111
+ });
1112
+ }
1113
+ }
1114
+ catch (e) {
1115
+ if (e.status === 401) {
1116
+ this.sessionExpired.emit();
1117
+ }
1118
+ if (e.status > 300 || !e.status) {
1119
+ this.submitError.emit({
1120
+ dataOrigin: e,
1121
+ status: e.status || 0
1122
+ });
1123
+ }
1124
+ }
1125
+ finally {
1126
+ this.submitLoading = false;
1127
+ }
1128
+ }
1129
+ handleSubmit() {
1130
+ this.orderSummarySubmit.emit();
1131
+ }
984
1132
  render() {
985
- return (index.h("div", { key: 'ef0fee38ed62adb7809b5a60668af6a499ebe5a6', ref: (el) => (this.stylingContainer = el) }, this.theme === 'text' ? (index.h("div", { class: {
986
- LotteryTippingBullet__segment: true,
987
- 'LotteryTippingBullet__segment--text': true
988
- } }, this.value)) : (index.h("button", { class: {
989
- LotteryTippingBullet__segment: true,
990
- 'LotteryTippingBullet__segment--disabled': this.disabled,
991
- 'LotteryTippingBullet__segment--active': this.isSelected
992
- }, onClick: this.handleClick.bind(this) }, this.isSelected ? 'X' : this.value))));
1133
+ return (index.h("div", { key: 'bdab321b9336f47e16057d240b3226d7cba59b97', ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: 'de7ffcc9f96d8c7cfc7bdb3a3c7225ee78c33483', class: "order-summary" }, index.h("h3", { key: '9500cd69a6eba0855d4981cdad8eaa91b9c98567', class: "order-summary__title" }, this.orderSummaryTitle), index.h("div", { key: 'ce29c82eef1d12bc63e94e4fa2d5474700860af2', class: "order-summary__ticket" }, index.h("div", { key: '9db79da17590c7f847f46c3b3b66489ea9a0e268', class: "order-summary__ticket-info" }, index.h("div", { key: '4b5a2df807aeb421cf3c1ebf33f410a92f39ccaf', class: "order-summary__ticket-label" }, index.h("div", { key: 'feb73e9f849d2e3d6b77e4c848657f27e6a82323', class: "order-summary__ticket" }, this.ticketsLabel), index.h("span", { key: '51f70dcdda2154d8ce97d8e1a7c0f61a6198afbb', class: "order-summary__colon" }, this.showColon ? ':' : null)), index.h("div", { key: '4fed2d63cd7a881c8844055fe1fde99c8c7aa9fb', class: "order-summary__details" }, index.h("slot", { key: '6a7969738546ee4aca81a075f6174556e78d2c31', name: "orderSummaryTicketDetail" }))), this.showDivider && index.h("hr", { key: '029803fa93960d5098a24d5ca18e77e14562b29f', class: "order-summary__divider" }), index.h("div", { key: '738096c5b605a97851dbf24a972d93d9533ad48b', class: "order-summary__ticket-info" }, index.h("div", { key: 'acd8a7f3e64c97f58c79f57a90143151c996abf8', class: "order-summary__ticket-label" }, index.h("div", { key: '44e6b29978ca4fc2b22ca9d95ee4facfc883f292', class: "order-summary__ticket" }, this.totalLabel), index.h("span", { key: '330a00a4b39e578a1b0d80211d2b68d44c5235c9', class: "order-summary__colon" }, this.showColon ? ':' : null)), index.h("span", { key: '294046815a62a80366458aade4ec5d5476577a93', class: "order-summary__details" }, index.h("slot", { key: '02d129ef0caf523ec0c9da34318df46d3b008376', name: "orderSummaryTotalDetail" })))), index.h("slot", { key: '9395396883f0594ad8db216a9aa9fa0aeff45c10', name: "orderSummaryChoice" }), index.h("div", { key: '462672abc490cde00fea90ea585f48875ca2ec47', class: "order-summary__button-wrapper" }, index.h("lottery-button", { key: '1885bee3570ce6b58d4ae1977c635f418485fdbe', onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: this.submitDisabled, text: this.submitButtonText })))));
993
1134
  }
994
1135
  static get watchers() { return {
995
1136
  "clientStyling": ["handleClientStylingChange"],
@@ -997,114 +1138,71 @@ const LotteryTippingBullet = class {
997
1138
  "mbSource": ["handleMbSourceChange"]
998
1139
  }; }
999
1140
  };
1000
- LotteryTippingBullet.style = LotteryTippingBulletStyle0;
1141
+ LotteryOrderSummary.style = LotteryOrderSummaryStyle0;
1001
1142
 
1002
- const lotteryTippingBulletGroupCss = "";
1003
- const LotteryTippingBulletGroupStyle0 = lotteryTippingBulletGroupCss;
1143
+ const lotterySegmentedCss = ":host{display:block}.wrapper{display:flex;align-items:center;gap:8px}.label{font-size:16px;color:var(--emw-segmented-label-color, #333);font-weight:500}.segmented-container{display:inline-flex;position:relative;background-color:var(--emw-segmented-bg, #f0f0f0);border-radius:20px;box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1)}.option{position:relative;z-index:1;border:none;background-color:transparent;padding:12px 18px;cursor:pointer;font-size:14px;font-weight:500;color:var(--emw-segmented-text-color, #555);transition:color 0.3s ease;white-space:nowrap}.option.active{color:var(--emw-segmented-active-text-color, #000);font-weight:bold}.active-indicator{position:absolute;z-index:0;top:2px;bottom:2px;background-color:var(--emw-segmented-active-bg, #fff);border-radius:22px;box-shadow:0 2px 4px rgba(0, 0, 0, 0.15);transition:transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1)}";
1144
+ const LotterySegmentedStyle0 = lotterySegmentedCss;
1004
1145
 
1005
- const LotteryTippingBulletGroup = class {
1146
+ const LotterySegmented = class {
1006
1147
  constructor(hostRef) {
1007
1148
  index.registerInstance(this, hostRef);
1008
- this.lotteryTippingBulletGroupToggleEvent = index.createEvent(this, "lotteryTippingBulletGroupToggle", 7);
1009
- this.mbSource = undefined;
1010
- this.clientStyling = undefined;
1011
- this.clientStylingUrl = undefined;
1012
- this.positionIdx = undefined;
1013
- this.theme = 'default';
1014
- this.mode = 'single';
1015
- this.bulletConfigContent = '';
1016
- }
1017
- get bulletConfigArr() {
1018
- const defaultConfig = [
1019
- {
1020
- value: '1'
1021
- },
1022
- {
1023
- value: 'X'
1024
- },
1025
- {
1026
- value: '2'
1027
- }
1028
- ];
1029
- if (typeof this.bulletConfigContent === 'string' && this.bulletConfigContent) {
1030
- try {
1031
- const _temp = JSON.parse(this.bulletConfigContent);
1032
- return _temp;
1033
- }
1034
- catch (e) {
1035
- console.error('Error parsing bulletConfigContent:', e);
1036
- return defaultConfig;
1037
- }
1038
- }
1039
- else {
1040
- return defaultConfig;
1041
- }
1042
- }
1043
- handleClientStylingChange(newValue, oldValue) {
1044
- if (newValue != oldValue) {
1045
- lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
1046
- }
1149
+ this.valueChange = index.createEvent(this, "valueChange", 7);
1150
+ this.optionRefs = [];
1151
+ this.label = undefined;
1152
+ this.options = [];
1153
+ this.value = undefined;
1047
1154
  }
1048
- handleClientStylingUrlChange(newValue, oldValue) {
1049
- if (newValue != oldValue) {
1050
- lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
1051
- }
1155
+ handleValueChange() {
1156
+ this.updateActiveIndicator();
1052
1157
  }
1053
- handleMbSourceChange(newValue, oldValue) {
1054
- if (newValue != oldValue) {
1055
- lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
1158
+ componentWillLoad() {
1159
+ if (!this.value && this.options.length > 0) {
1160
+ // Default to the first option if no value is provided
1161
+ this.value = this.options[0].value;
1056
1162
  }
1057
1163
  }
1058
1164
  componentDidLoad() {
1059
- if (this.stylingContainer) {
1060
- if (this.mbSource)
1061
- lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
1062
- if (this.clientStyling)
1063
- lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
1064
- if (this.clientStylingUrl)
1065
- lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
1066
- }
1067
- }
1068
- disconnectedCallback() {
1069
- this.stylingSubscription && this.stylingSubscription.unsubscribe();
1165
+ // Use requestAnimationFrame to ensure layout is calculated
1166
+ requestAnimationFrame(() => this.updateActiveIndicator());
1070
1167
  }
1071
- lotteryTippingBulletSelectionHandler(event) {
1072
- const { positionIdx } = event.detail;
1073
- this.handleToggle(positionIdx);
1168
+ handleWindowResize() {
1169
+ this.updateActiveIndicator();
1074
1170
  }
1075
- handleToggle(index) {
1076
- let newConfigArr = [...this.bulletConfigArr];
1077
- if (this.mode === 'single') {
1078
- // single mode: only one button can be selected
1079
- newConfigArr = newConfigArr.map((item) => (Object.assign(Object.assign({}, item), { isSelected: false })));
1080
- newConfigArr[index].isSelected = true;
1171
+ updateActiveIndicator() {
1172
+ const selectedIndex = this.options.findIndex((opt) => opt.value === this.value);
1173
+ if (selectedIndex === -1 || !this.activeIndicator || !this.optionRefs[selectedIndex]) {
1174
+ return;
1081
1175
  }
1082
- else {
1083
- // multi mode: multiple buttons can be selected
1084
- newConfigArr = newConfigArr.map((item) => (Object.assign({}, item)));
1085
- newConfigArr[index].isSelected = !newConfigArr[index].isSelected;
1176
+ const selectedOptionEl = this.optionRefs[selectedIndex];
1177
+ const containerEl = this.activeIndicator.parentElement;
1178
+ const containerRect = containerEl.getBoundingClientRect();
1179
+ const optionRect = selectedOptionEl.getBoundingClientRect();
1180
+ this.activeIndicator.style.transform = `translateX(${optionRect.left - containerRect.left}px)`;
1181
+ this.activeIndicator.style.width = `${optionRect.width}px`;
1182
+ }
1183
+ onOptionClick(optionValue) {
1184
+ if (this.value !== optionValue) {
1185
+ this.valueChange.emit(optionValue);
1086
1186
  }
1087
- this.lotteryTippingBulletGroupToggleEvent.emit({
1088
- bulletConfigArr: newConfigArr,
1089
- positionIdx: this.positionIdx + '-' + index
1090
- });
1091
1187
  }
1092
1188
  render() {
1093
- var _a;
1094
- return (index.h("div", { ref: (el) => (this.stylingContainer = el), key: this.positionIdx }, index.h("div", { key: '68223022eed831932c571378164be913206d98e9', style: { display: 'flex', flexDirection: 'row', gap: '10px' } }, (_a = this.bulletConfigArr) === null || _a === void 0 ? void 0 : _a.map((item, index$1) => (index.h("div", { key: index$1 }, index.h("lottery-tipping-bullet", { value: item.value, isSelected: item.isSelected, "position-idx": index$1, disabled: item.disabled, theme: this.theme, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource })))))));
1189
+ return (index.h("div", { key: '675f17d5fd8ddef56324416fda27ffd130ddafa3', class: "wrapper" }, this.label && index.h("label", { key: 'd6dfc897e2014a7ce57cc4ddca57b1e6173eb1a5', class: "label" }, this.label), index.h("div", { key: 'e89097f2a9536ada1e0edf52e0d50cdd8f88c52e', class: "segmented-container" }, index.h("div", { key: 'f720dc7b9b8957cb6d363fd6a2313978eba6988e', class: "active-indicator", ref: (el) => (this.activeIndicator = el) }), this.options.map((option, index$1) => (index.h("button", { class: { option: true, active: this.value === option.value }, onClick: () => this.onOptionClick(option.value), ref: (el) => (this.optionRefs[index$1] = el) }, option.label))))));
1095
1190
  }
1191
+ get host() { return index.getElement(this); }
1096
1192
  static get watchers() { return {
1097
- "clientStyling": ["handleClientStylingChange"],
1098
- "clientStylingUrl": ["handleClientStylingUrlChange"],
1099
- "mbSource": ["handleMbSourceChange"]
1193
+ "value": ["handleValueChange"]
1100
1194
  }; }
1101
1195
  };
1102
- LotteryTippingBulletGroup.style = LotteryTippingBulletGroupStyle0;
1196
+ LotterySegmented.style = LotterySegmentedStyle0;
1103
1197
 
1104
1198
  // This icon file is generated automatically.
1105
1199
  var CalendarOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z" } }] }, "name": "calendar", "theme": "outlined" };
1106
1200
  const CalendarOutlined$1 = CalendarOutlined;
1107
1201
 
1202
+ // This icon file is generated automatically.
1203
+ var DeleteFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M864 256H736v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zm-200 0H360v-72h304v72z" } }] }, "name": "delete", "theme": "filled" };
1204
+ const DeleteFilled$1 = DeleteFilled;
1205
+
1108
1206
  // This icon file is generated automatically.
1109
1207
  var DeleteOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
1110
1208
  const DeleteOutlined$1 = DeleteOutlined;
@@ -1178,49 +1276,1148 @@ function renderAbstractNodeToSVGElement(node, options) {
1178
1276
  return "<".concat(node.tag).concat(attrsToken, " />");
1179
1277
  }
1180
1278
 
1181
- const DEFAULT_LANGUAGE$5 = 'en';
1182
- const SUPPORTED_LANGUAGES$5 = ['ro', 'en', 'fr', 'ar', 'hr'];
1183
- const TRANSLATIONS$5 = {
1184
- en: {
1185
- weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1186
- bettingType: 'Betting Type:',
1187
- prizeAllocation: 'Prize Allocation (Turnover: {turnover})',
1188
- prizes: 'Prizes',
1189
- numberOfWinners: 'Number of Winners',
1190
- prizeMoney: 'Prize Money',
1191
- noLatestResult: 'No latest result.',
1192
- loading: 'Loading....'
1193
- },
1194
- ro: {
1195
- bettingType: 'Tip de pariu:',
1196
- prizeAllocation: 'Alocarea premiilor (Cifră de afaceri: €{turnover})',
1197
- prizes: 'Premii',
1198
- numberOfWinners: 'Număr de câștigători',
1199
- prizeMoney: 'Bani de premiu',
1200
- noLatestResult: 'Niciun rezultat recent.',
1201
- loading: 'Se încarcă....'
1202
- },
1203
- fr: {
1204
- bettingType: 'Type de pari:',
1205
- prizeAllocation: "Répartition des prix (Chiffre d'affaires: € {turnover})",
1206
- prizes: 'Prix',
1207
- numberOfWinners: 'Nombre de gagnants',
1208
- prizeMoney: 'Prix en argent',
1209
- noLatestResult: 'Aucun résultat récent.',
1210
- loading: 'Chargement....'
1211
- },
1212
- ar: {
1213
- bettingType: 'نوع الرهان:',
1214
- prizeAllocation: 'تخصيص الجائزة (دوران: € {turnover})',
1215
- prizes: 'الجوائز',
1216
- numberOfWinners: 'عدد الفائزين',
1217
- prizeMoney: 'أموال الجائزة',
1218
- noLatestResult: 'لا يوجد أحدث نتيجة.',
1219
- loading: 'جار التحميل....'
1220
- },
1221
- hr: {
1222
- bettingType: 'Vrsta oklade:',
1223
- prizeAllocation: 'Raspodjela nagrada (Promet: € {turnover})',
1279
+ // Basic sanitization method for SVG content
1280
+ // This is NOT a complete XSS prevention for SVG, but prevents common attacks.
1281
+ function sanitizeSvg(svgString) {
1282
+ let sanitized = svgString.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // Remove <script> tags
1283
+ sanitized = sanitized.replace(/on[a-z]+=[\"'][^\"']*[\"']/gi, ''); // Remove on* attributes
1284
+ sanitized = sanitized.replace(/javascript:/gi, ''); // Remove javascript: URLs
1285
+ return sanitized;
1286
+ }
1287
+
1288
+ const lotterySelectionCss = ":host{display:inline-block}.lottery-selection__button{display:flex;align-items:center;justify-content:center;width:var(--lottery-selection-width, 32px);height:var(--lottery-selection-height, 32px);padding:var(--lottery-selection-padding, 0);box-sizing:border-box;background:var(--lottery-selection-background, var(--emw--color-background, #fff));border:var(--lottery-selection-border-width, 2px) var(--lottery-selection-border-style, solid) var(--lottery-selection-border-color, var(--emw--color-primary, #0d196e));border-radius:var(--lottery-selection-border-radius, var(--emw--border-radius-medium, 8px));color:var(--lottery-selection-color, var(--emw--color-typography, #000));font-weight:var(--lottery-selection-font-weight, bold);font-size:var(--lottery-selection-font-size, 1em);cursor:pointer;user-select:none;}.lottery-selection__button:hover{background:var(--lottery-selection-hover-background, var(--emw--color-background, #fff));border-color:var(--lottery-selection-hover-border-color, var(--emw--color-primary, #0d196e));color:var(--lottery-selection-hover-color, var(--emw--color-typography, #000))}.lottery-selection__button .lottery-selection__delete-icon{display:none}.lottery-selection__button.isDeleteByIcon:hover .lottery-selection__text{display:none}.lottery-selection__button.isDeleteByIcon:hover .lottery-selection__delete-icon{display:flex;align-items:center;justify-content:center;fill:var(--lottery-selection-delete-icon-color, var(--emw--color-typography, #000));vertical-align:middle}.lottery-selection__button.lottery-selection__button--selected{background-color:var(--lottery-selection-selected-background, var(--emw--color-primary, #0d196e));border-color:var(--lottery-selection-selected-border-color, var(--emw--color-primary, #0d196e));color:var(--lottery-selection-selected-color, var(--emw--color-typography-inverse, #fff))}.lottery-selection__button.lottery-selection__button--disabled{background-color:var(--lottery-selection-disabled-background, var(--emw--color-gray-50, #f5f5f5));border-color:var(--lottery-selection-disabled-border-color, var(--emw--color-gray-100, #e6e6e6));color:var(--lottery-selection-disabled-color, var(--emw--color-gray-150, #6f6f6f));cursor:not-allowed;pointer-events:none;}.lottery-selection__button.lottery-selection__button--no-border{border:none}.lottery-selection__button.lottery-selection__button--no-background{background:transparent}";
1289
+ const LotterySelectionStyle0 = lotterySelectionCss;
1290
+
1291
+ const LotterySelection = class {
1292
+ constructor(hostRef) {
1293
+ index.registerInstance(this, hostRef);
1294
+ this.lotteryBulletClickHandler = index.createEvent(this, "lotteryBulletClick", 7);
1295
+ this.value = 0;
1296
+ this.text = undefined;
1297
+ this.idx = undefined;
1298
+ this.type = 'toggle';
1299
+ this.mbSource = undefined;
1300
+ this.clientStyling = undefined;
1301
+ this.clientStylingUrl = undefined;
1302
+ this.hasBorder = true;
1303
+ this.hasBackground = true;
1304
+ this.deleteIconSvg = '';
1305
+ this.deleteIconWidth = '16px';
1306
+ this.deleteIconHeight = '16px';
1307
+ }
1308
+ handleClientStylingChange(newValue, oldValue) {
1309
+ if (newValue !== oldValue) {
1310
+ lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
1311
+ }
1312
+ }
1313
+ handleClientStylingUrlChange(newValue, oldValue) {
1314
+ if (newValue !== oldValue) {
1315
+ lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
1316
+ }
1317
+ }
1318
+ handleMbSourceChange(newValue, oldValue) {
1319
+ if (newValue !== oldValue) {
1320
+ lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
1321
+ }
1322
+ }
1323
+ componentDidLoad() {
1324
+ if (this.stylingContainer) {
1325
+ if (this.mbSource)
1326
+ lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
1327
+ if (this.clientStyling)
1328
+ lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
1329
+ if (this.clientStylingUrl)
1330
+ lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
1331
+ }
1332
+ }
1333
+ disconnectedCallback() {
1334
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
1335
+ }
1336
+ handleClick() {
1337
+ if (this.type === 'disabled' || this.type === 'readonly') {
1338
+ return;
1339
+ }
1340
+ console.log('bullet clicked', this.type, this.idx, this.text, this.value);
1341
+ this.lotteryBulletClickHandler.emit({
1342
+ type: this.type,
1343
+ idx: this.idx,
1344
+ text: this.text,
1345
+ value: this.value
1346
+ });
1347
+ }
1348
+ render() {
1349
+ let iconToRender;
1350
+ if (this.deleteIconSvg) {
1351
+ iconToRender = sanitizeSvg(this.deleteIconSvg);
1352
+ }
1353
+ else {
1354
+ iconToRender = renderIconDefinitionToSVGElement(DeleteFilled$1, {
1355
+ extraSVGAttrs: {
1356
+ width: this.deleteIconWidth,
1357
+ height: this.deleteIconHeight,
1358
+ fill: 'currentColor'
1359
+ }
1360
+ });
1361
+ }
1362
+ return (index.h("div", { key: '0d1e8aaa80a907a7467410f6b27b4b6175e82299', class: "lottery-selection", ref: (el) => (this.stylingContainer = el) }, index.h("button", { key: '11a2402abbc290dc877ad95f3433092c3a0d8419', class: {
1363
+ 'lottery-selection__button': true,
1364
+ 'lottery-selection__button--selected': this.value == 1,
1365
+ 'lottery-selection__button--disabled': this.type === 'disabled',
1366
+ 'lottery-selection__button--no-border': !this.hasBorder,
1367
+ 'lottery-selection__button--no-background': !this.hasBackground,
1368
+ isDeleteByIcon: this.type === 'delete',
1369
+ isCallDialogBtn: this.type === 'input' || this.type === 'readonly'
1370
+ }, onClick: this.handleClick.bind(this), disabled: this.type === 'disabled' }, this.type === 'delete' && index.h("span", { key: 'f99001d936a8f7bdf8adc5c46e82caf730a9442a', class: "lottery-selection__delete-icon", innerHTML: iconToRender }), index.h("span", { key: '55775e2492a1fe45cc8a457ac0a0d206744461ab', class: "lottery-selection__text" }, this.text))));
1371
+ }
1372
+ static get watchers() { return {
1373
+ "clientStyling": ["handleClientStylingChange"],
1374
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
1375
+ "mbSource": ["handleMbSourceChange"]
1376
+ }; }
1377
+ };
1378
+ LotterySelection.style = LotterySelectionStyle0;
1379
+
1380
+ const DEFAULT_LANGUAGE$7 = 'en';
1381
+ const SUPPORTED_LANGUAGES$7 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
1382
+ const TRANSLATIONS$7 = {
1383
+ en: {
1384
+ noTicketBoard: 'No ticket board available.',
1385
+ selectionCleared: 'Your selection has been cleared.',
1386
+ clearAll: 'Clear All',
1387
+ stopAt: 'Stop at',
1388
+ turnover: 'Turnover: ',
1389
+ pleaseFillIn: 'Please fill in all the selection input!',
1390
+ fillIn: 'Fill in',
1391
+ noBets: 'Sorry. No bets have been placed so far. Check back later!',
1392
+ search: 'Search',
1393
+ clear: 'Clear',
1394
+ oddsChart: 'Odds Chart',
1395
+ ticketSuccess: 'Ticket purchased successfully.',
1396
+ stakePerLine: 'Stake per Line:',
1397
+ lowestOdds: 'Lowest Odds:',
1398
+ highestOdds: 'Highest Odds:',
1399
+ orderSummary: 'ORDER SUMMARY',
1400
+ ticket: 'Ticket',
1401
+ lines: 'Lines',
1402
+ total: 'Total',
1403
+ submit: 'Submit',
1404
+ loading: 'Loading',
1405
+ enterValidNumber: 'Please enter a valid number.',
1406
+ enterNumberBetween: 'Please enter a number between {min} and {max}.',
1407
+ numberAlreadySelected: 'This number has already been selected.',
1408
+ enterScoreUpTo: 'Please enter the score (Up to {maxScore})',
1409
+ enterValue: 'Please enter a value',
1410
+ myChoices: 'My Choices',
1411
+ teams: 'Teams',
1412
+ scores: 'Scores',
1413
+ euro: 'Euro',
1414
+ cancel: 'Cancel',
1415
+ confirm: 'Confirm'
1416
+ },
1417
+ ro: {},
1418
+ fr: {},
1419
+ ar: {},
1420
+ hr: {}
1421
+ };
1422
+ const translate$7 = (key, customLang, replacements) => {
1423
+ const lang = customLang;
1424
+ let translation = TRANSLATIONS$7[lang !== undefined && SUPPORTED_LANGUAGES$7.includes(lang) ? lang : DEFAULT_LANGUAGE$7][key];
1425
+ if (replacements) {
1426
+ Object.keys(replacements).forEach((placeholder) => {
1427
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
1428
+ });
1429
+ }
1430
+ return translation;
1431
+ };
1432
+ const getTranslations$7 = (data) => {
1433
+ Object.keys(data).forEach((item) => {
1434
+ for (let key in data[item]) {
1435
+ TRANSLATIONS$7[item][key] = data[item][key];
1436
+ }
1437
+ });
1438
+ };
1439
+
1440
+ function getBulletTextsSet(bulletTexts, splitToken) {
1441
+ return new Set(bulletTexts ? bulletTexts.split(splitToken) : []);
1442
+ }
1443
+ function validateInput({ value, selectedSet, maxValue, minValue, language, type = 'integer' }) {
1444
+ const trimmedValue = value.trim();
1445
+ if (type === 'integer') {
1446
+ // Strict integer check
1447
+ if (!/^-?\d+$/.test(trimmedValue)) {
1448
+ return {
1449
+ valid: false,
1450
+ errorMessage: translate$7('enterValidNumber', language),
1451
+ value
1452
+ };
1453
+ }
1454
+ const numValue = Number(trimmedValue);
1455
+ if (isNaN(numValue)) {
1456
+ return {
1457
+ valid: false,
1458
+ errorMessage: translate$7('enterValidNumber', language),
1459
+ value
1460
+ };
1461
+ }
1462
+ if ((minValue !== undefined && numValue < minValue) || (maxValue !== undefined && numValue > maxValue)) {
1463
+ return {
1464
+ valid: false,
1465
+ errorMessage: translate$7('enterNumberBetween', language, {
1466
+ min: minValue,
1467
+ max: maxValue
1468
+ }),
1469
+ value
1470
+ };
1471
+ }
1472
+ // Normalize value (e.g. "05" -> "5") for set check
1473
+ const normalizedValue = String(numValue);
1474
+ if (selectedSet.has(normalizedValue)) {
1475
+ return {
1476
+ valid: false,
1477
+ errorMessage: translate$7('numberAlreadySelected', language),
1478
+ value
1479
+ };
1480
+ }
1481
+ }
1482
+ else {
1483
+ // Text mode validation
1484
+ if (selectedSet.has(trimmedValue)) {
1485
+ return {
1486
+ valid: false,
1487
+ errorMessage: translate$7('numberAlreadySelected', language), // Or generic 'alreadySelected' if available, but reusing key for now
1488
+ value
1489
+ };
1490
+ }
1491
+ }
1492
+ return {
1493
+ valid: true,
1494
+ errorMessage: '',
1495
+ value
1496
+ };
1497
+ }
1498
+ function removeBulletTexts(text, selectedArr) {
1499
+ return selectedArr.filter((s) => s !== text);
1500
+ }
1501
+ function addSelectedBulletTexts(text, selectedArr) {
1502
+ return selectedArr.concat([text]);
1503
+ }
1504
+ function removeAndAddSelectedBulletTexts(text, selectedArr, maxSelectedCount) {
1505
+ return selectedArr.slice(selectedArr.length - (maxSelectedCount - 1)).concat([text]);
1506
+ }
1507
+ function buildSelectedBulletTextsArr(item, selectedArr, maxSelectedCount) {
1508
+ if (item.type === 'delete') {
1509
+ return removeBulletTexts(item.text, selectedArr);
1510
+ }
1511
+ if (item.type === 'toggle') {
1512
+ if (selectedArr.includes(item.text)) {
1513
+ return removeBulletTexts(item.text, selectedArr);
1514
+ }
1515
+ if (selectedArr.length >= maxSelectedCount) {
1516
+ return removeAndAddSelectedBulletTexts(item.text, selectedArr, maxSelectedCount);
1517
+ }
1518
+ return addSelectedBulletTexts(item.text, selectedArr);
1519
+ }
1520
+ return [];
1521
+ }
1522
+
1523
+ const lotterySelectionGroupCss = ":host {\n width: 100%;\n}\n\n.lottery-selection-group {\n container-type: inline-size;\n padding: var(--lottery-selection-group-padding, 0);\n background: var(--lottery-selection-group-background, transparent);\n border: var(--lottery-selection-group-border, none);\n border-radius: var(--lottery-selection-group-border-radius, 0);\n}\n.lottery-selection-group__item {\n display: flex;\n flex-direction: var(--lottery-selection-group-flex-direction, row);\n align-items: var(--lottery-selection-group-item-align, center);\n justify-content: var(--lottery-selection-group-item-justify, flex-start);\n gap: var(--lottery-selection-group-item-gap, 16px);\n width: 100%;\n}\n.lottery-selection-group__item--left {\n width: var(--lottery-selection-group-label-width, 130px);\n min-width: var(--lottery-selection-group-label-min-width, auto);\n max-width: var(--lottery-selection-group-label-max-width, none);\n color: var(--lottery-selection-group-label-color, var(--emw--color-typography, #000));\n font-size: var(--lottery-selection-group-label-font-size, 1em);\n font-weight: var(--lottery-selection-group-label-font-weight, bold);\n text-align: var(--lottery-selection-group-label-align, left);\n white-space: var(--lottery-selection-group-label-white-space, normal);\n}\n.lottery-selection-group__item--right {\n flex: 1;\n display: flex;\n flex-wrap: var(--lottery-selection-group-bullets-wrap, wrap); /* Allow items to wrap */\n gap: var(--lottery-selection-group-bullets-gap, 8px); /* Gap between bullets */\n align-items: var(--lottery-selection-group-bullets-align, center);\n justify-content: var(--lottery-selection-group-bullets-justify, flex-start); /* Align bullets to start */\n}\n@container (max-width: 320px) {\n .lottery-selection-group__item--left {\n width: 100px;\n max-width: 100px;\n }\n}\n\n.dialog-input {\n width: 100%;\n padding: var(--lottery-selection-group-input-padding, 8px);\n border: var(--lottery-selection-group-input-border-width, 1px) var(--lottery-selection-group-input-border-style, solid) var(--lottery-selection-group-input-border-color, var(--emw--color-gray-100, #e6e6e6));\n border-radius: var(--lottery-selection-group-input-radius, 4px);\n background-color: var(--lottery-selection-group-input-bg, #fff);\n color: var(--lottery-selection-group-input-color, #000);\n box-sizing: border-box;\n margin-top: var(--lottery-selection-group-input-margin-top, 10px);\n font-size: var(--lottery-selection-group-input-font-size, 1em);\n}\n.dialog-input::placeholder {\n color: var(--lottery-selection-group-input-placeholder-color, #999);\n}\n\n.dialog-input.invalid,\n.dialog-input.invalid:focus {\n border-color: var(--emw--color-error, #ff3d00);\n outline-color: var(--emw--color-error, #ff3d00);\n}\n\n.error-message {\n color: var(--lottery-selection-group-error-color, var(--emw--color-error, #ff3d00));\n font-size: var(--lottery-selection-group-error-font-size, 12px);\n font-weight: var(--lottery-selection-group-error-font-weight, normal);\n margin-top: 4px;\n}\n\n.addSelectionDialog-title {\n color: var(--lottery-selection-group-dialog-title-color, var(--emw--color-typography, #000));\n font-size: var(--lottery-selection-group-dialog-title-font-size, 1.2em);\n font-weight: var(--lottery-selection-group-dialog-title-font-weight, bold);\n margin-bottom: var(--lottery-selection-group-dialog-title-margin-bottom, 0);\n}\n.addSelectionDialog-footer {\n display: flex;\n justify-content: var(--lottery-selection-group-dialog-footer-justify, flex-end);\n gap: var(--lottery-selection-group-dialog-footer-gap, 18px);\n margin-top: var(--lottery-selection-group-dialog-footer-margin-top, 0);\n}";
1524
+ const LotterySelectionGroupStyle0 = lotterySelectionGroupCss;
1525
+
1526
+ const LotterySelectionGroup = class {
1527
+ constructor(hostRef) {
1528
+ index.registerInstance(this, hostRef);
1529
+ this.bulletGroupUpdateSelectedBulletTexts = index.createEvent(this, "bulletGroupUpdateSelection", 7);
1530
+ this.mbSource = undefined;
1531
+ this.clientStyling = undefined;
1532
+ this.clientStylingUrl = undefined;
1533
+ this.language = 'en';
1534
+ this.translationUrl = '';
1535
+ this.splitToken = ',';
1536
+ this.selectionGroupId = undefined;
1537
+ this.selectionGroupLabel = undefined;
1538
+ this.type = 'bet';
1539
+ this.selectedBulletTexts = null;
1540
+ this.maxSelectedCount = null;
1541
+ this.maxDisplayBulletsCount = 11;
1542
+ this.bulletTexts = null;
1543
+ this.maxIntegerBulletText = null;
1544
+ this.minIntegerBulletText = 0;
1545
+ this.bulletTextType = 'integer';
1546
+ this.hasBorder = true;
1547
+ this.hasBackground = true;
1548
+ this.dialogTitle = undefined;
1549
+ this.dialogInputPlaceholder = undefined;
1550
+ this.disabledBulletTexts = '';
1551
+ this.dialogConfig = {
1552
+ width: '400px',
1553
+ visible: false,
1554
+ onConfirm: () => this.handleFillInAddMore(),
1555
+ onCancel: () => this.handleCloseAddMoreDialog()
1556
+ };
1557
+ this.inputInfo = { valid: true, errorMessage: '', value: '' };
1558
+ }
1559
+ handleClientStylingChange(newValue, oldValue) {
1560
+ if (newValue != oldValue) {
1561
+ lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
1562
+ }
1563
+ }
1564
+ handleClientStylingUrlChange(newValue, oldValue) {
1565
+ if (newValue != oldValue) {
1566
+ lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
1567
+ }
1568
+ }
1569
+ handleMbSourceChange(newValue, oldValue) {
1570
+ if (newValue != oldValue) {
1571
+ lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
1572
+ }
1573
+ }
1574
+ componentWillLoad() {
1575
+ if (this.translationUrl) {
1576
+ getTranslations$7(JSON.parse(this.translationUrl));
1577
+ }
1578
+ }
1579
+ componentDidLoad() {
1580
+ if (this.stylingContainer) {
1581
+ if (this.mbSource)
1582
+ lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
1583
+ if (this.clientStyling)
1584
+ lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
1585
+ if (this.clientStylingUrl)
1586
+ lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
1587
+ }
1588
+ }
1589
+ disconnectedCallback() {
1590
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
1591
+ }
1592
+ lotteryBulletClickHandler(event) {
1593
+ event.stopPropagation();
1594
+ // if it's input type, open the dialog
1595
+ if (event.detail.type === 'input') {
1596
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: true });
1597
+ return;
1598
+ }
1599
+ if (['delete', 'toggle'].includes(event.detail.type)) {
1600
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
1601
+ newSelectedBulletTexts: buildSelectedBulletTextsArr(event.detail, Array.from(this.selectedSet), this.maxSelectedCount).join(this.splitToken),
1602
+ selectionGroupId: this.selectionGroupId
1603
+ });
1604
+ return;
1605
+ }
1606
+ }
1607
+ get selectedSet() {
1608
+ return getBulletTextsSet(this.selectedBulletTexts, this.splitToken);
1609
+ }
1610
+ get disabledSet() {
1611
+ return getBulletTextsSet(this.disabledBulletTexts, this.splitToken);
1612
+ }
1613
+ get bulletTextsSet() {
1614
+ if (this.bulletTexts)
1615
+ return getBulletTextsSet(this.bulletTexts, this.splitToken);
1616
+ if (this.bulletTextType === 'integer' &&
1617
+ this.maxIntegerBulletText !== null &&
1618
+ this.maxIntegerBulletText !== undefined) {
1619
+ return getBulletTextsSet(Array.from({ length: Number(this.lastDisplayBulletText) - this.minIntegerBulletText + 1 }, (_, index) => this.minIntegerBulletText + index).join(this.splitToken), this.splitToken);
1620
+ }
1621
+ // If neither bulletTexts nor maxIntegerBulletText are provided,
1622
+ return new Set();
1623
+ }
1624
+ // the last bullet text
1625
+ get lastDisplayBulletText() {
1626
+ if (this.bulletTextType === 'integer') {
1627
+ if (this.maxIntegerBulletText !== null && this.maxIntegerBulletText !== undefined) {
1628
+ return Math.min(this.maxIntegerBulletText, this.minIntegerBulletText + this.maxDisplayBulletsCount - 1);
1629
+ }
1630
+ return this.minIntegerBulletText + this.maxDisplayBulletsCount - 1;
1631
+ }
1632
+ // Text mode: return the text at the max display index if available
1633
+ if (this.bulletTextsSet.size > 0) {
1634
+ const texts = Array.from(this.bulletTextsSet);
1635
+ if (texts.length >= this.maxDisplayBulletsCount) {
1636
+ return texts[this.maxDisplayBulletsCount - 1];
1637
+ }
1638
+ return texts[texts.length - 1]; // If fewer than maxDisplayBulletsCount, return the last one
1639
+ }
1640
+ return null;
1641
+ }
1642
+ get isSingleSelectionMode() {
1643
+ return this.maxSelectedCount === 1;
1644
+ }
1645
+ getBulletToRender() {
1646
+ const allBulletTexts = Array.from(this.bulletTextsSet);
1647
+ // Determine which bullets to display based on type and limit
1648
+ let bulletsToRender = allBulletTexts;
1649
+ let showInputButton = false;
1650
+ if (this.bulletTextType === 'text') {
1651
+ // For text, if we have more items than the limit, we need an input button.
1652
+ // The input button takes one slot, so we show (limit - 1) items.
1653
+ if (allBulletTexts.length > this.maxDisplayBulletsCount) {
1654
+ showInputButton = true;
1655
+ bulletsToRender = allBulletTexts.slice(0, this.maxDisplayBulletsCount - 1);
1656
+ }
1657
+ else {
1658
+ bulletsToRender = allBulletTexts;
1659
+ }
1660
+ }
1661
+ else {
1662
+ // For integer, logic is based on maxIntegerBulletText vs displayed range
1663
+ showInputButton =
1664
+ this.maxIntegerBulletText !== null &&
1665
+ this.maxIntegerBulletText !== undefined &&
1666
+ this.maxIntegerBulletText > Number(this.lastDisplayBulletText);
1667
+ // Integer bullets generation already respects the count, no slicing needed on the raw set
1668
+ bulletsToRender = allBulletTexts;
1669
+ }
1670
+ return {
1671
+ bulletsToRender,
1672
+ showInputButton
1673
+ };
1674
+ }
1675
+ renderBulletGroup() {
1676
+ let items = [];
1677
+ if (this.type === 'bet') {
1678
+ const isMaxSelected = this.maxSelectedCount !== null && this.selectedSet.size >= this.maxSelectedCount;
1679
+ const { bulletsToRender, showInputButton } = this.getBulletToRender();
1680
+ bulletsToRender.forEach((text, idx) => {
1681
+ let bulletType = 'toggle';
1682
+ if (this.disabledSet.has(String(text))) {
1683
+ bulletType = 'disabled';
1684
+ }
1685
+ else if (!this.selectedSet.has(String(text)) && isMaxSelected && !this.isSingleSelectionMode) {
1686
+ bulletType = 'disabled';
1687
+ }
1688
+ items.push({
1689
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
1690
+ text: String(text),
1691
+ idx,
1692
+ type: bulletType
1693
+ });
1694
+ });
1695
+ if (showInputButton) {
1696
+ let inputBulletType = 'input';
1697
+ if (isMaxSelected && !this.isSingleSelectionMode) {
1698
+ inputBulletType = 'disabled';
1699
+ }
1700
+ const inputButtonText = this.bulletTextType === 'text' ? '...' : `${this.lastDisplayBulletText}+`;
1701
+ const inputButtonIdx = this.bulletTextType === 'text' ? -1 : Number(this.lastDisplayBulletText) + 1;
1702
+ // Special handling for integer mode:
1703
+ // If the generated set is "full" (size == maxDisplayBulletsCount),
1704
+ // we need to remove the last item to make room for the "N+" button
1705
+ // so the total visual count remains consistent.
1706
+ if (this.bulletTextType === 'integer' && items.length >= this.maxDisplayBulletsCount) {
1707
+ items.pop();
1708
+ }
1709
+ items.push({
1710
+ value: 0,
1711
+ text: inputButtonText,
1712
+ idx: inputButtonIdx,
1713
+ type: inputBulletType
1714
+ });
1715
+ }
1716
+ }
1717
+ else if (['choice', 'preview'].includes(this.type)) {
1718
+ // For choice/preview, also respect the visual limit for text mode
1719
+ const { bulletsToRender } = this.getBulletToRender();
1720
+ bulletsToRender.forEach((text, idx) => {
1721
+ let bulletType = 'toggle';
1722
+ if (this.disabledSet.has(String(text))) {
1723
+ bulletType = 'disabled';
1724
+ }
1725
+ else if (this.type === 'preview') {
1726
+ bulletType = 'readonly';
1727
+ }
1728
+ else if (this.selectedSet.has(String(text))) {
1729
+ bulletType = 'delete';
1730
+ }
1731
+ items.push({
1732
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
1733
+ text,
1734
+ idx,
1735
+ type: bulletType
1736
+ });
1737
+ });
1738
+ }
1739
+ return (index.h("div", { class: "lottery-selection-group__item--right" }, items.map((item) => {
1740
+ return (index.h("lottery-selection", { clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource, text: item.text, idx: item.idx, value: item.value, type: item.type, hasBorder: this.hasBorder, hasBackground: this.hasBackground }));
1741
+ })));
1742
+ }
1743
+ handleCloseAddMoreDialog() {
1744
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: false });
1745
+ this.inputInfo = { value: '', errorMessage: '', valid: true };
1746
+ }
1747
+ handleInputChange(e) {
1748
+ const inputElement = e.target;
1749
+ const value = inputElement.value;
1750
+ this.inputInfo = Object.assign(Object.assign({}, this.inputInfo), { value: value });
1751
+ this.inputInfo = validateInput({
1752
+ value,
1753
+ selectedSet: this.selectedSet,
1754
+ maxValue: this.maxIntegerBulletText,
1755
+ minValue: this.bulletTextType === 'integer' ? Number(this.lastDisplayBulletText) + 1 : undefined,
1756
+ language: this.language,
1757
+ type: this.bulletTextType
1758
+ });
1759
+ }
1760
+ handleFillInAddMore() {
1761
+ if (this.inputInfo.valid) {
1762
+ const { value } = this.inputInfo;
1763
+ // Normalize the value (e.g., "05" -> "5") to match validation logic
1764
+ let normalizedValue = value;
1765
+ if (this.bulletTextType === 'integer') {
1766
+ normalizedValue = String(Number(value));
1767
+ }
1768
+ else {
1769
+ normalizedValue = value.trim();
1770
+ }
1771
+ let newSelectedBulletTexts;
1772
+ if (this.isSingleSelectionMode) {
1773
+ newSelectedBulletTexts = normalizedValue;
1774
+ }
1775
+ else {
1776
+ newSelectedBulletTexts = addSelectedBulletTexts(normalizedValue, Array.from(this.selectedSet)).join(this.splitToken);
1777
+ }
1778
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
1779
+ newSelectedBulletTexts,
1780
+ selectionGroupId: this.selectionGroupId
1781
+ });
1782
+ this.handleCloseAddMoreDialog();
1783
+ }
1784
+ }
1785
+ render() {
1786
+ return (index.h("div", { key: '39225bad75cf435b166269367df570732eff7ef4', class: "lottery-selection-group", ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '2bb2bc539c9fc05aeece7145b13f722756bc054e', class: "lottery-selection-group__item" }, this.selectionGroupLabel && (index.h("div", { key: 'dc15197dca90375bd4eb50e87d96402d1ef694d2', class: "lottery-selection-group__item--left" }, this.selectionGroupLabel)), this.renderBulletGroup()), index.h("lottery-tipping-dialog", { key: '9526dbb5d1656d6724e6566465febde778437c64', visible: this.dialogConfig.visible, width: this.dialogConfig.width, onCancel: this.dialogConfig.onCancel }, index.h("div", { key: 'ecf5800430e92be4a2af279f1d8c5075d5965b7e', class: "addSelectionDialog" }, index.h("div", { key: '3e8a2f445679ef5fe2ada60d4a6832f472f27dfa', class: "addSelectionDialog-title" }, this.dialogTitle ||
1787
+ (this.bulletTextType === 'text'
1788
+ ? translate$7('enterValue', this.language)
1789
+ : translate$7('enterScoreUpTo', this.language, {
1790
+ maxScore: this.maxIntegerBulletText
1791
+ }))), index.h("input", { key: '46462ee8f27410639d45970a76fc3d90a03f3a10', type: "text", class: {
1792
+ 'dialog-input': true,
1793
+ invalid: !this.inputInfo.valid
1794
+ }, value: this.inputInfo.value, onInput: this.handleInputChange.bind(this), placeholder: this.dialogInputPlaceholder }), index.h("div", { key: '2e66988e4186f8f4f773ed548fc76e53085be946', class: "error-message" }, this.inputInfo.errorMessage)), index.h("div", { key: '81dc64f0b7cba422a54af8ecff4734aa19832583', slot: "footer", class: "addSelectionDialog-footer" }, index.h("lottery-button", { key: '3027240894aef525dc9fc50db79597cf29f9cb99', onClick: this.dialogConfig.onCancel, text: translate$7('cancel', this.language), variant: "outline" }), index.h("lottery-button", { key: 'ab8c6deed9ab4a7d79d71ed6fe8122b23af5741b', onClick: this.dialogConfig.onConfirm, text: translate$7('confirm', this.language), variant: "primary", disabled: !this.inputInfo.valid || !this.inputInfo.value })))));
1795
+ }
1796
+ static get watchers() { return {
1797
+ "clientStyling": ["handleClientStylingChange"],
1798
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
1799
+ "mbSource": ["handleMbSourceChange"]
1800
+ }; }
1801
+ };
1802
+ LotterySelectionGroup.style = LotterySelectionGroupStyle0;
1803
+
1804
+ const DEFAULT_LANGUAGE$6 = 'en';
1805
+ const SUPPORTED_LANGUAGES$6 = ['ro', 'en', 'fr', 'ar', 'hr'];
1806
+ const TRANSLATIONS$6 = {
1807
+ en: {
1808
+ homeTeam: 'Home team:',
1809
+ awayTeam: 'Away team:',
1810
+ loading: 'Loading...',
1811
+ error: 'Error!',
1812
+ noData: 'No data available.',
1813
+ lineInfo: 'Line {currentPage} of {totalPages}',
1814
+ clearAll: 'Clear All'
1815
+ },
1816
+ ro: {
1817
+ homeTeam: 'Echipa gazdă:',
1818
+ awayTeam: 'Echipa oaspete:',
1819
+ selectionCleared: 'Selecția dvs. a fost ștearsă.',
1820
+ selectionOnLineCleared: 'Selecția dvs. de pe această linie va fi ștearsă.',
1821
+ loading: `Se încarcă...',n error: 'Eroare!`,
1822
+ noData: 'Nu sunt date disponibile.',
1823
+ lineInfo: 'Linia {currentPage} din {totalPages}',
1824
+ clearAll: 'Șterge tot',
1825
+ cancel: 'Anulează',
1826
+ confirm: 'Confirmă'
1827
+ },
1828
+ fr: {
1829
+ homeTeam: 'Équipe à domicile:',
1830
+ awayTeam: `Équipe à l'extérieur:`,
1831
+ selectionCleared: 'Votre sélection a été effacée.',
1832
+ selectionOnLineCleared: 'Votre sélection sur cette ligne sera effacée.',
1833
+ loading: `Chargement...',n error: 'Erreur!`,
1834
+ noData: 'Aucune donnée disponible.',
1835
+ lineInfo: 'Ligne {currentPage} sur {totalPages}',
1836
+ clearAll: 'Tout effacer',
1837
+ cancel: 'Annuler',
1838
+ confirm: 'Confirmer'
1839
+ },
1840
+ ar: {
1841
+ homeTeam: 'الفريق المضيف:',
1842
+ awayTeam: 'الفريق الضيف:',
1843
+ selectionCleared: 'تم مسح اختيارك.',
1844
+ selectionOnLineCleared: 'سيتم مسح اختيارك في هذا السطر.',
1845
+ loading: `جار التحميل...',n error: 'خطأ!`,
1846
+ noData: 'لا توجد بيانات متاحة.',
1847
+ lineInfo: 'السطر {currentPage} من {totalPages}',
1848
+ clearAll: 'مسح الكل',
1849
+ cancel: 'إلغاء',
1850
+ confirm: 'تأكيد'
1851
+ },
1852
+ hr: {
1853
+ homeTeam: 'Domaći tim:',
1854
+ awayTeam: 'Gostujući tim:',
1855
+ selectionCleared: 'Vaš odabir je obrisan.',
1856
+ selectionOnLineCleared: 'Vaš odabir na ovoj liniji bit će obrisan.',
1857
+ loading: `Učitavanje...',n error: 'Greška!`,
1858
+ noData: 'Nema dostupnih podataka.',
1859
+ lineInfo: 'Linija {currentPage} od {totalPages}',
1860
+ clearAll: 'Očisti sve',
1861
+ cancel: 'Odustani',
1862
+ confirm: 'Potvrdi'
1863
+ }
1864
+ };
1865
+ const translate$6 = (key, customLang, replacements) => {
1866
+ const lang = customLang;
1867
+ let translation = TRANSLATIONS$6[lang !== undefined && SUPPORTED_LANGUAGES$6.includes(lang) ? lang : DEFAULT_LANGUAGE$6][key];
1868
+ if (replacements) {
1869
+ Object.keys(replacements).forEach((placeholder) => {
1870
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
1871
+ });
1872
+ }
1873
+ return translation;
1874
+ };
1875
+ const getTranslations$6 = (data) => {
1876
+ Object.keys(data).forEach((item) => {
1877
+ for (let key in data[item]) {
1878
+ TRANSLATIONS$6[item][key] = data[item][key];
1879
+ }
1880
+ });
1881
+ };
1882
+ const resolveTranslationUrl$3 = async (translationUrl) => {
1883
+ if (translationUrl) {
1884
+ try {
1885
+ const response = await fetch(translationUrl);
1886
+ if (!response.ok) {
1887
+ throw new Error(`HTTP error! status: ${response.status}`);
1888
+ }
1889
+ const translations = await response.json();
1890
+ getTranslations$6(translations);
1891
+ }
1892
+ catch (error) {
1893
+ console.error('Failed to fetch or parse translations from URL:', error);
1894
+ }
1895
+ }
1896
+ };
1897
+
1898
+ const formatDate$1 = ({ date, type = 'date', format }) => {
1899
+ try {
1900
+ const parsedDate = lotteryTippingEntrance.parseISO(date);
1901
+ if (isNaN(parsedDate.getTime())) {
1902
+ throw new Error(`Invalid date: ${date}`);
1903
+ }
1904
+ if (format)
1905
+ return lotteryTippingEntrance.format(parsedDate, format);
1906
+ let formatStr = 'dd/MM/yyyy';
1907
+ if (type === 'time') {
1908
+ formatStr = 'dd/MM/yyyy HH:mm:ss';
1909
+ }
1910
+ else if (type === 'week') {
1911
+ formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
1912
+ }
1913
+ return lotteryTippingEntrance.format(parsedDate, formatStr);
1914
+ }
1915
+ catch (error) {
1916
+ console.error('Error formatting date:', error.message);
1917
+ return '';
1918
+ }
1919
+ };
1920
+
1921
+ const lotteryTippingBetSlipCss = ":host {\n --lottery-button-border-radius: 16px;\n}\n\n.LotteryTippingTicketBet__container {\n display: block; /* Or inline-block, depending on desired layout flow */\n font-size: 14px;\n padding: 12px;\n border: 1px solid var(--emw--color-gray-100, #e6e6e6);\n border-radius: var(--emw--button-border-radius, 4px);\n line-height: 1.5715;\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n overflow: hidden;\n min-width: 300px;\n container-type: inline-size;\n}\n@container (max-width: 375px) {\n .LotteryTippingTicketBet__container {\n font-size: 12px;\n }\n}\n\n.table-wrapper {\n overflow-x: auto; /* Handle horizontal scroll if content overflows */\n}\n\n.LotteryTippingTicketBet__main {\n overflow: hidden;\n}\n\n.table-scroll-wrapper {\n overflow-x: auto;\n flex-grow: 1;\n min-width: 0;\n}\n\n.my-table-component {\n width: 100%;\n border-collapse: collapse; /* Important for borders */\n text-align: left;\n border-radius: 0.1rem; /* Ant Design like subtle rounding */\n border-spacing: 0;\n}\n\n/* Header */\n.my-table-component th {\n background: var(--emw--color-background-secondary, #f5f5f5);\n color: var(--emw--color-typography, #000);\n font-weight: 500;\n padding: 0.4rem 0.5rem;\n transition: background 0.3s ease;\n}\n@container (max-width: 400px) {\n .my-table-component th {\n padding: 0.3rem 0.3rem;\n }\n}\n\n/* Cells */\n.my-table-component td {\n padding: 0.4rem 0.5rem;\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n transition: background 0.3s;\n}\n@container (max-width: 400px) {\n .my-table-component td {\n padding: 0.3rem 0.3rem;\n }\n}\n\n.my-table-component th:nth-child(1),\n.my-table-component td:nth-child(1) {\n /* index */\n min-width: 10px;\n}\n.my-table-component th:nth-child(3),\n.my-table-component td:nth-child(3) {\n /* startTime */\n min-width: 60px;\n}\n.my-table-component th:nth-child(4),\n.my-table-component td:nth-child(4) {\n /* results */\n min-width: 120px;\n}\n\n.my-table-component.bordered th,\n.my-table-component.bordered td {\n border-bottom: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n/* Bordered style */\n.my-table-component.grid th,\n.my-table-component.grid td {\n border: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n.my-table-component.grid th {\n border-bottom-width: 1px; /* Ensure bottom border is consistent */\n}\n\n.my-table-component.grid {\n border: 1px solid var(--emw--color-gray-100, #e6e6e6); /* Outer border */\n border-right-width: 0;\n border-bottom-width: 0;\n}\n\n.my-table-component.grid th:last-child,\n.my-table-component.grid td:last-child {\n border-right: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n.my-table-component.grid tr:last-child td {\n border-bottom: 1px solid var(--emw--color-gray-100, #e6e6e6);\n}\n\n/* Striped style */\n.my-table-component.striped tbody tr:nth-child(even) td {\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n/* Hover (optional, but nice) */\n.my-table-component tbody tr:hover td {\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n.flex {\n display: flex;\n}\n\n.justify-end {\n justify-content: flex-end;\n}\n\n.gap-1 {\n gap: 4px;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.align-center {\n align-items: center;\n}\n\n.gap-1 {\n gap: 0.5rem;\n}\n\n.btn {\n color: var(--emw--color-typography, #000);\n background: var(--emw--color-background, #fff);\n font-size: 14px;\n transition: all 0.2s ease;\n}\n.btn:hover {\n cursor: pointer;\n}\n\n.btn:hover {\n background-color: var(--emw--color-gray-100, #e6e6e6);\n}\n\n.btn.disabled {\n opacity: 0.5;\n pointer-events: none;\n}\n.btn.disabled:hover {\n cursor: not-allowed !important;\n}\n\n.LotteryTippingTicketBet__tableToolbar {\n width: 100%;\n margin-bottom: 1rem;\n}\n\n.LotteryTippingTicketBet__tableToolbar--item {\n margin-right: 2rem;\n}\n.LotteryTippingTicketBet__tableToolbar--item.mr-0 {\n margin-right: 0rem !important;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup {\n flex-basis: 2rem;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n border-radius: 8px;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 2rem;\n height: 2rem;\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n color: var(--emw--color-typography, #000);\n border-radius: 8px;\n border: none;\n transition: all 0.2s ease-in-out;\n cursor: pointer;\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item:hover {\n transform: scale(1.1);\n box-shadow: 0 6px 14px var(--emw-calender-curday-box-shadow, rgba(0, 0, 0, 0.09));\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item .icon {\n width: 20px;\n height: 20px;\n transition: filter 0.2s ease-in-out;\n filter: grayscale(0.3);\n}\n\n.LotteryTippingTicketBet__lineOperatorGroup--item:hover .icon {\n filter: grayscale(0);\n transform: rotate(3deg);\n}\n\ndiv.border-line {\n margin-top: 1rem;\n height: 1px;\n width: 100%;\n box-sizing: border-box;\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n transition: all 0.3s ease;\n}\n\n.LotteryTippingTicketBet__footer {\n padding: 0.5rem;\n}\n\n.my-pagination {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 1rem;\n font-size: 0.8rem;\n color: var(--emw--color-typography-secondary, #333);\n}\n\n.my-pagination span {\n font-weight: 500;\n user-select: none;\n}\n\n.my-pagination .btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n border: none;\n transition: all 0.3s ease;\n cursor: pointer;\n opacity: 0.9;\n color: var(--emw--color-typography, #000);\n background-color: var(--emw--color-background-secondary, #f5f5f5);\n}\n\n.my-pagination .btn .icon {\n width: 20px;\n height: 20px;\n transition: transform 0.2s ease;\n}\n\n.my-pagination .btn:hover {\n transform: scale(1.1);\n box-shadow: 0 6px 14px var(--emw-calender-curday-box-shadow, rgba(0, 0, 0, 0.09));\n}\n\n.my-pagination .btn.disabled {\n background-color: var(--emw--color-background-tertiary, #ccc);\n cursor: not-allowed;\n opacity: 0.5;\n transform: scale(1);\n}\n\n.match-info-item {\n display: flex;\n}\n\n.match-info-item-label {\n margin-right: 6px;\n}\n\n.info-icon:hover {\n cursor: pointer;\n}\n\n.LotteryTippingTicketBet__empty p {\n text-align: center;\n}\n\n.no-wrap {\n white-space: nowrap;\n overflow: hidden;\n}\n\n.eventNameContainer__item--title {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 300px;\n}\n@container (max-width: 600px) {\n .eventNameContainer__item--title {\n max-width: 180px;\n }\n}\n@container (max-width: 500px) {\n .eventNameContainer__item--title {\n max-width: 150px;\n }\n}\n@container (max-width: 400px) {\n .eventNameContainer__item--title {\n max-width: 100px;\n }\n}\n@container (max-width: 330px) {\n .eventNameContainer__item--title {\n max-width: 70px;\n }\n}\n\n.LotteryTippingTicketBet__main {\n perspective: 800px;\n will-change: transform, opacity;\n}\n\n@container (max-width: 520px) {\n .LotteryTippingTicketBet__main {\n flex-wrap: wrap;\n justify-content: center;\n }\n .LotteryTippingTicketBet__tableToolbar--item {\n margin-right: 0 !important;\n }\n}\n/* Fade-In Keyframes */\n@keyframes fadeInLeft {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n/* Fade-Out Keyframes */\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n@keyframes fadeInRight {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n@-webkit-keyframes slide-left {\n 0% {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n }\n 100% {\n -webkit-transform: translateX(-100px);\n transform: translateX(-100px);\n }\n}\n@keyframes slide-left {\n 0% {\n -webkit-transform: translateX(100%);\n transform: translateX(100%);\n }\n 100% {\n -webkit-transform: translateX(0px);\n transform: translateX(0px);\n }\n}\n@-webkit-keyframes slide-right {\n 0% {\n -webkit-transform: translateX(-100%);\n transform: translateX(-100%);\n }\n 100% {\n -webkit-transform: translateX(0px);\n transform: translateX(0px);\n }\n}\n@keyframes slide-right {\n 0% {\n -webkit-transform: translateX(-100px);\n transform: translateX(-100px);\n }\n 100% {\n -webkit-transform: translateX(0);\n transform: translateX(0);\n }\n}\n@-webkit-keyframes slide-top {\n 0% {\n -webkit-transform: translateY(-100px);\n transform: translateY(-100px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slide-top {\n 0% {\n -webkit-transform: translateY(-100px);\n transform: translateY(-100px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n/* Apply to your card classes */\n.card-in-left {\n -webkit-animation: slide-left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-left {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.card-in-right {\n -webkit-animation: slide-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-right {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.card-in-up {\n -webkit-animation: slide-top 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slide-top 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n}\n\n.card-out-down {\n animation: fadeOut 0.2s ease-out both;\n}\n\n.loading-wrap {\n margin: 20px 0;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 40vh;\n}\n.loading-wrap .dots-container {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n}\n.loading-wrap .dot {\n height: 14px;\n width: 14px;\n margin-right: 14px;\n border-radius: 14px;\n background-color: var(--emw--color-gray-300, #333);\n animation: pulse 1.5s infinite ease-in-out;\n}\n.loading-wrap .dot:last-child {\n margin-right: 0;\n}\n.loading-wrap .dot:nth-child(1) {\n animation-delay: -0.3s;\n}\n.loading-wrap .dot:nth-child(2) {\n animation-delay: -0.1s;\n}\n.loading-wrap .dot:nth-child(3) {\n animation-delay: 0.1s;\n}\n@keyframes pulse {\n 0% {\n transform: scale(0.8);\n background-color: var(--emw--color-gray-300, #333);\n }\n 50% {\n transform: scale(1.2);\n background-color: var(--emw--color-gray-100, #e6e6e6);\n }\n 100% {\n transform: scale(0.8);\n background-color: var(--emw--color-gray-150, #6f6f6f);\n }\n}\n\n.lottery-selection-group-table-header .lottery-selection__button {\n border: none;\n background: none;\n}";
1922
+ const LotteryTippingBetSlipStyle0 = lotteryTippingBetSlipCss;
1923
+
1924
+ const MyTable = ({ columns, dataSource, hideHead = false, grid = true, bordered = true }) => (index.h("table", { class: { bordered: bordered, grid: grid, 'my-table-component': true } }, !hideHead && (index.h("thead", null, index.h("tr", null, columns.map((column) => {
1925
+ var _a;
1926
+ return (index.h("th", { key: column.value, style: { width: column.width + '%', textAlign: column.align } }, typeof column.title === 'string' ? column.title : (_a = column.title) === null || _a === void 0 ? void 0 : _a.call(column)));
1927
+ })))), index.h("tbody", null, dataSource.map((row, index$1) => (index.h("tr", { key: index$1 }, columns.map((column) => (index.h("td", { key: column.value, style: { width: column.width + '%', textAlign: column.align }, class: { 'no-wrap': column.nowrap } }, column.render ? column.render(row, row[column.value], index$1) : row[column.value])))))))));
1928
+ const LotteryTippingBetSlip = class {
1929
+ constructor(hostRef) {
1930
+ index.registerInstance(this, hostRef);
1931
+ this.selectionChangeHandler = index.createEvent(this, "lotteryTippingBetSelectionChange", 7);
1932
+ this.clearAll = index.createEvent(this, "lotteryTippingBetClearAll", 7);
1933
+ this.addLine = index.createEvent(this, "lotteryTippingBetAddLine", 7);
1934
+ this.removeLine = index.createEvent(this, "lotteryTippingBetRemoveLine", 7);
1935
+ this.pageChange = index.createEvent(this, "lotteryTippingBetPageChange", 7);
1936
+ this.columns = [
1937
+ { title: '', value: 'index', width: 3 },
1938
+ {
1939
+ title: '',
1940
+ value: 'eventName',
1941
+ width: 65,
1942
+ render: (item, value) => this.renderEventName(item, value)
1943
+ },
1944
+ {
1945
+ title: '',
1946
+ value: 'startTime',
1947
+ width: 22,
1948
+ align: 'right',
1949
+ nowrap: true,
1950
+ render: (_, value) => formatDate$1({ date: value, format: 'ccc HH:mm' })
1951
+ },
1952
+ {
1953
+ title: () => (index.h("lottery-selection-group", { language: this.language, "translation-url": this.translationUrl, "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, type: "preview", splitToken: this.bulletTextsSplitToken, "bullet-texts": this.bulletNames, bulletTextType: "text", hasBackground: false, hasBorder: false })),
1954
+ value: 'results',
1955
+ width: 10,
1956
+ render: (_, __, curRow) => (index.h("lottery-selection-group", { language: this.language, "translation-url": this.translationUrl, "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, "mb-source": this.mbSource, selectionGroupId: `${this.currentPage - 1}${this.bulletTextsSplitToken}${curRow}`, type: this.readPretty ? 'preview' : 'bet', "selected-bullet-texts": this.selectedBulletTexts(curRow), "disabled-bullet-texts": this.getBulletDisabledOptions(curRow), "max-selected-count": this.mode === 'single' ? 1 : this.bulletTexts.split(this.bulletTextsSplitToken).length, "bullet-texts": this.bulletTexts, splitToken: this.bulletTextsSplitToken, bulletTextType: "text" }))
1957
+ }
1958
+ ];
1959
+ this.mbSource = undefined;
1960
+ this.clientStyling = undefined;
1961
+ this.clientStylingUrl = undefined;
1962
+ this.translationUrl = '';
1963
+ this.language = 'en';
1964
+ this.totalPages = 1;
1965
+ this.minTotalPages = 1;
1966
+ this.maxTotalPages = 3;
1967
+ this.bulletTexts = '1,X,2';
1968
+ this.bulletNames = 'Home,Draw,Away';
1969
+ this.bulletTextsSplitToken = ',';
1970
+ this.showClearButton = true;
1971
+ this.addImage = renderIconDefinitionToSVGElement(PlusSquareOutlined$1, {
1972
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
1973
+ });
1974
+ this.deleteImage = renderIconDefinitionToSVGElement(DeleteOutlined$1, {
1975
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
1976
+ });
1977
+ this.infoImage = renderIconDefinitionToSVGElement(InfoCircleOutlined$1, {
1978
+ extraSVGAttrs: { width: '16px', height: '16px', fill: 'currentColor' }
1979
+ });
1980
+ this.leftImage = renderIconDefinitionToSVGElement(LeftOutlined$1, {
1981
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
1982
+ });
1983
+ this.rightImage = renderIconDefinitionToSVGElement(RightOutlined$1, {
1984
+ extraSVGAttrs: { width: '20px', height: '20px', fill: 'currentColor' }
1985
+ });
1986
+ this.mode = 'multi';
1987
+ this.readPretty = false;
1988
+ this.ticketDataSourceStr = '[]';
1989
+ this.bulletSelectionsLineGroupStr = '[]';
1990
+ this.currentPage = 1;
1991
+ this.bulletSelectionsLineGroup = [];
1992
+ this.ticketDataSource = [];
1993
+ this.betIsLoading = false;
1994
+ this.betHasErrors = false;
1995
+ }
1996
+ renderEventName(_, value) {
1997
+ const [homeName, awayName] = value.split(' vs ');
1998
+ return (index.h("div", { class: "flex gap-1 eventNameContainer__item" }, index.h("span", { class: "eventNameContainer__item--title" }, value), index.h("app-tooltip", null, index.h("span", { slot: "trigger", class: "icon info-icon", innerHTML: this.infoImage, style: { width: '18px' } }), index.h("div", { slot: "content" }, index.h("div", { class: "match-info" }, index.h("div", { class: "match-info-item" }, index.h("div", { class: "match-info-item-label" }, translate$6('homeTeam', this.language)), index.h("div", { class: "match-info-item-value" }, homeName)), index.h("div", { class: "match-info-item" }, index.h("div", { class: "match-info-item-label" }, translate$6('awayTeam', this.language)), index.h("div", { class: "match-info-item-value" }, awayName)))))));
1999
+ }
2000
+ selectedBulletTexts(curRow) {
2001
+ var _a, _b, _c;
2002
+ return ((_c = (_b = (_a = this.bulletSelectionsLineGroup) === null || _a === void 0 ? void 0 : _a[this.currentPage - 1]) === null || _b === void 0 ? void 0 : _b[curRow]) === null || _c === void 0 ? void 0 : _c.join(this.bulletTextsSplitToken)) || '';
2003
+ }
2004
+ getBulletDisabledOptions(curRow) {
2005
+ const { outcomes } = this.ticketDataSource[curRow];
2006
+ const curActiveOptions = outcomes.map((ev) => ev.betOn);
2007
+ const bulletText = this.bulletTexts.split(this.bulletTextsSplitToken);
2008
+ const disabledOptions = bulletText.filter((bullet) => !curActiveOptions.includes(bullet));
2009
+ return disabledOptions.join(this.bulletTextsSplitToken);
2010
+ }
2011
+ handleNewTranslations() {
2012
+ resolveTranslationUrl$3(this.translationUrl);
2013
+ }
2014
+ handleClientStylingChange(newValue, oldValue) {
2015
+ if (newValue != oldValue) {
2016
+ lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
2017
+ }
2018
+ }
2019
+ handleClientStylingUrlChange(newValue, oldValue) {
2020
+ if (newValue != oldValue) {
2021
+ lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2022
+ }
2023
+ }
2024
+ handleMbSourceChange(newValue, oldValue) {
2025
+ if (newValue != oldValue) {
2026
+ lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2027
+ }
2028
+ }
2029
+ parseTicketDataSource(newValue) {
2030
+ try {
2031
+ this.ticketDataSource = JSON.parse(newValue || '[]');
2032
+ }
2033
+ catch (e) {
2034
+ console.error('Failed to parse ticketDataSourceStr:', e);
2035
+ }
2036
+ }
2037
+ parseBulletSelectionsLineGroup(newValue) {
2038
+ try {
2039
+ this.bulletSelectionsLineGroup = JSON.parse(newValue || '[]');
2040
+ }
2041
+ catch (e) {
2042
+ console.error('Failed to parse bulletSelectionsLineGroupStr:', e);
2043
+ }
2044
+ }
2045
+ connectedCallback() {
2046
+ this.boundMessageHandler = this.messageHandler.bind(this);
2047
+ window.addEventListener('message', this.boundMessageHandler);
2048
+ }
2049
+ disconnectedCallback() {
2050
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2051
+ if (this.boundMessageHandler) {
2052
+ window.removeEventListener('message', this.boundMessageHandler);
2053
+ }
2054
+ }
2055
+ messageHandler() {
2056
+ // This handler can be kept for other potential messages, or removed if no longer needed.
2057
+ }
2058
+ componentWillLoad() {
2059
+ resolveTranslationUrl$3(this.translationUrl);
2060
+ this.parseTicketDataSource(this.ticketDataSourceStr);
2061
+ this.parseBulletSelectionsLineGroup(this.bulletSelectionsLineGroupStr);
2062
+ }
2063
+ componentDidLoad() {
2064
+ if (this.stylingContainer) {
2065
+ if (this.mbSource)
2066
+ lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2067
+ if (this.clientStyling)
2068
+ lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
2069
+ if (this.clientStylingUrl)
2070
+ lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2071
+ }
2072
+ }
2073
+ handleClearAll() {
2074
+ this.clearAll.emit();
2075
+ }
2076
+ bulletGroupUpdateSelectionHandler(event) {
2077
+ event.stopPropagation();
2078
+ const { newSelectedBulletTexts, selectionGroupId } = event.detail;
2079
+ if (!selectionGroupId) {
2080
+ console.error('Miss selectionGroupId');
2081
+ return;
2082
+ }
2083
+ const idParts = selectionGroupId.split(this.bulletTextsSplitToken);
2084
+ if (idParts.length !== 2) {
2085
+ console.error('Invalid selectionGroupId format:', selectionGroupId);
2086
+ return;
2087
+ }
2088
+ const [boardId, matchId] = idParts;
2089
+ this.selectionChangeHandler.emit({
2090
+ newSelections: newSelectedBulletTexts.split(this.bulletTextsSplitToken),
2091
+ matchId,
2092
+ boardId
2093
+ });
2094
+ }
2095
+ prevPage() {
2096
+ const doPrev = () => {
2097
+ this.pageChange.emit({ newPage: this.currentPage - 1 });
2098
+ };
2099
+ this.swapCard('prev', doPrev);
2100
+ }
2101
+ nextPage() {
2102
+ const doNext = () => {
2103
+ this.pageChange.emit({ newPage: this.currentPage + 1 });
2104
+ };
2105
+ this.swapCard('next', doNext);
2106
+ }
2107
+ handleAddLine() {
2108
+ const doAdd = () => {
2109
+ this.addLine.emit();
2110
+ };
2111
+ this.swapCard('add', doAdd);
2112
+ }
2113
+ handleRemoveLine() {
2114
+ this.removeLine.emit({
2115
+ boardId: this.currentPage - 1,
2116
+ close: (onClose) => {
2117
+ onClose && this.swapCard('remove', onClose);
2118
+ }
2119
+ });
2120
+ }
2121
+ swapCard(action, cb) {
2122
+ const wrapper = this.mainContainer;
2123
+ if (!wrapper)
2124
+ return;
2125
+ // Prevent new animations if one is already in progress
2126
+ const isAnimating = Array.from(wrapper.classList).some((cls) => cls.startsWith('card-out-') || cls.startsWith('card-in-'));
2127
+ if (isAnimating) {
2128
+ return;
2129
+ }
2130
+ const map = {
2131
+ next: { out: 'card-out-left', in: 'card-in-left' },
2132
+ prev: { out: 'card-out-right', in: 'card-in-right' },
2133
+ remove: { out: 'card-out-down', in: 'card-in-right' },
2134
+ add: { out: 'card-out-left', in: 'card-in-up' }
2135
+ };
2136
+ const { out: outCls, in: inCls } = map[action];
2137
+ wrapper.classList.add(outCls);
2138
+ wrapper.addEventListener('animationend', () => {
2139
+ wrapper.classList.remove(outCls);
2140
+ cb();
2141
+ const newWrapper = this.mainContainer;
2142
+ if (!newWrapper)
2143
+ return;
2144
+ newWrapper.classList.add(inCls);
2145
+ newWrapper.addEventListener('animationend', () => newWrapper.classList.remove(inCls), { once: true });
2146
+ }, { once: true });
2147
+ }
2148
+ renderLoading() {
2149
+ return (index.h("div", { class: "loading-wrap" }, index.h("section", { class: "dots-container" }, index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }), index.h("div", { class: "dot" }))));
2150
+ }
2151
+ renderErrorContent() {
2152
+ return index.h("p", null, translate$6('error', this.language));
2153
+ }
2154
+ renderEmptyContent() {
2155
+ return (index.h("div", { class: "LotteryTippingTicketBet__empty" }, index.h("p", null, translate$6('noData', this.language))));
2156
+ }
2157
+ renderPageFooter() {
2158
+ if (this.totalPages <= 1)
2159
+ return null;
2160
+ return (index.h("div", null, index.h("div", { class: 'border-line' }), index.h("div", { class: "LotteryTippingTicketBet__footer" }, index.h("div", { class: "my-pagination flex justify-between" }, index.h("span", null, translate$6('lineInfo', this.language, { currentPage: this.currentPage, totalPages: this.totalPages })), index.h("div", { class: 'flex gap-1' }, index.h("button", { type: "button", class: `btn ${this.currentPage === 1 ? 'disabled' : ''}`, onClick: () => this.prevPage(), disabled: this.currentPage === 1 }, index.h("span", { class: "icon", innerHTML: this.leftImage })), index.h("button", { type: "button", class: `btn ${this.currentPage === this.totalPages ? 'disabled' : ''}`, onClick: () => this.nextPage(), disabled: this.currentPage === this.totalPages }, index.h("span", { class: "icon", innerHTML: this.rightImage })))))));
2161
+ }
2162
+ renderReadPrettyContent() {
2163
+ var _a;
2164
+ return (index.h("div", { class: "LotteryTippingTicketBet__main", ref: (el) => (this.mainContainer = el) }, index.h("div", { class: "table-scroll-wrapper" }, index.h(MyTable, { columns: this.columns, dataSource: ((_a = this.ticketDataSource) === null || _a === void 0 ? void 0 : _a.map((item, index) => (Object.assign(Object.assign({}, item), { index: index + 1 })))) || [], hideHead: false, grid: false, bordered: false })), this.renderPageFooter()));
2165
+ }
2166
+ renderDefaultContent() {
2167
+ var _a;
2168
+ const lineOperatorAddShow = this.totalPages < this.maxTotalPages && this.currentPage === this.totalPages ? true : false;
2169
+ const lineOperatorRemoveShow = this.totalPages > this.minTotalPages ? true : false;
2170
+ return (index.h("div", null, index.h("div", { class: "LotteryTippingTicketBet__tableToolbar flex justify-end gap-1" }, this.showClearButton && (index.h("lottery-button", { class: {
2171
+ 'LotteryTippingTicketBet__tableToolbar--item': true,
2172
+ 'mr-0': !(lineOperatorAddShow || lineOperatorRemoveShow)
2173
+ }, text: translate$6('clearAll', this.language), onClick: () => this.handleClearAll(), variant: "text", clientStyling: this.clientStyling || '' }))), index.h("div", { class: "flex align-center LotteryTippingTicketBet__main", ref: (el) => (this.mainContainer = el) }, index.h("div", { class: "table-scroll-wrapper" }, index.h(MyTable, { columns: this.columns, dataSource: ((_a = this.ticketDataSource) === null || _a === void 0 ? void 0 : _a.map((item, index) => (Object.assign(Object.assign({}, item), { index: index + 1 })))) || [], hideHead: false, grid: false, bordered: false })), (lineOperatorAddShow || lineOperatorRemoveShow) && (index.h("div", { class: "LotteryTippingTicketBet__lineOperatorGroup" }, lineOperatorAddShow && (index.h("button", { type: "button", class: {
2174
+ 'LotteryTippingTicketBet__lineOperatorGroup--item': true
2175
+ }, onClick: () => this.handleAddLine() }, index.h("span", { class: "icon", innerHTML: this.addImage }))), lineOperatorRemoveShow && (index.h("button", { type: "button", class: {
2176
+ 'LotteryTippingTicketBet__lineOperatorGroup--item': true
2177
+ }, onClick: () => this.handleRemoveLine() }, index.h("span", { class: "icon", innerHTML: this.deleteImage })))))), this.renderPageFooter()));
2178
+ }
2179
+ render() {
2180
+ let content;
2181
+ if (this.betIsLoading) {
2182
+ content = this.renderLoading();
2183
+ }
2184
+ else if (this.betHasErrors) {
2185
+ content = this.renderErrorContent();
2186
+ }
2187
+ else if (this.ticketDataSource.length === 0) {
2188
+ content = this.renderEmptyContent();
2189
+ }
2190
+ else if (this.readPretty) {
2191
+ content = this.renderReadPrettyContent();
2192
+ }
2193
+ else {
2194
+ content = this.renderDefaultContent();
2195
+ }
2196
+ return (index.h("div", { key: '425f7f3d185616af3189857a9159868e3c57f100', ref: (el) => (this.stylingContainer = el), class: "LotteryTippingTicketBet__container" }, content));
2197
+ }
2198
+ static get watchers() { return {
2199
+ "translationUrl": ["handleNewTranslations"],
2200
+ "clientStyling": ["handleClientStylingChange"],
2201
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2202
+ "mbSource": ["handleMbSourceChange"],
2203
+ "ticketDataSourceStr": ["parseTicketDataSource"],
2204
+ "bulletSelectionsLineGroupStr": ["parseBulletSelectionsLineGroup"]
2205
+ }; }
2206
+ };
2207
+ LotteryTippingBetSlip.style = LotteryTippingBetSlipStyle0;
2208
+
2209
+ const lotteryTippingBulletCss = ".LotteryTippingBullet__segment{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;font-size:16px;line-height:1;font-weight:500;color:var(--emw--color-typography, #000);background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-gray-100, #e6e6e6);border-radius:6px;cursor:pointer;transition:all 0.2s ease;user-select:none}.LotteryTippingBullet__segment:not(.LotteryTippingBullet__segment--disabled):hover{cursor:pointer;animation:jelly 0.3s ease-in-out;transform:scale(1.02)}.LotteryTippingBullet__segment--text{border:none;color:var(--emw--color-typography, #000);background:transparent;font-weight:400}.LotteryTippingBullet__segment--text:hover{cursor:not-allowed !important}.LotteryTippingBullet__segment--active{font-weight:600;background-color:var(--emw--color-background-inverse, #000);color:var(--emw--color-primary, #fed275)}.LotteryTippingBullet__segment--disabled:not(.LotteryTippingBullet__segment--active){background-color:var(--emw--color-background-tertiary, #ccc);color:var(--emw--color-gray-150, #6f6f6f);border-color:var(--emw--color-gray-100, #e6e6e6)}.LotteryTippingBullet__segment--disabled:hover{cursor:not-allowed}@keyframes jelly{0%{transform:translate(0, 0)}20%{transform:translate(-0.5px, -0.5px)}40%{transform:translate(0.5px, 0.5px)}60%{transform:translate(-0.25px, -0.25px)}80%{transform:translate(0.25px, 0.25px)}100%{transform:translate(0, 0)}}";
2210
+ const LotteryTippingBulletStyle0 = lotteryTippingBulletCss;
2211
+
2212
+ const LotteryTippingBullet = class {
2213
+ constructor(hostRef) {
2214
+ index.registerInstance(this, hostRef);
2215
+ this.lotteryTippingBulletToggleEvent = index.createEvent(this, "lotteryTippingBulletToggle", 7);
2216
+ this.mbSource = undefined;
2217
+ this.clientStyling = undefined;
2218
+ this.clientStylingUrl = undefined;
2219
+ this.positionIdx = undefined;
2220
+ this.theme = 'default';
2221
+ this.value = '';
2222
+ this.disabled = false;
2223
+ this.isSelected = false;
2224
+ }
2225
+ handleClientStylingChange(newValue, oldValue) {
2226
+ if (newValue != oldValue) {
2227
+ lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
2228
+ }
2229
+ }
2230
+ handleClientStylingUrlChange(newValue, oldValue) {
2231
+ if (newValue != oldValue) {
2232
+ lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2233
+ }
2234
+ }
2235
+ handleMbSourceChange(newValue, oldValue) {
2236
+ if (newValue != oldValue) {
2237
+ lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2238
+ }
2239
+ }
2240
+ componentDidLoad() {
2241
+ if (this.stylingContainer) {
2242
+ if (this.mbSource)
2243
+ lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2244
+ if (this.clientStyling)
2245
+ lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
2246
+ if (this.clientStylingUrl)
2247
+ lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2248
+ }
2249
+ }
2250
+ handleClick() {
2251
+ if (!this.disabled) {
2252
+ this.lotteryTippingBulletToggleEvent.emit({ positionIdx: this.positionIdx });
2253
+ }
2254
+ }
2255
+ disconnectedCallback() {
2256
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2257
+ }
2258
+ render() {
2259
+ return (index.h("div", { key: 'ef0fee38ed62adb7809b5a60668af6a499ebe5a6', ref: (el) => (this.stylingContainer = el) }, this.theme === 'text' ? (index.h("div", { class: {
2260
+ LotteryTippingBullet__segment: true,
2261
+ 'LotteryTippingBullet__segment--text': true
2262
+ } }, this.value)) : (index.h("button", { class: {
2263
+ LotteryTippingBullet__segment: true,
2264
+ 'LotteryTippingBullet__segment--disabled': this.disabled,
2265
+ 'LotteryTippingBullet__segment--active': this.isSelected
2266
+ }, onClick: this.handleClick.bind(this) }, this.isSelected ? 'X' : this.value))));
2267
+ }
2268
+ static get watchers() { return {
2269
+ "clientStyling": ["handleClientStylingChange"],
2270
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2271
+ "mbSource": ["handleMbSourceChange"]
2272
+ }; }
2273
+ };
2274
+ LotteryTippingBullet.style = LotteryTippingBulletStyle0;
2275
+
2276
+ const lotteryTippingBulletGroupCss = "";
2277
+ const LotteryTippingBulletGroupStyle0 = lotteryTippingBulletGroupCss;
2278
+
2279
+ const LotteryTippingBulletGroup = class {
2280
+ constructor(hostRef) {
2281
+ index.registerInstance(this, hostRef);
2282
+ this.lotteryTippingBulletGroupToggleEvent = index.createEvent(this, "lotteryTippingBulletGroupToggle", 7);
2283
+ this.mbSource = undefined;
2284
+ this.clientStyling = undefined;
2285
+ this.clientStylingUrl = undefined;
2286
+ this.positionIdx = undefined;
2287
+ this.theme = 'default';
2288
+ this.mode = 'single';
2289
+ this.bulletConfigContent = '';
2290
+ }
2291
+ get bulletConfigArr() {
2292
+ const defaultConfig = [
2293
+ {
2294
+ value: '1'
2295
+ },
2296
+ {
2297
+ value: 'X'
2298
+ },
2299
+ {
2300
+ value: '2'
2301
+ }
2302
+ ];
2303
+ if (typeof this.bulletConfigContent === 'string' && this.bulletConfigContent) {
2304
+ try {
2305
+ const _temp = JSON.parse(this.bulletConfigContent);
2306
+ return _temp;
2307
+ }
2308
+ catch (e) {
2309
+ console.error('Error parsing bulletConfigContent:', e);
2310
+ return defaultConfig;
2311
+ }
2312
+ }
2313
+ else {
2314
+ return defaultConfig;
2315
+ }
2316
+ }
2317
+ handleClientStylingChange(newValue, oldValue) {
2318
+ if (newValue != oldValue) {
2319
+ lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
2320
+ }
2321
+ }
2322
+ handleClientStylingUrlChange(newValue, oldValue) {
2323
+ if (newValue != oldValue) {
2324
+ lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2325
+ }
2326
+ }
2327
+ handleMbSourceChange(newValue, oldValue) {
2328
+ if (newValue != oldValue) {
2329
+ lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2330
+ }
2331
+ }
2332
+ componentDidLoad() {
2333
+ if (this.stylingContainer) {
2334
+ if (this.mbSource)
2335
+ lotteryTippingEntrance.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
2336
+ if (this.clientStyling)
2337
+ lotteryTippingEntrance.setClientStyling(this.stylingContainer, this.clientStyling);
2338
+ if (this.clientStylingUrl)
2339
+ lotteryTippingEntrance.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
2340
+ }
2341
+ }
2342
+ disconnectedCallback() {
2343
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
2344
+ }
2345
+ lotteryTippingBulletSelectionHandler(event) {
2346
+ const { positionIdx } = event.detail;
2347
+ this.handleToggle(positionIdx);
2348
+ }
2349
+ handleToggle(index) {
2350
+ let newConfigArr = [...this.bulletConfigArr];
2351
+ if (this.mode === 'single') {
2352
+ // single mode: only one button can be selected
2353
+ newConfigArr = newConfigArr.map((item) => (Object.assign(Object.assign({}, item), { isSelected: false })));
2354
+ newConfigArr[index].isSelected = true;
2355
+ }
2356
+ else {
2357
+ // multi mode: multiple buttons can be selected
2358
+ newConfigArr = newConfigArr.map((item) => (Object.assign({}, item)));
2359
+ newConfigArr[index].isSelected = !newConfigArr[index].isSelected;
2360
+ }
2361
+ this.lotteryTippingBulletGroupToggleEvent.emit({
2362
+ bulletConfigArr: newConfigArr,
2363
+ positionIdx: this.positionIdx + '-' + index
2364
+ });
2365
+ }
2366
+ render() {
2367
+ var _a;
2368
+ return (index.h("div", { ref: (el) => (this.stylingContainer = el), key: this.positionIdx }, index.h("div", { key: '68223022eed831932c571378164be913206d98e9', style: { display: 'flex', flexDirection: 'row', gap: '10px' } }, (_a = this.bulletConfigArr) === null || _a === void 0 ? void 0 : _a.map((item, index$1) => (index.h("div", { key: index$1 }, index.h("lottery-tipping-bullet", { value: item.value, isSelected: item.isSelected, "position-idx": index$1, disabled: item.disabled, theme: this.theme, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource })))))));
2369
+ }
2370
+ static get watchers() { return {
2371
+ "clientStyling": ["handleClientStylingChange"],
2372
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
2373
+ "mbSource": ["handleMbSourceChange"]
2374
+ }; }
2375
+ };
2376
+ LotteryTippingBulletGroup.style = LotteryTippingBulletGroupStyle0;
2377
+
2378
+ const DEFAULT_LANGUAGE$5 = 'en';
2379
+ const SUPPORTED_LANGUAGES$5 = ['ro', 'en', 'fr', 'ar', 'hr'];
2380
+ const TRANSLATIONS$5 = {
2381
+ en: {
2382
+ weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
2383
+ bettingType: 'Betting Type:',
2384
+ prizeAllocation: 'Prize Allocation (Turnover: {turnover})',
2385
+ prizes: 'Prizes',
2386
+ numberOfWinners: 'Number of Winners',
2387
+ prizeMoney: 'Prize Money',
2388
+ noLatestResult: 'No latest result.',
2389
+ loading: 'Loading....'
2390
+ },
2391
+ ro: {
2392
+ bettingType: 'Tip de pariu:',
2393
+ prizeAllocation: 'Alocarea premiilor (Cifră de afaceri: €{turnover})',
2394
+ prizes: 'Premii',
2395
+ numberOfWinners: 'Număr de câștigători',
2396
+ prizeMoney: 'Bani de premiu',
2397
+ noLatestResult: 'Niciun rezultat recent.',
2398
+ loading: 'Se încarcă....'
2399
+ },
2400
+ fr: {
2401
+ bettingType: 'Type de pari:',
2402
+ prizeAllocation: "Répartition des prix (Chiffre d'affaires: € {turnover})",
2403
+ prizes: 'Prix',
2404
+ numberOfWinners: 'Nombre de gagnants',
2405
+ prizeMoney: 'Prix en argent',
2406
+ noLatestResult: 'Aucun résultat récent.',
2407
+ loading: 'Chargement....'
2408
+ },
2409
+ ar: {
2410
+ bettingType: 'نوع الرهان:',
2411
+ prizeAllocation: 'تخصيص الجائزة (دوران: € {turnover})',
2412
+ prizes: 'الجوائز',
2413
+ numberOfWinners: 'عدد الفائزين',
2414
+ prizeMoney: 'أموال الجائزة',
2415
+ noLatestResult: 'لا يوجد أحدث نتيجة.',
2416
+ loading: 'جار التحميل....'
2417
+ },
2418
+ hr: {
2419
+ bettingType: 'Vrsta oklade:',
2420
+ prizeAllocation: 'Raspodjela nagrada (Promet: € {turnover})',
1224
2421
  prizes: 'Nagrade',
1225
2422
  numberOfWinners: 'Broj pobjednika',
1226
2423
  prizeMoney: 'Novčana nagrada',
@@ -1822,7 +3019,7 @@ var DrawStatusEnum;
1822
3019
  DrawStatusEnum["CANCELED"] = "CANCELED";
1823
3020
  })(DrawStatusEnum || (DrawStatusEnum = {}));
1824
3021
 
1825
- const generateUUID$3 = () => {
3022
+ const generateUUID$2 = () => {
1826
3023
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
1827
3024
  var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
1828
3025
  return v.toString(16);
@@ -1830,7 +3027,7 @@ const generateUUID$3 = () => {
1830
3027
  };
1831
3028
  function fetchRequest$2(url, method = 'GET', body = null, headers = {}) {
1832
3029
  return new Promise((resolve, reject) => {
1833
- const uuid = generateUUID$3();
3030
+ const uuid = generateUUID$2();
1834
3031
  const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
1835
3032
  if (method !== 'GET' && method !== 'HEAD') {
1836
3033
  headersOrigin['X-Idempotency-Key'] = uuid;
@@ -1857,14 +3054,14 @@ function fetchRequest$2(url, method = 'GET', body = null, headers = {}) {
1857
3054
  .catch((error) => reject(error));
1858
3055
  });
1859
3056
  }
1860
- function isEmptyValueOfArray$1(arr) {
3057
+ function isEmptyValueOfArray$2(arr) {
1861
3058
  if (arr.length === 0) {
1862
3059
  return true;
1863
3060
  }
1864
3061
  const len = arr.length;
1865
3062
  let count = 0;
1866
3063
  for (let i = 0; i < len; i++) {
1867
- if (isEmptyValue$1(arr[i])) {
3064
+ if (isEmptyValue$2(arr[i])) {
1868
3065
  count++;
1869
3066
  }
1870
3067
  else {
@@ -1876,14 +3073,14 @@ function isEmptyValueOfArray$1(arr) {
1876
3073
  }
1877
3074
  return false;
1878
3075
  }
1879
- function isEmptyValueOfObject$1(obj) {
3076
+ function isEmptyValueOfObject$2(obj) {
1880
3077
  if (Object.keys(obj).length === 0) {
1881
3078
  return true;
1882
3079
  }
1883
3080
  const len = Object.keys(obj).length;
1884
3081
  let count = 0;
1885
3082
  for (const val of Object.values(obj)) {
1886
- if (isEmptyValue$1(val)) {
3083
+ if (isEmptyValue$2(val)) {
1887
3084
  count++;
1888
3085
  }
1889
3086
  else {
@@ -1895,7 +3092,7 @@ function isEmptyValueOfObject$1(obj) {
1895
3092
  }
1896
3093
  return false;
1897
3094
  }
1898
- function isEmptyValue$1(value, allowZero) {
3095
+ function isEmptyValue$2(value, allowZero) {
1899
3096
  if (value === null || value === undefined || value === '') {
1900
3097
  return true;
1901
3098
  }
@@ -1903,19 +3100,19 @@ function isEmptyValue$1(value, allowZero) {
1903
3100
  return false;
1904
3101
  }
1905
3102
  else if (Array.isArray(value)) {
1906
- return isEmptyValueOfArray$1(value);
3103
+ return isEmptyValueOfArray$2(value);
1907
3104
  }
1908
3105
  else if (Object.prototype.toString.call(value) === '[object Object]') {
1909
- return isEmptyValueOfObject$1(value);
3106
+ return isEmptyValueOfObject$2(value);
1910
3107
  }
1911
3108
  else {
1912
3109
  return !value;
1913
3110
  }
1914
3111
  }
1915
- function toQueryParams$1(params) {
3112
+ function toQueryParams$2(params) {
1916
3113
  const finalParams = {};
1917
3114
  Object.entries(params).forEach(([key, value]) => {
1918
- if (!isEmptyValue$1(value, true)) {
3115
+ if (!isEmptyValue$2(value, true)) {
1919
3116
  finalParams[key] = value;
1920
3117
  }
1921
3118
  });
@@ -2108,7 +3305,7 @@ const LotteryTippingLatestResult = class {
2108
3305
  try {
2109
3306
  const GAME_DRAW_LIMIT = 9999;
2110
3307
  const filterData = { status: [DrawStatusEnum.PAYABLE, DrawStatusEnum.CLOSED], limit: GAME_DRAW_LIMIT };
2111
- const { items } = await fetchRequest$2(`${this.endpoint}/games/${this.gameId}/draws${toQueryParams$1(filterData)}`, 'GET');
3308
+ const { items } = await fetchRequest$2(`${this.endpoint}/games/${this.gameId}/draws${toQueryParams$2(filterData)}`, 'GET');
2112
3309
  if (!items || items.length === 0)
2113
3310
  return;
2114
3311
  const filteredItems = items;
@@ -2245,7 +3442,9 @@ const TRANSLATIONS$2 = {
2245
3442
  en: {
2246
3443
  buyTickets: 'Buy Tickets',
2247
3444
  myTickets: 'My Tickets',
2248
- logout: 'Log out'
3445
+ logout: 'Log out',
3446
+ ticketSubmitted: 'Ticket submitted successfully.',
3447
+ ticketFailed: 'Failed to submit tickets.'
2249
3448
  },
2250
3449
  ro: {
2251
3450
  buyTickets: 'Cumpără bilete',
@@ -2295,12 +3494,21 @@ const resolveTranslationUrl$1 = async (translationUrl) => {
2295
3494
  }
2296
3495
  };
2297
3496
 
3497
+ const showNotification$2 = ({ message, theme = 'success' }) => {
3498
+ window.postMessage({
3499
+ type: 'ShowNotificationToast',
3500
+ message,
3501
+ theme
3502
+ });
3503
+ };
3504
+
2298
3505
  const lotteryTippingPageCss = ".lottery-tipping-page {\n container-type: inline-size;\n background: var(--emw--color-background, #fff);\n}\n.lottery-tipping-page-header {\n height: 56px;\n padding: 8px 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.lottery-tipping-page-header-operation {\n display: flex;\n gap: 14px;\n align-items: center;\n}\n.lottery-tipping-page-header .tab-btns {\n display: flex;\n align-items: center;\n gap: 40px;\n flex: 1;\n justify-content: center;\n}\n.lottery-tipping-page-header .tab-btn {\n padding: 0 8px;\n line-height: 40px;\n font-size: 16px;\n cursor: pointer;\n font-weight: 600;\n height: 40px;\n border: 2px solid var(--emw--color-primary, #fed275);\n border-radius: 8px;\n color: var(--emw--color-typography, #000);\n transition: all 0.2s linear;\n}\n.lottery-tipping-page-header .tab-btn.active {\n background-color: var(--emw--color-primary, #fed275);\n color: var(--emw--color-typography, #000);\n border: 1px solid var(--emw--color-typography, #000);\n}\n\n@container (min-width: 1200px) {\n .tab-btns {\n gap: 40px;\n }\n}\n@container (max-width: 480px) {\n .tab-btns {\n gap: 24px;\n }\n}";
2299
3506
  const LotteryTippingPageStyle0 = lotteryTippingPageCss;
2300
3507
 
2301
3508
  const LotteryTippingPage = class {
2302
3509
  constructor(hostRef) {
2303
3510
  index.registerInstance(this, hostRef);
3511
+ this.logoutEventHandler = index.createEvent(this, "logout", 7);
2304
3512
  this.handleTabClick = (tab) => {
2305
3513
  this.activeTab = tab;
2306
3514
  };
@@ -2351,6 +3559,15 @@ const LotteryTippingPage = class {
2351
3559
  this.stylingSubscription.unsubscribe();
2352
3560
  }
2353
3561
  }
3562
+ handleSessionExpired() {
3563
+ this.logoutEventHandler.emit();
3564
+ }
3565
+ handleLotteryTicketSubmitSuccess() {
3566
+ showNotification$2({ message: translate$2('ticketSubmitted', this.language), theme: 'success' });
3567
+ }
3568
+ handleLotteryTicketSubmitError() {
3569
+ showNotification$2({ message: translate$2('ticketFailed', this.language), theme: 'error' });
3570
+ }
2354
3571
  renderTabs() {
2355
3572
  const tabOptions = {
2356
3573
  [Tab.BuyTickets]: translate$2('buyTickets', this.language),
@@ -2360,7 +3577,7 @@ const LotteryTippingPage = class {
2360
3577
  }
2361
3578
  renderContent() {
2362
3579
  if (this.activeTab === Tab.BuyTickets) {
2363
- return (index.h("lottery-tipping-ticket-controller", { endpoint: this.endpoint, gameId: this.gameId, playerId: this.playerId, sessionId: this.sessionId, drawId: this.drawId, language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "translation-url": this.translationUrl }));
3580
+ return (index.h("lottery-tipping-ticket-buy", { endpoint: this.endpoint, gameId: this.gameId, drawId: this.drawId, sessionId: this.sessionId, language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "translation-url": this.translationUrl }));
2364
3581
  }
2365
3582
  if (this.activeTab === Tab.MyTickets) {
2366
3583
  return (index.h("lottery-tipping-ticket-history", { endpoint: this.endpoint, gameId: this.gameId, playerId: this.playerId, sessionId: this.sessionId, drawId: this.drawId, language: this.language, "mb-source": this.mbSource, "client-styling-url": this.clientStylingUrl, "client-styling": this.clientStyling, "translation-url": this.translationUrl }));
@@ -2368,7 +3585,7 @@ const LotteryTippingPage = class {
2368
3585
  return null;
2369
3586
  }
2370
3587
  render() {
2371
- return (index.h("div", { key: '62f666e26682d4a8cb26060e5ac9d84f4e60d55c', class: "lottery-tipping-page", ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: 'ea4e9581c9c5ad1b472c2caafba6c4fd84015cb9', class: "lottery-tipping-page-header" }, index.h("slot", { key: 'af74e6981a1912f2c53ece0990b301717c9dc4ab', name: "backBtn" }), this.renderTabs(), index.h("div", { key: '81675f34303260b406b5ba1588db43512d0ed162', class: "lottery-tipping-page-header-operation" }, index.h("slot", { key: '0e64913427a2937695ecc30446a784f510e68f70', name: "themeBtn" }), index.h("slot", { key: 'ca9c5405531466fb7f40b3b419ab264f3aa75f2d', name: "logoutBtn" }))), index.h("div", { key: 'fc231b87b57bedb3e8115d8bf0b1945390b53a3b', class: "lottery-tipping-content" }, this.renderContent())));
3588
+ return (index.h("div", { key: '3bd9dd7b474837c833638dca71b935abed471535', class: "lottery-tipping-page", ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '1cae9cf33d43f12d7d7c3e0e9a4e2ba7fbc1c49a', class: "lottery-tipping-page-header" }, index.h("slot", { key: '6c284581461a0be882eaa2c88eeb132238ecd78a', name: "backBtn" }), this.renderTabs(), index.h("div", { key: 'aac3e8563cb62650d405bbce9e76e53ca2eadade', class: "lottery-tipping-page-header-operation" }, index.h("slot", { key: 'd7f62cdc830f8c7dadc21527105de192ea3ae8ce', name: "themeBtn" }), index.h("slot", { key: 'c9090f6cb71d963fde1ea878cff2d3d682f1c752', name: "logoutBtn" }))), index.h("div", { key: '45f22f9e171d3c28c2604a48efe894a8d85389ae', class: "lottery-tipping-content" }, this.renderContent())));
2372
3589
  }
2373
3590
  static get watchers() { return {
2374
3591
  "clientStyling": ["handleClientStylingChange"],
@@ -2378,7 +3595,7 @@ const LotteryTippingPage = class {
2378
3595
  };
2379
3596
  LotteryTippingPage.style = LotteryTippingPageStyle0;
2380
3597
 
2381
- const generateUUID$2 = () => {
3598
+ const generateUUID$1 = () => {
2382
3599
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
2383
3600
  var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
2384
3601
  return v.toString(16);
@@ -2386,7 +3603,7 @@ const generateUUID$2 = () => {
2386
3603
  };
2387
3604
  function fetchRequest$1(url, method = 'GET', body = null, headers = {}) {
2388
3605
  return new Promise((resolve, reject) => {
2389
- const uuid = generateUUID$2();
3606
+ const uuid = generateUUID$1();
2390
3607
  const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
2391
3608
  if (method !== 'GET' && method !== 'HEAD') {
2392
3609
  headersOrigin['X-Idempotency-Key'] = uuid;
@@ -2413,14 +3630,14 @@ function fetchRequest$1(url, method = 'GET', body = null, headers = {}) {
2413
3630
  .catch((error) => reject(error));
2414
3631
  });
2415
3632
  }
2416
- function isEmptyValueOfArray(arr) {
3633
+ function isEmptyValueOfArray$1(arr) {
2417
3634
  if (arr.length === 0) {
2418
3635
  return true;
2419
3636
  }
2420
3637
  const len = arr.length;
2421
3638
  let count = 0;
2422
3639
  for (let i = 0; i < len; i++) {
2423
- if (isEmptyValue(arr[i])) {
3640
+ if (isEmptyValue$1(arr[i])) {
2424
3641
  count++;
2425
3642
  }
2426
3643
  else {
@@ -2432,14 +3649,14 @@ function isEmptyValueOfArray(arr) {
2432
3649
  }
2433
3650
  return false;
2434
3651
  }
2435
- function isEmptyValueOfObject(obj) {
3652
+ function isEmptyValueOfObject$1(obj) {
2436
3653
  if (Object.keys(obj).length === 0) {
2437
3654
  return true;
2438
3655
  }
2439
3656
  const len = Object.keys(obj).length;
2440
3657
  let count = 0;
2441
3658
  for (const val of Object.values(obj)) {
2442
- if (isEmptyValue(val)) {
3659
+ if (isEmptyValue$1(val)) {
2443
3660
  count++;
2444
3661
  }
2445
3662
  else {
@@ -2451,7 +3668,7 @@ function isEmptyValueOfObject(obj) {
2451
3668
  }
2452
3669
  return false;
2453
3670
  }
2454
- function isEmptyValue(value, allowZero) {
3671
+ function isEmptyValue$1(value, allowZero) {
2455
3672
  if (value === null || value === undefined || value === '') {
2456
3673
  return true;
2457
3674
  }
@@ -2459,19 +3676,19 @@ function isEmptyValue(value, allowZero) {
2459
3676
  return false;
2460
3677
  }
2461
3678
  else if (Array.isArray(value)) {
2462
- return isEmptyValueOfArray(value);
3679
+ return isEmptyValueOfArray$1(value);
2463
3680
  }
2464
3681
  else if (Object.prototype.toString.call(value) === '[object Object]') {
2465
- return isEmptyValueOfObject(value);
3682
+ return isEmptyValueOfObject$1(value);
2466
3683
  }
2467
3684
  else {
2468
3685
  return !value;
2469
3686
  }
2470
3687
  }
2471
- function toQueryParams(params) {
3688
+ function toQueryParams$1(params) {
2472
3689
  const finalParams = {};
2473
3690
  Object.entries(params).forEach(([key, value]) => {
2474
- if (!isEmptyValue(value, true)) {
3691
+ if (!isEmptyValue$1(value, true)) {
2475
3692
  finalParams[key] = value;
2476
3693
  }
2477
3694
  });
@@ -2527,7 +3744,7 @@ const isMobile = (userAgent) => {
2527
3744
  userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
2528
3745
  userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
2529
3746
  };
2530
- const showNotification$2 = ({ message, theme = 'success' }) => {
3747
+ const showNotification$1 = ({ message, theme = 'success' }) => {
2531
3748
  window.postMessage({
2532
3749
  type: 'ShowNotificationToast',
2533
3750
  message,
@@ -2812,7 +4029,7 @@ const getTranslations$1 = (data) => {
2812
4029
  });
2813
4030
  };
2814
4031
 
2815
- const formatDate$1 = ({ date, type = 'date', format }) => {
4032
+ const formatDate = ({ date, type = 'date', format }) => {
2816
4033
  try {
2817
4034
  const parsedDate = lotteryTippingEntrance.parseISO(date);
2818
4035
  if (isNaN(parsedDate.getTime())) {
@@ -2847,7 +4064,7 @@ const DEFAULT_BULLET_CONFIG = [
2847
4064
  }
2848
4065
  ];
2849
4066
  const SPLIT_TOKEN = '-';
2850
- const showNotification$1 = ({ message, theme = 'success', renderOne = false }) => {
4067
+ const showNotification = ({ message, theme = 'success', renderOne = false }) => {
2851
4068
  window.postMessage({
2852
4069
  type: 'ShowNotificationToast',
2853
4070
  message,
@@ -2894,7 +4111,7 @@ const LotteryTippingTicketBet = class {
2894
4111
  width: 22,
2895
4112
  align: 'right',
2896
4113
  nowrap: true,
2897
- render: (_, value) => formatDate$1({ date: value, format: 'ccc HH:mm' })
4114
+ render: (_, value) => formatDate({ date: value, format: 'ccc HH:mm' })
2898
4115
  },
2899
4116
  {
2900
4117
  title: () => (index.h("lottery-tipping-bullet-group", { theme: "text", bulletConfigContent: JSON.stringify(DEFAULT_BULLET_CONFIG) })),
@@ -3029,7 +4246,7 @@ const LotteryTippingTicketBet = class {
3029
4246
  }
3030
4247
  handleClearAll() {
3031
4248
  this._resetBulletConfig();
3032
- showNotification$1({ message: translate$1('selectionCleared', this.language), renderOne: true });
4249
+ showNotification({ message: translate$1('selectionCleared', this.language), renderOne: true });
3033
4250
  this.lotteryTippingBulletBetEvent.emit({ hasSelectBullet: false });
3034
4251
  }
3035
4252
  async resetBulletConfig({ minLineNumber, maxLineNumber, defaultBoards }) {
@@ -3197,39 +4414,193 @@ const LotteryTippingTicketBet = class {
3197
4414
  };
3198
4415
  LotteryTippingTicketBet.style = LotteryTippingTicketBetStyle0;
3199
4416
 
3200
- var PlayModeEnum;
3201
- (function (PlayModeEnum) {
3202
- PlayModeEnum["SingleBet"] = "SingleBet";
3203
- PlayModeEnum["SystemBet"] = "SystemBet";
3204
- })(PlayModeEnum || (PlayModeEnum = {}));
3205
- var BettingTypeEnum;
3206
- (function (BettingTypeEnum) {
3207
- BettingTypeEnum["FullTime"] = "FullTime";
3208
- BettingTypeEnum["HalfTime"] = "HalfTime";
3209
- BettingTypeEnum["Both"] = "Both";
3210
- })(BettingTypeEnum || (BettingTypeEnum = {}));
3211
- var DrawStatus;
3212
- (function (DrawStatus) {
3213
- DrawStatus["OPEN"] = "OPEN";
3214
- })(DrawStatus || (DrawStatus = {}));
3215
- var TicketState;
3216
- (function (TicketState) {
3217
- TicketState["Settled"] = "Settled";
3218
- TicketState["Purchased"] = "Purchased";
3219
- TicketState["Canceled"] = "Canceled";
3220
- })(TicketState || (TicketState = {}));
4417
+ function isEmptyValue(value, allowZero) {
4418
+ if (value === null || value === undefined || value === '') {
4419
+ return true;
4420
+ }
4421
+ else if (value === 0 && allowZero) {
4422
+ return false;
4423
+ }
4424
+ else if (Array.isArray(value)) {
4425
+ return isEmptyValueOfArray(value);
4426
+ }
4427
+ else if (Object.prototype.toString.call(value) === '[object Object]') {
4428
+ return isEmptyValueOfObject(value);
4429
+ }
4430
+ else {
4431
+ return !value;
4432
+ }
4433
+ }
4434
+ function isEmptyValueOfArray(arr) {
4435
+ if (arr.length === 0) {
4436
+ return true;
4437
+ }
4438
+ const len = arr.length;
4439
+ let count = 0;
4440
+ for (let i = 0; i < len; i++) {
4441
+ if (isEmptyValue(arr[i])) {
4442
+ count++;
4443
+ }
4444
+ else {
4445
+ return false;
4446
+ }
4447
+ }
4448
+ if (count === len) {
4449
+ return true;
4450
+ }
4451
+ return false;
4452
+ }
4453
+ function isEmptyValueOfObject(obj) {
4454
+ if (Object.keys(obj).length === 0) {
4455
+ return true;
4456
+ }
4457
+ const len = Object.keys(obj).length;
4458
+ let count = 0;
4459
+ for (const val of Object.values(obj)) {
4460
+ if (isEmptyValue(val)) {
4461
+ count++;
4462
+ }
4463
+ else {
4464
+ return false;
4465
+ }
4466
+ }
4467
+ if (count === len) {
4468
+ return true;
4469
+ }
4470
+ return false;
4471
+ }
4472
+ function thousandSeparator(value) {
4473
+ if (value === 0) {
4474
+ return '0';
4475
+ }
4476
+ if (!value) {
4477
+ return '';
4478
+ }
4479
+ value = value.toString();
4480
+ const parts = value.split('.');
4481
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
4482
+ return parts.join('.');
4483
+ }
4484
+ function formattedTurnover(turnover, unit = '€') {
4485
+ if (turnover === null || turnover === undefined)
4486
+ return '';
4487
+ return `${unit}${turnover ? thousandSeparator(turnover) : 0}`;
4488
+ }
4489
+ function calculateCombinationInLine(selectionsInLine = [[]], matchNum) {
4490
+ let res = 1;
4491
+ for (let i = 0; i < matchNum; i++) {
4492
+ const curMatchSelections = (selectionsInLine[i] || []).filter((i) => i);
4493
+ res *= curMatchSelections.length;
4494
+ if (res === 0)
4495
+ return 0;
4496
+ }
4497
+ return res;
4498
+ }
4499
+ function getTotalLinesAndCheckIfNotComplete(bulletSelectionsLineGroup, matchNum, minCombinations, maxCombinations) {
4500
+ const isEffectivelyEmpty = !bulletSelectionsLineGroup ||
4501
+ bulletSelectionsLineGroup.length === 0 ||
4502
+ bulletSelectionsLineGroup.every((board) => !board.some((match) => match && match.length > 0));
4503
+ if (isEffectivelyEmpty || matchNum === undefined || matchNum === null) {
4504
+ return {
4505
+ totalLines: 0,
4506
+ notComplete: true
4507
+ };
4508
+ }
4509
+ // total line combination is sum of all the line's combination
4510
+ const _totalLines = bulletSelectionsLineGroup.reduce((pre, cur) => pre + calculateCombinationInLine(cur, matchNum), 0);
4511
+ // each line's combination should within in [minCombinations, maxCombinations]
4512
+ return {
4513
+ totalLines: _totalLines,
4514
+ notComplete: bulletSelectionsLineGroup.some((selectionsInLine) => {
4515
+ const curCombination = calculateCombinationInLine(selectionsInLine, matchNum);
4516
+ return curCombination < minCombinations || curCombination > maxCombinations;
4517
+ })
4518
+ };
4519
+ }
4520
+
4521
+ const generateUUID = () => {
4522
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
4523
+ var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
4524
+ return v.toString(16);
4525
+ });
4526
+ };
4527
+ function fetchRequest(url, method = 'GET', body = null, headers = {}) {
4528
+ return new Promise((resolve, reject) => {
4529
+ const uuid = generateUUID();
4530
+ const headersOrigin = Object.assign({ 'Content-Type': 'application/json', 'X-APP-KEY': '123456' }, headers);
4531
+ if (method !== 'GET' && method !== 'HEAD') {
4532
+ headersOrigin['X-Idempotency-Key'] = uuid;
4533
+ }
4534
+ const options = {
4535
+ method,
4536
+ headers: headersOrigin,
4537
+ body: null
4538
+ };
4539
+ if (body && method !== 'GET' && method !== 'HEAD') {
4540
+ options.body = JSON.stringify(body);
4541
+ }
4542
+ else {
4543
+ delete options.body;
4544
+ }
4545
+ fetch(url, options)
4546
+ .then((response) => {
4547
+ if (!response.ok) {
4548
+ return response.json().then((errorData) => {
4549
+ const error = {
4550
+ status: response.status,
4551
+ statusText: response.statusText,
4552
+ code: errorData.code || 'UNKNOWN_ERROR',
4553
+ message: errorData.message || 'An unknown error occurred',
4554
+ data: errorData.data || null
4555
+ };
4556
+ reject(error);
4557
+ }, () => reject({
4558
+ status: response.status,
4559
+ statusText: response.statusText,
4560
+ code: 'PARSE_ERROR',
4561
+ message: 'Failed to parse error response'
4562
+ }));
4563
+ }
4564
+ else {
4565
+ return response.json();
4566
+ }
4567
+ })
4568
+ .then((data) => resolve(data), (error) => reject(error));
4569
+ });
4570
+ }
4571
+ async function fetchSaleStatistics({ endpoint, gameId, drawId }) {
4572
+ try {
4573
+ const res = await fetchRequest(`${endpoint}/games/${gameId}/draws/${drawId}/saleStatistics`);
4574
+ return res;
4575
+ }
4576
+ catch (error) {
4577
+ return Promise.reject(error);
4578
+ }
4579
+ }
4580
+ function toQueryParams(params) {
4581
+ const finalParams = {};
4582
+ Object.entries(params).forEach(([key, value]) => {
4583
+ if (!isEmptyValue(value, true)) {
4584
+ finalParams[key] = value;
4585
+ }
4586
+ });
4587
+ const queryString = Object.entries(finalParams)
4588
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
4589
+ .join('&');
4590
+ return queryString ? `?${queryString}` : '';
4591
+ }
3221
4592
 
3222
4593
  const DEFAULT_LANGUAGE = 'en';
3223
4594
  const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
3224
4595
  const TRANSLATIONS = {
3225
4596
  en: {
3226
- gameNotAvailable: 'Sorry. The Game is not available now.',
3227
4597
  stop: 'Stop',
3228
4598
  at: 'at',
3229
4599
  turnover: 'Turnover: ',
3230
4600
  selectionCleared: 'Your selection will be cleared.',
4601
+ selectionOnLineCleared: 'Your selection on this line will be cleared.',
3231
4602
  ticketSubmitted: 'Ticket submitted successfully.',
3232
- ticketFailed: 'Failed to submit tickets.',
4603
+ ticketFailed: 'Failed to purchase the ticket. Please try again.',
3233
4604
  lines: 'Lines',
3234
4605
  line: 'Line',
3235
4606
  bettingType: 'Betting Type',
@@ -3240,7 +4611,9 @@ const TRANSLATIONS = {
3240
4611
  orderSummarySubmit: 'Submit',
3241
4612
  cancel: 'Cancel',
3242
4613
  confirm: 'Confirm',
3243
- stakePerLine: 'Stake per Line:'
4614
+ stakePerLine: 'Stake per Line:',
4615
+ error: 'Error!',
4616
+ gameNotAvailable: 'Sorry. The Game is not available now.'
3244
4617
  },
3245
4618
  ro: {
3246
4619
  selectionCleared: 'Selecția dvs. va fi ștearsă.',
@@ -3297,438 +4670,98 @@ const TRANSLATIONS = {
3297
4670
  playingMode: 'Način igranja',
3298
4671
  orderSummaryTitle: 'Sažetak narudžbe',
3299
4672
  orderSummaryTickets: 'Listići',
3300
- orderSummaryTotal: 'Ukupno',
3301
- orderSummarySubmit: 'Pošalji',
3302
- cancel: 'Odustani',
3303
- confirm: 'Potvrdi'
3304
- }
3305
- };
3306
- const translate = (key, customLang) => {
3307
- const lang = customLang;
3308
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
3309
- };
3310
- const getTranslations = (data) => {
3311
- Object.keys(data).forEach((item) => {
3312
- for (let key in data[item]) {
3313
- TRANSLATIONS[item][key] = data[item][key];
3314
- }
3315
- });
3316
- };
3317
- const resolveTranslationUrl = async (translationUrl) => {
3318
- if (translationUrl) {
3319
- try {
3320
- const response = await fetch(translationUrl);
3321
- if (!response.ok) {
3322
- throw new Error(`HTTP error! status: ${response.status}`);
3323
- }
3324
- const translations = await response.json();
3325
- getTranslations(translations);
3326
- }
3327
- catch (error) {
3328
- console.error('Failed to fetch or parse translations from URL:', error);
3329
- }
3330
- }
3331
- };
3332
-
3333
- const formatDate = ({ date, type = 'date', format }) => {
3334
- try {
3335
- const parsedDate = lotteryTippingEntrance.parseISO(date);
3336
- if (isNaN(parsedDate.getTime())) {
3337
- throw new Error(`Invalid date: ${date}`);
3338
- }
3339
- if (format)
3340
- return lotteryTippingEntrance.format(parsedDate, format);
3341
- let formatStr = 'dd/MM/yyyy';
3342
- if (type === 'time') {
3343
- formatStr = 'dd/MM/yyyy HH:mm:ss';
3344
- }
3345
- else if (type === 'week') {
3346
- formatStr = 'ccc dd/MM/yyyy HH:mm:ss';
3347
- }
3348
- return lotteryTippingEntrance.format(parsedDate, formatStr);
3349
- }
3350
- catch (error) {
3351
- console.error('Error formatting date:', error.message);
3352
- return '';
3353
- }
3354
- };
3355
- const generateUUID$1 = () => {
3356
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
3357
- var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
3358
- return v.toString(16);
3359
- });
3360
- };
3361
- function fetchRequest(url, method = 'GET', body = null, headers = {}) {
3362
- return new Promise((resolve, reject) => {
3363
- const uuid = generateUUID$1();
3364
- const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
3365
- if (method !== 'GET' && method !== 'HEAD') {
3366
- headersOrigin['X-Idempotency-Key'] = uuid;
3367
- }
3368
- const options = {
3369
- method,
3370
- headers: headersOrigin
3371
- };
3372
- if (body && method !== 'GET' && method !== 'HEAD') {
3373
- options.body = JSON.stringify(body);
3374
- }
3375
- fetch(url, options)
3376
- .then((response) => {
3377
- if (!response.ok) {
3378
- throw new Error(`HTTP error! Status: ${response.status}`);
3379
- }
3380
- return response.json();
3381
- })
3382
- .then((data) => resolve(data))
3383
- .catch((error) => reject(error));
3384
- });
3385
- }
3386
- const showNotification = ({ message, theme = 'success' }) => {
3387
- window.postMessage({
3388
- type: 'ShowNotificationToast',
3389
- message,
3390
- theme
3391
- });
3392
- };
3393
- const thousandSeparator = (value) => {
3394
- if (value === 0) {
3395
- return '0';
3396
- }
3397
- if (!value) {
3398
- return '';
4673
+ orderSummaryTotal: 'Ukupno',
4674
+ orderSummarySubmit: 'Pošalji',
4675
+ cancel: 'Odustani',
4676
+ confirm: 'Potvrdi'
3399
4677
  }
3400
- value = value.toString();
3401
- const parts = value.split('.');
3402
- parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
3403
- return parts.join('.');
3404
4678
  };
3405
- const HomeDrawAwayArr = ['H', 'D', 'A'];
3406
- // Utility to format raw results into winning numbers (H/D/A)
3407
- const formatResultsToWinningNumbers = (rawResults) => {
3408
- // Convert each bullet item into binary (1 if selected, 0 otherwise)
3409
- const toBinarySelection = (matchRes) => matchRes.map((bulletItem) => (bulletItem.isSelected ? 1 : 0));
3410
- // Step 1: Convert rawResults into arrays of 0/1 flags
3411
- const binaryResults = rawResults.map((lineRes) => lineRes.map(toBinarySelection));
3412
- const resultLinesArr = [];
3413
- // Step 2: Iterate through each line of results
3414
- binaryResults.forEach((line, lineIdx) => {
3415
- const formattedLine = [];
3416
- // Step 3: Iterate through each match in a line
3417
- line.forEach((match, matchIdx) => {
3418
- // Step 4: Collect the winning outcomes (H/D/A) based on binary flags
3419
- const outcomes = match.map((isSelected, idx) => (isSelected ? HomeDrawAwayArr[idx] : null)).filter(Boolean);
3420
- // Wrap outcomes into the expected structure [[matchRes]]
3421
- formattedLine[matchIdx] = [outcomes];
4679
+ const translate = (key, customLang, replacements) => {
4680
+ const lang = customLang;
4681
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
4682
+ if (replacements) {
4683
+ Object.keys(replacements).forEach((placeholder) => {
4684
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
3422
4685
  });
3423
- resultLinesArr[lineIdx] = formattedLine;
3424
- });
3425
- return resultLinesArr;
3426
- };
3427
- const buildSubmitParam = ({ playerId, rawResults, gameId, rawData, amount, currentStake, betTypeId, betType }) => {
3428
- var _a;
3429
- const body = { playerId, tickets: [] };
3430
- const selections = formatResultsToWinningNumbers(rawResults);
3431
- const stake = currentStake || {};
3432
- body.tickets.push({
3433
- startingDrawId: (_a = rawData === null || rawData === void 0 ? void 0 : rawData.currentDraw) === null || _a === void 0 ? void 0 : _a.id,
3434
- amount,
3435
- gameId: gameId,
3436
- gameName: rawData.name,
3437
- currency: stake.currency,
3438
- selection: selections.map((i) => ({
3439
- betType: betTypeId,
3440
- stake: +stake.value,
3441
- poolGameSelections: i,
3442
- quickPick: false,
3443
- betName: betType.name
3444
- })),
3445
- multiplier: false,
3446
- drawCount: 1,
3447
- quickPick: false
3448
- });
3449
- return body;
3450
- };
3451
- // BettingTypes, playModes and playTypes
3452
- const getEnableOptions = (raw = []) => raw.filter((i) => i.enabled);
3453
- // the first one in bet type config that enabled = true, will be default choice
3454
- const getDefaultType = ({ playTypeConfig = [], betTypeConfig = [], enabledBettingTypeOptions = [], enabledPlayingModeOptions = [] }) => {
3455
- const enabledBetTypeConfig = betTypeConfig.filter((i) => i.enabled);
3456
- for (const item of enabledBetTypeConfig) {
3457
- const { bettingType, playMode } = playTypeConfig === null || playTypeConfig === void 0 ? void 0 : playTypeConfig.find((i) => i.betTypeId === item.id);
3458
- if (enabledBettingTypeOptions.map((i) => i.code).includes(bettingType) &&
3459
- enabledPlayingModeOptions.map((i) => i.code).includes(playMode))
3460
- return { bettingType, playMode };
3461
- }
3462
- return {};
3463
- };
3464
- const calculatePlayingModeOptions = ({ bettingType, playTypeConfig, betTypeConfig, enabledPlayingModeOptions }) => {
3465
- const enabledBetTypeIdConfig = betTypeConfig.filter((i) => i.enabled).map((i) => i.id);
3466
- const filteredPlayTypesConfig = playTypeConfig.filter((i) => enabledBetTypeIdConfig.includes(i.betTypeId));
3467
- const selectedBettingTypeFilteredPlayTypesConfig = filteredPlayTypesConfig.filter((i) => i.bettingType === bettingType);
3468
- const _ = selectedBettingTypeFilteredPlayTypesConfig.map((i) => i.playMode);
3469
- return enabledPlayingModeOptions.filter((i) => _.includes(i.code));
3470
- };
3471
- const getCheckedCountForEachLineAndEachMatch = ({ rawResults }) => {
3472
- const getMatchCheckRes = (matchRes) => matchRes.filter((bulletItem) => bulletItem.isSelected).length;
3473
- const checkedCountForEachLineAndEachMatch = rawResults.map((lineRes) => lineRes.length > 0 ? lineRes.map(getMatchCheckRes) : [0]);
3474
- return checkedCountForEachLineAndEachMatch;
3475
- };
3476
- const getPlayTypeConfig = ({ rawData, selectedBettingType, selectedPlayingMode }) => {
3477
- var _a, _b, _c, _d, _e, _f;
3478
- const betTypeId = (_d = (_c = (_b = (_a = rawData === null || rawData === void 0 ? void 0 : rawData.rules) === null || _a === void 0 ? void 0 : _a.poolGame) === null || _b === void 0 ? void 0 : _b.playTypes) === null || _c === void 0 ? void 0 : _c.find((i) => i.bettingType === selectedBettingType && i.playMode === selectedPlayingMode)) === null || _d === void 0 ? void 0 : _d.betTypeId;
3479
- const betType = (_f = (_e = rawData === null || rawData === void 0 ? void 0 : rawData.rules) === null || _e === void 0 ? void 0 : _e.betTypes) === null || _f === void 0 ? void 0 : _f.find((i) => i.id === betTypeId);
3480
- return { betTypeId, betType };
3481
- };
3482
- const getMinValue = (arr) => (arr.length ? Math.min.apply(null, arr) : undefined);
3483
- function formattedTurnover(turnover, unit = '€') {
3484
- if (turnover === null || turnover === undefined)
3485
- return '';
3486
- return `${unit}${turnover ? thousandSeparator(turnover) : 0}`;
3487
- }
3488
- function formattedWeekName(date) {
3489
- if (!date)
3490
- return '';
3491
- const _temp = formatDate({ date, format: 'EEEE' });
3492
- if (!['saturday', 'sunday'].includes(_temp.toLowerCase())) {
3493
- return 'MIDWEEK';
3494
4686
  }
3495
- return _temp.toUpperCase();
3496
- }
3497
-
3498
- const TICKET_INVALID_TOKEN = 'TICKET_INVALID_TOKEN';
3499
- const generateUUID = () => {
3500
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
3501
- var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
3502
- return v.toString(16);
3503
- });
4687
+ return translation;
3504
4688
  };
3505
- const doSubmitTicket = ({ body, sessionId, url }) => {
3506
- const options = {
3507
- method: 'POST',
3508
- headers: {
3509
- 'Content-Type': 'application/json',
3510
- Accept: 'application/json',
3511
- Authorization: `Bearer ${sessionId}`,
3512
- 'X-Idempotency-Key': generateUUID()
3513
- },
3514
- body: JSON.stringify(body)
3515
- };
3516
- return fetch(url, options).then((res) => {
3517
- if (res.status === 401) {
3518
- throw new Error(TICKET_INVALID_TOKEN);
3519
- }
3520
- if (res.status > 300) {
3521
- throw new Error(res.statusText);
4689
+ const getTranslations = (data) => {
4690
+ Object.keys(data).forEach((item) => {
4691
+ for (let key in data[item]) {
4692
+ TRANSLATIONS[item][key] = data[item][key];
3522
4693
  }
3523
- return res.json().then((data) => {
3524
- if (checkTicketDetailHasError(data.tickets))
3525
- throw new Error(res.statusText);
3526
- return data;
3527
- });
3528
4694
  });
3529
4695
  };
3530
- function checkTicketDetailHasError(tickets) {
3531
- if (!tickets || !tickets.length)
3532
- return true;
3533
- return tickets.some((i) => i.state !== TicketState.Purchased);
3534
- }
3535
- async function fetchSaleStatistics({ endpoint, gameId, drawId }) {
3536
- try {
3537
- const res = await fetchRequest(`${endpoint}/games/${gameId}/draws/${drawId}/saleStatistics`);
3538
- return res;
3539
- }
3540
- catch (error) {
3541
- return Promise.reject(error);
4696
+ const resolveTranslationUrl = async (translationUrl) => {
4697
+ if (translationUrl) {
4698
+ try {
4699
+ const response = await fetch(translationUrl);
4700
+ if (!response.ok) {
4701
+ throw new Error(`HTTP error! status: ${response.status}`);
4702
+ }
4703
+ const translations = await response.json();
4704
+ getTranslations(translations);
4705
+ }
4706
+ catch (error) {
4707
+ console.error('Failed to fetch or parse translations from URL:', error);
4708
+ }
3542
4709
  }
3543
- }
4710
+ };
3544
4711
 
3545
- 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: 1rem;\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}";
3546
- const LotteryTippingTicketControllerStyle0 = lotteryTippingTicketControllerCss;
4712
+ const lotteryTippingTicketBuyCss = ":host {\n --vaadin-input-field-background: var(--emw--color-background, #fff);\n --vaadin-input-field-border-color: var(--emw--color-gray-100, #e6e6e6);\n --vaadin-input-field-invalid-hover-highlight: var(--emw--color-background, #fff);\n --vaadin-input-field-hover-highlight: var(--emw--color-background, #fff);\n --vaadin-input-field-border-width: 1px;\n --lottery-selection-border-color: #e6e6e6;\n --lottery-selection-hover-border-color: #e6e6e6;\n --lottery-selection-selected-border-color: #e6e6e6;\n --lottery-selection-selected-color: #fed275;\n --lottery-button-primary-active-bg: #fed275;\n --lottery-selection-selected-background: #000;\n --lottery-button-text-color: #000;\n}\n\n.lottery-tipping-ticket-buy {\n container-type: inline-size;\n container-name: lottery-tipping-ticket-buy;\n}\n\n.flex {\n display: flex;\n}\n\n.flex-wrap {\n flex-wrap: wrap;\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.bet-selector {\n display: flex;\n gap: 18px;\n flex-direction: column;\n width: 80%;\n max-width: 800px;\n margin: 20px auto;\n}\n.bet-selector-line {\n display: flex;\n align-items: center;\n}\n.bet-selector-line-segments {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n gap: 18px;\n justify-content: space-between;\n}\n.bet-selector-line-label {\n font-size: 16px;\n margin-right: 8px;\n color: var(--emw--color-typography, #000);\n}\n\n.bet-board {\n display: flex;\n width: 84vw;\n max-width: 1200px;\n margin: 0px auto;\n gap: 30px;\n flex-wrap: wrap;\n}\n.bet-board-slip {\n min-width: 460px;\n flex: 1.6;\n}\n.bet-board-order {\n flex: 1;\n min-width: 200px;\n}\n\n@container lottery-tipping-ticket-buy (max-width: 768px) {\n .bet-board {\n width: 94%;\n }\n .bet-board-slip {\n min-width: 100%;\n }\n}\n.skeleton-block {\n background-color: var(--emw--color-background-tertiary, #e0e0e0);\n border-radius: 4px;\n position: relative;\n overflow: hidden;\n}\n.skeleton-block::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: linear-gradient(90deg, transparent, var(--emw--color-background-secondary, rgba(255, 255, 255, 0.4)), transparent);\n animation: shimmer 1.5s infinite;\n}\n\n@keyframes shimmer {\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(100%);\n }\n}\n.no-active-draw {\n margin: 100px auto;\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}";
4713
+ const LotteryTippingTicketBuyStyle0 = lotteryTippingTicketBuyCss;
3547
4714
 
3548
- const LotteryTippingTicketController = class {
4715
+ const LotteryTippingTicketBuy = class {
3549
4716
  constructor(hostRef) {
3550
4717
  index.registerInstance(this, hostRef);
3551
- this.logoutEventHandler = index.createEvent(this, "logout", 7);
3552
- this.bothBettingTypeMultiplier = 2;
3553
- this.onStakeChange = (e) => {
3554
- this.currentStake = this.getCurrentStakeByValue(e.detail.value);
4718
+ this.onClearAll = index.createEvent(this, "lotteryTippingSelectionClear", 7);
4719
+ this.lotteryTicketParamsReady = index.createEvent(this, "lotteryTicketParamsReady", 7);
4720
+ this.SPLIT_TOKEN = ',';
4721
+ this.EVENT_PART_MAP = {
4722
+ '3': 'Full Time',
4723
+ '5': 'Half Time'
3555
4724
  };
4725
+ this.endpoint = '';
4726
+ this.sessionId = undefined;
4727
+ this.playerId = '';
4728
+ this.gameId = '';
4729
+ this.drawId = '';
4730
+ this.currency = 'EUR';
4731
+ this.tippingBetOptions = '1,X,2';
4732
+ this.tippingBetOptionNames = 'Home,Draw,Away';
4733
+ this.groupBy = 'BettingType,EventPart,Event';
3556
4734
  this.mbSource = undefined;
3557
4735
  this.clientStyling = undefined;
3558
4736
  this.clientStylingUrl = undefined;
3559
4737
  this.translationUrl = '';
3560
4738
  this.language = 'en';
3561
- this.endpoint = '';
3562
- this.sessionId = undefined;
3563
- this.gameId = undefined;
3564
- this.playerId = '';
3565
- this.drawId = undefined;
3566
- this.isLoading = true;
3567
- this.bettingTypeOptions = [];
3568
- this.playingModeOptions = [];
3569
- this.selectedBettingType = undefined;
3570
- this.selectedPlayingMode = undefined;
3571
- this.hasSelectBullet = undefined;
3572
- this.hasSelectAllBullet = undefined;
3573
- this.totalLineCombination = 0;
3574
- this.submitLoading = false;
3575
- this.isSalesActive = false;
3576
- this.drawSubmitAvailable = false;
3577
- this.rawData = {};
3578
- this.saleStatisticsInfo = {};
3579
- this.currentStake = undefined;
4739
+ this.bulletSelectionsLineGroup = [[[]]];
4740
+ this.draw = undefined;
4741
+ this.isLoading = false;
4742
+ this.betCurrentPage = 1;
4743
+ this.betTotalPages = undefined;
3580
4744
  this.dialogConfig = { visible: false };
4745
+ this.submitLoading = undefined;
4746
+ this.betHasErrors = false;
3581
4747
  this.gameUnavailable = false;
3582
- }
3583
- async getLotteryTippingBulletResults() {
3584
- return await this.childRef.getData();
3585
- }
3586
- get lineNumberRange() {
3587
- const { betType } = getPlayTypeConfig({
3588
- rawData: this.rawData,
3589
- selectedBettingType: this.selectedBettingType,
3590
- selectedPlayingMode: this.selectedPlayingMode
3591
- });
3592
- const boardsAllowed = (betType === null || betType === void 0 ? void 0 : betType.boardsAllowed) || [0];
3593
- const [minLineNumber, maxLineNumber] = [Math.min(...boardsAllowed), Math.max(...boardsAllowed)];
3594
- const defaultBoards = (betType === null || betType === void 0 ? void 0 : betType.defaultBoards) || minLineNumber;
3595
- return { minLineNumber, maxLineNumber, defaultBoards };
3596
- }
3597
- get playTypeConfig() {
3598
- var _a, _b, _c;
3599
- return (_c = (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.poolGame) === null || _c === void 0 ? void 0 : _c.playTypes;
3600
- }
3601
- get betTypeConfig() {
3602
- var _a, _b;
3603
- return (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.betTypes;
3604
- }
3605
- get isBothBettingType() {
3606
- return this.selectedBettingType === BettingTypeEnum.Both;
3607
- }
3608
- get stakeOptions() {
3609
- var _a, _b, _c;
3610
- return (_c = (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.stakes) === null || _c === void 0 ? void 0 : _c.map((item) => {
3611
- var _a;
3612
- return { value: (_a = item.value) === null || _a === void 0 ? void 0 : _a.toString(), label: item.value, currency: item.currency };
3613
- });
3614
- }
3615
- getCurrentStakeByValue(value) {
3616
- var _a;
3617
- return (_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.find((item) => +item.value === +value);
3618
- }
3619
- initiateCurrentStake() {
3620
- var _a, _b;
3621
- // if only one option, default to the first one
3622
- if (((_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.length) === 1) {
3623
- this.currentStake = this.stakeOptions[0];
3624
- }
3625
- else {
3626
- // otherwise, default to the smallest stake option from the config
3627
- const minValue = getMinValue(((_b = this.stakeOptions) === null || _b === void 0 ? void 0 : _b.map((i) => i.value)) || []);
3628
- this.currentStake = this.getCurrentStakeByValue(minValue);
3629
- }
3630
- }
3631
- handleBettingTypeChange(type) {
3632
- var _a, _b, _c, _d;
3633
- if (type === this.selectedBettingType)
3634
- return;
3635
- this.selectedBettingType = type;
3636
- const calcPlayingModeOptions = calculatePlayingModeOptions({
3637
- bettingType: this.selectedBettingType,
3638
- playTypeConfig: this.playTypeConfig,
3639
- betTypeConfig: this.betTypeConfig,
3640
- enabledPlayingModeOptions: getEnableOptions(((_c = (_b = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.rules) === null || _b === void 0 ? void 0 : _b.poolGame) === null || _c === void 0 ? void 0 : _c.playModes) || [])
3641
- });
3642
- this.playingModeOptions = calcPlayingModeOptions;
3643
- if (!calcPlayingModeOptions.length) {
3644
- this.selectedPlayingMode = undefined;
3645
- }
3646
- else if (!calcPlayingModeOptions.map((i) => i.code).includes(this.selectedPlayingMode)) {
3647
- this.hasSelectBullet = false;
3648
- this.handlePlayingModeChange((_d = calcPlayingModeOptions[0]) === null || _d === void 0 ? void 0 : _d.code);
3649
- }
3650
- this.clearBulletConfig();
3651
- }
3652
- async clearBulletConfig() {
3653
- return await this.childRef.resetBulletConfig(this.lineNumberRange);
3654
- }
3655
- handlePlayingModeChange(mode) {
3656
- if (mode === this.selectedPlayingMode)
3657
- return;
3658
- const doChangeSelectedPlayingMod = (closeDialog) => {
3659
- this.selectedPlayingMode = mode;
3660
- this.clearBulletConfig().then(() => {
3661
- closeDialog === null || closeDialog === void 0 ? void 0 : closeDialog();
3662
- });
3663
- };
3664
- if (this.hasSelectBullet) {
3665
- const closeDialog = () => {
3666
- this.dialogConfig = { visible: false };
3667
- };
3668
- const onConfirm = () => {
3669
- doChangeSelectedPlayingMod(closeDialog);
3670
- };
3671
- this.dialogConfig = {
3672
- visible: true,
3673
- content: translate('selectionCleared', this.language),
3674
- onConfirm: onConfirm,
3675
- onCancel: closeDialog
3676
- };
3677
- }
3678
- else {
3679
- doChangeSelectedPlayingMod();
3680
- }
3681
- }
3682
- lotteryTippingBulletGroupSelectionHandler(event) {
3683
- var _a;
3684
- const hasSelectBullet = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.hasSelectBullet;
3685
- if (hasSelectBullet !== undefined)
3686
- this.hasSelectBullet = hasSelectBullet;
3687
- this.bulletBetSelectChecker();
3688
- }
3689
- calculateCombinationInLine(checkedNumberArr) {
3690
- return checkedNumberArr.reduce((pre, cur) => pre * cur, 1);
3691
- }
3692
- calculateTotalAmount() {
3693
- const stake = this.currentStake;
3694
- if (!stake) {
3695
- return 0;
3696
- }
3697
- let totalAmount = +stake.value * this.totalLineCombination;
3698
- if (this.isBothBettingType)
3699
- totalAmount = this.bothBettingTypeMultiplier * totalAmount;
3700
- return totalAmount;
3701
- }
3702
- get totalAmountFormatted() {
3703
- var _a;
3704
- const totalAmount = this.calculateTotalAmount();
3705
- return thousandSeparator(totalAmount) + ' ' + (((_a = this.currentStake) === null || _a === void 0 ? void 0 : _a.currency) || '');
3706
- }
3707
- get currentStakeFormatted() {
3708
- const { value = '', currency = '' } = this.currentStake || {};
3709
- return `${value} ${currency}`;
3710
- }
3711
- bulletBetSelectChecker() {
3712
- const validateSelectionsAndCalculateTotals = async () => {
3713
- const doCheckIfNotCompleteSelect = ({ rawResults }) => {
3714
- const checkedCountForEachLineAndEachMatch = getCheckedCountForEachLineAndEachMatch({ rawResults });
3715
- // total line combination is sum of all the line's combination
3716
- this.totalLineCombination = checkedCountForEachLineAndEachMatch.reduce((pre, cur) => pre + this.calculateCombinationInLine(cur), 0);
3717
- // each line's combination should within in [combinations, maxCombinations]
3718
- const { combinations = 1, maxCombinations = 1 } = getPlayTypeConfig({
3719
- rawData: this.rawData,
3720
- selectedBettingType: this.selectedBettingType,
3721
- selectedPlayingMode: this.selectedPlayingMode
3722
- }).betType || {};
3723
- return checkedCountForEachLineAndEachMatch.some((checkedNumberArr) => {
3724
- const curCombination = this.calculateCombinationInLine(checkedNumberArr);
3725
- return curCombination < combinations || curCombination > maxCombinations;
3726
- });
3727
- };
3728
- const rawResults = await this.getLotteryTippingBulletResults();
3729
- this.hasSelectAllBullet = !doCheckIfNotCompleteSelect({ rawResults });
4748
+ this.isSalesActive = false;
4749
+ this.currentStake = undefined;
4750
+ this.gameConfig = undefined;
4751
+ this.turnover = undefined;
4752
+ this.betTypes = undefined;
4753
+ this.curBetType = undefined;
4754
+ this.eventPartIds = undefined;
4755
+ this.curEventPartId = undefined;
4756
+ this.boardRange = {
4757
+ min: 1,
4758
+ max: 3
3730
4759
  };
3731
- validateSelectionsAndCalculateTotals();
4760
+ this.eventMap = undefined;
4761
+ this.eventPart2EventOutcomeMap = undefined;
4762
+ this.betTypeOptions = [];
4763
+ this.eventPartOptions = [];
4764
+ this.stakeOptions = [];
3732
4765
  }
3733
4766
  handleClientStylingChange(newValue, oldValue) {
3734
4767
  if (newValue != oldValue) {
@@ -3750,6 +4783,14 @@ const LotteryTippingTicketController = class {
3750
4783
  resolveTranslationUrl(this.translationUrl);
3751
4784
  }
3752
4785
  }
4786
+ connectedCallback() {
4787
+ if (this.endpoint && this.gameId && this.drawId) {
4788
+ this.getTippingInfo();
4789
+ }
4790
+ else {
4791
+ console.log('no fetch');
4792
+ }
4793
+ }
3753
4794
  componentDidLoad() {
3754
4795
  if (this.stylingContainer) {
3755
4796
  if (this.mbSource)
@@ -3763,9 +4804,23 @@ const LotteryTippingTicketController = class {
3763
4804
  disconnectedCallback() {
3764
4805
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
3765
4806
  }
4807
+ parsedOutcome(tippingInfo) {
4808
+ const { outcomes } = tippingInfo;
4809
+ const eventPartIdList = [];
4810
+ for (const bettingTypeId in outcomes) {
4811
+ const eventParts = outcomes[bettingTypeId];
4812
+ this.eventPart2EventOutcomeMap = eventParts;
4813
+ for (const eventPartId in eventParts) {
4814
+ eventPartIdList.push(eventPartId);
4815
+ }
4816
+ }
4817
+ if (eventPartIdList.length > 0) {
4818
+ this.eventPartIds = eventPartIdList;
4819
+ this.curEventPartId = eventPartIdList[0];
4820
+ }
4821
+ }
3766
4822
  updateDrawSalesStatus() {
3767
- var _a;
3768
- const currentDraw = (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.currentDraw;
4823
+ const currentDraw = this.draw;
3769
4824
  if (!currentDraw) {
3770
4825
  this.gameUnavailable = true;
3771
4826
  this.isSalesActive = false;
@@ -3790,139 +4845,296 @@ const LotteryTippingTicketController = class {
3790
4845
  this.isSalesActive = false;
3791
4846
  }
3792
4847
  }
3793
- connectedCallback() {
3794
- const fetchData = () => {
3795
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
4848
+ async getTippingInfo() {
4849
+ try {
3796
4850
  this.isLoading = true;
3797
- fetchRequest(url.href, 'GET')
3798
- .then((res) => {
3799
- var _a, _b, _c, _d, _e, _f, _g;
3800
- this.rawData = res;
3801
- this.bettingTypeOptions = getEnableOptions(((_b = (_a = res === null || res === void 0 ? void 0 : res.rules) === null || _a === void 0 ? void 0 : _a.poolGame) === null || _b === void 0 ? void 0 : _b.bettingTypes) || []);
3802
- this.playingModeOptions = getEnableOptions(((_d = (_c = res === null || res === void 0 ? void 0 : res.rules) === null || _c === void 0 ? void 0 : _c.poolGame) === null || _d === void 0 ? void 0 : _d.playModes) || []);
3803
- this.initiateCurrentStake();
3804
- // default: select the first one
3805
- const { bettingType, playMode } = getDefaultType({
3806
- playTypeConfig: (_f = (_e = res === null || res === void 0 ? void 0 : res.rules) === null || _e === void 0 ? void 0 : _e.poolGame) === null || _f === void 0 ? void 0 : _f.playTypes,
3807
- betTypeConfig: (_g = res === null || res === void 0 ? void 0 : res.rules) === null || _g === void 0 ? void 0 : _g.betTypes,
3808
- enabledBettingTypeOptions: this.bettingTypeOptions,
3809
- enabledPlayingModeOptions: this.playingModeOptions
3810
- });
3811
- this.handleBettingTypeChange(bettingType);
3812
- this.selectedPlayingMode = playMode;
3813
- this.updateDrawSalesStatus();
3814
- return this.updateSaleStatistics();
3815
- })
3816
- .catch((err) => {
3817
- console.error('Error!', err);
3818
- })
3819
- .finally(() => {
3820
- this.isLoading = false;
3821
- });
3822
- };
3823
- fetchData();
4851
+ const { gameId, drawId, endpoint, groupBy } = this;
4852
+ const res = await fetchRequest(`${endpoint}/poolgames/${gameId}/draws/${drawId}/bettingSelections${toQueryParams({
4853
+ groupBy
4854
+ })}`, 'GET');
4855
+ const { game, eventMap } = res;
4856
+ this.gameConfig = res;
4857
+ this.draw = game.currentDraw;
4858
+ this.betTypes = game.rules.betTypes;
4859
+ this._setBetType(this.betTypes[0]);
4860
+ this.currentStake = String(game.rules.stakes[0].value);
4861
+ this.eventMap = eventMap;
4862
+ this.parsedOutcome(res);
4863
+ const betTypeOptions = this.betTypes.map((bt) => ({ label: bt.name, value: bt.name }));
4864
+ this.betTypeOptions = betTypeOptions;
4865
+ const eventPartOptions = this.eventPartIds.map((id) => ({ label: this.EVENT_PART_MAP[id], value: id }));
4866
+ this.eventPartOptions = eventPartOptions;
4867
+ const stakeOptions = game.rules.stakes.map((stake) => ({ label: stake.value, value: stake.value }));
4868
+ this.stakeOptions = stakeOptions;
4869
+ this.updateDrawSalesStatus();
4870
+ this.updateSaleStatistics();
4871
+ }
4872
+ catch (err) {
4873
+ this.betHasErrors = true;
4874
+ console.error('Failed to get tipping info:', err);
4875
+ }
4876
+ finally {
4877
+ this.isLoading = false;
4878
+ }
3824
4879
  }
3825
4880
  updateSaleStatistics() {
3826
- var _a;
4881
+ var _a, _b, _c;
3827
4882
  return fetchSaleStatistics({
3828
4883
  endpoint: this.endpoint,
3829
- gameId: (_a = this.rawData) === null || _a === void 0 ? void 0 : _a.type,
3830
- drawId: this.drawId
4884
+ gameId: (_b = (_a = this.gameConfig) === null || _a === void 0 ? void 0 : _a.game) === null || _b === void 0 ? void 0 : _b.type,
4885
+ drawId: (_c = this.draw) === null || _c === void 0 ? void 0 : _c.id
3831
4886
  }).then((res) => {
3832
- this.saleStatisticsInfo = res;
4887
+ var _a;
4888
+ this.turnover = (_a = res === null || res === void 0 ? void 0 : res.wagerSegment) === null || _a === void 0 ? void 0 : _a.totalSalesCrossDraw;
4889
+ });
4890
+ }
4891
+ handleSelectionChange(event) {
4892
+ const { newSelections, matchId, boardId } = event.detail;
4893
+ const boardIndex = parseInt(boardId, 10);
4894
+ const matchIndex = parseInt(matchId, 10);
4895
+ const newBulletSelectionsLineGroup = this.bulletSelectionsLineGroup.map((board, index) => {
4896
+ if (index !== boardIndex)
4897
+ return board;
4898
+ const newBoard = [...board];
4899
+ newBoard[matchIndex] = newSelections;
4900
+ return newBoard;
4901
+ });
4902
+ // console.log('newBulletSelectionsLineGroup', newBulletSelectionsLineGroup);
4903
+ this.bulletSelectionsLineGroup = newBulletSelectionsLineGroup;
4904
+ }
4905
+ handleClearAll() {
4906
+ this._resetBulletConfig();
4907
+ this.onClearAll.emit();
4908
+ }
4909
+ handlePageChange(event) {
4910
+ const { newPage } = event.detail;
4911
+ if (newPage >= 1 && newPage <= this.betTotalPages) {
4912
+ this.betCurrentPage = newPage;
4913
+ }
4914
+ }
4915
+ handleAddLine() {
4916
+ if (this.betTotalPages < this.boardRange.max) {
4917
+ this.bulletSelectionsLineGroup = [...this.bulletSelectionsLineGroup, this.initLineForBulletConfig()];
4918
+ this.betTotalPages++;
4919
+ this.betCurrentPage = this.betTotalPages;
4920
+ }
4921
+ }
4922
+ handleRemoveLine(event) {
4923
+ const { boardId, close } = event.detail;
4924
+ if (this.betTotalPages > this.boardRange.min) {
4925
+ const closeDialog = () => {
4926
+ this.dialogConfig = { visible: false };
4927
+ };
4928
+ const doRemove = () => {
4929
+ this.bulletSelectionsLineGroup = this.bulletSelectionsLineGroup.filter((_, index) => index !== boardId);
4930
+ this.betTotalPages--;
4931
+ const removedPage = boardId + 1;
4932
+ if (this.betCurrentPage > removedPage) {
4933
+ this.betCurrentPage--;
4934
+ }
4935
+ if (this.betCurrentPage > this.betTotalPages) {
4936
+ this.betCurrentPage = this.betTotalPages;
4937
+ }
4938
+ close(closeDialog);
4939
+ };
4940
+ this.dialogConfig = {
4941
+ visible: true,
4942
+ content: translate('selectionOnLineCleared', this.language),
4943
+ onConfirm: doRemove,
4944
+ onCancel: closeDialog
4945
+ };
4946
+ }
4947
+ }
4948
+ handleSubmitTickets() {
4949
+ const params = this.buildTicketParam();
4950
+ this.lotteryTicketParamsReady.emit(params);
4951
+ }
4952
+ handleTicketSubmitSuccess() {
4953
+ this._resetBulletConfig();
4954
+ this.updateSaleStatistics();
4955
+ }
4956
+ buildTicketParam() {
4957
+ let body = {
4958
+ tickets: []
4959
+ };
4960
+ body.tickets.push({
4961
+ gameName: this.gameConfig.game.name,
4962
+ startingDrawId: this.draw.id,
4963
+ amount: this.calculateTotalAmount(),
4964
+ currency: this.currency,
4965
+ selection: this.bulletSelectionsLineGroup.map((boardInfo) => {
4966
+ const matchList = boardInfo.map((matchSelection, matchIdx) => {
4967
+ const curBettingTypeMatches = matchSelection.map((bet) => {
4968
+ return {
4969
+ betOn: bet,
4970
+ id: this.parsedEvent[matchIdx].outcomes.find((outcome) => outcome.betOn === bet).id
4971
+ };
4972
+ });
4973
+ return [curBettingTypeMatches];
4974
+ });
4975
+ return {
4976
+ betType: this.curBetType.id,
4977
+ prizePool: this.parsedEvent[0].outcomes[0].prizePools[0],
4978
+ stake: this.currentStake,
4979
+ poolGameSelections: matchList
4980
+ };
4981
+ })
3833
4982
  });
4983
+ return body;
4984
+ }
4985
+ initLineForBulletConfig() {
4986
+ return [[]];
3834
4987
  }
3835
- async handleSubmit() {
3836
- this.updateDrawSalesStatus();
3837
- if (!this.isSalesActive) {
3838
- showNotification({
3839
- message: 'Sales for this period have closed.',
3840
- theme: 'error'
4988
+ _resetBulletConfig() {
4989
+ this.bulletSelectionsLineGroup = Array.from({ length: this.betTotalPages }).map(this.initLineForBulletConfig.bind(this));
4990
+ this.betCurrentPage = 1;
4991
+ }
4992
+ calculateTotalAmount() {
4993
+ const stake = this.currentStake;
4994
+ if (!stake) {
4995
+ return '0';
4996
+ }
4997
+ let totalAmount = +stake * this.totalLineCombination;
4998
+ return totalAmount.toString();
4999
+ }
5000
+ get hasSelection() {
5001
+ return this.bulletSelectionsLineGroup.some((board) => board.some((match) => match && match.length > 0));
5002
+ }
5003
+ get parsedEvent() {
5004
+ if (!this.eventPart2EventOutcomeMap || !this.curEventPartId || !this.eventMap) {
5005
+ return [];
5006
+ }
5007
+ const curEventObj = this.eventPart2EventOutcomeMap[this.curEventPartId];
5008
+ const flatEvents = [];
5009
+ for (const eventId in curEventObj) {
5010
+ const curEventOutcomeArr = curEventObj[eventId];
5011
+ const eventDetail = this.eventMap[eventId];
5012
+ const { eventName, startTime, order } = eventDetail;
5013
+ flatEvents.push({
5014
+ eventName,
5015
+ startTime,
5016
+ order,
5017
+ outcomes: curEventOutcomeArr.map((outcome) => {
5018
+ const { betOn, outcomeId, prizePools } = outcome;
5019
+ return {
5020
+ betOn,
5021
+ id: outcomeId,
5022
+ prizePools
5023
+ };
5024
+ })
3841
5025
  });
5026
+ }
5027
+ flatEvents.sort((a, b) => a.order - b.order);
5028
+ // console.log('flatEvents', flatEvents);
5029
+ return flatEvents;
5030
+ }
5031
+ get _selectionStats() {
5032
+ const { combinations: minCombinations = 1, maxCombinations = 1 } = this.curBetType || {};
5033
+ return getTotalLinesAndCheckIfNotComplete(this.bulletSelectionsLineGroup, this.parsedEvent.length, minCombinations, maxCombinations);
5034
+ }
5035
+ get totalLineCombination() {
5036
+ return this._selectionStats.totalLines;
5037
+ }
5038
+ get hasSelectAllBullet() {
5039
+ return !this._selectionStats.notComplete;
5040
+ }
5041
+ _setBetType(betType) {
5042
+ if (!betType)
5043
+ return;
5044
+ this.curBetType = betType;
5045
+ this.boardRange.min = Math.min(...betType.boardsAllowed);
5046
+ this.boardRange.max = Math.max(...betType.boardsAllowed);
5047
+ this.betTotalPages = betType.defaultBoards;
5048
+ this._resetBulletConfig();
5049
+ }
5050
+ handleBetTypeChange(event) {
5051
+ const newBetTypeName = event.detail;
5052
+ if (newBetTypeName === this.curBetType.name) {
3842
5053
  return;
3843
5054
  }
3844
- const rawResults = await this.getLotteryTippingBulletResults();
3845
- const { betTypeId, betType } = getPlayTypeConfig({
3846
- rawData: this.rawData,
3847
- selectedBettingType: this.selectedBettingType,
3848
- selectedPlayingMode: this.selectedPlayingMode
3849
- });
3850
- const url = new URL(`${this.endpoint}/tickets`);
3851
- const body = buildSubmitParam({
3852
- playerId: this.playerId,
3853
- rawResults,
3854
- gameId: this.gameId,
3855
- rawData: this.rawData,
3856
- amount: this.calculateTotalAmount().toString(),
3857
- currentStake: this.currentStake,
3858
- betTypeId,
3859
- betType
3860
- });
3861
- this.submitLoading = true;
3862
- doSubmitTicket({ body, sessionId: this.sessionId, url: url.href })
3863
- .then(() => {
3864
- showNotification({ message: translate('ticketSubmitted', this.language) });
3865
- this.clearBulletConfig();
3866
- this.updateSaleStatistics();
3867
- })
3868
- .catch((res) => {
3869
- if (res.message === TICKET_INVALID_TOKEN) {
3870
- this.logoutEventHandler.emit();
3871
- showNotification({ message: TICKET_INVALID_TOKEN, theme: 'error' });
3872
- return;
3873
- }
3874
- showNotification({ message: translate('ticketFailed', this.language), theme: 'error' });
3875
- })
3876
- .finally(() => {
3877
- this.submitLoading = false;
3878
- });
5055
+ const switchBetType = () => {
5056
+ const newBetType = this.betTypes.find((bt) => bt.name === newBetTypeName);
5057
+ this._setBetType(newBetType);
5058
+ this.dialogConfig = { visible: false };
5059
+ };
5060
+ this.handleSwitchWithConfirmation(switchBetType);
3879
5061
  }
3880
- get lineCountRender() {
3881
- const _ = thousandSeparator(this.totalLineCombination);
3882
- let unit = translate('lines', this.language);
3883
- if ([0, 1].includes(+_))
3884
- unit = translate('line', this.language);
3885
- return _ + ' ' + unit;
5062
+ handleEventPartChange(event) {
5063
+ const newEventPartId = event.detail;
5064
+ if (newEventPartId === this.curEventPartId) {
5065
+ return;
5066
+ }
5067
+ const switchEventPart = () => {
5068
+ this.curEventPartId = newEventPartId;
5069
+ this._resetBulletConfig();
5070
+ this.dialogConfig = { visible: false };
5071
+ };
5072
+ this.handleSwitchWithConfirmation(switchEventPart);
3886
5073
  }
3887
- renderBettingControls() {
3888
- var _a;
3889
- const renderSkeleton = () => (index.h("div", { class: "skeleton-content" }, index.h("div", { class: "skeleton-item skeleton-animated" })));
3890
- const renderBettingTypeOptions = () => (index.h("div", { class: "LotteryTippingTicketController__segmented-control" }, this.bettingTypeOptions.map((item) => (index.h("button", { class: {
3891
- LotteryTippingTicketController__segment: true,
3892
- 'LotteryTippingTicketController__segment--active': this.selectedBettingType === item.code
3893
- }, onClick: this.handleBettingTypeChange.bind(this, item.code) }, item.name)))));
3894
- const renderPlayingModeOptions = () => (index.h("div", { class: "LotteryTippingTicketController__segmented-control" }, this.playingModeOptions.map((item) => (index.h("button", { class: {
3895
- LotteryTippingTicketController__segment: true,
3896
- 'LotteryTippingTicketController__segment--active': this.selectedPlayingMode === item.code
3897
- }, onClick: this.handlePlayingModeChange.bind(this, item.code) }, item.name)))));
3898
- const renderingStakeOptions = () => {
3899
- var _a, _b;
3900
- return (index.h("div", null, ((_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.length) === 1 ? (index.h("div", null, this.stakeOptions[0].label)) : (index.h("vaadin-select", { items: this.stakeOptions || [], value: ((_b = this.currentStake) === null || _b === void 0 ? void 0 : _b.value) || '', "on-value-changed": this.onStakeChange.bind(this), "no-vertical-overlap": true }))));
5074
+ onStakeChange(event) {
5075
+ this.currentStake = event.detail.value;
5076
+ }
5077
+ handleSwitchWithConfirmation(switchAction) {
5078
+ const closeDialog = () => {
5079
+ this.dialogConfig = { visible: false };
5080
+ };
5081
+ const doConfirm = () => {
5082
+ switchAction();
5083
+ closeDialog();
3901
5084
  };
3902
- return (index.h("div", { class: "LotteryTippingTicketController__top" }, index.h("div", { class: "LotteryTippingTicketController__row" }, index.h("div", { class: "LotteryTippingTicketController__section" }, index.h("span", { class: "LotteryTippingTicketController__label" }, translate('bettingType', this.language)), !!this.bettingTypeOptions.length ? renderBettingTypeOptions() : renderSkeleton()), index.h("div", { class: "LotteryTippingTicketController__section" }, index.h("span", { class: "LotteryTippingTicketController__label" }, translate('playingMode', this.language)), !!this.playingModeOptions.length ? renderPlayingModeOptions() : renderSkeleton())), index.h("div", { class: "LotteryTippingTicketController__row" }, ((_a = this.stakeOptions) === null || _a === void 0 ? void 0 : _a.length) && (index.h("div", { class: "LotteryTippingTicketController__section" }, index.h("span", { class: "LotteryTippingTicketController__label" }, translate('stakePerLine', this.language)), renderingStakeOptions())))));
5085
+ if (this.hasSelection) {
5086
+ this.dialogConfig = {
5087
+ visible: true,
5088
+ content: translate('selectionCleared', this.language),
5089
+ onConfirm: doConfirm,
5090
+ onCancel: closeDialog
5091
+ };
5092
+ }
5093
+ else {
5094
+ switchAction();
5095
+ }
3903
5096
  }
3904
- renderOrderSummary() {
3905
- var _a;
3906
- 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 ||
3907
- this.submitLoading ||
3908
- ((_a = this.currentStake) === null || _a === void 0 ? void 0 : _a.value) === undefined ||
3909
- !this.isSalesActive, text: translate('orderSummarySubmit', this.language) }))));
5097
+ _renderSkeletonBlock(style) {
5098
+ return index.h("div", { class: "skeleton-block", style: style });
5099
+ }
5100
+ renderSkeletons() {
5101
+ return (index.h("div", { class: "lottery-tipping-ticket-buy", ref: (el) => (this.stylingContainer = el) }, this._renderSkeletonBlock({ height: '60px', marginBottom: '16px' }), this._renderSkeletonBlock({ width: '60%', margin: '0 auto', height: '80px', marginBottom: '16px' }), index.h("div", { class: "bet-board", style: { display: 'flex', gap: '16px' } }, this._renderSkeletonBlock({ flex: '2', height: '400px' }), this._renderSkeletonBlock({ flex: '1', height: '400px' }))));
5102
+ }
5103
+ renderErrorContent() {
5104
+ return index.h("p", null, translate('error', this.language));
5105
+ }
5106
+ renderNoActiveDraw() {
5107
+ return (index.h("div", { class: "lottery-tipping-ticket-buy", ref: (el) => (this.stylingContainer = el) }, index.h("div", { class: "no-active-draw" }, translate('gameNotAvailable', this.language))));
5108
+ }
5109
+ get ticketDataSourceForBetSlip() {
5110
+ return this.parsedEvent.map(({ eventName, startTime, outcomes }) => ({
5111
+ eventName,
5112
+ startTime,
5113
+ outcomes: outcomes.map(({ betOn }) => ({ betOn }))
5114
+ }));
3910
5115
  }
3911
5116
  render() {
3912
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
3913
- if (this.gameUnavailable) {
3914
- return (index.h("div", { class: "lottery-tipping-ticket-controller__container", ref: (el) => (this.stylingContainer = el) }, index.h("div", { class: "noActiveDraw" }, translate('gameNotAvailable', this.language))));
5117
+ var _a, _b, _c, _d, _e, _f, _g, _h;
5118
+ if (this.isLoading) {
5119
+ return this.renderSkeletons();
5120
+ }
5121
+ else if (this.betHasErrors) {
5122
+ return this.renderErrorContent();
5123
+ }
5124
+ else if (this.gameUnavailable) {
5125
+ return this.renderNoActiveDraw();
5126
+ }
5127
+ else {
5128
+ return (index.h("div", { class: "lottery-tipping-ticket-buy", ref: (el) => (this.stylingContainer = el) }, index.h("lottery-banner", { clientStylingUrl: this.clientStylingUrl, stopTime: (_a = this.draw) === null || _a === void 0 ? void 0 : _a.wagerCloseTime, startTime: (_b = this.draw) === null || _b === void 0 ? void 0 : _b.wagerStartTime, "banner-title": (_d = (_c = this.gameConfig) === null || _c === void 0 ? void 0 : _c.game) === null || _d === void 0 ? void 0 : _d.name, turnover: formattedTurnover(this.turnover), language: this.language, "translation-url": this.translationUrl, onLotteryBannerWagerStarted: () => this.updateDrawSalesStatus() }), index.h("div", { class: "bet-selector" }, index.h("div", { class: "bet-selector-line" }, index.h("div", { class: "bet-selector-line-segments" }, index.h("lottery-segmented", { class: "event-part-selector", label: "Event Part", options: this.eventPartOptions, value: this.curEventPartId.toString(), onValueChange: this.handleEventPartChange.bind(this) }), index.h("lottery-segmented", { label: "Bet Type", options: this.betTypeOptions, value: ((_e = this.curBetType) === null || _e === void 0 ? void 0 : _e.name) || '', onValueChange: this.handleBetTypeChange.bind(this) }))), index.h("div", { class: "bet-selector-line" }, index.h("div", { class: "bet-selector-line-label" }, translate('stakePerLine', this.language)), index.h("div", { class: "bet-selector-line-input" }, this.stakeOptions.length > 1 ? (index.h("vaadin-select", { items: this.stakeOptions, value: this.currentStake, "on-value-changed": this.onStakeChange.bind(this), "no-vertical-overlap": true })) : (this.currentStake)))), index.h("div", { class: "bet-board" }, index.h("div", { class: "bet-board-slip" }, index.h("lottery-tipping-bet-slip", { language: this.language, "mb-source": this.mbSource, "client-styling": this.clientStyling, "client-styling-url": this.clientStylingUrl, "translation-url": this.translationUrl, "current-page": this.betCurrentPage, "total-pages": this.betTotalPages, "max-total-pages": this.boardRange.max, "min-total-pages": this.boardRange.min, mode: ((_f = this.curBetType) === null || _f === void 0 ? void 0 : _f.combinations) > 1 ? 'multi' : 'single', readPretty: false, bulletTexts: this.tippingBetOptions, bulletNames: this.tippingBetOptionNames, bulletTextsSplitToken: this.SPLIT_TOKEN, "ticket-data-source-str": JSON.stringify(this.ticketDataSourceForBetSlip), "bullet-selections-line-group-str": JSON.stringify(this.bulletSelectionsLineGroup), showClearButton: true })), index.h("div", { class: "bet-board-order" }, index.h("lottery-order-summary", { "client-styling": this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource, language: this.language, "translation-url": this.translationUrl, endpoint: this.endpoint, sessionId: this.sessionId, orderSummaryTitle: translate('orderSummaryTitle', this.language), ticketsLabel: translate('orderSummaryTickets', this.language), totalLabel: translate('orderSummaryTotal', this.language), "show-divider": true, submitLoading: this.submitLoading, submitDisabled: !this.hasSelectAllBullet || this.submitLoading || !this.isSalesActive, submitButtonText: translate('orderSummarySubmit', this.language) }, index.h("div", { class: "order-summary__details", slot: "orderSummaryTicketDetail" }, index.h("span", { class: "order-summary__line-count" }, `${this.totalLineCombination} ${this.totalLineCombination > 1 ? translate('lines', this.language) : translate('line', this.language)}`), index.h("div", null, index.h("span", { class: "order-summary__multiplier" }, "x"), index.h("span", { class: "order-summary__stake" }, `${this.currentStake} ${this.currency}`))), index.h("span", { class: "order-summary__details", slot: "orderSummaryTotalDetail" }, `${this.calculateTotalAmount()} ${this.currency}`)))), this.dialogConfig.visible && (index.h("vaadin-confirm-dialog", { rejectButtonVisible: true, rejectText: translate('cancel', this.language), confirmText: translate('confirm', this.language), opened: (_g = this.dialogConfig) === null || _g === void 0 ? void 0 : _g.visible, onConfirm: this.dialogConfig.onConfirm, onReject: this.dialogConfig.onCancel }, (_h = this.dialogConfig) === null || _h === void 0 ? void 0 : _h.content))));
3915
5129
  }
3916
- 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))));
3917
5130
  }
3918
- static get assetsDirs() { return ["../static"]; }
3919
5131
  static get watchers() { return {
3920
5132
  "clientStyling": ["handleClientStylingChange"],
3921
5133
  "clientStylingUrl": ["handleClientStylingUrlChange"],
3922
5134
  "mbSource": ["handleMbSourceChange"]
3923
5135
  }; }
3924
5136
  };
3925
- LotteryTippingTicketController.style = LotteryTippingTicketControllerStyle0;
5137
+ LotteryTippingTicketBuy.style = LotteryTippingTicketBuyStyle0;
3926
5138
 
3927
5139
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3928
5140
 
@@ -9008,7 +10220,7 @@ const LotteryTippingTicketHistory = class {
9008
10220
  this.rawData = res;
9009
10221
  }
9010
10222
  catch (e) {
9011
- showNotification$2({ message: (_a = e.message) !== null && _a !== void 0 ? _a : e, theme: 'error' });
10223
+ showNotification$1({ message: (_a = e.message) !== null && _a !== void 0 ? _a : e, theme: 'error' });
9012
10224
  }
9013
10225
  finally {
9014
10226
  }
@@ -9044,7 +10256,7 @@ const LotteryTippingTicketHistory = class {
9044
10256
  async fetchTicketList() {
9045
10257
  this.isLoading = true;
9046
10258
  try {
9047
- const { items, total } = await fetchRequest$1(`${this.endpoint}/tickets${toQueryParams(this.filterData)}`, 'GET', null, {
10259
+ const { items, total } = await fetchRequest$1(`${this.endpoint}/tickets${toQueryParams$1(this.filterData)}`, 'GET', null, {
9048
10260
  Authorization: `Bearer ${this.sessionId}`
9049
10261
  });
9050
10262
  this.ticketHistory = items;
@@ -9056,7 +10268,7 @@ const LotteryTippingTicketHistory = class {
9056
10268
  catch (e) {
9057
10269
  console.log('in fetchTicketList error is: ', e);
9058
10270
  if (e.status === 401) {
9059
- showNotification$2({ message: e.message, theme: 'error' });
10271
+ showNotification$1({ message: e.message, theme: 'error' });
9060
10272
  this.logout.emit();
9061
10273
  }
9062
10274
  }
@@ -9423,12 +10635,18 @@ const UiSkeleton = class {
9423
10635
  UiSkeleton.style = UiSkeletonStyle0;
9424
10636
 
9425
10637
  exports.lottery_tipping_entrance = lotteryTippingEntrance.LotteryTippingEntrance;
10638
+ exports.app_tooltip = Tooltip;
9426
10639
  exports.draw_selection = DrawSelection;
9427
10640
  exports.general_multi_select = GeneralMultiSelect;
9428
10641
  exports.general_tooltip = GeneralTooltip;
9429
10642
  exports.helper_count_down = HelperCountDown;
9430
10643
  exports.lottery_banner = LotteryBanner;
9431
10644
  exports.lottery_button = LotteryButton;
10645
+ exports.lottery_order_summary = LotteryOrderSummary;
10646
+ exports.lottery_segmented = LotterySegmented;
10647
+ exports.lottery_selection = LotterySelection;
10648
+ exports.lottery_selection_group = LotterySelectionGroup;
10649
+ exports.lottery_tipping_bet_slip = LotteryTippingBetSlip;
9432
10650
  exports.lottery_tipping_bullet = LotteryTippingBullet;
9433
10651
  exports.lottery_tipping_bullet_group = LotteryTippingBulletGroup;
9434
10652
  exports.lottery_tipping_calendar = LotteryTippingCalendar;
@@ -9439,6 +10657,6 @@ exports.lottery_tipping_page = LotteryTippingPage;
9439
10657
  exports.lottery_tipping_pagination = LotteryTippingPagination;
9440
10658
  exports.lottery_tipping_panel = lotteryTippingPanel;
9441
10659
  exports.lottery_tipping_ticket_bet = LotteryTippingTicketBet;
9442
- exports.lottery_tipping_ticket_controller = LotteryTippingTicketController;
10660
+ exports.lottery_tipping_ticket_buy = LotteryTippingTicketBuy;
9443
10661
  exports.lottery_tipping_ticket_history = LotteryTippingTicketHistory;
9444
10662
  exports.ui_skeleton = UiSkeleton;