@picked/client 0.0.1-dev.1787537193674 → 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 (31) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/{api-DRTduQVm.cjs → api-CahTmEWe.cjs} +1 -1
  3. package/dist/{api-4YpcWP-x.js → api-DwTNwuWK.js} +1 -1
  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 -1
  7. package/dist/cjs/server/index.js +1 -1
  8. package/dist/docs/reference/sdk/features.md +7 -0
  9. package/dist/esm/index.js +240 -478
  10. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  11. package/dist/esm/plugins/telemetry/index.js +19 -12
  12. package/dist/esm/server/index.js +1 -1
  13. package/dist/plugin-BcFzHPC7.cjs +1 -0
  14. package/dist/{plugin-DTN7fsyp.js → plugin-L5y4NdFX.js} +73 -52
  15. package/dist/{provider-BxhVIcsp.cjs → provider-BLDm3i8g.cjs} +1 -1
  16. package/dist/{provider-DLebj-AW.js → provider-Dx6VjvZg.js} +1 -1
  17. package/dist/types/entities/feature/feature.d.ts +43 -2
  18. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  19. package/dist/types/entities/plugin/plugin.d.ts +4 -0
  20. package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
  21. package/dist/types/picked.d.ts +3 -2
  22. package/dist/types/picked.d.ts.map +1 -1
  23. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  24. package/dist/types/plugins/telemetry/plugin.d.ts +7 -0
  25. package/dist/types/plugins/telemetry/plugin.d.ts.map +1 -1
  26. package/dist/version-BqU6f22c.cjs +1 -0
  27. package/dist/version-DAFO6eas.js +256 -0
  28. package/package.json +3 -3
  29. package/dist/plugin-BPZV7SJg.cjs +0 -1
  30. package/dist/version-BlahSDlG.cjs +0 -1
  31. package/dist/version-BmBn0dXR.js +0 -4
package/dist/esm/index.js CHANGED
@@ -5,14 +5,14 @@ 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
5
5
  import { a as v, i as y, r as ee, s as b, t as x } from "../dom-BqcToNL0.js";
6
6
  import { l as S, n as C, r as w, u as T } from "../experience-instance-DGk11d8a.js";
7
7
  import { i as te, n as E, r as D, t as O } from "../storage-1MW3-_As.js";
8
- import { t as ne } from "../id-Bo4RBeOs.js";
9
- import { t as re } from "../version-BmBn0dXR.js";
10
- import { n as ie, r as ae, t as oe } 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 se, sample as I } from "effector";
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 ce } 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"), le = 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,
@@ -99,17 +99,17 @@ var z = M("experience"), le = L(({ client: e, experience: r }) => {
99
99
  prepareExperienceContentFx: m
100
100
  }, u;
101
101
  });
102
- function ue(e) {
103
- return R(le, e);
102
+ function pe(e) {
103
+ return R(fe, e);
104
104
  }
105
- var de = 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(ue({
112
+ n.register(pe({
113
113
  client: e,
114
114
  experience: t
115
115
  }));
@@ -195,38 +195,35 @@ var de = L(({ client: e }) => {
195
195
  })
196
196
  };
197
197
  });
198
- function fe(e) {
199
- return R(de, e);
198
+ function he(e) {
199
+ return R(me, e);
200
200
  }
201
- var pe = 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 me(e) {
206
+ function _e(e) {
207
207
  return N(async () => {
208
208
  await e();
209
209
  });
210
210
  }
211
- var he = (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
- }, ge = M("component"), _e = 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 ve(e) {
226
- return R(_e, e);
222
+ function xe(e) {
223
+ return R(be, e);
227
224
  }
228
- var ye = L(({ client: e }) => {
229
- let t = ge.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 ye = 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 }) => ve({
239
+ fn: ({ name: t, component: n }) => xe({
243
240
  client: e,
244
241
  name: t,
245
242
  component: n
@@ -256,16 +253,16 @@ var ye = L(({ client: e }) => {
256
253
  listStore: a
257
254
  };
258
255
  });
259
- function be(e) {
260
- return R(ye, e);
256
+ function Ce(e) {
257
+ return R(Se, e);
261
258
  }
262
- var xe = (e, t, n) => {
259
+ var we = (e, t, n) => {
263
260
  n.register({
264
261
  name: e,
265
262
  component: t
266
263
  });
267
- }, Se = M("framework"), Ce = L((e) => {
268
- let t = Se.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 xe = (e, t, n) => {
290
287
  listStore: a
291
288
  };
292
289
  });
293
- function we(e) {
294
- return R(Ce, e);
290
+ function De(e) {
291
+ return R(Ee, e);
295
292
  }
296
- var Te = (e, t) => {
293
+ var Oe = (e, t) => {
297
294
  t.register({
298
295
  name: e.name,
299
296
  framework: e
300
297
  });
301
- }, Ee = 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 Te = (e, t) => {
312
309
  ...n
313
310
  }));
314
311
  });
315
- function De(e) {
316
- return R(Ee, e);
312
+ function Ae(e) {
313
+ return R(ke, e);
317
314
  }
318
315
  //#endregion
319
316
  //#region src/logic-engine.ts
320
- function Oe(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 ke(e) {
326
+ function Me(e) {
330
327
  return e instanceof Promise;
331
328
  }
332
- function Ae(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 (Oe(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 je = {
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 je = {
435
432
  };
436
433
  async function W(e, t) {
437
434
  if (!e) return e;
438
- if (ke(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 (!Ae(e)) return e;
441
- let n = Me(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 Ae(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 ? je[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 ke(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 Me(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 Ne(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: Ne(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 Pe = 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 Pe = L(({ client: e }) => k({
560
557
  };
561
558
  return await W(o, {
562
559
  ...d,
563
- conditions: Ne(a, d, /* @__PURE__ */ new Set())
560
+ conditions: Ie(a, d, /* @__PURE__ */ new Set())
564
561
  });
565
562
  }
566
563
  }));
567
- function Fe(e) {
568
- return R(Pe, e);
564
+ function Re(e) {
565
+ return R(Le, e);
569
566
  }
570
567
  //#endregion
571
568
  //#region src/ping.ts
572
- var Ie = 6e3, Le = O("last_ping", "global"), Re = 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(Le), r = 0;
575
- if (n.isSet() && (r = n.json() ?? 0), r && t - r < Ie) 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 ce(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,27 +580,27 @@ var Ie = 6e3, Le = O("last_ping", "global"), Re = async (e) => {
583
580
  } catch {
584
581
  return !1;
585
582
  }
586
- }, ze = "picked:start:begin", Be = "picked:start";
587
- function Ve() {
583
+ }, He = "picked:start:begin", Ue = "picked:start";
584
+ function We() {
588
585
  try {
589
586
  return s() && !!p.window && "performance" in p;
590
587
  } catch {
591
588
  return !1;
592
589
  }
593
590
  }
594
- function He() {
595
- if (Ve()) try {
596
- performance.mark(ze);
591
+ function Ge() {
592
+ if (We()) try {
593
+ performance.mark(He);
597
594
  } catch {}
598
595
  }
599
- function Ue() {
600
- if (Ve()) try {
601
- performance.measure(Be, ze);
596
+ function Ke() {
597
+ if (We()) try {
598
+ performance.measure(Ue, He);
602
599
  } catch {}
603
600
  }
604
601
  //#endregion
605
602
  //#region src/lifecycle/lifecycle.ts
606
- var K = M("lifecycle"), We = L(({ client: e }) => {
603
+ var K = M("lifecycle"), qe = L(({ client: e }) => {
607
604
  let t = K.store(!1), r = F(void 0, {
608
605
  skipVoid: !1,
609
606
  domain: K
@@ -619,11 +616,11 @@ var K = M("lifecycle"), We = L(({ client: e }) => {
619
616
  }), u = P(), d = P(), f = P(), p = P(), m = P(), h = P();
620
617
  o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
621
618
  let g = N(() => {
622
- Re(e);
619
+ Ve(e);
623
620
  }), _ = N(async () => {
624
621
  await ee();
625
622
  }), v = N(async () => {
626
- await pe(e);
623
+ await ge(e);
627
624
  }), y = k({ effect: v }), b = k({
628
625
  source: o,
629
626
  effect: async (e) => {
@@ -645,7 +642,7 @@ var K = M("lifecycle"), We = L(({ client: e }) => {
645
642
  clock: C,
646
643
  fn: () => "starting",
647
644
  target: a
648
- }), C.watch(He), d.watch(Ue), I({
645
+ }), C.watch(Ge), d.watch(Ke), I({
649
646
  clock: C,
650
647
  target: g
651
648
  }), I({
@@ -752,13 +749,13 @@ var K = M("lifecycle"), We = L(({ client: e }) => {
752
749
  setCondition: h
753
750
  };
754
751
  });
755
- function Ge(e) {
756
- return R(We, e);
752
+ function Je(e) {
753
+ return R(qe, e);
757
754
  }
758
755
  //#endregion
759
756
  //#region src/entities/predicate/predicate.ts
760
- var Ke = M("predicate"), qe = L(({ client: e }) => {
761
- let t = Ke.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) {
762
759
  return {
763
760
  ...e,
764
761
  [t.name]: {
@@ -816,261 +813,26 @@ var Ke = M("predicate"), qe = L(({ client: e }) => {
816
813
  getEvokablePredicate: s
817
814
  };
818
815
  });
819
- function Je(e) {
820
- return R(qe, e);
816
+ function Ze(e) {
817
+ return R(Xe, e);
821
818
  }
822
- var Ye = (e, t, n) => {
819
+ var Qe = (e, t, n) => {
823
820
  n.register({
824
821
  name: e,
825
822
  predicate: t
826
823
  });
827
- }, Xe = M("feature");
828
- function q(e) {
829
- return e?.enabled === !1;
830
- }
831
- function Ze(e) {
832
- return e === "true" || e !== "false" && e;
833
- }
834
- var Qe = L(({ client: e }) => {
835
- let t = Xe.store({}), n = Xe.store([]), i = j(t, { register(e, t) {
836
- return {
837
- ...e,
838
- [t.id]: t.feature
839
- };
840
- } }), a = P();
841
- I({
842
- clock: a,
843
- source: t,
844
- filter: (e, { id: t }) => e[t] !== void 0,
845
- fn: (e, { id: t }) => `Feature '${t}' already registered. Registering again will override the previous registration.`
846
- }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
847
- clock: a,
848
- fn: ({ id: e, feature: t }) => Object.freeze({
849
- id: e,
850
- feature: {
851
- id: e,
852
- feature: {
853
- ...t,
854
- id: e
855
- }
856
- }
857
- }),
858
- target: i.register
859
- });
860
- let o = N(async ({ id: e, key: t, storage: n = "local", enabled: r }) => {
861
- if (r === !1) return null;
862
- let i = O(`feature:${e}:${t}`, "global"), a = (n === "session" ? D : E).get(i).text();
863
- return a ? {
864
- id: e,
865
- key: t,
866
- bucket: Ze(a),
867
- storage: n
868
- } : null;
869
- }), s = N((e) => {
870
- if (!e) return null;
871
- let t = O(`feature:${e.id}:${e.key}`, "global");
872
- (e.storage === "session" ? D : E).set(t, e.bucket);
873
- }), c = /* @__PURE__ */ new Map(), l = k({
874
- source: {
875
- allFeaturesStore: t,
876
- resolvedFeaturesStore: n
877
- },
878
- effect: async ({ allFeaturesStore: e, resolvedFeaturesStore: t }, { id: n, decide: r, key: i }) => {
879
- let a = t.find((e) => e.id === n && e.key === i);
880
- if (a) return a;
881
- let o = e[n];
882
- if (!o) throw Error(`Feature with id '${n}' not found`);
883
- if (q(o.feature)) return {
884
- id: o.id,
885
- bucket: !1,
886
- key: i,
887
- storage: o.feature.storage
888
- };
889
- let s = c.get(`${n}:${i}`);
890
- if (s !== void 0) {
891
- let e = await s;
892
- return {
893
- id: o.id,
894
- bucket: e,
895
- key: i,
896
- storage: o.feature.storage
897
- };
898
- }
899
- let l = r();
900
- c.set(`${n}:${i}`, l);
901
- let u = await l;
902
- return {
903
- id: o.id,
904
- bucket: u,
905
- key: i,
906
- storage: o.feature.storage
907
- };
908
- }
909
- });
910
- I({
911
- clock: i.register,
912
- fn: (e) => {
913
- let { id: t, feature: n } = e;
914
- return {
915
- id: t,
916
- key: n.feature.key,
917
- storage: n.feature.storage,
918
- enabled: n.feature.enabled
919
- };
920
- },
921
- target: o
922
- }), I({
923
- source: t,
924
- clock: l.doneData,
925
- filter: (e, t) => !q(e[t.id]?.feature),
926
- fn: (e, t) => {
927
- let { id: n, bucket: r, storage: i } = t, a = e[n]?.feature.key;
928
- return a ? {
929
- key: a,
930
- id: n,
931
- bucket: r,
932
- storage: i
933
- } : null;
934
- },
935
- target: s
936
- });
937
- let u = A({
938
- allFeaturesStore: t,
939
- resolvedFeaturesStore: n
940
- }).map(({ allFeaturesStore: e, resolvedFeaturesStore: t }) => Object.values(e).map((e) => {
941
- let n = t.find((t) => t.id === e.id && t.key === e.feature.key);
942
- return n ? {
943
- id: e.id,
944
- name: e.feature.name,
945
- key: e.feature.key,
946
- enabled: e.feature.enabled,
947
- weight: e.feature.weight,
948
- getBucket: () => ({
949
- id: e.id,
950
- bucket: n.bucket
951
- }),
952
- isResolved: !0
953
- } : {
954
- id: e.id,
955
- name: e.feature.name,
956
- key: e.feature.key,
957
- enabled: e.feature.enabled,
958
- weight: e.feature.weight,
959
- getBucket: async () => await l(e.feature),
960
- isResolved: !1
961
- };
962
- }));
963
- I({
964
- clock: l.doneData,
965
- source: {
966
- resolvedFeatures: n,
967
- allFeatures: t
968
- },
969
- filter: ({ resolvedFeatures: e, allFeatures: t }, { id: n, key: r }) => !q(t[n]?.feature) && !e.some((e) => e.id === n && e.key === r),
970
- fn: (e, t) => t,
971
- target: e.eventBus.prepend((e) => ({
972
- type: "feature_decide",
973
- feature: e
974
- }))
975
- }), I({
976
- clock: [o.doneData, l.doneData],
977
- source: {
978
- resolvedFeatures: n,
979
- allFeatures: t
980
- },
981
- 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],
982
- target: n
983
- });
984
- function d(e) {
985
- return u.map((t) => t.find((t) => t.id === e));
986
- }
987
- let f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
988
- function h(e) {
989
- let t = f.get(e);
990
- if (t) return t;
991
- let n = d(e);
992
- return f.set(e, n), n;
993
- }
994
- function g(e) {
995
- return t.map((t) => t[e], { skipVoid: !1 });
996
- }
997
- function _(e) {
998
- let t = F(async () => void 0, { skipVoid: !1 }), n = h(e), r = k({
999
- source: n,
1000
- effect: async (e) => {
1001
- if (e) return async () => (await e.getBucket()).bucket;
1002
- }
1003
- });
1004
- return I({
1005
- clock: n,
1006
- target: r
1007
- }), I({
1008
- clock: r.doneData,
1009
- filter: (e) => e !== void 0,
1010
- target: t
1011
- }), r(), t;
1012
- }
1013
- function v(e) {
1014
- let t = p.get(e);
1015
- if (t) return t;
1016
- let n = _(e);
1017
- return p.set(e, n), n;
1018
- }
1019
- function y(e) {
1020
- let t = v(e), n = F(void 0, { skipVoid: !1 }), r = k({
1021
- source: t,
1022
- mapParams: (e, t) => t,
1023
- effect: N(async (e) => await e())
1024
- });
1025
- return I({
1026
- clock: r.doneData,
1027
- fn: (t) => {
1028
- if (t !== void 0) return {
1029
- id: e,
1030
- bucket: t
1031
- };
1032
- },
1033
- target: n
1034
- }), I({
1035
- clock: t,
1036
- target: r
1037
- }), r(), n;
1038
- }
1039
- function ee(e) {
1040
- let t = m.get(e);
1041
- if (t) return t;
1042
- let n = y(e);
1043
- return m.set(e, n), n;
1044
- }
1045
- return {
1046
- register: a,
1047
- getById: h,
1048
- getByName: g,
1049
- listStore: u,
1050
- getEvokableFeature: v,
1051
- getFeatureResult: ee
1052
- };
1053
- });
1054
- function $e(e) {
1055
- return R(Qe, e);
1056
- }
1057
- var et = (e, t, n) => {
1058
- n.register({
1059
- id: e,
1060
- feature: t
1061
- });
1062
- }, J = M("history");
1063
- function tt(e, t) {
824
+ }, q = M("history");
825
+ function $e(e, t) {
1064
826
  return {
1065
- id: ne(`history-entry-${Date.now()}-${Math.random()}}`),
827
+ id: oe(`history-entry-${Date.now()}-${Math.random()}}`),
1066
828
  node: t,
1067
829
  at: Date.now(),
1068
830
  experienceId: e
1069
831
  };
1070
832
  }
1071
- var nt = L(() => {
1072
- let e = J.store({ entries: [] }), t = J.event(), n = J.event(), r = J.event(), i = J.event();
1073
- e.on(t, (e, t) => ({ entries: [...e.entries, tt(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), tt(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);
1074
836
  function a(e, t) {
1075
837
  let n = {
1076
838
  lastStepIndex: -1,
@@ -1100,20 +862,20 @@ var nt = L(() => {
1100
862
  entriesStore: e.map((e) => e.entries)
1101
863
  };
1102
864
  });
1103
- function rt() {
1104
- return R(nt);
865
+ function tt() {
866
+ return R(et);
1105
867
  }
1106
868
  //#endregion
1107
869
  //#region src/utils/events.ts
1108
- var it = 0, at = (e) => {
870
+ var nt = 0, rt = (e) => {
1109
871
  let t = F([]);
1110
872
  return t.on(e, (e, t) => [...e, {
1111
- id: it++,
873
+ id: nt++,
1112
874
  at: /* @__PURE__ */ new Date(),
1113
875
  payload: t
1114
876
  }]), t;
1115
- }, ot = M("field"), st = L(() => {
1116
- let e = ot.store({}), t = j(e, {
877
+ }, it = M("field"), at = L(() => {
878
+ let e = it.store({}), t = j(e, {
1117
879
  register(e, t) {
1118
880
  return {
1119
881
  ...e,
@@ -1161,13 +923,13 @@ var it = 0, at = (e) => {
1161
923
  getByName: c
1162
924
  };
1163
925
  });
1164
- function ct() {
1165
- return R(st);
926
+ function ot() {
927
+ return R(at);
1166
928
  }
1167
929
  //#endregion
1168
930
  //#region src/entities/step/step.ts
1169
- var lt = M("step"), ut = L(() => {
1170
- let e = lt.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) {
1171
933
  return {
1172
934
  ...e,
1173
935
  [t.step.id]: t.step
@@ -1191,16 +953,16 @@ var lt = M("step"), ut = L(() => {
1191
953
  indexStore: e
1192
954
  };
1193
955
  });
1194
- function dt() {
1195
- return R(ut);
956
+ function lt() {
957
+ return R(ct);
1196
958
  }
1197
- function ft(e, t) {
959
+ function ut(e, t) {
1198
960
  t.register(e);
1199
961
  }
1200
962
  //#endregion
1201
963
  //#region src/entities/content/content.ts
1202
- var pt = M("content"), mt = L(() => {
1203
- let e = pt.store({}), t = j(e, {
964
+ var dt = M("content"), ft = L(() => {
965
+ let e = dt.store({}), t = j(e, {
1204
966
  register(e, t) {
1205
967
  return {
1206
968
  ...e,
@@ -1241,16 +1003,16 @@ var pt = M("content"), mt = L(() => {
1241
1003
  indexStore: e
1242
1004
  };
1243
1005
  });
1244
- function ht() {
1245
- return R(mt);
1006
+ function pt() {
1007
+ return R(ft);
1246
1008
  }
1247
- function gt(e, t) {
1009
+ function mt(e, t) {
1248
1010
  t.register(e);
1249
1011
  }
1250
1012
  //#endregion
1251
1013
  //#region src/entities/action/action.ts
1252
- var _t = M("action"), vt = L(({ client: e }) => {
1253
- let t = _t.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) {
1254
1016
  return {
1255
1017
  ...e,
1256
1018
  [t.key]: {
@@ -1308,10 +1070,10 @@ var _t = M("action"), vt = L(({ client: e }) => {
1308
1070
  getEvokableAction: s
1309
1071
  };
1310
1072
  });
1311
- function yt(e) {
1312
- return R(vt, e);
1073
+ function _t(e) {
1074
+ return R(gt, e);
1313
1075
  }
1314
- var bt = (e, t, n) => {
1076
+ var vt = (e, t, n) => {
1315
1077
  n.register({
1316
1078
  key: e,
1317
1079
  action: t
@@ -1319,7 +1081,7 @@ var bt = (e, t, n) => {
1319
1081
  };
1320
1082
  //#endregion
1321
1083
  //#region src/entities/response/response-validation.ts
1322
- function Y(e, t, n, r) {
1084
+ function J(e, t, n, r) {
1323
1085
  return {
1324
1086
  fieldKey: e.key,
1325
1087
  userMessage: n,
@@ -1327,62 +1089,62 @@ function Y(e, t, n, r) {
1327
1089
  value: t
1328
1090
  };
1329
1091
  }
1330
- function X(e) {
1092
+ function Y(e) {
1331
1093
  return e === null || e === "" || Array.isArray(e) && !e.length;
1332
1094
  }
1333
- function xt(e) {
1095
+ function yt(e) {
1334
1096
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
1335
1097
  }
1336
- function St(e) {
1098
+ function bt(e) {
1337
1099
  try {
1338
1100
  return JSON.stringify(e), !0;
1339
1101
  } catch {
1340
1102
  return !1;
1341
1103
  }
1342
1104
  }
1343
- function Ct(e, t) {
1105
+ function xt(e, t) {
1344
1106
  return t.find((t) => t.key === e) ?? null;
1345
1107
  }
1346
- function wt(e, t) {
1108
+ function St(e, t) {
1347
1109
  return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
1348
1110
  }
1349
- function Tt(e, t) {
1350
- if (e.type !== "object" || X(t)) return null;
1111
+ function Ct(e, t) {
1112
+ if (e.type !== "object" || Y(t)) return null;
1351
1113
  if (e.multiple) {
1352
- 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.");
1353
1115
  for (let n of t) {
1354
- 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.");
1355
- if (!St(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.).");
1356
1118
  }
1357
1119
  return null;
1358
1120
  }
1359
- 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.") : St(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.).");
1360
1122
  }
1361
- function Et(e, t) {
1362
- 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;
1363
1125
  let n = Array.isArray(t) ? t : [t];
1364
1126
  if (e.type === "object") {
1365
1127
  let r = new Set(e.options.map((e) => JSON.stringify(e.value)));
1366
- 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.");
1367
1129
  }
1368
1130
  let r = e.options.map((e) => e.value);
1369
- return n.every((e) => !xt(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(", ")}`);
1370
1132
  }
1371
- async function Dt(t, n, r, i) {
1372
- 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)) {
1373
1135
  let e = i ? {
1374
1136
  $input: r,
1375
1137
  responses: i
1376
1138
  } : { $input: r }, a = await t(n.validation, e);
1377
- if (typeof a == "string") return Y(n, r, a, `Field validation resulted in an error: ${a}.`);
1378
- 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.");
1379
1141
  }
1380
- 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;
1381
1143
  }
1382
1144
  //#endregion
1383
1145
  //#region src/entities/response/response.ts
1384
- var Ot = M("response"), kt = L(({ client: e }) => {
1385
- let t = Ot.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, {
1386
1148
  register(e, t) {
1387
1149
  return {
1388
1150
  ...e,
@@ -1421,7 +1183,7 @@ var Ot = M("response"), kt = L(({ client: e }) => {
1421
1183
  ...t,
1422
1184
  ...n
1423
1185
  }, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
1424
- let o = Ct(t, e);
1186
+ let o = xt(t, e);
1425
1187
  if (!o) {
1426
1188
  r.push({
1427
1189
  fieldKey: t,
@@ -1431,17 +1193,17 @@ var Ot = M("response"), kt = L(({ client: e }) => {
1431
1193
  });
1432
1194
  return;
1433
1195
  }
1434
- let c = wt(o, n), l = await Dt(s, o, c, a);
1196
+ let c = St(o, n), l = await Tt(s, o, c, a);
1435
1197
  if (l) {
1436
1198
  r.push(l);
1437
1199
  return;
1438
1200
  }
1439
- let u = Tt(o, c);
1201
+ let u = Ct(o, c);
1440
1202
  if (u) {
1441
1203
  r.push(u);
1442
1204
  return;
1443
1205
  }
1444
- let d = Et(o, c);
1206
+ let d = wt(o, c);
1445
1207
  if (d) {
1446
1208
  r.push(d);
1447
1209
  return;
@@ -1520,13 +1282,13 @@ var Ot = M("response"), kt = L(({ client: e }) => {
1520
1282
  getByFieldName: _
1521
1283
  };
1522
1284
  });
1523
- function At(e) {
1524
- return R(kt, e);
1285
+ function Ot(e) {
1286
+ return R(Dt, e);
1525
1287
  }
1526
1288
  //#endregion
1527
1289
  //#region src/entities/condition/condition.ts
1528
- var jt = M("condition"), Mt = L(() => {
1529
- let e = jt.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) {
1530
1292
  return {
1531
1293
  ...e,
1532
1294
  [t.condition.id]: t.condition
@@ -1550,12 +1312,12 @@ var jt = M("condition"), Mt = L(() => {
1550
1312
  indexStore: e
1551
1313
  };
1552
1314
  });
1553
- function Nt() {
1554
- return R(Mt);
1315
+ function jt() {
1316
+ return R(At);
1555
1317
  }
1556
1318
  //#endregion
1557
1319
  //#region src/utils/api-url.ts
1558
- function Pt() {
1320
+ function Mt() {
1559
1321
  if (c()) {
1560
1322
  let e = [
1561
1323
  document.currentScript,
@@ -1570,7 +1332,7 @@ function Pt() {
1570
1332
  }
1571
1333
  //#endregion
1572
1334
  //#region src/utils/search-params.ts
1573
- function Ft() {
1335
+ function Nt() {
1574
1336
  if (!s()) return {};
1575
1337
  let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
1576
1338
  for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
@@ -1588,13 +1350,13 @@ function Ft() {
1588
1350
  }
1589
1351
  //#endregion
1590
1352
  //#region src/entities/session/session.ts
1591
- var It = O("session", "global");
1592
- function Lt() {
1353
+ var Pt = O("session", "global");
1354
+ function Ft() {
1593
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)}`;
1594
1356
  }
1595
- function Rt() {
1357
+ function It() {
1596
1358
  if (!h()) return null;
1597
- let e = E.get(It);
1359
+ let e = E.get(Pt);
1598
1360
  if (!e.isSet()) return null;
1599
1361
  try {
1600
1362
  return e.json();
@@ -1602,8 +1364,8 @@ function Rt() {
1602
1364
  return null;
1603
1365
  }
1604
1366
  }
1605
- var zt = L(() => {
1606
- let e = Rt(), t = { id: e?.id ?? Lt() };
1367
+ var Lt = L(() => {
1368
+ let e = It(), t = { id: e?.id ?? Ft() };
1607
1369
  e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
1608
1370
  let n = F(t), r = j(n, {
1609
1371
  setIsUser: (e, t) => ({
@@ -1629,7 +1391,7 @@ var zt = L(() => {
1629
1391
  source: n,
1630
1392
  effect: (e) => {
1631
1393
  if (h()) try {
1632
- E.get(It).set(e);
1394
+ E.get(Pt).set(e);
1633
1395
  } catch {}
1634
1396
  }
1635
1397
  });
@@ -1643,39 +1405,39 @@ var zt = L(() => {
1643
1405
  removeIdentifier: r.removeIdentifier
1644
1406
  };
1645
1407
  });
1646
- function Bt() {
1647
- return R(zt, void 0);
1408
+ function Rt() {
1409
+ return R(Lt, void 0);
1648
1410
  }
1649
1411
  //#endregion
1650
1412
  //#region src/utils/picked-config.ts
1651
- function Vt() {
1413
+ function zt() {
1652
1414
  if (s()) return globalThis.window.pickedConfig;
1653
1415
  }
1654
- function Ht() {
1655
- if (s()) return Vt()?.projectId;
1416
+ function Bt() {
1417
+ if (s()) return zt()?.projectId;
1656
1418
  }
1657
- function Ut() {
1419
+ function Vt() {
1658
1420
  if (!c()) return;
1659
1421
  let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
1660
1422
  if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
1661
1423
  }
1662
- function Wt(e) {
1424
+ function Ht(e) {
1663
1425
  if (e.projectId) return e.projectId;
1664
- let t = Ht();
1426
+ let t = Bt();
1665
1427
  if (t) return t;
1666
- let n = Ut();
1428
+ let n = Vt();
1667
1429
  if (n) return n;
1668
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.");
1669
1431
  }
1670
1432
  //#endregion
1671
1433
  //#region src/utils/render-string.ts
1672
- function Z(e) {
1434
+ function X(e) {
1673
1435
  return e == null || e === "" || Number.isNaN(e);
1674
1436
  }
1675
- var Gt = {
1676
- default: (e, t) => Z(e) ? String(t ?? "") : String(e),
1677
- append: (e, t) => t && !Z(e) ? `${e} ${t}` : e,
1678
- 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,
1679
1441
  upper: (e) => typeof e == "string" ? e.toUpperCase() : e,
1680
1442
  lower: (e) => typeof e == "string" ? e.toLowerCase() : e,
1681
1443
  capitalize: (e) => typeof e == "string" ? e.charAt(0).toUpperCase() + e.slice(1) : e,
@@ -1693,24 +1455,24 @@ var Gt = {
1693
1455
  return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
1694
1456
  }
1695
1457
  };
1696
- function Kt(e) {
1458
+ function Wt(e) {
1697
1459
  return typeof e == "object" && !!e;
1698
1460
  }
1699
- function qt(e, t) {
1461
+ function Gt(e, t) {
1700
1462
  let n = t;
1701
- for (let t of e.split(".")) if (Kt(n) && t in n) n = n[t];
1463
+ for (let t of e.split(".")) if (Wt(n) && t in n) n = n[t];
1702
1464
  else return;
1703
1465
  return typeof n == "function" ? n() : n;
1704
1466
  }
1705
- function Jt(e, t) {
1706
- let n = e.split("|").map((e) => e.trim()), r = qt(n.shift() ?? "", t);
1467
+ function Kt(e, t) {
1468
+ let n = e.split("|").map((e) => e.trim()), r = Gt(n.shift() ?? "", t);
1707
1469
  for (let e of n) {
1708
- let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Gt[i];
1470
+ let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Ut[i];
1709
1471
  o && (r = o(r, a));
1710
1472
  }
1711
- return Z(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
1473
+ return X(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
1712
1474
  }
1713
- function Yt(e, t) {
1475
+ function qt(e, t) {
1714
1476
  let n = "", r = 0;
1715
1477
  for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
1716
1478
  r += 2;
@@ -1722,19 +1484,19 @@ function Yt(e, t) {
1722
1484
  }
1723
1485
  i += e[r++];
1724
1486
  }
1725
- n += Jt(i.trim(), t);
1487
+ n += Kt(i.trim(), t);
1726
1488
  } else n += e[r++];
1727
1489
  return n;
1728
1490
  }
1729
1491
  //#endregion
1730
1492
  //#region src/utils/preview-session.ts
1731
- var Xt = "preview-token";
1732
- function Zt() {
1733
- return !s() || !g() ? !1 : !!Ft()[Xt]?.[0];
1493
+ var Jt = "preview-token";
1494
+ function Yt() {
1495
+ return !s() || !g() ? !1 : !!Nt()[Jt]?.[0];
1734
1496
  }
1735
1497
  //#endregion
1736
1498
  //#region src/picked.ts
1737
- var Qt = class {
1499
+ var Xt = class {
1738
1500
  static logger = r;
1739
1501
  options;
1740
1502
  dataSource = null;
@@ -1753,51 +1515,51 @@ var Qt = class {
1753
1515
  apiUrl;
1754
1516
  dashboardUrl;
1755
1517
  documentationSiteUrl;
1756
- session = Bt();
1757
- searchParams = Ft();
1758
- history = rt();
1759
- components = be({ client: this });
1518
+ session = Rt();
1519
+ searchParams = Nt();
1520
+ history = tt();
1521
+ components = Ce({ client: this });
1760
1522
  experienceInstances = C({ client: this });
1761
- experiences = fe({ client: this });
1762
- frameworks = we({ client: this });
1763
- predicates = Je({ client: this });
1764
- features = $e({ client: this });
1765
- conditions = Nt();
1766
- fields = ct();
1767
- responses = At({ client: this });
1768
- steps = dt();
1769
- contents = ht();
1770
- actions = yt({ 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 });
1771
1533
  conditionResults = w();
1772
- stateSnapshotStore = De({ client: this });
1773
- evaluateRuleLogicFx = Fe({ client: this });
1534
+ stateSnapshotStore = Ae({ client: this });
1535
+ evaluateRuleLogicFx = Re({ client: this });
1774
1536
  start;
1775
1537
  readyStore;
1776
1538
  preconditionPassedStore;
1777
1539
  conditionPassedStore;
1778
1540
  lifecycleStageStore;
1779
- lifecycle = Ge({ client: this });
1541
+ lifecycle = Je({ client: this });
1780
1542
  renderStringFx = k({
1781
1543
  source: this.responses.listStore,
1782
1544
  effect: (e, { template: t, context: n }) => {
1783
1545
  let r = {};
1784
1546
  for (let t of e) r[t.fieldKey] = t.value;
1785
- return Yt(t, {
1547
+ return qt(t, {
1786
1548
  ...n,
1787
1549
  responses: r
1788
1550
  });
1789
1551
  }
1790
1552
  });
1791
1553
  constructor(e) {
1792
- this.events = at(this.eventBus), this.projectId = Wt(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Pt(), 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({
1793
1555
  type: "load",
1794
- version: re()
1556
+ version: ae()
1795
1557
  }), this.maybeStartPreviewChannel();
1796
1558
  }
1797
1559
  dataProviderFor(e) {
1798
1560
  let t = e ?? "", n = this.dataProviders.get(t);
1799
1561
  if (n) return n;
1800
- let r = import("../provider-DLebj-AW.js").then((t) => t.createPickedDataProvider({
1562
+ let r = import("../provider-Dx6VjvZg.js").then((t) => t.createPickedDataProvider({
1801
1563
  apiUrl: this.apiUrl,
1802
1564
  projectId: this.projectId,
1803
1565
  ...e !== void 0 && { previewToken: e }
@@ -1813,24 +1575,24 @@ var Qt = class {
1813
1575
  return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
1814
1576
  }
1815
1577
  maybeStartPreviewChannel() {
1816
- Zt() && 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);
1817
1579
  }
1818
1580
  registerFramework = (e) => {
1819
- Te(e, this.frameworks);
1581
+ Oe(e, this.frameworks);
1820
1582
  };
1821
1583
  registerComponent = (e, t) => {
1822
- xe(e, t, this.components);
1584
+ we(e, t, this.components);
1823
1585
  };
1824
1586
  registerPlugin = (e) => {
1825
- he(this, e, this.plugins);
1587
+ ve(this, e, this.plugins);
1826
1588
  let t = this.plugins[e.name];
1827
1589
  t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
1828
1590
  };
1829
1591
  registerFeature = (e, t) => {
1830
- et(e, t, this.features);
1592
+ ne(e, t, this.features);
1831
1593
  };
1832
1594
  registerPredicate = (e, t) => {
1833
- Ye(e, t, this.predicates);
1595
+ Qe(e, t, this.predicates);
1834
1596
  };
1835
1597
  registerCondition = (e) => {
1836
1598
  this.conditions.register(e);
@@ -1839,19 +1601,19 @@ var Qt = class {
1839
1601
  this.fields.register(e);
1840
1602
  };
1841
1603
  registerStep = (e) => {
1842
- ft(e, this.steps);
1604
+ ut(e, this.steps);
1843
1605
  };
1844
1606
  registerContent = (e) => {
1845
- gt(e, this.contents);
1607
+ mt(e, this.contents);
1846
1608
  };
1847
1609
  patchContent = (e, t) => {
1848
1610
  this.contents.patch(e, t);
1849
1611
  };
1850
1612
  registerAction = (e, t) => {
1851
- bt(e, t, this.actions);
1613
+ vt(e, t, this.actions);
1852
1614
  };
1853
1615
  registerExperience = (e) => {
1854
- e.component && xe(`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);
1855
1617
  };
1856
1618
  launchExperienceById = async (e, t) => {
1857
1619
  this.experiences.launch({
@@ -1894,12 +1656,12 @@ var Qt = class {
1894
1656
  this.registerFeature(e, n);
1895
1657
  }), this.searchParams.feature && this.searchParams.feature.forEach((e) => {
1896
1658
  try {
1897
- let [t, n] = e.split(":");
1898
- if (!t || !n) return;
1899
- let r = Ze(n);
1900
- this.registerFeature(t, {
1659
+ let t = ie(e);
1660
+ if (!t) return;
1661
+ let { id: n, bucket: r } = t;
1662
+ this.registerFeature(n, {
1901
1663
  key: `${r}`,
1902
- name: t,
1664
+ name: n,
1903
1665
  decide: () => r,
1904
1666
  storage: "session"
1905
1667
  });
@@ -1933,8 +1695,8 @@ var Qt = class {
1933
1695
  });
1934
1696
  }
1935
1697
  getPluginConfig = (e) => this.plugins[e] ?? {};
1936
- }, $t = "application/picked-javascript", en = "application/picked-module", tn = "data-picked-hydrated";
1937
- async function nn(e) {
1698
+ }, Zt = "application/picked-javascript", Qt = "application/picked-module", $t = "data-picked-hydrated";
1699
+ async function en(e) {
1938
1700
  if (!("document" in globalThis)) return;
1939
1701
  let t = "application/picked-module", n = "data-picked-hydrated";
1940
1702
  function r(e) {
@@ -1963,42 +1725,42 @@ async function nn(e) {
1963
1725
  a && await a;
1964
1726
  }
1965
1727
  }
1966
- function rn() {
1967
- return `<script>(${nn.toString()})(document)<\/script>`;
1728
+ function tn() {
1729
+ return `<script>(${en.toString()})(document)<\/script>`;
1968
1730
  }
1969
1731
  //#endregion
1970
1732
  //#region src/utils/html-asset-value.ts
1971
- function an(e) {
1733
+ function nn(e) {
1972
1734
  return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
1973
1735
  }
1974
1736
  //#endregion
1975
1737
  //#region src/entities/component/lazyComponent.ts
1976
- function on(e) {
1738
+ function rn(e) {
1977
1739
  return {
1978
1740
  $$type: "lazy-component",
1979
1741
  load: e
1980
1742
  };
1981
1743
  }
1982
- function sn(e) {
1744
+ function an(e) {
1983
1745
  return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
1984
1746
  }
1985
1747
  //#endregion
1986
1748
  //#region src/entities/content/reference.ts
1987
- function Q(e) {
1749
+ function Z(e) {
1988
1750
  return typeof e == "object" && !!e && !Array.isArray(e) && "contentEntryId" in e && typeof e.contentEntryId == "string";
1989
1751
  }
1990
- function $(e) {
1991
- return Q(e) ? e.contentEntryId : null;
1752
+ function Q(e) {
1753
+ return Z(e) ? e.contentEntryId : null;
1992
1754
  }
1993
- function cn(e) {
1755
+ function $(e) {
1994
1756
  let t = Array.isArray(e) ? e : [e], n = [];
1995
- for (let e of t) Q(e) && n.push(e.contentEntryId);
1757
+ for (let e of t) Z(e) && n.push(e.contentEntryId);
1996
1758
  return n;
1997
1759
  }
1998
- function ln(e, t) {
1760
+ function on(e, t) {
1999
1761
  return t === null ? null : e[t] ?? null;
2000
1762
  }
2001
- function un(e, t) {
1763
+ function sn(e, t) {
2002
1764
  let n = [];
2003
1765
  for (let r of t) {
2004
1766
  let t = e[r];
@@ -2006,29 +1768,29 @@ function un(e, t) {
2006
1768
  }
2007
1769
  return n;
2008
1770
  }
2009
- function dn(e, t) {
2010
- if (se.store(t)) return A(t, e.indexStore, (e, t) => ln(t, $(e)));
2011
- let n = $(t);
2012
- return e.indexStore.map((e) => ln(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 });
2013
1775
  }
2014
- function fn(e, t) {
2015
- if (se.store(t)) return A(t, e.indexStore, (e, t) => un(t, cn(e)));
2016
- let n = cn(t);
2017
- return e.indexStore.map((e) => un(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 });
2018
1780
  }
2019
1781
  //#endregion
2020
1782
  //#region src/exports.ts
2021
- var pn = (e) => {
2022
- let t = new Qt(e);
1783
+ var un = (e) => {
1784
+ let t = new Xt(e);
2023
1785
  return u(t), t;
2024
1786
  };
2025
1787
  //#endregion
2026
1788
  //#region src/typed-content.ts
2027
- function mn(e) {
1789
+ function dn(e) {
2028
1790
  return typeof e.data == "object";
2029
1791
  }
2030
- function hn(e) {
2031
- return e.map((e) => !e || !mn(e) ? null : e, { skipVoid: !1 });
1792
+ function fn(e) {
1793
+ return e.map((e) => !e || !dn(e) ? null : e, { skipVoid: !1 });
2032
1794
  }
2033
1795
  //#endregion
2034
- export { tn as PICKED_HYDRATED_ATTR, en as PICKED_MODULE_SCRIPT_TYPE, $t as PICKED_SCRIPT_TYPE, Xt as PREVIEW_TOKEN_PARAM, Qt as Picked, rn as buildRehydrateBootstrap, pn as createClient, me as createPluginEffect, O as createStorageKey, dn as deriveReference, fn as deriveReferences, n as evaluateRuleLogic, Vt as getPickedConfig, Q as isContentReference, an as isHtmlAssetValue, g as isInsideIframe, sn as isLazyLoader, v as isPickedRoot, Zt as isPreviewSession, on as lazyComponent, E as localStore, oe as onInertScriptSubtrees, $ as readReferenceId, cn as readReferenceIds, nn as rehydrateScripts, ie as reportInertScriptSubtrees, ae 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, hn 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 };