@everymatrix/lottery-hakuna-ticket-history-item 0.0.1

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 (57) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-99904d3f.js +1310 -0
  3. package/dist/cjs/index.cjs.js +10 -0
  4. package/dist/cjs/loader.cjs.js +15 -0
  5. package/dist/cjs/lottery-button_5.cjs.entry.js +900 -0
  6. package/dist/cjs/lottery-hakuna-ticket-history-item-6b877fa8.js +195 -0
  7. package/dist/cjs/lottery-hakuna-ticket-history-item.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +37 -0
  9. package/dist/collection/components/lottery-hakuna-ticket-history-item/index.js +1 -0
  10. package/dist/collection/components/lottery-hakuna-ticket-history-item/lottery-hakuna-ticket-history-item.css +91 -0
  11. package/dist/collection/components/lottery-hakuna-ticket-history-item/lottery-hakuna-ticket-history-item.js +315 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +39 -0
  14. package/dist/collection/utils/utils.js +3 -0
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/index-09b72148.js +1282 -0
  17. package/dist/esm/index.js +2 -0
  18. package/dist/esm/loader.js +11 -0
  19. package/dist/esm/lottery-button_5.entry.js +893 -0
  20. package/dist/esm/lottery-hakuna-ticket-history-item-785a2e3d.js +190 -0
  21. package/dist/esm/lottery-hakuna-ticket-history-item.js +20 -0
  22. package/dist/index.cjs.js +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/lottery-hakuna-ticket-history-item/app-globals-0f993ce5.js +1 -0
  25. package/dist/lottery-hakuna-ticket-history-item/index-09b72148.js +2 -0
  26. package/dist/lottery-hakuna-ticket-history-item/index.esm.js +1 -0
  27. package/dist/lottery-hakuna-ticket-history-item/lottery-button_5.entry.js +1 -0
  28. package/dist/lottery-hakuna-ticket-history-item/lottery-hakuna-ticket-history-item-785a2e3d.js +1 -0
  29. package/dist/lottery-hakuna-ticket-history-item/lottery-hakuna-ticket-history-item.esm.js +1 -0
  30. package/dist/stencil.config.dev.js +19 -0
  31. package/dist/stencil.config.js +19 -0
  32. package/dist/storybook/main.js +43 -0
  33. package/dist/storybook/preview.js +9 -0
  34. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  35. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/packages/stencil/lottery-hakuna-ticket-history-item/stencil.config.d.ts +2 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/packages/stencil/lottery-hakuna-ticket-history-item/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/packages/stencil/lottery-hakuna-ticket-history-item/storybook/main.d.ts +3 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/packages/stencil/lottery-hakuna-ticket-history-item/storybook/preview.d.ts +70 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/tools/plugins/index.d.ts +4 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  44. package/dist/types/components/lottery-hakuna-ticket-history-item/index.d.ts +1 -0
  45. package/dist/types/components/lottery-hakuna-ticket-history-item/lottery-hakuna-ticket-history-item.d.ts +61 -0
  46. package/dist/types/components.d.ts +133 -0
  47. package/dist/types/index.d.ts +1 -0
  48. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  49. package/dist/types/utils/locale.utils.d.ts +3 -0
  50. package/dist/types/utils/utils.d.ts +1 -0
  51. package/loader/cdn.js +1 -0
  52. package/loader/index.cjs.js +1 -0
  53. package/loader/index.d.ts +24 -0
  54. package/loader/index.es2017.js +1 -0
  55. package/loader/index.js +2 -0
  56. package/loader/package.json +11 -0
  57. package/package.json +27 -0
@@ -0,0 +1,900 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-99904d3f.js');
6
+ const lotteryHakunaTicketHistoryItem = require('./lottery-hakuna-ticket-history-item-6b877fa8.js');
7
+
8
+ const DEFAULT_LANGUAGE$2 = 'en';
9
+ const SUPPORTED_LANGUAGES$2 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
10
+ const TRANSLATIONS$2 = {
11
+ en: {
12
+ loading: 'Loading'
13
+ },
14
+ ro: {},
15
+ fr: {},
16
+ ar: {},
17
+ hr: {}
18
+ };
19
+ const translate$2 = (key, customLang, replacements) => {
20
+ const lang = customLang;
21
+ let translation = TRANSLATIONS$2[lang !== undefined && SUPPORTED_LANGUAGES$2.includes(lang) ? lang : DEFAULT_LANGUAGE$2][key];
22
+ if (replacements) {
23
+ Object.keys(replacements).forEach((placeholder) => {
24
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
25
+ });
26
+ }
27
+ return translation;
28
+ };
29
+ const getTranslations$2 = (data) => {
30
+ Object.keys(data).forEach((item) => {
31
+ for (let key in data[item]) {
32
+ TRANSLATIONS$2[item][key] = data[item][key];
33
+ }
34
+ });
35
+ };
36
+ const resolveTranslationUrl$1 = async (translationUrl) => {
37
+ if (translationUrl) {
38
+ try {
39
+ const response = await fetch(translationUrl);
40
+ if (!response.ok) {
41
+ throw new Error(`HTTP error! status: ${response.status}`);
42
+ }
43
+ const translations = await response.json();
44
+ getTranslations$2(translations);
45
+ }
46
+ catch (error) {
47
+ console.error('Failed to fetch or parse translations from URL:', error);
48
+ }
49
+ }
50
+ };
51
+
52
+ const lotteryButtonCss = ":host{display:inline-block}.btn{font:inherit;position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--lottery-button-border-radius, 6px);font-weight:var(--lottery-button-font-weight, 500);cursor:pointer;outline:none;overflow:hidden;transition:var(--lottery-button-transition, background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s);user-select:none;-webkit-tap-highlight-color:transparent;box-shadow:var(--lottery-button-box-shadow, 0 2px 4px 0 rgba(0, 0, 0, 0.5))}.btn .content{position:relative;display:inline-flex;align-items:center;gap:var(--lottery-button-content-gap, 0.5em)}.btn .content ::slotted(span){display:inline-flex;align-items:center}.btn:hover:not(:disabled){box-shadow:var(--lottery-button-hover-box-shadow, 0 4px 8px 0 rgba(0, 0, 0, 0.5))}.btn:disabled{cursor:not-allowed;opacity:var(--lottery-button-disabled-opacity, 0.5)}.btn .loading-container{display:flex;align-items:center}.btn--loading{position:relative}.btn .spinner{display:inline-block;width:1em;height:1em;border:var(--lottery-button-spinner-border, 2px solid rgba(255, 255, 255, 0.3));border-radius:50%;border-top-color:var(--lottery-button-spinner-color, white);animation:spin 1s ease-in-out infinite;margin-left:0.5em;vertical-align:middle}.btn--small .spinner{width:0.8em;height:0.8em}.btn--large .spinner{width:1.2em;height:1.2em}@keyframes spin{to{transform:rotate(360deg)}}.btn--primary{background-color:var(--emw--color-primary, #0d196e);color:var(--emw--color-typography-inverse, #fff)}.btn--primary:hover:not(:disabled){background-color:var(--emw--color-primary-variant, #1367e7)}.btn--primary:active:not(:disabled){background-color:var(--lottery-button-primary-active-bg, #08104a)}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:var(--lottery-button-spinner-inverse-border-color, rgba(0, 0, 0, 0.2))}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:var(--lottery-button-outline-border-color, #dcdcdc);color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:var(--lottery-button-outline-hover-border-color, #a6a6a6)}.btn--outline:active:not(:disabled){background-color:var(--lottery-button-outline-active-bg, #e6e6e6)}.btn--dashed{background-color:transparent;border-style:dashed;border-color:var(--lottery-button-dashed-border-color, #dcdcdc);color:var(--lottery-button-dashed-color, #333)}.btn--dashed:hover:not(:disabled){border-color:var(--lottery-button-dashed-hover-border-color, #a6a6a6);color:var(--lottery-button-dashed-hover-color, #0052d9)}.btn--text{background-color:transparent;color:var(--lottery-button-text-color, #0052d9);border-color:transparent}.btn--text:hover:not(:disabled){background-color:var(--lottery-button-text-hover-bg, #f2f2f2)}.btn--text:active:not(:disabled){background-color:var(--lottery-button-text-active-bg, #e6e6e6)}.btn--custom-color:hover:not(:disabled){opacity:var(--lottery-button-custom-hover-opacity, 0.9)}.btn--custom-color:active:not(:disabled){opacity:var(--lottery-button-custom-active-opacity, 0.8)}.btn--small{height:var(--lottery-button-small-height, 28px);font-size:var(--lottery-button-small-font-size, 12px);padding:var(--lottery-button-small-padding, 0 12px)}.btn--medium{height:var(--lottery-button-medium-height, 34px);font-size:var(--lottery-button-medium-font-size, 14px);padding:var(--lottery-button-medium-padding, 0 18px)}.btn--large{height:var(--lottery-button-large-height, 40px);font-size:var(--lottery-button-large-font-size, 16px);padding:var(--lottery-button-large-padding, 0 24px)}.ripple-container{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;border-radius:inherit}.ripple{position:absolute;border-radius:50%;background-color:var(--lottery-button-ripple-light, rgba(255, 255, 255, 0.3));transform:scale(0);animation:ripple-animation 600ms linear}.btn--outline .ripple,.btn--dashed .ripple,.btn--text .ripple{background-color:var(--lottery-button-ripple-dark, rgba(0, 0, 0, 0.03))}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}";
53
+ const LotteryButtonStyle0 = lotteryButtonCss;
54
+
55
+ const LotteryButton = class {
56
+ constructor(hostRef) {
57
+ index.registerInstance(this, hostRef);
58
+ this.handleClick = (event) => {
59
+ if (this.disabled) {
60
+ return;
61
+ }
62
+ // Get the button element from the shadow root
63
+ const button = this.host.shadowRoot.querySelector('.btn');
64
+ if (!button)
65
+ return;
66
+ const rect = button.getBoundingClientRect();
67
+ const size = Math.max(rect.width, rect.height);
68
+ const top = event.clientY - rect.top - size / 2;
69
+ const left = event.clientX - rect.left - size / 2;
70
+ // Add the new ripple to the state, triggering a re-render
71
+ const newRipple = { top, left, size };
72
+ this.ripples = [...this.ripples, newRipple];
73
+ // Set a timeout to clean up the ripple from the state after the animation ends
74
+ // This prevents the DOM from filling up with old ripple elements
75
+ setTimeout(() => {
76
+ this.ripples = this.ripples.filter((r) => r !== newRipple);
77
+ }, 600); // This duration should match the CSS animation duration
78
+ };
79
+ this.variant = 'primary';
80
+ this.size = 'medium';
81
+ this.color = undefined;
82
+ this.disabled = false;
83
+ this.loading = false;
84
+ this.text = undefined;
85
+ this.mbSource = undefined;
86
+ this.language = 'en';
87
+ this.clientStyling = undefined;
88
+ this.clientStylingUrl = undefined;
89
+ this.translationUrl = '';
90
+ this.ripples = [];
91
+ }
92
+ handleClientStylingChange(newValue, oldValue) {
93
+ if (newValue != oldValue) {
94
+ lotteryHakunaTicketHistoryItem.setClientStyling(this.stylingContainer, this.clientStyling);
95
+ }
96
+ }
97
+ handleClientStylingUrlChange(newValue, oldValue) {
98
+ if (newValue != oldValue) {
99
+ lotteryHakunaTicketHistoryItem.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
100
+ }
101
+ }
102
+ handleMbSourceChange(newValue, oldValue) {
103
+ if (newValue != oldValue) {
104
+ lotteryHakunaTicketHistoryItem.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
105
+ }
106
+ }
107
+ disconnectedCallback() {
108
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
109
+ }
110
+ componentDidLoad() {
111
+ if (this.stylingContainer) {
112
+ if (this.mbSource)
113
+ lotteryHakunaTicketHistoryItem.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
114
+ if (this.clientStyling)
115
+ lotteryHakunaTicketHistoryItem.setClientStyling(this.stylingContainer, this.clientStyling);
116
+ if (this.clientStylingUrl)
117
+ lotteryHakunaTicketHistoryItem.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
118
+ }
119
+ }
120
+ componentWillLoad() {
121
+ if (this.translationUrl) {
122
+ resolveTranslationUrl$1(this.translationUrl);
123
+ }
124
+ }
125
+ render() {
126
+ const { variant, disabled, size, color } = this;
127
+ const isDisabled = disabled || this.loading;
128
+ // Calculate styles based on variant and color
129
+ const buttonStyles = {};
130
+ if (color) {
131
+ switch (variant) {
132
+ case 'primary':
133
+ Object.assign(buttonStyles, {
134
+ backgroundColor: color,
135
+ borderColor: color
136
+ });
137
+ break;
138
+ case 'outline':
139
+ case 'dashed':
140
+ Object.assign(buttonStyles, {
141
+ color: color,
142
+ borderColor: color
143
+ });
144
+ break;
145
+ case 'text':
146
+ Object.assign(buttonStyles, {
147
+ color: color
148
+ });
149
+ break;
150
+ default:
151
+ Object.assign(buttonStyles, {
152
+ backgroundColor: color,
153
+ borderColor: color
154
+ });
155
+ }
156
+ }
157
+ return (index.h("button", { key: 'aa74ad98c90e7548228557bf8a8d26b125d4a83a', class: {
158
+ btn: true,
159
+ [`btn--${variant}`]: true,
160
+ [`btn--${size}`]: true,
161
+ 'btn--loading': this.loading
162
+ }, style: color ? buttonStyles : undefined, disabled: isDisabled, onClick: this.handleClick, ref: (el) => (this.stylingContainer = el) }, this.loading ? (index.h("div", { class: "loading-container" }, index.h("span", { class: "content" }, this.text || translate$2('loading', this.language)), index.h("span", { class: "spinner" }))) : (index.h("span", { class: "content" }, index.h("slot", { name: "icon-left" }), this.text || index.h("slot", null), index.h("slot", { name: "icon-right" }))), index.h("div", { key: '302ea02be395bb24989d4abc040a513e23fa029a', class: "ripple-container" }, this.ripples.map((ripple, index$1) => (index.h("span", { key: index$1, class: "ripple", style: {
163
+ top: `${ripple.top}px`,
164
+ left: `${ripple.left}px`,
165
+ width: `${ripple.size}px`,
166
+ height: `${ripple.size}px`
167
+ } }))))));
168
+ }
169
+ get host() { return index.getElement(this); }
170
+ static get watchers() { return {
171
+ "clientStyling": ["handleClientStylingChange"],
172
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
173
+ "mbSource": ["handleMbSourceChange"]
174
+ }; }
175
+ };
176
+ LotteryButton.style = LotteryButtonStyle0;
177
+
178
+ // This icon file is generated automatically.
179
+ var DeleteFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M864 256H736v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zm-200 0H360v-72h304v72z" } }] }, "name": "delete", "theme": "filled" };
180
+ const DeleteFilled$1 = DeleteFilled;
181
+
182
+ var __assign = (undefined && undefined.__assign) || function () {
183
+ __assign = Object.assign || function(t) {
184
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
185
+ s = arguments[i];
186
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
187
+ t[p] = s[p];
188
+ }
189
+ return t;
190
+ };
191
+ return __assign.apply(this, arguments);
192
+ };
193
+ var defaultColors = {
194
+ primaryColor: '#333',
195
+ secondaryColor: '#E6E6E6'
196
+ };
197
+ function renderIconDefinitionToSVGElement(icond, options) {
198
+ if (options === void 0) { options = {}; }
199
+ if (typeof icond.icon === 'function') {
200
+ // two-tone
201
+ var placeholders = options.placeholders || defaultColors;
202
+ return renderAbstractNodeToSVGElement(icond.icon(placeholders.primaryColor, placeholders.secondaryColor), options);
203
+ }
204
+ // fill, outline
205
+ return renderAbstractNodeToSVGElement(icond.icon, options);
206
+ }
207
+ function renderAbstractNodeToSVGElement(node, options) {
208
+ var targetAttrs = node.tag === 'svg'
209
+ ? __assign(__assign({}, node.attrs), (options.extraSVGAttrs || {})) : node.attrs;
210
+ var attrs = Object.keys(targetAttrs).reduce(function (acc, nextKey) {
211
+ var key = nextKey;
212
+ var value = targetAttrs[key];
213
+ var token = "".concat(key, "=\"").concat(value, "\"");
214
+ acc.push(token);
215
+ return acc;
216
+ }, []);
217
+ var attrsToken = attrs.length ? ' ' + attrs.join(' ') : '';
218
+ var children = (node.children || [])
219
+ .map(function (child) { return renderAbstractNodeToSVGElement(child, options); })
220
+ .join('');
221
+ if (children && children.length) {
222
+ return "<".concat(node.tag).concat(attrsToken, ">").concat(children, "</").concat(node.tag, ">");
223
+ }
224
+ return "<".concat(node.tag).concat(attrsToken, " />");
225
+ }
226
+
227
+ // Basic sanitization method for SVG content
228
+ // This is NOT a complete XSS prevention for SVG, but prevents common attacks.
229
+ function sanitizeSvg(svgString) {
230
+ let sanitized = svgString.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // Remove <script> tags
231
+ sanitized = sanitized.replace(/on[a-z]+=[\"'][^\"']*[\"']/gi, ''); // Remove on* attributes
232
+ sanitized = sanitized.replace(/javascript:/gi, ''); // Remove javascript: URLs
233
+ return sanitized;
234
+ }
235
+
236
+ const lotterySelectionCss = ":host{display:inline-block}.lottery-selection__button{display:flex;align-items:center;justify-content:center;width:var(--lottery-selection-width, 32px);height:var(--lottery-selection-height, 32px);padding:var(--lottery-selection-padding, 0);box-sizing:border-box;background:var(--lottery-selection-background, var(--emw--color-background, #fff));border:var(--lottery-selection-border-width, 2px) var(--lottery-selection-border-style, solid) var(--lottery-selection-border-color, var(--emw--color-primary, #0d196e));border-radius:var(--lottery-selection-border-radius, var(--emw--border-radius-medium, 8px));color:var(--lottery-selection-color, var(--emw--color-typography, #000));font-weight:var(--lottery-selection-font-weight, bold);font-size:var(--lottery-selection-font-size, 1em);cursor:pointer;user-select:none;}.lottery-selection__button:hover{background:var(--lottery-selection-hover-background, var(--emw--color-background, #fff));border-color:var(--lottery-selection-hover-border-color, var(--emw--color-primary, #0d196e));color:var(--lottery-selection-hover-color, var(--emw--color-typography, #000))}.lottery-selection__button .lottery-selection__delete-icon{display:none}.lottery-selection__button.isDeleteByIcon:hover .lottery-selection__text{display:none}.lottery-selection__button.isDeleteByIcon:hover .lottery-selection__delete-icon{display:flex;align-items:center;justify-content:center;fill:var(--lottery-selection-delete-icon-color, var(--emw--color-typography, #000));vertical-align:middle}.lottery-selection__button.lottery-selection__button--selected{background-color:var(--lottery-selection-selected-background, var(--emw--color-primary, #0d196e));border-color:var(--lottery-selection-selected-border-color, var(--emw--color-primary, #0d196e));color:var(--lottery-selection-selected-color, var(--emw--color-typography-inverse, #fff))}.lottery-selection__button.lottery-selection__button--disabled{background-color:var(--lottery-selection-disabled-background, var(--emw--color-gray-50, #f5f5f5));border-color:var(--lottery-selection-disabled-border-color, var(--emw--color-gray-100, #e6e6e6));color:var(--lottery-selection-disabled-color, var(--emw--color-gray-150, #6f6f6f));cursor:not-allowed;pointer-events:none;}.lottery-selection__button.lottery-selection__button--no-border{border:none}.lottery-selection__button.lottery-selection__button--no-background{background:transparent}";
237
+ const LotterySelectionStyle0 = lotterySelectionCss;
238
+
239
+ const LotterySelection = class {
240
+ constructor(hostRef) {
241
+ index.registerInstance(this, hostRef);
242
+ this.lotteryBulletClickHandler = index.createEvent(this, "lotteryBulletClick", 7);
243
+ this.value = 0;
244
+ this.text = undefined;
245
+ this.idx = undefined;
246
+ this.type = 'toggle';
247
+ this.mbSource = undefined;
248
+ this.clientStyling = undefined;
249
+ this.clientStylingUrl = undefined;
250
+ this.hasBorder = true;
251
+ this.hasBackground = true;
252
+ this.deleteIconSvg = '';
253
+ this.deleteIconWidth = '16px';
254
+ this.deleteIconHeight = '16px';
255
+ }
256
+ handleClientStylingChange(newValue, oldValue) {
257
+ if (newValue !== oldValue) {
258
+ lotteryHakunaTicketHistoryItem.setClientStyling(this.stylingContainer, this.clientStyling);
259
+ }
260
+ }
261
+ handleClientStylingUrlChange(newValue, oldValue) {
262
+ if (newValue !== oldValue) {
263
+ lotteryHakunaTicketHistoryItem.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
264
+ }
265
+ }
266
+ handleMbSourceChange(newValue, oldValue) {
267
+ if (newValue !== oldValue) {
268
+ lotteryHakunaTicketHistoryItem.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
269
+ }
270
+ }
271
+ componentDidLoad() {
272
+ if (this.stylingContainer) {
273
+ if (this.mbSource)
274
+ lotteryHakunaTicketHistoryItem.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
275
+ if (this.clientStyling)
276
+ lotteryHakunaTicketHistoryItem.setClientStyling(this.stylingContainer, this.clientStyling);
277
+ if (this.clientStylingUrl)
278
+ lotteryHakunaTicketHistoryItem.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
279
+ }
280
+ }
281
+ disconnectedCallback() {
282
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
283
+ }
284
+ handleClick() {
285
+ if (this.type === 'disabled' || this.type === 'readonly') {
286
+ return;
287
+ }
288
+ console.log('bullet clicked', this.type, this.idx, this.text, this.value);
289
+ this.lotteryBulletClickHandler.emit({
290
+ type: this.type,
291
+ idx: this.idx,
292
+ text: this.text,
293
+ value: this.value
294
+ });
295
+ }
296
+ render() {
297
+ let iconToRender;
298
+ if (this.deleteIconSvg) {
299
+ iconToRender = sanitizeSvg(this.deleteIconSvg);
300
+ }
301
+ else {
302
+ iconToRender = renderIconDefinitionToSVGElement(DeleteFilled$1, {
303
+ extraSVGAttrs: {
304
+ width: this.deleteIconWidth,
305
+ height: this.deleteIconHeight,
306
+ fill: 'currentColor'
307
+ }
308
+ });
309
+ }
310
+ return (index.h("div", { key: '0d1e8aaa80a907a7467410f6b27b4b6175e82299', class: "lottery-selection", ref: (el) => (this.stylingContainer = el) }, index.h("button", { key: '11a2402abbc290dc877ad95f3433092c3a0d8419', class: {
311
+ 'lottery-selection__button': true,
312
+ 'lottery-selection__button--selected': this.value == 1,
313
+ 'lottery-selection__button--disabled': this.type === 'disabled',
314
+ 'lottery-selection__button--no-border': !this.hasBorder,
315
+ 'lottery-selection__button--no-background': !this.hasBackground,
316
+ isDeleteByIcon: this.type === 'delete',
317
+ isCallDialogBtn: this.type === 'input' || this.type === 'readonly'
318
+ }, onClick: this.handleClick.bind(this), disabled: this.type === 'disabled' }, this.type === 'delete' && index.h("span", { key: 'f99001d936a8f7bdf8adc5c46e82caf730a9442a', class: "lottery-selection__delete-icon", innerHTML: iconToRender }), index.h("span", { key: '55775e2492a1fe45cc8a457ac0a0d206744461ab', class: "lottery-selection__text" }, this.text))));
319
+ }
320
+ static get watchers() { return {
321
+ "clientStyling": ["handleClientStylingChange"],
322
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
323
+ "mbSource": ["handleMbSourceChange"]
324
+ }; }
325
+ };
326
+ LotterySelection.style = LotterySelectionStyle0;
327
+
328
+ const DEFAULT_LANGUAGE$1 = 'en';
329
+ const SUPPORTED_LANGUAGES$1 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
330
+ const TRANSLATIONS$1 = {
331
+ en: {
332
+ noTicketBoard: 'No ticket board available.',
333
+ selectionCleared: 'Your selection has been cleared.',
334
+ clearAll: 'Clear All',
335
+ stopAt: 'Stop at',
336
+ turnover: 'Turnover: ',
337
+ pleaseFillIn: 'Please fill in all the selection input!',
338
+ fillIn: 'Fill in',
339
+ noBets: 'Sorry. No bets have been placed so far. Check back later!',
340
+ search: 'Search',
341
+ clear: 'Clear',
342
+ oddsChart: 'Odds Chart',
343
+ ticketSuccess: 'Ticket purchased successfully.',
344
+ stakePerLine: 'Stake per Line:',
345
+ lowestOdds: 'Lowest Odds:',
346
+ highestOdds: 'Highest Odds:',
347
+ orderSummary: 'ORDER SUMMARY',
348
+ ticket: 'Ticket',
349
+ lines: 'Lines',
350
+ total: 'Total',
351
+ submit: 'Submit',
352
+ loading: 'Loading',
353
+ enterValidNumber: 'Please enter a valid number.',
354
+ enterNumberBetween: 'Please enter a number between {min} and {max}.',
355
+ numberAlreadySelected: 'This number has already been selected.',
356
+ enterScoreUpTo: 'Please enter the score (Up to {maxScore})',
357
+ enterValue: 'Please enter a value',
358
+ myChoices: 'My Choices',
359
+ teams: 'Teams',
360
+ scores: 'Scores',
361
+ euro: 'Euro',
362
+ cancel: 'Cancel',
363
+ confirm: 'Confirm'
364
+ },
365
+ ro: {},
366
+ fr: {},
367
+ ar: {},
368
+ hr: {}
369
+ };
370
+ const translate$1 = (key, customLang, replacements) => {
371
+ const lang = customLang;
372
+ let translation = TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
373
+ if (replacements) {
374
+ Object.keys(replacements).forEach((placeholder) => {
375
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
376
+ });
377
+ }
378
+ return translation;
379
+ };
380
+ const getTranslations$1 = (data) => {
381
+ Object.keys(data).forEach((item) => {
382
+ for (let key in data[item]) {
383
+ TRANSLATIONS$1[item][key] = data[item][key];
384
+ }
385
+ });
386
+ };
387
+
388
+ function getBulletTextsSet(bulletTexts, splitToken) {
389
+ return new Set(bulletTexts ? bulletTexts.split(splitToken) : []);
390
+ }
391
+ function validateInput({ value, selectedSet, maxValue, minValue, language, type = 'integer' }) {
392
+ const trimmedValue = value.trim();
393
+ if (type === 'integer') {
394
+ // Strict integer check
395
+ if (!/^-?\d+$/.test(trimmedValue)) {
396
+ return {
397
+ valid: false,
398
+ errorMessage: translate$1('enterValidNumber', language),
399
+ value
400
+ };
401
+ }
402
+ const numValue = Number(trimmedValue);
403
+ if (isNaN(numValue)) {
404
+ return {
405
+ valid: false,
406
+ errorMessage: translate$1('enterValidNumber', language),
407
+ value
408
+ };
409
+ }
410
+ if ((minValue !== undefined && numValue < minValue) || (maxValue !== undefined && numValue > maxValue)) {
411
+ return {
412
+ valid: false,
413
+ errorMessage: translate$1('enterNumberBetween', language, {
414
+ min: minValue,
415
+ max: maxValue
416
+ }),
417
+ value
418
+ };
419
+ }
420
+ // Normalize value (e.g. "05" -> "5") for set check
421
+ const normalizedValue = String(numValue);
422
+ if (selectedSet.has(normalizedValue)) {
423
+ return {
424
+ valid: false,
425
+ errorMessage: translate$1('numberAlreadySelected', language),
426
+ value
427
+ };
428
+ }
429
+ }
430
+ else {
431
+ // Text mode validation
432
+ if (selectedSet.has(trimmedValue)) {
433
+ return {
434
+ valid: false,
435
+ errorMessage: translate$1('numberAlreadySelected', language), // Or generic 'alreadySelected' if available, but reusing key for now
436
+ value
437
+ };
438
+ }
439
+ }
440
+ return {
441
+ valid: true,
442
+ errorMessage: '',
443
+ value
444
+ };
445
+ }
446
+ function removeBulletTexts(text, selectedArr) {
447
+ return selectedArr.filter((s) => s !== text);
448
+ }
449
+ function addSelectedBulletTexts(text, selectedArr) {
450
+ return selectedArr.concat([text]);
451
+ }
452
+ function removeAndAddSelectedBulletTexts(text, selectedArr, maxSelectedCount) {
453
+ return selectedArr.slice(selectedArr.length - (maxSelectedCount - 1)).concat([text]);
454
+ }
455
+ function buildSelectedBulletTextsArr(item, selectedArr, maxSelectedCount) {
456
+ if (item.type === 'delete') {
457
+ return removeBulletTexts(item.text, selectedArr);
458
+ }
459
+ if (item.type === 'toggle') {
460
+ if (selectedArr.includes(item.text)) {
461
+ return removeBulletTexts(item.text, selectedArr);
462
+ }
463
+ if (selectedArr.length >= maxSelectedCount) {
464
+ return removeAndAddSelectedBulletTexts(item.text, selectedArr, maxSelectedCount);
465
+ }
466
+ return addSelectedBulletTexts(item.text, selectedArr);
467
+ }
468
+ return [];
469
+ }
470
+
471
+ const lotterySelectionGroupCss = ":host {\n width: 100%;\n}\n\n.lottery-selection-group {\n container-type: inline-size;\n padding: var(--lottery-selection-group-padding, 0);\n background: var(--lottery-selection-group-background, transparent);\n border: var(--lottery-selection-group-border, none);\n border-radius: var(--lottery-selection-group-border-radius, 0);\n}\n.lottery-selection-group__item {\n display: flex;\n flex-direction: var(--lottery-selection-group-flex-direction, row);\n align-items: var(--lottery-selection-group-item-align, center);\n justify-content: var(--lottery-selection-group-item-justify, flex-start);\n gap: var(--lottery-selection-group-item-gap, 16px);\n width: 100%;\n}\n.lottery-selection-group__item--left {\n width: var(--lottery-selection-group-label-width, 130px);\n min-width: var(--lottery-selection-group-label-min-width, auto);\n max-width: var(--lottery-selection-group-label-max-width, none);\n color: var(--lottery-selection-group-label-color, var(--emw--color-typography, #000));\n font-size: var(--lottery-selection-group-label-font-size, 1em);\n font-weight: var(--lottery-selection-group-label-font-weight, bold);\n text-align: var(--lottery-selection-group-label-align, left);\n white-space: var(--lottery-selection-group-label-white-space, normal);\n}\n.lottery-selection-group__item--right {\n flex: 1;\n display: flex;\n flex-wrap: var(--lottery-selection-group-bullets-wrap, wrap); /* Allow items to wrap */\n gap: var(--lottery-selection-group-bullets-gap, 8px); /* Gap between bullets */\n align-items: var(--lottery-selection-group-bullets-align, center);\n justify-content: var(--lottery-selection-group-bullets-justify, flex-start); /* Align bullets to start */\n}\n@container (max-width: 320px) {\n .lottery-selection-group__item--left {\n width: 100px;\n max-width: 100px;\n }\n}\n\n.dialog-input {\n width: 100%;\n padding: var(--lottery-selection-group-input-padding, 8px);\n border: var(--lottery-selection-group-input-border-width, 1px) var(--lottery-selection-group-input-border-style, solid) var(--lottery-selection-group-input-border-color, var(--emw--color-gray-100, #e6e6e6));\n border-radius: var(--lottery-selection-group-input-radius, 4px);\n background-color: var(--lottery-selection-group-input-bg, #fff);\n color: var(--lottery-selection-group-input-color, #000);\n box-sizing: border-box;\n margin-top: var(--lottery-selection-group-input-margin-top, 10px);\n font-size: var(--lottery-selection-group-input-font-size, 1em);\n}\n.dialog-input::placeholder {\n color: var(--lottery-selection-group-input-placeholder-color, #999);\n}\n\n.dialog-input.invalid,\n.dialog-input.invalid:focus {\n border-color: var(--emw--color-error, #ff3d00);\n outline-color: var(--emw--color-error, #ff3d00);\n}\n\n.error-message {\n color: var(--lottery-selection-group-error-color, var(--emw--color-error, #ff3d00));\n font-size: var(--lottery-selection-group-error-font-size, 12px);\n font-weight: var(--lottery-selection-group-error-font-weight, normal);\n margin-top: 4px;\n}\n\n.addSelectionDialog-title {\n color: var(--lottery-selection-group-dialog-title-color, var(--emw--color-typography, #000));\n font-size: var(--lottery-selection-group-dialog-title-font-size, 1.2em);\n font-weight: var(--lottery-selection-group-dialog-title-font-weight, bold);\n margin-bottom: var(--lottery-selection-group-dialog-title-margin-bottom, 0);\n}\n.addSelectionDialog-footer {\n display: flex;\n justify-content: var(--lottery-selection-group-dialog-footer-justify, flex-end);\n gap: var(--lottery-selection-group-dialog-footer-gap, 18px);\n margin-top: var(--lottery-selection-group-dialog-footer-margin-top, 0);\n}";
472
+ const LotterySelectionGroupStyle0 = lotterySelectionGroupCss;
473
+
474
+ const LotterySelectionGroup = class {
475
+ constructor(hostRef) {
476
+ index.registerInstance(this, hostRef);
477
+ this.bulletGroupUpdateSelectedBulletTexts = index.createEvent(this, "bulletGroupUpdateSelection", 7);
478
+ this.mbSource = undefined;
479
+ this.clientStyling = undefined;
480
+ this.clientStylingUrl = undefined;
481
+ this.language = 'en';
482
+ this.translationUrl = '';
483
+ this.splitToken = ',';
484
+ this.selectionGroupId = undefined;
485
+ this.selectionGroupLabel = undefined;
486
+ this.type = 'bet';
487
+ this.selectedBulletTexts = null;
488
+ this.maxSelectedCount = null;
489
+ this.maxDisplayBulletsCount = 11;
490
+ this.bulletTexts = null;
491
+ this.maxIntegerBulletText = null;
492
+ this.minIntegerBulletText = 0;
493
+ this.bulletTextType = 'integer';
494
+ this.hasBorder = true;
495
+ this.hasBackground = true;
496
+ this.dialogTitle = undefined;
497
+ this.dialogInputPlaceholder = undefined;
498
+ this.dialogConfig = {
499
+ width: '400px',
500
+ visible: false,
501
+ onConfirm: () => this.handleFillInAddMore(),
502
+ onCancel: () => this.handleCloseAddMoreDialog()
503
+ };
504
+ this.inputInfo = { valid: true, errorMessage: '', value: '' };
505
+ }
506
+ handleClientStylingChange(newValue, oldValue) {
507
+ if (newValue != oldValue) {
508
+ lotteryHakunaTicketHistoryItem.setClientStyling(this.stylingContainer, this.clientStyling);
509
+ }
510
+ }
511
+ handleClientStylingUrlChange(newValue, oldValue) {
512
+ if (newValue != oldValue) {
513
+ lotteryHakunaTicketHistoryItem.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
514
+ }
515
+ }
516
+ handleMbSourceChange(newValue, oldValue) {
517
+ if (newValue != oldValue) {
518
+ lotteryHakunaTicketHistoryItem.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
519
+ }
520
+ }
521
+ componentWillLoad() {
522
+ if (this.translationUrl) {
523
+ getTranslations$1(JSON.parse(this.translationUrl));
524
+ }
525
+ }
526
+ componentDidLoad() {
527
+ if (this.stylingContainer) {
528
+ if (this.mbSource)
529
+ lotteryHakunaTicketHistoryItem.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
530
+ if (this.clientStyling)
531
+ lotteryHakunaTicketHistoryItem.setClientStyling(this.stylingContainer, this.clientStyling);
532
+ if (this.clientStylingUrl)
533
+ lotteryHakunaTicketHistoryItem.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
534
+ }
535
+ }
536
+ disconnectedCallback() {
537
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
538
+ }
539
+ lotteryBulletClickHandler(event) {
540
+ event.stopPropagation();
541
+ // if it's input type, open the dialog
542
+ if (event.detail.type === 'input') {
543
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: true });
544
+ return;
545
+ }
546
+ if (['delete', 'toggle'].includes(event.detail.type)) {
547
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
548
+ newSelectedBulletTexts: buildSelectedBulletTextsArr(event.detail, Array.from(this.selectedSet), this.maxSelectedCount).join(this.splitToken),
549
+ selectionGroupId: this.selectionGroupId
550
+ });
551
+ return;
552
+ }
553
+ }
554
+ get selectedSet() {
555
+ return getBulletTextsSet(this.selectedBulletTexts, this.splitToken);
556
+ }
557
+ get bulletTextsSet() {
558
+ if (this.bulletTexts)
559
+ return getBulletTextsSet(this.bulletTexts, this.splitToken);
560
+ if (this.bulletTextType === 'integer' &&
561
+ this.maxIntegerBulletText !== null &&
562
+ this.maxIntegerBulletText !== undefined) {
563
+ return getBulletTextsSet(Array.from({ length: Number(this.lastDisplayBulletText) - this.minIntegerBulletText + 1 }, (_, index) => this.minIntegerBulletText + index).join(this.splitToken), this.splitToken);
564
+ }
565
+ // If neither bulletTexts nor maxIntegerBulletText are provided,
566
+ return new Set();
567
+ }
568
+ // the last bullet text
569
+ get lastDisplayBulletText() {
570
+ if (this.bulletTextType === 'integer') {
571
+ if (this.maxIntegerBulletText !== null && this.maxIntegerBulletText !== undefined) {
572
+ return Math.min(this.maxIntegerBulletText, this.minIntegerBulletText + this.maxDisplayBulletsCount - 1);
573
+ }
574
+ return this.minIntegerBulletText + this.maxDisplayBulletsCount - 1;
575
+ }
576
+ // Text mode: return the text at the max display index if available
577
+ if (this.bulletTextsSet.size > 0) {
578
+ const texts = Array.from(this.bulletTextsSet);
579
+ if (texts.length >= this.maxDisplayBulletsCount) {
580
+ return texts[this.maxDisplayBulletsCount - 1];
581
+ }
582
+ return texts[texts.length - 1]; // If fewer than maxDisplayBulletsCount, return the last one
583
+ }
584
+ return null;
585
+ }
586
+ get isSingleSelectionMode() {
587
+ return this.maxSelectedCount === 1;
588
+ }
589
+ getBulletToRender() {
590
+ const allBulletTexts = Array.from(this.bulletTextsSet);
591
+ // Determine which bullets to display based on type and limit
592
+ let bulletsToRender = allBulletTexts;
593
+ let showInputButton = false;
594
+ if (this.bulletTextType === 'text') {
595
+ // For text, if we have more items than the limit, we need an input button.
596
+ // The input button takes one slot, so we show (limit - 1) items.
597
+ if (allBulletTexts.length > this.maxDisplayBulletsCount) {
598
+ showInputButton = true;
599
+ bulletsToRender = allBulletTexts.slice(0, this.maxDisplayBulletsCount - 1);
600
+ }
601
+ else {
602
+ bulletsToRender = allBulletTexts;
603
+ }
604
+ }
605
+ else {
606
+ // For integer, logic is based on maxIntegerBulletText vs displayed range
607
+ showInputButton =
608
+ this.maxIntegerBulletText !== null &&
609
+ this.maxIntegerBulletText !== undefined &&
610
+ this.maxIntegerBulletText > Number(this.lastDisplayBulletText);
611
+ // Integer bullets generation already respects the count, no slicing needed on the raw set
612
+ bulletsToRender = allBulletTexts;
613
+ }
614
+ return {
615
+ bulletsToRender,
616
+ showInputButton
617
+ };
618
+ }
619
+ renderBulletGroup() {
620
+ let items = [];
621
+ if (this.type === 'bet') {
622
+ const isMaxSelected = this.maxSelectedCount !== null && this.selectedSet.size >= this.maxSelectedCount;
623
+ const { bulletsToRender, showInputButton } = this.getBulletToRender();
624
+ bulletsToRender.forEach((text, idx) => {
625
+ let bulletType = 'toggle';
626
+ if (!this.selectedSet.has(String(text)) && isMaxSelected && !this.isSingleSelectionMode) {
627
+ bulletType = 'disabled';
628
+ }
629
+ items.push({
630
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
631
+ text: String(text),
632
+ idx,
633
+ type: bulletType
634
+ });
635
+ });
636
+ if (showInputButton) {
637
+ let inputBulletType = 'input';
638
+ if (isMaxSelected && !this.isSingleSelectionMode) {
639
+ inputBulletType = 'disabled';
640
+ }
641
+ const inputButtonText = this.bulletTextType === 'text' ? '...' : `${this.lastDisplayBulletText}+`;
642
+ const inputButtonIdx = this.bulletTextType === 'text' ? -1 : Number(this.lastDisplayBulletText) + 1;
643
+ // Special handling for integer mode:
644
+ // If the generated set is "full" (size == maxDisplayBulletsCount),
645
+ // we need to remove the last item to make room for the "N+" button
646
+ // so the total visual count remains consistent.
647
+ if (this.bulletTextType === 'integer' && items.length >= this.maxDisplayBulletsCount) {
648
+ items.pop();
649
+ }
650
+ items.push({
651
+ value: 0,
652
+ text: inputButtonText,
653
+ idx: inputButtonIdx,
654
+ type: inputBulletType
655
+ });
656
+ }
657
+ }
658
+ else if (['choice', 'preview'].includes(this.type)) {
659
+ // For choice/preview, also respect the visual limit for text mode
660
+ const { bulletsToRender } = this.getBulletToRender();
661
+ bulletsToRender.forEach((text, idx) => {
662
+ let bulletType = 'toggle';
663
+ if (this.type === 'preview') {
664
+ bulletType = 'readonly';
665
+ }
666
+ else if (this.selectedSet.has(String(text))) {
667
+ bulletType = 'delete';
668
+ }
669
+ items.push({
670
+ value: this.selectedSet.has(String(text)) ? 1 : 0,
671
+ text,
672
+ idx,
673
+ type: bulletType
674
+ });
675
+ });
676
+ }
677
+ return (index.h("div", { class: "lottery-selection-group__item--right" }, items.map((item) => {
678
+ return (index.h("lottery-selection", { clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource, text: item.text, idx: item.idx, value: item.value, type: item.type, hasBorder: this.hasBorder, hasBackground: this.hasBackground }));
679
+ })));
680
+ }
681
+ handleCloseAddMoreDialog() {
682
+ this.dialogConfig = Object.assign(Object.assign({}, this.dialogConfig), { visible: false });
683
+ this.inputInfo = { value: '', errorMessage: '', valid: true };
684
+ }
685
+ handleInputChange(e) {
686
+ const inputElement = e.target;
687
+ const value = inputElement.value;
688
+ this.inputInfo = Object.assign(Object.assign({}, this.inputInfo), { value: value });
689
+ this.inputInfo = validateInput({
690
+ value,
691
+ selectedSet: this.selectedSet,
692
+ maxValue: this.maxIntegerBulletText,
693
+ minValue: this.bulletTextType === 'integer' ? Number(this.lastDisplayBulletText) + 1 : undefined,
694
+ language: this.language,
695
+ type: this.bulletTextType
696
+ });
697
+ }
698
+ handleFillInAddMore() {
699
+ if (this.inputInfo.valid) {
700
+ const { value } = this.inputInfo;
701
+ // Normalize the value (e.g., "05" -> "5") to match validation logic
702
+ let normalizedValue = value;
703
+ if (this.bulletTextType === 'integer') {
704
+ normalizedValue = String(Number(value));
705
+ }
706
+ else {
707
+ normalizedValue = value.trim();
708
+ }
709
+ let newSelectedBulletTexts;
710
+ if (this.isSingleSelectionMode) {
711
+ newSelectedBulletTexts = normalizedValue;
712
+ }
713
+ else {
714
+ newSelectedBulletTexts = addSelectedBulletTexts(normalizedValue, Array.from(this.selectedSet)).join(this.splitToken);
715
+ }
716
+ this.bulletGroupUpdateSelectedBulletTexts.emit({
717
+ newSelectedBulletTexts,
718
+ selectionGroupId: this.selectionGroupId
719
+ });
720
+ this.handleCloseAddMoreDialog();
721
+ }
722
+ }
723
+ render() {
724
+ return (index.h("div", { key: '66b8e9c63d948eb2f7eb37adb80892dbedd7df9a', class: "lottery-selection-group", ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '6562fdcad0f352b5e2d03edcc980a9aeab32277e', class: "lottery-selection-group__item" }, this.selectionGroupLabel && (index.h("div", { key: '43c2132e4904a2b69b970d9b2074f120ed4d0986', class: "lottery-selection-group__item--left" }, this.selectionGroupLabel)), this.renderBulletGroup()), index.h("lottery-tipping-dialog", { key: 'cb693d10e6b499628909571021d8508cdebbe29a', visible: this.dialogConfig.visible, width: this.dialogConfig.width, onCancel: this.dialogConfig.onCancel }, index.h("div", { key: 'dd312634574bbe1b4d3de7e82a9c58f58f846c1a', class: "addSelectionDialog" }, index.h("div", { key: 'b371b1090598f0219a7c652bab51e9d349703c34', class: "addSelectionDialog-title" }, this.dialogTitle || (this.bulletTextType === 'text'
725
+ ? translate$1('enterValue', this.language)
726
+ : translate$1('enterScoreUpTo', this.language, {
727
+ maxScore: this.maxIntegerBulletText
728
+ }))), index.h("input", { key: 'b5f1bb74999246dac8dc20f04e3af893deae6654', type: "text", class: {
729
+ 'dialog-input': true,
730
+ invalid: !this.inputInfo.valid
731
+ }, value: this.inputInfo.value, onInput: this.handleInputChange.bind(this), placeholder: this.dialogInputPlaceholder }), index.h("div", { key: 'f33970a6dffdc881ffa9cf2c0bb54b26b27cccd6', class: "error-message" }, this.inputInfo.errorMessage)), index.h("div", { key: '4c580dae14b38aff03e17067b2c0b72d01aa4f42', slot: "footer", class: "addSelectionDialog-footer" }, index.h("lottery-button", { key: '874aa0ffde8fe2d0b08efea0cf951f101ab8dad0', onClick: this.dialogConfig.onCancel, text: translate$1('cancel', this.language), variant: "outline" }), index.h("lottery-button", { key: '63a556eb5f9ad1cdd357c017756be274d40ef235', onClick: this.dialogConfig.onConfirm, text: translate$1('confirm', this.language), variant: "primary", disabled: !this.inputInfo.valid || !this.inputInfo.value })))));
732
+ }
733
+ static get watchers() { return {
734
+ "clientStyling": ["handleClientStylingChange"],
735
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
736
+ "mbSource": ["handleMbSourceChange"]
737
+ }; }
738
+ };
739
+ LotterySelectionGroup.style = LotterySelectionGroupStyle0;
740
+
741
+ const DEFAULT_LANGUAGE = 'en';
742
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
743
+ const TRANSLATIONS = {
744
+ en: {
745
+ cancel: 'Cancel',
746
+ confirm: 'Confirm'
747
+ },
748
+ ro: {
749
+ cancel: 'Anulează',
750
+ confirm: 'Confirmă'
751
+ },
752
+ fr: {
753
+ cancel: 'Annuler',
754
+ confirm: 'Confirmer'
755
+ },
756
+ ar: {
757
+ cancel: 'إلغاء',
758
+ confirm: 'تأكيد'
759
+ },
760
+ hr: {
761
+ cancel: 'Odustani',
762
+ confirm: 'Potvrdi'
763
+ }
764
+ };
765
+ const translate = (key, customLang) => {
766
+ const lang = customLang;
767
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
768
+ };
769
+ const getTranslations = (data) => {
770
+ Object.keys(data).forEach((item) => {
771
+ for (let key in data[item]) {
772
+ TRANSLATIONS[item][key] = data[item][key];
773
+ }
774
+ });
775
+ };
776
+ const resolveTranslationUrl = async (translationUrl) => {
777
+ if (translationUrl) {
778
+ try {
779
+ const response = await fetch(translationUrl);
780
+ if (!response.ok) {
781
+ throw new Error(`HTTP error! status: ${response.status}`);
782
+ }
783
+ const translations = await response.json();
784
+ getTranslations(translations);
785
+ }
786
+ catch (error) {
787
+ console.error('Failed to fetch or parse translations from URL:', error);
788
+ }
789
+ }
790
+ };
791
+
792
+ const lotteryTippingDialogCss = ".dialog-wrapper{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;visibility:hidden;opacity:1;z-index:199}.dialog-wrapper-visible{visibility:visible}.mask{position:fixed;inset:0;background-color:rgba(0, 0, 0, 0.5);opacity:0;z-index:1000;transition:opacity var(--duration) linear}.mask-enter{opacity:1}.mask-leave{opacity:0}.dialog{position:relative;background:var(--emw--color-background, #fff);border-radius:12px;box-shadow:0 4px 32px rgba(0, 0, 0, 0.15);opacity:0;transform:scale(0.9);transition:all var(--duration) linear;width:100%;max-width:100vw;overflow:hidden;z-index:1000}.dialog-enter{opacity:1;transform:scale(1)}.dialog-leave{opacity:0}.dialog.fullscreen{width:100vw !important;height:100vh;overflow:auto;max-height:none;border-radius:0;overflow:hidden}.dialog-header{padding:16px 16px 0 16px;display:flex;justify-content:space-between;align-items:center}.dialog-header .dialog-title{margin:0;font-size:1.25rem;font-weight:500;color:var(--emw--color-typography, #000)}.dialog-header .close-btn{background:transparent;border:none;font-size:1.5rem;width:2rem;height:2rem;color:var(--emw--color-gray-150, #6f6f6f);cursor:pointer;border-radius:4px}.dialog-header .close-btn:hover{background:var(--emw--color-gray-50, #f5f5f5);color:var(--emw--color-gray-300, #333)}.dialog-content{padding:24px;font-size:0.95rem;line-height:1.6;color:var(--emw--color-dialog-typography, #000);flex:1;overflow-y:auto;max-height:calc(100vh - 200px)}.dialog.fullscreen .dialog-content{max-height:none}.dialog-footer{padding:0 16px 16px 16px;display:flex;justify-content:center;gap:12px}.dialog-footer .cancel-btn,.dialog-footer .confirm-btn{padding:10px 24px;border-radius:6px;font-size:0.9rem;cursor:pointer;transition:all 0.3s linear}.dialog-footer .cancel-btn{border:var(--emw--button-border, 1px solid rgba(221, 221, 221, 0.8666666667));background-color:var(--emw--color-background, #fff);color:var(--emw--color-typography, #000)}.dialog-footer .cancel-btn:hover{background-color:var(--emw--color-background-tertiary, #ccc)}.dialog-footer .confirm-btn{border:none;color:var(--emw--color-typography-normalized, #ffffff);background:var(--emw--color-primary, #009993)}.dialog-footer .confirm-btn:hover{background:var(--emw--color-primary-variant, #004d4a)}@media screen and (max-width: 480px){.dialog.fullscreen .dialog-content{padding:12px}}.Loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.Loading svg{animation:spin 1s linear infinite;transform-origin:center}@keyframes spin{100%{transform:rotate(360deg)}}";
793
+ const LotteryTippingDialogStyle0 = lotteryTippingDialogCss;
794
+
795
+ const LotteryTippingDialog = class {
796
+ constructor(hostRef) {
797
+ index.registerInstance(this, hostRef);
798
+ this.open = index.createEvent(this, "open", 7);
799
+ this.close = index.createEvent(this, "close", 7);
800
+ this.confirm = index.createEvent(this, "confirm", 7);
801
+ this.cancel = index.createEvent(this, "cancel", 7);
802
+ this.wasVisible = false;
803
+ this.mbSource = undefined;
804
+ this.clientStyling = '';
805
+ this.clientStylingUrl = '';
806
+ this.visible = undefined;
807
+ this.dialogTitle = '';
808
+ this.width = '520px';
809
+ this.closable = true;
810
+ this.mask = true;
811
+ this.maskClosable = true;
812
+ this.animationDuration = 300;
813
+ this.fullscreen = false;
814
+ this.showFooter = true;
815
+ this.showCancelBtn = true;
816
+ this.language = 'en';
817
+ this.translationUrl = undefined;
818
+ }
819
+ handleClientStylingChange(newValue, oldValue) {
820
+ if (newValue != oldValue) {
821
+ lotteryHakunaTicketHistoryItem.setClientStyling(this.stylingContainer, this.clientStyling);
822
+ }
823
+ }
824
+ handleClientStylingUrlChange(newValue, oldValue) {
825
+ if (newValue != oldValue) {
826
+ lotteryHakunaTicketHistoryItem.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
827
+ }
828
+ }
829
+ handleMbSourceChange(newValue, oldValue) {
830
+ if (newValue != oldValue) {
831
+ lotteryHakunaTicketHistoryItem.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
832
+ }
833
+ }
834
+ componentWillLoad() {
835
+ if (this.translationUrl) {
836
+ resolveTranslationUrl(this.translationUrl);
837
+ }
838
+ }
839
+ componentWillUpdate() {
840
+ if (this.visible && !this.wasVisible) {
841
+ this.disableBodyScroll();
842
+ }
843
+ else if (!this.visible && this.wasVisible) {
844
+ this.enableBodyScroll();
845
+ }
846
+ this.wasVisible = this.visible;
847
+ }
848
+ disconnectedCallback() {
849
+ this.enableBodyScroll();
850
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
851
+ }
852
+ disableBodyScroll() {
853
+ document.body.style.overflow = 'hidden';
854
+ }
855
+ enableBodyScroll() {
856
+ document.body.style.overflow = '';
857
+ }
858
+ handleClose() {
859
+ this.cancel.emit();
860
+ }
861
+ handleMaskClick(e) {
862
+ if (this.maskClosable && e.target === this.el.querySelector('.mask')) {
863
+ this.cancel.emit();
864
+ }
865
+ }
866
+ handleConfirm() {
867
+ this.confirm.emit();
868
+ }
869
+ render() {
870
+ const dialogStyle = {
871
+ width: typeof this.width === 'number' ? `${this.width}px` : this.width,
872
+ '--duration': `${this.animationDuration}ms`
873
+ };
874
+ const dialogWrapperClass = ['dialog-wrapper', this.visible ? 'dialog-wrapper-visible' : ''];
875
+ const maskClass = ['mask', this.visible ? 'mask-enter' : 'mask-leave'];
876
+ const dialogClass = [
877
+ 'dialog',
878
+ this.visible ? 'dialog-enter' : 'dialog-leave',
879
+ this.fullscreen ? 'fullscreen' : ''
880
+ ].join(' ');
881
+ const contentStyle = {
882
+ maxHeight: 'calc(100vh - 62px)',
883
+ overflowY: 'auto'
884
+ };
885
+ return (index.h("div", { key: '716c6488b86fc5a74bcd8c8c8a4eee1b85f75cb7', class: dialogWrapperClass.join(' '), ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '161d976b5a15f62c63b56555e161b5b29c0a7771', class: maskClass.join(' '), onClick: this.handleMaskClick.bind(this) }), index.h("div", { key: 'ebd2c356c169765b06c85997dc9906b74358b450', class: dialogClass, style: dialogStyle, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-title" }, index.h("div", { key: '2a8616c336447b33d3c4b3f22deee3871abd93c9', class: "dialog-header" }, index.h("h2", { key: 'fc4f4f87826620754f8cce73874726cdebcc280e', id: "dialog-title", class: "dialog-title" }, this.dialogTitle), this.closable && (index.h("button", { key: '1626434c0700df7dc094cbf0c96840476ab65da5', class: "close-btn", onClick: this.handleClose.bind(this) }, "x"))), index.h("div", { key: '44d28c0e477e3e16069749f7700ee70b6a486d07', class: "dialog-content", style: contentStyle }, index.h("slot", { key: '745e1329fc3647247245f7aa96d10a06b6b18329' })), this.showFooter && (index.h("div", { key: 'cc3b19ba0ab16fd485f2c4e81a5793a25cecb98f', class: "dialog-footer" }, index.h("slot", { key: '906adc00a3735e096159002b972804cfe147f42e', name: "footer" }, this.showCancelBtn && (index.h("button", { key: '1fc68b04c7c39ca9b7dfb228836eb38c4368c355', class: "cancel-btn", onClick: this.handleClose.bind(this) }, translate('cancel', this.language))), index.h("button", { key: '1d054ca93148286249d4989c783a67e1afe33667', class: "confirm-btn", onClick: this.handleConfirm.bind(this) }, translate('confirm', this.language))))))));
886
+ }
887
+ get el() { return index.getElement(this); }
888
+ static get watchers() { return {
889
+ "clientStyling": ["handleClientStylingChange"],
890
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
891
+ "mbSource": ["handleMbSourceChange"]
892
+ }; }
893
+ };
894
+ LotteryTippingDialog.style = LotteryTippingDialogStyle0;
895
+
896
+ exports.lottery_hakuna_ticket_history_item = lotteryHakunaTicketHistoryItem.LotteryHakunaTicketHistoryItem;
897
+ exports.lottery_button = LotteryButton;
898
+ exports.lottery_selection = LotterySelection;
899
+ exports.lottery_selection_group = LotterySelectionGroup;
900
+ exports.lottery_tipping_dialog = LotteryTippingDialog;