@viamedici-spc/configurator-react 0.1.3 → 1.0.1-rc0001
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.
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +37 -8
- package/dist/index.js +325 -890
- package/package.json +9 -7
package/dist/index.js
CHANGED
|
@@ -1,816 +1,261 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AttributeType as S, ConfigurationInterpreter as E, DecisionKind as te, ExplainQuestionSubject as w, ExplainQuestionType as oe, globalAttributeIdEquals as re, globalConstraintIdEquals as ae, AllowedRulesInExplainType as h } from "@viamedici-spc/configurator-ts";
|
|
2
|
+
import { pipe as m, RA as l, O as a, some as U, none as D, flow as le, identity as ue, Eq as c, RR as ce, Str as I, constVoid as ge } from "@viamedici-spc/fp-ts-extensions";
|
|
3
|
+
import { createContext as P, useContext as N, useMemo as d, useRef as Q, useEffect as de } from "react";
|
|
4
|
+
import { match as M } from "ts-pattern";
|
|
5
|
+
import { jsx as b, Fragment as fe } from "react/jsx-runtime";
|
|
6
|
+
import { createMachine as F, assign as f, sendParent as X, spawn as K, forwardTo as q, send as pe } from "xstate";
|
|
7
|
+
import { log as C, pure as Ce, stop as G } from "xstate/lib/actions";
|
|
2
8
|
import { deepEqual as me } from "fast-equals";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (t || arguments.length === 2)
|
|
10
|
-
for (var i = 0, o = n.length, s; i < o; i++)
|
|
11
|
-
(s || !(i in n)) && (s || (s = Array.prototype.slice.call(n, 0, i)), s[i] = n[i]);
|
|
12
|
-
return e.concat(s || Array.prototype.slice.call(n));
|
|
9
|
+
import { useMachine as Se } from "@xstate/react";
|
|
10
|
+
const A = window.configuratorReactContexts ?? {
|
|
11
|
+
ConfigurationSessionContext: P(null),
|
|
12
|
+
ConfigurationInitializationContext: P(null),
|
|
13
|
+
ConfigurationUpdatingContext: P(null),
|
|
14
|
+
ConfigurationContext: P(null)
|
|
13
15
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function Ce(e) {
|
|
18
|
-
return function() {
|
|
19
|
-
return e;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
var en = /* @__PURE__ */ Ce(null), ye = /* @__PURE__ */ Ce(void 0), nn = ye;
|
|
23
|
-
function Se(e, n, t, i, o, s, a, g, u) {
|
|
24
|
-
switch (arguments.length) {
|
|
25
|
-
case 1:
|
|
26
|
-
return e;
|
|
27
|
-
case 2:
|
|
28
|
-
return function() {
|
|
29
|
-
return n(e.apply(this, arguments));
|
|
30
|
-
};
|
|
31
|
-
case 3:
|
|
32
|
-
return function() {
|
|
33
|
-
return t(n(e.apply(this, arguments)));
|
|
34
|
-
};
|
|
35
|
-
case 4:
|
|
36
|
-
return function() {
|
|
37
|
-
return i(t(n(e.apply(this, arguments))));
|
|
38
|
-
};
|
|
39
|
-
case 5:
|
|
40
|
-
return function() {
|
|
41
|
-
return o(i(t(n(e.apply(this, arguments)))));
|
|
42
|
-
};
|
|
43
|
-
case 6:
|
|
44
|
-
return function() {
|
|
45
|
-
return s(o(i(t(n(e.apply(this, arguments))))));
|
|
46
|
-
};
|
|
47
|
-
case 7:
|
|
48
|
-
return function() {
|
|
49
|
-
return a(s(o(i(t(n(e.apply(this, arguments)))))));
|
|
50
|
-
};
|
|
51
|
-
case 8:
|
|
52
|
-
return function() {
|
|
53
|
-
return g(a(s(o(i(t(n(e.apply(this, arguments))))))));
|
|
54
|
-
};
|
|
55
|
-
case 9:
|
|
56
|
-
return function() {
|
|
57
|
-
return u(g(a(s(o(i(t(n(e.apply(this, arguments)))))))));
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function r(e, n, t, i, o, s, a, g, u) {
|
|
62
|
-
switch (arguments.length) {
|
|
63
|
-
case 1:
|
|
64
|
-
return e;
|
|
65
|
-
case 2:
|
|
66
|
-
return n(e);
|
|
67
|
-
case 3:
|
|
68
|
-
return t(n(e));
|
|
69
|
-
case 4:
|
|
70
|
-
return i(t(n(e)));
|
|
71
|
-
case 5:
|
|
72
|
-
return o(i(t(n(e))));
|
|
73
|
-
case 6:
|
|
74
|
-
return s(o(i(t(n(e)))));
|
|
75
|
-
case 7:
|
|
76
|
-
return a(s(o(i(t(n(e))))));
|
|
77
|
-
case 8:
|
|
78
|
-
return g(a(s(o(i(t(n(e)))))));
|
|
79
|
-
case 9:
|
|
80
|
-
return u(g(a(s(o(i(t(n(e))))))));
|
|
81
|
-
default: {
|
|
82
|
-
for (var h = arguments[0], x = 1; x < arguments.length; x++)
|
|
83
|
-
h = arguments[x](h);
|
|
84
|
-
return h;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
var te = function(e, n) {
|
|
89
|
-
var t = typeof e == "number" ? function(i) {
|
|
90
|
-
return i.length >= e;
|
|
91
|
-
} : e;
|
|
92
|
-
return function() {
|
|
93
|
-
var i = Array.from(arguments);
|
|
94
|
-
return t(arguments) ? n.apply(this, i) : function(o) {
|
|
95
|
-
return n.apply(void 0, Ze([o], i, !1));
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
globalThis && globalThis.__spreadArray;
|
|
100
|
-
var ve = function(e) {
|
|
101
|
-
return e._tag === "Some";
|
|
102
|
-
}, Ee = { _tag: "None" }, Ae = function(e) {
|
|
103
|
-
return { _tag: "Some", value: e };
|
|
104
|
-
}, tn = function(e) {
|
|
105
|
-
return e.length > 0;
|
|
106
|
-
}, on = [], sn = Object.prototype.hasOwnProperty;
|
|
107
|
-
function rn(e) {
|
|
108
|
-
return function(n, t) {
|
|
109
|
-
return e.chain(n, function(i) {
|
|
110
|
-
return e.map(t(i), function() {
|
|
111
|
-
return i;
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
var v = function(e) {
|
|
117
|
-
return {
|
|
118
|
-
equals: function(n, t) {
|
|
119
|
-
return n === t || e(n, t);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}, S = function(e) {
|
|
123
|
-
return v(function(n, t) {
|
|
124
|
-
for (var i in e)
|
|
125
|
-
if (!e[i].equals(n[i], t[i]))
|
|
126
|
-
return !1;
|
|
127
|
-
return !0;
|
|
128
|
-
});
|
|
129
|
-
}, be = {
|
|
130
|
-
equals: function(e, n) {
|
|
131
|
-
return e === n;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
be.equals;
|
|
135
|
-
var y = Ee, P = Ae;
|
|
136
|
-
function H(e) {
|
|
137
|
-
return function(n) {
|
|
138
|
-
return e(n) ? P(n) : y;
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
var an = function(e, n) {
|
|
142
|
-
return r(e, A(n));
|
|
143
|
-
}, un = function(e, n) {
|
|
144
|
-
return r(e, fn(n));
|
|
145
|
-
}, cn = "Option", ln = function(e) {
|
|
146
|
-
return {
|
|
147
|
-
equals: function(n, t) {
|
|
148
|
-
return n === t || (E(n) ? E(t) : E(t) ? !1 : e.equals(n.value, t.value));
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
}, A = function(e) {
|
|
152
|
-
return function(n) {
|
|
153
|
-
return E(n) ? y : P(e(n.value));
|
|
154
|
-
};
|
|
155
|
-
}, fn = function(e) {
|
|
156
|
-
return function(n) {
|
|
157
|
-
return E(n) || E(e) ? y : P(n.value(e.value));
|
|
158
|
-
};
|
|
159
|
-
}, Pe = /* @__PURE__ */ te(2, function(e, n) {
|
|
160
|
-
return E(e) ? y : n(e.value);
|
|
161
|
-
}), gn = {
|
|
162
|
-
URI: cn,
|
|
163
|
-
map: an,
|
|
164
|
-
ap: un,
|
|
165
|
-
chain: Pe
|
|
166
|
-
}, I = function(e) {
|
|
167
|
-
return function(n) {
|
|
168
|
-
return E(n) ? y : e(n.value) ? n : y;
|
|
169
|
-
};
|
|
170
|
-
}, E = function(e) {
|
|
171
|
-
return e._tag === "None";
|
|
172
|
-
}, dn = function(e, n) {
|
|
173
|
-
return function(t) {
|
|
174
|
-
return E(t) ? e() : n(t.value);
|
|
175
|
-
};
|
|
176
|
-
}, ie = dn, pn = function(e) {
|
|
177
|
-
return function(n) {
|
|
178
|
-
return E(n) ? e() : n.value;
|
|
179
|
-
};
|
|
180
|
-
}, U = pn, mn = /* @__PURE__ */ te(2, rn(gn)), l = function(e) {
|
|
181
|
-
return e == null ? y : P(e);
|
|
182
|
-
}, W = /* @__PURE__ */ ie(en, O), D = /* @__PURE__ */ ie(ye, O), hn = Pe, Cn = mn, oe = {
|
|
183
|
-
equals: function(e, n) {
|
|
184
|
-
return e === n;
|
|
185
|
-
}
|
|
186
|
-
}, yn = {
|
|
187
|
-
equals: oe.equals,
|
|
188
|
-
compare: function(e, n) {
|
|
189
|
-
return e < n ? -1 : e > n ? 1 : 0;
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
oe.equals, yn.compare;
|
|
193
|
-
globalThis && globalThis.__spreadArray;
|
|
194
|
-
var Sn = on, vn = tn;
|
|
195
|
-
globalThis && globalThis.__spreadArray;
|
|
196
|
-
var En = function(e) {
|
|
197
|
-
return e.length === 0;
|
|
198
|
-
}, Ie = vn, An = function(e) {
|
|
199
|
-
return function(n) {
|
|
200
|
-
if (En(n))
|
|
201
|
-
return In;
|
|
202
|
-
for (var t = [], i = 0; i < n.length; i++)
|
|
203
|
-
t.push.apply(t, e(i, n[i]));
|
|
204
|
-
return t;
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
function qe(e) {
|
|
208
|
-
return function(n) {
|
|
209
|
-
for (var t = 0; t < n.length; t++)
|
|
210
|
-
if (e(n[t]))
|
|
211
|
-
return Ae(n[t]);
|
|
212
|
-
return Ee;
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
var bn = function(e, n, t) {
|
|
216
|
-
for (var i = [], o = Math.min(e.length, n.length), s = 0; s < o; s++)
|
|
217
|
-
i[s] = t(e[s], n[s]);
|
|
218
|
-
return i;
|
|
219
|
-
};
|
|
220
|
-
function Me(e, n) {
|
|
221
|
-
return n === void 0 ? function(t) {
|
|
222
|
-
return Me(t, e);
|
|
223
|
-
} : bn(e, n, function(t, i) {
|
|
224
|
-
return [t, i];
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
var we = /* @__PURE__ */ te(2, function(e, n) {
|
|
228
|
-
return r(e, An(function(t, i) {
|
|
229
|
-
return n(i, t);
|
|
230
|
-
}));
|
|
231
|
-
}), xe = /* @__PURE__ */ we(O), b = function(e) {
|
|
232
|
-
return function(n) {
|
|
233
|
-
return n.map(function(t) {
|
|
234
|
-
return e(t);
|
|
235
|
-
});
|
|
236
|
-
};
|
|
237
|
-
}, p = function(e) {
|
|
238
|
-
return function(n) {
|
|
239
|
-
return n.filter(e);
|
|
240
|
-
};
|
|
241
|
-
}, Pn = function(e) {
|
|
242
|
-
return function(n) {
|
|
243
|
-
for (var t = [], i = 0; i < n.length; i++) {
|
|
244
|
-
var o = e(i, n[i]);
|
|
245
|
-
ve(o) && t.push(o.value);
|
|
246
|
-
}
|
|
247
|
-
return t;
|
|
248
|
-
};
|
|
249
|
-
}, w = function(e) {
|
|
250
|
-
return Pn(function(n, t) {
|
|
251
|
-
return e(t);
|
|
252
|
-
});
|
|
253
|
-
}, Y = /* @__PURE__ */ w(O), K = function(e) {
|
|
254
|
-
return v(function(n, t) {
|
|
255
|
-
return n.length === t.length && n.every(function(i, o) {
|
|
256
|
-
return e.equals(i, t[o]);
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
}, In = Sn;
|
|
260
|
-
function qn(e) {
|
|
261
|
-
return function(n) {
|
|
262
|
-
return n.every(e);
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
var Mn = we, c = {
|
|
266
|
-
equals: function(e, n) {
|
|
267
|
-
return e === n;
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
c.equals;
|
|
271
|
-
var Re = {
|
|
272
|
-
equals: function(e, n) {
|
|
273
|
-
return e === n;
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
Re.equals;
|
|
277
|
-
function Ue(e) {
|
|
278
|
-
return function(n, t) {
|
|
279
|
-
if (t === void 0) {
|
|
280
|
-
var i = Ue(e);
|
|
281
|
-
return function(s) {
|
|
282
|
-
return i(s, n);
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
for (var o in n)
|
|
286
|
-
if (!sn.call(t, o) || !e.equals(n[o], t[o]))
|
|
287
|
-
return !1;
|
|
288
|
-
return !0;
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
function De(e) {
|
|
292
|
-
var n = Ue(e);
|
|
293
|
-
return v(function(t, i) {
|
|
294
|
-
return n(t)(i) && n(i)(t);
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
function se(e) {
|
|
298
|
-
return {
|
|
299
|
-
equals(n, t) {
|
|
300
|
-
return n == null && t == null ? !0 : n == null || t === null || t === void 0 ? !1 : e.equals(n, t);
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
function $(e) {
|
|
305
|
-
return {
|
|
306
|
-
equals(n, t) {
|
|
307
|
-
const i = r(l(n), U(() => [])), o = r(l(t), U(() => []));
|
|
308
|
-
return K(e).equals(i, o);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
const N = S({
|
|
313
|
-
localId: c,
|
|
314
|
-
componentPath: $(c),
|
|
315
|
-
sharedConfigurationModelId: se(c)
|
|
316
|
-
}), wn = S({
|
|
317
|
-
localId: c,
|
|
318
|
-
configurationModelId: c
|
|
319
|
-
}), xn = v((e, n) => Je({ x: e, y: n }).with({
|
|
320
|
-
x: {
|
|
321
|
-
type: "Choice"
|
|
322
|
-
/* Choice */
|
|
323
|
-
},
|
|
324
|
-
y: {
|
|
325
|
-
type: "Choice"
|
|
326
|
-
/* Choice */
|
|
327
|
-
}
|
|
328
|
-
}, (t) => Rn.equals(t.x, t.y)).with({
|
|
329
|
-
x: {
|
|
330
|
-
type: "Component"
|
|
331
|
-
/* Component */
|
|
332
|
-
},
|
|
333
|
-
y: {
|
|
334
|
-
type: "Component"
|
|
335
|
-
/* Component */
|
|
336
|
-
}
|
|
337
|
-
}, (t) => Un.equals(t.x, t.y)).with({
|
|
338
|
-
x: {
|
|
339
|
-
type: "Numeric"
|
|
340
|
-
/* Numeric */
|
|
341
|
-
},
|
|
342
|
-
y: {
|
|
343
|
-
type: "Numeric"
|
|
344
|
-
/* Numeric */
|
|
345
|
-
}
|
|
346
|
-
}, (t) => Dn.equals(t.x, t.y)).with({
|
|
347
|
-
x: {
|
|
348
|
-
type: "Boolean"
|
|
349
|
-
/* Boolean */
|
|
350
|
-
},
|
|
351
|
-
y: {
|
|
352
|
-
type: "Boolean"
|
|
353
|
-
/* Boolean */
|
|
354
|
-
}
|
|
355
|
-
}, (t) => Nn.equals(t.x, t.y)).otherwise(() => !1)), Rn = S({
|
|
356
|
-
type: c,
|
|
357
|
-
attributeId: N,
|
|
358
|
-
state: c,
|
|
359
|
-
choiceValueId: c
|
|
360
|
-
}), Un = S({
|
|
361
|
-
type: c,
|
|
362
|
-
attributeId: N,
|
|
363
|
-
state: c
|
|
364
|
-
}), Dn = S({
|
|
365
|
-
type: c,
|
|
366
|
-
attributeId: N,
|
|
367
|
-
state: oe
|
|
368
|
-
}), Nn = S({
|
|
369
|
-
type: c,
|
|
370
|
-
attributeId: N,
|
|
371
|
-
state: Re
|
|
372
|
-
});
|
|
373
|
-
var q = /* @__PURE__ */ ((e) => (e.whyIsNotSatisfied = "why-is-not-satisfied", e.whyIsStateNotPossible = "why-is-state-not-possible", e))(q || {}), M = /* @__PURE__ */ ((e) => (e.choiceValue = "choice-value", e.component = "component", e.boolean = "boolean", e.numeric = "numeric", e.configuration = "configuration", e.attribute = "attribute", e))(M || {}), f = /* @__PURE__ */ ((e) => (e.Boolean = "Boolean", e.Numeric = "Numeric", e.Choice = "Choice", e.Component = "Component", e))(f || {}), G = /* @__PURE__ */ ((e) => (e.Implicit = "Implicit", e.Explicit = "Explicit", e))(G || {});
|
|
374
|
-
const ge = S({
|
|
375
|
-
localId: c,
|
|
376
|
-
componentPath: $(c),
|
|
377
|
-
sharedConfigurationModel: se(c)
|
|
378
|
-
}), _n = ln(K(S({
|
|
379
|
-
attributeId: ge,
|
|
380
|
-
decisions: $(ge)
|
|
381
|
-
})));
|
|
382
|
-
S({
|
|
383
|
-
configurationModelSource: v((e, n) => me(e, n)),
|
|
384
|
-
decisionsToRespect: _n,
|
|
385
|
-
usageRuleParameters: De(c)
|
|
386
|
-
});
|
|
387
|
-
S({
|
|
388
|
-
localId: c,
|
|
389
|
-
componentPath: $(c),
|
|
390
|
-
sharedConfigurationModelId: se(c)
|
|
391
|
-
});
|
|
392
|
-
function Tn(e, n) {
|
|
393
|
-
return r(
|
|
394
|
-
e.values,
|
|
395
|
-
w((t) => r(
|
|
396
|
-
t.decision,
|
|
397
|
-
l,
|
|
398
|
-
I((i) => i.kind === n)
|
|
399
|
-
))
|
|
400
|
-
);
|
|
401
|
-
}
|
|
402
|
-
function kn(e) {
|
|
403
|
-
return r(
|
|
404
|
-
e.decision,
|
|
405
|
-
l,
|
|
406
|
-
I((n) => n.kind === G.Explicit),
|
|
407
|
-
W
|
|
408
|
-
);
|
|
409
|
-
}
|
|
410
|
-
function zn(e) {
|
|
411
|
-
return r(
|
|
412
|
-
e.decision,
|
|
413
|
-
l,
|
|
414
|
-
I((n) => n.kind === G.Explicit),
|
|
415
|
-
W
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
function On(e) {
|
|
419
|
-
return r(
|
|
420
|
-
e.decision,
|
|
421
|
-
l,
|
|
422
|
-
W
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
const Ne = (e) => e.type === f.Boolean, _e = (e) => e.type === f.Choice, Te = (e) => e.type === f.Numeric, ke = (e) => e.type === f.Component, $n = $(c);
|
|
426
|
-
function jn(e, n, t) {
|
|
427
|
-
var i;
|
|
428
|
-
const o = ((i = n.componentPath) == null ? void 0 : i.length) ?? 0;
|
|
429
|
-
return r(e, p((s) => {
|
|
430
|
-
var a;
|
|
431
|
-
const g = ((a = s.id.componentPath) == null ? void 0 : a.length) ?? 0;
|
|
432
|
-
return t ? o > g ? !1 : r(
|
|
433
|
-
s.id.componentPath ?? [],
|
|
434
|
-
Me(n.componentPath ?? []),
|
|
435
|
-
qn(([u, h]) => u === h)
|
|
436
|
-
) : $n.equals(s.id.componentPath, n.componentPath);
|
|
437
|
-
}));
|
|
438
|
-
}
|
|
439
|
-
function Bn(e, n, t) {
|
|
440
|
-
return [];
|
|
441
|
-
}
|
|
442
|
-
function Fn(e) {
|
|
443
|
-
return r(e, p((n) => {
|
|
444
|
-
const t = r(
|
|
445
|
-
n.id.componentPath,
|
|
446
|
-
l,
|
|
447
|
-
A((o) => o.length === 0),
|
|
448
|
-
U(() => !0)
|
|
449
|
-
), i = r(
|
|
450
|
-
n.id.sharedConfigurationModelId,
|
|
451
|
-
l,
|
|
452
|
-
ie(() => !0, () => !1)
|
|
453
|
-
);
|
|
454
|
-
return t && i;
|
|
455
|
-
}));
|
|
456
|
-
}
|
|
457
|
-
function Vn(e, n) {
|
|
458
|
-
return r(
|
|
459
|
-
ze(e),
|
|
460
|
-
b((t) => Tn(t, n)),
|
|
461
|
-
xe,
|
|
462
|
-
w((t) => l(t))
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
function Hn(e, n) {
|
|
466
|
-
return r(
|
|
467
|
-
$e(e),
|
|
468
|
-
p((t) => {
|
|
469
|
-
var i;
|
|
470
|
-
return ((i = t.decision) == null ? void 0 : i.kind) === n;
|
|
471
|
-
}),
|
|
472
|
-
b((t) => kn(t)),
|
|
473
|
-
w((t) => l(t))
|
|
474
|
-
);
|
|
475
|
-
}
|
|
476
|
-
function Wn(e, n) {
|
|
477
|
-
return r(
|
|
478
|
-
je(e),
|
|
479
|
-
p((t) => {
|
|
480
|
-
var i;
|
|
481
|
-
return ((i = t.decision) == null ? void 0 : i.kind) === n;
|
|
482
|
-
}),
|
|
483
|
-
b((t) => zn(t)),
|
|
484
|
-
w((t) => l(t))
|
|
485
|
-
);
|
|
486
|
-
}
|
|
487
|
-
function Kn(e, n) {
|
|
488
|
-
return r(
|
|
489
|
-
Oe(e),
|
|
490
|
-
p((t) => {
|
|
491
|
-
var i;
|
|
492
|
-
return ((i = t.decision) == null ? void 0 : i.kind) === n;
|
|
493
|
-
}),
|
|
494
|
-
b((t) => On(t)),
|
|
495
|
-
w((t) => l(t))
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
function ze(e) {
|
|
499
|
-
return r(
|
|
500
|
-
e.attributes,
|
|
501
|
-
p(_e)
|
|
502
|
-
);
|
|
503
|
-
}
|
|
504
|
-
function Oe(e) {
|
|
505
|
-
return r(
|
|
506
|
-
e.attributes,
|
|
507
|
-
p(ke)
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
function $e(e) {
|
|
511
|
-
return r(
|
|
512
|
-
e.attributes,
|
|
513
|
-
p(Te)
|
|
514
|
-
);
|
|
515
|
-
}
|
|
516
|
-
function je(e) {
|
|
517
|
-
return r(
|
|
518
|
-
e.attributes,
|
|
519
|
-
p(Ne)
|
|
520
|
-
);
|
|
521
|
-
}
|
|
522
|
-
function Gn(e, n) {
|
|
523
|
-
return r(
|
|
524
|
-
j(e, n),
|
|
525
|
-
D
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
function Jn(e, n) {
|
|
529
|
-
return r(
|
|
530
|
-
Be(e, n),
|
|
531
|
-
D
|
|
532
|
-
);
|
|
533
|
-
}
|
|
534
|
-
function Ln(e, n, t) {
|
|
535
|
-
return r(
|
|
536
|
-
Be(e, n),
|
|
537
|
-
A((i) => i.values),
|
|
538
|
-
hn(Se(qe((i) => i.id === t))),
|
|
539
|
-
D
|
|
540
|
-
);
|
|
541
|
-
}
|
|
542
|
-
function Xn(e, n) {
|
|
543
|
-
return r(
|
|
544
|
-
j(e, n),
|
|
545
|
-
I(Te),
|
|
546
|
-
D
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
function Yn(e, n) {
|
|
550
|
-
return r(
|
|
551
|
-
j(e, n),
|
|
552
|
-
I(Ne),
|
|
553
|
-
D
|
|
554
|
-
);
|
|
555
|
-
}
|
|
556
|
-
function Qn(e, n) {
|
|
557
|
-
return r(
|
|
558
|
-
j(e, n),
|
|
559
|
-
I(ke),
|
|
560
|
-
D
|
|
561
|
-
);
|
|
562
|
-
}
|
|
563
|
-
function j(e, n) {
|
|
564
|
-
return r(
|
|
565
|
-
e.attributes,
|
|
566
|
-
qe((t) => N.equals(t.id, n))
|
|
567
|
-
);
|
|
568
|
-
}
|
|
569
|
-
function Be(e, n) {
|
|
570
|
-
return r(
|
|
571
|
-
j(e, n),
|
|
572
|
-
I(_e)
|
|
573
|
-
);
|
|
574
|
-
}
|
|
575
|
-
const _ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
576
|
-
__proto__: null,
|
|
577
|
-
filterAttributesOfComponent: jn,
|
|
578
|
-
filterAttributesOfRoot: Fn,
|
|
579
|
-
filterAttributesOfShared: Bn,
|
|
580
|
-
getAttribute: Gn,
|
|
581
|
-
getBooleanAttribute: Yn,
|
|
582
|
-
getBooleanAttributes: je,
|
|
583
|
-
getBooleanDecisions: Wn,
|
|
584
|
-
getChoiceAttribute: Jn,
|
|
585
|
-
getChoiceAttributes: ze,
|
|
586
|
-
getChoiceDecisions: Vn,
|
|
587
|
-
getChoiceValue: Ln,
|
|
588
|
-
getComponentAttribute: Qn,
|
|
589
|
-
getComponentAttributes: Oe,
|
|
590
|
-
getComponentDecisions: Kn,
|
|
591
|
-
getNumericAttribute: Xn,
|
|
592
|
-
getNumericAttributes: $e,
|
|
593
|
-
getNumericDecisions: Hn
|
|
594
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
595
|
-
q.whyIsNotSatisfied, M.configuration;
|
|
596
|
-
const de = N.equals;
|
|
597
|
-
wn.equals;
|
|
598
|
-
xn.equals;
|
|
599
|
-
function ee(e) {
|
|
600
|
-
return v(
|
|
601
|
-
(n, t) => {
|
|
602
|
-
const i = n == null, o = t == null;
|
|
603
|
-
return i && o || !i && !o && e.equals(n, t);
|
|
604
|
-
}
|
|
605
|
-
);
|
|
606
|
-
}
|
|
607
|
-
const Fe = F(null), Ve = F(null), He = F(null), We = F(null), re = () => V(Fe), T = () => V(We), Ke = "The configuration is not initialized. Consider using the ConfigurationSuspender or unload components manually that make use of any unsafe hook while the configuration is initializing. Check the hooks documentation to see if it is safe to use while the configuration is initializing.";
|
|
608
|
-
function ae(e) {
|
|
16
|
+
window.configuratorReactContexts = A;
|
|
17
|
+
const Y = A.ConfigurationSessionContext, Z = A.ConfigurationInitializationContext, $ = A.ConfigurationUpdatingContext, ee = A.ConfigurationContext, j = () => N(Y), x = () => N(ee), ne = "The configuration is not initialized. Consider using the ConfigurationSuspender or unload components manually that make use of any unsafe hook while the configuration is initializing. Check the hooks documentation to see if it is safe to use while the configuration is initializing.";
|
|
18
|
+
function B(e) {
|
|
609
19
|
if (!e)
|
|
610
|
-
throw new Error(
|
|
20
|
+
throw new Error(ne);
|
|
611
21
|
}
|
|
612
|
-
function
|
|
22
|
+
function R(e) {
|
|
613
23
|
if (!e)
|
|
614
|
-
throw new Error(
|
|
24
|
+
throw new Error(ne);
|
|
615
25
|
}
|
|
616
|
-
function
|
|
617
|
-
const e =
|
|
618
|
-
return
|
|
26
|
+
function z() {
|
|
27
|
+
const e = j();
|
|
28
|
+
return B(e), d(() => ({
|
|
619
29
|
makeDecision: (n) => e.makeDecision(n),
|
|
620
|
-
setManyDecision: (n,
|
|
30
|
+
setManyDecision: (n, s) => e.setMany(n, s)
|
|
621
31
|
}), [e]);
|
|
622
32
|
}
|
|
623
|
-
|
|
33
|
+
globalThis && globalThis.__spreadArray;
|
|
34
|
+
var he = function(e) {
|
|
35
|
+
return e._tag === "Some";
|
|
36
|
+
}, k = function(e) {
|
|
624
37
|
return function(n) {
|
|
625
|
-
return
|
|
38
|
+
return he(e(n));
|
|
626
39
|
};
|
|
627
40
|
};
|
|
628
|
-
const
|
|
629
|
-
function
|
|
630
|
-
return e.decision != null && e.decision.kind ===
|
|
41
|
+
const ye = k((e) => e.type === S.Choice ? U(e) : D), Ee = k((e) => e.type === S.Numeric ? U(e) : D), xe = k((e) => e.type === S.Boolean ? U(e) : D), Re = k((e) => e.type === S.Component ? U(e) : D);
|
|
42
|
+
function _(e) {
|
|
43
|
+
return e.decision != null && e.decision.kind === te.Explicit;
|
|
631
44
|
}
|
|
632
|
-
function
|
|
633
|
-
return
|
|
45
|
+
function se(e) {
|
|
46
|
+
return m(
|
|
634
47
|
e.values,
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
type:
|
|
48
|
+
l.filter(_),
|
|
49
|
+
l.map((n) => ({
|
|
50
|
+
type: S.Choice,
|
|
638
51
|
attributeId: e.id,
|
|
639
52
|
choiceValueId: n.id,
|
|
640
53
|
state: null
|
|
641
54
|
}))
|
|
642
55
|
);
|
|
643
56
|
}
|
|
644
|
-
function
|
|
645
|
-
return
|
|
57
|
+
function be(e) {
|
|
58
|
+
return m(
|
|
646
59
|
e,
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
type:
|
|
60
|
+
a.fromPredicate(_),
|
|
61
|
+
a.map(() => ({
|
|
62
|
+
type: S.Numeric,
|
|
650
63
|
attributeId: e.id,
|
|
651
64
|
state: null
|
|
652
65
|
}))
|
|
653
66
|
);
|
|
654
67
|
}
|
|
655
|
-
function
|
|
656
|
-
return
|
|
68
|
+
function we(e) {
|
|
69
|
+
return m(
|
|
657
70
|
e,
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
type:
|
|
71
|
+
a.fromPredicate(_),
|
|
72
|
+
a.map(() => ({
|
|
73
|
+
type: S.Boolean,
|
|
661
74
|
attributeId: e.id,
|
|
662
75
|
state: null
|
|
663
76
|
}))
|
|
664
77
|
);
|
|
665
78
|
}
|
|
666
|
-
function
|
|
667
|
-
return
|
|
79
|
+
function Ae(e) {
|
|
80
|
+
return m(
|
|
668
81
|
e,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
type:
|
|
82
|
+
a.fromPredicate(_),
|
|
83
|
+
a.map(() => ({
|
|
84
|
+
type: S.Component,
|
|
672
85
|
attributeId: e.id,
|
|
673
86
|
state: null
|
|
674
87
|
}))
|
|
675
88
|
);
|
|
676
89
|
}
|
|
677
|
-
function
|
|
678
|
-
return
|
|
679
|
-
|
|
680
|
-
(
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
90
|
+
function Pe(e, n) {
|
|
91
|
+
return m(
|
|
92
|
+
E.filterAttributesOfComponent(n, e, !0),
|
|
93
|
+
(s) => [
|
|
94
|
+
m(
|
|
95
|
+
s,
|
|
96
|
+
l.filter(ye),
|
|
97
|
+
l.chain(se)
|
|
685
98
|
),
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
99
|
+
m(
|
|
100
|
+
s,
|
|
101
|
+
l.filter(Ee),
|
|
102
|
+
l.map(be),
|
|
103
|
+
l.compact
|
|
691
104
|
),
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
105
|
+
m(
|
|
106
|
+
s,
|
|
107
|
+
l.filter(xe),
|
|
108
|
+
l.map(we),
|
|
109
|
+
l.compact
|
|
697
110
|
),
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
111
|
+
m(
|
|
112
|
+
s,
|
|
113
|
+
l.filter(Re),
|
|
114
|
+
l.map(Ae),
|
|
115
|
+
l.compact
|
|
703
116
|
)
|
|
704
117
|
],
|
|
705
|
-
|
|
118
|
+
l.flatten
|
|
706
119
|
);
|
|
707
120
|
}
|
|
708
|
-
function
|
|
709
|
-
const
|
|
710
|
-
return
|
|
711
|
-
() =>
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
121
|
+
function qe() {
|
|
122
|
+
const e = j();
|
|
123
|
+
return B(e), d(() => ({
|
|
124
|
+
explain: (n, s) => M(s).with("decisions", (i) => e.explain(n, i)).with("constraints", (i) => e.explain(n, i)).with("full", (i) => e.explain(n, i)).exhaustive(),
|
|
125
|
+
applySolution: (n) => e.applySolution(n)
|
|
126
|
+
}), [e]);
|
|
127
|
+
}
|
|
128
|
+
function nn(e, n = !1) {
|
|
129
|
+
const s = x();
|
|
130
|
+
return R(s), d(
|
|
131
|
+
() => m(
|
|
132
|
+
a.fromNullable(e),
|
|
133
|
+
a.map(le(
|
|
134
|
+
l.map((i) => E.getAttribute(s, i)),
|
|
135
|
+
n ? l.filterMap(a.fromNullable) : ue
|
|
716
136
|
)),
|
|
717
|
-
|
|
137
|
+
a.getOrElse(() => s.attributes)
|
|
718
138
|
),
|
|
719
|
-
[e,
|
|
139
|
+
[e, s, n]
|
|
720
140
|
);
|
|
721
141
|
}
|
|
722
|
-
function
|
|
723
|
-
const n =
|
|
724
|
-
|
|
725
|
-
const o =
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
makeDecision: (g, u) => t({
|
|
729
|
-
type: f.Choice,
|
|
142
|
+
function sn(e) {
|
|
143
|
+
const n = x(), { makeDecision: s, setManyDecision: i } = z(), t = O(e, w.choiceValue);
|
|
144
|
+
R(n);
|
|
145
|
+
const o = E.getChoiceAttribute(n, e), u = d(() => ({
|
|
146
|
+
makeDecision: (r, p) => s({
|
|
147
|
+
type: S.Choice,
|
|
730
148
|
attributeId: e,
|
|
731
|
-
choiceValueId:
|
|
732
|
-
state:
|
|
149
|
+
choiceValueId: r,
|
|
150
|
+
state: p
|
|
733
151
|
}),
|
|
734
|
-
clearDecisions:
|
|
152
|
+
clearDecisions: m(
|
|
735
153
|
o,
|
|
736
|
-
|
|
737
|
-
|
|
154
|
+
a.fromNullable,
|
|
155
|
+
a.map(se),
|
|
738
156
|
// Only setMany if there are decisions to clear.
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
)
|
|
743
|
-
|
|
744
|
-
}), [e, o,
|
|
745
|
-
...
|
|
157
|
+
a.filter(l.isNonEmpty),
|
|
158
|
+
a.map((r) => () => i(r, { type: "Default" })),
|
|
159
|
+
a.getOrElse(() => () => Promise.resolve())
|
|
160
|
+
),
|
|
161
|
+
...t
|
|
162
|
+
}), [e, o, s, i, t]), g = d(() => ({
|
|
163
|
+
...u,
|
|
746
164
|
attribute: o
|
|
747
|
-
}), [o,
|
|
165
|
+
}), [o, u]);
|
|
748
166
|
if (o)
|
|
749
|
-
return
|
|
167
|
+
return g;
|
|
750
168
|
}
|
|
751
|
-
function
|
|
752
|
-
const n =
|
|
753
|
-
|
|
754
|
-
const
|
|
755
|
-
makeDecision: (
|
|
756
|
-
type:
|
|
169
|
+
function tn(e) {
|
|
170
|
+
const n = x(), { makeDecision: s } = z(), i = O(e, w.numeric);
|
|
171
|
+
R(n);
|
|
172
|
+
const t = E.getNumericAttribute(n, e), o = d(() => ({
|
|
173
|
+
makeDecision: (g) => s({
|
|
174
|
+
type: S.Numeric,
|
|
757
175
|
attributeId: e,
|
|
758
|
-
state:
|
|
759
|
-
})
|
|
760
|
-
|
|
176
|
+
state: g
|
|
177
|
+
}),
|
|
178
|
+
...i
|
|
179
|
+
}), [e, s, i]), u = d(() => ({
|
|
761
180
|
...o,
|
|
762
|
-
attribute:
|
|
763
|
-
}), [
|
|
764
|
-
if (
|
|
765
|
-
return
|
|
766
|
-
}
|
|
767
|
-
function
|
|
768
|
-
const n =
|
|
769
|
-
|
|
770
|
-
const
|
|
771
|
-
makeDecision: (
|
|
772
|
-
type:
|
|
181
|
+
attribute: t
|
|
182
|
+
}), [t, o]);
|
|
183
|
+
if (t)
|
|
184
|
+
return u;
|
|
185
|
+
}
|
|
186
|
+
function on(e) {
|
|
187
|
+
const n = x(), { makeDecision: s } = z(), i = O(e, w.boolean);
|
|
188
|
+
R(n);
|
|
189
|
+
const t = E.getBooleanAttribute(n, e), o = d(() => ({
|
|
190
|
+
makeDecision: (g) => s({
|
|
191
|
+
type: S.Boolean,
|
|
773
192
|
attributeId: e,
|
|
774
|
-
state:
|
|
775
|
-
})
|
|
776
|
-
|
|
193
|
+
state: g
|
|
194
|
+
}),
|
|
195
|
+
...i
|
|
196
|
+
}), [e, s, i]), u = d(() => ({
|
|
777
197
|
...o,
|
|
778
|
-
attribute:
|
|
779
|
-
}), [
|
|
780
|
-
if (
|
|
781
|
-
return
|
|
198
|
+
attribute: t
|
|
199
|
+
}), [t, o]);
|
|
200
|
+
if (t)
|
|
201
|
+
return u;
|
|
782
202
|
}
|
|
783
|
-
function
|
|
784
|
-
const n =
|
|
785
|
-
|
|
786
|
-
const o = n.attributes,
|
|
787
|
-
makeDecision: (
|
|
788
|
-
type:
|
|
203
|
+
function rn(e) {
|
|
204
|
+
const n = x(), { makeDecision: s, setManyDecision: i } = z(), t = O(e, w.component);
|
|
205
|
+
R(n);
|
|
206
|
+
const o = n.attributes, u = E.getComponentAttribute(n, e), g = d(() => ({
|
|
207
|
+
makeDecision: (p) => s({
|
|
208
|
+
type: S.Component,
|
|
789
209
|
attributeId: e,
|
|
790
|
-
state:
|
|
210
|
+
state: p
|
|
791
211
|
}),
|
|
792
|
-
clearSubtree:
|
|
793
|
-
|
|
212
|
+
clearSubtree: m(
|
|
213
|
+
Pe(e, o),
|
|
794
214
|
// Only setMany if there are decisions to clear.
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
)
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
215
|
+
a.fromPredicate(l.isNonEmpty),
|
|
216
|
+
a.map((p) => () => i(p, { type: "Default" })),
|
|
217
|
+
a.getOrElse(() => () => Promise.resolve())
|
|
218
|
+
),
|
|
219
|
+
...t
|
|
220
|
+
}), [e, s, o, i, t]), r = d(() => ({
|
|
221
|
+
...g,
|
|
222
|
+
attribute: u
|
|
223
|
+
}), [u, g]);
|
|
224
|
+
if (u)
|
|
225
|
+
return r;
|
|
226
|
+
}
|
|
227
|
+
function O(e, n) {
|
|
228
|
+
const { explain: s, applySolution: i } = qe();
|
|
229
|
+
return d(() => ({
|
|
230
|
+
explain: (t, o) => {
|
|
231
|
+
const u = M(t.question).with(oe.whyIsNotSatisfied, () => w.attribute).otherwise(() => n), g = {
|
|
232
|
+
...t,
|
|
233
|
+
subject: u,
|
|
234
|
+
attributeId: e
|
|
235
|
+
};
|
|
236
|
+
return M(o).with("decisions", (r) => s(g, r)).with("constraints", (r) => s(g, r)).with("full", (r) => s(g, r)).exhaustive();
|
|
237
|
+
},
|
|
238
|
+
applySolution: i
|
|
239
|
+
}), [e, n, s, i]);
|
|
240
|
+
}
|
|
241
|
+
const J = c.fromEquals(re), ve = c.fromEquals(ae), Me = c.fromEquals((e, n) => ce.getEq(I.Eq).equals(e ?? {}, n ?? {})), Ue = c.struct({
|
|
242
|
+
attributeId: J,
|
|
243
|
+
decisions: l.getEq(J)
|
|
244
|
+
}), De = c.fromEquals((e, n) => l.getEq(Ue).equals(e ?? [], n ?? [])), Ie = c.struct({
|
|
245
|
+
type: I.Eq
|
|
246
|
+
}), Ne = c.struct({
|
|
247
|
+
type: I.Eq
|
|
248
|
+
}), ze = c.struct({
|
|
249
|
+
type: I.Eq,
|
|
250
|
+
rules: l.getEq(ve)
|
|
251
|
+
}), ke = c.fromEquals((e, n) => M({ x: e, y: n }).returnType().with({ x: { type: h.all }, y: { type: h.all } }, ({ x: s, y: i }) => Ie.equals(s, i)).with({ x: { type: h.none }, y: { type: h.none } }, ({ x: s, y: i }) => Ne.equals(s, i)).with({ x: { type: h.specific }, y: { type: h.specific } }, ({ x: s, y: i }) => ze.equals(s, i)).otherwise(() => !1)), _e = c.struct({
|
|
252
|
+
rules: c.eqNullable(ke)
|
|
253
|
+
}), ie = c.struct({
|
|
254
|
+
configurationModelSource: c.fromEquals((e, n) => me(e, n)),
|
|
255
|
+
attributeRelations: De,
|
|
256
|
+
usageRuleParameters: Me,
|
|
257
|
+
allowedInExplain: c.eqNullable(_e)
|
|
258
|
+
}), T = c.eqNullable(ie), Oe = c.eqStrict, v = c.eqNullable(Oe), Te = () => F({
|
|
814
259
|
predictableActionArguments: !0,
|
|
815
260
|
preserveActionOrder: !0,
|
|
816
261
|
schema: {
|
|
@@ -843,7 +288,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
843
288
|
ProcessChanges: {
|
|
844
289
|
entry: [
|
|
845
290
|
C("Entering ProcessChanges", "SessionManagement:"),
|
|
846
|
-
|
|
291
|
+
y(
|
|
847
292
|
2
|
|
848
293
|
/* Other */
|
|
849
294
|
)
|
|
@@ -857,7 +302,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
857
302
|
DisposeSession: {
|
|
858
303
|
entry: [
|
|
859
304
|
C("Entering DisposeSession", "SessionManagement:"),
|
|
860
|
-
|
|
305
|
+
y(
|
|
861
306
|
2
|
|
862
307
|
/* Other */
|
|
863
308
|
)
|
|
@@ -870,7 +315,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
870
315
|
CreateSession: {
|
|
871
316
|
entry: [
|
|
872
317
|
C("Entering CreateSession", "SessionManagement:"),
|
|
873
|
-
|
|
318
|
+
y(
|
|
874
319
|
0
|
|
875
320
|
/* CreateSession */
|
|
876
321
|
)
|
|
@@ -891,7 +336,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
891
336
|
SessionCreationFailed: {
|
|
892
337
|
entry: [
|
|
893
338
|
C("Entering SessionCreationFailed", "SessionManagement:"),
|
|
894
|
-
|
|
339
|
+
y(
|
|
895
340
|
2
|
|
896
341
|
/* Other */
|
|
897
342
|
)
|
|
@@ -916,7 +361,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
916
361
|
UpdateSession: {
|
|
917
362
|
entry: [
|
|
918
363
|
C("Entering UpdateSession", "SessionManagement:"),
|
|
919
|
-
|
|
364
|
+
y(
|
|
920
365
|
1
|
|
921
366
|
/* UpdateSession */
|
|
922
367
|
)
|
|
@@ -936,7 +381,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
936
381
|
SessionUpdateFailed: {
|
|
937
382
|
entry: [
|
|
938
383
|
C("Entering SessionUpdateFailed", "SessionManagement:"),
|
|
939
|
-
|
|
384
|
+
y(
|
|
940
385
|
2
|
|
941
386
|
/* Other */
|
|
942
387
|
)
|
|
@@ -961,30 +406,30 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
961
406
|
}
|
|
962
407
|
}, {
|
|
963
408
|
actions: {
|
|
964
|
-
saveDesiredClient:
|
|
409
|
+
saveDesiredClient: f({
|
|
965
410
|
desiredClient: (e, n) => n.client
|
|
966
411
|
}),
|
|
967
|
-
saveDesiredSessionContext:
|
|
412
|
+
saveDesiredSessionContext: f({
|
|
968
413
|
desiredSessionContext: (e, n) => n.sessionContext
|
|
969
414
|
}),
|
|
970
|
-
disposeOldSession:
|
|
415
|
+
disposeOldSession: f((e, n) => (e.session && e.session.close().then(ge).catch((s) => {
|
|
971
416
|
}), {
|
|
972
417
|
session: null,
|
|
973
418
|
actualClient: null
|
|
974
419
|
})),
|
|
975
|
-
setSessionCreationResult:
|
|
420
|
+
setSessionCreationResult: f((e, n) => ({
|
|
976
421
|
session: n.data.session,
|
|
977
422
|
actualClient: n.data.client
|
|
978
423
|
})),
|
|
979
|
-
setSessionCreationError:
|
|
424
|
+
setSessionCreationError: f((e, n) => ({
|
|
980
425
|
sessionCreationError: n.data
|
|
981
426
|
})),
|
|
982
|
-
clearSessionCreationError:
|
|
983
|
-
setSessionUpdateError:
|
|
427
|
+
clearSessionCreationError: f({ sessionCreationError: () => null }),
|
|
428
|
+
setSessionUpdateError: f((e, n) => ({
|
|
984
429
|
sessionUpdateError: n.data
|
|
985
430
|
})),
|
|
986
|
-
clearSessionUpdateError:
|
|
987
|
-
setHasEverSuccessfullyCreatedSession:
|
|
431
|
+
clearSessionUpdateError: f({ sessionUpdateError: () => null }),
|
|
432
|
+
setHasEverSuccessfullyCreatedSession: f({
|
|
988
433
|
hasEverSuccessfullyCreatedSession: () => !0
|
|
989
434
|
})
|
|
990
435
|
},
|
|
@@ -993,60 +438,60 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
993
438
|
session: n,
|
|
994
439
|
client: e.desiredClient
|
|
995
440
|
})).catch((n) => Promise.reject({
|
|
996
|
-
|
|
441
|
+
failureResult: n,
|
|
997
442
|
client: e.desiredClient,
|
|
998
443
|
sessionContext: e.desiredSessionContext
|
|
999
444
|
})),
|
|
1000
445
|
updateSession: (e) => e.session.setSessionContext(e.desiredSessionContext).catch((n) => Promise.reject({
|
|
1001
|
-
|
|
446
|
+
failureResult: n,
|
|
1002
447
|
sessionContext: e.desiredSessionContext
|
|
1003
448
|
}))
|
|
1004
449
|
},
|
|
1005
450
|
guards: {
|
|
1006
|
-
shallDisposeSession: (e) => e.session != null && (e.desiredSessionContext == null || e.desiredClient == null || !
|
|
451
|
+
shallDisposeSession: (e) => e.session != null && (e.desiredSessionContext == null || e.desiredClient == null || !v.equals(e.actualClient, e.desiredClient)),
|
|
1007
452
|
shallCreateSession: (e) => e.session == null && e.desiredClient != null && e.desiredSessionContext != null,
|
|
1008
|
-
shallUpdateSession: (e) => e.session != null && !
|
|
453
|
+
shallUpdateSession: (e) => e.session != null && !ie.equals(e.session.getSessionContext(), e.desiredSessionContext),
|
|
1009
454
|
shallImmediatelyProcessChangesAfterSessionCreationError: (e) => (
|
|
1010
455
|
// The desired client and the desired session context is not the same that resulted in the error.
|
|
1011
|
-
!
|
|
456
|
+
!v.equals(e.desiredClient, e.sessionCreationError.client) || !T.equals(e.desiredSessionContext, e.sessionCreationError.sessionContext)
|
|
1012
457
|
),
|
|
1013
458
|
shallImmediatelyProcessChangesAfterSessionUpdateError: (e) => (
|
|
1014
459
|
// The desired client was changed
|
|
1015
|
-
!
|
|
460
|
+
!v.equals(e.desiredClient, e.actualClient) || !T.equals(e.desiredSessionContext, e.sessionUpdateError.sessionContext)
|
|
1016
461
|
)
|
|
1017
462
|
}
|
|
1018
463
|
});
|
|
1019
|
-
function
|
|
1020
|
-
const n = e === 0,
|
|
1021
|
-
return
|
|
1022
|
-
const
|
|
464
|
+
function y(e) {
|
|
465
|
+
const n = e === 0, s = e === 1;
|
|
466
|
+
return Ce((i, t) => {
|
|
467
|
+
const o = {
|
|
1023
468
|
isInitializing: (!i.hasEverSuccessfullyCreatedSession || n) && i.sessionCreationError == null,
|
|
1024
|
-
|
|
1025
|
-
},
|
|
1026
|
-
isUpdating:
|
|
1027
|
-
|
|
469
|
+
failureResult: i.sessionCreationError && i.sessionCreationError.failureResult
|
|
470
|
+
}, u = {
|
|
471
|
+
isUpdating: s && i.sessionUpdateError == null,
|
|
472
|
+
failureResult: i.sessionUpdateError && i.sessionUpdateError.failureResult
|
|
1028
473
|
};
|
|
1029
|
-
return
|
|
474
|
+
return X({
|
|
1030
475
|
type: "SessionManagementStateChanged",
|
|
1031
|
-
sessionInitialization:
|
|
1032
|
-
sessionUpdating:
|
|
476
|
+
sessionInitialization: o,
|
|
477
|
+
sessionUpdating: u,
|
|
1033
478
|
session: i.session
|
|
1034
479
|
});
|
|
1035
480
|
});
|
|
1036
481
|
}
|
|
1037
|
-
const
|
|
482
|
+
const Fe = (e) => (n) => (n({
|
|
1038
483
|
type: "ConfigurationChanged",
|
|
1039
484
|
session: e,
|
|
1040
485
|
configuration: e.getConfiguration()
|
|
1041
|
-
}), e.setOnConfigurationChangedHandler((
|
|
486
|
+
}), e.setOnConfigurationChangedHandler((s) => {
|
|
1042
487
|
n({
|
|
1043
488
|
type: "ConfigurationChanged",
|
|
1044
489
|
session: e,
|
|
1045
|
-
configuration:
|
|
490
|
+
configuration: s
|
|
1046
491
|
});
|
|
1047
492
|
}), () => {
|
|
1048
493
|
e.setOnConfigurationChangedHandler(null);
|
|
1049
|
-
}),
|
|
494
|
+
}), je = () => F({
|
|
1050
495
|
predictableActionArguments: !0,
|
|
1051
496
|
preserveActionOrder: !0,
|
|
1052
497
|
schema: {
|
|
@@ -1060,7 +505,7 @@ const gt = (e) => (n) => (n({
|
|
|
1060
505
|
// Forward the configuration data to the parent.
|
|
1061
506
|
ConfigurationChanged: {
|
|
1062
507
|
actions: [
|
|
1063
|
-
|
|
508
|
+
X((e, n) => n)
|
|
1064
509
|
]
|
|
1065
510
|
}
|
|
1066
511
|
},
|
|
@@ -1099,33 +544,40 @@ const gt = (e) => (n) => (n({
|
|
|
1099
544
|
},
|
|
1100
545
|
invoke: {
|
|
1101
546
|
id: "configurationSubscriptionActor",
|
|
1102
|
-
src: (e, n) =>
|
|
547
|
+
src: (e, n) => Fe(e.session)
|
|
1103
548
|
}
|
|
1104
549
|
}
|
|
1105
550
|
}
|
|
1106
551
|
}, {
|
|
1107
552
|
actions: {
|
|
1108
|
-
saveSession:
|
|
553
|
+
saveSession: f((e, n) => ({
|
|
1109
554
|
session: n.session
|
|
1110
555
|
}))
|
|
1111
556
|
}
|
|
1112
|
-
}),
|
|
557
|
+
}), Be = () => {
|
|
1113
558
|
let e, n;
|
|
1114
559
|
return {
|
|
1115
|
-
promise: new Promise((i,
|
|
1116
|
-
e = i, n =
|
|
560
|
+
promise: new Promise((i, t) => {
|
|
561
|
+
e = i, n = t;
|
|
1117
562
|
}),
|
|
1118
563
|
resolve: e,
|
|
1119
564
|
reject: n
|
|
1120
565
|
};
|
|
1121
|
-
},
|
|
1122
|
-
const e =
|
|
566
|
+
}, L = () => {
|
|
567
|
+
const e = Be();
|
|
1123
568
|
return {
|
|
1124
569
|
capsule: { promise: e.promise },
|
|
1125
570
|
resolve: e.resolve,
|
|
1126
571
|
reject: e.reject
|
|
1127
572
|
};
|
|
1128
|
-
}
|
|
573
|
+
};
|
|
574
|
+
var He = function(e, n, s) {
|
|
575
|
+
var i = Q(), t = Q(0);
|
|
576
|
+
return i.current == null && (i.current = e), n.equals(e, i.current) || (s && s.debug && process.env.NODE_ENV !== "production" && console.info("Stable hook update triggered:", { prev: i.current, value: e }), i.current = e, t.current += 1), [t.current];
|
|
577
|
+
}, W = function(e, n, s, i) {
|
|
578
|
+
return de(e, He(n, s, i));
|
|
579
|
+
};
|
|
580
|
+
const Ve = () => F({
|
|
1129
581
|
predictableActionArguments: !0,
|
|
1130
582
|
preserveActionOrder: !0,
|
|
1131
583
|
schema: {
|
|
@@ -1139,50 +591,50 @@ const gt = (e) => (n) => (n({
|
|
|
1139
591
|
sessionUpdating: null,
|
|
1140
592
|
session: null,
|
|
1141
593
|
configuration: null,
|
|
1142
|
-
isReadyPromise:
|
|
594
|
+
isReadyPromise: L()
|
|
1143
595
|
},
|
|
1144
596
|
entry: [
|
|
1145
|
-
|
|
1146
|
-
sessionManagementActor: () =>
|
|
1147
|
-
configurationSubscriptionManagementActor: () =>
|
|
597
|
+
f({
|
|
598
|
+
sessionManagementActor: () => K(Te()),
|
|
599
|
+
configurationSubscriptionManagementActor: () => K(je())
|
|
1148
600
|
})
|
|
1149
601
|
],
|
|
1150
602
|
exit: [
|
|
1151
|
-
|
|
1152
|
-
|
|
603
|
+
G((e) => e.sessionManagementActor),
|
|
604
|
+
G((e) => e.configurationSubscriptionManagementActor)
|
|
1153
605
|
],
|
|
1154
606
|
on: {
|
|
1155
607
|
// Forward events for sessionManagement
|
|
1156
608
|
ChangeConfigurationClient: {
|
|
1157
609
|
actions: [
|
|
1158
|
-
|
|
610
|
+
q((e) => e.sessionManagementActor)
|
|
1159
611
|
]
|
|
1160
612
|
},
|
|
1161
613
|
ChangeSessionContext: {
|
|
1162
614
|
actions: [
|
|
1163
|
-
|
|
615
|
+
q((e) => e.sessionManagementActor)
|
|
1164
616
|
]
|
|
1165
617
|
},
|
|
1166
618
|
RetrySessionCreation: {
|
|
1167
619
|
actions: [
|
|
1168
|
-
|
|
620
|
+
q((e) => e.sessionManagementActor)
|
|
1169
621
|
]
|
|
1170
622
|
},
|
|
1171
623
|
RetrySessionUpdate: {
|
|
1172
624
|
actions: [
|
|
1173
|
-
|
|
625
|
+
q((e) => e.sessionManagementActor)
|
|
1174
626
|
]
|
|
1175
627
|
},
|
|
1176
628
|
SessionManagementStateChanged: {
|
|
1177
629
|
actions: [
|
|
1178
630
|
// Assign the received data
|
|
1179
|
-
|
|
631
|
+
f((e, n) => ({
|
|
1180
632
|
session: n.session,
|
|
1181
633
|
sessionInitialization: n.sessionInitialization,
|
|
1182
634
|
sessionUpdating: n.sessionUpdating
|
|
1183
635
|
})),
|
|
1184
636
|
// Forward the session to the configuration subscription
|
|
1185
|
-
|
|
637
|
+
pe((e) => ({
|
|
1186
638
|
type: "ChangeSession",
|
|
1187
639
|
session: e.session
|
|
1188
640
|
}), { to: (e) => e.configurationSubscriptionManagementActor }),
|
|
@@ -1191,7 +643,7 @@ const gt = (e) => (n) => (n({
|
|
|
1191
643
|
},
|
|
1192
644
|
ConfigurationChanged: {
|
|
1193
645
|
actions: [
|
|
1194
|
-
|
|
646
|
+
f((e, n) => ({
|
|
1195
647
|
configuration: {
|
|
1196
648
|
session: n.session,
|
|
1197
649
|
configuration: n.configuration
|
|
@@ -1207,123 +659,106 @@ const gt = (e) => (n) => (n({
|
|
|
1207
659
|
}
|
|
1208
660
|
}, {
|
|
1209
661
|
actions: {
|
|
1210
|
-
calculateReadyState:
|
|
1211
|
-
var
|
|
1212
|
-
const
|
|
1213
|
-
return e.isReadyPromise &&
|
|
1214
|
-
isReadyPromise: (() =>
|
|
662
|
+
calculateReadyState: f((e, n) => {
|
|
663
|
+
var t;
|
|
664
|
+
const s = !((t = e.sessionInitialization) != null && t.isInitializing) && e.session != null && e.configuration != null && e.configuration.session === e.session;
|
|
665
|
+
return e.isReadyPromise && s && (e.isReadyPromise.resolve(), e.isReadyPromise.capsule.promise = null), {
|
|
666
|
+
isReadyPromise: (() => s ? null : e.isReadyPromise != null ? e.isReadyPromise : L())()
|
|
1215
667
|
};
|
|
1216
668
|
})
|
|
1217
669
|
}
|
|
1218
670
|
});
|
|
1219
|
-
function
|
|
1220
|
-
var
|
|
1221
|
-
const [n,
|
|
1222
|
-
logger: (...
|
|
671
|
+
function Qe(e) {
|
|
672
|
+
var u, g;
|
|
673
|
+
const [n, s] = Se(Ve, {
|
|
674
|
+
logger: (...r) => console.log("ConfigurationManagement:", ...r)
|
|
1223
675
|
});
|
|
1224
|
-
|
|
1225
|
-
|
|
676
|
+
W(() => {
|
|
677
|
+
s({
|
|
1226
678
|
type: "ChangeConfigurationClient",
|
|
1227
679
|
client: e.configuratorClient
|
|
1228
680
|
}), e.configuratorClient || console.warn("The configurator client is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass a valid client.");
|
|
1229
|
-
}, [e.configuratorClient]),
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
681
|
+
}, [e.configuratorClient], c.tuple(v)), W(() => {
|
|
682
|
+
const r = m(
|
|
683
|
+
a.fromNullable(e.sessionContext),
|
|
684
|
+
a.chainFirst((p) => a.fromNullable(p.configurationModelSource)),
|
|
685
|
+
a.toNullable
|
|
1234
686
|
);
|
|
1235
|
-
|
|
687
|
+
s({
|
|
1236
688
|
type: "ChangeSessionContext",
|
|
1237
|
-
sessionContext:
|
|
1238
|
-
}),
|
|
1239
|
-
}, [e.sessionContext]);
|
|
1240
|
-
const i =
|
|
689
|
+
sessionContext: r
|
|
690
|
+
}), r || console.warn("The session context is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass valid session context data.");
|
|
691
|
+
}, [e.sessionContext], c.tuple(T));
|
|
692
|
+
const i = d(
|
|
1241
693
|
() => {
|
|
1242
|
-
var
|
|
694
|
+
var r, p, H, V;
|
|
1243
695
|
return {
|
|
1244
|
-
isInitializing: ((
|
|
1245
|
-
isInitializingPromise: (
|
|
1246
|
-
error: ((
|
|
1247
|
-
|
|
1248
|
-
retry: () =>
|
|
696
|
+
isInitializing: ((p = (r = n.context.isReadyPromise) == null ? void 0 : r.capsule) == null ? void 0 : p.promise) != null,
|
|
697
|
+
isInitializingPromise: (H = n.context.isReadyPromise) == null ? void 0 : H.capsule,
|
|
698
|
+
error: ((V = n.context.sessionInitialization) == null ? void 0 : V.failureResult) && {
|
|
699
|
+
...n.context.sessionInitialization.failureResult,
|
|
700
|
+
retry: () => s({ type: "RetrySessionCreation" })
|
|
1249
701
|
}
|
|
1250
702
|
};
|
|
1251
703
|
},
|
|
1252
704
|
[n.context.sessionInitialization, n.context.isReadyPromise]
|
|
1253
|
-
),
|
|
705
|
+
), t = d(
|
|
1254
706
|
() => {
|
|
1255
|
-
var
|
|
707
|
+
var r, p;
|
|
1256
708
|
return {
|
|
1257
|
-
isUpdating: (
|
|
1258
|
-
error: ((
|
|
1259
|
-
|
|
1260
|
-
retry: () =>
|
|
709
|
+
isUpdating: (r = n.context.sessionUpdating) == null ? void 0 : r.isUpdating,
|
|
710
|
+
error: ((p = n.context.sessionUpdating) == null ? void 0 : p.failureResult) && {
|
|
711
|
+
...n.context.sessionUpdating.failureResult,
|
|
712
|
+
retry: () => s({ type: "RetrySessionUpdate" })
|
|
1261
713
|
}
|
|
1262
714
|
};
|
|
1263
715
|
},
|
|
1264
716
|
[n.context.sessionUpdating]
|
|
1265
|
-
),
|
|
717
|
+
), o = ((u = n.context.configuration) == null ? void 0 : u.session) === n.context.session ? (g = n.context.configuration) == null ? void 0 : g.configuration : null;
|
|
1266
718
|
return {
|
|
1267
719
|
configurationInitialization: i,
|
|
1268
|
-
configurationUpdating:
|
|
720
|
+
configurationUpdating: t,
|
|
1269
721
|
session: n.context.session,
|
|
1270
|
-
configuration:
|
|
722
|
+
configuration: o
|
|
1271
723
|
};
|
|
1272
724
|
}
|
|
1273
|
-
function
|
|
1274
|
-
const {
|
|
1275
|
-
configuratorClient:
|
|
1276
|
-
sessionContext:
|
|
725
|
+
function an(e) {
|
|
726
|
+
const { configuratorClient: n, ...s } = e, { configurationInitialization: i, configurationUpdating: t, session: o, configuration: u } = Qe({
|
|
727
|
+
configuratorClient: n,
|
|
728
|
+
sessionContext: s
|
|
1277
729
|
});
|
|
1278
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ b(Z.Provider, { value: i, children: /* @__PURE__ */ b($.Provider, { value: t, children: /* @__PURE__ */ b(Y.Provider, { value: o, children: /* @__PURE__ */ b(ee.Provider, { value: u, children: e.children }) }) }) });
|
|
1279
731
|
}
|
|
1280
|
-
function
|
|
1281
|
-
return
|
|
732
|
+
function Ke() {
|
|
733
|
+
return N(Z);
|
|
1282
734
|
}
|
|
1283
|
-
function
|
|
1284
|
-
return
|
|
735
|
+
function ln() {
|
|
736
|
+
return N($);
|
|
1285
737
|
}
|
|
1286
|
-
function
|
|
1287
|
-
const { children: n } = e, { isInitializingPromise:
|
|
1288
|
-
if (
|
|
1289
|
-
throw
|
|
1290
|
-
return /* @__PURE__ */
|
|
1291
|
-
}
|
|
1292
|
-
function Nt() {
|
|
1293
|
-
const e = re();
|
|
1294
|
-
return ae(e), m(() => ({
|
|
1295
|
-
// explainChoiceAttributeConsequence: (a, v, m) => configurationSession.explain({
|
|
1296
|
-
// type: ExplainType.ChoiceValue,
|
|
1297
|
-
// attributeId: a,
|
|
1298
|
-
// choiceValueId: v,
|
|
1299
|
-
// question: m
|
|
1300
|
-
// } as ExplainChoiceValue),
|
|
1301
|
-
// explainChoiceAttributeConsequences: (a, m) => configurationSession.explain({
|
|
1302
|
-
// type: ExplainType.Choice,
|
|
1303
|
-
// attributeId: a,
|
|
1304
|
-
// question: m
|
|
1305
|
-
// } as ExplainChoice),
|
|
1306
|
-
// applySolution: (s) => configurationSession.applySolution(s)
|
|
1307
|
-
}), [e]);
|
|
738
|
+
function un(e) {
|
|
739
|
+
const { children: n } = e, { isInitializingPromise: s } = Ke();
|
|
740
|
+
if (s != null && s.promise)
|
|
741
|
+
throw s.promise;
|
|
742
|
+
return /* @__PURE__ */ b(fe, { children: n });
|
|
1308
743
|
}
|
|
1309
|
-
function
|
|
1310
|
-
const e =
|
|
1311
|
-
return
|
|
744
|
+
function cn() {
|
|
745
|
+
const e = j(), n = x();
|
|
746
|
+
return B(e), R(n), d(() => ({
|
|
1312
747
|
configuration: n,
|
|
1313
|
-
restoreConfiguration: (
|
|
748
|
+
restoreConfiguration: (s) => e.restoreConfiguration(s)
|
|
1314
749
|
}), [n, e]);
|
|
1315
750
|
}
|
|
1316
751
|
export {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
752
|
+
an as Configuration,
|
|
753
|
+
un as ConfigurationSuspender,
|
|
754
|
+
nn as useAttributes,
|
|
755
|
+
on as useBooleanAttribute,
|
|
756
|
+
sn as useChoiceAttribute,
|
|
757
|
+
rn as useComponentAttribute,
|
|
758
|
+
cn as useConfiguration,
|
|
759
|
+
Ke as useConfigurationInitialization,
|
|
760
|
+
ln as useConfigurationUpdating,
|
|
761
|
+
z as useDecision,
|
|
762
|
+
qe as useExplain,
|
|
763
|
+
tn as useNumericAttribute
|
|
1329
764
|
};
|