@crystaldesign/quick-config 26.3.0-beta.4 → 26.3.0-beta.41

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 (82) hide show
  1. package/build/cjs/index.js +2107 -0
  2. package/build/esm/index.js +2090 -0
  3. package/build/types/quick-config/src/Components/ConditionEvaluator/index.d.ts +47 -0
  4. package/build/types/quick-config/src/Components/ConditionEvaluator/index.d.ts.map +1 -0
  5. package/build/types/quick-config/src/Components/QuickConfig/components/FeatureRenderer/index.d.ts +10 -0
  6. package/build/types/quick-config/src/Components/QuickConfig/components/FeatureRenderer/index.d.ts.map +1 -0
  7. package/build/types/quick-config/src/Components/QuickConfig/components/Header/index.d.ts +12 -0
  8. package/build/types/quick-config/src/Components/QuickConfig/components/Header/index.d.ts.map +1 -0
  9. package/build/types/quick-config/src/Components/QuickConfig/components/Navigation/index.d.ts +18 -0
  10. package/build/types/quick-config/src/Components/QuickConfig/components/Navigation/index.d.ts.map +1 -0
  11. package/build/types/quick-config/src/Components/QuickConfig/components/OptionRenderer/Layouts/ButtonGroupLayout.d.ts +18 -0
  12. package/build/types/quick-config/src/Components/QuickConfig/components/OptionRenderer/Layouts/ButtonGroupLayout.d.ts.map +1 -0
  13. package/build/types/quick-config/src/Components/QuickConfig/components/OptionRenderer/Layouts/DropdownLayout.d.ts +16 -0
  14. package/build/types/quick-config/src/Components/QuickConfig/components/OptionRenderer/Layouts/DropdownLayout.d.ts.map +1 -0
  15. package/build/types/quick-config/src/Components/QuickConfig/components/OptionRenderer/Layouts/RangeLayout.d.ts +11 -0
  16. package/build/types/quick-config/src/Components/QuickConfig/components/OptionRenderer/Layouts/RangeLayout.d.ts.map +1 -0
  17. package/build/types/quick-config/src/Components/QuickConfig/components/OptionRenderer/Layouts/SelectionListLayout.d.ts +18 -0
  18. package/build/types/quick-config/src/Components/QuickConfig/components/OptionRenderer/Layouts/SelectionListLayout.d.ts.map +1 -0
  19. package/build/types/quick-config/src/Components/QuickConfig/components/OptionRenderer/index.d.ts +10 -0
  20. package/build/types/quick-config/src/Components/QuickConfig/components/OptionRenderer/index.d.ts.map +1 -0
  21. package/build/types/quick-config/src/Components/QuickConfig/components/ProgressBar/index.d.ts +7 -0
  22. package/build/types/quick-config/src/Components/QuickConfig/components/ProgressBar/index.d.ts.map +1 -0
  23. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/components/ContentItem.d.ts +8 -0
  24. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/components/ContentItem.d.ts.map +1 -0
  25. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/components/ResultItemsRenderer.d.ts +12 -0
  26. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/components/ResultItemsRenderer.d.ts.map +1 -0
  27. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/components/SpeedometerGroup/Speedometer.d.ts +17 -0
  28. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/components/SpeedometerGroup/Speedometer.d.ts.map +1 -0
  29. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/components/SpeedometerGroup/index.d.ts +10 -0
  30. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/components/SpeedometerGroup/index.d.ts.map +1 -0
  31. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/components/TextResult.d.ts +10 -0
  32. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/components/TextResult.d.ts.map +1 -0
  33. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/index.d.ts +13 -0
  34. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/index.d.ts.map +1 -0
  35. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/utils/index.d.ts +3 -0
  36. package/build/types/quick-config/src/Components/QuickConfig/components/ResultDisplay/utils/index.d.ts.map +1 -0
  37. package/build/types/quick-config/src/Components/QuickConfig/hooks/useOptionRenderer.d.ts +19 -0
  38. package/build/types/quick-config/src/Components/QuickConfig/hooks/useOptionRenderer.d.ts.map +1 -0
  39. package/build/types/quick-config/src/Components/QuickConfig/hooks/useQuickConfig.d.ts +30 -0
  40. package/build/types/quick-config/src/Components/QuickConfig/hooks/useQuickConfig.d.ts.map +1 -0
  41. package/build/types/quick-config/src/Components/QuickConfig/hooks/useQuickConfigCalculations.d.ts +7 -0
  42. package/build/types/quick-config/src/Components/QuickConfig/hooks/useQuickConfigCalculations.d.ts.map +1 -0
  43. package/build/types/quick-config/src/Components/QuickConfig/hooks/useQuickConfigFeatures.d.ts +6 -0
  44. package/build/types/quick-config/src/Components/QuickConfig/hooks/useQuickConfigFeatures.d.ts.map +1 -0
  45. package/build/types/quick-config/src/Components/QuickConfig/hooks/useQuickConfigStorage.d.ts +9 -0
  46. package/build/types/quick-config/src/Components/QuickConfig/hooks/useQuickConfigStorage.d.ts.map +1 -0
  47. package/build/types/quick-config/src/Components/QuickConfig/index.d.ts +10 -0
  48. package/build/types/quick-config/src/Components/QuickConfig/index.d.ts.map +1 -0
  49. package/build/types/quick-config/src/calculators/variantValueCalculator.d.ts +8 -0
  50. package/build/types/quick-config/src/calculators/variantValueCalculator.d.ts.map +1 -0
  51. package/build/types/quick-config/src/index.d.ts +8 -0
  52. package/build/types/quick-config/src/index.d.ts.map +1 -0
  53. package/build/types/quick-config/src/stories/QuickConfig.stories.d.ts +17 -0
  54. package/build/types/quick-config/src/stories/QuickConfig.stories.d.ts.map +1 -0
  55. package/build/types/quick-config/src/types.d.ts +216 -0
  56. package/build/types/quick-config/src/types.d.ts.map +1 -0
  57. package/build/types/quick-config/src/utils/index.d.ts +14 -0
  58. package/build/types/quick-config/src/utils/index.d.ts.map +1 -0
  59. package/build/umd/124.quick-config.umd.min.js +2 -0
  60. package/build/umd/124.quick-config.umd.min.js.LICENSE.txt +1 -0
  61. package/build/umd/145.quick-config.umd.min.js +2 -0
  62. package/build/umd/145.quick-config.umd.min.js.LICENSE.txt +1 -0
  63. package/build/umd/338.quick-config.umd.min.js +2 -0
  64. package/build/umd/338.quick-config.umd.min.js.LICENSE.txt +1 -0
  65. package/build/umd/433.quick-config.umd.min.js +2 -0
  66. package/build/umd/433.quick-config.umd.min.js.LICENSE.txt +1 -0
  67. package/build/umd/610.quick-config.umd.min.js +2 -0
  68. package/build/umd/610.quick-config.umd.min.js.LICENSE.txt +1 -0
  69. package/build/umd/662.quick-config.umd.min.js +2 -0
  70. package/build/umd/662.quick-config.umd.min.js.LICENSE.txt +1 -0
  71. package/build/umd/721.quick-config.umd.min.js +408 -0
  72. package/build/umd/721.quick-config.umd.min.js.LICENSE.txt +92 -0
  73. package/build/umd/74.quick-config.umd.min.js +2 -0
  74. package/build/umd/74.quick-config.umd.min.js.LICENSE.txt +1 -0
  75. package/build/umd/871.quick-config.umd.min.js +2 -0
  76. package/build/umd/871.quick-config.umd.min.js.LICENSE.txt +1 -0
  77. package/build/umd/944.quick-config.umd.min.js +2 -0
  78. package/build/umd/944.quick-config.umd.min.js.LICENSE.txt +10 -0
  79. package/build/umd/quick-config.umd.min.js +102 -0
  80. package/build/umd/quick-config.umd.min.js.LICENSE.txt +135 -0
  81. package/build/umd/report.html +38 -0
  82. package/package.json +3 -2
@@ -0,0 +1,2090 @@
1
+ import { useMemo, useCallback, useState, useEffect, useRef } from 'react';
2
+ import { useTranslation } from '@crystaldesign/diva-core';
3
+ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
4
+ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
5
+ import _createClass from '@babel/runtime/helpers/createClass';
6
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
7
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
8
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
+ import _typeof from '@babel/runtime/helpers/typeof';
10
+ import classNames from 'classnames';
11
+
12
+ (function() {
13
+ const env = {"STAGE":"production"};
14
+ try {
15
+ if (process) {
16
+ process.env = Object.assign({}, process.env);
17
+ Object.assign(process.env, env);
18
+ return;
19
+ }
20
+ } catch (e) {} // avoid ReferenceError: process is not defined
21
+ globalThis.process = { env:env };
22
+ })();
23
+
24
+ /**
25
+ * Utility functions for QuickConfig
26
+ */
27
+
28
+ /**
29
+ * Get translated text with fallback
30
+ */
31
+ function getTranslatedText(translations, language, fallbackCodex) {
32
+ return translations[language] || translations.en || translations.de || fallbackCodex || '';
33
+ }
34
+
35
+ /**
36
+ * Validate QuickConfig definition
37
+ */
38
+ function validateQuickConfig(config) {
39
+ var _config$features;
40
+ var errors = [];
41
+ if (!config.codex) {
42
+ errors.push('QuickConfig must have a codex');
43
+ }
44
+ if (!config.name || Object.keys(config.name).length === 0) {
45
+ errors.push('QuickConfig must have at least one language for name');
46
+ }
47
+ if (!config.features || config.features.length === 0) {
48
+ errors.push('QuickConfig must have at least one feature');
49
+ }
50
+
51
+ // Validate features
52
+ (_config$features = config.features) === null || _config$features === void 0 || _config$features.forEach(function (feature, index) {
53
+ var _feature$options;
54
+ if (!feature.codex) {
55
+ errors.push("Feature at index ".concat(index, " must have a codex"));
56
+ }
57
+ if (!feature.label || Object.keys(feature.label).length === 0) {
58
+ errors.push("Feature ".concat(feature.codex || index, " must have at least one language for label"));
59
+ }
60
+ if (!feature.layout) {
61
+ errors.push("Feature ".concat(feature.codex || index, " must have a layout"));
62
+ }
63
+ if (!feature.options || feature.options.length === 0) {
64
+ errors.push("Feature ".concat(feature.codex || index, " must have at least one option"));
65
+ }
66
+
67
+ // Validate options
68
+ (_feature$options = feature.options) === null || _feature$options === void 0 || _feature$options.forEach(function (option, optIndex) {
69
+ if (!option.codex) {
70
+ errors.push("Option at index ".concat(optIndex, " in feature ").concat(feature.codex || index, " must have a codex"));
71
+ }
72
+ if (!option.type) {
73
+ errors.push("Option ".concat(option.codex || optIndex, " must have a type"));
74
+ }
75
+ if (option.type === 'range' && !option.range) {
76
+ errors.push("Range option ".concat(option.codex || optIndex, " must have range configuration"));
77
+ }
78
+ });
79
+ });
80
+ return errors;
81
+ }
82
+
83
+ /**
84
+ * Evaluates a condition against the current user selections
85
+ */
86
+ var ConditionEvaluator = /*#__PURE__*/function () {
87
+ function ConditionEvaluator(selections) {
88
+ _classCallCheck(this, ConditionEvaluator);
89
+ _defineProperty(this, "selections", void 0);
90
+ this.selections = new Map(selections.map(function (s) {
91
+ return [s.featureCodex, s.selectedOptions];
92
+ }));
93
+ }
94
+
95
+ /**
96
+ * Main evaluation method
97
+ */
98
+ return _createClass(ConditionEvaluator, [{
99
+ key: "evaluate",
100
+ value: function evaluate(condition) {
101
+ if (this.isAndCondition(condition)) {
102
+ return this.evaluateAnd(condition);
103
+ }
104
+ if (this.isOrCondition(condition)) {
105
+ return this.evaluateOr(condition);
106
+ }
107
+ if (this.isNotCondition(condition)) {
108
+ return this.evaluateNot(condition);
109
+ }
110
+ return this.evaluateSingleCondition(condition);
111
+ }
112
+
113
+ /**
114
+ * Type guards
115
+ */
116
+ }, {
117
+ key: "isAndCondition",
118
+ value: function isAndCondition(condition) {
119
+ return 'and' in condition;
120
+ }
121
+ }, {
122
+ key: "isOrCondition",
123
+ value: function isOrCondition(condition) {
124
+ return 'or' in condition;
125
+ }
126
+ }, {
127
+ key: "isNotCondition",
128
+ value: function isNotCondition(condition) {
129
+ return 'not' in condition;
130
+ }
131
+
132
+ /**
133
+ * Evaluate logical operators
134
+ */
135
+ }, {
136
+ key: "evaluateAnd",
137
+ value: function evaluateAnd(condition) {
138
+ var _this = this;
139
+ return condition.and.every(function (c) {
140
+ return _this.evaluateSingleCondition(c);
141
+ });
142
+ }
143
+ }, {
144
+ key: "evaluateOr",
145
+ value: function evaluateOr(condition) {
146
+ var _this2 = this;
147
+ return condition.or.some(function (c) {
148
+ return _this2.evaluateSingleCondition(c);
149
+ });
150
+ }
151
+ }, {
152
+ key: "evaluateNot",
153
+ value: function evaluateNot(condition) {
154
+ return !this.evaluate(condition.not);
155
+ }
156
+
157
+ /**
158
+ * Evaluate a single condition
159
+ */
160
+ }, {
161
+ key: "evaluateSingleCondition",
162
+ value: function evaluateSingleCondition(condition) {
163
+ var selectedValues = this.selections.get(condition.featureCodex);
164
+
165
+ // If feature not selected yet, condition is false
166
+ if (!selectedValues || selectedValues.length === 0) {
167
+ return false;
168
+ }
169
+ switch (condition.operator) {
170
+ case 'eq':
171
+ return selectedValues.some(function (v) {
172
+ return v === condition.value;
173
+ });
174
+ case 'ne':
175
+ return !selectedValues.some(function (v) {
176
+ return v === condition.value;
177
+ });
178
+ case 'in':
179
+ return selectedValues.some(function (v) {
180
+ return condition.value.includes(v);
181
+ });
182
+ case 'nin':
183
+ return !selectedValues.some(function (v) {
184
+ return condition.value.includes(v);
185
+ });
186
+ default:
187
+ return false;
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Utility method to check if a feature should be visible
193
+ */
194
+ }], [{
195
+ key: "shouldShowFeature",
196
+ value: function shouldShowFeature(feature, selections) {
197
+ if (!feature.condition) {
198
+ return true;
199
+ }
200
+ var evaluator = new ConditionEvaluator(selections);
201
+ return evaluator.evaluate(feature.condition);
202
+ }
203
+
204
+ /**
205
+ * Utility method to check if an option should be visible
206
+ */
207
+ }, {
208
+ key: "shouldShowOption",
209
+ value: function shouldShowOption(option, selections) {
210
+ if (!option.condition) {
211
+ return true;
212
+ }
213
+ var evaluator = new ConditionEvaluator(selections);
214
+ return evaluator.evaluate(option.condition);
215
+ }
216
+
217
+ /**
218
+ * Utility method to check if an instance should be visible
219
+ */
220
+ }, {
221
+ key: "shouldShowInstance",
222
+ value: function shouldShowInstance(instance, selections) {
223
+ if (!instance.condition) {
224
+ return true;
225
+ }
226
+ var evaluator = new ConditionEvaluator(selections);
227
+ return evaluator.evaluate(instance.condition);
228
+ }
229
+ }]);
230
+ }();
231
+
232
+ var useOptionRenderer = function useOptionRenderer(_ref) {
233
+ var feature = _ref.feature,
234
+ selectedOptions = _ref.selectedOptions,
235
+ onSelect = _ref.onSelect,
236
+ selections = _ref.selections;
237
+ var _useTranslation = useTranslation(),
238
+ i18n = _useTranslation.i18n;
239
+ var language = i18n.language;
240
+ // Filter visible options based on conditions
241
+ var visibleOptions = useMemo(function () {
242
+ return feature.options.filter(function (option) {
243
+ return ConditionEvaluator.shouldShowOption(option, selections);
244
+ });
245
+ }, [feature.options, selections]);
246
+ var selectOptions = useMemo(function () {
247
+ return visibleOptions.filter(function (o) {
248
+ return o.type === 'select';
249
+ });
250
+ }, [visibleOptions]);
251
+ var rangeOption = useMemo(function () {
252
+ return visibleOptions.find(function (o) {
253
+ return o.type === 'range';
254
+ });
255
+ }, [visibleOptions]);
256
+ var handleSingleSelect = useCallback(function (optionCodex) {
257
+ onSelect([optionCodex]);
258
+ }, [onSelect]);
259
+ var handleMultiSelect = useCallback(function (optionCodex) {
260
+ if (selectedOptions.includes(optionCodex)) {
261
+ onSelect(selectedOptions.filter(function (o) {
262
+ return o !== optionCodex;
263
+ }));
264
+ } else {
265
+ onSelect([].concat(_toConsumableArray(selectedOptions), [optionCodex]));
266
+ }
267
+ }, [selectedOptions, onSelect]);
268
+ var getOptionLabel = useCallback(function (option) {
269
+ return option.label[language] || option.label.en || option.label.de || option.codex;
270
+ }, [language]);
271
+ var getOptionDescription = useCallback(function (option) {
272
+ var _option$description, _option$description2, _option$description3;
273
+ return ((_option$description = option.description) === null || _option$description === void 0 ? void 0 : _option$description[language]) || ((_option$description2 = option.description) === null || _option$description2 === void 0 ? void 0 : _option$description2.en) || ((_option$description3 = option.description) === null || _option$description3 === void 0 ? void 0 : _option$description3.de);
274
+ }, [language]);
275
+ var getOptionCaption = useCallback(function (option) {
276
+ var _option$caption, _option$caption2, _option$caption3;
277
+ return ((_option$caption = option.caption) === null || _option$caption === void 0 ? void 0 : _option$caption[language]) || ((_option$caption2 = option.caption) === null || _option$caption2 === void 0 ? void 0 : _option$caption2.en) || ((_option$caption3 = option.caption) === null || _option$caption3 === void 0 ? void 0 : _option$caption3.de);
278
+ }, [language]);
279
+ return {
280
+ visibleOptions: visibleOptions,
281
+ selectOptions: selectOptions,
282
+ rangeOption: rangeOption,
283
+ handleSingleSelect: handleSingleSelect,
284
+ handleMultiSelect: handleMultiSelect,
285
+ getOptionLabel: getOptionLabel,
286
+ getOptionDescription: getOptionDescription,
287
+ getOptionCaption: getOptionCaption
288
+ };
289
+ };
290
+
291
+ function styleInject(css, ref) {
292
+ if ( ref === void 0 ) ref = {};
293
+ var insertAt = ref.insertAt;
294
+
295
+ if (!css || typeof document === 'undefined') { return; }
296
+
297
+ var head = document.head || document.getElementsByTagName('head')[0];
298
+ var style = document.createElement('style');
299
+ style.type = 'text/css';
300
+
301
+ if (insertAt === 'top') {
302
+ if (head.firstChild) {
303
+ head.insertBefore(style, head.firstChild);
304
+ } else {
305
+ head.appendChild(style);
306
+ }
307
+ } else {
308
+ head.appendChild(style);
309
+ }
310
+
311
+ if (style.styleSheet) {
312
+ style.styleSheet.cssText = css;
313
+ } else {
314
+ style.appendChild(document.createTextNode(css));
315
+ }
316
+ }
317
+
318
+ var container = "container-nN2kI";
319
+ var subContainer = "subContainer-x97eX";
320
+ var stickyHeader = "stickyHeader-V5orv";
321
+ var featureContainer = "featureContainer-cTJH8";
322
+ var featureLabel = "featureLabel-q4sHn";
323
+ var featureRequired = "featureRequired-tby4F";
324
+ var featureDescription = "featureDescription-k4v-p";
325
+ var optionDescription = "optionDescription-omLcU";
326
+ var progressText = "progressText-LXaM7";
327
+ var configDescription = "configDescription--0UjU";
328
+ var resultDescription = "resultDescription-7jW2U";
329
+ var optionsBox = "optionsBox-TBnRq";
330
+ var optionsGallery = "optionsGallery-72aVW";
331
+ var optionButton = "optionButton-tRXEs";
332
+ var radioOption = "radioOption-sv3m6";
333
+ var checkboxOption = "checkboxOption-UY3nL";
334
+ var optionButtonSelected = "optionButtonSelected-pjY9O";
335
+ var radioOptionSelected = "radioOptionSelected-vm6bN";
336
+ var checkboxOptionSelected = "checkboxOptionSelected-DuZGL";
337
+ var optionLabel = "optionLabel-oz4Zj";
338
+ var optionCaption = "optionCaption-3d-V1";
339
+ var optionContent = "optionContent-DS9Wc";
340
+ var progressBar = "progressBar-RKPZp";
341
+ var progressBarFill = "progressBarFill--Shc9";
342
+ var progressBarInner = "progressBarInner-agBx-";
343
+ var slider = "slider-ev57L";
344
+ var sliderInput = "sliderInput-xAXVM";
345
+ var sliderValue = "sliderValue-vwwNn";
346
+ var dropdown = "dropdown-fst7q";
347
+ var radio = "radio-GesCu";
348
+ var checkbox = "checkbox-xI7lT";
349
+ var toggle = "toggle-fi2uF";
350
+ var toggleButton = "toggleButton-4myWl";
351
+ var toggleButtonSelected = "toggleButtonSelected-4SMtn";
352
+ var resultContainer = "resultContainer-sc6De";
353
+ var resultItem = "resultItem-84scA";
354
+ var resultKey = "resultKey-qD5DS";
355
+ var resultValue = "resultValue-42tes";
356
+ var buttonContainer = "buttonContainer-UZKoO";
357
+ var navLeftGroup = "navLeftGroup-JOQ3N";
358
+ var navRightGroup = "navRightGroup-mWCAz";
359
+ var navButtonPadding = "navButtonPadding-aX9-f";
360
+ var button = "button-CT3BR";
361
+ var buttonPrimary = "buttonPrimary-b3Tur";
362
+ var buttonPrimaryApplied = "buttonPrimaryApplied-90Q5-";
363
+ var headerContainer = "headerContainer-fhFhh";
364
+ var tabWrapper = "tabWrapper-ZqpAa";
365
+ var tabSlider = "tabSlider-d133A";
366
+ var tab = "tab-Cf5O4";
367
+ var tabActive = "tabActive-B4W84";
368
+ var buttonSecondary = "buttonSecondary-Fs2ci";
369
+ var buttonWithArrow = "buttonWithArrow-PQQFS";
370
+ var closeButton = "closeButton-Regwf";
371
+ var resultsGrid = "resultsGrid-s3UTE";
372
+ var speedometer = "speedometer-kKRJQ";
373
+ var speedometerGroup = "speedometerGroup-SS-GT";
374
+ var speedometerGroupTitle = "speedometerGroupTitle-4s2YI";
375
+ var speedometerGroupGrid = "speedometerGroupGrid-SNMAM";
376
+ var speedometerGroupItem = "speedometerGroupItem-a4T-A";
377
+ var speedometerGroupItemTitle = "speedometerGroupItemTitle-N35gZ";
378
+ var contentSection = "contentSection-dJgsX";
379
+ var css_248z = ".container-nN2kI {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\n height: 100%;\n\n max-height: calc(100vh - 40px);\n padding: 12px;\n box-sizing: border-box;\n overflow: auto;\n}\n\n@supports (height: 100dvh) {\n .container-nN2kI {\n max-height: calc(100dvh - 40px);\n }\n}\n\n.subContainer-x97eX {\n flex: 1;\n padding: 12px 0;\n display: flex;\n flex-direction: column;\n gap: 20px;\n}\n\n.mobile .subContainer-x97eX {\n padding: 12px 0;\n gap: 4px;\n}\n\n.stickyHeader-V5orv {\n position: sticky;\n top: -12px;\n z-index: 10;\n background: #fff;\n margin: -12px -12px 0 -12px;\n padding: 12px 12px 0 12px;\n}\n\n.stickyHeaderSticky-5qqWo {\n position: sticky;\n top: -12px;\n z-index: 10;\n background: #fff;\n margin: -12px -12px 0 -12px;\n padding: 12px 12px 0 12px;\n}\n\n.darkmode .stickyHeader-V5orv {\n background: #1a1a1a;\n}\n\n.featureContainer-cTJH8 {\n min-width: 0;\n max-width: 100%;\n}\n\n.featureLabel-q4sHn {\n font-size: 18px;\n font-weight: 600;\n margin-bottom: 10px;\n word-wrap: break-word;\n}\n\n.featureRequired-tby4F {\n color: red;\n}\n\n.featureDescription-k4v-p,\n.optionDescription-omLcU,\n.progressText-LXaM7 {\n color: #666;\n}\n\n.darkmode .featureDescription-k4v-p,\n.darkmode .optionDescription-omLcU,\n.darkmode .progressText-LXaM7 {\n color: #aaa;\n}\n\n.featureDescription-k4v-p {\n font-size: 14px;\n margin-bottom: 15px;\n word-wrap: break-word;\n}\n\n.configDescription--0UjU,\n.resultDescription-7jW2U {\n font-size: 15px;\n color: #666;\n margin: 12px 0 0 0;\n word-wrap: break-word;\n}\n\n.mobile .configDescription--0UjU,\n.mobile .resultDescription-7jW2U {\n font-size: 14px;\n margin: 8px 0 0 0;\n}\n\n.darkmode .configDescription--0UjU,\n.darkmode .resultDescription-7jW2U {\n color: #aaa;\n}\n\n.optionsContainer-oIEc3 {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.optionsBox-TBnRq {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));\n grid-gap: 10px;\n gap: 10px;\n min-width: 0;\n max-width: 100%;\n}\n\n.optionsGallery-72aVW {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));\n grid-gap: 15px;\n gap: 15px;\n min-width: 0;\n max-width: 100%;\n}\n\n/* Shared selectable option base (optionButton, radioOption, checkboxOption) */\n.optionButton-tRXEs,\n.radioOption-sv3m6,\n.checkboxOption-UY3nL {\n padding: 12px;\n border: 2px solid #ddd;\n border-radius: 8px;\n background: #fff;\n cursor: pointer;\n transition: all 0.2s;\n min-width: 0;\n}\n\n.optionButton-tRXEs {\n padding: 15px;\n text-align: left;\n}\n\n.radioOption-sv3m6,\n.checkboxOption-UY3nL {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n\n.darkmode .optionButton-tRXEs,\n.darkmode .radioOption-sv3m6,\n.darkmode .checkboxOption-UY3nL {\n border-color: #444;\n background: #2a2a2a;\n}\n\n.optionButton-tRXEs:hover,\n.radioOption-sv3m6:hover,\n.checkboxOption-UY3nL:hover {\n border-color: #999;\n background: #f9f9f9;\n}\n\n.darkmode .optionButton-tRXEs:hover,\n.darkmode .radioOption-sv3m6:hover,\n.darkmode .checkboxOption-UY3nL:hover {\n border-color: #666;\n background: #333;\n}\n\n.optionButtonSelected-pjY9O,\n.radioOptionSelected-vm6bN,\n.checkboxOptionSelected-DuZGL {\n border-color: var(--diva-theme-palette-primary-main);\n background: var(--diva-theme-palette-primary-light);\n}\n\n.darkmode .optionButtonSelected-pjY9O,\n.darkmode .radioOptionSelected-vm6bN,\n.darkmode .checkboxOptionSelected-DuZGL {\n border-color: var(--diva-theme-palette-primary-main);\n background: var(--diva-theme-palette-primary-dark);\n}\n\n.optionButtonSelected-pjY9O:hover,\n.radioOptionSelected-vm6bN:hover,\n.checkboxOptionSelected-DuZGL:hover {\n border-color: var(--diva-theme-palette-primary-dark);\n background: var(--diva-theme-palette-primary-light);\n}\n\n.darkmode .optionButtonSelected-pjY9O:hover,\n.darkmode .radioOptionSelected-vm6bN:hover,\n.darkmode .checkboxOptionSelected-DuZGL:hover {\n border-color: var(--diva-theme-palette-primary-main);\n background: var(--diva-theme-palette-primary-dark);\n}\n\n.optionLabel-oz4Zj {\n font-weight: 500;\n display: flex;\n align-items: center;\n justify-self: start;\n gap: 5px;\n flex-direction: column;\n width: 100%;\n min-width: 0;\n word-wrap: break-word;\n}\n\n.optionCaption-3d-V1 {\n font-size: 0.75rem;\n opacity: 0.6;\n font-weight: normal;\n text-align: center;\n}\n\n.optionContent-DS9Wc {\n min-width: 0;\n flex: 1;\n}\n\n.optionDescription-omLcU {\n font-size: 12px;\n min-width: 0;\n word-wrap: break-word;\n}\n\n.progressBar-RKPZp {\n display: flex;\n align-items: center;\n gap: 10px;\n margin-bottom: 20px;\n padding-bottom: 15px;\n border-bottom: 1px solid #ddd;\n}\n\n.darkmode .progressBar-RKPZp {\n border-bottom-color: #444;\n}\n\n.progressBarFill--Shc9 {\n flex: 1;\n height: 6px;\n background: #e0e0e0;\n border-radius: 3px;\n overflow: hidden;\n}\n\n.darkmode .progressBarFill--Shc9 {\n background: #444;\n}\n\n.progressBarInner-agBx- {\n height: 100%;\n background: var(--diva-theme-palette-primary-main);\n transition: width 0.3s ease;\n}\n\n.progressText-LXaM7 {\n font-size: 14px;\n white-space: nowrap;\n}\n\n.backButton-qRYLD {\n padding: 8px 12px;\n border: 1px solid #ddd;\n background: #fff;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n}\n\n.darkmode .backButton-qRYLD {\n border-color: #444;\n background: #2a2a2a;\n color: white;\n}\n\n.backButton-qRYLD:hover {\n background: #f5f5f5;\n}\n\n.darkmode .backButton-qRYLD:hover {\n background: #333;\n}\n\n.slider-ev57L {\n width: 100%;\n margin: 20px 0;\n}\n\n.sliderInput-xAXVM {\n width: 100%;\n height: 6px;\n border-radius: 3px;\n background: #e0e0e0;\n outline: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n\n.darkmode .sliderInput-xAXVM {\n background: #444;\n}\n\n.sliderInput-xAXVM::-webkit-slider-thumb,\n.sliderInput-xAXVM::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--diva-theme-palette-primary-main);\n cursor: pointer;\n border: none;\n}\n\n.sliderInput-xAXVM::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n}\n\n.sliderValue-vwwNn {\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n margin-top: 10px;\n}\n\n.dropdown-fst7q {\n width: 100%;\n padding: 12px;\n border: 2px solid #ddd;\n border-radius: 8px;\n font-size: 16px;\n background: #fff;\n cursor: pointer;\n}\n\n.darkmode .dropdown-fst7q {\n border-color: #444;\n background: #2a2a2a;\n color: white;\n}\n\n.radio-GesCu {\n display: flex;\n flex-direction: column;\n gap: 10px;\n min-width: 0;\n max-width: 100%;\n}\n\n.checkbox-xI7lT {\n display: flex;\n flex-direction: column;\n gap: 10px;\n min-width: 0;\n max-width: 100%;\n}\n\n.toggle-fi2uF {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n}\n\n.toggleButton-4myWl {\n flex: 1;\n min-width: 120px;\n padding: 15px;\n border: 2px solid #ddd;\n border-radius: 8px;\n background: #fff;\n cursor: pointer;\n transition: all 0.2s;\n text-align: center;\n font-weight: 500;\n}\n\n.darkmode .toggleButton-4myWl {\n border-color: #444;\n background: #2a2a2a;\n color: white;\n}\n\n.toggleButton-4myWl:hover {\n border-color: #999;\n background: #f9f9f9;\n}\n\n.darkmode .toggleButton-4myWl:hover {\n border-color: #666;\n background: #333;\n}\n\n.toggleButtonSelected-4SMtn {\n border-color: var(--diva-theme-palette-primary-main);\n background: var(--diva-theme-palette-primary-main);\n color: var(--diva-theme-palette-primary-contrast-text);\n}\n\n.toggleButtonSelected-4SMtn:hover {\n border-color: var(--diva-theme-palette-primary-dark);\n background: var(--diva-theme-palette-primary-dark);\n color: var(--diva-theme-palette-primary-contrast-text);\n}\n\n.resultContainer-sc6De {\n}\n\n.mobile .resultContainer-sc6De {\n padding: 4px;\n}\n\n.resultItem-84scA {\n display: flex;\n justify-content: space-between;\n padding: 15px;\n margin-bottom: 10px;\n background: #f5f5f5;\n border-radius: 8px;\n}\n\n.darkmode .resultItem-84scA {\n background: #2a2a2a;\n}\n\n.resultKey-qD5DS {\n font-weight: 600;\n}\n\n.resultValue-42tes {\n color: var(--diva-theme-palette-primary-main);\n font-weight: 500;\n}\n\n.buttonContainer-UZKoO {\n display: flex;\n gap: 10px;\n justify-content: flex-end;\n padding: 20px 0;\n border-top: 1px solid #ddd;\n}\n\n.navLeftGroup-JOQ3N {\n display: flex;\n gap: 10px;\n flex: 1;\n}\n\n.navRightGroup-mWCAz {\n display: flex;\n gap: 10px;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-end;\n flex-grow: 1;\n}\n\n.navButtonPadding-aX9-f {\n padding: 10px 20px;\n}\n\n.darkmode .buttonContainer-UZKoO {\n border-top-color: #444;\n}\n\n.button-CT3BR {\n padding: 10px 20px;\n border: 1px solid #ddd;\n border-radius: 4px;\n background: #fff;\n color: #000;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n transition: all 0.2s;\n}\n\n.darkmode .button-CT3BR {\n border-color: #444;\n background: #2a2a2a;\n color: white;\n}\n\n.button-CT3BR:hover:not(:disabled) {\n background: #f5f5f5;\n border-color: #999;\n}\n\n.darkmode .button-CT3BR:hover:not(:disabled) {\n background: #333;\n border-color: #666;\n}\n\n.button-CT3BR:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.buttonPrimary-b3Tur {\n background: var(--diva-theme-palette-primary-main);\n border-color: var(--diva-theme-palette-primary-main);\n color: var(--diva-theme-palette-primary-contrast-text);\n}\n\n.buttonPrimary-b3Tur:hover:not(:disabled) {\n background: var(--diva-theme-palette-primary-dark);\n border-color: var(--diva-theme-palette-primary-dark);\n}\n\n.buttonPrimaryApplied-90Q5- {\n background: var(--diva-theme-palette-primary-dark);\n border-color: var(--diva-theme-palette-primary-dark);\n}\n\n.buttonCancel-HA74N {\n background: transparent;\n border-color: #ddd;\n color: #666;\n}\n\n.darkmode .buttonCancel-HA74N {\n border-color: #444;\n color: #aaa;\n}\n\n.buttonCancel-HA74N:hover:not(:disabled) {\n background: #f5f5f5;\n border-color: #999;\n color: #333;\n}\n\n.darkmode .buttonCancel-HA74N:hover:not(:disabled) {\n background: #333;\n border-color: #666;\n color: white;\n}\n\n.headerContainer-fhFhh {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 40px;\n margin-bottom: 4px;\n position: relative;\n}\n\n.darkmode .headerContainer-fhFhh {\n border-bottom-color: #333;\n}\n\n/* Segmented control style tabs */\n.tabWrapper-ZqpAa {\n --tab-count: 2;\n display: flex;\n position: relative;\n flex-grow: 1;\n max-width: min(360px, 80%);\n min-width: 0;\n background: #f0f0f0;\n border-radius: 10px;\n padding: 3px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n}\n\n.darkmode .tabWrapper-ZqpAa {\n background: #333;\n}\n\n.tabSlider-d133A {\n position: absolute;\n top: 3px;\n left: 3px;\n width: calc((100% - 6px) / var(--tab-count));\n height: calc(100% - 6px);\n background: #fff;\n border-radius: 7px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: transform 0.25s ease;\n pointer-events: none;\n}\n\n.darkmode .tabSlider-d133A {\n background: #404040;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n.tab-Cf5O4 {\n flex: 1;\n min-width: 0;\n padding: 8px 16px;\n border: none;\n outline: none;\n background: transparent;\n cursor: pointer;\n font-size: 16px;\n font-weight: 500;\n color: #666;\n transition: color 0.25s ease;\n position: relative;\n z-index: 1;\n text-align: center;\n}\n\n.tab-Cf5O4:focus,\n.tab-Cf5O4.focus-visible-kxYL6,\n.tab-Cf5O4:hover,\n.tab-Cf5O4:active {\n outline: none;\n border: none;\n box-shadow: none;\n}\n\n.tab-Cf5O4:focus,\n.tab-Cf5O4:focus-visible,\n.tab-Cf5O4:hover,\n.tab-Cf5O4:active {\n outline: none;\n border: none;\n box-shadow: none;\n}\n\n.darkmode .tab-Cf5O4 {\n color: #999;\n}\n\n.tabActive-B4W84 {\n color: var(--diva-theme-palette-primary-main);\n}\n\n.tab-Cf5O4:hover:not(.tabActive-B4W84) {\n color: #333;\n}\n\n.darkmode .tab-Cf5O4:hover:not(.tabActive-B4W84) {\n color: #ccc;\n}\n\n.instanceNavContainer-0U7gZ {\n display: flex;\n flex-direction: column;\n gap: 12px;\n margin-top: 32px;\n padding: 0;\n background: transparent;\n border-radius: 0;\n border: none;\n}\n\n.darkmode .instanceNavContainer-0U7gZ {\n background: transparent;\n border-color: transparent;\n}\n\n.instanceNavButtons-HMFdy {\n display: flex;\n flex-direction: row;\n gap: 16px;\n flex-wrap: wrap;\n}\n\n.buttonSecondary-Fs2ci {\n background: #fff;\n border: 1px solid var(--diva-theme-palette-primary-main);\n color: var(--diva-theme-palette-primary-main);\n font-size: 14px;\n}\n\n.darkmode .buttonSecondary-Fs2ci {\n background: transparent;\n border-color: var(--diva-theme-palette-primary-main);\n color: var(--diva-theme-palette-primary-main);\n}\n\n.buttonSecondary-Fs2ci:hover:not(:disabled) {\n background: var(--diva-theme-palette-primary-light);\n color: var(--diva-theme-palette-primary-contrast-text);\n}\n\n.darkmode .buttonSecondary-Fs2ci:hover:not(:disabled) {\n background: color-mix(in srgb, var(--diva-theme-palette-primary-main) 10%, transparent);\n color: var(--diva-theme-palette-primary-contrast-text);\n}\n\n.buttonWithArrow-PQQFS {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 12px 24px;\n font-size: 16px;\n border-radius: 8px;\n height: auto;\n text-align: left;\n flex: 1;\n min-width: 250px;\n}\n\n.closeButton-Regwf {\n position: absolute;\n right: -8px;\n top: 50%;\n transform: translateY(-50%);\n background-color: rgba(255,255,255,0.8);\n border-radius: 50%;\n border: none;\n outline: none;\n cursor: pointer;\n padding: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #949daf;\n transition: color 0.2s;\n}\n\n.closeButton-Regwf:focus,\n.closeButton-Regwf.focus-visible-kxYL6,\n.closeButton-Regwf:hover,\n.closeButton-Regwf:active {\n outline: none;\n border: none;\n box-shadow: none;\n}\n\n.closeButton-Regwf:focus,\n.closeButton-Regwf:focus-visible,\n.closeButton-Regwf:hover,\n.closeButton-Regwf:active {\n outline: none;\n border: none;\n box-shadow: none;\n}\n\n.closeButton-Regwf:hover {\n color: #333;\n}\n\n.darkmode .closeButton-Regwf:hover {\n color: #fff;\n}\n\n/* Mobile Smaller Version */\n.mobile .container-nN2kI {\n padding: 12px;\n}\n\n.mobile .subContainer-x97eX {\n padding: 12px 0;\n}\n\n.mobile .featureLabel-q4sHn {\n font-size: 16px;\n margin-bottom: 8px;\n}\n\n.mobile .featureDescription-k4v-p {\n font-size: 13px;\n margin-bottom: 10px;\n}\n\n.mobile .optionButton-tRXEs {\n padding: 10px;\n}\n\n.mobile .optionLabel-oz4Zj {\n gap: 3px;\n}\n\n.mobile .optionDescription-omLcU {\n font-size: 11px;\n}\n\n.mobile .progressBar-RKPZp {\n gap: 8px;\n margin-bottom: 15px;\n padding-bottom: 10px;\n}\n\n.mobile .progressText-LXaM7 {\n font-size: 12px;\n}\n\n.mobile .backButton-qRYLD {\n padding: 6px 10px;\n font-size: 13px;\n}\n\n.mobile .sliderValue-vwwNn {\n font-size: 14px;\n}\n\n.mobile .dropdown-fst7q {\n padding: 10px;\n font-size: 14px;\n}\n\n.mobile .radioOption-sv3m6,\n.mobile .checkboxOption-UY3nL {\n padding: 10px;\n}\n\n.mobile .toggleButton-4myWl {\n padding: 10px;\n min-width: 90px;\n}\n\n.mobile .resultContainer-sc6De {\n padding: 0px;\n}\n\n.mobile .resultTitle-WVM2- {\n font-size: 20px;\n margin-bottom: 15px;\n}\n\n.mobile .resultItem-84scA {\n padding: 10px;\n}\n\n.mobile .buttonContainer-UZKoO {\n padding: 8px 0;\n margin-top: 6px;\n}\n\n.mobile .button-CT3BR {\n padding: 8px 16px;\n font-size: 13px;\n}\n\n.mobile .tab-Cf5O4 {\n padding: 6px 12px;\n font-size: 14px;\n}\n\n.mobile .instanceNavContainer-0U7gZ {\n padding: 10px;\n}\n\n.resultsGrid-s3UTE {\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n gap: 30px;\n}\n\n.speedometer-kKRJQ {\n width: 100%;\n max-width: 250px;\n margin: 0 auto;\n aspect-ratio: 240 / 170;\n}\n\n.speedometerGroup-SS-GT {\n width: 100%;\n}\n\n.speedometerGroupTitle-4s2YI {\n text-align: center;\n margin-bottom: 4px;\n margin-top: 4px;\n}\n\n.speedometerGroupGrid-SNMAM {\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n gap: 16px;\n}\n\n.speedometerGroupItem-a4T-A {\n text-align: center;\n flex: 1 1 40%;\n max-width: 45%;\n}\n\n.speedometerGroupItemTitle-N35gZ {\n margin-bottom: 4px;\n margin-top: 4px;\n}\n\n.speedometerValue-pbLcR {\n color: var(--diva-theme-palette-primary-main);\n stroke: var(--diva-theme-palette-primary-main);\n}\n\n.contentSection-dJgsX {\n padding-top: 8px;\n}\n\n.darkmode .contentSection-dJgsX {\n border-top-color: #333;\n}\n";
380
+ styleInject(css_248z);
381
+
382
+ var RangeLayout = function RangeLayout(_ref) {
383
+ var _range$unit, _range$unit2, _range$unit3;
384
+ var option = _ref.option,
385
+ selectedOptions = _ref.selectedOptions,
386
+ onSelect = _ref.onSelect,
387
+ getOptionCaption = _ref.getOptionCaption;
388
+ var _useTranslation = useTranslation(),
389
+ i18n = _useTranslation.i18n;
390
+ var language = i18n.language;
391
+ var range = option.range;
392
+ if (!range) return null;
393
+ var _useState = useState(selectedOptions[0] ? Number(selectedOptions[0]) : range.defaultValue || range.min),
394
+ _useState2 = _slicedToArray(_useState, 2),
395
+ value = _useState2[0],
396
+ setValue = _useState2[1];
397
+ var caption = getOptionCaption(option);
398
+ var handleChange = function handleChange(e) {
399
+ var newValue = Number(e.target.value);
400
+ setValue(newValue);
401
+ onSelect([String(newValue)]);
402
+ };
403
+ var unit = ((_range$unit = range.unit) === null || _range$unit === void 0 ? void 0 : _range$unit[language]) || ((_range$unit2 = range.unit) === null || _range$unit2 === void 0 ? void 0 : _range$unit2.en) || ((_range$unit3 = range.unit) === null || _range$unit3 === void 0 ? void 0 : _range$unit3.de) || '';
404
+ return /*#__PURE__*/jsxs("div", {
405
+ className: slider,
406
+ children: [/*#__PURE__*/jsx("input", {
407
+ type: "range",
408
+ min: range.min,
409
+ max: range.max,
410
+ step: range.step,
411
+ value: value,
412
+ onChange: handleChange,
413
+ className: sliderInput + ' diva-stop-swipe-detection'
414
+ }), /*#__PURE__*/jsxs("div", {
415
+ className: sliderValue,
416
+ children: [value, " ", unit, caption && /*#__PURE__*/jsx("span", {
417
+ className: optionCaption,
418
+ dangerouslySetInnerHTML: {
419
+ __html: " ".concat(caption)
420
+ }
421
+ })]
422
+ })]
423
+ });
424
+ };
425
+
426
+ var DropdownLayout = function DropdownLayout(_ref) {
427
+ var options = _ref.options,
428
+ selectedOptions = _ref.selectedOptions,
429
+ onSelect = _ref.onSelect,
430
+ getOptionLabel = _ref.getOptionLabel,
431
+ getOptionCaption = _ref.getOptionCaption,
432
+ layoutConfig = _ref.layoutConfig;
433
+ var _useTranslation = useTranslation(),
434
+ t = _useTranslation.t;
435
+ return /*#__PURE__*/jsxs("select", {
436
+ className: dropdown,
437
+ value: selectedOptions[0] || '',
438
+ onChange: function onChange(e) {
439
+ return onSelect(e.target.value);
440
+ },
441
+ style: {
442
+ fontSize: layoutConfig === null || layoutConfig === void 0 ? void 0 : layoutConfig.optionLabelFontSize
443
+ },
444
+ children: [/*#__PURE__*/jsx("option", {
445
+ value: "",
446
+ children: t('quickconfig.pleaseSelect', {
447
+ defaultValue: 'Bitte wählen'
448
+ })
449
+ }), options.map(function (option) {
450
+ var label = getOptionLabel(option);
451
+ var caption = getOptionCaption(option);
452
+ return /*#__PURE__*/jsxs("option", {
453
+ value: option.codex,
454
+ children: [label, caption ? " (".concat(caption, ")") : '']
455
+ }, option.codex);
456
+ })]
457
+ });
458
+ };
459
+
460
+ var SelectionListLayout = function SelectionListLayout(_ref) {
461
+ var options = _ref.options,
462
+ selectedOptions = _ref.selectedOptions,
463
+ onSelect = _ref.onSelect,
464
+ getOptionLabel = _ref.getOptionLabel,
465
+ getOptionDescription = _ref.getOptionDescription,
466
+ getOptionCaption = _ref.getOptionCaption,
467
+ type = _ref.type,
468
+ layoutConfig = _ref.layoutConfig;
469
+ var isRadio = type === 'radio';
470
+ var containerClass = isRadio ? radio : checkbox;
471
+ var itemClass = isRadio ? radioOption : checkboxOption;
472
+ var selectedItemClass = isRadio ? radioOptionSelected : checkboxOptionSelected;
473
+ return /*#__PURE__*/jsx("div", {
474
+ className: containerClass,
475
+ children: options.map(function (option) {
476
+ var isSelected = selectedOptions.includes(option.codex);
477
+ var label = getOptionLabel(option);
478
+ var description = getOptionDescription(option);
479
+ var caption = getOptionCaption(option);
480
+ return /*#__PURE__*/jsxs("div", {
481
+ className: isSelected ? "".concat(itemClass, " ").concat(selectedItemClass) : itemClass,
482
+ onClick: function onClick() {
483
+ return onSelect(option.codex);
484
+ },
485
+ children: [/*#__PURE__*/jsx("input", {
486
+ type: isRadio ? 'radio' : 'checkbox',
487
+ checked: isSelected,
488
+ onChange: function onChange() {
489
+ return onSelect(option.codex);
490
+ }
491
+ }), /*#__PURE__*/jsxs("div", {
492
+ className: optionContent,
493
+ children: [/*#__PURE__*/jsxs("div", {
494
+ className: optionLabel,
495
+ style: layoutConfig !== null && layoutConfig !== void 0 && layoutConfig.optionLabelFontSize ? {
496
+ fontSize: layoutConfig === null || layoutConfig === void 0 ? void 0 : layoutConfig.optionLabelFontSize
497
+ } : undefined,
498
+ children: [/*#__PURE__*/jsx("span", {
499
+ dangerouslySetInnerHTML: {
500
+ __html: label
501
+ }
502
+ }), caption && /*#__PURE__*/jsx("span", {
503
+ className: optionCaption,
504
+ dangerouslySetInnerHTML: {
505
+ __html: " ".concat(caption)
506
+ }
507
+ })]
508
+ }), description && /*#__PURE__*/jsx("div", {
509
+ className: optionDescription,
510
+ dangerouslySetInnerHTML: {
511
+ __html: description
512
+ }
513
+ })]
514
+ })]
515
+ }, option.codex);
516
+ })
517
+ });
518
+ };
519
+
520
+ var ButtonGroupLayout = function ButtonGroupLayout(_ref) {
521
+ var options = _ref.options,
522
+ selectedOptions = _ref.selectedOptions,
523
+ onSelect = _ref.onSelect,
524
+ getOptionLabel = _ref.getOptionLabel,
525
+ getOptionDescription = _ref.getOptionDescription,
526
+ getOptionCaption = _ref.getOptionCaption,
527
+ layout = _ref.layout,
528
+ layoutConfig = _ref.layoutConfig;
529
+ var isToggle = layout === 'toggle' || layout === 'multitoggle';
530
+ var containerClass = isToggle ? toggle : layout === 'gallery' ? optionsGallery : optionsBox;
531
+ var itemClass = isToggle ? toggleButton : optionButton;
532
+ var selectedItemClass = isToggle ? toggleButtonSelected : optionButtonSelected;
533
+ var style = {};
534
+ if (layoutConfig !== null && layoutConfig !== void 0 && layoutConfig.columns && !isToggle) {
535
+ style.gridTemplateColumns = "repeat(".concat(layoutConfig.columns, ", minmax(0, 1fr))");
536
+ }
537
+ if (layoutConfig !== null && layoutConfig !== void 0 && layoutConfig.gap && !isToggle) {
538
+ style.gap = typeof layoutConfig.gap === 'number' ? "".concat(layoutConfig.gap, "px") : layoutConfig.gap;
539
+ }
540
+ return /*#__PURE__*/jsx("div", {
541
+ className: containerClass,
542
+ style: style,
543
+ children: options.map(function (option) {
544
+ var isSelected = selectedOptions.includes(option.codex);
545
+ var label = getOptionLabel(option);
546
+ var description = getOptionDescription(option);
547
+ var caption = getOptionCaption(option);
548
+ if (isToggle) {
549
+ return /*#__PURE__*/jsx("button", {
550
+ className: isSelected ? "".concat(itemClass, " ").concat(selectedItemClass) : itemClass,
551
+ onClick: function onClick() {
552
+ return onSelect(option.codex);
553
+ },
554
+ children: /*#__PURE__*/jsxs("div", {
555
+ className: optionLabel,
556
+ style: layoutConfig !== null && layoutConfig !== void 0 && layoutConfig.optionLabelFontSize ? {
557
+ fontSize: layoutConfig === null || layoutConfig === void 0 ? void 0 : layoutConfig.optionLabelFontSize
558
+ } : undefined,
559
+ children: [/*#__PURE__*/jsx("span", {
560
+ dangerouslySetInnerHTML: {
561
+ __html: label
562
+ }
563
+ }), caption && /*#__PURE__*/jsx("span", {
564
+ className: optionCaption,
565
+ dangerouslySetInnerHTML: {
566
+ __html: " ".concat(caption)
567
+ }
568
+ })]
569
+ })
570
+ }, option.codex);
571
+ }
572
+ return /*#__PURE__*/jsxs("div", {
573
+ className: isSelected ? "".concat(itemClass, " ").concat(selectedItemClass) : itemClass,
574
+ onClick: function onClick() {
575
+ return onSelect(option.codex);
576
+ },
577
+ children: [/*#__PURE__*/jsxs("div", {
578
+ className: optionLabel,
579
+ style: layoutConfig !== null && layoutConfig !== void 0 && layoutConfig.optionLabelFontSize ? {
580
+ fontSize: layoutConfig === null || layoutConfig === void 0 ? void 0 : layoutConfig.optionLabelFontSize
581
+ } : undefined,
582
+ children: [/*#__PURE__*/jsx("span", {
583
+ dangerouslySetInnerHTML: {
584
+ __html: label
585
+ }
586
+ }), caption && /*#__PURE__*/jsx("span", {
587
+ className: optionCaption,
588
+ dangerouslySetInnerHTML: {
589
+ __html: " ".concat(caption)
590
+ }
591
+ })]
592
+ }), description && /*#__PURE__*/jsx("div", {
593
+ className: optionDescription,
594
+ dangerouslySetInnerHTML: {
595
+ __html: description
596
+ }
597
+ })]
598
+ }, option.codex);
599
+ })
600
+ });
601
+ };
602
+
603
+ var OptionRenderer = function OptionRenderer(_ref) {
604
+ var feature = _ref.feature,
605
+ selectedOptions = _ref.selectedOptions,
606
+ onSelect = _ref.onSelect,
607
+ selections = _ref.selections;
608
+ var _useOptionRenderer = useOptionRenderer({
609
+ feature: feature,
610
+ selectedOptions: selectedOptions,
611
+ onSelect: onSelect,
612
+ selections: selections
613
+ }),
614
+ selectOptions = _useOptionRenderer.selectOptions,
615
+ rangeOption = _useOptionRenderer.rangeOption,
616
+ handleSingleSelect = _useOptionRenderer.handleSingleSelect,
617
+ handleMultiSelect = _useOptionRenderer.handleMultiSelect,
618
+ getOptionLabel = _useOptionRenderer.getOptionLabel,
619
+ getOptionDescription = _useOptionRenderer.getOptionDescription,
620
+ getOptionCaption = _useOptionRenderer.getOptionCaption;
621
+
622
+ // Handle range type (slider)
623
+ if (rangeOption && rangeOption.range) {
624
+ return /*#__PURE__*/jsx(RangeLayout, {
625
+ option: rangeOption,
626
+ selectedOptions: selectedOptions,
627
+ onSelect: onSelect,
628
+ getOptionCaption: getOptionCaption
629
+ });
630
+ }
631
+ var handleSelect = feature.multiSelect ? handleMultiSelect : handleSingleSelect;
632
+ switch (feature.layout) {
633
+ case 'dropdown':
634
+ return /*#__PURE__*/jsx(DropdownLayout, {
635
+ options: selectOptions,
636
+ selectedOptions: selectedOptions,
637
+ onSelect: handleSingleSelect,
638
+ getOptionLabel: getOptionLabel,
639
+ getOptionCaption: getOptionCaption,
640
+ layoutConfig: feature.layoutConfig
641
+ });
642
+ case 'radio':
643
+ case 'checkbox':
644
+ return /*#__PURE__*/jsx(SelectionListLayout, {
645
+ options: selectOptions,
646
+ selectedOptions: selectedOptions,
647
+ onSelect: handleSelect,
648
+ getOptionLabel: getOptionLabel,
649
+ getOptionDescription: getOptionDescription,
650
+ getOptionCaption: getOptionCaption,
651
+ type: feature.layout,
652
+ layoutConfig: feature.layoutConfig
653
+ });
654
+ case 'toggle':
655
+ case 'multitoggle':
656
+ case 'box':
657
+ case 'gallery':
658
+ default:
659
+ return /*#__PURE__*/jsx(ButtonGroupLayout, {
660
+ options: selectOptions,
661
+ selectedOptions: selectedOptions,
662
+ onSelect: handleSelect,
663
+ getOptionLabel: getOptionLabel,
664
+ getOptionDescription: getOptionDescription,
665
+ getOptionCaption: getOptionCaption,
666
+ layout: feature.layout,
667
+ layoutConfig: feature.layoutConfig
668
+ });
669
+ }
670
+ };
671
+
672
+ var FeatureRenderer = function FeatureRenderer(_ref) {
673
+ var _feature$description, _feature$description2, _feature$description3;
674
+ var feature = _ref.feature,
675
+ selection = _ref.selection,
676
+ _onSelect = _ref.onSelect,
677
+ selections = _ref.selections;
678
+ var _useTranslation = useTranslation(),
679
+ i18n = _useTranslation.i18n;
680
+ var language = i18n.language;
681
+ var label = feature.label[language] || feature.label.en || feature.label.de || feature.codex;
682
+ var description = ((_feature$description = feature.description) === null || _feature$description === void 0 ? void 0 : _feature$description[language]) || ((_feature$description2 = feature.description) === null || _feature$description2 === void 0 ? void 0 : _feature$description2.en) || ((_feature$description3 = feature.description) === null || _feature$description3 === void 0 ? void 0 : _feature$description3.de);
683
+ return /*#__PURE__*/jsxs("div", {
684
+ className: featureContainer,
685
+ children: [/*#__PURE__*/jsxs("div", {
686
+ className: featureLabel,
687
+ children: [/*#__PURE__*/jsx("span", {
688
+ dangerouslySetInnerHTML: {
689
+ __html: label
690
+ }
691
+ }), feature.required && /*#__PURE__*/jsx("span", {
692
+ className: featureRequired,
693
+ children: " *"
694
+ })]
695
+ }), description && /*#__PURE__*/jsx("div", {
696
+ className: featureDescription,
697
+ dangerouslySetInnerHTML: {
698
+ __html: description
699
+ }
700
+ }), /*#__PURE__*/jsx(OptionRenderer, {
701
+ feature: feature,
702
+ selectedOptions: (selection === null || selection === void 0 ? void 0 : selection.selectedOptions) || [],
703
+ onSelect: function onSelect(selectedOptions) {
704
+ return _onSelect(feature.codex, selectedOptions);
705
+ },
706
+ selections: selections
707
+ })]
708
+ });
709
+ };
710
+
711
+ var Speedometer = function Speedometer(_ref) {
712
+ var value = _ref.value,
713
+ _ref$min = _ref.min,
714
+ min = _ref$min === void 0 ? 0 : _ref$min,
715
+ _ref$max = _ref.max,
716
+ max = _ref$max === void 0 ? 100 : _ref$max,
717
+ label = _ref.label,
718
+ _ref$zones = _ref.zones,
719
+ zones = _ref$zones === void 0 ? [] : _ref$zones;
720
+ var _useTranslation = useTranslation();
721
+ _useTranslation.t;
722
+ var radius = 80;
723
+ var strokeWidth = 12;
724
+ var centerX = 100;
725
+ var centerY = 110;
726
+ var normalizedValue = Math.min(Math.max(value, min), max);
727
+ var percentage = (normalizedValue - min) / (max - min);
728
+
729
+ // Speedometer arc: Centered at top (0deg), spanning 240 degrees
730
+ // From 240deg (bottom-left) to 480deg (bottom-right)
731
+ var startAngle = 240;
732
+ var endAngle = 480;
733
+ var totalAngle = endAngle - startAngle;
734
+ var currentAngle = startAngle + percentage * totalAngle;
735
+
736
+ // Animation state for the indicator
737
+ var _useState = useState(startAngle),
738
+ _useState2 = _slicedToArray(_useState, 2),
739
+ animatedAngle = _useState2[0],
740
+ setAnimatedAngle = _useState2[1];
741
+ useEffect(function () {
742
+ var timer = setTimeout(function () {
743
+ setAnimatedAngle(currentAngle);
744
+ }, 50);
745
+ return function () {
746
+ return clearTimeout(timer);
747
+ };
748
+ }, [currentAngle]);
749
+ var polarToCartesian = function polarToCartesian(cX, cY, r, angleInDegrees) {
750
+ var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;
751
+ return {
752
+ x: cX + r * Math.cos(angleInRadians),
753
+ y: cY + r * Math.sin(angleInRadians)
754
+ };
755
+ };
756
+ var describeArc = function describeArc(x, y, r, startA, endA) {
757
+ var start = polarToCartesian(x, y, r, endA);
758
+ var end = polarToCartesian(x, y, r, startA);
759
+ var largeArcFlag = endA - startA <= 180 ? '0' : '1';
760
+ return ['M', start.x, start.y, 'A', r, r, 0, largeArcFlag, 0, end.x, end.y].join(' ');
761
+ };
762
+ var backgroundPath = describeArc(centerX, centerY, radius, startAngle, endAngle);
763
+
764
+ // Find current zone color
765
+ var currentZone = zones.find(function (z) {
766
+ if (z.value && label && z.value === label) return true;
767
+ return normalizedValue >= z.min && normalizedValue <= z.max;
768
+ });
769
+ var activeColor = (currentZone === null || currentZone === void 0 ? void 0 : currentZone.color) || 'var(--diva-theme-palette-primary-main)';
770
+ return /*#__PURE__*/jsx("div", {
771
+ className: speedometer,
772
+ children: /*#__PURE__*/jsxs("svg", {
773
+ viewBox: "-20 0 240 170",
774
+ width: "100%",
775
+ height: "100%",
776
+ children: [zones.length > 0 ? zones.map(function (zone, i) {
777
+ var zoneStart = startAngle + (zone.min - min) / (max - min) * totalAngle;
778
+ var zoneEnd = startAngle + (zone.max - min) / (max - min) * totalAngle;
779
+ return /*#__PURE__*/jsx("path", {
780
+ d: describeArc(centerX, centerY, radius, zoneStart, zoneEnd),
781
+ fill: "none",
782
+ stroke: zone.color || '#e6e6e6',
783
+ strokeWidth: strokeWidth,
784
+ opacity: 0.3
785
+ }, i);
786
+ }) : /*#__PURE__*/jsx("path", {
787
+ d: backgroundPath,
788
+ fill: "none",
789
+ stroke: "#e6e6e6",
790
+ strokeWidth: strokeWidth,
791
+ strokeLinecap: "round"
792
+ }), /*#__PURE__*/jsx("g", {
793
+ style: {
794
+ transition: 'transform 2s cubic-bezier(0.4, 0, 0.2, 1)',
795
+ transform: "rotate(".concat(animatedAngle, "deg)"),
796
+ transformOrigin: "".concat(centerX, "px ").concat(centerY, "px")
797
+ },
798
+ children: /*#__PURE__*/jsx("path", {
799
+ d: describeArc(centerX, centerY, radius + 5, -2, 2),
800
+ fill: "none",
801
+ stroke: activeColor,
802
+ strokeWidth: strokeWidth + 10,
803
+ strokeLinecap: "round"
804
+ })
805
+ }), zones.map(function (zone, i) {
806
+ var zoneMidAngle = startAngle + ((zone.min - min) / (max - min) + (zone.max - min) / (max - min)) / 2 * totalAngle;
807
+
808
+ // Adjust offset based on string length to avoid collision with the arc/pointer
809
+ var textLength = zone.label.length;
810
+ var labelOffset = 22 + (textLength > 5 ? 6 : 0);
811
+ var labelPos = polarToCartesian(centerX, centerY, radius - labelOffset, zoneMidAngle);
812
+ return /*#__PURE__*/jsx("text", {
813
+ x: labelPos.x,
814
+ y: labelPos.y,
815
+ textAnchor: "middle",
816
+ fontSize: textLength > 7 ? '10' : '12',
817
+ fontWeight: "500",
818
+ fill: "#999",
819
+ dominantBaseline: "middle",
820
+ children: zone.label
821
+ }, i);
822
+ }), /*#__PURE__*/jsx("text", {
823
+ x: centerX,
824
+ y: centerY - 10,
825
+ textAnchor: "middle",
826
+ fontSize: "22",
827
+ fontWeight: "700",
828
+ fill: activeColor,
829
+ children: (currentZone === null || currentZone === void 0 ? void 0 : currentZone.label) || label || value
830
+ }), /*#__PURE__*/jsx("text", {
831
+ x: centerX,
832
+ y: centerY + 34,
833
+ textAnchor: "middle",
834
+ fontSize: "20",
835
+ fontWeight: "600",
836
+ fill: activeColor,
837
+ children: value
838
+ })]
839
+ })
840
+ });
841
+ };
842
+
843
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
844
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
845
+ var SpeedometerGroup = function SpeedometerGroup(_ref) {
846
+ var displayConfig = _ref.displayConfig,
847
+ data = _ref.data,
848
+ language = _ref.language;
849
+ var titleText = displayConfig.title ? displayConfig.title[language] || displayConfig.title.en || displayConfig.title.de : '';
850
+ var speedometerConfigs = displayConfig.speedometers;
851
+ return /*#__PURE__*/jsxs("div", {
852
+ className: speedometerGroup,
853
+ children: [titleText && /*#__PURE__*/jsx("h4", {
854
+ className: speedometerGroupTitle,
855
+ dangerouslySetInnerHTML: {
856
+ __html: titleText
857
+ }
858
+ }), /*#__PURE__*/jsx("div", {
859
+ className: speedometerGroupGrid,
860
+ children: speedometerConfigs.map(function (sConfig, idx) {
861
+ var _sConfig$zones;
862
+ var sValue = sConfig.valueKey ? data[sConfig.valueKey] : null;
863
+ var sLabel = sConfig.labelKey ? data[sConfig.labelKey] : null;
864
+ var sTitle = sConfig.title ? sConfig.title[language] || sConfig.title.en || sConfig.title.de : '';
865
+ return /*#__PURE__*/jsxs("div", {
866
+ className: speedometerGroupItem,
867
+ children: [sTitle && /*#__PURE__*/jsx("h5", {
868
+ className: speedometerGroupItemTitle,
869
+ dangerouslySetInnerHTML: {
870
+ __html: sTitle
871
+ }
872
+ }), /*#__PURE__*/jsx(Speedometer, {
873
+ value: _typeof(sValue) === 'object' ? sValue.value : sValue,
874
+ label: _typeof(sLabel) === 'object' ? sLabel.result : sLabel,
875
+ min: sConfig.min,
876
+ max: sConfig.max,
877
+ zones: (_sConfig$zones = sConfig.zones) === null || _sConfig$zones === void 0 ? void 0 : _sConfig$zones.map(function (z) {
878
+ return _objectSpread$3(_objectSpread$3({}, z), {}, {
879
+ label: z.label[language] || z.label.en || z.label.de
880
+ });
881
+ })
882
+ })]
883
+ }, idx);
884
+ })
885
+ })]
886
+ });
887
+ };
888
+
889
+ var TextResult = function TextResult(_ref) {
890
+ var displayConfig = _ref.displayConfig,
891
+ data = _ref.data,
892
+ language = _ref.language;
893
+ var label = displayConfig.labelKey ? data[displayConfig.labelKey] : null;
894
+ var titleText = displayConfig.title ? displayConfig.title[language] || displayConfig.title.en || displayConfig.title.de : '';
895
+ var resultValueText = _typeof(label) === 'object' ? label.result : String(label);
896
+ return /*#__PURE__*/jsxs("div", {
897
+ className: resultItem,
898
+ children: [/*#__PURE__*/jsx("span", {
899
+ className: resultKey,
900
+ dangerouslySetInnerHTML: {
901
+ __html: titleText
902
+ }
903
+ }), /*#__PURE__*/jsx("span", {
904
+ className: resultValue,
905
+ dangerouslySetInnerHTML: {
906
+ __html: resultValueText
907
+ }
908
+ })]
909
+ }, displayConfig.labelKey || 'text');
910
+ };
911
+
912
+ var ResultItemsRenderer = function ResultItemsRenderer(_ref) {
913
+ var data = _ref.data,
914
+ config = _ref.config,
915
+ language = _ref.language;
916
+ var renderGenericResult = function renderGenericResult(displayConfig, data, index) {
917
+ switch (displayConfig.type) {
918
+ case 'speedometer':
919
+ return /*#__PURE__*/jsx(SpeedometerGroup, {
920
+ displayConfig: displayConfig,
921
+ data: data,
922
+ language: language
923
+ }, "speedometer-".concat(index));
924
+ case 'text':
925
+ return /*#__PURE__*/jsx(TextResult, {
926
+ displayConfig: displayConfig,
927
+ data: data,
928
+ language: language
929
+ }, "text-".concat(index));
930
+ default:
931
+ return null;
932
+ }
933
+ };
934
+ if (config.results && config.results.length > 0) {
935
+ return /*#__PURE__*/jsx("div", {
936
+ className: resultsGrid,
937
+ children: config.results.map(function (displayConfig, index) {
938
+ return renderGenericResult(displayConfig, data, index);
939
+ })
940
+ });
941
+ }
942
+
943
+ // Fallback to legacy rendering if no results config provided
944
+ return /*#__PURE__*/jsx(Fragment, {
945
+ children: Object.entries(data).map(function (_ref2) {
946
+ var _ref3 = _slicedToArray(_ref2, 2),
947
+ key = _ref3[0],
948
+ value = _ref3[1];
949
+ if (_typeof(value) === 'object' && value !== null) {
950
+ if (value.result !== undefined) {
951
+ return /*#__PURE__*/jsxs("div", {
952
+ className: resultItem,
953
+ children: [/*#__PURE__*/jsx("span", {
954
+ className: resultKey,
955
+ dangerouslySetInnerHTML: {
956
+ __html: key
957
+ }
958
+ }), /*#__PURE__*/jsx("span", {
959
+ className: resultValue,
960
+ dangerouslySetInnerHTML: {
961
+ __html: value.result
962
+ }
963
+ })]
964
+ }, key);
965
+ }
966
+ return null;
967
+ }
968
+ return /*#__PURE__*/jsxs("div", {
969
+ className: resultItem,
970
+ children: [/*#__PURE__*/jsx("span", {
971
+ className: resultKey,
972
+ dangerouslySetInnerHTML: {
973
+ __html: key
974
+ }
975
+ }), /*#__PURE__*/jsx("span", {
976
+ className: resultValue,
977
+ dangerouslySetInnerHTML: {
978
+ __html: String(value)
979
+ }
980
+ })]
981
+ }, key);
982
+ })
983
+ });
984
+ };
985
+
986
+ var ArrowRight = function ArrowRight() {
987
+ return /*#__PURE__*/jsxs("svg", {
988
+ width: "20",
989
+ height: "20",
990
+ viewBox: "0 0 24 24",
991
+ fill: "none",
992
+ stroke: "currentColor",
993
+ strokeWidth: "2",
994
+ strokeLinecap: "round",
995
+ strokeLinejoin: "round",
996
+ children: [/*#__PURE__*/jsx("line", {
997
+ x1: "5",
998
+ y1: "12",
999
+ x2: "19",
1000
+ y2: "12"
1001
+ }), /*#__PURE__*/jsx("polyline", {
1002
+ points: "12 5 19 12 12 19"
1003
+ })]
1004
+ });
1005
+ };
1006
+ var CopyIcon = function CopyIcon() {
1007
+ return /*#__PURE__*/jsxs("svg", {
1008
+ width: "20",
1009
+ height: "20",
1010
+ viewBox: "0 0 24 24",
1011
+ fill: "none",
1012
+ stroke: "currentColor",
1013
+ strokeWidth: "2",
1014
+ strokeLinecap: "round",
1015
+ strokeLinejoin: "round",
1016
+ children: [/*#__PURE__*/jsx("rect", {
1017
+ x: "9",
1018
+ y: "9",
1019
+ width: "13",
1020
+ height: "13",
1021
+ rx: "2",
1022
+ ry: "2"
1023
+ }), /*#__PURE__*/jsx("path", {
1024
+ d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
1025
+ })]
1026
+ });
1027
+ };
1028
+ var CheckIcon = function CheckIcon() {
1029
+ return /*#__PURE__*/jsx("svg", {
1030
+ width: "20",
1031
+ height: "20",
1032
+ viewBox: "0 0 24 24",
1033
+ fill: "none",
1034
+ stroke: "currentColor",
1035
+ strokeWidth: "2",
1036
+ strokeLinecap: "round",
1037
+ strokeLinejoin: "round",
1038
+ children: /*#__PURE__*/jsx("polyline", {
1039
+ points: "20 6 9 17 4 12"
1040
+ })
1041
+ });
1042
+ };
1043
+ var CloseIcon = function CloseIcon() {
1044
+ return /*#__PURE__*/jsxs("svg", {
1045
+ width: "20",
1046
+ height: "20",
1047
+ viewBox: "0 0 24 24",
1048
+ fill: "none",
1049
+ stroke: "currentColor",
1050
+ strokeWidth: "2",
1051
+ strokeLinecap: "round",
1052
+ strokeLinejoin: "round",
1053
+ children: [/*#__PURE__*/jsx("line", {
1054
+ x1: "18",
1055
+ y1: "6",
1056
+ x2: "6",
1057
+ y2: "18"
1058
+ }), /*#__PURE__*/jsx("line", {
1059
+ x1: "6",
1060
+ y1: "6",
1061
+ x2: "18",
1062
+ y2: "18"
1063
+ })]
1064
+ });
1065
+ };
1066
+ var Navigation = function Navigation(_ref) {
1067
+ var onBack = _ref.onBack,
1068
+ onNext = _ref.onNext,
1069
+ onCopy = _ref.onCopy,
1070
+ onRetry = _ref.onRetry,
1071
+ onApply = _ref.onApply,
1072
+ onClose = _ref.onClose,
1073
+ _ref$canProceed = _ref.canProceed,
1074
+ canProceed = _ref$canProceed === void 0 ? true : _ref$canProceed,
1075
+ _ref$showBack = _ref.showBack,
1076
+ showBack = _ref$showBack === void 0 ? false : _ref$showBack,
1077
+ _ref$nextLabel = _ref.nextLabel,
1078
+ nextLabel = _ref$nextLabel === void 0 ? '' : _ref$nextLabel,
1079
+ nextInstance = _ref.nextInstance,
1080
+ currentInstanceId = _ref.currentInstanceId,
1081
+ _ref$language = _ref.language,
1082
+ language = _ref$language === void 0 ? 'de' : _ref$language;
1083
+ var _useTranslation = useTranslation(),
1084
+ t = _useTranslation.t;
1085
+ var _useState = useState(false),
1086
+ _useState2 = _slicedToArray(_useState, 2),
1087
+ appliedFeedback = _useState2[0],
1088
+ setAppliedFeedback = _useState2[1];
1089
+ var _useState3 = useState(false),
1090
+ _useState4 = _slicedToArray(_useState3, 2),
1091
+ showCloseButton = _useState4[0],
1092
+ setShowCloseButton = _useState4[1];
1093
+ var nextInstanceLabel = nextInstance ? nextInstance.label[language] || nextInstance.label.en || nextInstance.label.de || nextInstance.id : '';
1094
+ var handleApply = function handleApply() {
1095
+ onApply === null || onApply === void 0 || onApply();
1096
+ setAppliedFeedback(true);
1097
+ if (onClose) {
1098
+ setTimeout(function () {
1099
+ return setShowCloseButton(true);
1100
+ }, 1500);
1101
+ } else {
1102
+ setTimeout(function () {
1103
+ setAppliedFeedback(false);
1104
+ }, 2000);
1105
+ }
1106
+ };
1107
+ return /*#__PURE__*/jsxs("div", {
1108
+ className: buttonContainer,
1109
+ children: [showBack && /*#__PURE__*/jsx("div", {
1110
+ className: navLeftGroup,
1111
+ children: /*#__PURE__*/jsx("button", {
1112
+ className: button,
1113
+ onClick: onBack,
1114
+ "aria-label": t('quickconfig.back', {
1115
+ defaultValue: 'Zurück'
1116
+ }),
1117
+ children: t('quickconfig.back', {
1118
+ defaultValue: 'Zurück'
1119
+ })
1120
+ }, "back")
1121
+ }), /*#__PURE__*/jsxs("div", {
1122
+ className: navRightGroup,
1123
+ children: [onApply && !showCloseButton && /*#__PURE__*/jsxs("button", {
1124
+ className: classNames(button, buttonPrimary, buttonWithArrow, navButtonPadding, appliedFeedback && buttonPrimaryApplied),
1125
+ onClick: handleApply,
1126
+ disabled: appliedFeedback,
1127
+ children: [appliedFeedback ? t('quickconfig.changesApplied', {
1128
+ defaultValue: 'Änderungen wurden übernommen'
1129
+ }) : t('quickconfig.applyChanges', {
1130
+ defaultValue: 'Änderungen übernehmen'
1131
+ }), appliedFeedback ? /*#__PURE__*/jsx(CheckIcon, {}) : /*#__PURE__*/jsx(CopyIcon, {})]
1132
+ }, "apply"), onClose && showCloseButton && /*#__PURE__*/jsxs("button", {
1133
+ className: classNames(button, buttonPrimary, buttonWithArrow, navButtonPadding),
1134
+ onClick: onClose,
1135
+ children: [t('quickconfig.closeNow', {
1136
+ defaultValue: 'Jetzt schließen'
1137
+ }), /*#__PURE__*/jsx(CloseIcon, {})]
1138
+ }, "close"), onRetry && /*#__PURE__*/jsx("button", {
1139
+ className: classNames(button, buttonSecondary, buttonWithArrow, navButtonPadding),
1140
+ onClick: onRetry,
1141
+ children: t('quickconfig.retry', {
1142
+ defaultValue: 'Nochmal zum Anfang'
1143
+ })
1144
+ }, "retry"), nextInstance && onCopy && currentInstanceId && /*#__PURE__*/jsxs("button", {
1145
+ className: classNames(button, buttonSecondary, buttonWithArrow),
1146
+ onClick: function onClick() {
1147
+ onCopy(currentInstanceId, nextInstance.id);
1148
+ },
1149
+ disabled: !canProceed,
1150
+ children: [t('quickconfig.applyRecommendationsFor', {
1151
+ instance: nextInstanceLabel,
1152
+ defaultValue: "Eingabe f\xFCr ".concat(nextInstanceLabel, " \xFCbernehmen")
1153
+ }), /*#__PURE__*/jsx(ArrowRight, {})]
1154
+ }, "applyRecommendations"), onNext && /*#__PURE__*/jsxs("button", {
1155
+ className: classNames(button, buttonPrimary, buttonWithArrow),
1156
+ onClick: onNext,
1157
+ disabled: !canProceed,
1158
+ children: [nextInstance ? t('quickconfig.nextWith', {
1159
+ instance: nextInstanceLabel,
1160
+ defaultValue: "Weiter mit ".concat(nextInstanceLabel)
1161
+ }) : nextLabel, /*#__PURE__*/jsx(ArrowRight, {})]
1162
+ }, "next")]
1163
+ })]
1164
+ });
1165
+ };
1166
+
1167
+ var ContentItem = function ContentItem(_ref) {
1168
+ var id = _ref.id,
1169
+ renderContentItem = _ref.renderContentItem;
1170
+ return /*#__PURE__*/jsx("div", {
1171
+ className: contentSection,
1172
+ children: renderContentItem ? renderContentItem(id) : null
1173
+ });
1174
+ };
1175
+
1176
+ function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1177
+ function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
1178
+ function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1179
+ var resolveContentItemId = function resolveContentItemId(displayConfig, data) {
1180
+ // Convert calculation results to UserSelection format for ConditionEvaluator
1181
+ var resultAsSelections = Object.entries(data).filter(function (_ref) {
1182
+ var _ref2 = _slicedToArray(_ref, 1),
1183
+ key = _ref2[0];
1184
+ return key !== 'input' && key !== 'instanceResults';
1185
+ }).map(function (_ref3) {
1186
+ var _ref4 = _slicedToArray(_ref3, 2),
1187
+ key = _ref4[0],
1188
+ val = _ref4[1];
1189
+ var value = _typeof(val) === 'object' && val !== null && 'result' in val ? String(val.result) : String(val);
1190
+ return {
1191
+ featureCodex: key,
1192
+ selectedOptions: [value]
1193
+ };
1194
+ });
1195
+ var evaluator = new ConditionEvaluator(resultAsSelections);
1196
+
1197
+ // 1. Check rules first (complex logic)
1198
+ if (displayConfig.rules) {
1199
+ var _iterator = _createForOfIteratorHelper$1(displayConfig.rules),
1200
+ _step;
1201
+ try {
1202
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1203
+ var rule = _step.value;
1204
+ if (evaluator.evaluate(rule.condition)) {
1205
+ return rule.contentItemId;
1206
+ }
1207
+ }
1208
+ } catch (err) {
1209
+ _iterator.e(err);
1210
+ } finally {
1211
+ _iterator.f();
1212
+ }
1213
+ }
1214
+
1215
+ // 2. Fallback to direct key match or static contentItemId
1216
+ return (displayConfig.contentItemId && data[displayConfig.contentItemId] ? data[displayConfig.contentItemId] : null) || displayConfig.contentItemId || null;
1217
+ };
1218
+
1219
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1220
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1221
+ var ResultDisplay = function ResultDisplay(_ref) {
1222
+ var activeInstanceId = _ref.activeInstanceId,
1223
+ result = _ref.result,
1224
+ config = _ref.config,
1225
+ onRetry = _ref.onRetry,
1226
+ filteredInstances = _ref.filteredInstances,
1227
+ onEvent = _ref.onEvent,
1228
+ renderContentItem = _ref.renderContentItem;
1229
+ var _useTranslation = useTranslation(),
1230
+ i18n = _useTranslation.i18n;
1231
+ var language = i18n.language;
1232
+ var activeInstanceData = useMemo(function () {
1233
+ if (activeInstanceId && result.instanceResults && result.instanceResults[activeInstanceId]) return result.instanceResults[activeInstanceId];
1234
+ return result;
1235
+ }, [activeInstanceId, result]);
1236
+ var handleApplyResults = function handleApplyResults() {
1237
+ var combinedMappedResults = {};
1238
+ if (result.instanceResults && filteredInstances && filteredInstances.length > 0) {
1239
+ filteredInstances.forEach(function (instance) {
1240
+ var instanceRes = result.instanceResults[instance.id];
1241
+ if (instanceRes && instance.resultMapping) {
1242
+ Object.entries(instance.resultMapping).forEach(function (_ref2) {
1243
+ var _ref3 = _slicedToArray(_ref2, 2),
1244
+ resultKey = _ref3[0],
1245
+ targetKey = _ref3[1];
1246
+ var val = instanceRes[resultKey];
1247
+ if (val && val.result) {
1248
+ if (Array.isArray(targetKey)) {
1249
+ targetKey.forEach(function (key) {
1250
+ combinedMappedResults[key] = val.result;
1251
+ });
1252
+ } else {
1253
+ combinedMappedResults[targetKey] = val.result;
1254
+ }
1255
+ }
1256
+ });
1257
+ }
1258
+ });
1259
+ } else {
1260
+ var targetInstance = filteredInstances && filteredInstances.length === 1 ? filteredInstances[0] : null;
1261
+ var resSource = result.result || {};
1262
+ if (targetInstance !== null && targetInstance !== void 0 && targetInstance.resultMapping) {
1263
+ Object.entries(targetInstance.resultMapping).forEach(function (_ref4) {
1264
+ var _ref5 = _slicedToArray(_ref4, 2),
1265
+ resultKey = _ref5[0],
1266
+ targetKey = _ref5[1];
1267
+ var val = resSource[resultKey];
1268
+ if (val && val.result) {
1269
+ if (Array.isArray(targetKey)) {
1270
+ targetKey.forEach(function (key) {
1271
+ combinedMappedResults[key] = val.result;
1272
+ });
1273
+ } else {
1274
+ combinedMappedResults[targetKey] = val.result;
1275
+ }
1276
+ }
1277
+ });
1278
+ }
1279
+ }
1280
+ onEvent === null || onEvent === void 0 || onEvent({
1281
+ type: 'applyResults',
1282
+ payload: combinedMappedResults
1283
+ });
1284
+ };
1285
+ var handleClose = onEvent ? function () {
1286
+ return onEvent({
1287
+ type: 'onClose'
1288
+ });
1289
+ } : undefined;
1290
+ var renderResultsInOrder = function renderResultsInOrder() {
1291
+ if (!config.results || config.results.length === 0) {
1292
+ return /*#__PURE__*/jsx(ResultItemsRenderer, {
1293
+ data: activeInstanceData,
1294
+ config: config,
1295
+ language: language
1296
+ });
1297
+ }
1298
+ var elements = [];
1299
+ var currentNonContentGroup = [];
1300
+ var flushNonContentGroup = function flushNonContentGroup() {
1301
+ if (currentNonContentGroup.length === 0) return;
1302
+ var groupResults = _toConsumableArray(currentNonContentGroup);
1303
+ var key = "group-".concat(elements.length);
1304
+ elements.push(/*#__PURE__*/jsx(ResultItemsRenderer, {
1305
+ data: activeInstanceData,
1306
+ config: _objectSpread$2(_objectSpread$2({}, config), {}, {
1307
+ results: groupResults
1308
+ }),
1309
+ language: language
1310
+ }, key));
1311
+ currentNonContentGroup = [];
1312
+ };
1313
+ config.results.forEach(function (displayConfig, index) {
1314
+ if (displayConfig.type === 'content') {
1315
+ flushNonContentGroup();
1316
+ var contentItemId = resolveContentItemId(displayConfig, activeInstanceData);
1317
+ if (contentItemId) {
1318
+ elements.push(/*#__PURE__*/jsx(ContentItem, {
1319
+ id: contentItemId,
1320
+ renderContentItem: renderContentItem
1321
+ }, "content-".concat(index)));
1322
+ }
1323
+ } else {
1324
+ currentNonContentGroup.push(displayConfig);
1325
+ }
1326
+ });
1327
+ flushNonContentGroup();
1328
+ return elements;
1329
+ };
1330
+ return /*#__PURE__*/jsxs("div", {
1331
+ className: resultContainer,
1332
+ children: [renderResultsInOrder(), /*#__PURE__*/jsx(Navigation, {
1333
+ onRetry: onRetry,
1334
+ onApply: onEvent ? handleApplyResults : undefined,
1335
+ onClose: handleClose
1336
+ })]
1337
+ });
1338
+ };
1339
+
1340
+ var ProgressBar = function ProgressBar(_ref) {
1341
+ var currentStep = _ref.currentStep,
1342
+ totalSteps = _ref.totalSteps;
1343
+ var progress = currentStep / totalSteps * 100;
1344
+ return /*#__PURE__*/jsxs("div", {
1345
+ className: progressBar,
1346
+ children: [/*#__PURE__*/jsx("div", {
1347
+ className: progressBarFill,
1348
+ children: /*#__PURE__*/jsx("div", {
1349
+ className: progressBarInner,
1350
+ style: {
1351
+ width: "".concat(progress, "%")
1352
+ }
1353
+ })
1354
+ }), /*#__PURE__*/jsxs("div", {
1355
+ className: progressText,
1356
+ children: [currentStep, " / ", totalSteps]
1357
+ })]
1358
+ });
1359
+ };
1360
+
1361
+ var Header = function Header(_ref) {
1362
+ var _ref$instances = _ref.instances,
1363
+ instances = _ref$instances === void 0 ? [] : _ref$instances,
1364
+ _ref$activeInstanceId = _ref.activeInstanceId,
1365
+ activeInstanceId = _ref$activeInstanceId === void 0 ? '' : _ref$activeInstanceId,
1366
+ onSwitchInstance = _ref.onSwitchInstance,
1367
+ onCancel = _ref.onCancel,
1368
+ _ref$featureGroups = _ref.featureGroups,
1369
+ featureGroups = _ref$featureGroups === void 0 ? [] : _ref$featureGroups,
1370
+ currentFeatureGroupIndex = _ref.currentFeatureGroupIndex;
1371
+ var _useTranslation = useTranslation(),
1372
+ t = _useTranslation.t,
1373
+ i18n = _useTranslation.i18n;
1374
+ var language = i18n.language;
1375
+ var activeIndex = instances.findIndex(function (i) {
1376
+ return i.id === activeInstanceId;
1377
+ });
1378
+ return /*#__PURE__*/jsxs("div", {
1379
+ className: stickyHeader,
1380
+ children: [/*#__PURE__*/jsxs("div", {
1381
+ className: headerContainer,
1382
+ children: [/*#__PURE__*/jsxs("div", {
1383
+ className: tabWrapper,
1384
+ style: {
1385
+ '--tab-count': instances.length
1386
+ },
1387
+ children: [/*#__PURE__*/jsx("div", {
1388
+ className: tabSlider,
1389
+ style: {
1390
+ transform: "translateX(".concat(activeIndex >= 0 ? activeIndex * 100 : 0, "%)")
1391
+ },
1392
+ "aria-hidden": true
1393
+ }), instances.map(function (instance) {
1394
+ return /*#__PURE__*/jsx("button", {
1395
+ type: "button",
1396
+ className: classNames(tab, _defineProperty({}, tabActive, activeInstanceId === instance.id)),
1397
+ onClick: function onClick() {
1398
+ return onSwitchInstance === null || onSwitchInstance === void 0 ? void 0 : onSwitchInstance(instance.id);
1399
+ },
1400
+ dangerouslySetInnerHTML: {
1401
+ __html: instance.label[language] || instance.label.en || instance.label.de || instance.id
1402
+ }
1403
+ }, instance.id);
1404
+ })]
1405
+ }), onCancel && /*#__PURE__*/jsx("button", {
1406
+ className: closeButton,
1407
+ onClick: onCancel,
1408
+ "aria-label": t('quickconfig.close', {
1409
+ defaultValue: 'Schließen'
1410
+ }),
1411
+ children: /*#__PURE__*/jsxs("svg", {
1412
+ width: "24",
1413
+ height: "24",
1414
+ viewBox: "0 0 24 24",
1415
+ fill: "none",
1416
+ stroke: "currentColor",
1417
+ strokeWidth: "2",
1418
+ strokeLinecap: "round",
1419
+ strokeLinejoin: "round",
1420
+ children: [/*#__PURE__*/jsx("line", {
1421
+ x1: "18",
1422
+ y1: "6",
1423
+ x2: "6",
1424
+ y2: "18"
1425
+ }), /*#__PURE__*/jsx("line", {
1426
+ x1: "6",
1427
+ y1: "6",
1428
+ x2: "18",
1429
+ y2: "18"
1430
+ })]
1431
+ })
1432
+ })]
1433
+ }), featureGroups.length > 1 && currentFeatureGroupIndex !== undefined && /*#__PURE__*/jsx(ProgressBar, {
1434
+ currentStep: currentFeatureGroupIndex + 1,
1435
+ totalSteps: featureGroups.length
1436
+ })]
1437
+ });
1438
+ };
1439
+
1440
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1441
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
1442
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1443
+ function calculateVariantValue(selections, config) {
1444
+ if (!config) {
1445
+ return {};
1446
+ }
1447
+
1448
+ // 1. Prepare variables for rule evaluation
1449
+ var variables = {};
1450
+
1451
+ // Extract values from selections based on config.features
1452
+ var _loop = function _loop() {
1453
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
1454
+ featureKey = _Object$entries$_i[0],
1455
+ featureConfig = _Object$entries$_i[1];
1456
+ var selection = selections.find(function (s) {
1457
+ return s.featureCodex === featureConfig.featureCodex;
1458
+ });
1459
+ if (selection && selection.selectedOptions.length > 0) {
1460
+ // Use the first selected option
1461
+ var selectedOptionCodex = selection.selectedOptions[0];
1462
+ var optionConfig = featureConfig.options[selectedOptionCodex];
1463
+ if (optionConfig) {
1464
+ variables[featureKey] = parseFloat(optionConfig.value) || 0;
1465
+ } else {
1466
+ // Handle range strings like "150-160" -> 160
1467
+ if (selectedOptionCodex.includes('-')) {
1468
+ var parts = selectedOptionCodex.split('-');
1469
+ var lastPart = parts[parts.length - 1];
1470
+ variables[featureKey] = parseFloat(lastPart) || 0;
1471
+ } else {
1472
+ variables[featureKey] = parseFloat(selectedOptionCodex) || 0;
1473
+ }
1474
+ }
1475
+ } else {
1476
+ variables[featureKey] = 0;
1477
+ }
1478
+ };
1479
+ for (var _i = 0, _Object$entries = Object.entries(config.features); _i < _Object$entries.length; _i++) {
1480
+ _loop();
1481
+ }
1482
+
1483
+ // 2. Evaluate results
1484
+ var calculatedResults = {};
1485
+ for (var _i2 = 0, _Object$entries2 = Object.entries(config.results); _i2 < _Object$entries2.length; _i2++) {
1486
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
1487
+ resultKey = _Object$entries2$_i[0],
1488
+ resultConfig = _Object$entries2$_i[1];
1489
+ var numericValue = evaluateRule(resultConfig.rule, variables);
1490
+ calculatedResults[resultKey] = getResultValue(resultKey, numericValue, resultConfig.valueResultPairs);
1491
+ }
1492
+ return calculatedResults;
1493
+ }
1494
+
1495
+ /**
1496
+ * Helper to evaluate a mathematical rule with given variables
1497
+ */
1498
+ function evaluateRule(rule, variables) {
1499
+ var expression = rule;
1500
+
1501
+ // Sort keys by length descending to avoid partial replacements
1502
+ var sortedKeys = Object.keys(variables).sort(function (a, b) {
1503
+ return b.length - a.length;
1504
+ });
1505
+ var _iterator = _createForOfIteratorHelper(sortedKeys),
1506
+ _step;
1507
+ try {
1508
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1509
+ var key = _step.value;
1510
+ var value = variables[key];
1511
+ var regex = new RegExp("\\b".concat(key, "\\b"), 'g');
1512
+ expression = expression.replace(regex, value.toString());
1513
+ }
1514
+
1515
+ // Safety check: only allow numbers, operators, parentheses and spaces
1516
+ } catch (err) {
1517
+ _iterator.e(err);
1518
+ } finally {
1519
+ _iterator.f();
1520
+ }
1521
+ var sanitizedExpression = expression.replace(/[0-9.+\-*/() ]/g, '');
1522
+ if (sanitizedExpression.length > 0) {
1523
+ return 0;
1524
+ }
1525
+ try {
1526
+ // eslint-disable-next-line no-new-func
1527
+ return new Function("return ".concat(expression))();
1528
+ } catch (e) {
1529
+ return 0;
1530
+ }
1531
+ }
1532
+
1533
+ /**
1534
+ * Helper to map a numeric value to a result string based on ranges
1535
+ */
1536
+ function getResultValue(resultKey, value, pairs) {
1537
+ console.log('resultKey', resultKey, value, pairs);
1538
+ var _iterator2 = _createForOfIteratorHelper(pairs),
1539
+ _step2;
1540
+ try {
1541
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1542
+ var _step2$value = _slicedToArray(_step2.value, 2),
1543
+ range = _step2$value[0],
1544
+ result = _step2$value[1];
1545
+ var parts = range.split('-');
1546
+ var min = parseFloat(parts[0]);
1547
+ var max = parseFloat(parts[1]);
1548
+ if (!isNaN(min) && !isNaN(max)) {
1549
+ if (value >= min && value <= max) {
1550
+ return {
1551
+ result: result,
1552
+ value: value
1553
+ };
1554
+ }
1555
+ } else if (!isNaN(min)) {
1556
+ if (value === min) return {
1557
+ result: result,
1558
+ value: value
1559
+ };
1560
+ }
1561
+ }
1562
+
1563
+ // Fallback: use first result if none match
1564
+ } catch (err) {
1565
+ _iterator2.e(err);
1566
+ } finally {
1567
+ _iterator2.f();
1568
+ }
1569
+ return pairs.length > 0 ? {
1570
+ result: pairs[0][1],
1571
+ value: value
1572
+ } : {
1573
+ result: '',
1574
+ value: value
1575
+ };
1576
+ }
1577
+
1578
+ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1579
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1580
+ var useQuickConfigCalculations = function useQuickConfigCalculations(config) {
1581
+ var calculateInstanceResult = useCallback(function (currentSelections) {
1582
+ if (!config.calculator) {
1583
+ return {};
1584
+ }
1585
+ if (config.calculator.variantValueConfig) {
1586
+ return calculateVariantValue(currentSelections, config.calculator.variantValueConfig);
1587
+ }
1588
+ return {};
1589
+ }, [config.calculator]);
1590
+ var calculateFullResult = useCallback(function (allInstanceSelections) {
1591
+ if (!config.instances || config.instances.length === 0) {
1592
+ var defaultSelections = allInstanceSelections['default'] || [];
1593
+ var res = calculateInstanceResult(defaultSelections);
1594
+ return _objectSpread$1(_objectSpread$1({}, res), {}, {
1595
+ input: {
1596
+ selections: defaultSelections
1597
+ }
1598
+ });
1599
+ }
1600
+ var instanceResults = {};
1601
+ config.instances.forEach(function (instance) {
1602
+ instanceResults[instance.id] = calculateInstanceResult(allInstanceSelections[instance.id] || []);
1603
+ });
1604
+ return {
1605
+ instanceResults: instanceResults,
1606
+ input: {
1607
+ selections: allInstanceSelections[config.instances[0].id] || [],
1608
+ // Backward compatibility
1609
+ instanceSelections: allInstanceSelections
1610
+ }
1611
+ };
1612
+ }, [config.instances, calculateInstanceResult]);
1613
+ return {
1614
+ calculateFullResult: calculateFullResult
1615
+ };
1616
+ };
1617
+
1618
+ var useQuickConfigFeatures = function useQuickConfigFeatures(config, selections, currentFeatureGroupIndex, result) {
1619
+ // Group features by group field
1620
+ var featureGroups = useMemo(function () {
1621
+ var groups = [];
1622
+ var groupMap = new Map();
1623
+ config.features.forEach(function (feature) {
1624
+ var groupKey = feature.group;
1625
+ if (!groupMap.has(groupKey)) {
1626
+ groupMap.set(groupKey, []);
1627
+ }
1628
+ groupMap.get(groupKey).push(feature);
1629
+ });
1630
+
1631
+ // Flatten groups in order they appear
1632
+ var seenGroups = new Set();
1633
+ config.features.forEach(function (feature) {
1634
+ var groupKey = feature.group;
1635
+ if (!seenGroups.has(groupKey)) {
1636
+ seenGroups.add(groupKey);
1637
+ groups.push(groupMap.get(groupKey));
1638
+ }
1639
+ });
1640
+ return groups;
1641
+ }, [config.features]);
1642
+
1643
+ // Get visible features in current group
1644
+ var currentFeatures = useMemo(function () {
1645
+ if (result) return [];
1646
+ var group = featureGroups[currentFeatureGroupIndex] || [];
1647
+ return group.filter(function (feature) {
1648
+ return ConditionEvaluator.shouldShowFeature(feature, selections);
1649
+ });
1650
+ }, [featureGroups, currentFeatureGroupIndex, selections, result]);
1651
+ return {
1652
+ featureGroups: featureGroups,
1653
+ currentFeatures: currentFeatures
1654
+ };
1655
+ };
1656
+
1657
+ var STORAGE_PREFIX = 'quickconfig.';
1658
+ var TTL_MS = 24 * 60 * 60 * 1000; // 1 day
1659
+
1660
+ function loadFromStorage(storageKey) {
1661
+ try {
1662
+ var raw = localStorage.getItem(storageKey);
1663
+ if (!raw) return null;
1664
+ var parsed = JSON.parse(raw);
1665
+ if (_typeof(parsed) !== 'object' || parsed === null) return null;
1666
+
1667
+ // Legacy format: plain selections object (no TTL)
1668
+ if (!('storedAt' in parsed) || !('selections' in parsed)) {
1669
+ var legacy = parsed;
1670
+ return _typeof(legacy) === 'object' && legacy !== null && !Array.isArray(legacy) ? legacy : null;
1671
+ }
1672
+ var _ref = parsed,
1673
+ selections = _ref.selections,
1674
+ storedAt = _ref.storedAt;
1675
+ if (typeof storedAt !== 'number' || !selections || _typeof(selections) !== 'object' || Array.isArray(selections)) return null;
1676
+ if (Date.now() - storedAt > TTL_MS) {
1677
+ localStorage.removeItem(storageKey);
1678
+ return null;
1679
+ }
1680
+ return selections;
1681
+ } catch (_unused) {
1682
+ return null;
1683
+ }
1684
+ }
1685
+ function useQuickConfigStorage(configId) {
1686
+ var storageKey = useMemo(function () {
1687
+ return configId ? "".concat(STORAGE_PREFIX).concat(configId) : '';
1688
+ }, [configId]);
1689
+ var storedSelections = useMemo(function () {
1690
+ return storageKey ? loadFromStorage(storageKey) : null;
1691
+ }, [storageKey]);
1692
+ var persistSelections = useCallback(function (selections) {
1693
+ if (!storageKey) return;
1694
+ try {
1695
+ var data = {
1696
+ selections: selections,
1697
+ storedAt: Date.now()
1698
+ };
1699
+ localStorage.setItem(storageKey, JSON.stringify(data));
1700
+ } catch (_unused2) {
1701
+ // Ignore quota exceeded or other storage errors
1702
+ }
1703
+ }, [storageKey]);
1704
+ return {
1705
+ storedSelections: storedSelections,
1706
+ persistSelections: persistSelections
1707
+ };
1708
+ }
1709
+
1710
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1711
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1712
+ var useQuickConfig = function useQuickConfig(_ref) {
1713
+ var config = _ref.config,
1714
+ onEvent = _ref.onEvent,
1715
+ initialContext = _ref.initialContext;
1716
+ var storageKey = config.id || config.codex;
1717
+ var _useQuickConfigStorag = useQuickConfigStorage(storageKey),
1718
+ storedSelections = _useQuickConfigStorag.storedSelections,
1719
+ persistSelections = _useQuickConfigStorag.persistSelections;
1720
+ var filteredInstances = useMemo(function () {
1721
+ if (!config.instances) return [];
1722
+ return config.instances.filter(function (instance) {
1723
+ return ConditionEvaluator.shouldShowInstance(instance, initialContext || []);
1724
+ });
1725
+ }, [config.instances, initialContext]);
1726
+ var getInitialSelections = useCallback(function () {
1727
+ // Prefer stored selections when reopening (user's previous choices persist across closes)
1728
+ if (storedSelections && Object.keys(storedSelections).length > 0) {
1729
+ return storedSelections;
1730
+ }
1731
+ // Fall back to initialContext when no stored data (e.g. pre-fill from product/basket)
1732
+ if (initialContext !== undefined) {
1733
+ return {
1734
+ "default": initialContext
1735
+ };
1736
+ }
1737
+ return {
1738
+ "default": []
1739
+ };
1740
+ }, [initialContext, storedSelections]);
1741
+ var _useState = useState(getInitialSelections),
1742
+ _useState2 = _slicedToArray(_useState, 2),
1743
+ instanceSelections = _useState2[0],
1744
+ setInstanceSelections = _useState2[1];
1745
+ var prevStorageKeyRef = useRef(storageKey);
1746
+ useEffect(function () {
1747
+ if (prevStorageKeyRef.current !== storageKey) {
1748
+ prevStorageKeyRef.current = storageKey;
1749
+ setInstanceSelections(getInitialSelections());
1750
+ }
1751
+ }, [storageKey, getInitialSelections]);
1752
+ useEffect(function () {
1753
+ persistSelections(instanceSelections);
1754
+ }, [instanceSelections, persistSelections]);
1755
+ var _useState3 = useState(filteredInstances.length > 0 ? filteredInstances[0].id : 'default'),
1756
+ _useState4 = _slicedToArray(_useState3, 2),
1757
+ activeInstanceId = _useState4[0],
1758
+ setActiveInstanceId = _useState4[1];
1759
+ var _useState5 = useState(0),
1760
+ _useState6 = _slicedToArray(_useState5, 2),
1761
+ currentFeatureGroupIndex = _useState6[0],
1762
+ setCurrentFeatureGroupIndex = _useState6[1];
1763
+ var _useState7 = useState(null),
1764
+ _useState8 = _slicedToArray(_useState7, 2),
1765
+ result = _useState8[0],
1766
+ setResult = _useState8[1];
1767
+ var _useState9 = useState(!!config.introText),
1768
+ _useState10 = _slicedToArray(_useState9, 2),
1769
+ showIntro = _useState10[0],
1770
+ setShowIntro = _useState10[1];
1771
+ useEffect(function () {
1772
+ if (result && filteredInstances.length > 0) {
1773
+ setActiveInstanceId(filteredInstances[0].id);
1774
+ }
1775
+ }, [result, filteredInstances]);
1776
+ var selections = useMemo(function () {
1777
+ return instanceSelections[activeInstanceId] || [];
1778
+ }, [instanceSelections, activeInstanceId]);
1779
+ var _useQuickConfigCalcul = useQuickConfigCalculations(config),
1780
+ calculateFullResult = _useQuickConfigCalcul.calculateFullResult;
1781
+ var _useQuickConfigFeatur = useQuickConfigFeatures(config, selections, currentFeatureGroupIndex, result),
1782
+ featureGroups = _useQuickConfigFeatur.featureGroups,
1783
+ currentFeatures = _useQuickConfigFeatur.currentFeatures;
1784
+ var handleFeatureSelect = useCallback(function (featureCodex, selectedOptions) {
1785
+ setInstanceSelections(function (prev) {
1786
+ var currentSelections = prev[activeInstanceId] || [];
1787
+ var existing = currentSelections.find(function (s) {
1788
+ return s.featureCodex === featureCodex;
1789
+ });
1790
+ var updatedSelections = existing ? currentSelections.map(function (s) {
1791
+ return s.featureCodex === featureCodex ? _objectSpread(_objectSpread({}, s), {}, {
1792
+ selectedOptions: selectedOptions
1793
+ }) : s;
1794
+ }) : [].concat(_toConsumableArray(currentSelections), [{
1795
+ featureCodex: featureCodex,
1796
+ selectedOptions: selectedOptions
1797
+ }]);
1798
+ var updated = _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, activeInstanceId, updatedSelections));
1799
+
1800
+ // Auto-advance logic
1801
+ var currentFeature = currentFeatures.find(function (f) {
1802
+ return f.codex === featureCodex;
1803
+ });
1804
+ if (currentFeatures.length === 1 && !(currentFeature !== null && currentFeature !== void 0 && currentFeature.multiSelect) && selectedOptions.length > 0) {
1805
+ var isLastGroup = currentFeatureGroupIndex === featureGroups.length - 1;
1806
+ var isLastInstance = filteredInstances.length === 0 || activeInstanceId === filteredInstances[filteredInstances.length - 1].id;
1807
+ if (!isLastGroup || !isLastInstance) {
1808
+ setTimeout(function () {
1809
+ if (currentFeatureGroupIndex < featureGroups.length - 1) {
1810
+ setCurrentFeatureGroupIndex(function (prevIdx) {
1811
+ return prevIdx + 1;
1812
+ });
1813
+ }
1814
+ }, 100);
1815
+ } else if (isLastGroup && isLastInstance) {
1816
+ setTimeout(function () {
1817
+ var fullResult = calculateFullResult(updated);
1818
+ setResult(fullResult);
1819
+ onEvent === null || onEvent === void 0 || onEvent({
1820
+ type: 'complete',
1821
+ payload: fullResult
1822
+ });
1823
+ }, 100);
1824
+ }
1825
+ }
1826
+ return updated;
1827
+ });
1828
+ }, [activeInstanceId, currentFeatures, currentFeatureGroupIndex, featureGroups.length, filteredInstances, calculateFullResult, onEvent]);
1829
+ var handleNext = useCallback(function () {
1830
+ var _filteredInstances$fi;
1831
+ var isLastGroup = currentFeatureGroupIndex === featureGroups.length - 1;
1832
+ var instanceIndex = (_filteredInstances$fi = filteredInstances.findIndex(function (i) {
1833
+ return i.id === activeInstanceId;
1834
+ })) !== null && _filteredInstances$fi !== void 0 ? _filteredInstances$fi : -1;
1835
+ var isLastInstance = filteredInstances.length === 0 || instanceIndex === filteredInstances.length - 1;
1836
+ if (!isLastGroup) {
1837
+ setCurrentFeatureGroupIndex(function (prev) {
1838
+ return prev + 1;
1839
+ });
1840
+ } else if (!isLastInstance) {
1841
+ setActiveInstanceId(filteredInstances[instanceIndex + 1].id);
1842
+ setCurrentFeatureGroupIndex(0);
1843
+ } else {
1844
+ var fullResult = calculateFullResult(instanceSelections);
1845
+ setResult(fullResult);
1846
+ onEvent === null || onEvent === void 0 || onEvent({
1847
+ type: 'complete',
1848
+ payload: fullResult
1849
+ });
1850
+ }
1851
+ }, [currentFeatureGroupIndex, featureGroups.length, filteredInstances, activeInstanceId, instanceSelections, calculateFullResult, onEvent]);
1852
+ var handleBack = useCallback(function () {
1853
+ var _filteredInstances$fi2;
1854
+ var instanceIndex = (_filteredInstances$fi2 = filteredInstances.findIndex(function (i) {
1855
+ return i.id === activeInstanceId;
1856
+ })) !== null && _filteredInstances$fi2 !== void 0 ? _filteredInstances$fi2 : -1;
1857
+ if (currentFeatureGroupIndex > 0) {
1858
+ setCurrentFeatureGroupIndex(function (prev) {
1859
+ return prev - 1;
1860
+ });
1861
+ } else if (instanceIndex > 0) {
1862
+ setActiveInstanceId(filteredInstances[instanceIndex - 1].id);
1863
+ setCurrentFeatureGroupIndex(featureGroups.length - 1);
1864
+ } else if (config.introText) {
1865
+ setShowIntro(true);
1866
+ }
1867
+ }, [currentFeatureGroupIndex, filteredInstances, activeInstanceId, featureGroups.length, config.introText]);
1868
+ var handleIntroNext = useCallback(function () {
1869
+ return setShowIntro(false);
1870
+ }, []);
1871
+ var handleRetry = useCallback(function () {
1872
+ setActiveInstanceId(filteredInstances.length > 0 ? filteredInstances[0].id : 'default');
1873
+ setCurrentFeatureGroupIndex(0);
1874
+ setResult(null);
1875
+ }, [filteredInstances]);
1876
+ var handleSwitchInstance = useCallback(function (instanceId) {
1877
+ setActiveInstanceId(instanceId);
1878
+ setCurrentFeatureGroupIndex(0);
1879
+ }, []);
1880
+ var handleCopySelections = useCallback(function (fromId, toId) {
1881
+ var selectionsToCopy = instanceSelections[fromId] || [];
1882
+ var updatedSelections = _objectSpread({}, instanceSelections);
1883
+ var fromIndex = filteredInstances.findIndex(function (i) {
1884
+ return i.id === fromId;
1885
+ });
1886
+ if (fromIndex !== -1) {
1887
+ for (var i = fromIndex + 1; i < filteredInstances.length; i++) {
1888
+ updatedSelections[filteredInstances[i].id] = _toConsumableArray(selectionsToCopy);
1889
+ }
1890
+ } else {
1891
+ updatedSelections[toId] = _toConsumableArray(selectionsToCopy);
1892
+ }
1893
+ setInstanceSelections(updatedSelections);
1894
+ var fullResult = calculateFullResult(updatedSelections);
1895
+ setResult(fullResult);
1896
+ onEvent === null || onEvent === void 0 || onEvent({
1897
+ type: 'complete',
1898
+ payload: fullResult
1899
+ });
1900
+ }, [instanceSelections, filteredInstances, calculateFullResult, onEvent]);
1901
+ var canProceed = useMemo(function () {
1902
+ return currentFeatures.every(function (feature) {
1903
+ if (!feature.required) return true;
1904
+ var selection = selections.find(function (s) {
1905
+ return s.featureCodex === feature.codex;
1906
+ });
1907
+ return selection && selection.selectedOptions.length > 0;
1908
+ });
1909
+ }, [currentFeatures, selections]);
1910
+ return {
1911
+ selections: selections,
1912
+ instanceSelections: instanceSelections,
1913
+ activeInstanceId: activeInstanceId,
1914
+ currentFeatureGroupIndex: currentFeatureGroupIndex,
1915
+ result: result,
1916
+ showIntro: showIntro,
1917
+ featureGroups: featureGroups,
1918
+ currentFeatures: currentFeatures,
1919
+ canProceed: canProceed,
1920
+ handleFeatureSelect: handleFeatureSelect,
1921
+ handleNext: handleNext,
1922
+ handleBack: handleBack,
1923
+ handleIntroNext: handleIntroNext,
1924
+ handleRetry: handleRetry,
1925
+ handleSwitchInstance: handleSwitchInstance,
1926
+ handleCopySelections: handleCopySelections,
1927
+ setResult: setResult,
1928
+ filteredInstances: filteredInstances
1929
+ };
1930
+ };
1931
+
1932
+ function getLocalizedText(texts, language) {
1933
+ if (!texts) return '';
1934
+ return texts[language] || texts.en || texts.de || '';
1935
+ }
1936
+ var QuickConfig = function QuickConfig(_ref) {
1937
+ var config = _ref.config,
1938
+ onEvent = _ref.onEvent,
1939
+ initialContext = _ref.initialContext,
1940
+ renderContentItem = _ref.renderContentItem;
1941
+ var _useTranslation = useTranslation(),
1942
+ t = _useTranslation.t,
1943
+ i18n = _useTranslation.i18n;
1944
+ var language = i18n.language;
1945
+ var containerRef = useRef(null);
1946
+ var handleCancel = onEvent ? function () {
1947
+ return onEvent({
1948
+ type: 'onCancel'
1949
+ });
1950
+ } : undefined;
1951
+ var _useQuickConfig = useQuickConfig({
1952
+ config: config,
1953
+ onEvent: onEvent,
1954
+ initialContext: initialContext
1955
+ }),
1956
+ selections = _useQuickConfig.selections,
1957
+ activeInstanceId = _useQuickConfig.activeInstanceId,
1958
+ currentFeatureGroupIndex = _useQuickConfig.currentFeatureGroupIndex,
1959
+ result = _useQuickConfig.result,
1960
+ showIntro = _useQuickConfig.showIntro,
1961
+ featureGroups = _useQuickConfig.featureGroups,
1962
+ currentFeatures = _useQuickConfig.currentFeatures,
1963
+ canProceed = _useQuickConfig.canProceed,
1964
+ handleFeatureSelect = _useQuickConfig.handleFeatureSelect,
1965
+ handleNext = _useQuickConfig.handleNext,
1966
+ handleBack = _useQuickConfig.handleBack,
1967
+ handleIntroNext = _useQuickConfig.handleIntroNext,
1968
+ handleRetry = _useQuickConfig.handleRetry,
1969
+ handleSwitchInstance = _useQuickConfig.handleSwitchInstance,
1970
+ handleCopySelections = _useQuickConfig.handleCopySelections,
1971
+ filteredInstances = _useQuickConfig.filteredInstances;
1972
+ useEffect(function () {
1973
+ var _containerRef$current;
1974
+ (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 || _containerRef$current.scrollTo({
1975
+ top: 0
1976
+ });
1977
+ }, [currentFeatureGroupIndex, activeInstanceId, showIntro, result]);
1978
+ if (showIntro && config.introText) {
1979
+ return /*#__PURE__*/jsxs("div", {
1980
+ className: container,
1981
+ ref: containerRef,
1982
+ children: [/*#__PURE__*/jsx(Header, {
1983
+ onCancel: handleCancel,
1984
+ featureGroups: featureGroups,
1985
+ currentFeatureGroupIndex: currentFeatureGroupIndex
1986
+ }), getLocalizedText(config.configDescription, language) && /*#__PURE__*/jsx("p", {
1987
+ className: configDescription,
1988
+ dangerouslySetInnerHTML: {
1989
+ __html: getLocalizedText(config.configDescription, language)
1990
+ }
1991
+ }), /*#__PURE__*/jsxs("div", {
1992
+ className: subContainer,
1993
+ children: [/*#__PURE__*/jsx("h2", {
1994
+ dangerouslySetInnerHTML: {
1995
+ __html: getLocalizedText(config.name, language)
1996
+ }
1997
+ }), /*#__PURE__*/jsx("p", {
1998
+ dangerouslySetInnerHTML: {
1999
+ __html: getLocalizedText(config.introText, language)
2000
+ }
2001
+ })]
2002
+ }), /*#__PURE__*/jsx(Navigation, {
2003
+ onNext: handleIntroNext,
2004
+ canProceed: true,
2005
+ showBack: false,
2006
+ nextLabel: t('quickconfig.next', {
2007
+ defaultValue: 'Weiter'
2008
+ })
2009
+ })]
2010
+ });
2011
+ }
2012
+ if (result) {
2013
+ return /*#__PURE__*/jsxs("div", {
2014
+ className: container,
2015
+ ref: containerRef,
2016
+ children: [/*#__PURE__*/jsx(Header, {
2017
+ instances: filteredInstances,
2018
+ activeInstanceId: activeInstanceId,
2019
+ onSwitchInstance: handleSwitchInstance,
2020
+ onCancel: handleCancel,
2021
+ featureGroups: featureGroups,
2022
+ currentFeatureGroupIndex: currentFeatureGroupIndex
2023
+ }), getLocalizedText(config.resultDescription, language) && /*#__PURE__*/jsx("p", {
2024
+ className: resultDescription,
2025
+ dangerouslySetInnerHTML: {
2026
+ __html: getLocalizedText(config.resultDescription, language)
2027
+ }
2028
+ }), /*#__PURE__*/jsx(ResultDisplay, {
2029
+ activeInstanceId: activeInstanceId,
2030
+ result: result,
2031
+ config: config,
2032
+ onRetry: handleRetry,
2033
+ filteredInstances: filteredInstances,
2034
+ onEvent: onEvent,
2035
+ renderContentItem: renderContentItem
2036
+ })]
2037
+ });
2038
+ }
2039
+ var currentInstanceIndex = filteredInstances.findIndex(function (i) {
2040
+ return i.id === activeInstanceId;
2041
+ });
2042
+ var hasNextInstance = filteredInstances.length > 1 && currentInstanceIndex < filteredInstances.length - 1;
2043
+ var isLastStep = currentFeatureGroupIndex >= featureGroups.length - 1 && !hasNextInstance;
2044
+ var nextLabel = isLastStep ? t('quickconfig.calculate', {
2045
+ defaultValue: 'Berechnen'
2046
+ }) : t('quickconfig.next', {
2047
+ defaultValue: 'Weiter'
2048
+ });
2049
+ return /*#__PURE__*/jsxs("div", {
2050
+ className: container,
2051
+ ref: containerRef,
2052
+ children: [/*#__PURE__*/jsx(Header, {
2053
+ instances: filteredInstances,
2054
+ activeInstanceId: activeInstanceId,
2055
+ onSwitchInstance: handleSwitchInstance,
2056
+ onCancel: handleCancel,
2057
+ featureGroups: featureGroups,
2058
+ currentFeatureGroupIndex: currentFeatureGroupIndex
2059
+ }), getLocalizedText(config.configDescription, language) && /*#__PURE__*/jsx("p", {
2060
+ className: configDescription,
2061
+ dangerouslySetInnerHTML: {
2062
+ __html: getLocalizedText(config.configDescription, language)
2063
+ }
2064
+ }), /*#__PURE__*/jsx("div", {
2065
+ className: subContainer,
2066
+ children: currentFeatures.map(function (feature) {
2067
+ return /*#__PURE__*/jsx(FeatureRenderer, {
2068
+ feature: feature,
2069
+ selection: selections.find(function (s) {
2070
+ return s.featureCodex === feature.codex;
2071
+ }),
2072
+ onSelect: handleFeatureSelect,
2073
+ selections: selections
2074
+ }, feature.codex);
2075
+ })
2076
+ }), /*#__PURE__*/jsx(Navigation, {
2077
+ onBack: handleBack,
2078
+ onNext: handleNext,
2079
+ onCopy: handleCopySelections,
2080
+ canProceed: canProceed,
2081
+ showBack: currentFeatureGroupIndex > 0,
2082
+ nextLabel: nextLabel,
2083
+ currentInstanceId: activeInstanceId,
2084
+ language: language,
2085
+ nextInstance: hasNextInstance ? filteredInstances[currentInstanceIndex + 1] : undefined
2086
+ }, currentFeatureGroupIndex)]
2087
+ });
2088
+ };
2089
+
2090
+ export { ConditionEvaluator, QuickConfig, getTranslatedText, validateQuickConfig };