@chaibuilder/sdk 1.2.108 → 1.2.109

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,278 +89,278 @@ 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, v) => {
92
+ const c = (f) => o.get(f), d = (f, v) => {
93
93
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(v);
94
- const w = o.get(j);
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);
94
+ const C = o.get(f);
95
+ if (o.set(f, v), r.has(f) || r.set(f, C), C && hasPromiseAtomValue(C)) {
96
+ const w = "v" in v ? v.v instanceof Promise ? v.v : Promise.resolve(v.v) : Promise.reject(v.e);
97
+ cancelPromise(C.v, w);
98
98
  }
99
- }, p = (j, v, w) => {
100
- const S = /* @__PURE__ */ new Map();
101
- let T = !1;
102
- w.forEach((L, P) => {
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(),
99
+ }, u = (f, v, C) => {
100
+ const w = /* @__PURE__ */ new Map();
101
+ let I = !1;
102
+ C.forEach((N, D) => {
103
+ !N && D === f && (N = v), N ? (w.set(D, N), v.d.get(D) !== N && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
+ }), (I || v.d.size !== w.size) && (v.d = w);
105
+ }, p = (f, v, C) => {
106
+ const w = c(f), I = {
107
+ d: (w == null ? void 0 : w.d) || /* @__PURE__ */ new Map(),
108
108
  v
109
109
  };
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;
110
+ if (C && u(f, I, C), w && isEqualAtomValue(w, I) && w.d === I.d)
111
+ return w;
112
+ if (w && hasPromiseAtomValue(w) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(w, I)) {
113
+ if (w.d === I.d)
114
+ return w;
115
+ I.v = w.v;
116
116
  }
117
- return d(j, T), T;
118
- }, m = (j, v, w, S) => {
117
+ return d(f, I), I;
118
+ }, m = (f, v, C, w) => {
119
119
  if (isPromiseLike$2(v)) {
120
- let T;
121
- const L = new Promise((P, V) => {
120
+ let I;
121
+ const N = new Promise((D, V) => {
122
122
  let M = !1;
123
123
  v.then(
124
124
  (O) => {
125
125
  if (!M) {
126
126
  M = !0;
127
- const $ = c(j), H = u(
128
- j,
129
- L,
130
- w
127
+ const $ = c(f), H = p(
128
+ f,
129
+ N,
130
+ C
131
131
  );
132
- resolvePromise(L, O), P(O), ($ == null ? void 0 : $.d) !== H.d && N(j, H, $ == null ? void 0 : $.d);
132
+ resolvePromise(N, O), D(O), ($ == null ? void 0 : $.d) !== H.d && T(f, H, $ == null ? void 0 : $.d);
133
133
  }
134
134
  },
135
135
  (O) => {
136
136
  if (!M) {
137
137
  M = !0;
138
- const $ = c(j), H = u(
139
- j,
140
- L,
141
- w
138
+ const $ = c(f), H = p(
139
+ f,
140
+ N,
141
+ C
142
142
  );
143
- rejectPromise(L, O), V(O), ($ == null ? void 0 : $.d) !== H.d && N(j, H, $ == null ? void 0 : $.d);
143
+ rejectPromise(N, O), V(O), ($ == null ? void 0 : $.d) !== H.d && T(f, H, $ == null ? void 0 : $.d);
144
144
  }
145
145
  }
146
- ), T = (O) => {
146
+ ), I = (O) => {
147
147
  M || (M = !0, O.then(
148
- ($) => resolvePromise(L, $),
149
- ($) => rejectPromise(L, $)
150
- ), P(O));
148
+ ($) => resolvePromise(N, $),
149
+ ($) => rejectPromise(N, $)
150
+ ), D(O));
151
151
  };
152
152
  });
153
- return L.orig = v, L.status = "pending", registerCancelPromise(L, (P) => {
154
- P && T(P), S == null || S();
155
- }), u(j, L, w);
153
+ return N.orig = v, N.status = "pending", registerCancelPromise(N, (D) => {
154
+ D && I(D), w == null || w();
155
+ }), p(f, N, C);
156
156
  }
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(),
157
+ return p(f, v, C);
158
+ }, g = (f, v, C) => {
159
+ const w = c(f), I = {
160
+ d: (w == null ? void 0 : w.d) || /* @__PURE__ */ new Map(),
161
161
  e: v
162
162
  };
163
- return w && p(j, T, w), S && isEqualAtomError(S, T) && S.d === T.d ? S : (d(j, T), T);
164
- }, g = (j) => {
165
- const v = c(j);
163
+ return C && u(f, I, C), w && isEqualAtomError(w, I) && w.d === I.d ? w : (d(f, I), I);
164
+ }, x = (f) => {
165
+ const v = c(f);
166
166
  if (v && (v.d.forEach((M, O) => {
167
- O !== j && !n.has(O) && g(O);
167
+ O !== f && !n.has(O) && x(O);
168
168
  }), Array.from(v.d).every(([M, O]) => {
169
169
  const $ = c(M);
170
- return M === j || $ === O || // TODO This is a hack, we should find a better solution.
170
+ return M === f || $ === O || // TODO This is a hack, we should find a better solution.
171
171
  $ && !hasPromiseAtomValue($) && isEqualAtomValue($, O);
172
172
  })))
173
173
  return v;
174
- const w = /* @__PURE__ */ new Map();
175
- let S = !0;
176
- const T = (M) => {
177
- if (M === j) {
174
+ const C = /* @__PURE__ */ new Map();
175
+ let w = !0;
176
+ const I = (M) => {
177
+ if (M === f) {
178
178
  const $ = c(M);
179
179
  if ($)
180
- return w.set(M, $), returnAtomValue($);
180
+ return C.set(M, $), returnAtomValue($);
181
181
  if (hasInitialValue(M))
182
- return w.set(M, void 0), M.init;
182
+ return C.set(M, void 0), M.init;
183
183
  throw new Error("no atom init");
184
184
  }
185
- const O = g(M);
186
- return w.set(M, O), returnAtomValue(O);
185
+ const O = x(M);
186
+ return C.set(M, O), returnAtomValue(O);
187
187
  };
188
- let L, P;
188
+ let N, D;
189
189
  const V = {
190
190
  get signal() {
191
- return L || (L = new AbortController()), L.signal;
191
+ return N || (N = new AbortController()), N.signal;
192
192
  },
193
193
  get setSelf() {
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" && S && console.warn("setSelf function cannot be called in sync"), !S)
196
- return B(j, ...M);
197
- }), P;
194
+ return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(f) && console.warn("setSelf function cannot be used with read-only atom"), !D && isActuallyWritableAtom(f) && (D = (...M) => {
195
+ if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && w && console.warn("setSelf function cannot be called in sync"), !w)
196
+ return B(f, ...M);
197
+ }), D;
198
198
  }
199
199
  };
200
200
  try {
201
- const M = j.read(T, V);
201
+ const M = f.read(I, V);
202
202
  return m(
203
- j,
203
+ f,
204
204
  M,
205
- w,
206
- () => L == null ? void 0 : L.abort()
205
+ C,
206
+ () => N == null ? void 0 : N.abort()
207
207
  );
208
208
  } catch (M) {
209
- return x(j, M, w);
209
+ return g(f, M, C);
210
210
  } finally {
211
- S = !1;
211
+ w = !1;
212
212
  }
213
- }, E = (j) => returnAtomValue(g(j)), b = (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
- }, _ = (j) => {
220
- const v = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), S = (L) => {
221
- const P = n.get(L);
222
- P == null || P.t.forEach((V) => {
223
- V !== L && (v.set(
213
+ }, j = (f) => returnAtomValue(x(f)), E = (f) => {
214
+ let v = n.get(f);
215
+ return v || (v = R(f)), v;
216
+ }, b = (f, v) => !v.l.size && (!v.t.size || v.t.size === 1 && v.t.has(f)), k = (f) => {
217
+ const v = n.get(f);
218
+ v && b(f, v) && A(f);
219
+ }, _ = (f) => {
220
+ const v = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), w = (N) => {
221
+ const D = n.get(N);
222
+ D == null || D.t.forEach((V) => {
223
+ V !== N && (v.set(
224
224
  V,
225
- (v.get(V) || /* @__PURE__ */ new Set()).add(L)
226
- ), w.set(V, (w.get(V) || 0) + 1), S(V));
225
+ (v.get(V) || /* @__PURE__ */ new Set()).add(N)
226
+ ), C.set(V, (C.get(V) || 0) + 1), w(V));
227
227
  });
228
228
  };
229
- S(j);
230
- const T = (L) => {
231
- const P = n.get(L);
232
- P == null || P.t.forEach((V) => {
229
+ w(f);
230
+ const I = (N) => {
231
+ const D = n.get(N);
232
+ D == null || D.t.forEach((V) => {
233
233
  var M;
234
- if (V !== L) {
235
- let O = w.get(V);
236
- if (O && w.set(V, --O), !O) {
234
+ if (V !== N) {
235
+ let O = C.get(V);
236
+ if (O && C.set(V, --O), !O) {
237
237
  let $ = !!((M = v.get(V)) != null && M.size);
238
238
  if ($) {
239
- const H = c(V), F = g(V);
239
+ const H = c(V), F = x(V);
240
240
  $ = !H || !isEqualAtomValue(H, F);
241
241
  }
242
242
  $ || v.forEach((H) => H.delete(V));
243
243
  }
244
- T(V);
244
+ I(V);
245
245
  }
246
246
  });
247
247
  };
248
- T(j);
249
- }, C = (j, ...v) => {
250
- let w = !0;
251
- const S = (P) => returnAtomValue(g(P)), T = (P, ...V) => {
248
+ I(f);
249
+ }, S = (f, ...v) => {
250
+ let C = !0;
251
+ const w = (D) => returnAtomValue(x(D)), I = (D, ...V) => {
252
252
  let M;
253
- if (P === j) {
254
- if (!hasInitialValue(P))
253
+ if (D === f) {
254
+ if (!hasInitialValue(D))
255
255
  throw new Error("atom not writable");
256
- const O = c(P), $ = m(P, V[0]);
257
- (!O || !isEqualAtomValue(O, $)) && _(P);
256
+ const O = c(D), $ = m(D, V[0]);
257
+ (!O || !isEqualAtomValue(O, $)) && _(D);
258
258
  } else
259
- M = C(P, ...V);
260
- if (!w) {
261
- const O = D();
259
+ M = S(D, ...V);
260
+ if (!C) {
261
+ const O = L();
262
262
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
263
263
  ($) => $({ type: "async-write", flushed: O })
264
264
  );
265
265
  }
266
266
  return M;
267
- }, L = j.write(S, T, ...v);
268
- return w = !1, L;
269
- }, B = (j, ...v) => {
270
- const w = C(j, ...v), S = D();
267
+ }, N = f.write(w, I, ...v);
268
+ return C = !1, N;
269
+ }, B = (f, ...v) => {
270
+ const C = S(f, ...v), w = L();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
- (T) => T({ type: "write", flushed: S })
273
- ), w;
274
- }, R = (j, v) => {
275
- const w = {
272
+ (I) => I({ type: "write", flushed: w })
273
+ ), C;
274
+ }, R = (f, v) => {
275
+ const C = {
276
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((S, T) => {
280
- const L = n.get(T);
281
- L ? L.t.add(j) : T !== j && R(T, j);
282
- }), g(j), isActuallyWritableAtom(j) && j.onMount) {
283
- const S = j.onMount((...T) => B(j, ...T));
284
- S && (w.u = S);
279
+ if (n.set(f, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(f), x(f).d.forEach((w, I) => {
280
+ const N = n.get(I);
281
+ N ? N.t.add(f) : I !== f && R(I, f);
282
+ }), x(f), isActuallyWritableAtom(f) && f.onMount) {
283
+ const w = f.onMount((...I) => B(f, ...I));
284
+ w && (C.u = w);
285
285
  }
286
- return w;
287
- }, A = (j) => {
286
+ return C;
287
+ }, A = (f) => {
288
288
  var v;
289
- const w = (v = n.get(j)) == null ? void 0 : v.u;
290
- w && w(), n.delete(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(j);
291
- const S = c(j);
292
- S ? (hasPromiseAtomValue(S) && cancelPromise(S.v), S.d.forEach((T, L) => {
293
- if (L !== j) {
294
- const P = n.get(L);
295
- P && (P.t.delete(j), f(L, P) && A(L));
289
+ const C = (v = n.get(f)) == null ? void 0 : v.u;
290
+ C && C(), n.delete(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(f);
291
+ const w = c(f);
292
+ w ? (hasPromiseAtomValue(w) && cancelPromise(w.v), w.d.forEach((I, N) => {
293
+ if (N !== f) {
294
+ const D = n.get(N);
295
+ D && (D.t.delete(f), b(N, D) && A(N));
296
296
  }
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, v, w) => {
299
- const S = new Set(v.d.keys());
300
- w == null || w.forEach((T, L) => {
301
- if (S.has(L)) {
302
- S.delete(L);
297
+ })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", f);
298
+ }, T = (f, v, C) => {
299
+ const w = new Set(v.d.keys());
300
+ C == null || C.forEach((I, N) => {
301
+ if (w.has(N)) {
302
+ w.delete(N);
303
303
  return;
304
304
  }
305
- const P = n.get(L);
306
- P && (P.t.delete(j), f(L, P) && A(L));
307
- }), S.forEach((T) => {
308
- const L = n.get(T);
309
- L ? L.t.add(j) : n.has(j) && R(T, j);
305
+ const D = n.get(N);
306
+ D && (D.t.delete(f), b(N, D) && A(N));
307
+ }), w.forEach((I) => {
308
+ const N = n.get(I);
309
+ N ? N.t.add(f) : n.has(f) && R(I, f);
310
310
  });
311
- }, D = () => {
312
- let j;
313
- for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (j = /* @__PURE__ */ new Set()); r.size; ) {
311
+ }, L = () => {
312
+ let f;
313
+ for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (f = /* @__PURE__ */ new Set()); r.size; ) {
314
314
  const v = Array.from(r);
315
- r.clear(), v.forEach(([w, S]) => {
316
- const T = c(w);
317
- if (T) {
318
- T.d !== (S == null ? void 0 : S.d) && N(w, T, S == null ? void 0 : S.d);
319
- const L = n.get(w);
320
- L && !// TODO This seems pretty hacky. Hope to fix it.
315
+ r.clear(), v.forEach(([C, w]) => {
316
+ const I = c(C);
317
+ if (I) {
318
+ I.d !== (w == null ? void 0 : w.d) && T(C, I, w == null ? void 0 : w.d);
319
+ const N = n.get(C);
320
+ N && !// TODO This seems pretty hacky. Hope to fix it.
321
321
  // Maybe we could `mountDependencies` in `setAtomState`?
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));
322
+ (w && !hasPromiseAtomValue(w) && (isEqualAtomValue(w, I) || isEqualAtomError(w, I))) && (N.l.forEach((D) => D()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && f.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
  });
326
326
  }
327
327
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
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 })
328
+ return a.forEach((v) => v("state")), f;
329
+ }, P = (f, v) => {
330
+ const C = E(f), w = L(), I = C.l;
331
+ return I.add(v), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((N) => N("sub")), l.forEach(
332
+ (N) => N({ type: "sub", flushed: w })
333
333
  )), () => {
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" })));
334
+ I.delete(v), k(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((N) => N("unsub")), l.forEach((N) => N({ type: "unsub" })));
335
335
  };
336
336
  };
337
337
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
338
- get: E,
338
+ get: j,
339
339
  set: B,
340
- sub: I,
340
+ sub: P,
341
341
  // store dev methods (these are tentative and subject to change without notice)
342
- dev_subscribe_store: (j, v) => v !== 2 ? (console.warn(
342
+ dev_subscribe_store: (f, v) => v !== 2 ? (console.warn(
343
343
  "The current StoreListener revision is 2. The older ones are deprecated."
344
- ), a.add(j), () => {
345
- a.delete(j);
346
- }) : (l.add(j), () => {
347
- l.delete(j);
344
+ ), a.add(f), () => {
345
+ a.delete(f);
346
+ }) : (l.add(f), () => {
347
+ l.delete(f);
348
348
  }),
349
349
  dev_get_mounted_atoms: () => i.values(),
350
- dev_get_atom_state: (j) => o.get(j),
351
- dev_get_mounted: (j) => n.get(j),
352
- dev_restore_atoms: (j) => {
353
- for (const [w, S] of j)
354
- hasInitialValue(w) && (m(w, S), _(w));
355
- const v = D();
350
+ dev_get_atom_state: (f) => o.get(f),
351
+ dev_get_mounted: (f) => n.get(f),
352
+ dev_restore_atoms: (f) => {
353
+ for (const [C, w] of f)
354
+ hasInitialValue(C) && (m(C, w), _(C));
355
+ const v = L();
356
356
  l.forEach(
357
- (w) => w({ type: "restore", flushed: v })
357
+ (C) => C({ type: "restore", flushed: v })
358
358
  );
359
359
  }
360
360
  } : {
361
- get: E,
361
+ get: j,
362
362
  set: B,
363
- sub: I
363
+ sub: P
364
364
  };
365
365
  };
366
366
  let defaultStore;
@@ -374,86 +374,86 @@ function splitAtom(o, n) {
374
374
  return memo2$1(
375
375
  () => {
376
376
  const r = /* @__PURE__ */ new WeakMap(), a = (c, d) => {
377
- let p = r.get(c);
378
- if (p)
379
- return p;
380
- const u = d && r.get(d), m = [], x = [];
381
- return c.forEach((g, E) => {
382
- const b = n ? n(g) : E;
383
- x[E] = b;
384
- const f = u && u.atomList[u.keyList.indexOf(b)];
385
- if (f) {
386
- m[E] = f;
377
+ let u = r.get(c);
378
+ if (u)
379
+ return u;
380
+ const p = d && r.get(d), m = [], g = [];
381
+ return c.forEach((x, j) => {
382
+ const E = n ? n(x) : j;
383
+ g[j] = E;
384
+ const b = p && p.atomList[p.keyList.indexOf(E)];
385
+ if (b) {
386
+ m[j] = b;
387
387
  return;
388
388
  }
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
- const D = c[a(c).keyList.indexOf(b)];
393
- if (D)
394
- return D;
389
+ const k = (S) => {
390
+ const B = S(l), R = S(o), T = a(R, B == null ? void 0 : B.arr).keyList.indexOf(E);
391
+ if (T < 0 || T >= R.length) {
392
+ const L = c[a(c).keyList.indexOf(E)];
393
+ if (L)
394
+ return L;
395
395
  throw new Error("splitAtom: index out of bounds for read");
396
396
  }
397
- return R[N];
398
- }, _ = (C, B, R) => {
399
- const A = C(l), N = C(o), I = a(N, A == null ? void 0 : A.arr).keyList.indexOf(b);
400
- if (I < 0 || I >= N.length)
397
+ return R[T];
398
+ }, _ = (S, B, R) => {
399
+ const A = S(l), T = S(o), P = a(T, A == null ? void 0 : A.arr).keyList.indexOf(E);
400
+ if (P < 0 || P >= T.length)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const j = isFunction(R) ? R(N[I]) : R;
402
+ const f = isFunction(R) ? R(T[P]) : R;
403
403
  B(o, [
404
- ...N.slice(0, I),
405
- j,
406
- ...N.slice(I + 1)
404
+ ...T.slice(0, P),
405
+ f,
406
+ ...T.slice(P + 1)
407
407
  ]);
408
408
  };
409
- m[E] = isWritable(o) ? atom(k, _) : atom(k);
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;
409
+ m[j] = isWritable(o) ? atom(k, _) : atom(k);
410
+ }), p && p.keyList.length === g.length && p.keyList.every((x, j) => x === g[j]) ? u = p : u = { arr: c, atomList: m, keyList: g }, r.set(c, u), u;
411
411
  }, l = atom((c) => {
412
- const d = c(l), p = c(o);
413
- return a(p, d == null ? void 0 : d.arr);
412
+ const d = c(l), u = c(o);
413
+ return a(u, d == null ? void 0 : d.arr);
414
414
  });
415
415
  (define_import_meta_env_default$1 ? "production" : void 0) !== "production" && (l.debugPrivate = !0), l.init = void 0;
416
416
  const i = isWritable(o) ? atom(
417
417
  (c) => c(l).atomList,
418
- (c, d, p) => {
419
- switch (p.type) {
418
+ (c, d, u) => {
419
+ switch (u.type) {
420
420
  case "remove": {
421
- const u = c(i).indexOf(p.atom);
422
- if (u >= 0) {
421
+ const p = c(i).indexOf(u.atom);
422
+ if (p >= 0) {
423
423
  const m = c(o);
424
424
  d(o, [
425
- ...m.slice(0, u),
426
- ...m.slice(u + 1)
425
+ ...m.slice(0, p),
426
+ ...m.slice(p + 1)
427
427
  ]);
428
428
  }
429
429
  break;
430
430
  }
431
431
  case "insert": {
432
- const u = p.before ? c(i).indexOf(p.before) : c(i).length;
433
- if (u >= 0) {
432
+ const p = u.before ? c(i).indexOf(u.before) : c(i).length;
433
+ if (p >= 0) {
434
434
  const m = c(o);
435
435
  d(o, [
436
- ...m.slice(0, u),
437
- p.value,
438
- ...m.slice(u)
436
+ ...m.slice(0, p),
437
+ u.value,
438
+ ...m.slice(p)
439
439
  ]);
440
440
  }
441
441
  break;
442
442
  }
443
443
  case "move": {
444
- const u = c(i).indexOf(p.atom), m = p.before ? c(i).indexOf(p.before) : c(i).length;
445
- if (u >= 0 && m >= 0) {
446
- const x = c(o);
447
- u < m ? d(o, [
448
- ...x.slice(0, u),
449
- ...x.slice(u + 1, m),
450
- x[u],
451
- ...x.slice(m)
444
+ const p = c(i).indexOf(u.atom), m = u.before ? c(i).indexOf(u.before) : c(i).length;
445
+ if (p >= 0 && m >= 0) {
446
+ const g = c(o);
447
+ p < m ? d(o, [
448
+ ...g.slice(0, p),
449
+ ...g.slice(p + 1, m),
450
+ g[p],
451
+ ...g.slice(m)
452
452
  ]) : d(o, [
453
- ...x.slice(0, m),
454
- x[u],
455
- ...x.slice(m, u),
456
- ...x.slice(u + 1)
453
+ ...g.slice(0, m),
454
+ g[p],
455
+ ...g.slice(m, p),
456
+ ...g.slice(p + 1)
457
457
  ]);
458
458
  }
459
459
  break;
@@ -473,7 +473,7 @@ function createJSONStorage(o) {
473
473
  const a = {
474
474
  getItem: (l, i) => {
475
475
  var c, d;
476
- const p = (m) => {
476
+ const u = (m) => {
477
477
  if (m = m || "", n !== m) {
478
478
  try {
479
479
  r = JSON.parse(m);
@@ -483,8 +483,8 @@ function createJSONStorage(o) {
483
483
  n = m;
484
484
  }
485
485
  return r;
486
- }, u = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
487
- return isPromiseLike$1(u) ? u.then(p) : p(u);
486
+ }, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
487
+ return isPromiseLike$1(p) ? p.then(u) : u(p);
488
488
  },
489
489
  setItem: (l, i) => {
490
490
  var c;
@@ -499,15 +499,15 @@ function createJSONStorage(o) {
499
499
  if (!(o() instanceof window.Storage))
500
500
  return () => {
501
501
  };
502
- const d = (p) => {
503
- if (p.storageArea === o() && p.key === l) {
504
- let u;
502
+ const d = (u) => {
503
+ if (u.storageArea === o() && u.key === l) {
504
+ let p;
505
505
  try {
506
- u = JSON.parse(p.newValue || "");
506
+ p = JSON.parse(u.newValue || "");
507
507
  } catch {
508
- u = c;
508
+ p = c;
509
509
  }
510
- i(u);
510
+ i(p);
511
511
  }
512
512
  };
513
513
  return window.addEventListener("storage", d), () => {
@@ -524,13 +524,13 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
524
524
  );
525
525
  return (define_import_meta_env_default$1 ? "production" : void 0) !== "production" && (i.debugPrivate = !0), i.onMount = (d) => {
526
526
  l || d(r.getItem(o, n));
527
- let p;
528
- return r.subscribe && (p = r.subscribe(o, d, n)), p;
527
+ let u;
528
+ return r.subscribe && (u = r.subscribe(o, d, n)), u;
529
529
  }, atom(
530
530
  (d) => d(i),
531
- (d, p, u) => {
532
- const m = typeof u == "function" ? u(d(i)) : u;
533
- return m === RESET ? (p(i, n), r.removeItem(o)) : m instanceof Promise ? m.then((x) => (p(i, x), r.setItem(o, x))) : (p(i, m), r.setItem(o, m));
531
+ (d, u, p) => {
532
+ const m = typeof p == "function" ? p(d(i)) : p;
533
+ return m === RESET ? (u(i, n), r.removeItem(o)) : m instanceof Promise ? m.then((g) => (u(i, g), r.setItem(o, g))) : (u(i, m), r.setItem(o, m));
534
534
  }
535
535
  );
536
536
  }
@@ -554,26 +554,26 @@ const StoreContext = createContext(void 0), useStore = (o) => {
554
554
  });
555
555
  function useAtomValue(o, n) {
556
556
  const r = useStore(n), [[a, l, i], c] = useReducer(
557
- (u) => {
557
+ (p) => {
558
558
  const m = r.get(o);
559
- return Object.is(u[0], m) && u[1] === r && u[2] === o ? u : [m, r, o];
559
+ return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
560
560
  },
561
561
  void 0,
562
562
  () => [r.get(o), r, o]
563
563
  );
564
564
  let d = a;
565
565
  (l !== r || i !== o) && (c(), d = r.get(o));
566
- const p = n == null ? void 0 : n.delay;
566
+ const u = n == null ? void 0 : n.delay;
567
567
  return useEffect(() => {
568
- const u = r.sub(o, () => {
569
- if (typeof p == "number") {
570
- setTimeout(c, p);
568
+ const p = r.sub(o, () => {
569
+ if (typeof u == "number") {
570
+ setTimeout(c, u);
571
571
  return;
572
572
  }
573
573
  c();
574
574
  });
575
- return c(), u;
576
- }, [r, o, p]), useDebugValue(d), isPromiseLike(d) ? use(d) : d;
575
+ return c(), p;
576
+ }, [r, o, u]), useDebugValue(d), isPromiseLike(d) ? use(d) : d;
577
577
  }
578
578
  function useSetAtom(o, n) {
579
579
  const r = useStore(n);
@@ -638,10 +638,10 @@ const getSlots = (o) => {
638
638
  filter(o, { _parent: n }).length > 0 && l.push(flatten(duplicateBlocks(o, n, a._id)));
639
639
  const i = flatten(l);
640
640
  return map(i, (c) => {
641
- const d = c, p = getSlots(d);
642
- return Object.keys(p).length > 0 && Object.keys(p).forEach((u) => {
643
- const m = find(i, { oldId: p[u].replace("slot:", "") });
644
- d[u] = `slot:${m._id}`;
641
+ const d = c, u = getSlots(d);
642
+ return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
643
+ const m = find(i, { oldId: u[p].replace("slot:", "") });
644
+ d[p] = `slot:${m._id}`;
645
645
  }), omit(d, ["global", "oldId"]);
646
646
  });
647
647
  }, presentBlocksAtom = atom$1([]);
@@ -746,8 +746,8 @@ const useSelectedBlocksDisplayChild = () => ({
746
746
  }, getBlockJSONFromSchemas = (o, n, r) => {
747
747
  switch (o.type) {
748
748
  case "singular": {
749
- const u = o.schema;
750
- return u.title && (u.title = titleWithLang(n(u.title), r, get(o, "i18n"))), u.oneOf && Array.isArray(u.oneOf) && (u.oneOf = u.oneOf.map((m) => (m.title && (m.title = n(m.title)), m))), u;
749
+ const p = o.schema;
750
+ return p.title && (p.title = titleWithLang(n(p.title), r, get(o, "i18n"))), p.oneOf && Array.isArray(p.oneOf) && (p.oneOf = p.oneOf.map((m) => (m.title && (m.title = n(m.title)), m))), p;
751
751
  }
752
752
  case "model":
753
753
  const { properties: a, title: l } = o, i = {
@@ -755,15 +755,15 @@ const useSelectedBlocksDisplayChild = () => ({
755
755
  type: "object",
756
756
  properties: {}
757
757
  };
758
- return Object.keys(a).forEach((u) => {
759
- const m = a[u];
758
+ return Object.keys(a).forEach((p) => {
759
+ const m = a[p];
760
760
  if (includes(["slot", "styles"], m.type))
761
761
  return;
762
- const x = u;
763
- i.properties[x] = getBlockJSONFromSchemas(m, n, r);
762
+ const g = p;
763
+ i.properties[g] = getBlockJSONFromSchemas(m, n, r);
764
764
  }), i;
765
765
  case "list":
766
- const { itemProperties: c, title: d } = o, p = {
766
+ const { itemProperties: c, title: d } = o, u = {
767
767
  title: titleWithLang(n(d), r, get(o, "i18n")),
768
768
  type: "array",
769
769
  items: {
@@ -771,17 +771,17 @@ const useSelectedBlocksDisplayChild = () => ({
771
771
  properties: {}
772
772
  }
773
773
  };
774
- return Object.keys(c).forEach((u) => {
775
- const m = c[u];
774
+ return Object.keys(c).forEach((p) => {
775
+ const m = c[p];
776
776
  if (includes(["slot", "styles"], m.type))
777
777
  return;
778
- const x = u;
779
- p.items.properties[x] = getBlockJSONFromSchemas(m, n, r), set(
780
- p.items,
778
+ const g = p;
779
+ u.items.properties[g] = getBlockJSONFromSchemas(m, n, r), set(
780
+ u.items,
781
781
  "title",
782
782
  titleWithLang(get(m, "itemTitle", `${n(d)} item`), r, get(m, "i18n"))
783
783
  );
784
- }), p;
784
+ }), u;
785
785
  default:
786
786
  return {};
787
787
  }
@@ -833,8 +833,8 @@ var undomanager = { exports: {} };
833
833
  }
834
834
  let r = function() {
835
835
  let a = [], l = -1, i = 0, c = !1, d;
836
- function p(u, m) {
837
- return !u || typeof u[m] != "function" ? this : (c = !0, u[m](), c = !1, this);
836
+ function u(p, m) {
837
+ return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
838
838
  }
839
839
  return {
840
840
  /**
@@ -844,25 +844,25 @@ var undomanager = { exports: {} };
844
844
  * @property {function} command.redo - Redo function
845
845
  * @property {string} [command.groupId] - Optional group id
846
846
  */
847
- add: function(u) {
848
- return c ? this : (a.splice(l + 1, a.length - l), a.push(u), i && a.length > i && n(a, 0, -(i + 1)), l = a.length - 1, d && d(), this);
847
+ add: function(p) {
848
+ return c ? this : (a.splice(l + 1, a.length - l), a.push(p), i && a.length > i && n(a, 0, -(i + 1)), l = a.length - 1, d && d(), this);
849
849
  },
850
850
  /**
851
851
  * Pass a function to be called on undo and redo actions.
852
852
  * @property {function} callbackFunc - Callback function
853
853
  */
854
- setCallback: function(u) {
855
- d = u;
854
+ setCallback: function(p) {
855
+ d = p;
856
856
  },
857
857
  /**
858
858
  * Performs undo: call the undo function at the current index and decrease the index by 1.
859
859
  */
860
860
  undo: function() {
861
- let u = a[l];
862
- if (!u)
861
+ let p = a[l];
862
+ if (!p)
863
863
  return this;
864
- const m = u.groupId;
865
- for (; u.groupId === m && (p(u, "undo"), l -= 1, u = a[l], !(!u || !u.groupId)); )
864
+ const m = p.groupId;
865
+ for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
866
866
  ;
867
867
  return d && d(), this;
868
868
  },
@@ -870,11 +870,11 @@ var undomanager = { exports: {} };
870
870
  * Performs redo: call the redo function at the next index and increase the index by 1.
871
871
  */
872
872
  redo: function() {
873
- let u = a[l + 1];
874
- if (!u)
873
+ let p = a[l + 1];
874
+ if (!p)
875
875
  return this;
876
- const m = u.groupId;
877
- for (; u.groupId === m && (p(u, "redo"), l += 1, u = a[l + 1], !(!u || !u.groupId)); )
876
+ const m = p.groupId;
877
+ for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
878
878
  ;
879
879
  return d && d(), this;
880
880
  },
@@ -882,8 +882,8 @@ var undomanager = { exports: {} };
882
882
  * Clears the memory, losing all stored states. Resets the index.
883
883
  */
884
884
  clear: function() {
885
- let u = a.length;
886
- a = [], l = -1, d && u > 0 && d();
885
+ let p = a.length;
886
+ a = [], l = -1, d && p > 0 && d();
887
887
  },
888
888
  /**
889
889
  * Tests if any undo actions exist.
@@ -904,8 +904,8 @@ var undomanager = { exports: {} };
904
904
  * @param {string} [groupId] - Optionally filter commands by group ID
905
905
  * @returns {array}
906
906
  */
907
- getCommands: function(u) {
908
- return u ? a.filter((m) => m.groupId === u) : a;
907
+ getCommands: function(p) {
908
+ return p ? a.filter((m) => m.groupId === p) : a;
909
909
  },
910
910
  /**
911
911
  * Returns the index of the actions list.
@@ -918,8 +918,8 @@ var undomanager = { exports: {} };
918
918
  * Sets the maximum number of undo steps. Default: 0 (unlimited).
919
919
  * @property {number} max - Maximum number of undo steps
920
920
  */
921
- setLimit: function(u) {
922
- i = u;
921
+ setLimit: function(p) {
922
+ i = p;
923
923
  }
924
924
  };
925
925
  };
@@ -1063,13 +1063,13 @@ dataProvidersAtom.debugLabel = "dataProvidersAtom";
1063
1063
  const usePageDataProviders = () => useAtom$1(dataProvidersAtom), builderSaveStateAtom = atom$1("SAVED");
1064
1064
  builderSaveStateAtom.debugLabel = "builderSaveStateAtom";
1065
1065
  const useSavePage = () => {
1066
- const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (p) => {
1066
+ const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (u) => {
1067
1067
  }), a = useBuilderProp("onSaveStateChange", noop), l = useGetPageData(), [i] = usePageDataProviders(), [c] = useBrandingOptions();
1068
1068
  return { savePage: useThrottledCallback(
1069
1069
  async () => {
1070
1070
  n("SAVING"), a("SAVING");
1071
- const p = l();
1072
- return await r({ blocks: p.blocks, providers: i, brandingOptions: c, themeConfiguration: c }), setTimeout(() => {
1071
+ const u = l();
1072
+ return await r({ blocks: u.blocks, providers: i, brandingOptions: c, themeConfiguration: c }), setTimeout(() => {
1073
1073
  n("SAVED"), a("SAVED");
1074
1074
  }, 100), !0;
1075
1075
  },
@@ -1112,13 +1112,13 @@ function insertBlocksAtPosition(o, n, r, a) {
1112
1112
  r && (l = o.filter((d) => d._parent === r));
1113
1113
  const i = a !== void 0 ? a : l.length;
1114
1114
  let c = o.length;
1115
- for (let d = 0, p = 0; d < o.length; d++)
1115
+ for (let d = 0, u = 0; d < o.length; d++)
1116
1116
  if (o[d]._parent === r) {
1117
- if (p === i) {
1117
+ if (u === i) {
1118
1118
  c = d;
1119
1119
  break;
1120
1120
  }
1121
- p++;
1121
+ u++;
1122
1122
  }
1123
1123
  return !r && a !== void 0 && a >= l.length && (c = o.length), [...o.slice(0, c), ...n, ...o.slice(c)];
1124
1124
  }
@@ -1148,7 +1148,7 @@ function moveBlocksWithChildren(o, n, r, a) {
1148
1148
  r = r || "root";
1149
1149
  const i = new TreeModel().parse({ _id: "root", children: getBlocksTree(o) });
1150
1150
  if (moveNode(i, n, r, a)) {
1151
- const c = flattenTree(i), d = c.find((p) => p._id === n);
1151
+ const c = flattenTree(i), d = c.find((u) => u._id === n);
1152
1152
  return d && (d._parent = r === "root" ? null : r), c.shift(), c;
1153
1153
  }
1154
1154
  return o;
@@ -1195,82 +1195,82 @@ const useBlocksStoreManager = () => {
1195
1195
  updateBlocksProps: c
1196
1196
  } = useBlocksStoreManager();
1197
1197
  return {
1198
- moveBlocks: (b, f, k) => {
1199
- const _ = map(b, (B) => {
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
- return { _id: B, oldParent: A, oldPosition: D };
1202
- }), C = _.find(({ _id: B }) => B === b[0]);
1203
- C && C.oldParent === f && C.oldPosition === k || (i(b, f, k), o({
1198
+ moveBlocks: (E, b, k) => {
1199
+ const _ = map(E, (B) => {
1200
+ const A = n.find((P) => P._id === B)._parent || null, L = n.filter((P) => A ? P._parent === A : !P._parent).map((P) => P._id).indexOf(B);
1201
+ return { _id: B, oldParent: A, oldPosition: L };
1202
+ }), S = _.find(({ _id: B }) => B === E[0]);
1203
+ S && S.oldParent === b && S.oldPosition === k || (i(E, b, k), o({
1204
1204
  undo: () => each(_, ({ _id: B, oldParent: R, oldPosition: A }) => {
1205
1205
  i([B], R, A);
1206
1206
  }),
1207
- redo: () => i(b, f, k)
1207
+ redo: () => i(E, b, k)
1208
1208
  }));
1209
1209
  },
1210
- addBlocks: (b, f, k) => {
1211
- a(b, f, k), o({
1212
- undo: () => l(map(b, "_id")),
1213
- redo: () => a(b, f, k)
1210
+ addBlocks: (E, b, k) => {
1211
+ a(E, b, k), o({
1212
+ undo: () => l(map(E, "_id")),
1213
+ redo: () => a(E, b, k)
1214
1214
  });
1215
1215
  },
1216
- removeBlocks: (b) => {
1217
- var C;
1218
- const f = (C = first(b)) == null ? void 0 : C._parent, _ = n.filter((B) => f ? B._parent === f : !B._parent).indexOf(first(b));
1219
- l(map(b, "_id")), o({
1220
- undo: () => a(b, f, _),
1221
- redo: () => l(map(b, "_id"))
1216
+ removeBlocks: (E) => {
1217
+ var S;
1218
+ const b = (S = first(E)) == null ? void 0 : S._parent, _ = n.filter((B) => b ? B._parent === b : !B._parent).indexOf(first(E));
1219
+ l(map(E, "_id")), o({
1220
+ undo: () => a(E, b, _),
1221
+ redo: () => l(map(E, "_id"))
1222
1222
  });
1223
1223
  },
1224
- updateBlocks: (b, f, k) => {
1224
+ updateBlocks: (E, b, k) => {
1225
1225
  let _ = [];
1226
1226
  if (k)
1227
- _ = map(b, (C) => ({ _id: C, ...k }));
1227
+ _ = map(E, (S) => ({ _id: S, ...k }));
1228
1228
  else {
1229
- const C = keys(f);
1230
- _ = map(b, (B) => {
1231
- const R = n.find((N) => N._id === B), A = { _id: B };
1232
- return each(C, (N) => A[N] = R[N]), A;
1229
+ const S = keys(b);
1230
+ _ = map(E, (B) => {
1231
+ const R = n.find((T) => T._id === B), A = { _id: B };
1232
+ return each(S, (T) => A[T] = R[T]), A;
1233
1233
  });
1234
1234
  }
1235
- c(map(b, (C) => ({ _id: C, ...f }))), o({
1235
+ c(map(E, (S) => ({ _id: S, ...b }))), o({
1236
1236
  undo: () => c(_),
1237
- redo: () => c(map(b, (C) => ({ _id: C, ...f })))
1237
+ redo: () => c(map(E, (S) => ({ _id: S, ...b })))
1238
1238
  });
1239
1239
  },
1240
- updateBlocksRuntime: (b, f) => {
1241
- c(map(b, (k) => ({ _id: k, ...f })));
1240
+ updateBlocksRuntime: (E, b) => {
1241
+ c(map(E, (k) => ({ _id: k, ...b })));
1242
1242
  },
1243
- setNewBlocks: (b) => {
1244
- r(b), o({
1243
+ setNewBlocks: (E) => {
1244
+ r(E), o({
1245
1245
  undo: () => r(n),
1246
- redo: () => r(b)
1246
+ redo: () => r(E)
1247
1247
  });
1248
1248
  },
1249
- updateMultipleBlocksProps: (b) => {
1250
- let f = [];
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
- }), c(b), o({
1255
- undo: () => c(f),
1256
- redo: () => c(b)
1249
+ updateMultipleBlocksProps: (E) => {
1250
+ let b = [];
1251
+ b = map(E, (k) => {
1252
+ const _ = keys(k), S = n.find((R) => R._id === k._id), B = {};
1253
+ return each(_, (R) => B[R] = S[R]), B;
1254
+ }), c(E), o({
1255
+ undo: () => c(b),
1256
+ redo: () => c(E)
1257
1257
  });
1258
1258
  }
1259
1259
  };
1260
1260
  }, useAddBlock = () => {
1261
1261
  const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
1262
1262
  (i, c, d) => {
1263
- var g;
1264
- for (let E = 0; E < i.length; E++) {
1265
- const { _id: b } = i[E];
1266
- i[E]._id = generateUUID();
1267
- const f = filter(i, { _parent: b });
1268
- for (let k = 0; k < f.length; k++)
1269
- f[k]._parent = i[E]._id;
1263
+ var x;
1264
+ for (let j = 0; j < i.length; j++) {
1265
+ const { _id: E } = i[j];
1266
+ i[j]._id = generateUUID();
1267
+ const b = filter(i, { _parent: E });
1268
+ for (let k = 0; k < b.length; k++)
1269
+ b[k]._parent = i[j]._id;
1270
1270
  }
1271
- const p = first(i);
1272
- let u, m;
1273
- return c && (u = find(o, { _id: c }), i[0]._parent = c, m = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, m = u._parent), r(i, m, d), n([(g = first(i)) == null ? void 0 : g._id]), first(i);
1271
+ const u = first(i);
1272
+ let p, m;
1273
+ return c && (p = find(o, { _id: c }), i[0]._parent = c, m = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, m = p._parent), r(i, m, d), n([(x = first(i)) == null ? void 0 : x._id]), first(i);
1274
1274
  },
1275
1275
  [o, n]
1276
1276
  );
@@ -1280,29 +1280,29 @@ const useBlocksStoreManager = () => {
1280
1280
  const k = i.blocks;
1281
1281
  return a(k, c, d);
1282
1282
  }
1283
- const p = generateUUID(), u = getBlockDefaultProps(i.props), m = [];
1284
- forIn(u, (k, _) => {
1283
+ const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
1284
+ forIn(p, (k, _) => {
1285
1285
  if (startsWith(k, SLOT_KEY)) {
1286
- const C = k.replace(SLOT_KEY, "");
1286
+ const S = k.replace(SLOT_KEY, "");
1287
1287
  m.push({
1288
- _id: C,
1288
+ _id: S,
1289
1289
  _type: "Slot",
1290
- _parent: p,
1290
+ _parent: u,
1291
1291
  _name: i.props[_].name,
1292
1292
  _styles: i.props[_].styles,
1293
1293
  _emptyStyles: i.props[_].emptyStyles
1294
1294
  });
1295
1295
  }
1296
1296
  });
1297
- const x = {
1297
+ const g = {
1298
1298
  _type: i.type,
1299
- _id: p,
1300
- ...u
1299
+ _id: u,
1300
+ ...p
1301
1301
  };
1302
- let g, E;
1303
- c && (g = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(g == null ? void 0 : g._type, x._type) && g && (x._parent = g._parent, E = g._parent);
1304
- const f = [x, ...m];
1305
- return r(f, E, d), n([x._id]), x;
1302
+ let x, j;
1303
+ c && (x = find(o, { _id: c }), g._parent = c, j = c), !canAcceptChildBlock(x == null ? void 0 : x._type, g._type) && x && (g._parent = x._parent, j = x._parent);
1304
+ const b = [g, ...m];
1305
+ return r(b, j, d), n([g._id]), g;
1306
1306
  },
1307
1307
  [a, o, n]
1308
1308
  ), addPredefinedBlock: a };
@@ -2402,23 +2402,23 @@ function getNewClasses(o = "", n = "", r = []) {
2402
2402
  o = o.trim().replace(/ +/g, "");
2403
2403
  let a = filter(
2404
2404
  map(o.split(" "), constructClassObject),
2405
- (u) => !isNull(u)
2406
- ), l = filter(map(n.split(" "), constructClassObject), (u) => !isNull(u));
2405
+ (p) => !isNull(p)
2406
+ ), l = filter(map(n.split(" "), constructClassObject), (p) => !isNull(p));
2407
2407
  l = filter(
2408
2408
  l,
2409
- (u) => !includes(IGNORED_BASES_CLASSES_PROPERTIES, u.property)
2409
+ (p) => !includes(IGNORED_BASES_CLASSES_PROPERTIES, p.property)
2410
2410
  );
2411
2411
  const i = [], c = [];
2412
- each(r, (u) => {
2413
- const m = constructClassObject(u), x = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2414
- if (x && (a = filter(
2412
+ each(r, (p) => {
2413
+ const m = constructClassObject(p), g = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2414
+ if (g && (a = filter(
2415
2415
  a,
2416
- (g) => g.fullCls !== (x == null ? void 0 : x.fullCls)
2417
- )), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (g) => g.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
2418
- const g = find(l, pick(m, ["property"]));
2419
- x && (l = filter(
2416
+ (x) => x.fullCls !== (g == null ? void 0 : g.fullCls)
2417
+ )), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (x) => x.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
2418
+ const x = find(l, pick(m, ["property"]));
2419
+ g && (l = filter(
2420
2420
  l,
2421
- (E) => E.fullCls !== (g == null ? void 0 : g.fullCls)
2421
+ (j) => j.fullCls !== (x == null ? void 0 : x.fullCls)
2422
2422
  )), c.push({
2423
2423
  ...m,
2424
2424
  fullCls: m.cls,
@@ -2427,11 +2427,11 @@ function getNewClasses(o = "", n = "", r = []) {
2427
2427
  }
2428
2428
  });
2429
2429
  const d = map(
2430
- sortBy([...a, ...i], (u) => MEDIA_QUERIES[u.mq]),
2430
+ sortBy([...a, ...i], (p) => MEDIA_QUERIES[p.mq]),
2431
2431
  "fullCls"
2432
2432
  ).join(" ");
2433
2433
  return `${map(
2434
- sortBy([...l, ...c], (u) => MEDIA_QUERIES[u.mq]),
2434
+ sortBy([...l, ...c], (p) => MEDIA_QUERIES[p.mq]),
2435
2435
  "fullCls"
2436
2436
  ).join(" ").trim()},${d.trim()}`.trim().replace(/ +/g, "");
2437
2437
  }
@@ -2449,10 +2449,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2449
2449
  )
2450
2450
  ), i = first(o(selectedStylingBlocksAtom));
2451
2451
  return map(l, (c) => {
2452
- const d = o(c), p = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: u, classes: m } = getSplitClasses$1(p);
2452
+ const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
2453
2453
  return {
2454
2454
  ids: [d._id],
2455
- props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, u, a)}` }
2455
+ props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
2456
2456
  };
2457
2457
  });
2458
2458
  }), useAddClassesToBlocks = () => {
@@ -2501,13 +2501,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2501
2501
  (a, l = null) => {
2502
2502
  const i = [];
2503
2503
  each(a, (c) => {
2504
- const d = o.find((g) => g._id === c);
2504
+ const d = o.find((x) => x._id === c);
2505
2505
  l || (l = d._parent);
2506
2506
  const m = filter(
2507
2507
  o,
2508
- (g) => isString$1(l) ? g._parent === l : !d._parent
2509
- ).indexOf(d) + 1, x = getDuplicatedBlocks(o, c, l);
2510
- r(x, l, m), i.push(get(x, "0._id", ""));
2508
+ (x) => isString$1(l) ? x._parent === l : !d._parent
2509
+ ).indexOf(d) + 1, g = getDuplicatedBlocks(o, c, l);
2510
+ r(g, l, m), i.push(get(g, "0._id", ""));
2511
2511
  }), n(i);
2512
2512
  },
2513
2513
  [o, n]
@@ -2548,8 +2548,8 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2548
2548
  ),
2549
2549
  pasteBlocks: useCallback(
2550
2550
  (d) => {
2551
- const p = Array.isArray(d) ? d[0] : d;
2552
- isEmpty(o) ? l(n, d) : a(o, p), r([]);
2551
+ const u = Array.isArray(d) ? d[0] : d;
2552
+ isEmpty(o) ? l(n, d) : a(o, u), r([]);
2553
2553
  },
2554
2554
  [n, o, a, l, r]
2555
2555
  )
@@ -2569,20 +2569,20 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2569
2569
  )
2570
2570
  );
2571
2571
  return map(i, (c) => {
2572
- const d = o(c), p = a;
2573
- let { classes: u, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2574
- return each(p, (x) => {
2575
- const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${g}($| )`, "g");
2576
- u = u.replace(E, " ").replace(/ +/g, " ").trim();
2577
- const b = first(x.split(":"));
2578
- includes(["2xl", "xl", "lg", "md", "sm"], b) && p.push(x.split(":").pop().trim());
2579
- }), each(p, (x) => {
2580
- const g = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2581
- m = m.replace(g, " ").replace(/ +/g, " ").trim();
2572
+ const d = o(c), u = a;
2573
+ let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2574
+ return each(u, (g) => {
2575
+ const x = g.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${x}($| )`, "g");
2576
+ p = p.replace(j, " ").replace(/ +/g, " ").trim();
2577
+ const E = first(g.split(":"));
2578
+ includes(["2xl", "xl", "lg", "md", "sm"], E) && u.push(g.split(":").pop().trim());
2579
+ }), each(u, (g) => {
2580
+ const x = new RegExp(`(^| )${g.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2581
+ m = m.replace(x, " ").replace(/ +/g, " ").trim();
2582
2582
  }), {
2583
2583
  ids: [d._id],
2584
2584
  props: {
2585
- [l.prop]: `${STYLES_KEY}${m},${u}`
2585
+ [l.prop]: `${STYLES_KEY}${m},${p}`
2586
2586
  }
2587
2587
  };
2588
2588
  });
@@ -2680,10 +2680,10 @@ const useLanguages = () => {
2680
2680
  const c = r[i];
2681
2681
  if (isString$1(c)) {
2682
2682
  const d = chunk(c.split(""), 12);
2683
- let p = "";
2683
+ let u = "";
2684
2684
  o([n], { [i]: "" });
2685
- for (let u = 0; u < d.length; u++)
2686
- p += d[u].join(""), o([n], { [i]: p }), await new Promise((m) => setTimeout(m, a));
2685
+ for (let p = 0; p < d.length; p++)
2686
+ u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
2687
2687
  }
2688
2688
  }
2689
2689
  },
@@ -2748,18 +2748,18 @@ const xShowBlocksAtom = atom$1([]);
2748
2748
  xShowBlocksAtom.debugLabel = "xShowBlocksAtom";
2749
2749
  const selectedLibraryAtom = atomWithStorage("_selectedLibrary", null);
2750
2750
  selectedLibraryAtom.debugLabel = "selectedLibraryAtom";
2751
- let lastHighlighted$1 = null;
2751
+ let lastHighlighted = null;
2752
2752
  const useBlockHighlight = () => {
2753
2753
  const [o] = useAtom$1(canvasIframeAtom);
2754
2754
  return { highlightBlock: (a) => {
2755
2755
  var c;
2756
2756
  const l = o.contentDocument || ((c = o.contentWindow) == null ? void 0 : c.document);
2757
- lastHighlighted$1 && lastHighlighted$1.removeAttribute("data-highlighted");
2757
+ lastHighlighted && lastHighlighted.removeAttribute("data-highlighted");
2758
2758
  const i = l.querySelector(`[data-block-id="${a}"]`);
2759
- i ? (i.setAttribute("data-highlighted", "true"), lastHighlighted$1 = i) : lastHighlighted$1 = null;
2759
+ i ? (i.setAttribute("data-highlighted", "true"), lastHighlighted = i) : lastHighlighted = null;
2760
2760
  }, clearHighlight: () => {
2761
- lastHighlighted$1 && (lastHighlighted$1.removeAttribute("data-highlighted"), lastHighlighted$1 = null);
2762
- } };
2761
+ lastHighlighted && (lastHighlighted.removeAttribute("data-highlighted"), lastHighlighted = null);
2762
+ }, lastHighlighted };
2763
2763
  }, globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}), useGlobalBlocksStore = () => {
2764
2764
  const [o, n] = useAtom(globalBlocksStoreAtom), r = useCallback(
2765
2765
  (l) => get(o, l == null ? void 0 : l.globalBlock, []),
@@ -2769,18 +2769,18 @@ const useBlockHighlight = () => {
2769
2769
  }, [n]);
2770
2770
  return { getGlobalBlocks: r, reset: a };
2771
2771
  }, useWatchGlobalBlocks = () => {
2772
- const [o] = useBlocksStore(), [n, r] = useAtom(globalBlocksStoreAtom), [a, l] = useAtom(globalBlocksLoadingStateAtom), i = useBuilderProp("getGlobalBlockBlocks", async (d) => []), c = useMemo(() => o.filter((p) => p._type === "GlobalBlock").filter((p) => p._type === "GlobalBlock").map((p) => p.globalBlock), [o]);
2772
+ const [o] = useBlocksStore(), [n, r] = useAtom(globalBlocksStoreAtom), [a, l] = useAtom(globalBlocksLoadingStateAtom), i = useBuilderProp("getGlobalBlockBlocks", async (d) => []), c = useMemo(() => o.filter((u) => u._type === "GlobalBlock").filter((u) => u._type === "GlobalBlock").map((u) => u.globalBlock), [o]);
2773
2773
  useEffect(() => {
2774
2774
  forEach(c, (d) => {
2775
- has(n, d) || get(a, `${d}.loading`, !1) || (l((p) => ({ ...p, [d]: { loading: !0, error: null } })), i(d).then((p) => {
2776
- r((u) => ({ ...u, [d]: p })), l((u) => ({
2777
- ...u,
2775
+ has(n, d) || get(a, `${d}.loading`, !1) || (l((u) => ({ ...u, [d]: { loading: !0, error: null } })), i(d).then((u) => {
2776
+ r((p) => ({ ...p, [d]: u })), l((p) => ({
2777
+ ...p,
2778
2778
  [d]: { loading: !1, error: null }
2779
2779
  }));
2780
- }).catch((p) => {
2781
- l((u) => ({
2782
- ...u,
2783
- [d]: { loading: !1, error: p.message }
2780
+ }).catch((u) => {
2781
+ l((p) => ({
2782
+ ...p,
2783
+ [d]: { loading: !1, error: u.message }
2784
2784
  }));
2785
2785
  }));
2786
2786
  });
@@ -2878,24 +2878,24 @@ const useBlockHighlight = () => {
2878
2878
  </body>
2879
2879
  </html>`, useCanvasScale = (o) => {
2880
2880
  const [n] = useCanvasWidth(), [, r] = useCanvasZoom(), a = useBuilderProp("htmlDir", "ltr"), [l, i] = useState({}), c = useCallback(() => {
2881
- const { width: d, height: p } = o;
2881
+ const { width: d, height: u } = o;
2882
2882
  if (d < n) {
2883
- const u = parseFloat((d / n).toFixed(2).toString());
2883
+ const p = parseFloat((d / n).toFixed(2).toString());
2884
2884
  let m = {};
2885
- const x = p * u, g = d * u;
2886
- p && (m = {
2885
+ const g = u * p, x = d * p;
2886
+ u && (m = {
2887
2887
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
2888
- height: 100 + (p - x) / x * 100 + "%",
2889
- width: 100 + (d - g) / g * 100 + "%"
2888
+ height: 100 + (u - g) / g * 100 + "%",
2889
+ width: 100 + (d - x) / x * 100 + "%"
2890
2890
  }), i({
2891
2891
  position: "relative",
2892
2892
  top: 0,
2893
- transform: `scale(${u})`,
2893
+ transform: `scale(${p})`,
2894
2894
  transformOrigin: a === "rtl" ? "top right" : "top left",
2895
2895
  ...m,
2896
2896
  maxWidth: "none"
2897
2897
  // TODO: Add max-width to the wrapper
2898
- }), r(u * 100);
2898
+ }), r(p * 100);
2899
2899
  } else
2900
2900
  i({}), r(100);
2901
2901
  }, [n, o, a, r]);
@@ -3016,8 +3016,8 @@ let iframeDocument = null, possiblePositions = [], dropTarget = null, dropIndex
3016
3016
  const positionPlaceholder = (o, n, r) => {
3017
3017
  if (!iframeDocument || !o)
3018
3018
  return;
3019
- const a = iframeDocument == null ? void 0 : iframeDocument.getElementById("placeholder"), l = possiblePositions.map(([p]) => p), i = l.reduce(
3020
- (p, u) => Math.abs(u - r) < Math.abs(p - r) ? u : p,
3019
+ const a = iframeDocument == null ? void 0 : iframeDocument.getElementById("placeholder"), l = possiblePositions.map(([u]) => u), i = l.reduce(
3020
+ (u, p) => Math.abs(p - r) < Math.abs(u - r) ? p : u,
3021
3021
  0
3022
3022
  ), c = l.indexOf(i);
3023
3023
  if (!possiblePositions[c])
@@ -3062,41 +3062,41 @@ function removeDataDrop() {
3062
3062
  o && o.removeAttribute("data-drop");
3063
3063
  }
3064
3064
  const useDnd = () => {
3065
- const { document: o } = useFrame(), [n, r] = useAtom$1(draggingFlagAtom), { addCoreBlock: a } = useAddBlock(), [, l] = useHighlightBlockId(), [, i] = useSelectedBlockIds(), { moveBlocks: c } = useBlocksStoreUndoableActions(), [d, p] = useAtom$1(draggedBlockAtom), [, u] = useAtom$1(dropTargetBlockIdAtom);
3065
+ const { document: o } = useFrame(), [n, r] = useAtom$1(draggingFlagAtom), { addCoreBlock: a } = useAddBlock(), [, l] = useHighlightBlockId(), [, i] = useSelectedBlockIds(), { moveBlocks: c } = useBlocksStoreUndoableActions(), [d, u] = useAtom$1(draggedBlockAtom), [, p] = useAtom$1(dropTargetBlockIdAtom);
3066
3066
  if (!useFeature("dnd"))
3067
3067
  return {};
3068
- const x = () => {
3069
- removePlaceholder(), r(!1), p(null), u(null), possiblePositions = [];
3068
+ const g = () => {
3069
+ removePlaceholder(), r(!1), u(null), p(null), possiblePositions = [];
3070
3070
  };
3071
3071
  return iframeDocument = o, {
3072
3072
  isDragging: n,
3073
- onDragOver: (g) => {
3074
- g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
3073
+ onDragOver: (x) => {
3074
+ x.preventDefault(), x.stopPropagation(), throttledDragOver(x);
3075
3075
  },
3076
- onDrop: (g) => {
3076
+ onDrop: (x) => {
3077
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
- dropIndex = calculateDropIndex(f, possiblePositions);
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
- x();
3078
+ const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((R = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : R.scrollY) : x.clientX;
3079
+ dropIndex = calculateDropIndex(b, possiblePositions);
3080
+ const k = d, _ = j.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3081
+ if ((k == null ? void 0 : k._id) === _ || !S) {
3082
+ g();
3083
3083
  return;
3084
3084
  }
3085
3085
  if (!has(k, "_id")) {
3086
- a(k, _ === "canvas" ? null : _, dropIndex), setTimeout(x, 300);
3086
+ a(k, _ === "canvas" ? null : _, dropIndex), setTimeout(g, 300);
3087
3087
  return;
3088
3088
  }
3089
- let B = E.getAttribute("data-block-id");
3090
- B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3089
+ let B = j.getAttribute("data-block-id");
3090
+ B === null && (B = x.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), g(), setTimeout(removePlaceholder, 300);
3091
3091
  },
3092
- onDragEnter: (g) => {
3093
- const E = g, b = E.target;
3094
- dropTarget = b;
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([]);
3092
+ onDragEnter: (x) => {
3093
+ const j = x, E = j.target;
3094
+ dropTarget = E;
3095
+ const b = E.getAttribute("data-block-id"), k = E.getAttribute("data-dnd-dragged") !== "yes";
3096
+ p(b), j.stopPropagation(), j.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(E), r(!0), l(""), i([]);
3097
3097
  },
3098
- onDragLeave: (g) => {
3099
- g.target.getAttribute("data-block-id") === "canvas" && (u(null), r(!1), removePlaceholder(), possiblePositions = []);
3098
+ onDragLeave: (x) => {
3099
+ x.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3100
3100
  }
3101
3101
  };
3102
3102
  };
@@ -3114,113 +3114,109 @@ function destroyQuill(o) {
3114
3114
  n && n.parentNode.removeChild(n), o = null;
3115
3115
  }
3116
3116
  const useHandleCanvasDblClick = () => {
3117
- const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], n = useUpdateBlocksProps(), [r, a] = useAtom$1(inlineEditingActiveAtom);
3118
- return (l) => {
3119
- var m;
3117
+ const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], n = useUpdateBlocksProps(), [r, a] = useAtom$1(inlineEditingActiveAtom), { clearHighlight: l } = useBlockHighlight();
3118
+ return (i) => {
3119
+ var g;
3120
3120
  if (r)
3121
3121
  return;
3122
- const i = getTargetedBlock(l.target), c = i.getAttribute("data-block-type");
3123
- if (!c || !o.includes(c))
3122
+ const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
3123
+ if (!d || !o.includes(d))
3124
3124
  return;
3125
- const d = i.cloneNode(!0);
3126
- i.style.display = "none", Array.from(d.attributes).forEach((x) => {
3127
- x.name !== "class" && d.removeAttribute(x.name);
3128
- }), c === "Text" && (d.style.display = "inline-block"), i.parentNode.insertBefore(d, i.nextSibling);
3129
- const p = new Quill(d, { placeholder: "Type here..." });
3130
- function u() {
3125
+ const u = c.cloneNode(!0);
3126
+ c.style.display = "none", Array.from(u.attributes).forEach((x) => {
3127
+ x.name !== "class" && u.removeAttribute(x.name);
3128
+ }), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
3129
+ const p = new Quill(u, { placeholder: "Type here..." });
3130
+ function m() {
3131
3131
  const x = p.getText(0, p.getLength());
3132
- n([i.getAttribute("data-block-id")], { content: x }), i.removeAttribute("style"), d.removeEventListener("blur", u, !0), destroyQuill(p), a(""), lastHighlighted && (lastHighlighted.removeAttribute("data-highlighted"), lastHighlighted = null);
3132
+ n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), a(""), l();
3133
3133
  }
3134
- d.addEventListener("blur", u, !0), d.addEventListener("keydown", (x) => {
3135
- (x.key === "Enter" || x.key === "Escape") && u();
3136
- }), p.focus(), (m = d.querySelector(".ql-clipboard")) == null || m.remove(), a(i.getAttribute("data-block-id"));
3134
+ u.addEventListener("blur", m, !0), u.addEventListener("keydown", (x) => {
3135
+ (x.key === "Enter" || x.key === "Escape") && m();
3136
+ }), p.focus(), (g = u.querySelector(".ql-clipboard")) == null || g.remove(), a(c.getAttribute("data-block-id"));
3137
3137
  };
3138
3138
  }, useHandleCanvasClick = () => {
3139
- const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom);
3140
- return (i) => {
3139
+ const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom), { clearHighlight: i } = useBlockHighlight();
3140
+ return (c) => {
3141
3141
  if (a)
3142
3142
  return;
3143
- i.stopPropagation();
3144
- const c = getTargetedBlock(i.target);
3145
- if (c != null && c.getAttribute("data-block-id") && (c == null ? void 0 : c.getAttribute("data-block-id")) === "container") {
3146
- r([]), o([]), lastHighlighted && (lastHighlighted.removeAttribute("data-highlighted"), lastHighlighted = null);
3143
+ c.stopPropagation();
3144
+ const d = getTargetedBlock(c.target);
3145
+ if (d != null && d.getAttribute("data-block-id") && (d == null ? void 0 : d.getAttribute("data-block-id")) === "container") {
3146
+ r([]), o([]), i();
3147
3147
  return;
3148
3148
  }
3149
- if (c != null && c.getAttribute("data-block-parent")) {
3150
- const d = c.getAttribute("data-style-prop"), p = c.getAttribute("data-style-id"), u = c.getAttribute("data-block-parent");
3151
- n.includes(u) || l == null || l.closeAll(), o([{ id: p, prop: d, blockId: u }]), r([u]);
3152
- } else if (c != null && c.getAttribute("data-block-id")) {
3153
- const d = c.getAttribute("data-block-id");
3154
- n.includes(d) || l == null || l.closeAll(), o([]), r(d === "canvas" ? [] : [d]);
3149
+ if (d != null && d.getAttribute("data-block-parent")) {
3150
+ const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
3151
+ n.includes(m) || l == null || l.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
3152
+ } else if (d != null && d.getAttribute("data-block-id")) {
3153
+ const u = d.getAttribute("data-block-id");
3154
+ n.includes(u) || l == null || l.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
3155
3155
  }
3156
- lastHighlighted && (lastHighlighted.removeAttribute("data-highlighted"), lastHighlighted = null);
3157
- };
3158
- };
3159
- let lastHighlighted = null;
3160
- const handleMouseMove = throttle((o) => {
3161
- lastHighlighted && lastHighlighted.removeAttribute("data-highlighted");
3162
- const n = getTargetedBlock(o.target);
3163
- n ? (n.setAttribute("data-highlighted", "true"), lastHighlighted = n) : lastHighlighted = null;
3164
- }, 16), useHandleMouseMove = () => {
3165
- const [o] = useAtom$1(inlineEditingActiveAtom);
3166
- return (n) => {
3167
- o || handleMouseMove(n);
3156
+ i();
3168
3157
  };
3169
- }, clearHighlight = () => {
3170
- lastHighlighted && (lastHighlighted.removeAttribute("data-highlighted"), lastHighlighted = null);
3171
- }, useHandleMouseLeave = () => clearHighlight, Canvas = ({ children: o }) => {
3172
- const { document: n } = useFrame(), [r] = useSelectedBlockIds(), [a, l] = useSelectedStylingBlocks();
3173
- useEffect(() => () => {
3174
- clearHighlight();
3175
- }, []), useEffect(() => {
3158
+ }, useHandleMouseMove = () => {
3159
+ const [o] = useAtom$1(inlineEditingActiveAtom), { highlightBlock: n } = useBlockHighlight();
3160
+ return throttle((r) => {
3161
+ if (o)
3162
+ return;
3163
+ const a = getTargetedBlock(r.target);
3164
+ a && n(a.getAttribute("data-block-id"));
3165
+ }, 16);
3166
+ }, useHandleMouseLeave = () => {
3167
+ const { clearHighlight: o } = useBlockHighlight();
3168
+ return o;
3169
+ }, Canvas = ({ children: o }) => {
3170
+ const { document: n } = useFrame(), [r] = useSelectedBlockIds(), [a, l] = useSelectedStylingBlocks(), { clearHighlight: i } = useBlockHighlight();
3171
+ useEffect(() => i, [i]), useEffect(() => {
3176
3172
  setTimeout(() => {
3177
3173
  if (!isEmpty(a))
3178
3174
  return;
3179
- const m = getElementByDataBlockId(n, first(r));
3180
- if (m) {
3181
- const x = m.getAttribute("data-style-prop");
3175
+ const g = getElementByDataBlockId(n, first(r));
3176
+ if (g) {
3177
+ const x = g.getAttribute("data-style-prop");
3182
3178
  if (x) {
3183
- const g = m.getAttribute("data-style-id"), E = m.getAttribute("data-block-parent");
3184
- l([{ id: g, prop: x, blockId: E }]);
3179
+ const j = g.getAttribute("data-style-id"), E = g.getAttribute("data-block-parent");
3180
+ l([{ id: j, prop: x, blockId: E }]);
3185
3181
  }
3186
3182
  }
3187
3183
  }, 100);
3188
3184
  }, [n, r, l, a]);
3189
- const i = useHandleCanvasDblClick(), c = useHandleCanvasClick(), d = useHandleMouseMove(), p = useHandleMouseLeave(), u = useDnd();
3185
+ const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), u = useHandleMouseMove(), p = useHandleMouseLeave(), m = useDnd();
3190
3186
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3191
3187
  "div",
3192
3188
  {
3193
3189
  "data-block-id": "canvas",
3194
3190
  id: "canvas",
3195
- onClick: c,
3196
- onDoubleClick: i,
3197
- onMouseMove: d,
3191
+ onClick: d,
3192
+ onDoubleClick: c,
3193
+ onMouseMove: u,
3198
3194
  onMouseLeave: p,
3199
- ...omit(u, "isDragging"),
3200
- className: "relative h-full max-w-full p-px " + (u.isDragging ? "dragging" : ""),
3195
+ ...omit(m, "isDragging"),
3196
+ className: "relative h-full max-w-full p-px " + (m.isDragging ? "dragging" : ""),
3201
3197
  children: o
3202
3198
  }
3203
3199
  );
3204
3200
  }, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
3205
- const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, p] = useCopyBlockIds(), { canPaste: u, pasteBlocks: m } = usePasteBlocks();
3206
- useHotkeys("ctrl+z,command+z", () => i(), {}, [i]), useHotkeys("ctrl+y,command+y", () => c(), {}, [c]), useHotkeys("ctrl+x,command+x", () => d(n), {}, [n, d]), useHotkeys("ctrl+c,command+c", () => p(n), {}, [n, p]), useHotkeys(
3201
+ const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
3202
+ useHotkeys("ctrl+z,command+z", () => i(), {}, [i]), useHotkeys("ctrl+y,command+y", () => c(), {}, [c]), useHotkeys("ctrl+x,command+x", () => d(n), {}, [n, d]), useHotkeys("ctrl+c,command+c", () => u(n), {}, [n, u]), useHotkeys(
3207
3203
  "ctrl+v,command+v",
3208
3204
  () => {
3209
- u(n[0]) && m(n);
3205
+ p(n[0]) && m(n);
3210
3206
  },
3211
3207
  {},
3212
- [n, u, m]
3208
+ [n, p, m]
3213
3209
  );
3214
- const x = o ? { document: o } : {};
3215
- useHotkeys("esc", () => r([]), x, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...x, preventDefault: !0 }, [
3210
+ const g = o ? { document: o } : {};
3211
+ useHotkeys("esc", () => r([]), g, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...g, preventDefault: !0 }, [
3216
3212
  n,
3217
3213
  l
3218
3214
  ]), useHotkeys(
3219
3215
  "del, backspace",
3220
- (g) => {
3221
- g.preventDefault(), a(n);
3216
+ (x) => {
3217
+ x.preventDefault(), a(n);
3222
3218
  },
3223
- x,
3219
+ g,
3224
3220
  [n, a]
3225
3221
  );
3226
3222
  }, KeyboardHandler = () => {
@@ -3249,7 +3245,7 @@ const handleMouseMove = throttle((o) => {
3249
3245
  }
3250
3246
  );
3251
3247
  }, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
3252
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: p, refs: u, update: m } = useFloating({
3248
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
3253
3249
  placement: "top-start",
3254
3250
  middleware: [shift(), flip()],
3255
3251
  elements: {
@@ -3257,33 +3253,33 @@ const handleMouseMove = throttle((o) => {
3257
3253
  }
3258
3254
  });
3259
3255
  useResizeObserver(o, () => m(), o !== null);
3260
- const x = get(n, "_parent", null), g = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3256
+ const g = get(n, "_parent", null), x = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3261
3257
  return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3262
3258
  "div",
3263
3259
  {
3264
3260
  role: "button",
3265
3261
  tabIndex: 0,
3266
- ref: u.setFloating,
3267
- style: p,
3268
- onClick: (E) => {
3269
- E.stopPropagation(), E.preventDefault();
3262
+ ref: p.setFloating,
3263
+ style: u,
3264
+ onClick: (j) => {
3265
+ j.stopPropagation(), j.preventDefault();
3270
3266
  },
3271
- onMouseEnter: (E) => {
3272
- E.stopPropagation(), i(null);
3267
+ onMouseEnter: (j) => {
3268
+ j.stopPropagation(), i(null);
3273
3269
  },
3274
- onKeyDown: (E) => E.stopPropagation(),
3270
+ onKeyDown: (j) => j.stopPropagation(),
3275
3271
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
3276
3272
  children: [
3277
- x && /* @__PURE__ */ jsxRuntimeExports.jsx(
3273
+ g && /* @__PURE__ */ jsxRuntimeExports.jsx(
3278
3274
  ArrowUpIcon,
3279
3275
  {
3280
3276
  className: "hover:scale-105",
3281
3277
  onClick: () => {
3282
- c([]), l([x]);
3278
+ c([]), l([g]);
3283
3279
  }
3284
3280
  }
3285
3281
  ),
3286
- /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: g, block: n }),
3282
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: x, block: n }),
3287
3283
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
3288
3284
  canAddChildBlock(get(n, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3289
3285
  PlusIcon,
@@ -3306,29 +3302,29 @@ const handleMouseMove = throttle((o) => {
3306
3302
  }
3307
3303
  ) });
3308
3304
  }, HeadTags = () => {
3309
- const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), [a] = useSelectedStylingBlocks(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), { document: c, window: d } = useFrame(), [p] = useState(c == null ? void 0 : c.getElementById("highlighted-block")), [u] = useState(
3305
+ const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), [a] = useSelectedStylingBlocks(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), { document: c, window: d } = useFrame(), [u] = useState(c == null ? void 0 : c.getElementById("highlighted-block")), [p] = useState(
3310
3306
  c == null ? void 0 : c.getElementById("selected-block")
3311
3307
  ), [m] = useState(
3312
3308
  c == null ? void 0 : c.getElementById("selected-styling-block")
3313
- ), [x] = useState(
3309
+ ), [g] = useState(
3314
3310
  c == null ? void 0 : c.getElementById("dragged-block")
3315
3311
  );
3316
3312
  useEffect(() => {
3317
3313
  r ? c == null || c.documentElement.classList.add("dark") : c == null || c.documentElement.classList.remove("dark");
3318
3314
  }, [r, c]);
3319
- const g = get(o, "headingFont", "DM Sans"), E = get(o, "bodyFont", "DM Sans");
3315
+ const x = get(o, "headingFont", "DM Sans"), j = get(o, "bodyFont", "DM Sans");
3320
3316
  return useEffect(() => {
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
- colors: [b, f],
3317
+ const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), _ = get(o, "bodyBgDarkColor", "#000"), S = get(o, "bodyTextDarkColor", "#000"), B = get(o, "bodyTextLightColor", "#fff"), R = s({
3318
+ colors: [E, b],
3323
3319
  names: ["primary", "secondary"]
3324
3320
  });
3325
- set(R, "primary.DEFAULT", b), set(R, "secondary.DEFAULT", f);
3321
+ set(R, "primary.DEFAULT", E), set(R, "secondary.DEFAULT", b);
3326
3322
  const A = {
3327
3323
  "bg-light": k,
3328
3324
  "bg-dark": _,
3329
- "text-dark": C,
3325
+ "text-dark": S,
3330
3326
  "text-light": B
3331
- }, N = get(o, "roundedCorners", "0");
3327
+ }, T = get(o, "roundedCorners", "0");
3332
3328
  !d || !d.tailwind || (d.tailwind.config = {
3333
3329
  darkMode: "class",
3334
3330
  theme: {
@@ -3341,11 +3337,11 @@ const handleMouseMove = throttle((o) => {
3341
3337
  }
3342
3338
  },
3343
3339
  fontFamily: {
3344
- heading: [g],
3345
- body: [E]
3340
+ heading: [x],
3341
+ body: [j]
3346
3342
  },
3347
3343
  borderRadius: {
3348
- DEFAULT: `${N || "0"}px`
3344
+ DEFAULT: `${T || "0"}px`
3349
3345
  },
3350
3346
  colors: { ...A, ...R }
3351
3347
  }
@@ -3354,60 +3350,60 @@ const handleMouseMove = throttle((o) => {
3354
3350
  typography$1,
3355
3351
  forms,
3356
3352
  aspectRatio,
3357
- plugin(function({ addBase: D, theme: I }) {
3358
- D({
3353
+ plugin(function({ addBase: L, theme: P }) {
3354
+ L({
3359
3355
  "h1,h2,h3,h4,h5,h6": {
3360
- fontFamily: I("fontFamily.heading")
3356
+ fontFamily: P("fontFamily.heading")
3361
3357
  },
3362
3358
  body: {
3363
- fontFamily: I("fontFamily.body"),
3364
- color: I("colors.text-light"),
3365
- backgroundColor: I("colors.bg-light")
3359
+ fontFamily: P("fontFamily.body"),
3360
+ color: P("colors.text-light"),
3361
+ backgroundColor: P("colors.bg-light")
3366
3362
  },
3367
3363
  ".dark body": {
3368
- color: I("colors.text-dark"),
3369
- backgroundColor: I("colors.bg-dark")
3364
+ color: P("colors.text-dark"),
3365
+ backgroundColor: P("colors.bg-dark")
3370
3366
  }
3371
3367
  });
3372
3368
  })
3373
3369
  ]
3374
3370
  });
3375
- }, [o, d, g, E]), useEffect(() => {
3376
- u && (u.textContent = `${map(n, (b) => `[data-block-id="${b}"]`).join(",")}{
3371
+ }, [o, d, x, j]), useEffect(() => {
3372
+ p && (p.textContent = `${map(n, (E) => `[data-block-id="${E}"]`).join(",")}{
3377
3373
  outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
3378
3374
  }`);
3379
- }, [n, u]), useEffect(() => {
3380
- x.textContent = l ? `[data-block-id="${l._id}"], [data-block-id="${l._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3381
- }, [l, x]), useEffect(() => {
3382
- p && (p.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3383
- }, [p]), useEffect(() => {
3384
- m && (m.textContent = `${map(a, ({ id: b }) => `[data-style-id="${b}"]`).join(",")}{
3375
+ }, [n, p]), useEffect(() => {
3376
+ g.textContent = l ? `[data-block-id="${l._id}"], [data-block-id="${l._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3377
+ }, [l, g]), useEffect(() => {
3378
+ u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3379
+ }, [u]), useEffect(() => {
3380
+ m && (m.textContent = `${map(a, ({ id: E }) => `[data-style-id="${E}"]`).join(",")}{
3385
3381
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3386
3382
  }`);
3387
3383
  }, [a, m]), useEffect(() => {
3388
3384
  c.querySelector("#drop-target-block").innerHTML = i ? `[data-block-id="${i}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3389
- }, [i]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (g || E) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3385
+ }, [i]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (x || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3390
3386
  "link",
3391
3387
  {
3392
3388
  rel: "stylesheet",
3393
- 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`
3389
+ href: `https://fonts.googleapis.com/css2?family=${x ? `${x.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` : ""}${x && j && x !== j ? "&" : ""}${j && j !== x ? `family=${j.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`
3394
3390
  }
3395
3391
  ) });
3396
3392
  }, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
3397
3393
  const r = ["xs", "sm", "md", "lg", "xl", "2xl"], a = r.indexOf(n), l = o.split(" ");
3398
3394
  let i = new Array(r.length).fill(!1);
3399
3395
  for (const c of l) {
3400
- let [d, p] = c.split(":");
3401
- p || (p = d, d = "xs");
3402
- const u = r.indexOf(d);
3403
- if (u <= a) {
3404
- const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
3405
- if (m.includes(p))
3406
- for (let g = u; g < r.length; g++)
3407
- i[g] = !0;
3408
- else if (x.includes(p))
3409
- for (let g = u; g < r.length; g++)
3410
- i[g] = !1;
3396
+ let [d, u] = c.split(":");
3397
+ u || (u = d, d = "xs");
3398
+ const p = r.indexOf(d);
3399
+ if (p <= a) {
3400
+ const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], g = ["hidden"];
3401
+ if (m.includes(u))
3402
+ for (let x = p; x < r.length; x++)
3403
+ i[x] = !0;
3404
+ else if (g.includes(u))
3405
+ for (let x = p; x < r.length; x++)
3406
+ i[x] = !1;
3411
3407
  }
3412
3408
  }
3413
3409
  return i[a];
@@ -3426,24 +3422,24 @@ const handleMouseMove = throttle((o) => {
3426
3422
  );
3427
3423
  return { getRSCBlockMarkup: a, getRSCBlockState: l, reset: i };
3428
3424
  }, useWatchRSCBlocks = () => {
3429
- const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (p) => ""), d = useMemo(() => o.filter((u) => {
3430
- var x;
3431
- return (x = get(i, u._type)) == null ? void 0 : x.server;
3432
- }).map((u) => u._id), [i, o]);
3425
+ const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (u) => ""), d = useMemo(() => o.filter((p) => {
3426
+ var g;
3427
+ return (g = get(i, p._type)) == null ? void 0 : g.server;
3428
+ }).map((p) => p._id), [i, o]);
3433
3429
  useEffect(() => {
3434
- forEach(d, (p) => {
3435
- if (get(n, p, "") || get(a, `${p}.loading`, !1))
3430
+ forEach(d, (u) => {
3431
+ if (get(n, u, "") || get(a, `${u}.loading`, !1))
3436
3432
  return;
3437
- const u = o.find((m) => m._id === p);
3438
- l((m) => ({ ...m, [p]: { loading: !0, error: null } })), c(u).then((m) => {
3439
- r((x) => ({ ...x, [p]: m })), l((x) => ({
3440
- ...x,
3441
- [p]: { loading: !1, error: null }
3433
+ const p = o.find((m) => m._id === u);
3434
+ l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
3435
+ r((g) => ({ ...g, [u]: m })), l((g) => ({
3436
+ ...g,
3437
+ [u]: { loading: !1, error: null }
3442
3438
  }));
3443
3439
  }).catch((m) => {
3444
- l((x) => ({
3445
- ...x,
3446
- [p]: { loading: !1, error: m.message }
3440
+ l((g) => ({
3441
+ ...g,
3442
+ [u]: { loading: !1, error: m.message }
3447
3443
  }));
3448
3444
  });
3449
3445
  });
@@ -3508,50 +3504,50 @@ function applyLanguage(o, n, r) {
3508
3504
  }), a;
3509
3505
  }
3510
3506
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
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((k, _) => {
3513
- const C = get(p, _, {});
3514
- return { ...k, ...C };
3507
+ const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), g = useCallback((b) => getStyleAttrs(b, d), [d]), [x] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3508
+ (b) => b.reduce((k, _) => {
3509
+ const S = get(u, _, {});
3510
+ return { ...k, ...S };
3515
3511
  }, {}),
3516
- [p]
3512
+ [u]
3517
3513
  );
3518
3514
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3519
- o.map((f, k) => {
3520
- if (E === f._id || u.includes(f._id))
3515
+ o.map((b, k) => {
3516
+ if (j === b._id || p.includes(b._id))
3521
3517
  return null;
3522
- const _ = {}, C = filter(n, { _parent: f._id });
3523
- if (_.children = C.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: C }) : null, f._type === "GlobalBlock") {
3524
- const w = m(f);
3525
- _.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(w, (S) => !S._parent), allBlocks: w });
3518
+ const _ = {}, S = filter(n, { _parent: b._id });
3519
+ if (_.children = S.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: S }) : null, b._type === "GlobalBlock") {
3520
+ const C = m(b);
3521
+ _.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (w) => !w._parent), allBlocks: C });
3526
3522
  }
3527
- const B = getBlockComponent(f._type), R = get(B, "server", !1), A = R ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
3523
+ const B = getBlockComponent(b._type), R = get(B, "server", !1), A = R ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
3528
3524
  if (isNull(A))
3529
- return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
3530
- const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(f, n) : [], D = b(N), I = x(f);
3531
- if (get(I, "__isHidden", !1) && !includes(a, f._id))
3525
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
3526
+ const T = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(b, n) : [], L = E(T), P = g(b);
3527
+ if (get(P, "__isHidden", !1) && !includes(a, b._id))
3532
3528
  return null;
3533
- const j = i && isDescendant(i._id, f._id, n), v = {
3534
- ...includes(a, f._id) ? { "force-show": "" } : {},
3535
- "data-block-id": f._id,
3536
- "data-block-type": f._type,
3529
+ const f = i && isDescendant(i._id, b._id, n), v = {
3530
+ ...includes(a, b._id) ? { "force-show": "" } : {},
3531
+ "data-block-id": b._id,
3532
+ "data-block-type": b._type,
3537
3533
  ...i ? (
3538
3534
  // @ts-ignore
3539
3535
  {
3540
- "data-dnd": canAcceptChildBlock(f._type, i == null ? void 0 : i._type) ? "yes" : "no",
3541
- "data-dnd-dragged": i._id === f._id || j ? "yes" : "no"
3536
+ "data-dnd": canAcceptChildBlock(b._type, i == null ? void 0 : i._type) ? "yes" : "no",
3537
+ "data-dnd-dragged": i._id === b._id || f ? "yes" : "no"
3542
3538
  }
3543
3539
  ) : {},
3544
- ...c === f._id && !j ? { "data-drop": "yes" } : {},
3545
- ...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
3540
+ ...c === b._id && !f ? { "data-drop": "yes" } : {},
3541
+ ...includes(l, b._id) ? { "data-cut-block": "yes" } : {}
3546
3542
  };
3547
- return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: v }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
3543
+ return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: v }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
3548
3544
  blockProps: v,
3549
3545
  index: k,
3550
- ...applyBindings(applyLanguage(f, r, B), g),
3551
- ...omit(I, ["__isHidden"]),
3546
+ ...applyBindings(applyLanguage(b, r, B), x),
3547
+ ...omit(P, ["__isHidden"]),
3552
3548
  ..._,
3553
3549
  inBuilder: !0,
3554
- blockState: D
3550
+ blockState: L
3555
3551
  }) });
3556
3552
  })
3557
3553
  ) });
@@ -3563,7 +3559,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3563
3559
  if (i) {
3564
3560
  const c = (i == null ? void 0 : i.mockFn) || (i == null ? void 0 : i.dataFn);
3565
3561
  c && c(l.args).then(
3566
- (d) => n((p) => ({ ...p, [l.providerKey]: d }))
3562
+ (d) => n((u) => ({ ...u, [l.providerKey]: d }))
3567
3563
  );
3568
3564
  }
3569
3565
  }), () => {
@@ -3601,35 +3597,35 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3601
3597
  n(i);
3602
3598
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
3603
3599
  }, 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(), k = useBuilderProp("loading", !1), _ = useBuilderProp("htmlDir", "ltr"), C = (A) => {
3605
- p((N) => ({ ...N, width: A }));
3600
+ const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, g] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), _ = useBuilderProp("htmlDir", "ltr"), S = (A) => {
3601
+ u((T) => ({ ...T, width: A }));
3606
3602
  };
3607
3603
  useEffect(() => {
3608
3604
  if (!c.current)
3609
3605
  return;
3610
- const { clientWidth: A, clientHeight: N } = c.current;
3611
- p({ width: A, height: N });
3606
+ const { clientWidth: A, clientHeight: T } = c.current;
3607
+ u({ width: A, height: T });
3612
3608
  }, [c, n]);
3613
- const B = (A, N = 0) => {
3614
- const { top: D } = A.getBoundingClientRect();
3615
- return D + N >= 0 && D - N <= window.innerHeight;
3609
+ const B = (A, T = 0) => {
3610
+ const { top: L } = A.getBoundingClientRect();
3611
+ return L + T >= 0 && L - T <= window.innerHeight;
3616
3612
  };
3617
3613
  useEffect(() => {
3618
- var A, N;
3614
+ var A, T;
3619
3615
  if (a && a.type !== "Multiple" && i.current) {
3620
- const D = getElementByDataBlockId(i.current.contentDocument, a._id);
3621
- D && (B(D) || (N = (A = i.current) == null ? void 0 : A.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
3616
+ const L = getElementByDataBlockId(i.current.contentDocument, a._id);
3617
+ L && (B(L) || (T = (A = i.current) == null ? void 0 : A.contentWindow) == null || T.scrollTo({ top: L.offsetTop, behavior: "smooth" }), g([L]));
3622
3618
  }
3623
3619
  }, [a]), useEffect(() => {
3624
- if (!isEmpty(b) && i.current) {
3620
+ if (!isEmpty(E) && i.current) {
3625
3621
  const A = getElementByStyleId(
3626
3622
  i.current.contentDocument,
3627
- first(b).id
3623
+ first(E).id
3628
3624
  );
3629
- g(A ? [A] : [null]);
3625
+ x(A ? [A] : [null]);
3630
3626
  } else
3631
- g([null]);
3632
- }, [b]);
3627
+ x([null]);
3628
+ }, [E]);
3633
3629
  const R = useMemo(() => {
3634
3630
  let A = IframeInitialContent;
3635
3631
  return A = A.replace("__HTML_DIR__", _), o === "offline" && (A = A.replace(
@@ -3637,11 +3633,11 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3637
3633
  "/offline/tailwind.cdn.js"
3638
3634
  ), A = A.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), A = A.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), A;
3639
3635
  }, [o, _]);
3640
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3636
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: S, onResize: S, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3641
3637
  "div",
3642
3638
  {
3643
3639
  onClick: () => {
3644
- r([]), f([]);
3640
+ r([]), b([]);
3645
3641
  },
3646
3642
  onMouseLeave: () => setTimeout(() => l(""), 300),
3647
3643
  className: "relative mx-auto h-full w-full overflow-hidden",
@@ -3649,10 +3645,10 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3649
3645
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3650
3646
  ChaiFrame,
3651
3647
  {
3652
- contentDidMount: () => E(i.current),
3648
+ contentDidMount: () => j(i.current),
3653
3649
  ref: i,
3654
3650
  id: "canvas-iframe",
3655
- style: { ...u, ...isEmpty(u) ? { width: `${n}px` } : {} },
3651
+ style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
3656
3652
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3657
3653
  initialContent: R,
3658
3654
  children: [
@@ -3777,7 +3773,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3777
3773
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3778
3774
  ] }, l))
3779
3775
  ] }) });
3780
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-kW6SrwIa.js")), CanvasArea = () => {
3776
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-lKbkdWrD.js")), CanvasArea = () => {
3781
3777
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3782
3778
  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
3779
  /* @__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, {}) }) }),
@@ -3855,25 +3851,25 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3855
3851
  const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: R }, A) => {
3856
3852
  A && (a(R), i.current = R);
3857
3853
  }, {
3858
- bodyFont: p,
3859
- headingFont: u,
3854
+ bodyFont: u,
3855
+ headingFont: p,
3860
3856
  primaryColor: m,
3861
- bodyTextDarkColor: x,
3862
- bodyTextLightColor: g,
3863
- bodyBgDarkColor: E,
3864
- secondaryColor: b,
3865
- bodyBgLightColor: f,
3857
+ bodyTextDarkColor: g,
3858
+ bodyTextLightColor: x,
3859
+ bodyBgDarkColor: j,
3860
+ secondaryColor: E,
3861
+ bodyBgLightColor: b,
3866
3862
  roundedCorners: k
3867
3863
  } = r;
3868
3864
  let _ = {
3869
3865
  headingFont: y({
3870
3866
  title: c("theme_config.heading_font"),
3871
- default: u,
3867
+ default: p,
3872
3868
  options: FONTS
3873
3869
  }),
3874
3870
  bodyFont: y({
3875
3871
  title: c("theme_config.body_font"),
3876
- default: p,
3872
+ default: u,
3877
3873
  options: FONTS
3878
3874
  }),
3879
3875
  roundedCorners: s$1({
@@ -3881,34 +3877,34 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3881
3877
  default: parseInt(k || 5, 10)
3882
3878
  }),
3883
3879
  primaryColor: h({ title: c("theme_config.primary"), default: m }),
3884
- secondaryColor: h({ title: c("theme_config.secondary"), default: b })
3880
+ secondaryColor: h({ title: c("theme_config.secondary"), default: E })
3885
3881
  };
3886
3882
  l || (_ = {
3887
3883
  ..._,
3888
3884
  bodyBgLightColor: h({
3889
3885
  title: c("theme_config.background"),
3890
- default: f
3886
+ default: b
3891
3887
  }),
3892
3888
  bodyTextLightColor: h({
3893
3889
  title: c("theme_config.text_color"),
3894
- default: x
3890
+ default: g
3895
3891
  }),
3896
3892
  bodyBgDarkColor: h({
3897
3893
  title: c("theme_config.background_dark_mode"),
3898
- default: E
3894
+ default: j
3899
3895
  }),
3900
3896
  bodyTextDarkColor: h({
3901
3897
  title: c("theme_config.text_color_dark_mode"),
3902
- default: g
3898
+ default: x
3903
3899
  })
3904
3900
  });
3905
- const C = {
3901
+ const S = {
3906
3902
  type: "object",
3907
3903
  properties: {}
3908
3904
  }, B = {};
3909
3905
  return Object.keys(_).forEach((R) => {
3910
3906
  const A = _[R];
3911
- return C.properties || (C.properties = {}), C.properties[R] = A.schema, B[R] = A.uiSchema, !0;
3907
+ return S.properties || (S.properties = {}), S.properties[R] = A.schema, B[R] = A.uiSchema, !0;
3912
3908
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
3913
3909
  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
3910
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3921,7 +3917,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3921
3917
  liveOmit: !0,
3922
3918
  liveValidate: !0,
3923
3919
  uiSchema: B,
3924
- schema: C,
3920
+ schema: S,
3925
3921
  formData: r,
3926
3922
  validator,
3927
3923
  onChange: d
@@ -4103,35 +4099,35 @@ function BiExpandVertical(o) {
4103
4099
  }
4104
4100
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4105
4101
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
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: k, handleClick: _ } = o, C = (I) => {
4108
- I.stopPropagation(), !i.includes(x) && o.toggle();
4109
- }, B = (I) => {
4110
- I.isInternal && (p = I.isOpen, I.isOpen && I.close());
4111
- }, R = (I) => {
4112
- I.isInternal && p !== null && (p ? I.open() : I.close(), p = null);
4113
- }, A = (I) => {
4114
- I.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), _(I);
4102
+ let u = null;
4103
+ const p = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: _, handleClick: S } = o, B = (f) => {
4104
+ f.stopPropagation(), !i.includes(x) && o.toggle();
4105
+ }, R = (f) => {
4106
+ f.isInternal && (u = f.isOpen, f.isOpen && f.close());
4107
+ }, A = (f) => {
4108
+ f.isInternal && u !== null && (u ? f.open() : f.close(), u = null);
4109
+ }, T = (f) => {
4110
+ f.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), S(f);
4115
4111
  };
4116
4112
  useEffect(() => {
4117
- const I = setTimeout(() => {
4118
- b && !o.isOpen && !f && !i.includes(x) && o.toggle();
4113
+ const f = setTimeout(() => {
4114
+ b && !o.isOpen && !k && !i.includes(x) && o.toggle();
4119
4115
  }, 500);
4120
- return () => clearTimeout(I);
4121
- }, [b, o, f]);
4122
- const N = useMemo(() => {
4123
- const I = Object.keys(g), j = [];
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");
4116
+ return () => clearTimeout(f);
4117
+ }, [b, o, k]);
4118
+ const L = useMemo(() => {
4119
+ const f = Object.keys(j), v = [];
4120
+ for (let C = 0; C < f.length; C++)
4121
+ if (f[C].endsWith("_attrs")) {
4122
+ const w = j[f[C]], I = Object.keys(w).join("|");
4123
+ I.match(/x-data/) && v.push("data"), I.match(/x-on/) && v.push("event"), I.match(/x-show|x-if/) && v.push("show");
4128
4124
  }
4129
- return j;
4130
- }, [g]), D = (I, j) => {
4131
- const v = d.contentDocument || d.contentWindow.document, w = v.querySelector(`[data-block-id=${I}]`);
4132
- w && w.setAttribute("data-drop", j);
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);
4125
+ return v;
4126
+ }, [j]), P = (f, v) => {
4127
+ const C = d.contentDocument || d.contentWindow.document, w = C.querySelector(`[data-block-id=${f}]`);
4128
+ w && w.setAttribute("data-drop", v);
4129
+ const I = w.getBoundingClientRect(), N = d.getBoundingClientRect();
4130
+ I.top >= N.top && I.left >= N.left && I.bottom <= N.bottom && I.right <= N.right || (C.documentElement.scrollTop = w.offsetTop - N.top);
4135
4131
  };
4136
4132
  return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4137
4133
  "button",
@@ -4147,26 +4143,27 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4147
4143
  "div",
4148
4144
  {
4149
4145
  onMouseEnter: () => m(x),
4150
- onClick: A,
4146
+ onMouseLeave: () => g(),
4147
+ onClick: T,
4151
4148
  style: n,
4152
4149
  "data-node-id": x,
4153
4150
  ref: i.includes(x) ? null : r,
4154
- onDragStart: () => B(o),
4155
- onDragEnd: () => R(o),
4156
- onDragOver: (I) => {
4157
- I.preventDefault(), D(x, "yes");
4151
+ onDragStart: () => R(o),
4152
+ onDragEnd: () => A(o),
4153
+ onDragOver: (f) => {
4154
+ f.preventDefault(), P(x, "yes");
4158
4155
  },
4159
- onDragLeave: (I) => {
4160
- I.preventDefault(), D(x, "no");
4156
+ onDragLeave: (f) => {
4157
+ f.preventDefault(), P(x, "no");
4161
4158
  },
4162
- onDrop: (I) => {
4163
- I.preventDefault(), D(x, "no");
4159
+ onDrop: (f) => {
4160
+ f.preventDefault(), P(x, "no");
4164
4161
  },
4165
4162
  className: cn(
4166
4163
  "group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
4167
4164
  E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4168
- b && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
4169
- f && "opacity-20",
4165
+ b && canAcceptChildBlock(j._type, "Icon") ? "bg-green-200" : "",
4166
+ k && "opacity-20",
4170
4167
  i.includes(x) ? "opacity-50" : ""
4171
4168
  ),
4172
4169
  children: [
@@ -4175,41 +4172,41 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4175
4172
  "div",
4176
4173
  {
4177
4174
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
4178
- children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: C, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4175
+ children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: B, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4179
4176
  }
4180
4177
  ),
4181
4178
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
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
- k ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4179
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: j == null ? void 0 : j._type }) }),
4180
+ _ ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4184
4181
  "div",
4185
4182
  {
4186
4183
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
4187
- onDoubleClick: (I) => {
4188
- I.stopPropagation(), o.edit(), o.deselect();
4184
+ onDoubleClick: (f) => {
4185
+ f.stopPropagation(), o.edit(), o.deselect();
4189
4186
  },
4190
4187
  children: [
4191
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (g == null ? void 0 : g._name) || (g == null ? void 0 : g._type.split("/").pop()) }),
4192
- N.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4193
- N.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4194
- N.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
4188
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (j == null ? void 0 : j._name) || (j == null ? void 0 : j._type.split("/").pop()) }),
4189
+ L.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4190
+ L.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4191
+ L.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
4195
4192
  ]
4196
4193
  }
4197
4194
  )
4198
4195
  ] })
4199
4196
  ] }),
4200
4197
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: [
4201
- !i.includes(x) && a.map((I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4198
+ !i.includes(x) && a.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4202
4199
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4203
4200
  TooltipTrigger,
4204
4201
  {
4205
4202
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
4206
4203
  asChild: !0,
4207
- children: React__default.createElement(I.item, { blockId: x })
4204
+ children: React__default.createElement(f.item, { blockId: x })
4208
4205
  }
4209
4206
  ),
4210
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: I.tooltip })
4207
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: f.tooltip })
4211
4208
  ] })),
4212
- canAddChildBlock(g == null ? void 0 : g._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4209
+ canAddChildBlock(j == null ? void 0 : j._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4213
4210
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4214
4211
  TooltipTrigger,
4215
4212
  {
@@ -4225,8 +4222,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4225
4222
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4226
4223
  TooltipTrigger,
4227
4224
  {
4228
- onClick: (I) => {
4229
- I.stopPropagation(), c(x), o.isOpen && o.toggle();
4225
+ onClick: (f) => {
4226
+ f.stopPropagation(), c(x), o.isOpen && o.toggle();
4230
4227
  },
4231
4228
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",
4232
4229
  asChild: !0,
@@ -4558,7 +4555,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4558
4555
  return { _type: "TableBody" };
4559
4556
  case "tfoot":
4560
4557
  return { _type: "TableFooter" };
4561
- case "div": {
4558
+ default: {
4562
4559
  const l = get(o, "children", []).length > 0 ? "Box" : "EmptyBox";
4563
4560
  return {
4564
4561
  _type: l,
@@ -4568,7 +4565,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4568
4565
  }
4569
4566
  }
4570
4567
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
4571
- var p, u, m, x, g, E, b, f;
4568
+ var u, p, m, g, x, j, E, b;
4572
4569
  if (r.type === "comment")
4573
4570
  return [];
4574
4571
  let a = { _id: generateUUID() };
@@ -4603,12 +4600,12 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4603
4600
  ];
4604
4601
  a = {
4605
4602
  ...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",
4603
+ href: ((u = l.find((_) => _.key === "href")) == null ? void 0 : u.value) || "",
4604
+ hrefType: ((p = l.find((_) => _.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
4608
4605
  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) || ""
4606
+ maxWidth: ((x = (g = l.find((_) => _.key === "data-maxwidth")) == null ? void 0 : g.value) == null ? void 0 : x.replace("px", "")) || "",
4607
+ backdropColor: ((j = l.find((_) => _.key === "data-overlay")) == null ? void 0 : j.value) || "",
4608
+ galleryName: ((E = l.find((_) => _.key === "data-gall")) == null ? void 0 : E.value) || ""
4612
4609
  }, forEach(k, (_) => {
4613
4610
  has(a, `styles_attrs.${_}`) && delete a.styles_attrs[_];
4614
4611
  });
@@ -4620,14 +4617,13 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4620
4617
  const k = stringify([r]);
4621
4618
  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];
4622
4619
  } else if (r.tagName === "svg") {
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")
4620
+ const k = find(r.attributes, { key: "height" }), _ = find(r.attributes, { key: "width" }), S = 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");
4621
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${B} h-${S}`, R)}`.trim(), r.attributes = filter(r.attributes, (A) => !includes(["style", "width", "height", "class"], A.key)), a.icon = stringify([r]), [a];
4622
+ } else if (r.tagName == "option" && n && ((b = n.block) == null ? void 0 : b._type) === "Select")
4626
4623
  return n.block.options.push({
4627
4624
  label: getTextContent(r.children),
4628
4625
  ...getAttrs(r)
4629
4626
  }), [];
4630
- console.log(a);
4631
4627
  const d = traverseNodes(r.children, { block: a, node: r });
4632
4628
  return [a, ...d];
4633
4629
  }), getSanitizedHTML = (o) => {
@@ -4681,63 +4677,63 @@ function ExpandableObject(o) {
4681
4677
  openBracket: i,
4682
4678
  closeBracket: c,
4683
4679
  level: d,
4684
- style: p,
4685
- shouldExpandNode: u,
4680
+ style: u,
4681
+ shouldExpandNode: p,
4686
4682
  clickToExpandNode: m
4687
4683
  } = o;
4688
- const x = useRef(!1), [g, E, b] = useBool(() => u(d, r, n));
4684
+ const g = useRef(!1), [x, j, E] = useBool(() => p(d, r, n));
4689
4685
  useEffect(() => {
4690
- x.current ? b(u(d, r, n)) : x.current = !0;
4691
- }, [u]);
4692
- const f = g ? p.collapseIcon : p.expandIcon, k = g ? "collapse JSON" : "expand JSON", _ = useComponentId(), C = d + 1, B = a.length - 1, R = (A) => {
4693
- A.key === " " && (A.preventDefault(), E());
4686
+ g.current ? E(p(d, r, n)) : g.current = !0;
4687
+ }, [p]);
4688
+ const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", _ = useComponentId(), S = d + 1, B = a.length - 1, R = (A) => {
4689
+ A.key === " " && (A.preventDefault(), j());
4694
4690
  };
4695
4691
  return /* @__PURE__ */ createElement("div", {
4696
- className: p.basicChildStyle,
4692
+ className: u.basicChildStyle,
4697
4693
  role: "list"
4698
4694
  }, /* @__PURE__ */ createElement("span", {
4699
- className: f,
4700
- onClick: E,
4695
+ className: b,
4696
+ onClick: j,
4701
4697
  onKeyDown: R,
4702
4698
  role: "button",
4703
4699
  tabIndex: 0,
4704
4700
  "aria-label": k,
4705
- "aria-expanded": g,
4706
- "aria-controls": g ? _ : void 0
4701
+ "aria-expanded": x,
4702
+ "aria-controls": x ? _ : void 0
4707
4703
  }), n && (m ? /* @__PURE__ */ createElement("span", {
4708
- className: p.clickableLabel,
4709
- onClick: E,
4704
+ className: u.clickableLabel,
4705
+ onClick: j,
4710
4706
  onKeyDown: R,
4711
4707
  role: "button",
4712
4708
  tabIndex: -1
4713
4709
  }, n, ":") : /* @__PURE__ */ createElement("span", {
4714
- className: p.label
4710
+ className: u.label
4715
4711
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4716
- className: p.punctuation
4717
- }, i), g ? /* @__PURE__ */ createElement("div", {
4712
+ className: u.punctuation
4713
+ }, i), x ? /* @__PURE__ */ createElement("div", {
4718
4714
  id: _
4719
- }, a.map((A, N) => /* @__PURE__ */ createElement(DataRender, {
4720
- key: A[0] || N,
4715
+ }, a.map((A, T) => /* @__PURE__ */ createElement(DataRender, {
4716
+ key: A[0] || T,
4721
4717
  field: A[0],
4722
4718
  value: A[1],
4723
- style: p,
4724
- lastElement: N === B,
4725
- level: C,
4726
- shouldExpandNode: u,
4719
+ style: u,
4720
+ lastElement: T === B,
4721
+ level: S,
4722
+ shouldExpandNode: p,
4727
4723
  clickToExpandNode: m
4728
4724
  }))) : /* @__PURE__ */ createElement("span", {
4729
- className: p.collapsedContent,
4730
- onClick: E,
4725
+ className: u.collapsedContent,
4726
+ onClick: j,
4731
4727
  onKeyDown: R,
4732
4728
  role: "button",
4733
4729
  tabIndex: -1,
4734
4730
  "aria-hidden": !0,
4735
4731
  "aria-label": k,
4736
- "aria-expanded": g
4732
+ "aria-expanded": x
4737
4733
  }), /* @__PURE__ */ createElement("span", {
4738
- className: p.punctuation
4734
+ className: u.punctuation
4739
4735
  }, c), !l && /* @__PURE__ */ createElement("span", {
4740
- className: p.punctuation
4736
+ className: u.punctuation
4741
4737
  }, ","));
4742
4738
  }
4743
4739
  function JsonObject(o) {
@@ -4760,7 +4756,7 @@ function JsonObject(o) {
4760
4756
  style: a,
4761
4757
  shouldExpandNode: i,
4762
4758
  clickToExpandNode: c,
4763
- data: Object.keys(r).map((p) => [p, r[p]])
4759
+ data: Object.keys(r).map((u) => [u, r[u]])
4764
4760
  });
4765
4761
  }
4766
4762
  function JsonArray(o) {
@@ -4783,7 +4779,7 @@ function JsonArray(o) {
4783
4779
  style: a,
4784
4780
  shouldExpandNode: c,
4785
4781
  clickToExpandNode: d,
4786
- data: r.map((p) => [void 0, p])
4782
+ data: r.map((u) => [void 0, u])
4787
4783
  });
4788
4784
  }
4789
4785
  function JsonPrimitiveValue(o) {
@@ -4847,8 +4843,8 @@ function getPathAndTypes(o) {
4847
4843
  const n = [], r = {};
4848
4844
  function a(l, i) {
4849
4845
  forEach(i, (c, d) => {
4850
- const p = l ? `${l}.${d}` : d, u = isArray$1(c) ? "list" : typeof c;
4851
- n.push(p), r[p] = u === "string" ? "text" : u === "object" ? "model" : u, u === "object" && !isArray$1(c) && a(p, c);
4846
+ const u = l ? `${l}.${d}` : d, p = isArray$1(c) ? "list" : typeof c;
4847
+ n.push(u), r[u] = p === "string" ? "text" : p === "object" ? "model" : p, p === "object" && !isArray$1(c) && a(u, c);
4852
4848
  });
4853
4849
  }
4854
4850
  return a("", omit(o, ["styles", "_type", "_id", "_name", "_bindings"])), { paths: n, pathsType: r };
@@ -4886,15 +4882,15 @@ const ViewData = ({ data: o, fullView: n }) => {
4886
4882
  dataType: i,
4887
4883
  appliedBindings: c
4888
4884
  }) => {
4889
- const { paths: d, pathsType: p } = getPathAndTypes(a), u = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [x, g] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
4890
- (b) => !includes(c, b) && get(u, `props.${first(split(b, "."))}.binding`)
4891
- ) : d.filter((b) => i === get(p, b, "")), [o, d, c, i, u]);
4885
+ const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [g, x] = useState(!1), j = useMemo(() => o === "PROP" ? d.filter(
4886
+ (E) => !includes(c, E) && get(p, `props.${first(split(E, "."))}.binding`)
4887
+ ) : d.filter((E) => i === get(u, E, "")), [o, d, c, i, p]);
4892
4888
  return useEffect(() => {
4893
4889
  n && l(n);
4894
4890
  }, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4895
4891
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
4896
4892
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
4897
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: g, children: [
4893
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: g, onOpenChange: x, children: [
4898
4894
  /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4899
4895
  Button,
4900
4896
  {
@@ -4917,23 +4913,23 @@ const ViewData = ({ data: o, fullView: n }) => {
4917
4913
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
4918
4914
  /* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
4919
4915
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
4920
- /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4916
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(j, (E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4921
4917
  CommandItem,
4922
4918
  {
4923
- value: b,
4919
+ value: E,
4924
4920
  className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4925
- onSelect: (f) => {
4926
- r(find(E, (k) => k === f) || null), g(!1);
4921
+ onSelect: (b) => {
4922
+ r(find(j, (k) => k === b) || null), x(!1);
4927
4923
  },
4928
4924
  children: [
4929
4925
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
4930
- /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === b ? "" : "opacity-0"}` }),
4931
- b
4926
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === E ? "" : "opacity-0"}` }),
4927
+ E
4932
4928
  ] }),
4933
- m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(p, b, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, b) }) })
4929
+ m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, E, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, E) }) })
4934
4930
  ]
4935
4931
  },
4936
- b
4932
+ E
4937
4933
  )) })
4938
4934
  ] })
4939
4935
  ] }) })
@@ -4947,20 +4943,20 @@ const ViewData = ({ data: o, fullView: n }) => {
4947
4943
  editMode: r,
4948
4944
  item: a
4949
4945
  }) => {
4950
- const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), p = useSelectedBlock(), [u] = useChaiExternalData(), m = useCallback(
4951
- (E, b) => {
4952
- if (isEmpty(E))
4946
+ const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
4947
+ (j, E) => {
4948
+ if (isEmpty(j))
4953
4949
  return "";
4954
4950
  {
4955
- const f = get(b === "PROP" ? p : u, E, "");
4956
- if (isArray$1(f))
4951
+ const b = get(E === "PROP" ? u : p, j, "");
4952
+ if (isArray$1(b))
4957
4953
  return "list";
4958
- const k = typeof f;
4954
+ const k = typeof b;
4959
4955
  return k === "string" ? "text" : k === "object" ? "model" : k;
4960
4956
  }
4961
4957
  },
4962
- [p, u]
4963
- ), [x, g] = useState(r ? m(a.key, "PROP") : "");
4958
+ [u, p]
4959
+ ), [g, x] = useState(r ? m(a.key, "PROP") : "");
4964
4960
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4965
4961
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
4966
4962
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
@@ -4975,12 +4971,12 @@ const ViewData = ({ data: o, fullView: n }) => {
4975
4971
  placeholder: "Enter prop key",
4976
4972
  value: l,
4977
4973
  setValue: i,
4978
- onChange: (E) => {
4979
- const b = m(E, "PROP");
4980
- i(E), x !== b && d(""), g(b);
4974
+ onChange: (j) => {
4975
+ const E = m(j, "PROP");
4976
+ i(j), g !== E && d(""), x(E);
4981
4977
  },
4982
- data: p,
4983
- dataType: x,
4978
+ data: u,
4979
+ dataType: g,
4984
4980
  appliedBindings: o
4985
4981
  }
4986
4982
  ),
@@ -4993,12 +4989,12 @@ const ViewData = ({ data: o, fullView: n }) => {
4993
4989
  placeholder: "Enter data path",
4994
4990
  value: c,
4995
4991
  setValue: d,
4996
- onChange: (E) => {
4997
- const b = m(E, "PATH");
4998
- d(x === b ? E : "");
4992
+ onChange: (j) => {
4993
+ const E = m(j, "PATH");
4994
+ d(g === E ? j : "");
4999
4995
  },
5000
- data: u,
5001
- dataType: x,
4996
+ data: p,
4997
+ dataType: g,
5002
4998
  appliedBindings: o
5003
4999
  }
5004
5000
  )
@@ -5024,8 +5020,8 @@ const ViewData = ({ data: o, fullView: n }) => {
5024
5020
  item: i,
5025
5021
  editMode: l,
5026
5022
  appliedBindings: a,
5027
- onAddBinding: (p) => {
5028
- r(p), d(!1);
5023
+ onAddBinding: (u) => {
5024
+ r(u), d(!1);
5029
5025
  }
5030
5026
  }
5031
5027
  ) })
@@ -5038,18 +5034,18 @@ const ViewData = ({ data: o, fullView: n }) => {
5038
5034
  dataProvider: l,
5039
5035
  appliedBindings: i
5040
5036
  }) => {
5041
- const [c, d] = useState("string"), p = (u, m) => {
5042
- if (isEmpty(u))
5037
+ const [c, d] = useState("string"), u = (p, m) => {
5038
+ if (isEmpty(p))
5043
5039
  return "";
5044
5040
  {
5045
- const x = get(m === "PROP" ? a : l, u, "");
5046
- if (isArray$1(x))
5041
+ const g = get(m === "PROP" ? a : l, p, "");
5042
+ if (isArray$1(g))
5047
5043
  return "list";
5048
- const g = typeof x;
5049
- return g === "string" ? "text" : g === "object" ? "model" : g;
5044
+ const x = typeof g;
5045
+ return x === "string" ? "text" : x === "object" ? "model" : x;
5050
5046
  }
5051
5047
  };
5052
- return useEffect(() => d(() => p(o.key, "PROP")), [o.key]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col rounded-md border border-border p-2", children: [
5048
+ return useEffect(() => d(() => u(o.key, "PROP")), [o.key]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col rounded-md border border-border p-2", children: [
5053
5049
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-normal text-gray-500", children: o.key }),
5054
5050
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium leading-5", children: o.value }),
5055
5051
  /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(l, o.value, "") }),
@@ -5067,34 +5063,34 @@ const ViewData = ({ data: o, fullView: n }) => {
5067
5063
  ] });
5068
5064
  }, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
5069
5065
  const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
5070
- map(o, (x, g) => ({ key: g, value: x }))
5066
+ map(o, (g, x) => ({ key: x, value: g }))
5071
5067
  );
5072
5068
  useEffect(() => {
5073
- c(map(o, (x, g) => ({ key: g, value: x })));
5069
+ c(map(o, (g, x) => ({ key: x, value: g })));
5074
5070
  }, [r == null ? void 0 : r._id, o]);
5075
5071
  const d = useMemo(() => {
5076
5072
  if (isEmpty(a))
5077
5073
  return !0;
5078
5074
  if (isEmpty(i))
5079
5075
  return !1;
5080
- const x = last(i);
5081
- return isEmpty(x == null ? void 0 : x.key) || isEmpty(x == null ? void 0 : x.value);
5082
- }, [a, i]), p = (x) => {
5083
- const g = filter(i, (E) => E.key !== x.key);
5084
- c([...g, x]), m([...g, x]);
5085
- }, u = (x) => {
5086
- const g = filter(i, (E, b) => x !== b);
5087
- m([...g]);
5076
+ const g = last(i);
5077
+ return isEmpty(g == null ? void 0 : g.key) || isEmpty(g == null ? void 0 : g.value);
5078
+ }, [a, i]), u = (g) => {
5079
+ const x = filter(i, (j) => j.key !== g.key);
5080
+ c([...x, g]), m([...x, g]);
5081
+ }, p = (g) => {
5082
+ const x = filter(i, (j, E) => g !== E);
5083
+ m([...x]);
5088
5084
  }, m = useCallback(
5089
- (x = []) => {
5090
- if (c(x), isEmpty(x)) {
5085
+ (g = []) => {
5086
+ if (c(g), isEmpty(g)) {
5091
5087
  n({});
5092
5088
  return;
5093
5089
  }
5094
- const g = {};
5095
- forEach(x, (E) => {
5096
- !isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(g, E.key, E.value);
5097
- }), n(g);
5090
+ const x = {};
5091
+ forEach(g, (j) => {
5092
+ !isEmpty(j == null ? void 0 : j.key) && !isEmpty(j == null ? void 0 : j.value) && set(x, j.key, j.value);
5093
+ }), n(x);
5098
5094
  },
5099
5095
  [n]
5100
5096
  );
@@ -5103,17 +5099,17 @@ const ViewData = ({ data: o, fullView: n }) => {
5103
5099
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
5104
5100
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
5105
5101
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
5106
- map(i, (x, g) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5102
+ map(i, (g, x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5107
5103
  NewDataBindingPair,
5108
5104
  {
5109
- item: x,
5110
- onAddBinding: p,
5111
- onRemove: () => u(g),
5105
+ item: g,
5106
+ onAddBinding: u,
5107
+ onRemove: () => p(x),
5112
5108
  selectedBlock: r,
5113
5109
  dataProvider: a,
5114
5110
  appliedBindings: map(i, "key")
5115
5111
  },
5116
- x.key
5112
+ g.key
5117
5113
  )),
5118
5114
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 200, children: [
5119
5115
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { disabled: isEmpty(a), className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5121,7 +5117,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5121
5117
  {
5122
5118
  disabled: d,
5123
5119
  appliedBindings: map(i, "key"),
5124
- onAddBinding: p,
5120
+ onAddBinding: u,
5125
5121
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5126
5122
  "span",
5127
5123
  {
@@ -5202,7 +5198,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5202
5198
  }
5203
5199
  )
5204
5200
  ] });
5205
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-OH1oIK1z.js")), UploadImages = React__default.lazy(() => import("./UploadImages-Yom319eJ.js")), ImagesPanel = ({
5201
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-nAe1gyu9.js")), UploadImages = React__default.lazy(() => import("./UploadImages-PygaZXFU.js")), ImagesPanel = ({
5206
5202
  isModalView: o = !1,
5207
5203
  onSelect: n = () => {
5208
5204
  }
@@ -5212,7 +5208,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5212
5208
  );
5213
5209
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col", children: [
5214
5210
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: o && l ? "Unsplash images" : o ? "Select or upload images" : "Images" }) }),
5215
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: c, onValueChange: (p) => d(p), className: "flex h-full w-full flex-col py-2", children: [
5211
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: c, onValueChange: (u) => d(u), className: "flex h-full w-full flex-col py-2", children: [
5216
5212
  !(l || i) && /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "w-full", children: [
5217
5213
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "upload", className: "w-full", children: "Upload" }),
5218
5214
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "unsplash", className: "w-full", children: "Unsplash" })
@@ -5249,8 +5245,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5249
5245
  className: "text-xs",
5250
5246
  placeholder: c("enter_image_url"),
5251
5247
  value: o,
5252
- onBlur: ({ target: { value: p } }) => a(r, p),
5253
- onChange: (p) => n(p.target.value)
5248
+ onBlur: ({ target: { value: u } }) => a(r, u),
5249
+ onChange: (u) => n(u.target.value)
5254
5250
  }
5255
5251
  )
5256
5252
  ] })
@@ -5292,25 +5288,25 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5292
5288
  }
5293
5289
  );
5294
5290
  }, LinkField = ({ schema: o, formData: n, onChange: r }) => {
5295
- const [a, l] = useState([]), i = useBuilderProp("getPages", () => []), { type: c = "page", href: d = "", target: p = "self" } = n;
5291
+ const [a, l] = useState([]), i = useBuilderProp("getPages", () => []), { type: c = "page", href: d = "", target: u = "self" } = n;
5296
5292
  return useEffect(() => {
5297
5293
  (async () => {
5298
- const u = await i();
5299
- l(u || []);
5294
+ const p = await i();
5295
+ l(p || []);
5300
5296
  })();
5301
5297
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5302
5298
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
5303
5299
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
5304
- /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: c, onChange: (u) => r({ ...n, type: u.target.value }), children: [
5300
+ /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: c, onChange: (p) => r({ ...n, type: p.target.value }), children: [
5305
5301
  { const: "page", title: "Open Page" },
5306
5302
  { const: "url", title: "Open URL" },
5307
5303
  { const: "email", title: "Compose Email" },
5308
5304
  { const: "telephone", title: "Call Phone" },
5309
5305
  { const: "scroll", title: "Scroll to element" }
5310
- ].map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.const, children: u.title }, u.const)) }),
5311
- c === "page" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { name: "href", value: d, onChange: (u) => r({ ...n, href: u.target.value || "#" }), children: [
5306
+ ].map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.const, children: p.title }, p.const)) }),
5307
+ c === "page" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { name: "href", value: d, onChange: (p) => r({ ...n, href: p.target.value || "#" }), children: [
5312
5308
  /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "Choose page" }),
5313
- map(a, (u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.slug, children: u.name }, u.uuid))
5309
+ map(a, (p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.slug, children: p.name }, p.uuid))
5314
5310
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
5315
5311
  "input",
5316
5312
  {
@@ -5320,7 +5316,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5320
5316
  name: "href",
5321
5317
  type: "text",
5322
5318
  value: d,
5323
- onChange: (u) => r({ ...n, href: u.target.value || "#" }),
5319
+ onChange: (p) => r({ ...n, href: p.target.value || "#" }),
5324
5320
  placeholder: c === "page" || c === "url" ? "Enter URL" : c === "scroll" ? "#ElementID" : "Enter detail"
5325
5321
  }
5326
5322
  ),
@@ -5332,9 +5328,9 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5332
5328
  autoCorrect: "off",
5333
5329
  spellCheck: "false",
5334
5330
  type: "checkbox",
5335
- defaultChecked: p === "_blank",
5331
+ defaultChecked: u === "_blank",
5336
5332
  className: "!w-fit cursor-pointer rounded-md border border-border",
5337
- onChange: () => r({ ...n, target: p === "_blank" ? "_self" : "_blank" })
5333
+ onChange: () => r({ ...n, target: u === "_blank" ? "_self" : "_blank" })
5338
5334
  }
5339
5335
  ),
5340
5336
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pt-1 text-xs", children: "Open in new tab" })
@@ -5346,8 +5342,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5346
5342
  if (typeof window > "u")
5347
5343
  return null;
5348
5344
  const i = o.replace("root.", ""), c = get(l, i, ""), d = () => {
5349
- const p = l == null ? void 0 : l._id;
5350
- a({ blockId: p, blockProp: i, placeholder: n, initialCode: get(l, i, c) });
5345
+ const u = l == null ? void 0 : l._id;
5346
+ a({ blockId: u, blockProp: i, placeholder: n, initialCode: get(l, i, c) });
5351
5347
  };
5352
5348
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex flex-col gap-y-1", children: [
5353
5349
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5361,19 +5357,19 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5361
5357
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
5362
5358
  ] });
5363
5359
  }, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
5364
- const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: p } = useTranslation(), { selectedLang: u, fallbackLang: m, languages: x } = useLanguages(), g = x.length === 0 ? "" : u.length ? u : m;
5365
- Object.keys(n).forEach((b) => {
5366
- const f = n[b];
5367
- if (includes(["slot", "styles"], f.type))
5360
+ const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: m, languages: g } = useLanguages(), x = g.length === 0 ? "" : p.length ? p : m;
5361
+ Object.keys(n).forEach((E) => {
5362
+ const b = n[E];
5363
+ if (includes(["slot", "styles"], b.type))
5368
5364
  return;
5369
- const k = b;
5370
- c.properties[k] = getBlockJSONFromSchemas(f, p, g), d[k] = getBlockJSONFromUISchemas(f);
5365
+ const k = E;
5366
+ c.properties[k] = getBlockJSONFromSchemas(b, u, x), d[k] = getBlockJSONFromUISchemas(b);
5371
5367
  }), useEffect(() => {
5372
5368
  i(r);
5373
- }, [o, u]);
5374
- const E = useThrottledCallback(
5375
- async ({ formData: b }, f) => {
5376
- a({ formData: b }, f);
5369
+ }, [o, p]);
5370
+ const j = useThrottledCallback(
5371
+ async ({ formData: E }, b) => {
5372
+ a({ formData: E }, b);
5377
5373
  },
5378
5374
  [a],
5379
5375
  1e3
@@ -5399,8 +5395,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5399
5395
  uiSchema: d,
5400
5396
  schema: c,
5401
5397
  formData: l,
5402
- onChange: ({ formData: b }, f) => {
5403
- f && (i(b), E({ formData: b }, f));
5398
+ onChange: ({ formData: E }, b) => {
5399
+ b && (i(E), j({ formData: E }, b));
5404
5400
  }
5405
5401
  }
5406
5402
  );
@@ -5422,7 +5418,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5422
5418
  id: "show-on-canvas",
5423
5419
  checked: c,
5424
5420
  onCheckedChange: (d) => {
5425
- d ? (n((p) => [...p, r._id]), a([r._id])) : n((p) => p.filter((u) => u !== r._id));
5421
+ d ? (n((u) => [...u, r._id]), a([r._id])) : n((u) => u.filter((p) => p !== r._id));
5426
5422
  }
5427
5423
  }
5428
5424
  ),
@@ -5469,32 +5465,32 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5469
5465
  }), a;
5470
5466
  };
5471
5467
  function BlockSettings() {
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, _) => {
5468
+ 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), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: b }, k, _) => {
5473
5469
  if (k && (c == null ? void 0 : c._id) === n._id) {
5474
- const C = k.replace("root.", "");
5475
- a([n._id], { [C]: get(f, C) }, _);
5470
+ const S = k.replace("root.", "");
5471
+ a([n._id], { [S]: get(b, S) }, _);
5476
5472
  }
5477
5473
  }, m = useCallback(
5478
- debounce(({ formData: f }, k, _) => {
5479
- u({ formData: f }, k, _), d(f);
5474
+ debounce(({ formData: b }, k, _) => {
5475
+ p({ formData: b }, k, _), d(b);
5480
5476
  }, 1500),
5481
5477
  [n == null ? void 0 : n._id, o]
5482
- ), x = ({ formData: f }, k) => {
5478
+ ), g = ({ formData: b }, k) => {
5483
5479
  if (k) {
5484
5480
  const _ = k.replace("root.", "");
5485
5481
  r(
5486
5482
  [n._id],
5487
- convertDotNotationToObject(_, get(f, _.split(".")))
5488
- ), m({ formData: f }, k, { [_]: get(c, _) });
5483
+ convertDotNotationToObject(_, get(b, _.split(".")))
5484
+ ), m({ formData: b }, k, { [_]: get(c, _) });
5489
5485
  }
5490
- }, g = keys(get(i, "_bindings", {})), E = useMemo(() => {
5491
- const f = cloneDeep(get(l, "props", {}));
5492
- return each(f, (k, _) => {
5493
- get(k, "hidden", !1) && delete f[_];
5494
- }), p && each(g, (k) => delete f[k]), f;
5495
- }, [l, g, p]), b = get(l, "server", !1);
5486
+ }, x = keys(get(i, "_bindings", {})), j = useMemo(() => {
5487
+ const b = cloneDeep(get(l, "props", {}));
5488
+ return each(b, (k, _) => {
5489
+ get(k, "hidden", !1) && delete b[_];
5490
+ }), u && each(x, (k) => delete b[k]), b;
5491
+ }, [l, x, u]), E = get(l, "server", !1);
5496
5492
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
5497
- p ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5493
+ u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5498
5494
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
5499
5495
  /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
5500
5496
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5509,8 +5505,8 @@ function BlockSettings() {
5509
5505
  DataBindingSetting$1,
5510
5506
  {
5511
5507
  bindingData: get(n, "_bindings", {}),
5512
- onChange: (f) => {
5513
- u({ formData: { _bindings: f } }, "root._bindings");
5508
+ onChange: (b) => {
5509
+ p({ formData: { _bindings: b } }, "root._bindings");
5514
5510
  }
5515
5511
  }
5516
5512
  ) })
@@ -5521,35 +5517,35 @@ function BlockSettings() {
5521
5517
  "Static Content"
5522
5518
  ] }) }),
5523
5519
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { className: "pt-4", children: [
5524
- isEmpty(g) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500", children: [
5520
+ isEmpty(x) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500", children: [
5525
5521
  "Data binding is set for ",
5526
- /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(g, capitalize).join(", ") }),
5522
+ /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(x, capitalize).join(", ") }),
5527
5523
  " ",
5528
- g.length === 1 ? "property" : "properties",
5524
+ x.length === 1 ? "property" : "properties",
5529
5525
  ". Remove data binding to edit static content."
5530
5526
  ] }),
5531
5527
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5532
5528
  JSONForm,
5533
5529
  {
5534
5530
  id: n == null ? void 0 : n._id,
5535
- onChange: x,
5531
+ onChange: g,
5536
5532
  formData: i,
5537
- properties: E
5533
+ properties: j
5538
5534
  }
5539
5535
  )
5540
5536
  ] })
5541
5537
  ] })
5542
- ] }) : isEmpty(E) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5538
+ ] }) : isEmpty(j) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5543
5539
  JSONForm,
5544
5540
  {
5545
5541
  id: n == null ? void 0 : n._id,
5546
- onChange: x,
5542
+ onChange: g,
5547
5543
  formData: i,
5548
- properties: E
5544
+ properties: j
5549
5545
  }
5550
5546
  ),
5551
5547
  (n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
5552
- b ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: n == null ? void 0 : n._id }) : null,
5548
+ E ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: n == null ? void 0 : n._id }) : null,
5553
5549
  /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
5554
5550
  ] });
5555
5551
  }
@@ -5573,25 +5569,25 @@ function promptWithLanguage(o, n, r) {
5573
5569
  ${a}`;
5574
5570
  }
5575
5571
  const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5576
- const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), m = p.length ? p : u;
5572
+ const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: u, fallbackLang: p } = useLanguages(), m = u.length ? u : p;
5577
5573
  return {
5578
5574
  askAi: useCallback(
5579
- async (x, g, E, b) => {
5575
+ async (g, x, j, E) => {
5580
5576
  if (l) {
5581
5577
  n(!0), a(null);
5582
5578
  try {
5583
- const f = x === "content" ? cloneDeep(getBlockWithChildren(g, d)) : [cloneDeep(d.find((R) => R._id === g))];
5584
- set(f, "0._parent", null);
5585
- const k = p === u ? "" : p, _ = await l(x, promptWithLanguage(E, m, x), f, k), { blocks: C, error: B } = _;
5579
+ const b = g === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((R) => R._id === x))];
5580
+ set(b, "0._parent", null);
5581
+ const k = u === p ? "" : u, _ = await l(g, promptWithLanguage(j, m, g), b, k), { blocks: S, error: B } = _;
5586
5582
  if (B) {
5587
5583
  a(B);
5588
5584
  return;
5589
5585
  }
5590
- x === "styles" ? c(C) : i(C), b && b(_);
5591
- } catch (f) {
5592
- a(f);
5586
+ g === "styles" ? c(S) : i(S), E && E(_);
5587
+ } catch (b) {
5588
+ a(b);
5593
5589
  } finally {
5594
- n(!1), b && b();
5590
+ n(!1), E && E();
5595
5591
  }
5596
5592
  }
5597
5593
  },
@@ -5599,8 +5595,8 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5599
5595
  l,
5600
5596
  n,
5601
5597
  d,
5602
- p,
5603
5598
  u,
5599
+ p,
5604
5600
  m,
5605
5601
  c,
5606
5602
  i
@@ -5627,10 +5623,10 @@ function Countdown() {
5627
5623
  const [o, n] = useState(SECONDS), [r, a] = useState(!1);
5628
5624
  useEffect(() => {
5629
5625
  if (r && o > 0) {
5630
- const p = setTimeout(() => {
5626
+ const u = setTimeout(() => {
5631
5627
  n(o - 0.1);
5632
5628
  }, 100);
5633
- return () => clearTimeout(p);
5629
+ return () => clearTimeout(u);
5634
5630
  } else
5635
5631
  o <= 0 && (a(!1), n(SECONDS));
5636
5632
  }, [r, o]);
@@ -5675,14 +5671,14 @@ function Countdown() {
5675
5671
  ] });
5676
5672
  }
5677
5673
  const AskAIStyles = ({ blockId: o }) => {
5678
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), [u, m] = useState();
5674
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
5679
5675
  useEffect(() => {
5680
- var g;
5681
- (g = d.current) == null || g.focus();
5676
+ var x;
5677
+ (x = d.current) == null || x.focus();
5682
5678
  }, []);
5683
- const x = (g) => {
5684
- const { usage: E } = g || {};
5685
- !l && E && m(E), p.current = setTimeout(() => m(void 0), 1e4), l || c("");
5679
+ const g = (x) => {
5680
+ const { usage: j } = x || {};
5681
+ !l && j && m(j), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
5686
5682
  };
5687
5683
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5688
5684
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
@@ -5691,12 +5687,12 @@ const AskAIStyles = ({ blockId: o }) => {
5691
5687
  {
5692
5688
  ref: d,
5693
5689
  value: i,
5694
- onChange: (g) => c(g.target.value),
5690
+ onChange: (x) => c(x.target.value),
5695
5691
  placeholder: n("ask_ai_to_edit_styles"),
5696
5692
  className: "w-full border border-border focus:border-0",
5697
5693
  rows: 3,
5698
- onKeyDown: (g) => {
5699
- g.key === "Enter" && (g.preventDefault(), p.current && clearTimeout(p.current), m(void 0), r("styles", o, i, x));
5694
+ onKeyDown: (x) => {
5695
+ x.key === "Enter" && (x.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g));
5700
5696
  }
5701
5697
  }
5702
5698
  ),
@@ -5706,7 +5702,7 @@ const AskAIStyles = ({ blockId: o }) => {
5706
5702
  {
5707
5703
  disabled: i.trim().length < 5 || a,
5708
5704
  onClick: () => {
5709
- p.current && clearTimeout(p.current), m(void 0), r("styles", o, i, x);
5705
+ u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g);
5710
5706
  },
5711
5707
  variant: "default",
5712
5708
  className: "w-fit",
@@ -5725,11 +5721,11 @@ const AskAIStyles = ({ blockId: o }) => {
5725
5721
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("stop") })
5726
5722
  ] }) : null
5727
5723
  ] }),
5728
- u ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
5724
+ p ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
5729
5725
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
5730
5726
  n("Total tokens used"),
5731
5727
  ": ",
5732
- u.totalTokens
5728
+ p.totalTokens
5733
5729
  ] }),
5734
5730
  /* @__PURE__ */ jsxRuntimeExports.jsx(Countdown, {})
5735
5731
  ] }) }) : null,
@@ -5743,45 +5739,45 @@ const AskAIStyles = ({ blockId: o }) => {
5743
5739
  });
5744
5740
  function ManualClasses() {
5745
5741
  var A;
5746
- const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, p] = useState(""), { toast: u } = useToast(), m = (A = first(n)) == null ? void 0 : A.prop, x = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
5747
- const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5748
- a(i, N, !0), p("");
5749
- }, [E, b] = useState([]), f = ({ value: N }) => {
5750
- const D = N.trim().toLowerCase(), I = D.match(/.+:/g);
5751
- let j = [];
5752
- if (I && I.length > 0) {
5753
- const [v] = I, w = D.replace(v, "");
5754
- j = fuse.search(w).map((T) => ({
5755
- ...T,
5756
- item: { ...T.item, name: v + T.item.name }
5742
+ const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (A = first(n)) == null ? void 0 : A.prop, g = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
5743
+ const T = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5744
+ a(i, T, !0), u("");
5745
+ }, [j, E] = useState([]), b = ({ value: T }) => {
5746
+ const L = T.trim().toLowerCase(), P = L.match(/.+:/g);
5747
+ let f = [];
5748
+ if (P && P.length > 0) {
5749
+ const [v] = P, C = L.replace(v, "");
5750
+ f = fuse.search(C).map((I) => ({
5751
+ ...I,
5752
+ item: { ...I.item, name: v + I.item.name }
5757
5753
  }));
5758
5754
  } else
5759
- j = fuse.search(D);
5760
- return b(map(j, "item"));
5755
+ f = fuse.search(L);
5756
+ return E(map(f, "item"));
5761
5757
  }, k = () => {
5762
- b([]);
5763
- }, _ = (N) => N.name, C = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5758
+ E([]);
5759
+ }, _ = (T) => T.name, S = (T) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: T.name }), B = {
5764
5760
  autoComplete: "off",
5765
5761
  autoCorrect: "off",
5766
5762
  autoCapitalize: "off",
5767
5763
  spellCheck: !1,
5768
5764
  placeholder: o("enter_classes_separated_by_space"),
5769
5765
  value: d,
5770
- onKeyDown: (N) => {
5771
- N.key === "Enter" && d.trim() !== "" && g();
5766
+ onKeyDown: (T) => {
5767
+ T.key === "Enter" && d.trim() !== "" && x();
5772
5768
  },
5773
- onChange: (N, { newValue: D }) => p(D),
5769
+ onChange: (T, { newValue: L }) => u(L),
5774
5770
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5775
5771
  }, R = () => {
5776
5772
  if (navigator.clipboard === void 0) {
5777
- u({
5773
+ p({
5778
5774
  title: o("clipboard_not_supported"),
5779
5775
  description: o("please_use_chrome_firefox_or_safari"),
5780
5776
  variant: "destructive"
5781
5777
  });
5782
5778
  return;
5783
5779
  }
5784
- navigator.clipboard.writeText(x.join(" ")), u({
5780
+ navigator.clipboard.writeText(g.join(" ")), p({
5785
5781
  title: o("copied"),
5786
5782
  description: o("classes_copied_to_clipboard")
5787
5783
  });
@@ -5789,7 +5785,7 @@ function ManualClasses() {
5789
5785
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
5790
5786
  "div",
5791
5787
  {
5792
- className: `flex ${E.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
5788
+ className: `flex ${j.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
5793
5789
  children: [
5794
5790
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
5795
5791
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
@@ -5811,11 +5807,11 @@ function ManualClasses() {
5811
5807
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5812
5808
  Autosuggest,
5813
5809
  {
5814
- suggestions: E,
5815
- onSuggestionsFetchRequested: f,
5810
+ suggestions: j,
5811
+ onSuggestionsFetchRequested: b,
5816
5812
  onSuggestionsClearRequested: k,
5817
5813
  getSuggestionValue: _,
5818
- renderSuggestion: C,
5814
+ renderSuggestion: S,
5819
5815
  inputProps: B,
5820
5816
  containerProps: {
5821
5817
  className: "relative h-8 w-full gap-y-1 py-1 border-border"
@@ -5832,7 +5828,7 @@ function ManualClasses() {
5832
5828
  {
5833
5829
  variant: "outline",
5834
5830
  className: "h-6 border-border",
5835
- onClick: g,
5831
+ onClick: x,
5836
5832
  disabled: d.trim() === "",
5837
5833
  size: "sm",
5838
5834
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
@@ -5840,22 +5836,22 @@ function ManualClasses() {
5840
5836
  )
5841
5837
  ] }),
5842
5838
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
5843
- x.map((N) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5839
+ g.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5844
5840
  "div",
5845
5841
  {
5846
5842
  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",
5847
5843
  children: [
5848
- N,
5844
+ T,
5849
5845
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5850
5846
  Cross2Icon,
5851
5847
  {
5852
- onClick: () => l(i, [N]),
5848
+ onClick: () => l(i, [T]),
5853
5849
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
5854
5850
  }
5855
5851
  )
5856
5852
  ]
5857
5853
  },
5858
- N
5854
+ T
5859
5855
  ))
5860
5856
  ) })
5861
5857
  ]
@@ -6155,7 +6151,7 @@ const EDITOR_ICONS = {
6155
6151
  DropDown,
6156
6152
  {
6157
6153
  rounded: o,
6158
- onChange: (p) => r(p, n),
6154
+ onChange: (u) => r(u, n),
6159
6155
  selected: i,
6160
6156
  options: a,
6161
6157
  disabled: !c
@@ -6169,23 +6165,23 @@ function DropDown({ selected: o, onChange: n, rounded: r = !1, options: a, disab
6169
6165
  {
6170
6166
  disabled: !a.length || l,
6171
6167
  className: `${r ? "rounded-md border border-border" : "border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,
6172
- onChange: (p) => n(p.target.value),
6173
- onKeyDown: (p) => {
6174
- p.ctrlKey && (p.key === "z" && c(), p.key === "y" && d());
6168
+ onChange: (u) => n(u.target.value),
6169
+ onKeyDown: (u) => {
6170
+ u.ctrlKey && (u.key === "z" && c(), u.key === "y" && d());
6175
6171
  },
6176
6172
  value: i,
6177
6173
  children: [
6178
6174
  /* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: "" }),
6179
6175
  React__default.Children.toArray(
6180
- a.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: p, children: p }))
6176
+ a.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: u, children: u }))
6181
6177
  )
6182
6178
  ]
6183
6179
  }
6184
6180
  );
6185
6181
  }
6186
6182
  const RangeChoices = ({ property: o, onChange: n }) => {
6187
- const { canReset: r, canChange: a } = useContext(StyleContext), l = useCurrentClassByProperty(o), i = useMemo(() => get(l, "cls", ""), [l]), c = useMemo(() => get(CLASSES_LIST, `${o}.classes`, [""]), [o]), d = c.indexOf(i) > -1 ? c.indexOf(i) : 0, p = /\[.*\]/g.test(i);
6188
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs", children: p ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-[5px] px-2", children: i }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6183
+ const { canReset: r, canChange: a } = useContext(StyleContext), l = useCurrentClassByProperty(o), i = useMemo(() => get(l, "cls", ""), [l]), c = useMemo(() => get(CLASSES_LIST, `${o}.classes`, [""]), [o]), d = c.indexOf(i) > -1 ? c.indexOf(i) : 0, u = /\[.*\]/g.test(i);
6184
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs", children: u ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-[5px] px-2", children: i }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6189
6185
  /* @__PURE__ */ jsxRuntimeExports.jsx(
6190
6186
  "button",
6191
6187
  {
@@ -6246,30 +6242,30 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6246
6242
  ringColor: "ring",
6247
6243
  ringOffsetColor: "ring-offset"
6248
6244
  }, ColorChoice = ({ property: o, onChange: n }) => {
6249
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), m = get(u, "1", ""), x = get(u, "2", ""), g = useCallback(
6245
+ const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), g = get(p, "2", ""), x = useCallback(
6250
6246
  // eslint-disable-next-line no-shadow
6251
- (b) => {
6252
- ["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), p({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((f) => ({ ...f, color: b, shade: f.shade ? f.shade : "500" })));
6247
+ (E) => {
6248
+ ["current", "inherit", "transparent", "black", "white"].includes(E) ? (c([]), u({ color: E })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((b) => ({ ...b, color: E, shade: b.shade ? b.shade : "500" })));
6253
6249
  },
6254
- [c, p]
6250
+ [c, u]
6255
6251
  );
6256
6252
  useEffect(() => {
6257
6253
  if (["current", "inherit", "transparent", "black", "white"].includes(m))
6258
6254
  return c([]);
6259
6255
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
6260
6256
  }, [m]);
6261
- const E = useCallback(
6257
+ const j = useCallback(
6262
6258
  // eslint-disable-next-line no-shadow
6263
- (b) => {
6264
- p({ color: m, shade: b });
6259
+ (E) => {
6260
+ u({ color: m, shade: E });
6265
6261
  },
6266
6262
  [m]
6267
6263
  );
6268
6264
  return useEffect(() => {
6269
- p({ color: "", shade: "" });
6265
+ u({ color: "", shade: "" });
6270
6266
  }, [r]), useEffect(() => {
6271
- const f = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6272
- f.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(f, o);
6267
+ const b = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6268
+ b.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(b, o);
6273
6269
  }, [d, n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
6274
6270
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6275
6271
  DropDown,
@@ -6277,7 +6273,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6277
6273
  disabled: !l,
6278
6274
  rounded: !0,
6279
6275
  selected: m,
6280
- onChange: g,
6276
+ onChange: x,
6281
6277
  options: [
6282
6278
  "current",
6283
6279
  "transparent",
@@ -6310,7 +6306,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6310
6306
  ]
6311
6307
  }
6312
6308
  ) }),
6313
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !m || !l, onChange: E, options: i }) })
6309
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: g, disabled: !m || !l, onChange: j, options: i }) })
6314
6310
  ] });
6315
6311
  }, getUserInputValues = (o, n) => {
6316
6312
  o = o.toLowerCase();
@@ -6474,18 +6470,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6474
6470
  "button",
6475
6471
  {
6476
6472
  type: "button",
6477
- onMouseDown: (p) => {
6478
- const u = {
6473
+ onMouseDown: (u) => {
6474
+ const p = {
6479
6475
  onDrag: r,
6480
6476
  onDragEnd: a,
6481
6477
  dragging: !0,
6482
- dragStartY: p.pageY,
6478
+ dragStartY: u.pageY,
6483
6479
  dragStartValue: `${n}`,
6484
6480
  dragUnit: o,
6485
6481
  negative: i,
6486
6482
  cssProperty: c
6487
6483
  };
6488
- l(u), d(u);
6484
+ l(p), d(p);
6489
6485
  },
6490
6486
  color: void 0,
6491
6487
  className: "relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",
@@ -6505,52 +6501,52 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6505
6501
  },
6506
6502
  a
6507
6503
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
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);
6504
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [g, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [_, S] = useState(!1), [B, R] = useState(!1);
6509
6505
  useEffect(() => {
6510
- const { value: j, unit: v } = getClassValueAndUnit(i);
6506
+ const { value: f, unit: v } = getClassValueAndUnit(i);
6511
6507
  if (v === "") {
6512
- l(j), g(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
6508
+ l(f), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6513
6509
  return;
6514
6510
  }
6515
- g(v), l(v === "class" || isEmpty(j) ? "" : j);
6516
- }, [i, p, u]);
6517
- const A = useThrottledCallback((j) => c(j), [c], THROTTLE_TIME), N = useThrottledCallback((j) => c(j, !1), [c], THROTTLE_TIME), D = useCallback(
6518
- (j = !1) => {
6519
- const v = getUserInputValues(`${a}`, u);
6511
+ x(v), l(v === "class" || isEmpty(f) ? "" : f);
6512
+ }, [i, u, p]);
6513
+ const A = useThrottledCallback((f) => c(f), [c], THROTTLE_TIME), T = useThrottledCallback((f) => c(f, !1), [c], THROTTLE_TIME), L = useCallback(
6514
+ (f = !1) => {
6515
+ const v = getUserInputValues(`${a}`, p);
6520
6516
  if (get(v, "error", !1)) {
6521
- b(!0);
6517
+ E(!0);
6522
6518
  return;
6523
6519
  }
6524
- const w = get(v, "unit") !== "" ? get(v, "unit") : x;
6525
- if (w === "auto" || w === "none") {
6526
- A(`${d}${w}`);
6520
+ const C = get(v, "unit") !== "" ? get(v, "unit") : g;
6521
+ if (C === "auto" || C === "none") {
6522
+ A(`${d}${C}`);
6527
6523
  return;
6528
6524
  }
6529
6525
  if (get(v, "value") === "")
6530
6526
  return;
6531
- const T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6532
- j ? N(T) : A(T);
6527
+ const I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6528
+ f ? T(I) : A(I);
6533
6529
  },
6534
- [A, N, a, x, d, u]
6535
- ), I = useCallback(
6536
- (j) => {
6537
- const v = getUserInputValues(`${a}`, u);
6530
+ [A, T, a, g, d, p]
6531
+ ), P = useCallback(
6532
+ (f) => {
6533
+ const v = getUserInputValues(`${a}`, p);
6538
6534
  if (get(v, "error", !1)) {
6539
- b(!0);
6535
+ E(!0);
6540
6536
  return;
6541
6537
  }
6542
- if (j === "auto" || j === "none") {
6543
- A(`${d}${j}`);
6538
+ if (f === "auto" || f === "none") {
6539
+ A(`${d}${f}`);
6544
6540
  return;
6545
6541
  }
6546
6542
  if (get(v, "value") === "")
6547
6543
  return;
6548
- const w = get(v, "unit") !== "" ? get(v, "unit") : j, T = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6549
- A(T);
6544
+ const C = get(v, "unit") !== "" ? get(v, "unit") : f, I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6545
+ A(I);
6550
6546
  },
6551
- [A, a, d, u]
6547
+ [A, a, d, p]
6552
6548
  );
6553
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: x === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6549
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: g === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6554
6550
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
6555
6551
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6556
6552
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircledIcon, {}) }) }),
@@ -6558,38 +6554,38 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6558
6554
  ] })
6559
6555
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${_ ? "z-auto" : ""}`, children: [
6560
6556
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6561
- ["none", "auto"].indexOf(x) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6557
+ ["none", "auto"].indexOf(g) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6562
6558
  "input",
6563
6559
  {
6564
- readOnly: x === "class",
6565
- onKeyPress: (j) => {
6566
- j.key === "Enter" && D();
6560
+ readOnly: g === "class",
6561
+ onKeyPress: (f) => {
6562
+ f.key === "Enter" && L();
6567
6563
  },
6568
- onKeyDown: (j) => {
6569
- if (j.keyCode !== 38 && j.keyCode !== 40)
6564
+ onKeyDown: (f) => {
6565
+ if (f.keyCode !== 38 && f.keyCode !== 40)
6570
6566
  return;
6571
- j.preventDefault(), R(!0);
6572
- const v = parseInt$1(j.target.value);
6573
- let w = isNaN$1(v) ? 0 : v;
6574
- j.keyCode === 38 && (w += 1), j.keyCode === 40 && (w -= 1);
6575
- const S = `${w}`, L = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${x === "-" ? "" : x}]`;
6576
- N(L);
6567
+ f.preventDefault(), R(!0);
6568
+ const v = parseInt$1(f.target.value);
6569
+ let C = isNaN$1(v) ? 0 : v;
6570
+ f.keyCode === 38 && (C += 1), f.keyCode === 40 && (C -= 1);
6571
+ const w = `${C}`, N = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${g === "-" ? "" : g}]`;
6572
+ T(N);
6577
6573
  },
6578
- onKeyUp: (j) => {
6579
- B && (j.preventDefault(), R(!1));
6574
+ onKeyUp: (f) => {
6575
+ B && (f.preventDefault(), R(!1));
6580
6576
  },
6581
- onBlur: () => D(),
6582
- onChange: (j) => {
6583
- b(!1), l(j.target.value);
6577
+ onBlur: () => L(),
6578
+ onChange: (f) => {
6579
+ E(!1), l(f.target.value);
6584
6580
  },
6585
- onClick: (j) => {
6581
+ onClick: (f) => {
6586
6582
  var v;
6587
- (v = j == null ? void 0 : j.target) == null || v.select(), r(!1);
6583
+ (v = f == null ? void 0 : f.target) == null || v.select(), r(!1);
6588
6584
  },
6589
- value: _ ? f : a,
6585
+ value: _ ? b : a,
6590
6586
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6591
6587
  " ",
6592
- E ? "border-red-500 text-red-500" : "border-foreground/20"
6588
+ j ? "border-red-500 text-red-500" : "border-foreground/20"
6593
6589
  )
6594
6590
  }
6595
6591
  ),
@@ -6601,44 +6597,44 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6601
6597
  onClick: () => r(!n),
6602
6598
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
6603
6599
  children: [
6604
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: x }),
6605
- u.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
6600
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: g }),
6601
+ p.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
6606
6602
  ]
6607
6603
  }
6608
6604
  ) }),
6609
6605
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipPortal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6610
6606
  UnitSelection,
6611
6607
  {
6612
- units: u,
6613
- current: x,
6614
- onSelect: (j) => {
6615
- r(!1), g(j), I(j);
6608
+ units: p,
6609
+ current: g,
6610
+ onSelect: (f) => {
6611
+ r(!1), x(f), P(f);
6616
6612
  }
6617
6613
  }
6618
6614
  ) }) })
6619
6615
  ] })
6620
6616
  ] }),
6621
- ["none", "auto"].indexOf(x) !== -1 || _ ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6617
+ ["none", "auto"].indexOf(g) !== -1 || _ ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6622
6618
  DragStyleButton,
6623
6619
  {
6624
- onDragStart: () => C(!0),
6625
- onDragEnd: (j) => {
6626
- if (k(() => ""), C(!1), isEmpty(j))
6620
+ onDragStart: () => S(!0),
6621
+ onDragEnd: (f) => {
6622
+ if (k(() => ""), S(!1), isEmpty(f))
6627
6623
  return;
6628
- const v = `${j}`, S = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${x === "-" ? "" : x}]`;
6629
- A(S);
6624
+ const v = `${f}`, w = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${g === "-" ? "" : g}]`;
6625
+ A(w);
6630
6626
  },
6631
- onDrag: (j) => {
6632
- if (isEmpty(j))
6627
+ onDrag: (f) => {
6628
+ if (isEmpty(f))
6633
6629
  return;
6634
- k(j);
6635
- const v = `${j}`, S = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${x === "-" ? "" : x}]`;
6636
- N(S);
6630
+ k(f);
6631
+ const v = `${f}`, w = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${g === "-" ? "" : g}]`;
6632
+ T(w);
6637
6633
  },
6638
6634
  currentValue: a,
6639
- unit: x,
6635
+ unit: g,
6640
6636
  negative: m,
6641
- cssProperty: p
6637
+ cssProperty: u
6642
6638
  }
6643
6639
  )
6644
6640
  ] }) }) });
@@ -6730,22 +6726,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6730
6726
  "2xl": "1536px"
6731
6727
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6732
6728
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
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(
6734
- (N, D = !0) => {
6735
- const I = { dark: p, mq: m, mod: u, cls: N, property: l, fullCls: "" };
6736
- (p || u !== "") && (I.mq = "xs");
6737
- const j = generateFullClsName(I);
6738
- g(b, [j], D);
6729
+ }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), g = useCurrentClassByProperty(l), x = useAddClassesToBlocks(), j = useRemoveClassesFromBlocks(), [E] = useSelectedBlockIds(), b = useMemo(() => get(g, "fullCls", ""), [g]), k = useCallback(
6730
+ (T, L = !0) => {
6731
+ const P = { dark: u, mq: m, mod: p, cls: T, property: l, fullCls: "" };
6732
+ (u || p !== "") && (P.mq = "xs");
6733
+ const f = generateFullClsName(P);
6734
+ x(E, [f], L);
6739
6735
  },
6740
- [b, p, m, u, l, g]
6736
+ [E, u, m, p, l, x]
6741
6737
  ), _ = useCallback(() => {
6742
- E(b, [f]);
6743
- }, [b, f, E]), C = useMemo(() => canChangeClass(x, m), [x, m]);
6738
+ j(E, [b]);
6739
+ }, [E, b, j]), S = useMemo(() => canChangeClass(g, m), [g, m]);
6744
6740
  useEffect(() => {
6745
- i(C, x);
6746
- }, [C, i, x]);
6741
+ i(S, g);
6742
+ }, [S, i, g]);
6747
6743
  const [, , B] = useCanvasWidth(), R = useCallback(
6748
- (N) => {
6744
+ (T) => {
6749
6745
  B({
6750
6746
  xs: 400,
6751
6747
  sm: 640,
@@ -6753,18 +6749,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6753
6749
  lg: 1024,
6754
6750
  xl: 1420,
6755
6751
  "2xl": 1920
6756
- }[N]);
6752
+ }[T]);
6757
6753
  },
6758
6754
  [B]
6759
- ), A = get(x, "dark", null) === p && get(x, "mod", null) === u && get(x, "mq", null) === m;
6760
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: x && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6761
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !A ? "text-foreground" : ""}`, children: n(a) }) }),
6755
+ ), A = get(g, "dark", null) === u && get(g, "mod", null) === p && get(g, "mq", null) === m;
6756
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: g && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6757
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !A ? "text-foreground" : ""}`, children: n(a) }) }),
6762
6758
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6763
6759
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
6764
6760
  r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
6765
6761
  AdvanceChoices,
6766
6762
  {
6767
- currentClass: get(x, "cls", ""),
6763
+ currentClass: get(g, "cls", ""),
6768
6764
  classPrefix: get(CLASS_PREFIXES, l, ""),
6769
6765
  units: c || [],
6770
6766
  onChange: k,
@@ -6777,7 +6773,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6777
6773
  r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
6778
6774
  r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
6779
6775
  ] }),
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: [
6776
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "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" }) }) : S && g ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6781
6777
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6782
6778
  "button",
6783
6779
  {
@@ -6789,19 +6785,19 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6789
6785
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
6790
6786
  "Current style is set at  ",
6791
6787
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
6792
- getBreakpoint(get(x, "mq")),
6793
- p && !x.dark ? "(Light mode)" : ""
6788
+ getBreakpoint(get(g, "mq")),
6789
+ u && !g.dark ? "(Light mode)" : ""
6794
6790
  ] }),
6795
6791
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
6796
6792
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
6797
6793
  "button",
6798
6794
  {
6799
6795
  type: "button",
6800
- onClick: () => R(get(x, "mq")),
6796
+ onClick: () => R(get(g, "mq")),
6801
6797
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6802
6798
  children: [
6803
6799
  "Switch to ",
6804
- get(x, "mq").toUpperCase()
6800
+ get(g, "mq").toUpperCase()
6805
6801
  ]
6806
6802
  }
6807
6803
  )
@@ -6818,7 +6814,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6818
6814
  units: i = basicUnits,
6819
6815
  negative: c = !1
6820
6816
  }) => {
6821
- const { t: d } = useTranslation(), [p, u] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), x = useCallback((g) => map(m, "property").includes(g), [m]);
6817
+ const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), g = useCallback((x) => map(m, "property").includes(x), [m]);
6822
6818
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6823
6819
  "div",
6824
6820
  {
@@ -6827,22 +6823,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6827
6823
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
6828
6824
  o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
6829
6825
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
6830
- n.map(({ label: g, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6826
+ n.map(({ label: x, key: j }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6831
6827
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
6832
6828
  "button",
6833
6829
  {
6834
6830
  type: "button",
6835
- onClick: () => u(E),
6836
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${E === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6831
+ onClick: () => p(j),
6832
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${j === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6837
6833
  children: [
6838
6834
  React__default.createElement("div", {
6839
- className: x(E) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6835
+ className: g(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6840
6836
  }),
6841
- React__default.createElement(get(EDITOR_ICONS, E, BoxIcon), { className: "text-inherit w-3 h-3" })
6837
+ React__default.createElement(get(EDITOR_ICONS, j, BoxIcon), { className: "text-inherit w-3 h-3" })
6842
6838
  ]
6843
6839
  }
6844
6840
  ) }),
6845
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(g)) })
6841
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(x)) })
6846
6842
  ] }) }))
6847
6843
  ) })
6848
6844
  ] }),
@@ -6852,7 +6848,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6852
6848
  type: l,
6853
6849
  units: [...i],
6854
6850
  label: "",
6855
- property: p,
6851
+ property: u,
6856
6852
  negative: c
6857
6853
  }
6858
6854
  ) })
@@ -6861,10 +6857,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6861
6857
  );
6862
6858
  }, NestedOptions = ({ heading: o, items: n }) => {
6863
6859
  const { t: r } = useTranslation(), a = useSelectedBlockCurrentClasses(), l = useMemo(() => {
6864
- const i = (p) => flatten(
6865
- p.map((u) => u.styleType === "multiple" ? map(u.options, "key") : u.property)
6860
+ const i = (u) => flatten(
6861
+ u.map((p) => p.styleType === "multiple" ? map(p.options, "key") : p.property)
6866
6862
  ), c = flatten(
6867
- n.map((p) => p.styleType === "accordion" ? i(p.items) : p.styleType === "multiple" ? map(p.options, "key") : p.property)
6863
+ n.map((u) => u.styleType === "accordion" ? i(u.items) : u.styleType === "multiple" ? map(u.options, "key") : u.property)
6868
6864
  ), d = map(a, "property");
6869
6865
  return intersection(c, d).length > 0;
6870
6866
  }, [a, n]);
@@ -6884,11 +6880,11 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6884
6880
  const { t: n } = useTranslation(), r = useSelectedBlockCurrentClasses(), a = useCallback(
6885
6881
  (i = []) => {
6886
6882
  const c = {};
6887
- for (let p = 0; p < r.length; p++)
6888
- c[r[p].property] = r[p].cls;
6883
+ for (let u = 0; u < r.length; u++)
6884
+ c[r[u].property] = r[u].cls;
6889
6885
  let d = !0;
6890
- for (const p in i)
6891
- if (!has(c, p) || c[p] !== i[p]) {
6886
+ for (const u in i)
6887
+ if (!has(c, u) || c[u] !== i[u]) {
6892
6888
  d = !1;
6893
6889
  break;
6894
6890
  }
@@ -6906,8 +6902,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6906
6902
  const o = useSelectedBlock(), [n] = useSelectedStylingBlocks(), { t: r } = useTranslation(), a = useGlobalStylingPresets(), l = useAddClassesToBlocks(), i = getBlockComponent(o._type), c = get(first(n), "prop"), d = get(i.props, `${c}.presets`, {});
6907
6903
  if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
6908
6904
  return null;
6909
- const p = (u) => {
6910
- const m = u.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6905
+ const u = (p) => {
6906
+ const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6911
6907
  l([o._id], m, !0);
6912
6908
  };
6913
6909
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
@@ -6923,16 +6919,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6923
6919
  r("presets")
6924
6920
  ] }),
6925
6921
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
6926
- /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(d).map((u) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => p(d[u]), children: [
6927
- capitalize(startCase(r(u))),
6922
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(d).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => u(d[p]), children: [
6923
+ capitalize(startCase(r(p))),
6928
6924
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
6929
6925
  ] })) })
6930
6926
  ] }),
6931
6927
  isEmpty(a) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6932
6928
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuLabel, { children: r("Global presets") }),
6933
6929
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
6934
- /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(a).map((u) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => p(a[u]), children: [
6935
- capitalize(startCase(r(u))),
6930
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(a).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => u(a[p]), children: [
6931
+ capitalize(startCase(r(p))),
6936
6932
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
6937
6933
  ] })) })
6938
6934
  ] })
@@ -6952,8 +6948,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6952
6948
  };
6953
6949
  function BlockStyling() {
6954
6950
  const { flexChild: o, gridChild: n } = useSelectedBlocksDisplayChild(), [r] = useSelectedStylingBlocks(), [a, l] = React__default.useState(""), [i, c] = React__default.useState({
6955
- onDrag: (u) => u,
6956
- onDragEnd: (u) => u,
6951
+ onDrag: (p) => p,
6952
+ onDragEnd: (p) => p,
6957
6953
  dragStartY: 0,
6958
6954
  dragging: !1,
6959
6955
  dragStartValue: 0,
@@ -6961,21 +6957,21 @@ function BlockStyling() {
6961
6957
  negative: !1,
6962
6958
  cssProperty: ""
6963
6959
  }), d = useThrottledCallback(
6964
- (u) => {
6965
- const m = !get(i, "negative", !1), x = get(i, "cssProperty", "");
6966
- let g = parseFloat(i.dragStartValue);
6967
- g = isNaN(g) ? 0 : g;
6968
- let E = MAPPER[i.dragUnit];
6969
- (startsWith(x, "scale") || x === "opacity") && (E = 10);
6970
- let f = (i.dragStartY - u.pageY) / E + g;
6971
- m && f < 0 && (f = 0), x === "opacity" && f > 1 && (f = 1), i.onDrag(`${f}`), l(`${f}`);
6960
+ (p) => {
6961
+ const m = !get(i, "negative", !1), g = get(i, "cssProperty", "");
6962
+ let x = parseFloat(i.dragStartValue);
6963
+ x = isNaN(x) ? 0 : x;
6964
+ let j = MAPPER[i.dragUnit];
6965
+ (startsWith(g, "scale") || g === "opacity") && (j = 10);
6966
+ let b = (i.dragStartY - p.pageY) / j + x;
6967
+ m && b < 0 && (b = 0), g === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
6972
6968
  },
6973
6969
  [i],
6974
6970
  50
6975
- ), p = useCallback(() => {
6971
+ ), u = useCallback(() => {
6976
6972
  setTimeout(() => i.onDragEnd(`${a}`), 100), c({
6977
- onDrag: (u) => u,
6978
- onDragEnd: (u) => u,
6973
+ onDrag: (p) => p,
6974
+ onDragEnd: (p) => p,
6979
6975
  dragStartY: 0,
6980
6976
  dragging: !1,
6981
6977
  dragStartValue: 0,
@@ -6989,7 +6985,7 @@ function BlockStyling() {
6989
6985
  "div",
6990
6986
  {
6991
6987
  onMouseMove: d,
6992
- onMouseUp: () => p(),
6988
+ onMouseUp: () => u(),
6993
6989
  className: "absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"
6994
6990
  }
6995
6991
  ) : null,
@@ -6998,7 +6994,7 @@ function BlockStyling() {
6998
6994
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { defaultValue: ["Styles"], type: "multiple", className: "w-full", children: [
6999
6995
  o && /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: FLEX_CHILD_SECTION }),
7000
6996
  n ? /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: GRID_CHILD_SECTION }) : null,
7001
- SETTINGS_SECTIONS.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: u }, u.heading))
6997
+ SETTINGS_SECTIONS.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: p }, p.heading))
7002
6998
  ] })
7003
6999
  ] })
7004
7000
  ] });
@@ -7010,9 +7006,9 @@ const ChaiSelect = ({
7010
7006
  placeholder: a = "Select",
7011
7007
  className: l = ""
7012
7008
  }) => {
7013
- const [i, c] = useState(o), d = (p) => {
7014
- const u = p.target.value;
7015
- c(u), n(u);
7009
+ const [i, c] = useState(o), d = (u) => {
7010
+ const p = u.target.value;
7011
+ c(p), n(p);
7016
7012
  };
7017
7013
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("relative inline-block w-full", l), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7018
7014
  "select",
@@ -7022,7 +7018,7 @@ const ChaiSelect = ({
7022
7018
  onChange: d,
7023
7019
  children: [
7024
7020
  /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", disabled: !0, children: a }),
7025
- r.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.value, children: p.label }, p.value))
7021
+ r.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.value, children: u.label }, u.value))
7026
7022
  ]
7027
7023
  }
7028
7024
  ) });
@@ -7054,10 +7050,10 @@ const BlockCard = ({
7054
7050
  library: n,
7055
7051
  parentId: r = void 0
7056
7052
  }) => {
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) => {
7053
+ const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), m = get(o, "name", get(o, "label")), g = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), j = (k) => {
7058
7054
  const _ = has(k, "styles_attrs.data-page-section");
7059
7055
  return k._type === "Box" && _;
7060
- }, b = useCallback(
7056
+ }, E = useCallback(
7061
7057
  async (k) => {
7062
7058
  if (k.stopPropagation(), has(o, "component")) {
7063
7059
  c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
@@ -7068,11 +7064,11 @@ const BlockCard = ({
7068
7064
  isEmpty(_) || d(syncBlocksWithDefaults(_), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7069
7065
  },
7070
7066
  [o]
7071
- ), f = async (k) => {
7067
+ ), b = async (k) => {
7072
7068
  const _ = await i(n, o);
7073
- let C = r;
7074
- if (E(first(_)) && (C = null), !isEmpty(_)) {
7075
- const B = { blocks: _, uiLibrary: !0, parent: C };
7069
+ let S = r;
7070
+ if (j(first(_)) && (S = null), !isEmpty(_)) {
7071
+ const B = { blocks: _, uiLibrary: !0, parent: S };
7076
7072
  if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
7077
7073
  const R = new Image();
7078
7074
  R.src = o.preview, R.onload = () => {
@@ -7080,8 +7076,8 @@ const BlockCard = ({
7080
7076
  };
7081
7077
  } else
7082
7078
  k.dataTransfer.setDragImage(new Image(), 0, 0);
7083
- g(B), setTimeout(() => {
7084
- p([]), u(), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7079
+ x(B), setTimeout(() => {
7080
+ u([]), p(), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7085
7081
  }, 200);
7086
7082
  }
7087
7083
  };
@@ -7090,9 +7086,9 @@ const BlockCard = ({
7090
7086
  "div",
7091
7087
  {
7092
7088
  onClick: a ? () => {
7093
- } : b,
7094
- draggable: x ? "true" : "false",
7095
- onDragStart: f,
7089
+ } : E,
7090
+ draggable: g ? "true" : "false",
7091
+ onDragStart: b,
7096
7092
  className: clsx(
7097
7093
  "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
7098
7094
  ),
@@ -7115,42 +7111,42 @@ const BlockCard = ({
7115
7111
  (async () => {
7116
7112
  if (i === "complete" || c.current === "loading")
7117
7113
  return;
7118
- c.current = "loading", r((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
7114
+ c.current = "loading", r((u) => ({ ...u, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
7119
7115
  const d = await a(o);
7120
- c.current = "idle", r((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
7116
+ c.current = "idle", r((u) => ({ ...u, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
7121
7117
  })();
7122
7118
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
7123
7119
  }, UILibrarySection = ({ parentId: o }) => {
7124
- const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((C) => C.category === "custom"), c = a.find((C) => C.uuid === n) || first(a), { data: d, isLoading: p } = useLibraryBlocks(c), u = groupBy([...d, ...i], "group"), [m, x] = useState("Hero"), g = get(u, m, []), E = useRef(null), { t: b } = useTranslation(), f = (C) => {
7125
- E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
7126
- E.current && x(C);
7120
+ const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, g] = useState("Hero"), x = get(p, m, []), j = useRef(null), { t: E } = useTranslation(), b = (S) => {
7121
+ j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
7122
+ j.current && g(S);
7127
7123
  }, 300);
7128
7124
  };
7129
- if (p)
7125
+ if (u)
7130
7126
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 grid h-full w-full grid-cols-12 gap-2", children: [
7131
7127
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7132
7128
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7133
7129
  ] });
7134
- const k = filter(g, (C, B) => B % 2 === 0), _ = filter(g, (C, B) => B % 2 === 1);
7130
+ const k = filter(x, (S, B) => B % 2 === 0), _ = filter(x, (S, B) => B % 2 === 1);
7135
7131
  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: [
7136
7132
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7137
7133
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
7138
7134
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
7139
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: b("groups") }),
7135
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: E("groups") }),
7140
7136
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7141
7137
  /* @__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(
7142
- map(u, (C, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7138
+ map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7143
7139
  "div",
7144
7140
  {
7145
- onMouseEnter: () => f(B),
7146
- onMouseLeave: () => clearTimeout(E.current),
7147
- onClick: () => x(B),
7141
+ onMouseEnter: () => b(B),
7142
+ onMouseLeave: () => clearTimeout(j.current),
7143
+ onClick: () => g(B),
7148
7144
  className: cn(
7149
7145
  "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",
7150
7146
  B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7151
7147
  ),
7152
7148
  children: [
7153
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(b(B.toLowerCase())) }),
7149
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(B.toLowerCase())) }),
7154
7150
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7155
7151
  ]
7156
7152
  },
@@ -7162,15 +7158,15 @@ const BlockCard = ({
7162
7158
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
7163
7159
  ScrollArea,
7164
7160
  {
7165
- onMouseEnter: () => E.current ? clearTimeout(E.current) : null,
7161
+ onMouseEnter: () => j.current ? clearTimeout(j.current) : null,
7166
7162
  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",
7167
7163
  children: [
7168
7164
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7169
7165
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7170
- k.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7166
+ k.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
7171
7167
  ) }),
7172
7168
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7173
- _.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7169
+ _.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
7174
7170
  ) })
7175
7171
  ] }),
7176
7172
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -7615,54 +7611,54 @@ i18n.use(initReactI18next).init({
7615
7611
  }
7616
7612
  });
7617
7613
  const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7618
- const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), x = () => {
7614
+ const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = () => {
7619
7615
  if (has(o, "blocks")) {
7620
- const b = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7621
- p(syncBlocksWithDefaults(b), r || null);
7616
+ const E = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7617
+ u(syncBlocksWithDefaults(E), r || null);
7622
7618
  } else
7623
7619
  d(o, r || null);
7624
7620
  emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7625
- }, g = useFeature("dnd"), { t: E } = useTranslation();
7621
+ }, x = useFeature("dnd"), { t: j } = useTranslation();
7626
7622
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
7627
7623
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7628
7624
  "button",
7629
7625
  {
7630
7626
  disabled: n,
7631
- onClick: x,
7627
+ onClick: g,
7632
7628
  type: "button",
7633
- onDragStart: (b) => {
7634
- b.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), b.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7635
- u([]), m();
7629
+ onDragStart: (E) => {
7630
+ E.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), E.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7631
+ p([]), m();
7636
7632
  }, 200);
7637
7633
  },
7638
- draggable: g ? "true" : "false",
7634
+ draggable: x ? "true" : "false",
7639
7635
  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",
7640
7636
  children: [
7641
7637
  createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
7642
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(E(c || l)) })
7638
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(j(c || l)) })
7643
7639
  ]
7644
7640
  }
7645
7641
  ) }),
7646
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: E(c || l) }) })
7642
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: j(c || l) }) })
7647
7643
  ] }) });
7648
7644
  }, DefaultChaiBlocks = ({ parentId: o, gridCols: n = "grid-cols-2" }) => {
7649
7645
  const r = useChaiBlocks(), a = useBuilderProp("filterChaiBlock", () => !0), l = filter(r, a), i = groupBy(l, "category"), c = uniq(map(i.core, "group"));
7650
7646
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ChaiBuilderBlocks, { gridCols: n, parentId: o, groups: c, blocks: i.core });
7651
7647
  }, CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, gridCols: a = "grid-cols-4" }) => {
7652
7648
  var d;
7653
- const { t: l } = useTranslation(), [i] = useBlocksStore(), c = (d = find(i, (p) => p._id === r)) == null ? void 0 : d._type;
7649
+ const { t: l } = useTranslation(), [i] = useBlocksStore(), c = (d = find(i, (u) => u._id === r)) == null ? void 0 : d._type;
7654
7650
  return React__default.Children.toArray(
7655
7651
  map(
7656
- sortBy(o, (p) => CORE_GROUPS.indexOf(p) === -1 ? 99 : CORE_GROUPS.indexOf(p)),
7657
- (p) => reject(filter(values(n), { group: p }), { hidden: !0 }).length ? /* @__PURE__ */ jsxRuntimeExports.jsx(Accordion, { type: "single", value: p, collapsible: !0, className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: p, className: "border-border", children: [
7658
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "rounded-md bg-background px-4 py-2 capitalize text-foreground hover:no-underline", children: capitalize(l(p.toLowerCase())) }),
7652
+ sortBy(o, (u) => CORE_GROUPS.indexOf(u) === -1 ? 99 : CORE_GROUPS.indexOf(u)),
7653
+ (u) => reject(filter(values(n), { group: u }), { hidden: !0 }).length ? /* @__PURE__ */ jsxRuntimeExports.jsx(Accordion, { type: "single", value: u, collapsible: !0, className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: u, className: "border-border", children: [
7654
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "rounded-md bg-background px-4 py-2 capitalize text-foreground hover:no-underline", children: capitalize(l(u.toLowerCase())) }),
7659
7655
  /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionContent, { className: "mx-auto max-w-xl p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-2 " + a, children: React__default.Children.toArray(
7660
- reject(filter(values(n), { group: p }), { hidden: !0 }).map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx(
7656
+ reject(filter(values(n), { group: u }), { hidden: !0 }).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(
7661
7657
  CoreBlock,
7662
7658
  {
7663
7659
  parentId: r,
7664
- block: u,
7665
- disabled: !canAcceptChildBlock(c, u.type) || !canBeNestedInside(c, u.type)
7660
+ block: p,
7661
+ disabled: !canAcceptChildBlock(c, p.type) || !canBeNestedInside(c, p.type)
7666
7662
  }
7667
7663
  ))
7668
7664
  ) }) })
@@ -7683,8 +7679,8 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7683
7679
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7684
7680
  Tabs,
7685
7681
  {
7686
- onValueChange: (p) => {
7687
- c(""), i(p);
7682
+ onValueChange: (u) => {
7683
+ c(""), i(u);
7688
7684
  },
7689
7685
  value: l,
7690
7686
  className: cn("h-max"),
@@ -7969,7 +7965,7 @@ function QuickPrompts({ onClick: o }) {
7969
7965
  icon: FaLanguage$1,
7970
7966
  prompt: `Translate the content to ${get(LANGUAGES, a, a)}. Maintain same tone, style and length.`
7971
7967
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: n ? "pointer-events-none opacity-50" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-2", children: i.map(
7972
- ({ name: c, icon: d, subMenus: p, prompt: u }) => p ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [
7968
+ ({ name: c, icon: d, subMenus: u, prompt: p }) => u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [
7973
7969
  /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7974
7970
  "li",
7975
7971
  {
@@ -7985,7 +7981,7 @@ function QuickPrompts({ onClick: o }) {
7985
7981
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
7986
7982
  "li",
7987
7983
  {
7988
- onClick: () => o(u),
7984
+ onClick: () => o(p),
7989
7985
  className: "flex cursor-pointer items-center space-x-2 rounded p-1 text-sm hover:bg-gray-100 dark:hover:bg-gray-800",
7990
7986
  children: [
7991
7987
  /* @__PURE__ */ jsxRuntimeExports.jsx(d, { className: "h-4 w-4" }),
@@ -7997,20 +7993,20 @@ function QuickPrompts({ onClick: o }) {
7997
7993
  ) }) });
7998
7994
  }
7999
7995
  const AIUserPrompt = ({ blockId: o }) => {
8000
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, m] = useState(), x = useRef(null), g = useRef(null);
7996
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), g = useRef(null), x = useRef(null);
8001
7997
  useEffect(() => {
8002
- var b;
8003
- (b = x.current) == null || b.focus();
7998
+ var E;
7999
+ (E = g.current) == null || E.focus();
8004
8000
  }, []);
8005
- const E = (b) => {
8006
- const { usage: f } = b || {};
8007
- !l && f && m(f), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
8001
+ const j = (E) => {
8002
+ const { usage: b } = E || {};
8003
+ !l && b && m(b), x.current = setTimeout(() => m(void 0), 1e4), l || c("");
8008
8004
  };
8009
8005
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
8010
8006
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8011
8007
  "div",
8012
8008
  {
8013
- onClick: () => p(!d),
8009
+ onClick: () => u(!d),
8014
8010
  className: "flex cursor-pointer items-center justify-between border-b border-border py-2 text-sm font-bold text-muted-foreground hover:underline",
8015
8011
  children: [
8016
8012
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: n("Ask AI") }),
@@ -8022,14 +8018,14 @@ const AIUserPrompt = ({ blockId: o }) => {
8022
8018
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8023
8019
  Textarea,
8024
8020
  {
8025
- ref: x,
8021
+ ref: g,
8026
8022
  value: i,
8027
- onChange: (b) => c(b.target.value),
8023
+ onChange: (E) => c(E.target.value),
8028
8024
  placeholder: n("Ask AI to edit content"),
8029
8025
  className: "w-full",
8030
8026
  rows: 3,
8031
- onKeyDown: (b) => {
8032
- b.key === "Enter" && (b.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E));
8027
+ onKeyDown: (E) => {
8028
+ E.key === "Enter" && (E.preventDefault(), x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j));
8033
8029
  }
8034
8030
  }
8035
8031
  ),
@@ -8039,7 +8035,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8039
8035
  {
8040
8036
  disabled: i.trim().length < 5 || a,
8041
8037
  onClick: () => {
8042
- g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E);
8038
+ x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j);
8043
8039
  },
8044
8040
  variant: "default",
8045
8041
  className: "w-fit",
@@ -8058,11 +8054,11 @@ const AIUserPrompt = ({ blockId: o }) => {
8058
8054
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
8059
8055
  ] }) : null
8060
8056
  ] }),
8061
- u ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
8057
+ p ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
8062
8058
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
8063
8059
  n("Total tokens used"),
8064
8060
  ": ",
8065
- u.totalTokens
8061
+ p.totalTokens
8066
8062
  ] }),
8067
8063
  /* @__PURE__ */ jsxRuntimeExports.jsx(Countdown, {})
8068
8064
  ] }) }) : null,
@@ -8071,8 +8067,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8071
8067
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8072
8068
  QuickPrompts,
8073
8069
  {
8074
- onClick: (b) => {
8075
- g.current && clearTimeout(g.current), m(void 0), r("content", o, b, E);
8070
+ onClick: (E) => {
8071
+ x.current && clearTimeout(x.current), m(void 0), r("content", o, E, j);
8076
8072
  }
8077
8073
  }
8078
8074
  )
@@ -8082,19 +8078,19 @@ const AIUserPrompt = ({ blockId: o }) => {
8082
8078
  ] }) }) : null
8083
8079
  ] });
8084
8080
  }, AISetContext = () => {
8085
- const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, m] = useState(!1), { toast: x } = useToast(), g = useRef(null);
8081
+ const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, m] = useState(!1), { toast: g } = useToast(), x = useRef(null);
8086
8082
  useEffect(() => {
8087
8083
  n && a(n);
8088
8084
  }, [n]);
8089
- const E = async () => {
8085
+ const j = async () => {
8090
8086
  try {
8091
- d(!0), u(null), await i(r), x({
8087
+ d(!0), p(null), await i(r), g({
8092
8088
  title: o("Updated AI Context"),
8093
8089
  description: o("You can now Ask AI to edit your content"),
8094
8090
  variant: "default"
8095
- }), g.current.click();
8096
- } catch (b) {
8097
- u(b);
8091
+ }), x.current.click();
8092
+ } catch (E) {
8093
+ p(E);
8098
8094
  } finally {
8099
8095
  d(!1);
8100
8096
  }
@@ -8102,25 +8098,25 @@ const AIUserPrompt = ({ blockId: o }) => {
8102
8098
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
8103
8099
  Accordion,
8104
8100
  {
8105
- onValueChange: (b) => {
8106
- m(b !== "");
8101
+ onValueChange: (E) => {
8102
+ m(E !== "");
8107
8103
  },
8108
8104
  type: "single",
8109
8105
  collapsible: !0,
8110
8106
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
8111
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: g, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
8107
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: x, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
8112
8108
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
8113
8109
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8114
8110
  Textarea,
8115
8111
  {
8116
8112
  ref: l,
8117
8113
  value: r,
8118
- onChange: (b) => a(b.target.value),
8114
+ onChange: (E) => a(E.target.value),
8119
8115
  placeholder: o("Tell about this page eg this page is about"),
8120
8116
  className: "mt-1 w-full",
8121
8117
  rows: 10,
8122
- onKeyDown: (b) => {
8123
- b.key === "Enter" && (b.preventDefault(), E());
8118
+ onKeyDown: (E) => {
8119
+ E.key === "Enter" && (E.preventDefault(), j());
8124
8120
  }
8125
8121
  }
8126
8122
  ),
@@ -8132,7 +8128,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8132
8128
  Button,
8133
8129
  {
8134
8130
  disabled: r.trim().length < 5,
8135
- onClick: () => E(),
8131
+ onClick: () => j(),
8136
8132
  variant: "default",
8137
8133
  className: "w-fit",
8138
8134
  size: "sm",
@@ -8161,7 +8157,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8161
8157
  AlertDialogAction,
8162
8158
  {
8163
8159
  onClick: () => {
8164
- a(""), E();
8160
+ a(""), j();
8165
8161
  },
8166
8162
  children: o("Yes, Delete")
8167
8163
  }
@@ -8170,7 +8166,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8170
8166
  ] })
8171
8167
  ] }) : null
8172
8168
  ] }),
8173
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 max-w-full", children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500", children: p.message }) })
8169
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 max-w-full", children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500", children: u.message }) })
8174
8170
  ] })
8175
8171
  ] })
8176
8172
  }
@@ -8182,42 +8178,42 @@ const AIUserPrompt = ({ blockId: o }) => {
8182
8178
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
8183
8179
  ] });
8184
8180
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
8185
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, m] = useState(null), [x, g] = useState(""), E = useRef(null), b = useRef(null);
8181
+ const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [g, x] = useState(""), j = useRef(null), E = useRef(null);
8186
8182
  useEffect(() => {
8187
8183
  l(n);
8188
8184
  }, [n]);
8189
- const f = () => {
8185
+ const b = () => {
8190
8186
  if (i.startsWith("@")) {
8191
- g("Attribute keys cannot start with '@'");
8187
+ x("Attribute keys cannot start with '@'");
8192
8188
  return;
8193
8189
  }
8194
8190
  if (i) {
8195
8191
  const R = [...a, { key: i, value: d }];
8196
- r(R), l(a), c(""), p(""), g("");
8192
+ r(R), l(a), c(""), u(""), x("");
8197
8193
  }
8198
8194
  }, k = (R) => {
8199
- const A = a.filter((N, D) => D !== R);
8195
+ const A = a.filter((T, L) => L !== R);
8200
8196
  r(A), l(A);
8201
8197
  }, _ = (R) => {
8202
- m(R), c(a[R].key), p(a[R].value);
8203
- }, C = () => {
8198
+ m(R), c(a[R].key), u(a[R].value);
8199
+ }, S = () => {
8204
8200
  if (i.startsWith("@")) {
8205
- g("Attribute keys cannot start with '@'");
8201
+ x("Attribute keys cannot start with '@'");
8206
8202
  return;
8207
8203
  }
8208
- if (u !== null && i) {
8204
+ if (p !== null && i) {
8209
8205
  const R = [...a];
8210
- R[u] = { key: i, value: d }, r(R), l(R), m(null), c(""), p(""), g("");
8206
+ R[p] = { key: i, value: d }, r(R), l(R), m(null), c(""), u(""), x("");
8211
8207
  }
8212
8208
  }, B = (R) => {
8213
- R.key === "Enter" && !R.shiftKey && (R.preventDefault(), u !== null ? C() : f());
8209
+ R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? S() : b());
8214
8210
  };
8215
8211
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
8216
8212
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8217
8213
  "form",
8218
8214
  {
8219
8215
  onSubmit: (R) => {
8220
- R.preventDefault(), u !== null ? C() : f();
8216
+ R.preventDefault(), p !== null ? S() : b();
8221
8217
  },
8222
8218
  className: "space-y-3",
8223
8219
  children: [
@@ -8231,7 +8227,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8231
8227
  autoCorrect: "off",
8232
8228
  spellCheck: "false",
8233
8229
  id: "attrKey",
8234
- ref: E,
8230
+ ref: j,
8235
8231
  value: i,
8236
8232
  onChange: (R) => c(R.target.value),
8237
8233
  placeholder: "Key",
@@ -8249,9 +8245,9 @@ const AIUserPrompt = ({ blockId: o }) => {
8249
8245
  spellCheck: "false",
8250
8246
  id: "attrValue",
8251
8247
  rows: 2,
8252
- ref: b,
8248
+ ref: E,
8253
8249
  value: d,
8254
- onChange: (R) => p(R.target.value),
8250
+ onChange: (R) => u(R.target.value),
8255
8251
  onKeyDown: B,
8256
8252
  placeholder: "Value",
8257
8253
  className: "bg-background text-sm"
@@ -8259,8 +8255,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8259
8255
  )
8260
8256
  ] })
8261
8257
  ] }),
8262
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: u !== null ? "Save" : "Add" }),
8263
- x && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: x })
8258
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: p !== null ? "Save" : "Add" }),
8259
+ g && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: g })
8264
8260
  ]
8265
8261
  }
8266
8262
  ),
@@ -8284,15 +8280,15 @@ const AIUserPrompt = ({ blockId: o }) => {
8284
8280
  }), BlockAttributesEditor = React.memo(() => {
8285
8281
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
8286
8282
  React.useEffect(() => {
8287
- const d = map(get(o, i), (p, u) => ({ key: u, value: p }));
8283
+ const d = map(get(o, i), (u, p) => ({ key: p, value: u }));
8288
8284
  isEmpty(d) ? r([]) : r(d);
8289
8285
  }, [get(o, i)]);
8290
8286
  const c = React.useCallback(
8291
8287
  (d = []) => {
8292
- const p = {};
8293
- forEach(d, (u) => {
8294
- isEmpty(u.key) || set(p, u.key, u.value);
8295
- }), l([get(o, "_id")], { [i]: p });
8288
+ const u = {};
8289
+ forEach(d, (p) => {
8290
+ isEmpty(p.key) || set(u, p.key, p.value);
8291
+ }), l([get(o, "_id")], { [i]: u });
8296
8292
  },
8297
8293
  [o, l, i]
8298
8294
  );
@@ -8418,7 +8414,7 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
8418
8414
  ] });
8419
8415
  }, Breakpoints = () => {
8420
8416
  const [, o, n] = useCanvasWidth(), [r, a] = useSelectedBreakpoints(), { t: l } = useTranslation(), i = useBuilderProp("breakpoints", WEB_BREAKPOINTS), c = (d) => {
8421
- r.includes(d) ? r.length > 2 && a(r.filter((p) => p !== d)) : a((p) => [...p, d]);
8417
+ r.includes(d) ? r.length > 2 && a(r.filter((u) => u !== d)) : a((u) => [...u, d]);
8422
8418
  };
8423
8419
  return i.length < 4 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center rounded-md", children: map(i, (d) => /* @__PURE__ */ createElement(BreakpointCard, { ...d, onClick: n, key: d.breakpoint, currentBreakpoint: o })) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md", children: [
8424
8420
  map(
@@ -8468,8 +8464,8 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
8468
8464
  const { fallbackLang: o, languages: n, selectedLang: r, setSelectedLang: a } = useLanguages(), l = (r == null ? void 0 : r.length) > 0 ? r : o, i = useMemo(() => {
8469
8465
  const c = [];
8470
8466
  return forEach(uniq([o, ...n]), (d) => {
8471
- const p = get(LANGUAGES, d);
8472
- p && c.push({ key: d, value: p, default: d === o });
8467
+ const u = get(LANGUAGES, d);
8468
+ u && c.push({ key: d, value: u, default: d === o });
8473
8469
  }), c;
8474
8470
  }, [o, n]);
8475
8471
  return isEmpty(n) && l === "en" ? null : isEmpty(n) && l !== "en" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-1 text-sm text-blue-500 hover:text-blue-600", children: [
@@ -8736,16 +8732,16 @@ function RemoveProviderConfirmation({
8736
8732
  }
8737
8733
  const PageDataProviders = () => {
8738
8734
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8739
- filter(n, (f) => map(r, "providerKey").includes(f.providerKey))
8740
- ), [d, p] = useState(""), [u, m] = useState(null), x = filter(
8741
- n.map((f) => map(i, "providerKey").includes(f.providerKey) ? null : { value: f.providerKey, label: f.name }),
8742
- (f) => !isNull(f)
8743
- ), g = (f) => {
8744
- const k = find(n, { providerKey: f });
8745
- c((_) => [..._, k]), a((_) => [..._, { providerKey: k.providerKey, args: {} }]), p(""), l("UNSAVED");
8746
- }, E = (f) => {
8747
- c((k) => filter(k, (_) => _.providerKey !== f.providerKey)), a((k) => filter(k, (_) => _.providerKey !== f.providerKey)), l("UNSAVED");
8748
- }, b = (f) => m(f);
8735
+ filter(n, (b) => map(r, "providerKey").includes(b.providerKey))
8736
+ ), [d, u] = useState(""), [p, m] = useState(null), g = filter(
8737
+ n.map((b) => map(i, "providerKey").includes(b.providerKey) ? null : { value: b.providerKey, label: b.name }),
8738
+ (b) => !isNull(b)
8739
+ ), x = (b) => {
8740
+ const k = find(n, { providerKey: b });
8741
+ c((_) => [..._, k]), a((_) => [..._, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8742
+ }, j = (b) => {
8743
+ c((k) => filter(k, (_) => _.providerKey !== b.providerKey)), a((k) => filter(k, (_) => _.providerKey !== b.providerKey)), l("UNSAVED");
8744
+ }, E = (b) => m(b);
8749
8745
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8750
8746
  o("no_data_providers"),
8751
8747
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8753,11 +8749,11 @@ const PageDataProviders = () => {
8753
8749
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
8754
8750
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
8755
8751
  /* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
8756
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (f) => g(f), children: [
8752
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (b) => x(b), children: [
8757
8753
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
8758
8754
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
8759
8755
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
8760
- x.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: f.value, children: f.label }, f.value))
8756
+ g.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: b.value, children: b.label }, b.value))
8761
8757
  ] })
8762
8758
  ] }) }),
8763
8759
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8766,21 +8762,21 @@ const PageDataProviders = () => {
8766
8762
  o("page_data_providers"),
8767
8763
  ":"
8768
8764
  ] }),
8769
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
8765
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
8770
8766
  "div",
8771
8767
  {
8772
8768
  className: "w-full rounded-lg border border-border bg-card text-card-foreground shadow-sm",
8773
8769
  "data-v0-t": "card",
8774
8770
  children: [
8775
8771
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
8776
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: f.name }),
8777
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: f.description })
8772
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: b.name }),
8773
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: b.description })
8778
8774
  ] }) }) }),
8779
8775
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
8780
8776
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8781
8777
  "button",
8782
8778
  {
8783
- onClick: () => b(f),
8779
+ onClick: () => E(b),
8784
8780
  className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
8785
8781
  children: [
8786
8782
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -8806,7 +8802,7 @@ const PageDataProviders = () => {
8806
8802
  ]
8807
8803
  }
8808
8804
  ),
8809
- /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(f), name: f.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
8805
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => j(b), name: b.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
8810
8806
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8811
8807
  "svg",
8812
8808
  {
@@ -8832,16 +8828,16 @@ const PageDataProviders = () => {
8832
8828
  ] })
8833
8829
  ]
8834
8830
  },
8835
- f.providerKey
8831
+ b.providerKey
8836
8832
  )) }),
8837
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: u })
8833
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
8838
8834
  ] })
8839
8835
  ] });
8840
8836
  };
8841
8837
  function AiFillDatabase(o) {
8842
8838
  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);
8843
8839
  }
8844
- const TopBar = lazy(() => import("./Topbar-3h7dkWBH.js"));
8840
+ const TopBar = lazy(() => import("./Topbar-lJgYu8sz.js"));
8845
8841
  function useSidebarMenuItems(o) {
8846
8842
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8847
8843
  return useMemo(() => {
@@ -8868,15 +8864,15 @@ function isDualLayout(o) {
8868
8864
  }
8869
8865
  const RootLayout = () => {
8870
8866
  const [o, n] = useState(0), [r] = useLayoutVariant(), [a, l] = useState(!1);
8871
- useChaiBuilderMsgListener(({ name: g }) => {
8872
- g === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
8867
+ useChaiBuilderMsgListener(({ name: x }) => {
8868
+ x === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
8873
8869
  });
8874
- const i = useBuilderProp("sideBarComponents.top", []), c = (g) => {
8875
- g.preventDefault();
8876
- }, d = (g) => {
8877
- n(o === g ? null : g);
8878
- }, p = useSidebarMenuItems(r), { t: u } = useTranslation(), m = [...p, ...i], x = useBuilderProp("htmlDir", "ltr");
8879
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: x, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
8870
+ const i = useBuilderProp("sideBarComponents.top", []), c = (x) => {
8871
+ x.preventDefault();
8872
+ }, d = (x) => {
8873
+ n(o === x ? null : x);
8874
+ }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], g = useBuilderProp("htmlDir", "ltr");
8875
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: g, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
8880
8876
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8881
8877
  "div",
8882
8878
  {
@@ -8886,23 +8882,23 @@ const RootLayout = () => {
8886
8882
  /* @__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, {}) }) }),
8887
8883
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
8888
8884
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
8889
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8885
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((x, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8890
8886
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8891
8887
  Button,
8892
8888
  {
8893
- variant: o === E ? "default" : "ghost",
8889
+ variant: o === j ? "default" : "ghost",
8894
8890
  className: "mb-2 rounded-lg p-2 transition-colors",
8895
- onClick: () => d(E),
8896
- children: get(g, "icon", null)
8891
+ onClick: () => d(j),
8892
+ children: get(x, "icon", null)
8897
8893
  },
8898
- E
8894
+ j
8899
8895
  ) }),
8900
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: u(g.label) }) })
8901
- ] }, "button" + E)) }),
8896
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(x.label) }) })
8897
+ ] }, "button" + j)) }),
8902
8898
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
8903
8899
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8904
8900
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", onClick: () => l(!0), children: /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutTemplate, { size: 20 }) }) }),
8905
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: u("Choose Builder Layout") }) })
8901
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p("Choose Builder Layout") }) })
8906
8902
  ] }),
8907
8903
  /* @__PURE__ */ jsxRuntimeExports.jsx(HotKeys, {})
8908
8904
  ] })
@@ -8917,7 +8913,7 @@ const RootLayout = () => {
8917
8913
  children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-3", children: [
8918
8914
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
8919
8915
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
8920
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: u(m[o].label) })
8916
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
8921
8917
  ] }),
8922
8918
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(m, `${o}.component`, null), {}) }) })
8923
8919
  ] }) })
@@ -8937,7 +8933,7 @@ const RootLayout = () => {
8937
8933
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full max-h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-col p-3", children: [
8938
8934
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
8939
8935
  /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: "16", className: "rtl:ml-2" }),
8940
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: u("Block Settings") })
8936
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p("Block Settings") })
8941
8937
  ] }),
8942
8938
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsPanel$1, {}) }) })
8943
8939
  ] }) })