@picked/client 0.0.1-dev.1770256874555 → 0.0.1-dev.1770787109735

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.
@@ -1,108 +1,113 @@
1
- import { g as f } from "../../../id-BW-g3y32.js";
2
- const r = {
1
+ import { g as N } from "../../../id-BW-g3y32.js";
2
+ const a = {
3
3
  serialize(e) {
4
4
  return JSON.stringify(e);
5
5
  },
6
6
  deserialize(e) {
7
7
  return JSON.parse(e);
8
8
  }
9
- }, x = (e) => ({
9
+ }, v = (e) => ({
10
10
  name: "create-experience",
11
- setup: (o) => {
12
- e.experiences.forEach((s) => {
13
- const n = s.serialize(), d = r.deserialize(n);
14
- d.component = s.component, o.registerExperience(d), d.fields.forEach((N) => {
15
- o.registerField(N);
16
- });
11
+ setup: (n) => {
12
+ Promise.all(
13
+ e.experiences.map(async (d) => {
14
+ const s = d.serialize(), r = a.deserialize(s);
15
+ r.component = d.component, n.registerExperience(r), r.fields.forEach((h) => {
16
+ const p = d.fields.find((t) => t.id === h.id);
17
+ p && typeof p.options == "function" && (h.options = p.options), n.registerField(h);
18
+ });
19
+ })
20
+ ).catch((d) => {
21
+ throw new Error(`Failed to create experiences: ${d}`);
17
22
  });
18
23
  }
19
- }), y = (e, o) => ({
20
- id: f("node"),
24
+ }), z = (e, n) => ({
25
+ id: N("node"),
21
26
  position: [0, 0],
22
- experience: o,
27
+ experience: n,
23
28
  type: "action",
24
29
  action: e.action,
25
- addNext(n) {
26
- if (!n.node) throw new Error("Cannot connect to node");
27
- const d = h(
28
- { sourceNode: this, destinationNode: n.node, sourceNodeHandle: null },
29
- o
30
+ addNext(s) {
31
+ if (!s.node) throw new Error("Cannot connect to node");
32
+ const r = u(
33
+ { sourceNode: this, destinationNode: s.node, sourceNodeHandle: null },
34
+ n
30
35
  );
31
- o.edges.push(d);
36
+ n.edges.push(r);
32
37
  },
33
- onSuccess(n) {
34
- if (!n.node) throw new Error("Cannot connect to node");
35
- const d = h(
36
- { sourceNode: this, destinationNode: n.node, sourceNodeHandle: "true" },
37
- o
38
+ onSuccess(s) {
39
+ if (!s.node) throw new Error("Cannot connect to node");
40
+ const r = u(
41
+ { sourceNode: this, destinationNode: s.node, sourceNodeHandle: "true" },
42
+ n
38
43
  );
39
- o.edges.push(d);
44
+ n.edges.push(r);
40
45
  },
41
- onFail(n) {
42
- if (!n.node) throw new Error("Cannot connect to node");
43
- const d = h(
44
- { sourceNode: this, destinationNode: n.node, sourceNodeHandle: "false" },
45
- o
46
+ onFail(s) {
47
+ if (!s.node) throw new Error("Cannot connect to node");
48
+ const r = u(
49
+ { sourceNode: this, destinationNode: s.node, sourceNodeHandle: "false" },
50
+ n
46
51
  );
47
- o.edges.push(d);
52
+ n.edges.push(r);
48
53
  },
49
54
  serialize() {
50
- return r.serialize({
55
+ return a.serialize({
51
56
  id: this.id,
52
57
  type: this.type,
53
58
  action: this.action,
54
59
  position: this.position
55
60
  });
56
61
  }
57
- }), V = (e) => ({
58
- id: e.id ?? f("step"),
62
+ }), E = (e) => ({
63
+ id: e.id ?? N("step"),
59
64
  label: e.label,
60
65
  fields: e.fields ?? [],
61
- addField(o) {
62
- const s = "serialize" in o ? o : m(o);
63
- return this.fields?.includes(s) || this.fields?.push(s), s;
66
+ addField(n) {
67
+ const d = "serialize" in n ? n : m(n);
68
+ return this.fields?.includes(d) || this.fields?.push(d), d;
64
69
  }
65
- }), z = (e, o) => {
66
- const s = {
67
- id: e.id ?? f("step"),
70
+ }), g = (e, n) => {
71
+ const d = {
72
+ id: e.id ?? N("step"),
68
73
  label: e.label,
69
- experience: o,
74
+ experience: n,
70
75
  fields: e.fields ?? [],
71
76
  node: null,
72
- nextStep(n) {
73
- return this.experience.addStep(n, this);
77
+ nextStep(s) {
78
+ return this.experience.addStep(s, this);
74
79
  },
75
- nextConditional(n) {
76
- return this.experience.addConditional(n, this);
80
+ nextConditional(s) {
81
+ return this.experience.addConditional(s, this);
77
82
  },
78
- addNextExperience(n) {
79
- return this.experience.addExperience(n, this);
83
+ addNextExperience(s) {
84
+ return this.experience.addExperience(s, this);
80
85
  },
81
- addField(n) {
82
- return this.experience.addField(n, this);
86
+ addField(s) {
87
+ return this.experience.addField(s, this);
83
88
  },
84
89
  serialize() {
85
- return r.serialize({
90
+ return a.serialize({
86
91
  id: this.id,
87
92
  label: this.label,
88
- fieldIds: this.fields.map((n) => n.id)
93
+ fieldIds: this.fields.map((s) => s.id)
89
94
  });
90
95
  }
91
96
  };
92
- return p({ step: s, type: "step" }, o), s;
93
- }, g = () => [0, 0], p = (e, o) => {
94
- const s = {
95
- id: f("node"),
96
- position: g(),
97
- experience: o
97
+ return f({ step: d, type: "step" }, n), d;
98
+ }, b = () => [0, 0], f = (e, n) => {
99
+ const d = {
100
+ id: N("node"),
101
+ position: b(),
102
+ experience: n
98
103
  };
99
104
  if (e.type === "step") {
100
- const d = {
101
- ...s,
105
+ const r = {
106
+ ...d,
102
107
  type: "step",
103
108
  connectedStep: e.step,
104
109
  serialize() {
105
- return r.serialize({
110
+ return a.serialize({
106
111
  id: this.id,
107
112
  type: this.type,
108
113
  stepId: this.connectedStep.id,
@@ -111,15 +116,15 @@ const r = {
111
116
  });
112
117
  }
113
118
  };
114
- return d.connectedStep.node = d, d;
119
+ return r.connectedStep.node = r, r;
115
120
  }
116
121
  if (e.type === "conditional") {
117
- const d = {
118
- ...s,
122
+ const r = {
123
+ ...d,
119
124
  type: "conditional",
120
125
  connectedConditional: e.conditional,
121
126
  serialize() {
122
- return r.serialize({
127
+ return a.serialize({
123
128
  id: this.id,
124
129
  type: this.type,
125
130
  conditionalId: this.connectedConditional.id,
@@ -127,14 +132,14 @@ const r = {
127
132
  });
128
133
  }
129
134
  };
130
- return d.connectedConditional.node = d, d;
135
+ return r.connectedConditional.node = r, r;
131
136
  }
132
137
  return e.type === "experience" ? {
133
- ...s,
138
+ ...d,
134
139
  type: "experience",
135
140
  connectedExperience: e.experience,
136
141
  serialize() {
137
- return r.serialize({
142
+ return a.serialize({
138
143
  id: this.id,
139
144
  type: this.type,
140
145
  experienceId: this.connectedExperience.id,
@@ -142,307 +147,306 @@ const r = {
142
147
  });
143
148
  }
144
149
  } : {
145
- ...s,
150
+ ...d,
146
151
  type: "origin",
147
152
  serialize() {
148
- return r.serialize({
153
+ return a.serialize({
149
154
  id: this.id,
150
155
  type: this.type,
151
156
  position: this.position
152
157
  });
153
158
  }
154
159
  };
155
- }, h = (e, o) => ({
156
- id: f("edge"),
160
+ }, u = (e, n) => ({
161
+ id: N("edge"),
157
162
  sourceNode: e.sourceNode,
158
163
  sourceNodeHandle: e.sourceNodeHandle,
159
164
  destinationNode: e.destinationNode,
160
- experience: o,
165
+ experience: n,
161
166
  serialize() {
162
- return r.serialize({
167
+ return a.serialize({
163
168
  id: this.id,
164
169
  sourceNodeHandle: this.sourceNodeHandle ?? void 0,
165
170
  sourceNodeId: this.sourceNode.id,
166
171
  destinationNodeId: this.destinationNode.id
167
172
  });
168
173
  }
169
- }), b = (e, o) => {
170
- const s = {
171
- id: f("conditional"),
174
+ }), x = (e, n) => {
175
+ const d = {
176
+ id: N("conditional"),
172
177
  condition: e.condition,
173
178
  node: null,
174
- experience: o,
175
- addTrue(n) {
176
- if (!this.node || !n.node)
179
+ experience: n,
180
+ addTrue(s) {
181
+ if (!this.node || !s.node)
177
182
  throw new Error("todo no node");
178
- const d = h(
179
- { sourceNode: this.node, destinationNode: n.node, sourceNodeHandle: "true" },
183
+ const r = u(
184
+ { sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "true" },
180
185
  this.experience
181
186
  );
182
- this.experience.edges.push(d);
187
+ this.experience.edges.push(r);
183
188
  },
184
- addFalse(n) {
185
- if (!this.node || !n.node)
189
+ addFalse(s) {
190
+ if (!this.node || !s.node)
186
191
  throw new Error("todo no node");
187
- const d = h(
188
- { sourceNode: this.node, destinationNode: n.node, sourceNodeHandle: "false" },
192
+ const r = u(
193
+ { sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "false" },
189
194
  this.experience
190
195
  );
191
- this.experience.edges.push(d);
196
+ this.experience.edges.push(r);
192
197
  },
193
198
  serialize() {
194
- return r.serialize({
199
+ return a.serialize({
195
200
  id: this.id,
196
201
  condition: this.condition
197
202
  });
198
203
  }
199
204
  };
200
- return p({ conditional: s, type: "conditional" }, o), s;
201
- }, m = (e) => ({
202
- id: e.id,
203
- name: e.name,
204
- type: e.type,
205
- label: e.label,
206
- placeholder: e.placeholder,
207
- description: e.description,
208
- helpText: e.helpText,
209
- defaultValue: e.defaultValue ?? null,
210
- multiple: e.multiple,
211
- validation: e.validation ?? {},
212
- condition: e.condition,
213
- required: e.required,
214
- options: e.options?.map((s) => ({
215
- ...s
216
- })) ?? null,
217
- policies: e.policies,
218
- serialize() {
219
- const s = {
220
- id: this.id,
221
- name: this.name,
222
- label: this.label,
223
- placeholder: this.placeholder,
224
- required: this.required,
225
- description: this.description,
226
- helpText: this.helpText,
227
- validation: this.validation,
228
- condition: this.condition,
229
- policies: this.policies
230
- }, n = typeof this.defaultValue == "string" ? this.defaultValue : void 0, d = typeof this.defaultValue == "number" ? this.defaultValue : void 0, N = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
231
- switch (this.type) {
232
- case "text":
233
- if (this.multiple) {
234
- let t;
235
- if (Array.isArray(this.defaultValue)) {
236
- t = [];
237
- for (const i of this.defaultValue)
238
- typeof i == "string" && t.push(i);
239
- t.length === 0 && (t = void 0);
205
+ return f({ conditional: d, type: "conditional" }, n), d;
206
+ };
207
+ function y(e, n) {
208
+ if (e === null) return null;
209
+ if (typeof e == "function") {
210
+ const d = e;
211
+ return async () => (await Promise.resolve(d())).map(n);
212
+ }
213
+ return e.map(n);
214
+ }
215
+ const m = (e) => {
216
+ const n = typeof e.options == "function";
217
+ return {
218
+ id: e.id,
219
+ name: e.name,
220
+ type: e.type,
221
+ label: e.label,
222
+ placeholder: e.placeholder,
223
+ description: e.description,
224
+ helpText: e.helpText,
225
+ defaultValue: e.defaultValue ?? null,
226
+ multiple: e.multiple,
227
+ validation: e.validation ?? {},
228
+ condition: e.condition,
229
+ required: e.required,
230
+ options: n ? e.options : e.options ? e.options.map((s) => ({
231
+ ...s
232
+ })) : null,
233
+ policies: e.policies,
234
+ serialize() {
235
+ const s = {
236
+ id: this.id,
237
+ name: this.name,
238
+ label: this.label,
239
+ placeholder: this.placeholder,
240
+ required: this.required,
241
+ description: this.description,
242
+ helpText: this.helpText,
243
+ validation: this.validation,
244
+ condition: this.condition,
245
+ policies: this.policies
246
+ }, r = typeof this.defaultValue == "string" ? this.defaultValue : void 0, h = typeof this.defaultValue == "number" ? this.defaultValue : void 0, p = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
247
+ switch (this.type) {
248
+ case "text": {
249
+ const t = y(this.options, (i) => ({
250
+ id: i.id,
251
+ label: i.label,
252
+ value: `${i.value}`,
253
+ condition: i.condition
254
+ }));
255
+ if (this.multiple) {
256
+ let i;
257
+ if (Array.isArray(this.defaultValue)) {
258
+ i = [];
259
+ for (const o of this.defaultValue)
260
+ typeof o == "string" && i.push(o);
261
+ i.length === 0 && (i = void 0);
262
+ }
263
+ return a.serialize({
264
+ ...s,
265
+ type: "text",
266
+ multiple: !0,
267
+ defaultValue: i,
268
+ options: t
269
+ });
240
270
  }
241
- return r.serialize({
271
+ return a.serialize({
242
272
  ...s,
243
273
  type: "text",
244
- multiple: !0,
245
- defaultValue: t,
246
- options: this.options ? this.options.map((i) => ({
247
- id: i.id,
248
- label: i.label,
249
- value: `${i.value}`,
250
- condition: i.condition
251
- })) : null
274
+ multiple: !1,
275
+ defaultValue: r,
276
+ options: t
252
277
  });
253
278
  }
254
- return r.serialize({
255
- ...s,
256
- type: "text",
257
- multiple: !1,
258
- defaultValue: n,
259
- options: this.options ? this.options.map((t) => ({
260
- id: t.id,
261
- label: t.label,
262
- value: `${t.value}`,
263
- condition: t.condition
264
- })) : null
265
- });
266
- case "number":
267
- if (this.multiple) {
268
- let t;
269
- if (Array.isArray(this.defaultValue)) {
270
- t = [];
271
- for (const i of this.defaultValue)
272
- typeof i == "number" && t.push(i);
273
- t.length === 0 && (t = void 0);
279
+ case "number": {
280
+ const t = y(this.options, (i) => ({
281
+ id: i.id,
282
+ label: i.label,
283
+ value: Number(i.value),
284
+ condition: i.condition
285
+ }));
286
+ if (this.multiple) {
287
+ let i;
288
+ if (Array.isArray(this.defaultValue)) {
289
+ i = [];
290
+ for (const o of this.defaultValue)
291
+ typeof o == "number" && i.push(o);
292
+ i.length === 0 && (i = void 0);
293
+ }
294
+ return a.serialize({
295
+ ...s,
296
+ type: "number",
297
+ multiple: !0,
298
+ defaultValue: i,
299
+ options: t
300
+ });
274
301
  }
275
- return r.serialize({
302
+ return a.serialize({
276
303
  ...s,
277
304
  type: "number",
278
- multiple: !0,
279
- defaultValue: t,
280
- options: this.options ? this.options.map((i) => ({
281
- id: i.id,
282
- label: i.label,
283
- value: Number(i.value),
284
- condition: i.condition
285
- })) : null
305
+ multiple: !1,
306
+ defaultValue: h,
307
+ options: t
286
308
  });
287
309
  }
288
- return r.serialize({
289
- ...s,
290
- type: "number",
291
- multiple: !1,
292
- defaultValue: d,
293
- options: this.options ? this.options.map((t) => ({
294
- id: t.id,
295
- label: t.label,
296
- value: Number(t.value),
297
- condition: t.condition
298
- })) : null
299
- });
300
- case "boolean":
301
- if (this.multiple) {
302
- let t;
303
- if (Array.isArray(this.defaultValue)) {
304
- t = [];
305
- for (const i of this.defaultValue)
306
- typeof i == "boolean" && t.push(i);
307
- t.length === 0 && (t = void 0);
310
+ case "boolean": {
311
+ const t = y(this.options, (i) => ({
312
+ id: i.id,
313
+ label: i.label,
314
+ value: !!i.value,
315
+ condition: i.condition
316
+ }));
317
+ if (this.multiple) {
318
+ let i;
319
+ if (Array.isArray(this.defaultValue)) {
320
+ i = [];
321
+ for (const o of this.defaultValue)
322
+ typeof o == "boolean" && i.push(o);
323
+ i.length === 0 && (i = void 0);
324
+ }
325
+ return a.serialize({
326
+ ...s,
327
+ type: "boolean",
328
+ multiple: !0,
329
+ defaultValue: i,
330
+ options: t
331
+ });
308
332
  }
309
- return r.serialize({
333
+ return a.serialize({
310
334
  ...s,
311
335
  type: "boolean",
336
+ multiple: !1,
337
+ defaultValue: p,
338
+ options: t
339
+ });
340
+ }
341
+ case "object": {
342
+ const t = y(this.options, (i) => ({
343
+ id: i.id,
344
+ label: i.label,
345
+ description: i.description,
346
+ value: i.value,
347
+ condition: i.condition
348
+ }));
349
+ return this.multiple ? a.serialize({
350
+ ...s,
351
+ type: "object",
312
352
  multiple: !0,
313
- defaultValue: t,
314
- options: this.options ? this.options.map((i) => ({
315
- id: i.id,
316
- label: i.label,
317
- value: !!i.value,
318
- condition: i.condition
319
- })) : null
353
+ defaultValue: this.defaultValue,
354
+ options: t
355
+ }) : a.serialize({
356
+ ...s,
357
+ type: "object",
358
+ multiple: !1,
359
+ defaultValue: this.defaultValue,
360
+ options: t
320
361
  });
321
362
  }
322
- return r.serialize({
323
- ...s,
324
- type: "boolean",
325
- multiple: !1,
326
- defaultValue: N,
327
- options: this.options ? this.options.map((t) => ({
328
- id: t.id,
329
- label: t.label,
330
- value: !!t.value,
331
- condition: t.condition
332
- })) : null
333
- });
334
- case "object":
335
- return this.multiple ? r.serialize({
336
- ...s,
337
- type: "object",
338
- multiple: !0,
339
- defaultValue: this.defaultValue,
340
- options: this.options ? this.options.map((t) => ({
341
- id: t.id,
342
- label: t.label,
343
- description: t.description,
344
- value: t.value,
345
- condition: t.condition
346
- })) : null
347
- }) : r.serialize({
348
- ...s,
349
- type: "object",
350
- multiple: !1,
351
- defaultValue: this.defaultValue,
352
- options: this.options ? this.options.map((t) => ({
353
- id: t.id,
354
- label: t.label,
355
- description: t.description,
356
- value: t.value,
357
- condition: t.condition
358
- })) : null
359
- });
360
- default:
361
- throw new Error("Unsupported field type");
363
+ default:
364
+ throw new Error("Unsupported field type");
365
+ }
362
366
  }
363
- }
364
- }), E = (e) => {
365
- const o = [], s = [], n = [], d = [], N = [], t = e.condition ?? e.decide;
367
+ };
368
+ }, w = (e) => {
369
+ const n = [], d = [], s = [], r = [], h = [], p = e.condition ?? e.decide;
366
370
  return {
367
371
  id: e.id,
368
372
  component: e.component,
369
373
  name: e.name,
370
374
  initializeOpen: e.initializeOpen,
371
- condition: t,
375
+ condition: p,
372
376
  decide: e.decide,
373
377
  targets: e.targets,
374
- steps: o,
375
- nodes: s,
376
- edges: n,
377
- fields: N,
378
- conditionals: d,
379
- addStep(i, u) {
380
- let l = u?.node;
381
- this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
382
- const a = "serialize" in i ? i : z(i, this);
383
- if (l) {
384
- if (!a.node)
378
+ steps: n,
379
+ nodes: d,
380
+ edges: s,
381
+ fields: h,
382
+ conditionals: r,
383
+ addStep(t, i) {
384
+ let o = i?.node;
385
+ this.nodes.length === 0 && (o = f({ type: "origin" }, this), this.nodes.push(o));
386
+ const l = "serialize" in t ? t : g(t, this);
387
+ if (o) {
388
+ if (!l.node)
385
389
  throw new Error("todo no node");
386
- const c = h(
387
- { sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
390
+ const c = u(
391
+ { sourceNode: o, destinationNode: l.node, sourceNodeHandle: null },
388
392
  this
389
393
  );
390
394
  this.edges.push(c);
391
395
  }
392
- return a.fields.length > 0 && a.fields.forEach((c) => {
396
+ return l.fields.length > 0 && l.fields.forEach((c) => {
393
397
  this.fields.includes(c) || this.fields.push(c);
394
- }), this.steps.includes(a) || (this.steps.push(a), a.node && this.nodes.push(a.node)), a;
398
+ }), this.steps.includes(l) || (this.steps.push(l), l.node && this.nodes.push(l.node)), l;
395
399
  },
396
- addAction(i, u) {
397
- let l = u?.node;
398
- this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
399
- const a = "serialize" in i ? i : y(i, this);
400
- if (l) {
401
- const c = h(
402
- { sourceNode: l, destinationNode: a, sourceNodeHandle: null },
400
+ addAction(t, i) {
401
+ let o = i?.node;
402
+ this.nodes.length === 0 && (o = f({ type: "origin" }, this), this.nodes.push(o));
403
+ const l = "serialize" in t ? t : z(t, this);
404
+ if (o) {
405
+ const c = u(
406
+ { sourceNode: o, destinationNode: l, sourceNodeHandle: null },
403
407
  this
404
408
  );
405
409
  this.edges.push(c);
406
410
  }
407
- return this.nodes.push(a), a;
411
+ return this.nodes.push(l), l;
408
412
  },
409
- addConditional(i, u) {
410
- let l = u?.node;
411
- this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
412
- const a = "serialize" in i ? i : b(i, this);
413
- if (l) {
414
- if (!a.node)
413
+ addConditional(t, i) {
414
+ let o = i?.node;
415
+ this.nodes.length === 0 && (o = f({ type: "origin" }, this), this.nodes.push(o));
416
+ const l = "serialize" in t ? t : x(t, this);
417
+ if (o) {
418
+ if (!l.node)
415
419
  throw new Error("todo no node");
416
- const c = h(
417
- { sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
420
+ const c = u(
421
+ { sourceNode: o, destinationNode: l.node, sourceNodeHandle: null },
418
422
  this
419
423
  );
420
424
  this.edges.push(c);
421
425
  }
422
- return this.conditionals.includes(a) || (this.conditionals.push(a), a.node && this.nodes.push(a.node)), a;
426
+ return this.conditionals.includes(l) || (this.conditionals.push(l), l.node && this.nodes.push(l.node)), l;
423
427
  },
424
- addExperience(i, u) {
425
- let l = u?.node;
426
- this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
427
- const a = p(
428
- { type: "experience", experience: i },
428
+ addExperience(t, i) {
429
+ let o = i?.node;
430
+ this.nodes.length === 0 && (o = f({ type: "origin" }, this), this.nodes.push(o));
431
+ const l = f(
432
+ { type: "experience", experience: t },
429
433
  this
430
434
  );
431
- if (this.nodes.push(a), l) {
432
- const c = h(
433
- { sourceNode: l, destinationNode: a, sourceNodeHandle: null },
435
+ if (this.nodes.push(l), o) {
436
+ const c = u(
437
+ { sourceNode: o, destinationNode: l, sourceNodeHandle: null },
434
438
  this
435
439
  );
436
440
  this.edges.push(c);
437
441
  }
438
- return i;
442
+ return t;
439
443
  },
440
- addField(i, u) {
441
- const l = "serialize" in i ? i : m(i);
442
- return u && u.fields.push(l), this.fields.includes(l) || this.fields.push(l), l;
444
+ addField(t, i) {
445
+ const o = "serialize" in t ? t : m(t);
446
+ return i && i.fields.push(o), this.fields.includes(o) || this.fields.push(o), o;
443
447
  },
444
448
  serialize() {
445
- return r.serialize({
449
+ return a.serialize({
446
450
  id: this.id,
447
451
  component: this.component,
448
452
  name: this.name,
@@ -450,24 +454,24 @@ const r = {
450
454
  condition: this.condition ?? this.decide,
451
455
  decide: this.decide,
452
456
  targets: this.targets,
453
- steps: this.steps.map((i) => r.deserialize(i.serialize())),
454
- nodes: this.nodes.map((i) => r.deserialize(i.serialize())),
455
- edges: this.edges.map((i) => r.deserialize(i.serialize())),
457
+ steps: this.steps.map((t) => a.deserialize(t.serialize())),
458
+ nodes: this.nodes.map((t) => a.deserialize(t.serialize())),
459
+ edges: this.edges.map((t) => a.deserialize(t.serialize())),
456
460
  conditionals: this.conditionals.map(
457
- (i) => r.deserialize(i.serialize())
461
+ (t) => a.deserialize(t.serialize())
458
462
  ),
459
- fields: this.fields.map((i) => r.deserialize(i.serialize()))
463
+ fields: this.fields.map((t) => a.deserialize(t.serialize()))
460
464
  });
461
465
  }
462
466
  };
463
467
  };
464
468
  export {
465
- b as createConditional,
466
- h as createEdge,
467
- E as createExperience,
468
- x as createExperiencePlugin,
469
+ x as createConditional,
470
+ u as createEdge,
471
+ w as createExperience,
472
+ v as createExperiencePlugin,
469
473
  m as createField,
470
- p as createNode,
471
- V as createStep,
472
- r as serialization
474
+ f as createNode,
475
+ E as createStep,
476
+ a as serialization
473
477
  };