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

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