@picked/client 0.0.1-dev.1787019239195 → 0.0.1-dev.1787543060859

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 (78) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/api-CahTmEWe.cjs +1 -0
  3. package/dist/api-DwTNwuWK.js +33 -0
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/plugins/telemetry/index.js +1 -0
  7. package/dist/cjs/server/index.js +1 -1
  8. package/dist/docs/explanation/feature-flag-allocation.md +43 -1
  9. package/dist/docs/how-to/install-the-sdk.md +2 -2
  10. package/dist/docs/how-to/read-a-feature-flag.md +22 -10
  11. package/dist/docs/how-to/read-a-referenced-entry.md +4 -6
  12. package/dist/docs/how-to/render-a-step-form.md +3 -4
  13. package/dist/docs/how-to/switch-workspaces.md +1 -2
  14. package/dist/docs/reference/dashboard/features.mdx +45 -5
  15. package/dist/docs/reference/delivery-api/workspace-schema.md +12 -1
  16. package/dist/docs/reference/pickedql/dimensions.md +6 -0
  17. package/dist/docs/reference/pickedql/virtual-functions.md +16 -5
  18. package/dist/docs/reference/sdk/content.md +6 -9
  19. package/dist/docs/reference/sdk/features.md +24 -6
  20. package/dist/docs/reference/sdk/steps.md +3 -4
  21. package/dist/docs/reference/sdk/type-generation.md +18 -4
  22. package/dist/docs/reference/tools/cli.md +3 -5
  23. package/dist/docs/reference/tools/vite-plugin.md +1 -5
  24. package/dist/docs/tutorials/first-experience.mdx +4 -5
  25. package/dist/emit-D-tLiWL1.cjs +1 -0
  26. package/dist/emit-Ds2EG7CB.js +14 -0
  27. package/dist/esm/index.js +275 -490
  28. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  29. package/dist/esm/plugins/telemetry/index.js +101 -0
  30. package/dist/esm/server/index.js +1 -1
  31. package/dist/plugin-BcFzHPC7.cjs +1 -0
  32. package/dist/{plugin-Bb2fJVFr.js → plugin-L5y4NdFX.js} +83 -47
  33. package/dist/{provider-DZEDUlIk.cjs → provider-BLDm3i8g.cjs} +1 -1
  34. package/dist/{provider-B8vTLrFT.js → provider-Dx6VjvZg.js} +1 -1
  35. package/dist/request-observer-BXDfOU0V.cjs +1 -0
  36. package/dist/request-observer-DtG0cRfz.js +19 -0
  37. package/dist/types/data-source/api.d.ts.map +1 -1
  38. package/dist/types/data-source/provider.d.ts +11 -1
  39. package/dist/types/data-source/provider.d.ts.map +1 -1
  40. package/dist/types/data-source/request-observer.d.ts +46 -0
  41. package/dist/types/data-source/request-observer.d.ts.map +1 -0
  42. package/dist/types/entities/feature/feature.d.ts +53 -5
  43. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  44. package/dist/types/entities/plugin/plugin.d.ts +4 -0
  45. package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
  46. package/dist/types/index.d.ts +1 -1
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/types/lifecycle/lifecycle.d.ts.map +1 -1
  49. package/dist/types/picked.d.ts +13 -2
  50. package/dist/types/picked.d.ts.map +1 -1
  51. package/dist/types/plugins/dynamic-experiences/hash.d.ts +53 -1
  52. package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +1 -1
  53. package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -0
  54. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
  55. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +1 -1
  56. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  57. package/dist/types/plugins/dynamic-experiences/types.d.ts +3 -4
  58. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  59. package/dist/types/plugins/telemetry/emit.d.ts +18 -0
  60. package/dist/types/plugins/telemetry/emit.d.ts.map +1 -0
  61. package/dist/types/plugins/telemetry/index.d.ts +4 -0
  62. package/dist/types/plugins/telemetry/index.d.ts.map +1 -0
  63. package/dist/types/plugins/telemetry/plugin-summary.d.ts +10 -0
  64. package/dist/types/plugins/telemetry/plugin-summary.d.ts.map +1 -0
  65. package/dist/types/plugins/telemetry/plugin.d.ts +36 -0
  66. package/dist/types/plugins/telemetry/plugin.d.ts.map +1 -0
  67. package/dist/types/schema-registry.d.ts +16 -0
  68. package/dist/types/schema-registry.d.ts.map +1 -1
  69. package/dist/types/utils/user-timing.d.ts +18 -0
  70. package/dist/types/utils/user-timing.d.ts.map +1 -0
  71. package/dist/version-BqU6f22c.cjs +1 -0
  72. package/dist/version-DAFO6eas.js +256 -0
  73. package/package.json +16 -4
  74. package/dist/api-TWnRLh3X.cjs +0 -1
  75. package/dist/api-uttjU_Tg.js +0 -22
  76. package/dist/plugin-hFQIiHOB.cjs +0 -1
  77. package/dist/version-CfTz7TK0.cjs +0 -1
  78. package/dist/version-DjCWhJD5.js +0 -4
package/dist/esm/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import { t as e } from "../object-BUDGxEqy.js";
2
2
  import { n as t, t as n } from "../rules-logic-HesIUCu6.js";
3
3
  import { t as r } from "../logger-DMN6TxJJ.js";
4
- import { a as i, c as a, d as o, f as s, i as c, l, m as u, n as d, o as f, r as p, s as m, t as h, u as g } from "../supports-CO9bJGNl.js";
5
- import { a as _, i as v, r as ee, s as y, t as b } from "../dom-BqcToNL0.js";
6
- import { l as x, n as S, r as C, u as w } from "../experience-instance-DGk11d8a.js";
7
- import { i as T, n as E, r as D, t as O } from "../storage-1MW3-_As.js";
8
- import { t as te } from "../id-Bo4RBeOs.js";
9
- import { t as ne } from "../version-DjCWhJD5.js";
10
- import { n as re, r as ie, t as ae } from "../inert-script-report-B_bMPRzp.js";
11
- import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, is as oe, sample as I } from "effector";
4
+ import { a as i, c as a, d as o, f as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _ } from "../supports-CO9bJGNl.js";
5
+ import { a as v, i as y, r as ee, s as b, t as x } from "../dom-BqcToNL0.js";
6
+ import { l as S, n as C, r as w, u as T } from "../experience-instance-DGk11d8a.js";
7
+ import { i as te, n as E, r as D, t as O } from "../storage-1MW3-_As.js";
8
+ import { i as ne, n as re, r as ie, t as ae } from "../version-DAFO6eas.js";
9
+ import { t as oe } from "../id-Bo4RBeOs.js";
10
+ import { n as se, r as ce, t as le } from "../inert-script-report-B_bMPRzp.js";
11
+ import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, is as ue, sample as I } from "effector";
12
12
  import { createFactory as L, invoke as R } from "@withease/factories";
13
- import { sendPing as se } from "@picked/delivery-api-client";
13
+ import { sendPing as de } from "@picked/delivery-api-client";
14
14
  //#region src/entities/experience/experience.ts
15
- var z = M("experience"), ce = L(({ client: e, experience: r }) => {
15
+ var z = M("experience"), fe = L(({ client: e, experience: r }) => {
16
16
  let i = z.store(r), a = j(i, { merge(e, t) {
17
17
  return {
18
18
  ...e,
@@ -24,7 +24,7 @@ var z = M("experience"), ce = L(({ client: e, experience: r }) => {
24
24
  targetSelectors: e.targets,
25
25
  initializeOpenLogic: e.initializeOpen
26
26
  })), s = A(i, e.components.listStore, (e, t) => (e.componentName ? t.find((t) => t.name === e.componentName) : void 0) || t.find((t) => t.name === `experience:${e.id}`) || t.find((e) => e.name === "experience"), { skipVoid: !1 }), c = A(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
27
- let r = e.nodes.filter(w).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(x).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
27
+ let r = e.nodes.filter(T).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(S).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
28
28
  return {
29
29
  steps: r,
30
30
  nodes: e.nodes,
@@ -34,8 +34,8 @@ var z = M("experience"), ce = L(({ client: e, experience: r }) => {
34
34
  }), l = r.actions ?? [], u, d = k({
35
35
  source: o,
36
36
  effect: (t, n) => {
37
- let i = v(t.targetSelectors, r.id);
38
- i.forEach(({ elements: e }) => e.forEach((e) => y(e, r.id))), b(i, r.id, r.key).forEach((t) => {
37
+ let i = y(t.targetSelectors, r.id);
38
+ i.forEach(({ elements: e }) => e.forEach((e) => b(e, r.id))), x(i, r.id, r.key).forEach((t) => {
39
39
  n ? e.experienceInstances.spawn(u, t, n) : e.experienceInstances.spawn(u, t);
40
40
  });
41
41
  }
@@ -48,7 +48,7 @@ var z = M("experience"), ce = L(({ client: e, experience: r }) => {
48
48
  effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
49
49
  if (!i || !a) return !1;
50
50
  let { decisionLogic: s, targetSelectors: c } = o;
51
- return c.length === 0 || v(c, r.id).length < 1 ? !1 : s === void 0 || !t(s) || await n(e, s) === !0;
51
+ return c.length === 0 || y(c, r.id).length < 1 ? !1 : s === void 0 || !t(s) || await n(e, s) === !0;
52
52
  }
53
53
  }), m = N(async () => {
54
54
  if (!e.contentLoader) return !0;
@@ -99,17 +99,17 @@ var z = M("experience"), ce = L(({ client: e, experience: r }) => {
99
99
  prepareExperienceContentFx: m
100
100
  }, u;
101
101
  });
102
- function le(e) {
103
- return R(ce, e);
102
+ function pe(e) {
103
+ return R(fe, e);
104
104
  }
105
- var ue = L(({ client: e }) => {
105
+ var me = L(({ client: e }) => {
106
106
  let t = z.store({}), n = j(t, { register(e, t) {
107
107
  return {
108
108
  ...e,
109
109
  [t.id]: t
110
110
  };
111
111
  } }), r = P(), i = N((t) => {
112
- n.register(le({
112
+ n.register(pe({
113
113
  client: e,
114
114
  experience: t
115
115
  }));
@@ -195,38 +195,35 @@ var ue = L(({ client: e }) => {
195
195
  })
196
196
  };
197
197
  });
198
- function de(e) {
199
- return R(ue, e);
198
+ function he(e) {
199
+ return R(me, e);
200
200
  }
201
- var fe = async (e) => {
201
+ var ge = async (e) => {
202
202
  await e.experiences.initialiseExperiencesFx();
203
203
  };
204
204
  //#endregion
205
205
  //#region src/entities/plugin/plugin.ts
206
- function pe(e) {
206
+ function _e(e) {
207
207
  return N(async () => {
208
208
  await e();
209
209
  });
210
210
  }
211
- var me = (e, t, n) => {
212
- let r = t.name, i = t.setup(e);
213
- if (i) {
214
- let e = n[r] ?? {};
215
- n[r] = Object.freeze({
216
- ...e,
217
- ...i
218
- });
219
- }
220
- }, he = M("component"), ge = L(({ client: e, component: t, name: n }) => ({
211
+ var ve = (e, t, n) => {
212
+ let r = t.name, i = t.setup(e), a = n[r] ?? {};
213
+ n[r] = Object.freeze({
214
+ ...a,
215
+ ...i
216
+ });
217
+ }, ye = M("component"), be = L(({ client: e, component: t, name: n }) => ({
221
218
  name: n,
222
219
  component: t,
223
220
  frameworkStore: e.frameworks.getByName(t.frameworkName)
224
221
  }));
225
- function _e(e) {
226
- return R(ge, e);
222
+ function xe(e) {
223
+ return R(be, e);
227
224
  }
228
- var ve = L(({ client: e }) => {
229
- let t = he.store({}), n = j(t, { register(e, t) {
225
+ var Se = L(({ client: e }) => {
226
+ let t = ye.store({}), n = j(t, { register(e, t) {
230
227
  return {
231
228
  ...e,
232
229
  [t.name]: t
@@ -239,7 +236,7 @@ var ve = L(({ client: e }) => {
239
236
  fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
240
237
  }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
241
238
  clock: i,
242
- fn: ({ name: t, component: n }) => _e({
239
+ fn: ({ name: t, component: n }) => xe({
243
240
  client: e,
244
241
  name: t,
245
242
  component: n
@@ -256,16 +253,16 @@ var ve = L(({ client: e }) => {
256
253
  listStore: a
257
254
  };
258
255
  });
259
- function ye(e) {
260
- return R(ve, e);
256
+ function Ce(e) {
257
+ return R(Se, e);
261
258
  }
262
- var be = (e, t, n) => {
259
+ var we = (e, t, n) => {
263
260
  n.register({
264
261
  name: e,
265
262
  component: t
266
263
  });
267
- }, xe = M("framework"), Se = L((e) => {
268
- let t = xe.store({}), n = j(t, { register(e, t) {
264
+ }, Te = M("framework"), Ee = L((e) => {
265
+ let t = Te.store({}), n = j(t, { register(e, t) {
269
266
  return {
270
267
  ...e,
271
268
  [t.name]: t.framework
@@ -290,15 +287,15 @@ var be = (e, t, n) => {
290
287
  listStore: a
291
288
  };
292
289
  });
293
- function Ce(e) {
294
- return R(Se, e);
290
+ function De(e) {
291
+ return R(Ee, e);
295
292
  }
296
- var we = (e, t) => {
293
+ var Oe = (e, t) => {
297
294
  t.register({
298
295
  name: e.name,
299
296
  framework: e
300
297
  });
301
- }, Te = L(({ client: e }) => {
298
+ }, ke = L(({ client: e }) => {
302
299
  let t = "window" in globalThis, n = {
303
300
  location: t ? globalThis.location : void 0,
304
301
  document: t ? globalThis.document : void 0,
@@ -312,12 +309,12 @@ var we = (e, t) => {
312
309
  ...n
313
310
  }));
314
311
  });
315
- function Ee(e) {
316
- return R(Te, e);
312
+ function Ae(e) {
313
+ return R(ke, e);
317
314
  }
318
315
  //#endregion
319
316
  //#region src/logic-engine.ts
320
- function De(e) {
317
+ function je(e) {
321
318
  return typeof e == "number" && !isNaN(e);
322
319
  }
323
320
  function B(e) {
@@ -326,21 +323,21 @@ function B(e) {
326
323
  function V(e) {
327
324
  return Array.isArray(e);
328
325
  }
329
- function Oe(e) {
326
+ function Me(e) {
330
327
  return e instanceof Promise;
331
328
  }
332
- function ke(e) {
329
+ function Ne(e) {
333
330
  return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
334
331
  }
335
332
  function H(e) {
336
- if (De(e)) return e;
333
+ if (je(e)) return e;
337
334
  let t = parseFloat(`${e}`);
338
335
  return isNaN(t) ? 0 : t;
339
336
  }
340
337
  function U(e) {
341
338
  return `${e}`;
342
339
  }
343
- var Ae = {
340
+ var Pe = {
344
341
  "==": (e, t) => e == t,
345
342
  "===": (e, t) => e === t,
346
343
  "!=": (e, t) => e != t,
@@ -435,10 +432,10 @@ var Ae = {
435
432
  };
436
433
  async function W(e, t) {
437
434
  if (!e) return e;
438
- if (Oe(e)) return W(await e, t);
435
+ if (Me(e)) return W(await e, t);
439
436
  if (V(e)) return Promise.all(e.map((e) => W(e, t)));
440
- if (!ke(e)) return e;
441
- let n = je(e), r = n ? e[n] ?? [] : [];
437
+ if (!Ne(e)) return e;
438
+ let n = Fe(e), r = n ? e[n] ?? [] : [];
442
439
  switch (V(r) || (r = [r]), n) {
443
440
  case "if":
444
441
  case "?:":
@@ -496,32 +493,32 @@ async function W(e, t) {
496
493
  case "catch": try {
497
494
  return await W(r[0], t);
498
495
  } catch (e) {
499
- return ke(e) ? await W(e, t) : r[1] ? await W(r[1], e) : e instanceof Error ? e.message : e;
496
+ return Ne(e) ? await W(e, t) : r[1] ? await W(r[1], e) : e instanceof Error ? e.message : e;
500
497
  }
501
498
  }
502
- let i = await Promise.all(r.map((e) => W(e, t))), a = n ? Ae[n] : void 0;
499
+ let i = await Promise.all(r.map((e) => W(e, t))), a = n ? Pe[n] : void 0;
503
500
  if (!a) throw Error(`Unrecognized operation ${n}`);
504
501
  return a.apply(t, i);
505
502
  }
506
503
  async function G(e) {
507
- return Oe(e) ? G(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
504
+ return Me(e) ? G(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
508
505
  }
509
- function je(e) {
506
+ function Fe(e) {
510
507
  return Object.keys(e)[0];
511
508
  }
512
509
  //#endregion
513
510
  //#region src/lifecycle/rules-logic.ts
514
- function Me(e, t, n) {
511
+ function Ie(e, t, n) {
515
512
  return new Proxy(Object.create(null), { get(r, i) {
516
513
  if (typeof i != "string") return;
517
514
  let a = e.find((e) => e.key === i);
518
515
  if (a !== void 0) return async () => !n.has(i) && await W(a.logic, {
519
516
  ...t,
520
- conditions: Me(e, t, new Set(n).add(i))
517
+ conditions: Ie(e, t, new Set(n).add(i))
521
518
  }) === !0;
522
519
  } });
523
520
  }
524
- var Ne = L(({ client: e }) => k({
521
+ var Le = L(({ client: e }) => k({
525
522
  source: {
526
523
  stateSnapshot: e.stateSnapshotStore,
527
524
  predicates: e.predicates.listStore,
@@ -560,22 +557,22 @@ var Ne = L(({ client: e }) => k({
560
557
  };
561
558
  return await W(o, {
562
559
  ...d,
563
- conditions: Me(a, d, /* @__PURE__ */ new Set())
560
+ conditions: Ie(a, d, /* @__PURE__ */ new Set())
564
561
  });
565
562
  }
566
563
  }));
567
- function Pe(e) {
568
- return R(Ne, e);
564
+ function Re(e) {
565
+ return R(Le, e);
569
566
  }
570
567
  //#endregion
571
568
  //#region src/ping.ts
572
- var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
569
+ var ze = 6e3, Be = O("last_ping", "global"), Ve = async (e) => {
573
570
  try {
574
- let t = Date.now(), n = E.get(Ie), r = 0;
575
- if (n.isSet() && (r = n.json() ?? 0), r && t - r < Fe) return !0;
571
+ let t = Date.now(), n = E.get(Be), r = 0;
572
+ if (n.isSet() && (r = n.json() ?? 0), r && t - r < ze) return !0;
576
573
  let i = {}, a = document.getElementById("picked_script")?.dataset.verceltoken;
577
574
  a && (i["x-vercel-protection-bypass"] = a);
578
- let o = await se(e.apiUrl, {
575
+ let o = await de(e.apiUrl, {
579
576
  projectId: e.projectId,
580
577
  path: window.location.pathname
581
578
  }, { headers: i });
@@ -583,7 +580,27 @@ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
583
580
  } catch {
584
581
  return !1;
585
582
  }
586
- }, K = M("lifecycle"), Re = L(({ client: e }) => {
583
+ }, He = "picked:start:begin", Ue = "picked:start";
584
+ function We() {
585
+ try {
586
+ return s() && !!p.window && "performance" in p;
587
+ } catch {
588
+ return !1;
589
+ }
590
+ }
591
+ function Ge() {
592
+ if (We()) try {
593
+ performance.mark(He);
594
+ } catch {}
595
+ }
596
+ function Ke() {
597
+ if (We()) try {
598
+ performance.measure(Ue, He);
599
+ } catch {}
600
+ }
601
+ //#endregion
602
+ //#region src/lifecycle/lifecycle.ts
603
+ var K = M("lifecycle"), qe = L(({ client: e }) => {
587
604
  let t = K.store(!1), r = F(void 0, {
588
605
  skipVoid: !1,
589
606
  domain: K
@@ -599,11 +616,11 @@ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
599
616
  }), u = P(), d = P(), f = P(), p = P(), m = P(), h = P();
600
617
  o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
601
618
  let g = N(() => {
602
- Le(e);
619
+ Ve(e);
603
620
  }), _ = N(async () => {
604
621
  await ee();
605
622
  }), v = N(async () => {
606
- await fe(e);
623
+ await ge(e);
607
624
  }), y = k({ effect: v }), b = k({
608
625
  source: o,
609
626
  effect: async (e) => {
@@ -625,7 +642,7 @@ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
625
642
  clock: C,
626
643
  fn: () => "starting",
627
644
  target: a
628
- }), I({
645
+ }), C.watch(Ge), d.watch(Ke), I({
629
646
  clock: C,
630
647
  target: g
631
648
  }), I({
@@ -671,24 +688,24 @@ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
671
688
  fn: () => ({ type: "initialize" }),
672
689
  target: e.eventBus
673
690
  });
674
- let w = F(!1).on(_.done, () => !0), T = F(!1).on(f, () => !0), E = F(!1).on(y.done, () => !0), D = A(r, i, (e, t) => e === !0 && t === !0);
691
+ let w = F(!1).on(_.done, () => !0), T = F(!1).on(f, () => !0), te = F(!1).on(y.done, () => !0), E = A(r, i, (e, t) => e === !0 && t === !0);
675
692
  I({
676
693
  clock: f,
677
- source: D,
694
+ source: E,
678
695
  filter: (e) => e,
679
696
  fn: () => void 0,
680
697
  target: v
681
698
  });
682
- let O = A(w, T, D, (e, t, n) => e && t && n);
699
+ let D = A(w, T, E, (e, t, n) => e && t && n);
683
700
  I({
684
- clock: O,
701
+ clock: D,
685
702
  filter: (e) => e,
686
703
  fn: () => void 0,
687
704
  target: y
688
705
  });
689
- let te = A(w, T, D, E, (e, t, n, r) => e && t && (!n || r));
706
+ let O = A(w, T, E, te, (e, t, n, r) => e && t && (!n || r));
690
707
  return I({
691
- clock: te,
708
+ clock: O,
692
709
  filter: (e) => e,
693
710
  fn: () => void 0,
694
711
  target: d
@@ -732,13 +749,13 @@ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
732
749
  setCondition: h
733
750
  };
734
751
  });
735
- function ze(e) {
736
- return R(Re, e);
752
+ function Je(e) {
753
+ return R(qe, e);
737
754
  }
738
755
  //#endregion
739
756
  //#region src/entities/predicate/predicate.ts
740
- var Be = M("predicate"), Ve = L(({ client: e }) => {
741
- let t = Be.store({}), n = j(t, { register(e, t) {
757
+ var Ye = M("predicate"), Xe = L(({ client: e }) => {
758
+ let t = Ye.store({}), n = j(t, { register(e, t) {
742
759
  return {
743
760
  ...e,
744
761
  [t.name]: {
@@ -796,261 +813,26 @@ var Be = M("predicate"), Ve = L(({ client: e }) => {
796
813
  getEvokablePredicate: s
797
814
  };
798
815
  });
799
- function He(e) {
800
- return R(Ve, e);
816
+ function Ze(e) {
817
+ return R(Xe, e);
801
818
  }
802
- var Ue = (e, t, n) => {
819
+ var Qe = (e, t, n) => {
803
820
  n.register({
804
821
  name: e,
805
822
  predicate: t
806
823
  });
807
- }, We = M("feature");
808
- function q(e) {
809
- return e?.enabled === !1;
810
- }
811
- function Ge(e) {
812
- return e === "true" || e !== "false" && e;
813
- }
814
- var Ke = L(({ client: e }) => {
815
- let t = We.store({}), n = We.store([]), i = j(t, { register(e, t) {
816
- return {
817
- ...e,
818
- [t.id]: t.feature
819
- };
820
- } }), a = P();
821
- I({
822
- clock: a,
823
- source: t,
824
- filter: (e, { id: t }) => e[t] !== void 0,
825
- fn: (e, { id: t }) => `Feature '${t}' already registered. Registering again will override the previous registration.`
826
- }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
827
- clock: a,
828
- fn: ({ id: e, feature: t }) => Object.freeze({
829
- id: e,
830
- feature: {
831
- id: e,
832
- feature: {
833
- ...t,
834
- id: e
835
- }
836
- }
837
- }),
838
- target: i.register
839
- });
840
- let o = N(async ({ id: e, key: t, storage: n = "local", enabled: r }) => {
841
- if (r === !1) return null;
842
- let i = O(`feature:${e}:${t}`, "global"), a = (n === "session" ? D : E).get(i).text();
843
- return a ? {
844
- id: e,
845
- key: t,
846
- bucket: Ge(a),
847
- storage: n
848
- } : null;
849
- }), s = N((e) => {
850
- if (!e) return null;
851
- let t = O(`feature:${e.id}:${e.key}`, "global");
852
- (e.storage === "session" ? D : E).set(t, e.bucket);
853
- }), c = /* @__PURE__ */ new Map(), l = k({
854
- source: {
855
- allFeaturesStore: t,
856
- resolvedFeaturesStore: n
857
- },
858
- effect: async ({ allFeaturesStore: e, resolvedFeaturesStore: t }, { id: n, decide: r, key: i }) => {
859
- let a = t.find((e) => e.id === n && e.key === i);
860
- if (a) return a;
861
- let o = e[n];
862
- if (!o) throw Error(`Feature with id '${n}' not found`);
863
- if (q(o.feature)) return {
864
- id: o.id,
865
- bucket: !1,
866
- key: i,
867
- storage: o.feature.storage
868
- };
869
- let s = c.get(`${n}:${i}`);
870
- if (s !== void 0) {
871
- let e = await s;
872
- return {
873
- id: o.id,
874
- bucket: e,
875
- key: i,
876
- storage: o.feature.storage
877
- };
878
- }
879
- let l = r();
880
- c.set(`${n}:${i}`, l);
881
- let u = await l;
882
- return {
883
- id: o.id,
884
- bucket: u,
885
- key: i,
886
- storage: o.feature.storage
887
- };
888
- }
889
- });
890
- I({
891
- clock: i.register,
892
- fn: (e) => {
893
- let { id: t, feature: n } = e;
894
- return {
895
- id: t,
896
- key: n.feature.key,
897
- storage: n.feature.storage,
898
- enabled: n.feature.enabled
899
- };
900
- },
901
- target: o
902
- }), I({
903
- source: t,
904
- clock: l.doneData,
905
- filter: (e, t) => !q(e[t.id]?.feature),
906
- fn: (e, t) => {
907
- let { id: n, bucket: r, storage: i } = t, a = e[n]?.feature.key;
908
- return a ? {
909
- key: a,
910
- id: n,
911
- bucket: r,
912
- storage: i
913
- } : null;
914
- },
915
- target: s
916
- });
917
- let u = A({
918
- allFeaturesStore: t,
919
- resolvedFeaturesStore: n
920
- }).map(({ allFeaturesStore: e, resolvedFeaturesStore: t }) => Object.values(e).map((e) => {
921
- let n = t.find((t) => t.id === e.id && t.key === e.feature.key);
922
- return n ? {
923
- id: e.id,
924
- name: e.feature.name,
925
- key: e.feature.key,
926
- enabled: e.feature.enabled,
927
- weight: e.feature.weight,
928
- getBucket: () => ({
929
- id: e.id,
930
- bucket: n.bucket
931
- }),
932
- isResolved: !0
933
- } : {
934
- id: e.id,
935
- name: e.feature.name,
936
- key: e.feature.key,
937
- enabled: e.feature.enabled,
938
- weight: e.feature.weight,
939
- getBucket: async () => await l(e.feature),
940
- isResolved: !1
941
- };
942
- }));
943
- I({
944
- clock: l.doneData,
945
- source: {
946
- resolvedFeatures: n,
947
- allFeatures: t
948
- },
949
- filter: ({ resolvedFeatures: e, allFeatures: t }, { id: n, key: r }) => !q(t[n]?.feature) && !e.some((e) => e.id === n && e.key === r),
950
- fn: (e, t) => t,
951
- target: e.eventBus.prepend((e) => ({
952
- type: "feature_decide",
953
- feature: e
954
- }))
955
- }), I({
956
- clock: [o.doneData, l.doneData],
957
- source: {
958
- resolvedFeatures: n,
959
- allFeatures: t
960
- },
961
- fn: ({ resolvedFeatures: e, allFeatures: t }, n) => !n || q(t[n.id]?.feature) || e.some((e) => e.id === n.id && e.key === n.key) ? e : [...e, n],
962
- target: n
963
- });
964
- function d(e) {
965
- return u.map((t) => t.find((t) => t.id === e));
966
- }
967
- let f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
968
- function h(e) {
969
- let t = f.get(e);
970
- if (t) return t;
971
- let n = d(e);
972
- return f.set(e, n), n;
973
- }
974
- function g(e) {
975
- return t.map((t) => t[e], { skipVoid: !1 });
976
- }
977
- function _(e) {
978
- let t = F(async () => void 0, { skipVoid: !1 }), n = h(e), r = k({
979
- source: n,
980
- effect: async (e) => {
981
- if (e) return async () => (await e.getBucket()).bucket;
982
- }
983
- });
984
- return I({
985
- clock: n,
986
- target: r
987
- }), I({
988
- clock: r.doneData,
989
- filter: (e) => e !== void 0,
990
- target: t
991
- }), r(), t;
992
- }
993
- function v(e) {
994
- let t = p.get(e);
995
- if (t) return t;
996
- let n = _(e);
997
- return p.set(e, n), n;
998
- }
999
- function ee(e) {
1000
- let t = v(e), n = F(void 0, { skipVoid: !1 }), r = k({
1001
- source: t,
1002
- mapParams: (e, t) => t,
1003
- effect: N(async (e) => await e())
1004
- });
1005
- return I({
1006
- clock: r.doneData,
1007
- fn: (t) => {
1008
- if (t !== void 0) return {
1009
- id: e,
1010
- bucket: t
1011
- };
1012
- },
1013
- target: n
1014
- }), I({
1015
- clock: t,
1016
- target: r
1017
- }), r(), n;
1018
- }
1019
- function y(e) {
1020
- let t = m.get(e);
1021
- if (t) return t;
1022
- let n = ee(e);
1023
- return m.set(e, n), n;
1024
- }
824
+ }, q = M("history");
825
+ function $e(e, t) {
1025
826
  return {
1026
- register: a,
1027
- getById: h,
1028
- getByName: g,
1029
- listStore: u,
1030
- getEvokableFeature: v,
1031
- getFeatureResult: y
1032
- };
1033
- });
1034
- function qe(e) {
1035
- return R(Ke, e);
1036
- }
1037
- var Je = (e, t, n) => {
1038
- n.register({
1039
- id: e,
1040
- feature: t
1041
- });
1042
- }, J = M("history");
1043
- function Ye(e, t) {
1044
- return {
1045
- id: te(`history-entry-${Date.now()}-${Math.random()}}`),
827
+ id: oe(`history-entry-${Date.now()}-${Math.random()}}`),
1046
828
  node: t,
1047
829
  at: Date.now(),
1048
830
  experienceId: e
1049
831
  };
1050
832
  }
1051
- var Xe = L(() => {
1052
- let e = J.store({ entries: [] }), t = J.event(), n = J.event(), r = J.event(), i = J.event();
1053
- e.on(t, (e, t) => ({ entries: [...e.entries, Ye(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Ye(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
833
+ var et = L(() => {
834
+ let e = q.store({ entries: [] }), t = q.event(), n = q.event(), r = q.event(), i = q.event();
835
+ e.on(t, (e, t) => ({ entries: [...e.entries, $e(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), $e(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
1054
836
  function a(e, t) {
1055
837
  let n = {
1056
838
  lastStepIndex: -1,
@@ -1058,7 +840,7 @@ var Xe = L(() => {
1058
840
  };
1059
841
  for (let r = e.length - 1; r >= 0; r--) {
1060
842
  let i = e[r], a = i?.node;
1061
- if (!(!a || !w(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
843
+ if (!(!a || !T(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
1062
844
  else {
1063
845
  n.secondLastStepIndex = r;
1064
846
  break;
@@ -1080,20 +862,20 @@ var Xe = L(() => {
1080
862
  entriesStore: e.map((e) => e.entries)
1081
863
  };
1082
864
  });
1083
- function Ze() {
1084
- return R(Xe);
865
+ function tt() {
866
+ return R(et);
1085
867
  }
1086
868
  //#endregion
1087
869
  //#region src/utils/events.ts
1088
- var Qe = 0, $e = (e) => {
870
+ var nt = 0, rt = (e) => {
1089
871
  let t = F([]);
1090
872
  return t.on(e, (e, t) => [...e, {
1091
- id: Qe++,
873
+ id: nt++,
1092
874
  at: /* @__PURE__ */ new Date(),
1093
875
  payload: t
1094
876
  }]), t;
1095
- }, et = M("field"), tt = L(() => {
1096
- let e = et.store({}), t = j(e, {
877
+ }, it = M("field"), at = L(() => {
878
+ let e = it.store({}), t = j(e, {
1097
879
  register(e, t) {
1098
880
  return {
1099
881
  ...e,
@@ -1141,13 +923,13 @@ var Qe = 0, $e = (e) => {
1141
923
  getByName: c
1142
924
  };
1143
925
  });
1144
- function nt() {
1145
- return R(tt);
926
+ function ot() {
927
+ return R(at);
1146
928
  }
1147
929
  //#endregion
1148
930
  //#region src/entities/step/step.ts
1149
- var rt = M("step"), it = L(() => {
1150
- let e = rt.store({}), t = j(e, { register(e, t) {
931
+ var st = M("step"), ct = L(() => {
932
+ let e = st.store({}), t = j(e, { register(e, t) {
1151
933
  return {
1152
934
  ...e,
1153
935
  [t.step.id]: t.step
@@ -1171,16 +953,16 @@ var rt = M("step"), it = L(() => {
1171
953
  indexStore: e
1172
954
  };
1173
955
  });
1174
- function at() {
1175
- return R(it);
956
+ function lt() {
957
+ return R(ct);
1176
958
  }
1177
- function ot(e, t) {
959
+ function ut(e, t) {
1178
960
  t.register(e);
1179
961
  }
1180
962
  //#endregion
1181
963
  //#region src/entities/content/content.ts
1182
- var st = M("content"), ct = L(() => {
1183
- let e = st.store({}), t = j(e, {
964
+ var dt = M("content"), ft = L(() => {
965
+ let e = dt.store({}), t = j(e, {
1184
966
  register(e, t) {
1185
967
  return {
1186
968
  ...e,
@@ -1221,16 +1003,16 @@ var st = M("content"), ct = L(() => {
1221
1003
  indexStore: e
1222
1004
  };
1223
1005
  });
1224
- function lt() {
1225
- return R(ct);
1006
+ function pt() {
1007
+ return R(ft);
1226
1008
  }
1227
- function ut(e, t) {
1009
+ function mt(e, t) {
1228
1010
  t.register(e);
1229
1011
  }
1230
1012
  //#endregion
1231
1013
  //#region src/entities/action/action.ts
1232
- var dt = M("action"), ft = L(({ client: e }) => {
1233
- let t = dt.store({}), n = j(t, { register(e, t) {
1014
+ var ht = M("action"), gt = L(({ client: e }) => {
1015
+ let t = ht.store({}), n = j(t, { register(e, t) {
1234
1016
  return {
1235
1017
  ...e,
1236
1018
  [t.key]: {
@@ -1288,10 +1070,10 @@ var dt = M("action"), ft = L(({ client: e }) => {
1288
1070
  getEvokableAction: s
1289
1071
  };
1290
1072
  });
1291
- function pt(e) {
1292
- return R(ft, e);
1073
+ function _t(e) {
1074
+ return R(gt, e);
1293
1075
  }
1294
- var mt = (e, t, n) => {
1076
+ var vt = (e, t, n) => {
1295
1077
  n.register({
1296
1078
  key: e,
1297
1079
  action: t
@@ -1299,7 +1081,7 @@ var mt = (e, t, n) => {
1299
1081
  };
1300
1082
  //#endregion
1301
1083
  //#region src/entities/response/response-validation.ts
1302
- function Y(e, t, n, r) {
1084
+ function J(e, t, n, r) {
1303
1085
  return {
1304
1086
  fieldKey: e.key,
1305
1087
  userMessage: n,
@@ -1307,62 +1089,62 @@ function Y(e, t, n, r) {
1307
1089
  value: t
1308
1090
  };
1309
1091
  }
1310
- function X(e) {
1092
+ function Y(e) {
1311
1093
  return e === null || e === "" || Array.isArray(e) && !e.length;
1312
1094
  }
1313
- function ht(e) {
1095
+ function yt(e) {
1314
1096
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
1315
1097
  }
1316
- function gt(e) {
1098
+ function bt(e) {
1317
1099
  try {
1318
1100
  return JSON.stringify(e), !0;
1319
1101
  } catch {
1320
1102
  return !1;
1321
1103
  }
1322
1104
  }
1323
- function _t(e, t) {
1105
+ function xt(e, t) {
1324
1106
  return t.find((t) => t.key === e) ?? null;
1325
1107
  }
1326
- function vt(e, t) {
1108
+ function St(e, t) {
1327
1109
  return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
1328
1110
  }
1329
- function yt(e, t) {
1330
- if (e.type !== "object" || X(t)) return null;
1111
+ function Ct(e, t) {
1112
+ if (e.type !== "object" || Y(t)) return null;
1331
1113
  if (e.multiple) {
1332
- if (!Array.isArray(t)) return Y(e, t, "This field expects multiple values", "Field expects an array of objects.");
1114
+ if (!Array.isArray(t)) return J(e, t, "This field expects multiple values", "Field expects an array of objects.");
1333
1115
  for (let n of t) {
1334
- if (typeof n != "object" || !n) return Y(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
1335
- if (!gt(n)) return Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1116
+ if (typeof n != "object" || !n) return J(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
1117
+ if (!bt(n)) return J(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1336
1118
  }
1337
1119
  return null;
1338
1120
  }
1339
- return Array.isArray(t) ? Y(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Y(e, t, "This field expects an object value", "Field expects an object value.") : gt(t) ? null : Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1121
+ return Array.isArray(t) ? J(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? J(e, t, "This field expects an object value", "Field expects an object value.") : bt(t) ? null : J(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1340
1122
  }
1341
- function bt(e, t) {
1342
- if (X(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
1123
+ function wt(e, t) {
1124
+ if (Y(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
1343
1125
  let n = Array.isArray(t) ? t : [t];
1344
1126
  if (e.type === "object") {
1345
1127
  let r = new Set(e.options.map((e) => JSON.stringify(e.value)));
1346
- return n.every((e) => r.has(JSON.stringify(e))) ? null : Y(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
1128
+ return n.every((e) => r.has(JSON.stringify(e))) ? null : J(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
1347
1129
  }
1348
1130
  let r = e.options.map((e) => e.value);
1349
- return n.every((e) => !ht(e) || e === null ? !1 : r.includes(e)) ? null : Y(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
1131
+ return n.every((e) => !yt(e) || e === null ? !1 : r.includes(e)) ? null : J(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
1350
1132
  }
1351
- async function xt(t, n, r, i) {
1352
- if (n.validation && !e(n.validation) && !X(r)) {
1133
+ async function Tt(t, n, r, i) {
1134
+ if (n.validation && !e(n.validation) && !Y(r)) {
1353
1135
  let e = i ? {
1354
1136
  $input: r,
1355
1137
  responses: i
1356
1138
  } : { $input: r }, a = await t(n.validation, e);
1357
- if (typeof a == "string") return Y(n, r, a, `Field validation resulted in an error: ${a}.`);
1358
- if (a === !1) return Y(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
1139
+ if (typeof a == "string") return J(n, r, a, `Field validation resulted in an error: ${a}.`);
1140
+ if (a === !1) return J(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
1359
1141
  }
1360
- return n.required && X(r) ? Y(n, r, "This field is required", "Field is required.") : !n.multiple && Array.isArray(r) && r.length > 1 ? Y(n, r, "This field expects a single response", "Field expects a single response.") : null;
1142
+ return n.required && Y(r) ? J(n, r, "This field is required", "Field is required.") : !n.multiple && Array.isArray(r) && r.length > 1 ? J(n, r, "This field expects a single response", "Field expects a single response.") : null;
1361
1143
  }
1362
1144
  //#endregion
1363
1145
  //#region src/entities/response/response.ts
1364
- var St = M("response"), Ct = L(({ client: e }) => {
1365
- let t = St.store({}), r = P(), i = P(), a = j(t, {
1146
+ var Et = M("response"), Dt = L(({ client: e }) => {
1147
+ let t = Et.store({}), r = P(), i = P(), a = j(t, {
1366
1148
  register(e, t) {
1367
1149
  return {
1368
1150
  ...e,
@@ -1401,7 +1183,7 @@ var St = M("response"), Ct = L(({ client: e }) => {
1401
1183
  ...t,
1402
1184
  ...n
1403
1185
  }, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
1404
- let o = _t(t, e);
1186
+ let o = xt(t, e);
1405
1187
  if (!o) {
1406
1188
  r.push({
1407
1189
  fieldKey: t,
@@ -1411,17 +1193,17 @@ var St = M("response"), Ct = L(({ client: e }) => {
1411
1193
  });
1412
1194
  return;
1413
1195
  }
1414
- let c = vt(o, n), l = await xt(s, o, c, a);
1196
+ let c = St(o, n), l = await Tt(s, o, c, a);
1415
1197
  if (l) {
1416
1198
  r.push(l);
1417
1199
  return;
1418
1200
  }
1419
- let u = yt(o, c);
1201
+ let u = Ct(o, c);
1420
1202
  if (u) {
1421
1203
  r.push(u);
1422
1204
  return;
1423
1205
  }
1424
- let d = bt(o, c);
1206
+ let d = wt(o, c);
1425
1207
  if (d) {
1426
1208
  r.push(d);
1427
1209
  return;
@@ -1500,13 +1282,13 @@ var St = M("response"), Ct = L(({ client: e }) => {
1500
1282
  getByFieldName: _
1501
1283
  };
1502
1284
  });
1503
- function wt(e) {
1504
- return R(Ct, e);
1285
+ function Ot(e) {
1286
+ return R(Dt, e);
1505
1287
  }
1506
1288
  //#endregion
1507
1289
  //#region src/entities/condition/condition.ts
1508
- var Tt = M("condition"), Et = L(() => {
1509
- let e = Tt.store({}), t = j(e, { register(e, t) {
1290
+ var kt = M("condition"), At = L(() => {
1291
+ let e = kt.store({}), t = j(e, { register(e, t) {
1510
1292
  return {
1511
1293
  ...e,
1512
1294
  [t.condition.id]: t.condition
@@ -1530,12 +1312,12 @@ var Tt = M("condition"), Et = L(() => {
1530
1312
  indexStore: e
1531
1313
  };
1532
1314
  });
1533
- function Dt() {
1534
- return R(Et);
1315
+ function jt() {
1316
+ return R(At);
1535
1317
  }
1536
1318
  //#endregion
1537
1319
  //#region src/utils/api-url.ts
1538
- function Ot() {
1320
+ function Mt() {
1539
1321
  if (c()) {
1540
1322
  let e = [
1541
1323
  document.currentScript,
@@ -1550,7 +1332,7 @@ function Ot() {
1550
1332
  }
1551
1333
  //#endregion
1552
1334
  //#region src/utils/search-params.ts
1553
- function kt() {
1335
+ function Nt() {
1554
1336
  if (!s()) return {};
1555
1337
  let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
1556
1338
  for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
@@ -1568,13 +1350,13 @@ function kt() {
1568
1350
  }
1569
1351
  //#endregion
1570
1352
  //#region src/entities/session/session.ts
1571
- var At = O("session", "global");
1572
- function jt() {
1573
- return p() ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}`;
1353
+ var Pt = O("session", "global");
1354
+ function Ft() {
1355
+ return m() ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}`;
1574
1356
  }
1575
- function Mt() {
1576
- if (!m()) return null;
1577
- let e = E.get(At);
1357
+ function It() {
1358
+ if (!h()) return null;
1359
+ let e = E.get(Pt);
1578
1360
  if (!e.isSet()) return null;
1579
1361
  try {
1580
1362
  return e.json();
@@ -1582,8 +1364,8 @@ function Mt() {
1582
1364
  return null;
1583
1365
  }
1584
1366
  }
1585
- var Nt = L(() => {
1586
- let e = Mt(), t = { id: e?.id ?? jt() };
1367
+ var Lt = L(() => {
1368
+ let e = It(), t = { id: e?.id ?? Ft() };
1587
1369
  e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
1588
1370
  let n = F(t), r = j(n, {
1589
1371
  setIsUser: (e, t) => ({
@@ -1608,8 +1390,8 @@ var Nt = L(() => {
1608
1390
  }), i = k({
1609
1391
  source: n,
1610
1392
  effect: (e) => {
1611
- if (m()) try {
1612
- E.get(At).set(e);
1393
+ if (h()) try {
1394
+ E.get(Pt).set(e);
1613
1395
  } catch {}
1614
1396
  }
1615
1397
  });
@@ -1623,39 +1405,39 @@ var Nt = L(() => {
1623
1405
  removeIdentifier: r.removeIdentifier
1624
1406
  };
1625
1407
  });
1626
- function Pt() {
1627
- return R(Nt, void 0);
1408
+ function Rt() {
1409
+ return R(Lt, void 0);
1628
1410
  }
1629
1411
  //#endregion
1630
1412
  //#region src/utils/picked-config.ts
1631
- function Ft() {
1413
+ function zt() {
1632
1414
  if (s()) return globalThis.window.pickedConfig;
1633
1415
  }
1634
- function It() {
1635
- if (s()) return Ft()?.projectId;
1416
+ function Bt() {
1417
+ if (s()) return zt()?.projectId;
1636
1418
  }
1637
- function Lt() {
1419
+ function Vt() {
1638
1420
  if (!c()) return;
1639
1421
  let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
1640
1422
  if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
1641
1423
  }
1642
- function Rt(e) {
1424
+ function Ht(e) {
1643
1425
  if (e.projectId) return e.projectId;
1644
- let t = It();
1426
+ let t = Bt();
1645
1427
  if (t) return t;
1646
- let n = Lt();
1428
+ let n = Vt();
1647
1429
  if (n) return n;
1648
1430
  throw Error("projectId is required. You can provide it via one of:\n (1) createClient({ projectId }) options;\n (2) window.pickedConfig = { projectId };\n (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes a data-projectid (or project-id) attribute.");
1649
1431
  }
1650
1432
  //#endregion
1651
1433
  //#region src/utils/render-string.ts
1652
- function Z(e) {
1434
+ function X(e) {
1653
1435
  return e == null || e === "" || Number.isNaN(e);
1654
1436
  }
1655
- var zt = {
1656
- default: (e, t) => Z(e) ? String(t ?? "") : String(e),
1657
- append: (e, t) => t && !Z(e) ? `${e} ${t}` : e,
1658
- prepend: (e, t) => t && !Z(e) ? `${t} ${e}` : e,
1437
+ var Ut = {
1438
+ default: (e, t) => X(e) ? String(t ?? "") : String(e),
1439
+ append: (e, t) => t && !X(e) ? `${e} ${t}` : e,
1440
+ prepend: (e, t) => t && !X(e) ? `${t} ${e}` : e,
1659
1441
  upper: (e) => typeof e == "string" ? e.toUpperCase() : e,
1660
1442
  lower: (e) => typeof e == "string" ? e.toLowerCase() : e,
1661
1443
  capitalize: (e) => typeof e == "string" ? e.charAt(0).toUpperCase() + e.slice(1) : e,
@@ -1673,24 +1455,24 @@ var zt = {
1673
1455
  return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
1674
1456
  }
1675
1457
  };
1676
- function Bt(e) {
1458
+ function Wt(e) {
1677
1459
  return typeof e == "object" && !!e;
1678
1460
  }
1679
- function Vt(e, t) {
1461
+ function Gt(e, t) {
1680
1462
  let n = t;
1681
- for (let t of e.split(".")) if (Bt(n) && t in n) n = n[t];
1463
+ for (let t of e.split(".")) if (Wt(n) && t in n) n = n[t];
1682
1464
  else return;
1683
1465
  return typeof n == "function" ? n() : n;
1684
1466
  }
1685
- function Ht(e, t) {
1686
- let n = e.split("|").map((e) => e.trim()), r = Vt(n.shift() ?? "", t);
1467
+ function Kt(e, t) {
1468
+ let n = e.split("|").map((e) => e.trim()), r = Gt(n.shift() ?? "", t);
1687
1469
  for (let e of n) {
1688
- let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = zt[i];
1470
+ let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Ut[i];
1689
1471
  o && (r = o(r, a));
1690
1472
  }
1691
- return Z(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
1473
+ return X(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
1692
1474
  }
1693
- function Ut(e, t) {
1475
+ function qt(e, t) {
1694
1476
  let n = "", r = 0;
1695
1477
  for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
1696
1478
  r += 2;
@@ -1702,19 +1484,19 @@ function Ut(e, t) {
1702
1484
  }
1703
1485
  i += e[r++];
1704
1486
  }
1705
- n += Ht(i.trim(), t);
1487
+ n += Kt(i.trim(), t);
1706
1488
  } else n += e[r++];
1707
1489
  return n;
1708
1490
  }
1709
1491
  //#endregion
1710
1492
  //#region src/utils/preview-session.ts
1711
- var Wt = "preview-token";
1712
- function Gt() {
1713
- return !s() || !h() ? !1 : !!kt()[Wt]?.[0];
1493
+ var Jt = "preview-token";
1494
+ function Yt() {
1495
+ return !s() || !g() ? !1 : !!Nt()[Jt]?.[0];
1714
1496
  }
1715
1497
  //#endregion
1716
1498
  //#region src/picked.ts
1717
- var Kt = class {
1499
+ var Xt = class {
1718
1500
  static logger = r;
1719
1501
  options;
1720
1502
  dataSource = null;
@@ -1723,6 +1505,9 @@ var Kt = class {
1723
1505
  contentLoader;
1724
1506
  previewEmbedderOrigins = null;
1725
1507
  plugins = {};
1508
+ get pluginNames() {
1509
+ return Object.keys(this.plugins);
1510
+ }
1726
1511
  dataProviders = /* @__PURE__ */ new Map();
1727
1512
  eventBus = P();
1728
1513
  events;
@@ -1730,51 +1515,51 @@ var Kt = class {
1730
1515
  apiUrl;
1731
1516
  dashboardUrl;
1732
1517
  documentationSiteUrl;
1733
- session = Pt();
1734
- searchParams = kt();
1735
- history = Ze();
1736
- components = ye({ client: this });
1737
- experienceInstances = S({ client: this });
1738
- experiences = de({ client: this });
1739
- frameworks = Ce({ client: this });
1740
- predicates = He({ client: this });
1741
- features = qe({ client: this });
1742
- conditions = Dt();
1743
- fields = nt();
1744
- responses = wt({ client: this });
1745
- steps = at();
1746
- contents = lt();
1747
- actions = pt({ client: this });
1748
- conditionResults = C();
1749
- stateSnapshotStore = Ee({ client: this });
1750
- evaluateRuleLogicFx = Pe({ client: this });
1518
+ session = Rt();
1519
+ searchParams = Nt();
1520
+ history = tt();
1521
+ components = Ce({ client: this });
1522
+ experienceInstances = C({ client: this });
1523
+ experiences = he({ client: this });
1524
+ frameworks = De({ client: this });
1525
+ predicates = Ze({ client: this });
1526
+ features = re({ client: this });
1527
+ conditions = jt();
1528
+ fields = ot();
1529
+ responses = Ot({ client: this });
1530
+ steps = lt();
1531
+ contents = pt();
1532
+ actions = _t({ client: this });
1533
+ conditionResults = w();
1534
+ stateSnapshotStore = Ae({ client: this });
1535
+ evaluateRuleLogicFx = Re({ client: this });
1751
1536
  start;
1752
1537
  readyStore;
1753
1538
  preconditionPassedStore;
1754
1539
  conditionPassedStore;
1755
1540
  lifecycleStageStore;
1756
- lifecycle = ze({ client: this });
1541
+ lifecycle = Je({ client: this });
1757
1542
  renderStringFx = k({
1758
1543
  source: this.responses.listStore,
1759
1544
  effect: (e, { template: t, context: n }) => {
1760
1545
  let r = {};
1761
1546
  for (let t of e) r[t.fieldKey] = t.value;
1762
- return Ut(t, {
1547
+ return qt(t, {
1763
1548
  ...n,
1764
1549
  responses: r
1765
1550
  });
1766
1551
  }
1767
1552
  });
1768
1553
  constructor(e) {
1769
- this.events = $e(this.eventBus), this.projectId = Rt(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Ot(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.start = this.lifecycle.start, this.readyStore = this.lifecycle.readyStore, this.preconditionPassedStore = this.lifecycle.preconditionPassedStore, this.conditionPassedStore = this.lifecycle.conditionPassedStore, this.lifecycleStageStore = this.lifecycle.lifecycleStageStore, this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
1554
+ this.events = rt(this.eventBus), this.projectId = Ht(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Mt(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.start = this.lifecycle.start, this.readyStore = this.lifecycle.readyStore, this.preconditionPassedStore = this.lifecycle.preconditionPassedStore, this.conditionPassedStore = this.lifecycle.conditionPassedStore, this.lifecycleStageStore = this.lifecycle.lifecycleStageStore, this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
1770
1555
  type: "load",
1771
- version: ne()
1556
+ version: ae()
1772
1557
  }), this.maybeStartPreviewChannel();
1773
1558
  }
1774
1559
  dataProviderFor(e) {
1775
1560
  let t = e ?? "", n = this.dataProviders.get(t);
1776
1561
  if (n) return n;
1777
- let r = import("../provider-B8vTLrFT.js").then((t) => t.createPickedDataProvider({
1562
+ let r = import("../provider-Dx6VjvZg.js").then((t) => t.createPickedDataProvider({
1778
1563
  apiUrl: this.apiUrl,
1779
1564
  projectId: this.projectId,
1780
1565
  ...e !== void 0 && { previewToken: e }
@@ -1790,24 +1575,24 @@ var Kt = class {
1790
1575
  return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
1791
1576
  }
1792
1577
  maybeStartPreviewChannel() {
1793
- Gt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
1578
+ Yt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
1794
1579
  }
1795
1580
  registerFramework = (e) => {
1796
- we(e, this.frameworks);
1581
+ Oe(e, this.frameworks);
1797
1582
  };
1798
1583
  registerComponent = (e, t) => {
1799
- be(e, t, this.components);
1584
+ we(e, t, this.components);
1800
1585
  };
1801
1586
  registerPlugin = (e) => {
1802
- me(this, e, this.plugins);
1587
+ ve(this, e, this.plugins);
1803
1588
  let t = this.plugins[e.name];
1804
1589
  t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
1805
1590
  };
1806
1591
  registerFeature = (e, t) => {
1807
- Je(e, t, this.features);
1592
+ ne(e, t, this.features);
1808
1593
  };
1809
1594
  registerPredicate = (e, t) => {
1810
- Ue(e, t, this.predicates);
1595
+ Qe(e, t, this.predicates);
1811
1596
  };
1812
1597
  registerCondition = (e) => {
1813
1598
  this.conditions.register(e);
@@ -1816,19 +1601,19 @@ var Kt = class {
1816
1601
  this.fields.register(e);
1817
1602
  };
1818
1603
  registerStep = (e) => {
1819
- ot(e, this.steps);
1604
+ ut(e, this.steps);
1820
1605
  };
1821
1606
  registerContent = (e) => {
1822
- ut(e, this.contents);
1607
+ mt(e, this.contents);
1823
1608
  };
1824
1609
  patchContent = (e, t) => {
1825
1610
  this.contents.patch(e, t);
1826
1611
  };
1827
1612
  registerAction = (e, t) => {
1828
- mt(e, t, this.actions);
1613
+ vt(e, t, this.actions);
1829
1614
  };
1830
1615
  registerExperience = (e) => {
1831
- e.component && be(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
1616
+ e.component && we(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
1832
1617
  };
1833
1618
  launchExperienceById = async (e, t) => {
1834
1619
  this.experiences.launch({
@@ -1871,12 +1656,12 @@ var Kt = class {
1871
1656
  this.registerFeature(e, n);
1872
1657
  }), this.searchParams.feature && this.searchParams.feature.forEach((e) => {
1873
1658
  try {
1874
- let [t, n] = e.split(":");
1875
- if (!t || !n) return;
1876
- let r = Ge(n);
1877
- this.registerFeature(t, {
1659
+ let t = ie(e);
1660
+ if (!t) return;
1661
+ let { id: n, bucket: r } = t;
1662
+ this.registerFeature(n, {
1878
1663
  key: `${r}`,
1879
- name: t,
1664
+ name: n,
1880
1665
  decide: () => r,
1881
1666
  storage: "session"
1882
1667
  });
@@ -1910,8 +1695,8 @@ var Kt = class {
1910
1695
  });
1911
1696
  }
1912
1697
  getPluginConfig = (e) => this.plugins[e] ?? {};
1913
- }, qt = "application/picked-javascript", Jt = "application/picked-module", Yt = "data-picked-hydrated";
1914
- async function Xt(e) {
1698
+ }, Zt = "application/picked-javascript", Qt = "application/picked-module", $t = "data-picked-hydrated";
1699
+ async function en(e) {
1915
1700
  if (!("document" in globalThis)) return;
1916
1701
  let t = "application/picked-module", n = "data-picked-hydrated";
1917
1702
  function r(e) {
@@ -1940,42 +1725,42 @@ async function Xt(e) {
1940
1725
  a && await a;
1941
1726
  }
1942
1727
  }
1943
- function Zt() {
1944
- return `<script>(${Xt.toString()})(document)<\/script>`;
1728
+ function tn() {
1729
+ return `<script>(${en.toString()})(document)<\/script>`;
1945
1730
  }
1946
1731
  //#endregion
1947
1732
  //#region src/utils/html-asset-value.ts
1948
- function Qt(e) {
1733
+ function nn(e) {
1949
1734
  return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
1950
1735
  }
1951
1736
  //#endregion
1952
1737
  //#region src/entities/component/lazyComponent.ts
1953
- function $t(e) {
1738
+ function rn(e) {
1954
1739
  return {
1955
1740
  $$type: "lazy-component",
1956
1741
  load: e
1957
1742
  };
1958
1743
  }
1959
- function en(e) {
1744
+ function an(e) {
1960
1745
  return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
1961
1746
  }
1962
1747
  //#endregion
1963
1748
  //#region src/entities/content/reference.ts
1964
- function Q(e) {
1749
+ function Z(e) {
1965
1750
  return typeof e == "object" && !!e && !Array.isArray(e) && "contentEntryId" in e && typeof e.contentEntryId == "string";
1966
1751
  }
1967
- function $(e) {
1968
- return Q(e) ? e.contentEntryId : null;
1752
+ function Q(e) {
1753
+ return Z(e) ? e.contentEntryId : null;
1969
1754
  }
1970
- function tn(e) {
1755
+ function $(e) {
1971
1756
  let t = Array.isArray(e) ? e : [e], n = [];
1972
- for (let e of t) Q(e) && n.push(e.contentEntryId);
1757
+ for (let e of t) Z(e) && n.push(e.contentEntryId);
1973
1758
  return n;
1974
1759
  }
1975
- function nn(e, t) {
1760
+ function on(e, t) {
1976
1761
  return t === null ? null : e[t] ?? null;
1977
1762
  }
1978
- function rn(e, t) {
1763
+ function sn(e, t) {
1979
1764
  let n = [];
1980
1765
  for (let r of t) {
1981
1766
  let t = e[r];
@@ -1983,29 +1768,29 @@ function rn(e, t) {
1983
1768
  }
1984
1769
  return n;
1985
1770
  }
1986
- function an(e, t) {
1987
- if (oe.store(t)) return A(t, e.indexStore, (e, t) => nn(t, $(e)));
1988
- let n = $(t);
1989
- return e.indexStore.map((e) => nn(e, n), { skipVoid: !1 });
1771
+ function cn(e, t) {
1772
+ if (ue.store(t)) return A(t, e.indexStore, (e, t) => on(t, Q(e)));
1773
+ let n = Q(t);
1774
+ return e.indexStore.map((e) => on(e, n), { skipVoid: !1 });
1990
1775
  }
1991
- function on(e, t) {
1992
- if (oe.store(t)) return A(t, e.indexStore, (e, t) => rn(t, tn(e)));
1993
- let n = tn(t);
1994
- return e.indexStore.map((e) => rn(e, n), { skipVoid: !1 });
1776
+ function ln(e, t) {
1777
+ if (ue.store(t)) return A(t, e.indexStore, (e, t) => sn(t, $(e)));
1778
+ let n = $(t);
1779
+ return e.indexStore.map((e) => sn(e, n), { skipVoid: !1 });
1995
1780
  }
1996
1781
  //#endregion
1997
1782
  //#region src/exports.ts
1998
- var sn = (e) => {
1999
- let t = new Kt(e);
1783
+ var un = (e) => {
1784
+ let t = new Xt(e);
2000
1785
  return u(t), t;
2001
1786
  };
2002
1787
  //#endregion
2003
1788
  //#region src/typed-content.ts
2004
- function cn(e) {
1789
+ function dn(e) {
2005
1790
  return typeof e.data == "object";
2006
1791
  }
2007
- function ln(e) {
2008
- return e.map((e) => !e || !cn(e) ? null : e, { skipVoid: !1 });
1792
+ function fn(e) {
1793
+ return e.map((e) => !e || !dn(e) ? null : e, { skipVoid: !1 });
2009
1794
  }
2010
1795
  //#endregion
2011
- export { Yt as PICKED_HYDRATED_ATTR, Jt as PICKED_MODULE_SCRIPT_TYPE, qt as PICKED_SCRIPT_TYPE, Wt as PREVIEW_TOKEN_PARAM, Kt as Picked, Zt as buildRehydrateBootstrap, sn as createClient, pe as createPluginEffect, O as createStorageKey, an as deriveReference, on as deriveReferences, n as evaluateRuleLogic, Ft as getPickedConfig, Q as isContentReference, Qt as isHtmlAssetValue, h as isInsideIframe, en as isLazyLoader, _ as isPickedRoot, Gt as isPreviewSession, $t as lazyComponent, E as localStore, ae as onInertScriptSubtrees, $ as readReferenceId, tn as readReferenceIds, Xt as rehydrateScripts, re as reportInertScriptSubtrees, ie as resetInertScriptReport, D as sessionStore, T as subscribe, d as supportsCookies, p as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, m as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, g as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow, ln as toTypedContentStore };
1796
+ export { $t as PICKED_HYDRATED_ATTR, Qt as PICKED_MODULE_SCRIPT_TYPE, Zt as PICKED_SCRIPT_TYPE, Jt as PREVIEW_TOKEN_PARAM, Xt as Picked, tn as buildRehydrateBootstrap, un as createClient, _e as createPluginEffect, O as createStorageKey, cn as deriveReference, ln as deriveReferences, n as evaluateRuleLogic, zt as getPickedConfig, Z as isContentReference, nn as isHtmlAssetValue, g as isInsideIframe, an as isLazyLoader, v as isPickedRoot, Yt as isPreviewSession, rn as lazyComponent, E as localStore, le as onInertScriptSubtrees, Q as readReferenceId, $ as readReferenceIds, en as rehydrateScripts, se as reportInertScriptSubtrees, ce as resetInertScriptReport, D as sessionStore, te as subscribe, d as supportsCookies, m as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, h as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, _ as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow, fn as toTypedContentStore };