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

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