@everymatrix/lottery-ticket-controller 0.1.2 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/cjs/helper-accordion.cjs.entry.js +92 -0
  2. package/dist/cjs/{index-c560cdc6.js → index-95915aab.js} +2 -0
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/lottery-bullet.cjs.entry.js +41 -0
  5. package/dist/cjs/lottery-grid.cjs.entry.js +167 -0
  6. package/dist/cjs/lottery-ticket-controller.cjs.entry.js +69 -0
  7. package/dist/cjs/lottery-ticket-controller.cjs.js +2 -2
  8. package/dist/cjs/lottery-ticket.cjs.entry.js +169 -0
  9. package/dist/collection/collection-manifest.json +7 -1
  10. package/dist/components/helper-accordion2.js +8 -2
  11. package/dist/components/lottery-bullet2.js +2 -1
  12. package/dist/components/lottery-grid2.js +2 -1
  13. package/dist/components/lottery-ticket-controller.js +1 -0
  14. package/dist/components/lottery-ticket2.js +36 -10
  15. package/dist/esm/helper-accordion.entry.js +88 -0
  16. package/dist/esm/{index-0b72e6e4.js → index-e3877ca0.js} +2 -0
  17. package/dist/esm/loader.js +2 -2
  18. package/dist/esm/lottery-bullet.entry.js +37 -0
  19. package/dist/esm/lottery-grid.entry.js +163 -0
  20. package/dist/esm/lottery-ticket-controller.entry.js +65 -0
  21. package/dist/esm/lottery-ticket-controller.js +2 -2
  22. package/dist/esm/lottery-ticket.entry.js +165 -0
  23. package/dist/lottery-ticket-controller/lottery-ticket-controller.esm.js +1 -1
  24. package/dist/lottery-ticket-controller/p-25f1639a.entry.js +1 -0
  25. package/dist/lottery-ticket-controller/p-3971b8e6.js +1 -0
  26. package/dist/lottery-ticket-controller/p-40d1058f.entry.js +1 -0
  27. package/dist/lottery-ticket-controller/p-dc525e6c.entry.js +1 -0
  28. package/dist/lottery-ticket-controller/p-f08b1b06.entry.js +1 -0
  29. package/dist/lottery-ticket-controller/p-f886ec7e.entry.js +1 -0
  30. package/dist/stencil.config.js +3 -0
  31. package/package.json +2 -2
  32. package/dist/cjs/helper-accordion_5.cjs.entry.js +0 -487
  33. package/dist/esm/helper-accordion_5.entry.js +0 -479
  34. package/dist/lottery-ticket-controller/p-62871984.entry.js +0 -1
  35. package/dist/lottery-ticket-controller/p-e0a7e661.js +0 -1
@@ -1,479 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-0b72e6e4.js';
2
-
3
- const DEFAULT_LANGUAGE$1 = 'en';
4
- const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
5
- const TRANSLATIONS$1 = {
6
- en: {
7
- deleteTicket: 'Delete ticket'
8
- },
9
- ro: {
10
- deleteTicket: 'Sterge biletul'
11
- },
12
- };
13
- const translate$1 = (key, customLang) => {
14
- const lang = customLang;
15
- return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
16
- };
17
-
18
- const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:4px;margin-bottom:1px;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{border-radius:4px;margin-top:10px;cursor:pointer;text-transform:capitalize;display:block;font-size:12px;text-align:center;padding:8px 20px;width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
19
-
20
- const Accordion = class {
21
- constructor(hostRef) {
22
- registerInstance(this, hostRef);
23
- this.accordionEvent = createEvent(this, "helperAccordionAction", 7);
24
- /**
25
- * Title (top header)
26
- */
27
- this.headerTitle = '';
28
- /**
29
- * SubTitle (top header)
30
- */
31
- this.headerSubtitle = '';
32
- /**
33
- * Description
34
- */
35
- this.description = '';
36
- /**
37
- * Enables footer content
38
- */
39
- this.footer = false;
40
- /**
41
- * Enables footer button for tab deletion
42
- */
43
- this.deleteTab = false;
44
- /**
45
- * Activates postMessages as events for actions from the widget
46
- */
47
- this.postMessage = false;
48
- /**
49
- * Name of the event emitter by the action button
50
- */
51
- this.eventName = 'helperAccordionAction';
52
- /**
53
- * Collapsed
54
- */
55
- this.collapsed = true;
56
- /**
57
- * Language
58
- */
59
- this.language = 'en';
60
- }
61
- // @TODO fix the `any` type :)
62
- connectedCallback() {
63
- this.showContent = !this.collapsed;
64
- }
65
- toggleContent() {
66
- this.showContent = !this.showContent;
67
- }
68
- deleteAction() {
69
- if (this.postMessage) {
70
- // @TODO maybe change the name type, this one sucks
71
- window.postMessage({ type: this.eventName }, window.location.href);
72
- }
73
- this.accordionEvent.emit();
74
- }
75
- render() {
76
- return (h("div", { class: "Wrapper" }, h("div", { class: "Header" }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle" }, this.description), h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
77
- h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
78
- h("div", null, this.deleteTab &&
79
- h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate$1('deleteTicket', this.language)))))));
80
- }
81
- };
82
- Accordion.style = helperAccordionCss;
83
-
84
- const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Circle{cursor:pointer;color:#000000;display:block;background:#FFF;border:solid 2px #00958f;height:20px;width:20px;border-radius:50%;margin:0;display:flex;align-items:center;justify-content:center;user-select:none;font-size:12px;font-weight:600;position:relative}.Circle:hover{background:#aee4e2}.Circle.Selected{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{color:#707070;background:#D4D4D4;border:solid 2px #707070;cursor:default}.Circle.DisabledSelected{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 #707070;cursor:default}";
85
-
86
- const LotteryBullet = class {
87
- constructor(hostRef) {
88
- registerInstance(this, hostRef);
89
- this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
90
- /**
91
- * Value of the bullet
92
- */
93
- this.value = '0';
94
- /**
95
- * Marks if the bullet should be selectable
96
- */
97
- this.selectable = true;
98
- /**
99
- * Marks if the bullet should be selected
100
- */
101
- this.isSelected = false;
102
- this.select = () => {
103
- if (this.selectable) {
104
- this.isSelected = !this.isSelected;
105
- this.bulletEvent.emit({
106
- value: this.value,
107
- selected: this.isSelected
108
- });
109
- }
110
- };
111
- }
112
- render() {
113
- return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
114
- }
115
- };
116
- LotteryBullet.style = lotteryBulletCss;
117
-
118
- 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:350px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:10px}";
119
-
120
- const LotteryGrid = class {
121
- constructor(hostRef) {
122
- registerInstance(this, hostRef);
123
- this.gridFilledEvent = createEvent(this, "gridFilled", 7);
124
- this.gridDirtyEvent = createEvent(this, "gridDirty", 7);
125
- /**
126
- * Number of bullets of grid
127
- */
128
- this.totalNumbers = 0;
129
- /**
130
- * Number of maximum bullets that can be selected
131
- */
132
- this.maximumAllowed = 0;
133
- /**
134
- * Minimum allowed of bullets
135
- */
136
- this.minimumAllowed = 1;
137
- /**
138
- * Allows the user to select numbers on the grid
139
- */
140
- this.selectable = true;
141
- /**
142
- * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
143
- */
144
- this.selectedNumbers = '';
145
- /**
146
- * Show only selected numbers
147
- */
148
- this.displaySelected = false;
149
- /**
150
- * Language
151
- */
152
- this.language = 'en';
153
- this.numbers = [];
154
- this.selectedCounter = 0;
155
- }
156
- connectedCallback() {
157
- let selected = [];
158
- if (this.selectedNumbers.length > 0) {
159
- selected = this.selectedNumbers.split(',');
160
- this.selectedCounter = selected.length;
161
- }
162
- if (this.displaySelected) {
163
- selected.forEach((item) => {
164
- this.numbers.push({
165
- number: item,
166
- selected: true,
167
- selectable: this.selectable
168
- });
169
- });
170
- }
171
- else {
172
- [...Array(this.totalNumbers).keys()]
173
- .map(number => (number + 1).toString())
174
- .forEach((number) => {
175
- this.numbers.push({
176
- number,
177
- selected: selected.indexOf(number) >= 0 ? true : false,
178
- selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
179
- });
180
- });
181
- }
182
- }
183
- lotteryBulletSelectionHandler(event) {
184
- this.numbers = this.numbers.map((item) => {
185
- if (item.number == event.detail.value) {
186
- return {
187
- number: item.number,
188
- selected: event.detail.selected,
189
- selectable: item.selectable
190
- };
191
- }
192
- return {
193
- number: item.number,
194
- selected: item.selected,
195
- selectable: item.selectable
196
- };
197
- });
198
- if (event.detail.selected) {
199
- this.selectedCounter += 1;
200
- if (this.selectedCounter == this.maximumAllowed) {
201
- this.numbers = this.numbers.map((item) => {
202
- return {
203
- number: item.number,
204
- selected: item.selected,
205
- selectable: item.selected ? true : false
206
- };
207
- });
208
- this.gridFilledEvent.emit({
209
- id: this.ticketId,
210
- index: this.gridIndex,
211
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
212
- });
213
- }
214
- }
215
- else {
216
- if (this.selectedCounter == this.maximumAllowed) {
217
- this.numbers = this.numbers.map((item) => {
218
- return {
219
- number: item.number,
220
- selected: item.selected,
221
- selectable: true
222
- };
223
- });
224
- this.gridDirtyEvent.emit({
225
- id: this.ticketId,
226
- index: this.gridIndex,
227
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
228
- });
229
- }
230
- this.selectedCounter -= 1;
231
- }
232
- }
233
- async resetSelectionHandler(event) {
234
- if (event.detail && event.detail == this.ticketId) {
235
- this.selectedCounter = 0;
236
- this.numbers = this.numbers.map((item) => {
237
- return {
238
- number: item.number,
239
- selected: false,
240
- selectable: this.selectable
241
- };
242
- });
243
- this.gridDirtyEvent.emit({
244
- id: this.ticketId,
245
- index: this.gridIndex,
246
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
247
- });
248
- }
249
- }
250
- async autoSelectionHandler(event) {
251
- if (event.detail && event.detail == this.ticketId) {
252
- this.resetSelectionHandler(event);
253
- let array = [...Array(this.totalNumbers).keys()]
254
- .map(number => number + 1)
255
- .sort(() => 0.5 - Math.random());
256
- array = array.slice(0, this.minimumAllowed);
257
- this.numbers = this.numbers.map((item) => {
258
- return {
259
- number: item.number,
260
- selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
261
- selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
262
- };
263
- });
264
- this.gridFilledEvent.emit({
265
- id: this.ticketId,
266
- index: this.gridIndex,
267
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
268
- });
269
- this.selectedCounter = this.maximumAllowed;
270
- }
271
- }
272
- render() {
273
- return (h("div", { class: "GridContainer" }, h("div", { class: "Grid" }, this.numbers.map((item) => h("div", null, h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected }))))));
274
- }
275
- };
276
- LotteryGrid.style = lotteryGridCss;
277
-
278
- const DEFAULT_LANGUAGE = 'en';
279
- const SUPPORTED_LANGUAGES = ['ro', 'en'];
280
- const TRANSLATIONS = {
281
- en: {
282
- loading: 'Loading, please wait ...',
283
- error: 'It was an error while trying to fetch the data',
284
- grid: 'Grid',
285
- multiplier: 'Multiplier',
286
- numberOfDraws: 'Number of draws',
287
- wagerPerDraw: 'Wager per draw',
288
- resetButton: 'Reset',
289
- autoButton: 'I feel lucky'
290
- },
291
- ro: {
292
- loading: 'Se incarca, va rugam asteptati ...',
293
- error: 'A fost o eroare in timp ce asteptam datele',
294
- grid: 'Grid',
295
- multiplier: 'Multiplicator',
296
- numberOfDraws: 'Numarul de extrageri',
297
- wagerPerDraw: 'Pariul per extragere',
298
- resetButton: 'Reseteaza',
299
- autoButton: 'Ma simt norocos'
300
- },
301
- };
302
- const translate = (key, customLang) => {
303
- const lang = customLang;
304
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
305
- };
306
-
307
- const lotteryTicketCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.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;background-color:transparent;border:none;align-items:center;justify-content:center;height:20px;margin:0;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);width:30px;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:block;border-radius:4px;padding:8px 25px;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:block;border-radius:4px;padding:8px 25px;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}";
308
-
309
- const LotteryTicket = class {
310
- constructor(hostRef) {
311
- registerInstance(this, hostRef);
312
- this.ticketCompleted = createEvent(this, "ticketCompleted", 7);
313
- this.autoSelection = createEvent(this, "autoSelection", 7);
314
- this.resetSelection = createEvent(this, "resetSelection", 7);
315
- this.stakeChange = createEvent(this, "stakeChange", 7);
316
- this.multiplierChange = createEvent(this, "multiplierChange", 7);
317
- /**
318
- * Number of grids of a ticket
319
- */
320
- this.numberOfGrids = 1;
321
- /**
322
- * Option to have the ticket registered for multiple draws
323
- */
324
- this.multipleDraws = true;
325
- /**
326
- * Shows the reset button
327
- */
328
- this.resetButton = false;
329
- /**
330
- * Shows the auto-pick button
331
- */
332
- this.autoPick = false;
333
- /**
334
- * Language
335
- */
336
- this.language = 'en';
337
- this.multiplier = false;
338
- this.numberOfDraws = 1;
339
- this.isLoading = true;
340
- this.hasErrors = false;
341
- this.ticketDone = false;
342
- }
343
- connectedCallback() {
344
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
345
- fetch(url.href)
346
- .then((response) => {
347
- if (response.ok) {
348
- return response.json();
349
- }
350
- else {
351
- // Throw error
352
- this.hasErrors = true;
353
- }
354
- })
355
- .then((data) => {
356
- this.isLoading = false;
357
- this.gameData = data;
358
- this.grids = [...Array(data.rules.boards.length).keys()];
359
- })
360
- .catch((err) => {
361
- this.isLoading = false;
362
- this.hasErrors = true;
363
- console.error('Error!', err);
364
- });
365
- }
366
- multiplierChangeHandler(e) {
367
- this.multiplier = e.target ? e.target.checked : false;
368
- this.multiplierChange.emit(this.multiplier);
369
- }
370
- drawsChangeHandler(event) {
371
- this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
372
- this.ticketCompleted.emit(this.ticket);
373
- }
374
- gridFilledHandler(event) {
375
- this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
376
- this.ticketDone = true;
377
- this.ticketCompleted.emit(this.ticket);
378
- }
379
- toggleAutoSelection() {
380
- this.ticketDone = true;
381
- this.autoSelection.emit(this.ticketId);
382
- }
383
- toggleResetSelection() {
384
- this.ticketDone = false;
385
- this.resetSelection.emit(this.ticketId);
386
- }
387
- changeStake(event) {
388
- this.stakeChange.emit({
389
- ticketId: this.ticketId,
390
- stake: event.target.value
391
- });
392
- }
393
- render() {
394
- if (this.isLoading) {
395
- return (h("div", null, h("p", null, translate('loading', this.language))));
396
- }
397
- else {
398
- if (this.hasErrors) {
399
- return (h("div", null, h("p", null, translate('error', this.language))));
400
- }
401
- else {
402
- const { rules } = this.gameData;
403
- return (h("div", { class: "TicketContainer" }, h("p", null, this.gameData.name), this.resetButton && this.ticketDone &&
404
- h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language)), this.autoPick && !this.ticketDone &&
405
- h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language)), this.grids.map((item, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), h("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language }))), rules.multiplier &&
406
- h("div", null, h("label", { class: "Toggle" }, h("label", { class: "Label" }, translate('multiplier', this.language), ": "), h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
407
- h("div", { class: "TicketDraws" }, h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), h("div", { class: "NumberInput" }, h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), h("div", { class: "WagerInput" }, rules.stakes.length > 1 ? h("div", null, h("select", { class: "InputDefault", onChange: (event) => this.changeStake(event) }, rules.stakes.map((item) => h("option", { value: item.amount }, item.amount, " ", item.currency)))) : h("div", null, h("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }), h("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))));
408
- }
409
- }
410
- }
411
- static get watchers() { return {
412
- "numberOfDraws": ["drawsChangeHandler"]
413
- }; }
414
- };
415
- LotteryTicket.style = lotteryTicketCss;
416
-
417
- const lotteryTicketControllerCss = ":host{display:block}";
418
-
419
- const LotteryTicketController = class {
420
- constructor(hostRef) {
421
- registerInstance(this, hostRef);
422
- this.deleteTicketEvent = createEvent(this, "deleteTicket", 7);
423
- /**
424
- * Endpoint URL for the source of data (NorWAy standard)
425
- */
426
- this.endpoint = '';
427
- /**
428
- * Ticket number
429
- */
430
- this.ticketId = 1;
431
- /**
432
- * Activates postMessages as events for actions from the widget
433
- */
434
- this.postMessage = false;
435
- /**
436
- * Name of the event emitter by the action button
437
- */
438
- this.eventName = 'deleteTicketAction';
439
- /**
440
- * Collapsed
441
- */
442
- this.collapsed = true;
443
- /**
444
- * Number of grids?
445
- */
446
- this.numberOfGrids = 1;
447
- /**
448
- * This toggles if the last ticket added should be expanded or not
449
- */
450
- this.last = false;
451
- /**
452
- * Language
453
- */
454
- this.language = 'en';
455
- /**
456
- * Shows the auto-pick button
457
- */
458
- this.autoPick = false;
459
- /**
460
- * Shows the reset button
461
- */
462
- this.resetButton = false;
463
- }
464
- // @TODO fix the `any` type
465
- helperAccordionActionHandler() {
466
- if (this.postMessage) {
467
- window.postMessage({ type: this.eventName }, window.location.href);
468
- }
469
- this.deleteTicketEvent.emit({
470
- ticketId: this.ticketId
471
- });
472
- }
473
- render() {
474
- return (h("div", null, h("helper-accordion", { "header-title": 'Ticket ' + this.ticketId, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language }, h("div", { slot: "accordionContent" }, h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick })))));
475
- }
476
- };
477
- LotteryTicketController.style = lotteryTicketControllerCss;
478
-
479
- export { Accordion as helper_accordion, LotteryBullet as lottery_bullet, LotteryGrid as lottery_grid, LotteryTicket as lottery_ticket, LotteryTicketController as lottery_ticket_controller };
@@ -1 +0,0 @@
1
- import{r as t,c as e,h as i}from"./p-e0a7e661.js";const s=["ro","en"],r={en:{deleteTicket:"Delete ticket"},ro:{deleteTicket:"Sterge biletul"}},o=class{constructor(i){t(this,i),this.accordionEvent=e(this,"helperAccordionAction",7),this.headerTitle="",this.headerSubtitle="",this.description="",this.footer=!1,this.deleteTab=!1,this.postMessage=!1,this.eventName="helperAccordionAction",this.collapsed=!0,this.language="en"}connectedCallback(){this.showContent=!this.collapsed}toggleContent(){this.showContent=!this.showContent}deleteAction(){this.postMessage&&window.postMessage({type:this.eventName},window.location.href),this.accordionEvent.emit()}render(){return i("div",{class:"Wrapper"},i("div",{class:"Header"},i("p",{class:"Title"},this.headerTitle),i("p",{class:"Subtitle"},this.headerSubtitle),i("p",{class:"Subtitle"},this.description),i("span",{class:"Expand",onClick:()=>this.toggleContent()},this.showContent?"<":">")),this.showContent&&i("div",null,i("div",{class:"Content"},i("slot",{name:"accordionContent"}),this.footer&&this.showContent&&i("div",null,this.deleteTab&&i("span",{class:"ActionButton",onClick:()=>this.deleteAction()},(()=>{const t=this.language;return r[void 0!==t&&s.includes(t)?t:"en"].deleteTicket})())))))}};o.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}.Header{border-radius:4px;margin-bottom:1px;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{border-radius:4px;margin-top:10px;cursor:pointer;text-transform:capitalize;display:block;font-size:12px;text-align:center;padding:8px 20px;width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}';const n=class{constructor(i){t(this,i),this.bulletEvent=e(this,"lotteryBulletSelection",7),this.value="0",this.selectable=!0,this.isSelected=!1,this.select=()=>{this.selectable&&(this.isSelected=!this.isSelected,this.bulletEvent.emit({value:this.value,selected:this.isSelected}))}}render(){return i("div",{class:"Circle "+(this.selectable?"":"Disabled")+(this.isSelected?"Selected":""),onClick:()=>this.select()},this.value)}};n.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}.Circle{cursor:pointer;color:#000000;display:block;background:#FFF;border:solid 2px #00958f;height:20px;width:20px;border-radius:50%;margin:0;display:flex;align-items:center;justify-content:center;user-select:none;font-size:12px;font-weight:600;position:relative}.Circle:hover{background:#aee4e2}.Circle.Selected{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{color:#707070;background:#D4D4D4;border:solid 2px #707070;cursor:default}.Circle.DisabledSelected{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 #707070;cursor:default}';const l=class{constructor(i){t(this,i),this.gridFilledEvent=e(this,"gridFilled",7),this.gridDirtyEvent=e(this,"gridDirty",7),this.totalNumbers=0,this.maximumAllowed=0,this.minimumAllowed=1,this.selectable=!0,this.selectedNumbers="",this.displaySelected=!1,this.language="en",this.numbers=[],this.selectedCounter=0}connectedCallback(){let t=[];this.selectedNumbers.length>0&&(t=this.selectedNumbers.split(","),this.selectedCounter=t.length),this.displaySelected?t.forEach((t=>{this.numbers.push({number:t,selected:!0,selectable:this.selectable})})):[...Array(this.totalNumbers).keys()].map((t=>(t+1).toString())).forEach((e=>{this.numbers.push({number:e,selected:t.indexOf(e)>=0,selectable:this.selectedCounter!=this.maximumAllowed&&this.selectable})}))}lotteryBulletSelectionHandler(t){this.numbers=this.numbers.map((e=>e.number==t.detail.value?{number:e.number,selected:t.detail.selected,selectable:e.selectable}:{number:e.number,selected:e.selected,selectable:e.selectable})),t.detail.selected?(this.selectedCounter+=1,this.selectedCounter==this.maximumAllowed&&(this.numbers=this.numbers.map((t=>({number:t.number,selected:t.selected,selectable:!!t.selected}))),this.gridFilledEvent.emit({id:this.ticketId,index:this.gridIndex,selectedNumbers:this.numbers.filter((t=>t.selected)).map((t=>t.number))}))):(this.selectedCounter==this.maximumAllowed&&(this.numbers=this.numbers.map((t=>({number:t.number,selected:t.selected,selectable:!0}))),this.gridDirtyEvent.emit({id:this.ticketId,index:this.gridIndex,selectedNumbers:this.numbers.filter((t=>t.selected)).map((t=>t.number))})),this.selectedCounter-=1)}async resetSelectionHandler(t){t.detail&&t.detail==this.ticketId&&(this.selectedCounter=0,this.numbers=this.numbers.map((t=>({number:t.number,selected:!1,selectable:this.selectable}))),this.gridDirtyEvent.emit({id:this.ticketId,index:this.gridIndex,selectedNumbers:this.numbers.filter((t=>t.selected)).map((t=>t.number))}))}async autoSelectionHandler(t){if(t.detail&&t.detail==this.ticketId){this.resetSelectionHandler(t);let e=[...Array(this.totalNumbers).keys()].map((t=>t+1)).sort((()=>.5-Math.random()));e=e.slice(0,this.minimumAllowed),this.numbers=this.numbers.map((t=>({number:t.number,selected:e.indexOf(parseInt(t.number,10))>=0,selectable:e.indexOf(parseInt(t.number,10))>=0}))),this.gridFilledEvent.emit({id:this.ticketId,index:this.gridIndex,selectedNumbers:this.numbers.filter((t=>t.selected)).map((t=>t.number))}),this.selectedCounter=this.maximumAllowed}}render(){return i("div",{class:"GridContainer"},i("div",{class:"Grid"},this.numbers.map((t=>i("div",null,i("lottery-bullet",{value:t.number,selectable:t.selectable,"is-selected":t.selected}))))))}};l.style='@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:350px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:10px}';const a=["ro","en"],c={en:{loading:"Loading, please wait ...",error:"It was an error while trying to fetch the data",grid:"Grid",multiplier:"Multiplier",numberOfDraws:"Number of draws",wagerPerDraw:"Wager per draw",resetButton:"Reset",autoButton:"I feel lucky"},ro:{loading:"Se incarca, va rugam asteptati ...",error:"A fost o eroare in timp ce asteptam datele",grid:"Grid",multiplier:"Multiplicator",numberOfDraws:"Numarul de extrageri",wagerPerDraw:"Pariul per extragere",resetButton:"Reseteaza",autoButton:"Ma simt norocos"}},d=(t,e)=>{const i=e;return c[void 0!==i&&a.includes(i)?i:"en"][t]},h=class{constructor(i){t(this,i),this.ticketCompleted=e(this,"ticketCompleted",7),this.autoSelection=e(this,"autoSelection",7),this.resetSelection=e(this,"resetSelection",7),this.stakeChange=e(this,"stakeChange",7),this.multiplierChange=e(this,"multiplierChange",7),this.numberOfGrids=1,this.multipleDraws=!0,this.resetButton=!1,this.autoPick=!1,this.language="en",this.multiplier=!1,this.numberOfDraws=1,this.isLoading=!0,this.hasErrors=!1,this.ticketDone=!1}connectedCallback(){let t=new URL(`${this.endpoint}/games/${this.gameId}`);fetch(t.href).then((t=>{if(t.ok)return t.json();this.hasErrors=!0})).then((t=>{this.isLoading=!1,this.gameData=t,this.grids=[...Array(t.rules.boards.length).keys()]})).catch((t=>{this.isLoading=!1,this.hasErrors=!0,console.error("Error!",t)}))}multiplierChangeHandler(t){this.multiplier=!!t.target&&t.target.checked,this.multiplierChange.emit(this.multiplier)}drawsChangeHandler(t){this.ticket=Object.assign(Object.assign({},this.ticket),{draws:t}),this.ticketCompleted.emit(this.ticket)}gridFilledHandler(t){this.ticket=Object.assign(Object.assign({},t.detail),{draws:this.numberOfDraws}),this.ticketDone=!0,this.ticketCompleted.emit(this.ticket)}toggleAutoSelection(){this.ticketDone=!0,this.autoSelection.emit(this.ticketId)}toggleResetSelection(){this.ticketDone=!1,this.resetSelection.emit(this.ticketId)}changeStake(t){this.stakeChange.emit({ticketId:this.ticketId,stake:t.target.value})}render(){if(this.isLoading)return i("div",null,i("p",null,d("loading",this.language)));if(this.hasErrors)return i("div",null,i("p",null,d("error",this.language)));{const{rules:t}=this.gameData;return i("div",{class:"TicketContainer"},i("p",null,this.gameData.name),this.resetButton&&this.ticketDone&&i("a",{class:"ResetButton",onClick:()=>this.toggleResetSelection()},d("resetButton",this.language)),this.autoPick&&!this.ticketDone&&i("a",{class:"AutoButton",onClick:()=>this.toggleAutoSelection()},d("autoButton",this.language)),this.grids.map(((e,s)=>i("div",{class:"TicketGridBullets"},i("p",{class:"TicketGridTitle"},d("grid",this.language)," ",e),i("lottery-grid",{"grid-index":s,"maximum-allowed":t.boards[s].maximumAllowed,"minimum-allowed":t.boards[s].minimumAllowed,"total-numbers":t.boards[s].totalNumbers,selectable:!0,"reset-button":!0,"auto-pick":!0,"game-id":this.gameId,"ticket-id":this.ticketId,language:this.language})))),t.multiplier&&i("div",null,i("label",{class:"Toggle"},i("label",{class:"Label"},d("multiplier",this.language),": "),i("input",{class:"ToggleCheckbox",type:"checkbox",onInput:t=>this.multiplierChangeHandler(t)}),i("div",{class:"ToggleSwitch"}))),this.multipleDraws&&i("div",{class:"TicketDraws"},i("label",{class:"Label"},d("numberOfDraws",this.language),": "),i("div",{class:"NumberInput"},i("button",{onClick:()=>this.numberOfDraws>1?this.numberOfDraws--:this.numberOfDraws=1,class:"Minus"},"-"),i("input",{class:"InputDefault",min:"1",value:this.numberOfDraws,type:"number"}),i("button",{onClick:()=>this.numberOfDraws++,class:"Plus"},"+"))),i("label",{class:"Label"},d("wagerPerDraw",this.language),": "),i("div",{class:"WagerInput"},t.stakes.length>1?i("div",null,i("select",{class:"InputDefault",onChange:t=>this.changeStake(t)},t.stakes.map((t=>i("option",{value:t.amount},t.amount," ",t.currency))))):i("div",null,i("input",{min:"1",value:t.stakes[0].amount,type:"number",disabled:!0}),i("p",{class:"WagerInputTitle"},t.stakes[0].currency))))}}static get watchers(){return{numberOfDraws:["drawsChangeHandler"]}}};h.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}.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;background-color:transparent;border:none;align-items:center;justify-content:center;height:20px;margin:0;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);width:30px;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:block;border-radius:4px;padding:8px 25px;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:block;border-radius:4px;padding:8px 25px;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}';const p=class{constructor(i){t(this,i),this.deleteTicketEvent=e(this,"deleteTicket",7),this.endpoint="",this.ticketId=1,this.postMessage=!1,this.eventName="deleteTicketAction",this.collapsed=!0,this.numberOfGrids=1,this.last=!1,this.language="en",this.autoPick=!1,this.resetButton=!1}helperAccordionActionHandler(){this.postMessage&&window.postMessage({type:this.eventName},window.location.href),this.deleteTicketEvent.emit({ticketId:this.ticketId})}render(){return i("div",null,i("helper-accordion",{"header-title":"Ticket "+this.ticketId,"header-subtitle":this.ticketDescription,footer:!0,"delete-tab":!0,collapsed:!this.last||this.collapsed,language:this.language},i("div",{slot:"accordionContent"},i("lottery-ticket",{endpoint:this.endpoint,"game-id":this.gameId,"ticket-id":this.ticketId,"number-of-grids":this.numberOfGrids,language:this.language,"reset-button":this.resetButton,"auto-pick":this.autoPick}))))}};p.style=":host{display:block}";export{o as helper_accordion,n as lottery_bullet,l as lottery_grid,h as lottery_ticket,p as lottery_ticket_controller}
@@ -1 +0,0 @@
1
- let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},c=e=>Promise.resolve(e),r=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=(e,t,n)=>{n&&n.map((([n,l,s])=>{const c=a(e,n),r=u(t,s),i=f(n);o.ael(c,l,r,i),(t.o=t.o||[]).push((()=>o.rel(c,l,r,i)))}))},u=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){J(e)}},a=(e,t)=>4&t?s:e,f=e=>0!=(2&e),h=new WeakMap,y=e=>"sc-"+e.h,$={},d=e=>"object"==(e=typeof e)||"function"===e,m=(e,t,...n)=>{let l=null,s=!1,o=!1,c=[];const r=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?r(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!d(l))&&(l+=""),s&&o?c[c.length-1].$+=l:c.push(s?p(null,l):l),o=s)};if(r(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=p(e,null);return i.m=t,c.length>0&&(i.p=c),i},p=(e,t)=>({t:0,S:e,$:t,g:null,p:null,m:null}),b={},w=(e,t,n,s,c,r)=>{if(n!==s){let i=I(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,l=g(n),o=g(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if(i||"o"!==t[0]||"n"!==t[1]){const l=d(s);if((i||l&&null!==s)&&!c)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?i=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&r||c)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):I(l,u)?u.slice(2):u[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},S=/\s/,g=e=>e?e.split(S):[],j=(e,t,n,l)=>{const s=11===t.g.nodeType&&t.g.host?t.g.host:t.g,o=e&&e.m||$,c=t.m||$;for(l in o)l in c||w(s,l,o[l],void 0,n,t.t);for(l in c)w(s,l,o[l],c[l],n,t.t)},v=(t,n,l)=>{let o,c,r=n.p[l],i=0;if(null!==r.$)o=r.g=s.createTextNode(r.$);else if(o=r.g=s.createElement(r.S),j(null,r,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),r.p)for(i=0;i<r.p.length;++i)c=v(t,r,i),c&&o.appendChild(c);return o},k=(e,n,l,s,o,c)=>{let r,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=c;++o)s[o]&&(r=v(null,l,o),r&&(s[o].g=r,i.insertBefore(r,n)))},M=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.g.remove()},C=(e,t)=>e.S===t.S,O=(e,t)=>{const n=t.g=e.g,l=e.p,s=t.p,o=t.$;null===o?("slot"===t.S||j(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,c=0,r=t.length-1,i=t[0],u=t[r],a=l.length-1,f=l[0],h=l[a];for(;o<=r&&c<=a;)null==i?i=t[++o]:null==u?u=t[--r]:null==f?f=l[++c]:null==h?h=l[--a]:C(i,f)?(O(i,f),i=t[++o],f=l[++c]):C(u,h)?(O(u,h),u=t[--r],h=l[--a]):C(i,h)?(O(i,h),e.insertBefore(i.g,u.g.nextSibling),i=t[++o],h=l[--a]):C(u,f)?(O(u,f),e.insertBefore(u.g,i.g),u=t[--r],f=l[++c]):(s=v(t&&t[c],n,c),f=l[++c],s&&i.g.parentNode.insertBefore(s,i.g));o>r?k(e,null==l[a+1]?null:l[a+1].g,n,l,c,a):c>a&&M(t,o,r)})(n,l,t,s):null!==s?(null!==e.$&&(n.textContent=""),k(n,null,t,s,0,s.length-1)):null!==l&&M(l,0,l.length-1)):e.$!==o&&(n.data=o)},P=(e,t,n)=>{const l=(e=>B(e).j)(e);return{emit:e=>x(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},x=(e,t,n)=>{const l=o.ce(t,n);return e.dispatchEvent(l),l},E=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},N=(e,t)=>{if(e.t|=16,!(4&e.t))return E(e,e.k),se((()=>T(e,t)));e.t|=512},T=(e,t)=>{const n=e.i;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>U(n,e,t))),e.u=null)),W(void 0,(()=>A(e,n,t)))},A=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.M,n=e.j,l=t.t,o=((e,t)=>{let n=y(t),l=X.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=h.get(e=e.head||e);o||h.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);F(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>L(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},F=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.C||p(null,null),c=(e=>e&&e.S===b)(l)?l:m(null,null,l);t=s.tagName,c.S=null,c.t|=4,n.C=c,c.g=o.g=s.shadowRoot||s,e=s["s-sc"],O(o,c)})(n,l)}catch(e){J(e,n.j)}return null},L=e=>{const t=e.j,n=e.k;64&e.t||(e.t|=64,q(t),e.O(t),n||R()),e.v&&(e.v(),e.v=void 0),512&e.t&&le((()=>N(e,!1))),e.t&=-517},R=()=>{q(s.documentElement),le((()=>x(l,"appload",{detail:{namespace:"lottery-ticket-controller"}})))},U=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){J(e)}},W=(e,t)=>e&&e.then?e.then(t):t(),q=e=>e.classList.add("hydrated"),H=(e,t,n)=>{if(t.P){e.watchers&&(t.N=e.watchers);const l=Object.entries(t.P),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>B(this).T.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=B(e),o=s.j,c=s.T.get(t),r=s.t,i=s.i;if(n=((e,t)=>null==e||d(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.P[t][0]),(!(8&r)||void 0===c)&&n!==c&&(!Number.isNaN(c)||!Number.isNaN(n))&&(s.T.set(t,n),i)){if(l.N&&128&r){const e=l.N[t];e&&e.map((e=>{try{i[e](n,c,t)}catch(e){J(e,o)}}))}2==(18&r)&&N(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},V=e=>{U(e,"connectedCallback")},_=(e,t={})=>{const n=[],c=t.exclude||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),h=s.createElement("style"),$=[];let d,m=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],h:t[1],P:t[2],A:t[3]};l.P=t[2],l.A=t[3],l.N={};const s=l.h,a=class extends HTMLElement{constructor(e){super(e),G(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){d&&(clearTimeout(d),d=null),m?$.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=B(e),n=t.M,l=()=>{};if(1&t.t)i(e,t,n.A),V(t.i);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){E(t,t.k=n);break}}n.P&&Object.entries(n.P).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=Q(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.N=s.watchers,H(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){J(e)}t.t&=-9,t.t|=128,e(),V(t.i)}if(s.style){let e=s.style;const t=y(n);if(!X.has(t)){const l=()=>{};((e,t,n)=>{let l=X.get(e);r&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,X.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.k,c=()=>N(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=B(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return B(this).F}};l.L=e[0],c.includes(s)||u.get(s)||(n.push(s),u.define(s,H(a,l,1)))}))})),h.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",h.setAttribute("data-styles",""),a.insertBefore(h,f?f.nextSibling:a.firstChild),m=!1,$.length?$.map((e=>e.connectedCallback())):o.jmp((()=>d=setTimeout(R,30)))},z=new WeakMap,B=e=>z.get(e),D=(e,t)=>z.set(t.i=e,t),G=(e,t)=>{const n={t:0,j:e,M:t,T:new Map};return n.F=new Promise((e=>n.O=e)),e["s-p"]=[],e["s-rc"]=[],i(e,n,t.A),z.set(e,n)},I=(e,t)=>t in e,J=(e,t)=>(0,console.error)(e,t),K=new Map,Q=e=>{const t=e.h.replace(/-/g,"_"),n=e.L,l=K.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(K.set(n,e),e[t])),J)},X=new Map,Y=[],Z=[],ee=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?le(ne):o.raf(ne))},te=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){J(e)}e.length=0},ne=()=>{te(Y),te(Z),(n=Y.length>0)&&o.raf(ne)},le=e=>c().then(e),se=ee(Z,!0);export{_ as b,P as c,m as h,c as p,D as r}