@picked/client 0.0.1-dev.1772412203098 → 0.0.1-dev.1773363643396

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/api-C7ddxkUx.cjs +1 -0
  2. package/dist/api-CQ_YBH_c.js +32 -0
  3. package/dist/cjs/index.js +2 -2
  4. package/dist/cjs/plugins/create-experience/index.js +1 -1
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  7. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  8. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  9. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  10. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  11. package/dist/cjs/server/index.js +1 -1
  12. package/dist/esm/index.js +602 -687
  13. package/dist/esm/plugins/create-experience/index.js +237 -213
  14. package/dist/esm/plugins/dynamic-experiences/index.js +65 -43
  15. package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
  16. package/dist/esm/plugins/history-browser-storage/index.js +1 -1
  17. package/dist/esm/plugins/responses-browser-storage/index.js +18 -17
  18. package/dist/esm/plugins/responses-indexeddb/index.js +46 -51
  19. package/dist/esm/plugins/single-page-app/index.js +24 -24
  20. package/dist/esm/server/index.js +1 -1
  21. package/dist/experience-instance-BsXG5XJ4.cjs +1 -0
  22. package/dist/{experience-instance-DTyL1fNb.js → experience-instance-fvSEb72i.js} +199 -205
  23. package/dist/object-BbFTsGh3.cjs +1 -0
  24. package/dist/{object-CJssU1Pm.js → object-JwZ58NOH.js} +1 -1
  25. package/dist/storage-Be5xWNPC.cjs +1 -0
  26. package/dist/{storage-B2d81EOI.js → storage-Co_LbKr_.js} +30 -35
  27. package/dist/to-kebab-case-BPnCZjhB.js +6 -0
  28. package/dist/to-kebab-case-BsOQ8CON.cjs +1 -0
  29. package/dist/types/client.d.ts +13 -0
  30. package/dist/types/client.d.ts.map +1 -1
  31. package/dist/types/entities/action/action.d.ts +2 -5
  32. package/dist/types/entities/action/action.d.ts.map +1 -1
  33. package/dist/types/entities/experience/experience.d.ts +31 -17
  34. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  35. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  36. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  37. package/dist/types/entities/field/field.d.ts +21 -52
  38. package/dist/types/entities/field/field.d.ts.map +1 -1
  39. package/dist/types/entities/history/history.d.ts.map +1 -1
  40. package/dist/types/entities/project/project.d.ts.map +1 -1
  41. package/dist/types/entities/response/response.d.ts +6 -6
  42. package/dist/types/entities/response/response.d.ts.map +1 -1
  43. package/dist/types/index.d.ts +0 -1
  44. package/dist/types/index.d.ts.map +1 -1
  45. package/dist/types/logic-engine.d.ts +8 -2
  46. package/dist/types/logic-engine.d.ts.map +1 -1
  47. package/dist/types/picked.d.ts +17 -23
  48. package/dist/types/picked.d.ts.map +1 -1
  49. package/dist/types/plugins/create-experience/create-experience.d.ts +28 -33
  50. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  51. package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -0
  52. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
  53. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +2 -2
  54. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  55. package/dist/types/plugins/dynamic-experiences/types.d.ts +7 -1
  56. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  57. package/dist/types/plugins/experience-browser-storage/plugin.d.ts +1 -2
  58. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  59. package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -2
  60. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  61. package/dist/types/plugins/responses-browser-storage/plugin.d.ts +1 -2
  62. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
  63. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
  64. package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
  65. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  66. package/dist/types/utils/api.d.ts +1 -1
  67. package/dist/types/utils/api.d.ts.map +1 -1
  68. package/dist/types/utils/client-headers.d.ts +2 -0
  69. package/dist/types/utils/client-headers.d.ts.map +1 -0
  70. package/dist/types/utils/dom.d.ts +3 -0
  71. package/dist/types/utils/dom.d.ts.map +1 -1
  72. package/dist/types/utils/events.d.ts +1 -1
  73. package/dist/types/utils/events.d.ts.map +1 -1
  74. package/dist/types/utils/get-step-fields.d.ts +1 -2
  75. package/dist/types/utils/get-step-fields.d.ts.map +1 -1
  76. package/dist/types/utils/global-obj.d.ts +1 -0
  77. package/dist/types/utils/global-obj.d.ts.map +1 -1
  78. package/dist/types/utils/indexed-db.d.ts +1 -2
  79. package/dist/types/utils/indexed-db.d.ts.map +1 -1
  80. package/dist/types/utils/logger.d.ts.map +1 -1
  81. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
  82. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
  83. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
  84. package/dist/types/utils/object.d.ts +8 -0
  85. package/dist/types/utils/object.d.ts.map +1 -1
  86. package/dist/types/utils/picked-config.d.ts +1 -1
  87. package/dist/types/utils/picked-config.d.ts.map +1 -1
  88. package/dist/types/utils/rules-logic.d.ts.map +1 -1
  89. package/dist/types/utils/search-params.d.ts.map +1 -1
  90. package/dist/types/utils/storage.d.ts.map +1 -1
  91. package/dist/types/utils/to-kebab-case.d.ts +9 -0
  92. package/dist/types/utils/to-kebab-case.d.ts.map +1 -0
  93. package/package.json +59 -8
  94. package/dist/api-CbXfbi_s.js +0 -19
  95. package/dist/api-DzSCgBQ2.cjs +0 -1
  96. package/dist/experience-instance-BX0aqKsC.cjs +0 -1
  97. package/dist/object-mwaxtjLG.cjs +0 -1
  98. package/dist/storage-58NoTSsc.cjs +0 -1
@@ -1,15 +1,15 @@
1
- import { createDomain as kt, createEvent as b, combine as D, createApi as lt, createEffect as B, attach as O, sample as S, split as bt } from "effector";
1
+ import { createDomain as kt, createEvent as k, combine as D, createApi as lt, createEffect as _, attach as O, sample as m, split as bt } from "effector";
2
2
  import { createFactory as dt, invoke as pt } from "@withease/factories";
3
3
  import { a as vt, s as gt, j as At } from "./supports-8YT4QKI7.js";
4
4
  import { l as I } from "./logger-C9a75KZn.js";
5
- import { i as Ot } from "./object-CJssU1Pm.js";
5
+ import { i as Ot } from "./object-JwZ58NOH.js";
6
6
  function Ft(t) {
7
7
  return typeof t == "number" && !isNaN(t);
8
8
  }
9
9
  function j(t) {
10
10
  return typeof t == "string";
11
11
  }
12
- function E(t) {
12
+ function N(t) {
13
13
  return Array.isArray(t);
14
14
  }
15
15
  function mt(t) {
@@ -18,7 +18,7 @@ function mt(t) {
18
18
  function st(t) {
19
19
  return typeof t == "object" && t !== null && !Array.isArray(t) && Object.keys(t).length === 1;
20
20
  }
21
- function m(t) {
21
+ function g(t) {
22
22
  if (Ft(t)) return t;
23
23
  const e = parseFloat(`${t}`);
24
24
  return isNaN(e) ? 0 : e;
@@ -26,39 +26,39 @@ function m(t) {
26
26
  function R(t) {
27
27
  return `${t}`;
28
28
  }
29
- const _t = {
29
+ const Bt = {
30
30
  // eslint-disable-next-line eqeqeq
31
31
  "==": (t, e) => t == e,
32
32
  "===": (t, e) => t === e,
33
33
  // eslint-disable-next-line eqeqeq
34
34
  "!=": (t, e) => t != e,
35
35
  "!==": (t, e) => t !== e,
36
- ">": (t, e) => m(t) > m(e),
37
- ">=": (t, e) => m(t) >= m(e),
36
+ ">": (t, e) => g(t) > g(e),
37
+ ">=": (t, e) => g(t) >= g(e),
38
38
  "<": (t, e, r) => {
39
- const n = m(t), s = m(e);
39
+ const n = g(t), s = g(e);
40
40
  if (r === void 0) return n < s;
41
- const a = m(r);
41
+ const a = g(r);
42
42
  return n < s && s < a;
43
43
  },
44
44
  "<=": (t, e, r) => {
45
- const n = m(t), s = m(e);
45
+ const n = g(t), s = g(e);
46
46
  if (r === void 0) return n <= s;
47
- const a = m(r);
47
+ const a = g(r);
48
48
  return n <= s && s <= a;
49
49
  },
50
50
  "!!": async (t) => await v(t),
51
51
  "!": async (t) => !await v(t),
52
- "%": (t, e) => m(t) % m(e),
52
+ "%": (t, e) => g(t) % g(e),
53
53
  // eslint-disable-next-line sonarjs/function-return-type
54
54
  log: (t) => (console.log(t), t),
55
- in: (t, e) => e ? j(e) ? e.indexOf(R(t)) !== -1 : E(e) ? e.includes(t) : !1 : !1,
55
+ in: (t, e) => e ? j(e) ? e.indexOf(R(t)) !== -1 : N(e) ? e.includes(t) : !1 : !1,
56
56
  cat: (...t) => t.map(R).join(""),
57
57
  /* eslint-disable sonarjs/deprecation */
58
58
  substr: (t, e, r) => {
59
- const n = R(t), s = m(e);
59
+ const n = R(t), s = g(e);
60
60
  if (r === void 0) return n.substr(s);
61
- const a = m(r);
61
+ const a = g(r);
62
62
  if (a < 0) {
63
63
  const o = n.substr(s);
64
64
  return o.substr(0, o.length + a);
@@ -66,17 +66,16 @@ const _t = {
66
66
  return n.substr(s, a);
67
67
  },
68
68
  /* eslint-enable sonarjs/deprecation */
69
- "+": (...t) => t.reduce((e, r) => m(e) + m(r), 0),
70
- "*": (...t) => t.reduce((e, r) => m(e) * m(r), 1),
69
+ "+": (...t) => t.reduce((e, r) => g(e) + g(r), 0),
70
+ "*": (...t) => t.reduce((e, r) => g(e) * g(r), 1),
71
71
  "-": (t, e) => {
72
- const r = m(t);
73
- return e === void 0 ? -r : r - m(e);
72
+ const r = g(t);
73
+ return e === void 0 ? -r : r - g(e);
74
74
  },
75
- "/": (t, e) => m(t) / m(e),
76
- min: (...t) => Math.min(...t.map(m)),
77
- max: (...t) => Math.max(...t.map(m)),
78
- merge: (...t) => t.reduce((e, r) => E(r) ? e.concat(r) : e.concat([r]), []),
79
- // eslint-disable-next-line sonarjs/cognitive-complexity -- JSONLogic var operator requires complex path traversal logic
75
+ "/": (t, e) => g(t) / g(e),
76
+ min: (...t) => Math.min(...t.map(g)),
77
+ max: (...t) => Math.max(...t.map(g)),
78
+ merge: (...t) => t.reduce((e, r) => N(r) ? e.concat(r) : e.concat([r]), []),
80
79
  var(t, e) {
81
80
  const r = arguments.length > 1 ? e : null;
82
81
  if (t === "" || t === "." || t === null || t === void 0)
@@ -92,15 +91,15 @@ const _t = {
92
91
  if (a == null)
93
92
  return r;
94
93
  if (Array.isArray(a)) {
95
- const f = parseInt(o, 10);
96
- isNaN(f) ? a = a[o] : a = a[f];
94
+ const u = parseInt(o, 10);
95
+ isNaN(u) ? a = a[o] : a = a[u];
97
96
  } else
98
97
  a = a[o];
99
98
  }
100
99
  return a !== void 0 ? a : r;
101
100
  },
102
101
  async missing(...t) {
103
- const e = E(t[0]) ? t[0] : t, r = [];
102
+ const e = N(t[0]) ? t[0] : t, r = [];
104
103
  for (const n of e) {
105
104
  const s = await p({ var: n }, this);
106
105
  (s === null || s === "") && r.push(`${n}`);
@@ -109,9 +108,9 @@ const _t = {
109
108
  },
110
109
  async missing_some(t, e) {
111
110
  const r = await p({ missing: e }, this);
112
- if (!E(r) || !E(e)) return [];
111
+ if (!N(r) || !N(e)) return [];
113
112
  const n = r.filter(j);
114
- return e.filter(j).length - n.length >= m(t) ? [] : n;
113
+ return e.filter(j).length - n.length >= g(t) ? [] : n;
115
114
  },
116
115
  /**
117
116
  * Invoke operator - executes a function with optional arguments
@@ -131,7 +130,7 @@ const _t = {
131
130
  },
132
131
  regexp_matches(t, e) {
133
132
  let r = t, n = "";
134
- if (E(t)) {
133
+ if (N(t)) {
135
134
  const [a, o] = t;
136
135
  r = a, n = o;
137
136
  }
@@ -145,12 +144,12 @@ async function p(t, e) {
145
144
  if (!t) return t;
146
145
  if (mt(t))
147
146
  return p(await t, e);
148
- if (E(t))
147
+ if (N(t))
149
148
  return Promise.all(t.map((o) => p(o, e)));
150
149
  if (!st(t)) return t;
151
- const r = Bt(t);
150
+ const r = _t(t);
152
151
  let n = r ? t[r] ?? [] : [];
153
- switch (E(n) || (n = [n]), r) {
152
+ switch (N(n) || (n = [n]), r) {
154
153
  case "if":
155
154
  case "?:":
156
155
  for (let o = 0; o < n.length - 1; o += 2)
@@ -159,59 +158,59 @@ async function p(t, e) {
159
158
  return n.length % 2 === 1 ? p(n[n.length - 1], e) : null;
160
159
  case "and": {
161
160
  let o = null;
162
- for (const f of n)
163
- if (o = await p(f, e), !await v(o))
161
+ for (const u of n)
162
+ if (o = await p(u, e), !await v(o))
164
163
  return o;
165
164
  return o;
166
165
  }
167
166
  case "or": {
168
167
  let o = null;
169
- for (const f of n)
170
- if (o = await p(f, e), await v(o)) return o;
168
+ for (const u of n)
169
+ if (o = await p(u, e), await v(o)) return o;
171
170
  return o;
172
171
  }
173
172
  case "map": {
174
173
  const o = await p(n[0], e);
175
- return E(o) ? await Promise.all(o.map((f) => p(n[1], f))) : [];
174
+ return N(o) ? await Promise.all(o.map((u) => p(n[1], u))) : [];
176
175
  }
177
176
  case "filter": {
178
177
  const o = await p(n[0], e);
179
- return E(o) ? (await Promise.all(
178
+ return N(o) ? (await Promise.all(
180
179
  o.map(async (d) => {
181
- const g = await v(await p(n[1], d));
182
- return { item: d, shouldInclude: g };
180
+ const y = await v(await p(n[1], d));
181
+ return { item: d, shouldInclude: y };
183
182
  })
184
183
  )).filter(({ shouldInclude: d }) => d).map(({ item: d }) => d) : [];
185
184
  }
186
185
  case "reduce": {
187
186
  const o = await p(n[0], e);
188
- if (!E(o))
187
+ if (!N(o))
189
188
  return n.length > 2 ? await p(n[2], e) : null;
190
- const f = n[1];
191
- let g = n.length > 2 ? await p(n[2], e) : null;
192
- for (const x of o)
193
- g = await p(f, { current: x, accumulator: g });
194
- return g;
189
+ const u = n[1];
190
+ let y = n.length > 2 ? await p(n[2], e) : null;
191
+ for (const b of o)
192
+ y = await p(u, { current: b, accumulator: y });
193
+ return y;
195
194
  }
196
195
  case "all": {
197
196
  const o = await p(n[0], e);
198
- if (!E(o) || o.length === 0) return !1;
199
- for (const f of o)
200
- if (!await v(await p(n[1], f))) return !1;
197
+ if (!N(o) || o.length === 0) return !1;
198
+ for (const u of o)
199
+ if (!await v(await p(n[1], u))) return !1;
201
200
  return !0;
202
201
  }
203
202
  case "some": {
204
203
  const o = await p(n[0], e);
205
- if (!E(o)) return !1;
206
- for (const f of o)
207
- if (await v(await p(n[1], f))) return !0;
204
+ if (!N(o)) return !1;
205
+ for (const u of o)
206
+ if (await v(await p(n[1], u))) return !0;
208
207
  return !1;
209
208
  }
210
209
  case "none": {
211
210
  const o = await p(n[0], e);
212
- if (!E(o)) return !0;
213
- for (const f of o)
214
- if (await v(await p(n[1], f))) return !1;
211
+ if (!N(o)) return !0;
212
+ for (const u of o)
213
+ if (await v(await p(n[1], u))) return !1;
215
214
  return !0;
216
215
  }
217
216
  case "catch":
@@ -221,33 +220,31 @@ async function p(t, e) {
221
220
  return st(o) ? await p(o, e) : n[1] ? await p(n[1], o) : o instanceof Error ? o.message : o;
222
221
  }
223
222
  }
224
- const s = await Promise.all(n.map((o) => p(o, e))), a = r ? _t[r] : void 0;
223
+ const s = await Promise.all(n.map((o) => p(o, e))), a = r ? Bt[r] : void 0;
225
224
  if (!a) throw new Error(`Unrecognized operation ${r}`);
226
225
  return a.apply(e, s);
227
226
  }
228
227
  async function v(t) {
229
228
  return mt(t) ? v(await t) : !(Array.isArray(t) && t.length === 0) && !!t;
230
229
  }
231
- function Bt(t) {
230
+ function _t(t) {
232
231
  return Object.keys(t)[0];
233
232
  }
234
233
  function $t(t) {
235
234
  return !Ot(t);
236
235
  }
237
236
  async function at(t, e, r) {
238
- const n = t.getStateSnapshot(), s = t.predicates.listStore.getState().reduce((d, g) => ({
239
- ...d,
240
- [g.name]: (...x) => g.predicate({ ...n, args: x })
241
- }), {}), a = t.features.listStore.getState().reduce((d, g) => ({
242
- ...d,
243
- [g.id]: async () => {
244
- const { bucket: x } = await g.getBucket();
245
- return x;
237
+ const n = t.getStateSnapshot(), s = t.predicates.listStore.getState().reduce((u, d) => ({
238
+ ...u,
239
+ [d.name]: (...y) => d.predicate({ ...n, args: y })
240
+ }), {}), a = t.features.listStore.getState().reduce((u, d) => ({
241
+ ...u,
242
+ [d.id]: async () => {
243
+ const { bucket: y } = await d.getBucket();
244
+ return y;
246
245
  }
247
- }), {}), o = t.actions.listStore.getState().reduce((d, g) => ({
248
- ...d,
249
- [g.name]: (x) => g.action(x)
250
- }), {}), f = {
246
+ }), {}), o = {
247
+ ...r,
251
248
  responses: t.responses.getAllStore.getState(),
252
249
  location: typeof n.location == "object" ? {
253
250
  hash: n.location.hash,
@@ -261,11 +258,9 @@ async function at(t, e, r) {
261
258
  search: n.location.search
262
259
  } : void 0,
263
260
  predicates: s,
264
- features: a,
265
- actions: o,
266
- ...r
261
+ features: a
267
262
  };
268
- return await p(e, f);
263
+ return await p(e, o);
269
264
  }
270
265
  function Mt(t) {
271
266
  return !vt() || !gt() ? [] : Array.from(window.document.querySelectorAll(t)).filter(
@@ -347,7 +342,7 @@ function jt(t, e, r) {
347
342
  case "prepend":
348
343
  t.prepend(s);
349
344
  break;
350
- case "append":
345
+ default:
351
346
  t.append(s);
352
347
  break;
353
348
  }
@@ -371,43 +366,43 @@ function ft(t) {
371
366
  return t.type === "action";
372
367
  }
373
368
  const St = (t, e, r, n, s = /* @__PURE__ */ new Set()) => s.has(r.id) ? [] : (s.add(r.id), P(r) && !n ? [r] : e.filter((o) => o.sourceNodeId === r.id).flatMap((o) => {
374
- const f = t.find((d) => d.id === o.destinationNodeId);
375
- return f ? St(t, e, f, !1, s) : [];
369
+ const u = t.find((d) => d.id === o.destinationNodeId);
370
+ return u ? St(t, e, u, !1, s) : [];
376
371
  })), Ut = (t, e, r) => St(t, e, r, !0, /* @__PURE__ */ new Set()), yt = (t, e, r, n, s = /* @__PURE__ */ new Set()) => {
377
372
  if (s.has(r.id)) return [-1, -1];
378
373
  s.add(r.id);
379
374
  const a = e.filter((d) => d.sourceNodeId === r.id);
380
375
  if (a.length === 0) return [0, 0];
381
- let o = 1 / 0, f = -1 / 0;
376
+ let o = 1 / 0, u = -1 / 0;
382
377
  for (const d of a) {
383
- const g = t.find((M) => M.id === d.destinationNodeId);
384
- if (!g) continue;
385
- const [x, F] = yt(
378
+ const y = t.find((M) => M.id === d.destinationNodeId);
379
+ if (!y) continue;
380
+ const [b, F] = yt(
386
381
  t,
387
382
  e,
388
- g,
383
+ y,
389
384
  !1,
390
385
  new Set(s)
391
386
  );
392
- x !== -1 && (o = Math.min(o, x + 1), f = Math.max(f, F + 1));
387
+ b !== -1 && (o = Math.min(o, b + 1), u = Math.max(u, F + 1));
393
388
  }
394
- return o === 1 / 0 ? [-1, -1] : [o, f];
389
+ return o === 1 / 0 ? [-1, -1] : [o, u];
395
390
  }, Wt = (t, e, r) => yt(t, e, r, !0, /* @__PURE__ */ new Set()), ht = (t, e, r, n = /* @__PURE__ */ new Set()) => {
396
391
  if (n.has(r.id)) return [-1, -1];
397
392
  if (n.add(r.id), r.type === "origin") return [0, 0];
398
- const s = e.filter((f) => f.destinationNodeId === r.id);
393
+ const s = e.filter((u) => u.destinationNodeId === r.id);
399
394
  if (s.length === 0) return [-1, -1];
400
395
  let a = 1 / 0, o = -1 / 0;
401
- for (const f of s) {
402
- const d = t.find((F) => F.id === f.sourceNodeId);
396
+ for (const u of s) {
397
+ const d = t.find((F) => F.id === u.sourceNodeId);
403
398
  if (!d) continue;
404
- const [g, x] = ht(
399
+ const [y, b] = ht(
405
400
  t,
406
401
  e,
407
402
  d,
408
403
  new Set(n)
409
404
  );
410
- g !== -1 && (a = Math.min(a, g + 1), o = Math.max(o, x + 1));
405
+ y !== -1 && (a = Math.min(a, y + 1), o = Math.max(o, b + 1));
411
406
  }
412
407
  return a === 1 / 0 ? [-1, -1] : [a, o];
413
408
  }, Gt = (t, e, r) => ht(t, e, r, /* @__PURE__ */ new Set()), wt = (t) => t.find((r) => r.type === "origin") || null, Z = (t, e, r) => {
@@ -432,44 +427,44 @@ const tt = kt("experience-instance"), Vt = dt(
432
427
  target: r,
433
428
  options: n
434
429
  }) => {
435
- const s = b(), a = b(), o = b(), f = b(), d = b(), g = b(), x = e.componentStore, F = tt.store("transitioning"), M = t.history.entriesStore.map((i) => i.filter((l) => l.experienceId === e.id)), U = M.map((i) => i.filter((l) => P(l.node))), c = M.map((i) => i.at(-1)?.node || null), y = D(
430
+ const s = k(), a = k(), o = k(), u = k(), d = k(), y = k(), b = e.componentStore, F = tt.store("transitioning"), M = t.history.entriesStore.map((i) => i.filter((l) => l.experienceId === e.id)), U = M.map((i) => i.filter((l) => P(l.node))), c = M.map((i) => i.at(-1)?.node || null), S = D(
436
431
  e.treeStore,
437
432
  c,
438
- ({ steps: i }, l) => i.find((u) => l && P(l) && u.id === l.stepId) || null
439
- ), N = D(
433
+ ({ steps: i }, l) => i.find((f) => l && P(l) && f.id === l.stepId) || null
434
+ ), x = D(
440
435
  e.treeStore,
441
436
  U,
442
437
  ({ steps: i }, l) => {
443
- const u = l.at(-2);
444
- if (!u || !P(u.node))
438
+ const f = l.at(-2);
439
+ if (!f || !P(f.node))
445
440
  return null;
446
- const h = u.node;
447
- return i.find((_) => _.id === h.stepId) || null;
441
+ const h = f.node;
442
+ return i.find((B) => B.id === h.stepId) || null;
448
443
  }
449
444
  ), T = D(
450
445
  e.treeStore,
451
446
  c,
452
- ({ nodes: i, edges: l }, u) => u ? Ut(i, l, u) : []
447
+ ({ nodes: i, edges: l }, f) => f ? Ut(i, l, f) : []
453
448
  ), C = D(
454
449
  e.treeStore,
455
450
  c,
456
- ({ nodes: i, edges: l }, u) => u ? Gt(i, l, u) : [-1, -1]
451
+ ({ nodes: i, edges: l }, f) => f ? Gt(i, l, f) : [-1, -1]
457
452
  ), q = D(
458
453
  e.treeStore,
459
454
  c,
460
- ({ nodes: i, edges: l }, u) => u ? Wt(i, l, u) : [-1, -1]
455
+ ({ nodes: i, edges: l }, f) => f ? Wt(i, l, f) : [-1, -1]
461
456
  ), L = tt.store(!1), W = lt(L, {
462
457
  open: () => !0,
463
458
  close: () => !1,
464
459
  toggle: (i) => !i,
465
460
  set: (i, l) => l
466
- }), xt = B(async () => {
461
+ }), xt = _(async () => {
467
462
  t.history.back({ experienceId: e.id });
468
463
  }), Nt = O({
469
464
  source: e.treeStore,
470
465
  effect: async (i, l) => {
471
- const u = i.nodes.find((h) => P(h) && h.stepId === l);
472
- u && t.history.push({ experienceId: e.id, node: u });
466
+ const f = i.nodes.find((h) => P(h) && h.stepId === l);
467
+ f && t.history.push({ experienceId: e.id, node: f });
473
468
  }
474
469
  }), et = O({
475
470
  source: c,
@@ -480,87 +475,86 @@ const tt = kt("experience-instance"), Vt = dt(
480
475
  effect: async ({ nodes: i }) => wt(i)
481
476
  }), X = O({
482
477
  source: e.treeStore,
483
- effect: async ({ nodes: i, edges: l }, u) => {
484
- if (Y(u))
485
- return Z(u, i, l);
478
+ effect: async ({ nodes: i, edges: l }, f) => {
479
+ if (Y(f))
480
+ return Z(f, i, l);
486
481
  }
487
482
  }), J = O({
488
483
  source: e.treeStore,
489
- effect: async ({ nodes: i, edges: l, conditionals: u }, h) => {
484
+ effect: async ({ nodes: i, edges: l, conditionals: f }, h) => {
490
485
  if (!ct(h))
491
486
  return;
492
- const _ = u.find((A) => A.id === h.conditionalId);
493
- if (!_)
487
+ const B = f.find((A) => A.id === h.conditionalId);
488
+ if (!B)
494
489
  return;
495
- const k = h.id, w = await at(t, _.condition);
496
- return Kt(!!w, k, i, l);
490
+ const E = h.id, w = await at(t, B.condition);
491
+ return Kt(!!w, E, i, l);
497
492
  }
498
493
  }), nt = O({
499
494
  source: e.treeStore,
500
- effect: async ({ nodes: i, edges: l }, u) => {
501
- if (!ft(u))
495
+ effect: async ({ nodes: i, edges: l }, f) => {
496
+ if (!ft(f))
502
497
  return;
503
- const h = u.action;
498
+ const h = f.action;
504
499
  if (!h) {
505
- I("warn", `Action node ${u.id} has no action name`);
500
+ I("warn", `Action node ${f.id} has no action name`);
506
501
  return;
507
502
  }
508
- const _ = t.actions.getByName(h).getState();
509
- if (!_) {
503
+ const B = t.actions.getByName(h).getState();
504
+ if (!B) {
510
505
  I("warn", `Action '${h}' not registered on client`);
511
- const k = l.find(
512
- (w) => w.sourceNodeId === u.id && w.sourceNodeHandle === "false"
506
+ const E = l.find(
507
+ (w) => w.sourceNodeId === f.id && w.sourceNodeHandle === "false"
513
508
  );
514
- return k ? i.find((w) => w.id === k.destinationNodeId) : null;
509
+ return E ? i.find((w) => w.id === E.destinationNodeId) : null;
515
510
  }
516
- if (typeof _.action != "function") {
511
+ if (typeof B.action != "function") {
517
512
  I("warn", `Action '${h}' is not a function`);
518
- const k = l.find(
519
- (w) => w.sourceNodeId === u.id && w.sourceNodeHandle === "false"
513
+ const E = l.find(
514
+ (w) => w.sourceNodeId === f.id && w.sourceNodeHandle === "false"
520
515
  );
521
- return k ? i.find((w) => w.id === k.destinationNodeId) : null;
516
+ return E ? i.find((w) => w.id === E.destinationNodeId) : null;
522
517
  }
523
518
  try {
524
- I("info", `Executing action: ${h}`), await _.action(h);
525
- const k = l.find(
526
- (A) => A.sourceNodeId === u.id && A.sourceNodeHandle === "true"
519
+ I("info", `Executing action: ${h}`), await B.action(h);
520
+ const E = l.find(
521
+ (A) => A.sourceNodeId === f.id && A.sourceNodeHandle === "true"
527
522
  );
528
- if (!k)
529
- return I("warn", `No 'true' edge found for action node ${u.id}`), null;
530
- const w = i.find((A) => A.id === k.destinationNodeId);
523
+ if (!E)
524
+ return I("warn", `No 'true' edge found for action node ${f.id}`), null;
525
+ const w = i.find((A) => A.id === E.destinationNodeId);
531
526
  return I("info", `Action '${h}' succeeded, moving to node ${w?.id}`), w || null;
532
- } catch (k) {
533
- I("warn", `Action '${h}' failed:`, k);
527
+ } catch (E) {
528
+ I("warn", `Action '${h}' failed:`, E);
534
529
  const w = l.find(
535
- (G) => G.sourceNodeId === u.id && G.sourceNodeHandle === "false"
530
+ (G) => G.sourceNodeId === f.id && G.sourceNodeHandle === "false"
536
531
  );
537
532
  if (!w)
538
- return I("warn", `No 'false' edge found for action node ${u.id}`), null;
533
+ return I("warn", `No 'false' edge found for action node ${f.id}`), null;
539
534
  const A = i.find((G) => G.id === w.destinationNodeId);
540
535
  return I("info", `Action '${h}' failed, moving to node ${A?.id}`), A || null;
541
536
  }
542
537
  }
543
- }), Et = B((i) => {
538
+ }), It = _((i) => {
544
539
  ut(i) && t.experiences.launch({ id: i.experienceId });
545
540
  }), rt = O({
546
541
  source: [c, e.treeStore],
547
- effect: async ([i, { nodes: l, edges: u }]) => Z(i, l, u)
542
+ effect: async ([i, { nodes: l, edges: f }]) => Z(i, l, f)
548
543
  }), H = O({
549
544
  source: [c, e.treeStore],
550
- effect: async ([i, { nodes: l, edges: u }]) => Z(i, l, u)
551
- }), It = B((i) => {
545
+ effect: async ([i, { nodes: l, edges: f }]) => Z(i, l, f)
546
+ }), Et = _((i) => {
552
547
  t.history.push({ experienceId: e.id, node: i });
553
548
  }), ot = O({
554
549
  source: e.configStore,
555
550
  effect: async ({ initializeOpenLogic: i }) => n?.initialiseOpen !== void 0 ? n.initialiseOpen : $t(i) ? !!await at(t, i) : i ?? !1
556
551
  }), $ = Object.freeze({
557
- // eslint-disable-next-line sonarjs/pseudo-random -- non-security use: generating a unique runtime ID for UI tracking
558
552
  id: Math.random().toString(36).substring(7),
559
553
  // config
560
554
  experienceId: e.id,
561
555
  configStore: e.configStore,
562
556
  target: r,
563
- componentStore: x,
557
+ componentStore: b,
564
558
  // state
565
559
  stateStore: F,
566
560
  // open close
@@ -573,25 +567,25 @@ const tt = kt("experience-instance"), Vt = dt(
573
567
  treeStore: e.treeStore,
574
568
  fieldsStore: e.fieldsStore,
575
569
  currentNodeStore: c,
576
- currentStepStore: y,
577
- previousStepStore: N,
570
+ currentStepStore: S,
571
+ previousStepStore: x,
578
572
  nextReachableStepNodesStore: T,
579
573
  stepsToOriginStore: C,
580
574
  stepsToLeafStore: q,
581
575
  // history
582
576
  goToNextStep: a,
583
577
  goToPreviousStep: o,
584
- goToStepById: f,
578
+ goToStepById: u,
585
579
  stepsHistoryStore: U
586
- }), Q = b(), it = b();
587
- return S({
580
+ }), Q = k(), it = k();
581
+ return m({
588
582
  source: c,
589
583
  target: Q
590
- }), S({
584
+ }), m({
591
585
  clock: Q,
592
586
  filter: (i) => i === null,
593
587
  target: z
594
- }), S({
588
+ }), m({
595
589
  clock: Q,
596
590
  filter: (i) => i !== null,
597
591
  target: it
@@ -602,11 +596,11 @@ const tt = kt("experience-instance"), Vt = dt(
602
596
  origin: X,
603
597
  condition: J,
604
598
  step: et,
605
- launchExperience: Et,
599
+ launchExperience: It,
606
600
  action: nt,
607
- __: b()
601
+ __: k()
608
602
  }
609
- }), S({
603
+ }), m({
610
604
  clock: [
611
605
  J.doneData,
612
606
  X.doneData,
@@ -616,41 +610,41 @@ const tt = kt("experience-instance"), Vt = dt(
616
610
  nt.doneData
617
611
  ],
618
612
  filter: Boolean,
619
- target: It
620
- }), S({
613
+ target: Et
614
+ }), m({
621
615
  clock: a,
622
616
  target: H
623
- }), S({
617
+ }), m({
624
618
  clock: a,
625
- source: y,
619
+ source: S,
626
620
  filter: Boolean,
627
621
  target: t.eventBus.prepend((i) => ({
628
622
  type: "step_submit",
629
623
  step: i,
630
624
  experience: $
631
625
  }))
632
- }), S({
626
+ }), m({
633
627
  clock: H.done,
634
- source: y,
628
+ source: S,
635
629
  filter: Boolean,
636
630
  target: t.eventBus.prepend((i) => ({
637
631
  type: "step_submit_success",
638
632
  step: i,
639
633
  experience: $
640
634
  }))
641
- }), S({
635
+ }), m({
642
636
  clock: H.fail,
643
- source: y,
637
+ source: S,
644
638
  filter: Boolean,
645
639
  target: t.eventBus.prepend((i) => ({
646
640
  type: "step_submit_error",
647
641
  step: i,
648
642
  experience: $
649
643
  }))
650
- }), S({
644
+ }), m({
651
645
  clock: o,
652
646
  target: xt
653
- }), S({ clock: f, target: Nt }), S({
647
+ }), m({ clock: u, target: Nt }), m({
654
648
  source: D([
655
649
  J.pending,
656
650
  X.pending,
@@ -659,48 +653,48 @@ const tt = kt("experience-instance"), Vt = dt(
659
653
  ]),
660
654
  fn: (i) => i.some(Boolean) ? "transitioning" : "ready",
661
655
  target: F
662
- }), S({
656
+ }), m({
663
657
  clock: et.doneData,
664
- source: y,
658
+ source: S,
665
659
  filter: Boolean,
666
660
  target: t.eventBus.prepend((i) => ({
667
661
  type: "step_enter",
668
662
  step: i,
669
663
  experience: $
670
664
  }))
671
- }), S({
672
- clock: g,
665
+ }), m({
666
+ clock: y,
673
667
  target: ot
674
- }), S({
668
+ }), m({
675
669
  source: ot.doneData,
676
670
  fn: Boolean,
677
671
  target: L
678
- }), S({
672
+ }), m({
679
673
  source: c,
680
674
  clock: s,
681
675
  filter: (i) => i ? Y(i) : !0,
682
676
  target: rt
683
- }), S({
677
+ }), m({
684
678
  source: L,
685
679
  filter: Boolean,
686
680
  target: s
687
- }), S({
681
+ }), m({
688
682
  source: L,
689
683
  filter: Boolean,
690
684
  target: t.eventBus.prepend(() => ({
691
685
  type: "experience_open",
692
686
  experience: $
693
687
  }))
694
- }), S({
688
+ }), m({
695
689
  source: L,
696
690
  filter: (i) => !i,
697
691
  target: t.eventBus.prepend(() => ({
698
692
  type: "experience_close",
699
693
  experience: $
700
694
  }))
701
- }), S({
695
+ }), m({
702
696
  clock: d,
703
- target: [g]
697
+ target: [y]
704
698
  }), d(), $;
705
699
  }
706
700
  );
@@ -708,52 +702,52 @@ function qt(t) {
708
702
  return pt(Vt, t);
709
703
  }
710
704
  const zt = dt(({ client: t }) => {
711
- const e = tt.store({}), r = b(), n = b(), s = b(), a = lt(e, {
712
- register(c, y) {
713
- const N = [
714
- ...c[y.experienceId] ?? []
705
+ const e = tt.store({}), r = k(), n = k(), s = k(), a = lt(e, {
706
+ register(c, S) {
707
+ const x = [
708
+ ...c[S.experienceId] ?? []
715
709
  ];
716
- return N.push(y), {
710
+ return x.push(S), {
717
711
  ...c,
718
- [y.experienceId]: N
712
+ [S.experienceId]: x
719
713
  };
720
714
  },
721
- unregister(c, y) {
722
- const N = y.experienceId, T = c[N]?.filter(
723
- (C) => C !== y
715
+ unregister(c, S) {
716
+ const x = S.experienceId, T = c[x]?.filter(
717
+ (C) => C !== S
724
718
  );
725
719
  return {
726
720
  ...c,
727
- [N]: T ?? []
721
+ [x]: T ?? []
728
722
  };
729
723
  }
730
- }), o = B(
724
+ }), o = _(
731
725
  ({
732
726
  experience: c,
733
- target: y,
734
- options: N
735
- }) => qt({ client: t, experience: c, target: y, options: N })
736
- ), f = B((c) => {
727
+ target: S,
728
+ options: x
729
+ }) => qt({ client: t, experience: c, target: S, options: x })
730
+ ), u = _((c) => {
737
731
  a.register(c);
738
- }), d = B(
732
+ }), d = _(
739
733
  (c) => {
740
734
  c.target && Dt(c.target, () => {
741
735
  s(c);
742
736
  });
743
737
  }
744
- ), g = B((c) => {
738
+ ), y = _((c) => {
745
739
  a.unregister(c);
746
- }), x = B((c) => {
747
- const y = c.componentStore.getState();
748
- if (!y) {
740
+ }), b = _((c) => {
741
+ const S = c.componentStore.getState();
742
+ if (!S) {
749
743
  I("warn", "No app component registered. Skipping init.");
750
744
  return;
751
745
  }
752
- const N = y.frameworkStore.getState();
753
- if (!N) {
746
+ const x = S.frameworkStore.getState();
747
+ if (!x) {
754
748
  I(
755
749
  "error",
756
- `No framework registered for component '${y.name}'. Skipping rendering.`
750
+ `No framework registered for component '${S.name}'. Skipping rendering.`
757
751
  );
758
752
  return;
759
753
  }
@@ -767,40 +761,40 @@ const zt = dt(({ client: t }) => {
767
761
  }
768
762
  const C = Lt(T);
769
763
  try {
770
- N.render(C, y.component, t, c);
764
+ x.render(C, S.component, t, c);
771
765
  } catch (q) {
772
766
  I("error", q);
773
767
  }
774
768
  });
775
- S({
769
+ m({
776
770
  clock: r,
777
771
  target: o
778
- }), S({
772
+ }), m({
779
773
  clock: s,
780
- target: g
781
- }), S({
774
+ target: y
775
+ }), m({
782
776
  clock: o.doneData,
783
777
  target: [
784
- f,
778
+ u,
785
779
  d,
786
780
  n
787
781
  ]
788
- }), S({
782
+ }), m({
789
783
  clock: o.doneData,
790
784
  target: t.eventBus.prepend((c) => ({
791
785
  type: "experience_initialize",
792
786
  experience: c
793
787
  }))
794
- }), S({
788
+ }), m({
795
789
  clock: n,
796
- target: x
790
+ target: b
797
791
  });
798
- function F(c, y, N) {
799
- r({ experience: c, target: y, options: N });
792
+ function F(c, S, x) {
793
+ r({ experience: c, target: S, options: x });
800
794
  }
801
795
  const M = e.map((c) => Object.values(c).flat());
802
796
  function U(c) {
803
- return e.map((y) => y[c] || [], { skipVoid: !1 });
797
+ return e.map((S) => S[c] || [], { skipVoid: !1 });
804
798
  }
805
799
  return {
806
800
  spawn: F,