@chaibuilder/sdk 1.2.107 → 1.2.108

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.
@@ -89,38 +89,38 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
89
89
  const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
90
90
  let a, l, i;
91
91
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
92
- const c = (j) => o.get(j), d = (j, k) => {
93
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(k);
92
+ const c = (j) => o.get(j), d = (j, v) => {
93
+ (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(v);
94
94
  const w = o.get(j);
95
- if (o.set(j, k), r.has(j) || r.set(j, w), w && hasPromiseAtomValue(w)) {
96
- const R = "v" in k ? k.v instanceof Promise ? k.v : Promise.resolve(k.v) : Promise.reject(k.e);
97
- cancelPromise(w.v, R);
95
+ if (o.set(j, v), r.has(j) || r.set(j, w), w && hasPromiseAtomValue(w)) {
96
+ const S = "v" in v ? v.v instanceof Promise ? v.v : Promise.resolve(v.v) : Promise.reject(v.e);
97
+ cancelPromise(w.v, S);
98
98
  }
99
- }, p = (j, k, w) => {
100
- const R = /* @__PURE__ */ new Map();
99
+ }, p = (j, v, w) => {
100
+ const S = /* @__PURE__ */ new Map();
101
101
  let T = !1;
102
102
  w.forEach((L, P) => {
103
- !L && P === j && (L = k), L ? (R.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 !== R.size) && (k.d = R);
105
- }, u = (j, k, w) => {
106
- const R = c(j), T = {
107
- d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
108
- v: k
103
+ !L && P === j && (L = v), L ? (S.set(P, L), v.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 || v.d.size !== S.size) && (v.d = S);
105
+ }, u = (j, v, w) => {
106
+ const S = c(j), T = {
107
+ d: (S == null ? void 0 : S.d) || /* @__PURE__ */ new Map(),
108
+ v
109
109
  };
110
- if (w && p(j, T, w), R && isEqualAtomValue(R, T) && R.d === T.d)
111
- return R;
112
- if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(T) && isEqualPromiseAtomValue(R, T)) {
113
- if (R.d === T.d)
114
- return R;
115
- T.v = R.v;
110
+ if (w && p(j, T, w), S && isEqualAtomValue(S, T) && S.d === T.d)
111
+ return S;
112
+ if (S && hasPromiseAtomValue(S) && hasPromiseAtomValue(T) && isEqualPromiseAtomValue(S, T)) {
113
+ if (S.d === T.d)
114
+ return S;
115
+ T.v = S.v;
116
116
  }
117
117
  return d(j, T), T;
118
- }, m = (j, k, w, R) => {
119
- if (isPromiseLike$2(k)) {
118
+ }, m = (j, v, w, S) => {
119
+ if (isPromiseLike$2(v)) {
120
120
  let T;
121
121
  const L = new Promise((P, V) => {
122
122
  let M = !1;
123
- k.then(
123
+ v.then(
124
124
  (O) => {
125
125
  if (!M) {
126
126
  M = !0;
@@ -150,29 +150,29 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
150
150
  ), P(O));
151
151
  };
152
152
  });
153
- return L.orig = k, L.status = "pending", registerCancelPromise(L, (P) => {
154
- P && T(P), R == null || R();
153
+ return L.orig = v, L.status = "pending", registerCancelPromise(L, (P) => {
154
+ P && T(P), S == null || S();
155
155
  }), u(j, L, w);
156
156
  }
157
- return u(j, k, w);
158
- }, x = (j, k, w) => {
159
- const R = c(j), T = {
160
- d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
161
- e: k
157
+ return u(j, v, w);
158
+ }, x = (j, v, w) => {
159
+ const S = c(j), T = {
160
+ d: (S == null ? void 0 : S.d) || /* @__PURE__ */ new Map(),
161
+ e: v
162
162
  };
163
- return w && p(j, T, w), R && isEqualAtomError(R, T) && R.d === T.d ? R : (d(j, T), T);
163
+ return w && p(j, T, w), S && isEqualAtomError(S, T) && S.d === T.d ? S : (d(j, T), T);
164
164
  }, g = (j) => {
165
- const k = c(j);
166
- if (k && (k.d.forEach((M, O) => {
165
+ const v = c(j);
166
+ if (v && (v.d.forEach((M, O) => {
167
167
  O !== j && !n.has(O) && g(O);
168
- }), Array.from(k.d).every(([M, O]) => {
168
+ }), Array.from(v.d).every(([M, O]) => {
169
169
  const $ = c(M);
170
170
  return M === j || $ === O || // TODO This is a hack, we should find a better solution.
171
171
  $ && !hasPromiseAtomValue($) && isEqualAtomValue($, O);
172
172
  })))
173
- return k;
173
+ return v;
174
174
  const w = /* @__PURE__ */ new Map();
175
- let R = !0;
175
+ let S = !0;
176
176
  const T = (M) => {
177
177
  if (M === j) {
178
178
  const $ = c(M);
@@ -192,7 +192,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
192
192
  },
193
193
  get setSelf() {
194
194
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(j) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(j) && (P = (...M) => {
195
- if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && R && console.warn("setSelf function cannot be called in sync"), !R)
195
+ if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && S && console.warn("setSelf function cannot be called in sync"), !S)
196
196
  return B(j, ...M);
197
197
  }), P;
198
198
  }
@@ -208,25 +208,25 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
208
208
  } catch (M) {
209
209
  return x(j, M, w);
210
210
  } finally {
211
- R = !1;
211
+ S = !1;
212
212
  }
213
213
  }, E = (j) => returnAtomValue(g(j)), b = (j) => {
214
- let k = n.get(j);
215
- return k || (k = S(j)), k;
216
- }, f = (j, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(j)), v = (j) => {
217
- const k = n.get(j);
218
- k && f(j, k) && A(j);
214
+ let v = n.get(j);
215
+ return v || (v = R(j)), v;
216
+ }, f = (j, v) => !v.l.size && (!v.t.size || v.t.size === 1 && v.t.has(j)), k = (j) => {
217
+ const v = n.get(j);
218
+ v && f(j, v) && A(j);
219
219
  }, _ = (j) => {
220
- const k = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), R = (L) => {
220
+ const v = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), S = (L) => {
221
221
  const P = n.get(L);
222
222
  P == null || P.t.forEach((V) => {
223
- V !== L && (k.set(
223
+ V !== L && (v.set(
224
224
  V,
225
- (k.get(V) || /* @__PURE__ */ new Set()).add(L)
226
- ), w.set(V, (w.get(V) || 0) + 1), R(V));
225
+ (v.get(V) || /* @__PURE__ */ new Set()).add(L)
226
+ ), w.set(V, (w.get(V) || 0) + 1), S(V));
227
227
  });
228
228
  };
229
- R(j);
229
+ S(j);
230
230
  const T = (L) => {
231
231
  const P = n.get(L);
232
232
  P == null || P.t.forEach((V) => {
@@ -234,21 +234,21 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
234
234
  if (V !== L) {
235
235
  let O = w.get(V);
236
236
  if (O && w.set(V, --O), !O) {
237
- let $ = !!((M = k.get(V)) != null && M.size);
237
+ let $ = !!((M = v.get(V)) != null && M.size);
238
238
  if ($) {
239
239
  const H = c(V), F = g(V);
240
240
  $ = !H || !isEqualAtomValue(H, F);
241
241
  }
242
- $ || k.forEach((H) => H.delete(V));
242
+ $ || v.forEach((H) => H.delete(V));
243
243
  }
244
244
  T(V);
245
245
  }
246
246
  });
247
247
  };
248
248
  T(j);
249
- }, C = (j, ...k) => {
249
+ }, C = (j, ...v) => {
250
250
  let w = !0;
251
- const R = (P) => returnAtomValue(g(P)), T = (P, ...V) => {
251
+ const S = (P) => returnAtomValue(g(P)), T = (P, ...V) => {
252
252
  let M;
253
253
  if (P === j) {
254
254
  if (!hasInitialValue(P))
@@ -264,74 +264,74 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
264
264
  );
265
265
  }
266
266
  return M;
267
- }, L = j.write(R, T, ...k);
267
+ }, L = j.write(S, T, ...v);
268
268
  return w = !1, L;
269
- }, B = (j, ...k) => {
270
- const w = C(j, ...k), R = D();
269
+ }, B = (j, ...v) => {
270
+ const w = C(j, ...v), S = D();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
- (T) => T({ type: "write", flushed: R })
272
+ (T) => T({ type: "write", flushed: S })
273
273
  ), w;
274
- }, S = (j, k) => {
274
+ }, R = (j, v) => {
275
275
  const w = {
276
- t: new Set(k && [k]),
276
+ t: new Set(v && [v]),
277
277
  l: /* @__PURE__ */ new Set()
278
278
  };
279
- if (n.set(j, w), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(j), g(j).d.forEach((R, T) => {
279
+ if (n.set(j, w), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(j), g(j).d.forEach((S, T) => {
280
280
  const L = n.get(T);
281
- L ? L.t.add(j) : T !== j && S(T, j);
281
+ L ? L.t.add(j) : T !== j && R(T, j);
282
282
  }), g(j), isActuallyWritableAtom(j) && j.onMount) {
283
- const R = j.onMount((...T) => B(j, ...T));
284
- R && (w.u = R);
283
+ const S = j.onMount((...T) => B(j, ...T));
284
+ S && (w.u = S);
285
285
  }
286
286
  return w;
287
287
  }, A = (j) => {
288
- var k;
289
- const w = (k = n.get(j)) == null ? void 0 : k.u;
288
+ var v;
289
+ const w = (v = n.get(j)) == null ? void 0 : v.u;
290
290
  w && w(), n.delete(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(j);
291
- const R = c(j);
292
- R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((T, L) => {
291
+ const S = c(j);
292
+ S ? (hasPromiseAtomValue(S) && cancelPromise(S.v), S.d.forEach((T, L) => {
293
293
  if (L !== j) {
294
294
  const P = n.get(L);
295
295
  P && (P.t.delete(j), f(L, P) && A(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", j);
298
- }, N = (j, k, w) => {
299
- const R = new Set(k.d.keys());
298
+ }, N = (j, v, w) => {
299
+ const S = new Set(v.d.keys());
300
300
  w == null || w.forEach((T, L) => {
301
- if (R.has(L)) {
302
- R.delete(L);
301
+ if (S.has(L)) {
302
+ S.delete(L);
303
303
  return;
304
304
  }
305
305
  const P = n.get(L);
306
306
  P && (P.t.delete(j), f(L, P) && A(L));
307
- }), R.forEach((T) => {
307
+ }), S.forEach((T) => {
308
308
  const L = n.get(T);
309
- L ? L.t.add(j) : n.has(j) && S(T, j);
309
+ L ? L.t.add(j) : n.has(j) && R(T, j);
310
310
  });
311
311
  }, D = () => {
312
312
  let j;
313
313
  for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (j = /* @__PURE__ */ new Set()); r.size; ) {
314
- const k = Array.from(r);
315
- r.clear(), k.forEach(([w, R]) => {
314
+ const v = Array.from(r);
315
+ r.clear(), v.forEach(([w, S]) => {
316
316
  const T = c(w);
317
317
  if (T) {
318
- T.d !== (R == null ? void 0 : R.d) && N(w, T, R == null ? void 0 : R.d);
318
+ T.d !== (S == null ? void 0 : S.d) && N(w, T, S == null ? void 0 : S.d);
319
319
  const L = n.get(w);
320
320
  L && !// TODO This seems pretty hacky. Hope to fix it.
321
321
  // Maybe we could `mountDependencies` in `setAtomState`?
322
- (R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, T) || isEqualAtomError(R, T))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && j.add(w));
322
+ (S && !hasPromiseAtomValue(S) && (isEqualAtomValue(S, T) || isEqualAtomError(S, T))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && j.add(w));
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
  });
326
326
  }
327
327
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
328
- return a.forEach((k) => k("state")), j;
329
- }, I = (j, k) => {
330
- const w = b(j), R = D(), T = w.l;
331
- return T.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
332
- (L) => L({ type: "sub", flushed: R })
328
+ return a.forEach((v) => v("state")), j;
329
+ }, I = (j, v) => {
330
+ const w = b(j), S = D(), T = w.l;
331
+ return T.add(v), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
332
+ (L) => L({ type: "sub", flushed: S })
333
333
  )), () => {
334
- T.delete(k), v(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
334
+ T.delete(v), k(j), (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" ? {
@@ -339,7 +339,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
339
339
  set: B,
340
340
  sub: I,
341
341
  // store dev methods (these are tentative and subject to change without notice)
342
- dev_subscribe_store: (j, k) => k !== 2 ? (console.warn(
342
+ dev_subscribe_store: (j, v) => v !== 2 ? (console.warn(
343
343
  "The current StoreListener revision is 2. The older ones are deprecated."
344
344
  ), a.add(j), () => {
345
345
  a.delete(j);
@@ -350,11 +350,11 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
350
350
  dev_get_atom_state: (j) => o.get(j),
351
351
  dev_get_mounted: (j) => n.get(j),
352
352
  dev_restore_atoms: (j) => {
353
- for (const [w, R] of j)
354
- hasInitialValue(w) && (m(w, R), _(w));
355
- const k = D();
353
+ for (const [w, S] of j)
354
+ hasInitialValue(w) && (m(w, S), _(w));
355
+ const v = D();
356
356
  l.forEach(
357
- (w) => w({ type: "restore", flushed: k })
357
+ (w) => w({ type: "restore", flushed: v })
358
358
  );
359
359
  }
360
360
  } : {
@@ -386,27 +386,27 @@ function splitAtom(o, n) {
386
386
  m[E] = f;
387
387
  return;
388
388
  }
389
- const v = (C) => {
390
- const B = C(l), S = C(o), N = a(S, B == null ? void 0 : B.arr).keyList.indexOf(b);
391
- if (N < 0 || N >= S.length) {
389
+ const k = (C) => {
390
+ const B = C(l), R = C(o), N = a(R, B == null ? void 0 : B.arr).keyList.indexOf(b);
391
+ if (N < 0 || N >= R.length) {
392
392
  const D = c[a(c).keyList.indexOf(b)];
393
393
  if (D)
394
394
  return D;
395
395
  throw new Error("splitAtom: index out of bounds for read");
396
396
  }
397
- return S[N];
398
- }, _ = (C, B, S) => {
397
+ return R[N];
398
+ }, _ = (C, B, R) => {
399
399
  const A = C(l), N = C(o), I = a(N, A == null ? void 0 : A.arr).keyList.indexOf(b);
400
400
  if (I < 0 || I >= N.length)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const j = isFunction(S) ? S(N[I]) : S;
402
+ const j = isFunction(R) ? R(N[I]) : R;
403
403
  B(o, [
404
404
  ...N.slice(0, I),
405
405
  j,
406
406
  ...N.slice(I + 1)
407
407
  ]);
408
408
  };
409
- m[E] = isWritable(o) ? atom(v, _) : atom(v);
409
+ m[E] = isWritable(o) ? atom(k, _) : atom(k);
410
410
  }), u && u.keyList.length === x.length && u.keyList.every((g, E) => g === x[E]) ? p = u : p = { arr: c, atomList: m, keyList: x }, r.set(c, p), p;
411
411
  }, l = atom((c) => {
412
412
  const d = c(l), p = c(o);
@@ -1195,22 +1195,22 @@ const useBlocksStoreManager = () => {
1195
1195
  updateBlocksProps: c
1196
1196
  } = useBlocksStoreManager();
1197
1197
  return {
1198
- moveBlocks: (b, f, v) => {
1198
+ moveBlocks: (b, f, k) => {
1199
1199
  const _ = map(b, (B) => {
1200
1200
  const A = n.find((I) => I._id === B)._parent || null, D = n.filter((I) => A ? I._parent === A : !I._parent).map((I) => I._id).indexOf(B);
1201
1201
  return { _id: B, oldParent: A, oldPosition: D };
1202
1202
  }), C = _.find(({ _id: B }) => B === b[0]);
1203
- C && C.oldParent === f && C.oldPosition === v || (i(b, f, v), o({
1204
- undo: () => each(_, ({ _id: B, oldParent: S, oldPosition: A }) => {
1205
- i([B], S, A);
1203
+ C && C.oldParent === f && C.oldPosition === k || (i(b, f, k), o({
1204
+ undo: () => each(_, ({ _id: B, oldParent: R, oldPosition: A }) => {
1205
+ i([B], R, A);
1206
1206
  }),
1207
- redo: () => i(b, f, v)
1207
+ redo: () => i(b, f, k)
1208
1208
  }));
1209
1209
  },
1210
- addBlocks: (b, f, v) => {
1211
- a(b, f, v), o({
1210
+ addBlocks: (b, f, k) => {
1211
+ a(b, f, k), o({
1212
1212
  undo: () => l(map(b, "_id")),
1213
- redo: () => a(b, f, v)
1213
+ redo: () => a(b, f, k)
1214
1214
  });
1215
1215
  },
1216
1216
  removeBlocks: (b) => {
@@ -1221,15 +1221,15 @@ const useBlocksStoreManager = () => {
1221
1221
  redo: () => l(map(b, "_id"))
1222
1222
  });
1223
1223
  },
1224
- updateBlocks: (b, f, v) => {
1224
+ updateBlocks: (b, f, k) => {
1225
1225
  let _ = [];
1226
- if (v)
1227
- _ = map(b, (C) => ({ _id: C, ...v }));
1226
+ if (k)
1227
+ _ = map(b, (C) => ({ _id: C, ...k }));
1228
1228
  else {
1229
1229
  const C = keys(f);
1230
1230
  _ = map(b, (B) => {
1231
- const S = n.find((N) => N._id === B), A = { _id: B };
1232
- return each(C, (N) => A[N] = S[N]), A;
1231
+ const R = n.find((N) => N._id === B), A = { _id: B };
1232
+ return each(C, (N) => A[N] = R[N]), A;
1233
1233
  });
1234
1234
  }
1235
1235
  c(map(b, (C) => ({ _id: C, ...f }))), o({
@@ -1238,7 +1238,7 @@ const useBlocksStoreManager = () => {
1238
1238
  });
1239
1239
  },
1240
1240
  updateBlocksRuntime: (b, f) => {
1241
- c(map(b, (v) => ({ _id: v, ...f })));
1241
+ c(map(b, (k) => ({ _id: k, ...f })));
1242
1242
  },
1243
1243
  setNewBlocks: (b) => {
1244
1244
  r(b), o({
@@ -1248,9 +1248,9 @@ const useBlocksStoreManager = () => {
1248
1248
  },
1249
1249
  updateMultipleBlocksProps: (b) => {
1250
1250
  let f = [];
1251
- f = map(b, (v) => {
1252
- const _ = keys(v), C = n.find((S) => S._id === v._id), B = {};
1253
- return each(_, (S) => B[S] = C[S]), B;
1251
+ f = map(b, (k) => {
1252
+ const _ = keys(k), C = n.find((R) => R._id === k._id), B = {};
1253
+ return each(_, (R) => B[R] = C[R]), B;
1254
1254
  }), c(b), o({
1255
1255
  undo: () => c(f),
1256
1256
  redo: () => c(b)
@@ -1265,8 +1265,8 @@ const useBlocksStoreManager = () => {
1265
1265
  const { _id: b } = i[E];
1266
1266
  i[E]._id = generateUUID();
1267
1267
  const f = filter(i, { _parent: b });
1268
- for (let v = 0; v < f.length; v++)
1269
- f[v]._parent = i[E]._id;
1268
+ for (let k = 0; k < f.length; k++)
1269
+ f[k]._parent = i[E]._id;
1270
1270
  }
1271
1271
  const p = first(i);
1272
1272
  let u, m;
@@ -1277,13 +1277,13 @@ const useBlocksStoreManager = () => {
1277
1277
  return { addCoreBlock: useCallback(
1278
1278
  (i, c, d) => {
1279
1279
  if (has(i, "blocks")) {
1280
- const v = i.blocks;
1281
- return a(v, c, d);
1280
+ const k = i.blocks;
1281
+ return a(k, c, d);
1282
1282
  }
1283
1283
  const p = generateUUID(), u = getBlockDefaultProps(i.props), m = [];
1284
- forIn(u, (v, _) => {
1285
- if (startsWith(v, SLOT_KEY)) {
1286
- const C = v.replace(SLOT_KEY, "");
1284
+ forIn(u, (k, _) => {
1285
+ if (startsWith(k, SLOT_KEY)) {
1286
+ const C = k.replace(SLOT_KEY, "");
1287
1287
  m.push({
1288
1288
  _id: C,
1289
1289
  _type: "Slot",
@@ -3074,26 +3074,26 @@ const useDnd = () => {
3074
3074
  g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
3075
3075
  },
3076
3076
  onDrop: (g) => {
3077
- var S;
3078
- const E = dropTarget, f = getOrientation(E) === "vertical" ? g.clientY + ((S = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : S.scrollY) : g.clientX;
3077
+ var R;
3078
+ const E = dropTarget, f = getOrientation(E) === "vertical" ? g.clientY + ((R = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : R.scrollY) : g.clientX;
3079
3079
  dropIndex = calculateDropIndex(f, possiblePositions);
3080
- const v = d, _ = E.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3081
- if ((v == null ? void 0 : v._id) === _ || !C) {
3080
+ const k = d, _ = E.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3081
+ if ((k == null ? void 0 : k._id) === _ || !C) {
3082
3082
  x();
3083
3083
  return;
3084
3084
  }
3085
- if (!has(v, "_id")) {
3086
- a(v, _ === "canvas" ? null : _, dropIndex), setTimeout(x, 300);
3085
+ if (!has(k, "_id")) {
3086
+ a(k, _ === "canvas" ? null : _, dropIndex), setTimeout(x, 300);
3087
3087
  return;
3088
3088
  }
3089
3089
  let B = E.getAttribute("data-block-id");
3090
- B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([v._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3090
+ B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3091
3091
  },
3092
3092
  onDragEnter: (g) => {
3093
3093
  const E = g, b = E.target;
3094
3094
  dropTarget = b;
3095
- const f = b.getAttribute("data-block-id"), v = b.getAttribute("data-dnd-dragged") !== "yes";
3096
- u(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], v && calculatePossiblePositions(b), r(!0), l(""), i([]);
3095
+ const f = b.getAttribute("data-block-id"), k = b.getAttribute("data-dnd-dragged") !== "yes";
3096
+ u(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(b), r(!0), l(""), i([]);
3097
3097
  },
3098
3098
  onDragLeave: (g) => {
3099
3099
  g.target.getAttribute("data-block-id") === "canvas" && (u(null), r(!1), removePlaceholder(), possiblePositions = []);
@@ -3318,13 +3318,13 @@ const handleMouseMove = throttle((o) => {
3318
3318
  }, [r, c]);
3319
3319
  const g = get(o, "headingFont", "DM Sans"), E = get(o, "bodyFont", "DM Sans");
3320
3320
  return useEffect(() => {
3321
- const b = get(o, "primaryColor", "#000"), f = get(o, "secondaryColor", "#FFF"), v = get(o, "bodyBgLightColor", "#fff"), _ = get(o, "bodyBgDarkColor", "#000"), C = get(o, "bodyTextDarkColor", "#000"), B = get(o, "bodyTextLightColor", "#fff"), S = s({
3321
+ const b = get(o, "primaryColor", "#000"), f = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), _ = get(o, "bodyBgDarkColor", "#000"), C = get(o, "bodyTextDarkColor", "#000"), B = get(o, "bodyTextLightColor", "#fff"), R = s({
3322
3322
  colors: [b, f],
3323
3323
  names: ["primary", "secondary"]
3324
3324
  });
3325
- set(S, "primary.DEFAULT", b), set(S, "secondary.DEFAULT", f);
3325
+ set(R, "primary.DEFAULT", b), set(R, "secondary.DEFAULT", f);
3326
3326
  const A = {
3327
- "bg-light": v,
3327
+ "bg-light": k,
3328
3328
  "bg-dark": _,
3329
3329
  "text-dark": C,
3330
3330
  "text-light": B
@@ -3347,7 +3347,7 @@ const handleMouseMove = throttle((o) => {
3347
3347
  borderRadius: {
3348
3348
  DEFAULT: `${N || "0"}px`
3349
3349
  },
3350
- colors: { ...A, ...S }
3350
+ colors: { ...A, ...R }
3351
3351
  }
3352
3352
  },
3353
3353
  plugins: [
@@ -3509,28 +3509,28 @@ function applyLanguage(o, n, r) {
3509
3509
  }
3510
3510
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3511
3511
  const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [p] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), x = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), b = useCallback(
3512
- (f) => f.reduce((v, _) => {
3512
+ (f) => f.reduce((k, _) => {
3513
3513
  const C = get(p, _, {});
3514
- return { ...v, ...C };
3514
+ return { ...k, ...C };
3515
3515
  }, {}),
3516
3516
  [p]
3517
3517
  );
3518
3518
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3519
- o.map((f, v) => {
3519
+ o.map((f, k) => {
3520
3520
  if (E === f._id || u.includes(f._id))
3521
3521
  return null;
3522
3522
  const _ = {}, C = filter(n, { _parent: f._id });
3523
3523
  if (_.children = C.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: C }) : null, f._type === "GlobalBlock") {
3524
3524
  const w = m(f);
3525
- _.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(w, (R) => !R._parent), allBlocks: w });
3525
+ _.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(w, (S) => !S._parent), allBlocks: w });
3526
3526
  }
3527
- const B = getBlockComponent(f._type), S = get(B, "server", !1), A = S ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
3527
+ const B = getBlockComponent(f._type), R = get(B, "server", !1), A = R ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
3528
3528
  if (isNull(A))
3529
3529
  return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
3530
3530
  const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(f, n) : [], D = b(N), I = x(f);
3531
3531
  if (get(I, "__isHidden", !1) && !includes(a, f._id))
3532
3532
  return null;
3533
- const j = i && isDescendant(i._id, f._id, n), k = {
3533
+ const j = i && isDescendant(i._id, f._id, n), v = {
3534
3534
  ...includes(a, f._id) ? { "force-show": "" } : {},
3535
3535
  "data-block-id": f._id,
3536
3536
  "data-block-type": f._type,
@@ -3544,9 +3544,9 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3544
3544
  ...c === f._id && !j ? { "data-drop": "yes" } : {},
3545
3545
  ...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
3546
3546
  };
3547
- return S ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: k }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
3548
- blockProps: k,
3549
- index: v,
3547
+ return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: v }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
3548
+ blockProps: v,
3549
+ index: k,
3550
3550
  ...applyBindings(applyLanguage(f, r, B), g),
3551
3551
  ...omit(I, ["__isHidden"]),
3552
3552
  ..._,
@@ -3601,7 +3601,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3601
3601
  n(i);
3602
3602
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
3603
3603
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3604
- const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [b, f] = useSelectedStylingBlocks(), v = useBuilderProp("loading", !1), _ = useBuilderProp("htmlDir", "ltr"), C = (A) => {
3604
+ const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [b, f] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), _ = useBuilderProp("htmlDir", "ltr"), C = (A) => {
3605
3605
  p((N) => ({ ...N, width: A }));
3606
3606
  };
3607
3607
  useEffect(() => {
@@ -3630,7 +3630,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3630
3630
  } else
3631
3631
  g([null]);
3632
3632
  }, [b]);
3633
- const S = useMemo(() => {
3633
+ const R = useMemo(() => {
3634
3634
  let A = IframeInitialContent;
3635
3635
  return A = A.replace("__HTML_DIR__", _), o === "offline" && (A = A.replace(
3636
3636
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
@@ -3654,7 +3654,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3654
3654
  id: "canvas-iframe",
3655
3655
  style: { ...u, ...isEmpty(u) ? { width: `${n}px` } : {} },
3656
3656
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3657
- initialContent: S,
3657
+ initialContent: R,
3658
3658
  children: [
3659
3659
  /* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
3660
3660
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3666,7 +3666,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3666
3666
  ),
3667
3667
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {}),
3668
3668
  /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
3669
- v ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3669
+ k ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3670
3670
  /* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
3671
3671
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
3672
3672
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -3777,7 +3777,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3777
3777
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3778
3778
  ] }, l))
3779
3779
  ] }) });
3780
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-U9ErQEW3.js")), CanvasArea = () => {
3780
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-kW6SrwIa.js")), CanvasArea = () => {
3781
3781
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3782
3782
  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: [
3783
3783
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
@@ -3852,8 +3852,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3852
3852
  showHeading: o = !0,
3853
3853
  className: n = ""
3854
3854
  }) => {
3855
- const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: S }, A) => {
3856
- A && (a(S), i.current = S);
3855
+ const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: R }, A) => {
3856
+ A && (a(R), i.current = R);
3857
3857
  }, {
3858
3858
  bodyFont: p,
3859
3859
  headingFont: u,
@@ -3863,7 +3863,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3863
3863
  bodyBgDarkColor: E,
3864
3864
  secondaryColor: b,
3865
3865
  bodyBgLightColor: f,
3866
- roundedCorners: v
3866
+ roundedCorners: k
3867
3867
  } = r;
3868
3868
  let _ = {
3869
3869
  headingFont: y({
@@ -3878,7 +3878,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3878
3878
  }),
3879
3879
  roundedCorners: s$1({
3880
3880
  title: c("theme_config.rounded_corner"),
3881
- default: parseInt(v || 5, 10)
3881
+ default: parseInt(k || 5, 10)
3882
3882
  }),
3883
3883
  primaryColor: h({ title: c("theme_config.primary"), default: m }),
3884
3884
  secondaryColor: h({ title: c("theme_config.secondary"), default: b })
@@ -3906,9 +3906,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3906
3906
  type: "object",
3907
3907
  properties: {}
3908
3908
  }, B = {};
3909
- return Object.keys(_).forEach((S) => {
3910
- const A = _[S];
3911
- return C.properties || (C.properties = {}), C.properties[S] = A.schema, B[S] = A.uiSchema, !0;
3909
+ return Object.keys(_).forEach((R) => {
3910
+ const A = _[R];
3911
+ return C.properties || (C.properties = {}), C.properties[R] = A.schema, B[R] = A.uiSchema, !0;
3912
3912
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
3913
3913
  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,
3914
3914
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -4104,11 +4104,11 @@ function BiExpandVertical(o) {
4104
4104
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4105
4105
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
4106
4106
  let p = null;
4107
- const u = o.children.length > 0, { highlightBlock: m } = useBlockHighlight(), { id: x, data: g, isSelected: E, willReceiveDrop: b, isDragging: f, isEditing: v, handleClick: _ } = o, C = (I) => {
4107
+ const u = o.children.length > 0, { highlightBlock: m } = useBlockHighlight(), { id: x, data: g, isSelected: E, willReceiveDrop: b, isDragging: f, isEditing: k, handleClick: _ } = o, C = (I) => {
4108
4108
  I.stopPropagation(), !i.includes(x) && o.toggle();
4109
4109
  }, B = (I) => {
4110
4110
  I.isInternal && (p = I.isOpen, I.isOpen && I.close());
4111
- }, S = (I) => {
4111
+ }, R = (I) => {
4112
4112
  I.isInternal && p !== null && (p ? I.open() : I.close(), p = null);
4113
4113
  }, A = (I) => {
4114
4114
  I.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), _(I);
@@ -4121,17 +4121,17 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4121
4121
  }, [b, o, f]);
4122
4122
  const N = useMemo(() => {
4123
4123
  const I = Object.keys(g), j = [];
4124
- for (let k = 0; k < I.length; k++)
4125
- if (I[k].endsWith("_attrs")) {
4126
- const w = g[I[k]], R = Object.keys(w).join("|");
4127
- R.match(/x-data/) && j.push("data"), R.match(/x-on/) && j.push("event"), R.match(/x-show|x-if/) && j.push("show");
4124
+ for (let v = 0; v < I.length; v++)
4125
+ if (I[v].endsWith("_attrs")) {
4126
+ const w = g[I[v]], S = Object.keys(w).join("|");
4127
+ S.match(/x-data/) && j.push("data"), S.match(/x-on/) && j.push("event"), S.match(/x-show|x-if/) && j.push("show");
4128
4128
  }
4129
4129
  return j;
4130
4130
  }, [g]), D = (I, j) => {
4131
- const k = d.contentDocument || d.contentWindow.document, w = k.querySelector(`[data-block-id=${I}]`);
4131
+ const v = d.contentDocument || d.contentWindow.document, w = v.querySelector(`[data-block-id=${I}]`);
4132
4132
  w && w.setAttribute("data-drop", j);
4133
- const R = w.getBoundingClientRect(), T = d.getBoundingClientRect();
4134
- R.top >= T.top && R.left >= T.left && R.bottom <= T.bottom && R.right <= T.right || (k.documentElement.scrollTop = w.offsetTop - T.top);
4133
+ const S = w.getBoundingClientRect(), T = d.getBoundingClientRect();
4134
+ S.top >= T.top && S.left >= T.left && S.bottom <= T.bottom && S.right <= T.right || (v.documentElement.scrollTop = w.offsetTop - T.top);
4135
4135
  };
4136
4136
  return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4137
4137
  "button",
@@ -4152,7 +4152,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4152
4152
  "data-node-id": x,
4153
4153
  ref: i.includes(x) ? null : r,
4154
4154
  onDragStart: () => B(o),
4155
- onDragEnd: () => S(o),
4155
+ onDragEnd: () => R(o),
4156
4156
  onDragOver: (I) => {
4157
4157
  I.preventDefault(), D(x, "yes");
4158
4158
  },
@@ -4180,7 +4180,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4180
4180
  ),
4181
4181
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4182
4182
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: g == null ? void 0 : g._type }) }),
4183
- v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4183
+ k ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4184
4184
  "div",
4185
4185
  {
4186
4186
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
@@ -4454,7 +4454,10 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4454
4454
  multiple: "multiple",
4455
4455
  name: "fieldName"
4456
4456
  }
4457
- }, shouldAddText = (o, n) => o.children.length === 1 && includes(["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link"], n._type), getTextContent = (o) => o.map((n) => n.type === "text" ? get(n, "content", "") : isEmpty(n.children) ? "" : getTextContent(n.children)).join(""), getSanitizedValue = (o) => o === null ? "" : o, getAttrs = (o) => {
4457
+ }, shouldAddText = (o, n) => o.children.length === 1 && includes(
4458
+ ["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
4459
+ n._type
4460
+ ), getTextContent = (o) => o.map((n) => n.type === "text" ? get(n, "content", "") : isEmpty(n.children) ? "" : getTextContent(n.children)).join(""), getSanitizedValue = (o) => o === null ? "" : o, getAttrs = (o) => {
4458
4461
  if (o.tagName === "svg")
4459
4462
  return {};
4460
4463
  const n = {}, r = ATTRIBUTE_MAP[o.tagName] || {}, a = o.attributes;
@@ -4479,6 +4482,11 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4479
4482
  }
4480
4483
  return { [n]: `${STYLES_KEY},` };
4481
4484
  }, getBlockProps = (o) => {
4485
+ const n = get(o, "attributes", []), r = n.find((l) => l.key === "data-chai-richtext" || l.key === "chai-richtext"), a = n.find((l) => l.key === "data-chai-lightbox" || l.key === "chai-lightbox");
4486
+ if (r)
4487
+ return { _type: "RichText" };
4488
+ if (a)
4489
+ return { _type: "LightBoxLink" };
4482
4490
  switch (o.tagName) {
4483
4491
  case "img":
4484
4492
  return { _type: "Image" };
@@ -4550,46 +4558,78 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4550
4558
  return { _type: "TableBody" };
4551
4559
  case "tfoot":
4552
4560
  return { _type: "TableFooter" };
4553
- default:
4554
- const n = get(o, "children", []).length > 0 ? "Box" : "EmptyBox";
4561
+ case "div": {
4562
+ const l = get(o, "children", []).length > 0 ? "Box" : "EmptyBox";
4555
4563
  return {
4556
- _type: n,
4564
+ _type: l,
4557
4565
  tag: o.tagName,
4558
- _name: n == "EmptyBox" || o.tagName === "div" ? n : capitalize(o.tagName)
4566
+ _name: l == "EmptyBox" || o.tagName === "div" ? l : capitalize(o.tagName)
4559
4567
  };
4568
+ }
4560
4569
  }
4561
4570
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
4562
- var i;
4571
+ var p, u, m, x, g, E, b, f;
4563
4572
  if (r.type === "comment")
4564
4573
  return [];
4565
4574
  let a = { _id: generateUUID() };
4566
4575
  if (n && (a._parent = n.block._id), r.type === "text")
4567
4576
  return isEmpty(get(r, "content", "")) ? [] : n && shouldAddText(n.node, n.block) ? (set(n, "block.content", get(r, "content", "")), []) : { ...a, _type: "Text", content: get(r, "content", "") };
4577
+ const l = get(r, "attributes", []), i = l.find(
4578
+ (k) => k.key === "data-chai-richtext" || k.key === "chai-richtext"
4579
+ ), c = l.find(
4580
+ (k) => k.key === "data-chai-lightbox" || k.key === "chai-lightbox"
4581
+ );
4568
4582
  if (a = {
4569
4583
  ...a,
4570
4584
  ...getBlockProps(r),
4571
4585
  ...getAttrs(r),
4572
4586
  ...getStyles(r)
4573
4587
  }, r.attributes) {
4574
- const c = r.attributes.find((d) => d.key === NAME_ATTRIBUTE);
4575
- c && (a._name = c.value);
4588
+ const k = r.attributes.find((_) => _.key === NAME_ATTRIBUTE);
4589
+ k && (a._name = k.value);
4590
+ }
4591
+ if (i)
4592
+ return a.content = stringify(r.children), has(a, "styles_attrs.data-chai-richtext") && delete a.styles_attrs["data-chai-richtext"], has(a, "styles_attrs.chai-richtext") && delete a.styles_attrs["chai-richtext"], [a];
4593
+ if (c) {
4594
+ const k = [
4595
+ "data-chai-lightbox",
4596
+ "chai-lightbox",
4597
+ "data-vbtype",
4598
+ "data-autoplay",
4599
+ "data-maxwidth",
4600
+ "data-overlay",
4601
+ "data-gall",
4602
+ "href"
4603
+ ];
4604
+ a = {
4605
+ ...a,
4606
+ href: ((p = l.find((_) => _.key === "href")) == null ? void 0 : p.value) || "",
4607
+ hrefType: ((u = l.find((_) => _.key === "data-vbtype")) == null ? void 0 : u.value) || "video",
4608
+ autoplay: ((m = l.find((_) => _.key === "data-autoplay")) == null ? void 0 : m.value) === "true",
4609
+ maxWidth: ((g = (x = l.find((_) => _.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : g.replace("px", "")) || "",
4610
+ backdropColor: ((E = l.find((_) => _.key === "data-overlay")) == null ? void 0 : E.value) || "",
4611
+ galleryName: ((b = l.find((_) => _.key === "data-gall")) == null ? void 0 : b.value) || ""
4612
+ }, forEach(k, (_) => {
4613
+ has(a, `styles_attrs.${_}`) && delete a.styles_attrs[_];
4614
+ });
4576
4615
  }
4577
4616
  if (a._type === "Input") {
4578
- const c = a.inputType || "text";
4579
- c === "checkbox" ? set(a, "_type", "Checkbox") : c === "radio" && set(a, "_type", "Radio");
4617
+ const k = a.inputType || "text";
4618
+ k === "checkbox" ? set(a, "_type", "Checkbox") : k === "radio" && set(a, "_type", "Radio");
4580
4619
  } else if (r.tagName === "video" || r.tagName === "iframe") {
4581
- const c = stringify([r]);
4582
- return hasVideoEmbed(c) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(c)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = c, [a];
4620
+ const k = stringify([r]);
4621
+ return hasVideoEmbed(k) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(k)), 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 = k, [a];
4583
4622
  } else if (r.tagName === "svg") {
4584
- const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), p = get(c, "value") ? `[${get(c, "value")}px]` : "24px", u = get(d, "value") ? `[${get(d, "value")}px]` : "24px", m = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4585
- return a.styles = `${STYLES_KEY}, ${cn(`w-${u} h-${p}`, m)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
4586
- } else if (r.tagName == "option" && n && ((i = n.block) == null ? void 0 : i._type) === "Select")
4623
+ const k = find(r.attributes, { key: "height" }), _ = find(r.attributes, { key: "width" }), C = get(k, "value") ? `[${get(k, "value")}px]` : "24px", B = get(_, "value") ? `[${get(_, "value")}px]` : "24px", R = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4624
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${B} h-${C}`, R)}`.trim(), r.attributes = filter(r.attributes, (A) => !includes(["style", "width", "height", "class"], A.key)), a.icon = stringify([r]), [a];
4625
+ } else if (r.tagName == "option" && n && ((f = n.block) == null ? void 0 : f._type) === "Select")
4587
4626
  return n.block.options.push({
4588
4627
  label: getTextContent(r.children),
4589
4628
  ...getAttrs(r)
4590
4629
  }), [];
4591
- const l = traverseNodes(r.children, { block: a, node: r });
4592
- return [a, ...l];
4630
+ console.log(a);
4631
+ const d = traverseNodes(r.children, { block: a, node: r });
4632
+ return [a, ...d];
4593
4633
  }), getSanitizedHTML = (o) => {
4594
4634
  const n = o.match(/<body[^>]*>[\s\S]*?<\/body>/);
4595
4635
  return (n && n.length > 0 ? n[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : o).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
@@ -4649,7 +4689,7 @@ function ExpandableObject(o) {
4649
4689
  useEffect(() => {
4650
4690
  x.current ? b(u(d, r, n)) : x.current = !0;
4651
4691
  }, [u]);
4652
- const f = g ? p.collapseIcon : p.expandIcon, v = g ? "collapse JSON" : "expand JSON", _ = useComponentId(), C = d + 1, B = a.length - 1, S = (A) => {
4692
+ const f = g ? p.collapseIcon : p.expandIcon, k = g ? "collapse JSON" : "expand JSON", _ = useComponentId(), C = d + 1, B = a.length - 1, R = (A) => {
4653
4693
  A.key === " " && (A.preventDefault(), E());
4654
4694
  };
4655
4695
  return /* @__PURE__ */ createElement("div", {
@@ -4658,16 +4698,16 @@ function ExpandableObject(o) {
4658
4698
  }, /* @__PURE__ */ createElement("span", {
4659
4699
  className: f,
4660
4700
  onClick: E,
4661
- onKeyDown: S,
4701
+ onKeyDown: R,
4662
4702
  role: "button",
4663
4703
  tabIndex: 0,
4664
- "aria-label": v,
4704
+ "aria-label": k,
4665
4705
  "aria-expanded": g,
4666
4706
  "aria-controls": g ? _ : void 0
4667
4707
  }), n && (m ? /* @__PURE__ */ createElement("span", {
4668
4708
  className: p.clickableLabel,
4669
4709
  onClick: E,
4670
- onKeyDown: S,
4710
+ onKeyDown: R,
4671
4711
  role: "button",
4672
4712
  tabIndex: -1
4673
4713
  }, n, ":") : /* @__PURE__ */ createElement("span", {
@@ -4688,11 +4728,11 @@ function ExpandableObject(o) {
4688
4728
  }))) : /* @__PURE__ */ createElement("span", {
4689
4729
  className: p.collapsedContent,
4690
4730
  onClick: E,
4691
- onKeyDown: S,
4731
+ onKeyDown: R,
4692
4732
  role: "button",
4693
4733
  tabIndex: -1,
4694
4734
  "aria-hidden": !0,
4695
- "aria-label": v,
4735
+ "aria-label": k,
4696
4736
  "aria-expanded": g
4697
4737
  }), /* @__PURE__ */ createElement("span", {
4698
4738
  className: p.punctuation
@@ -4883,7 +4923,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4883
4923
  value: b,
4884
4924
  className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4885
4925
  onSelect: (f) => {
4886
- r(find(E, (v) => v === f) || null), g(!1);
4926
+ r(find(E, (k) => k === f) || null), g(!1);
4887
4927
  },
4888
4928
  children: [
4889
4929
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
@@ -4915,8 +4955,8 @@ const ViewData = ({ data: o, fullView: n }) => {
4915
4955
  const f = get(b === "PROP" ? p : u, E, "");
4916
4956
  if (isArray$1(f))
4917
4957
  return "list";
4918
- const v = typeof f;
4919
- return v === "string" ? "text" : v === "object" ? "model" : v;
4958
+ const k = typeof f;
4959
+ return k === "string" ? "text" : k === "object" ? "model" : k;
4920
4960
  }
4921
4961
  },
4922
4962
  [p, u]
@@ -5162,7 +5202,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5162
5202
  }
5163
5203
  )
5164
5204
  ] });
5165
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-B5Dq7OwG.js")), UploadImages = React__default.lazy(() => import("./UploadImages-nEQCD1rK.js")), ImagesPanel = ({
5205
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-OH1oIK1z.js")), UploadImages = React__default.lazy(() => import("./UploadImages-Yom319eJ.js")), ImagesPanel = ({
5166
5206
  isModalView: o = !1,
5167
5207
  onSelect: n = () => {
5168
5208
  }
@@ -5326,8 +5366,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5326
5366
  const f = n[b];
5327
5367
  if (includes(["slot", "styles"], f.type))
5328
5368
  return;
5329
- const v = b;
5330
- c.properties[v] = getBlockJSONFromSchemas(f, p, g), d[v] = getBlockJSONFromUISchemas(f);
5369
+ const k = b;
5370
+ c.properties[k] = getBlockJSONFromSchemas(f, p, g), d[k] = getBlockJSONFromUISchemas(f);
5331
5371
  }), useEffect(() => {
5332
5372
  i(r);
5333
5373
  }, [o, u]);
@@ -5429,29 +5469,29 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5429
5469
  }), a;
5430
5470
  };
5431
5471
  function BlockSettings() {
5432
- const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), p = useBuilderProp("dataBindingSupport", !1), u = ({ formData: f }, v, _) => {
5433
- if (v && (c == null ? void 0 : c._id) === n._id) {
5434
- const C = v.replace("root.", "");
5472
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), p = useBuilderProp("dataBindingSupport", !1), u = ({ formData: f }, k, _) => {
5473
+ if (k && (c == null ? void 0 : c._id) === n._id) {
5474
+ const C = k.replace("root.", "");
5435
5475
  a([n._id], { [C]: get(f, C) }, _);
5436
5476
  }
5437
5477
  }, m = useCallback(
5438
- debounce(({ formData: f }, v, _) => {
5439
- u({ formData: f }, v, _), d(f);
5478
+ debounce(({ formData: f }, k, _) => {
5479
+ u({ formData: f }, k, _), d(f);
5440
5480
  }, 1500),
5441
5481
  [n == null ? void 0 : n._id, o]
5442
- ), x = ({ formData: f }, v) => {
5443
- if (v) {
5444
- const _ = v.replace("root.", "");
5482
+ ), x = ({ formData: f }, k) => {
5483
+ if (k) {
5484
+ const _ = k.replace("root.", "");
5445
5485
  r(
5446
5486
  [n._id],
5447
5487
  convertDotNotationToObject(_, get(f, _.split(".")))
5448
- ), m({ formData: f }, v, { [_]: get(c, _) });
5488
+ ), m({ formData: f }, k, { [_]: get(c, _) });
5449
5489
  }
5450
5490
  }, g = keys(get(i, "_bindings", {})), E = useMemo(() => {
5451
5491
  const f = cloneDeep(get(l, "props", {}));
5452
- return each(f, (v, _) => {
5453
- get(v, "hidden", !1) && delete f[_];
5454
- }), p && each(g, (v) => delete f[v]), f;
5492
+ return each(f, (k, _) => {
5493
+ get(k, "hidden", !1) && delete f[_];
5494
+ }), p && each(g, (k) => delete f[k]), f;
5455
5495
  }, [l, g, p]), b = get(l, "server", !1);
5456
5496
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
5457
5497
  p ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
@@ -5540,9 +5580,9 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5540
5580
  if (l) {
5541
5581
  n(!0), a(null);
5542
5582
  try {
5543
- const f = x === "content" ? cloneDeep(getBlockWithChildren(g, d)) : [cloneDeep(d.find((S) => S._id === g))];
5583
+ const f = x === "content" ? cloneDeep(getBlockWithChildren(g, d)) : [cloneDeep(d.find((R) => R._id === g))];
5544
5584
  set(f, "0._parent", null);
5545
- const v = p === u ? "" : p, _ = await l(x, promptWithLanguage(E, m, x), f, v), { blocks: C, error: B } = _;
5585
+ const k = p === u ? "" : p, _ = await l(x, promptWithLanguage(E, m, x), f, k), { blocks: C, error: B } = _;
5546
5586
  if (B) {
5547
5587
  a(B);
5548
5588
  return;
@@ -5710,15 +5750,15 @@ function ManualClasses() {
5710
5750
  const D = N.trim().toLowerCase(), I = D.match(/.+:/g);
5711
5751
  let j = [];
5712
5752
  if (I && I.length > 0) {
5713
- const [k] = I, w = D.replace(k, "");
5753
+ const [v] = I, w = D.replace(v, "");
5714
5754
  j = fuse.search(w).map((T) => ({
5715
5755
  ...T,
5716
- item: { ...T.item, name: k + T.item.name }
5756
+ item: { ...T.item, name: v + T.item.name }
5717
5757
  }));
5718
5758
  } else
5719
5759
  j = fuse.search(D);
5720
5760
  return b(map(j, "item"));
5721
- }, v = () => {
5761
+ }, k = () => {
5722
5762
  b([]);
5723
5763
  }, _ = (N) => N.name, C = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5724
5764
  autoComplete: "off",
@@ -5732,7 +5772,7 @@ function ManualClasses() {
5732
5772
  },
5733
5773
  onChange: (N, { newValue: D }) => p(D),
5734
5774
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5735
- }, S = () => {
5775
+ }, R = () => {
5736
5776
  if (navigator.clipboard === void 0) {
5737
5777
  u({
5738
5778
  title: o("clipboard_not_supported"),
@@ -5755,7 +5795,7 @@ function ManualClasses() {
5755
5795
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5756
5796
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
5757
5797
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
5758
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: S, className: "cursor-pointer" }) }),
5798
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: R, className: "cursor-pointer" }) }),
5759
5799
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("copy_classes_to_clipboard") }) })
5760
5800
  ] })
5761
5801
  ] }),
@@ -5773,7 +5813,7 @@ function ManualClasses() {
5773
5813
  {
5774
5814
  suggestions: E,
5775
5815
  onSuggestionsFetchRequested: f,
5776
- onSuggestionsClearRequested: v,
5816
+ onSuggestionsClearRequested: k,
5777
5817
  getSuggestionValue: _,
5778
5818
  renderSuggestion: C,
5779
5819
  inputProps: B,
@@ -6465,37 +6505,37 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6465
6505
  },
6466
6506
  a
6467
6507
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6468
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: m } = o, [x, g] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [E, b] = useState(!1), [f, v] = useState(""), [_, C] = useState(!1), [B, S] = useState(!1);
6508
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: m } = o, [x, g] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [E, b] = useState(!1), [f, k] = useState(""), [_, C] = useState(!1), [B, R] = useState(!1);
6469
6509
  useEffect(() => {
6470
- const { value: j, unit: k } = getClassValueAndUnit(i);
6471
- if (k === "") {
6510
+ const { value: j, unit: v } = getClassValueAndUnit(i);
6511
+ if (v === "") {
6472
6512
  l(j), g(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
6473
6513
  return;
6474
6514
  }
6475
- g(k), l(k === "class" || isEmpty(j) ? "" : j);
6515
+ g(v), l(v === "class" || isEmpty(j) ? "" : j);
6476
6516
  }, [i, p, u]);
6477
6517
  const A = useThrottledCallback((j) => c(j), [c], THROTTLE_TIME), N = useThrottledCallback((j) => c(j, !1), [c], THROTTLE_TIME), D = useCallback(
6478
6518
  (j = !1) => {
6479
- const k = getUserInputValues(`${a}`, u);
6480
- if (get(k, "error", !1)) {
6519
+ const v = getUserInputValues(`${a}`, u);
6520
+ if (get(v, "error", !1)) {
6481
6521
  b(!0);
6482
6522
  return;
6483
6523
  }
6484
- const w = get(k, "unit") !== "" ? get(k, "unit") : x;
6524
+ const w = get(v, "unit") !== "" ? get(v, "unit") : x;
6485
6525
  if (w === "auto" || w === "none") {
6486
6526
  A(`${d}${w}`);
6487
6527
  return;
6488
6528
  }
6489
- if (get(k, "value") === "")
6529
+ if (get(v, "value") === "")
6490
6530
  return;
6491
- const T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6531
+ const T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6492
6532
  j ? N(T) : A(T);
6493
6533
  },
6494
6534
  [A, N, a, x, d, u]
6495
6535
  ), I = useCallback(
6496
6536
  (j) => {
6497
- const k = getUserInputValues(`${a}`, u);
6498
- if (get(k, "error", !1)) {
6537
+ const v = getUserInputValues(`${a}`, u);
6538
+ if (get(v, "error", !1)) {
6499
6539
  b(!0);
6500
6540
  return;
6501
6541
  }
@@ -6503,9 +6543,9 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6503
6543
  A(`${d}${j}`);
6504
6544
  return;
6505
6545
  }
6506
- if (get(k, "value") === "")
6546
+ if (get(v, "value") === "")
6507
6547
  return;
6508
- const w = get(k, "unit") !== "" ? get(k, "unit") : j, T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6548
+ const w = get(v, "unit") !== "" ? get(v, "unit") : j, T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6509
6549
  A(T);
6510
6550
  },
6511
6551
  [A, a, d, u]
@@ -6528,23 +6568,23 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6528
6568
  onKeyDown: (j) => {
6529
6569
  if (j.keyCode !== 38 && j.keyCode !== 40)
6530
6570
  return;
6531
- j.preventDefault(), S(!0);
6532
- const k = parseInt$1(j.target.value);
6533
- let w = isNaN$1(k) ? 0 : k;
6571
+ j.preventDefault(), R(!0);
6572
+ const v = parseInt$1(j.target.value);
6573
+ let w = isNaN$1(v) ? 0 : v;
6534
6574
  j.keyCode === 38 && (w += 1), j.keyCode === 40 && (w -= 1);
6535
- const R = `${w}`, L = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
6575
+ const S = `${w}`, L = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${x === "-" ? "" : x}]`;
6536
6576
  N(L);
6537
6577
  },
6538
6578
  onKeyUp: (j) => {
6539
- B && (j.preventDefault(), S(!1));
6579
+ B && (j.preventDefault(), R(!1));
6540
6580
  },
6541
6581
  onBlur: () => D(),
6542
6582
  onChange: (j) => {
6543
6583
  b(!1), l(j.target.value);
6544
6584
  },
6545
6585
  onClick: (j) => {
6546
- var k;
6547
- (k = j == null ? void 0 : j.target) == null || k.select(), r(!1);
6586
+ var v;
6587
+ (v = j == null ? void 0 : j.target) == null || v.select(), r(!1);
6548
6588
  },
6549
6589
  value: _ ? f : a,
6550
6590
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
@@ -6583,17 +6623,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6583
6623
  {
6584
6624
  onDragStart: () => C(!0),
6585
6625
  onDragEnd: (j) => {
6586
- if (v(() => ""), C(!1), isEmpty(j))
6626
+ if (k(() => ""), C(!1), isEmpty(j))
6587
6627
  return;
6588
- const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6589
- A(R);
6628
+ const v = `${j}`, S = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${x === "-" ? "" : x}]`;
6629
+ A(S);
6590
6630
  },
6591
6631
  onDrag: (j) => {
6592
6632
  if (isEmpty(j))
6593
6633
  return;
6594
- v(j);
6595
- const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6596
- N(R);
6634
+ k(j);
6635
+ const v = `${j}`, S = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${x === "-" ? "" : x}]`;
6636
+ N(S);
6597
6637
  },
6598
6638
  currentValue: a,
6599
6639
  unit: x,
@@ -6690,7 +6730,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6690
6730
  "2xl": "1536px"
6691
6731
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6692
6732
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6693
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), f = useMemo(() => get(x, "fullCls", ""), [x]), v = useCallback(
6733
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), f = useMemo(() => get(x, "fullCls", ""), [x]), k = useCallback(
6694
6734
  (N, D = !0) => {
6695
6735
  const I = { dark: p, mq: m, mod: u, cls: N, property: l, fullCls: "" };
6696
6736
  (p || u !== "") && (I.mq = "xs");
@@ -6704,7 +6744,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6704
6744
  useEffect(() => {
6705
6745
  i(C, x);
6706
6746
  }, [C, i, x]);
6707
- const [, , B] = useCanvasWidth(), S = useCallback(
6747
+ const [, , B] = useCanvasWidth(), R = useCallback(
6708
6748
  (N) => {
6709
6749
  B({
6710
6750
  xs: 400,
@@ -6727,15 +6767,15 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6727
6767
  currentClass: get(x, "cls", ""),
6728
6768
  classPrefix: get(CLASS_PREFIXES, l, ""),
6729
6769
  units: c || [],
6730
- onChange: v,
6770
+ onChange: k,
6731
6771
  negative: d,
6732
6772
  cssProperty: l
6733
6773
  }
6734
6774
  ) : null,
6735
- r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: v }),
6736
- r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: v }),
6737
- r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: v }),
6738
- r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: v })
6775
+ r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: k }),
6776
+ r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: k }),
6777
+ r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
6778
+ r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
6739
6779
  ] }),
6740
6780
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => _(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : C && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6741
6781
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -6757,7 +6797,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6757
6797
  "button",
6758
6798
  {
6759
6799
  type: "button",
6760
- onClick: () => S(get(x, "mq")),
6800
+ onClick: () => R(get(x, "mq")),
6761
6801
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6762
6802
  children: [
6763
6803
  "Switch to ",
@@ -7014,12 +7054,12 @@ const BlockCard = ({
7014
7054
  library: n,
7015
7055
  parentId: r = void 0
7016
7056
  }) => {
7017
- 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")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (v) => {
7018
- const _ = has(v, "styles_attrs.data-page-section");
7019
- return v._type === "Box" && _;
7057
+ 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")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (k) => {
7058
+ const _ = has(k, "styles_attrs.data-page-section");
7059
+ return k._type === "Box" && _;
7020
7060
  }, b = useCallback(
7021
- async (v) => {
7022
- if (v.stopPropagation(), has(o, "component")) {
7061
+ async (k) => {
7062
+ if (k.stopPropagation(), has(o, "component")) {
7023
7063
  c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7024
7064
  return;
7025
7065
  }
@@ -7028,18 +7068,18 @@ const BlockCard = ({
7028
7068
  isEmpty(_) || d(syncBlocksWithDefaults(_), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7029
7069
  },
7030
7070
  [o]
7031
- ), f = async (v) => {
7071
+ ), f = async (k) => {
7032
7072
  const _ = await i(n, o);
7033
7073
  let C = r;
7034
7074
  if (E(first(_)) && (C = null), !isEmpty(_)) {
7035
7075
  const B = { blocks: _, uiLibrary: !0, parent: C };
7036
- if (v.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
7037
- const S = new Image();
7038
- S.src = o.preview, S.onload = () => {
7039
- v.dataTransfer.setDragImage(S, 0, 0);
7076
+ if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
7077
+ const R = new Image();
7078
+ R.src = o.preview, R.onload = () => {
7079
+ k.dataTransfer.setDragImage(R, 0, 0);
7040
7080
  };
7041
7081
  } else
7042
- v.dataTransfer.setDragImage(new Image(), 0, 0);
7082
+ k.dataTransfer.setDragImage(new Image(), 0, 0);
7043
7083
  g(B), setTimeout(() => {
7044
7084
  p([]), u(), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7045
7085
  }, 200);
@@ -7091,7 +7131,7 @@ const BlockCard = ({
7091
7131
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7092
7132
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7093
7133
  ] });
7094
- const v = filter(g, (C, B) => B % 2 === 0), _ = filter(g, (C, B) => B % 2 === 1);
7134
+ const k = filter(g, (C, B) => B % 2 === 0), _ = filter(g, (C, B) => B % 2 === 1);
7095
7135
  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: [
7096
7136
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7097
7137
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
@@ -7127,7 +7167,7 @@ const BlockCard = ({
7127
7167
  children: [
7128
7168
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7129
7169
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7130
- v.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7170
+ k.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7131
7171
  ) }),
7132
7172
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7133
7173
  _.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
@@ -8152,32 +8192,32 @@ const AIUserPrompt = ({ blockId: o }) => {
8152
8192
  return;
8153
8193
  }
8154
8194
  if (i) {
8155
- const S = [...a, { key: i, value: d }];
8156
- r(S), l(a), c(""), p(""), g("");
8195
+ const R = [...a, { key: i, value: d }];
8196
+ r(R), l(a), c(""), p(""), g("");
8157
8197
  }
8158
- }, v = (S) => {
8159
- const A = a.filter((N, D) => D !== S);
8198
+ }, k = (R) => {
8199
+ const A = a.filter((N, D) => D !== R);
8160
8200
  r(A), l(A);
8161
- }, _ = (S) => {
8162
- m(S), c(a[S].key), p(a[S].value);
8201
+ }, _ = (R) => {
8202
+ m(R), c(a[R].key), p(a[R].value);
8163
8203
  }, C = () => {
8164
8204
  if (i.startsWith("@")) {
8165
8205
  g("Attribute keys cannot start with '@'");
8166
8206
  return;
8167
8207
  }
8168
8208
  if (u !== null && i) {
8169
- const S = [...a];
8170
- S[u] = { key: i, value: d }, r(S), l(S), m(null), c(""), p(""), g("");
8209
+ const R = [...a];
8210
+ R[u] = { key: i, value: d }, r(R), l(R), m(null), c(""), p(""), g("");
8171
8211
  }
8172
- }, B = (S) => {
8173
- S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? C() : f());
8212
+ }, B = (R) => {
8213
+ R.key === "Enter" && !R.shiftKey && (R.preventDefault(), u !== null ? C() : f());
8174
8214
  };
8175
8215
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
8176
8216
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8177
8217
  "form",
8178
8218
  {
8179
- onSubmit: (S) => {
8180
- S.preventDefault(), u !== null ? C() : f();
8219
+ onSubmit: (R) => {
8220
+ R.preventDefault(), u !== null ? C() : f();
8181
8221
  },
8182
8222
  className: "space-y-3",
8183
8223
  children: [
@@ -8193,7 +8233,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8193
8233
  id: "attrKey",
8194
8234
  ref: E,
8195
8235
  value: i,
8196
- onChange: (S) => c(S.target.value),
8236
+ onChange: (R) => c(R.target.value),
8197
8237
  placeholder: "Key",
8198
8238
  className: "h-8 text-sm"
8199
8239
  }
@@ -8211,7 +8251,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8211
8251
  rows: 2,
8212
8252
  ref: b,
8213
8253
  value: d,
8214
- onChange: (S) => p(S.target.value),
8254
+ onChange: (R) => p(R.target.value),
8215
8255
  onKeyDown: B,
8216
8256
  placeholder: "Value",
8217
8257
  className: "bg-background text-sm"
@@ -8224,17 +8264,17 @@ const AIUserPrompt = ({ blockId: o }) => {
8224
8264
  ]
8225
8265
  }
8226
8266
  ),
8227
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((S, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8267
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((R, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8228
8268
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
8229
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: S.key }),
8230
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: S.value.toString() })
8269
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: R.key }),
8270
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: R.value.toString() })
8231
8271
  ] }),
8232
8272
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
8233
8273
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => _(A), children: [
8234
8274
  /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
8235
8275
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
8236
8276
  ] }),
8237
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: [
8277
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(A), children: [
8238
8278
  /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
8239
8279
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
8240
8280
  ] })
@@ -8701,10 +8741,10 @@ const PageDataProviders = () => {
8701
8741
  n.map((f) => map(i, "providerKey").includes(f.providerKey) ? null : { value: f.providerKey, label: f.name }),
8702
8742
  (f) => !isNull(f)
8703
8743
  ), g = (f) => {
8704
- const v = find(n, { providerKey: f });
8705
- c((_) => [..._, v]), a((_) => [..._, { providerKey: v.providerKey, args: {} }]), p(""), l("UNSAVED");
8744
+ const k = find(n, { providerKey: f });
8745
+ c((_) => [..._, k]), a((_) => [..._, { providerKey: k.providerKey, args: {} }]), p(""), l("UNSAVED");
8706
8746
  }, E = (f) => {
8707
- c((v) => filter(v, (_) => _.providerKey !== f.providerKey)), a((v) => filter(v, (_) => _.providerKey !== f.providerKey)), l("UNSAVED");
8747
+ c((k) => filter(k, (_) => _.providerKey !== f.providerKey)), a((k) => filter(k, (_) => _.providerKey !== f.providerKey)), l("UNSAVED");
8708
8748
  }, b = (f) => m(f);
8709
8749
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8710
8750
  o("no_data_providers"),
@@ -8801,7 +8841,7 @@ const PageDataProviders = () => {
8801
8841
  function AiFillDatabase(o) {
8802
8842
  return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
8803
8843
  }
8804
- const TopBar = lazy(() => import("./Topbar-XucHTo33.js"));
8844
+ const TopBar = lazy(() => import("./Topbar-3h7dkWBH.js"));
8805
8845
  function useSidebarMenuItems(o) {
8806
8846
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8807
8847
  return useMemo(() => {