@chaibuilder/sdk 2.0.0-beta.6 → 2.0.0-beta.8

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.
@@ -98,26 +98,26 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
98
98
  }
99
99
  }, p = (x, k, C) => {
100
100
  const A = /* @__PURE__ */ new Map();
101
- let I = !1;
101
+ let T = !1;
102
102
  C.forEach((L, P) => {
103
- !L && P === x && (L = k), L ? (A.set(P, L), k.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
- }), (I || k.d.size !== A.size) && (k.d = A);
103
+ !L && P === x && (L = k), L ? (A.set(P, L), k.d.get(P) !== L && (T = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
+ }), (T || k.d.size !== A.size) && (k.d = A);
105
105
  }, u = (x, k, C) => {
106
- const A = c(x), I = {
106
+ const A = c(x), T = {
107
107
  d: (A == null ? void 0 : A.d) || /* @__PURE__ */ new Map(),
108
108
  v: k
109
109
  };
110
- if (C && p(x, I, C), A && isEqualAtomValue(A, I) && A.d === I.d)
110
+ if (C && p(x, T, C), A && isEqualAtomValue(A, T) && A.d === T.d)
111
111
  return A;
112
- if (A && hasPromiseAtomValue(A) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(A, I)) {
113
- if (A.d === I.d)
112
+ if (A && hasPromiseAtomValue(A) && hasPromiseAtomValue(T) && isEqualPromiseAtomValue(A, T)) {
113
+ if (A.d === T.d)
114
114
  return A;
115
- I.v = A.v;
115
+ T.v = A.v;
116
116
  }
117
- return d(x, I), I;
117
+ return d(x, T), T;
118
118
  }, m = (x, k, C, A) => {
119
119
  if (isPromiseLike$2(k)) {
120
- let I;
120
+ let T;
121
121
  const L = new Promise((P, O) => {
122
122
  let M = !1;
123
123
  k.then(
@@ -129,7 +129,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
129
129
  L,
130
130
  C
131
131
  );
132
- resolvePromise(L, H), P(H), ($ == null ? void 0 : $.d) !== V.d && T(x, V, $ == null ? void 0 : $.d);
132
+ resolvePromise(L, H), P(H), ($ == null ? void 0 : $.d) !== V.d && I(x, V, $ == null ? void 0 : $.d);
133
133
  }
134
134
  },
135
135
  (H) => {
@@ -140,10 +140,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
140
140
  L,
141
141
  C
142
142
  );
143
- rejectPromise(L, H), O(H), ($ == null ? void 0 : $.d) !== V.d && T(x, V, $ == null ? void 0 : $.d);
143
+ rejectPromise(L, H), O(H), ($ == null ? void 0 : $.d) !== V.d && I(x, V, $ == null ? void 0 : $.d);
144
144
  }
145
145
  }
146
- ), I = (H) => {
146
+ ), T = (H) => {
147
147
  M || (M = !0, H.then(
148
148
  ($) => resolvePromise(L, $),
149
149
  ($) => rejectPromise(L, $)
@@ -151,16 +151,16 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
151
151
  };
152
152
  });
153
153
  return L.orig = k, L.status = "pending", registerCancelPromise(L, (P) => {
154
- P && I(P), A == null || A();
154
+ P && T(P), A == null || A();
155
155
  }), u(x, L, C);
156
156
  }
157
157
  return u(x, k, C);
158
158
  }, f = (x, k, C) => {
159
- const A = c(x), I = {
159
+ const A = c(x), T = {
160
160
  d: (A == null ? void 0 : A.d) || /* @__PURE__ */ new Map(),
161
161
  e: k
162
162
  };
163
- return C && p(x, I, C), A && isEqualAtomError(A, I) && A.d === I.d ? A : (d(x, I), I);
163
+ return C && p(x, T, C), A && isEqualAtomError(A, T) && A.d === T.d ? A : (d(x, T), T);
164
164
  }, g = (x) => {
165
165
  const k = c(x);
166
166
  if (k && (k.d.forEach((M, H) => {
@@ -173,7 +173,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
173
173
  return k;
174
174
  const C = /* @__PURE__ */ new Map();
175
175
  let A = !0;
176
- const I = (M) => {
176
+ const T = (M) => {
177
177
  if (M === x) {
178
178
  const $ = c(M);
179
179
  if ($)
@@ -198,7 +198,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
198
198
  }
199
199
  };
200
200
  try {
201
- const M = x.read(I, O);
201
+ const M = x.read(T, O);
202
202
  return m(
203
203
  x,
204
204
  M,
@@ -210,12 +210,12 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
210
210
  } finally {
211
211
  A = !1;
212
212
  }
213
- }, b = (x) => returnAtomValue(g(x)), E = (x) => {
213
+ }, E = (x) => returnAtomValue(g(x)), j = (x) => {
214
214
  let k = r.get(x);
215
- return k || (k = w(x)), k;
216
- }, j = (x, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(x)), v = (x) => {
215
+ return k || (k = R(x)), k;
216
+ }, b = (x, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(x)), v = (x) => {
217
217
  const k = r.get(x);
218
- k && j(x, k) && B(x);
218
+ k && b(x, k) && B(x);
219
219
  }, S = (x) => {
220
220
  const k = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), A = (L) => {
221
221
  const P = r.get(L);
@@ -227,7 +227,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
227
227
  });
228
228
  };
229
229
  A(x);
230
- const I = (L) => {
230
+ const T = (L) => {
231
231
  const P = r.get(L);
232
232
  P == null || P.t.forEach((O) => {
233
233
  var M;
@@ -241,14 +241,14 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
241
241
  }
242
242
  $ || k.forEach((V) => V.delete(O));
243
243
  }
244
- I(O);
244
+ T(O);
245
245
  }
246
246
  });
247
247
  };
248
- I(x);
249
- }, R = (x, ...k) => {
248
+ T(x);
249
+ }, w = (x, ...k) => {
250
250
  let C = !0;
251
- const A = (P) => returnAtomValue(g(P)), I = (P, ...O) => {
251
+ const A = (P) => returnAtomValue(g(P)), T = (P, ...O) => {
252
252
  let M;
253
253
  if (P === x) {
254
254
  if (!hasInitialValue(P))
@@ -256,7 +256,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
256
256
  const H = c(P), $ = m(P, O[0]);
257
257
  (!H || !isEqualAtomValue(H, $)) && S(P);
258
258
  } else
259
- M = R(P, ...O);
259
+ M = w(P, ...O);
260
260
  if (!C) {
261
261
  const H = N();
262
262
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
@@ -264,23 +264,23 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
264
264
  );
265
265
  }
266
266
  return M;
267
- }, L = x.write(A, I, ...k);
267
+ }, L = x.write(A, T, ...k);
268
268
  return C = !1, L;
269
269
  }, _ = (x, ...k) => {
270
- const C = R(x, ...k), A = N();
270
+ const C = w(x, ...k), A = N();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
- (I) => I({ type: "write", flushed: A })
272
+ (T) => T({ type: "write", flushed: A })
273
273
  ), C;
274
- }, w = (x, k) => {
274
+ }, R = (x, k) => {
275
275
  const C = {
276
276
  t: new Set(k && [k]),
277
277
  l: /* @__PURE__ */ new Set()
278
278
  };
279
- if (r.set(x, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(x), g(x).d.forEach((A, I) => {
280
- const L = r.get(I);
281
- L ? L.t.add(x) : I !== x && w(I, x);
279
+ if (r.set(x, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(x), g(x).d.forEach((A, T) => {
280
+ const L = r.get(T);
281
+ L ? L.t.add(x) : T !== x && R(T, x);
282
282
  }), g(x), isActuallyWritableAtom(x) && x.onMount) {
283
- const A = x.onMount((...I) => _(x, ...I));
283
+ const A = x.onMount((...T) => _(x, ...T));
284
284
  A && (C.u = A);
285
285
  }
286
286
  return C;
@@ -289,37 +289,37 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
289
289
  const C = (k = r.get(x)) == null ? void 0 : k.u;
290
290
  C && C(), r.delete(x), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(x);
291
291
  const A = c(x);
292
- A ? (hasPromiseAtomValue(A) && cancelPromise(A.v), A.d.forEach((I, L) => {
292
+ A ? (hasPromiseAtomValue(A) && cancelPromise(A.v), A.d.forEach((T, L) => {
293
293
  if (L !== x) {
294
294
  const P = r.get(L);
295
- P && (P.t.delete(x), j(L, P) && B(L));
295
+ P && (P.t.delete(x), b(L, P) && B(L));
296
296
  }
297
297
  })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", x);
298
- }, T = (x, k, C) => {
298
+ }, I = (x, k, C) => {
299
299
  const A = new Set(k.d.keys());
300
- C == null || C.forEach((I, L) => {
300
+ C == null || C.forEach((T, L) => {
301
301
  if (A.has(L)) {
302
302
  A.delete(L);
303
303
  return;
304
304
  }
305
305
  const P = r.get(L);
306
- P && (P.t.delete(x), j(L, P) && B(L));
307
- }), A.forEach((I) => {
308
- const L = r.get(I);
309
- L ? L.t.add(x) : r.has(x) && w(I, x);
306
+ P && (P.t.delete(x), b(L, P) && B(L));
307
+ }), A.forEach((T) => {
308
+ const L = r.get(T);
309
+ L ? L.t.add(x) : r.has(x) && R(T, x);
310
310
  });
311
311
  }, N = () => {
312
312
  let x;
313
313
  for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (x = /* @__PURE__ */ new Set()); n.size; ) {
314
314
  const k = Array.from(n);
315
315
  n.clear(), k.forEach(([C, A]) => {
316
- const I = c(C);
317
- if (I) {
318
- I.d !== (A == null ? void 0 : A.d) && T(C, I, A == null ? void 0 : A.d);
316
+ const T = c(C);
317
+ if (T) {
318
+ T.d !== (A == null ? void 0 : A.d) && I(C, T, A == null ? void 0 : A.d);
319
319
  const L = r.get(C);
320
320
  L && !// TODO This seems pretty hacky. Hope to fix it.
321
321
  // Maybe we could `mountDependencies` in `setAtomState`?
322
- (A && !hasPromiseAtomValue(A) && (isEqualAtomValue(A, I) || isEqualAtomError(A, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && x.add(C));
322
+ (A && !hasPromiseAtomValue(A) && (isEqualAtomValue(A, T) || isEqualAtomError(A, T))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && x.add(C));
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")), x;
329
329
  }, D = (x, k) => {
330
- const C = E(x), A = N(), I = C.l;
331
- return I.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
330
+ const C = j(x), A = N(), T = C.l;
331
+ return T.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
332
332
  (L) => L({ type: "sub", flushed: A })
333
333
  )), () => {
334
- I.delete(k), v(x), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
334
+ T.delete(k), v(x), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
335
335
  };
336
336
  };
337
337
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
338
- get: b,
338
+ get: E,
339
339
  set: _,
340
340
  sub: D,
341
341
  // store dev methods (these are tentative and subject to change without notice)
@@ -358,7 +358,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
358
358
  );
359
359
  }
360
360
  } : {
361
- get: b,
361
+ get: E,
362
362
  set: _,
363
363
  sub: D
364
364
  };
@@ -378,36 +378,36 @@ function splitAtom(o, r) {
378
378
  if (p)
379
379
  return p;
380
380
  const u = d && n.get(d), m = [], f = [];
381
- return c.forEach((g, b) => {
382
- const E = r ? r(g) : b;
383
- f[b] = E;
384
- const j = u && u.atomList[u.keyList.indexOf(E)];
385
- if (j) {
386
- m[b] = j;
381
+ return c.forEach((g, E) => {
382
+ const j = r ? r(g) : E;
383
+ f[E] = j;
384
+ const b = u && u.atomList[u.keyList.indexOf(j)];
385
+ if (b) {
386
+ m[E] = b;
387
387
  return;
388
388
  }
389
- const v = (R) => {
390
- const _ = R(l), w = R(o), T = a(w, _ == null ? void 0 : _.arr).keyList.indexOf(E);
391
- if (T < 0 || T >= w.length) {
392
- const N = c[a(c).keyList.indexOf(E)];
389
+ const v = (w) => {
390
+ const _ = w(l), R = w(o), I = a(R, _ == null ? void 0 : _.arr).keyList.indexOf(j);
391
+ if (I < 0 || I >= R.length) {
392
+ const N = c[a(c).keyList.indexOf(j)];
393
393
  if (N)
394
394
  return N;
395
395
  throw new Error("splitAtom: index out of bounds for read");
396
396
  }
397
- return w[T];
398
- }, S = (R, _, w) => {
399
- const B = R(l), T = R(o), D = a(T, B == null ? void 0 : B.arr).keyList.indexOf(E);
400
- if (D < 0 || D >= T.length)
397
+ return R[I];
398
+ }, S = (w, _, R) => {
399
+ const B = w(l), I = w(o), D = a(I, B == null ? void 0 : B.arr).keyList.indexOf(j);
400
+ if (D < 0 || D >= I.length)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const x = isFunction(w) ? w(T[D]) : w;
402
+ const x = isFunction(R) ? R(I[D]) : R;
403
403
  _(o, [
404
- ...T.slice(0, D),
404
+ ...I.slice(0, D),
405
405
  x,
406
- ...T.slice(D + 1)
406
+ ...I.slice(D + 1)
407
407
  ]);
408
408
  };
409
- m[b] = isWritable(o) ? atom(v, S) : atom(v);
410
- }), u && u.keyList.length === f.length && u.keyList.every((g, b) => g === f[b]) ? p = u : p = { arr: c, atomList: m, keyList: f }, n.set(c, p), p;
409
+ m[E] = isWritable(o) ? atom(v, S) : atom(v);
410
+ }), u && u.keyList.length === f.length && u.keyList.every((g, E) => g === f[E]) ? p = u : p = { arr: c, atomList: m, keyList: f }, n.set(c, p), p;
411
411
  }, l = atom((c) => {
412
412
  const d = c(l), p = c(o);
413
413
  return a(p, d == null ? void 0 : d.arr);
@@ -1201,65 +1201,65 @@ const useBlocksStoreManager = () => {
1201
1201
  updateBlocksProps: c
1202
1202
  } = useBlocksStoreManager();
1203
1203
  return {
1204
- moveBlocks: (E, j, v) => {
1205
- const S = map(E, (_) => {
1204
+ moveBlocks: (j, b, v) => {
1205
+ const S = map(j, (_) => {
1206
1206
  const B = r.find((D) => D._id === _)._parent || null, N = r.filter((D) => B ? D._parent === B : !D._parent).map((D) => D._id).indexOf(_);
1207
1207
  return { _id: _, oldParent: B, oldPosition: N };
1208
- }), R = S.find(({ _id: _ }) => _ === E[0]);
1209
- R && R.oldParent === j && R.oldPosition === v || (i(E, j, v), o({
1210
- undo: () => each(S, ({ _id: _, oldParent: w, oldPosition: B }) => {
1211
- i([_], w, B);
1208
+ }), w = S.find(({ _id: _ }) => _ === j[0]);
1209
+ w && w.oldParent === b && w.oldPosition === v || (i(j, b, v), o({
1210
+ undo: () => each(S, ({ _id: _, oldParent: R, oldPosition: B }) => {
1211
+ i([_], R, B);
1212
1212
  }),
1213
- redo: () => i(E, j, v)
1213
+ redo: () => i(j, b, v)
1214
1214
  }));
1215
1215
  },
1216
- addBlocks: (E, j, v) => {
1217
- a(E, j, v), o({
1218
- undo: () => l(map(E, "_id")),
1219
- redo: () => a(E, j, v)
1216
+ addBlocks: (j, b, v) => {
1217
+ a(j, b, v), o({
1218
+ undo: () => l(map(j, "_id")),
1219
+ redo: () => a(j, b, v)
1220
1220
  });
1221
1221
  },
1222
- removeBlocks: (E) => {
1223
- var R;
1224
- const j = (R = first(E)) == null ? void 0 : R._parent, S = r.filter((_) => j ? _._parent === j : !_._parent).indexOf(first(E));
1225
- l(map(E, "_id")), o({
1226
- undo: () => a(E, j, S),
1227
- redo: () => l(map(E, "_id"))
1222
+ removeBlocks: (j) => {
1223
+ var w;
1224
+ const b = (w = first(j)) == null ? void 0 : w._parent, S = r.filter((_) => b ? _._parent === b : !_._parent).indexOf(first(j));
1225
+ l(map(j, "_id")), o({
1226
+ undo: () => a(j, b, S),
1227
+ redo: () => l(map(j, "_id"))
1228
1228
  });
1229
1229
  },
1230
- updateBlocks: (E, j, v) => {
1230
+ updateBlocks: (j, b, v) => {
1231
1231
  let S = [];
1232
1232
  if (v)
1233
- S = map(E, (R) => ({ _id: R, ...v }));
1233
+ S = map(j, (w) => ({ _id: w, ...v }));
1234
1234
  else {
1235
- const R = keys(j);
1236
- S = map(E, (_) => {
1237
- const w = r.find((T) => T._id === _), B = { _id: _ };
1238
- return each(R, (T) => B[T] = w[T]), B;
1235
+ const w = keys(b);
1236
+ S = map(j, (_) => {
1237
+ const R = r.find((I) => I._id === _), B = { _id: _ };
1238
+ return each(w, (I) => B[I] = R[I]), B;
1239
1239
  });
1240
1240
  }
1241
- c(map(E, (R) => ({ _id: R, ...j }))), o({
1241
+ c(map(j, (w) => ({ _id: w, ...b }))), o({
1242
1242
  undo: () => c(S),
1243
- redo: () => c(map(E, (R) => ({ _id: R, ...j })))
1243
+ redo: () => c(map(j, (w) => ({ _id: w, ...b })))
1244
1244
  });
1245
1245
  },
1246
- updateBlocksRuntime: (E, j) => {
1247
- c(map(E, (v) => ({ _id: v, ...j })));
1246
+ updateBlocksRuntime: (j, b) => {
1247
+ c(map(j, (v) => ({ _id: v, ...b })));
1248
1248
  },
1249
- setNewBlocks: (E) => {
1250
- n(E), o({
1249
+ setNewBlocks: (j) => {
1250
+ n(j), o({
1251
1251
  undo: () => n(r),
1252
- redo: () => n(E)
1252
+ redo: () => n(j)
1253
1253
  });
1254
1254
  },
1255
- updateMultipleBlocksProps: (E) => {
1256
- let j = [];
1257
- j = map(E, (v) => {
1258
- const S = keys(v), R = r.find((w) => w._id === v._id), _ = {};
1259
- return each(S, (w) => _[w] = R[w]), _;
1260
- }), c(E), o({
1261
- undo: () => c(j),
1262
- redo: () => c(E)
1255
+ updateMultipleBlocksProps: (j) => {
1256
+ let b = [];
1257
+ b = map(j, (v) => {
1258
+ const S = keys(v), w = r.find((R) => R._id === v._id), _ = {};
1259
+ return each(S, (R) => _[R] = w[R]), _;
1260
+ }), c(j), o({
1261
+ undo: () => c(b),
1262
+ redo: () => c(j)
1263
1263
  });
1264
1264
  }
1265
1265
  };
@@ -1267,12 +1267,12 @@ const useBlocksStoreManager = () => {
1267
1267
  const [o] = useBlocksStore(), [, r] = useSelectedBlockIds(), { addBlocks: n } = useBlocksStoreUndoableActions(), a = useCallback(
1268
1268
  (i, c, d) => {
1269
1269
  var g;
1270
- for (let b = 0; b < i.length; b++) {
1271
- const { _id: E } = i[b];
1272
- i[b]._id = generateUUID();
1273
- const j = filter(i, { _parent: E });
1274
- for (let v = 0; v < j.length; v++)
1275
- j[v]._parent = i[b]._id;
1270
+ for (let E = 0; E < i.length; E++) {
1271
+ const { _id: j } = i[E];
1272
+ i[E]._id = generateUUID();
1273
+ const b = filter(i, { _parent: j });
1274
+ for (let v = 0; v < b.length; v++)
1275
+ b[v]._parent = i[E]._id;
1276
1276
  }
1277
1277
  const p = first(i);
1278
1278
  let u, m;
@@ -1289,9 +1289,9 @@ const useBlocksStoreManager = () => {
1289
1289
  const p = generateUUID(), u = getBlockDefaultProps(i.props), m = [];
1290
1290
  forIn(u, (v, S) => {
1291
1291
  if (startsWith(v, SLOT_KEY)) {
1292
- const R = v.replace(SLOT_KEY, "");
1292
+ const w = v.replace(SLOT_KEY, "");
1293
1293
  m.push({
1294
- _id: R,
1294
+ _id: w,
1295
1295
  _type: "Slot",
1296
1296
  _parent: p,
1297
1297
  _name: i.props[S].name,
@@ -1305,10 +1305,10 @@ const useBlocksStoreManager = () => {
1305
1305
  _id: p,
1306
1306
  ...u
1307
1307
  };
1308
- let g, b;
1309
- c && (g = find(o, { _id: c }), f._parent = c, b = c), !canAcceptChildBlock(g == null ? void 0 : g._type, f._type) && g && (f._parent = g._parent, b = g._parent);
1310
- const j = [f, ...m];
1311
- return n(j, b, d), r([f._id]), f;
1308
+ let g, E;
1309
+ c && (g = find(o, { _id: c }), f._parent = c, E = c), !canAcceptChildBlock(g == null ? void 0 : g._type, f._type) && g && (f._parent = g._parent, E = g._parent);
1310
+ const b = [f, ...m];
1311
+ return n(b, E, d), r([f._id]), f;
1312
1312
  },
1313
1313
  [a, o, r]
1314
1314
  ), addPredefinedBlock: a };
@@ -2424,7 +2424,7 @@ function getNewClasses(o = "", r = "", n = []) {
2424
2424
  const g = find(l, pick(m, ["property"]));
2425
2425
  f && (l = filter(
2426
2426
  l,
2427
- (b) => b.fullCls !== (g == null ? void 0 : g.fullCls)
2427
+ (E) => E.fullCls !== (g == null ? void 0 : g.fullCls)
2428
2428
  )), c.push({
2429
2429
  ...m,
2430
2430
  fullCls: m.cls,
@@ -2578,10 +2578,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2578
2578
  const d = o(c), p = a;
2579
2579
  let { classes: u, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2580
2580
  return each(p, (f) => {
2581
- const g = f.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), b = new RegExp(`(^| )${g}($| )`, "g");
2582
- u = u.replace(b, " ").replace(/ +/g, " ").trim();
2583
- const E = first(f.split(":"));
2584
- includes(["2xl", "xl", "lg", "md", "sm"], E) && p.push(f.split(":").pop().trim());
2581
+ const g = f.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${g}($| )`, "g");
2582
+ u = u.replace(E, " ").replace(/ +/g, " ").trim();
2583
+ const j = first(f.split(":"));
2584
+ includes(["2xl", "xl", "lg", "md", "sm"], j) && p.push(f.split(":").pop().trim());
2585
2585
  }), each(p, (f) => {
2586
2586
  const g = new RegExp(`(^| )${f.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2587
2587
  m = m.replace(g, " ").replace(/ +/g, " ").trim();
@@ -3080,11 +3080,11 @@ const useDnd = () => {
3080
3080
  g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
3081
3081
  },
3082
3082
  onDrop: (g) => {
3083
- var w;
3084
- const b = dropTarget, j = getOrientation(b) === "vertical" ? g.clientY + ((w = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : w.scrollY) : g.clientX;
3085
- dropIndex = calculateDropIndex(j, possiblePositions);
3086
- const v = d, S = b.getAttribute("data-block-id"), R = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3087
- if ((v == null ? void 0 : v._id) === S || !R) {
3083
+ var R;
3084
+ const E = dropTarget, b = getOrientation(E) === "vertical" ? g.clientY + ((R = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : R.scrollY) : g.clientX;
3085
+ dropIndex = calculateDropIndex(b, possiblePositions);
3086
+ const v = d, S = E.getAttribute("data-block-id"), w = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3087
+ if ((v == null ? void 0 : v._id) === S || !w) {
3088
3088
  f();
3089
3089
  return;
3090
3090
  }
@@ -3092,14 +3092,14 @@ const useDnd = () => {
3092
3092
  a(v, S === "canvas" ? null : S, dropIndex), setTimeout(f, 300);
3093
3093
  return;
3094
3094
  }
3095
- let _ = b.getAttribute("data-block-id");
3095
+ let _ = E.getAttribute("data-block-id");
3096
3096
  _ === null && (_ = g.target.parentElement.getAttribute("data-block-id")), c([v._id], _ === "canvas" ? null : _, dropIndex), f(), setTimeout(removePlaceholder, 300);
3097
3097
  },
3098
3098
  onDragEnter: (g) => {
3099
- const b = g, E = b.target;
3100
- dropTarget = E;
3101
- const j = E.getAttribute("data-block-id"), v = E.getAttribute("data-dnd-dragged") !== "yes";
3102
- u(j), b.stopPropagation(), b.preventDefault(), possiblePositions = [], v && calculatePossiblePositions(E), n(!0), l(""), i([]);
3099
+ const E = g, j = E.target;
3100
+ dropTarget = j;
3101
+ const b = j.getAttribute("data-block-id"), v = j.getAttribute("data-dnd-dragged") !== "yes";
3102
+ u(b), E.stopPropagation(), E.preventDefault(), possiblePositions = [], v && calculatePossiblePositions(j), n(!0), l(""), i([]);
3103
3103
  },
3104
3104
  onDragLeave: (g) => {
3105
3105
  g.target.getAttribute("data-block-id") === "canvas" && (u(null), n(!1), removePlaceholder(), possiblePositions = []);
@@ -3184,8 +3184,8 @@ const useHandleCanvasDblClick = () => {
3184
3184
  if (f) {
3185
3185
  const g = f.getAttribute("data-style-prop");
3186
3186
  if (g) {
3187
- const b = f.getAttribute("data-style-id"), E = f.getAttribute("data-block-parent");
3188
- l([{ id: b, prop: g, blockId: E }]);
3187
+ const E = f.getAttribute("data-style-id"), j = f.getAttribute("data-block-parent");
3188
+ l([{ id: E, prop: g, blockId: j }]);
3189
3189
  }
3190
3190
  }
3191
3191
  }, 100);
@@ -3285,13 +3285,13 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3285
3285
  tabIndex: 0,
3286
3286
  ref: u.setFloating,
3287
3287
  style: p,
3288
- onClick: (b) => {
3289
- b.stopPropagation(), b.preventDefault();
3288
+ onClick: (E) => {
3289
+ E.stopPropagation(), E.preventDefault();
3290
3290
  },
3291
- onMouseEnter: (b) => {
3292
- b.stopPropagation(), i(null);
3291
+ onMouseEnter: (E) => {
3292
+ E.stopPropagation(), i(null);
3293
3293
  },
3294
- onKeyDown: (b) => b.stopPropagation(),
3294
+ onKeyDown: (E) => E.stopPropagation(),
3295
3295
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
3296
3296
  children: [
3297
3297
  f && /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3336,19 +3336,19 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3336
3336
  useEffect(() => {
3337
3337
  n ? c == null || c.documentElement.classList.add("dark") : c == null || c.documentElement.classList.remove("dark");
3338
3338
  }, [n, c]);
3339
- const g = get(o, "headingFont", "DM Sans"), b = get(o, "bodyFont", "DM Sans");
3339
+ const g = get(o, "headingFont", "DM Sans"), E = get(o, "bodyFont", "DM Sans");
3340
3340
  return useEffect(() => {
3341
- const E = get(o, "primaryColor", "#000"), j = get(o, "secondaryColor", "#FFF"), v = get(o, "bodyBgLightColor", "#fff"), S = get(o, "bodyBgDarkColor", "#000"), R = get(o, "bodyTextDarkColor", "#000"), _ = get(o, "bodyTextLightColor", "#fff"), w = s({
3342
- colors: [E, j],
3341
+ const j = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), v = get(o, "bodyBgLightColor", "#fff"), S = get(o, "bodyBgDarkColor", "#000"), w = get(o, "bodyTextDarkColor", "#000"), _ = get(o, "bodyTextLightColor", "#fff"), R = s({
3342
+ colors: [j, b],
3343
3343
  names: ["primary", "secondary"]
3344
3344
  });
3345
- set(w, "primary.DEFAULT", E), set(w, "secondary.DEFAULT", j);
3345
+ set(R, "primary.DEFAULT", j), set(R, "secondary.DEFAULT", b);
3346
3346
  const B = {
3347
3347
  "bg-light": v,
3348
3348
  "bg-dark": S,
3349
- "text-dark": R,
3349
+ "text-dark": w,
3350
3350
  "text-light": _
3351
- }, T = get(o, "roundedCorners", "0");
3351
+ }, I = get(o, "roundedCorners", "0");
3352
3352
  !d || !d.tailwind || (d.tailwind.config = {
3353
3353
  darkMode: "class",
3354
3354
  theme: {
@@ -3362,12 +3362,12 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3362
3362
  },
3363
3363
  fontFamily: {
3364
3364
  heading: [g],
3365
- body: [b]
3365
+ body: [E]
3366
3366
  },
3367
3367
  borderRadius: {
3368
- DEFAULT: `${T || "0"}px`
3368
+ DEFAULT: `${I || "0"}px`
3369
3369
  },
3370
- colors: { ...B, ...w }
3370
+ colors: { ...B, ...R }
3371
3371
  }
3372
3372
  },
3373
3373
  plugins: [
@@ -3392,8 +3392,8 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3392
3392
  })
3393
3393
  ]
3394
3394
  });
3395
- }, [o, d, g, b]), useEffect(() => {
3396
- u && (u.textContent = `${map(r, (E) => `[data-block-id="${E}"]`).join(",")}{
3395
+ }, [o, d, g, E]), useEffect(() => {
3396
+ u && (u.textContent = `${map(r, (j) => `[data-block-id="${j}"]`).join(",")}{
3397
3397
  outline: 1px solid ${r.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
3398
3398
  }`);
3399
3399
  }, [r, u]), useEffect(() => {
@@ -3401,16 +3401,16 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3401
3401
  }, [l, f]), useEffect(() => {
3402
3402
  p && (p.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3403
3403
  }, [p]), useEffect(() => {
3404
- m && (m.textContent = `${map(a, ({ id: E }) => `[data-style-id="${E}"]`).join(",")}{
3404
+ m && (m.textContent = `${map(a, ({ id: j }) => `[data-style-id="${j}"]`).join(",")}{
3405
3405
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3406
3406
  }`);
3407
3407
  }, [a, m]), useEffect(() => {
3408
3408
  c.querySelector("#drop-target-block").innerHTML = i ? `[data-block-id="${i}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3409
- }, [i]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (g || b) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3409
+ }, [i]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (g || E) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3410
3410
  "link",
3411
3411
  {
3412
3412
  rel: "stylesheet",
3413
- href: `https://fonts.googleapis.com/css2?family=${g ? `${g.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` : ""}${g && b && g !== b ? "&" : ""}${b && b !== g ? `family=${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` : ""}&display=swap`
3413
+ href: `https://fonts.googleapis.com/css2?family=${g ? `${g.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` : ""}${g && E && g !== E ? "&" : ""}${E && E !== g ? `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`
3414
3414
  }
3415
3415
  ) });
3416
3416
  }, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, r) => {
@@ -3528,46 +3528,46 @@ function applyLanguage(o, r, n) {
3528
3528
  }), a;
3529
3529
  }
3530
3530
  function BlocksRendererStatic({ blocks: o, allBlocks: r }) {
3531
- const { selectedLang: n } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [p] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), f = useCallback((j) => getStyleAttrs(j, d), [d]), [g] = useChaiExternalData(), [b] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3532
- (j) => j.reduce((v, S) => {
3533
- const R = get(p, S, {});
3534
- return { ...v, ...R };
3531
+ const { selectedLang: n } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [p] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), f = useCallback((b) => getStyleAttrs(b, d), [d]), [g] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), j = useCallback(
3532
+ (b) => b.reduce((v, S) => {
3533
+ const w = get(p, S, {});
3534
+ return { ...v, ...w };
3535
3535
  }, {}),
3536
3536
  [p]
3537
3537
  );
3538
3538
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3539
- o.map((j, v) => {
3540
- if (b === j._id || u.includes(j._id))
3539
+ o.map((b, v) => {
3540
+ if (E === b._id || u.includes(b._id))
3541
3541
  return null;
3542
- const S = {}, R = filter(r, { _parent: j._id });
3543
- if (S.children = R.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: r, blocks: R }) : null, j._type === "GlobalBlock") {
3544
- const C = m(j);
3542
+ const S = {}, w = filter(r, { _parent: b._id });
3543
+ if (S.children = w.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: r, blocks: w }) : null, b._type === "GlobalBlock") {
3544
+ const C = m(b);
3545
3545
  S.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (A) => !A._parent), allBlocks: C });
3546
3546
  }
3547
- const _ = getBlockComponent(j._type), w = get(_, "server", !1), B = w ? RSCBlock : get(_, "builderComponent", get(_, "component", null));
3547
+ const _ = getBlockComponent(b._type), R = get(_, "server", !1), B = R ? RSCBlock : get(_, "builderComponent", get(_, "component", null));
3548
3548
  if (isNull(B))
3549
- return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${j == null ? void 0 : j._type} not registered -->` });
3550
- const T = has(_, "getBlockStateFrom") ? _ == null ? void 0 : _.getBlockStateFrom(j, r) : [], N = E(T), D = f(j);
3551
- if (get(D, "__isHidden", !1) && !includes(a, j._id))
3549
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
3550
+ const I = has(_, "getBlockStateFrom") ? _ == null ? void 0 : _.getBlockStateFrom(b, r) : [], N = j(I), D = f(b);
3551
+ if (get(D, "__isHidden", !1) && !includes(a, b._id))
3552
3552
  return null;
3553
- const x = i && isDescendant(i._id, j._id, r), k = {
3554
- ...includes(a, j._id) ? { "force-show": "" } : {},
3555
- "data-block-id": j._id,
3556
- "data-block-type": j._type,
3553
+ const x = i && isDescendant(i._id, b._id, r), k = {
3554
+ ...includes(a, b._id) ? { "force-show": "" } : {},
3555
+ "data-block-id": b._id,
3556
+ "data-block-type": b._type,
3557
3557
  ...i ? (
3558
3558
  // @ts-ignore
3559
3559
  {
3560
- "data-dnd": canAcceptChildBlock(j._type, i == null ? void 0 : i._type) ? "yes" : "no",
3561
- "data-dnd-dragged": i._id === j._id || x ? "yes" : "no"
3560
+ "data-dnd": canAcceptChildBlock(b._type, i == null ? void 0 : i._type) ? "yes" : "no",
3561
+ "data-dnd-dragged": i._id === b._id || x ? "yes" : "no"
3562
3562
  }
3563
3563
  ) : {},
3564
- ...c === j._id && !x ? { "data-drop": "yes" } : {},
3565
- ...includes(l, j._id) ? { "data-cut-block": "yes" } : {}
3564
+ ...c === b._id && !x ? { "data-drop": "yes" } : {},
3565
+ ...includes(l, b._id) ? { "data-cut-block": "yes" } : {}
3566
3566
  };
3567
- return w ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: j, blockProps: k }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(B, {
3567
+ return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: k }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(B, {
3568
3568
  blockProps: k,
3569
3569
  index: v,
3570
- ...applyBindings(applyLanguage(j, n, _), g),
3570
+ ...applyBindings(applyLanguage(b, n, _), g),
3571
3571
  ...omit(D, ["__isHidden"]),
3572
3572
  ...S,
3573
3573
  inBuilder: !0,
@@ -3625,47 +3625,47 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3625
3625
  };
3626
3626
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
3627
3627
  }, getElementByStyleId = (o, r) => o.querySelector(`[data-style-id="${r}"]`), StaticCanvas = () => {
3628
- const [o] = useAtom$1(networkModeAtom), [r] = useCanvasWidth(), [, n] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [m, f] = useState([]), [, g] = useState([]), [, b] = useAtom$1(canvasIframeAtom), [E, j] = useSelectedStylingBlocks(), v = useBuilderProp("loading", !1), S = useBuilderProp("htmlDir", "ltr"), R = (B) => {
3629
- p((T) => ({ ...T, width: B }));
3628
+ const [o] = useAtom$1(networkModeAtom), [r] = useCanvasWidth(), [, n] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [m, f] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [j, b] = useSelectedStylingBlocks(), v = useBuilderProp("loading", !1), S = useBuilderProp("htmlDir", "ltr"), w = (B) => {
3629
+ p((I) => ({ ...I, width: B }));
3630
3630
  };
3631
3631
  useEffect(() => {
3632
3632
  if (!c.current)
3633
3633
  return;
3634
- const { clientWidth: B, clientHeight: T } = c.current;
3635
- p({ width: B, height: T });
3634
+ const { clientWidth: B, clientHeight: I } = c.current;
3635
+ p({ width: B, height: I });
3636
3636
  }, [c, r]);
3637
- const _ = (B, T = 0) => {
3637
+ const _ = (B, I = 0) => {
3638
3638
  const { top: N } = B.getBoundingClientRect();
3639
- return N + T >= 0 && N - T <= window.innerHeight;
3639
+ return N + I >= 0 && N - I <= window.innerHeight;
3640
3640
  };
3641
3641
  useEffect(() => {
3642
- var B, T;
3642
+ var B, I;
3643
3643
  if (a && a.type !== "Multiple" && i.current) {
3644
3644
  const N = getElementByDataBlockId(i.current.contentDocument, a._id);
3645
- N && (_(N) || (T = (B = i.current) == null ? void 0 : B.contentWindow) == null || T.scrollTo({ top: N.offsetTop, behavior: "smooth" }), f([N]));
3645
+ N && (_(N) || (I = (B = i.current) == null ? void 0 : B.contentWindow) == null || I.scrollTo({ top: N.offsetTop, behavior: "smooth" }), f([N]));
3646
3646
  }
3647
3647
  }, [a]), useEffect(() => {
3648
- if (!isEmpty(E) && i.current) {
3648
+ if (!isEmpty(j) && i.current) {
3649
3649
  const B = getElementByStyleId(
3650
3650
  i.current.contentDocument,
3651
- first(E).id
3651
+ first(j).id
3652
3652
  );
3653
3653
  g(B ? [B] : [null]);
3654
3654
  } else
3655
3655
  g([null]);
3656
- }, [E]);
3657
- const w = useMemo(() => {
3656
+ }, [j]);
3657
+ const R = useMemo(() => {
3658
3658
  let B = IframeInitialContent;
3659
3659
  return B = B.replace("__HTML_DIR__", S), o === "offline" && (B = B.replace(
3660
3660
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3661
3661
  "/offline/tailwind.cdn.js"
3662
3662
  ), B = B.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), B = B.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), B;
3663
3663
  }, [o, S]);
3664
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: R, onResize: R, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3664
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: w, onResize: w, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3665
3665
  "div",
3666
3666
  {
3667
3667
  onClick: () => {
3668
- n([]), j([]);
3668
+ n([]), b([]);
3669
3669
  },
3670
3670
  onMouseLeave: () => setTimeout(() => l(""), 300),
3671
3671
  className: "relative mx-auto h-full w-full overflow-hidden",
@@ -3673,12 +3673,12 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3673
3673
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3674
3674
  ChaiFrame,
3675
3675
  {
3676
- contentDidMount: () => b(i.current),
3676
+ contentDidMount: () => E(i.current),
3677
3677
  ref: i,
3678
3678
  id: "canvas-iframe",
3679
3679
  style: { ...u, ...isEmpty(u) ? { width: `${r}px` } : {} },
3680
3680
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3681
- initialContent: w,
3681
+ initialContent: R,
3682
3682
  children: [
3683
3683
  /* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
3684
3684
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3801,7 +3801,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3801
3801
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3802
3802
  ] }, l))
3803
3803
  ] }) });
3804
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-D-BYzobl.js")), CanvasArea = () => {
3804
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-BUKZyPNe.js")), CanvasArea = () => {
3805
3805
  const [o] = useCodeEditor(), r = useBuilderProp("onError", noop);
3806
3806
  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: [
3807
3807
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
@@ -3876,17 +3876,17 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3876
3876
  showHeading: o = !0,
3877
3877
  className: r = ""
3878
3878
  }) => {
3879
- const [n, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(n), { t: c } = useTranslation(), d = ({ formData: w }, B) => {
3880
- B && (a(w), i.current = w);
3879
+ const [n, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(n), { t: c } = useTranslation(), d = ({ formData: R }, B) => {
3880
+ B && (a(R), i.current = R);
3881
3881
  }, {
3882
3882
  bodyFont: p,
3883
3883
  headingFont: u,
3884
3884
  primaryColor: m,
3885
3885
  bodyTextDarkColor: f,
3886
3886
  bodyTextLightColor: g,
3887
- bodyBgDarkColor: b,
3888
- secondaryColor: E,
3889
- bodyBgLightColor: j,
3887
+ bodyBgDarkColor: E,
3888
+ secondaryColor: j,
3889
+ bodyBgLightColor: b,
3890
3890
  roundedCorners: v
3891
3891
  } = n;
3892
3892
  let S = {
@@ -3905,13 +3905,13 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3905
3905
  default: parseInt(v || 5, 10)
3906
3906
  }),
3907
3907
  primaryColor: h({ title: c("Theme Config.Primary"), default: m }),
3908
- secondaryColor: h({ title: c("Theme Config.Secondary"), default: E })
3908
+ secondaryColor: h({ title: c("Theme Config.Secondary"), default: j })
3909
3909
  };
3910
3910
  l || (S = {
3911
3911
  ...S,
3912
3912
  bodyBgLightColor: h({
3913
3913
  title: c("Theme Config.Background"),
3914
- default: j
3914
+ default: b
3915
3915
  }),
3916
3916
  bodyTextLightColor: h({
3917
3917
  title: c("Theme Config.Text Color"),
@@ -3919,20 +3919,20 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3919
3919
  }),
3920
3920
  bodyBgDarkColor: h({
3921
3921
  title: c("Theme Config.Background Dark Mode"),
3922
- default: b
3922
+ default: E
3923
3923
  }),
3924
3924
  bodyTextDarkColor: h({
3925
3925
  title: c("Theme Config.Text Color Dark Mode"),
3926
3926
  default: g
3927
3927
  })
3928
3928
  });
3929
- const R = {
3929
+ const w = {
3930
3930
  type: "object",
3931
3931
  properties: {}
3932
3932
  }, _ = {};
3933
- return Object.keys(S).forEach((w) => {
3934
- const B = S[w];
3935
- return R.properties || (R.properties = {}), R.properties[w] = B.schema, _[w] = B.uiSchema, !0;
3933
+ return Object.keys(S).forEach((R) => {
3934
+ const B = S[R];
3935
+ return w.properties || (w.properties = {}), w.properties[R] = B.schema, _[R] = B.uiSchema, !0;
3936
3936
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", r), children: [
3937
3937
  o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: c("Theme Configuration") }) }) : null,
3938
3938
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3945,7 +3945,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3945
3945
  liveOmit: !0,
3946
3946
  liveValidate: !0,
3947
3947
  uiSchema: _,
3948
- schema: R,
3948
+ schema: w,
3949
3949
  formData: n,
3950
3950
  validator,
3951
3951
  onChange: d
@@ -4128,34 +4128,34 @@ function BiExpandVertical(o) {
4128
4128
  const Node = memo(({ node: o, style: r, dragHandle: n }) => {
4129
4129
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
4130
4130
  let p = null;
4131
- const u = o.children.length > 0, { highlightBlock: m, clearHighlight: f } = useBlockHighlight(), { id: g, data: b, isSelected: E, willReceiveDrop: j, isDragging: v, isEditing: S, handleClick: R } = o, _ = (x) => {
4131
+ const u = o.children.length > 0, { highlightBlock: m, clearHighlight: f } = useBlockHighlight(), { id: g, data: E, isSelected: j, willReceiveDrop: b, isDragging: v, isEditing: S, handleClick: w } = o, _ = (x) => {
4132
4132
  x.stopPropagation(), !i.includes(g) && o.toggle();
4133
- }, w = (x) => {
4133
+ }, R = (x) => {
4134
4134
  x.isInternal && (p = x.isOpen, x.isOpen && x.close());
4135
4135
  }, B = (x) => {
4136
4136
  x.isInternal && p !== null && (p ? x.open() : x.close(), p = null);
4137
- }, T = (x) => {
4138
- x.stopPropagation(), !o.isOpen && !i.includes(g) && o.toggle(), R(x);
4137
+ }, I = (x) => {
4138
+ x.stopPropagation(), !o.isOpen && !i.includes(g) && o.toggle(), w(x);
4139
4139
  };
4140
4140
  useEffect(() => {
4141
4141
  const x = setTimeout(() => {
4142
- j && !o.isOpen && !v && !i.includes(g) && o.toggle();
4142
+ b && !o.isOpen && !v && !i.includes(g) && o.toggle();
4143
4143
  }, 500);
4144
4144
  return () => clearTimeout(x);
4145
- }, [j, o, v]);
4145
+ }, [b, o, v]);
4146
4146
  const N = useMemo(() => {
4147
- const x = Object.keys(b), k = [];
4147
+ const x = Object.keys(E), k = [];
4148
4148
  for (let C = 0; C < x.length; C++)
4149
4149
  if (x[C].endsWith("_attrs")) {
4150
- const A = b[x[C]], I = Object.keys(A).join("|");
4151
- I.match(/x-data/) && k.push("data"), I.match(/x-on/) && k.push("event"), I.match(/x-show|x-if/) && k.push("show");
4150
+ const A = E[x[C]], T = Object.keys(A).join("|");
4151
+ T.match(/x-data/) && k.push("data"), T.match(/x-on/) && k.push("event"), T.match(/x-show|x-if/) && k.push("show");
4152
4152
  }
4153
4153
  return k;
4154
- }, [b]), D = (x, k) => {
4154
+ }, [E]), D = (x, k) => {
4155
4155
  const C = d.contentDocument || d.contentWindow.document, A = C.querySelector(`[data-block-id=${x}]`);
4156
4156
  A && A.setAttribute("data-drop", k);
4157
- const I = A.getBoundingClientRect(), L = d.getBoundingClientRect();
4158
- I.top >= L.top && I.left >= L.left && I.bottom <= L.bottom && I.right <= L.right || (C.documentElement.scrollTop = A.offsetTop - L.top);
4157
+ const T = A.getBoundingClientRect(), L = d.getBoundingClientRect();
4158
+ T.top >= L.top && T.left >= L.left && T.bottom <= L.bottom && T.right <= L.right || (C.documentElement.scrollTop = A.offsetTop - L.top);
4159
4159
  };
4160
4160
  return g === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4161
4161
  "button",
@@ -4172,11 +4172,11 @@ const Node = memo(({ node: o, style: r, dragHandle: n }) => {
4172
4172
  {
4173
4173
  onMouseEnter: () => m(g),
4174
4174
  onMouseLeave: () => f(),
4175
- onClick: T,
4175
+ onClick: I,
4176
4176
  style: r,
4177
4177
  "data-node-id": g,
4178
4178
  ref: i.includes(g) ? null : n,
4179
- onDragStart: () => w(o),
4179
+ onDragStart: () => R(o),
4180
4180
  onDragEnd: () => B(o),
4181
4181
  onDragOver: (x) => {
4182
4182
  x.preventDefault(), D(g, "yes");
@@ -4189,8 +4189,8 @@ const Node = memo(({ node: o, style: r, dragHandle: n }) => {
4189
4189
  },
4190
4190
  className: cn(
4191
4191
  "group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
4192
- E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4193
- j && canAcceptChildBlock(b._type, "Icon") ? "bg-green-200" : "",
4192
+ j ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4193
+ b && canAcceptChildBlock(E._type, "Icon") ? "bg-green-200" : "",
4194
4194
  v && "opacity-20",
4195
4195
  i.includes(g) ? "opacity-50" : ""
4196
4196
  ),
@@ -4204,7 +4204,7 @@ const Node = memo(({ node: o, style: r, dragHandle: n }) => {
4204
4204
  }
4205
4205
  ),
4206
4206
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4207
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: b == null ? void 0 : b._type }) }),
4207
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: E == null ? void 0 : E._type }) }),
4208
4208
  S ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4209
4209
  "div",
4210
4210
  {
@@ -4213,7 +4213,7 @@ const Node = memo(({ node: o, style: r, dragHandle: n }) => {
4213
4213
  x.stopPropagation(), o.edit(), o.deselect();
4214
4214
  },
4215
4215
  children: [
4216
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (b == null ? void 0 : b._name) || (b == null ? void 0 : b._type.split("/").pop()) }),
4216
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (E == null ? void 0 : E._name) || (E == null ? void 0 : E._type.split("/").pop()) }),
4217
4217
  N.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4218
4218
  N.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4219
4219
  N.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
@@ -4234,7 +4234,7 @@ const Node = memo(({ node: o, style: r, dragHandle: n }) => {
4234
4234
  ),
4235
4235
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: x.tooltip })
4236
4236
  ] })),
4237
- canAddChildBlock(b == null ? void 0 : b._type) && !i.includes(g) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4237
+ canAddChildBlock(E == null ? void 0 : E._type) && !i.includes(g) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4238
4238
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4239
4239
  TooltipTrigger,
4240
4240
  {
@@ -4585,7 +4585,7 @@ const Node = memo(({ node: o, style: r, dragHandle: n }) => {
4585
4585
  }
4586
4586
  }
4587
4587
  }, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
4588
- var p, u, m, f, g, b, E, j;
4588
+ var p, u, m, f, g, E, j, b;
4589
4589
  if (n.type === "comment")
4590
4590
  return [];
4591
4591
  let a = { _id: generateUUID() };
@@ -4624,8 +4624,8 @@ const Node = memo(({ node: o, style: r, dragHandle: n }) => {
4624
4624
  hrefType: ((u = l.find((S) => S.key === "data-vbtype")) == null ? void 0 : u.value) || "video",
4625
4625
  autoplay: ((m = l.find((S) => S.key === "data-autoplay")) == null ? void 0 : m.value) === "true",
4626
4626
  maxWidth: ((g = (f = l.find((S) => S.key === "data-maxwidth")) == null ? void 0 : f.value) == null ? void 0 : g.replace("px", "")) || "",
4627
- backdropColor: ((b = l.find((S) => S.key === "data-overlay")) == null ? void 0 : b.value) || "",
4628
- galleryName: ((E = l.find((S) => S.key === "data-gall")) == null ? void 0 : E.value) || ""
4627
+ backdropColor: ((E = l.find((S) => S.key === "data-overlay")) == null ? void 0 : E.value) || "",
4628
+ galleryName: ((j = l.find((S) => S.key === "data-gall")) == null ? void 0 : j.value) || ""
4629
4629
  }, forEach(v, (S) => {
4630
4630
  has(a, `styles_attrs.${S}`) && delete a.styles_attrs[S];
4631
4631
  });
@@ -4637,9 +4637,9 @@ const Node = memo(({ node: o, style: r, dragHandle: n }) => {
4637
4637
  const v = stringify([n]);
4638
4638
  return hasVideoEmbed(v) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(v)), 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 = v, [a];
4639
4639
  } else if (n.tagName === "svg") {
4640
- const v = find(n.attributes, { key: "height" }), S = find(n.attributes, { key: "width" }), R = get(v, "value") ? `[${get(v, "value")}px]` : "24px", _ = get(S, "value") ? `[${get(S, "value")}px]` : "24px", w = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
4641
- return a.styles = `${STYLES_KEY}, ${cn(`w-${_} h-${R}`, w)}`.trim(), n.attributes = filter(n.attributes, (B) => !includes(["style", "width", "height", "class"], B.key)), a.icon = stringify([n]), [a];
4642
- } else if (n.tagName == "option" && r && ((j = r.block) == null ? void 0 : j._type) === "Select")
4640
+ const v = find(n.attributes, { key: "height" }), S = find(n.attributes, { key: "width" }), w = get(v, "value") ? `[${get(v, "value")}px]` : "24px", _ = get(S, "value") ? `[${get(S, "value")}px]` : "24px", R = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
4641
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${_} h-${w}`, R)}`.trim(), n.attributes = filter(n.attributes, (B) => !includes(["style", "width", "height", "class"], B.key)), a.icon = stringify([n]), [a];
4642
+ } else if (n.tagName == "option" && r && ((b = r.block) == null ? void 0 : b._type) === "Select")
4643
4643
  return r.block.options.push({
4644
4644
  label: getTextContent(n.children),
4645
4645
  ...getAttrs(n)
@@ -4825,12 +4825,12 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
4825
4825
  onChange: n
4826
4826
  }) => {
4827
4827
  var D;
4828
- const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (x, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, m] = useState("page"), [f, g] = useState(""), [b, E] = useState([]), [j, v] = useState(-1), S = useRef(null), R = (D = r == null ? void 0 : r.find((x) => x.key === u)) == null ? void 0 : D.name;
4828
+ const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (x, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, m] = useState("page"), [f, g] = useState(""), [E, j] = useState([]), [b, v] = useState(-1), S = useRef(null), w = (D = r == null ? void 0 : r.find((x) => x.key === u)) == null ? void 0 : D.name;
4829
4829
  useEffect(() => {
4830
- if (!o || i || !startsWith(o, "collection:"))
4830
+ if (g(""), j([]), v(-1), p(!1), !o || i || !startsWith(o, "collection:"))
4831
4831
  return;
4832
4832
  const x = split(o, ":"), k = get(x, 1, "page") || "page";
4833
- m(k), g(""), E([]), v(-1), (async () => {
4833
+ m(k), (async () => {
4834
4834
  const C = await l(k, [get(x, 2, "page")]);
4835
4835
  C && Array.isArray(C) && g(get(C, [0, "name"], ""));
4836
4836
  })();
@@ -4838,44 +4838,44 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
4838
4838
  const _ = useDebouncedCallback(
4839
4839
  async (x) => {
4840
4840
  if (isEmpty(x))
4841
- E([]);
4841
+ j([]);
4842
4842
  else {
4843
4843
  const k = await l(u, x);
4844
- E(k);
4844
+ j(k);
4845
4845
  }
4846
4846
  c(!1), v(-1);
4847
4847
  },
4848
4848
  [u],
4849
4849
  300
4850
- ), w = (x) => {
4850
+ ), R = (x) => {
4851
4851
  const k = ["collection", u, x.id];
4852
- k[1] && (n(k.join(":")), g(x.name), p(!1), E([]), v(-1));
4852
+ k[1] && (n(k.join(":")), g(x.name), p(!1), j([]), v(-1));
4853
4853
  }, B = (x) => {
4854
4854
  switch (x.key) {
4855
4855
  case "ArrowDown":
4856
- x.preventDefault(), v((k) => k < b.length - 1 ? k + 1 : k);
4856
+ x.preventDefault(), v((k) => k < E.length - 1 ? k + 1 : k);
4857
4857
  break;
4858
4858
  case "ArrowUp":
4859
4859
  x.preventDefault(), v((k) => k > 0 ? k - 1 : k);
4860
4860
  break;
4861
4861
  case "Enter":
4862
- if (x.preventDefault(), b.length === 0)
4862
+ if (x.preventDefault(), E.length === 0)
4863
4863
  return;
4864
- j >= 0 && w(b[j]);
4864
+ b >= 0 && R(E[b]);
4865
4865
  break;
4866
4866
  case "Escape":
4867
- x.preventDefault(), T();
4867
+ x.preventDefault(), I();
4868
4868
  break;
4869
4869
  }
4870
4870
  };
4871
4871
  useEffect(() => {
4872
- if (j >= 0 && S.current) {
4873
- const x = S.current.children[j];
4872
+ if (b >= 0 && S.current) {
4873
+ const x = S.current.children[b];
4874
4874
  x == null || x.scrollIntoView({ block: "nearest" });
4875
4875
  }
4876
- }, [j]);
4877
- const T = () => {
4878
- g(""), E([]), v(-1), p(!1), n("");
4876
+ }, [b]);
4877
+ const I = () => {
4878
+ g(""), j([]), v(-1), p(!1), n("");
4879
4879
  }, N = (x) => {
4880
4880
  g(x), p(!isEmpty(x)), c(!0), _(x);
4881
4881
  };
@@ -4889,25 +4889,25 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
4889
4889
  value: f,
4890
4890
  onChange: (x) => N(x.target.value),
4891
4891
  onKeyDown: B,
4892
- placeholder: a(`Search ${R}`),
4892
+ placeholder: a(`Search ${w}`),
4893
4893
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
4894
4894
  }
4895
4895
  ),
4896
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: f && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: T, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
4896
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: f && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: I, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
4897
4897
  ] }),
4898
- (i || !isEmpty(b) || d && isEmpty(b)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
4898
+ (i || !isEmpty(E) || d && isEmpty(E)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
4899
4899
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
4900
4900
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
4901
- ] }) : d && isEmpty(b) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4901
+ ] }) : d && isEmpty(E) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4902
4902
  a("No results found for"),
4903
4903
  ' "',
4904
4904
  f,
4905
4905
  '"'
4906
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: S, children: map(b == null ? void 0 : b.slice(0, 20), (x, k) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4906
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: S, children: map(E == null ? void 0 : E.slice(0, 20), (x, k) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4907
4907
  "li",
4908
4908
  {
4909
- onClick: () => w(x),
4910
- className: `cursor-pointer p-2 text-xs ${o != null && o.includes(x.id) ? "bg-blue-200" : k === j ? "bg-gray-100" : "hover:bg-gray-100"}`,
4909
+ onClick: () => R(x),
4910
+ className: `cursor-pointer p-2 text-xs ${o != null && o.includes(x.id) ? "bg-blue-200" : k === b ? "bg-gray-100" : "hover:bg-gray-100"}`,
4911
4911
  children: [
4912
4912
  x.name,
4913
4913
  " ",
@@ -4994,18 +4994,18 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
4994
4994
  ] });
4995
4995
  }, JSONForm = memo(({ id: o, properties: r, formData: n, onChange: a }) => {
4996
4996
  const [l, i] = useState(n), c = { type: "object", properties: {} }, d = {}, { t: p } = useTranslation(), { selectedLang: u, fallbackLang: m, languages: f } = useLanguages(), g = f.length === 0 ? "" : u.length ? u : m;
4997
- Object.keys(r).forEach((E) => {
4998
- const j = r[E];
4999
- if (includes(["slot", "styles"], j.type))
4997
+ Object.keys(r).forEach((j) => {
4998
+ const b = r[j];
4999
+ if (includes(["slot", "styles"], b.type))
5000
5000
  return;
5001
- const v = E;
5002
- c.properties[v] = getBlockJSONFromSchemas(j, p, g), d[v] = getBlockJSONFromUISchemas(j);
5001
+ const v = j;
5002
+ c.properties[v] = getBlockJSONFromSchemas(b, p, g), d[v] = getBlockJSONFromUISchemas(b);
5003
5003
  }), useEffect(() => {
5004
5004
  i(n);
5005
5005
  }, [o, u]);
5006
- const b = useThrottledCallback(
5007
- async ({ formData: E }, j) => {
5008
- a({ formData: E }, j);
5006
+ const E = useThrottledCallback(
5007
+ async ({ formData: j }, b) => {
5008
+ a({ formData: j }, b);
5009
5009
  },
5010
5010
  [a],
5011
5011
  1e3
@@ -5031,8 +5031,8 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5031
5031
  uiSchema: d,
5032
5032
  schema: c,
5033
5033
  formData: l,
5034
- onChange: ({ formData: E }, j) => {
5035
- j && (i(E), b({ formData: E }, j));
5034
+ onChange: ({ formData: j }, b) => {
5035
+ b && (i(j), E({ formData: j }, b));
5036
5036
  }
5037
5037
  }
5038
5038
  );
@@ -5102,45 +5102,234 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5102
5102
  }), a;
5103
5103
  };
5104
5104
  function BlockSettings() {
5105
- const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), p = !1, u = ({ formData: j }, v, S) => {
5105
+ const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), p = !1, u = ({ formData: b }, v, S) => {
5106
5106
  if (v && (c == null ? void 0 : c._id) === r._id) {
5107
- const R = v.replace("root.", "");
5108
- a([r._id], { [R]: get(j, R) }, S);
5107
+ const w = v.replace("root.", "");
5108
+ a([r._id], { [w]: get(b, w) }, S);
5109
5109
  }
5110
5110
  }, m = useCallback(
5111
- debounce(({ formData: j }, v, S) => {
5112
- u({ formData: j }, v, S), d(j);
5111
+ debounce(({ formData: b }, v, S) => {
5112
+ u({ formData: b }, v, S), d(b);
5113
5113
  }, 1500),
5114
5114
  [r == null ? void 0 : r._id, o]
5115
- ), f = ({ formData: j }, v) => {
5115
+ ), f = ({ formData: b }, v) => {
5116
5116
  if (v) {
5117
5117
  const S = v.replace("root.", "");
5118
5118
  n(
5119
5119
  [r._id],
5120
- convertDotNotationToObject(S, get(j, S.split(".")))
5121
- ), m({ formData: j }, v, { [S]: get(c, S) });
5120
+ convertDotNotationToObject(S, get(b, S.split(".")))
5121
+ ), m({ formData: b }, v, { [S]: get(c, S) });
5122
5122
  }
5123
- }, g = keys(get(i, "_bindings", {})), b = useMemo(() => {
5124
- const j = cloneDeep(get(l, "props", {}));
5125
- return each(j, (v, S) => {
5126
- get(v, "hidden", !1) && delete j[S];
5127
- }), j;
5128
- }, [l, g, p]), E = get(l, "server", !1);
5123
+ }, g = keys(get(i, "_bindings", {})), E = useMemo(() => {
5124
+ const b = cloneDeep(get(l, "props", {}));
5125
+ return each(b, (v, S) => {
5126
+ get(v, "hidden", !1) && delete b[S];
5127
+ }), b;
5128
+ }, [l, g, p]), j = get(l, "server", !1);
5129
5129
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
5130
- isEmpty(b) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5130
+ isEmpty(E) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5131
5131
  JSONForm,
5132
5132
  {
5133
5133
  id: r == null ? void 0 : r._id,
5134
5134
  onChange: f,
5135
5135
  formData: i,
5136
- properties: b
5136
+ properties: E
5137
5137
  }
5138
5138
  ),
5139
5139
  (r == null ? void 0 : r._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
5140
- E ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: r == null ? void 0 : r._id }) : null,
5140
+ j ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: r == null ? void 0 : r._id }) : null,
5141
5141
  /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
5142
5142
  ] });
5143
5143
  }
5144
+ const LANGUAGES = {
5145
+ ab: "Abkhazian",
5146
+ aa: "Afar",
5147
+ af: "Afrikaans",
5148
+ ak: "Akan",
5149
+ sq: "Albanian",
5150
+ am: "Amharic",
5151
+ ar: "Arabic",
5152
+ an: "Aragonese",
5153
+ hy: "Armenian",
5154
+ as: "Assamese",
5155
+ av: "Avaric",
5156
+ ae: "Avestan",
5157
+ ay: "Aymara",
5158
+ az: "Azerbaijani",
5159
+ bm: "Bambara",
5160
+ ba: "Bashkir",
5161
+ eu: "Basque",
5162
+ be: "Belarusian",
5163
+ bn: "Bengali",
5164
+ bh: "Bihari",
5165
+ bi: "Bislama",
5166
+ bs: "Bosnian",
5167
+ br: "Breton",
5168
+ bg: "Bulgarian",
5169
+ my: "Burmese",
5170
+ ca: "Catalan",
5171
+ ch: "Chamorro",
5172
+ ce: "Chechen",
5173
+ ny: "Chichewa",
5174
+ zh: "Chinese",
5175
+ "zh-Hans": "Chinese (Simplified)",
5176
+ "zh-Hant": "Chinese (Traditional)",
5177
+ cv: "Chuvash",
5178
+ kw: "Cornish",
5179
+ co: "Corsican",
5180
+ cr: "Cree",
5181
+ hr: "Croatian",
5182
+ cs: "Czech",
5183
+ da: "Danish",
5184
+ dv: "Maldivian",
5185
+ nl: "Dutch",
5186
+ dz: "Dzongkha",
5187
+ en: "English",
5188
+ eo: "Esperanto",
5189
+ et: "Estonian",
5190
+ ee: "Ewe",
5191
+ fo: "Faroese",
5192
+ fj: "Fijian",
5193
+ fi: "Finnish",
5194
+ fr: "French",
5195
+ ff: "Fula, Pular",
5196
+ gl: "Galician",
5197
+ gd: "Gaelic (Scottish)",
5198
+ gv: "Manx",
5199
+ ka: "Georgian",
5200
+ de: "German",
5201
+ el: "Greek",
5202
+ kl: "Kalaallisut",
5203
+ gn: "Guarani",
5204
+ gu: "Gujarati",
5205
+ ht: "Haitian Creole",
5206
+ ha: "Hausa",
5207
+ he: "Hebrew",
5208
+ hz: "Herero",
5209
+ hi: "Hindi",
5210
+ ho: "Hiri Motu",
5211
+ hu: "Hungarian",
5212
+ is: "Icelandic",
5213
+ io: "Ido",
5214
+ ig: "Igbo",
5215
+ id: "Indonesian",
5216
+ ia: "Interlingua",
5217
+ ie: "Interlingue",
5218
+ iu: "Inuktitut",
5219
+ ik: "Inupiak",
5220
+ ga: "Irish",
5221
+ it: "Italian",
5222
+ ja: "Japanese",
5223
+ jv: "Javanese",
5224
+ kn: "Kannada",
5225
+ kr: "Kanuri",
5226
+ ks: "Kashmiri",
5227
+ kk: "Kazakh",
5228
+ km: "Khmer",
5229
+ ki: "Kikuyu",
5230
+ rw: "Kinyarwanda",
5231
+ rn: "Kirundi",
5232
+ ky: "Kyrgyz",
5233
+ kv: "Komi",
5234
+ kg: "Kongo",
5235
+ ko: "Korean",
5236
+ ku: "Kurdish",
5237
+ kj: "Kwanyama",
5238
+ lo: "Lao",
5239
+ la: "Latin",
5240
+ lv: "Latvian",
5241
+ li: "Limburgish",
5242
+ ln: "Lingala",
5243
+ lt: "Lithuanian",
5244
+ lu: "Luga-Katanga",
5245
+ lg: "Luganda, Ganda",
5246
+ lb: "Luxembourgish",
5247
+ mk: "Macedonian",
5248
+ mg: "Malagasy",
5249
+ ms: "Malay",
5250
+ ml: "Malayalam",
5251
+ mt: "Maltese",
5252
+ mi: "Maori",
5253
+ mr: "Marathi",
5254
+ mh: "Marshallese",
5255
+ mo: "Moldavian",
5256
+ mn: "Mongolian",
5257
+ na: "Nauru",
5258
+ nv: "Navajo",
5259
+ ng: "Ndonga",
5260
+ nd: "Northern Ndebele",
5261
+ ne: "Nepali",
5262
+ no: "Norwegian",
5263
+ nb: "Norwegian bokmål",
5264
+ nn: "Norwegian nynorsk",
5265
+ ii: "Sichuan Yi",
5266
+ oc: "Occitan",
5267
+ oj: "Ojibwe",
5268
+ cu: "Old Church Slavonic",
5269
+ or: "Oriya",
5270
+ om: "Oromo",
5271
+ os: "Ossetian",
5272
+ pi: "Pāli",
5273
+ ps: "Pashto, Pushto",
5274
+ fa: "Persian (Farsi)",
5275
+ pl: "Polish",
5276
+ pt: "Portuguese",
5277
+ pa: "Punjabi (Eastern)",
5278
+ qu: "Quechua",
5279
+ rm: "Romansh",
5280
+ ro: "Romanian",
5281
+ ru: "Russian",
5282
+ se: "Sami",
5283
+ sm: "Samoan",
5284
+ sg: "Sango",
5285
+ sa: "Sanskrit",
5286
+ sr: "Serbian",
5287
+ sh: "Serbo-Croatian",
5288
+ st: "Sesotho",
5289
+ tn: "Setswana",
5290
+ sn: "Shona",
5291
+ sd: "Sindhi",
5292
+ si: "Sinhalese",
5293
+ ss: "Swati",
5294
+ sk: "Slovak",
5295
+ sl: "Slovenian",
5296
+ so: "Somali",
5297
+ nr: "Southern Ndebele",
5298
+ es: "Spanish",
5299
+ su: "Sundanese",
5300
+ sw: "Swahili (Kiswahili)",
5301
+ sv: "Swedish",
5302
+ tl: "Tagalog",
5303
+ ty: "Tahitian",
5304
+ tg: "Tajik",
5305
+ ta: "Tamil",
5306
+ tt: "Tatar",
5307
+ te: "Telugu",
5308
+ th: "Thai",
5309
+ bo: "Tibetan",
5310
+ ti: "Tigrinya",
5311
+ to: "Tonga",
5312
+ ts: "Tsonga",
5313
+ tr: "Turkish",
5314
+ tk: "Turkmen",
5315
+ tw: "Twi",
5316
+ ug: "Uyghur",
5317
+ uk: "Ukrainian",
5318
+ ur: "Urdu",
5319
+ uz: "Uzbek",
5320
+ ve: "Venda",
5321
+ vi: "Vietnamese",
5322
+ vo: "Volapük",
5323
+ wa: "Wallon",
5324
+ cy: "Welsh",
5325
+ wo: "Wolof",
5326
+ fy: "Western Frisian",
5327
+ xh: "Xhosa",
5328
+ yi: "Yiddish",
5329
+ yo: "Yoruba",
5330
+ za: "Zhuang, Chuang",
5331
+ zu: "Zulu"
5332
+ };
5144
5333
  function getChildBlocks(o, r, n) {
5145
5334
  n.push(find(o, { _id: r }));
5146
5335
  const a = filter(o, { _parent: r });
@@ -5158,44 +5347,53 @@ const getBlockWithChildren = (o, r) => {
5158
5347
  a.includes(d) || get(i, `props.${d}.ai`, !1) && (c[d] = get(n, `${d}-${r}`, n[d]));
5159
5348
  return isEmpty$1(c) ? !1 : (has(l, "_parent") && isEmpty$1(l._parent) && delete l._parent, { ...l, ...c });
5160
5349
  })
5161
- ), askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5162
- const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), m = (f, g) => {
5163
- const b = cloneDeep(g.find((E) => E._id === f));
5164
- for (const E in b) {
5165
- const j = b[E];
5166
- typeof j == "string" && startsWith(j, STYLES_KEY) ? b[E] = compact(flattenDeep(j.replace(STYLES_KEY, "").split(","))).join(" ") : E !== "_id" && delete b[E];
5350
+ ), addLangToPrompt = (o, r, n) => !r || n !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, r, r)} language.`, askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5351
+ const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), m = p.length ? p : u, f = (g, E) => {
5352
+ const j = cloneDeep(E.find((b) => b._id === g));
5353
+ for (const b in j) {
5354
+ const v = j[b];
5355
+ typeof v == "string" && startsWith(v, STYLES_KEY) ? j[b] = compact(flattenDeep(v.replace(STYLES_KEY, "").split(","))).join(" ") : b !== "_id" && delete j[b];
5167
5356
  }
5168
- return b;
5357
+ return j;
5169
5358
  };
5170
5359
  return {
5171
5360
  askAi: useCallback(
5172
- async (f, g, b, E) => {
5361
+ async (g, E, j, b) => {
5173
5362
  if (l) {
5174
5363
  r(!0), a(null);
5175
5364
  try {
5176
- const j = p === u ? "" : p, v = f === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(g, d)), p) : [m(g, d)], S = await l(f, b, v, j), { blocks: R, error: _ } = S;
5177
- if (_) {
5178
- a(_);
5365
+ const v = p === u ? "" : p, S = g === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(E, d)), p) : [f(E, d)], w = await l(g, addLangToPrompt(j, m, g), S, v), { blocks: _, error: R } = w;
5366
+ if (R) {
5367
+ a(R);
5179
5368
  return;
5180
5369
  }
5181
- if (f === "styles") {
5182
- const w = R.map((B) => {
5183
- for (const T in B)
5184
- T !== "_id" && (B[T] = `${STYLES_KEY},${B[T]}`);
5185
- return B;
5370
+ if (g === "styles") {
5371
+ const B = _.map((I) => {
5372
+ for (const N in I)
5373
+ N !== "_id" && (I[N] = `${STYLES_KEY},${I[N]}`);
5374
+ return I;
5186
5375
  });
5187
- c(w);
5376
+ c(B);
5188
5377
  } else
5189
- i(R);
5190
- E && E(S);
5191
- } catch (j) {
5192
- a(j);
5378
+ i(_);
5379
+ b && b(w);
5380
+ } catch (v) {
5381
+ a(v);
5193
5382
  } finally {
5194
- r(!1), E && E();
5383
+ r(!1), b && b();
5195
5384
  }
5196
5385
  }
5197
5386
  },
5198
- [l, r, d, p, u, c, i]
5387
+ [
5388
+ l,
5389
+ r,
5390
+ p,
5391
+ u,
5392
+ d,
5393
+ m,
5394
+ c,
5395
+ i
5396
+ ]
5199
5397
  ),
5200
5398
  loading: o,
5201
5399
  error: n
@@ -5272,8 +5470,8 @@ const AskAIStyles = ({ blockId: o }) => {
5272
5470
  (g = d.current) == null || g.focus();
5273
5471
  }, []);
5274
5472
  const f = (g) => {
5275
- const { usage: b } = g || {};
5276
- !l && b && m(b), p.current = setTimeout(() => m(void 0), 1e4), l || c("");
5473
+ const { usage: E } = g || {};
5474
+ !l && E && m(E), p.current = setTimeout(() => m(void 0), 1e4), l || c("");
5277
5475
  };
5278
5476
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5279
5477
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: r("Ask AI") }),
@@ -5335,35 +5533,35 @@ const AskAIStyles = ({ blockId: o }) => {
5335
5533
  function ManualClasses() {
5336
5534
  var B;
5337
5535
  const { t: o } = useTranslation(), [r] = useSelectedStylingBlocks(), n = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, p] = useState(""), { toast: u } = useToast(), m = (B = first(r)) == null ? void 0 : B.prop, f = reject((get(n, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
5338
- const T = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5339
- a(i, T, !0), p("");
5340
- }, [b, E] = useState([]), j = ({ value: T }) => {
5341
- const N = T.trim().toLowerCase(), D = N.match(/.+:/g);
5536
+ const I = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5537
+ a(i, I, !0), p("");
5538
+ }, [E, j] = useState([]), b = ({ value: I }) => {
5539
+ const N = I.trim().toLowerCase(), D = N.match(/.+:/g);
5342
5540
  let x = [];
5343
5541
  if (D && D.length > 0) {
5344
5542
  const [k] = D, C = N.replace(k, "");
5345
- x = fuse.search(C).map((I) => ({
5346
- ...I,
5347
- item: { ...I.item, name: k + I.item.name }
5543
+ x = fuse.search(C).map((T) => ({
5544
+ ...T,
5545
+ item: { ...T.item, name: k + T.item.name }
5348
5546
  }));
5349
5547
  } else
5350
5548
  x = fuse.search(N);
5351
- return E(map(x, "item"));
5549
+ return j(map(x, "item"));
5352
5550
  }, v = () => {
5353
- E([]);
5354
- }, S = (T) => T.name, R = (T) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: T.name }), _ = {
5551
+ j([]);
5552
+ }, S = (I) => I.name, w = (I) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: I.name }), _ = {
5355
5553
  autoComplete: "off",
5356
5554
  autoCorrect: "off",
5357
5555
  autoCapitalize: "off",
5358
5556
  spellCheck: !1,
5359
5557
  placeholder: o("Enter classes separated by space"),
5360
5558
  value: d,
5361
- onKeyDown: (T) => {
5362
- T.key === "Enter" && d.trim() !== "" && g();
5559
+ onKeyDown: (I) => {
5560
+ I.key === "Enter" && d.trim() !== "" && g();
5363
5561
  },
5364
- onChange: (T, { newValue: N }) => p(N),
5562
+ onChange: (I, { newValue: N }) => p(N),
5365
5563
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5366
- }, w = () => {
5564
+ }, R = () => {
5367
5565
  if (navigator.clipboard === void 0) {
5368
5566
  u({
5369
5567
  title: o("Clipboard not supported"),
@@ -5380,13 +5578,13 @@ function ManualClasses() {
5380
5578
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
5381
5579
  "div",
5382
5580
  {
5383
- className: `flex ${b.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
5581
+ className: `flex ${E.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
5384
5582
  children: [
5385
5583
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
5386
5584
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5387
5585
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
5388
5586
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
5389
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: w, className: "cursor-pointer" }) }),
5587
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: R, className: "cursor-pointer" }) }),
5390
5588
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("Copy classes to clipboard") }) })
5391
5589
  ] })
5392
5590
  ] }),
@@ -5402,11 +5600,11 @@ function ManualClasses() {
5402
5600
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5403
5601
  Autosuggest,
5404
5602
  {
5405
- suggestions: b,
5406
- onSuggestionsFetchRequested: j,
5603
+ suggestions: E,
5604
+ onSuggestionsFetchRequested: b,
5407
5605
  onSuggestionsClearRequested: v,
5408
5606
  getSuggestionValue: S,
5409
- renderSuggestion: R,
5607
+ renderSuggestion: w,
5410
5608
  inputProps: _,
5411
5609
  containerProps: {
5412
5610
  className: "relative h-8 w-full gap-y-1 py-1 border-border"
@@ -5431,22 +5629,22 @@ function ManualClasses() {
5431
5629
  )
5432
5630
  ] }),
5433
5631
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
5434
- f.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5632
+ f.map((I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5435
5633
  "div",
5436
5634
  {
5437
5635
  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",
5438
5636
  children: [
5439
- T,
5637
+ I,
5440
5638
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5441
5639
  Cross2Icon,
5442
5640
  {
5443
- onClick: () => l(i, [T]),
5641
+ onClick: () => l(i, [I]),
5444
5642
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
5445
5643
  }
5446
5644
  )
5447
5645
  ]
5448
5646
  },
5449
- T
5647
+ I
5450
5648
  ))
5451
5649
  ) })
5452
5650
  ]
@@ -5839,8 +6037,8 @@ const RangeChoices = ({ property: o, onChange: r }) => {
5839
6037
  }, ColorChoice = ({ property: o, onChange: r }) => {
5840
6038
  const n = useCurrentClassByProperty(o), a = useMemo(() => get(n, "cls", ""), [n]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), m = get(u, "1", ""), f = get(u, "2", ""), g = useCallback(
5841
6039
  // eslint-disable-next-line no-shadow
5842
- (E) => {
5843
- ["current", "inherit", "transparent", "black", "white"].includes(E) ? (c([]), p({ color: E })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((j) => ({ ...j, color: E, shade: j.shade ? j.shade : "500" })));
6040
+ (j) => {
6041
+ ["current", "inherit", "transparent", "black", "white"].includes(j) ? (c([]), p({ color: j })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((b) => ({ ...b, color: j, shade: b.shade ? b.shade : "500" })));
5844
6042
  },
5845
6043
  [c, p]
5846
6044
  );
@@ -5849,18 +6047,18 @@ const RangeChoices = ({ property: o, onChange: r }) => {
5849
6047
  return c([]);
5850
6048
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
5851
6049
  }, [m]);
5852
- const b = useCallback(
6050
+ const E = useCallback(
5853
6051
  // eslint-disable-next-line no-shadow
5854
- (E) => {
5855
- p({ color: m, shade: E });
6052
+ (j) => {
6053
+ p({ color: m, shade: j });
5856
6054
  },
5857
6055
  [m]
5858
6056
  );
5859
6057
  return useEffect(() => {
5860
6058
  p({ color: "", shade: "" });
5861
6059
  }, [n]), useEffect(() => {
5862
- const j = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
5863
- j.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && r(j, o);
6060
+ const b = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6061
+ b.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && r(b, o);
5864
6062
  }, [d, r, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
5865
6063
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5866
6064
  DropDown,
@@ -5901,7 +6099,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
5901
6099
  ]
5902
6100
  }
5903
6101
  ) }),
5904
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: f, disabled: !m || !l, onChange: b, options: i }) })
6102
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: f, disabled: !m || !l, onChange: E, options: i }) })
5905
6103
  ] });
5906
6104
  }, getUserInputValues = (o, r) => {
5907
6105
  o = o.toLowerCase();
@@ -6096,7 +6294,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6096
6294
  },
6097
6295
  a
6098
6296
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6099
- const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: m } = o, [f, g] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [b, E] = useState(!1), [j, v] = useState(""), [S, R] = useState(!1), [_, w] = useState(!1);
6297
+ const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: m } = o, [f, g] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [E, j] = useState(!1), [b, v] = useState(""), [S, w] = useState(!1), [_, R] = useState(!1);
6100
6298
  useEffect(() => {
6101
6299
  const { value: x, unit: k } = getClassValueAndUnit(i);
6102
6300
  if (k === "") {
@@ -6105,11 +6303,11 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6105
6303
  }
6106
6304
  g(k), l(k === "class" || isEmpty(x) ? "" : x);
6107
6305
  }, [i, p, u]);
6108
- const B = useThrottledCallback((x) => c(x), [c], THROTTLE_TIME), T = useThrottledCallback((x) => c(x, !1), [c], THROTTLE_TIME), N = useCallback(
6306
+ const B = useThrottledCallback((x) => c(x), [c], THROTTLE_TIME), I = useThrottledCallback((x) => c(x, !1), [c], THROTTLE_TIME), N = useCallback(
6109
6307
  (x = !1) => {
6110
6308
  const k = getUserInputValues(`${a}`, u);
6111
6309
  if (get(k, "error", !1)) {
6112
- E(!0);
6310
+ j(!0);
6113
6311
  return;
6114
6312
  }
6115
6313
  const C = get(k, "unit") !== "" ? get(k, "unit") : f;
@@ -6119,15 +6317,15 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6119
6317
  }
6120
6318
  if (get(k, "value") === "")
6121
6319
  return;
6122
- const I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6123
- x ? T(I) : B(I);
6320
+ const T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6321
+ x ? I(T) : B(T);
6124
6322
  },
6125
- [B, T, a, f, d, u]
6323
+ [B, I, a, f, d, u]
6126
6324
  ), D = useCallback(
6127
6325
  (x) => {
6128
6326
  const k = getUserInputValues(`${a}`, u);
6129
6327
  if (get(k, "error", !1)) {
6130
- E(!0);
6328
+ j(!0);
6131
6329
  return;
6132
6330
  }
6133
6331
  if (x === "auto" || x === "none") {
@@ -6136,8 +6334,8 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6136
6334
  }
6137
6335
  if (get(k, "value") === "")
6138
6336
  return;
6139
- const C = get(k, "unit") !== "" ? get(k, "unit") : x, I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6140
- B(I);
6337
+ const C = get(k, "unit") !== "" ? get(k, "unit") : x, T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6338
+ B(T);
6141
6339
  },
6142
6340
  [B, a, d, u]
6143
6341
  );
@@ -6159,28 +6357,28 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6159
6357
  onKeyDown: (x) => {
6160
6358
  if (x.keyCode !== 38 && x.keyCode !== 40)
6161
6359
  return;
6162
- x.preventDefault(), w(!0);
6360
+ x.preventDefault(), R(!0);
6163
6361
  const k = parseInt$1(x.target.value);
6164
6362
  let C = isNaN$1(k) ? 0 : k;
6165
6363
  x.keyCode === 38 && (C += 1), x.keyCode === 40 && (C -= 1);
6166
6364
  const A = `${C}`, L = `${A.startsWith("-") ? "-" : ""}${d}[${A.replace("-", "")}${f === "-" ? "" : f}]`;
6167
- T(L);
6365
+ I(L);
6168
6366
  },
6169
6367
  onKeyUp: (x) => {
6170
- _ && (x.preventDefault(), w(!1));
6368
+ _ && (x.preventDefault(), R(!1));
6171
6369
  },
6172
6370
  onBlur: () => N(),
6173
6371
  onChange: (x) => {
6174
- E(!1), l(x.target.value);
6372
+ j(!1), l(x.target.value);
6175
6373
  },
6176
6374
  onClick: (x) => {
6177
6375
  var k;
6178
6376
  (k = x == null ? void 0 : x.target) == null || k.select(), n(!1);
6179
6377
  },
6180
- value: S ? j : a,
6378
+ value: S ? b : a,
6181
6379
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6182
6380
  " ",
6183
- b ? "border-red-500 text-red-500" : "border-foreground/20"
6381
+ E ? "border-red-500 text-red-500" : "border-foreground/20"
6184
6382
  )
6185
6383
  }
6186
6384
  ),
@@ -6212,9 +6410,9 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6212
6410
  ["none", "auto"].indexOf(f) !== -1 || S ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6213
6411
  DragStyleButton,
6214
6412
  {
6215
- onDragStart: () => R(!0),
6413
+ onDragStart: () => w(!0),
6216
6414
  onDragEnd: (x) => {
6217
- if (v(() => ""), R(!1), isEmpty(x))
6415
+ if (v(() => ""), w(!1), isEmpty(x))
6218
6416
  return;
6219
6417
  const k = `${x}`, A = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${f === "-" ? "" : f}]`;
6220
6418
  B(A);
@@ -6224,7 +6422,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6224
6422
  return;
6225
6423
  v(x);
6226
6424
  const k = `${x}`, A = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${f === "-" ? "" : f}]`;
6227
- T(A);
6425
+ I(A);
6228
6426
  },
6229
6427
  currentValue: a,
6230
6428
  unit: f,
@@ -6321,22 +6519,22 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6321
6519
  "2xl": "1536px"
6322
6520
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6323
6521
  const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
6324
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, m] = useCanvasWidth(), f = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), b = useRemoveClassesFromBlocks(), [E] = useSelectedBlockIds(), j = useMemo(() => get(f, "fullCls", ""), [f]), v = useCallback(
6325
- (T, N = !0) => {
6326
- const D = { dark: p, mq: m, mod: u, cls: T, property: l, fullCls: "" };
6522
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, m] = useCanvasWidth(), f = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [j] = useSelectedBlockIds(), b = useMemo(() => get(f, "fullCls", ""), [f]), v = useCallback(
6523
+ (I, N = !0) => {
6524
+ const D = { dark: p, mq: m, mod: u, cls: I, property: l, fullCls: "" };
6327
6525
  (p || u !== "") && (D.mq = "xs");
6328
6526
  const x = generateFullClsName(D);
6329
- g(E, [x], N);
6527
+ g(j, [x], N);
6330
6528
  },
6331
- [E, p, m, u, l, g]
6529
+ [j, p, m, u, l, g]
6332
6530
  ), S = useCallback(() => {
6333
- b(E, [j]);
6334
- }, [E, j, b]), R = useMemo(() => canChangeClass(f, m), [f, m]);
6531
+ E(j, [b]);
6532
+ }, [j, b, E]), w = useMemo(() => canChangeClass(f, m), [f, m]);
6335
6533
  useEffect(() => {
6336
- i(R, f);
6337
- }, [R, i, f]);
6338
- const [, , _] = useCanvasWidth(), w = useCallback(
6339
- (T) => {
6534
+ i(w, f);
6535
+ }, [w, i, f]);
6536
+ const [, , _] = useCanvasWidth(), R = useCallback(
6537
+ (I) => {
6340
6538
  _({
6341
6539
  xs: 400,
6342
6540
  sm: 640,
@@ -6344,11 +6542,11 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6344
6542
  lg: 1024,
6345
6543
  xl: 1420,
6346
6544
  "2xl": 1920
6347
- }[T]);
6545
+ }[I]);
6348
6546
  },
6349
6547
  [_]
6350
6548
  ), B = get(f, "dark", null) === p && get(f, "mod", null) === u && get(f, "mq", null) === m;
6351
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: R, canReset: f && B, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6549
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: w, canReset: f && B, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6352
6550
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${f && !B ? "text-foreground" : ""}`, children: r(a) }) }),
6353
6551
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6354
6552
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
@@ -6368,7 +6566,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6368
6566
  n === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: v }),
6369
6567
  n === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: v })
6370
6568
  ] }),
6371
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${j ? "visible" : "invisible"}`, children: B ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => S(), 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" }) }) : R && f ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6569
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: B ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => S(), 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" }) }) : w && f ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6372
6570
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6373
6571
  "button",
6374
6572
  {
@@ -6388,7 +6586,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6388
6586
  "button",
6389
6587
  {
6390
6588
  type: "button",
6391
- onClick: () => w(get(f, "mq")),
6589
+ onClick: () => R(get(f, "mq")),
6392
6590
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6393
6591
  children: [
6394
6592
  "Switch to ",
@@ -6418,18 +6616,18 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6418
6616
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
6419
6617
  o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
6420
6618
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
6421
- r.map(({ label: g, key: b }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6619
+ r.map(({ label: g, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6422
6620
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
6423
6621
  "button",
6424
6622
  {
6425
6623
  type: "button",
6426
- onClick: () => u(b),
6427
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${b === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6624
+ onClick: () => u(E),
6625
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${E === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6428
6626
  children: [
6429
6627
  React__default.createElement("div", {
6430
- className: f(b) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6628
+ className: f(E) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6431
6629
  }),
6432
- React__default.createElement(get(EDITOR_ICONS, b, BoxIcon), { className: "text-inherit w-3 h-3" })
6630
+ React__default.createElement(get(EDITOR_ICONS, E, BoxIcon), { className: "text-inherit w-3 h-3" })
6433
6631
  ]
6434
6632
  }
6435
6633
  ) }),
@@ -6556,10 +6754,10 @@ function BlockStyling() {
6556
6754
  const m = !get(i, "negative", !1), f = get(i, "cssProperty", "");
6557
6755
  let g = parseFloat(i.dragStartValue);
6558
6756
  g = isNaN(g) ? 0 : g;
6559
- let b = MAPPER[i.dragUnit];
6560
- (startsWith(f, "scale") || f === "opacity") && (b = 10);
6561
- let j = (i.dragStartY - u.pageY) / b + g;
6562
- m && j < 0 && (j = 0), f === "opacity" && j > 1 && (j = 1), i.onDrag(`${j}`), l(`${j}`);
6757
+ let E = MAPPER[i.dragUnit];
6758
+ (startsWith(f, "scale") || f === "opacity") && (E = 10);
6759
+ let b = (i.dragStartY - u.pageY) / E + g;
6760
+ m && b < 0 && (b = 0), f === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
6563
6761
  },
6564
6762
  [i],
6565
6763
  50
@@ -6645,10 +6843,10 @@ const BlockCard = ({
6645
6843
  library: r,
6646
6844
  parentId: n = void 0
6647
6845
  }) => {
6648
- const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: u } = useBlockHighlight(), m = get(o, "name", get(o, "label")), f = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), b = (v) => {
6846
+ const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: u } = useBlockHighlight(), m = get(o, "name", get(o, "label")), f = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (v) => {
6649
6847
  const S = has(v, "styles_attrs.data-page-section");
6650
6848
  return v._type === "Box" && S;
6651
- }, E = useCallback(
6849
+ }, j = useCallback(
6652
6850
  async (v) => {
6653
6851
  if (v.stopPropagation(), has(o, "component")) {
6654
6852
  c(o, n), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
@@ -6659,15 +6857,15 @@ const BlockCard = ({
6659
6857
  isEmpty(S) || d(syncBlocksWithDefaults(S), n), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
6660
6858
  },
6661
6859
  [o]
6662
- ), j = async (v) => {
6860
+ ), b = async (v) => {
6663
6861
  const S = await i(r, o);
6664
- let R = n;
6665
- if (b(first(S)) && (R = null), !isEmpty(S)) {
6666
- const _ = { blocks: S, uiLibrary: !0, parent: R };
6862
+ let w = n;
6863
+ if (E(first(S)) && (w = null), !isEmpty(S)) {
6864
+ const _ = { blocks: S, uiLibrary: !0, parent: w };
6667
6865
  if (v.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
6668
- const w = new Image();
6669
- w.src = o.preview, w.onload = () => {
6670
- v.dataTransfer.setDragImage(w, 0, 0);
6866
+ const R = new Image();
6867
+ R.src = o.preview, R.onload = () => {
6868
+ v.dataTransfer.setDragImage(R, 0, 0);
6671
6869
  };
6672
6870
  } else
6673
6871
  v.dataTransfer.setDragImage(new Image(), 0, 0);
@@ -6681,9 +6879,9 @@ const BlockCard = ({
6681
6879
  "div",
6682
6880
  {
6683
6881
  onClick: a ? () => {
6684
- } : E,
6882
+ } : j,
6685
6883
  draggable: f ? "true" : "false",
6686
- onDragStart: j,
6884
+ onDragStart: b,
6687
6885
  className: clsx(
6688
6886
  "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
6689
6887
  ),
@@ -6712,9 +6910,9 @@ const BlockCard = ({
6712
6910
  })();
6713
6911
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
6714
6912
  }, UILibrarySection = ({ parentId: o }) => {
6715
- const [r, n] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((R) => R.category === "custom"), c = a.find((R) => R.uuid === r) || first(a), { data: d, isLoading: p } = useLibraryBlocks(c), u = groupBy([...d, ...i], "group"), [m, f] = useState("Hero"), g = get(u, m, []), b = useRef(null), { t: E } = useTranslation(), j = (R) => {
6716
- b.current && (clearTimeout(b.current), b.current = null), b.current = setTimeout(() => {
6717
- b.current && f(R);
6913
+ const [r, n] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((w) => w.category === "custom"), c = a.find((w) => w.uuid === r) || first(a), { data: d, isLoading: p } = useLibraryBlocks(c), u = groupBy([...d, ...i], "group"), [m, f] = useState("Hero"), g = get(u, m, []), E = useRef(null), { t: j } = useTranslation(), b = (w) => {
6914
+ E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
6915
+ E.current && f(w);
6718
6916
  }, 300);
6719
6917
  };
6720
6918
  if (p)
@@ -6722,26 +6920,26 @@ const BlockCard = ({
6722
6920
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
6723
6921
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
6724
6922
  ] });
6725
- const v = filter(g, (R, _) => _ % 2 === 0), S = filter(g, (R, _) => _ % 2 === 1);
6923
+ const v = filter(g, (w, _) => _ % 2 === 0), S = filter(g, (w, _) => _ % 2 === 1);
6726
6924
  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: [
6727
6925
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
6728
6926
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: n, uiLibraries: a }),
6729
6927
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
6730
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: E("Groups") }),
6928
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: j("Groups") }),
6731
6929
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
6732
6930
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: React__default.Children.toArray(
6733
- map(u, (R, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
6931
+ map(u, (w, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
6734
6932
  "div",
6735
6933
  {
6736
- onMouseEnter: () => j(_),
6737
- onMouseLeave: () => clearTimeout(b.current),
6934
+ onMouseEnter: () => b(_),
6935
+ onMouseLeave: () => clearTimeout(E.current),
6738
6936
  onClick: () => f(_),
6739
6937
  className: cn(
6740
6938
  "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",
6741
6939
  _ === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
6742
6940
  ),
6743
6941
  children: [
6744
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(_.toLowerCase())) }),
6942
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(j(_.toLowerCase())) }),
6745
6943
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
6746
6944
  ]
6747
6945
  },
@@ -6753,15 +6951,15 @@ const BlockCard = ({
6753
6951
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
6754
6952
  ScrollArea,
6755
6953
  {
6756
- onMouseEnter: () => b.current ? clearTimeout(b.current) : null,
6954
+ onMouseEnter: () => E.current ? clearTimeout(E.current) : null,
6757
6955
  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",
6758
6956
  children: [
6759
6957
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
6760
6958
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
6761
- v.map((R) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: R, library: c }))
6959
+ v.map((w) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: w, library: c }))
6762
6960
  ) }),
6763
6961
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
6764
- S.map((R) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: R, library: c }))
6962
+ S.map((w) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: w, library: c }))
6765
6963
  ) })
6766
6964
  ] }),
6767
6965
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -7267,12 +7465,12 @@ i18n.use(initReactI18next).init({
7267
7465
  const CoreBlock = ({ block: o, disabled: r, parentId: n }) => {
7268
7466
  const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), f = () => {
7269
7467
  if (has(o, "blocks")) {
7270
- const E = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7271
- p(syncBlocksWithDefaults(E), n || null);
7468
+ const j = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7469
+ p(syncBlocksWithDefaults(j), n || null);
7272
7470
  } else
7273
7471
  d(o, n || null);
7274
7472
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7275
- }, g = useFeature("dnd"), { t: b } = useTranslation();
7473
+ }, g = useFeature("dnd"), { t: E } = useTranslation();
7276
7474
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
7277
7475
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7278
7476
  "button",
@@ -7280,8 +7478,8 @@ const CoreBlock = ({ block: o, disabled: r, parentId: n }) => {
7280
7478
  disabled: r,
7281
7479
  onClick: f,
7282
7480
  type: "button",
7283
- onDragStart: (E) => {
7284
- E.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), E.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7481
+ onDragStart: (j) => {
7482
+ j.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), j.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7285
7483
  u([]), m();
7286
7484
  }, 200);
7287
7485
  },
@@ -7289,11 +7487,11 @@ const CoreBlock = ({ block: o, disabled: r, parentId: n }) => {
7289
7487
  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",
7290
7488
  children: [
7291
7489
  createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
7292
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(b(c || l)) })
7490
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(E(c || l)) })
7293
7491
  ]
7294
7492
  }
7295
7493
  ) }),
7296
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: b(c || l) }) })
7494
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: E(c || l) }) })
7297
7495
  ] }) });
7298
7496
  }, DefaultChaiBlocks = ({ parentId: o, gridCols: r = "grid-cols-2" }) => {
7299
7497
  const n = useChaiBlocks(), a = useBuilderProp("filterChaiBlock", () => !0), l = filter(n, a), i = groupBy(l, "category"), c = uniq(map(i.core, "group"));
@@ -7389,195 +7587,7 @@ function FaLanguage(o) {
7389
7587
  function FaStar(o) {
7390
7588
  return GenIcon({ tag: "svg", attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z" }, child: [] }] })(o);
7391
7589
  }
7392
- const LANGUAGES = {
7393
- ab: "Abkhazian",
7394
- aa: "Afar",
7395
- af: "Afrikaans",
7396
- ak: "Akan",
7397
- sq: "Albanian",
7398
- am: "Amharic",
7399
- ar: "Arabic",
7400
- an: "Aragonese",
7401
- hy: "Armenian",
7402
- as: "Assamese",
7403
- av: "Avaric",
7404
- ae: "Avestan",
7405
- ay: "Aymara",
7406
- az: "Azerbaijani",
7407
- bm: "Bambara",
7408
- ba: "Bashkir",
7409
- eu: "Basque",
7410
- be: "Belarusian",
7411
- bn: "Bengali",
7412
- bh: "Bihari",
7413
- bi: "Bislama",
7414
- bs: "Bosnian",
7415
- br: "Breton",
7416
- bg: "Bulgarian",
7417
- my: "Burmese",
7418
- ca: "Catalan",
7419
- ch: "Chamorro",
7420
- ce: "Chechen",
7421
- ny: "Chichewa",
7422
- zh: "Chinese",
7423
- "zh-Hans": "Chinese (Simplified)",
7424
- "zh-Hant": "Chinese (Traditional)",
7425
- cv: "Chuvash",
7426
- kw: "Cornish",
7427
- co: "Corsican",
7428
- cr: "Cree",
7429
- hr: "Croatian",
7430
- cs: "Czech",
7431
- da: "Danish",
7432
- dv: "Maldivian",
7433
- nl: "Dutch",
7434
- dz: "Dzongkha",
7435
- en: "English",
7436
- eo: "Esperanto",
7437
- et: "Estonian",
7438
- ee: "Ewe",
7439
- fo: "Faroese",
7440
- fj: "Fijian",
7441
- fi: "Finnish",
7442
- fr: "French",
7443
- ff: "Fula, Pular",
7444
- gl: "Galician",
7445
- gd: "Gaelic (Scottish)",
7446
- gv: "Manx",
7447
- ka: "Georgian",
7448
- de: "German",
7449
- el: "Greek",
7450
- kl: "Kalaallisut",
7451
- gn: "Guarani",
7452
- gu: "Gujarati",
7453
- ht: "Haitian Creole",
7454
- ha: "Hausa",
7455
- he: "Hebrew",
7456
- hz: "Herero",
7457
- hi: "Hindi",
7458
- ho: "Hiri Motu",
7459
- hu: "Hungarian",
7460
- is: "Icelandic",
7461
- io: "Ido",
7462
- ig: "Igbo",
7463
- id: "Indonesian",
7464
- ia: "Interlingua",
7465
- ie: "Interlingue",
7466
- iu: "Inuktitut",
7467
- ik: "Inupiak",
7468
- ga: "Irish",
7469
- it: "Italian",
7470
- ja: "Japanese",
7471
- jv: "Javanese",
7472
- kn: "Kannada",
7473
- kr: "Kanuri",
7474
- ks: "Kashmiri",
7475
- kk: "Kazakh",
7476
- km: "Khmer",
7477
- ki: "Kikuyu",
7478
- rw: "Kinyarwanda",
7479
- rn: "Kirundi",
7480
- ky: "Kyrgyz",
7481
- kv: "Komi",
7482
- kg: "Kongo",
7483
- ko: "Korean",
7484
- ku: "Kurdish",
7485
- kj: "Kwanyama",
7486
- lo: "Lao",
7487
- la: "Latin",
7488
- lv: "Latvian",
7489
- li: "Limburgish",
7490
- ln: "Lingala",
7491
- lt: "Lithuanian",
7492
- lu: "Luga-Katanga",
7493
- lg: "Luganda, Ganda",
7494
- lb: "Luxembourgish",
7495
- mk: "Macedonian",
7496
- mg: "Malagasy",
7497
- ms: "Malay",
7498
- ml: "Malayalam",
7499
- mt: "Maltese",
7500
- mi: "Maori",
7501
- mr: "Marathi",
7502
- mh: "Marshallese",
7503
- mo: "Moldavian",
7504
- mn: "Mongolian",
7505
- na: "Nauru",
7506
- nv: "Navajo",
7507
- ng: "Ndonga",
7508
- nd: "Northern Ndebele",
7509
- ne: "Nepali",
7510
- no: "Norwegian",
7511
- nb: "Norwegian bokmål",
7512
- nn: "Norwegian nynorsk",
7513
- ii: "Sichuan Yi",
7514
- oc: "Occitan",
7515
- oj: "Ojibwe",
7516
- cu: "Old Church Slavonic",
7517
- or: "Oriya",
7518
- om: "Oromo",
7519
- os: "Ossetian",
7520
- pi: "Pāli",
7521
- ps: "Pashto, Pushto",
7522
- fa: "Persian (Farsi)",
7523
- pl: "Polish",
7524
- pt: "Portuguese",
7525
- pa: "Punjabi (Eastern)",
7526
- qu: "Quechua",
7527
- rm: "Romansh",
7528
- ro: "Romanian",
7529
- ru: "Russian",
7530
- se: "Sami",
7531
- sm: "Samoan",
7532
- sg: "Sango",
7533
- sa: "Sanskrit",
7534
- sr: "Serbian",
7535
- sh: "Serbo-Croatian",
7536
- st: "Sesotho",
7537
- tn: "Setswana",
7538
- sn: "Shona",
7539
- sd: "Sindhi",
7540
- si: "Sinhalese",
7541
- ss: "Swati",
7542
- sk: "Slovak",
7543
- sl: "Slovenian",
7544
- so: "Somali",
7545
- nr: "Southern Ndebele",
7546
- es: "Spanish",
7547
- su: "Sundanese",
7548
- sw: "Swahili (Kiswahili)",
7549
- sv: "Swedish",
7550
- tl: "Tagalog",
7551
- ty: "Tahitian",
7552
- tg: "Tajik",
7553
- ta: "Tamil",
7554
- tt: "Tatar",
7555
- te: "Telugu",
7556
- th: "Thai",
7557
- bo: "Tibetan",
7558
- ti: "Tigrinya",
7559
- to: "Tonga",
7560
- ts: "Tsonga",
7561
- tr: "Turkish",
7562
- tk: "Turkmen",
7563
- tw: "Twi",
7564
- ug: "Uyghur",
7565
- uk: "Ukrainian",
7566
- ur: "Urdu",
7567
- uz: "Uzbek",
7568
- ve: "Venda",
7569
- vi: "Vietnamese",
7570
- vo: "Volapük",
7571
- wa: "Wallon",
7572
- cy: "Welsh",
7573
- wo: "Wolof",
7574
- fy: "Western Frisian",
7575
- xh: "Xhosa",
7576
- yi: "Yiddish",
7577
- yo: "Yoruba",
7578
- za: "Zhuang, Chuang",
7579
- zu: "Zulu"
7580
- }, QUICK_PROMPTS = [
7590
+ const QUICK_PROMPTS = [
7581
7591
  {
7582
7592
  name: "Improve writing",
7583
7593
  icon: FaFilePen,
@@ -7658,12 +7668,12 @@ function QuickPrompts({ onClick: o }) {
7658
7668
  const AIUserPrompt = ({ blockId: o }) => {
7659
7669
  const { t: r } = useTranslation(), { askAi: n, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, m] = useState(), f = useRef(null), g = useRef(null);
7660
7670
  useEffect(() => {
7661
- var E;
7662
- (E = f.current) == null || E.focus();
7671
+ var j;
7672
+ (j = f.current) == null || j.focus();
7663
7673
  }, []);
7664
- const b = (E) => {
7665
- const { usage: j } = E || {};
7666
- !l && j && m(j), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
7674
+ const E = (j) => {
7675
+ const { usage: b } = j || {};
7676
+ !l && b && m(b), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
7667
7677
  };
7668
7678
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
7669
7679
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -7683,12 +7693,12 @@ const AIUserPrompt = ({ blockId: o }) => {
7683
7693
  {
7684
7694
  ref: f,
7685
7695
  value: i,
7686
- onChange: (E) => c(E.target.value),
7696
+ onChange: (j) => c(j.target.value),
7687
7697
  placeholder: r("Ask AI to edit content"),
7688
7698
  className: "w-full",
7689
7699
  rows: 3,
7690
- onKeyDown: (E) => {
7691
- E.key === "Enter" && (E.preventDefault(), g.current && clearTimeout(g.current), m(void 0), n("content", o, i, b));
7700
+ onKeyDown: (j) => {
7701
+ j.key === "Enter" && (j.preventDefault(), g.current && clearTimeout(g.current), m(void 0), n("content", o, i, E));
7692
7702
  }
7693
7703
  }
7694
7704
  ),
@@ -7698,7 +7708,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7698
7708
  {
7699
7709
  disabled: i.trim().length < 5 || a,
7700
7710
  onClick: () => {
7701
- g.current && clearTimeout(g.current), m(void 0), n("content", o, i, b);
7711
+ g.current && clearTimeout(g.current), m(void 0), n("content", o, i, E);
7702
7712
  },
7703
7713
  variant: "default",
7704
7714
  className: "w-fit",
@@ -7730,8 +7740,8 @@ const AIUserPrompt = ({ blockId: o }) => {
7730
7740
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7731
7741
  QuickPrompts,
7732
7742
  {
7733
- onClick: (E) => {
7734
- g.current && clearTimeout(g.current), m(void 0), n("content", o, E, b);
7743
+ onClick: (j) => {
7744
+ g.current && clearTimeout(g.current), m(void 0), n("content", o, j, E);
7735
7745
  }
7736
7746
  }
7737
7747
  )
@@ -7745,15 +7755,15 @@ const AIUserPrompt = ({ blockId: o }) => {
7745
7755
  useEffect(() => {
7746
7756
  r && a(r);
7747
7757
  }, [r]);
7748
- const b = async () => {
7758
+ const E = async () => {
7749
7759
  try {
7750
7760
  d(!0), u(null), await i(n), f({
7751
7761
  title: o("Updated AI Context"),
7752
7762
  description: o("You can now Ask AI to edit your content"),
7753
7763
  variant: "default"
7754
7764
  }), g.current.click();
7755
- } catch (E) {
7756
- u(E);
7765
+ } catch (j) {
7766
+ u(j);
7757
7767
  } finally {
7758
7768
  d(!1);
7759
7769
  }
@@ -7761,8 +7771,8 @@ const AIUserPrompt = ({ blockId: o }) => {
7761
7771
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
7762
7772
  Accordion,
7763
7773
  {
7764
- onValueChange: (E) => {
7765
- m(E !== "");
7774
+ onValueChange: (j) => {
7775
+ m(j !== "");
7766
7776
  },
7767
7777
  type: "single",
7768
7778
  collapsible: !0,
@@ -7774,12 +7784,12 @@ const AIUserPrompt = ({ blockId: o }) => {
7774
7784
  {
7775
7785
  ref: l,
7776
7786
  value: n,
7777
- onChange: (E) => a(E.target.value),
7787
+ onChange: (j) => a(j.target.value),
7778
7788
  placeholder: o("Tell about this page eg this page is about"),
7779
7789
  className: "mt-1 w-full",
7780
7790
  rows: 10,
7781
- onKeyDown: (E) => {
7782
- E.key === "Enter" && (E.preventDefault(), b());
7791
+ onKeyDown: (j) => {
7792
+ j.key === "Enter" && (j.preventDefault(), E());
7783
7793
  }
7784
7794
  }
7785
7795
  ),
@@ -7791,7 +7801,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7791
7801
  Button,
7792
7802
  {
7793
7803
  disabled: n.trim().length < 5,
7794
- onClick: () => b(),
7804
+ onClick: () => E(),
7795
7805
  variant: "default",
7796
7806
  className: "w-fit",
7797
7807
  size: "sm",
@@ -7820,7 +7830,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7820
7830
  AlertDialogAction,
7821
7831
  {
7822
7832
  onClick: () => {
7823
- a(""), b();
7833
+ a(""), E();
7824
7834
  },
7825
7835
  children: o("Yes, Delete")
7826
7836
  }
@@ -7841,42 +7851,42 @@ const AIUserPrompt = ({ blockId: o }) => {
7841
7851
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
7842
7852
  ] });
7843
7853
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: r = [], onAttributesChange: n }) {
7844
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, m] = useState(null), [f, g] = useState(""), b = useRef(null), E = useRef(null);
7854
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, m] = useState(null), [f, g] = useState(""), E = useRef(null), j = useRef(null);
7845
7855
  useEffect(() => {
7846
7856
  l(r);
7847
7857
  }, [r]);
7848
- const j = () => {
7858
+ const b = () => {
7849
7859
  if (i.startsWith("@")) {
7850
7860
  g("Attribute keys cannot start with '@'");
7851
7861
  return;
7852
7862
  }
7853
7863
  if (i) {
7854
- const w = [...a, { key: i, value: d }];
7855
- n(w), l(a), c(""), p(""), g("");
7864
+ const R = [...a, { key: i, value: d }];
7865
+ n(R), l(a), c(""), p(""), g("");
7856
7866
  }
7857
- }, v = (w) => {
7858
- const B = a.filter((T, N) => N !== w);
7867
+ }, v = (R) => {
7868
+ const B = a.filter((I, N) => N !== R);
7859
7869
  n(B), l(B);
7860
- }, S = (w) => {
7861
- m(w), c(a[w].key), p(a[w].value);
7862
- }, R = () => {
7870
+ }, S = (R) => {
7871
+ m(R), c(a[R].key), p(a[R].value);
7872
+ }, w = () => {
7863
7873
  if (i.startsWith("@")) {
7864
7874
  g("Attribute keys cannot start with '@'");
7865
7875
  return;
7866
7876
  }
7867
7877
  if (u !== null && i) {
7868
- const w = [...a];
7869
- w[u] = { key: i, value: d }, n(w), l(w), m(null), c(""), p(""), g("");
7878
+ const R = [...a];
7879
+ R[u] = { key: i, value: d }, n(R), l(R), m(null), c(""), p(""), g("");
7870
7880
  }
7871
- }, _ = (w) => {
7872
- w.key === "Enter" && !w.shiftKey && (w.preventDefault(), u !== null ? R() : j());
7881
+ }, _ = (R) => {
7882
+ R.key === "Enter" && !R.shiftKey && (R.preventDefault(), u !== null ? w() : b());
7873
7883
  };
7874
7884
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
7875
7885
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
7876
7886
  "form",
7877
7887
  {
7878
- onSubmit: (w) => {
7879
- w.preventDefault(), u !== null ? R() : j();
7888
+ onSubmit: (R) => {
7889
+ R.preventDefault(), u !== null ? w() : b();
7880
7890
  },
7881
7891
  className: "space-y-3",
7882
7892
  children: [
@@ -7890,9 +7900,9 @@ const AIUserPrompt = ({ blockId: o }) => {
7890
7900
  autoCorrect: "off",
7891
7901
  spellCheck: "false",
7892
7902
  id: "attrKey",
7893
- ref: b,
7903
+ ref: E,
7894
7904
  value: i,
7895
- onChange: (w) => c(w.target.value),
7905
+ onChange: (R) => c(R.target.value),
7896
7906
  placeholder: "Key",
7897
7907
  className: "h-8 text-sm"
7898
7908
  }
@@ -7908,9 +7918,9 @@ const AIUserPrompt = ({ blockId: o }) => {
7908
7918
  spellCheck: "false",
7909
7919
  id: "attrValue",
7910
7920
  rows: 2,
7911
- ref: E,
7921
+ ref: j,
7912
7922
  value: d,
7913
- onChange: (w) => p(w.target.value),
7923
+ onChange: (R) => p(R.target.value),
7914
7924
  onKeyDown: _,
7915
7925
  placeholder: "Value",
7916
7926
  className: "bg-background text-sm"
@@ -7923,10 +7933,10 @@ const AIUserPrompt = ({ blockId: o }) => {
7923
7933
  ]
7924
7934
  }
7925
7935
  ),
7926
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((w, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
7936
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((R, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
7927
7937
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
7928
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: w.key }),
7929
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: w.value.toString() })
7938
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: R.key }),
7939
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: R.value.toString() })
7930
7940
  ] }),
7931
7941
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
7932
7942
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(B), children: [
@@ -8300,7 +8310,7 @@ const ChooseLayout = ({ open: o, close: r }) => {
8300
8310
  ] }) })
8301
8311
  ] })
8302
8312
  ] });
8303
- }, TopBar = lazy(() => import("./Topbar-Npy8Q-99.js"));
8313
+ }, TopBar = lazy(() => import("./Topbar-34AjGxOm.js"));
8304
8314
  function useSidebarMenuItems(o) {
8305
8315
  const r = o === "SINGLE_SIDE_PANEL", { t: n } = useTranslation(), a = useBuilderProp("askAiCallBack", null);
8306
8316
  return useMemo(() => {
@@ -8339,19 +8349,19 @@ const RootLayout = () => {
8339
8349
  /* @__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, {}) }) }),
8340
8350
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
8341
8351
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
8342
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g, b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8352
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8343
8353
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8344
8354
  Button,
8345
8355
  {
8346
- variant: o === b ? "default" : "ghost",
8356
+ variant: o === E ? "default" : "ghost",
8347
8357
  className: "mb-2 rounded-lg p-2 transition-colors",
8348
- onClick: () => d(b),
8358
+ onClick: () => d(E),
8349
8359
  children: get(g, "icon", null)
8350
8360
  },
8351
- b
8361
+ E
8352
8362
  ) }),
8353
8363
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: u(g.label) }) })
8354
- ] }, "button" + b)) }),
8364
+ ] }, "button" + E)) }),
8355
8365
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
8356
8366
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8357
8367
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", onClick: () => l(!0), children: /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutTemplate, { size: 15 }) }) }),