@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,2 @@
1
+ export { L as LotterySelectionGroup } from './lottery-selection-group-656d6729.js';
2
+ import './index-3a4d6110.js';
@@ -0,0 +1,11 @@
1
+ import { b as bootstrapLazy } from './index-3a4d6110.js';
2
+ export { s as setNonce } from './index-3a4d6110.js';
3
+ import { g as globalScripts } from './app-globals-0f993ce5.js';
4
+
5
+ const defineCustomElements = async (win, options) => {
6
+ if (typeof window === 'undefined') return undefined;
7
+ await globalScripts();
8
+ return bootstrapLazy([["lottery-button_4",[[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);
9
+ };
10
+
11
+ export { defineCustomElements };
@@ -0,0 +1,480 @@
1
+ import { r as registerInstance, h, g as getElement, c as createEvent } from './index-3a4d6110.js';
2
+ import { s as setClientStyling, a as setClientStylingURL, b as setStreamStyling } from './lottery-selection-group-656d6729.js';
3
+ export { L as lottery_selection_group } from './lottery-selection-group-656d6729.js';
4
+
5
+ const DEFAULT_LANGUAGE$1 = 'en';
6
+ const SUPPORTED_LANGUAGES$1 = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
7
+ const TRANSLATIONS$1 = {
8
+ en: {
9
+ loading: 'Loading'
10
+ },
11
+ ro: {},
12
+ fr: {},
13
+ ar: {},
14
+ hr: {}
15
+ };
16
+ const translate$1 = (key, customLang, replacements) => {
17
+ const lang = customLang;
18
+ let translation = TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
19
+ if (replacements) {
20
+ Object.keys(replacements).forEach((placeholder) => {
21
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
22
+ });
23
+ }
24
+ return translation;
25
+ };
26
+ const getTranslations$1 = (data) => {
27
+ Object.keys(data).forEach((item) => {
28
+ for (let key in data[item]) {
29
+ TRANSLATIONS$1[item][key] = data[item][key];
30
+ }
31
+ });
32
+ };
33
+ const resolveTranslationUrl$1 = async (translationUrl) => {
34
+ if (translationUrl) {
35
+ try {
36
+ const response = await fetch(translationUrl);
37
+ if (!response.ok) {
38
+ throw new Error(`HTTP error! status: ${response.status}`);
39
+ }
40
+ const translations = await response.json();
41
+ getTranslations$1(translations);
42
+ }
43
+ catch (error) {
44
+ console.error('Failed to fetch or parse translations from URL:', error);
45
+ }
46
+ }
47
+ };
48
+
49
+ 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}}";
50
+ const LotteryButtonStyle0 = lotteryButtonCss;
51
+
52
+ const LotteryButton = class {
53
+ constructor(hostRef) {
54
+ registerInstance(this, hostRef);
55
+ this.handleClick = (event) => {
56
+ if (this.disabled) {
57
+ return;
58
+ }
59
+ // Get the button element from the shadow root
60
+ const button = this.host.shadowRoot.querySelector('.btn');
61
+ if (!button)
62
+ return;
63
+ const rect = button.getBoundingClientRect();
64
+ const size = Math.max(rect.width, rect.height);
65
+ const top = event.clientY - rect.top - size / 2;
66
+ const left = event.clientX - rect.left - size / 2;
67
+ // Add the new ripple to the state, triggering a re-render
68
+ const newRipple = { top, left, size };
69
+ this.ripples = [...this.ripples, newRipple];
70
+ // Set a timeout to clean up the ripple from the state after the animation ends
71
+ // This prevents the DOM from filling up with old ripple elements
72
+ setTimeout(() => {
73
+ this.ripples = this.ripples.filter((r) => r !== newRipple);
74
+ }, 600); // This duration should match the CSS animation duration
75
+ };
76
+ this.variant = 'primary';
77
+ this.size = 'medium';
78
+ this.color = undefined;
79
+ this.disabled = false;
80
+ this.loading = false;
81
+ this.text = undefined;
82
+ this.mbSource = undefined;
83
+ this.language = 'en';
84
+ this.clientStyling = undefined;
85
+ this.clientStylingUrl = undefined;
86
+ this.translationUrl = '';
87
+ this.ripples = [];
88
+ }
89
+ handleClientStylingChange(newValue, oldValue) {
90
+ if (newValue != oldValue) {
91
+ setClientStyling(this.stylingContainer, this.clientStyling);
92
+ }
93
+ }
94
+ handleClientStylingUrlChange(newValue, oldValue) {
95
+ if (newValue != oldValue) {
96
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
97
+ }
98
+ }
99
+ handleMbSourceChange(newValue, oldValue) {
100
+ if (newValue != oldValue) {
101
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
102
+ }
103
+ }
104
+ disconnectedCallback() {
105
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
106
+ }
107
+ componentDidLoad() {
108
+ if (this.stylingContainer) {
109
+ if (this.mbSource)
110
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
111
+ if (this.clientStyling)
112
+ setClientStyling(this.stylingContainer, this.clientStyling);
113
+ if (this.clientStylingUrl)
114
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
115
+ }
116
+ }
117
+ componentWillLoad() {
118
+ if (this.translationUrl) {
119
+ resolveTranslationUrl$1(this.translationUrl);
120
+ }
121
+ }
122
+ render() {
123
+ const { variant, disabled, size, color } = this;
124
+ const isDisabled = disabled || this.loading;
125
+ // Calculate styles based on variant and color
126
+ const buttonStyles = {};
127
+ if (color) {
128
+ switch (variant) {
129
+ case 'primary':
130
+ Object.assign(buttonStyles, {
131
+ backgroundColor: color,
132
+ borderColor: color
133
+ });
134
+ break;
135
+ case 'outline':
136
+ case 'dashed':
137
+ Object.assign(buttonStyles, {
138
+ color: color,
139
+ borderColor: color
140
+ });
141
+ break;
142
+ case 'text':
143
+ Object.assign(buttonStyles, {
144
+ color: color
145
+ });
146
+ break;
147
+ default:
148
+ Object.assign(buttonStyles, {
149
+ backgroundColor: color,
150
+ borderColor: color
151
+ });
152
+ }
153
+ }
154
+ return (h("button", { key: 'aa74ad98c90e7548228557bf8a8d26b125d4a83a', class: {
155
+ btn: true,
156
+ [`btn--${variant}`]: true,
157
+ [`btn--${size}`]: true,
158
+ 'btn--loading': this.loading
159
+ }, style: color ? buttonStyles : undefined, disabled: isDisabled, onClick: this.handleClick, ref: (el) => (this.stylingContainer = el) }, this.loading ? (h("div", { class: "loading-container" }, h("span", { class: "content" }, this.text || translate$1('loading', this.language)), h("span", { class: "spinner" }))) : (h("span", { class: "content" }, h("slot", { name: "icon-left" }), this.text || h("slot", null), h("slot", { name: "icon-right" }))), h("div", { key: '302ea02be395bb24989d4abc040a513e23fa029a', class: "ripple-container" }, this.ripples.map((ripple, index) => (h("span", { key: index, class: "ripple", style: {
160
+ top: `${ripple.top}px`,
161
+ left: `${ripple.left}px`,
162
+ width: `${ripple.size}px`,
163
+ height: `${ripple.size}px`
164
+ } }))))));
165
+ }
166
+ get host() { return getElement(this); }
167
+ static get watchers() { return {
168
+ "clientStyling": ["handleClientStylingChange"],
169
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
170
+ "mbSource": ["handleMbSourceChange"]
171
+ }; }
172
+ };
173
+ LotteryButton.style = LotteryButtonStyle0;
174
+
175
+ // This icon file is generated automatically.
176
+ 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" };
177
+ const DeleteFilled$1 = DeleteFilled;
178
+
179
+ var __assign = (undefined && undefined.__assign) || function () {
180
+ __assign = Object.assign || function(t) {
181
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
182
+ s = arguments[i];
183
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
184
+ t[p] = s[p];
185
+ }
186
+ return t;
187
+ };
188
+ return __assign.apply(this, arguments);
189
+ };
190
+ var defaultColors = {
191
+ primaryColor: '#333',
192
+ secondaryColor: '#E6E6E6'
193
+ };
194
+ function renderIconDefinitionToSVGElement(icond, options) {
195
+ if (options === void 0) { options = {}; }
196
+ if (typeof icond.icon === 'function') {
197
+ // two-tone
198
+ var placeholders = options.placeholders || defaultColors;
199
+ return renderAbstractNodeToSVGElement(icond.icon(placeholders.primaryColor, placeholders.secondaryColor), options);
200
+ }
201
+ // fill, outline
202
+ return renderAbstractNodeToSVGElement(icond.icon, options);
203
+ }
204
+ function renderAbstractNodeToSVGElement(node, options) {
205
+ var targetAttrs = node.tag === 'svg'
206
+ ? __assign(__assign({}, node.attrs), (options.extraSVGAttrs || {})) : node.attrs;
207
+ var attrs = Object.keys(targetAttrs).reduce(function (acc, nextKey) {
208
+ var key = nextKey;
209
+ var value = targetAttrs[key];
210
+ var token = "".concat(key, "=\"").concat(value, "\"");
211
+ acc.push(token);
212
+ return acc;
213
+ }, []);
214
+ var attrsToken = attrs.length ? ' ' + attrs.join(' ') : '';
215
+ var children = (node.children || [])
216
+ .map(function (child) { return renderAbstractNodeToSVGElement(child, options); })
217
+ .join('');
218
+ if (children && children.length) {
219
+ return "<".concat(node.tag).concat(attrsToken, ">").concat(children, "</").concat(node.tag, ">");
220
+ }
221
+ return "<".concat(node.tag).concat(attrsToken, " />");
222
+ }
223
+
224
+ // Basic sanitization method for SVG content
225
+ // This is NOT a complete XSS prevention for SVG, but prevents common attacks.
226
+ function sanitizeSvg(svgString) {
227
+ let sanitized = svgString.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // Remove <script> tags
228
+ sanitized = sanitized.replace(/on[a-z]+=[\"'][^\"']*[\"']/gi, ''); // Remove on* attributes
229
+ sanitized = sanitized.replace(/javascript:/gi, ''); // Remove javascript: URLs
230
+ return sanitized;
231
+ }
232
+
233
+ 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}";
234
+ const LotterySelectionStyle0 = lotterySelectionCss;
235
+
236
+ const LotterySelection = class {
237
+ constructor(hostRef) {
238
+ registerInstance(this, hostRef);
239
+ this.lotteryBulletClickHandler = createEvent(this, "lotteryBulletClick", 7);
240
+ this.value = 0;
241
+ this.text = undefined;
242
+ this.idx = undefined;
243
+ this.type = 'toggle';
244
+ this.mbSource = undefined;
245
+ this.clientStyling = undefined;
246
+ this.clientStylingUrl = undefined;
247
+ this.hasBorder = true;
248
+ this.hasBackground = true;
249
+ this.deleteIconSvg = '';
250
+ this.deleteIconWidth = '16px';
251
+ this.deleteIconHeight = '16px';
252
+ }
253
+ handleClientStylingChange(newValue, oldValue) {
254
+ if (newValue !== oldValue) {
255
+ setClientStyling(this.stylingContainer, this.clientStyling);
256
+ }
257
+ }
258
+ handleClientStylingUrlChange(newValue, oldValue) {
259
+ if (newValue !== oldValue) {
260
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
261
+ }
262
+ }
263
+ handleMbSourceChange(newValue, oldValue) {
264
+ if (newValue !== oldValue) {
265
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
266
+ }
267
+ }
268
+ componentDidLoad() {
269
+ if (this.stylingContainer) {
270
+ if (this.mbSource)
271
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
272
+ if (this.clientStyling)
273
+ setClientStyling(this.stylingContainer, this.clientStyling);
274
+ if (this.clientStylingUrl)
275
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
276
+ }
277
+ }
278
+ disconnectedCallback() {
279
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
280
+ }
281
+ handleClick() {
282
+ if (this.type === 'disabled' || this.type === 'readonly') {
283
+ return;
284
+ }
285
+ console.log('bullet clicked', this.type, this.idx, this.text, this.value);
286
+ this.lotteryBulletClickHandler.emit({
287
+ type: this.type,
288
+ idx: this.idx,
289
+ text: this.text,
290
+ value: this.value
291
+ });
292
+ }
293
+ render() {
294
+ let iconToRender;
295
+ if (this.deleteIconSvg) {
296
+ iconToRender = sanitizeSvg(this.deleteIconSvg);
297
+ }
298
+ else {
299
+ iconToRender = renderIconDefinitionToSVGElement(DeleteFilled$1, {
300
+ extraSVGAttrs: {
301
+ width: this.deleteIconWidth,
302
+ height: this.deleteIconHeight,
303
+ fill: 'currentColor'
304
+ }
305
+ });
306
+ }
307
+ return (h("div", { key: '0d1e8aaa80a907a7467410f6b27b4b6175e82299', class: "lottery-selection", ref: (el) => (this.stylingContainer = el) }, h("button", { key: '11a2402abbc290dc877ad95f3433092c3a0d8419', class: {
308
+ 'lottery-selection__button': true,
309
+ 'lottery-selection__button--selected': this.value == 1,
310
+ 'lottery-selection__button--disabled': this.type === 'disabled',
311
+ 'lottery-selection__button--no-border': !this.hasBorder,
312
+ 'lottery-selection__button--no-background': !this.hasBackground,
313
+ isDeleteByIcon: this.type === 'delete',
314
+ isCallDialogBtn: this.type === 'input' || this.type === 'readonly'
315
+ }, onClick: this.handleClick.bind(this), disabled: this.type === 'disabled' }, this.type === 'delete' && h("span", { key: 'f99001d936a8f7bdf8adc5c46e82caf730a9442a', class: "lottery-selection__delete-icon", innerHTML: iconToRender }), h("span", { key: '55775e2492a1fe45cc8a457ac0a0d206744461ab', class: "lottery-selection__text" }, this.text))));
316
+ }
317
+ static get watchers() { return {
318
+ "clientStyling": ["handleClientStylingChange"],
319
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
320
+ "mbSource": ["handleMbSourceChange"]
321
+ }; }
322
+ };
323
+ LotterySelection.style = LotterySelectionStyle0;
324
+
325
+ const DEFAULT_LANGUAGE = 'en';
326
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
327
+ const TRANSLATIONS = {
328
+ en: {
329
+ cancel: 'Cancel',
330
+ confirm: 'Confirm'
331
+ },
332
+ ro: {
333
+ cancel: 'Anulează',
334
+ confirm: 'Confirmă'
335
+ },
336
+ fr: {
337
+ cancel: 'Annuler',
338
+ confirm: 'Confirmer'
339
+ },
340
+ ar: {
341
+ cancel: 'إلغاء',
342
+ confirm: 'تأكيد'
343
+ },
344
+ hr: {
345
+ cancel: 'Odustani',
346
+ confirm: 'Potvrdi'
347
+ }
348
+ };
349
+ const translate = (key, customLang) => {
350
+ const lang = customLang;
351
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
352
+ };
353
+ const getTranslations = (data) => {
354
+ Object.keys(data).forEach((item) => {
355
+ for (let key in data[item]) {
356
+ TRANSLATIONS[item][key] = data[item][key];
357
+ }
358
+ });
359
+ };
360
+ const resolveTranslationUrl = async (translationUrl) => {
361
+ if (translationUrl) {
362
+ try {
363
+ const response = await fetch(translationUrl);
364
+ if (!response.ok) {
365
+ throw new Error(`HTTP error! status: ${response.status}`);
366
+ }
367
+ const translations = await response.json();
368
+ getTranslations(translations);
369
+ }
370
+ catch (error) {
371
+ console.error('Failed to fetch or parse translations from URL:', error);
372
+ }
373
+ }
374
+ };
375
+
376
+ 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)}}";
377
+ const LotteryTippingDialogStyle0 = lotteryTippingDialogCss;
378
+
379
+ const LotteryTippingDialog = class {
380
+ constructor(hostRef) {
381
+ registerInstance(this, hostRef);
382
+ this.open = createEvent(this, "open", 7);
383
+ this.close = createEvent(this, "close", 7);
384
+ this.confirm = createEvent(this, "confirm", 7);
385
+ this.cancel = createEvent(this, "cancel", 7);
386
+ this.wasVisible = false;
387
+ this.mbSource = undefined;
388
+ this.clientStyling = '';
389
+ this.clientStylingUrl = '';
390
+ this.visible = undefined;
391
+ this.dialogTitle = '';
392
+ this.width = '520px';
393
+ this.closable = true;
394
+ this.mask = true;
395
+ this.maskClosable = true;
396
+ this.animationDuration = 300;
397
+ this.fullscreen = false;
398
+ this.showFooter = true;
399
+ this.showCancelBtn = true;
400
+ this.language = 'en';
401
+ this.translationUrl = undefined;
402
+ }
403
+ handleClientStylingChange(newValue, oldValue) {
404
+ if (newValue != oldValue) {
405
+ setClientStyling(this.stylingContainer, this.clientStyling);
406
+ }
407
+ }
408
+ handleClientStylingUrlChange(newValue, oldValue) {
409
+ if (newValue != oldValue) {
410
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
411
+ }
412
+ }
413
+ handleMbSourceChange(newValue, oldValue) {
414
+ if (newValue != oldValue) {
415
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
416
+ }
417
+ }
418
+ componentWillLoad() {
419
+ if (this.translationUrl) {
420
+ resolveTranslationUrl(this.translationUrl);
421
+ }
422
+ }
423
+ componentWillUpdate() {
424
+ if (this.visible && !this.wasVisible) {
425
+ this.disableBodyScroll();
426
+ }
427
+ else if (!this.visible && this.wasVisible) {
428
+ this.enableBodyScroll();
429
+ }
430
+ this.wasVisible = this.visible;
431
+ }
432
+ disconnectedCallback() {
433
+ this.enableBodyScroll();
434
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
435
+ }
436
+ disableBodyScroll() {
437
+ document.body.style.overflow = 'hidden';
438
+ }
439
+ enableBodyScroll() {
440
+ document.body.style.overflow = '';
441
+ }
442
+ handleClose() {
443
+ this.cancel.emit();
444
+ }
445
+ handleMaskClick(e) {
446
+ if (this.maskClosable && e.target === this.el.querySelector('.mask')) {
447
+ this.cancel.emit();
448
+ }
449
+ }
450
+ handleConfirm() {
451
+ this.confirm.emit();
452
+ }
453
+ render() {
454
+ const dialogStyle = {
455
+ width: typeof this.width === 'number' ? `${this.width}px` : this.width,
456
+ '--duration': `${this.animationDuration}ms`
457
+ };
458
+ const dialogWrapperClass = ['dialog-wrapper', this.visible ? 'dialog-wrapper-visible' : ''];
459
+ const maskClass = ['mask', this.visible ? 'mask-enter' : 'mask-leave'];
460
+ const dialogClass = [
461
+ 'dialog',
462
+ this.visible ? 'dialog-enter' : 'dialog-leave',
463
+ this.fullscreen ? 'fullscreen' : ''
464
+ ].join(' ');
465
+ const contentStyle = {
466
+ maxHeight: 'calc(100vh - 62px)',
467
+ overflowY: 'auto'
468
+ };
469
+ return (h("div", { key: '716c6488b86fc5a74bcd8c8c8a4eee1b85f75cb7', class: dialogWrapperClass.join(' '), ref: (el) => (this.stylingContainer = el) }, h("div", { key: '161d976b5a15f62c63b56555e161b5b29c0a7771', class: maskClass.join(' '), onClick: this.handleMaskClick.bind(this) }), h("div", { key: 'ebd2c356c169765b06c85997dc9906b74358b450', class: dialogClass, style: dialogStyle, role: "dialog", "aria-modal": "true", "aria-labelledby": "dialog-title" }, h("div", { key: '2a8616c336447b33d3c4b3f22deee3871abd93c9', class: "dialog-header" }, h("h2", { key: 'fc4f4f87826620754f8cce73874726cdebcc280e', id: "dialog-title", class: "dialog-title" }, this.dialogTitle), this.closable && (h("button", { key: '1626434c0700df7dc094cbf0c96840476ab65da5', class: "close-btn", onClick: this.handleClose.bind(this) }, "x"))), h("div", { key: '44d28c0e477e3e16069749f7700ee70b6a486d07', class: "dialog-content", style: contentStyle }, h("slot", { key: '745e1329fc3647247245f7aa96d10a06b6b18329' })), this.showFooter && (h("div", { key: 'cc3b19ba0ab16fd485f2c4e81a5793a25cecb98f', class: "dialog-footer" }, h("slot", { key: '906adc00a3735e096159002b972804cfe147f42e', name: "footer" }, this.showCancelBtn && (h("button", { key: '1fc68b04c7c39ca9b7dfb228836eb38c4368c355', class: "cancel-btn", onClick: this.handleClose.bind(this) }, translate('cancel', this.language))), h("button", { key: '1d054ca93148286249d4989c783a67e1afe33667', class: "confirm-btn", onClick: this.handleConfirm.bind(this) }, translate('confirm', this.language))))))));
470
+ }
471
+ get el() { return getElement(this); }
472
+ static get watchers() { return {
473
+ "clientStyling": ["handleClientStylingChange"],
474
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
475
+ "mbSource": ["handleMbSourceChange"]
476
+ }; }
477
+ };
478
+ LotteryTippingDialog.style = LotteryTippingDialogStyle0;
479
+
480
+ export { LotteryButton as lottery_button, LotterySelection as lottery_selection, LotteryTippingDialog as lottery_tipping_dialog };