@chaibuilder/sdk 1.2.93-beta.1 → 1.2.93-beta.2

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 (36) hide show
  1. package/dist/CodeEditor-oXzf_WM-.cjs +1 -0
  2. package/dist/{CodeEditor-_pniWL9A.js → CodeEditor-p-F-Bwyu.js} +17 -19
  3. package/dist/{Topbar-AzDg5F6n.js → Topbar-Ns8vNtP5.js} +11 -13
  4. package/dist/Topbar-RgbS4i_F.cjs +1 -0
  5. package/dist/{UnsplashImages-Gdm78EC5.js → UnsplashImages-Mc0XR9vF.js} +8 -10
  6. package/dist/UnsplashImages-pDkNL6f7.cjs +1 -0
  7. package/dist/{UploadImages-2XWy9JHd.js → UploadImages-BF4_7sIk.js} +55 -30
  8. package/dist/UploadImages-KUCb9y7z.cjs +1 -0
  9. package/dist/core.cjs +1 -1
  10. package/dist/core.js +70 -72
  11. package/dist/index-11fpvJA3.cjs +223 -0
  12. package/dist/{index-zgy8mVKm.js → index-UmpQEfVx.js} +8967 -7745
  13. package/dist/{plugin-BXpjdQxx.cjs → plugin-P0tpo_XZ.cjs} +1 -1
  14. package/dist/plugin-_F-KZp1i.cjs +1 -0
  15. package/dist/{plugin-DdKuAR7p.js → plugin-f5uJtdXY.js} +1 -1
  16. package/dist/plugin-sJ3Hzvpv.js +57 -0
  17. package/dist/render.cjs +2 -2
  18. package/dist/render.js +6 -7
  19. package/dist/tailwind.cjs +1 -1
  20. package/dist/tailwind.js +6 -7
  21. package/dist/web-blocks.cjs +1 -1
  22. package/dist/web-blocks.js +98 -100
  23. package/package.json +1 -1
  24. package/dist/CodeEditor-hbpcHA6a.cjs +0 -1
  25. package/dist/GlobalBlockSettings-1Ix883dP.cjs +0 -1
  26. package/dist/GlobalBlockSettings-eytCBAHr.js +0 -44
  27. package/dist/Topbar-0dGbwmC_.cjs +0 -1
  28. package/dist/UnsplashImages-etSQzJ6J.cjs +0 -1
  29. package/dist/UploadImages-lyC-Th50.cjs +0 -1
  30. package/dist/_commonjsHelpers-f3sTPFkQ.js +0 -8
  31. package/dist/_commonjsHelpers-f52AuuUj.cjs +0 -1
  32. package/dist/index-lynOzeB3.cjs +0 -223
  33. package/dist/plugin-02QsHeBE.cjs +0 -1
  34. package/dist/plugin-VDzc8jUO.js +0 -52
  35. package/dist/useGlobalBlocksStore-1wJUEOl4.cjs +0 -1
  36. package/dist/useGlobalBlocksStore-HlGhDxuV.js +0 -1258
@@ -1,1258 +0,0 @@
1
- import Qe, { createContext as et, useReducer as tt, useEffect as le, useDebugValue as ot, useCallback as N, useContext as nt, useState as st, useMemo as rt } from "react";
2
- import { find as Q, filter as H, flatten as Y, map as x, omit as ue, isString as xe, has as De, includes as ee, without as ct, get as $, compact as it, isObject as lt, each as q, set as pe, first as te, noop as ge, isEmpty as ut, keys as he, chunk as dt, forEach as at } from "lodash-es";
3
- import { atom as P, useAtomValue as J, useAtom as W } from "jotai";
4
- import { g as re } from "./iconBase-HBZkvN04.js";
5
- import { g as ft } from "./_commonjsHelpers-f3sTPFkQ.js";
6
- import { useThrottledCallback as pt } from "@react-hookz/web";
7
- import "react-i18next";
8
- import "@chaibuilder/runtime";
9
- import gt from "tree-model";
10
- var O = { VITE_OPENAI_API_KEY: "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", VITE_UNSPASH_ACCESS_KEY: "XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA", BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
11
- let ht = 0;
12
- function R(e, t) {
13
- const o = `atom${++ht}`, n = {
14
- toString: () => o
15
- };
16
- return typeof e == "function" ? n.read = e : (n.init = e, n.read = (s) => s(n), n.write = (s, r, c) => r(
17
- n,
18
- typeof c == "function" ? c(s(n)) : c
19
- )), t && (n.write = t), n;
20
- }
21
- const de = (e) => "init" in e, ae = (e) => !!e.write, ce = /* @__PURE__ */ new WeakMap(), mt = (e, t) => {
22
- ce.set(e, t), e.catch(() => {
23
- }).finally(() => ce.delete(e));
24
- }, ye = (e, t) => {
25
- const o = ce.get(e);
26
- o && (ce.delete(e), o(t));
27
- }, Pe = (e, t) => {
28
- e.status = "fulfilled", e.value = t;
29
- }, Le = (e, t) => {
30
- e.status = "rejected", e.reason = t;
31
- }, vt = (e) => typeof (e == null ? void 0 : e.then) == "function", K = (e, t) => "v" in e && "v" in t && Object.is(e.v, t.v), Ie = (e, t) => "e" in e && "e" in t && Object.is(e.e, t.e), z = (e) => "v" in e && e.v instanceof Promise, Bt = (e, t) => "v" in e && "v" in t && e.v.orig && e.v.orig === t.v.orig, se = (e) => {
32
- if ("e" in e)
33
- throw e.e;
34
- return e.v;
35
- }, kt = () => {
36
- const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new Map();
37
- let n, s, r;
38
- (O ? "production" : void 0) !== "production" && (n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set());
39
- const c = (i) => e.get(i), u = (i, a) => {
40
- (O ? "production" : void 0) !== "production" && Object.freeze(a);
41
- const g = e.get(i);
42
- if (e.set(i, a), o.has(i) || o.set(i, g), g && z(g)) {
43
- const f = "v" in a ? a.v instanceof Promise ? a.v : Promise.resolve(a.v) : Promise.reject(a.e);
44
- ye(g.v, f);
45
- }
46
- }, d = (i, a, g) => {
47
- const f = /* @__PURE__ */ new Map();
48
- let h = !1;
49
- g.forEach((p, v) => {
50
- !p && v === i && (p = a), p ? (f.set(v, p), a.d.get(v) !== p && (h = !0)) : (O ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
51
- }), (h || a.d.size !== f.size) && (a.d = f);
52
- }, l = (i, a, g) => {
53
- const f = c(i), h = {
54
- d: (f == null ? void 0 : f.d) || /* @__PURE__ */ new Map(),
55
- v: a
56
- };
57
- if (g && d(i, h, g), f && K(f, h) && f.d === h.d)
58
- return f;
59
- if (f && z(f) && z(h) && Bt(f, h)) {
60
- if (f.d === h.d)
61
- return f;
62
- h.v = f.v;
63
- }
64
- return u(i, h), h;
65
- }, m = (i, a, g, f) => {
66
- if (vt(a)) {
67
- let h;
68
- const p = new Promise((v, E) => {
69
- let k = !1;
70
- a.then(
71
- (_) => {
72
- if (!k) {
73
- k = !0;
74
- const b = c(i), j = l(
75
- i,
76
- p,
77
- g
78
- );
79
- Pe(p, _), v(_), (b == null ? void 0 : b.d) !== j.d && C(i, j, b == null ? void 0 : b.d);
80
- }
81
- },
82
- (_) => {
83
- if (!k) {
84
- k = !0;
85
- const b = c(i), j = l(
86
- i,
87
- p,
88
- g
89
- );
90
- Le(p, _), E(_), (b == null ? void 0 : b.d) !== j.d && C(i, j, b == null ? void 0 : b.d);
91
- }
92
- }
93
- ), h = (_) => {
94
- k || (k = !0, _.then(
95
- (b) => Pe(p, b),
96
- (b) => Le(p, b)
97
- ), v(_));
98
- };
99
- });
100
- return p.orig = a, p.status = "pending", mt(p, (v) => {
101
- v && h(v), f == null || f();
102
- }), l(i, p, g);
103
- }
104
- return l(i, a, g);
105
- }, I = (i, a, g) => {
106
- const f = c(i), h = {
107
- d: (f == null ? void 0 : f.d) || /* @__PURE__ */ new Map(),
108
- e: a
109
- };
110
- return g && d(i, h, g), f && Ie(f, h) && f.d === h.d ? f : (u(i, h), h);
111
- }, F = (i) => {
112
- const a = c(i);
113
- if (a && (a.d.forEach((k, _) => {
114
- _ !== i && !t.has(_) && F(_);
115
- }), Array.from(a.d).every(([k, _]) => {
116
- const b = c(k);
117
- return k === i || b === _ || // TODO This is a hack, we should find a better solution.
118
- b && !z(b) && K(b, _);
119
- })))
120
- return a;
121
- const g = /* @__PURE__ */ new Map();
122
- let f = !0;
123
- const h = (k) => {
124
- if (k === i) {
125
- const b = c(k);
126
- if (b)
127
- return g.set(k, b), se(b);
128
- if (de(k))
129
- return g.set(k, void 0), k.init;
130
- throw new Error("no atom init");
131
- }
132
- const _ = F(k);
133
- return g.set(k, _), se(_);
134
- };
135
- let p, v;
136
- const E = {
137
- get signal() {
138
- return p || (p = new AbortController()), p.signal;
139
- },
140
- get setSelf() {
141
- return (O ? "production" : void 0) !== "production" && !ae(i) && console.warn("setSelf function cannot be used with read-only atom"), !v && ae(i) && (v = (...k) => {
142
- if ((O ? "production" : void 0) !== "production" && f && console.warn("setSelf function cannot be called in sync"), !f)
143
- return S(i, ...k);
144
- }), v;
145
- }
146
- };
147
- try {
148
- const k = i.read(h, E);
149
- return m(
150
- i,
151
- k,
152
- g,
153
- () => p == null ? void 0 : p.abort()
154
- );
155
- } catch (k) {
156
- return I(i, k, g);
157
- } finally {
158
- f = !1;
159
- }
160
- }, U = (i) => se(F(i)), B = (i) => {
161
- let a = t.get(i);
162
- return a || (a = y(i)), a;
163
- }, A = (i, a) => !a.l.size && (!a.t.size || a.t.size === 1 && a.t.has(i)), L = (i) => {
164
- const a = t.get(i);
165
- a && A(i, a) && M(i);
166
- }, D = (i) => {
167
- const a = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new WeakMap(), f = (p) => {
168
- const v = t.get(p);
169
- v == null || v.t.forEach((E) => {
170
- E !== p && (a.set(
171
- E,
172
- (a.get(E) || /* @__PURE__ */ new Set()).add(p)
173
- ), g.set(E, (g.get(E) || 0) + 1), f(E));
174
- });
175
- };
176
- f(i);
177
- const h = (p) => {
178
- const v = t.get(p);
179
- v == null || v.t.forEach((E) => {
180
- var k;
181
- if (E !== p) {
182
- let _ = g.get(E);
183
- if (_ && g.set(E, --_), !_) {
184
- let b = !!((k = a.get(E)) != null && k.size);
185
- if (b) {
186
- const j = c(E), qe = F(E);
187
- b = !j || !K(j, qe);
188
- }
189
- b || a.forEach((j) => j.delete(E));
190
- }
191
- h(E);
192
- }
193
- });
194
- };
195
- h(i);
196
- }, w = (i, ...a) => {
197
- let g = !0;
198
- const f = (v) => se(F(v)), h = (v, ...E) => {
199
- let k;
200
- if (v === i) {
201
- if (!de(v))
202
- throw new Error("atom not writable");
203
- const _ = c(v), b = m(v, E[0]);
204
- (!_ || !K(_, b)) && D(v);
205
- } else
206
- k = w(v, ...E);
207
- if (!g) {
208
- const _ = V();
209
- (O ? "production" : void 0) !== "production" && s.forEach(
210
- (b) => b({ type: "async-write", flushed: _ })
211
- );
212
- }
213
- return k;
214
- }, p = i.write(f, h, ...a);
215
- return g = !1, p;
216
- }, S = (i, ...a) => {
217
- const g = w(i, ...a), f = V();
218
- return (O ? "production" : void 0) !== "production" && s.forEach(
219
- (h) => h({ type: "write", flushed: f })
220
- ), g;
221
- }, y = (i, a) => {
222
- const g = {
223
- t: new Set(a && [a]),
224
- l: /* @__PURE__ */ new Set()
225
- };
226
- if (t.set(i, g), (O ? "production" : void 0) !== "production" && r.add(i), F(i).d.forEach((f, h) => {
227
- const p = t.get(h);
228
- p ? p.t.add(i) : h !== i && y(h, i);
229
- }), F(i), ae(i) && i.onMount) {
230
- const f = i.onMount((...h) => S(i, ...h));
231
- f && (g.u = f);
232
- }
233
- return g;
234
- }, M = (i) => {
235
- var a;
236
- const g = (a = t.get(i)) == null ? void 0 : a.u;
237
- g && g(), t.delete(i), (O ? "production" : void 0) !== "production" && r.delete(i);
238
- const f = c(i);
239
- f ? (z(f) && ye(f.v), f.d.forEach((h, p) => {
240
- if (p !== i) {
241
- const v = t.get(p);
242
- v && (v.t.delete(i), A(p, v) && M(p));
243
- }
244
- })) : (O ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", i);
245
- }, C = (i, a, g) => {
246
- const f = new Set(a.d.keys());
247
- g == null || g.forEach((h, p) => {
248
- if (f.has(p)) {
249
- f.delete(p);
250
- return;
251
- }
252
- const v = t.get(p);
253
- v && (v.t.delete(i), A(p, v) && M(p));
254
- }), f.forEach((h) => {
255
- const p = t.get(h);
256
- p ? p.t.add(i) : t.has(i) && y(h, i);
257
- });
258
- }, V = () => {
259
- let i;
260
- for ((O ? "production" : void 0) !== "production" && (i = /* @__PURE__ */ new Set()); o.size; ) {
261
- const a = Array.from(o);
262
- o.clear(), a.forEach(([g, f]) => {
263
- const h = c(g);
264
- if (h) {
265
- h.d !== (f == null ? void 0 : f.d) && C(g, h, f == null ? void 0 : f.d);
266
- const p = t.get(g);
267
- p && !// TODO This seems pretty hacky. Hope to fix it.
268
- // Maybe we could `mountDependencies` in `setAtomState`?
269
- (f && !z(f) && (K(f, h) || Ie(f, h))) && (p.l.forEach((v) => v()), (O ? "production" : void 0) !== "production" && i.add(g));
270
- } else
271
- (O ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
272
- });
273
- }
274
- if ((O ? "production" : void 0) !== "production")
275
- return n.forEach((a) => a("state")), i;
276
- }, T = (i, a) => {
277
- const g = B(i), f = V(), h = g.l;
278
- return h.add(a), (O ? "production" : void 0) !== "production" && (n.forEach((p) => p("sub")), s.forEach(
279
- (p) => p({ type: "sub", flushed: f })
280
- )), () => {
281
- h.delete(a), L(i), (O ? "production" : void 0) !== "production" && (n.forEach((p) => p("unsub")), s.forEach((p) => p({ type: "unsub" })));
282
- };
283
- };
284
- return (O ? "production" : void 0) !== "production" ? {
285
- get: U,
286
- set: S,
287
- sub: T,
288
- // store dev methods (these are tentative and subject to change without notice)
289
- dev_subscribe_store: (i, a) => a !== 2 ? (console.warn(
290
- "The current StoreListener revision is 2. The older ones are deprecated."
291
- ), n.add(i), () => {
292
- n.delete(i);
293
- }) : (s.add(i), () => {
294
- s.delete(i);
295
- }),
296
- dev_get_mounted_atoms: () => r.values(),
297
- dev_get_atom_state: (i) => e.get(i),
298
- dev_get_mounted: (i) => t.get(i),
299
- dev_restore_atoms: (i) => {
300
- for (const [g, f] of i)
301
- de(g) && (m(g, f), D(g));
302
- const a = V();
303
- s.forEach(
304
- (g) => g({ type: "restore", flushed: a })
305
- );
306
- }
307
- } : {
308
- get: U,
309
- set: S,
310
- sub: T
311
- };
312
- };
313
- let fe;
314
- const bt = () => (fe || (fe = kt()), fe);
315
- var Be = { VITE_OPENAI_API_KEY: "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", VITE_UNSPASH_ACCESS_KEY: "XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA", BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
316
- const Te = Symbol(), Ce = (e, t, o) => (t.has(o) ? t : t.set(o, e())).get(o), _t = /* @__PURE__ */ new WeakMap(), At = (e, t, o) => {
317
- const n = Ce(() => /* @__PURE__ */ new WeakMap(), _t, t);
318
- return Ce(e, n, o);
319
- }, St = {}, Oe = (e) => !!e.write, wt = (e) => typeof e == "function";
320
- function Et(e, t) {
321
- return At(
322
- () => {
323
- const o = /* @__PURE__ */ new WeakMap(), n = (c, u) => {
324
- let d = o.get(c);
325
- if (d)
326
- return d;
327
- const l = u && o.get(u), m = [], I = [];
328
- return c.forEach((F, U) => {
329
- const B = t ? t(F) : U;
330
- I[U] = B;
331
- const A = l && l.atomList[l.keyList.indexOf(B)];
332
- if (A) {
333
- m[U] = A;
334
- return;
335
- }
336
- const L = (w) => {
337
- const S = w(s), y = w(e), C = n(y, S == null ? void 0 : S.arr).keyList.indexOf(B);
338
- if (C < 0 || C >= y.length) {
339
- const V = c[n(c).keyList.indexOf(B)];
340
- if (V)
341
- return V;
342
- throw new Error("splitAtom: index out of bounds for read");
343
- }
344
- return y[C];
345
- }, D = (w, S, y) => {
346
- const M = w(s), C = w(e), T = n(C, M == null ? void 0 : M.arr).keyList.indexOf(B);
347
- if (T < 0 || T >= C.length)
348
- throw new Error("splitAtom: index out of bounds for write");
349
- const i = wt(y) ? y(C[T]) : y;
350
- S(e, [
351
- ...C.slice(0, T),
352
- i,
353
- ...C.slice(T + 1)
354
- ]);
355
- };
356
- m[U] = Oe(e) ? R(L, D) : R(L);
357
- }), l && l.keyList.length === I.length && l.keyList.every((F, U) => F === I[U]) ? d = l : d = { arr: c, atomList: m, keyList: I }, o.set(c, d), d;
358
- }, s = R((c) => {
359
- const u = c(s), d = c(e);
360
- return n(d, u == null ? void 0 : u.arr);
361
- });
362
- (Be ? "production" : void 0) !== "production" && (s.debugPrivate = !0), s.init = void 0;
363
- const r = Oe(e) ? R(
364
- (c) => c(s).atomList,
365
- (c, u, d) => {
366
- switch (d.type) {
367
- case "remove": {
368
- const l = c(r).indexOf(d.atom);
369
- if (l >= 0) {
370
- const m = c(e);
371
- u(e, [
372
- ...m.slice(0, l),
373
- ...m.slice(l + 1)
374
- ]);
375
- }
376
- break;
377
- }
378
- case "insert": {
379
- const l = d.before ? c(r).indexOf(d.before) : c(r).length;
380
- if (l >= 0) {
381
- const m = c(e);
382
- u(e, [
383
- ...m.slice(0, l),
384
- d.value,
385
- ...m.slice(l)
386
- ]);
387
- }
388
- break;
389
- }
390
- case "move": {
391
- const l = c(r).indexOf(d.atom), m = d.before ? c(r).indexOf(d.before) : c(r).length;
392
- if (l >= 0 && m >= 0) {
393
- const I = c(e);
394
- l < m ? u(e, [
395
- ...I.slice(0, l),
396
- ...I.slice(l + 1, m),
397
- I[l],
398
- ...I.slice(m)
399
- ]) : u(e, [
400
- ...I.slice(0, m),
401
- I[l],
402
- ...I.slice(m, l),
403
- ...I.slice(l + 1)
404
- ]);
405
- }
406
- break;
407
- }
408
- }
409
- }
410
- ) : R((c) => c(s).atomList);
411
- return r;
412
- },
413
- e,
414
- t || St
415
- );
416
- }
417
- function So(e) {
418
- const t = Symbol(), o = R(t);
419
- (Be ? "production" : void 0) !== "production" && (o.debugPrivate = !0);
420
- const n = R(
421
- (s, r) => {
422
- const c = s(o);
423
- return c !== t ? c : e(s, r);
424
- },
425
- (s, r, c) => {
426
- if (c === Te)
427
- r(o, t);
428
- else if (typeof c == "function") {
429
- const u = s(n);
430
- r(o, c(u));
431
- } else
432
- r(o, c);
433
- }
434
- );
435
- return n;
436
- }
437
- const yt = (e) => typeof (e == null ? void 0 : e.then) == "function";
438
- function Pt(e) {
439
- let t, o;
440
- const n = {
441
- getItem: (s, r) => {
442
- var c, u;
443
- const d = (m) => {
444
- if (m = m || "", t !== m) {
445
- try {
446
- o = JSON.parse(m);
447
- } catch {
448
- return r;
449
- }
450
- t = m;
451
- }
452
- return o;
453
- }, l = (u = (c = e()) == null ? void 0 : c.getItem(s)) != null ? u : null;
454
- return yt(l) ? l.then(d) : d(l);
455
- },
456
- setItem: (s, r) => {
457
- var c;
458
- return (c = e()) == null ? void 0 : c.setItem(s, JSON.stringify(r));
459
- },
460
- removeItem: (s) => {
461
- var r;
462
- return (r = e()) == null ? void 0 : r.removeItem(s);
463
- }
464
- };
465
- return typeof window < "u" && typeof window.addEventListener == "function" && (n.subscribe = (s, r, c) => {
466
- if (!(e() instanceof window.Storage))
467
- return () => {
468
- };
469
- const u = (d) => {
470
- if (d.storageArea === e() && d.key === s) {
471
- let l;
472
- try {
473
- l = JSON.parse(d.newValue || "");
474
- } catch {
475
- l = c;
476
- }
477
- r(l);
478
- }
479
- };
480
- return window.addEventListener("storage", u), () => {
481
- window.removeEventListener("storage", u);
482
- };
483
- }), n;
484
- }
485
- const Lt = Pt(
486
- () => typeof window < "u" ? window.localStorage : void 0
487
- );
488
- function It(e, t, o = Lt, n) {
489
- const s = n == null ? void 0 : n.unstable_getOnInit, r = R(
490
- s ? o.getItem(e, t) : t
491
- );
492
- return (Be ? "production" : void 0) !== "production" && (r.debugPrivate = !0), r.onMount = (u) => {
493
- s || u(o.getItem(e, t));
494
- let d;
495
- return o.subscribe && (d = o.subscribe(e, u, t)), d;
496
- }, R(
497
- (u) => u(r),
498
- (u, d, l) => {
499
- const m = typeof l == "function" ? l(u(r)) : l;
500
- return m === Te ? (d(r, t), o.removeItem(e)) : m instanceof Promise ? m.then((I) => (d(r, I), o.setItem(e, I))) : (d(r, m), o.setItem(e, m));
501
- }
502
- );
503
- }
504
- var Ct = { VITE_OPENAI_API_KEY: "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", VITE_UNSPASH_ACCESS_KEY: "XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA", BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
505
- const Ot = et(void 0), Fe = (e) => {
506
- const t = nt(Ot);
507
- return (e == null ? void 0 : e.store) || t || bt();
508
- }, Mt = (e) => typeof (e == null ? void 0 : e.then) == "function", xt = Qe.use || ((e) => {
509
- if (e.status === "pending")
510
- throw e;
511
- if (e.status === "fulfilled")
512
- return e.value;
513
- throw e.status === "rejected" ? e.reason : (e.status = "pending", e.then(
514
- (t) => {
515
- e.status = "fulfilled", e.value = t;
516
- },
517
- (t) => {
518
- e.status = "rejected", e.reason = t;
519
- }
520
- ), e);
521
- });
522
- function Dt(e, t) {
523
- const o = Fe(t), [[n, s, r], c] = tt(
524
- (l) => {
525
- const m = o.get(e);
526
- return Object.is(l[0], m) && l[1] === o && l[2] === e ? l : [m, o, e];
527
- },
528
- void 0,
529
- () => [o.get(e), o, e]
530
- );
531
- let u = n;
532
- (s !== o || r !== e) && (c(), u = o.get(e));
533
- const d = t == null ? void 0 : t.delay;
534
- return le(() => {
535
- const l = o.sub(e, () => {
536
- if (typeof d == "number") {
537
- setTimeout(c, d);
538
- return;
539
- }
540
- c();
541
- });
542
- return c(), l;
543
- }, [o, e, d]), ot(u), Mt(u) ? xt(u) : u;
544
- }
545
- function Tt(e, t) {
546
- const o = Fe(t);
547
- return N(
548
- (...s) => {
549
- if ((Ct ? "production" : void 0) !== "production" && !("write" in e))
550
- throw new Error("not writable atom");
551
- return o.set(e, ...s);
552
- },
553
- [o, e]
554
- );
555
- }
556
- function ie(e, t) {
557
- return [
558
- Dt(e, t),
559
- // We do wrong type assertion here, which results in throwing an error.
560
- Tt(e, t)
561
- ];
562
- }
563
- function Re(e, t, o) {
564
- const n = H(e, (r) => r._parent === t), s = [];
565
- for (let r = 0; r < n.length; r++) {
566
- const c = Ue(n[r]);
567
- if (Object.keys(c).length > 0 && Object.keys(c).forEach((u) => {
568
- n[r][u] = `slot:${re()}`;
569
- }), H(e, { _parent: n[r]._id }).length > 0) {
570
- const u = re();
571
- s.push({ ...n[r], oldId: n[r]._id, _id: u, _parent: o }), s.push(Y(Re(e, n[r]._id, u)));
572
- } else
573
- s.push({
574
- ...n[r],
575
- oldId: n[r]._id,
576
- _id: re(),
577
- _parent: o
578
- });
579
- }
580
- return Y(s);
581
- }
582
- function Ne(e) {
583
- const t = {};
584
- e.forEach((n) => {
585
- t[n._id] = { ...n, children: [] };
586
- });
587
- const o = [];
588
- return e.forEach((n) => {
589
- if (n._parent) {
590
- const s = t[n._parent];
591
- s && s.children.push(t[n._id]);
592
- } else
593
- o.push(t[n._id]);
594
- }), o;
595
- }
596
- const Ue = (e) => {
597
- const t = {};
598
- return Object.keys(e).forEach((o) => {
599
- xe(e[o]) && e[o].startsWith("slot") && (t[o] = e[o].replace("slot:", ""));
600
- }), t;
601
- }, wo = (e, t, o = null) => {
602
- let n = Q(e, { _id: t });
603
- n = { ...n, oldId: n._id, _id: re() }, o && (n = { ...n, _parent: o });
604
- const s = [n];
605
- H(e, { _parent: t }).length > 0 && s.push(Y(Re(e, t, n._id)));
606
- const r = Y(s);
607
- return x(r, (c) => {
608
- const u = c, d = Ue(u);
609
- return Object.keys(d).length > 0 && Object.keys(d).forEach((l) => {
610
- const m = Q(r, { oldId: d[l].replace("slot:", "") });
611
- u[l] = `slot:${m._id}`;
612
- }), ue(u, ["global", "oldId"]);
613
- });
614
- }, X = P([]);
615
- X.debugLabel = "presentBlocksAtom";
616
- const Ft = P((e) => {
617
- const t = e(X);
618
- return Ne([...t]);
619
- });
620
- Ft.debugLabel = "treeDSBlocks";
621
- X.debugLabel = "presentBlocksAtom";
622
- const Rt = Et(X);
623
- Rt.debugLabel = "pageBlocksAtomsAtom";
624
- const Nt = P("");
625
- Nt.debugLabel = "builderActivePageAtom";
626
- const Ut = P(-1);
627
- Ut.debugLabel = "destinationDropIndexAtom";
628
- const Ve = P([]);
629
- Ve.debugLabel = "buildingBlocksAtom";
630
- const Vt = P((e) => {
631
- const t = e(Ve);
632
- return H(t, (o) => De(o, "blockId"));
633
- });
634
- Vt.debugLabel = "globalBlocksAtom";
635
- const ke = P([]);
636
- ke.debugLabel = "selectedBlockIdsAtom";
637
- const be = P((e) => {
638
- const t = e(X), o = e(ke);
639
- return x(
640
- H(t, ({ _id: n }) => ee(o, n)),
641
- (n) => ({ ...n })
642
- );
643
- });
644
- be.debugLabel = "selectedBlocksAtom";
645
- const _e = P((e) => {
646
- const t = e(be);
647
- if (t.length === 0)
648
- return null;
649
- if (t.length === 1)
650
- return t[0];
651
- });
652
- _e.debugLabel = "selectedBlockAtom";
653
- const jt = (e) => $(e, "_parent", null), Gt = P((e) => {
654
- const t = e(be), o = x(t, jt);
655
- return H(e(X), (n) => ee(o, n._id));
656
- });
657
- Gt.debugLabel = "selectedBlocksParentsAtom";
658
- const je = P(() => !1);
659
- je.debugLabel = "selectedBlockFlexChildAtom";
660
- const Ge = P(() => !1);
661
- Ge.debugLabel = "selectedBlockGridChildAtom";
662
- const Yt = P("");
663
- Yt.debugLabel = "styleStateAtom";
664
- const Ht = It("styleBreakpoint", "xs");
665
- Ht.debugLabel = "styleBreakpointAtom";
666
- const Eo = () => ({
667
- flexChild: J(je),
668
- gridChild: J(Ge)
669
- }), yo = () => J(_e), Xt = P((e) => {
670
- const t = e(_e), o = e(X);
671
- let n = t;
672
- const s = [t];
673
- do {
674
- const r = o.find(({ _id: c }) => c === (n == null ? void 0 : n._parent));
675
- n = r, r && s.push(r);
676
- } while (n != null && n._parent);
677
- return s;
678
- }), Po = () => it(J(Xt)), Wt = () => {
679
- const [e, t] = W(ke), o = N(
680
- (n) => {
681
- t((s) => ee(s, n) ? ct(s, n) : [...s, n]);
682
- },
683
- [t]
684
- );
685
- return [e, t, o];
686
- };
687
- var Ye = { exports: {} };
688
- (function(e) {
689
- (function() {
690
- function t(n, s, r) {
691
- return n.splice(
692
- s,
693
- !r || 1 + r - s + (!(r < 0 ^ s >= 0) && (r < 0 || -1) * n.length)
694
- ), n.length;
695
- }
696
- let o = function() {
697
- let n = [], s = -1, r = 0, c = !1, u;
698
- function d(l, m) {
699
- return !l || typeof l[m] != "function" ? this : (c = !0, l[m](), c = !1, this);
700
- }
701
- return {
702
- /**
703
- * Adds a command to the queue.
704
- * @property {object} command - Command
705
- * @property {function} command.undo - Undo function
706
- * @property {function} command.redo - Redo function
707
- * @property {string} [command.groupId] - Optional group id
708
- */
709
- add: function(l) {
710
- return c ? this : (n.splice(s + 1, n.length - s), n.push(l), r && n.length > r && t(n, 0, -(r + 1)), s = n.length - 1, u && u(), this);
711
- },
712
- /**
713
- * Pass a function to be called on undo and redo actions.
714
- * @property {function} callbackFunc - Callback function
715
- */
716
- setCallback: function(l) {
717
- u = l;
718
- },
719
- /**
720
- * Performs undo: call the undo function at the current index and decrease the index by 1.
721
- */
722
- undo: function() {
723
- let l = n[s];
724
- if (!l)
725
- return this;
726
- const m = l.groupId;
727
- for (; l.groupId === m && (d(l, "undo"), s -= 1, l = n[s], !(!l || !l.groupId)); )
728
- ;
729
- return u && u(), this;
730
- },
731
- /**
732
- * Performs redo: call the redo function at the next index and increase the index by 1.
733
- */
734
- redo: function() {
735
- let l = n[s + 1];
736
- if (!l)
737
- return this;
738
- const m = l.groupId;
739
- for (; l.groupId === m && (d(l, "redo"), s += 1, l = n[s + 1], !(!l || !l.groupId)); )
740
- ;
741
- return u && u(), this;
742
- },
743
- /**
744
- * Clears the memory, losing all stored states. Resets the index.
745
- */
746
- clear: function() {
747
- let l = n.length;
748
- n = [], s = -1, u && l > 0 && u();
749
- },
750
- /**
751
- * Tests if any undo actions exist.
752
- * @returns {boolean}
753
- */
754
- hasUndo: function() {
755
- return s !== -1;
756
- },
757
- /**
758
- * Tests if any redo actions exist.
759
- * @returns {boolean}
760
- */
761
- hasRedo: function() {
762
- return s < n.length - 1;
763
- },
764
- /**
765
- * Returns the list of queued commands.
766
- * @param {string} [groupId] - Optionally filter commands by group ID
767
- * @returns {array}
768
- */
769
- getCommands: function(l) {
770
- return l ? n.filter((m) => m.groupId === l) : n;
771
- },
772
- /**
773
- * Returns the index of the actions list.
774
- * @returns {number}
775
- */
776
- getIndex: function() {
777
- return s;
778
- },
779
- /**
780
- * Sets the maximum number of undo steps. Default: 0 (unlimited).
781
- * @property {number} max - Maximum number of undo steps
782
- */
783
- setLimit: function(l) {
784
- r = l;
785
- }
786
- };
787
- };
788
- e.exports ? e.exports = o : window.UndoManager = o;
789
- })();
790
- })(Ye);
791
- var zt = Ye.exports;
792
- const Jt = /* @__PURE__ */ ft(zt), Lo = [
793
- "hover",
794
- "focus",
795
- "focus-within",
796
- "focus-visible",
797
- "active",
798
- "visited",
799
- "target",
800
- "first",
801
- "last",
802
- "only",
803
- "odd",
804
- "even",
805
- "first-of-type",
806
- "last-of-type",
807
- "only-of-type",
808
- "empty",
809
- "disabled",
810
- "checked",
811
- "indeterminate",
812
- "default",
813
- "required",
814
- "valid",
815
- "invalid",
816
- "in-range",
817
- "out-of-range",
818
- "placeholder-shown",
819
- "autofill",
820
- "read-only",
821
- "open",
822
- "before",
823
- "after",
824
- "first-letter",
825
- "first-line",
826
- "marker",
827
- "selection",
828
- "file",
829
- "placeholder",
830
- // preline
831
- "hs-collapse-open",
832
- "hs-accordion-active"
833
- ], me = {
834
- bodyFont: "Inter",
835
- headingFont: "Inter",
836
- roundedCorners: 5,
837
- primaryColor: "#570df8",
838
- secondaryColor: "#f002b8",
839
- bodyBgDarkColor: "#031022",
840
- bodyBgLightColor: "#fcfcfc",
841
- bodyTextDarkColor: "#ffffff",
842
- bodyTextLightColor: "#000000"
843
- }, $t = P(me), Zt = P(null), He = () => {
844
- const [e, t] = W($t);
845
- return [
846
- lt(e) ? { ...me, ...e } : me,
847
- t
848
- ];
849
- }, Io = () => W(Zt), Kt = P(null), qt = () => ({ currentPage: J(Kt) });
850
- function Xe(e) {
851
- return Ne(e);
852
- }
853
- const Ae = (e, t) => Y(
854
- e.map((o) => {
855
- if (o = t ? { ...o, _parent: t } : { ...o }, o.children) {
856
- const n = [...o.children];
857
- return delete o.children, Y([o, ...Ae(n, o._id)]);
858
- }
859
- return o;
860
- })
861
- );
862
- function Se(e, t = !1) {
863
- for (let o = 0; o < e.length; o++) {
864
- const n = e[o];
865
- n.global && !t ? e[o] = {
866
- type: "GlobalBlock",
867
- blockId: n.blockId,
868
- _parent: $(n, "_parent", null),
869
- _id: n._id
870
- } : n.children && n.children.length && Se(n.children);
871
- }
872
- }
873
- function We(e) {
874
- let t = [], o = H(e, { type: "GlobalBlock" });
875
- return o.length > 0 && (o = x(o, ze), q(o, (n) => {
876
- t = [...t, ...Qt(n)];
877
- })), t;
878
- }
879
- function Qt(e) {
880
- let t = [];
881
- const o = $(te(e), "_parent", null);
882
- pe(te(e), "_parent", null);
883
- const n = [flatToNestedInstance.convert(Je(e))];
884
- Se(n, !0);
885
- let s = Ae(n, e[0]._id);
886
- return s = pe(s, "0._parent", o), t = [...t, s, ...We(s)], t;
887
- }
888
- function ze(e) {
889
- const t = Q(ve, { _id: e._id });
890
- if (!t)
891
- return [];
892
- const o = [t], n = H(ve, { _parent: e._id });
893
- return n.length ? Y([...o, ...Y(x(n, ze))]) : Y(o);
894
- }
895
- const Je = (e) => JSON.parse(JSON.stringify(e));
896
- let ve = [];
897
- function eo(e) {
898
- ve = e;
899
- const t = Xe(Je(e));
900
- Se(t);
901
- const o = Ae(t, null), n = We(o), s = {};
902
- return q(n, (r) => pe(s, te(r).blockId, r)), [o, s];
903
- }
904
- const to = () => {
905
- const [e] = He(), { currentPage: t } = qt(), [o] = ne();
906
- return N(() => {
907
- const n = x(
908
- o,
909
- (r) => ue(r, ["expanded", "order", "title", "siblings", "tempClasses"])
910
- ), [s = []] = eo(n);
911
- return {
912
- currentPage: t,
913
- blocks: s
914
- };
915
- }, [e, t, o]);
916
- }, $e = P(null);
917
- $e.debugLabel = "chaiBuilderPropsAtom";
918
- const oo = P({});
919
- oo.debugLabel = "chaiExternalDataAtom";
920
- const oe = (e, t = void 0) => {
921
- const o = J($e);
922
- return $(o, e, t);
923
- }, Ze = P([]);
924
- Ze.debugLabel = "dataProvidersAtom";
925
- const no = () => W(Ze), we = P("SAVED");
926
- we.debugLabel = "builderSaveStateAtom";
927
- const Co = () => {
928
- const [e, t] = W(we), o = oe("onSave", async (d) => {
929
- }), n = oe("onSaveStateChange", ge), s = to(), [r] = no(), [c] = He();
930
- return { savePage: pt(
931
- async () => {
932
- t("SAVING"), n("SAVING");
933
- const d = s();
934
- return await o({ blocks: d.blocks, providers: r, brandingOptions: c, themeConfiguration: c }), setTimeout(() => {
935
- t("SAVED"), n("SAVED");
936
- }, 100), !0;
937
- },
938
- [s, t, c, o, n],
939
- 3e3
940
- // save only every 5 seconds
941
- ), saveState: e, setSaveState: t };
942
- }, G = new Jt();
943
- G.setLimit(50);
944
- const so = () => {
945
- const [, e] = W(we), t = oe("onSaveStateChange", ge);
946
- return le(() => (G.setCallback(() => {
947
- e("UNSAVED"), t("UNSAVED");
948
- }), () => {
949
- G.setCallback(ge);
950
- }), []), {
951
- add: G.add,
952
- undo: G.undo,
953
- redo: G.redo,
954
- hasRedo: G.hasRedo,
955
- hasUndo: G.hasUndo,
956
- clear: G.clear
957
- };
958
- }, Ee = (e, t) => {
959
- const o = [], n = H(e, (s) => ee(t, s._id) || ee(t, s._parent) ? (o.push(s._id), !1) : !0);
960
- return ut(o) ? n : Ee(n, o);
961
- }, Oo = () => {
962
- const [e] = ne(), [t, o] = Wt(), { setNewBlocks: n } = Z();
963
- return N(
964
- (s) => {
965
- var c;
966
- const r = ((c = Q(e, { _id: s[0] })) == null ? void 0 : c._parent) || null;
967
- n(Ee(e, s)), setTimeout(() => o(r ? [r] : []), 200);
968
- },
969
- [e, o, t]
970
- );
971
- };
972
- function ro(e, t, o, n) {
973
- let s = e.filter((u) => !u._parent);
974
- o && (s = e.filter((u) => u._parent === o));
975
- const r = n !== void 0 ? n : s.length;
976
- let c = e.length;
977
- for (let u = 0, d = 0; u < e.length; u++)
978
- if (e[u]._parent === o) {
979
- if (d === r) {
980
- c = u;
981
- break;
982
- }
983
- d++;
984
- }
985
- return !o && n !== void 0 && n >= s.length && (c = e.length), [...e.slice(0, c), ...t, ...e.slice(c)];
986
- }
987
- function co(e) {
988
- let t = [];
989
- return e.walk((o) => (delete o.model.children, t.push(o.model), !0)), t;
990
- }
991
- function Me(e, t) {
992
- return e.first((o) => o.model._id === t) || null;
993
- }
994
- function io(e, t, o, n) {
995
- const s = Me(e, t), r = Me(e, o);
996
- if (s && r) {
997
- s.drop(), r.children || (r.model.children = []);
998
- try {
999
- r.addChildAtIndex(s, n);
1000
- } catch (c) {
1001
- return console.error("Error adding child to parent:", c), !1;
1002
- }
1003
- return !0;
1004
- }
1005
- return !1;
1006
- }
1007
- function lo(e, t, o, n) {
1008
- if (!t)
1009
- return e;
1010
- o = o || "root";
1011
- const r = new gt().parse({ _id: "root", children: Xe(e) });
1012
- if (io(r, t, o, n)) {
1013
- const c = co(r), u = c.find((d) => d._id === t);
1014
- return u && (u._parent = o === "root" ? null : o), c.shift(), c;
1015
- }
1016
- return e;
1017
- }
1018
- const uo = () => {
1019
- const [, e] = ne();
1020
- return {
1021
- setNewBlocks: (t) => {
1022
- e(t);
1023
- },
1024
- addBlocks: (t, o, n) => {
1025
- e((s) => ro(s, t, o, n));
1026
- },
1027
- removeBlocks: (t) => {
1028
- e((o) => Ee(o, t));
1029
- },
1030
- moveBlocks: (t, o, n) => {
1031
- e((s) => {
1032
- let r = s;
1033
- for (let c = 0; c < t.length; c++)
1034
- r = lo(r, t[c], o, n);
1035
- return r;
1036
- });
1037
- },
1038
- updateBlocksProps: (t) => {
1039
- e((o) => {
1040
- const n = t.map((s) => s._id);
1041
- return o.map((s) => {
1042
- if (n.includes(s._id)) {
1043
- const r = Q(t, { _id: s._id });
1044
- return { ...s, ...ue(r, "_id") };
1045
- }
1046
- return s;
1047
- });
1048
- });
1049
- }
1050
- };
1051
- }, ne = () => W(X), Z = () => {
1052
- const { add: e } = so(), [t] = ne(), {
1053
- setNewBlocks: o,
1054
- addBlocks: n,
1055
- removeBlocks: s,
1056
- moveBlocks: r,
1057
- updateBlocksProps: c
1058
- } = uo();
1059
- return {
1060
- moveBlocks: (B, A, L) => {
1061
- const D = x(B, (S) => {
1062
- const M = t.find((T) => T._id === S)._parent || null, V = t.filter((T) => M ? T._parent === M : !T._parent).map((T) => T._id).indexOf(S);
1063
- return { _id: S, oldParent: M, oldPosition: V };
1064
- }), w = D.find(({ _id: S }) => S === B[0]);
1065
- w && w.oldParent === A && w.oldPosition === L || (r(B, A, L), e({
1066
- undo: () => q(D, ({ _id: S, oldParent: y, oldPosition: M }) => {
1067
- r([S], y, M);
1068
- }),
1069
- redo: () => r(B, A, L)
1070
- }));
1071
- },
1072
- addBlocks: (B, A, L) => {
1073
- n(B, A, L), e({
1074
- undo: () => s(x(B, "_id")),
1075
- redo: () => n(B, A, L)
1076
- });
1077
- },
1078
- removeBlocks: (B) => {
1079
- var w;
1080
- const A = (w = te(B)) == null ? void 0 : w._parent, D = t.filter((S) => A ? S._parent === A : !S._parent).indexOf(te(B));
1081
- s(x(B, "_id")), e({
1082
- undo: () => n(B, A, D),
1083
- redo: () => s(x(B, "_id"))
1084
- });
1085
- },
1086
- updateBlocks: (B, A, L) => {
1087
- let D = [];
1088
- if (L)
1089
- D = x(B, (w) => ({ _id: w, ...L }));
1090
- else {
1091
- const w = he(A);
1092
- D = x(B, (S) => {
1093
- const y = t.find((C) => C._id === S), M = { _id: S };
1094
- return q(w, (C) => M[C] = y[C]), M;
1095
- });
1096
- }
1097
- c(x(B, (w) => ({ _id: w, ...A }))), e({
1098
- undo: () => c(D),
1099
- redo: () => c(x(B, (w) => ({ _id: w, ...A })))
1100
- });
1101
- },
1102
- updateBlocksRuntime: (B, A) => {
1103
- c(x(B, (L) => ({ _id: L, ...A })));
1104
- },
1105
- setNewBlocks: (B) => {
1106
- o(B), e({
1107
- undo: () => o(t),
1108
- redo: () => o(B)
1109
- });
1110
- },
1111
- updateMultipleBlocksProps: (B) => {
1112
- let A = [];
1113
- A = x(B, (L) => {
1114
- const D = he(L), w = t.find((y) => y._id === L._id), S = {};
1115
- return q(D, (y) => S[y] = w[y]), S;
1116
- }), c(B), e({
1117
- undo: () => c(A),
1118
- redo: () => c(B)
1119
- });
1120
- }
1121
- };
1122
- }, Mo = () => {
1123
- const { updateBlocks: e } = Z();
1124
- return N(
1125
- (t, o, n) => {
1126
- e(t, o, n);
1127
- },
1128
- [e]
1129
- );
1130
- }, xo = () => {
1131
- const { updateMultipleBlocksProps: e } = Z();
1132
- return N(
1133
- (t) => {
1134
- e(t);
1135
- },
1136
- [e]
1137
- );
1138
- }, ao = () => {
1139
- const { updateBlocksRuntime: e } = Z();
1140
- return N(
1141
- async (t, o, n = 30) => {
1142
- const s = he(ue(o, ["_id"]));
1143
- for (const r of s) {
1144
- const c = o[r];
1145
- if (xe(c)) {
1146
- const u = dt(c.split(""), 12);
1147
- let d = "";
1148
- e([t], { [r]: "" });
1149
- for (let l = 0; l < u.length; l++)
1150
- d += u[l].join(""), e([t], { [r]: d }), await new Promise((m) => setTimeout(m, n));
1151
- }
1152
- }
1153
- },
1154
- [e]
1155
- );
1156
- }, Do = () => {
1157
- const { updateMultipleBlocksProps: e } = Z(), t = ao();
1158
- return N(
1159
- async (o) => {
1160
- for (const n of o)
1161
- await t(n._id, n);
1162
- e(o);
1163
- },
1164
- [e]
1165
- );
1166
- }, To = () => {
1167
- const { updateBlocksRuntime: e } = Z();
1168
- return N(
1169
- (t, o) => {
1170
- e(t, o);
1171
- },
1172
- [e]
1173
- );
1174
- }, Ke = R({}), fo = R({}), Fo = () => {
1175
- const [e, t] = ie(Ke), o = N(
1176
- (s) => $(e, s == null ? void 0 : s.globalBlock, []),
1177
- [e]
1178
- ), n = N(() => {
1179
- t({});
1180
- }, [t]);
1181
- return { getGlobalBlocks: o, reset: n };
1182
- }, Ro = () => {
1183
- const [e] = ne(), [t, o] = ie(Ke), [n, s] = ie(fo), r = oe("getGlobalBlockBlocks", async (u) => []), c = rt(() => e.filter((d) => d._type === "GlobalBlock").filter((d) => d._type === "GlobalBlock").map((d) => d.globalBlock), [e]);
1184
- le(() => {
1185
- at(c, (u) => {
1186
- De(t, u) || $(n, `${u}.loading`, !1) || (s((d) => ({ ...d, [u]: { loading: !0, error: null } })), r(u).then((d) => {
1187
- o((l) => ({ ...l, [u]: d })), s((l) => ({
1188
- ...l,
1189
- [u]: { loading: !1, error: null }
1190
- }));
1191
- }).catch((d) => {
1192
- s((l) => ({
1193
- ...l,
1194
- [u]: { loading: !1, error: d.message }
1195
- }));
1196
- }));
1197
- });
1198
- }, [
1199
- r,
1200
- t,
1201
- c,
1202
- n,
1203
- o,
1204
- s
1205
- ]);
1206
- }, po = R({}), No = () => {
1207
- const [e, t] = st(!1), [o, n] = ie(po), s = oe("getGlobalBlocks", async () => []), r = N(async () => {
1208
- t(!0);
1209
- const c = await s();
1210
- n(c), t(!1);
1211
- }, [s, n]);
1212
- return le(() => {
1213
- r();
1214
- }, []), { data: o, isLoading: e, refetch: r };
1215
- };
1216
- export {
1217
- Eo as A,
1218
- Fe as B,
1219
- R as C,
1220
- So as D,
1221
- Dt as E,
1222
- Tt as F,
1223
- kt as G,
1224
- we as H,
1225
- Ro as I,
1226
- $e as J,
1227
- Ze as K,
1228
- Co as L,
1229
- Lo as M,
1230
- No as N,
1231
- qt as O,
1232
- Wt as a,
1233
- Z as b,
1234
- It as c,
1235
- X as d,
1236
- _e as e,
1237
- Yt as f,
1238
- wo as g,
1239
- so as h,
1240
- ie as i,
1241
- Fo as j,
1242
- oe as k,
1243
- Mo as l,
1244
- Oo as m,
1245
- He as n,
1246
- oo as o,
1247
- Rt as p,
1248
- no as q,
1249
- yo as r,
1250
- Ht as s,
1251
- Po as t,
1252
- ne as u,
1253
- Io as v,
1254
- Ft as w,
1255
- To as x,
1256
- Do as y,
1257
- xo as z
1258
- };