@picked/client 0.0.1-dev.1784001148032 → 0.0.1-dev.1784265353357

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 (49) hide show
  1. package/dist/{api-BJ8EHkg5.js → api-Dh6rss_Z.js} +1 -1
  2. package/dist/{api-B1wdTDNv.cjs → api-DoUBwN6K.cjs} +1 -1
  3. package/dist/cjs/index.js +2 -2
  4. package/dist/cjs/plugins/dom-observer/index.js +1 -1
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  7. package/dist/cjs/server/index.js +1 -1
  8. package/dist/docs/actions.mdx +16 -2
  9. package/dist/docs/content/asset-library.mdx +43 -0
  10. package/dist/docs/sdk/actions.md +33 -3
  11. package/dist/{dom-CZyRgp2P.js → dom-BwmTHeT7.js} +12 -17
  12. package/dist/dom-CDrHc_j9.cjs +1 -0
  13. package/dist/esm/index.js +341 -418
  14. package/dist/esm/plugins/dom-observer/index.js +1 -1
  15. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  16. package/dist/esm/plugins/history-browser-storage/index.js +11 -33
  17. package/dist/esm/server/index.js +2 -2
  18. package/dist/{experience-instance-M2kR3nTp.js → experience-instance-DCcKZrdI.js} +207 -200
  19. package/dist/experience-instance-Nl39IDKx.cjs +1 -0
  20. package/dist/{plugin-D3z3IXOb.cjs → plugin-D2xYyTWf.cjs} +1 -1
  21. package/dist/{plugin-B04iPuj_.js → plugin-DTYpuy6Q.js} +1 -1
  22. package/dist/types/entities/action/action.d.ts +8 -2
  23. package/dist/types/entities/action/action.d.ts.map +1 -1
  24. package/dist/types/entities/experience/experience.d.ts +2 -2
  25. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  26. package/dist/types/entities/experience-instance/experience-instance.d.ts +10 -23
  27. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  28. package/dist/types/entities/history/history.d.ts +16 -30
  29. package/dist/types/entities/history/history.d.ts.map +1 -1
  30. package/dist/types/entities/response/response.d.ts +0 -1
  31. package/dist/types/entities/response/response.d.ts.map +1 -1
  32. package/dist/types/exports.d.ts +3 -0
  33. package/dist/types/exports.d.ts.map +1 -1
  34. package/dist/types/lifecycle/condition-selection.d.ts.map +1 -1
  35. package/dist/types/picked.d.ts +14 -10
  36. package/dist/types/picked.d.ts.map +1 -1
  37. package/dist/types/plugins/history-browser-storage/plugin.d.ts +0 -17
  38. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  39. package/dist/types/utils/dom.d.ts +0 -94
  40. package/dist/types/utils/dom.d.ts.map +1 -1
  41. package/dist/types/utils/html-asset-value.d.ts +20 -0
  42. package/dist/types/utils/html-asset-value.d.ts.map +1 -0
  43. package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +24 -0
  44. package/dist/types/utils/node-tree/get-next-node-from-action.d.ts.map +1 -0
  45. package/dist/types/utils/rehydrate-scripts.d.ts +35 -0
  46. package/dist/types/utils/rehydrate-scripts.d.ts.map +1 -0
  47. package/package.json +2 -2
  48. package/dist/dom-CdxDV3e-.cjs +0 -1
  49. package/dist/experience-instance-BbSXoRrr.cjs +0 -1
package/dist/esm/index.js CHANGED
@@ -2,25 +2,16 @@ import { t as e } from "../object-BUDGxEqy.js";
2
2
  import { n as t, t as n } from "../rules-logic-HesIUCu6.js";
3
3
  import { t as r } from "../logger-DMN6TxJJ.js";
4
4
  import { a as i, c as a, d as o, f as s, i as c, l, m as u, n as d, o as f, r as p, s as m, t as h, u as g } from "../supports-CO9bJGNl.js";
5
- import { a as _, c as v, i as y, o as b, r as ee, t as x } from "../dom-CZyRgp2P.js";
6
- import { l as S, n as C, r as w, u as T } from "../experience-instance-M2kR3nTp.js";
7
- import { i as E, n as D, r as O, t as k } from "../storage-1MW3-_As.js";
8
- import { n as te, r as ne } from "../api-BJ8EHkg5.js";
5
+ import { a as _, i as v, r as ee, s as y, t as b } from "../dom-BwmTHeT7.js";
6
+ import { l as x, n as S, r as C, u as w } from "../experience-instance-DCcKZrdI.js";
7
+ import { i as T, n as E, r as D, t as O } from "../storage-1MW3-_As.js";
8
+ import { n as te, r as ne } from "../api-Dh6rss_Z.js";
9
9
  import { t as re } from "../id-Bo4RBeOs.js";
10
- import { attach as A, combine as j, createApi as M, createDomain as N, createEffect as P, createEvent as F, createStore as I, sample as L } from "effector";
11
- import { createFactory as R, invoke as z } from "@withease/factories";
10
+ import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, sample as I } from "effector";
11
+ import { createFactory as L, invoke as R } from "@withease/factories";
12
12
  //#region src/entities/experience/experience.ts
13
- var B = N("experience");
14
- function ie(e, t, n) {
15
- let r = new Set(t.filter((e) => e.elements.length > 0).map((e) => e.selector));
16
- for (let t of e) {
17
- if (t.placement !== "replace" || r.has(t.selector)) continue;
18
- let e = y(t.selector);
19
- !e || e === n || `${t.selector}${e}${n}`;
20
- }
21
- }
22
- var ae = R(({ client: e, experience: r }) => {
23
- let i = B.store(r), a = M(i, { merge(e, t) {
13
+ var z = M("experience"), ie = L(({ client: e, experience: r }) => {
14
+ let i = z.store(r), a = j(i, { merge(e, t) {
24
15
  return {
25
16
  ...e,
26
17
  ...t.experience
@@ -30,24 +21,24 @@ var ae = R(({ client: e, experience: r }) => {
30
21
  decisionLogic: e.condition,
31
22
  targetSelectors: e.targets,
32
23
  initializeOpenLogic: e.initializeOpen
33
- })), s = j(i, e.components.listStore, (e, t) => (e.componentName ? t.find((t) => t.name === e.componentName) : void 0) || t.find((t) => t.name === `experience:${e.id}`) || t.find((e) => e.name === "experience"), { skipVoid: !1 }), c = j(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
34
- let r = e.nodes.filter(T).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(S).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
24
+ })), s = A(i, e.components.listStore, (e, t) => (e.componentName ? t.find((t) => t.name === e.componentName) : void 0) || t.find((t) => t.name === `experience:${e.id}`) || t.find((e) => e.name === "experience"), { skipVoid: !1 }), c = A(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
25
+ let r = e.nodes.filter(w).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(x).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
35
26
  return {
36
27
  steps: r,
37
28
  nodes: e.nodes,
38
29
  edges: e.edges,
39
30
  conditions: i
40
31
  };
41
- }), l = r.actions ?? [], u, d = A({
32
+ }), l = r.actions ?? [], u, d = k({
42
33
  source: o,
43
34
  effect: (t, n) => {
44
- let i = _(t.targetSelectors, r.id);
45
- i.forEach(({ elements: e }) => e.forEach((e) => v(e, r.id))), x(i, r.id, r.key).forEach((t) => {
35
+ let i = v(t.targetSelectors, r.id);
36
+ i.forEach(({ elements: e }) => e.forEach((e) => y(e, r.id))), b(i, r.id, r.key).forEach((t) => {
46
37
  n ? e.experienceInstances.spawn(u, t, n) : e.experienceInstances.spawn(u, t);
47
- }), ie(t.targetSelectors, i, r.id);
38
+ });
48
39
  }
49
- }), f = A({
50
- source: j({
40
+ }), f = k({
41
+ source: A({
51
42
  preconditionPassed: e.preconditionPassedStore,
52
43
  isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
53
44
  config: o
@@ -55,9 +46,9 @@ var ae = R(({ client: e, experience: r }) => {
55
46
  effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
56
47
  if (!i || !a) return !1;
57
48
  let { decisionLogic: s, targetSelectors: c } = o;
58
- return c.length === 0 || _(c, r.id).length < 1 ? !1 : s === void 0 ? !0 : t(s) ? await n(e, s) === !0 : !0;
49
+ return c.length === 0 || v(c, r.id).length < 1 ? !1 : s === void 0 ? !0 : t(s) ? await n(e, s) === !0 : !0;
59
50
  }
60
- }), p = P(async () => {
51
+ }), p = N(async () => {
61
52
  if (!e.contentLoader) return !0;
62
53
  try {
63
54
  await e.contentLoader({
@@ -68,26 +59,26 @@ var ae = R(({ client: e, experience: r }) => {
68
59
  `${r.id}`;
69
60
  }
70
61
  return !0;
71
- }), m = F(), h = F(), g = B.createStore(void 0, { skipVoid: !1 }).on(m, (e, t) => t).on(h, (e, t) => t);
72
- return L({
62
+ }), m = P(), h = P(), g = z.createStore(void 0, { skipVoid: !1 }).on(m, (e, t) => t).on(h, (e, t) => t);
63
+ return I({
73
64
  clock: m,
74
65
  target: f
75
- }), L({
66
+ }), I({
76
67
  clock: f.doneData,
77
68
  source: g,
78
69
  filter: (e, t) => t,
79
70
  fn: (e) => e,
80
71
  target: d
81
- }), L({
72
+ }), I({
82
73
  clock: f.doneData,
83
74
  filter: Boolean,
84
75
  target: p
85
- }), L({
76
+ }), I({
86
77
  clock: h,
87
78
  source: g,
88
79
  fn: (e) => e,
89
80
  target: d
90
- }), L({
81
+ }), I({
91
82
  clock: h,
92
83
  target: p
93
84
  }), u = {
@@ -106,60 +97,22 @@ var ae = R(({ client: e, experience: r }) => {
106
97
  prepareExperienceContentFx: p
107
98
  }, u;
108
99
  });
109
- function oe(e) {
110
- return z(ae, e);
111
- }
112
- var se = 5e3;
113
- function ce(e, t) {
114
- return new Promise((n) => {
115
- let r = setTimeout(n, t);
116
- e.then(() => {
117
- clearTimeout(r), n();
118
- });
119
- });
120
- }
121
- function le(e) {
122
- return e.configStore.getState().targetSelectors.filter((e) => e.placement === "replace").map((e) => e.selector);
123
- }
124
- function ue(e) {
125
- let t = /* @__PURE__ */ new Map();
126
- for (let n of e) for (let e of le(n)) t.set(e, (t.get(e) ?? 0) + 1);
127
- let n = [], r = [];
128
- for (let i of e) le(i).some((e) => (t.get(e) ?? 0) > 1) ? n.push(i) : r.push(i);
129
- return {
130
- serialised: n,
131
- parallel: r
132
- };
133
- }
134
- async function de(e) {
135
- let t;
136
- try {
137
- let n = new Promise((n) => {
138
- t = e.initialiseFx.finally.watch(() => n());
139
- });
140
- await e.shouldInitialiseFx() && await ce(n, se);
141
- } catch {
142
- `${e.id}`;
143
- } finally {
144
- t?.();
145
- }
100
+ function ae(e) {
101
+ return R(ie, e);
146
102
  }
147
- async function fe(e) {
148
- for (let t of e) await de(t);
149
- }
150
- var pe = R(({ client: e }) => {
151
- let t = B.store({}), n = M(t, { register(e, t) {
103
+ var oe = L(({ client: e }) => {
104
+ let t = z.store({}), n = j(t, { register(e, t) {
152
105
  return {
153
106
  ...e,
154
107
  [t.id]: t
155
108
  };
156
- } }), r = F(), i = P((t) => {
157
- n.register(oe({
109
+ } }), r = P(), i = N((t) => {
110
+ n.register(ae({
158
111
  client: e,
159
112
  experience: t
160
113
  }));
161
114
  });
162
- L({
115
+ I({
163
116
  clock: r,
164
117
  source: t,
165
118
  filter: (e, t) => e[t.id] !== void 0,
@@ -172,7 +125,7 @@ var pe = R(({ client: e }) => {
172
125
  experience: t,
173
126
  strategy: "override"
174
127
  });
175
- }), L({
128
+ }), I({
176
129
  clock: r,
177
130
  source: t,
178
131
  filter: (e, t) => e[t.id] === void 0,
@@ -186,7 +139,7 @@ var pe = R(({ client: e }) => {
186
139
  function s(e) {
187
140
  return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
188
141
  }
189
- let c = A({
142
+ let c = k({
190
143
  source: t,
191
144
  effect: (e, t) => {
192
145
  let n = "key" in t ? Object.values(e).find((e) => e.key === t.key) : e[t.id];
@@ -204,7 +157,7 @@ var pe = R(({ client: e }) => {
204
157
  getById: o,
205
158
  getByKey: s,
206
159
  launch: c,
207
- open: A({
160
+ open: k({
208
161
  source: {
209
162
  experiences: t,
210
163
  instances: e.experienceInstances.listStore
@@ -231,29 +184,28 @@ var pe = R(({ client: e }) => {
231
184
  }
232
185
  }),
233
186
  listStore: a,
234
- initialiseExperiencesFx: A({
187
+ initialiseExperiencesFx: k({
235
188
  source: a,
236
- effect: async (e) => {
237
- let { serialised: t, parallel: n } = ue(e);
238
- await Promise.all([fe(t), ...n.map((e) => de(e))]);
189
+ effect: (e) => {
190
+ for (let t of e) t.initialiseRequested(void 0);
239
191
  }
240
192
  })
241
193
  };
242
194
  });
243
- function me(e) {
244
- return z(pe, e);
195
+ function se(e) {
196
+ return R(oe, e);
245
197
  }
246
- var he = async (e) => {
198
+ var ce = async (e) => {
247
199
  await e.experiences.initialiseExperiencesFx();
248
200
  };
249
201
  //#endregion
250
202
  //#region src/entities/plugin/plugin.ts
251
- function ge(e) {
252
- return P(async () => {
203
+ function le(e) {
204
+ return N(async () => {
253
205
  await e();
254
206
  });
255
207
  }
256
- var _e = (e, t, n) => {
208
+ var ue = (e, t, n) => {
257
209
  let r = t.name, i = t.setup(e);
258
210
  if (i) {
259
211
  let e = n[r] ?? {};
@@ -262,29 +214,29 @@ var _e = (e, t, n) => {
262
214
  ...i
263
215
  });
264
216
  }
265
- }, ve = N("component"), ye = R(({ client: e, component: t, name: n }) => ({
217
+ }, de = M("component"), fe = L(({ client: e, component: t, name: n }) => ({
266
218
  name: n,
267
219
  component: t,
268
220
  frameworkStore: e.frameworks.getByName(t.frameworkName)
269
221
  }));
270
- function be(e) {
271
- return z(ye, e);
222
+ function pe(e) {
223
+ return R(fe, e);
272
224
  }
273
- var xe = R(({ client: e }) => {
274
- let t = ve.store({}), n = M(t, { register(e, t) {
225
+ var me = L(({ client: e }) => {
226
+ let t = de.store({}), n = j(t, { register(e, t) {
275
227
  return {
276
228
  ...e,
277
229
  [t.name]: t
278
230
  };
279
- } }), i = F();
280
- L({
231
+ } }), i = P();
232
+ I({
281
233
  clock: i,
282
234
  source: t,
283
235
  filter: (e, { name: t }) => e[t] !== void 0,
284
236
  fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
285
- }).watch((e) => /* @__PURE__ */ r("warn", e)), L({
237
+ }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
286
238
  clock: i,
287
- fn: ({ name: t, component: n }) => be({
239
+ fn: ({ name: t, component: n }) => pe({
288
240
  client: e,
289
241
  name: t,
290
242
  component: n
@@ -301,27 +253,27 @@ var xe = R(({ client: e }) => {
301
253
  listStore: a
302
254
  };
303
255
  });
304
- function Se(e) {
305
- return z(xe, e);
256
+ function he(e) {
257
+ return R(me, e);
306
258
  }
307
- var Ce = (e, t, n) => {
259
+ var B = (e, t, n) => {
308
260
  n.register({
309
261
  name: e,
310
262
  component: t
311
263
  });
312
- }, we = N("framework"), Te = R((e) => {
313
- let t = we.store({}), n = M(t, { register(e, t) {
264
+ }, ge = M("framework"), _e = L((e) => {
265
+ let t = ge.store({}), n = j(t, { register(e, t) {
314
266
  return {
315
267
  ...e,
316
268
  [t.name]: t.framework
317
269
  };
318
- } }), i = F();
319
- L({
270
+ } }), i = P();
271
+ I({
320
272
  clock: i,
321
273
  source: t,
322
274
  filter: (e, { name: t }) => e[t] !== void 0,
323
275
  fn: (e, { name: t }) => `Framework '${t}' already registered. Registering again will override the previous registration.`
324
- }).watch((e) => /* @__PURE__ */ r("warn", e)), L({
276
+ }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
325
277
  clock: i,
326
278
  target: n.register
327
279
  });
@@ -335,34 +287,34 @@ var Ce = (e, t, n) => {
335
287
  listStore: a
336
288
  };
337
289
  });
338
- function Ee(e) {
339
- return z(Te, e);
290
+ function ve(e) {
291
+ return R(_e, e);
340
292
  }
341
- var De = (e, t) => {
293
+ var ye = (e, t) => {
342
294
  t.register({
343
295
  name: e.name,
344
296
  framework: e
345
297
  });
346
- }, Oe = R(({ client: e }) => {
298
+ }, be = L(({ client: e }) => {
347
299
  let t = "window" in globalThis, n = {
348
300
  location: t ? globalThis.location : void 0,
349
301
  document: t ? globalThis.document : void 0,
350
302
  sessionStorage: t ? globalThis.sessionStorage : void 0,
351
303
  localStorage: t ? globalThis.localStorage : void 0
352
304
  };
353
- return j(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
305
+ return A(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
354
306
  client: e,
355
307
  responses: t,
356
308
  fields: r,
357
309
  ...n
358
310
  }));
359
311
  });
360
- function ke(e) {
361
- return z(Oe, e);
312
+ function xe(e) {
313
+ return R(be, e);
362
314
  }
363
315
  //#endregion
364
316
  //#region src/logic-engine.ts
365
- function Ae(e) {
317
+ function Se(e) {
366
318
  return typeof e == "number" && !isNaN(e);
367
319
  }
368
320
  function V(e) {
@@ -371,21 +323,21 @@ function V(e) {
371
323
  function H(e) {
372
324
  return Array.isArray(e);
373
325
  }
374
- function je(e) {
326
+ function Ce(e) {
375
327
  return e instanceof Promise;
376
328
  }
377
- function Me(e) {
329
+ function we(e) {
378
330
  return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
379
331
  }
380
332
  function U(e) {
381
- if (Ae(e)) return e;
333
+ if (Se(e)) return e;
382
334
  let t = parseFloat(`${e}`);
383
335
  return isNaN(t) ? 0 : t;
384
336
  }
385
337
  function W(e) {
386
338
  return `${e}`;
387
339
  }
388
- var Ne = {
340
+ var Te = {
389
341
  "==": (e, t) => e == t,
390
342
  "===": (e, t) => e === t,
391
343
  "!=": (e, t) => e != t,
@@ -480,10 +432,10 @@ var Ne = {
480
432
  };
481
433
  async function G(e, t) {
482
434
  if (!e) return e;
483
- if (je(e)) return G(await e, t);
435
+ if (Ce(e)) return G(await e, t);
484
436
  if (H(e)) return Promise.all(e.map((e) => G(e, t)));
485
- if (!Me(e)) return e;
486
- let n = Pe(e), r = n ? e[n] ?? [] : [];
437
+ if (!we(e)) return e;
438
+ let n = Ee(e), r = n ? e[n] ?? [] : [];
487
439
  switch (H(r) || (r = [r]), n) {
488
440
  case "if":
489
441
  case "?:":
@@ -541,17 +493,17 @@ async function G(e, t) {
541
493
  case "catch": try {
542
494
  return await G(r[0], t);
543
495
  } catch (e) {
544
- return Me(e) ? await G(e, t) : r[1] ? await G(r[1], e) : e instanceof Error ? e.message : e;
496
+ return we(e) ? await G(e, t) : r[1] ? await G(r[1], e) : e instanceof Error ? e.message : e;
545
497
  }
546
498
  }
547
- let i = await Promise.all(r.map((e) => G(e, t))), a = n ? Ne[n] : void 0;
499
+ let i = await Promise.all(r.map((e) => G(e, t))), a = n ? Te[n] : void 0;
548
500
  if (!a) throw Error(`Unrecognized operation ${n}`);
549
501
  return a.apply(t, i);
550
502
  }
551
503
  async function K(e) {
552
- return je(e) ? K(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
504
+ return Ce(e) ? K(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
553
505
  }
554
- function Pe(e) {
506
+ function Ee(e) {
555
507
  return Object.keys(e)[0];
556
508
  }
557
509
  //#endregion
@@ -566,7 +518,7 @@ function q(e, t, n) {
566
518
  }) === !0;
567
519
  } });
568
520
  }
569
- var Fe = R(({ client: e }) => A({
521
+ var De = L(({ client: e }) => k({
570
522
  source: {
571
523
  stateSnapshot: e.stateSnapshotStore,
572
524
  predicates: e.predicates.listStore,
@@ -609,15 +561,15 @@ var Fe = R(({ client: e }) => A({
609
561
  });
610
562
  }
611
563
  }));
612
- function Ie(e) {
613
- return z(Fe, e);
564
+ function Oe(e) {
565
+ return R(De, e);
614
566
  }
615
567
  //#endregion
616
568
  //#region src/ping.ts
617
- var Le = 6e3, Re = k("last_ping", "global"), ze = async (e) => {
569
+ var ke = 6e3, Ae = O("last_ping", "global"), je = async (e) => {
618
570
  try {
619
- let t = Date.now(), n = D.get(Re), r = 0;
620
- if (n.isSet() && (r = n.json() ?? 0), r && t - r < Le) return !0;
571
+ let t = Date.now(), n = E.get(Ae), r = 0;
572
+ if (n.isSet() && (r = n.json() ?? 0), r && t - r < ke) return !0;
621
573
  let i = {
622
574
  projectId: e.projectId,
623
575
  path: window.location.pathname
@@ -628,120 +580,120 @@ var Le = 6e3, Re = k("last_ping", "global"), ze = async (e) => {
628
580
  } catch {
629
581
  return !1;
630
582
  }
631
- }, J = N("lifecycle"), Be = R(({ client: e }) => {
632
- let t = J.store(!1), r = I(void 0, {
583
+ }, J = M("lifecycle"), Me = L(({ client: e }) => {
584
+ let t = J.store(!1), r = F(void 0, {
633
585
  skipVoid: !1,
634
586
  domain: J
635
- }), i = I(void 0, {
587
+ }), i = F(void 0, {
636
588
  skipVoid: !1,
637
589
  domain: J
638
- }), a = J.store("idle"), o = J.store([]), s = I(void 0, {
590
+ }), a = J.store("idle"), o = J.store([]), s = F(void 0, {
639
591
  skipVoid: !1,
640
592
  domain: J
641
- }), l = I(void 0, {
593
+ }), l = F(void 0, {
642
594
  skipVoid: !1,
643
595
  domain: J
644
- }), u = F(), d = F(), f = F(), p = F(), m = F(), h = F();
596
+ }), u = P(), d = P(), f = P(), p = P(), m = P(), h = P();
645
597
  o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
646
- let g = P(() => {
647
- ze(e);
648
- }), _ = P(async () => {
598
+ let g = N(() => {
599
+ je(e);
600
+ }), _ = N(async () => {
649
601
  await ee();
650
- }), v = P(async () => {
651
- await he(e);
652
- }), y = A({ effect: v }), b = A({
602
+ }), v = N(async () => {
603
+ await ce(e);
604
+ }), y = k({ effect: v }), b = k({
653
605
  source: o,
654
606
  effect: async (e) => {
655
607
  for (let t of e) await t();
656
608
  }
657
- }), x = A({
609
+ }), x = k({
658
610
  source: s,
659
611
  effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
660
- }), S = A({
612
+ }), S = k({
661
613
  source: l,
662
614
  effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
663
- }), C = L({
615
+ }), C = I({
664
616
  clock: u,
665
617
  source: a,
666
618
  filter: (e) => e === "idle" && c(),
667
619
  fn: () => void 0
668
620
  });
669
- L({
621
+ I({
670
622
  clock: C,
671
623
  fn: () => "starting",
672
624
  target: a
673
- }), L({
625
+ }), I({
674
626
  clock: C,
675
627
  target: g
676
- }), L({
628
+ }), I({
677
629
  clock: C,
678
630
  target: b
679
- }), L({
631
+ }), I({
680
632
  clock: C,
681
633
  target: _
682
- }), L({
634
+ }), I({
683
635
  clock: b.done,
684
636
  target: x
685
- }), L({
637
+ }), I({
686
638
  clock: x.doneData,
687
639
  target: r
688
- }), L({
640
+ }), I({
689
641
  clock: S.doneData,
690
642
  target: i
691
- }), L({
643
+ }), I({
692
644
  clock: x.doneData,
693
645
  filter: (e) => e,
694
646
  target: S
695
- }), L({
647
+ }), I({
696
648
  clock: S.doneData,
697
649
  target: e.session.setIsUser
698
- }), L({
650
+ }), I({
699
651
  clock: S.doneData,
700
652
  fn: (e) => ({
701
653
  type: "user_decide",
702
654
  value: e
703
655
  }),
704
656
  target: e.eventBus
705
- }), L({
657
+ }), I({
706
658
  clock: x.doneData,
707
659
  filter: (e) => !e,
708
660
  fn: () => void 0,
709
661
  target: f
710
- }), L({
662
+ }), I({
711
663
  clock: S.doneData,
712
664
  fn: () => void 0,
713
665
  target: f
714
- }), L({
666
+ }), I({
715
667
  clock: f,
716
668
  fn: () => ({ type: "initialize" }),
717
669
  target: e.eventBus
718
670
  });
719
- let w = I(!1).on(_.done, () => !0), T = I(!1).on(f, () => !0), E = I(!1).on(y.done, () => !0), D = j(r, i, (e, t) => e === !0 && t === !0);
720
- return L({
671
+ let w = F(!1).on(_.done, () => !0), T = F(!1).on(f, () => !0), E = F(!1).on(y.done, () => !0), D = A(r, i, (e, t) => e === !0 && t === !0);
672
+ return I({
721
673
  clock: f,
722
674
  source: D,
723
675
  filter: (e) => e,
724
676
  fn: () => void 0,
725
677
  target: v
726
- }), L({
727
- clock: j(w, T, D, (e, t, n) => e && t && n),
678
+ }), I({
679
+ clock: A(w, T, D, (e, t, n) => e && t && n),
728
680
  filter: (e) => e,
729
681
  fn: () => void 0,
730
682
  target: y
731
- }), L({
732
- clock: j(w, T, D, E, (e, t, n, r) => e && t && (!n || r)),
683
+ }), I({
684
+ clock: A(w, T, D, E, (e, t, n, r) => e && t && (!n || r)),
733
685
  filter: (e) => e,
734
686
  fn: () => void 0,
735
687
  target: d
736
- }), L({
688
+ }), I({
737
689
  clock: d,
738
690
  fn: () => "ready",
739
691
  target: a
740
- }), L({
692
+ }), I({
741
693
  clock: d,
742
694
  fn: () => ({ type: "ready" }),
743
695
  target: e.eventBus
744
- }), L({
696
+ }), I({
745
697
  clock: d,
746
698
  source: e.session.store,
747
699
  fn: ({ id: e, isUser: t, identifiers: n }) => ({
@@ -751,7 +703,7 @@ var Le = 6e3, Re = k("last_ping", "global"), ze = async (e) => {
751
703
  identifiers: n
752
704
  }),
753
705
  target: e.eventBus
754
- }), L({
706
+ }), I({
755
707
  clock: [
756
708
  b.fail,
757
709
  x.fail,
@@ -773,13 +725,13 @@ var Le = 6e3, Re = k("last_ping", "global"), ze = async (e) => {
773
725
  setCondition: h
774
726
  };
775
727
  });
776
- function Ve(e) {
777
- return z(Be, e);
728
+ function Ne(e) {
729
+ return R(Me, e);
778
730
  }
779
731
  //#endregion
780
732
  //#region src/entities/predicate/predicate.ts
781
- var He = N("predicate"), Ue = R(({ client: e }) => {
782
- let t = He.store({}), n = M(t, { register(e, t) {
733
+ var Pe = M("predicate"), Fe = L(({ client: e }) => {
734
+ let t = Pe.store({}), n = j(t, { register(e, t) {
783
735
  return {
784
736
  ...e,
785
737
  [t.name]: {
@@ -787,13 +739,13 @@ var He = N("predicate"), Ue = R(({ client: e }) => {
787
739
  predicate: t.predicate
788
740
  }
789
741
  };
790
- } }), i = F();
791
- L({
742
+ } }), i = P();
743
+ I({
792
744
  clock: i,
793
745
  source: t,
794
746
  filter: (e, { name: t }) => e[t] !== void 0,
795
747
  fn: (e, { name: t }) => `Predicate '${t}' already registered. Registering again will override the previous registration.`
796
- }).watch((e) => /* @__PURE__ */ r("warn", e)), L({
748
+ }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
797
749
  clock: i,
798
750
  fn: ({ name: e, predicate: t }) => Object.freeze({
799
751
  name: e,
@@ -806,7 +758,7 @@ var He = N("predicate"), Ue = R(({ client: e }) => {
806
758
  return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
807
759
  }
808
760
  function s(t) {
809
- let n = I(() => void 0, { skipVoid: !1 }), r = A({
761
+ let n = F(() => void 0, { skipVoid: !1 }), r = k({
810
762
  source: {
811
763
  predicate: o(t),
812
764
  snapshot: e.stateSnapshotStore
@@ -818,13 +770,13 @@ var He = N("predicate"), Ue = R(({ client: e }) => {
818
770
  });
819
771
  }
820
772
  });
821
- return L({
773
+ return I({
822
774
  source: {
823
775
  responses: e.responses.listStore,
824
776
  fields: e.fields.listStore
825
777
  },
826
778
  target: r
827
- }), L({
779
+ }), I({
828
780
  clock: r.doneData,
829
781
  filter: (e) => e !== void 0,
830
782
  target: n
@@ -837,27 +789,27 @@ var He = N("predicate"), Ue = R(({ client: e }) => {
837
789
  getEvokablePredicate: s
838
790
  };
839
791
  });
840
- function We(e) {
841
- return z(Ue, e);
792
+ function Ie(e) {
793
+ return R(Fe, e);
842
794
  }
843
- var Ge = (e, t, n) => {
795
+ var Le = (e, t, n) => {
844
796
  n.register({
845
797
  name: e,
846
798
  predicate: t
847
799
  });
848
- }, Ke = N("feature"), qe = R(({ client: e }) => {
849
- let t = Ke.store({}), n = Ke.store([]), i = M(t, { register(e, t) {
800
+ }, Y = M("feature"), Re = L(({ client: e }) => {
801
+ let t = Y.store({}), n = Y.store([]), i = j(t, { register(e, t) {
850
802
  return {
851
803
  ...e,
852
804
  [t.id]: t.feature
853
805
  };
854
- } }), a = F();
855
- L({
806
+ } }), a = P();
807
+ I({
856
808
  clock: a,
857
809
  source: t,
858
810
  filter: (e, { id: t }) => e[t] !== void 0,
859
811
  fn: (e, { id: t }) => `Feature '${t}' already registered. Registering again will override the previous registration.`
860
- }).watch((e) => /* @__PURE__ */ r("warn", e)), L({
812
+ }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
861
813
  clock: a,
862
814
  fn: ({ id: e, feature: t }) => Object.freeze({
863
815
  id: e,
@@ -871,19 +823,19 @@ var Ge = (e, t, n) => {
871
823
  }),
872
824
  target: i.register
873
825
  });
874
- let o = P(async ({ id: e, key: t, storage: n = "local" }) => {
875
- let r = k(`feature:${e}:${t}`, "global"), i = (n === "session" ? O : D).get(r).boolean();
826
+ let o = N(async ({ id: e, key: t, storage: n = "local" }) => {
827
+ let r = O(`feature:${e}:${t}`, "global"), i = (n === "session" ? D : E).get(r).boolean();
876
828
  return i === null ? null : {
877
829
  id: e,
878
830
  key: t,
879
831
  bucket: i,
880
832
  storage: n
881
833
  };
882
- }), s = P((e) => {
834
+ }), s = N((e) => {
883
835
  if (!e) return null;
884
- let t = k(`feature:${e.id}:${e.key}`, "global");
885
- (e.storage === "session" ? O : D).set(t, e.bucket);
886
- }), c = /* @__PURE__ */ new Map(), l = A({
836
+ let t = O(`feature:${e.id}:${e.key}`, "global");
837
+ (e.storage === "session" ? D : E).set(t, e.bucket);
838
+ }), c = /* @__PURE__ */ new Map(), l = k({
887
839
  source: {
888
840
  allFeaturesStore: t,
889
841
  resolvedFeaturesStore: n
@@ -914,7 +866,7 @@ var Ge = (e, t, n) => {
914
866
  };
915
867
  }
916
868
  });
917
- L({
869
+ I({
918
870
  clock: i.register,
919
871
  fn: (e) => {
920
872
  let { id: t, feature: n } = e;
@@ -925,7 +877,7 @@ var Ge = (e, t, n) => {
925
877
  };
926
878
  },
927
879
  target: o
928
- }), L({
880
+ }), I({
929
881
  source: t,
930
882
  clock: l.doneData,
931
883
  fn: (e, t) => {
@@ -939,7 +891,7 @@ var Ge = (e, t, n) => {
939
891
  },
940
892
  target: s
941
893
  });
942
- let u = j({
894
+ let u = A({
943
895
  allFeaturesStore: t,
944
896
  resolvedFeaturesStore: n
945
897
  }).map(({ allFeaturesStore: e, resolvedFeaturesStore: t }) => Object.values(e).map((e) => {
@@ -961,7 +913,7 @@ var Ge = (e, t, n) => {
961
913
  isResolved: !1
962
914
  };
963
915
  }));
964
- L({
916
+ I({
965
917
  clock: l.doneData,
966
918
  source: { resolvedFeatures: n },
967
919
  filter: ({ resolvedFeatures: e }, { id: t, key: n }) => !e.some((e) => e.id === t && e.key === n),
@@ -970,7 +922,7 @@ var Ge = (e, t, n) => {
970
922
  type: "feature_decide",
971
923
  feature: e
972
924
  }))
973
- }), L({
925
+ }), I({
974
926
  clock: [o.doneData, l.doneData],
975
927
  source: n,
976
928
  fn: (e, t) => !t || e.some((e) => e.id === t.id && e.key === t.key) ? e : [...e, t],
@@ -983,17 +935,17 @@ var Ge = (e, t, n) => {
983
935
  return t.map((t) => t[e], { skipVoid: !1 });
984
936
  }
985
937
  function p(e) {
986
- let t = I(async () => void 0, { skipVoid: !1 }), r = A({
938
+ let t = F(async () => void 0, { skipVoid: !1 }), r = k({
987
939
  source: d(e),
988
940
  effect: async (e) => {
989
941
  if (e) return async () => (await e.getBucket()).bucket;
990
942
  }
991
943
  });
992
- return L({
944
+ return I({
993
945
  source: n,
994
946
  filter: (t) => t.some((t) => t.id === e),
995
947
  target: r
996
- }), L({
948
+ }), I({
997
949
  clock: r.doneData,
998
950
  filter: (e) => e !== void 0,
999
951
  target: t
@@ -1007,111 +959,69 @@ var Ge = (e, t, n) => {
1007
959
  getEvokableFeature: p
1008
960
  };
1009
961
  });
1010
- function Je(e) {
1011
- return z(qe, e);
962
+ function ze(e) {
963
+ return R(Re, e);
1012
964
  }
1013
- var Ye = (e, t, n) => {
965
+ var Be = (e, t, n) => {
1014
966
  n.register({
1015
967
  id: e,
1016
968
  feature: t
1017
969
  });
1018
- }, Y = N("history");
1019
- function X(e, t, n) {
970
+ }, X = M("history");
971
+ function Ve(e, t) {
1020
972
  return {
1021
- id: re("history-entry"),
1022
- node: n,
973
+ id: re(`history-entry-${Date.now()}-${Math.random()}}`),
974
+ node: t,
1023
975
  at: Date.now(),
1024
- instanceId: e,
1025
- experienceId: t
976
+ experienceId: e
1026
977
  };
1027
978
  }
1028
- function Xe(e) {
1029
- for (let t = e.length - 1; t >= 0; t--) {
1030
- let n = e[t];
1031
- if (n && T(n.node)) return e.slice(0, t + 1);
1032
- }
1033
- return [];
1034
- }
1035
- var Ze = R(() => {
1036
- let e = Y.store([]), t = Y.event(), n = Y.event(), r = Y.event(), i = Y.event(), a = Y.event(), o = Y.event(), s = Y.event();
1037
- e.on(t, (e, t) => [...e, X(t.instanceId, t.experienceId, t.node)]), e.on(n, (e, t) => {
1038
- let n = X(t.instanceId, t.experienceId, t.node), r = -1;
1039
- for (let n = e.length - 1; n >= 0; n--) if (e[n]?.instanceId === t.instanceId) {
1040
- r = n;
1041
- break;
1042
- }
1043
- return r === -1 ? [...e, n] : [
1044
- ...e.slice(0, r),
1045
- n,
1046
- ...e.slice(r + 1)
1047
- ];
1048
- }), e.on(r, (e, { instanceId: t }) => {
1049
- let n = 0, r = -1;
1050
- for (let i = e.length - 1; i >= 0; i--) {
1051
- let a = e[i];
1052
- if (!(a?.instanceId !== t || !T(a.node)) && ++n === 2) {
1053
- r = i;
979
+ var He = L(() => {
980
+ let e = X.store({ entries: [] }), t = X.event(), n = X.event(), r = X.event(), i = X.event();
981
+ e.on(t, (e, t) => ({ entries: [...e.entries, Ve(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Ve(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
982
+ function a(e, t) {
983
+ let n = {
984
+ lastStepIndex: -1,
985
+ secondLastStepIndex: -1
986
+ };
987
+ for (let r = e.length - 1; r >= 0; r--) {
988
+ let i = e[r], a = i?.node;
989
+ if (!(!a || !w(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
990
+ else {
991
+ n.secondLastStepIndex = r;
1054
992
  break;
1055
993
  }
1056
994
  }
1057
- return r === -1 ? e : e.filter((e, n) => e.instanceId !== t || n <= r);
1058
- }), e.on(i, (e, { snapshots: t }) => {
1059
- let n = new Set(e.map((e) => e.experienceId)), r = [];
1060
- for (let e of Object.keys(t)) {
1061
- if (n.has(e)) continue;
1062
- let i = t[e];
1063
- i && r.push(...i);
1064
- }
1065
- return r.length === 0 ? e : [...e, ...r];
1066
- }), e.on(s, (e, t) => [...e, ...t]), e.on(o, (e, { instanceId: t }) => {
1067
- let n = e.filter((e) => e.instanceId !== t);
1068
- return n.length === e.length ? e : n;
1069
- });
1070
- let c = e.map((e) => {
1071
- let t = /* @__PURE__ */ new Map();
1072
- for (let n of e) t.set(n.experienceId, n.instanceId);
1073
- let n = {};
1074
- for (let r of e) {
1075
- if (t.get(r.experienceId) !== r.instanceId) continue;
1076
- let e = n[r.experienceId] ?? [];
1077
- e.push(r), n[r.experienceId] = e;
1078
- }
1079
995
  return n;
1080
- });
1081
- return L({
1082
- clock: a,
1083
- source: c,
1084
- fn: (e, { instanceId: t, experienceId: n }) => Xe(e[n] ?? []).map((e) => ({
996
+ }
997
+ return e.on(r, (e, t) => {
998
+ let { secondLastStepIndex: n } = a(e.entries, t.experienceId), r = n === -1 ? e.entries : e.entries.slice(0, n + 1);
999
+ return {
1085
1000
  ...e,
1086
- id: re("history-entry"),
1087
- instanceId: t
1088
- })),
1089
- target: s
1001
+ entries: r
1002
+ };
1090
1003
  }), {
1091
1004
  push: t,
1092
1005
  replace: n,
1093
1006
  back: r,
1094
- restoreSnapshots: i,
1095
- seedInstanceFromSnapshot: a,
1096
- clearForInstance: o,
1097
- entriesStore: e,
1098
- snapshotStore: c
1007
+ restore: i,
1008
+ entriesStore: e.map((e) => e.entries)
1099
1009
  };
1100
1010
  });
1101
- function Qe() {
1102
- return z(Ze);
1011
+ function Ue() {
1012
+ return R(He);
1103
1013
  }
1104
1014
  //#endregion
1105
1015
  //#region src/utils/events.ts
1106
- var $e = 0, et = (e) => {
1107
- let t = I([]);
1016
+ var We = 0, Ge = (e) => {
1017
+ let t = F([]);
1108
1018
  return t.on(e, (e, t) => [...e, {
1109
- id: $e++,
1019
+ id: We++,
1110
1020
  at: /* @__PURE__ */ new Date(),
1111
1021
  payload: t
1112
1022
  }]), t;
1113
- }, tt = N("field"), nt = R(() => {
1114
- let e = tt.store({}), t = M(e, {
1023
+ }, Ke = M("field"), qe = L(() => {
1024
+ let e = Ke.store({}), t = j(e, {
1115
1025
  register(e, t) {
1116
1026
  return {
1117
1027
  ...e,
@@ -1159,13 +1069,13 @@ var $e = 0, et = (e) => {
1159
1069
  getByName: c
1160
1070
  };
1161
1071
  });
1162
- function rt() {
1163
- return z(nt);
1072
+ function Je() {
1073
+ return R(qe);
1164
1074
  }
1165
1075
  //#endregion
1166
1076
  //#region src/entities/step/step.ts
1167
- var it = N("step"), at = R(() => {
1168
- let e = it.store({}), t = M(e, { register(e, t) {
1077
+ var Ye = M("step"), Xe = L(() => {
1078
+ let e = Ye.store({}), t = j(e, { register(e, t) {
1169
1079
  return {
1170
1080
  ...e,
1171
1081
  [t.step.id]: t.step
@@ -1189,16 +1099,16 @@ var it = N("step"), at = R(() => {
1189
1099
  indexStore: e
1190
1100
  };
1191
1101
  });
1192
- function ot() {
1193
- return z(at);
1102
+ function Ze() {
1103
+ return R(Xe);
1194
1104
  }
1195
- function st(e, t) {
1105
+ function Qe(e, t) {
1196
1106
  t.register(e);
1197
1107
  }
1198
1108
  //#endregion
1199
1109
  //#region src/entities/content/content.ts
1200
- var ct = N("content"), lt = R(() => {
1201
- let e = ct.store({}), t = M(e, { register(e, t) {
1110
+ var $e = M("content"), et = L(() => {
1111
+ let e = $e.store({}), t = j(e, { register(e, t) {
1202
1112
  return {
1203
1113
  ...e,
1204
1114
  [t.content.id]: t.content
@@ -1218,16 +1128,16 @@ var ct = N("content"), lt = R(() => {
1218
1128
  indexStore: e
1219
1129
  };
1220
1130
  });
1221
- function ut() {
1222
- return z(lt);
1131
+ function tt() {
1132
+ return R(et);
1223
1133
  }
1224
- function dt(e, t) {
1134
+ function nt(e, t) {
1225
1135
  t.register(e);
1226
1136
  }
1227
1137
  //#endregion
1228
1138
  //#region src/entities/action/action.ts
1229
- var ft = N("action"), pt = R(({ client: e }) => {
1230
- let t = ft.store({}), n = M(t, { register(e, t) {
1139
+ var rt = M("action"), it = L(({ client: e }) => {
1140
+ let t = rt.store({}), n = j(t, { register(e, t) {
1231
1141
  return {
1232
1142
  ...e,
1233
1143
  [t.key]: {
@@ -1235,13 +1145,13 @@ var ft = N("action"), pt = R(({ client: e }) => {
1235
1145
  action: t.action
1236
1146
  }
1237
1147
  };
1238
- } }), i = F();
1239
- L({
1148
+ } }), i = P();
1149
+ I({
1240
1150
  clock: i,
1241
1151
  source: t,
1242
1152
  filter: (e, { key: t }) => e[t] !== void 0,
1243
1153
  fn: (e, { key: t }) => `Action '${t}' already registered. Registering again will override the previous registration.`
1244
- }).watch((e) => /* @__PURE__ */ r("warn", e)), L({
1154
+ }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
1245
1155
  clock: i,
1246
1156
  fn: ({ key: e, action: t }) => Object.freeze({
1247
1157
  key: e,
@@ -1254,7 +1164,7 @@ var ft = N("action"), pt = R(({ client: e }) => {
1254
1164
  return t.map((t) => t[e]?.action, { skipVoid: !1 });
1255
1165
  }
1256
1166
  function s(t, n) {
1257
- let r = I(() => void 0, { skipVoid: !1 }), i = n ? { experience: n.experience } : null, a = A({
1167
+ let r = F(() => void 0, { skipVoid: !1 }), i = n ? { experience: n.experience } : null, a = k({
1258
1168
  source: {
1259
1169
  action: o(t),
1260
1170
  snapshot: e.stateSnapshotStore
@@ -1266,13 +1176,13 @@ var ft = N("action"), pt = R(({ client: e }) => {
1266
1176
  }, i);
1267
1177
  }
1268
1178
  });
1269
- return L({
1179
+ return I({
1270
1180
  source: {
1271
1181
  responses: e.responses.listStore,
1272
1182
  fields: e.fields.listStore
1273
1183
  },
1274
1184
  target: a
1275
- }), L({
1185
+ }), I({
1276
1186
  clock: a.doneData,
1277
1187
  filter: (e) => e !== void 0,
1278
1188
  target: r
@@ -1285,10 +1195,10 @@ var ft = N("action"), pt = R(({ client: e }) => {
1285
1195
  getEvokableAction: s
1286
1196
  };
1287
1197
  });
1288
- function mt(e) {
1289
- return z(pt, e);
1198
+ function at(e) {
1199
+ return R(it, e);
1290
1200
  }
1291
- var ht = (e, t, n) => {
1201
+ var ot = (e, t, n) => {
1292
1202
  n.register({
1293
1203
  key: e,
1294
1204
  action: t
@@ -1307,35 +1217,35 @@ function Z(e, t, n, r) {
1307
1217
  function Q(e) {
1308
1218
  return e === null || e === "" || Array.isArray(e) && !e.length;
1309
1219
  }
1310
- function gt(e) {
1220
+ function st(e) {
1311
1221
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
1312
1222
  }
1313
- function _t(e) {
1223
+ function ct(e) {
1314
1224
  try {
1315
1225
  return JSON.stringify(e), !0;
1316
1226
  } catch {
1317
1227
  return !1;
1318
1228
  }
1319
1229
  }
1320
- function vt(e, t) {
1230
+ function lt(e, t) {
1321
1231
  return t.find((t) => t.key === e) ?? null;
1322
1232
  }
1323
- function yt(e, t) {
1233
+ function ut(e, t) {
1324
1234
  return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
1325
1235
  }
1326
- function bt(e, t) {
1236
+ function dt(e, t) {
1327
1237
  if (e.type !== "object" || Q(t)) return null;
1328
1238
  if (e.multiple) {
1329
1239
  if (!Array.isArray(t)) return Z(e, t, "This field expects multiple values", "Field expects an array of objects.");
1330
1240
  for (let n of t) {
1331
1241
  if (typeof n != "object" || !n) return Z(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
1332
- if (!_t(n)) return Z(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1242
+ if (!ct(n)) return Z(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1333
1243
  }
1334
1244
  return null;
1335
1245
  }
1336
- return Array.isArray(t) ? Z(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Z(e, t, "This field expects an object value", "Field expects an object value.") : _t(t) ? null : Z(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1246
+ return Array.isArray(t) ? Z(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Z(e, t, "This field expects an object value", "Field expects an object value.") : ct(t) ? null : Z(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1337
1247
  }
1338
- function xt(e, t) {
1248
+ function ft(e, t) {
1339
1249
  if (Q(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
1340
1250
  let n = Array.isArray(t) ? t : [t];
1341
1251
  if (e.type === "object") {
@@ -1343,9 +1253,9 @@ function xt(e, t) {
1343
1253
  return n.every((e) => r.has(JSON.stringify(e))) ? null : Z(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
1344
1254
  }
1345
1255
  let r = e.options.map((e) => e.value);
1346
- return n.every((e) => !gt(e) || e === null ? !1 : r.includes(e)) ? null : Z(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
1256
+ return n.every((e) => !st(e) || e === null ? !1 : r.includes(e)) ? null : Z(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
1347
1257
  }
1348
- async function St(t, n, r, i) {
1258
+ async function pt(t, n, r, i) {
1349
1259
  if (n.validation && !e(n.validation) && !Q(r)) {
1350
1260
  let e = i ? {
1351
1261
  $input: r,
@@ -1358,8 +1268,8 @@ async function St(t, n, r, i) {
1358
1268
  }
1359
1269
  //#endregion
1360
1270
  //#region src/entities/response/response.ts
1361
- var Ct = N("response"), wt = R(({ client: e }) => {
1362
- let t = Ct.store({}), r = F(), i = F(), a = M(t, {
1271
+ var mt = M("response"), ht = L(({ client: e }) => {
1272
+ let t = mt.store({}), r = P(), i = P(), a = j(t, {
1363
1273
  register(e, t) {
1364
1274
  return {
1365
1275
  ...e,
@@ -1388,7 +1298,7 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1388
1298
  });
1389
1299
  } else a.registerBatch(e);
1390
1300
  }
1391
- let s = (t, r) => n(e, t, r), c = A({
1301
+ let s = (t, r) => n(e, t, r), c = k({
1392
1302
  source: {
1393
1303
  allFields: e.fields.listStore,
1394
1304
  existingResponses: t
@@ -1398,7 +1308,7 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1398
1308
  ...t,
1399
1309
  ...n
1400
1310
  }, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
1401
- let o = vt(t, e);
1311
+ let o = lt(t, e);
1402
1312
  if (!o) {
1403
1313
  r.push({
1404
1314
  fieldKey: t,
@@ -1408,17 +1318,17 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1408
1318
  });
1409
1319
  return;
1410
1320
  }
1411
- let c = yt(o, n), l = await St(s, o, c, a);
1321
+ let c = ut(o, n), l = await pt(s, o, c, a);
1412
1322
  if (l) {
1413
1323
  r.push(l);
1414
1324
  return;
1415
1325
  }
1416
- let u = bt(o, c);
1326
+ let u = dt(o, c);
1417
1327
  if (u) {
1418
1328
  r.push(u);
1419
1329
  return;
1420
1330
  }
1421
- let d = xt(o, c);
1331
+ let d = ft(o, c);
1422
1332
  if (d) {
1423
1333
  r.push(d);
1424
1334
  return;
@@ -1446,7 +1356,7 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1446
1356
  async function l(e) {
1447
1357
  return c(e);
1448
1358
  }
1449
- let u = A({
1359
+ let u = k({
1450
1360
  source: t,
1451
1361
  effect: async (e, t) => {
1452
1362
  let { responsesToCommit: n, validationErrors: r } = await c(t);
@@ -1461,7 +1371,7 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1461
1371
  value: t
1462
1372
  })));
1463
1373
  function m(e) {
1464
- return j({
1374
+ return A({
1465
1375
  f: e,
1466
1376
  s: t
1467
1377
  }, ({ f: e, s: t }) => {
@@ -1478,30 +1388,16 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1478
1388
  function _(t) {
1479
1389
  return m(e.fields.getByName(t));
1480
1390
  }
1481
- L({
1391
+ return I({
1482
1392
  clock: r,
1483
1393
  target: a.clearAll
1484
- }), L({
1394
+ }), I({
1485
1395
  clock: i,
1486
1396
  target: a.clear
1487
- });
1488
- let v = A({
1489
- source: e.experiences.listStore,
1490
- effect: (e, t) => {
1491
- let n = e.find((e) => e.id === t);
1492
- if (!n) return;
1493
- let { steps: r } = n.treeStore.getState(), a = r.flatMap((e) => e.fieldKeys);
1494
- for (let e of a) i(e);
1495
- }
1496
- });
1497
- function y(e) {
1498
- v(e);
1499
- }
1500
- return {
1397
+ }), {
1501
1398
  register: o,
1502
1399
  clearAll: r,
1503
1400
  clear: i,
1504
- clearByExperience: y,
1505
1401
  commit: d,
1506
1402
  getResponsesToCommit: l,
1507
1403
  listStore: p,
@@ -1511,13 +1407,13 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1511
1407
  getByFieldName: _
1512
1408
  };
1513
1409
  });
1514
- function Tt(e) {
1515
- return z(wt, e);
1410
+ function gt(e) {
1411
+ return R(ht, e);
1516
1412
  }
1517
1413
  //#endregion
1518
1414
  //#region src/entities/condition/condition.ts
1519
- var Et = N("condition"), Dt = R(() => {
1520
- let e = Et.store({}), t = M(e, { register(e, t) {
1415
+ var _t = M("condition"), vt = L(() => {
1416
+ let e = _t.store({}), t = j(e, { register(e, t) {
1521
1417
  return {
1522
1418
  ...e,
1523
1419
  [t.condition.id]: t.condition
@@ -1541,12 +1437,12 @@ var Et = N("condition"), Dt = R(() => {
1541
1437
  indexStore: e
1542
1438
  };
1543
1439
  });
1544
- function Ot() {
1545
- return z(Dt);
1440
+ function yt() {
1441
+ return R(vt);
1546
1442
  }
1547
1443
  //#endregion
1548
1444
  //#region src/utils/api-url.ts
1549
- function kt() {
1445
+ function bt() {
1550
1446
  if (c()) {
1551
1447
  let e = [
1552
1448
  document.currentScript,
@@ -1561,7 +1457,7 @@ function kt() {
1561
1457
  }
1562
1458
  //#endregion
1563
1459
  //#region src/utils/search-params.ts
1564
- function At() {
1460
+ function xt() {
1565
1461
  if (!s()) return {};
1566
1462
  let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
1567
1463
  for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
@@ -1569,23 +1465,23 @@ function At() {
1569
1465
  let n = r.replace("picked-", "");
1570
1466
  t[n] = e.getAll(r);
1571
1467
  }
1572
- let r = k("s");
1573
- if (n.size > 0) O.set(r, t);
1468
+ let r = O("s");
1469
+ if (n.size > 0) D.set(r, t);
1574
1470
  else {
1575
- let e = O.get(r);
1471
+ let e = D.get(r);
1576
1472
  if (e) return e.json() || {};
1577
1473
  }
1578
1474
  return t;
1579
1475
  }
1580
1476
  //#endregion
1581
1477
  //#region src/entities/session/session.ts
1582
- var jt = k("session", "global");
1583
- function Mt() {
1478
+ var St = O("session", "global");
1479
+ function Ct() {
1584
1480
  return p() ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}`;
1585
1481
  }
1586
- function Nt() {
1482
+ function wt() {
1587
1483
  if (!m()) return null;
1588
- let e = D.get(jt);
1484
+ let e = E.get(St);
1589
1485
  if (!e.isSet()) return null;
1590
1486
  try {
1591
1487
  return e.json();
@@ -1593,10 +1489,10 @@ function Nt() {
1593
1489
  return null;
1594
1490
  }
1595
1491
  }
1596
- var Pt = R(() => {
1597
- let e = Nt(), t = { id: e?.id ?? Mt() };
1492
+ var Tt = L(() => {
1493
+ let e = wt(), t = { id: e?.id ?? Ct() };
1598
1494
  e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
1599
- let n = I(t), r = M(n, {
1495
+ let n = F(t), r = j(n, {
1600
1496
  setIsUser: (e, t) => ({
1601
1497
  ...e,
1602
1498
  isUser: t
@@ -1617,13 +1513,13 @@ var Pt = R(() => {
1617
1513
  return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
1618
1514
  }
1619
1515
  });
1620
- return L({
1516
+ return I({
1621
1517
  source: n,
1622
- target: A({
1518
+ target: k({
1623
1519
  source: n,
1624
1520
  effect: (e) => {
1625
1521
  if (m()) try {
1626
- D.get(jt).set(e);
1522
+ E.get(St).set(e);
1627
1523
  } catch {}
1628
1524
  }
1629
1525
  })
@@ -1634,27 +1530,27 @@ var Pt = R(() => {
1634
1530
  removeIdentifier: r.removeIdentifier
1635
1531
  };
1636
1532
  });
1637
- function Ft() {
1638
- return z(Pt, void 0);
1533
+ function Et() {
1534
+ return R(Tt, void 0);
1639
1535
  }
1640
1536
  //#endregion
1641
1537
  //#region src/utils/picked-config.ts
1642
- function It() {
1538
+ function Dt() {
1643
1539
  if (s()) return globalThis.window.pickedConfig;
1644
1540
  }
1645
- function Lt() {
1646
- if (s()) return It()?.projectId;
1541
+ function Ot() {
1542
+ if (s()) return Dt()?.projectId;
1647
1543
  }
1648
- function Rt() {
1544
+ function kt() {
1649
1545
  if (!c()) return;
1650
1546
  let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
1651
1547
  if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
1652
1548
  }
1653
- function zt(e) {
1549
+ function At(e) {
1654
1550
  if (e.projectId) return e.projectId;
1655
- let t = Lt();
1551
+ let t = Ot();
1656
1552
  if (t) return t;
1657
- let n = Rt();
1553
+ let n = kt();
1658
1554
  if (n) return n;
1659
1555
  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.");
1660
1556
  }
@@ -1663,7 +1559,7 @@ function zt(e) {
1663
1559
  function $(e) {
1664
1560
  return e == null || e === "" || Number.isNaN(e);
1665
1561
  }
1666
- var Bt = {
1562
+ var jt = {
1667
1563
  default: (e, t) => $(e) ? String(t ?? "") : String(e),
1668
1564
  append: (e, t) => t && !$(e) ? `${e} ${t}` : e,
1669
1565
  prepend: (e, t) => t && !$(e) ? `${t} ${e}` : e,
@@ -1684,24 +1580,24 @@ var Bt = {
1684
1580
  return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
1685
1581
  }
1686
1582
  };
1687
- function Vt(e) {
1583
+ function Mt(e) {
1688
1584
  return typeof e == "object" && !!e;
1689
1585
  }
1690
- function Ht(e, t) {
1586
+ function Nt(e, t) {
1691
1587
  let n = t;
1692
- for (let t of e.split(".")) if (Vt(n) && t in n) n = n[t];
1588
+ for (let t of e.split(".")) if (Mt(n) && t in n) n = n[t];
1693
1589
  else return;
1694
1590
  return typeof n == "function" ? n() : n;
1695
1591
  }
1696
- function Ut(e, t) {
1697
- let n = e.split("|").map((e) => e.trim()), r = Ht(n.shift() ?? "", t);
1592
+ function Pt(e, t) {
1593
+ let n = e.split("|").map((e) => e.trim()), r = Nt(n.shift() ?? "", t);
1698
1594
  for (let e of n) {
1699
- let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Bt[i];
1595
+ let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = jt[i];
1700
1596
  o && (r = o(r, a));
1701
1597
  }
1702
1598
  return $(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
1703
1599
  }
1704
- function Wt(e, t) {
1600
+ function Ft(e, t) {
1705
1601
  let n = "", r = 0;
1706
1602
  for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
1707
1603
  r += 2;
@@ -1713,61 +1609,61 @@ function Wt(e, t) {
1713
1609
  }
1714
1610
  i += e[r++];
1715
1611
  }
1716
- n += Ut(i.trim(), t);
1612
+ n += Pt(i.trim(), t);
1717
1613
  } else n += e[r++];
1718
1614
  return n;
1719
1615
  }
1720
1616
  //#endregion
1721
1617
  //#region src/picked.ts
1722
- var Gt = class {
1618
+ var It = class {
1723
1619
  static logger = r;
1724
1620
  options;
1725
1621
  dataSource = null;
1726
1622
  contentLoader;
1727
1623
  plugins = {};
1728
- eventBus = F();
1624
+ eventBus = P();
1729
1625
  events;
1730
1626
  projectId;
1731
1627
  apiUrl;
1732
1628
  dashboardUrl;
1733
1629
  documentationSiteUrl;
1734
- session = Ft();
1735
- searchParams = At();
1736
- history = Qe();
1737
- components = Se({ client: this });
1738
- experienceInstances = C({ client: this });
1739
- experiences = me({ client: this });
1740
- frameworks = Ee({ client: this });
1741
- predicates = We({ client: this });
1742
- features = Je({ client: this });
1743
- conditions = Ot();
1744
- fields = rt();
1745
- responses = Tt({ client: this });
1746
- steps = ot();
1747
- contents = ut();
1748
- actions = mt({ client: this });
1749
- conditionResults = w();
1750
- stateSnapshotStore = ke({ client: this });
1751
- evaluateRuleLogicFx = Ie({ client: this });
1630
+ session = Et();
1631
+ searchParams = xt();
1632
+ history = Ue();
1633
+ components = he({ client: this });
1634
+ experienceInstances = S({ client: this });
1635
+ experiences = se({ client: this });
1636
+ frameworks = ve({ client: this });
1637
+ predicates = Ie({ client: this });
1638
+ features = ze({ client: this });
1639
+ conditions = yt();
1640
+ fields = Je();
1641
+ responses = gt({ client: this });
1642
+ steps = Ze();
1643
+ contents = tt();
1644
+ actions = at({ client: this });
1645
+ conditionResults = C();
1646
+ stateSnapshotStore = xe({ client: this });
1647
+ evaluateRuleLogicFx = Oe({ client: this });
1752
1648
  start;
1753
1649
  readyStore;
1754
1650
  preconditionPassedStore;
1755
1651
  conditionPassedStore;
1756
1652
  lifecycleStageStore;
1757
- lifecycle = Ve({ client: this });
1758
- renderStringFx = A({
1653
+ lifecycle = Ne({ client: this });
1654
+ renderStringFx = k({
1759
1655
  source: this.responses.listStore,
1760
1656
  effect: (e, { template: t, context: n }) => {
1761
1657
  let r = {};
1762
1658
  for (let t of e) r[t.fieldKey] = t.value;
1763
- return Wt(t, {
1659
+ return Ft(t, {
1764
1660
  ...n,
1765
1661
  responses: r
1766
1662
  });
1767
1663
  }
1768
1664
  });
1769
1665
  constructor(e) {
1770
- this.events = et(this.eventBus), this.projectId = zt(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || kt(), 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({
1666
+ this.events = Ge(this.eventBus), this.projectId = At(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || bt(), 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({
1771
1667
  type: "load",
1772
1668
  version: ne()
1773
1669
  }), this.maybeStartPreviewBridge();
@@ -1776,21 +1672,21 @@ var Gt = class {
1776
1672
  !s() || !h() || this.searchParams["preview-token"]?.[0] && import("../preview-bridge-D76l-dPy.js").then((e) => e.initPreviewBridge()).catch(() => void 0);
1777
1673
  }
1778
1674
  registerFramework = (e) => {
1779
- De(e, this.frameworks);
1675
+ ye(e, this.frameworks);
1780
1676
  };
1781
1677
  registerComponent = (e, t) => {
1782
- Ce(e, t, this.components);
1678
+ B(e, t, this.components);
1783
1679
  };
1784
1680
  registerPlugin = (e) => {
1785
- _e(this, e, this.plugins);
1681
+ ue(this, e, this.plugins);
1786
1682
  let t = this.plugins[e.name];
1787
1683
  t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
1788
1684
  };
1789
1685
  registerFeature = (e, t) => {
1790
- Ye(e, t, this.features);
1686
+ Be(e, t, this.features);
1791
1687
  };
1792
1688
  registerPredicate = (e, t) => {
1793
- Ge(e, t, this.predicates);
1689
+ Le(e, t, this.predicates);
1794
1690
  };
1795
1691
  registerCondition = (e) => {
1796
1692
  this.conditions.register(e);
@@ -1799,16 +1695,16 @@ var Gt = class {
1799
1695
  this.fields.register(e);
1800
1696
  };
1801
1697
  registerStep = (e) => {
1802
- st(e, this.steps);
1698
+ Qe(e, this.steps);
1803
1699
  };
1804
1700
  registerContent = (e) => {
1805
- dt(e, this.contents);
1701
+ nt(e, this.contents);
1806
1702
  };
1807
1703
  registerAction = (e, t) => {
1808
- ht(e, t, this.actions);
1704
+ ot(e, t, this.actions);
1809
1705
  };
1810
1706
  registerExperience = (e) => {
1811
- e.component && Ce(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
1707
+ e.component && B(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
1812
1708
  };
1813
1709
  launchExperienceById = async (e, t) => {
1814
1710
  this.experiences.launch({
@@ -1890,23 +1786,50 @@ var Gt = class {
1890
1786
  });
1891
1787
  }
1892
1788
  getPluginConfig = (e) => this.plugins[e] ?? {};
1893
- };
1789
+ }, Lt = "application/picked-javascript", Rt = "application/picked-module", zt = "data-picked-hydrated";
1790
+ async function Bt(e) {
1791
+ if (!("document" in globalThis)) return;
1792
+ let t = "application/picked-module", n = "data-picked-hydrated";
1793
+ function r(e, t) {
1794
+ let r = document.createElement("script");
1795
+ for (let t of Array.from(e.attributes)) t.name !== "type" && r.setAttribute(t.name, t.value);
1796
+ t && r.setAttribute("type", t), r.setAttribute(n, ""), e.src ? r.async = !1 : r.textContent = e.textContent;
1797
+ let i = e.src ? new Promise((e) => {
1798
+ r.addEventListener("load", () => e(), { once: !0 }), r.addEventListener("error", () => e(), { once: !0 });
1799
+ }) : null;
1800
+ return e.replaceWith(r), i;
1801
+ }
1802
+ let i = Array.from(e.querySelectorAll(`script[type="application/picked-javascript"]:not([${n}]), script[type="${t}"]:not([${n}])`)).filter((e) => e instanceof HTMLScriptElement);
1803
+ for (let e of i) {
1804
+ if (!e.isConnected) continue;
1805
+ let n = r(e, e.getAttribute("type") === t ? "module" : null);
1806
+ n && await n;
1807
+ }
1808
+ }
1809
+ function Vt() {
1810
+ return `<script>(${Bt.toString()})(document)<\/script>`;
1811
+ }
1812
+ //#endregion
1813
+ //#region src/utils/html-asset-value.ts
1814
+ function Ht(e) {
1815
+ return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
1816
+ }
1894
1817
  //#endregion
1895
1818
  //#region src/entities/component/lazyComponent.ts
1896
- function Kt(e) {
1819
+ function Ut(e) {
1897
1820
  return {
1898
1821
  $$type: "lazy-component",
1899
1822
  load: e
1900
1823
  };
1901
1824
  }
1902
- function qt(e) {
1825
+ function Wt(e) {
1903
1826
  return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
1904
1827
  }
1905
1828
  //#endregion
1906
1829
  //#region src/exports.ts
1907
- var Jt = (e) => {
1908
- let t = new Gt(e);
1830
+ var Gt = (e) => {
1831
+ let t = new It(e);
1909
1832
  return u(t), t;
1910
1833
  };
1911
1834
  //#endregion
1912
- export { Gt as Picked, Jt as createClient, ge as createPluginEffect, k as createStorageKey, n as evaluateRuleLogic, It as getPickedConfig, h as isInsideIframe, qt as isLazyLoader, b as isPickedRoot, Kt as lazyComponent, D as localStore, O as sessionStore, E as subscribe, d as supportsCookies, p as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, m as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, g as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow };
1835
+ export { zt as PICKED_HYDRATED_ATTR, Rt as PICKED_MODULE_SCRIPT_TYPE, Lt as PICKED_SCRIPT_TYPE, It as Picked, Vt as buildRehydrateBootstrap, Gt as createClient, le as createPluginEffect, O as createStorageKey, n as evaluateRuleLogic, Dt as getPickedConfig, Ht as isHtmlAssetValue, h as isInsideIframe, Wt as isLazyLoader, _ as isPickedRoot, Ut as lazyComponent, E as localStore, Bt as rehydrateScripts, D as sessionStore, T as subscribe, d as supportsCookies, p as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, m as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, g as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow };