@picked/client 0.0.1-dev.1773807602703 → 0.0.1-dev.1774224866171

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 (135) hide show
  1. package/dist/api-WKe5XBeR.cjs +1 -0
  2. package/dist/api-ZK-H-MlI.js +37 -0
  3. package/dist/cjs/form/index.js +1 -0
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/create-experience/index.js +1 -1
  6. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  7. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  8. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  9. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  10. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  11. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  12. package/dist/cjs/plugins/web-components/index.js +1 -1
  13. package/dist/cjs/plugins/window-object/index.js +1 -1
  14. package/dist/cjs/server/index.js +1 -1
  15. package/dist/esm/form/index.js +428 -0
  16. package/dist/esm/index.js +1138 -1291
  17. package/dist/esm/plugins/create-experience/index.js +424 -509
  18. package/dist/esm/plugins/dynamic-experiences/index.js +120 -204
  19. package/dist/esm/plugins/experience-browser-storage/index.js +32 -37
  20. package/dist/esm/plugins/history-browser-storage/index.js +23 -25
  21. package/dist/esm/plugins/responses-browser-storage/index.js +36 -39
  22. package/dist/esm/plugins/responses-indexeddb/index.js +77 -80
  23. package/dist/esm/plugins/single-page-app/index.js +31 -35
  24. package/dist/esm/plugins/web-components/index.js +18 -20
  25. package/dist/esm/plugins/window-object/index.js +9 -9
  26. package/dist/esm/server/index.js +95 -89
  27. package/dist/experience-instance-DZiAwXph.js +481 -0
  28. package/dist/experience-instance-Ddk4Jktn.cjs +1 -0
  29. package/dist/id-Bv44ilEo.cjs +1 -0
  30. package/dist/id-CRqy981z.js +4 -0
  31. package/dist/logger-6z_gb4rA.js +4 -0
  32. package/dist/logger-fbvQC40v.cjs +1 -0
  33. package/dist/object-C82v79xc.js +25 -0
  34. package/dist/object-CUJOjanb.cjs +1 -0
  35. package/dist/rules-logic-B7vJrWyO.js +231 -0
  36. package/dist/rules-logic-CXr4wXcG.cjs +1 -0
  37. package/dist/storage-6Xk0uAxB.js +103 -0
  38. package/dist/storage-B6lQtc4-.cjs +1 -0
  39. package/dist/supports-0XIfd4-R.js +85 -0
  40. package/dist/supports-Dsjg-82e.cjs +1 -0
  41. package/dist/types/entities/action/action.d.ts.map +1 -1
  42. package/dist/types/entities/experience/experience.d.ts +31 -48
  43. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  44. package/dist/types/entities/experience-instance/experience-instance.d.ts +2 -2
  45. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  46. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  47. package/dist/types/entities/field/field.d.ts +12 -17
  48. package/dist/types/entities/field/field.d.ts.map +1 -1
  49. package/dist/types/entities/history/history.d.ts.map +1 -1
  50. package/dist/types/entities/response/response.d.ts +7 -9
  51. package/dist/types/entities/response/response.d.ts.map +1 -1
  52. package/dist/types/form/build-responses.d.ts +14 -0
  53. package/dist/types/form/build-responses.d.ts.map +1 -0
  54. package/dist/types/form/create-field-evaluator.d.ts +19 -0
  55. package/dist/types/form/create-field-evaluator.d.ts.map +1 -0
  56. package/dist/types/form/create-field-validation.d.ts +44 -0
  57. package/dist/types/form/create-field-validation.d.ts.map +1 -0
  58. package/dist/types/form/create-form.d.ts +66 -0
  59. package/dist/types/form/create-form.d.ts.map +1 -0
  60. package/dist/types/form/create-submit-pipeline.d.ts +58 -0
  61. package/dist/types/form/create-submit-pipeline.d.ts.map +1 -0
  62. package/dist/types/form/get-step-fields.d.ts +5 -0
  63. package/dist/types/form/get-step-fields.d.ts.map +1 -0
  64. package/dist/types/form/index.d.ts +10 -0
  65. package/dist/types/form/index.d.ts.map +1 -0
  66. package/dist/types/index.d.ts +1 -3
  67. package/dist/types/index.d.ts.map +1 -1
  68. package/dist/types/logic-engine.d.ts +2 -8
  69. package/dist/types/logic-engine.d.ts.map +1 -1
  70. package/dist/types/picked.d.ts +23 -42
  71. package/dist/types/picked.d.ts.map +1 -1
  72. package/dist/types/plugins/create-experience/create-experience.d.ts +37 -70
  73. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  74. package/dist/types/plugins/create-experience/index.d.ts +1 -1
  75. package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
  76. package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
  77. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +5 -20
  78. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  79. package/dist/types/plugins/dynamic-experiences/types.d.ts +0 -46
  80. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  81. package/dist/types/plugins/experience-browser-storage/plugin.d.ts +2 -1
  82. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  83. package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -0
  84. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  85. package/dist/types/plugins/responses-browser-storage/plugin.d.ts +2 -1
  86. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
  87. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
  88. package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
  89. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  90. package/dist/types/utils/dom.d.ts +0 -3
  91. package/dist/types/utils/dom.d.ts.map +1 -1
  92. package/dist/types/utils/events.d.ts +2 -2
  93. package/dist/types/utils/events.d.ts.map +1 -1
  94. package/dist/types/utils/global-obj.d.ts +0 -1
  95. package/dist/types/utils/global-obj.d.ts.map +1 -1
  96. package/dist/types/utils/indexed-db.d.ts +2 -1
  97. package/dist/types/utils/indexed-db.d.ts.map +1 -1
  98. package/dist/types/utils/logger.d.ts.map +1 -1
  99. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
  100. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
  101. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +3 -3
  102. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
  103. package/dist/types/utils/nodes.d.ts +2 -7
  104. package/dist/types/utils/nodes.d.ts.map +1 -1
  105. package/dist/types/utils/object.d.ts +0 -8
  106. package/dist/types/utils/object.d.ts.map +1 -1
  107. package/dist/types/utils/picked-config.d.ts +1 -1
  108. package/dist/types/utils/picked-config.d.ts.map +1 -1
  109. package/dist/types/utils/search-params.d.ts.map +1 -1
  110. package/dist/types/utils/storage.d.ts.map +1 -1
  111. package/package.json +18 -8
  112. package/dist/api-GlH9T8_1.js +0 -32
  113. package/dist/api-GvmToTw0.cjs +0 -1
  114. package/dist/experience-instance-CxiOyYPf.cjs +0 -1
  115. package/dist/experience-instance-DCknHRkX.js +0 -804
  116. package/dist/id-BKIWbSTy.cjs +0 -1
  117. package/dist/id-BW-g3y32.js +0 -6
  118. package/dist/logger-BsmHUUw1.cjs +0 -1
  119. package/dist/logger-C9a75KZn.js +0 -5
  120. package/dist/nodes-DQt4TfuO.js +0 -26
  121. package/dist/nodes-DsL8kMSX.cjs +0 -1
  122. package/dist/object-BbFTsGh3.cjs +0 -1
  123. package/dist/object-JwZ58NOH.js +0 -28
  124. package/dist/storage-Be5xWNPC.cjs +0 -1
  125. package/dist/storage-Co_LbKr_.js +0 -239
  126. package/dist/supports-8YT4QKI7.js +0 -95
  127. package/dist/supports-YvpQZxbh.cjs +0 -1
  128. package/dist/types/entities/condition/condition.d.ts +0 -17
  129. package/dist/types/entities/condition/condition.d.ts.map +0 -1
  130. package/dist/types/entities/project/project.d.ts +0 -9
  131. package/dist/types/entities/project/project.d.ts.map +0 -1
  132. package/dist/types/entities/step/step.d.ts +0 -20
  133. package/dist/types/entities/step/step.d.ts.map +0 -1
  134. package/dist/types/utils/key.d.ts +0 -12
  135. package/dist/types/utils/key.d.ts.map +0 -1
package/dist/esm/index.js CHANGED
@@ -1,1334 +1,1181 @@
1
- import { createDomain as j, createApi as w, attach as V, combine as A, createStore as L, createEffect as C, sample as v, createEvent as D } from "effector";
2
- import { createFactory as k, invoke as b } from "@withease/factories";
3
- import { g as Z, t as ne, c as se, i as ie, e as _, a as oe, d as ae } from "../experience-instance-DCknHRkX.js";
4
- import { b as Gt } from "../experience-instance-DCknHRkX.js";
5
- import { l as F } from "../logger-C9a75KZn.js";
6
- import { c as z, l as R, s as M } from "../storage-Co_LbKr_.js";
7
- import { a as qt } from "../storage-Co_LbKr_.js";
8
- import { p as ce, g as ue } from "../api-GlH9T8_1.js";
9
- import { i as de } from "../nodes-DQt4TfuO.js";
10
- import { g as le } from "../id-BW-g3y32.js";
11
- import { i as fe } from "../object-JwZ58NOH.js";
12
- import { s as H, a as G, b as pe, c as ge, d as me } from "../supports-8YT4QKI7.js";
13
- import { e as Wt, f as Yt, g as Qt, h as Xt, i as Zt, j as er, k as tr } from "../supports-8YT4QKI7.js";
14
- const U = j("experience"), ye = k(
15
- ({ client: t, experience: e }) => {
16
- const r = U.store(e), n = w(r, {
17
- merge(p, f) {
18
- return {
19
- ...p,
20
- ...f.experience
21
- };
22
- }
23
- }), i = r.map((p) => ({
24
- name: p.name,
25
- decisionLogic: p.condition,
26
- targetSelectors: p.targets,
27
- initializeOpenLogic: e.initializeOpen
28
- })), u = e.component ? {
29
- name: `experience:${e.id}`,
30
- component: e.component,
31
- frameworkStore: t.frameworks.getByName(e.component.frameworkName)
32
- } : void 0, s = t.components.listStore.map(
33
- (p) => u || (e.componentName ? p.find((f) => f.name === e.componentName) : void 0) || p.find((f) => f.name === `experience:${e.id}`) || p.find((f) => f.name === "experience"),
34
- { skipVoid: !1 }
35
- ), o = r.map((p) => ({
36
- steps: p.steps,
37
- nodes: p.nodes,
38
- edges: p.edges,
39
- // eslint-disable-next-line sonarjs/deprecation -- backwards-compat fallback for conditionals
40
- conditions: p.conditions ?? p.conditionals ?? []
41
- })), l = e.actions ?? [];
42
- return {
43
- id: e.id,
44
- key: e.key,
45
- name: e.name,
46
- configStore: i,
47
- treeStore: o,
48
- componentStore: s,
49
- actions: l,
50
- merge: n.merge
51
- };
52
- }
53
- );
54
- function he(t) {
55
- return b(ye, t);
1
+ import { n as e, t } from "../rules-logic-B7vJrWyO.js";
2
+ import { t as n } from "../object-C82v79xc.js";
3
+ import { t as r } from "../logger-6z_gb4rA.js";
4
+ import { a as i, c as a, d as o, i as s, l as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "../supports-0XIfd4-R.js";
5
+ import { a as g, c as ee, i as te, n as _, o as v, r as y, s as ne } from "../experience-instance-DZiAwXph.js";
6
+ import { i as re, n as b, r as x, t as S } from "../storage-6Xk0uAxB.js";
7
+ import { n as ie, r as ae } from "../api-ZK-H-MlI.js";
8
+ import { t as oe } from "../id-CRqy981z.js";
9
+ import { attach as C, combine as w, createApi as T, createDomain as E, createEffect as D, createEvent as O, createStore as k, sample as A } from "effector";
10
+ import { createFactory as j, invoke as M } from "@withease/factories";
11
+ //#region src/entities/experience/experience.ts
12
+ var N = E("experience"), se = j(({ client: e, experience: t }) => {
13
+ let n = N.store(t), r = T(n, { merge(e, t) {
14
+ return {
15
+ ...e,
16
+ ...t.experience
17
+ };
18
+ } }), i = n.map((e) => ({
19
+ name: e.name,
20
+ decisionLogic: e.condition,
21
+ targetSelectors: e.targets,
22
+ initializeOpenLogic: t.initializeOpen
23
+ })), a = e.components.listStore.map((e) => (t.componentName ? e.find((e) => e.name === t.componentName) : void 0) || e.find((e) => e.name === `experience:${t.id}`) || e.find((e) => e.name === "experience"), { skipVoid: !1 }), o = n.map((e) => ({
24
+ steps: e.steps,
25
+ nodes: e.nodes,
26
+ edges: e.edges,
27
+ conditionals: e.conditionals
28
+ })), s = n.map((e) => e.fields), c = t.actions ?? [];
29
+ return {
30
+ id: t.id,
31
+ configStore: i,
32
+ treeStore: o,
33
+ fieldsStore: s,
34
+ componentStore: a,
35
+ actions: c,
36
+ merge: r.merge
37
+ };
38
+ });
39
+ function ce(e) {
40
+ return M(se, e);
56
41
  }
57
- const Se = k(({ client: t }) => {
58
- const e = U.store({}), r = U.store({}), n = w(e, {
59
- register(f, h) {
60
- return {
61
- ...f,
62
- [h.id]: h
63
- };
64
- }
65
- }), i = w(r, {
66
- register(f, { key: h, id: S }) {
67
- return { ...f, [h]: S };
68
- }
69
- });
70
- function u(f) {
71
- const h = e.getState()[f.id];
72
- if (h) {
73
- h.merge({ experience: f, strategy: "override" }), f.key && i.register({ key: f.key, id: f.id });
74
- return;
75
- }
76
- const S = he({ client: t, experience: f });
77
- n.register(S), f.key && i.register({ key: f.key, id: f.id });
78
- }
79
- const s = e.map((f) => Object.values(f));
80
- function o(f) {
81
- return A(e, r, (h, S) => h[f] ?? h[S[f] ?? ""], { skipVoid: !1 });
82
- }
83
- const l = V({
84
- source: { experiences: e, keys: r },
85
- effect: async ({ experiences: f, keys: h }, { id: S, options: g }) => {
86
- const a = f[S] ?? f[h[S] ?? ""];
87
- if (!a) {
88
- F("warn", `Experience with id '${S}' not found.`);
89
- return;
90
- }
91
- if (g?.bypassCondition) {
92
- N(t, a, g);
93
- return;
94
- }
95
- await ee(t, a) && N(t, a, g);
96
- }
97
- }), p = V({
98
- source: { instances: t.experienceInstances.listStore, keys: r },
99
- effect: ({ instances: f, keys: h }, { id: S, options: g }) => {
100
- const a = h[S] ?? S, c = f.filter((d) => d.experienceId === a);
101
- if (c.length > 0)
102
- for (const d of c)
103
- d.open();
104
- else
105
- l({ id: a, options: { ...g, initialiseOpen: !0 } });
106
- }
107
- });
108
- return {
109
- /** Registers an experience in the index. If an experience with the same ID already exists, it is merged. */
110
- register: u,
111
- /** Returns a derived store for an experience by its ID or key. The store value is `undefined` when no match exists. */
112
- get: o,
113
- /** @deprecated Use `experiences.get(id)` instead. */
114
- getById: o,
115
- /** Effector effect that launches an experience by ID or key, creating instances for each DOM target. */
116
- launch: l,
117
- /** Effector effect that opens an experience's existing instances, or launches it with `initialiseOpen` if none exist. */
118
- open: p,
119
- /** Derived store containing all registered experiences as an array. */
120
- listStore: s
121
- };
42
+ var le = j(({ client: e }) => {
43
+ let t = N.store({}), n = T(t, { register(e, t) {
44
+ return {
45
+ ...e,
46
+ [t.id]: t
47
+ };
48
+ } });
49
+ function r(r) {
50
+ let i = t.getState()[r.id];
51
+ if (i) {
52
+ i.merge({
53
+ experience: r,
54
+ strategy: "override"
55
+ });
56
+ return;
57
+ }
58
+ let a = ce({
59
+ client: e,
60
+ experience: r
61
+ });
62
+ n.register(a);
63
+ }
64
+ let i = t.map((e) => Object.values(e));
65
+ function a(e) {
66
+ return t.map((t) => t[e], { skipVoid: !1 });
67
+ }
68
+ let o = C({
69
+ source: t,
70
+ effect: async (t, { id: n, options: r }) => {
71
+ let i = t[n];
72
+ if (!i) {
73
+ `${n}`;
74
+ return;
75
+ }
76
+ if (r?.bypassCondition) {
77
+ P(e, i, r);
78
+ return;
79
+ }
80
+ await I(e, i) && P(e, i, r);
81
+ }
82
+ });
83
+ return {
84
+ register: r,
85
+ get: a,
86
+ getById: a,
87
+ launch: o,
88
+ open: C({
89
+ source: e.experienceInstances.listStore,
90
+ effect: (e, { id: t, options: n }) => {
91
+ let r = e.filter((e) => e.experienceId === t);
92
+ if (r.length > 0) for (let e of r) e.open();
93
+ else o({
94
+ id: t,
95
+ options: {
96
+ ...n,
97
+ initialiseOpen: !0
98
+ }
99
+ });
100
+ }
101
+ }),
102
+ listStore: i
103
+ };
122
104
  });
123
- function ke(t) {
124
- return b(Se, t);
105
+ function ue(e) {
106
+ return M(le, e);
125
107
  }
126
- const be = (t, e) => {
127
- e.register(t);
128
- }, N = (t, e, r) => {
129
- const { targetSelectors: n } = e.configStore.getState(), i = Z(n, e.id);
130
- i.forEach(
131
- ({ elements: s }) => s.forEach((o) => ne(o, e.id))
132
- ), se(i, e.id).forEach((s) => {
133
- r ? t.experienceInstances.spawn(e, s, r) : t.experienceInstances.spawn(e, s);
134
- });
135
- }, K = async (t) => {
136
- await Promise.all(
137
- t.experiences.listStore.getState().map(async (e) => {
138
- await ee(t, e) && N(t, e);
139
- })
140
- );
141
- }, ee = async (t, e) => {
142
- if (!t.preconditionPassed || !t.session?.isUser)
143
- return !1;
144
- const { decisionLogic: r, targetSelectors: n } = e.configStore.getState();
145
- return Z(n, e.id).length < 1 || n.length === 0 ? !1 : r === void 0 ? !0 : ie(r) ? await _(t, r) === !0 : !0;
146
- }, we = (t, e, r) => {
147
- const n = e.name, i = e.setup(t);
148
- if (i) {
149
- const u = r[n] ?? {};
150
- r[n] = Object.freeze({ ...u, ...i });
151
- }
152
- }, Ie = j("component"), ve = k(
153
- ({ client: t, component: e, name: r }) => {
154
- const n = t.frameworks.getByName(e.frameworkName);
155
- return {
156
- name: r,
157
- component: e,
158
- frameworkStore: n
159
- };
160
- }
161
- );
162
- function Fe(t) {
163
- return b(ve, t);
108
+ var de = (e, t) => {
109
+ t.register(e);
110
+ }, P = (e, t, n) => {
111
+ let { targetSelectors: r } = t.configStore.getState(), i = v(r, t.id);
112
+ i.forEach(({ elements: e }) => e.forEach((e) => ee(e, t.id))), te(i, t.id).forEach((r) => {
113
+ n ? e.experienceInstances.spawn(t, r, n) : e.experienceInstances.spawn(t, r);
114
+ });
115
+ }, F = async (e) => {
116
+ await Promise.all(e.experiences.listStore.getState().map(async (t) => {
117
+ await I(e, t) && P(e, t);
118
+ }));
119
+ }, I = async (n, r) => {
120
+ if (!n.preconditionPassed || !n.session?.isUser) return !1;
121
+ let { decisionLogic: i, targetSelectors: a } = r.configStore.getState();
122
+ return v(a, r.id).length < 1 || a.length === 0 ? !1 : i === void 0 ? !0 : e(i) ? await t(n, i) === !0 : !0;
123
+ }, L = (e, t, n) => {
124
+ let r = t.name, i = t.setup(e);
125
+ if (i) {
126
+ let e = n[r] ?? {};
127
+ n[r] = Object.freeze({
128
+ ...e,
129
+ ...i
130
+ });
131
+ }
132
+ }, R = E("component"), z = j(({ client: e, component: t, name: n }) => ({
133
+ name: n,
134
+ component: t,
135
+ frameworkStore: e.frameworks.getByName(t.frameworkName)
136
+ }));
137
+ function B(e) {
138
+ return M(z, e);
164
139
  }
165
- const je = k(({ client: t }) => {
166
- const e = Ie.store({}), r = w(e, {
167
- register(s, o) {
168
- return {
169
- ...s,
170
- [o.name]: o
171
- };
172
- }
173
- });
174
- function n(s, o) {
175
- e.getState()[s] && F(
176
- "warn",
177
- `Component '${s}' already registered. Registering again will override the previous registration.`
178
- );
179
- const p = Fe({ client: t, name: s, component: o });
180
- r.register(p);
181
- }
182
- const i = e.map((s) => Object.values(s));
183
- function u(s) {
184
- return e.map((o) => o[s], { skipVoid: !1 });
185
- }
186
- return {
187
- register: n,
188
- getByName: u,
189
- listStore: i
190
- };
140
+ var V = j(({ client: e }) => {
141
+ let t = R.store({}), n = T(t, { register(e, t) {
142
+ return {
143
+ ...e,
144
+ [t.name]: t
145
+ };
146
+ } });
147
+ function r(r, i) {
148
+ t.getState()[r] && `${r}`;
149
+ let a = B({
150
+ client: e,
151
+ name: r,
152
+ component: i
153
+ });
154
+ n.register(a);
155
+ }
156
+ let i = t.map((e) => Object.values(e));
157
+ function a(e) {
158
+ return t.map((t) => t[e], { skipVoid: !1 });
159
+ }
160
+ return {
161
+ register: r,
162
+ getByName: a,
163
+ listStore: i
164
+ };
191
165
  });
192
- function Ee(t) {
193
- return b(je, t);
166
+ function H(e) {
167
+ return M(V, e);
194
168
  }
195
- const W = (t, e, r) => {
196
- r.register(t, e);
197
- }, xe = j("framework"), Pe = k(({ client: t }) => {
198
- const e = xe.store({}), r = w(e, {
199
- register(s, o) {
200
- return {
201
- ...s,
202
- [o.name]: o.framework
203
- };
204
- }
205
- });
206
- function n(s, o) {
207
- e.getState()[s] && F(
208
- "warn",
209
- `Framework '${s}' already registered. Registering again will override the previous registration.`
210
- ), r.register({ name: s, framework: o });
211
- }
212
- const i = e.map((s) => Object.values(s));
213
- function u(s) {
214
- return e.map((o) => o[s], { skipVoid: !1 });
215
- }
216
- return {
217
- register: n,
218
- getByName: u,
219
- listStore: i
220
- };
169
+ var U = (e, t, n) => {
170
+ n.register(e, t);
171
+ }, fe = E("framework"), pe = j(({ client: e }) => {
172
+ let t = fe.store({}), n = T(t, { register(e, t) {
173
+ return {
174
+ ...e,
175
+ [t.name]: t.framework
176
+ };
177
+ } });
178
+ function r(e, r) {
179
+ t.getState()[e] && `${e}`, n.register({
180
+ name: e,
181
+ framework: r
182
+ });
183
+ }
184
+ let i = t.map((e) => Object.values(e));
185
+ function a(e) {
186
+ return t.map((t) => t[e], { skipVoid: !1 });
187
+ }
188
+ return {
189
+ register: r,
190
+ getByName: a,
191
+ listStore: i
192
+ };
221
193
  });
222
- function Ae(t) {
223
- return b(Pe, t);
194
+ function me(e) {
195
+ return M(pe, e);
224
196
  }
225
- const Be = (t, e) => {
226
- e.register(t.name, t);
227
- }, $e = 6e3, ze = z("last_ping", "global"), Ce = async (t) => {
228
- try {
229
- const e = Date.now(), r = R.get(ze);
230
- let n = 0;
231
- if (r.isSet() && (n = r.json() ?? 0), n && e - n < $e)
232
- return !0;
233
- const i = {
234
- projectId: t.projectId,
235
- path: window.location.pathname
236
- }, u = {}, o = document.getElementById("picked_script")?.dataset.verceltoken;
237
- o && (u["x-vercel-protection-bypass"] = o);
238
- const p = (await ce(t.apiUrl, "ping", i, u)).ok;
239
- return p && r.set(e), p;
240
- } catch (e) {
241
- return F("error", e), !1;
242
- }
197
+ var he = (e, t) => {
198
+ t.register(e.name, e);
199
+ }, ge = 6e3, _e = S("last_ping", "global"), ve = async (e) => {
200
+ try {
201
+ let t = Date.now(), n = b.get(_e), r = 0;
202
+ if (n.isSet() && (r = n.json() ?? 0), r && t - r < ge) return !0;
203
+ let i = {
204
+ projectId: e.projectId,
205
+ path: window.location.pathname
206
+ }, a = {}, o = document.getElementById("picked_script")?.dataset.verceltoken;
207
+ o && (a["x-vercel-protection-bypass"] = o);
208
+ let s = (await ie(e.apiUrl, "ping", i, a)).ok;
209
+ return s && n.set(t), s;
210
+ } catch {
211
+ return !1;
212
+ }
243
213
  };
244
- function te(t) {
245
- const e = typeof window < "u", r = {
246
- client: t,
247
- responses: t.responses.listStore.getState(),
248
- fields: t.fields.listStore.getState(),
249
- location: e ? window.location : void 0,
250
- document: e ? window.document : void 0,
251
- sessionStorage: e ? window.sessionStorage : void 0,
252
- localStorage: e ? window.localStorage : void 0
253
- };
254
- return Object.freeze(r);
214
+ //#endregion
215
+ //#region src/utils/state-snaphot.ts
216
+ function W(e) {
217
+ let t = typeof window < "u", n = {
218
+ client: e,
219
+ responses: e.responses.listStore.getState(),
220
+ fields: e.fields.listStore.getState(),
221
+ location: t ? window.location : void 0,
222
+ document: t ? window.document : void 0,
223
+ sessionStorage: t ? window.sessionStorage : void 0,
224
+ localStorage: t ? window.localStorage : void 0
225
+ };
226
+ return Object.freeze(n);
255
227
  }
256
- const Oe = j("predicate"), Re = k(({ client: t }) => {
257
- const e = Oe.store({}), r = w(e, {
258
- register(o, l) {
259
- return {
260
- ...o,
261
- [l.name]: {
262
- name: l.name,
263
- predicate: l.predicate
264
- }
265
- };
266
- }
267
- });
268
- function n(o, l) {
269
- e.getState()[o] && F(
270
- "warn",
271
- `Predicate '${o}' already registered. Registering again will override the previous registration.`
272
- ), r.register(Object.freeze({ name: o, predicate: l }));
273
- }
274
- const i = e.map((o) => Object.values(o));
275
- function u(o) {
276
- return e.map((l) => l[o]?.predicate, { skipVoid: !1 });
277
- }
278
- function s(o) {
279
- const l = L(() => {
280
- }, {
281
- skipVoid: !1
282
- }), p = C(async () => {
283
- const f = u(o).getState();
284
- if (!f)
285
- return;
286
- const h = te(t);
287
- return (...S) => f({ ...h, args: S });
288
- });
289
- return v({
290
- source: { responses: t.responses.listStore, fields: t.fields.listStore },
291
- target: p
292
- }), v({
293
- clock: p.doneData,
294
- filter: (f) => f !== void 0,
295
- target: l
296
- }), p(), l;
297
- }
298
- return {
299
- register: n,
300
- getByName: u,
301
- listStore: i,
302
- getEvokablePredicate: s
303
- };
228
+ //#endregion
229
+ //#region src/entities/predicate/predicate.ts
230
+ var ye = E("predicate"), be = j(({ client: e }) => {
231
+ let t = ye.store({}), n = T(t, { register(e, t) {
232
+ return {
233
+ ...e,
234
+ [t.name]: {
235
+ name: t.name,
236
+ predicate: t.predicate
237
+ }
238
+ };
239
+ } });
240
+ function r(e, r) {
241
+ t.getState()[e] && `${e}`, n.register(Object.freeze({
242
+ name: e,
243
+ predicate: r
244
+ }));
245
+ }
246
+ let i = t.map((e) => Object.values(e));
247
+ function a(e) {
248
+ return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
249
+ }
250
+ function o(t) {
251
+ let n = k(() => void 0, { skipVoid: !1 }), r = D(async () => {
252
+ let n = a(t).getState();
253
+ if (!n) return;
254
+ let r = W(e);
255
+ return (...e) => n({
256
+ ...r,
257
+ args: e
258
+ });
259
+ });
260
+ return A({
261
+ source: {
262
+ responses: e.responses.listStore,
263
+ fields: e.fields.listStore
264
+ },
265
+ target: r
266
+ }), A({
267
+ clock: r.doneData,
268
+ filter: (e) => e !== void 0,
269
+ target: n
270
+ }), r(), n;
271
+ }
272
+ return {
273
+ register: r,
274
+ getByName: a,
275
+ listStore: i,
276
+ getEvokablePredicate: o
277
+ };
304
278
  });
305
- function Me(t) {
306
- return b(Re, t);
279
+ function xe(e) {
280
+ return M(be, e);
307
281
  }
308
- const Ve = (t, e, r) => {
309
- r.register(t, e);
310
- }, Y = j("feature"), De = k(({ client: t }) => {
311
- const e = Y.store({}), r = Y.store([]), n = w(e, {
312
- register(g, a) {
313
- return {
314
- ...g,
315
- [a.id]: a.feature
316
- };
317
- }
318
- });
319
- function i(g, a) {
320
- e.getState()[g] && F(
321
- "warn",
322
- `Feature '${g}' already registered. Registering again will override the previous registration.`
323
- );
324
- const d = {
325
- id: g,
326
- feature: {
327
- ...a,
328
- id: g
329
- }
330
- };
331
- n.register(
332
- Object.freeze({
333
- id: g,
334
- feature: d
335
- })
336
- );
337
- }
338
- const u = C(
339
- async ({
340
- id: g,
341
- key: a,
342
- storage: c = "local"
343
- }) => {
344
- const d = z(`feature:${g}:${a}`, "global"), y = (c === "session" ? M : R).get(d).boolean();
345
- return y === null ? null : { id: g, key: a, bucket: y, storage: c };
346
- }
347
- ), s = C((g) => {
348
- if (!g)
349
- return null;
350
- const a = z(`feature:${g.id}:${g.key}`, "global");
351
- (g.storage === "session" ? M : R).set(a, g.bucket);
352
- }), o = /* @__PURE__ */ new Map(), l = V({
353
- source: { allFeaturesStore: e, resolvedFeaturesStore: r },
354
- effect: async ({ allFeaturesStore: g, resolvedFeaturesStore: a }, { id: c, decide: d, key: m }) => {
355
- const y = a.find(
356
- (P) => P.id === c && P.key === m
357
- );
358
- if (y)
359
- return y;
360
- const I = g[c];
361
- if (!I)
362
- throw new Error(`Feature with id '${c}' not found`);
363
- const E = o.get(`${c}:${m}`);
364
- if (E !== void 0) {
365
- const P = await E;
366
- return { id: I.id, bucket: P, key: m, storage: I.feature.storage };
367
- }
368
- const x = d();
369
- o.set(`${c}:${m}`, x);
370
- const B = await x;
371
- return { id: I.id, bucket: B, key: m, storage: I.feature.storage };
372
- }
373
- });
374
- v({
375
- clock: n.register,
376
- fn: (g) => {
377
- const { id: a, feature: c } = g;
378
- return { id: a, key: c.feature.key, storage: c.feature.storage };
379
- },
380
- target: u
381
- }), v({
382
- source: e,
383
- clock: l.doneData,
384
- fn: (g, a) => {
385
- const { id: c, bucket: d, storage: m } = a, y = g[c]?.feature.key;
386
- return y ? { key: y, id: c, bucket: d, storage: m } : null;
387
- },
388
- target: s
389
- });
390
- const p = A({ allFeaturesStore: e, resolvedFeaturesStore: r }).map(
391
- ({
392
- allFeaturesStore: g,
393
- resolvedFeaturesStore: a
394
- }) => Object.values(g).map((c) => {
395
- const d = a.find(
396
- (m) => m.id === c.id && m.key === c.feature.key
397
- );
398
- return d ? {
399
- id: c.id,
400
- name: c.feature.name,
401
- key: c.feature.key,
402
- getBucket: () => ({ id: c.id, bucket: d.bucket }),
403
- isResolved: !0
404
- } : {
405
- id: c.id,
406
- name: c.feature.name,
407
- key: c.feature.key,
408
- getBucket: async () => await l(c.feature),
409
- isResolved: !1
410
- };
411
- })
412
- );
413
- v({
414
- clock: l.doneData,
415
- source: { resolvedFeatures: r },
416
- filter: ({ resolvedFeatures: g }, { id: a, key: c }) => !g.some(
417
- (m) => m.id === a && m.key === c
418
- ),
419
- fn: (g, a) => a,
420
- target: t.eventBus.prepend((g) => ({
421
- type: "feature_decide",
422
- feature: g
423
- }))
424
- }), v({
425
- clock: [u.doneData, l.doneData],
426
- source: r,
427
- fn: (g, a) => !a || g.some(
428
- (d) => d.id === a.id && d.key === a.key
429
- ) ? g : [...g, a],
430
- target: r
431
- });
432
- function f(g) {
433
- return p.map((a) => a.find((c) => c.id === g));
434
- }
435
- function h(g) {
436
- return e.map((a) => a[g], { skipVoid: !1 });
437
- }
438
- function S(g) {
439
- const a = L(
440
- async () => {
441
- },
442
- { skipVoid: !1 }
443
- ), c = C(async () => {
444
- const d = f(g).getState();
445
- if (d)
446
- return async () => (await d.getBucket()).bucket;
447
- });
448
- return v({
449
- source: r,
450
- filter: (d) => d.some((m) => m.id === g),
451
- target: c
452
- }), v({
453
- clock: c.doneData,
454
- filter: (d) => d !== void 0,
455
- target: a
456
- }), c(), a;
457
- }
458
- return {
459
- register: i,
460
- getById: f,
461
- getByName: h,
462
- listStore: p,
463
- getEvokableFeature: S
464
- };
282
+ var Se = (e, t, n) => {
283
+ n.register(e, t);
284
+ }, G = E("feature"), Ce = j(({ client: e }) => {
285
+ let t = G.store({}), n = G.store([]), r = T(t, { register(e, t) {
286
+ return {
287
+ ...e,
288
+ [t.id]: t.feature
289
+ };
290
+ } });
291
+ function i(e, n) {
292
+ t.getState()[e] && `${e}`;
293
+ let i = {
294
+ id: e,
295
+ feature: {
296
+ ...n,
297
+ id: e
298
+ }
299
+ };
300
+ r.register(Object.freeze({
301
+ id: e,
302
+ feature: i
303
+ }));
304
+ }
305
+ let a = D(async ({ id: e, key: t, storage: n = "local" }) => {
306
+ let r = S(`feature:${e}:${t}`, "global"), i = (n === "session" ? x : b).get(r).boolean();
307
+ return i === null ? null : {
308
+ id: e,
309
+ key: t,
310
+ bucket: i,
311
+ storage: n
312
+ };
313
+ }), o = D((e) => {
314
+ if (!e) return null;
315
+ let t = S(`feature:${e.id}:${e.key}`, "global");
316
+ (e.storage === "session" ? x : b).set(t, e.bucket);
317
+ }), s = /* @__PURE__ */ new Map(), c = C({
318
+ source: {
319
+ allFeaturesStore: t,
320
+ resolvedFeaturesStore: n
321
+ },
322
+ effect: async ({ allFeaturesStore: e, resolvedFeaturesStore: t }, { id: n, decide: r, key: i }) => {
323
+ let a = t.find((e) => e.id === n && e.key === i);
324
+ if (a) return a;
325
+ let o = e[n];
326
+ if (!o) throw Error(`Feature with id '${n}' not found`);
327
+ let c = s.get(`${n}:${i}`);
328
+ if (c !== void 0) {
329
+ let e = await c;
330
+ return {
331
+ id: o.id,
332
+ bucket: e,
333
+ key: i,
334
+ storage: o.feature.storage
335
+ };
336
+ }
337
+ let l = r();
338
+ s.set(`${n}:${i}`, l);
339
+ let u = await l;
340
+ return {
341
+ id: o.id,
342
+ bucket: u,
343
+ key: i,
344
+ storage: o.feature.storage
345
+ };
346
+ }
347
+ });
348
+ A({
349
+ clock: r.register,
350
+ fn: (e) => {
351
+ let { id: t, feature: n } = e;
352
+ return {
353
+ id: t,
354
+ key: n.feature.key,
355
+ storage: n.feature.storage
356
+ };
357
+ },
358
+ target: a
359
+ }), A({
360
+ source: t,
361
+ clock: c.doneData,
362
+ fn: (e, t) => {
363
+ let { id: n, bucket: r, storage: i } = t, a = e[n]?.feature.key;
364
+ return a ? {
365
+ key: a,
366
+ id: n,
367
+ bucket: r,
368
+ storage: i
369
+ } : null;
370
+ },
371
+ target: o
372
+ });
373
+ let l = w({
374
+ allFeaturesStore: t,
375
+ resolvedFeaturesStore: n
376
+ }).map(({ allFeaturesStore: e, resolvedFeaturesStore: t }) => Object.values(e).map((e) => {
377
+ let n = t.find((t) => t.id === e.id && t.key === e.feature.key);
378
+ return n ? {
379
+ id: e.id,
380
+ name: e.feature.name,
381
+ key: e.feature.key,
382
+ getBucket: () => ({
383
+ id: e.id,
384
+ bucket: n.bucket
385
+ }),
386
+ isResolved: !0
387
+ } : {
388
+ id: e.id,
389
+ name: e.feature.name,
390
+ key: e.feature.key,
391
+ getBucket: async () => await c(e.feature),
392
+ isResolved: !1
393
+ };
394
+ }));
395
+ A({
396
+ clock: c.doneData,
397
+ source: { resolvedFeatures: n },
398
+ filter: ({ resolvedFeatures: e }, { id: t, key: n }) => !e.some((e) => e.id === t && e.key === n),
399
+ fn: (e, t) => t,
400
+ target: e.eventBus.prepend((e) => ({
401
+ type: "feature_decide",
402
+ feature: e
403
+ }))
404
+ }), A({
405
+ clock: [a.doneData, c.doneData],
406
+ source: n,
407
+ fn: (e, t) => !t || e.some((e) => e.id === t.id && e.key === t.key) ? e : [...e, t],
408
+ target: n
409
+ });
410
+ function u(e) {
411
+ return l.map((t) => t.find((t) => t.id === e));
412
+ }
413
+ function d(e) {
414
+ return t.map((t) => t[e], { skipVoid: !1 });
415
+ }
416
+ function f(e) {
417
+ let t = k(async () => void 0, { skipVoid: !1 }), r = D(async () => {
418
+ let t = u(e).getState();
419
+ if (t) return async () => (await t.getBucket()).bucket;
420
+ });
421
+ return A({
422
+ source: n,
423
+ filter: (t) => t.some((t) => t.id === e),
424
+ target: r
425
+ }), A({
426
+ clock: r.doneData,
427
+ filter: (e) => e !== void 0,
428
+ target: t
429
+ }), r(), t;
430
+ }
431
+ return {
432
+ register: i,
433
+ getById: u,
434
+ getByName: d,
435
+ listStore: l,
436
+ getEvokableFeature: f
437
+ };
465
438
  });
466
- function Ue(t) {
467
- return b(De, t);
468
- }
469
- const Ne = (t, e, r) => {
470
- r.register(t, e);
471
- }, $ = j("history");
472
- function Q(t, e) {
473
- return {
474
- // eslint-disable-next-line sonarjs/pseudo-random
475
- id: le(`history-entry-${Date.now()}-${Math.random()}}`),
476
- node: e,
477
- at: Date.now(),
478
- experienceId: t
479
- };
439
+ function we(e) {
440
+ return M(Ce, e);
480
441
  }
481
- const Te = k(() => {
482
- const t = $.store({ entries: [] }), e = $.event(), r = $.event(), n = $.event(), i = $.event();
483
- t.on(e, (s, o) => ({
484
- entries: [...s.entries, Q(o.experienceId, o.node)]
485
- })), t.on(r, (s, o) => ({
486
- entries: [
487
- ...s.entries.slice(0, -1),
488
- Q(o.experienceId, o.node)
489
- ]
490
- })), t.on(i, (s, o) => o);
491
- function u(s, o) {
492
- const l = { lastStepIndex: -1, secondLastStepIndex: -1 };
493
- for (let p = s.length - 1; p >= 0; p--) {
494
- const f = s[p], h = f?.node;
495
- if (!(!h || !de(h)) && !(o && f?.experienceId !== o))
496
- if (l.lastStepIndex === -1)
497
- l.lastStepIndex = p;
498
- else {
499
- l.secondLastStepIndex = p;
500
- break;
501
- }
502
- }
503
- return l;
504
- }
505
- return t.on(n, (s, o) => {
506
- const { secondLastStepIndex: l } = u(s.entries, o.experienceId), p = l !== -1 ? s.entries.slice(0, l + 1) : s.entries;
507
- return {
508
- ...s,
509
- entries: p
510
- };
511
- }), {
512
- push: e,
513
- replace: r,
514
- back: n,
515
- restore: i,
516
- entriesStore: t.map((s) => s.entries)
517
- };
518
- });
519
- function Le() {
520
- return b(Te);
442
+ var Te = (e, t, n) => {
443
+ n.register(e, t);
444
+ }, K = E("history");
445
+ function q(e, t) {
446
+ return {
447
+ id: oe(`history-entry-${Date.now()}-${Math.random()}}`),
448
+ node: t,
449
+ at: Date.now(),
450
+ experienceId: e
451
+ };
521
452
  }
522
- let _e = 0;
523
- const He = (t) => {
524
- const e = L([]);
525
- return v({
526
- clock: t,
527
- source: e,
528
- fn: (r, n) => [
529
- ...r,
530
- {
531
- id: _e++,
532
- at: /* @__PURE__ */ new Date(),
533
- payload: n
534
- }
535
- ],
536
- target: e
537
- }), e;
538
- }, Ge = j("field"), Je = k(() => {
539
- const t = Ge.store({}), e = w(t, {
540
- register(l, p) {
541
- return {
542
- ...l,
543
- [p.field.id]: p.field
544
- };
545
- }
546
- });
547
- function r(l) {
548
- e.register({ field: l });
549
- }
550
- function n(l, p) {
551
- const f = t.getState()[l] ?? null;
552
- if (!f)
553
- return;
554
- const h = Object.assign({}, f, {
555
- ...p
556
- });
557
- e.register({ field: { ...h } });
558
- }
559
- const i = t.map((l) => Object.values(l));
560
- function u(l) {
561
- return t.map((p) => p[l] ?? null);
562
- }
563
- function s(l) {
564
- return t.map((p) => Object.values(p).find((f) => f.key === l) ?? null);
565
- }
566
- function o(l) {
567
- return t.map((p) => Object.values(p).find((f) => f.name === l) ?? null);
568
- }
569
- return {
570
- register: r,
571
- update: n,
572
- // eslint-disable-next-line sonarjs/deprecation -- returned for backwards compatibility; callers should use getByKey
573
- getById: u,
574
- getByKey: s,
575
- listStore: i,
576
- getByName: o
577
- };
453
+ var Ee = j(() => {
454
+ let e = K.store({ entries: [] }), t = K.event(), n = K.event(), r = K.event(), i = K.event();
455
+ e.on(t, (e, t) => ({ entries: [...e.entries, q(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), q(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
456
+ function a(e, t) {
457
+ let n = {
458
+ lastStepIndex: -1,
459
+ secondLastStepIndex: -1
460
+ };
461
+ for (let r = e.length - 1; r >= 0; r--) {
462
+ let i = e[r], a = i?.node;
463
+ if (!(!a || !y(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
464
+ else {
465
+ n.secondLastStepIndex = r;
466
+ break;
467
+ }
468
+ }
469
+ return n;
470
+ }
471
+ return e.on(r, (e, t) => {
472
+ let { secondLastStepIndex: n } = a(e.entries, t.experienceId), r = n === -1 ? e.entries : e.entries.slice(0, n + 1);
473
+ return {
474
+ ...e,
475
+ entries: r
476
+ };
477
+ }), {
478
+ push: t,
479
+ replace: n,
480
+ back: r,
481
+ restore: i,
482
+ entriesStore: e.map((e) => e.entries)
483
+ };
578
484
  });
579
- function qe() {
580
- return b(Je);
485
+ function J() {
486
+ return M(Ee);
581
487
  }
582
- const Ke = (t, e) => {
583
- e.register(t);
584
- }, We = j("step"), Ye = k(() => {
585
- const t = We.store({}), e = w(t, {
586
- register(u, s) {
587
- return {
588
- ...u,
589
- [s.step.id]: s.step
590
- };
591
- }
592
- });
593
- function r(u) {
594
- e.register({ step: u });
595
- }
596
- const n = t.map((u) => Object.values(u));
597
- function i(u) {
598
- return t.map((s) => s[u] ?? null);
599
- }
600
- return {
601
- register: r,
602
- getById: i,
603
- listStore: n
604
- };
488
+ //#endregion
489
+ //#region src/utils/events.ts
490
+ var De = 0, Oe = (e) => {
491
+ let t = k([]);
492
+ return A({
493
+ clock: e,
494
+ source: t,
495
+ fn: (e, t) => [...e, {
496
+ id: De++,
497
+ at: /* @__PURE__ */ new Date(),
498
+ payload: t
499
+ }],
500
+ target: t
501
+ }), t;
502
+ }, ke = E("field"), Ae = j(() => {
503
+ let e = ke.store({}), t = T(e, {
504
+ register(e, t) {
505
+ return {
506
+ ...e,
507
+ [t.field.id]: t.field
508
+ };
509
+ },
510
+ updateById(e, t) {
511
+ let n = e[t.fieldId];
512
+ return n ? {
513
+ ...e,
514
+ [t.fieldId]: Object.assign({}, n, t.updates)
515
+ } : e;
516
+ }
517
+ });
518
+ function n(e) {
519
+ t.register({ field: e });
520
+ }
521
+ function r(e, n) {
522
+ t.updateById({
523
+ fieldId: e,
524
+ updates: n
525
+ });
526
+ }
527
+ let i = e.map((e) => Object.values(e));
528
+ function a(t) {
529
+ return e.map((e) => e[t] || null);
530
+ }
531
+ function o(t) {
532
+ return e.map((e) => Object.values(e).find((e) => e.name === t) || null);
533
+ }
534
+ return {
535
+ register: n,
536
+ update: r,
537
+ getById: a,
538
+ listStore: i,
539
+ getByName: o
540
+ };
605
541
  });
606
- function Qe() {
607
- return b(Ye);
542
+ function je() {
543
+ return M(Ae);
608
544
  }
609
- function Xe(t, e) {
610
- e.register(t);
611
- }
612
- const Ze = j("action"), et = k(() => {
613
- const t = Ze.store({}), e = w(t, {
614
- register(s, o) {
615
- return {
616
- ...s,
617
- [o.name]: {
618
- name: o.name,
619
- action: o.action
620
- }
621
- };
622
- }
623
- });
624
- function r(s, o) {
625
- e.register({ name: s, action: o });
626
- }
627
- const n = t.map((s) => Object.values(s));
628
- function i(s) {
629
- return t.map((o) => o[s], { skipVoid: !1 });
630
- }
631
- function u(s) {
632
- return t.map(
633
- (o) => {
634
- const l = o[s];
635
- return l ? l.action : void 0;
636
- },
637
- { skipVoid: !1 }
638
- );
639
- }
640
- return {
641
- register: r,
642
- getByName: i,
643
- listStore: n,
644
- getEvokableAction: u
645
- };
545
+ var Me = (e, t) => {
546
+ t.register(e);
547
+ }, Ne = E("action"), Pe = j(() => {
548
+ let e = Ne.store({}), t = T(e, { register(e, t) {
549
+ return {
550
+ ...e,
551
+ [t.name]: {
552
+ name: t.name,
553
+ action: t.action
554
+ }
555
+ };
556
+ } });
557
+ function n(e, n) {
558
+ t.register({
559
+ name: e,
560
+ action: n
561
+ });
562
+ }
563
+ let r = e.map((e) => Object.values(e));
564
+ function i(t) {
565
+ return e.map((e) => e[t], { skipVoid: !1 });
566
+ }
567
+ function a(t) {
568
+ return e.map((e) => {
569
+ let n = e[t];
570
+ return n ? n.action : void 0;
571
+ }, { skipVoid: !1 });
572
+ }
573
+ return {
574
+ register: n,
575
+ getByName: i,
576
+ listStore: r,
577
+ getEvokableAction: a
578
+ };
646
579
  });
647
- function tt() {
648
- return b(et);
580
+ function Fe() {
581
+ return M(Pe);
649
582
  }
650
- const rt = (t, e, r) => {
651
- r.register(t, e);
583
+ var Ie = (e, t, n) => {
584
+ n.register(e, t);
652
585
  };
653
- function T(t) {
654
- return typeof t > "u" || t === null || t === "" || Array.isArray(t) && !t.length;
655
- }
656
- function nt(t) {
657
- return typeof t == "string" || typeof t == "number" || typeof t == "boolean" || t === null;
658
- }
659
- function X(t) {
660
- try {
661
- return JSON.stringify(t), !0;
662
- } catch {
663
- return !1;
664
- }
665
- }
666
- function st(t, e) {
667
- return e.find((r) => r.id === t) ?? e.find((r) => r.key === t) ?? null;
586
+ //#endregion
587
+ //#region src/entities/response/response.ts
588
+ function Y(e) {
589
+ return e == null || e === "" || Array.isArray(e) && !e.length;
668
590
  }
669
- function it(t, e) {
670
- return t.multiple && (typeof e == "string" || typeof e == "number" || typeof e == "boolean") ? [e] : e;
591
+ function Le(e) {
592
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
671
593
  }
672
- function ot(t, e, r) {
673
- if (t.type !== "object" || T(r)) return null;
674
- if (t.multiple) {
675
- if (!Array.isArray(r))
676
- return {
677
- fieldId: e,
678
- userMessage: "This field expects multiple values",
679
- systemMessage: "Field expects an array of objects.",
680
- value: r
681
- };
682
- for (const n of r) {
683
- if (typeof n != "object" || n === null)
684
- return {
685
- fieldId: e,
686
- userMessage: "This field expects object values",
687
- systemMessage: "Field expects an array of objects, but received non-object value.",
688
- value: r
689
- };
690
- if (!X(n))
691
- return {
692
- fieldId: e,
693
- userMessage: "This field contains non-serializable data",
694
- systemMessage: "Field value contains non-JSON-serializable data (functions, circular references, etc.).",
695
- value: r
696
- };
697
- }
698
- return null;
699
- }
700
- return Array.isArray(r) ? {
701
- fieldId: e,
702
- userMessage: "This field expects a single value",
703
- systemMessage: "Field expects a single object, not an array.",
704
- value: r
705
- } : typeof r != "object" || r === null ? {
706
- fieldId: e,
707
- userMessage: "This field expects an object value",
708
- systemMessage: "Field expects an object value.",
709
- value: r
710
- } : X(r) ? null : {
711
- fieldId: e,
712
- userMessage: "This field contains non-serializable data",
713
- systemMessage: "Field value contains non-JSON-serializable data (functions, circular references, etc.).",
714
- value: r
715
- };
594
+ function X(e) {
595
+ try {
596
+ return JSON.stringify(e), !0;
597
+ } catch {
598
+ return !1;
599
+ }
716
600
  }
717
- function at(t, e, r) {
718
- if (!Array.isArray(t.options) || t.options.length === 0) return null;
719
- const n = Array.isArray(r) ? r : [r];
720
- if (t.type === "object") {
721
- const s = t.options.map((l) => JSON.stringify(l.value));
722
- return n.every((l) => s.includes(JSON.stringify(l))) ? null : {
723
- fieldId: e,
724
- userMessage: "This field expects a valid option",
725
- systemMessage: "Field expects a valid option from the defined choices.",
726
- value: r
727
- };
728
- }
729
- const i = t.options.map((s) => s.value);
730
- return n.every((s) => !nt(s) || s === null ? !1 : i.includes(s)) ? null : {
731
- fieldId: e,
732
- userMessage: "This field expects a valid option",
733
- systemMessage: `Field expects a valid option. Valid options are: ${i.join(", ")}`,
734
- value: r
735
- };
736
- }
737
- const ct = j("response"), ut = k(({ client: t }) => {
738
- const e = ct.store({}), r = D(), n = D(), i = w(e, {
739
- register(a, c) {
740
- return {
741
- ...a,
742
- [c.fieldId]: c.response
743
- };
744
- },
745
- registerBatch(a, c) {
746
- return {
747
- ...a,
748
- ...c
749
- };
750
- },
751
- clear(a, c) {
752
- return Object.fromEntries(Object.entries(a).filter(([d]) => d !== c));
753
- },
754
- clearAll() {
755
- return {};
756
- }
757
- });
758
- function u(a, c) {
759
- if (typeof a == "string") {
760
- if (c === void 0)
761
- throw new Error("Response is required when registering a single field");
762
- i.register({ fieldId: a, response: c });
763
- } else
764
- i.registerBatch(a);
765
- }
766
- async function s(a, c, d) {
767
- if (a.validation && !fe(a.validation) && !T(d)) {
768
- const m = await _(t, a.validation, { $input: d });
769
- if (typeof m == "string")
770
- return {
771
- fieldId: c,
772
- userMessage: m,
773
- systemMessage: `Field validation resulted in an error: ${m}.`,
774
- value: d
775
- };
776
- if (m === !1)
777
- return {
778
- fieldId: c,
779
- userMessage: "This field is invalid",
780
- systemMessage: "Field validation resulted in an unspecified error.",
781
- value: d
782
- };
783
- }
784
- return a.required && T(d) ? {
785
- fieldId: c,
786
- userMessage: "This field is required",
787
- systemMessage: "Field is required.",
788
- value: d
789
- } : !a.multiple && Array.isArray(d) && d.length > 1 ? {
790
- fieldId: c,
791
- userMessage: "This field expects a single response",
792
- systemMessage: "Field expects a single response.",
793
- value: d
794
- } : null;
795
- }
796
- async function o(a) {
797
- const c = [], d = {}, m = t.fields.listStore.getState();
798
- return await Promise.allSettled(
799
- Object.entries(a).map(async ([y, I]) => {
800
- const E = st(y, m);
801
- if (!E) {
802
- c.push({
803
- fieldId: y,
804
- userMessage: `Field '${y}' not found`,
805
- systemMessage: `No field with ID or key '${y}' exists. Available field IDs are: ${m.map((re) => re.id).join(",")}.`,
806
- value: I
807
- });
808
- return;
809
- }
810
- const x = E.id, B = it(E, I), P = await s(E, x, B);
811
- if (P) {
812
- c.push(P);
813
- return;
814
- }
815
- const J = ot(E, x, B);
816
- if (J) {
817
- c.push(J);
818
- return;
819
- }
820
- const q = at(E, x, B);
821
- q && c.push(q), d[x] = I;
822
- })
823
- ), { responsesToCommit: d, validationErrors: c };
824
- }
825
- async function l(a) {
826
- const { responsesToCommit: c, validationErrors: d } = await o(a);
827
- return d.length ? { errors: d } : (i.registerBatch(c), { errors: [] });
828
- }
829
- const p = e.map((a) => a), f = A(
830
- { responses: e, fields: t.fields.listStore },
831
- ({ responses: a, fields: c }) => Object.entries(a).map(([d, m]) => {
832
- const y = c.find((I) => I.id === d);
833
- return {
834
- fieldId: d,
835
- fieldKey: y?.key ?? d,
836
- value: m
837
- };
838
- })
839
- );
840
- function h(a) {
841
- const c = t.fields.listStore.map(
842
- (m) => m.find((y) => y.id === a) ?? null
843
- ), d = e.map((m) => m[a] ?? null);
844
- return A({ f: c, r: d }, ({ f: m, r: y }) => y !== null ? y : m?.defaultValue ? m.defaultValue : null);
845
- }
846
- function S(a) {
847
- const c = t.fields.getByKey(a);
848
- return A({ f: c, s: e }, ({ f: d, s: m }) => {
849
- const y = d ? m[d.id] ?? null : null;
850
- return y || (d?.defaultValue ? d.defaultValue : null);
851
- });
852
- }
853
- function g(a) {
854
- const c = t.fields.getByName(a);
855
- return A({ f: c, s: e }, ({ f: d, s: m }) => {
856
- const y = d && m[d.id] || null;
857
- return y || (d?.defaultValue ? d.defaultValue : null);
858
- });
859
- }
860
- return v({
861
- clock: r,
862
- target: i.clearAll
863
- }), v({
864
- clock: n,
865
- target: i.clear
866
- }), {
867
- register: u,
868
- clearAll: r,
869
- clear: n,
870
- commit: l,
871
- getResponsesToCommit: o,
872
- listStore: f,
873
- getAllStore: p,
874
- // eslint-disable-next-line sonarjs/deprecation -- returned for backwards compatibility; callers should use getByFieldKey
875
- getByFieldId: h,
876
- getByFieldKey: S,
877
- getByFieldName: g
878
- };
879
- });
880
- function dt(t) {
881
- return b(ut, t);
882
- }
883
- const lt = j("condition"), ft = k(() => {
884
- const t = lt.store({}), e = w(t, {
885
- register(s, o) {
886
- return {
887
- ...s,
888
- [o.condition.id]: o.condition
889
- };
890
- }
891
- });
892
- function r(s) {
893
- e.register({ condition: s });
894
- }
895
- const n = t.map((s) => Object.values(s));
896
- function i(s) {
897
- return t.map((o) => o[s] ?? null);
898
- }
899
- function u(s) {
900
- return t.map((o) => Object.values(o).find((l) => l.key === s) ?? null);
901
- }
902
- return {
903
- register: r,
904
- getById: i,
905
- getByKey: u,
906
- listStore: n
907
- };
601
+ var Re = E("response"), ze = j(({ client: e }) => {
602
+ let r = Re.store({}), i = O(), a = O(), o = T(r, {
603
+ register(e, t) {
604
+ return {
605
+ ...e,
606
+ [t.fieldId]: t.response
607
+ };
608
+ },
609
+ registerBatch(e, t) {
610
+ return {
611
+ ...e,
612
+ ...t
613
+ };
614
+ },
615
+ clear(e, t) {
616
+ let { [t]: n, ...r } = e;
617
+ return r;
618
+ },
619
+ clearAll() {
620
+ return {};
621
+ }
622
+ });
623
+ function s(e, t) {
624
+ if (typeof e == "string") {
625
+ if (t === void 0) throw Error("Response is required when registering a single field");
626
+ o.register({
627
+ fieldId: e,
628
+ response: t
629
+ });
630
+ } else o.registerBatch(e);
631
+ }
632
+ async function c(r, i) {
633
+ let a = [];
634
+ return await Promise.allSettled(Object.entries(i).map(async ([o, s]) => {
635
+ let c = s, l = e.fields.getById(o).getState();
636
+ if (!l) {
637
+ a.push({
638
+ fieldId: o,
639
+ userMessage: `Field '${o}' not found`,
640
+ systemMessage: `No field with ID '${o}' exists. Available field IDs are: ${Object.keys(e.fields.listStore.getState()).join(",")}.`,
641
+ value: c
642
+ });
643
+ return;
644
+ }
645
+ if (l.multiple && (typeof c == "string" || typeof c == "number" || typeof c == "boolean") && (c = [c]), l.validation && !n(l.validation) && !Y(c)) {
646
+ let n = {
647
+ ...r,
648
+ ...i
649
+ }, s = await t(e, l.validation, {
650
+ $input: c,
651
+ responses: n
652
+ });
653
+ if (typeof s == "string") {
654
+ a.push({
655
+ fieldId: o,
656
+ userMessage: s,
657
+ systemMessage: `Field validation resulted in an error: ${s}.`,
658
+ value: c
659
+ });
660
+ return;
661
+ }
662
+ if (s === !1) {
663
+ a.push({
664
+ fieldId: o,
665
+ userMessage: "This field is invalid",
666
+ systemMessage: "Field validation resulted in an unspecified error.",
667
+ value: c
668
+ });
669
+ return;
670
+ }
671
+ }
672
+ if (l.required && Y(c)) {
673
+ a.push({
674
+ fieldId: o,
675
+ userMessage: "This field is required",
676
+ systemMessage: "Field is required.",
677
+ value: c
678
+ });
679
+ return;
680
+ }
681
+ if (!l.multiple && Array.isArray(c) && c.length > 1) {
682
+ a.push({
683
+ fieldId: o,
684
+ userMessage: "This field expects a single response",
685
+ systemMessage: "Field expects a single response.",
686
+ value: c
687
+ });
688
+ return;
689
+ }
690
+ if (l.type === "object" && !Y(c)) if (l.multiple) {
691
+ if (!Array.isArray(c)) {
692
+ a.push({
693
+ fieldId: o,
694
+ userMessage: "This field expects multiple values",
695
+ systemMessage: "Field expects an array of objects.",
696
+ value: c
697
+ });
698
+ return;
699
+ }
700
+ for (let e of c) {
701
+ if (typeof e != "object" || !e) {
702
+ a.push({
703
+ fieldId: o,
704
+ userMessage: "This field expects object values",
705
+ systemMessage: "Field expects an array of objects, but received non-object value.",
706
+ value: c
707
+ });
708
+ return;
709
+ }
710
+ if (!X(e)) {
711
+ a.push({
712
+ fieldId: o,
713
+ userMessage: "This field contains non-serializable data",
714
+ systemMessage: "Field value contains non-JSON-serializable data (functions, circular references, etc.).",
715
+ value: c
716
+ });
717
+ return;
718
+ }
719
+ }
720
+ } else {
721
+ if (Array.isArray(c)) {
722
+ a.push({
723
+ fieldId: o,
724
+ userMessage: "This field expects a single value",
725
+ systemMessage: "Field expects a single object, not an array.",
726
+ value: c
727
+ });
728
+ return;
729
+ }
730
+ if (typeof c != "object" || !c) {
731
+ a.push({
732
+ fieldId: o,
733
+ userMessage: "This field expects an object value",
734
+ systemMessage: "Field expects an object value.",
735
+ value: c
736
+ });
737
+ return;
738
+ }
739
+ if (!X(c)) {
740
+ a.push({
741
+ fieldId: o,
742
+ userMessage: "This field contains non-serializable data",
743
+ systemMessage: "Field value contains non-JSON-serializable data (functions, circular references, etc.).",
744
+ value: c
745
+ });
746
+ return;
747
+ }
748
+ }
749
+ if (Array.isArray(l.options) && l.options.length > 0) {
750
+ let e = Array.isArray(c) ? c : [c];
751
+ if (l.type === "object") {
752
+ let t = l.options.map((e) => JSON.stringify(e.value));
753
+ e.every((e) => t.includes(JSON.stringify(e))) || a.push({
754
+ fieldId: o,
755
+ userMessage: "This field expects a valid option",
756
+ systemMessage: "Field expects a valid option from the defined choices.",
757
+ value: c
758
+ });
759
+ } else {
760
+ let t = l.options.map((e) => e.value);
761
+ e.every((e) => !Le(e) || e === null ? !1 : t.includes(e)) || a.push({
762
+ fieldId: o,
763
+ userMessage: "This field expects a valid option",
764
+ systemMessage: `Field expects a valid option. Valid options are: ${t.join(", ")}`,
765
+ value: c
766
+ });
767
+ }
768
+ }
769
+ })), {
770
+ responsesToCommit: i,
771
+ validationErrors: a
772
+ };
773
+ }
774
+ let l = C({
775
+ source: r,
776
+ effect: (e, t) => c(e, t)
777
+ });
778
+ async function u(e) {
779
+ return l(e);
780
+ }
781
+ let d = C({
782
+ source: r,
783
+ effect: async (e, t) => {
784
+ let { responsesToCommit: n, validationErrors: r } = await c(e, t);
785
+ return r.length ? { errors: r } : (o.registerBatch(n), { errors: [] });
786
+ }
787
+ });
788
+ async function f(e) {
789
+ return d(e);
790
+ }
791
+ let p = r.map((e) => e), m = r.map((e) => Object.keys(e).map((t) => ({
792
+ fieldId: t,
793
+ value: e[t]
794
+ })));
795
+ function h(t) {
796
+ return w({
797
+ f: e.fields.getById(t),
798
+ r: r.map((e) => e[t] || null)
799
+ }, ({ f: e, r: t }) => t || (e?.defaultValue ? e.defaultValue : null));
800
+ }
801
+ function g(t) {
802
+ return w({
803
+ f: e.fields.getByName(t),
804
+ s: r
805
+ }, ({ f: e, s: t }) => e && t[e.id] || (e?.defaultValue ? e.defaultValue : null));
806
+ }
807
+ return A({
808
+ clock: i,
809
+ target: o.clearAll
810
+ }), A({
811
+ clock: a,
812
+ target: o.clear
813
+ }), {
814
+ register: s,
815
+ clearAll: i,
816
+ clear: a,
817
+ commit: f,
818
+ getResponsesToCommit: u,
819
+ listStore: m,
820
+ getAllStore: p,
821
+ getByFieldId: h,
822
+ getByFieldName: g
823
+ };
908
824
  });
909
- function pt() {
910
- return b(ft);
825
+ function Be(e) {
826
+ return M(ze, e);
911
827
  }
912
- function gt() {
913
- if (H()) {
914
- const t = [
915
- document.currentScript,
916
- document.getElementById("picked_script"),
917
- document.getElementById("picked"),
918
- document.getElementById("cvly"),
919
- document.getElementById("cvly-x")
920
- ];
921
- for (const e of t)
922
- if (e?.dataset.api)
923
- return e.dataset.api;
924
- }
925
- return "https://api.picked.app";
828
+ //#endregion
829
+ //#region src/utils/api-url.ts
830
+ function Ve() {
831
+ if (f()) {
832
+ let e = [
833
+ document.currentScript,
834
+ document.getElementById("picked_script"),
835
+ document.getElementById("picked"),
836
+ document.getElementById("cvly"),
837
+ document.getElementById("cvly-x")
838
+ ];
839
+ for (let t of e) if (t?.dataset.api) return t.dataset.api;
840
+ }
841
+ return "https://api.picked.app";
926
842
  }
927
- function mt() {
928
- if (!G())
929
- return {};
930
- const t = new URLSearchParams(window.location.search), e = {}, r = /* @__PURE__ */ new Set();
931
- for (const [i] of t.entries())
932
- i.startsWith("picked-") && r.add(i);
933
- for (const i of r) {
934
- const u = i.replace("picked-", "");
935
- e[u] = t.getAll(i);
936
- }
937
- const n = z("s");
938
- if (r.size > 0)
939
- M.set(n, e);
940
- else {
941
- const i = M.get(n);
942
- if (i)
943
- return i.json() || {};
944
- }
945
- return e;
843
+ //#endregion
844
+ //#region src/utils/search-params.ts
845
+ function He() {
846
+ if (!o()) return {};
847
+ let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
848
+ for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
849
+ for (let r of n) {
850
+ let n = r.replace("picked-", "");
851
+ t[n] = e.getAll(r);
852
+ }
853
+ let r = S("s");
854
+ if (n.size > 0) x.set(r, t);
855
+ else {
856
+ let e = x.get(r);
857
+ if (e) return e.json() || {};
858
+ }
859
+ return t;
946
860
  }
947
- function yt() {
948
- if (ge())
949
- return crypto.randomUUID();
950
- const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), r = Math.random().toString(36).substring(2, 15), n = Math.random().toString(36).substring(2, 15);
951
- return `${t}-${e}-${r}-${n}`;
861
+ //#endregion
862
+ //#region src/utils/user-session.ts
863
+ function Ue() {
864
+ return l() ? 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)}`;
952
865
  }
953
- const ht = z("session", "global"), St = () => {
954
- const t = R.get(ht);
955
- let e;
956
- t.isSet() && (e = t.json());
957
- const r = (i) => t.set({
958
- id: i.id,
959
- isUser: i.isUser,
960
- identifiers: i.identifiers
961
- }), n = {
962
- id: e?.id ?? yt(),
963
- isUser: e?.isUser ?? void 0,
964
- identifiers: e?.identifiers ?? void 0,
965
- setIsUser(i) {
966
- this.isUser = i, r(this);
967
- },
968
- setIdentifier(i, u) {
969
- this.identifiers = { ...this.identifiers, [i]: u }, r(this);
970
- },
971
- removeIdentifier(i) {
972
- this.identifiers && (this.identifiers = Object.fromEntries(
973
- Object.entries(this.identifiers).filter(([u]) => u !== i)
974
- ), this.identifiers = Object.keys(this.identifiers).length ? this.identifiers : void 0, r(this));
975
- }
976
- };
977
- return r(n), n;
978
- }, kt = () => pe() ? St() : null;
979
- function bt() {
980
- if (G())
981
- return globalThis.window.pickedConfig;
866
+ var We = S("session", "global"), Ge = () => {
867
+ let e = b.get(We), t;
868
+ e.isSet() && (t = e.json());
869
+ let n = (t) => e.set({
870
+ id: t.id,
871
+ isUser: t.isUser,
872
+ identifiers: t.identifiers
873
+ }), r = {
874
+ id: t?.id ?? Ue(),
875
+ isUser: t?.isUser ?? void 0,
876
+ identifiers: t?.identifiers ?? void 0,
877
+ setIsUser(e) {
878
+ this.isUser = e, n(this);
879
+ },
880
+ setIdentifier(e, t) {
881
+ this.identifiers = {
882
+ ...this.identifiers,
883
+ [e]: t
884
+ }, n(this);
885
+ },
886
+ removeIdentifier(e) {
887
+ this.identifiers && (this.identifiers = Object.fromEntries(Object.entries(this.identifiers).filter(([t]) => t !== e)), this.identifiers = Object.keys(this.identifiers).length ? this.identifiers : void 0, n(this));
888
+ }
889
+ };
890
+ return n(r), r;
891
+ }, Ke = () => u() ? Ge() : null;
892
+ //#endregion
893
+ //#region src/utils/picked-config.ts
894
+ function Z() {
895
+ if (o()) return globalThis.window.pickedConfig;
982
896
  }
983
- function wt() {
984
- if (!G())
985
- return;
986
- const t = bt(), e = t?.organizationId, r = t?.projectId;
987
- return e && r ? { organizationId: e, projectId: r } : void 0;
897
+ function qe() {
898
+ if (!o()) return;
899
+ let e = Z(), t = e?.organizationId, n = e?.projectId;
900
+ return t && n ? {
901
+ organizationId: t,
902
+ projectId: n
903
+ } : void 0;
988
904
  }
989
- function It() {
990
- if (!H())
991
- return;
992
- const t = document.getElementById("picked_script") || document.querySelector("script#picked") || // legacy support for 'cvly' script tag
993
- document.getElementById("cvly");
994
- if (!t)
995
- return;
996
- const e = t.dataset.organizationid || t.getAttribute("organization-id"), r = t.dataset.projectid || t.getAttribute("project-id");
997
- return e && r ? { organizationId: e, projectId: r } : void 0;
905
+ function Je() {
906
+ if (!f()) return;
907
+ let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
908
+ if (!e) return;
909
+ let t = e.dataset.organizationid || e.getAttribute("organization-id"), n = e.dataset.projectid || e.getAttribute("project-id");
910
+ return t && n ? {
911
+ organizationId: t,
912
+ projectId: n
913
+ } : void 0;
998
914
  }
999
- function vt(t) {
1000
- const { organizationId: e, projectId: r } = t;
1001
- if (e && r)
1002
- return { organizationId: e, projectId: r };
1003
- const n = wt();
1004
- if (n)
1005
- return n;
1006
- const i = It();
1007
- if (i)
1008
- return i;
1009
- throw new Error(
1010
- `organizationId and projectId are required. You can provide them via one of:
1011
- (1) createClient({ organizationId, projectId }) options;
1012
- (2) window.pickedConfig = { organizationId, projectId };
1013
- (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes data-organizationid/data-projectid (or organization-id/project-id) attributes.`
1014
- );
915
+ function Ye(e) {
916
+ let { organizationId: t, projectId: n } = e;
917
+ if (t && n) return {
918
+ organizationId: t,
919
+ projectId: n
920
+ };
921
+ let r = qe();
922
+ if (r) return r;
923
+ let i = Je();
924
+ if (i) return i;
925
+ throw Error("organizationId and projectId are required. You can provide them via one of:\n (1) createClient({ organizationId, projectId }) options;\n (2) window.pickedConfig = { organizationId, projectId };\n (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes data-organizationid/data-projectid (or organization-id/project-id) attributes.");
1015
926
  }
1016
- function O(t) {
1017
- return t == null || t === "" || Number.isNaN(t);
927
+ //#endregion
928
+ //#region src/utils/render-string.ts
929
+ function Q(e) {
930
+ return e == null || e === "" || Number.isNaN(e);
1018
931
  }
1019
- const Ft = {
1020
- default: (t, e) => O(t) ? String(e ?? "") : String(t),
1021
- append: (t, e) => e && !O(t) ? `${t} ${e}` : t,
1022
- prepend: (t, e) => e && !O(t) ? `${e} ${t}` : t,
1023
- upper: (t) => typeof t == "string" ? t.toUpperCase() : t,
1024
- lower: (t) => typeof t == "string" ? t.toLowerCase() : t,
1025
- capitalize: (t) => typeof t == "string" ? t.charAt(0).toUpperCase() + t.slice(1) : t,
1026
- list: (t) => {
1027
- if (!t || typeof t != "object")
1028
- return t;
1029
- const e = new Intl.ListFormat("en", { style: "long", type: "conjunction" });
1030
- if (Array.isArray(t))
1031
- return e.format(t.map(String));
1032
- if (t instanceof Map) {
1033
- const r = Array.from(t.entries()).map(([n, i]) => `${n}: ${i}`);
1034
- return e.format(r);
1035
- }
1036
- return t instanceof Set ? e.format(Array.from(t).map(String)) : t;
1037
- }
932
+ var Xe = {
933
+ default: (e, t) => Q(e) ? String(t ?? "") : String(e),
934
+ append: (e, t) => t && !Q(e) ? `${e} ${t}` : e,
935
+ prepend: (e, t) => t && !Q(e) ? `${t} ${e}` : e,
936
+ upper: (e) => typeof e == "string" ? e.toUpperCase() : e,
937
+ lower: (e) => typeof e == "string" ? e.toLowerCase() : e,
938
+ capitalize: (e) => typeof e == "string" ? e.charAt(0).toUpperCase() + e.slice(1) : e,
939
+ list: (e) => {
940
+ if (!e || typeof e != "object") return e;
941
+ let t = new Intl.ListFormat("en", {
942
+ style: "long",
943
+ type: "conjunction"
944
+ });
945
+ if (Array.isArray(e)) return t.format(e.map(String));
946
+ if (e instanceof Map) {
947
+ let n = Array.from(e.entries()).map(([e, t]) => `${e}: ${t}`);
948
+ return t.format(n);
949
+ }
950
+ return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
951
+ }
1038
952
  };
1039
- function jt(t) {
1040
- return typeof t == "object" && t !== null;
953
+ function Ze(e) {
954
+ return typeof e == "object" && !!e;
1041
955
  }
1042
- function Et(t, e) {
1043
- let r = e;
1044
- for (const n of t.split("."))
1045
- if (jt(r) && n in r)
1046
- r = r[n];
1047
- else
1048
- return;
1049
- return typeof r == "function" ? r() : r;
956
+ function Qe(e, t) {
957
+ let n = t;
958
+ for (let t of e.split(".")) if (Ze(n) && t in n) n = n[t];
959
+ else return;
960
+ return typeof n == "function" ? n() : n;
1050
961
  }
1051
- function xt(t, e) {
1052
- const r = t.split("|").map((u) => u.trim()), n = r.shift() ?? "";
1053
- let i = Et(n, e);
1054
- for (const u of r) {
1055
- const [s, ...o] = u.split(":"), l = s?.trim() ?? "", p = o.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), f = Ft[l];
1056
- f && (i = f(i, p));
1057
- }
1058
- return O(i) ? "" : typeof i == "object" ? JSON.stringify(i) : String(i);
962
+ function $e(e, t) {
963
+ let n = e.split("|").map((e) => e.trim()), r = Qe(n.shift() ?? "", t);
964
+ for (let e of n) {
965
+ let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Xe[i];
966
+ o && (r = o(r, a));
967
+ }
968
+ return Q(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
1059
969
  }
1060
- function Pt(t, e) {
1061
- let r = "", n = 0;
1062
- for (; n < t.length; )
1063
- if (t[n] === "{" && t[n + 1] === "{") {
1064
- n += 2;
1065
- let i = "";
1066
- for (; n < t.length; ) {
1067
- if (t[n] === "}" && t[n + 1] === "}") {
1068
- n += 2;
1069
- break;
1070
- }
1071
- i += t[n++];
1072
- }
1073
- r += xt(i.trim(), e);
1074
- } else
1075
- r += t[n++];
1076
- return r;
970
+ function et(e, t) {
971
+ let n = "", r = 0;
972
+ for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
973
+ r += 2;
974
+ let i = "";
975
+ for (; r < e.length;) {
976
+ if (e[r] === "}" && e[r + 1] === "}") {
977
+ r += 2;
978
+ break;
979
+ }
980
+ i += e[r++];
981
+ }
982
+ n += $e(i.trim(), t);
983
+ } else n += e[r++];
984
+ return n;
1077
985
  }
1078
- class At {
1079
- static logger = F;
1080
- options;
1081
- isReady = !1;
1082
- project;
1083
- plugins = {};
1084
- pluginStartHooks = [];
1085
- eventBus = D();
1086
- events;
1087
- organizationId;
1088
- projectId;
1089
- apiUrl;
1090
- dashboardUrl;
1091
- documentationSiteUrl;
1092
- session;
1093
- precondition;
1094
- condition;
1095
- preconditionPassed;
1096
- searchParams = mt();
1097
- history = Le();
1098
- components = Ee({ client: this });
1099
- experienceInstances = oe({ client: this });
1100
- experiences = ke({ client: this });
1101
- frameworks = Ae({ client: this });
1102
- predicates = Me({ client: this });
1103
- features = Ue({ client: this });
1104
- conditions = pt();
1105
- fields = qe();
1106
- responses = dt({ client: this });
1107
- steps = Qe();
1108
- actions = tt();
1109
- constructor(e) {
1110
- F("info", "Picked client initializing."), this.events = He(this.eventBus);
1111
- const { organizationId: r, projectId: n } = vt(e);
1112
- this.organizationId = r, this.projectId = n, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || gt(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.session = kt(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupComponents(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: ue() }), F("info", "Picked client initialized.");
1113
- }
1114
- start = () => {
1115
- Ce(this), (async () => {
1116
- if (!H())
1117
- return;
1118
- await this.runPluginStartHooks();
1119
- const r = await this.evaluateGate(this.precondition);
1120
- this.preconditionPassed = r;
1121
- let n;
1122
- r && (n = await this.evaluateGate(this.condition));
1123
- const i = r && n === !0;
1124
- if (typeof n == "boolean" && this.session) {
1125
- const u = n;
1126
- this.session.setIsUser(u), this.eventBus({ type: "user_decide", value: u });
1127
- }
1128
- if (this.eventBus({ type: "initialize" }), i && K(this), await ae(), i && K(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
1129
- const { id: u, isUser: s, identifiers: o } = this.session;
1130
- this.eventBus({ type: "session", id: u, isUser: s, identifiers: o });
1131
- }
1132
- })();
1133
- };
1134
- registerFramework = (e) => {
1135
- Be(e, this.frameworks);
1136
- };
1137
- registerComponent = (e, r) => {
1138
- W(e, r, this.components);
1139
- };
1140
- registerPlugin = (e) => {
1141
- we(this, e, this.plugins);
1142
- const r = this.plugins[e.name];
1143
- r?.onStart && this.pluginStartHooks.push(r.onStart);
1144
- };
1145
- registerFeature = (e, r) => {
1146
- Ne(e, r, this.features);
1147
- };
1148
- registerPredicate = (e, r) => {
1149
- Ve(e, r, this.predicates);
1150
- };
1151
- registerCondition = (e) => {
1152
- this.conditions.register(e);
1153
- };
1154
- registerField = (e) => {
1155
- Ke(e, this.fields);
1156
- };
1157
- registerStep = (e) => {
1158
- Xe(e, this.steps);
1159
- };
1160
- registerAction = (e, r) => {
1161
- rt(e, r, this.actions);
1162
- };
1163
- registerExperience = (e) => {
1164
- e.component && W(`experience:${e.id}`, e.component, this.components), be(e, this.experiences);
1165
- };
1166
- getStateSnapshot = () => te(this);
1167
- /** @deprecated Use `client.experiences.launch({ id: experienceId })` instead. */
1168
- launchExperienceById = async (e, r) => {
1169
- this.experiences.launch({ id: e, options: r });
1170
- };
1171
- /** @deprecated Use `client.experiences.open({ id: experienceId })` instead. */
1172
- openExperienceById = async (e) => {
1173
- this.experiences.open({ id: e });
1174
- };
1175
- async runPluginStartHooks() {
1176
- for (const e of this.pluginStartHooks)
1177
- await e();
1178
- }
1179
- async evaluateGate(e) {
1180
- return e === void 0 ? !0 : typeof e == "boolean" ? e : await _(this, e) === !0;
1181
- }
1182
- setupPlugins() {
1183
- this.options.plugins?.forEach((e) => {
1184
- if (Array.isArray(e)) {
1185
- e.forEach((n) => {
1186
- this.registerPlugin(n);
1187
- });
1188
- return;
1189
- }
1190
- const r = typeof e == "function" ? e() : e;
1191
- if (Array.isArray(r)) {
1192
- r.forEach((n) => this.registerPlugin(n));
1193
- return;
1194
- }
1195
- this.registerPlugin(r);
1196
- });
1197
- }
1198
- setupFeatures() {
1199
- const e = this.options.features;
1200
- e && (Object.entries(e).forEach(([r, n]) => {
1201
- const i = typeof n == "function" ? n() : n;
1202
- this.registerFeature(r, i);
1203
- }), this.searchParams.feature && this.searchParams.feature.forEach((r) => {
1204
- try {
1205
- const [n, i] = r.split(":");
1206
- if (!n || !i)
1207
- return;
1208
- let u = i;
1209
- u === "true" && (u = !0), u === "false" && (u = !1), this.registerFeature(n, {
1210
- key: `${u}`,
1211
- // use the assigned bucket value as the key
1212
- name: n,
1213
- // eslint-disable-next-line sonarjs/function-return-type -- feature decide returns either string bucket or boolean; union return is intentional
1214
- decide: () => u,
1215
- storage: "session"
1216
- });
1217
- } catch {
1218
- }
1219
- }));
1220
- }
1221
- setupPredicates() {
1222
- const e = this.options.predicates;
1223
- e && Object.entries(e).forEach(([r, n]) => {
1224
- if (typeof n != "function") {
1225
- F("warn", `Predicate "${r}" is not a function.`);
1226
- return;
1227
- }
1228
- this.registerPredicate(r, n);
1229
- });
1230
- }
1231
- setupActions() {
1232
- const e = this.options.actions;
1233
- e && Object.entries(e).forEach(([r, n]) => {
1234
- if (typeof n != "function") {
1235
- F("warn", `Action "${r}" is not a function.`);
1236
- return;
1237
- }
1238
- this.registerAction(r, n);
1239
- });
1240
- }
1241
- setupComponents() {
1242
- const e = this.options.components;
1243
- e && Object.entries(e).forEach(([r, n]) => {
1244
- this.registerComponent(r, n);
1245
- });
1246
- }
1247
- getPluginConfig = (e) => this.plugins[e] ?? {};
1248
- /**
1249
- * Interpolates a template string using values from the client's response store and/or a provided context.
1250
- * Supports dot-notation, modifiers, and executing functions found in the context.
1251
- *
1252
- * Sources:
1253
- * - responses.*: Loaded automatically from the client's internal response store by fieldId (e.g. {{ responses.email }}).
1254
- * - Context: Any non-responses.* key must be supplied in the context; nested dot-notation is supported.
1255
- * - Functions: If a context value is a function, it is invoked and its result is rendered.
1256
- *
1257
- * Placeholders:
1258
- * - {{ key | modifier: arg | modifier2: arg2 }} with modifiers applied left-to-right.
1259
- *
1260
- * Modifiers:
1261
- * - default: Use the argument when the value is null, undefined, NaN, or empty string; otherwise return the value as a string.
1262
- * - append: Append the argument (space-separated) when the value is non-empty.
1263
- * - prepend: Prepend the argument (space-separated) when the value is non-empty.
1264
- * - upper: Uppercase string values.
1265
- * - lower: Lowercase string values.
1266
- * - capitalize: Capitalize the first letter of string values.
1267
- * - list: Format Arrays, Maps, and Sets via Intl.ListFormat (Maps render as key: value pairs).
1268
- *
1269
- * Behavior:
1270
- * - Empty values (null, undefined, empty string, NaN) render as empty. Numeric 0 renders as "0", boolean false renders as "false", and boolean true renders as "true".
1271
- * - Objects and arrays are JSON-stringified; Maps/Sets serialize to {} unless the list modifier is used.
1272
- * - Unknown modifiers are ignored.
1273
- *
1274
- * @param template Template containing placeholders.
1275
- * @param context Optional data for interpolation. Non-responses.* keys belong here; function values are executed.
1276
- * @returns Interpolated string.
1277
- *
1278
- * @example
1279
- * renderString("Hello {{ name | default: 'Guest' | capitalize }}! Email: {{ responses.email | lower }}.", { name: "ALICE" })
1280
- * // => "Hello Alice! Email: alice@example.com."
1281
- *
1282
- * @example
1283
- * renderString("User: {{ getName | capitalize }}", { getName: () => "alice" })
1284
- * // => "User: Alice"
1285
- *
1286
- * @example
1287
- * renderString("Fruits: {{ fruits | list }}", { fruits: ["apple", "banana", "cherry"] })
1288
- * // => "Fruits: apple, banana, and cherry"
1289
- */
1290
- renderString = (e, r) => {
1291
- const n = this.responses.listStore.getState().reduce((i, u) => (i[u.fieldId] = u.value, i), {});
1292
- return Pt(e, {
1293
- ...r,
1294
- responses: n
1295
- });
1296
- };
1297
- }
1298
- function Nt(t) {
1299
- return {
1300
- $$type: "lazy-component",
1301
- load: t
1302
- };
986
+ //#endregion
987
+ //#region src/picked.ts
988
+ var $ = class {
989
+ static logger = r;
990
+ options;
991
+ isReady = !1;
992
+ plugins = {};
993
+ pluginStartHooks = [];
994
+ eventBus = O();
995
+ events;
996
+ organizationId;
997
+ projectId;
998
+ apiUrl;
999
+ dashboardUrl;
1000
+ documentationSiteUrl;
1001
+ session;
1002
+ precondition;
1003
+ condition;
1004
+ preconditionPassed;
1005
+ searchParams = He();
1006
+ history = J();
1007
+ components = H({ client: this });
1008
+ experienceInstances = _({ client: this });
1009
+ experiences = ue({ client: this });
1010
+ frameworks = me({ client: this });
1011
+ predicates = xe({ client: this });
1012
+ features = we({ client: this });
1013
+ responses = Be({ client: this });
1014
+ fields = je();
1015
+ actions = Fe();
1016
+ constructor(e) {
1017
+ this.events = Oe(this.eventBus);
1018
+ let { organizationId: t, projectId: n } = Ye(e);
1019
+ this.organizationId = t, this.projectId = n, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Ve(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.session = Ke(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupComponents(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({
1020
+ type: "load",
1021
+ version: ae()
1022
+ });
1023
+ }
1024
+ start = () => {
1025
+ ve(this), (async () => {
1026
+ if (!f()) return;
1027
+ await this.runPluginStartHooks();
1028
+ let e = await this.evaluateGate(this.precondition);
1029
+ this.preconditionPassed = e;
1030
+ let t;
1031
+ e && (t = await this.evaluateGate(this.condition));
1032
+ let n = e && t === !0;
1033
+ if (typeof t == "boolean" && this.session) {
1034
+ let e = t;
1035
+ this.session.setIsUser(e), this.eventBus({
1036
+ type: "user_decide",
1037
+ value: e
1038
+ });
1039
+ }
1040
+ if (this.eventBus({ type: "initialize" }), n && F(this), await g(), n && F(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
1041
+ let { id: e, isUser: t, identifiers: n } = this.session;
1042
+ this.eventBus({
1043
+ type: "session",
1044
+ id: e,
1045
+ isUser: t,
1046
+ identifiers: n
1047
+ });
1048
+ }
1049
+ })();
1050
+ };
1051
+ registerFramework = (e) => {
1052
+ he(e, this.frameworks);
1053
+ };
1054
+ registerComponent = (e, t) => {
1055
+ U(e, t, this.components);
1056
+ };
1057
+ registerPlugin = (e) => {
1058
+ L(this, e, this.plugins);
1059
+ let t = this.plugins[e.name];
1060
+ t?.onStart && this.pluginStartHooks.push(t.onStart);
1061
+ };
1062
+ registerFeature = (e, t) => {
1063
+ Te(e, t, this.features);
1064
+ };
1065
+ registerPredicate = (e, t) => {
1066
+ Se(e, t, this.predicates);
1067
+ };
1068
+ registerField = (e) => {
1069
+ Me(e, this.fields);
1070
+ };
1071
+ registerAction = (e, t) => {
1072
+ Ie(e, t, this.actions);
1073
+ };
1074
+ registerExperience = (e) => {
1075
+ e.component && U(`experience:${e.id}`, e.component, this.components), de(e, this.experiences);
1076
+ };
1077
+ getStateSnapshot = () => W(this);
1078
+ launchExperienceById = async (e, t) => {
1079
+ this.experiences.launch({
1080
+ id: e,
1081
+ options: t
1082
+ });
1083
+ };
1084
+ openExperienceById = async (e) => {
1085
+ this.experiences.open({ id: e });
1086
+ };
1087
+ async runPluginStartHooks() {
1088
+ for (let e of this.pluginStartHooks) await e();
1089
+ }
1090
+ async evaluateGate(e) {
1091
+ return e === void 0 ? !0 : typeof e == "boolean" ? e : await t(this, e) === !0;
1092
+ }
1093
+ setupPlugins() {
1094
+ this.options.plugins?.forEach((e) => {
1095
+ if (Array.isArray(e)) {
1096
+ e.forEach((e) => {
1097
+ this.registerPlugin(e);
1098
+ });
1099
+ return;
1100
+ }
1101
+ let t = typeof e == "function" ? e() : e;
1102
+ if (Array.isArray(t)) {
1103
+ t.forEach((e) => this.registerPlugin(e));
1104
+ return;
1105
+ }
1106
+ this.registerPlugin(t);
1107
+ });
1108
+ }
1109
+ setupFeatures() {
1110
+ let e = this.options.features;
1111
+ e && Object.entries(e).forEach(([e, t]) => {
1112
+ let n = typeof t == "function" ? t() : t;
1113
+ this.registerFeature(e, n);
1114
+ }), this.searchParams.feature && this.searchParams.feature.forEach((e) => {
1115
+ try {
1116
+ let [t, n] = e.split(":");
1117
+ if (!t || !n) return;
1118
+ let r = n;
1119
+ r === "true" && (r = !0), r === "false" && (r = !1), this.registerFeature(t, {
1120
+ key: `${r}`,
1121
+ name: t,
1122
+ decide: () => r,
1123
+ storage: "session"
1124
+ });
1125
+ } catch {}
1126
+ });
1127
+ }
1128
+ setupPredicates() {
1129
+ let e = this.options.predicates;
1130
+ e && Object.entries(e).forEach(([e, t]) => {
1131
+ if (typeof t != "function") {
1132
+ `${e}`;
1133
+ return;
1134
+ }
1135
+ this.registerPredicate(e, t);
1136
+ });
1137
+ }
1138
+ setupActions() {
1139
+ let e = this.options.actions;
1140
+ e && Object.entries(e).forEach(([e, t]) => {
1141
+ if (typeof t != "function") {
1142
+ `${e}`;
1143
+ return;
1144
+ }
1145
+ this.registerAction(e, t);
1146
+ });
1147
+ }
1148
+ setupComponents() {
1149
+ let e = this.options.components;
1150
+ e && Object.entries(e).forEach(([e, t]) => {
1151
+ this.registerComponent(e, t);
1152
+ });
1153
+ }
1154
+ getPluginConfig = (e) => this.plugins[e] ?? {};
1155
+ renderString = (e, t) => {
1156
+ let n = this.responses.listStore.getState().reduce((e, t) => (e[t.fieldId] = t.value, e), {});
1157
+ return et(e, {
1158
+ ...t,
1159
+ responses: n
1160
+ });
1161
+ };
1162
+ };
1163
+ //#endregion
1164
+ //#region src/entities/component/lazyComponent.ts
1165
+ function tt(e) {
1166
+ return {
1167
+ $$type: "lazy-component",
1168
+ load: e
1169
+ };
1303
1170
  }
1304
- function Tt(t) {
1305
- return typeof t == "object" && t !== null && "$$type" in t && t.$$type === "lazy-component";
1171
+ function nt(e) {
1172
+ return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
1306
1173
  }
1307
- const Lt = (t) => {
1308
- const e = new At(t);
1309
- return me(e), e;
1310
- };
1311
- export {
1312
- At as Picked,
1313
- Lt as createClient,
1314
- z as createStorageKey,
1315
- _ as evaluateRuleLogic,
1316
- bt as getPickedConfig,
1317
- Tt as isLazyLoader,
1318
- Gt as isPickedRoot,
1319
- Nt as lazyComponent,
1320
- R as localStore,
1321
- M as sessionStore,
1322
- qt as subscribe,
1323
- Wt as supportsCookies,
1324
- ge as supportsCryptoRandomUUID,
1325
- H as supportsDocument,
1326
- Yt as supportsHistory,
1327
- Qt as supportsIntersectionObserver,
1328
- pe as supportsLocalStorage,
1329
- Xt as supportsLocation,
1330
- Zt as supportsSessionStorage,
1331
- er as supportsShadowRoot,
1332
- tr as supportsWebComponents,
1333
- G as supportsWindow
1174
+ //#endregion
1175
+ //#region src/exports.ts
1176
+ var rt = (e) => {
1177
+ let t = new $(e);
1178
+ return d(t), t;
1334
1179
  };
1180
+ //#endregion
1181
+ export { $ as Picked, rt as createClient, S as createStorageKey, t as evaluateRuleLogic, Z as getPickedConfig, nt as isLazyLoader, ne as isPickedRoot, tt as lazyComponent, b as localStore, x as sessionStore, re as subscribe, m as supportsCookies, l as supportsCryptoRandomUUID, f as supportsDocument, s as supportsHistory, i as supportsIntersectionObserver, u as supportsLocalStorage, p as supportsLocation, a as supportsSessionStorage, c as supportsShadowRoot, h as supportsWebComponents, o as supportsWindow };