@everymatrix/lottery-selection-group 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 (59) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-bc355d7d.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_4.cjs.entry.js +486 -0
  6. package/dist/cjs/lottery-selection-group-1608b2e2.js +480 -0
  7. package/dist/cjs/lottery-selection-group.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +31 -0
  9. package/dist/collection/components/lottery-selection-group/index.js +1 -0
  10. package/dist/collection/components/lottery-selection-group/lottery-selection-group.css +84 -0
  11. package/dist/collection/components/lottery-selection-group/lottery-selection-group.js +685 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/model/type.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +74 -0
  15. package/dist/collection/utils/utils.js +86 -0
  16. package/dist/esm/app-globals-0f993ce5.js +3 -0
  17. package/dist/esm/index-3a4d6110.js +1282 -0
  18. package/dist/esm/index.js +2 -0
  19. package/dist/esm/loader.js +11 -0
  20. package/dist/esm/lottery-button_4.entry.js +480 -0
  21. package/dist/esm/lottery-selection-group-656d6729.js +475 -0
  22. package/dist/esm/lottery-selection-group.js +20 -0
  23. package/dist/index.cjs.js +1 -0
  24. package/dist/index.js +1 -0
  25. package/dist/lottery-selection-group/app-globals-0f993ce5.js +1 -0
  26. package/dist/lottery-selection-group/index-3a4d6110.js +2 -0
  27. package/dist/lottery-selection-group/index.esm.js +1 -0
  28. package/dist/lottery-selection-group/lottery-button_4.entry.js +1 -0
  29. package/dist/lottery-selection-group/lottery-selection-group-656d6729.js +1 -0
  30. package/dist/lottery-selection-group/lottery-selection-group.esm.js +1 -0
  31. package/dist/stencil.config.dev.js +19 -0
  32. package/dist/stencil.config.js +19 -0
  33. package/dist/storybook/main.js +43 -0
  34. package/dist/storybook/preview.js +9 -0
  35. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/packages/stencil/lottery-selection-group/stencil.config.d.ts +2 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/packages/stencil/lottery-selection-group/stencil.config.dev.d.ts +2 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/packages/stencil/lottery-selection-group/storybook/main.d.ts +3 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/packages/stencil/lottery-selection-group/storybook/preview.d.ts +70 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/tools/plugins/index.d.ts +4 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  44. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection-group/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  45. package/dist/types/components/lottery-selection-group/index.d.ts +1 -0
  46. package/dist/types/components/lottery-selection-group/lottery-selection-group.d.ts +122 -0
  47. package/dist/types/components.d.ts +218 -0
  48. package/dist/types/index.d.ts +1 -0
  49. package/dist/types/model/type.d.ts +12 -0
  50. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  51. package/dist/types/utils/locale.utils.d.ts +3 -0
  52. package/dist/types/utils/utils.d.ts +14 -0
  53. package/loader/cdn.js +1 -0
  54. package/loader/index.cjs.js +1 -0
  55. package/loader/index.d.ts +24 -0
  56. package/loader/index.es2017.js +1 -0
  57. package/loader/index.js +2 -0
  58. package/loader/package.json +11 -0
  59. package/package.json +27 -0
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const lotterySelectionGroup = require('./lottery-selection-group-1608b2e2.js');
6
+ require('./index-bc355d7d.js');
7
+
8
+
9
+
10
+ exports.LotterySelectionGroup = lotterySelectionGroup.LotterySelectionGroup;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-bc355d7d.js');
6
+ const appGlobals = require('./app-globals-3a1e7e63.js');
7
+
8
+ const defineCustomElements = async (win, options) => {
9
+ if (typeof window === 'undefined') return undefined;
10
+ await appGlobals.globalScripts();
11
+ return index.bootstrapLazy([["lottery-button_4.cjs",[[1,"lottery-selection-group",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"translationUrl":[513,"translation-url"],"splitToken":[513,"split-token"],"selectionGroupId":[513,"selection-group-id"],"selectionGroupLabel":[513,"selection-group-label"],"type":[513],"selectedBulletTexts":[513,"selected-bullet-texts"],"maxSelectedCount":[514,"max-selected-count"],"maxDisplayBulletsCount":[514,"max-display-bullets-count"],"bulletTexts":[513,"bullet-texts"],"maxIntegerBulletText":[514,"max-integer-bullet-text"],"minIntegerBulletText":[514,"min-integer-bullet-text"],"bulletTextType":[513,"bullet-text-type"],"hasBorder":[516,"has-border"],"hasBackground":[516,"has-background"],"dialogTitle":[513,"dialog-title"],"dialogInputPlaceholder":[513,"dialog-input-placeholder"],"dialogConfig":[32],"inputInfo":[32]},[[0,"lotteryBulletClick","lotteryBulletClickHandler"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-button",{"variant":[513],"size":[513],"color":[513],"disabled":[516],"loading":[516],"text":[513],"mbSource":[513,"mb-source"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-selection",{"value":[520],"text":[513],"idx":[514],"type":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"hasBorder":[516,"has-border"],"hasBackground":[516,"has-background"],"deleteIconSvg":[513,"delete-icon-svg"],"deleteIconWidth":[513,"delete-icon-width"],"deleteIconHeight":[513,"delete-icon-height"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-tipping-dialog",{"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"visible":[516],"dialogTitle":[1,"dialog-title"],"width":[1],"closable":[4],"mask":[4],"maskClosable":[4,"mask-closable"],"animationDuration":[2,"animation-duration"],"fullscreen":[4],"showFooter":[4,"show-footer"],"showCancelBtn":[4,"show-cancel-btn"],"language":[513],"translationUrl":[520,"translation-url"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
12
+ };
13
+
14
+ exports.setNonce = index.setNonce;
15
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,486 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-bc355d7d.js');
6
+ const lotterySelectionGroup = require('./lottery-selection-group-1608b2e2.js');
7
+
8
+ const DEFAULT_LANGUAGE$1 = 'en';
9
+ const SUPPORTED_LANGUAGES$1 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
10
+ const TRANSLATIONS$1 = {
11
+ en: {
12
+ loading: 'Loading'
13
+ },
14
+ ro: {},
15
+ fr: {},
16
+ ar: {},
17
+ hr: {}
18
+ };
19
+ const translate$1 = (key, customLang, replacements) => {
20
+ const lang = customLang;
21
+ let translation = TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][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$1 = (data) => {
30
+ Object.keys(data).forEach((item) => {
31
+ for (let key in data[item]) {
32
+ TRANSLATIONS$1[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$1(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
+ lotterySelectionGroup.setClientStyling(this.stylingContainer, this.clientStyling);
95
+ }
96
+ }
97
+ handleClientStylingUrlChange(newValue, oldValue) {
98
+ if (newValue != oldValue) {
99
+ lotterySelectionGroup.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
100
+ }
101
+ }
102
+ handleMbSourceChange(newValue, oldValue) {
103
+ if (newValue != oldValue) {
104
+ lotterySelectionGroup.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
+ lotterySelectionGroup.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
114
+ if (this.clientStyling)
115
+ lotterySelectionGroup.setClientStyling(this.stylingContainer, this.clientStyling);
116
+ if (this.clientStylingUrl)
117
+ lotterySelectionGroup.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$1('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
+ lotterySelectionGroup.setClientStyling(this.stylingContainer, this.clientStyling);
259
+ }
260
+ }
261
+ handleClientStylingUrlChange(newValue, oldValue) {
262
+ if (newValue !== oldValue) {
263
+ lotterySelectionGroup.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
264
+ }
265
+ }
266
+ handleMbSourceChange(newValue, oldValue) {
267
+ if (newValue !== oldValue) {
268
+ lotterySelectionGroup.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
269
+ }
270
+ }
271
+ componentDidLoad() {
272
+ if (this.stylingContainer) {
273
+ if (this.mbSource)
274
+ lotterySelectionGroup.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
275
+ if (this.clientStyling)
276
+ lotterySelectionGroup.setClientStyling(this.stylingContainer, this.clientStyling);
277
+ if (this.clientStylingUrl)
278
+ lotterySelectionGroup.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 = 'en';
329
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
330
+ const TRANSLATIONS = {
331
+ en: {
332
+ cancel: 'Cancel',
333
+ confirm: 'Confirm'
334
+ },
335
+ ro: {
336
+ cancel: 'Anulează',
337
+ confirm: 'Confirmă'
338
+ },
339
+ fr: {
340
+ cancel: 'Annuler',
341
+ confirm: 'Confirmer'
342
+ },
343
+ ar: {
344
+ cancel: 'إلغاء',
345
+ confirm: 'تأكيد'
346
+ },
347
+ hr: {
348
+ cancel: 'Odustani',
349
+ confirm: 'Potvrdi'
350
+ }
351
+ };
352
+ const translate = (key, customLang) => {
353
+ const lang = customLang;
354
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
355
+ };
356
+ const getTranslations = (data) => {
357
+ Object.keys(data).forEach((item) => {
358
+ for (let key in data[item]) {
359
+ TRANSLATIONS[item][key] = data[item][key];
360
+ }
361
+ });
362
+ };
363
+ const resolveTranslationUrl = async (translationUrl) => {
364
+ if (translationUrl) {
365
+ try {
366
+ const response = await fetch(translationUrl);
367
+ if (!response.ok) {
368
+ throw new Error(`HTTP error! status: ${response.status}`);
369
+ }
370
+ const translations = await response.json();
371
+ getTranslations(translations);
372
+ }
373
+ catch (error) {
374
+ console.error('Failed to fetch or parse translations from URL:', error);
375
+ }
376
+ }
377
+ };
378
+
379
+ 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)}}";
380
+ const LotteryTippingDialogStyle0 = lotteryTippingDialogCss;
381
+
382
+ const LotteryTippingDialog = class {
383
+ constructor(hostRef) {
384
+ index.registerInstance(this, hostRef);
385
+ this.open = index.createEvent(this, "open", 7);
386
+ this.close = index.createEvent(this, "close", 7);
387
+ this.confirm = index.createEvent(this, "confirm", 7);
388
+ this.cancel = index.createEvent(this, "cancel", 7);
389
+ this.wasVisible = false;
390
+ this.mbSource = undefined;
391
+ this.clientStyling = '';
392
+ this.clientStylingUrl = '';
393
+ this.visible = undefined;
394
+ this.dialogTitle = '';
395
+ this.width = '520px';
396
+ this.closable = true;
397
+ this.mask = true;
398
+ this.maskClosable = true;
399
+ this.animationDuration = 300;
400
+ this.fullscreen = false;
401
+ this.showFooter = true;
402
+ this.showCancelBtn = true;
403
+ this.language = 'en';
404
+ this.translationUrl = undefined;
405
+ }
406
+ handleClientStylingChange(newValue, oldValue) {
407
+ if (newValue != oldValue) {
408
+ lotterySelectionGroup.setClientStyling(this.stylingContainer, this.clientStyling);
409
+ }
410
+ }
411
+ handleClientStylingUrlChange(newValue, oldValue) {
412
+ if (newValue != oldValue) {
413
+ lotterySelectionGroup.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
414
+ }
415
+ }
416
+ handleMbSourceChange(newValue, oldValue) {
417
+ if (newValue != oldValue) {
418
+ lotterySelectionGroup.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
419
+ }
420
+ }
421
+ componentWillLoad() {
422
+ if (this.translationUrl) {
423
+ resolveTranslationUrl(this.translationUrl);
424
+ }
425
+ }
426
+ componentWillUpdate() {
427
+ if (this.visible && !this.wasVisible) {
428
+ this.disableBodyScroll();
429
+ }
430
+ else if (!this.visible && this.wasVisible) {
431
+ this.enableBodyScroll();
432
+ }
433
+ this.wasVisible = this.visible;
434
+ }
435
+ disconnectedCallback() {
436
+ this.enableBodyScroll();
437
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
438
+ }
439
+ disableBodyScroll() {
440
+ document.body.style.overflow = 'hidden';
441
+ }
442
+ enableBodyScroll() {
443
+ document.body.style.overflow = '';
444
+ }
445
+ handleClose() {
446
+ this.cancel.emit();
447
+ }
448
+ handleMaskClick(e) {
449
+ if (this.maskClosable && e.target === this.el.querySelector('.mask')) {
450
+ this.cancel.emit();
451
+ }
452
+ }
453
+ handleConfirm() {
454
+ this.confirm.emit();
455
+ }
456
+ render() {
457
+ const dialogStyle = {
458
+ width: typeof this.width === 'number' ? `${this.width}px` : this.width,
459
+ '--duration': `${this.animationDuration}ms`
460
+ };
461
+ const dialogWrapperClass = ['dialog-wrapper', this.visible ? 'dialog-wrapper-visible' : ''];
462
+ const maskClass = ['mask', this.visible ? 'mask-enter' : 'mask-leave'];
463
+ const dialogClass = [
464
+ 'dialog',
465
+ this.visible ? 'dialog-enter' : 'dialog-leave',
466
+ this.fullscreen ? 'fullscreen' : ''
467
+ ].join(' ');
468
+ const contentStyle = {
469
+ maxHeight: 'calc(100vh - 62px)',
470
+ overflowY: 'auto'
471
+ };
472
+ 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))))))));
473
+ }
474
+ get el() { return index.getElement(this); }
475
+ static get watchers() { return {
476
+ "clientStyling": ["handleClientStylingChange"],
477
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
478
+ "mbSource": ["handleMbSourceChange"]
479
+ }; }
480
+ };
481
+ LotteryTippingDialog.style = LotteryTippingDialogStyle0;
482
+
483
+ exports.lottery_selection_group = lotterySelectionGroup.LotterySelectionGroup;
484
+ exports.lottery_button = LotteryButton;
485
+ exports.lottery_selection = LotterySelection;
486
+ exports.lottery_tipping_dialog = LotteryTippingDialog;