@chaibuilder/sdk 1.2.96 → 1.2.97

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.
@@ -8,7 +8,7 @@ import { S as Skeleton, B as Button, C as ContextMenu, a as ContextMenuTrigger,
8
8
  import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, chunk, forEach, throttle, memoize, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, cloneDeep, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
9
9
  import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
10
10
  import { g as generateUUID, a as getBreakpointValue, f, y, h, c as cn, G as GenIcon } from "./iconBase-HBZkvN04.js";
11
- import { getBlockComponent, getChaiDataProviders, useGlobalStylingPresets, useChaiBlocks, syncBlocksWithDefaults } from "@chaibuilder/runtime";
11
+ import { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
12
12
  import { useTranslation, initReactI18next } from "react-i18next";
13
13
  import { g as getDefaultExportFromCjs, p as plugin } from "./plugin-ooqqxWRQ.js";
14
14
  import { useThrottledCallback, useResizeObserver, useDebouncedCallback, useIntervalEffect } from "@react-hookz/web";
@@ -98,26 +98,26 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
98
98
  }
99
99
  }, u = (j, k, S) => {
100
100
  const R = /* @__PURE__ */ new Map();
101
- let T = !1;
101
+ let N = !1;
102
102
  S.forEach((D, $) => {
103
- !D && $ === j && (D = k), D ? (R.set($, D), k.d.get($) !== D && (T = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
- }), (T || k.d.size !== R.size) && (k.d = R);
103
+ !D && $ === j && (D = k), D ? (R.set($, D), k.d.get($) !== D && (N = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
+ }), (N || k.d.size !== R.size) && (k.d = R);
105
105
  }, p = (j, k, S) => {
106
- const R = c(j), T = {
106
+ const R = c(j), N = {
107
107
  d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
108
108
  v: k
109
109
  };
110
- if (S && u(j, T, S), R && isEqualAtomValue(R, T) && R.d === T.d)
110
+ if (S && u(j, N, S), R && isEqualAtomValue(R, N) && R.d === N.d)
111
111
  return R;
112
- if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(T) && isEqualPromiseAtomValue(R, T)) {
113
- if (R.d === T.d)
112
+ if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(N) && isEqualPromiseAtomValue(R, N)) {
113
+ if (R.d === N.d)
114
114
  return R;
115
- T.v = R.v;
115
+ N.v = R.v;
116
116
  }
117
- return d(j, T), T;
118
- }, g = (j, k, S, R) => {
117
+ return d(j, N), N;
118
+ }, m = (j, k, S, R) => {
119
119
  if (isPromiseLike$2(k)) {
120
- let T;
120
+ let N;
121
121
  const D = new Promise(($, H) => {
122
122
  let M = !1;
123
123
  k.then(
@@ -129,7 +129,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
129
129
  D,
130
130
  S
131
131
  );
132
- resolvePromise(D, V), $(V), (O == null ? void 0 : O.d) !== U.d && N(j, U, O == null ? void 0 : O.d);
132
+ resolvePromise(D, V), $(V), (O == null ? void 0 : O.d) !== U.d && T(j, U, O == null ? void 0 : O.d);
133
133
  }
134
134
  },
135
135
  (V) => {
@@ -140,10 +140,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
140
140
  D,
141
141
  S
142
142
  );
143
- rejectPromise(D, V), H(V), (O == null ? void 0 : O.d) !== U.d && N(j, U, O == null ? void 0 : O.d);
143
+ rejectPromise(D, V), H(V), (O == null ? void 0 : O.d) !== U.d && T(j, U, O == null ? void 0 : O.d);
144
144
  }
145
145
  }
146
- ), T = (V) => {
146
+ ), N = (V) => {
147
147
  M || (M = !0, V.then(
148
148
  (O) => resolvePromise(D, O),
149
149
  (O) => rejectPromise(D, O)
@@ -151,20 +151,20 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
151
151
  };
152
152
  });
153
153
  return D.orig = k, D.status = "pending", registerCancelPromise(D, ($) => {
154
- $ && T($), R == null || R();
154
+ $ && N($), R == null || R();
155
155
  }), p(j, D, S);
156
156
  }
157
157
  return p(j, k, S);
158
158
  }, x = (j, k, S) => {
159
- const R = c(j), T = {
159
+ const R = c(j), N = {
160
160
  d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
161
161
  e: k
162
162
  };
163
- return S && u(j, T, S), R && isEqualAtomError(R, T) && R.d === T.d ? R : (d(j, T), T);
164
- }, m = (j) => {
163
+ return S && u(j, N, S), R && isEqualAtomError(R, N) && R.d === N.d ? R : (d(j, N), N);
164
+ }, g = (j) => {
165
165
  const k = c(j);
166
166
  if (k && (k.d.forEach((M, V) => {
167
- V !== j && !n.has(V) && m(V);
167
+ V !== j && !n.has(V) && g(V);
168
168
  }), Array.from(k.d).every(([M, V]) => {
169
169
  const O = c(M);
170
170
  return M === j || O === V || // TODO This is a hack, we should find a better solution.
@@ -173,7 +173,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
173
173
  return k;
174
174
  const S = /* @__PURE__ */ new Map();
175
175
  let R = !0;
176
- const T = (M) => {
176
+ const N = (M) => {
177
177
  if (M === j) {
178
178
  const O = c(M);
179
179
  if (O)
@@ -182,7 +182,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
182
182
  return S.set(M, void 0), M.init;
183
183
  throw new Error("no atom init");
184
184
  }
185
- const V = m(M);
185
+ const V = g(M);
186
186
  return S.set(M, V), returnAtomValue(V);
187
187
  };
188
188
  let D, $;
@@ -198,8 +198,8 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
198
198
  }
199
199
  };
200
200
  try {
201
- const M = j.read(T, H);
202
- return g(
201
+ const M = j.read(N, H);
202
+ return m(
203
203
  j,
204
204
  M,
205
205
  S,
@@ -210,12 +210,12 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
210
210
  } finally {
211
211
  R = !1;
212
212
  }
213
- }, E = (j) => returnAtomValue(m(j)), b = (j) => {
213
+ }, _ = (j) => returnAtomValue(g(j)), b = (j) => {
214
214
  let k = n.get(j);
215
215
  return k || (k = w(j)), k;
216
- }, _ = (j, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(j)), v = (j) => {
216
+ }, E = (j, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(j)), v = (j) => {
217
217
  const k = n.get(j);
218
- k && _(j, k) && A(j);
218
+ k && E(j, k) && A(j);
219
219
  }, B = (j) => {
220
220
  const k = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new WeakMap(), R = (D) => {
221
221
  const $ = n.get(D);
@@ -227,7 +227,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
227
227
  });
228
228
  };
229
229
  R(j);
230
- const T = (D) => {
230
+ const N = (D) => {
231
231
  const $ = n.get(D);
232
232
  $ == null || $.t.forEach((H) => {
233
233
  var M;
@@ -236,24 +236,24 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
236
236
  if (V && S.set(H, --V), !V) {
237
237
  let O = !!((M = k.get(H)) != null && M.size);
238
238
  if (O) {
239
- const U = c(H), z = m(H);
239
+ const U = c(H), z = g(H);
240
240
  O = !U || !isEqualAtomValue(U, z);
241
241
  }
242
242
  O || k.forEach((U) => U.delete(H));
243
243
  }
244
- T(H);
244
+ N(H);
245
245
  }
246
246
  });
247
247
  };
248
- T(j);
248
+ N(j);
249
249
  }, C = (j, ...k) => {
250
250
  let S = !0;
251
- const R = ($) => returnAtomValue(m($)), T = ($, ...H) => {
251
+ const R = ($) => returnAtomValue(g($)), N = ($, ...H) => {
252
252
  let M;
253
253
  if ($ === j) {
254
254
  if (!hasInitialValue($))
255
255
  throw new Error("atom not writable");
256
- const V = c($), O = g($, H[0]);
256
+ const V = c($), O = m($, H[0]);
257
257
  (!V || !isEqualAtomValue(V, O)) && B($);
258
258
  } else
259
259
  M = C($, ...H);
@@ -264,23 +264,23 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
264
264
  );
265
265
  }
266
266
  return M;
267
- }, D = j.write(R, T, ...k);
267
+ }, D = j.write(R, N, ...k);
268
268
  return S = !1, D;
269
269
  }, I = (j, ...k) => {
270
270
  const S = C(j, ...k), R = P();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
- (T) => T({ type: "write", flushed: R })
272
+ (N) => N({ type: "write", flushed: R })
273
273
  ), S;
274
274
  }, w = (j, k) => {
275
275
  const S = {
276
276
  t: new Set(k && [k]),
277
277
  l: /* @__PURE__ */ new Set()
278
278
  };
279
- if (n.set(j, S), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(j), m(j).d.forEach((R, T) => {
280
- const D = n.get(T);
281
- D ? D.t.add(j) : T !== j && w(T, j);
282
- }), m(j), isActuallyWritableAtom(j) && j.onMount) {
283
- const R = j.onMount((...T) => I(j, ...T));
279
+ if (n.set(j, S), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(j), g(j).d.forEach((R, N) => {
280
+ const D = n.get(N);
281
+ D ? D.t.add(j) : N !== j && w(N, j);
282
+ }), g(j), isActuallyWritableAtom(j) && j.onMount) {
283
+ const R = j.onMount((...N) => I(j, ...N));
284
284
  R && (S.u = R);
285
285
  }
286
286
  return S;
@@ -289,37 +289,37 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
289
289
  const S = (k = n.get(j)) == null ? void 0 : k.u;
290
290
  S && S(), n.delete(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(j);
291
291
  const R = c(j);
292
- R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((T, D) => {
292
+ R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((N, D) => {
293
293
  if (D !== j) {
294
294
  const $ = n.get(D);
295
- $ && ($.t.delete(j), _(D, $) && A(D));
295
+ $ && ($.t.delete(j), E(D, $) && A(D));
296
296
  }
297
297
  })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", j);
298
- }, N = (j, k, S) => {
298
+ }, T = (j, k, S) => {
299
299
  const R = new Set(k.d.keys());
300
- S == null || S.forEach((T, D) => {
300
+ S == null || S.forEach((N, D) => {
301
301
  if (R.has(D)) {
302
302
  R.delete(D);
303
303
  return;
304
304
  }
305
305
  const $ = n.get(D);
306
- $ && ($.t.delete(j), _(D, $) && A(D));
307
- }), R.forEach((T) => {
308
- const D = n.get(T);
309
- D ? D.t.add(j) : n.has(j) && w(T, j);
306
+ $ && ($.t.delete(j), E(D, $) && A(D));
307
+ }), R.forEach((N) => {
308
+ const D = n.get(N);
309
+ D ? D.t.add(j) : n.has(j) && w(N, j);
310
310
  });
311
311
  }, P = () => {
312
312
  let j;
313
313
  for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (j = /* @__PURE__ */ new Set()); r.size; ) {
314
314
  const k = Array.from(r);
315
315
  r.clear(), k.forEach(([S, R]) => {
316
- const T = c(S);
317
- if (T) {
318
- T.d !== (R == null ? void 0 : R.d) && N(S, T, R == null ? void 0 : R.d);
316
+ const N = c(S);
317
+ if (N) {
318
+ N.d !== (R == null ? void 0 : R.d) && T(S, N, R == null ? void 0 : R.d);
319
319
  const D = n.get(S);
320
320
  D && !// TODO This seems pretty hacky. Hope to fix it.
321
321
  // Maybe we could `mountDependencies` in `setAtomState`?
322
- (R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, T) || isEqualAtomError(R, T))) && (D.l.forEach(($) => $()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && j.add(S));
322
+ (R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, N) || isEqualAtomError(R, N))) && (D.l.forEach(($) => $()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && j.add(S));
323
323
  } else
324
324
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
325
325
  });
@@ -327,15 +327,15 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
327
327
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
328
328
  return a.forEach((k) => k("state")), j;
329
329
  }, L = (j, k) => {
330
- const S = b(j), R = P(), T = S.l;
331
- return T.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((D) => D("sub")), l.forEach(
330
+ const S = b(j), R = P(), N = S.l;
331
+ return N.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((D) => D("sub")), l.forEach(
332
332
  (D) => D({ type: "sub", flushed: R })
333
333
  )), () => {
334
- T.delete(k), v(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((D) => D("unsub")), l.forEach((D) => D({ type: "unsub" })));
334
+ N.delete(k), v(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((D) => D("unsub")), l.forEach((D) => D({ type: "unsub" })));
335
335
  };
336
336
  };
337
337
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
338
- get: E,
338
+ get: _,
339
339
  set: I,
340
340
  sub: L,
341
341
  // store dev methods (these are tentative and subject to change without notice)
@@ -351,14 +351,14 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
351
351
  dev_get_mounted: (j) => n.get(j),
352
352
  dev_restore_atoms: (j) => {
353
353
  for (const [S, R] of j)
354
- hasInitialValue(S) && (g(S, R), B(S));
354
+ hasInitialValue(S) && (m(S, R), B(S));
355
355
  const k = P();
356
356
  l.forEach(
357
357
  (S) => S({ type: "restore", flushed: k })
358
358
  );
359
359
  }
360
360
  } : {
361
- get: E,
361
+ get: _,
362
362
  set: I,
363
363
  sub: L
364
364
  };
@@ -377,37 +377,37 @@ function splitAtom(o, n) {
377
377
  let u = r.get(c);
378
378
  if (u)
379
379
  return u;
380
- const p = d && r.get(d), g = [], x = [];
381
- return c.forEach((m, E) => {
382
- const b = n ? n(m) : E;
383
- x[E] = b;
384
- const _ = p && p.atomList[p.keyList.indexOf(b)];
385
- if (_) {
386
- g[E] = _;
380
+ const p = d && r.get(d), m = [], x = [];
381
+ return c.forEach((g, _) => {
382
+ const b = n ? n(g) : _;
383
+ x[_] = b;
384
+ const E = p && p.atomList[p.keyList.indexOf(b)];
385
+ if (E) {
386
+ m[_] = E;
387
387
  return;
388
388
  }
389
389
  const v = (C) => {
390
- const I = C(l), w = C(o), N = a(w, I == null ? void 0 : I.arr).keyList.indexOf(b);
391
- if (N < 0 || N >= w.length) {
390
+ const I = C(l), w = C(o), T = a(w, I == null ? void 0 : I.arr).keyList.indexOf(b);
391
+ if (T < 0 || T >= w.length) {
392
392
  const P = c[a(c).keyList.indexOf(b)];
393
393
  if (P)
394
394
  return P;
395
395
  throw new Error("splitAtom: index out of bounds for read");
396
396
  }
397
- return w[N];
397
+ return w[T];
398
398
  }, B = (C, I, w) => {
399
- const A = C(l), N = C(o), L = a(N, A == null ? void 0 : A.arr).keyList.indexOf(b);
400
- if (L < 0 || L >= N.length)
399
+ const A = C(l), T = C(o), L = a(T, A == null ? void 0 : A.arr).keyList.indexOf(b);
400
+ if (L < 0 || L >= T.length)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const j = isFunction(w) ? w(N[L]) : w;
402
+ const j = isFunction(w) ? w(T[L]) : w;
403
403
  I(o, [
404
- ...N.slice(0, L),
404
+ ...T.slice(0, L),
405
405
  j,
406
- ...N.slice(L + 1)
406
+ ...T.slice(L + 1)
407
407
  ]);
408
408
  };
409
- g[E] = isWritable(o) ? atom(v, B) : atom(v);
410
- }), p && p.keyList.length === x.length && p.keyList.every((m, E) => m === x[E]) ? u = p : u = { arr: c, atomList: g, keyList: x }, r.set(c, u), u;
409
+ m[_] = isWritable(o) ? atom(v, B) : atom(v);
410
+ }), p && p.keyList.length === x.length && p.keyList.every((g, _) => g === x[_]) ? u = p : u = { arr: c, atomList: m, keyList: x }, r.set(c, u), u;
411
411
  }, l = atom((c) => {
412
412
  const d = c(l), u = c(o);
413
413
  return a(u, d == null ? void 0 : d.arr);
@@ -420,10 +420,10 @@ function splitAtom(o, n) {
420
420
  case "remove": {
421
421
  const p = c(i).indexOf(u.atom);
422
422
  if (p >= 0) {
423
- const g = c(o);
423
+ const m = c(o);
424
424
  d(o, [
425
- ...g.slice(0, p),
426
- ...g.slice(p + 1)
425
+ ...m.slice(0, p),
426
+ ...m.slice(p + 1)
427
427
  ]);
428
428
  }
429
429
  break;
@@ -431,28 +431,28 @@ function splitAtom(o, n) {
431
431
  case "insert": {
432
432
  const p = u.before ? c(i).indexOf(u.before) : c(i).length;
433
433
  if (p >= 0) {
434
- const g = c(o);
434
+ const m = c(o);
435
435
  d(o, [
436
- ...g.slice(0, p),
436
+ ...m.slice(0, p),
437
437
  u.value,
438
- ...g.slice(p)
438
+ ...m.slice(p)
439
439
  ]);
440
440
  }
441
441
  break;
442
442
  }
443
443
  case "move": {
444
- const p = c(i).indexOf(u.atom), g = u.before ? c(i).indexOf(u.before) : c(i).length;
445
- if (p >= 0 && g >= 0) {
444
+ const p = c(i).indexOf(u.atom), m = u.before ? c(i).indexOf(u.before) : c(i).length;
445
+ if (p >= 0 && m >= 0) {
446
446
  const x = c(o);
447
- p < g ? d(o, [
447
+ p < m ? d(o, [
448
448
  ...x.slice(0, p),
449
- ...x.slice(p + 1, g),
449
+ ...x.slice(p + 1, m),
450
450
  x[p],
451
- ...x.slice(g)
451
+ ...x.slice(m)
452
452
  ]) : d(o, [
453
- ...x.slice(0, g),
453
+ ...x.slice(0, m),
454
454
  x[p],
455
- ...x.slice(g, p),
455
+ ...x.slice(m, p),
456
456
  ...x.slice(p + 1)
457
457
  ]);
458
458
  }
@@ -473,14 +473,14 @@ function createJSONStorage(o) {
473
473
  const a = {
474
474
  getItem: (l, i) => {
475
475
  var c, d;
476
- const u = (g) => {
477
- if (g = g || "", n !== g) {
476
+ const u = (m) => {
477
+ if (m = m || "", n !== m) {
478
478
  try {
479
- r = JSON.parse(g);
479
+ r = JSON.parse(m);
480
480
  } catch {
481
481
  return i;
482
482
  }
483
- n = g;
483
+ n = m;
484
484
  }
485
485
  return r;
486
486
  }, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
@@ -529,8 +529,8 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
529
529
  }, atom(
530
530
  (d) => d(i),
531
531
  (d, u, p) => {
532
- const g = typeof p == "function" ? p(d(i)) : p;
533
- return g === RESET ? (u(i, n), r.removeItem(o)) : g instanceof Promise ? g.then((x) => (u(i, x), r.setItem(o, x))) : (u(i, g), r.setItem(o, g));
532
+ const m = typeof p == "function" ? p(d(i)) : p;
533
+ return m === RESET ? (u(i, n), r.removeItem(o)) : m instanceof Promise ? m.then((x) => (u(i, x), r.setItem(o, x))) : (u(i, m), r.setItem(o, m));
534
534
  }
535
535
  );
536
536
  }
@@ -555,8 +555,8 @@ const StoreContext = createContext(void 0), useStore = (o) => {
555
555
  function useAtomValue(o, n) {
556
556
  const r = useStore(n), [[a, l, i], c] = useReducer(
557
557
  (p) => {
558
- const g = r.get(o);
559
- return Object.is(p[0], g) && p[1] === r && p[2] === o ? p : [g, r, o];
558
+ const m = r.get(o);
559
+ return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
560
560
  },
561
561
  void 0,
562
562
  () => [r.get(o), r, o]
@@ -640,8 +640,8 @@ const getSlots = (o) => {
640
640
  return map(i, (c) => {
641
641
  const d = c, u = getSlots(d);
642
642
  return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
643
- const g = find(i, { oldId: u[p].replace("slot:", "") });
644
- d[p] = `slot:${g._id}`;
643
+ const m = find(i, { oldId: u[p].replace("slot:", "") });
644
+ d[p] = `slot:${m._id}`;
645
645
  }), omit(d, ["global", "oldId"]);
646
646
  });
647
647
  }, presentBlocksAtom = atom$1([]);
@@ -759,8 +759,8 @@ const useSelectedBlocksDisplayChild = () => ({
759
759
  const p = r[u];
760
760
  if (includes(["slot", "styles"], p.type))
761
761
  return;
762
- const g = u;
763
- l.properties[g] = getBlockJSONFromSchemas(p, n);
762
+ const m = u;
763
+ l.properties[m] = getBlockJSONFromSchemas(p, n);
764
764
  }), l;
765
765
  case "list":
766
766
  const { itemProperties: i, title: c } = o, d = {
@@ -775,8 +775,8 @@ const useSelectedBlocksDisplayChild = () => ({
775
775
  const p = i[u];
776
776
  if (includes(["slot", "styles"], p.type))
777
777
  return;
778
- const g = u;
779
- d.items.properties[g] = getBlockJSONFromSchemas(p, n), set(d.items, "title", get(p, "itemTitle", `${n(c)} item`));
778
+ const m = u;
779
+ d.items.properties[m] = getBlockJSONFromSchemas(p, n), set(d.items, "title", get(p, "itemTitle", `${n(c)} item`));
780
780
  }), d;
781
781
  default:
782
782
  return {};
@@ -829,8 +829,8 @@ var undomanager = { exports: {} };
829
829
  }
830
830
  let r = function() {
831
831
  let a = [], l = -1, i = 0, c = !1, d;
832
- function u(p, g) {
833
- return !p || typeof p[g] != "function" ? this : (c = !0, p[g](), c = !1, this);
832
+ function u(p, m) {
833
+ return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
834
834
  }
835
835
  return {
836
836
  /**
@@ -857,8 +857,8 @@ var undomanager = { exports: {} };
857
857
  let p = a[l];
858
858
  if (!p)
859
859
  return this;
860
- const g = p.groupId;
861
- for (; p.groupId === g && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
860
+ const m = p.groupId;
861
+ for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
862
862
  ;
863
863
  return d && d(), this;
864
864
  },
@@ -869,8 +869,8 @@ var undomanager = { exports: {} };
869
869
  let p = a[l + 1];
870
870
  if (!p)
871
871
  return this;
872
- const g = p.groupId;
873
- for (; p.groupId === g && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
872
+ const m = p.groupId;
873
+ for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
874
874
  ;
875
875
  return d && d(), this;
876
876
  },
@@ -901,7 +901,7 @@ var undomanager = { exports: {} };
901
901
  * @returns {array}
902
902
  */
903
903
  getCommands: function(p) {
904
- return p ? a.filter((g) => g.groupId === p) : a;
904
+ return p ? a.filter((m) => m.groupId === p) : a;
905
905
  },
906
906
  /**
907
907
  * Returns the index of the actions list.
@@ -1191,50 +1191,50 @@ const useBlocksStoreManager = () => {
1191
1191
  updateBlocksProps: c
1192
1192
  } = useBlocksStoreManager();
1193
1193
  return {
1194
- moveBlocks: (b, _, v) => {
1194
+ moveBlocks: (b, E, v) => {
1195
1195
  const B = map(b, (I) => {
1196
1196
  const A = n.find((L) => L._id === I)._parent || null, P = n.filter((L) => A ? L._parent === A : !L._parent).map((L) => L._id).indexOf(I);
1197
1197
  return { _id: I, oldParent: A, oldPosition: P };
1198
1198
  }), C = B.find(({ _id: I }) => I === b[0]);
1199
- C && C.oldParent === _ && C.oldPosition === v || (i(b, _, v), o({
1199
+ C && C.oldParent === E && C.oldPosition === v || (i(b, E, v), o({
1200
1200
  undo: () => each(B, ({ _id: I, oldParent: w, oldPosition: A }) => {
1201
1201
  i([I], w, A);
1202
1202
  }),
1203
- redo: () => i(b, _, v)
1203
+ redo: () => i(b, E, v)
1204
1204
  }));
1205
1205
  },
1206
- addBlocks: (b, _, v) => {
1207
- a(b, _, v), o({
1206
+ addBlocks: (b, E, v) => {
1207
+ a(b, E, v), o({
1208
1208
  undo: () => l(map(b, "_id")),
1209
- redo: () => a(b, _, v)
1209
+ redo: () => a(b, E, v)
1210
1210
  });
1211
1211
  },
1212
1212
  removeBlocks: (b) => {
1213
1213
  var C;
1214
- const _ = (C = first(b)) == null ? void 0 : C._parent, B = n.filter((I) => _ ? I._parent === _ : !I._parent).indexOf(first(b));
1214
+ const E = (C = first(b)) == null ? void 0 : C._parent, B = n.filter((I) => E ? I._parent === E : !I._parent).indexOf(first(b));
1215
1215
  l(map(b, "_id")), o({
1216
- undo: () => a(b, _, B),
1216
+ undo: () => a(b, E, B),
1217
1217
  redo: () => l(map(b, "_id"))
1218
1218
  });
1219
1219
  },
1220
- updateBlocks: (b, _, v) => {
1220
+ updateBlocks: (b, E, v) => {
1221
1221
  let B = [];
1222
1222
  if (v)
1223
1223
  B = map(b, (C) => ({ _id: C, ...v }));
1224
1224
  else {
1225
- const C = keys(_);
1225
+ const C = keys(E);
1226
1226
  B = map(b, (I) => {
1227
- const w = n.find((N) => N._id === I), A = { _id: I };
1228
- return each(C, (N) => A[N] = w[N]), A;
1227
+ const w = n.find((T) => T._id === I), A = { _id: I };
1228
+ return each(C, (T) => A[T] = w[T]), A;
1229
1229
  });
1230
1230
  }
1231
- c(map(b, (C) => ({ _id: C, ..._ }))), o({
1231
+ c(map(b, (C) => ({ _id: C, ...E }))), o({
1232
1232
  undo: () => c(B),
1233
- redo: () => c(map(b, (C) => ({ _id: C, ..._ })))
1233
+ redo: () => c(map(b, (C) => ({ _id: C, ...E })))
1234
1234
  });
1235
1235
  },
1236
- updateBlocksRuntime: (b, _) => {
1237
- c(map(b, (v) => ({ _id: v, ..._ })));
1236
+ updateBlocksRuntime: (b, E) => {
1237
+ c(map(b, (v) => ({ _id: v, ...E })));
1238
1238
  },
1239
1239
  setNewBlocks: (b) => {
1240
1240
  r(b), o({
@@ -1243,12 +1243,12 @@ const useBlocksStoreManager = () => {
1243
1243
  });
1244
1244
  },
1245
1245
  updateMultipleBlocksProps: (b) => {
1246
- let _ = [];
1247
- _ = map(b, (v) => {
1246
+ let E = [];
1247
+ E = map(b, (v) => {
1248
1248
  const B = keys(v), C = n.find((w) => w._id === v._id), I = {};
1249
1249
  return each(B, (w) => I[w] = C[w]), I;
1250
1250
  }), c(b), o({
1251
- undo: () => c(_),
1251
+ undo: () => c(E),
1252
1252
  redo: () => c(b)
1253
1253
  });
1254
1254
  }
@@ -1256,17 +1256,17 @@ const useBlocksStoreManager = () => {
1256
1256
  }, useAddBlock = () => {
1257
1257
  const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
1258
1258
  (i, c, d) => {
1259
- var m;
1260
- for (let E = 0; E < i.length; E++) {
1261
- const { _id: b } = i[E];
1262
- i[E]._id = generateUUID();
1263
- const _ = filter(i, { _parent: b });
1264
- for (let v = 0; v < _.length; v++)
1265
- _[v]._parent = i[E]._id;
1259
+ var g;
1260
+ for (let _ = 0; _ < i.length; _++) {
1261
+ const { _id: b } = i[_];
1262
+ i[_]._id = generateUUID();
1263
+ const E = filter(i, { _parent: b });
1264
+ for (let v = 0; v < E.length; v++)
1265
+ E[v]._parent = i[_]._id;
1266
1266
  }
1267
1267
  const u = first(i);
1268
- let p, g;
1269
- return c && (p = find(o, { _id: c }), i[0]._parent = c, g = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, g = p._parent), r(i, g, d), n([(m = first(i)) == null ? void 0 : m._id]), first(i);
1268
+ let p, m;
1269
+ return c && (p = find(o, { _id: c }), i[0]._parent = c, m = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, m = p._parent), r(i, m, d), n([(g = first(i)) == null ? void 0 : g._id]), first(i);
1270
1270
  },
1271
1271
  [o, n]
1272
1272
  );
@@ -1276,11 +1276,11 @@ const useBlocksStoreManager = () => {
1276
1276
  const v = i.blocks;
1277
1277
  return a(v, c, d);
1278
1278
  }
1279
- const u = generateUUID(), p = getBlockDefaultProps(i.props), g = [];
1279
+ const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
1280
1280
  forIn(p, (v, B) => {
1281
1281
  if (startsWith(v, SLOT_KEY)) {
1282
1282
  const C = v.replace(SLOT_KEY, "");
1283
- g.push({
1283
+ m.push({
1284
1284
  _id: C,
1285
1285
  _type: "Slot",
1286
1286
  _parent: u,
@@ -1295,10 +1295,10 @@ const useBlocksStoreManager = () => {
1295
1295
  _id: u,
1296
1296
  ...p
1297
1297
  };
1298
- let m, E;
1299
- c && (m = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(m == null ? void 0 : m._type, x._type) && m && (x._parent = m._parent, E = m._parent);
1300
- const _ = [x, ...g];
1301
- return r(_, E, d), n([x._id]), x;
1298
+ let g, _;
1299
+ c && (g = find(o, { _id: c }), x._parent = c, _ = c), !canAcceptChildBlock(g == null ? void 0 : g._type, x._type) && g && (x._parent = g._parent, _ = g._parent);
1300
+ const E = [x, ...m];
1301
+ return r(E, _, d), n([x._id]), x;
1302
1302
  },
1303
1303
  [a, o, n]
1304
1304
  ), addPredefinedBlock: a };
@@ -2406,18 +2406,18 @@ function getNewClasses(o = "", n = "", r = []) {
2406
2406
  );
2407
2407
  const i = [], c = [];
2408
2408
  each(r, (p) => {
2409
- const g = constructClassObject(p), x = find(a, pick(g, ["dark", "mq", "mod", "property"]));
2409
+ const m = constructClassObject(p), x = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2410
2410
  if (x && (a = filter(
2411
2411
  a,
2412
- (m) => m.fullCls !== (x == null ? void 0 : x.fullCls)
2413
- )), i.push(g), g.mq === "xs" && !g.dark && g.mod === "" && (l = filter(l, (m) => m.property !== g.property)), getBelongsToForClass(a, g) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, g.property)) {
2414
- const m = find(l, pick(g, ["property"]));
2412
+ (g) => g.fullCls !== (x == null ? void 0 : x.fullCls)
2413
+ )), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (g) => g.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
2414
+ const g = find(l, pick(m, ["property"]));
2415
2415
  x && (l = filter(
2416
2416
  l,
2417
- (E) => E.fullCls !== (m == null ? void 0 : m.fullCls)
2417
+ (_) => _.fullCls !== (g == null ? void 0 : g.fullCls)
2418
2418
  )), c.push({
2419
- ...g,
2420
- fullCls: g.cls,
2419
+ ...m,
2420
+ fullCls: m.cls,
2421
2421
  mq: "xs"
2422
2422
  });
2423
2423
  }
@@ -2445,10 +2445,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2445
2445
  )
2446
2446
  ), i = first(o(selectedStylingBlocksAtom));
2447
2447
  return map(l, (c) => {
2448
- const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: g } = getSplitClasses$1(u);
2448
+ const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
2449
2449
  return {
2450
2450
  ids: [d._id],
2451
- props: { [i.prop]: `${STYLES_KEY}${getNewClasses(g, p, a)}` }
2451
+ props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
2452
2452
  };
2453
2453
  });
2454
2454
  }), useAddClassesToBlocks = () => {
@@ -2497,13 +2497,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2497
2497
  (a, l = null) => {
2498
2498
  const i = [];
2499
2499
  each(a, (c) => {
2500
- const d = o.find((m) => m._id === c);
2500
+ const d = o.find((g) => g._id === c);
2501
2501
  l || (l = d._parent);
2502
- const g = filter(
2502
+ const m = filter(
2503
2503
  o,
2504
- (m) => isString$1(l) ? m._parent === l : !d._parent
2504
+ (g) => isString$1(l) ? g._parent === l : !d._parent
2505
2505
  ).indexOf(d) + 1, x = getDuplicatedBlocks(o, c, l);
2506
- r(x, l, g), i.push(get(x, "0._id", ""));
2506
+ r(x, l, m), i.push(get(x, "0._id", ""));
2507
2507
  }), n(i);
2508
2508
  },
2509
2509
  [o, n]
@@ -2566,19 +2566,19 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2566
2566
  );
2567
2567
  return map(i, (c) => {
2568
2568
  const d = o(c), u = a;
2569
- let { classes: p, baseClasses: g } = getSplitClasses(get(d, l.prop, "styles:,"));
2569
+ let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2570
2570
  return each(u, (x) => {
2571
- const m = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${m}($| )`, "g");
2572
- p = p.replace(E, " ").replace(/ +/g, " ").trim();
2571
+ const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), _ = new RegExp(`(^| )${g}($| )`, "g");
2572
+ p = p.replace(_, " ").replace(/ +/g, " ").trim();
2573
2573
  const b = first(x.split(":"));
2574
2574
  includes(["2xl", "xl", "lg", "md", "sm"], b) && u.push(x.split(":").pop().trim());
2575
2575
  }), each(u, (x) => {
2576
- const m = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2577
- g = g.replace(m, " ").replace(/ +/g, " ").trim();
2576
+ const g = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2577
+ m = m.replace(g, " ").replace(/ +/g, " ").trim();
2578
2578
  }), {
2579
2579
  ids: [d._id],
2580
2580
  props: {
2581
- [l.prop]: `${STYLES_KEY}${g},${p}`
2581
+ [l.prop]: `${STYLES_KEY}${m},${p}`
2582
2582
  }
2583
2583
  };
2584
2584
  });
@@ -2655,7 +2655,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2655
2655
  let u = "";
2656
2656
  o([n], { [i]: "" });
2657
2657
  for (let p = 0; p < d.length; p++)
2658
- u += d[p].join(""), o([n], { [i]: u }), await new Promise((g) => setTimeout(g, a));
2658
+ u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
2659
2659
  }
2660
2660
  }
2661
2661
  },
@@ -2841,10 +2841,10 @@ const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}),
2841
2841
  if (c < n) {
2842
2842
  const u = parseFloat((c / n).toFixed(2).toString());
2843
2843
  let p = {};
2844
- const g = d * u, x = c * u;
2844
+ const m = d * u, x = c * u;
2845
2845
  d && (p = {
2846
2846
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
2847
- height: 100 + (d - g) / g * 100 + "%",
2847
+ height: 100 + (d - m) / m * 100 + "%",
2848
2848
  width: 100 + (c - x) / x * 100 + "%"
2849
2849
  }), l({
2850
2850
  position: "relative",
@@ -3029,14 +3029,14 @@ const useDnd = () => {
3029
3029
  };
3030
3030
  return iframeDocument = o, {
3031
3031
  isDragging: n,
3032
- onDragOver: (m) => {
3033
- m.preventDefault(), m.stopPropagation(), throttledDragOver(m);
3032
+ onDragOver: (g) => {
3033
+ g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
3034
3034
  },
3035
- onDrop: (m) => {
3035
+ onDrop: (g) => {
3036
3036
  var w;
3037
- const E = dropTarget, _ = getOrientation(E) === "vertical" ? m.clientY + ((w = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : w.scrollY) : m.clientX;
3038
- dropIndex = calculateDropIndex(_, possiblePositions);
3039
- const v = d, B = E.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3037
+ const _ = dropTarget, E = getOrientation(_) === "vertical" ? g.clientY + ((w = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : w.scrollY) : g.clientX;
3038
+ dropIndex = calculateDropIndex(E, possiblePositions);
3039
+ const v = d, B = _.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3040
3040
  if ((v == null ? void 0 : v._id) === B || !C) {
3041
3041
  x();
3042
3042
  return;
@@ -3045,17 +3045,17 @@ const useDnd = () => {
3045
3045
  a(v, B === "canvas" ? null : B, dropIndex), setTimeout(x, 300);
3046
3046
  return;
3047
3047
  }
3048
- let I = E.getAttribute("data-block-id");
3049
- I === null && (I = m.target.parentElement.getAttribute("data-block-id")), c([v._id], I === "canvas" ? null : I, dropIndex), x(), setTimeout(removePlaceholder, 300);
3048
+ let I = _.getAttribute("data-block-id");
3049
+ I === null && (I = g.target.parentElement.getAttribute("data-block-id")), c([v._id], I === "canvas" ? null : I, dropIndex), x(), setTimeout(removePlaceholder, 300);
3050
3050
  },
3051
- onDragEnter: (m) => {
3052
- const E = m, b = E.target;
3051
+ onDragEnter: (g) => {
3052
+ const _ = g, b = _.target;
3053
3053
  dropTarget = b;
3054
- const _ = b.getAttribute("data-block-id"), v = b.getAttribute("data-dnd-dragged") !== "yes";
3055
- p(_), E.stopPropagation(), E.preventDefault(), possiblePositions = [], v && calculatePossiblePositions(b), r(!0), l(""), i([]);
3054
+ const E = b.getAttribute("data-block-id"), v = b.getAttribute("data-dnd-dragged") !== "yes";
3055
+ p(E), _.stopPropagation(), _.preventDefault(), possiblePositions = [], v && calculatePossiblePositions(b), r(!0), l(""), i([]);
3056
3056
  },
3057
- onDragLeave: (m) => {
3058
- m.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3057
+ onDragLeave: (g) => {
3058
+ g.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3059
3059
  }
3060
3060
  };
3061
3061
  };
@@ -3077,16 +3077,16 @@ const useHandleCanvasDblClick = () => {
3077
3077
  if (!d || !o.includes(d))
3078
3078
  return;
3079
3079
  const u = c.cloneNode(!0);
3080
- c.style.display = "none", Array.from(u.attributes).forEach((m) => {
3081
- m.name !== "class" && u.removeAttribute(m.name);
3080
+ c.style.display = "none", Array.from(u.attributes).forEach((g) => {
3081
+ g.name !== "class" && u.removeAttribute(g.name);
3082
3082
  }), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
3083
3083
  const p = new Quill(u, { placeholder: "Type here..." });
3084
- function g() {
3085
- const m = p.getText(0, p.getLength());
3086
- n([c.getAttribute("data-block-id")], { content: m }), c.removeAttribute("style"), u.removeEventListener("blur", g, !0), destroyQuill(p), l(""), r("");
3084
+ function m() {
3085
+ const g = p.getText(0, p.getLength());
3086
+ n([c.getAttribute("data-block-id")], { content: g }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), l(""), r("");
3087
3087
  }
3088
- u.addEventListener("blur", g, !0), u.addEventListener("keydown", (m) => {
3089
- (m.key === "Enter" || m.key === "Escape") && g();
3088
+ u.addEventListener("blur", m, !0), u.addEventListener("keydown", (g) => {
3089
+ (g.key === "Enter" || g.key === "Escape") && m();
3090
3090
  }), p.focus(), (x = u.querySelector(".ql-clipboard")) == null || x.remove(), l(c.getAttribute("data-block-id"));
3091
3091
  };
3092
3092
  }, useHandleCanvasClick = () => {
@@ -3101,8 +3101,8 @@ const useHandleCanvasDblClick = () => {
3101
3101
  return;
3102
3102
  }
3103
3103
  if (d != null && d.getAttribute("data-block-parent")) {
3104
- const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
3105
- n.includes(g) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: g }]), r([g]);
3104
+ const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
3105
+ n.includes(m) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
3106
3106
  } else if (d != null && d.getAttribute("data-block-id")) {
3107
3107
  let u = d.getAttribute("data-block-id");
3108
3108
  n.includes(u) || i == null || i.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
@@ -3125,10 +3125,10 @@ const useHandleCanvasDblClick = () => {
3125
3125
  return;
3126
3126
  const p = getElementByDataBlockId(n, first(r));
3127
3127
  if (p) {
3128
- const g = p.getAttribute("data-style-prop");
3129
- if (g) {
3130
- const x = p.getAttribute("data-style-id"), m = p.getAttribute("data-block-parent");
3131
- l([{ id: x, prop: g, blockId: m }]);
3128
+ const m = p.getAttribute("data-style-prop");
3129
+ if (m) {
3130
+ const x = p.getAttribute("data-style-id"), g = p.getAttribute("data-block-parent");
3131
+ l([{ id: x, prop: m, blockId: g }]);
3132
3132
  }
3133
3133
  }
3134
3134
  }, 100);
@@ -3148,14 +3148,14 @@ const useHandleCanvasDblClick = () => {
3148
3148
  }
3149
3149
  );
3150
3150
  }, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
3151
- const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: g } = usePasteBlocks();
3151
+ const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
3152
3152
  useHotkeys("ctrl+z,command+z", () => i(), {}, [i]), useHotkeys("ctrl+y,command+y", () => c(), {}, [c]), useHotkeys("ctrl+x,command+x", () => d(n), {}, [n, d]), useHotkeys("ctrl+c,command+c", () => u(n), {}, [n, u]), useHotkeys(
3153
3153
  "ctrl+v,command+v",
3154
3154
  () => {
3155
- p(n[0]) && g(n);
3155
+ p(n[0]) && m(n);
3156
3156
  },
3157
3157
  {},
3158
- [n, p, g]
3158
+ [n, p, m]
3159
3159
  );
3160
3160
  const x = o ? { document: o } : {};
3161
3161
  useHotkeys("esc", () => r([]), x, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...x, preventDefault: !0 }, [
@@ -3163,8 +3163,8 @@ const useHandleCanvasDblClick = () => {
3163
3163
  l
3164
3164
  ]), useHotkeys(
3165
3165
  "del, backspace",
3166
- (m) => {
3167
- m.preventDefault(), a(n);
3166
+ (g) => {
3167
+ g.preventDefault(), a(n);
3168
3168
  },
3169
3169
  x,
3170
3170
  [n, a]
@@ -3195,15 +3195,15 @@ const useHandleCanvasDblClick = () => {
3195
3195
  }
3196
3196
  );
3197
3197
  }, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
3198
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: g } = useFloating({
3198
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
3199
3199
  placement: "top-start",
3200
3200
  middleware: [shift(), flip()],
3201
3201
  elements: {
3202
3202
  reference: o
3203
3203
  }
3204
3204
  });
3205
- useResizeObserver(o, () => g(), o !== null);
3206
- const x = get(n, "_parent", null), m = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3205
+ useResizeObserver(o, () => m(), o !== null);
3206
+ const x = get(n, "_parent", null), g = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3207
3207
  return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3208
3208
  "div",
3209
3209
  {
@@ -3211,13 +3211,13 @@ const useHandleCanvasDblClick = () => {
3211
3211
  tabIndex: 0,
3212
3212
  ref: p.setFloating,
3213
3213
  style: u,
3214
- onClick: (E) => {
3215
- E.stopPropagation(), E.preventDefault();
3214
+ onClick: (_) => {
3215
+ _.stopPropagation(), _.preventDefault();
3216
3216
  },
3217
- onMouseEnter: (E) => {
3218
- E.stopPropagation(), i(null);
3217
+ onMouseEnter: (_) => {
3218
+ _.stopPropagation(), i(null);
3219
3219
  },
3220
- onKeyDown: (E) => E.stopPropagation(),
3220
+ onKeyDown: (_) => _.stopPropagation(),
3221
3221
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
3222
3222
  children: [
3223
3223
  x && /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3229,7 +3229,7 @@ const useHandleCanvasDblClick = () => {
3229
3229
  }
3230
3230
  }
3231
3231
  ),
3232
- /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: m, block: n }),
3232
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: g, block: n }),
3233
3233
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
3234
3234
  canAddChildBlock(get(n, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3235
3235
  PlusIcon,
@@ -3252,19 +3252,19 @@ const useHandleCanvasDblClick = () => {
3252
3252
  }
3253
3253
  ) });
3254
3254
  }, HeadTags = ({ model: o }) => {
3255
- const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [g] = useState(u == null ? void 0 : u.getElementById("highlighted-block")), [x] = useState(
3255
+ const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [m] = useState(u == null ? void 0 : u.getElementById("highlighted-block")), [x] = useState(
3256
3256
  u == null ? void 0 : u.getElementById("selected-block")
3257
- ), [m] = useState(
3257
+ ), [g] = useState(
3258
3258
  u == null ? void 0 : u.getElementById("selected-styling-block")
3259
- ), [E] = useState(
3259
+ ), [_] = useState(
3260
3260
  u == null ? void 0 : u.getElementById("dragged-block")
3261
3261
  );
3262
3262
  useEffect(() => {
3263
3263
  a ? u == null || u.documentElement.classList.add("dark") : u == null || u.documentElement.classList.remove("dark");
3264
3264
  }, [a, u]);
3265
- const b = get(n, "headingFont", "DM Sans"), _ = get(n, "bodyFont", "DM Sans");
3265
+ const b = get(n, "headingFont", "DM Sans"), E = get(n, "bodyFont", "DM Sans");
3266
3266
  return useEffect(() => {
3267
- const v = get(n, "primaryColor", "#000"), B = get(n, "secondaryColor", "#FFF"), C = get(n, "bodyBgLightColor", "#fff"), I = get(n, "bodyBgDarkColor", "#000"), w = get(n, "bodyTextDarkColor", "#000"), A = get(n, "bodyTextLightColor", "#fff"), N = getPalette([
3267
+ const v = get(n, "primaryColor", "#000"), B = get(n, "secondaryColor", "#FFF"), C = get(n, "bodyBgLightColor", "#fff"), I = get(n, "bodyBgDarkColor", "#000"), w = get(n, "bodyTextDarkColor", "#000"), A = get(n, "bodyTextLightColor", "#fff"), T = getPalette([
3268
3268
  { color: v, name: "primary" },
3269
3269
  { color: B, name: "secondary" }
3270
3270
  ]), P = {
@@ -3286,12 +3286,12 @@ const useHandleCanvasDblClick = () => {
3286
3286
  },
3287
3287
  fontFamily: {
3288
3288
  heading: [b],
3289
- body: [_]
3289
+ body: [E]
3290
3290
  },
3291
3291
  borderRadius: {
3292
3292
  DEFAULT: `${L || "0"}px`
3293
3293
  },
3294
- colors: { ...P, ...N }
3294
+ colors: { ...P, ...T }
3295
3295
  }
3296
3296
  },
3297
3297
  plugins: [
@@ -3316,25 +3316,25 @@ const useHandleCanvasDblClick = () => {
3316
3316
  })
3317
3317
  ]
3318
3318
  });
3319
- }, [n, p, b, _]), useEffect(() => {
3319
+ }, [n, p, b, E]), useEffect(() => {
3320
3320
  x && (x.textContent = `${map(r, (v) => `[data-block-id="${v}"]`).join(",")}{
3321
3321
  outline: 1px solid ${r.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
3322
3322
  }`);
3323
3323
  }, [r, x]), useEffect(() => {
3324
- E.textContent = c ? `[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3325
- }, [c, E]), useEffect(() => {
3326
- g && (g.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
3327
- }, [l, r, g]), useEffect(() => {
3328
- m && (m.textContent = `${map(i, ({ id: v }) => `[data-style-id="${v}"]`).join(",")}{
3324
+ _.textContent = c ? `[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3325
+ }, [c, _]), useEffect(() => {
3326
+ m && (m.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
3327
+ }, [l, r, m]), useEffect(() => {
3328
+ g && (g.textContent = `${map(i, ({ id: v }) => `[data-style-id="${v}"]`).join(",")}{
3329
3329
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3330
3330
  }`);
3331
- }, [i, m]), useEffect(() => {
3331
+ }, [i, g]), useEffect(() => {
3332
3332
  u.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3333
- }, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (b || _) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3333
+ }, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (b || E) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3334
3334
  "link",
3335
3335
  {
3336
3336
  rel: "stylesheet",
3337
- href: `https://fonts.googleapis.com/css2?family=${b ? `${b.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${b && _ && b !== _ ? "&" : ""}${_ && _ !== b ? `family=${_.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
3337
+ href: `https://fonts.googleapis.com/css2?family=${b ? `${b.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${b && E && b !== E ? "&" : ""}${E && E !== b ? `family=${E.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
3338
3338
  }
3339
3339
  ) });
3340
3340
  }, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
@@ -3345,16 +3345,67 @@ const useHandleCanvasDblClick = () => {
3345
3345
  u || (u = d, d = "xs");
3346
3346
  const p = r.indexOf(d);
3347
3347
  if (p <= a) {
3348
- const g = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
3349
- if (g.includes(u))
3350
- for (let m = p; m < r.length; m++)
3351
- i[m] = !0;
3348
+ const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
3349
+ if (m.includes(u))
3350
+ for (let g = p; g < r.length; g++)
3351
+ i[g] = !0;
3352
3352
  else if (x.includes(u))
3353
- for (let m = p; m < r.length; m++)
3354
- i[m] = !1;
3353
+ for (let g = p; g < r.length; g++)
3354
+ i[g] = !1;
3355
3355
  }
3356
3356
  }
3357
3357
  return i[a];
3358
+ }, rscBlocksStoreAtom = atom({}), rscBlocksLoadingStateAtom = atom({}), useRSCBlocksStore = () => {
3359
+ const [o, n] = useAtom(rscBlocksStoreAtom), [r] = useAtom(rscBlocksLoadingStateAtom), a = useCallback(
3360
+ (c) => get(o, c == null ? void 0 : c._id, null),
3361
+ [o]
3362
+ ), l = useCallback(
3363
+ (c) => get(r, `${c}`, { loading: !1, error: null }),
3364
+ [r]
3365
+ ), i = useCallback(
3366
+ (c) => {
3367
+ n((d) => ({ ...d, [c]: "" }));
3368
+ },
3369
+ [n]
3370
+ );
3371
+ return { getRSCBlockMarkup: a, getRSCBlockState: l, reset: i };
3372
+ }, useWatchRSCBlocks = () => {
3373
+ const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (u) => ""), d = useMemo(() => o.filter((p) => {
3374
+ var x;
3375
+ return (x = get(i, p._type)) == null ? void 0 : x.server;
3376
+ }).map((p) => p._id), [i, o]);
3377
+ useEffect(() => {
3378
+ forEach(d, (u) => {
3379
+ if (get(n, u, "") || get(a, `${u}.loading`, !1))
3380
+ return;
3381
+ const p = o.find((m) => m._id === u);
3382
+ l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
3383
+ r((x) => ({ ...x, [u]: m })), l((x) => ({
3384
+ ...x,
3385
+ [u]: { loading: !1, error: null }
3386
+ }));
3387
+ }).catch((m) => {
3388
+ l((x) => ({
3389
+ ...x,
3390
+ [u]: { loading: !1, error: m.message }
3391
+ }));
3392
+ });
3393
+ });
3394
+ }, [
3395
+ o,
3396
+ c,
3397
+ n,
3398
+ d,
3399
+ a,
3400
+ r,
3401
+ l
3402
+ ]);
3403
+ }, RSCBlock = ({ blockProps: o, block: n }) => {
3404
+ const { getRSCBlockMarkup: r, getRSCBlockState: a } = useRSCBlocksStore(), l = r(n), { loading: i, error: c } = a(n._id);
3405
+ return i ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...o, className: "h-10 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full w-full rounded-md border" }) }) : c ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...o, children: [
3406
+ "Error: ",
3407
+ c
3408
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...o, dangerouslySetInnerHTML: { __html: l } });
3358
3409
  }, generateClassNames = memoize((o) => {
3359
3410
  const n = o.replace(STYLES_KEY, "").split(",");
3360
3411
  return twMerge(n[0], n[1]);
@@ -3393,50 +3444,50 @@ function isDescendant(o, n, r) {
3393
3444
  }
3394
3445
  const RenderGlobalBlock = ({ blocks: o, allBlocks: n }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: o });
3395
3446
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3396
- const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), g = useCallback((b) => getStyleAttrs(b, c), [c]), [x] = useChaiExternalData(), [m] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3397
- (b) => b.reduce((_, v) => {
3447
+ const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), m = useCallback((b) => getStyleAttrs(b, c), [c]), [x] = useChaiExternalData(), [g] = useAtom$1(inlineEditingActiveAtom), _ = useCallback(
3448
+ (b) => b.reduce((E, v) => {
3398
3449
  const B = get(d, v, {});
3399
- return { ..._, ...B };
3450
+ return { ...E, ...B };
3400
3451
  }, {}),
3401
3452
  [d]
3402
3453
  );
3403
3454
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3404
- o.map((b, _) => {
3405
- if (m === b._id || u.includes(b._id))
3455
+ o.map((b, E) => {
3456
+ if (g === b._id || u.includes(b._id))
3406
3457
  return null;
3407
3458
  const v = {}, B = filter(n, { _parent: b._id });
3408
3459
  if (v.children = B.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: B }) : null, b._type === "GlobalBlock") {
3409
- const L = p(b);
3410
- v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(L, (j) => !j._parent), allBlocks: L });
3460
+ const k = p(b);
3461
+ v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(k, (S) => !S._parent), allBlocks: k });
3411
3462
  }
3412
- const C = getBlockComponent(b._type), I = get(C, "builderComponent", get(C, "component", null));
3413
- if (isNull(I))
3463
+ const C = getBlockComponent(b._type), I = get(C, "server", !1), w = I ? RSCBlock : get(C, "builderComponent", get(C, "component", null));
3464
+ if (isNull(w))
3414
3465
  return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
3415
- const w = has(C, "getBlockStateFrom") ? C == null ? void 0 : C.getBlockStateFrom(b, n) : [], A = E(w), N = g(b);
3416
- if (get(N, "__isHidden", !1) && !includes(r, b._id))
3466
+ const A = has(C, "getBlockStateFrom") ? C == null ? void 0 : C.getBlockStateFrom(b, n) : [], T = _(A), P = m(b);
3467
+ if (get(P, "__isHidden", !1) && !includes(r, b._id))
3417
3468
  return null;
3418
- const P = l && isDescendant(l._id, b._id, n);
3419
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(I, {
3420
- blockProps: {
3421
- ...includes(r, b._id) ? { "force-show": "" } : {},
3422
- "data-block-id": b._id,
3423
- "data-block-type": b._type,
3424
- ...l ? (
3425
- // @ts-ignore
3426
- {
3427
- "data-dnd": canAcceptChildBlock(b._type, l == null ? void 0 : l._type) ? "yes" : "no",
3428
- "data-dnd-dragged": l._id === b._id || P ? "yes" : "no"
3429
- }
3430
- ) : {},
3431
- ...i === b._id && !P ? { "data-drop": "yes" } : {},
3432
- ...includes(a, b._id) ? { "data-cut-block": "yes" } : {}
3433
- },
3434
- index: _,
3469
+ const L = l && isDescendant(l._id, b._id, n), j = {
3470
+ ...includes(r, b._id) ? { "force-show": "" } : {},
3471
+ "data-block-id": b._id,
3472
+ "data-block-type": b._type,
3473
+ ...l ? (
3474
+ // @ts-ignore
3475
+ {
3476
+ "data-dnd": canAcceptChildBlock(b._type, l == null ? void 0 : l._type) ? "yes" : "no",
3477
+ "data-dnd-dragged": l._id === b._id || L ? "yes" : "no"
3478
+ }
3479
+ ) : {},
3480
+ ...i === b._id && !L ? { "data-drop": "yes" } : {},
3481
+ ...includes(a, b._id) ? { "data-cut-block": "yes" } : {}
3482
+ };
3483
+ return I ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: j }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(w, {
3484
+ blockProps: j,
3485
+ index: E,
3435
3486
  ...applyBindings(b, x),
3436
- ...omit(N, ["__isHidden"]),
3487
+ ...omit(P, ["__isHidden"]),
3437
3488
  ...v,
3438
3489
  inBuilder: !0,
3439
- blockState: A
3490
+ blockState: T
3440
3491
  }) });
3441
3492
  })
3442
3493
  ) });
@@ -3486,24 +3537,24 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3486
3537
  n(i);
3487
3538
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
3488
3539
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3489
- const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [g, x] = useState([]), [, m] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [b, _] = useSelectedStylingBlocks(), v = useBuilderProp("loading", !1), B = useBuilderProp("htmlDir", "ltr"), C = (A) => {
3490
- u((N) => ({ ...N, width: A }));
3540
+ const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, _] = useAtom$1(canvasIframeAtom), [b, E] = useSelectedStylingBlocks(), v = useBuilderProp("loading", !1), B = useBuilderProp("htmlDir", "ltr"), C = (A) => {
3541
+ u((T) => ({ ...T, width: A }));
3491
3542
  };
3492
3543
  useEffect(() => {
3493
3544
  if (!c.current)
3494
3545
  return;
3495
- const { clientWidth: A, clientHeight: N } = c.current;
3496
- u({ width: A, height: N });
3546
+ const { clientWidth: A, clientHeight: T } = c.current;
3547
+ u({ width: A, height: T });
3497
3548
  }, [c, n]);
3498
- const I = (A, N = 0) => {
3549
+ const I = (A, T = 0) => {
3499
3550
  const { top: P } = A.getBoundingClientRect();
3500
- return P + N >= 0 && P - N <= window.innerHeight;
3551
+ return P + T >= 0 && P - T <= window.innerHeight;
3501
3552
  };
3502
3553
  useEffect(() => {
3503
- var A, N;
3554
+ var A, T;
3504
3555
  if (a && a.type !== "Multiple" && i.current) {
3505
3556
  const P = getElementByDataBlockId(i.current.contentDocument, a._id);
3506
- P && (I(P) || (N = (A = i.current) == null ? void 0 : A.contentWindow) == null || N.scrollTo({ top: P.offsetTop, behavior: "smooth" }), x([P]));
3557
+ P && (I(P) || (T = (A = i.current) == null ? void 0 : A.contentWindow) == null || T.scrollTo({ top: P.offsetTop, behavior: "smooth" }), x([P]));
3507
3558
  }
3508
3559
  }, [a]), useEffect(() => {
3509
3560
  if (!isEmpty(b) && i.current) {
@@ -3511,9 +3562,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3511
3562
  i.current.contentDocument,
3512
3563
  first(b).id
3513
3564
  );
3514
- m(A ? [A] : [null]);
3565
+ g(A ? [A] : [null]);
3515
3566
  } else
3516
- m([null]);
3567
+ g([null]);
3517
3568
  }, [b]);
3518
3569
  const w = useMemo(() => {
3519
3570
  let A = IframeInitialContent;
@@ -3526,7 +3577,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3526
3577
  "div",
3527
3578
  {
3528
3579
  onClick: () => {
3529
- r([]), _([]);
3580
+ r([]), E([]);
3530
3581
  },
3531
3582
  onMouseLeave: () => setTimeout(() => l(""), 300),
3532
3583
  className: "relative mx-auto h-full w-full overflow-hidden",
@@ -3534,7 +3585,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3534
3585
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3535
3586
  ChaiFrame,
3536
3587
  {
3537
- contentDidMount: () => E(i.current),
3588
+ contentDidMount: () => _(i.current),
3538
3589
  ref: i,
3539
3590
  id: "canvas-iframe",
3540
3591
  style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
@@ -3546,7 +3597,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3546
3597
  BlockActionsStatic,
3547
3598
  {
3548
3599
  block: a,
3549
- selectedBlockElement: first(g)
3600
+ selectedBlockElement: first(m)
3550
3601
  }
3551
3602
  ),
3552
3603
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, { model: "page" }),
@@ -3662,7 +3713,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3662
3713
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { size: 16 })
3663
3714
  ] }, l))
3664
3715
  ] }) });
3665
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-ePAAihqK.js")), CanvasArea = () => {
3716
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-_PTE1mX9.js")), CanvasArea = () => {
3666
3717
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3667
3718
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
3668
3719
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
@@ -3742,12 +3793,12 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3742
3793
  }, {
3743
3794
  bodyFont: u,
3744
3795
  headingFont: p,
3745
- primaryColor: g,
3796
+ primaryColor: m,
3746
3797
  bodyTextDarkColor: x,
3747
- bodyTextLightColor: m,
3748
- bodyBgDarkColor: E,
3798
+ bodyTextLightColor: g,
3799
+ bodyBgDarkColor: _,
3749
3800
  secondaryColor: b,
3750
- bodyBgLightColor: _,
3801
+ bodyBgLightColor: E,
3751
3802
  roundedCorners: v
3752
3803
  } = r;
3753
3804
  let B = {
@@ -3765,14 +3816,14 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3765
3816
  title: c("theme_config.rounded_corner"),
3766
3817
  default: parseInt(v || 5, 10)
3767
3818
  }),
3768
- primaryColor: h({ title: c("theme_config.primary"), default: g }),
3819
+ primaryColor: h({ title: c("theme_config.primary"), default: m }),
3769
3820
  secondaryColor: h({ title: c("theme_config.secondary"), default: b })
3770
3821
  };
3771
3822
  l || (B = {
3772
3823
  ...B,
3773
3824
  bodyBgLightColor: h({
3774
3825
  title: c("theme_config.background"),
3775
- default: _
3826
+ default: E
3776
3827
  }),
3777
3828
  bodyTextLightColor: h({
3778
3829
  title: c("theme_config.text_color"),
@@ -3780,11 +3831,11 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3780
3831
  }),
3781
3832
  bodyBgDarkColor: h({
3782
3833
  title: c("theme_config.background_dark_mode"),
3783
- default: E
3834
+ default: _
3784
3835
  }),
3785
3836
  bodyTextDarkColor: h({
3786
3837
  title: c("theme_config.text_color_dark_mode"),
3787
- default: m
3838
+ default: g
3788
3839
  })
3789
3840
  });
3790
3841
  const C = {
@@ -3989,7 +4040,7 @@ function BiExpandVertical(o) {
3989
4040
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
3990
4041
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
3991
4042
  let p = null;
3992
- const g = o.children.length > 0, { id: x, data: m, isSelected: E, willReceiveDrop: b, isDragging: _, isEditing: v, handleClick: B } = o, C = (L) => {
4043
+ const m = o.children.length > 0, { id: x, data: g, isSelected: _, willReceiveDrop: b, isDragging: E, isEditing: v, handleClick: B } = o, C = (L) => {
3993
4044
  L.stopPropagation(), !i.includes(x) && o.toggle();
3994
4045
  }, I = (L) => {
3995
4046
  L.isInternal && (p = L.isOpen, L.isOpen && L.close());
@@ -4000,23 +4051,23 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4000
4051
  };
4001
4052
  useEffect(() => {
4002
4053
  const L = setTimeout(() => {
4003
- b && !o.isOpen && !_ && !i.includes(x) && o.toggle();
4054
+ b && !o.isOpen && !E && !i.includes(x) && o.toggle();
4004
4055
  }, 500);
4005
4056
  return () => clearTimeout(L);
4006
- }, [b, o, _]);
4007
- const N = useMemo(() => {
4008
- const L = Object.keys(m), j = [];
4057
+ }, [b, o, E]);
4058
+ const T = useMemo(() => {
4059
+ const L = Object.keys(g), j = [];
4009
4060
  for (let k = 0; k < L.length; k++)
4010
4061
  if (L[k].endsWith("_attrs")) {
4011
- const S = m[L[k]], R = Object.keys(S).join("|");
4062
+ const S = g[L[k]], R = Object.keys(S).join("|");
4012
4063
  R.match(/x-data/) && j.push("data"), R.match(/x-on/) && j.push("event"), R.match(/x-show|x-if/) && j.push("show");
4013
4064
  }
4014
4065
  return j;
4015
- }, [m]), P = (L, j) => {
4066
+ }, [g]), P = (L, j) => {
4016
4067
  const k = u.contentDocument || u.contentWindow.document, S = k.querySelector(`[data-block-id=${L}]`);
4017
4068
  S && S.setAttribute("data-drop", j);
4018
- const R = S.getBoundingClientRect(), T = u.getBoundingClientRect();
4019
- R.top >= T.top && R.left >= T.left && R.bottom <= T.bottom && R.right <= T.right || (k.documentElement.scrollTop = S.offsetTop - T.top);
4069
+ const R = S.getBoundingClientRect(), N = u.getBoundingClientRect();
4070
+ R.top >= N.top && R.left >= N.left && R.bottom <= N.bottom && R.right <= N.right || (k.documentElement.scrollTop = S.offsetTop - N.top);
4020
4071
  };
4021
4072
  return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4022
4073
  "button",
@@ -4049,9 +4100,9 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4049
4100
  },
4050
4101
  className: cn(
4051
4102
  "group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
4052
- E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4053
- b && canAcceptChildBlock(m._type, "Icon") ? "bg-green-200" : "",
4054
- _ && "opacity-20",
4103
+ _ ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4104
+ b && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
4105
+ E && "opacity-20",
4055
4106
  i.includes(x) ? "opacity-50" : ""
4056
4107
  ),
4057
4108
  children: [
@@ -4060,11 +4111,11 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4060
4111
  "div",
4061
4112
  {
4062
4113
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
4063
- children: g && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: C, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4114
+ children: m && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: C, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4064
4115
  }
4065
4116
  ),
4066
4117
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4067
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: m == null ? void 0 : m._type }) }),
4118
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: g == null ? void 0 : g._type }) }),
4068
4119
  v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4069
4120
  "div",
4070
4121
  {
@@ -4073,10 +4124,10 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4073
4124
  L.stopPropagation(), o.edit(), o.deselect();
4074
4125
  },
4075
4126
  children: [
4076
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (m == null ? void 0 : m._name) || (m == null ? void 0 : m._type.split("/").pop()) }),
4077
- N.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4078
- N.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4079
- N.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
4127
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (g == null ? void 0 : g._name) || (g == null ? void 0 : g._type.split("/").pop()) }),
4128
+ T.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4129
+ T.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4130
+ T.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
4080
4131
  ]
4081
4132
  }
4082
4133
  )
@@ -4094,7 +4145,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4094
4145
  ),
4095
4146
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: L.tooltip })
4096
4147
  ] })),
4097
- canAddChildBlock(m == null ? void 0 : m._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4148
+ canAddChildBlock(g == null ? void 0 : g._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4098
4149
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4099
4150
  TooltipTrigger,
4100
4151
  {
@@ -4466,8 +4517,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4466
4517
  const c = stringify([r]);
4467
4518
  return hasVideoEmbed(c) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(c)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = c, [a];
4468
4519
  } else if (r.tagName === "svg") {
4469
- const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px", g = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4470
- return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`, g)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
4520
+ const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px", m = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4521
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`, m)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
4471
4522
  } else if (r.tagName == "option" && n && ((i = n.block) == null ? void 0 : i._type) === "Select")
4472
4523
  return n.block.options.push({
4473
4524
  label: getTextContent(r.children),
@@ -4528,30 +4579,30 @@ function ExpandableObject(o) {
4528
4579
  level: d,
4529
4580
  style: u,
4530
4581
  shouldExpandNode: p,
4531
- clickToExpandNode: g
4582
+ clickToExpandNode: m
4532
4583
  } = o;
4533
- const x = useRef(!1), [m, E, b] = useBool(() => p(d, r, n));
4584
+ const x = useRef(!1), [g, _, b] = useBool(() => p(d, r, n));
4534
4585
  useEffect(() => {
4535
4586
  x.current ? b(p(d, r, n)) : x.current = !0;
4536
4587
  }, [p]);
4537
- const _ = m ? u.collapseIcon : u.expandIcon, v = m ? "collapse JSON" : "expand JSON", B = useComponentId(), C = d + 1, I = a.length - 1, w = (A) => {
4538
- A.key === " " && (A.preventDefault(), E());
4588
+ const E = g ? u.collapseIcon : u.expandIcon, v = g ? "collapse JSON" : "expand JSON", B = useComponentId(), C = d + 1, I = a.length - 1, w = (A) => {
4589
+ A.key === " " && (A.preventDefault(), _());
4539
4590
  };
4540
4591
  return /* @__PURE__ */ createElement("div", {
4541
4592
  className: u.basicChildStyle,
4542
4593
  role: "list"
4543
4594
  }, /* @__PURE__ */ createElement("span", {
4544
- className: _,
4545
- onClick: E,
4595
+ className: E,
4596
+ onClick: _,
4546
4597
  onKeyDown: w,
4547
4598
  role: "button",
4548
4599
  tabIndex: 0,
4549
4600
  "aria-label": v,
4550
- "aria-expanded": m,
4551
- "aria-controls": m ? B : void 0
4552
- }), n && (g ? /* @__PURE__ */ createElement("span", {
4601
+ "aria-expanded": g,
4602
+ "aria-controls": g ? B : void 0
4603
+ }), n && (m ? /* @__PURE__ */ createElement("span", {
4553
4604
  className: u.clickableLabel,
4554
- onClick: E,
4605
+ onClick: _,
4555
4606
  onKeyDown: w,
4556
4607
  role: "button",
4557
4608
  tabIndex: -1
@@ -4559,26 +4610,26 @@ function ExpandableObject(o) {
4559
4610
  className: u.label
4560
4611
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4561
4612
  className: u.punctuation
4562
- }, i), m ? /* @__PURE__ */ createElement("div", {
4613
+ }, i), g ? /* @__PURE__ */ createElement("div", {
4563
4614
  id: B
4564
- }, a.map((A, N) => /* @__PURE__ */ createElement(DataRender, {
4565
- key: A[0] || N,
4615
+ }, a.map((A, T) => /* @__PURE__ */ createElement(DataRender, {
4616
+ key: A[0] || T,
4566
4617
  field: A[0],
4567
4618
  value: A[1],
4568
4619
  style: u,
4569
- lastElement: N === I,
4620
+ lastElement: T === I,
4570
4621
  level: C,
4571
4622
  shouldExpandNode: p,
4572
- clickToExpandNode: g
4623
+ clickToExpandNode: m
4573
4624
  }))) : /* @__PURE__ */ createElement("span", {
4574
4625
  className: u.collapsedContent,
4575
- onClick: E,
4626
+ onClick: _,
4576
4627
  onKeyDown: w,
4577
4628
  role: "button",
4578
4629
  tabIndex: -1,
4579
4630
  "aria-hidden": !0,
4580
4631
  "aria-label": v,
4581
- "aria-expanded": m
4632
+ "aria-expanded": g
4582
4633
  }), /* @__PURE__ */ createElement("span", {
4583
4634
  className: u.punctuation
4584
4635
  }, c), !l && /* @__PURE__ */ createElement("span", {
@@ -4731,7 +4782,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4731
4782
  dataType: i,
4732
4783
  appliedBindings: c
4733
4784
  }) => {
4734
- const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, g = o === "PROP", [x, m] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
4785
+ const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [x, g] = useState(!1), _ = useMemo(() => o === "PROP" ? d.filter(
4735
4786
  (b) => !includes(c, b) && get(p, `props.${first(split(b, "."))}.binding`)
4736
4787
  ) : d.filter((b) => i === get(u, b, "")), [o, d, c, i, p]);
4737
4788
  return useEffect(() => {
@@ -4739,7 +4790,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4739
4790
  }, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4740
4791
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
4741
4792
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
4742
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: m, children: [
4793
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: g, children: [
4743
4794
  /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4744
4795
  Button,
4745
4796
  {
@@ -4748,7 +4799,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4748
4799
  className: ` ${isEmpty(n) ? "w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white" : "min-w-[350px] items-center justify-between"}`,
4749
4800
  children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4750
4801
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "pr-8 text-sm", children: [
4751
- g && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
4802
+ m && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
4752
4803
  n
4753
4804
  ] }),
4754
4805
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
@@ -4762,20 +4813,20 @@ const ViewData = ({ data: o, fullView: n }) => {
4762
4813
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
4763
4814
  /* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
4764
4815
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
4765
- /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4816
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(_, (b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4766
4817
  CommandItem,
4767
4818
  {
4768
4819
  value: b,
4769
- className: `cursor-pointer ${g ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4770
- onSelect: (_) => {
4771
- r(find(E, (v) => v === _) || null), m(!1);
4820
+ className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4821
+ onSelect: (E) => {
4822
+ r(find(_, (v) => v === E) || null), g(!1);
4772
4823
  },
4773
4824
  children: [
4774
4825
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
4775
4826
  /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === b ? "" : "opacity-0"}` }),
4776
4827
  b
4777
4828
  ] }),
4778
- g ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, b, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, b) }) })
4829
+ m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, b, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, b) }) })
4779
4830
  ]
4780
4831
  },
4781
4832
  b
@@ -4784,7 +4835,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4784
4835
  ] }) })
4785
4836
  ] })
4786
4837
  ] }),
4787
- !g && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4838
+ !m && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4788
4839
  ] });
4789
4840
  }, AddBindingModalContent = ({
4790
4841
  appliedBindings: o = [],
@@ -4792,20 +4843,20 @@ const ViewData = ({ data: o, fullView: n }) => {
4792
4843
  editMode: r,
4793
4844
  item: a
4794
4845
  }) => {
4795
- const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), g = useCallback(
4796
- (E, b) => {
4797
- if (isEmpty(E))
4846
+ const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
4847
+ (_, b) => {
4848
+ if (isEmpty(_))
4798
4849
  return "";
4799
4850
  {
4800
- const _ = get(b === "PROP" ? u : p, E, "");
4801
- if (isArray$1(_))
4851
+ const E = get(b === "PROP" ? u : p, _, "");
4852
+ if (isArray$1(E))
4802
4853
  return "list";
4803
- const v = typeof _;
4854
+ const v = typeof E;
4804
4855
  return v === "string" ? "text" : v === "object" ? "model" : v;
4805
4856
  }
4806
4857
  },
4807
4858
  [u, p]
4808
- ), [x, m] = useState(r ? g(a.key, "PROP") : "");
4859
+ ), [x, g] = useState(r ? m(a.key, "PROP") : "");
4809
4860
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4810
4861
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
4811
4862
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
@@ -4820,9 +4871,9 @@ const ViewData = ({ data: o, fullView: n }) => {
4820
4871
  placeholder: "Enter prop key",
4821
4872
  value: l,
4822
4873
  setValue: i,
4823
- onChange: (E) => {
4824
- const b = g(E, "PROP");
4825
- i(E), x !== b && d(""), m(b);
4874
+ onChange: (_) => {
4875
+ const b = m(_, "PROP");
4876
+ i(_), x !== b && d(""), g(b);
4826
4877
  },
4827
4878
  data: u,
4828
4879
  dataType: x,
@@ -4838,9 +4889,9 @@ const ViewData = ({ data: o, fullView: n }) => {
4838
4889
  placeholder: "Enter data path",
4839
4890
  value: c,
4840
4891
  setValue: d,
4841
- onChange: (E) => {
4842
- const b = g(E, "PATH");
4843
- d(x === b ? E : "");
4892
+ onChange: (_) => {
4893
+ const b = m(_, "PATH");
4894
+ d(x === b ? _ : "");
4844
4895
  },
4845
4896
  data: p,
4846
4897
  dataType: x,
@@ -4883,15 +4934,15 @@ const ViewData = ({ data: o, fullView: n }) => {
4883
4934
  dataProvider: l,
4884
4935
  appliedBindings: i
4885
4936
  }) => {
4886
- const [c, d] = useState("string"), u = (p, g) => {
4937
+ const [c, d] = useState("string"), u = (p, m) => {
4887
4938
  if (isEmpty(p))
4888
4939
  return "";
4889
4940
  {
4890
- const x = get(g === "PROP" ? a : l, p, "");
4941
+ const x = get(m === "PROP" ? a : l, p, "");
4891
4942
  if (isArray$1(x))
4892
4943
  return "list";
4893
- const m = typeof x;
4894
- return m === "string" ? "text" : m === "object" ? "model" : m;
4944
+ const g = typeof x;
4945
+ return g === "string" ? "text" : g === "object" ? "model" : g;
4895
4946
  }
4896
4947
  };
4897
4948
  return useEffect(() => d(() => u(o.key, "PROP")), [o.key]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col rounded-md border border-border p-2", children: [
@@ -4912,10 +4963,10 @@ const ViewData = ({ data: o, fullView: n }) => {
4912
4963
  ] });
4913
4964
  }, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
4914
4965
  const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
4915
- map(o, (x, m) => ({ key: m, value: x }))
4966
+ map(o, (x, g) => ({ key: g, value: x }))
4916
4967
  );
4917
4968
  useEffect(() => {
4918
- c(map(o, (x, m) => ({ key: m, value: x })));
4969
+ c(map(o, (x, g) => ({ key: g, value: x })));
4919
4970
  }, [r == null ? void 0 : r._id, o]);
4920
4971
  const d = useMemo(() => {
4921
4972
  if (isEmpty(a))
@@ -4925,21 +4976,21 @@ const ViewData = ({ data: o, fullView: n }) => {
4925
4976
  const x = last(i);
4926
4977
  return isEmpty(x == null ? void 0 : x.key) || isEmpty(x == null ? void 0 : x.value);
4927
4978
  }, [a, i]), u = (x) => {
4928
- const m = filter(i, (E) => E.key !== x.key);
4929
- c([...m, x]), g([...m, x]);
4979
+ const g = filter(i, (_) => _.key !== x.key);
4980
+ c([...g, x]), m([...g, x]);
4930
4981
  }, p = (x) => {
4931
- const m = filter(i, (E, b) => x !== b);
4932
- g([...m]);
4933
- }, g = useCallback(
4982
+ const g = filter(i, (_, b) => x !== b);
4983
+ m([...g]);
4984
+ }, m = useCallback(
4934
4985
  (x = []) => {
4935
4986
  if (c(x), isEmpty(x)) {
4936
4987
  n({});
4937
4988
  return;
4938
4989
  }
4939
- const m = {};
4940
- forEach(x, (E) => {
4941
- !isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(m, E.key, E.value);
4942
- }), n(m);
4990
+ const g = {};
4991
+ forEach(x, (_) => {
4992
+ !isEmpty(_ == null ? void 0 : _.key) && !isEmpty(_ == null ? void 0 : _.value) && set(g, _.key, _.value);
4993
+ }), n(g);
4943
4994
  },
4944
4995
  [n]
4945
4996
  );
@@ -4948,12 +4999,12 @@ const ViewData = ({ data: o, fullView: n }) => {
4948
4999
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
4949
5000
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
4950
5001
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
4951
- map(i, (x, m) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5002
+ map(i, (x, g) => /* @__PURE__ */ jsxRuntimeExports.jsx(
4952
5003
  NewDataBindingPair,
4953
5004
  {
4954
5005
  item: x,
4955
5006
  onAddBinding: u,
4956
- onRemove: () => p(m),
5007
+ onRemove: () => p(g),
4957
5008
  selectedBlock: r,
4958
5009
  dataProvider: a,
4959
5010
  appliedBindings: map(i, "key")
@@ -5047,7 +5098,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5047
5098
  }
5048
5099
  )
5049
5100
  ] });
5050
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-ypfGqude.js")), UploadImages = React__default.lazy(() => import("./UploadImages-UWFlkqDP.js")), ImagesPanel = ({
5101
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-Pchz4LmI.js")), UploadImages = React__default.lazy(() => import("./UploadImages-9dzylU64.js")), ImagesPanel = ({
5051
5102
  isModalView: o = !1,
5052
5103
  onSelect: n = () => {
5053
5104
  }
@@ -5205,18 +5256,18 @@ const ViewData = ({ data: o, fullView: n }) => {
5205
5256
  ] });
5206
5257
  }, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
5207
5258
  const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation();
5208
- Object.keys(n).forEach((g) => {
5209
- const x = n[g];
5259
+ Object.keys(n).forEach((m) => {
5260
+ const x = n[m];
5210
5261
  if (includes(["slot", "styles"], x.type))
5211
5262
  return;
5212
- const m = g;
5213
- c.properties[m] = getBlockJSONFromSchemas(x, u), d[m] = getBlockJSONFromUISchemas(x);
5263
+ const g = m;
5264
+ c.properties[g] = getBlockJSONFromSchemas(x, u), d[g] = getBlockJSONFromUISchemas(x);
5214
5265
  }), useEffect(() => {
5215
5266
  i(r);
5216
5267
  }, [o]);
5217
5268
  const p = useThrottledCallback(
5218
- async ({ formData: g }, x) => {
5219
- a({ formData: g }, x);
5269
+ async ({ formData: m }, x) => {
5270
+ a({ formData: m }, x);
5220
5271
  },
5221
5272
  [a],
5222
5273
  1e3
@@ -5242,8 +5293,8 @@ const ViewData = ({ data: o, fullView: n }) => {
5242
5293
  uiSchema: d,
5243
5294
  schema: c,
5244
5295
  formData: l,
5245
- onChange: ({ formData: g }, x) => {
5246
- x && (i(g), p({ formData: g }, x));
5296
+ onChange: ({ formData: m }, x) => {
5297
+ x && (i(m), p({ formData: m }, x));
5247
5298
  }
5248
5299
  }
5249
5300
  );
@@ -5302,32 +5353,35 @@ const ViewData = ({ data: o, fullView: n }) => {
5302
5353
  }
5303
5354
  ) })
5304
5355
  ] });
5356
+ }, ResetRSCBlockButton = ({ blockId: o }) => {
5357
+ const { t: n } = useTranslation(), { reset: r } = useRSCBlocksStore();
5358
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "outline", onClick: () => r(o), children: n("Reload") });
5305
5359
  };
5306
5360
  function BlockSettings() {
5307
- const o = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), r = useUpdateBlocksProps(), a = getBlockComponent(o == null ? void 0 : o._type), l = { ...o }, [i, c] = useState(l), d = useBuilderProp("dataBindingSupport", !1), u = ({ formData: E }, b, _) => {
5308
- if (b && (i == null ? void 0 : i._id) === o._id) {
5309
- const v = b.replace("root.", "");
5310
- r([o._id], { [v]: get(E, v) }, _);
5361
+ const o = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), r = useUpdateBlocksProps(), a = getBlockComponent(o == null ? void 0 : o._type), l = { ...o }, [i, c] = useState(l), d = useBuilderProp("dataBindingSupport", !1), u = ({ formData: b }, E, v) => {
5362
+ if (E && (i == null ? void 0 : i._id) === o._id) {
5363
+ const B = E.replace("root.", "");
5364
+ r([o._id], { [B]: get(b, B) }, v);
5311
5365
  }
5312
5366
  }, p = useCallback(
5313
- debounce(({ formData: E }, b, _) => {
5314
- u({ formData: E }, b, _), c(E);
5367
+ debounce(({ formData: b }, E, v) => {
5368
+ u({ formData: b }, E, v), c(b);
5315
5369
  }, 1500),
5316
5370
  [o == null ? void 0 : o._id]
5317
- ), g = ({ formData: E }, b) => {
5318
- if (b) {
5319
- const _ = b.replace("root.", "");
5371
+ ), m = ({ formData: b }, E) => {
5372
+ if (E) {
5373
+ const v = E.replace("root.", "");
5320
5374
  n(
5321
5375
  [o._id],
5322
- convertDotNotationToObject(_, get(E, _.split(".")))
5323
- ), p({ formData: E }, b, { [_]: get(i, _) });
5376
+ convertDotNotationToObject(v, get(b, v.split(".")))
5377
+ ), p({ formData: b }, E, { [v]: get(i, v) });
5324
5378
  }
5325
- }, x = keys(get(l, "_bindings", {})), m = useMemo(() => {
5326
- const E = cloneDeep(get(a, "props", {}));
5327
- return each(E, (b, _) => {
5328
- get(b, "hidden", !1) && delete E[_];
5329
- }), d && each(x, (b) => delete E[b]), E;
5330
- }, [a, x, d]);
5379
+ }, x = keys(get(l, "_bindings", {})), g = useMemo(() => {
5380
+ const b = cloneDeep(get(a, "props", {}));
5381
+ return each(b, (E, v) => {
5382
+ get(E, "hidden", !1) && delete b[v];
5383
+ }), d && each(x, (E) => delete b[E]), b;
5384
+ }, [a, x, d]), _ = get(a, "server", !1);
5331
5385
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
5332
5386
  d ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5333
5387
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
@@ -5344,8 +5398,8 @@ function BlockSettings() {
5344
5398
  DataBindingSetting$1,
5345
5399
  {
5346
5400
  bindingData: get(o, "_bindings", {}),
5347
- onChange: (E) => {
5348
- u({ formData: { _bindings: E } }, "root._bindings");
5401
+ onChange: (b) => {
5402
+ u({ formData: { _bindings: b } }, "root._bindings");
5349
5403
  }
5350
5404
  }
5351
5405
  ) })
@@ -5367,23 +5421,24 @@ function BlockSettings() {
5367
5421
  JSONForm,
5368
5422
  {
5369
5423
  id: o == null ? void 0 : o._id,
5370
- onChange: g,
5424
+ onChange: m,
5371
5425
  formData: l,
5372
- properties: m
5426
+ properties: g
5373
5427
  }
5374
5428
  )
5375
5429
  ] })
5376
5430
  ] })
5377
- ] }) : isEmpty(m) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5431
+ ] }) : isEmpty(g) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5378
5432
  JSONForm,
5379
5433
  {
5380
5434
  id: o == null ? void 0 : o._id,
5381
- onChange: g,
5435
+ onChange: m,
5382
5436
  formData: l,
5383
- properties: m
5437
+ properties: g
5384
5438
  }
5385
5439
  ),
5386
5440
  (o == null ? void 0 : o._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
5441
+ _ ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: o == null ? void 0 : o._id }) : null,
5387
5442
  /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
5388
5443
  ] });
5389
5444
  }
@@ -5401,20 +5456,20 @@ const getBlockWithChildren = (o, n) => {
5401
5456
  const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore();
5402
5457
  return {
5403
5458
  askAi: useCallback(
5404
- async (u, p, g, x) => {
5459
+ async (u, p, m, x) => {
5405
5460
  if (l) {
5406
5461
  n(!0), a(null);
5407
5462
  try {
5408
- const m = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((v) => v._id === p))];
5409
- set(m, "0._parent", null);
5410
- const E = await l(u, g, m), { blocks: b, error: _ } = E;
5411
- if (_) {
5412
- a(_);
5463
+ const g = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((v) => v._id === p))];
5464
+ set(g, "0._parent", null);
5465
+ const _ = await l(u, m, g), { blocks: b, error: E } = _;
5466
+ if (E) {
5467
+ a(E);
5413
5468
  return;
5414
5469
  }
5415
- u === "styles" ? c(b) : i(b), x && x(E);
5416
- } catch (m) {
5417
- a(m);
5470
+ u === "styles" ? c(b) : i(b), x && x(_);
5471
+ } catch (g) {
5472
+ a(g);
5418
5473
  } finally {
5419
5474
  n(!1), x && x();
5420
5475
  }
@@ -5488,14 +5543,14 @@ function Countdown() {
5488
5543
  ] });
5489
5544
  }
5490
5545
  const AskAIStyles = ({ blockId: o }) => {
5491
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, g] = useState();
5546
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
5492
5547
  useEffect(() => {
5493
- var m;
5494
- (m = d.current) == null || m.focus();
5548
+ var g;
5549
+ (g = d.current) == null || g.focus();
5495
5550
  }, []);
5496
- const x = (m) => {
5497
- const { usage: E } = m || {};
5498
- !l && E && g(E), u.current = setTimeout(() => g(void 0), 1e4), l || c("");
5551
+ const x = (g) => {
5552
+ const { usage: _ } = g || {};
5553
+ !l && _ && m(_), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
5499
5554
  };
5500
5555
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5501
5556
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
@@ -5504,12 +5559,12 @@ const AskAIStyles = ({ blockId: o }) => {
5504
5559
  {
5505
5560
  ref: d,
5506
5561
  value: i,
5507
- onChange: (m) => c(m.target.value),
5562
+ onChange: (g) => c(g.target.value),
5508
5563
  placeholder: n("ask_ai_to_edit_styles"),
5509
5564
  className: "w-full border border-border focus:border-0",
5510
5565
  rows: 3,
5511
- onKeyDown: (m) => {
5512
- m.key === "Enter" && (m.preventDefault(), u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, x));
5566
+ onKeyDown: (g) => {
5567
+ g.key === "Enter" && (g.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x));
5513
5568
  }
5514
5569
  }
5515
5570
  ),
@@ -5519,7 +5574,7 @@ const AskAIStyles = ({ blockId: o }) => {
5519
5574
  {
5520
5575
  disabled: i.trim().length < 5 || a,
5521
5576
  onClick: () => {
5522
- u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, x);
5577
+ u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x);
5523
5578
  },
5524
5579
  variant: "default",
5525
5580
  className: "w-fit",
@@ -5556,34 +5611,34 @@ const AskAIStyles = ({ blockId: o }) => {
5556
5611
  });
5557
5612
  function ManualClasses() {
5558
5613
  var A;
5559
- const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), g = (A = first(n)) == null ? void 0 : A.prop, x = reject((get(r, g, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), m = () => {
5560
- const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5561
- a(i, N, !0), u("");
5562
- }, [E, b] = useState([]), _ = ({ value: N }) => {
5563
- const P = N.trim().toLowerCase(), L = P.match(/.+:/g);
5614
+ const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (A = first(n)) == null ? void 0 : A.prop, x = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
5615
+ const T = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5616
+ a(i, T, !0), u("");
5617
+ }, [_, b] = useState([]), E = ({ value: T }) => {
5618
+ const P = T.trim().toLowerCase(), L = P.match(/.+:/g);
5564
5619
  let j = [];
5565
5620
  if (L && L.length > 0) {
5566
5621
  const [k] = L, S = P.replace(k, "");
5567
- j = fuse.search(S).map((T) => ({
5568
- ...T,
5569
- item: { ...T.item, name: k + T.item.name }
5622
+ j = fuse.search(S).map((N) => ({
5623
+ ...N,
5624
+ item: { ...N.item, name: k + N.item.name }
5570
5625
  }));
5571
5626
  } else
5572
5627
  j = fuse.search(P);
5573
5628
  return b(map(j, "item"));
5574
5629
  }, v = () => {
5575
5630
  b([]);
5576
- }, B = (N) => N.name, C = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), I = {
5631
+ }, B = (T) => T.name, C = (T) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: T.name }), I = {
5577
5632
  autoComplete: "off",
5578
5633
  autoCorrect: "off",
5579
5634
  autoCapitalize: "off",
5580
5635
  spellCheck: !1,
5581
5636
  placeholder: o("enter_classes_separated_by_space"),
5582
5637
  value: d,
5583
- onKeyDown: (N) => {
5584
- N.key === "Enter" && d.trim() !== "" && m();
5638
+ onKeyDown: (T) => {
5639
+ T.key === "Enter" && d.trim() !== "" && g();
5585
5640
  },
5586
- onChange: (N, { newValue: P }) => u(P),
5641
+ onChange: (T, { newValue: P }) => u(P),
5587
5642
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5588
5643
  }, w = () => {
5589
5644
  if (navigator.clipboard === void 0) {
@@ -5602,7 +5657,7 @@ function ManualClasses() {
5602
5657
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
5603
5658
  "div",
5604
5659
  {
5605
- className: `flex ${E.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
5660
+ className: `flex ${_.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
5606
5661
  children: [
5607
5662
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
5608
5663
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
@@ -5624,8 +5679,8 @@ function ManualClasses() {
5624
5679
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5625
5680
  Autosuggest,
5626
5681
  {
5627
- suggestions: E,
5628
- onSuggestionsFetchRequested: _,
5682
+ suggestions: _,
5683
+ onSuggestionsFetchRequested: E,
5629
5684
  onSuggestionsClearRequested: v,
5630
5685
  getSuggestionValue: B,
5631
5686
  renderSuggestion: C,
@@ -5645,7 +5700,7 @@ function ManualClasses() {
5645
5700
  {
5646
5701
  variant: "outline",
5647
5702
  className: "h-6 border-border",
5648
- onClick: m,
5703
+ onClick: g,
5649
5704
  disabled: d.trim() === "",
5650
5705
  size: "sm",
5651
5706
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
@@ -5653,22 +5708,22 @@ function ManualClasses() {
5653
5708
  )
5654
5709
  ] }),
5655
5710
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
5656
- x.map((N) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5711
+ x.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5657
5712
  "div",
5658
5713
  {
5659
5714
  className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
5660
5715
  children: [
5661
- N,
5716
+ T,
5662
5717
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5663
5718
  Cross2Icon,
5664
5719
  {
5665
- onClick: () => l(i, [N]),
5720
+ onClick: () => l(i, [T]),
5666
5721
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
5667
5722
  }
5668
5723
  )
5669
5724
  ]
5670
5725
  },
5671
- N
5726
+ T
5672
5727
  ))
5673
5728
  ) })
5674
5729
  ]
@@ -6059,38 +6114,38 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6059
6114
  ringColor: "ring",
6060
6115
  ringOffsetColor: "ring-offset"
6061
6116
  }, ColorChoice = ({ property: o, onChange: n }) => {
6062
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), g = get(p, "1", ""), x = get(p, "2", ""), m = useCallback(
6117
+ const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), x = get(p, "2", ""), g = useCallback(
6063
6118
  // eslint-disable-next-line no-shadow
6064
6119
  (b) => {
6065
- ["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), u({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((_) => ({ ..._, color: b, shade: _.shade ? _.shade : "500" })));
6120
+ ["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), u({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((E) => ({ ...E, color: b, shade: E.shade ? E.shade : "500" })));
6066
6121
  },
6067
6122
  [c, u]
6068
6123
  );
6069
6124
  useEffect(() => {
6070
- if (["current", "inherit", "transparent", "black", "white"].includes(g))
6125
+ if (["current", "inherit", "transparent", "black", "white"].includes(m))
6071
6126
  return c([]);
6072
6127
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
6073
- }, [g]);
6074
- const E = useCallback(
6128
+ }, [m]);
6129
+ const _ = useCallback(
6075
6130
  // eslint-disable-next-line no-shadow
6076
6131
  (b) => {
6077
- u({ color: g, shade: b });
6132
+ u({ color: m, shade: b });
6078
6133
  },
6079
- [g]
6134
+ [m]
6080
6135
  );
6081
6136
  return useEffect(() => {
6082
6137
  u({ color: "", shade: "" });
6083
6138
  }, [r]), useEffect(() => {
6084
- const _ = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6085
- _.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(_, o);
6139
+ const E = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6140
+ E.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(E, o);
6086
6141
  }, [d, n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
6087
6142
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6088
6143
  DropDown,
6089
6144
  {
6090
6145
  disabled: !l,
6091
6146
  rounded: !0,
6092
- selected: g,
6093
- onChange: m,
6147
+ selected: m,
6148
+ onChange: g,
6094
6149
  options: [
6095
6150
  "current",
6096
6151
  "transparent",
@@ -6123,7 +6178,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6123
6178
  ]
6124
6179
  }
6125
6180
  ) }),
6126
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !g || !l, onChange: E, options: i }) })
6181
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !m || !l, onChange: _, options: i }) })
6127
6182
  ] });
6128
6183
  }, getUserInputValues = (o, n) => {
6129
6184
  o = o.toLowerCase();
@@ -6318,16 +6373,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6318
6373
  },
6319
6374
  a
6320
6375
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6321
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [x, m] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, b] = useState(!1), [_, v] = useState(""), [B, C] = useState(!1), [I, w] = useState(!1);
6376
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [x, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [_, b] = useState(!1), [E, v] = useState(""), [B, C] = useState(!1), [I, w] = useState(!1);
6322
6377
  useEffect(() => {
6323
6378
  const { value: j, unit: k } = getClassValueAndUnit(i);
6324
6379
  if (k === "") {
6325
- l(j), m(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6380
+ l(j), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6326
6381
  return;
6327
6382
  }
6328
- m(k), l(k === "class" || isEmpty(j) ? "" : j);
6383
+ g(k), l(k === "class" || isEmpty(j) ? "" : j);
6329
6384
  }, [i, u, p]);
6330
- const A = useThrottledCallback((j) => c(j), [c], THROTTLE_TIME), N = useThrottledCallback((j) => c(j, !1), [c], THROTTLE_TIME), P = useCallback(
6385
+ const A = useThrottledCallback((j) => c(j), [c], THROTTLE_TIME), T = useThrottledCallback((j) => c(j, !1), [c], THROTTLE_TIME), P = useCallback(
6331
6386
  (j = !1) => {
6332
6387
  const k = getUserInputValues(`${a}`, p);
6333
6388
  if (get(k, "error", !1)) {
@@ -6341,10 +6396,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6341
6396
  }
6342
6397
  if (get(k, "value") === "")
6343
6398
  return;
6344
- const T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
6345
- j ? N(T) : A(T);
6399
+ const N = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
6400
+ j ? T(N) : A(N);
6346
6401
  },
6347
- [A, N, a, x, d, p]
6402
+ [A, T, a, x, d, p]
6348
6403
  ), L = useCallback(
6349
6404
  (j) => {
6350
6405
  const k = getUserInputValues(`${a}`, p);
@@ -6358,8 +6413,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6358
6413
  }
6359
6414
  if (get(k, "value") === "")
6360
6415
  return;
6361
- const S = get(k, "unit") !== "" ? get(k, "unit") : j, T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
6362
- A(T);
6416
+ const S = get(k, "unit") !== "" ? get(k, "unit") : j, N = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
6417
+ A(N);
6363
6418
  },
6364
6419
  [A, a, d, p]
6365
6420
  );
@@ -6386,7 +6441,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6386
6441
  let S = isNaN$1(k) ? 0 : k;
6387
6442
  j.keyCode === 38 && (S += 1), j.keyCode === 40 && (S -= 1);
6388
6443
  const R = `${S}`, D = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
6389
- N(D);
6444
+ T(D);
6390
6445
  },
6391
6446
  onKeyUp: (j) => {
6392
6447
  I && (j.preventDefault(), w(!1));
@@ -6399,10 +6454,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6399
6454
  var k;
6400
6455
  (k = j == null ? void 0 : j.target) == null || k.select(), r(!1);
6401
6456
  },
6402
- value: B ? _ : a,
6457
+ value: B ? E : a,
6403
6458
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6404
6459
  " ",
6405
- E ? "border-red-500 text-red-500" : "border-foreground/20"
6460
+ _ ? "border-red-500 text-red-500" : "border-foreground/20"
6406
6461
  )
6407
6462
  }
6408
6463
  ),
@@ -6425,7 +6480,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6425
6480
  units: p,
6426
6481
  current: x,
6427
6482
  onSelect: (j) => {
6428
- r(!1), m(j), L(j);
6483
+ r(!1), g(j), L(j);
6429
6484
  }
6430
6485
  }
6431
6486
  ) }) })
@@ -6446,11 +6501,11 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6446
6501
  return;
6447
6502
  v(j);
6448
6503
  const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6449
- N(R);
6504
+ T(R);
6450
6505
  },
6451
6506
  currentValue: a,
6452
6507
  unit: x,
6453
- negative: g,
6508
+ negative: m,
6454
6509
  cssProperty: u
6455
6510
  }
6456
6511
  )
@@ -6543,22 +6598,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6543
6598
  "2xl": "1536px"
6544
6599
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6545
6600
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6546
- }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useCanvasWidth(), x = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), _ = useMemo(() => get(x, "fullCls", ""), [x]), v = useCallback(
6547
- (N, P = !0) => {
6548
- const L = { dark: u, mq: g, mod: p, cls: N, property: l, fullCls: "" };
6601
+ }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), _ = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), E = useMemo(() => get(x, "fullCls", ""), [x]), v = useCallback(
6602
+ (T, P = !0) => {
6603
+ const L = { dark: u, mq: m, mod: p, cls: T, property: l, fullCls: "" };
6549
6604
  (u || p !== "") && (L.mq = "xs");
6550
6605
  const j = generateFullClsName(L);
6551
- m(b, [j], P);
6606
+ g(b, [j], P);
6552
6607
  },
6553
- [b, u, g, p, l, m]
6608
+ [b, u, m, p, l, g]
6554
6609
  ), B = useCallback(() => {
6555
- E(b, [_]);
6556
- }, [b, _, E]), C = useMemo(() => canChangeClass(x, g), [x, g]);
6610
+ _(b, [E]);
6611
+ }, [b, E, _]), C = useMemo(() => canChangeClass(x, m), [x, m]);
6557
6612
  useEffect(() => {
6558
6613
  i(C, x);
6559
6614
  }, [C, i, x]);
6560
6615
  const [, , I] = useCanvasWidth(), w = useCallback(
6561
- (N) => {
6616
+ (T) => {
6562
6617
  I({
6563
6618
  xs: 400,
6564
6619
  sm: 640,
@@ -6566,10 +6621,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6566
6621
  lg: 1024,
6567
6622
  xl: 1420,
6568
6623
  "2xl": 1920
6569
- }[N]);
6624
+ }[T]);
6570
6625
  },
6571
6626
  [I]
6572
- ), A = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === g;
6627
+ ), A = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === m;
6573
6628
  return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: x && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6574
6629
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !A ? "text-foreground" : ""}`, children: n(a) }) }),
6575
6630
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
@@ -6590,7 +6645,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6590
6645
  r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: v }),
6591
6646
  r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: v })
6592
6647
  ] }),
6593
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${_ ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => B(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : C && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6648
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${E ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => B(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : C && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6594
6649
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6595
6650
  "button",
6596
6651
  {
@@ -6631,7 +6686,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6631
6686
  units: i = basicUnits,
6632
6687
  negative: c = !1
6633
6688
  }) => {
6634
- const { t: d } = useTranslation(), [u, p] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), x = useCallback((m) => map(g, "property").includes(m), [g]);
6689
+ const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), x = useCallback((g) => map(m, "property").includes(g), [m]);
6635
6690
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6636
6691
  "div",
6637
6692
  {
@@ -6640,22 +6695,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6640
6695
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
6641
6696
  o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
6642
6697
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
6643
- n.map(({ label: m, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6698
+ n.map(({ label: g, key: _ }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6644
6699
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
6645
6700
  "button",
6646
6701
  {
6647
6702
  type: "button",
6648
- onClick: () => p(E),
6649
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${E === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6703
+ onClick: () => p(_),
6704
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${_ === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6650
6705
  children: [
6651
6706
  React__default.createElement("div", {
6652
- className: x(E) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6707
+ className: x(_) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6653
6708
  }),
6654
- React__default.createElement(get(EDITOR_ICONS, E, BoxIcon), { className: "text-inherit w-3 h-3" })
6709
+ React__default.createElement(get(EDITOR_ICONS, _, BoxIcon), { className: "text-inherit w-3 h-3" })
6655
6710
  ]
6656
6711
  }
6657
6712
  ) }),
6658
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(m)) })
6713
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(g)) })
6659
6714
  ] }) }))
6660
6715
  ) })
6661
6716
  ] }),
@@ -6720,8 +6775,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6720
6775
  if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
6721
6776
  return null;
6722
6777
  const u = (p) => {
6723
- const g = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6724
- l([o._id], g, !0);
6778
+ const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6779
+ l([o._id], m, !0);
6725
6780
  };
6726
6781
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
6727
6782
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "default", className: "w-full", size: "sm", children: [
@@ -6775,13 +6830,13 @@ function BlockStyling() {
6775
6830
  cssProperty: ""
6776
6831
  }), d = useThrottledCallback(
6777
6832
  (p) => {
6778
- const g = !get(i, "negative", !1), x = get(i, "cssProperty", "");
6779
- let m = parseFloat(i.dragStartValue);
6780
- m = isNaN(m) ? 0 : m;
6781
- let E = MAPPER[i.dragUnit];
6782
- (startsWith(x, "scale") || x === "opacity") && (E = 10);
6783
- let _ = (i.dragStartY - p.pageY) / E + m;
6784
- g && _ < 0 && (_ = 0), x === "opacity" && _ > 1 && (_ = 1), i.onDrag(`${_}`), l(`${_}`);
6833
+ const m = !get(i, "negative", !1), x = get(i, "cssProperty", "");
6834
+ let g = parseFloat(i.dragStartValue);
6835
+ g = isNaN(g) ? 0 : g;
6836
+ let _ = MAPPER[i.dragUnit];
6837
+ (startsWith(x, "scale") || x === "opacity") && (_ = 10);
6838
+ let E = (i.dragStartY - p.pageY) / _ + g;
6839
+ m && E < 0 && (E = 0), x === "opacity" && E > 1 && (E = 1), i.onDrag(`${E}`), l(`${E}`);
6785
6840
  },
6786
6841
  [i],
6787
6842
  50
@@ -6867,7 +6922,7 @@ const BlockCard = ({
6867
6922
  library: n,
6868
6923
  parentId: r = void 0
6869
6924
  }) => {
6870
- const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), g = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, m] = useAtom$1(draggedBlockAtom), E = (v) => {
6925
+ const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), m = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), _ = (v) => {
6871
6926
  const B = has(v, "styles_attrs.data-page-section");
6872
6927
  return v._type === "Box" && B;
6873
6928
  }, b = useCallback(
@@ -6881,10 +6936,10 @@ const BlockCard = ({
6881
6936
  isEmpty(B) || d(syncBlocksWithDefaults(B), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6882
6937
  },
6883
6938
  [o]
6884
- ), _ = async (v) => {
6939
+ ), E = async (v) => {
6885
6940
  const B = await i(n, o);
6886
6941
  let C = r;
6887
- if (E(first(B)) && (C = null), !isEmpty(B)) {
6942
+ if (_(first(B)) && (C = null), !isEmpty(B)) {
6888
6943
  const I = { blocks: B, uiLibrary: !0, parent: C };
6889
6944
  if (v.dataTransfer.setData("text/plain", JSON.stringify(I)), o.preview) {
6890
6945
  const w = new Image();
@@ -6893,7 +6948,7 @@ const BlockCard = ({
6893
6948
  };
6894
6949
  } else
6895
6950
  v.dataTransfer.setDragImage(new Image(), 0, 0);
6896
- m(I), setTimeout(() => {
6951
+ g(I), setTimeout(() => {
6897
6952
  u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6898
6953
  }, 200);
6899
6954
  }
@@ -6905,7 +6960,7 @@ const BlockCard = ({
6905
6960
  onClick: a ? () => {
6906
6961
  } : b,
6907
6962
  draggable: x ? "true" : "false",
6908
- onDragStart: _,
6963
+ onDragStart: E,
6909
6964
  className: clsx(
6910
6965
  "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
6911
6966
  ),
@@ -6914,11 +6969,11 @@ const BlockCard = ({
6914
6969
  /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
6915
6970
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
6916
6971
  ] }),
6917
- o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: g }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: g }) })
6972
+ o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: m }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: m }) })
6918
6973
  ]
6919
6974
  }
6920
6975
  ) }),
6921
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: g }) })
6976
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m }) })
6922
6977
  ] });
6923
6978
  }, libraryBlocksAtom = atom$1(
6924
6979
  {}
@@ -6934,9 +6989,9 @@ const BlockCard = ({
6934
6989
  })();
6935
6990
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
6936
6991
  }, UILibrarySection = ({ parentId: o }) => {
6937
- const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((C) => C.category === "custom"), c = a.find((C) => C.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [g, x] = useState("Hero"), m = get(p, g, []), E = useRef(null), { t: b } = useTranslation(), _ = (C) => {
6938
- E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
6939
- E.current && x(C);
6992
+ const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((C) => C.category === "custom"), c = a.find((C) => C.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, x] = useState("Hero"), g = get(p, m, []), _ = useRef(null), { t: b } = useTranslation(), E = (C) => {
6993
+ _.current && (clearTimeout(_.current), _.current = null), _.current = setTimeout(() => {
6994
+ _.current && x(C);
6940
6995
  }, 300);
6941
6996
  };
6942
6997
  if (u)
@@ -6944,7 +6999,7 @@ const BlockCard = ({
6944
6999
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
6945
7000
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
6946
7001
  ] });
6947
- const v = filter(m, (C, I) => I % 2 === 0), B = filter(m, (C, I) => I % 2 === 1);
7002
+ const v = filter(g, (C, I) => I % 2 === 0), B = filter(g, (C, I) => I % 2 === 1);
6948
7003
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative mt-2 flex h-full max-h-full overflow-hidden bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full pt-2", children: [
6949
7004
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
6950
7005
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
@@ -6955,12 +7010,12 @@ const BlockCard = ({
6955
7010
  map(p, (C, I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
6956
7011
  "div",
6957
7012
  {
6958
- onMouseEnter: () => _(I),
6959
- onMouseLeave: () => clearTimeout(E.current),
7013
+ onMouseEnter: () => E(I),
7014
+ onMouseLeave: () => clearTimeout(_.current),
6960
7015
  onClick: () => x(I),
6961
7016
  className: cn(
6962
7017
  "flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
6963
- I === g ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7018
+ I === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
6964
7019
  ),
6965
7020
  children: [
6966
7021
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(b(I.toLowerCase())) }),
@@ -6975,7 +7030,7 @@ const BlockCard = ({
6975
7030
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
6976
7031
  ScrollArea,
6977
7032
  {
6978
- onMouseEnter: () => E.current ? clearTimeout(E.current) : null,
7033
+ onMouseEnter: () => _.current ? clearTimeout(_.current) : null,
6979
7034
  className: "z-10 -mt-2 flex h-full max-h-full w-full flex-col gap-2 border-l border-border transition-all ease-linear",
6980
7035
  children: [
6981
7036
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
@@ -7428,14 +7483,14 @@ i18n.use(initReactI18next).init({
7428
7483
  }
7429
7484
  });
7430
7485
  const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7431
- const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, g] = useHighlightBlockId(), x = () => {
7486
+ const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, m] = useHighlightBlockId(), x = () => {
7432
7487
  if (console.log("addBlockToPage", o, r), has(o, "blocks")) {
7433
7488
  const b = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7434
7489
  u(syncBlocksWithDefaults(b), r || null);
7435
7490
  } else
7436
7491
  d(o, r || null);
7437
7492
  emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7438
- }, m = useFeature("dnd"), { t: E } = useTranslation();
7493
+ }, g = useFeature("dnd"), { t: _ } = useTranslation();
7439
7494
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
7440
7495
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7441
7496
  "button",
@@ -7445,18 +7500,18 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7445
7500
  type: "button",
7446
7501
  onDragStart: (b) => {
7447
7502
  b.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), b.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7448
- p([]), g(null);
7503
+ p([]), m(null);
7449
7504
  }, 200);
7450
7505
  },
7451
- draggable: m ? "true" : "false",
7506
+ draggable: g ? "true" : "false",
7452
7507
  className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
7453
7508
  children: [
7454
7509
  createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
7455
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(E(c || l)) })
7510
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(_(c || l)) })
7456
7511
  ]
7457
7512
  }
7458
7513
  ) }),
7459
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: E(c || l) }) })
7514
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: _(c || l) }) })
7460
7515
  ] }) });
7461
7516
  }, DefaultChaiBlocks = ({ parentId: o, gridCols: n = "grid-cols-2" }) => {
7462
7517
  const r = useChaiBlocks(), a = useBuilderProp("filterChaiBlock", () => !0), l = filter(r, a), i = groupBy(l, "category"), c = uniq(map(i.core, "group"));
@@ -7617,14 +7672,14 @@ function QuickPrompts({ onClick: o }) {
7617
7672
  ) }) });
7618
7673
  }
7619
7674
  const AIUserPrompt = ({ blockId: o }) => {
7620
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, g] = useState(), x = useRef(null), m = useRef(null);
7675
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), x = useRef(null), g = useRef(null);
7621
7676
  useEffect(() => {
7622
7677
  var b;
7623
7678
  (b = x.current) == null || b.focus();
7624
7679
  }, []);
7625
- const E = (b) => {
7626
- const { usage: _ } = b || {};
7627
- !l && _ && g(_), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
7680
+ const _ = (b) => {
7681
+ const { usage: E } = b || {};
7682
+ !l && E && m(E), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
7628
7683
  };
7629
7684
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
7630
7685
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -7649,7 +7704,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7649
7704
  className: "w-full",
7650
7705
  rows: 3,
7651
7706
  onKeyDown: (b) => {
7652
- b.key === "Enter" && (b.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E));
7707
+ b.key === "Enter" && (b.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, _));
7653
7708
  }
7654
7709
  }
7655
7710
  ),
@@ -7659,7 +7714,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7659
7714
  {
7660
7715
  disabled: i.trim().length < 5 || a,
7661
7716
  onClick: () => {
7662
- m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E);
7717
+ g.current && clearTimeout(g.current), m(void 0), r("content", o, i, _);
7663
7718
  },
7664
7719
  variant: "default",
7665
7720
  className: "w-fit",
@@ -7692,7 +7747,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7692
7747
  QuickPrompts,
7693
7748
  {
7694
7749
  onClick: (b) => {
7695
- m.current && clearTimeout(m.current), g(void 0), r("content", o, b, E);
7750
+ g.current && clearTimeout(g.current), m(void 0), r("content", o, b, _);
7696
7751
  }
7697
7752
  }
7698
7753
  )
@@ -7702,17 +7757,17 @@ const AIUserPrompt = ({ blockId: o }) => {
7702
7757
  ] }) }) : null
7703
7758
  ] });
7704
7759
  }, AISetContext = () => {
7705
- const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, g] = useState(!1), { toast: x } = useToast(), m = useRef(null);
7760
+ const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, m] = useState(!1), { toast: x } = useToast(), g = useRef(null);
7706
7761
  useEffect(() => {
7707
7762
  n && a(n);
7708
7763
  }, [n]);
7709
- const E = async () => {
7764
+ const _ = async () => {
7710
7765
  try {
7711
7766
  d(!0), p(null), await i(r), x({
7712
7767
  title: o("Updated AI Context"),
7713
7768
  description: o("You can now Ask AI to edit your content"),
7714
7769
  variant: "default"
7715
- }), m.current.click();
7770
+ }), g.current.click();
7716
7771
  } catch (b) {
7717
7772
  p(b);
7718
7773
  } finally {
@@ -7723,12 +7778,12 @@ const AIUserPrompt = ({ blockId: o }) => {
7723
7778
  Accordion,
7724
7779
  {
7725
7780
  onValueChange: (b) => {
7726
- g(b !== "");
7781
+ m(b !== "");
7727
7782
  },
7728
7783
  type: "single",
7729
7784
  collapsible: !0,
7730
7785
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
7731
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: m, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
7786
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: g, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
7732
7787
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
7733
7788
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7734
7789
  Textarea,
@@ -7740,7 +7795,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7740
7795
  className: "mt-1 w-full",
7741
7796
  rows: 10,
7742
7797
  onKeyDown: (b) => {
7743
- b.key === "Enter" && (b.preventDefault(), E());
7798
+ b.key === "Enter" && (b.preventDefault(), _());
7744
7799
  }
7745
7800
  }
7746
7801
  ),
@@ -7752,7 +7807,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7752
7807
  Button,
7753
7808
  {
7754
7809
  disabled: r.trim().length < 5,
7755
- onClick: () => E(),
7810
+ onClick: () => _(),
7756
7811
  variant: "default",
7757
7812
  className: "w-fit",
7758
7813
  size: "sm",
@@ -7781,7 +7836,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7781
7836
  AlertDialogAction,
7782
7837
  {
7783
7838
  onClick: () => {
7784
- a(""), E();
7839
+ a(""), _();
7785
7840
  },
7786
7841
  children: o("Yes, Delete")
7787
7842
  }
@@ -7802,42 +7857,42 @@ const AIUserPrompt = ({ blockId: o }) => {
7802
7857
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
7803
7858
  ] });
7804
7859
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
7805
- const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [x, m] = useState(""), E = useRef(null), b = useRef(null);
7860
+ const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [x, g] = useState(""), _ = useRef(null), b = useRef(null);
7806
7861
  useEffect(() => {
7807
7862
  l(n);
7808
7863
  }, [n]);
7809
- const _ = () => {
7864
+ const E = () => {
7810
7865
  if (i.startsWith("@")) {
7811
- m("Attribute keys cannot start with '@'");
7866
+ g("Attribute keys cannot start with '@'");
7812
7867
  return;
7813
7868
  }
7814
7869
  if (i) {
7815
7870
  const w = [...a, { key: i, value: d }];
7816
- r(w), l(a), c(""), u(""), m("");
7871
+ r(w), l(a), c(""), u(""), g("");
7817
7872
  }
7818
7873
  }, v = (w) => {
7819
- const A = a.filter((N, P) => P !== w);
7874
+ const A = a.filter((T, P) => P !== w);
7820
7875
  r(A), l(A);
7821
7876
  }, B = (w) => {
7822
- g(w), c(a[w].key), u(a[w].value);
7877
+ m(w), c(a[w].key), u(a[w].value);
7823
7878
  }, C = () => {
7824
7879
  if (i.startsWith("@")) {
7825
- m("Attribute keys cannot start with '@'");
7880
+ g("Attribute keys cannot start with '@'");
7826
7881
  return;
7827
7882
  }
7828
7883
  if (p !== null && i) {
7829
7884
  const w = [...a];
7830
- w[p] = { key: i, value: d }, r(w), l(w), g(null), c(""), u(""), m("");
7885
+ w[p] = { key: i, value: d }, r(w), l(w), m(null), c(""), u(""), g("");
7831
7886
  }
7832
7887
  }, I = (w) => {
7833
- w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? C() : _());
7888
+ w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? C() : E());
7834
7889
  };
7835
7890
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
7836
7891
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
7837
7892
  "form",
7838
7893
  {
7839
7894
  onSubmit: (w) => {
7840
- w.preventDefault(), p !== null ? C() : _();
7895
+ w.preventDefault(), p !== null ? C() : E();
7841
7896
  },
7842
7897
  className: "space-y-3",
7843
7898
  children: [
@@ -7851,7 +7906,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7851
7906
  autoCorrect: "off",
7852
7907
  spellCheck: "false",
7853
7908
  id: "attrKey",
7854
- ref: E,
7909
+ ref: _,
7855
7910
  value: i,
7856
7911
  onChange: (w) => c(w.target.value),
7857
7912
  placeholder: "Key",
@@ -8316,16 +8371,16 @@ function RemoveProviderConfirmation({
8316
8371
  }
8317
8372
  const PageDataProviders = () => {
8318
8373
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8319
- filter(n, (_) => map(r, "providerKey").includes(_.providerKey))
8320
- ), [d, u] = useState(""), [p, g] = useState(null), x = filter(
8321
- n.map((_) => map(i, "providerKey").includes(_.providerKey) ? null : { value: _.providerKey, label: _.name }),
8322
- (_) => !isNull(_)
8323
- ), m = (_) => {
8324
- const v = find(n, { providerKey: _ });
8374
+ filter(n, (E) => map(r, "providerKey").includes(E.providerKey))
8375
+ ), [d, u] = useState(""), [p, m] = useState(null), x = filter(
8376
+ n.map((E) => map(i, "providerKey").includes(E.providerKey) ? null : { value: E.providerKey, label: E.name }),
8377
+ (E) => !isNull(E)
8378
+ ), g = (E) => {
8379
+ const v = find(n, { providerKey: E });
8325
8380
  c((B) => [...B, v]), a((B) => [...B, { providerKey: v.providerKey, args: {} }]), u(""), l("UNSAVED");
8326
- }, E = (_) => {
8327
- c((v) => filter(v, (B) => B.providerKey !== _.providerKey)), a((v) => filter(v, (B) => B.providerKey !== _.providerKey)), l("UNSAVED");
8328
- }, b = (_) => g(_);
8381
+ }, _ = (E) => {
8382
+ c((v) => filter(v, (B) => B.providerKey !== E.providerKey)), a((v) => filter(v, (B) => B.providerKey !== E.providerKey)), l("UNSAVED");
8383
+ }, b = (E) => m(E);
8329
8384
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8330
8385
  o("no_data_providers"),
8331
8386
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8333,11 +8388,11 @@ const PageDataProviders = () => {
8333
8388
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
8334
8389
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
8335
8390
  /* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
8336
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (_) => m(_), children: [
8391
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (E) => g(E), children: [
8337
8392
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
8338
8393
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
8339
8394
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
8340
- x.map((_) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: _.value, children: _.label }, _.value))
8395
+ x.map((E) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: E.value, children: E.label }, E.value))
8341
8396
  ] })
8342
8397
  ] }) }),
8343
8398
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8346,21 +8401,21 @@ const PageDataProviders = () => {
8346
8401
  o("page_data_providers"),
8347
8402
  ":"
8348
8403
  ] }),
8349
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((_) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
8404
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
8350
8405
  "div",
8351
8406
  {
8352
8407
  className: "w-full rounded-lg border border-border bg-card text-card-foreground shadow-sm",
8353
8408
  "data-v0-t": "card",
8354
8409
  children: [
8355
8410
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
8356
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: _.name }),
8357
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: _.description })
8411
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: E.name }),
8412
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: E.description })
8358
8413
  ] }) }) }),
8359
8414
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
8360
8415
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8361
8416
  "button",
8362
8417
  {
8363
- onClick: () => b(_),
8418
+ onClick: () => b(E),
8364
8419
  className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
8365
8420
  children: [
8366
8421
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -8386,7 +8441,7 @@ const PageDataProviders = () => {
8386
8441
  ]
8387
8442
  }
8388
8443
  ),
8389
- /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(_), name: _.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
8444
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => _(E), name: E.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
8390
8445
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8391
8446
  "svg",
8392
8447
  {
@@ -8412,16 +8467,16 @@ const PageDataProviders = () => {
8412
8467
  ] })
8413
8468
  ]
8414
8469
  },
8415
- _.providerKey
8470
+ E.providerKey
8416
8471
  )) }),
8417
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => g(null), provider: p })
8472
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
8418
8473
  ] })
8419
8474
  ] });
8420
8475
  };
8421
8476
  function AiFillDatabase(o) {
8422
8477
  return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
8423
8478
  }
8424
- const TopBar = lazy(() => import("./Topbar-xeW18bO-.js"));
8479
+ const TopBar = lazy(() => import("./Topbar-EPvh-p9w.js"));
8425
8480
  function useSidebarMenuItems(o) {
8426
8481
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8427
8482
  return useMemo(() => {
@@ -8448,14 +8503,14 @@ function isDualLayout(o) {
8448
8503
  }
8449
8504
  const RootLayout = () => {
8450
8505
  const [o, n] = useState(0), [r] = useLayoutVariant(), [a, l] = useState(!1);
8451
- useChaiBuilderMsgListener(({ name: m }) => {
8452
- m === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
8506
+ useChaiBuilderMsgListener(({ name: g }) => {
8507
+ g === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
8453
8508
  });
8454
- const i = useBuilderProp("sideBarComponents.top", []), c = (m) => {
8455
- m.preventDefault();
8456
- }, d = (m) => {
8457
- n(o === m ? null : m);
8458
- }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), g = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
8509
+ const i = useBuilderProp("sideBarComponents.top", []), c = (g) => {
8510
+ g.preventDefault();
8511
+ }, d = (g) => {
8512
+ n(o === g ? null : g);
8513
+ }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
8459
8514
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: x, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
8460
8515
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8461
8516
  "div",
@@ -8466,19 +8521,19 @@ const RootLayout = () => {
8466
8521
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TopBar, {}) }) }),
8467
8522
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
8468
8523
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
8469
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: g.map((m, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8524
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8470
8525
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8471
8526
  Button,
8472
8527
  {
8473
- variant: o === E ? "default" : "ghost",
8528
+ variant: o === _ ? "default" : "ghost",
8474
8529
  className: "mb-2 rounded-lg p-2 transition-colors",
8475
- onClick: () => d(E),
8476
- children: get(m, "icon", null)
8530
+ onClick: () => d(_),
8531
+ children: get(g, "icon", null)
8477
8532
  },
8478
- E
8533
+ _
8479
8534
  ) }),
8480
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(m.label) }) })
8481
- ] }, "button" + E)) }),
8535
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(g.label) }) })
8536
+ ] }, "button" + _)) }),
8482
8537
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
8483
8538
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8484
8539
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", onClick: () => l(!0), children: /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutTemplate, { size: 20 }) }) }),
@@ -8496,10 +8551,10 @@ const RootLayout = () => {
8496
8551
  transition: { duration: 0.3, ease: "easeInOut" },
8497
8552
  children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-3", children: [
8498
8553
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
8499
- get(g, `${o}.icon`, null),
8500
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(g[o].label) })
8554
+ get(m, `${o}.icon`, null),
8555
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
8501
8556
  ] }),
8502
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(g, `${o}.component`, null), {}) }) })
8557
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(m, `${o}.component`, null), {}) }) })
8503
8558
  ] }) })
8504
8559
  }
8505
8560
  ),
@@ -8572,7 +8627,7 @@ const RootLayout = () => {
8572
8627
  }, r * 1e3);
8573
8628
  }, ChaiBuilderComponent = (o) => {
8574
8629
  const [, n] = useBlocksStore(), [, r] = useBrandingOptions(), a = useBuilderReset(), [l] = useAtom(builderSaveStateAtom), i = useMemo(() => o.layout || RootLayout, [o.layout]);
8575
- return useAtom(selectedLibraryAtom), useKeyEventWatcher(), useExpandTree(), useAutoSave(), useWatchGlobalBlocks(), useEffect(() => {
8630
+ return useAtom(selectedLibraryAtom), useKeyEventWatcher(), useExpandTree(), useAutoSave(), useWatchGlobalBlocks(), useWatchRSCBlocks(), useEffect(() => {
8576
8631
  builderStore.set(
8577
8632
  // @ts-ignore
8578
8633
  chaiBuilderPropsAtom,