@picked/client 0.0.12-next.3 → 0.0.12-next.4

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/dist/esm/index.js CHANGED
@@ -1,35 +1,35 @@
1
- var G = Object.defineProperty;
2
- var W = (t, e, s) => e in t ? G(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var m = (t, e, s) => W(t, typeof e != "symbol" ? e + "" : e, s);
4
- import { createDomain as I, createApi as x, createEffect as O, attach as Y, sample as P, combine as j, createEvent as C } from "effector";
5
- import { createFactory as v, invoke as k } from "@withease/factories";
6
- import { g as U, t as J, c as Q, e as R, i as X, a as Z, b as ee, d as te } from "../experience-instance-BBz99AXU.js";
7
- import { f as yt } from "../experience-instance-BBz99AXU.js";
8
- import { l as w } from "../logger-C9a75KZn.js";
9
- import { c as A, s as $, l as D } from "../storage-Cb_71y48.js";
1
+ var W = Object.defineProperty;
2
+ var Y = (t, e, r) => e in t ? W(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var m = (t, e, r) => Y(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import { createDomain as I, createApi as x, createEffect as M, attach as J, sample as F, combine as C, createEvent as D } from "effector";
5
+ import { createFactory as w, invoke as k } from "@withease/factories";
6
+ import { g as _, t as Q, c as X, e as R, i as Z, a as ee, b as te, d as re } from "../experience-instance-BBz99AXU.js";
7
+ import { f as St } from "../experience-instance-BBz99AXU.js";
8
+ import { l as v } from "../logger-C9a75KZn.js";
9
+ import { c as A, s as $, l as O } from "../storage-Cb_71y48.js";
10
10
  import { a as wt } from "../storage-Cb_71y48.js";
11
- import { g as re } from "../id-BW-g3y32.js";
12
- import { i as se } from "../object-JwZ58NOH.js";
13
- import { s as z, a as ne, b as oe, c as ie, d as ae } from "../supports-BjhuLJ8z.js";
14
- import { h as kt, f as bt, j as It, e as xt, g as Ft, i as Et, k as Pt } from "../supports-BjhuLJ8z.js";
15
- const _ = I("experience"), ce = v(
11
+ import { g as se } from "../id-BW-g3y32.js";
12
+ import { i as ne } from "../object-JwZ58NOH.js";
13
+ import { s as z, a as oe, b as ie, c as ae, d as ce } from "../supports-BjhuLJ8z.js";
14
+ import { h as bt, f as It, j as xt, e as Ft, g as Et, i as Pt, k as Rt } from "../supports-BjhuLJ8z.js";
15
+ const H = I("experience"), ue = w(
16
16
  ({ client: t, experience: e }) => {
17
- const s = _.store(e), n = x(s, {
17
+ const r = H.store(e), n = x(r, {
18
18
  merge(u, h) {
19
19
  return {
20
20
  ...u,
21
21
  ...h.experience
22
22
  };
23
23
  }
24
- }), i = s.map((u) => ({
24
+ }), a = r.map((u) => ({
25
25
  type: u.type,
26
26
  name: u.name,
27
27
  decisionLogic: u.decide,
28
28
  targetSelectors: u.targets
29
- })), c = t.components.listStore.map(
29
+ })), l = t.components.listStore.map(
30
30
  (u) => u.find((h) => h.name === `experience:${e.id}`) || u.find((h) => h.name === "experience"),
31
31
  { skipVoid: !1 }
32
- ), r = s.map((u) => ({
32
+ ), s = r.map((u) => ({
33
33
  steps: u.steps,
34
34
  nodes: u.nodes,
35
35
  edges: u.edges,
@@ -37,171 +37,171 @@ const _ = I("experience"), ce = v(
37
37
  })), o = e.actions ?? [];
38
38
  return {
39
39
  id: e.id,
40
- configStore: i,
41
- treeStore: r,
42
- componentStore: c,
40
+ configStore: a,
41
+ treeStore: s,
42
+ componentStore: l,
43
43
  actions: o,
44
44
  merge: n.merge
45
45
  };
46
46
  }
47
47
  );
48
- function ue(t) {
49
- return k(ce, t);
48
+ function le(t) {
49
+ return k(ue, t);
50
50
  }
51
- const le = v(({ client: t }) => {
52
- const e = _.store({}), s = x(e, {
53
- register(r, o) {
51
+ const de = w(({ client: t }) => {
52
+ const e = H.store({}), r = x(e, {
53
+ register(s, o) {
54
54
  return {
55
- ...r,
55
+ ...s,
56
56
  [o.id]: o
57
57
  };
58
58
  }
59
59
  });
60
- function n(r) {
61
- const o = e.getState()[r.id];
60
+ function n(s) {
61
+ const o = e.getState()[s.id];
62
62
  if (o) {
63
- o.merge({ experience: r, strategy: "override" });
63
+ o.merge({ experience: s, strategy: "override" });
64
64
  return;
65
65
  }
66
- const u = ue({ client: t, experience: r });
67
- s.register(u);
66
+ const u = le({ client: t, experience: s });
67
+ r.register(u);
68
68
  }
69
- const i = e.map((r) => Object.values(r));
70
- function c(r) {
71
- return e.map((o) => o[r], { skipVoid: !1 });
69
+ const a = e.map((s) => Object.values(s));
70
+ function l(s) {
71
+ return e.map((o) => o[s], { skipVoid: !1 });
72
72
  }
73
73
  return {
74
74
  register: n,
75
- getById: c,
76
- listStore: i
75
+ getById: l,
76
+ listStore: a
77
77
  };
78
78
  });
79
- function de(t) {
80
- return k(le, t);
79
+ function pe(t) {
80
+ return k(de, t);
81
81
  }
82
- const pe = (t, e) => {
82
+ const ge = (t, e) => {
83
83
  e.register(t);
84
- }, H = (t, e) => {
85
- const { targetSelectors: s } = e.configStore.getState(), n = U(s, e.id);
84
+ }, K = (t, e) => {
85
+ const { targetSelectors: r } = e.configStore.getState(), n = _(r, e.id);
86
86
  n.forEach(
87
- ({ elements: c }) => c.forEach((r) => J(r, e.id))
88
- ), Q(n, e.id).forEach((c) => {
89
- t.experienceInstances.spawn(e, c);
87
+ ({ elements: l }) => l.forEach((s) => Q(s, e.id))
88
+ ), X(n, e.id).forEach((l) => {
89
+ t.experienceInstances.spawn(e, l);
90
90
  });
91
- }, M = async (t) => {
91
+ }, T = async (t) => {
92
92
  await Promise.all(
93
93
  t.experiences.listStore.getState().map(async (e) => {
94
- await ge(t, e) && H(t, e);
94
+ await fe(t, e) && K(t, e);
95
95
  })
96
96
  );
97
- }, ge = async (t, e) => {
98
- const { type: s, decisionLogic: n, targetSelectors: i } = e.configStore.getState();
99
- return U(i, e.id).length < 1 ? !1 : s === "funnel" ? n ? await R(t, n) === !0 : !1 : i.length === 0 ? !1 : X(n) ? await R(t, n) === !0 : !0;
100
- }, fe = (t, e, s) => {
101
- const n = e.name, i = e.setup(t);
102
- if (i) {
103
- const c = s[n] ?? {};
104
- s[n] = Object.freeze({ ...c, ...i });
105
- }
106
- }, me = I("component"), he = v(
107
- ({ client: t, component: e, name: s }) => {
97
+ }, fe = async (t, e) => {
98
+ const { type: r, decisionLogic: n, targetSelectors: a } = e.configStore.getState();
99
+ return _(a, e.id).length < 1 ? !1 : r === "funnel" ? n ? await R(t, n) === !0 : !1 : a.length === 0 ? !1 : Z(n) ? await R(t, n) === !0 : !0;
100
+ }, me = (t, e, r) => {
101
+ const n = e.name, a = e.setup(t);
102
+ if (a) {
103
+ const l = r[n] ?? {};
104
+ r[n] = Object.freeze({ ...l, ...a });
105
+ }
106
+ }, he = I("component"), ye = w(
107
+ ({ client: t, component: e, name: r }) => {
108
108
  const n = t.frameworks.getByName(e.frameworkName);
109
109
  return {
110
- name: s,
110
+ name: r,
111
111
  component: e,
112
112
  frameworkStore: n
113
113
  };
114
114
  }
115
115
  );
116
- function ye(t) {
117
- return k(he, t);
116
+ function Se(t) {
117
+ return k(ye, t);
118
118
  }
119
- const Se = v(({ client: t }) => {
120
- const e = me.store({}), s = x(e, {
121
- register(r, o) {
119
+ const ve = w(({ client: t }) => {
120
+ const e = he.store({}), r = x(e, {
121
+ register(s, o) {
122
122
  return {
123
- ...r,
123
+ ...s,
124
124
  [o.name]: o
125
125
  };
126
126
  }
127
127
  });
128
- function n(r, o) {
129
- e.getState()[r] && w(
128
+ function n(s, o) {
129
+ e.getState()[s] && v(
130
130
  "warn",
131
- `Component '${r}' already registered. Registering again will override the previous registration.`
131
+ `Component '${s}' already registered. Registering again will override the previous registration.`
132
132
  );
133
- const h = ye({ client: t, name: r, component: o });
134
- s.register(h);
133
+ const h = Se({ client: t, name: s, component: o });
134
+ r.register(h);
135
135
  }
136
- const i = e.map((r) => Object.values(r));
137
- function c(r) {
138
- return e.map((o) => o[r], { skipVoid: !1 });
136
+ const a = e.map((s) => Object.values(s));
137
+ function l(s) {
138
+ return e.map((o) => o[s], { skipVoid: !1 });
139
139
  }
140
140
  return {
141
141
  register: n,
142
- getByName: c,
143
- listStore: i
142
+ getByName: l,
143
+ listStore: a
144
144
  };
145
145
  });
146
146
  function we(t) {
147
- return k(Se, t);
147
+ return k(ve, t);
148
148
  }
149
- const T = (t, e, s) => {
150
- s.register(t, e);
151
- }, ve = I("framework"), ke = v(({ client: t }) => {
152
- const e = ve.store({}), s = x(e, {
153
- register(r, o) {
149
+ const V = (t, e, r) => {
150
+ r.register(t, e);
151
+ }, ke = I("framework"), be = w(({ client: t }) => {
152
+ const e = ke.store({}), r = x(e, {
153
+ register(s, o) {
154
154
  return {
155
- ...r,
155
+ ...s,
156
156
  [o.name]: o.framework
157
157
  };
158
158
  }
159
159
  });
160
- function n(r, o) {
161
- e.getState()[r] && w(
160
+ function n(s, o) {
161
+ e.getState()[s] && v(
162
162
  "warn",
163
- `Framework '${r}' already registered. Registering again will override the previous registration.`
164
- ), s.register({ name: r, framework: o });
163
+ `Framework '${s}' already registered. Registering again will override the previous registration.`
164
+ ), r.register({ name: s, framework: o });
165
165
  }
166
- const i = e.map((r) => Object.values(r));
167
- function c(r) {
168
- return e.map((o) => o[r], { skipVoid: !1 });
166
+ const a = e.map((s) => Object.values(s));
167
+ function l(s) {
168
+ return e.map((o) => o[s], { skipVoid: !1 });
169
169
  }
170
170
  return {
171
171
  register: n,
172
- getByName: c,
173
- listStore: i
172
+ getByName: l,
173
+ listStore: a
174
174
  };
175
175
  });
176
- function be(t) {
177
- return k(ke, t);
176
+ function Ie(t) {
177
+ return k(be, t);
178
178
  }
179
- const Ie = (t, e) => {
179
+ const xe = (t, e) => {
180
180
  e.register(t.name, t);
181
- }, xe = 6e3, V = A("last_ping", "global"), Fe = (t) => `${t}/api/v1/ping`, Ee = async (t) => {
181
+ }, Fe = 6e3, N = A("last_ping", "global"), Ee = (t) => `${t}/api/v1/ping`, Pe = async (t) => {
182
182
  try {
183
- const e = Date.now(), s = localStorage.getItem(V);
184
- if (s && e - parseInt(s) < xe)
183
+ const e = Date.now(), r = localStorage.getItem(N);
184
+ if (r && e - parseInt(r) < Fe)
185
185
  return !0;
186
- const n = Fe(t.apiUrl), i = {
186
+ const n = Ee(t.apiUrl), a = {
187
187
  projectId: t.projectId,
188
188
  path: window.location.pathname
189
- }, c = JSON.stringify(i), r = {
189
+ }, l = JSON.stringify(a), s = {
190
190
  "Content-Type": "application/json"
191
191
  }, o = document.getElementById("picked_script"), u = o == null ? void 0 : o.dataset.verceltoken;
192
- u && (r["x-vercel-protection-bypass"] = u);
193
- const l = (await fetch(n, {
192
+ u && (s["x-vercel-protection-bypass"] = u);
193
+ const S = (await fetch(n, {
194
194
  method: "POST",
195
- headers: r,
196
- body: c
195
+ headers: s,
196
+ body: l
197
197
  })).ok;
198
- return l && localStorage.setItem(V, e.toString()), l;
198
+ return S && localStorage.setItem(N, e.toString()), S;
199
199
  } catch (e) {
200
- return w("error", e), !1;
200
+ return v("error", e), !1;
201
201
  }
202
202
  };
203
- function Pe(t) {
204
- const e = typeof window < "u", s = {
203
+ function Re(t) {
204
+ const e = typeof window < "u", r = {
205
205
  client: t,
206
206
  responses: t.responses.listStore.getState(),
207
207
  fields: t.fields.listStore.getState(),
@@ -210,13 +210,13 @@ function Pe(t) {
210
210
  sessionStorage: e ? window.sessionStorage : void 0,
211
211
  localStorage: e ? window.localStorage : void 0
212
212
  };
213
- return Object.freeze(s);
213
+ return Object.freeze(r);
214
214
  }
215
- const Re = I("predicate"), Ae = v(({ client: t }) => {
216
- const e = Re.store({}), s = x(e, {
217
- register(r, o) {
215
+ const Ae = I("predicate"), Be = w(({ client: t }) => {
216
+ const e = Ae.store({}), r = x(e, {
217
+ register(s, o) {
218
218
  return {
219
- ...r,
219
+ ...s,
220
220
  [o.name]: {
221
221
  name: o.name,
222
222
  predicate: o.predicate
@@ -224,172 +224,181 @@ const Re = I("predicate"), Ae = v(({ client: t }) => {
224
224
  };
225
225
  }
226
226
  });
227
- function n(r, o) {
228
- e.getState()[r] && w(
227
+ function n(s, o) {
228
+ e.getState()[s] && v(
229
229
  "warn",
230
- `Predicate '${r}' already registered. Registering again will override the previous registration.`
231
- ), s.register(Object.freeze({ name: r, predicate: o }));
230
+ `Predicate '${s}' already registered. Registering again will override the previous registration.`
231
+ ), r.register(Object.freeze({ name: s, predicate: o }));
232
232
  }
233
- const i = e.map((r) => Object.values(r));
234
- function c(r) {
235
- return e.map((o) => o[r], { skipVoid: !1 });
233
+ const a = e.map((s) => Object.values(s));
234
+ function l(s) {
235
+ return e.map((o) => o[s], { skipVoid: !1 });
236
236
  }
237
237
  return {
238
238
  register: n,
239
- getByName: c,
240
- listStore: i
239
+ getByName: l,
240
+ listStore: a
241
241
  };
242
242
  });
243
243
  function $e(t) {
244
- return k(Ae, t);
244
+ return k(Be, t);
245
245
  }
246
- const Be = (t, e, s) => {
247
- s.register(t, e);
248
- }, N = I("feature"), je = v(() => {
249
- const t = N.store({}), e = N.store([]), s = x(t, {
250
- register(l, f) {
246
+ const je = (t, e, r) => {
247
+ r.register(t, e);
248
+ }, L = I("feature"), Ce = w(({ client: t }) => {
249
+ const e = L.store({}), r = L.store([]), n = x(e, {
250
+ register(d, c) {
251
251
  return {
252
- ...l,
253
- [f.id]: f.feature
252
+ ...d,
253
+ [c.id]: c.feature
254
254
  };
255
255
  }
256
256
  });
257
- function n(l, f) {
258
- t.getState()[l] && w(
257
+ function a(d, c) {
258
+ e.getState()[d] && v(
259
259
  "warn",
260
- `Feature '${l}' already registered. Registering again will override the previous registration.`
260
+ `Feature '${d}' already registered. Registering again will override the previous registration.`
261
261
  );
262
- const p = {
263
- id: l,
262
+ const g = {
263
+ id: d,
264
264
  feature: {
265
- ...f,
266
- id: l
265
+ ...c,
266
+ id: d
267
267
  }
268
268
  };
269
- s.register(
269
+ n.register(
270
270
  Object.freeze({
271
- id: l,
272
- feature: p
271
+ id: d,
272
+ feature: g
273
273
  })
274
274
  );
275
275
  }
276
- const i = O(
276
+ const l = M(
277
277
  async ({
278
- id: l,
279
- key: f,
280
- storage: a = "local"
278
+ id: d,
279
+ key: c,
280
+ storage: i = "local"
281
281
  }) => {
282
- const p = A(`feature:${l}:${f}`, "global"), y = (a === "session" ? $ : D).get(p).boolean();
283
- if (y !== null)
284
- return { id: l, bucket: y };
282
+ const g = A(`feature:${d}:${c}`, "global"), p = (i === "session" ? $ : O).get(g).boolean();
283
+ return p ? { id: d, key: c, bucket: p } : null;
285
284
  }
286
- ), c = O((l) => {
287
- if (!l)
285
+ ), s = M((d) => {
286
+ if (!d)
288
287
  return null;
289
- const f = A(`feature:${l.id}:${l.key}`, "global");
290
- (l.storage === "session" ? $ : D).set(f, l.bucket);
291
- }), r = /* @__PURE__ */ new Map(), o = Y({
292
- source: { allFeaturesStore: t, resolvedFeaturesStore: e },
293
- effect: async ({ allFeaturesStore: l, resolvedFeaturesStore: f }, { id: a, decide: p, key: g }) => {
294
- const y = f.find((F) => F.id === a);
295
- if (y)
296
- return y;
297
- const d = l[a];
298
- if (!d)
299
- throw new Error(`Feature with id '${a}' not found`);
300
- const S = r.get(`${a}:${g}`);
301
- if (S !== void 0) {
302
- const F = await S;
303
- return { id: d.id, bucket: F, storage: d.feature.storage };
288
+ const c = A(`feature:${d.id}:${d.key}`, "global");
289
+ (d.storage === "session" ? $ : O).set(c, d.bucket);
290
+ }), o = /* @__PURE__ */ new Map(), u = J({
291
+ source: { allFeaturesStore: e, resolvedFeaturesStore: r },
292
+ effect: async ({ allFeaturesStore: d, resolvedFeaturesStore: c }, { id: i, decide: g, key: f }) => {
293
+ const p = c.find((j) => j.id === i);
294
+ if (p)
295
+ return p;
296
+ const y = d[i];
297
+ if (!y)
298
+ throw new Error(`Feature with id '${i}' not found`);
299
+ const b = o.get(`${i}:${f}`);
300
+ if (b !== void 0) {
301
+ const j = await b;
302
+ return { id: y.id, bucket: j, key: f, storage: y.feature.storage };
304
303
  }
305
- const b = p();
306
- r.set(`${a}:${g}`, b);
307
- const B = await b;
308
- return { id: d.id, bucket: B, storage: d.feature.storage };
304
+ const B = g();
305
+ o.set(`${i}:${f}`, B);
306
+ const E = await B;
307
+ return { id: y.id, bucket: E, key: f, storage: y.feature.storage };
309
308
  }
310
309
  });
311
- P({
312
- clock: s.register,
313
- fn: (l) => {
314
- const { id: f, feature: a } = l;
315
- return { id: f, key: a.feature.key, storage: a.feature.storage };
310
+ F({
311
+ clock: n.register,
312
+ fn: (d) => {
313
+ const { id: c, feature: i } = d;
314
+ return { id: c, key: i.feature.key, storage: i.feature.storage };
316
315
  },
317
- target: i
318
- }), P({
316
+ target: l
317
+ }), F({
319
318
  source: e,
320
- clock: [i.doneData, o.doneData],
321
- fn: (l, f) => !f || l.some((a) => a.id === f.id) ? l : [...l, f],
322
- target: e
323
- }), P({
324
- source: t,
325
- clock: o.doneData,
326
- fn: (l, f) => {
327
- var d;
328
- const { id: a, bucket: p, storage: g } = f, y = (d = l[a]) == null ? void 0 : d.feature.key;
329
- return y ? { key: y, id: a, bucket: p, storage: g } : null;
319
+ clock: u.doneData,
320
+ fn: (d, c) => {
321
+ var y;
322
+ const { id: i, bucket: g, storage: f } = c, p = (y = d[i]) == null ? void 0 : y.feature.key;
323
+ return p ? { key: p, id: i, bucket: g, storage: f } : null;
330
324
  },
331
- target: c
325
+ target: s
332
326
  });
333
- const u = j({ allFeaturesStore: t, resolvedFeaturesStore: e }).map(
327
+ const h = C({ allFeaturesStore: e, resolvedFeaturesStore: r }).map(
334
328
  ({
335
- allFeaturesStore: l,
336
- resolvedFeaturesStore: f
337
- }) => Object.values(l).map((a) => {
338
- const p = f.find((g) => g.id === a.id);
339
- return p ? {
340
- id: a.id,
341
- name: a.feature.name,
342
- key: a.feature.key,
343
- getBucket: () => ({ id: a.id, bucket: p.bucket }),
329
+ allFeaturesStore: d,
330
+ resolvedFeaturesStore: c
331
+ }) => Object.values(d).map((i) => {
332
+ const g = c.find((f) => f.id === i.id);
333
+ return g ? {
334
+ id: i.id,
335
+ name: i.feature.name,
336
+ key: i.feature.key,
337
+ getBucket: () => ({ id: i.id, bucket: g.bucket }),
344
338
  isResolved: !0
345
339
  } : {
346
- id: a.id,
347
- name: a.feature.name,
348
- key: a.feature.key,
349
- getBucket: async () => await o(a.feature),
340
+ id: i.id,
341
+ name: i.feature.name,
342
+ key: i.feature.key,
343
+ getBucket: async () => await u(i.feature),
350
344
  isResolved: !1
351
345
  };
352
346
  })
353
347
  );
354
- function h(l) {
355
- return t.map((f) => f[l], { skipVoid: !1 });
348
+ F({
349
+ clock: u.doneData,
350
+ source: { resolvedFeatures: r },
351
+ filter: ({ resolvedFeatures: d }, { id: c }) => !d.some((i) => i.id === c),
352
+ fn: (d, c) => c,
353
+ target: t.eventBus.prepend((d) => ({
354
+ type: "feature_decide",
355
+ feature: d
356
+ }))
357
+ }), F({
358
+ clock: [l.doneData, u.doneData],
359
+ source: r,
360
+ fn: (d, c) => !c || d.some((i) => i.id === c.id) ? d : [...d, c],
361
+ target: r
362
+ });
363
+ function S(d) {
364
+ return e.map((c) => c[d], { skipVoid: !1 });
356
365
  }
357
366
  return {
358
- register: n,
359
- getByName: h,
360
- listStore: u
367
+ register: a,
368
+ getByName: S,
369
+ listStore: h
361
370
  };
362
371
  });
363
- function Ce() {
364
- return k(je);
372
+ function De(t) {
373
+ return k(Ce, t);
365
374
  }
366
- const De = (t, e, s) => {
367
- s.register(t, e);
368
- }, E = I("history");
369
- function L(t, e) {
375
+ const Oe = (t, e, r) => {
376
+ r.register(t, e);
377
+ }, P = I("history");
378
+ function U(t, e) {
370
379
  return {
371
380
  // eslint-disable-next-line sonarjs/pseudo-random
372
- id: re(`history-entry-${Date.now()}-${Math.random()}}`),
381
+ id: se(`history-entry-${Date.now()}-${Math.random()}}`),
373
382
  node: e,
374
383
  at: Date.now(),
375
384
  experienceId: t
376
385
  };
377
386
  }
378
- const Oe = v(() => {
379
- const t = E.store({ entries: [] }), e = E.event(), s = E.event(), n = E.event(), i = E.event();
380
- t.on(e, (r, o) => ({
381
- entries: [...r.entries, L(o.experienceId, o.node)]
382
- })), t.on(s, (r, o) => ({
387
+ const Me = w(() => {
388
+ const t = P.store({ entries: [] }), e = P.event(), r = P.event(), n = P.event(), a = P.event();
389
+ t.on(e, (s, o) => ({
390
+ entries: [...s.entries, U(o.experienceId, o.node)]
391
+ })), t.on(r, (s, o) => ({
383
392
  entries: [
384
- ...r.entries.slice(0, -1),
385
- L(o.experienceId, o.node)
393
+ ...s.entries.slice(0, -1),
394
+ U(o.experienceId, o.node)
386
395
  ]
387
- })), t.on(i, (r, o) => o);
388
- function c(r, o) {
396
+ })), t.on(a, (s, o) => o);
397
+ function l(s, o) {
389
398
  const u = { lastStepIndex: -1, secondLastStepIndex: -1 };
390
- for (let h = r.length - 1; h >= 0; h--) {
391
- const l = r[h], f = l == null ? void 0 : l.node;
392
- if (!(!f || !Z(f)) && !(o && (l == null ? void 0 : l.experienceId) !== o))
399
+ for (let h = s.length - 1; h >= 0; h--) {
400
+ const S = s[h], d = S == null ? void 0 : S.node;
401
+ if (!(!d || !ee(d)) && !(o && (S == null ? void 0 : S.experienceId) !== o))
393
402
  if (u.lastStepIndex === -1)
394
403
  u.lastStepIndex = h;
395
404
  else {
@@ -399,219 +408,219 @@ const Oe = v(() => {
399
408
  }
400
409
  return u;
401
410
  }
402
- return t.on(n, (r, o) => {
403
- const { secondLastStepIndex: u } = c(r.entries, o.experienceId), h = u !== -1 ? r.entries.slice(0, u + 1) : r.entries;
411
+ return t.on(n, (s, o) => {
412
+ const { secondLastStepIndex: u } = l(s.entries, o.experienceId), h = u !== -1 ? s.entries.slice(0, u + 1) : s.entries;
404
413
  return {
405
- ...r,
414
+ ...s,
406
415
  entries: h
407
416
  };
408
417
  }), {
409
418
  push: e,
410
- replace: s,
419
+ replace: r,
411
420
  back: n,
412
- restore: i,
413
- entriesStore: t.map((r) => r.entries)
421
+ restore: a,
422
+ entriesStore: t.map((s) => s.entries)
414
423
  };
415
424
  });
416
- function Me() {
417
- return k(Oe);
425
+ function Te() {
426
+ return k(Me);
418
427
  }
419
- const Te = () => C(), Ve = I("field"), Ne = v(() => {
420
- const t = Ve.store({}), e = x(t, {
421
- register(r, o) {
428
+ const Ve = () => D(), Ne = I("field"), Le = w(() => {
429
+ const t = Ne.store({}), e = x(t, {
430
+ register(s, o) {
422
431
  return {
423
- ...r,
432
+ ...s,
424
433
  [o.field.id]: o.field
425
434
  };
426
435
  }
427
436
  });
428
- function s(r) {
429
- e.register({ field: r });
437
+ function r(s) {
438
+ e.register({ field: s });
430
439
  }
431
- const n = t.map((r) => Object.values(r));
432
- function i(r) {
433
- return t.map((o) => o[r] || null);
440
+ const n = t.map((s) => Object.values(s));
441
+ function a(s) {
442
+ return t.map((o) => o[s] || null);
434
443
  }
435
- function c(r) {
436
- return t.map((o) => Object.values(o).find((u) => u.name === r) || null);
444
+ function l(s) {
445
+ return t.map((o) => Object.values(o).find((u) => u.name === s) || null);
437
446
  }
438
447
  return {
439
- register: s,
440
- getById: i,
448
+ register: r,
449
+ getById: a,
441
450
  listStore: n,
442
- getByName: c
451
+ getByName: l
443
452
  };
444
453
  });
445
- function Le() {
446
- return k(Ne);
454
+ function Ue() {
455
+ return k(Le);
447
456
  }
448
- const Ue = (t, e) => {
457
+ const _e = (t, e) => {
449
458
  e.register(t);
450
- }, ze = I("action"), _e = v(() => {
459
+ }, ze = I("action"), He = w(() => {
451
460
  const t = ze.store({}), e = x(t, {
452
- register(c, r) {
461
+ register(l, s) {
453
462
  return {
454
- ...c,
455
- [r.name]: {
456
- name: r.name,
457
- action: r.action
463
+ ...l,
464
+ [s.name]: {
465
+ name: s.name,
466
+ action: s.action
458
467
  }
459
468
  };
460
469
  }
461
470
  });
462
- function s(c, r) {
463
- e.register({ name: c, action: r });
471
+ function r(l, s) {
472
+ e.register({ name: l, action: s });
464
473
  }
465
- const n = t.map((c) => Object.values(c));
466
- function i(c) {
467
- return t.map((r) => r[c], { skipVoid: !1 });
474
+ const n = t.map((l) => Object.values(l));
475
+ function a(l) {
476
+ return t.map((s) => s[l], { skipVoid: !1 });
468
477
  }
469
478
  return {
470
- register: s,
471
- getByName: i,
479
+ register: r,
480
+ getByName: a,
472
481
  listStore: n
473
482
  };
474
483
  });
475
- function He() {
476
- return k(_e);
484
+ function Ke() {
485
+ return k(He);
477
486
  }
478
- const Ke = (t, e, s) => {
479
- s.register(t, e);
480
- }, qe = I("response"), Ge = v(({ client: t }) => {
481
- const e = qe.store({}), s = C(), n = C(), i = x(e, {
482
- register(a, p) {
487
+ const qe = (t, e, r) => {
488
+ r.register(t, e);
489
+ }, Ge = I("response"), We = w(({ client: t }) => {
490
+ const e = Ge.store({}), r = D(), n = D(), a = x(e, {
491
+ register(c, i) {
483
492
  return {
484
- ...a,
485
- [p.fieldId]: p.response
493
+ ...c,
494
+ [i.fieldId]: i.response
486
495
  };
487
496
  },
488
- registerBatch(a, p) {
497
+ registerBatch(c, i) {
489
498
  return {
490
- ...a,
491
- ...p
499
+ ...c,
500
+ ...i
492
501
  };
493
502
  },
494
- clear(a, p) {
495
- const { [p]: g, ...y } = a;
496
- return y;
503
+ clear(c, i) {
504
+ const { [i]: g, ...f } = c;
505
+ return f;
497
506
  },
498
507
  clearAll() {
499
508
  return {};
500
509
  }
501
510
  });
502
- function c(a, p) {
503
- i.register({ fieldId: a, response: p });
511
+ function l(c, i) {
512
+ a.register({ fieldId: c, response: i });
504
513
  }
505
- async function r(a) {
506
- const p = [];
514
+ async function s(c) {
515
+ const i = [];
507
516
  return await Promise.allSettled(
508
- Object.entries(a).map(async ([g, y]) => {
509
- let d = y;
510
- const S = t.fields.getById(g).getState();
511
- if (!S) {
512
- p.push({
517
+ Object.entries(c).map(async ([g, f]) => {
518
+ let p = f;
519
+ const y = t.fields.getById(g).getState();
520
+ if (!y) {
521
+ i.push({
513
522
  fieldId: g,
514
523
  userMessage: `Field '${g}' not found`,
515
524
  systemMessage: `No field with ID '${g}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,
516
- value: d
525
+ value: p
517
526
  });
518
527
  return;
519
528
  }
520
- if (S.multiple && (typeof d == "string" || typeof d == "number" || typeof d == "boolean") && (d = [d]), S.validation && !se(S.validation)) {
521
- const b = await R(t, S.validation, {
522
- $input: d
529
+ if (y.multiple && (typeof p == "string" || typeof p == "number" || typeof p == "boolean") && (p = [p]), y.validation && !ne(y.validation)) {
530
+ const b = await R(t, y.validation, {
531
+ $input: p
523
532
  });
524
533
  if (typeof b == "string") {
525
- p.push({
534
+ i.push({
526
535
  fieldId: g,
527
536
  userMessage: b,
528
537
  systemMessage: `Field validation resulted in an error: ${b}.`,
529
- value: d
538
+ value: p
530
539
  });
531
540
  return;
532
541
  }
533
542
  if (b === !1) {
534
- p.push({
543
+ i.push({
535
544
  fieldId: g,
536
545
  userMessage: "This field is invalid",
537
546
  systemMessage: "Field validation resulted in an unspecified error.",
538
- value: d
547
+ value: p
539
548
  });
540
549
  return;
541
550
  }
542
551
  }
543
- if (S.required && (typeof d > "u" || d === null || d === "" || Array.isArray(d) && !d.length)) {
544
- p.push({
552
+ if (y.required && (typeof p > "u" || p === null || p === "" || Array.isArray(p) && !p.length)) {
553
+ i.push({
545
554
  fieldId: g,
546
555
  userMessage: "This field is required",
547
556
  systemMessage: "Field is required.",
548
- value: d
557
+ value: p
549
558
  });
550
559
  return;
551
560
  }
552
- if (!S.multiple && Array.isArray(d) && d.length > 1) {
553
- p.push({
561
+ if (!y.multiple && Array.isArray(p) && p.length > 1) {
562
+ i.push({
554
563
  fieldId: g,
555
564
  userMessage: "This field expects a single response",
556
565
  systemMessage: "Field expects a single response.",
557
- value: d
566
+ value: p
558
567
  });
559
568
  return;
560
569
  }
561
- if (S.options) {
562
- const b = S.options.map((F) => F.value), B = Array.isArray(d) ? d : [d];
563
- Array.isArray(d) && (B.every((F) => b.includes(F)) || p.push({
570
+ if (y.options) {
571
+ const b = y.options.map((E) => E.value), B = Array.isArray(p) ? p : [p];
572
+ Array.isArray(p) && (B.every((E) => b.includes(E)) || i.push({
564
573
  fieldId: g,
565
574
  userMessage: "This field expects a valid option",
566
575
  systemMessage: `Field expects a valid option. Valid options are: ${b.join(", ")}`,
567
- value: d
576
+ value: p
568
577
  }));
569
578
  }
570
579
  })
571
- ), { responsesToCommit: a, validationErrors: p };
580
+ ), { responsesToCommit: c, validationErrors: i };
572
581
  }
573
- async function o(a) {
574
- const { responsesToCommit: p, validationErrors: g } = await r(a);
575
- return g.length ? { errors: g } : (i.registerBatch(p), { errors: [] });
582
+ async function o(c) {
583
+ const { responsesToCommit: i, validationErrors: g } = await s(c);
584
+ return g.length ? { errors: g } : (a.registerBatch(i), { errors: [] });
576
585
  }
577
- const u = e.map((a) => a), h = e.map((a) => Object.keys(a).map((g) => ({
586
+ const u = e.map((c) => c), h = e.map((c) => Object.keys(c).map((g) => ({
578
587
  fieldId: g,
579
- value: a[g]
588
+ value: c[g]
580
589
  })));
581
- function l(a) {
582
- const p = t.fields.getById(a), g = e.map((y) => y[a] || null);
583
- return j({ f: p, r: g }, ({ f: y, r: d }) => d || (y != null && y.defaultValue ? y.defaultValue : null));
584
- }
585
- function f(a) {
586
- const p = t.fields.getByName(a);
587
- return j({ f: p, s: e }, ({ f: g, s: y }) => {
588
- const d = g && y[g.id] || null;
589
- return d || (g != null && g.defaultValue ? g.defaultValue : null);
590
+ function S(c) {
591
+ const i = t.fields.getById(c), g = e.map((f) => f[c] || null);
592
+ return C({ f: i, r: g }, ({ f, r: p }) => p || (f != null && f.defaultValue ? f.defaultValue : null));
593
+ }
594
+ function d(c) {
595
+ const i = t.fields.getByName(c);
596
+ return C({ f: i, s: e }, ({ f: g, s: f }) => {
597
+ const p = g && f[g.id] || null;
598
+ return p || (g != null && g.defaultValue ? g.defaultValue : null);
590
599
  });
591
600
  }
592
- return P({
593
- clock: s,
594
- target: i.clearAll
595
- }), P({
601
+ return F({
602
+ clock: r,
603
+ target: a.clearAll
604
+ }), F({
596
605
  clock: n,
597
- target: i.clear
606
+ target: a.clear
598
607
  }), {
599
- register: c,
600
- clearAll: s,
608
+ register: l,
609
+ clearAll: r,
601
610
  clear: n,
602
611
  commit: o,
603
- getResponsesToCommit: r,
612
+ getResponsesToCommit: s,
604
613
  listStore: h,
605
614
  getAllStore: u,
606
- getByFieldId: l,
607
- getByFieldName: f
615
+ getByFieldId: S,
616
+ getByFieldName: d
608
617
  };
609
618
  });
610
- function We(t) {
611
- return k(Ge, t);
619
+ function Ye(t) {
620
+ return k(We, t);
612
621
  }
613
- const Ye = () => "0.0.12-next.3";
614
- function Je() {
622
+ const Je = () => "0.0.12-next.4";
623
+ function Qe() {
615
624
  if (z()) {
616
625
  const t = [
617
626
  document.currentScript,
@@ -626,103 +635,103 @@ function Je() {
626
635
  }
627
636
  return "https://api.picked.app";
628
637
  }
629
- function Qe() {
630
- if (!ne())
638
+ function Xe() {
639
+ if (!oe())
631
640
  return {};
632
- const t = new URLSearchParams(window.location.search), e = {}, s = /* @__PURE__ */ new Set();
633
- for (const [i] of t.entries())
634
- i.startsWith("picked-") && s.add(i);
635
- for (const i of s) {
636
- const c = i.replace("picked-", "");
637
- e[c] = t.getAll(i);
641
+ const t = new URLSearchParams(window.location.search), e = {}, r = /* @__PURE__ */ new Set();
642
+ for (const [a] of t.entries())
643
+ a.startsWith("picked-") && r.add(a);
644
+ for (const a of r) {
645
+ const l = a.replace("picked-", "");
646
+ e[l] = t.getAll(a);
638
647
  }
639
648
  const n = A("s");
640
- if (s.size > 0)
649
+ if (r.size > 0)
641
650
  $.set(n, e);
642
651
  else {
643
- const i = $.get(n);
644
- if (i)
645
- return i.json() || {};
652
+ const a = $.get(n);
653
+ if (a)
654
+ return a.json() || {};
646
655
  }
647
656
  return e;
648
657
  }
649
- function Xe() {
650
- if (ie())
658
+ function Ze() {
659
+ if (ae())
651
660
  return crypto.randomUUID();
652
- const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), s = Math.random().toString(36).substring(2, 15), n = Math.random().toString(36).substring(2, 15);
653
- return `${t}-${e}-${s}-${n}`;
661
+ const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), r = Math.random().toString(36).substring(2, 15), n = Math.random().toString(36).substring(2, 15);
662
+ return `${t}-${e}-${r}-${n}`;
654
663
  }
655
- const Ze = () => ({
656
- id: Xe()
657
- }), et = A("session", "global"), tt = () => {
658
- if (!oe()) return null;
659
- const t = D.get(et);
664
+ const et = () => ({
665
+ id: Ze()
666
+ }), tt = A("session", "global"), rt = () => {
667
+ if (!ie()) return null;
668
+ const t = O.get(tt);
660
669
  let e = t.isSet() ? t.json() : null;
661
- return e || (e = Ze(), t.set(e)), e;
662
- }, rt = () => tt();
663
- class K {
670
+ return e || (e = et(), t.set(e)), e;
671
+ }, st = () => rt();
672
+ class q {
664
673
  constructor(e) {
665
674
  m(this, "options");
666
675
  m(this, "isReady", !1);
667
676
  m(this, "project");
668
677
  m(this, "plugins", {});
669
- m(this, "eventBus", Te());
678
+ m(this, "eventBus", Ve());
670
679
  m(this, "organizationId");
671
680
  m(this, "projectId");
672
681
  m(this, "apiUrl");
673
682
  m(this, "session");
674
- m(this, "searchParams", Qe());
675
- m(this, "history", Me());
683
+ m(this, "searchParams", Xe());
684
+ m(this, "history", Te());
676
685
  m(this, "components", we({ client: this }));
677
- m(this, "experienceInstances", ee({ client: this }));
678
- m(this, "experiences", de({ client: this }));
679
- m(this, "frameworks", be({ client: this }));
686
+ m(this, "experienceInstances", te({ client: this }));
687
+ m(this, "experiences", pe({ client: this }));
688
+ m(this, "frameworks", Ie({ client: this }));
680
689
  m(this, "predicates", $e({ client: this }));
681
- m(this, "features", Ce());
682
- m(this, "responses", We({ client: this }));
683
- m(this, "fields", Le());
684
- m(this, "actions", He());
685
- w("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Je(), this.session = rt(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.eventBus({ type: "initialized", version: Ye() }), w("info", "Picked client initialized.");
690
+ m(this, "features", De({ client: this }));
691
+ m(this, "responses", Ye({ client: this }));
692
+ m(this, "fields", Ue());
693
+ m(this, "actions", Ke());
694
+ v("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Qe(), this.session = st(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.eventBus({ type: "initialized", version: Je() }), v("info", "Picked client initialized.");
686
695
  }
687
696
  start() {
688
- Ee(this), (async () => {
689
- z() && (document.body && M(this), await te(), await M(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session }));
697
+ Pe(this), (async () => {
698
+ z() && (document.body && T(this), await re(), await T(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session }));
690
699
  })();
691
700
  }
692
701
  registerFramework(e) {
693
- Ie(e, this.frameworks);
702
+ xe(e, this.frameworks);
694
703
  }
695
- registerComponent(e, s) {
696
- T(e, s, this.components);
704
+ registerComponent(e, r) {
705
+ V(e, r, this.components);
697
706
  }
698
707
  registerPlugin(e) {
699
- fe(this, e, this.plugins);
708
+ me(this, e, this.plugins);
700
709
  }
701
- registerFeature(e, s) {
702
- De(e, s, this.features);
710
+ registerFeature(e, r) {
711
+ Oe(e, r, this.features);
703
712
  }
704
- registerPredicate(e, s) {
705
- Be(e, s, this.predicates);
713
+ registerPredicate(e, r) {
714
+ je(e, r, this.predicates);
706
715
  }
707
716
  registerField(e) {
708
- Ue(e, this.fields);
717
+ _e(e, this.fields);
709
718
  }
710
- registerAction(e, s) {
711
- Ke(e, s, this.actions);
719
+ registerAction(e, r) {
720
+ qe(e, r, this.actions);
712
721
  }
713
722
  registerExperience(e) {
714
- e.component && T(`experience:${e.id}`, e.component, this.components), pe(e, this.experiences);
723
+ e.component && V(`experience:${e.id}`, e.component, this.components), ge(e, this.experiences);
715
724
  }
716
725
  getStateSnapshot() {
717
- return Pe(this);
726
+ return Re(this);
718
727
  }
719
728
  async launchExperienceById(e) {
720
- const s = this.experiences.getById(e).getState();
721
- if (!s) {
722
- w("warn", `Experience with id '${e}' not found.`);
729
+ const r = this.experiences.getById(e).getState();
730
+ if (!r) {
731
+ v("warn", `Experience with id '${e}' not found.`);
723
732
  return;
724
733
  }
725
- H(this, s);
734
+ K(this, r);
726
735
  }
727
736
  // private async fetchProject() {
728
737
  // if (this.project) {
@@ -735,16 +744,16 @@ class K {
735
744
  // }
736
745
  setupPlugins() {
737
746
  var e;
738
- (e = this.options.plugins) == null || e.forEach((s) => {
739
- if (Array.isArray(s)) {
740
- s.forEach((i) => {
741
- this.registerPlugin(i);
747
+ (e = this.options.plugins) == null || e.forEach((r) => {
748
+ if (Array.isArray(r)) {
749
+ r.forEach((a) => {
750
+ this.registerPlugin(a);
742
751
  });
743
752
  return;
744
753
  }
745
- const n = typeof s == "function" ? s() : s;
754
+ const n = typeof r == "function" ? r() : r;
746
755
  if (Array.isArray(n)) {
747
- n.forEach((i) => this.registerPlugin(i));
756
+ n.forEach((a) => this.registerPlugin(a));
748
757
  return;
749
758
  }
750
759
  this.registerPlugin(n);
@@ -752,21 +761,21 @@ class K {
752
761
  }
753
762
  setupFeatures() {
754
763
  const e = this.options.features;
755
- e && (Object.entries(e).forEach(([s, n]) => {
756
- const i = typeof n == "function" ? n() : n;
757
- this.registerFeature(s, i);
758
- }), this.searchParams.feature && this.searchParams.feature.forEach((s) => {
764
+ e && (Object.entries(e).forEach(([r, n]) => {
765
+ const a = typeof n == "function" ? n() : n;
766
+ this.registerFeature(r, a);
767
+ }), this.searchParams.feature && this.searchParams.feature.forEach((r) => {
759
768
  try {
760
- const [n, i] = s.split(":");
761
- if (!n || !i)
769
+ const [n, a] = r.split(":");
770
+ if (!n || !a)
762
771
  return;
763
- let c = i;
764
- c === "true" && (c = !0), c === "false" && (c = !1), this.registerFeature(n, {
765
- key: `${c}`,
772
+ let l = a;
773
+ l === "true" && (l = !0), l === "false" && (l = !1), this.registerFeature(n, {
774
+ key: `${l}`,
766
775
  // use the assigned bucket value as the key
767
776
  name: n,
768
777
  // eslint-disable-next-line sonarjs/function-return-type
769
- decide: () => c,
778
+ decide: () => l,
770
779
  storage: "session"
771
780
  });
772
781
  } catch {
@@ -775,73 +784,73 @@ class K {
775
784
  }
776
785
  setupPredicates() {
777
786
  const e = this.options.predicates;
778
- e && Object.entries(e).forEach(([s, n]) => {
787
+ e && Object.entries(e).forEach(([r, n]) => {
779
788
  if (typeof n != "function") {
780
- w("warn", `Predicate "${s}" is not a function.`);
789
+ v("warn", `Predicate "${r}" is not a function.`);
781
790
  return;
782
791
  }
783
- this.registerPredicate(s, n);
792
+ this.registerPredicate(r, n);
784
793
  });
785
794
  }
786
795
  setupActions() {
787
796
  const e = this.options.actions;
788
- e && Object.entries(e).forEach(([s, n]) => {
797
+ e && Object.entries(e).forEach(([r, n]) => {
789
798
  if (typeof n != "function") {
790
- w("warn", `Action "${s}" is not a function.`);
799
+ v("warn", `Action "${r}" is not a function.`);
791
800
  return;
792
801
  }
793
- this.registerAction(s, n);
802
+ this.registerAction(r, n);
794
803
  });
795
804
  }
796
805
  getPluginConfig(e) {
797
806
  return this.plugins[e] ?? {};
798
807
  }
799
808
  }
800
- m(K, "logger", w);
801
- function q(t) {
809
+ m(q, "logger", v);
810
+ function G(t) {
802
811
  var e;
803
- return ((e = t.options) == null ? void 0 : e.some((s) => "condition" in s)) ?? !1;
812
+ return ((e = t.options) == null ? void 0 : e.some((r) => "condition" in r)) ?? !1;
804
813
  }
805
- function st(t) {
806
- return t.some((e) => e.condition || q(e));
814
+ function nt(t) {
815
+ return t.some((e) => e.condition || G(e));
807
816
  }
808
- async function gt(t, e) {
809
- return e.length === 0 || !st(e) ? e : (await Promise.all(
817
+ async function ft(t, e) {
818
+ return e.length === 0 || !nt(e) ? e : (await Promise.all(
810
819
  e.map(async (n) => {
811
820
  if (!(n.condition ? await R(t, n.condition) : !0))
812
821
  return null;
813
- if (!n.options || !q(n))
822
+ if (!n.options || !G(n))
814
823
  return n;
815
- const r = (await Promise.all(
824
+ const s = (await Promise.all(
816
825
  n.options.map(async (u) => u.condition ? await R(t, u.condition) ? u : null : u)
817
826
  )).filter((u) => u !== null);
818
- return r.length === n.options.length ? n : r.length === 0 ? null : { ...n, options: r };
827
+ return s.length === n.options.length ? n : s.length === 0 ? null : { ...n, options: s };
819
828
  })
820
829
  )).filter((n) => n !== null);
821
830
  }
822
- const ft = (t) => {
823
- const e = new K(t);
824
- return ae(e), e;
831
+ const mt = (t) => {
832
+ const e = new q(t);
833
+ return ce(e), e;
825
834
  };
826
835
  export {
827
- K as Picked,
828
- ft as createClient,
836
+ q as Picked,
837
+ mt as createClient,
829
838
  A as createStorageKey,
830
839
  R as evaluateRuleLogic,
831
- gt as getStepFields,
832
- yt as isPickedRoot,
833
- D as localStore,
840
+ ft as getStepFields,
841
+ St as isPickedRoot,
842
+ O as localStore,
834
843
  $ as sessionStore,
835
844
  wt as subscribe,
836
- kt as supportsCookies,
837
- ie as supportsCryptoRandomUUID,
845
+ bt as supportsCookies,
846
+ ae as supportsCryptoRandomUUID,
838
847
  z as supportsDocument,
839
- bt as supportsHistory,
840
- It as supportsIntersectionObserver,
841
- oe as supportsLocalStorage,
842
- xt as supportsLocation,
843
- Ft as supportsSessionStorage,
844
- Et as supportsShadowRoot,
845
- Pt as supportsWebComponents,
846
- ne as supportsWindow
848
+ It as supportsHistory,
849
+ xt as supportsIntersectionObserver,
850
+ ie as supportsLocalStorage,
851
+ Ft as supportsLocation,
852
+ Et as supportsSessionStorage,
853
+ Pt as supportsShadowRoot,
854
+ Rt as supportsWebComponents,
855
+ oe as supportsWindow
847
856
  };