@everymatrix/lottery-ticket 0.1.23 → 1.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-f01e4770.js +1303 -0
  3. package/dist/cjs/loader.cjs.js +7 -13
  4. package/dist/cjs/lottery-bullet_3.cjs.entry.js +402 -440
  5. package/dist/cjs/lottery-ticket.cjs.js +17 -11
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/lottery-ticket/index.js +1 -0
  8. package/dist/collection/components/lottery-ticket/lottery-ticket.js +435 -485
  9. package/dist/collection/utils/locale.utils.js +53 -43
  10. package/dist/esm/app-globals-0f993ce5.js +3 -0
  11. package/dist/esm/index-cde6554c.js +1276 -0
  12. package/dist/esm/loader.js +7 -13
  13. package/dist/esm/lottery-bullet_3.entry.js +402 -440
  14. package/dist/esm/lottery-ticket.js +14 -11
  15. package/dist/lottery-ticket/lottery-ticket.esm.js +1 -1
  16. package/dist/lottery-ticket/p-174b5b05.entry.js +1 -0
  17. package/dist/lottery-ticket/p-73c1e1fd.js +2 -0
  18. package/dist/lottery-ticket/p-e1255160.js +1 -0
  19. package/dist/stencil.config.dev.js +17 -0
  20. package/dist/stencil.config.js +14 -19
  21. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-ticket/.stencil/packages/stencil/lottery-ticket/stencil.config.d.ts +2 -0
  22. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-ticket/.stencil/packages/stencil/lottery-ticket/stencil.config.dev.d.ts +2 -0
  23. package/dist/types/components/lottery-ticket/index.d.ts +1 -0
  24. package/dist/types/components/lottery-ticket/lottery-ticket.d.ts +78 -78
  25. package/dist/types/components/lottery-ticket/lottery-ticket.types.d.ts +31 -31
  26. package/dist/types/components.d.ts +24 -5
  27. package/dist/types/stencil-public-runtime.d.ts +142 -33
  28. package/loader/cdn.js +1 -3
  29. package/loader/index.cjs.js +1 -3
  30. package/loader/index.d.ts +13 -1
  31. package/loader/index.es2017.js +1 -3
  32. package/loader/index.js +1 -3
  33. package/loader/package.json +1 -0
  34. package/package.json +10 -3
  35. package/dist/cjs/index-6033a99f.js +0 -1272
  36. package/dist/components/index.d.ts +0 -26
  37. package/dist/components/index.js +0 -1
  38. package/dist/components/lottery-bullet.js +0 -6
  39. package/dist/components/lottery-bullet2.js +0 -91
  40. package/dist/components/lottery-grid.js +0 -6
  41. package/dist/components/lottery-grid2.js +0 -236
  42. package/dist/components/lottery-ticket.d.ts +0 -11
  43. package/dist/components/lottery-ticket.js +0 -266
  44. package/dist/esm/index-7790b5a7.js +0 -1246
  45. package/dist/esm/polyfills/core-js.js +0 -11
  46. package/dist/esm/polyfills/css-shim.js +0 -1
  47. package/dist/esm/polyfills/dom.js +0 -79
  48. package/dist/esm/polyfills/es5-html-element.js +0 -1
  49. package/dist/esm/polyfills/index.js +0 -34
  50. package/dist/esm/polyfills/system.js +0 -6
  51. package/dist/lottery-ticket/p-4e7976c5.entry.js +0 -1
  52. package/dist/lottery-ticket/p-913d0cce.js +0 -1
  53. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/stencil/widgets-stencil/packages/lottery-ticket/.stencil/packages/lottery-ticket/stencil.config.d.ts +0 -2
@@ -2,483 +2,445 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-6033a99f.js');
5
+ const index = require('./index-f01e4770.js');
6
6
 
7
- const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}@-webkit-keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.22) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.2) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@-webkit-keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.Circle{-webkit-animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;cursor:pointer;color:#000000;display:block;height:30px;width:30px;margin:0;display:flex;align-items:center;justify-content:center;justify-content:center;align-items:center;border:solid 2px #ffffff;background:radial-gradient(circle at top, white 0%, white 100%);font-weight:bold;border-radius:50%;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.5);user-select:none;font-size:16px;line-height:16px;font-weight:600;position:relative}.Circle:hover{-webkit-animation:hover-rotate 0.4s linear both;animation:hover-rotate 0.4s linear both;background:radial-gradient(circle at top, white 0%, #f1f1f1 100%)}.Circle.Selected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#ffffff;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #00958f}.Circle.Disabled{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#D4D4D4;border:solid 2px #D4D4D4;cursor:default}.Circle.DisabledSelected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #D4D4D4;cursor:default}";
7
+ const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}@-webkit-keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.22) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.2) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@-webkit-keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.Circle{-webkit-animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;cursor:pointer;color:#000000;display:block;height:30px;width:30px;margin:0;display:flex;align-items:center;justify-content:center;justify-content:center;align-items:center;border:solid 2px #ffffff;background:radial-gradient(circle at top, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 100%);font-weight:bold;border-radius:50%;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.5);user-select:none;font-size:16px;line-height:16px;font-weight:600;position:relative}.Circle:hover{-webkit-animation:hover-rotate 0.4s linear both;animation:hover-rotate 0.4s linear both;background:radial-gradient(circle at top, rgb(255, 255, 255) 0%, rgb(241, 241, 241) 100%)}.Circle.Selected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#ffffff;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #00958f}.Circle.Disabled{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#D4D4D4;border:solid 2px #D4D4D4;cursor:default}.Circle.DisabledSelected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #D4D4D4;cursor:default}";
8
+ const LotteryBulletStyle0 = lotteryBulletCss;
8
9
 
9
10
  const LotteryBullet = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this.bulletEvent = index.createEvent(this, "lotteryBulletSelection", 7);
13
- /**
14
- * Value of the bullet
15
- */
16
- this.value = '0';
17
- /**
18
- * Marks if the bullet should be selectable
19
- */
20
- this.selectable = true;
21
- /**
22
- * Marks if the bullet should be selected
23
- */
24
- this.isSelected = false;
25
- /**
26
- * Client custom styling via string
27
- */
28
- this.clientStyling = '';
29
- /**
30
- * Client custom styling via url content
31
- */
32
- this.clientStylingUrlContent = '';
33
- this.limitStylingAppends = false;
34
- this.select = () => {
35
- if (this.selectable) {
36
- this.isSelected = !this.isSelected;
37
- this.bulletEvent.emit({
38
- value: this.value,
39
- selected: this.isSelected
40
- });
41
- }
42
- };
43
- this.setClientStyling = () => {
44
- let sheet = document.createElement('style');
45
- sheet.innerHTML = this.clientStyling;
46
- this.stylingContainer.prepend(sheet);
47
- };
48
- this.setClientStylingURL = () => {
49
- let cssFile = document.createElement('style');
50
- setTimeout(() => {
51
- cssFile.innerHTML = this.clientStylingUrlContent;
52
- this.stylingContainer.prepend(cssFile);
53
- }, 1);
54
- };
55
- }
56
- componentDidRender() {
57
- // start custom styling area
58
- if (!this.limitStylingAppends && this.stylingContainer) {
59
- if (this.clientStyling)
60
- this.setClientStyling();
61
- if (this.clientStylingUrlContent)
62
- this.setClientStylingURL();
63
- this.limitStylingAppends = true;
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.bulletEvent = index.createEvent(this, "lotteryBulletSelection", 7);
14
+ this.select = () => {
15
+ if (this.selectable) {
16
+ this.isSelected = !this.isSelected;
17
+ this.bulletEvent.emit({
18
+ value: this.value,
19
+ selected: this.isSelected
20
+ });
21
+ }
22
+ };
23
+ this.setClientStyling = () => {
24
+ let sheet = document.createElement('style');
25
+ sheet.innerHTML = this.clientStyling;
26
+ this.stylingContainer.prepend(sheet);
27
+ };
28
+ this.setClientStylingURL = () => {
29
+ let cssFile = document.createElement('style');
30
+ setTimeout(() => {
31
+ cssFile.innerHTML = this.clientStylingUrlContent;
32
+ this.stylingContainer.prepend(cssFile);
33
+ }, 1);
34
+ };
35
+ this.value = '0';
36
+ this.selectable = true;
37
+ this.isSelected = false;
38
+ this.clientStyling = '';
39
+ this.clientStylingUrlContent = '';
40
+ this.limitStylingAppends = false;
41
+ }
42
+ componentDidRender() {
43
+ // start custom styling area
44
+ if (!this.limitStylingAppends && this.stylingContainer) {
45
+ if (this.clientStyling)
46
+ this.setClientStyling();
47
+ if (this.clientStylingUrlContent)
48
+ this.setClientStylingURL();
49
+ this.limitStylingAppends = true;
50
+ }
51
+ // end custom styling area
52
+ }
53
+ render() {
54
+ return (index.h("div", { key: 'af3601684ecf1f39d65fc9461430cba96b9e4b8c', class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
64
55
  }
65
- // end custom styling area
66
- }
67
- render() {
68
- return (index.h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
69
- }
70
56
  };
71
- LotteryBullet.style = lotteryBulletCss;
57
+ LotteryBullet.style = LotteryBulletStyle0;
72
58
 
73
59
  const lotteryGridCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridContainer{display:flex;flex-direction:column;max-width:1200px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:20px}.Grid.TicketGrid{gap:5px}";
60
+ const LotteryGridStyle0 = lotteryGridCss;
74
61
 
75
62
  const LotteryGrid = class {
76
- constructor(hostRef) {
77
- index.registerInstance(this, hostRef);
78
- this.gridFilledEvent = index.createEvent(this, "gridFilled", 7);
79
- this.gridDirtyEvent = index.createEvent(this, "gridDirty", 7);
80
- /**
81
- * Number of bullets of grid
82
- */
83
- this.totalNumbers = 0;
84
- /**
85
- * Number of maximum bullets that can be selected
86
- */
87
- this.maximumAllowed = 0;
88
- /**
89
- * Minimum allowed of bullets
90
- */
91
- this.minimumAllowed = 1;
92
- /**
93
- * Allows the user to select numbers on the grid
94
- */
95
- this.selectable = true;
96
- /**
97
- * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
98
- */
99
- this.selectedNumbers = '';
100
- /**
101
- * Show only selected numbers
102
- */
103
- this.displaySelected = false;
104
- /**
105
- * Language
106
- */
107
- this.language = 'en';
108
- /**
109
- * Personalize grid for ticket
110
- */
111
- this.gridType = '';
112
- /**
113
- * Client custom styling via string
114
- */
115
- this.clientStyling = '';
116
- /**
117
- * Client custom styling via url content
118
- */
119
- this.clientStylingUrlContent = '';
120
- this.numbers = [];
121
- this.limitStylingAppends = false;
122
- this.selectedCounter = 0;
123
- this.setClientStyling = () => {
124
- let sheet = document.createElement('style');
125
- sheet.innerHTML = this.clientStyling;
126
- this.stylingContainer.prepend(sheet);
127
- };
128
- this.setClientStylingURL = () => {
129
- let cssFile = document.createElement('style');
130
- setTimeout(() => {
131
- cssFile.innerHTML = this.clientStylingUrlContent;
132
- this.stylingContainer.prepend(cssFile);
133
- }, 1);
134
- };
135
- }
136
- connectedCallback() {
137
- let selected = [];
138
- if (this.selectedNumbers.length > 0) {
139
- selected = this.selectedNumbers.split(',');
140
- this.selectedCounter = selected.length;
63
+ constructor(hostRef) {
64
+ index.registerInstance(this, hostRef);
65
+ this.gridFilledEvent = index.createEvent(this, "gridFilled", 7);
66
+ this.gridDirtyEvent = index.createEvent(this, "gridDirty", 7);
67
+ this.selectedCounter = 0;
68
+ this.setClientStyling = () => {
69
+ let sheet = document.createElement('style');
70
+ sheet.innerHTML = this.clientStyling;
71
+ this.stylingContainer.prepend(sheet);
72
+ };
73
+ this.setClientStylingURL = () => {
74
+ let cssFile = document.createElement('style');
75
+ setTimeout(() => {
76
+ cssFile.innerHTML = this.clientStylingUrlContent;
77
+ this.stylingContainer.prepend(cssFile);
78
+ }, 1);
79
+ };
80
+ this.ticketId = undefined;
81
+ this.totalNumbers = 0;
82
+ this.gameId = undefined;
83
+ this.maximumAllowed = 0;
84
+ this.minimumAllowed = 1;
85
+ this.selectable = true;
86
+ this.selectedNumbers = '';
87
+ this.displaySelected = false;
88
+ this.language = 'en';
89
+ this.gridIndex = undefined;
90
+ this.gridType = '';
91
+ this.clientStyling = '';
92
+ this.clientStylingUrlContent = '';
93
+ this.numbers = [];
94
+ this.limitStylingAppends = false;
141
95
  }
142
- if (this.displaySelected) {
143
- selected.forEach((item) => {
144
- this.numbers.push({
145
- number: item,
146
- selected: true,
147
- selectable: this.selectable
148
- });
149
- });
96
+ connectedCallback() {
97
+ let selected = [];
98
+ if (this.selectedNumbers.length > 0) {
99
+ selected = this.selectedNumbers.split(',');
100
+ this.selectedCounter = selected.length;
101
+ }
102
+ if (this.displaySelected) {
103
+ selected.forEach((item) => {
104
+ this.numbers.push({
105
+ number: item,
106
+ selected: true,
107
+ selectable: this.selectable
108
+ });
109
+ });
110
+ }
111
+ else {
112
+ [...Array(this.totalNumbers).keys()]
113
+ .map(number => (number + 1).toString())
114
+ .forEach((number) => {
115
+ this.numbers.push({
116
+ number,
117
+ selected: selected.indexOf(number) >= 0 ? true : false,
118
+ selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
119
+ });
120
+ });
121
+ }
150
122
  }
151
- else {
152
- [...Array(this.totalNumbers).keys()]
153
- .map(number => (number + 1).toString())
154
- .forEach((number) => {
155
- this.numbers.push({
156
- number,
157
- selected: selected.indexOf(number) >= 0 ? true : false,
158
- selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
159
- });
160
- });
123
+ componentDidRender() {
124
+ // start custom styling area
125
+ if (!this.limitStylingAppends && this.stylingContainer) {
126
+ if (this.clientStyling)
127
+ this.setClientStyling();
128
+ if (this.clientStylingUrlContent)
129
+ this.setClientStylingURL();
130
+ this.limitStylingAppends = true;
131
+ }
132
+ // end custom styling area
161
133
  }
162
- }
163
- componentDidRender() {
164
- // start custom styling area
165
- if (!this.limitStylingAppends && this.stylingContainer) {
166
- if (this.clientStyling)
167
- this.setClientStyling();
168
- if (this.clientStylingUrlContent)
169
- this.setClientStylingURL();
170
- this.limitStylingAppends = true;
134
+ // wrote this because the classic .sort(() => 0.5 - Math.random()) method yielded low entropy shuffles for some reason on certain devices
135
+ shuffleArray(array) {
136
+ const result = [];
137
+ while (array.length > 0) {
138
+ const randomIndex = Math.floor(Math.random() * (array.length));
139
+ result.push(array.splice(randomIndex, 1)[0]);
140
+ }
141
+ return result;
171
142
  }
172
- // end custom styling area
173
- }
174
- lotteryBulletSelectionHandler(event) {
175
- this.numbers = this.numbers.map((item) => {
176
- if (item.number == event.detail.value) {
177
- return {
178
- number: item.number,
179
- selected: event.detail.selected,
180
- selectable: item.selectable
181
- };
182
- }
183
- return {
184
- number: item.number,
185
- selected: item.selected,
186
- selectable: item.selectable
187
- };
188
- });
189
- if (event.detail.selected) {
190
- this.selectedCounter += 1;
191
- if (this.selectedCounter == this.maximumAllowed) {
143
+ lotteryBulletSelectionHandler(event) {
192
144
  this.numbers = this.numbers.map((item) => {
193
- return {
194
- number: item.number,
195
- selected: item.selected,
196
- selectable: item.selected ? true : false
197
- };
198
- });
199
- this.gridFilledEvent.emit({
200
- id: this.ticketId,
201
- index: this.gridIndex,
202
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
145
+ if (item.number == event.detail.value) {
146
+ return {
147
+ number: item.number,
148
+ selected: event.detail.selected,
149
+ selectable: item.selectable
150
+ };
151
+ }
152
+ return {
153
+ number: item.number,
154
+ selected: item.selected,
155
+ selectable: item.selectable
156
+ };
203
157
  });
204
- }
158
+ if (event.detail.selected) {
159
+ this.selectedCounter += 1;
160
+ if (this.selectedCounter == this.maximumAllowed) {
161
+ this.numbers = this.numbers.map((item) => {
162
+ return {
163
+ number: item.number,
164
+ selected: item.selected,
165
+ selectable: item.selected ? true : false
166
+ };
167
+ });
168
+ this.gridFilledEvent.emit({
169
+ id: this.ticketId,
170
+ index: this.gridIndex,
171
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
172
+ });
173
+ }
174
+ }
175
+ else {
176
+ if (this.selectedCounter == this.maximumAllowed) {
177
+ this.numbers = this.numbers.map((item) => {
178
+ return {
179
+ number: item.number,
180
+ selected: item.selected,
181
+ selectable: true
182
+ };
183
+ });
184
+ this.gridDirtyEvent.emit({
185
+ id: this.ticketId,
186
+ index: this.gridIndex,
187
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
188
+ });
189
+ }
190
+ this.selectedCounter -= 1;
191
+ }
205
192
  }
206
- else {
207
- if (this.selectedCounter == this.maximumAllowed) {
208
- this.numbers = this.numbers.map((item) => {
209
- return {
210
- number: item.number,
211
- selected: item.selected,
212
- selectable: true
213
- };
214
- });
215
- this.gridDirtyEvent.emit({
216
- id: this.ticketId,
217
- index: this.gridIndex,
218
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
219
- });
220
- }
221
- this.selectedCounter -= 1;
193
+ async resetSelectionHandler(event) {
194
+ if (event.detail && event.detail == this.ticketId) {
195
+ this.selectedCounter = 0;
196
+ this.numbers = this.numbers.map((item) => {
197
+ return {
198
+ number: item.number,
199
+ selected: false,
200
+ selectable: this.selectable
201
+ };
202
+ });
203
+ this.gridDirtyEvent.emit({
204
+ id: this.ticketId,
205
+ index: this.gridIndex,
206
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
207
+ });
208
+ }
222
209
  }
223
- }
224
- async resetSelectionHandler(event) {
225
- if (event.detail && event.detail == this.ticketId) {
226
- this.selectedCounter = 0;
227
- this.numbers = this.numbers.map((item) => {
228
- return {
229
- number: item.number,
230
- selected: false,
231
- selectable: this.selectable
232
- };
233
- });
234
- this.gridDirtyEvent.emit({
235
- id: this.ticketId,
236
- index: this.gridIndex,
237
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
238
- });
210
+ async autoSelectionHandler(event) {
211
+ if (event.detail && event.detail == this.ticketId) {
212
+ this.resetSelectionHandler(event);
213
+ let array = [...Array(this.totalNumbers).keys()]
214
+ .map(number => number + 1);
215
+ array = this.shuffleArray(array);
216
+ array = array.slice(0, this.minimumAllowed);
217
+ this.numbers = this.numbers.map((item) => {
218
+ return {
219
+ number: item.number,
220
+ selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
221
+ selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
222
+ };
223
+ });
224
+ this.gridFilledEvent.emit({
225
+ id: this.ticketId,
226
+ index: this.gridIndex,
227
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
228
+ });
229
+ this.selectedCounter = this.maximumAllowed;
230
+ }
239
231
  }
240
- }
241
- async autoSelectionHandler(event) {
242
- if (event.detail && event.detail == this.ticketId) {
243
- this.resetSelectionHandler(event);
244
- let array = [...Array(this.totalNumbers).keys()]
245
- .map(number => number + 1)
246
- .sort(() => 0.5 - Math.random());
247
- array = array.slice(0, this.minimumAllowed);
248
- this.numbers = this.numbers.map((item) => {
249
- return {
250
- number: item.number,
251
- selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
252
- selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
253
- };
254
- });
255
- this.gridFilledEvent.emit({
256
- id: this.ticketId,
257
- index: this.gridIndex,
258
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
259
- });
260
- this.selectedCounter = this.maximumAllowed;
232
+ render() {
233
+ return (index.h("div", { key: '54b9187146b5d2625fd5ce7f53f38abf091cd943', class: "GridContainer", ref: el => this.stylingContainer = el }, index.h("div", { key: 'e7e8570557ebaa78edf881cdbc1ed720028cdf6e', class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => index.h("div", null, index.h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
261
234
  }
262
- }
263
- render() {
264
- return (index.h("div", { class: "GridContainer", ref: el => this.stylingContainer = el }, index.h("div", { class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => index.h("div", null, index.h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
265
- }
266
235
  };
267
- LotteryGrid.style = lotteryGridCss;
236
+ LotteryGrid.style = LotteryGridStyle0;
268
237
 
269
238
  const DEFAULT_LANGUAGE = 'en';
270
- const SUPPORTED_LANGUAGES = ['ro', 'en'];
239
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'hr'];
271
240
  const TRANSLATIONS = {
272
- en: {
273
- loading: 'Loading, please wait ...',
274
- error: 'It was an error while trying to fetch the data',
275
- grid: 'Grid',
276
- multiplier: 'Multiplier',
277
- numberOfDraws: 'Number of draws',
278
- wagerPerDraw: 'Wager per draw',
279
- resetButton: 'Reset',
280
- autoButton: 'I feel lucky'
281
- },
282
- ro: {
283
- loading: 'Se incarca, va rugam asteptati ...',
284
- error: 'A fost o eroare in timp ce asteptam datele',
285
- grid: 'Grid',
286
- multiplier: 'Multiplicator',
287
- numberOfDraws: 'Numarul de extrageri',
288
- wagerPerDraw: 'Pariul per extragere',
289
- resetButton: 'Reseteaza',
290
- autoButton: 'Ma simt norocos'
291
- },
292
- fr: {
293
- loading: 'Loading, please wait ...',
294
- error: 'It was an error while trying to fetch the data',
295
- grid: 'Grid',
296
- multiplier: 'Multiplier',
297
- numberOfDraws: 'Number of draws',
298
- wagerPerDraw: 'Wager per draw',
299
- resetButton: 'Reset',
300
- autoButton: 'I feel lucky'
301
- },
302
- ar: {
303
- loading: 'Loading, please wait ...',
304
- error: 'It was an error while trying to fetch the data',
305
- grid: 'Grid',
306
- multiplier: 'Multiplier',
307
- numberOfDraws: 'Number of draws',
308
- wagerPerDraw: 'Wager per draw',
309
- resetButton: 'Reset',
310
- autoButton: 'I feel lucky'
311
- }
241
+ en: {
242
+ loading: 'Loading, please wait ...',
243
+ error: 'It was an error while trying to fetch the data',
244
+ grid: 'Grid',
245
+ multiplier: 'Multiplier',
246
+ numberOfDraws: 'Number of draws',
247
+ wagerPerDraw: 'Wager per draw',
248
+ resetButton: 'Reset',
249
+ autoButton: 'I feel lucky'
250
+ },
251
+ ro: {
252
+ loading: 'Se incarca, va rugam asteptati ...',
253
+ error: 'A fost o eroare in timp ce asteptam datele',
254
+ grid: 'Grid',
255
+ multiplier: 'Multiplicator',
256
+ numberOfDraws: 'Numarul de extrageri',
257
+ wagerPerDraw: 'Pariul per extragere',
258
+ resetButton: 'Reseteaza',
259
+ autoButton: 'Ma simt norocos'
260
+ },
261
+ fr: {
262
+ loading: 'Loading, please wait ...',
263
+ error: 'It was an error while trying to fetch the data',
264
+ grid: 'Grid',
265
+ multiplier: 'Multiplier',
266
+ numberOfDraws: 'Number of draws',
267
+ wagerPerDraw: 'Wager per draw',
268
+ resetButton: 'Reset',
269
+ autoButton: 'I feel lucky'
270
+ },
271
+ ar: {
272
+ loading: 'Loading, please wait ...',
273
+ error: 'It was an error while trying to fetch the data',
274
+ grid: 'Grid',
275
+ multiplier: 'Multiplier',
276
+ numberOfDraws: 'Number of draws',
277
+ wagerPerDraw: 'Wager per draw',
278
+ resetButton: 'Reset',
279
+ autoButton: 'I feel lucky'
280
+ },
281
+ hr: {
282
+ loading: 'Učitavanje, molimo pričekajte ...',
283
+ error: 'Došlo je do pogreške prilikom pokušaja dohvaćanja podataka',
284
+ grid: 'Tablica',
285
+ multiplier: 'Multiplikator',
286
+ numberOfDraws: 'Broj izvlačenja',
287
+ wagerPerDraw: 'Ulog po izvlačenju',
288
+ resetButton: 'Resetiraj',
289
+ autoButton: 'Osjećam se sretno'
290
+ }
312
291
  };
313
292
  const translate = (key, customLang) => {
314
- const lang = customLang;
315
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
293
+ const lang = customLang;
294
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
316
295
  };
317
296
 
318
297
  const lotteryTicketCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketTitle{font-size:16px;font-weight:bold}.ButtonContainer{display:flex;justify-content:flex-end}.Toggle{cursor:pointer;margin-top:20px;display:inline-block}.ToggleSwitch{display:inline-block;background:#707070;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #F1F1F1 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#00ABA4}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px;font-size:14px;font-weight:lighter;color:#000}input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}.NumberInput,.WagerInput{margin-top:10px;display:inline-flex;align-items:center}.NumberInput,.NumberInput *{box-sizing:border-box}.NumberInput button{cursor:pointer;outline:none;-webkit-appearance:none;border:none;align-items:center;justify-content:center;height:20px;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);align-items:center;text-align:center}.NumberInput button.Plus:after{transform:translate(-50%, -50%) rotate(0deg);width:30px;display:inline-flex;align-items:center;text-align:center}.NumberInput input[type=number],.WagerInput input[type=number]{max-width:50px;display:inline-flex;align-items:center;padding:4px 10px;text-align:center}.NumberInput input[type=number] .WagerInputTitle,.WagerInput input[type=number] .WagerInputTitle{font-size:14px;color:#000;padding:10px}.InputDefault{background-color:#F1F1F1;border-radius:4px;padding:5px;border:solid 1px #D4D4D4;color:#707070}.AutoButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.AutoButton:active{background:#00958f;color:#FFF}.ResetButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ResetButton:hover{background:#FF6536;border:1px solid #FF3D00}.TicketGridBullets{background:#f1f1f1;border-radius:4px;padding:20px;margin-top:5px}.TicketGridBullets .TicketGridTitle{margin-top:0px}.Minus{border-radius:4px;width:30px;height:24px !important;margin-right:10px;color:#FFF;background:#009993}.Plus{border-radius:4px;width:30px;height:24px !important;margin-left:10px;color:#FFF;background:#009993}.SelectWrapper{width:auto;padding:5px;margin:0 auto;border:1px solid #ccc;border-radius:5px;position:relative}.SelectButton,.SelectOptions li{display:flex;align-items:center;cursor:pointer}.SelectButton{display:flex;padding:0 5px;border-radius:7px;align-items:center;justify-content:space-between;font-size:14px}.SelectButton span:first-child{padding-right:10px}.SelectExpand{transition:transform 0.3s linear;font-size:12px}.SelectActive .SelectExpand{transform:rotate(180deg)}.SelectContent{display:none;padding:5px;border-radius:7px}.SelectWrapper.SelectActive .SelectContent{width:100%;display:block;position:absolute;left:0;top:32px;padding:0;border:1px solid #ccc;overflow:hidden;background:#fff}.SelectContent .SelectOptions{max-height:100px;margin:0;overflow-y:auto;padding:0}.SelectContent .SelectOptions .SelectedValue{background-color:#009993;color:#fff}.SelectOptions::-webkit-scrollbar{width:7px}.SelectOptions::-webkit-scrollbar-track{background:#f1f1f1;border-radius:25px}.SelectOptions::-webkit-scrollbar-thumb{background:#ccc;border-radius:25px}.SelectOptions li{height:20px;padding:0 13px;font-size:14px}.SelectOptions li:hover{background:#f2f2f2}";
298
+ const LotteryTicketStyle0 = lotteryTicketCss;
319
299
 
320
300
  const LotteryTicket = class {
321
- constructor(hostRef) {
322
- index.registerInstance(this, hostRef);
323
- this.ticketCompleted = index.createEvent(this, "ticketCompleted", 7);
324
- this.autoSelection = index.createEvent(this, "autoSelection", 7);
325
- this.resetSelection = index.createEvent(this, "resetSelection", 7);
326
- this.stakeChange = index.createEvent(this, "stakeChange", 7);
327
- this.multiplierChange = index.createEvent(this, "multiplierChange", 7);
328
- /**
329
- * Number of grids of a ticket
330
- */
331
- this.numberOfGrids = 1;
332
- /**
333
- * Option to have the ticket registered for multiple draws
334
- */
335
- this.multipleDraws = true;
336
- /**
337
- * Shows the reset button
338
- */
339
- this.resetButton = false;
340
- /**
341
- * Shows the auto-pick button
342
- */
343
- this.autoPick = false;
344
- /**
345
- * Language
346
- */
347
- this.language = 'en';
348
- /**
349
- * Client custom styling via string
350
- */
351
- this.clientStyling = '';
301
+ constructor(hostRef) {
302
+ index.registerInstance(this, hostRef);
303
+ this.ticketCompleted = index.createEvent(this, "ticketCompleted", 7);
304
+ this.autoSelection = index.createEvent(this, "autoSelection", 7);
305
+ this.resetSelection = index.createEvent(this, "resetSelection", 7);
306
+ this.stakeChange = index.createEvent(this, "stakeChange", 7);
307
+ this.multiplierChange = index.createEvent(this, "multiplierChange", 7);
308
+ this.setClientStyling = () => {
309
+ let sheet = document.createElement('style');
310
+ sheet.innerHTML = this.clientStyling;
311
+ this.stylingContainer.prepend(sheet);
312
+ };
313
+ this.setClientStylingURL = () => {
314
+ let cssFile = document.createElement('style');
315
+ setTimeout(() => {
316
+ cssFile.innerHTML = this.clientStylingUrlContent;
317
+ this.stylingContainer.prepend(cssFile);
318
+ }, 1);
319
+ };
320
+ this.endpoint = undefined;
321
+ this.gameId = undefined;
322
+ this.numberOfGrids = 1;
323
+ this.multipleDraws = true;
324
+ this.ticketId = undefined;
325
+ this.resetButton = false;
326
+ this.autoPick = false;
327
+ this.language = 'en';
328
+ this.clientStyling = '';
329
+ this.clientStylingUrlContent = '';
330
+ this.multiplier = false;
331
+ this.numberOfDraws = 1;
332
+ this.isLoading = true;
333
+ this.hasErrors = false;
334
+ this.ticketDone = false;
335
+ this.isCustomSelect = false;
336
+ this.amountInfo = {};
337
+ this.limitStylingAppends = false;
338
+ }
352
339
  /**
353
- * Client custom styling via url content
340
+ * @TODO find a better way to implement click outside the custom select, so that we don't have to use the 'data-cluster' attribute on each element
354
341
  */
355
- this.clientStylingUrlContent = '';
356
- this.multiplier = false;
357
- this.numberOfDraws = 1;
358
- this.isLoading = true;
359
- this.hasErrors = false;
360
- this.ticketDone = false;
361
- this.isCustomSelect = false;
362
- this.amountInfo = {};
363
- this.limitStylingAppends = false;
364
- this.setClientStyling = () => {
365
- let sheet = document.createElement('style');
366
- sheet.innerHTML = this.clientStyling;
367
- this.stylingContainer.prepend(sheet);
368
- };
369
- this.setClientStylingURL = () => {
370
- let cssFile = document.createElement('style');
371
- setTimeout(() => {
372
- cssFile.innerHTML = this.clientStylingUrlContent;
373
- this.stylingContainer.prepend(cssFile);
374
- }, 1);
375
- };
376
- }
377
- /**
378
- * @TODO find a better way to implement click outside the custom select, so that we don't have to use the 'data-cluster' attribute on each element
379
- */
380
- checkForClickOutside(ev) {
381
- if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
382
- this.isCustomSelect = false;
342
+ checkForClickOutside(ev) {
343
+ if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
344
+ this.isCustomSelect = false;
345
+ }
346
+ }
347
+ connectedCallback() {
348
+ let url = new URL(`${this.endpoint}/games/${this.gameId}`);
349
+ fetch(url.href)
350
+ .then((response) => {
351
+ if (response.ok) {
352
+ return response.json();
353
+ }
354
+ else {
355
+ // Throw error
356
+ this.hasErrors = true;
357
+ }
358
+ })
359
+ .then((data) => {
360
+ this.isLoading = false;
361
+ this.gameData = data;
362
+ this.grids = [...Array(this.gameData.type.boards.length).keys()];
363
+ this.amountInfo = this.gameData.type.stakes[0]; // initial value for select
364
+ })
365
+ .catch((err) => {
366
+ this.isLoading = false;
367
+ this.hasErrors = true;
368
+ console.error('Error!', err);
369
+ });
383
370
  }
384
- }
385
- connectedCallback() {
386
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
387
- fetch(url.href)
388
- .then((response) => {
389
- if (response.ok) {
390
- return response.json();
391
- }
392
- else {
393
- // Throw error
394
- this.hasErrors = true;
395
- }
396
- })
397
- .then((data) => {
398
- this.isLoading = false;
399
- this.gameData = data;
400
- this.grids = [...Array(data.rules.boards.length).keys()];
401
- this.amountInfo = this.gameData.rules.stakes[0]; // initial value for select
402
- })
403
- .catch((err) => {
404
- this.isLoading = false;
405
- this.hasErrors = true;
406
- console.error('Error!', err);
407
- });
408
- }
409
- componentDidRender() {
410
- // start custom styling area
411
- if (!this.limitStylingAppends && this.stylingContainer) {
412
- if (this.clientStyling)
413
- this.setClientStyling();
414
- if (this.clientStylingUrlContent)
415
- this.setClientStylingURL();
416
- this.limitStylingAppends = true;
371
+ componentDidRender() {
372
+ // start custom styling area
373
+ if (!this.limitStylingAppends && this.stylingContainer) {
374
+ if (this.clientStyling)
375
+ this.setClientStyling();
376
+ if (this.clientStylingUrlContent)
377
+ this.setClientStylingURL();
378
+ this.limitStylingAppends = true;
379
+ }
380
+ // end custom styling area
417
381
  }
418
- // end custom styling area
419
- }
420
- multiplierChangeHandler(e) {
421
- this.multiplier = e.target ? e.target.checked : false;
422
- this.multiplierChange.emit(this.multiplier);
423
- }
424
- drawsChangeHandler(event) {
425
- this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
426
- this.ticketCompleted.emit(this.ticket);
427
- }
428
- gridFilledHandler(event) {
429
- this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
430
- this.ticketDone = true;
431
- this.ticketCompleted.emit(this.ticket);
432
- }
433
- toggleAutoSelection() {
434
- this.ticketDone = true;
435
- this.autoSelection.emit(this.ticketId);
436
- }
437
- toggleResetSelection() {
438
- this.ticketDone = false;
439
- this.resetSelection.emit(this.ticketId);
440
- }
441
- changeStake(ticketid, amount) {
442
- this.stakeChange.emit({
443
- ticketId: ticketid,
444
- stake: amount
445
- });
446
- }
447
- toggleClass() {
448
- this.isCustomSelect = !this.isCustomSelect;
449
- }
450
- setDropdownItem(item) {
451
- this.amountInfo = {
452
- amount: item.amount,
453
- currency: item.currency
454
- };
455
- this.isCustomSelect = false;
456
- this.changeStake(this.ticketId, item.amount);
457
- }
458
- render() {
459
- if (this.isLoading) {
460
- return (index.h("div", null, index.h("p", null, translate('loading', this.language))));
382
+ multiplierChangeHandler(e) {
383
+ this.multiplier = e.target ? e.target.checked : false;
384
+ this.multiplierChange.emit(this.multiplier);
385
+ }
386
+ drawsChangeHandler(event) {
387
+ this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
388
+ this.ticketCompleted.emit(this.ticket);
389
+ }
390
+ gridFilledHandler(event) {
391
+ this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
392
+ this.ticketDone = true;
393
+ this.ticketCompleted.emit(this.ticket);
394
+ }
395
+ toggleAutoSelection() {
396
+ this.ticketDone = true;
397
+ this.autoSelection.emit(this.ticketId);
398
+ }
399
+ toggleResetSelection() {
400
+ this.ticketDone = false;
401
+ this.resetSelection.emit(this.ticketId);
402
+ }
403
+ changeStake(ticketid, amount) {
404
+ this.stakeChange.emit({
405
+ ticketId: ticketid,
406
+ stake: amount
407
+ });
408
+ }
409
+ toggleClass() {
410
+ this.isCustomSelect = !this.isCustomSelect;
411
+ }
412
+ setDropdownItem(item) {
413
+ this.amountInfo = {
414
+ value: item.value,
415
+ currency: item.currency
416
+ };
417
+ this.isCustomSelect = false;
418
+ this.changeStake(this.ticketId, item.amount);
461
419
  }
462
- else {
463
- if (this.hasErrors) {
464
- return (index.h("div", null, index.h("p", null, translate('error', this.language))));
465
- }
466
- else {
467
- const { rules } = this.gameData;
468
- return (index.h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, index.h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
469
- index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
470
- index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((item, index$1) => index.h("div", { class: "TicketGridBullets" }, index.h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), index.h("lottery-grid", { "grid-index": index$1, "maximum-allowed": rules.boards[index$1].maximumAllowed, "minimum-allowed": rules.boards[index$1].minimumAllowed, "total-numbers": rules.boards[index$1].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), rules.multiplier &&
471
- index.h("div", null, index.h("label", { class: "Toggle" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), ": "), index.h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), index.h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
472
- index.h("div", { class: "TicketDraws" }, index.h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), index.h("div", { class: "NumberInput" }, index.h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), index.h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), index.h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), index.h("div", null, index.h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), index.h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
473
- (index.h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, index.h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, index.h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.amount, " ", this.amountInfo.currency), index.h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), index.h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, index.h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, rules.stakes.map((item) => index.h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.amount == item.amount ? 'SelectedValue' : '', value: item.amount, onClick: () => this.setDropdownItem(item) }, item.amount, " ", item.currency)))))) : (index.h("div", null, index.h("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }), index.h("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))))));
474
- }
420
+ render() {
421
+ if (this.isLoading) {
422
+ return (index.h("div", null, index.h("p", null, translate('loading', this.language))));
423
+ }
424
+ else {
425
+ if (this.hasErrors) {
426
+ return (index.h("div", null, index.h("p", null, translate('error', this.language))));
427
+ }
428
+ else {
429
+ const { type } = this.gameData;
430
+ return (index.h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, index.h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
431
+ index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
432
+ index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((_, index$1) => index.h("div", { class: "TicketGridBullets" }, index.h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", index$1 + 1), index.h("lottery-grid", { "grid-index": index$1, "maximum-allowed": type.boards[index$1].maximumAllowed, "minimum-allowed": type.boards[index$1].minimumAllowed, "total-numbers": type.boards[index$1].highNumber - type.boards[index$1].lowNumber + 1, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), type.multiplier &&
433
+ index.h("div", null, index.h("label", { class: "Toggle" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), ": "), index.h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), index.h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
434
+ index.h("div", { class: "TicketDraws" }, index.h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), index.h("div", { class: "NumberInput" }, index.h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), index.h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), index.h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), index.h("div", null, index.h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), index.h("div", { class: "WagerInput" }, type.stakes.length > 1 ?
435
+ (index.h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, index.h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, index.h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.value, " ", this.amountInfo.currency), index.h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), index.h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, index.h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, type.stakes.map((item) => index.h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.value == item.value ? 'SelectedValue' : '', value: item.value, onClick: () => this.setDropdownItem(item) }, item.value, " ", item.currency)))))) : (index.h("div", null, index.h("input", { min: "1", value: type.stakes[0].amount, type: "number", disabled: true }), index.h("p", { class: "WagerInputTitle" }, type.stakes[0].currency)))))));
436
+ }
437
+ }
475
438
  }
476
- }
477
- static get watchers() { return {
478
- "numberOfDraws": ["drawsChangeHandler"]
479
- }; }
439
+ static get watchers() { return {
440
+ "numberOfDraws": ["drawsChangeHandler"]
441
+ }; }
480
442
  };
481
- LotteryTicket.style = lotteryTicketCss;
443
+ LotteryTicket.style = LotteryTicketStyle0;
482
444
 
483
445
  exports.lottery_bullet = LotteryBullet;
484
446
  exports.lottery_grid = LotteryGrid;