@chaibuilder/sdk 1.2.106 → 1.2.107

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,61 +89,61 @@ 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 = (b) => o.get(b), d = (b, k) => {
92
+ const c = (j) => o.get(j), d = (j, k) => {
93
93
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(k);
94
- const C = o.get(b);
95
- if (o.set(b, k), r.has(b) || r.set(b, C), C && hasPromiseAtomValue(C)) {
94
+ const w = o.get(j);
95
+ if (o.set(j, k), r.has(j) || r.set(j, w), w && hasPromiseAtomValue(w)) {
96
96
  const R = "v" in k ? k.v instanceof Promise ? k.v : Promise.resolve(k.v) : Promise.reject(k.e);
97
- cancelPromise(C.v, R);
97
+ cancelPromise(w.v, R);
98
98
  }
99
- }, u = (b, k, C) => {
99
+ }, p = (j, k, w) => {
100
100
  const R = /* @__PURE__ */ new Map();
101
- let I = !1;
102
- C.forEach((L, P) => {
103
- !L && P === b && (L = k), L ? (R.set(P, L), k.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
- }), (I || k.d.size !== R.size) && (k.d = R);
105
- }, p = (b, k, C) => {
106
- const R = c(b), I = {
101
+ let T = !1;
102
+ w.forEach((L, P) => {
103
+ !L && P === j && (L = k), L ? (R.set(P, L), k.d.get(P) !== L && (T = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
+ }), (T || k.d.size !== R.size) && (k.d = R);
105
+ }, u = (j, k, w) => {
106
+ const R = c(j), T = {
107
107
  d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
108
108
  v: k
109
109
  };
110
- if (C && u(b, I, C), R && isEqualAtomValue(R, I) && R.d === I.d)
110
+ if (w && p(j, T, w), R && isEqualAtomValue(R, T) && R.d === T.d)
111
111
  return R;
112
- if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(R, I)) {
113
- if (R.d === I.d)
112
+ if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(T) && isEqualPromiseAtomValue(R, T)) {
113
+ if (R.d === T.d)
114
114
  return R;
115
- I.v = R.v;
115
+ T.v = R.v;
116
116
  }
117
- return d(b, I), I;
118
- }, m = (b, k, C, R) => {
117
+ return d(j, T), T;
118
+ }, m = (j, k, w, R) => {
119
119
  if (isPromiseLike$2(k)) {
120
- let I;
120
+ let T;
121
121
  const L = new Promise((P, V) => {
122
122
  let M = !1;
123
123
  k.then(
124
124
  (O) => {
125
125
  if (!M) {
126
126
  M = !0;
127
- const $ = c(b), H = p(
128
- b,
127
+ const $ = c(j), H = u(
128
+ j,
129
129
  L,
130
- C
130
+ w
131
131
  );
132
- resolvePromise(L, O), P(O), ($ == null ? void 0 : $.d) !== H.d && N(b, H, $ == null ? void 0 : $.d);
132
+ resolvePromise(L, O), P(O), ($ == null ? void 0 : $.d) !== H.d && N(j, H, $ == null ? void 0 : $.d);
133
133
  }
134
134
  },
135
135
  (O) => {
136
136
  if (!M) {
137
137
  M = !0;
138
- const $ = c(b), H = p(
139
- b,
138
+ const $ = c(j), H = u(
139
+ j,
140
140
  L,
141
- C
141
+ w
142
142
  );
143
- rejectPromise(L, O), V(O), ($ == null ? void 0 : $.d) !== H.d && N(b, H, $ == null ? void 0 : $.d);
143
+ rejectPromise(L, O), V(O), ($ == null ? void 0 : $.d) !== H.d && N(j, H, $ == null ? void 0 : $.d);
144
144
  }
145
145
  }
146
- ), I = (O) => {
146
+ ), T = (O) => {
147
147
  M || (M = !0, O.then(
148
148
  ($) => resolvePromise(L, $),
149
149
  ($) => rejectPromise(L, $)
@@ -151,39 +151,39 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
151
151
  };
152
152
  });
153
153
  return L.orig = k, L.status = "pending", registerCancelPromise(L, (P) => {
154
- P && I(P), R == null || R();
155
- }), p(b, L, C);
154
+ P && T(P), R == null || R();
155
+ }), u(j, L, w);
156
156
  }
157
- return p(b, k, C);
158
- }, x = (b, k, C) => {
159
- const R = c(b), I = {
157
+ return u(j, k, w);
158
+ }, x = (j, k, w) => {
159
+ const R = c(j), T = {
160
160
  d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
161
161
  e: k
162
162
  };
163
- return C && u(b, I, C), R && isEqualAtomError(R, I) && R.d === I.d ? R : (d(b, I), I);
164
- }, g = (b) => {
165
- const k = c(b);
163
+ return w && p(j, T, w), R && isEqualAtomError(R, T) && R.d === T.d ? R : (d(j, T), T);
164
+ }, g = (j) => {
165
+ const k = c(j);
166
166
  if (k && (k.d.forEach((M, O) => {
167
- O !== b && !n.has(O) && g(O);
167
+ O !== j && !n.has(O) && g(O);
168
168
  }), Array.from(k.d).every(([M, O]) => {
169
169
  const $ = c(M);
170
- return M === b || $ === O || // TODO This is a hack, we should find a better solution.
170
+ return M === j || $ === O || // TODO This is a hack, we should find a better solution.
171
171
  $ && !hasPromiseAtomValue($) && isEqualAtomValue($, O);
172
172
  })))
173
173
  return k;
174
- const C = /* @__PURE__ */ new Map();
174
+ const w = /* @__PURE__ */ new Map();
175
175
  let R = !0;
176
- const I = (M) => {
177
- if (M === b) {
176
+ const T = (M) => {
177
+ if (M === j) {
178
178
  const $ = c(M);
179
179
  if ($)
180
- return C.set(M, $), returnAtomValue($);
180
+ return w.set(M, $), returnAtomValue($);
181
181
  if (hasInitialValue(M))
182
- return C.set(M, void 0), M.init;
182
+ return w.set(M, void 0), M.init;
183
183
  throw new Error("no atom init");
184
184
  }
185
185
  const O = g(M);
186
- return C.set(M, O), returnAtomValue(O);
186
+ return w.set(M, O), returnAtomValue(O);
187
187
  };
188
188
  let L, P;
189
189
  const V = {
@@ -191,49 +191,49 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
191
191
  return L || (L = new AbortController()), L.signal;
192
192
  },
193
193
  get setSelf() {
194
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(b) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(b) && (P = (...M) => {
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
195
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && R && console.warn("setSelf function cannot be called in sync"), !R)
196
- return B(b, ...M);
196
+ return B(j, ...M);
197
197
  }), P;
198
198
  }
199
199
  };
200
200
  try {
201
- const M = b.read(I, V);
201
+ const M = j.read(T, V);
202
202
  return m(
203
- b,
203
+ j,
204
204
  M,
205
- C,
205
+ w,
206
206
  () => L == null ? void 0 : L.abort()
207
207
  );
208
208
  } catch (M) {
209
- return x(b, M, C);
209
+ return x(j, M, w);
210
210
  } finally {
211
211
  R = !1;
212
212
  }
213
- }, E = (b) => returnAtomValue(g(b)), j = (b) => {
214
- let k = n.get(b);
215
- return k || (k = w(b)), k;
216
- }, f = (b, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(b)), _ = (b) => {
217
- const k = n.get(b);
218
- k && f(b, k) && A(b);
219
- }, v = (b) => {
220
- const k = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), R = (L) => {
213
+ }, E = (j) => returnAtomValue(g(j)), b = (j) => {
214
+ let k = n.get(j);
215
+ return k || (k = S(j)), k;
216
+ }, f = (j, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(j)), v = (j) => {
217
+ const k = n.get(j);
218
+ k && f(j, k) && A(j);
219
+ }, _ = (j) => {
220
+ const k = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), R = (L) => {
221
221
  const P = n.get(L);
222
222
  P == null || P.t.forEach((V) => {
223
223
  V !== L && (k.set(
224
224
  V,
225
225
  (k.get(V) || /* @__PURE__ */ new Set()).add(L)
226
- ), C.set(V, (C.get(V) || 0) + 1), R(V));
226
+ ), w.set(V, (w.get(V) || 0) + 1), R(V));
227
227
  });
228
228
  };
229
- R(b);
230
- const I = (L) => {
229
+ R(j);
230
+ const T = (L) => {
231
231
  const P = n.get(L);
232
232
  P == null || P.t.forEach((V) => {
233
233
  var M;
234
234
  if (V !== L) {
235
- let O = C.get(V);
236
- if (O && C.set(V, --O), !O) {
235
+ let O = w.get(V);
236
+ if (O && w.set(V, --O), !O) {
237
237
  let $ = !!((M = k.get(V)) != null && M.size);
238
238
  if ($) {
239
239
  const H = c(V), F = g(V);
@@ -241,126 +241,126 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
241
241
  }
242
242
  $ || k.forEach((H) => H.delete(V));
243
243
  }
244
- I(V);
244
+ T(V);
245
245
  }
246
246
  });
247
247
  };
248
- I(b);
249
- }, S = (b, ...k) => {
250
- let C = !0;
251
- const R = (P) => returnAtomValue(g(P)), I = (P, ...V) => {
248
+ T(j);
249
+ }, C = (j, ...k) => {
250
+ let w = !0;
251
+ const R = (P) => returnAtomValue(g(P)), T = (P, ...V) => {
252
252
  let M;
253
- if (P === b) {
253
+ if (P === j) {
254
254
  if (!hasInitialValue(P))
255
255
  throw new Error("atom not writable");
256
256
  const O = c(P), $ = m(P, V[0]);
257
- (!O || !isEqualAtomValue(O, $)) && v(P);
257
+ (!O || !isEqualAtomValue(O, $)) && _(P);
258
258
  } else
259
- M = S(P, ...V);
260
- if (!C) {
259
+ M = C(P, ...V);
260
+ if (!w) {
261
261
  const O = D();
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 = b.write(R, I, ...k);
268
- return C = !1, L;
269
- }, B = (b, ...k) => {
270
- const C = S(b, ...k), R = D();
267
+ }, L = j.write(R, T, ...k);
268
+ return w = !1, L;
269
+ }, B = (j, ...k) => {
270
+ const w = C(j, ...k), R = D();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
- (I) => I({ type: "write", flushed: R })
273
- ), C;
274
- }, w = (b, k) => {
275
- const C = {
272
+ (T) => T({ type: "write", flushed: R })
273
+ ), w;
274
+ }, S = (j, k) => {
275
+ const w = {
276
276
  t: new Set(k && [k]),
277
277
  l: /* @__PURE__ */ new Set()
278
278
  };
279
- if (n.set(b, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b), g(b).d.forEach((R, I) => {
280
- const L = n.get(I);
281
- L ? L.t.add(b) : I !== b && w(I, b);
282
- }), g(b), isActuallyWritableAtom(b) && b.onMount) {
283
- const R = b.onMount((...I) => B(b, ...I));
284
- R && (C.u = R);
279
+ if (n.set(j, w), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(j), g(j).d.forEach((R, T) => {
280
+ const L = n.get(T);
281
+ L ? L.t.add(j) : T !== j && S(T, j);
282
+ }), g(j), isActuallyWritableAtom(j) && j.onMount) {
283
+ const R = j.onMount((...T) => B(j, ...T));
284
+ R && (w.u = R);
285
285
  }
286
- return C;
287
- }, A = (b) => {
286
+ return w;
287
+ }, A = (j) => {
288
288
  var k;
289
- const C = (k = n.get(b)) == null ? void 0 : k.u;
290
- C && C(), n.delete(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(b);
291
- const R = c(b);
292
- R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((I, L) => {
293
- if (L !== b) {
289
+ const w = (k = n.get(j)) == null ? void 0 : k.u;
290
+ w && w(), n.delete(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(j);
291
+ const R = c(j);
292
+ R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((T, L) => {
293
+ if (L !== j) {
294
294
  const P = n.get(L);
295
- P && (P.t.delete(b), f(L, P) && A(L));
295
+ P && (P.t.delete(j), f(L, P) && A(L));
296
296
  }
297
- })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", b);
298
- }, N = (b, k, C) => {
297
+ })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", j);
298
+ }, N = (j, k, w) => {
299
299
  const R = new Set(k.d.keys());
300
- C == null || C.forEach((I, L) => {
300
+ w == null || w.forEach((T, L) => {
301
301
  if (R.has(L)) {
302
302
  R.delete(L);
303
303
  return;
304
304
  }
305
305
  const P = n.get(L);
306
- P && (P.t.delete(b), f(L, P) && A(L));
307
- }), R.forEach((I) => {
308
- const L = n.get(I);
309
- L ? L.t.add(b) : n.has(b) && w(I, b);
306
+ P && (P.t.delete(j), f(L, P) && A(L));
307
+ }), R.forEach((T) => {
308
+ const L = n.get(T);
309
+ L ? L.t.add(j) : n.has(j) && S(T, j);
310
310
  });
311
311
  }, D = () => {
312
- let b;
313
- for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (b = /* @__PURE__ */ new Set()); r.size; ) {
312
+ let j;
313
+ for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (j = /* @__PURE__ */ new Set()); r.size; ) {
314
314
  const k = Array.from(r);
315
- r.clear(), k.forEach(([C, R]) => {
316
- const I = c(C);
317
- if (I) {
318
- I.d !== (R == null ? void 0 : R.d) && N(C, I, R == null ? void 0 : R.d);
319
- const L = n.get(C);
315
+ r.clear(), k.forEach(([w, R]) => {
316
+ const T = c(w);
317
+ if (T) {
318
+ T.d !== (R == null ? void 0 : R.d) && N(w, T, R == null ? void 0 : R.d);
319
+ const L = n.get(w);
320
320
  L && !// TODO This seems pretty hacky. Hope to fix it.
321
321
  // Maybe we could `mountDependencies` in `setAtomState`?
322
- (R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, I) || isEqualAtomError(R, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && b.add(C));
322
+ (R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, T) || isEqualAtomError(R, T))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && j.add(w));
323
323
  } else
324
324
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
325
325
  });
326
326
  }
327
327
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
328
- return a.forEach((k) => k("state")), b;
329
- }, T = (b, k) => {
330
- const C = j(b), R = D(), I = C.l;
331
- return I.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
328
+ return a.forEach((k) => k("state")), j;
329
+ }, I = (j, k) => {
330
+ const w = b(j), R = D(), T = w.l;
331
+ return T.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
332
332
  (L) => L({ type: "sub", flushed: R })
333
333
  )), () => {
334
- I.delete(k), _(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
334
+ T.delete(k), v(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
335
335
  };
336
336
  };
337
337
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
338
338
  get: E,
339
339
  set: B,
340
- sub: T,
340
+ sub: I,
341
341
  // store dev methods (these are tentative and subject to change without notice)
342
- dev_subscribe_store: (b, k) => k !== 2 ? (console.warn(
342
+ dev_subscribe_store: (j, k) => k !== 2 ? (console.warn(
343
343
  "The current StoreListener revision is 2. The older ones are deprecated."
344
- ), a.add(b), () => {
345
- a.delete(b);
346
- }) : (l.add(b), () => {
347
- l.delete(b);
344
+ ), a.add(j), () => {
345
+ a.delete(j);
346
+ }) : (l.add(j), () => {
347
+ l.delete(j);
348
348
  }),
349
349
  dev_get_mounted_atoms: () => i.values(),
350
- dev_get_atom_state: (b) => o.get(b),
351
- dev_get_mounted: (b) => n.get(b),
352
- dev_restore_atoms: (b) => {
353
- for (const [C, R] of b)
354
- hasInitialValue(C) && (m(C, R), v(C));
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, R] of j)
354
+ hasInitialValue(w) && (m(w, R), _(w));
355
355
  const k = D();
356
356
  l.forEach(
357
- (C) => C({ type: "restore", flushed: k })
357
+ (w) => w({ type: "restore", flushed: k })
358
358
  );
359
359
  }
360
360
  } : {
361
361
  get: E,
362
362
  set: B,
363
- sub: T
363
+ sub: I
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 u = r.get(c);
378
- if (u)
379
- return u;
380
- const p = d && r.get(d), m = [], x = [];
377
+ let p = r.get(c);
378
+ if (p)
379
+ return p;
380
+ const u = d && r.get(d), m = [], x = [];
381
381
  return c.forEach((g, E) => {
382
- const j = n ? n(g) : E;
383
- x[E] = j;
384
- const f = p && p.atomList[p.keyList.indexOf(j)];
382
+ const b = n ? n(g) : E;
383
+ x[E] = b;
384
+ const f = u && u.atomList[u.keyList.indexOf(b)];
385
385
  if (f) {
386
386
  m[E] = f;
387
387
  return;
388
388
  }
389
- const _ = (S) => {
390
- const B = S(l), w = S(o), N = a(w, B == null ? void 0 : B.arr).keyList.indexOf(j);
391
- if (N < 0 || N >= w.length) {
392
- const D = c[a(c).keyList.indexOf(j)];
389
+ const v = (C) => {
390
+ const B = C(l), S = C(o), N = a(S, B == null ? void 0 : B.arr).keyList.indexOf(b);
391
+ if (N < 0 || N >= S.length) {
392
+ const D = c[a(c).keyList.indexOf(b)];
393
393
  if (D)
394
394
  return D;
395
395
  throw new Error("splitAtom: index out of bounds for read");
396
396
  }
397
- return w[N];
398
- }, v = (S, B, w) => {
399
- const A = S(l), N = S(o), T = a(N, A == null ? void 0 : A.arr).keyList.indexOf(j);
400
- if (T < 0 || T >= N.length)
397
+ return S[N];
398
+ }, _ = (C, B, S) => {
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)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const b = isFunction(w) ? w(N[T]) : w;
402
+ const j = isFunction(S) ? S(N[I]) : S;
403
403
  B(o, [
404
- ...N.slice(0, T),
405
- b,
406
- ...N.slice(T + 1)
404
+ ...N.slice(0, I),
405
+ j,
406
+ ...N.slice(I + 1)
407
407
  ]);
408
408
  };
409
- m[E] = isWritable(o) ? atom(_, v) : atom(_);
410
- }), p && p.keyList.length === x.length && p.keyList.every((g, E) => g === x[E]) ? u = p : u = { arr: c, atomList: m, keyList: x }, r.set(c, u), u;
409
+ m[E] = isWritable(o) ? atom(v, _) : atom(v);
410
+ }), u && u.keyList.length === x.length && u.keyList.every((g, E) => g === x[E]) ? p = u : p = { arr: c, atomList: m, keyList: x }, r.set(c, p), p;
411
411
  }, l = atom((c) => {
412
- const d = c(l), u = c(o);
413
- return a(u, d == null ? void 0 : d.arr);
412
+ const d = c(l), p = c(o);
413
+ return a(p, 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, u) => {
419
- switch (u.type) {
418
+ (c, d, p) => {
419
+ switch (p.type) {
420
420
  case "remove": {
421
- const p = c(i).indexOf(u.atom);
422
- if (p >= 0) {
421
+ const u = c(i).indexOf(p.atom);
422
+ if (u >= 0) {
423
423
  const m = c(o);
424
424
  d(o, [
425
- ...m.slice(0, p),
426
- ...m.slice(p + 1)
425
+ ...m.slice(0, u),
426
+ ...m.slice(u + 1)
427
427
  ]);
428
428
  }
429
429
  break;
430
430
  }
431
431
  case "insert": {
432
- const p = u.before ? c(i).indexOf(u.before) : c(i).length;
433
- if (p >= 0) {
432
+ const u = p.before ? c(i).indexOf(p.before) : c(i).length;
433
+ if (u >= 0) {
434
434
  const m = c(o);
435
435
  d(o, [
436
- ...m.slice(0, p),
437
- u.value,
438
- ...m.slice(p)
436
+ ...m.slice(0, u),
437
+ p.value,
438
+ ...m.slice(u)
439
439
  ]);
440
440
  }
441
441
  break;
442
442
  }
443
443
  case "move": {
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) {
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
446
  const x = c(o);
447
- p < m ? d(o, [
448
- ...x.slice(0, p),
449
- ...x.slice(p + 1, m),
450
- x[p],
447
+ u < m ? d(o, [
448
+ ...x.slice(0, u),
449
+ ...x.slice(u + 1, m),
450
+ x[u],
451
451
  ...x.slice(m)
452
452
  ]) : d(o, [
453
453
  ...x.slice(0, m),
454
- x[p],
455
- ...x.slice(m, p),
456
- ...x.slice(p + 1)
454
+ x[u],
455
+ ...x.slice(m, u),
456
+ ...x.slice(u + 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 u = (m) => {
476
+ const p = (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
- }, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
487
- return isPromiseLike$1(p) ? p.then(u) : u(p);
486
+ }, u = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
487
+ return isPromiseLike$1(u) ? u.then(p) : p(u);
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 = (u) => {
503
- if (u.storageArea === o() && u.key === l) {
504
- let p;
502
+ const d = (p) => {
503
+ if (p.storageArea === o() && p.key === l) {
504
+ let u;
505
505
  try {
506
- p = JSON.parse(u.newValue || "");
506
+ u = JSON.parse(p.newValue || "");
507
507
  } catch {
508
- p = c;
508
+ u = c;
509
509
  }
510
- i(p);
510
+ i(u);
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 u;
528
- return r.subscribe && (u = r.subscribe(o, d, n)), u;
527
+ let p;
528
+ return r.subscribe && (p = r.subscribe(o, d, n)), p;
529
529
  }, atom(
530
530
  (d) => d(i),
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((x) => (u(i, x), r.setItem(o, x))) : (u(i, m), r.setItem(o, m));
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));
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
- (p) => {
557
+ (u) => {
558
558
  const m = r.get(o);
559
- return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
559
+ return Object.is(u[0], m) && u[1] === r && u[2] === o ? u : [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 u = n == null ? void 0 : n.delay;
566
+ const p = n == null ? void 0 : n.delay;
567
567
  return useEffect(() => {
568
- const p = r.sub(o, () => {
569
- if (typeof u == "number") {
570
- setTimeout(c, u);
568
+ const u = r.sub(o, () => {
569
+ if (typeof p == "number") {
570
+ setTimeout(c, p);
571
571
  return;
572
572
  }
573
573
  c();
574
574
  });
575
- return c(), p;
576
- }, [r, o, u]), useDebugValue(d), isPromiseLike(d) ? use(d) : d;
575
+ return c(), u;
576
+ }, [r, o, p]), 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, 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}`;
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}`;
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 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;
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;
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((p) => {
759
- const m = a[p];
758
+ return Object.keys(a).forEach((u) => {
759
+ const m = a[u];
760
760
  if (includes(["slot", "styles"], m.type))
761
761
  return;
762
- const x = p;
762
+ const x = u;
763
763
  i.properties[x] = getBlockJSONFromSchemas(m, n, r);
764
764
  }), i;
765
765
  case "list":
766
- const { itemProperties: c, title: d } = o, u = {
766
+ const { itemProperties: c, title: d } = o, p = {
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((p) => {
775
- const m = c[p];
774
+ return Object.keys(c).forEach((u) => {
775
+ const m = c[u];
776
776
  if (includes(["slot", "styles"], m.type))
777
777
  return;
778
- const x = p;
779
- u.items.properties[x] = getBlockJSONFromSchemas(m, n, r), set(
780
- u.items,
778
+ const x = u;
779
+ p.items.properties[x] = getBlockJSONFromSchemas(m, n, r), set(
780
+ p.items,
781
781
  "title",
782
782
  titleWithLang(get(m, "itemTitle", `${n(d)} item`), r, get(m, "i18n"))
783
783
  );
784
- }), u;
784
+ }), p;
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 u(p, m) {
837
- return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
836
+ function p(u, m) {
837
+ return !u || typeof u[m] != "function" ? this : (c = !0, u[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(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);
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);
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(p) {
855
- d = p;
854
+ setCallback: function(u) {
855
+ d = u;
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 p = a[l];
862
- if (!p)
861
+ let u = a[l];
862
+ if (!u)
863
863
  return this;
864
- const m = p.groupId;
865
- for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
864
+ const m = u.groupId;
865
+ for (; u.groupId === m && (p(u, "undo"), l -= 1, u = a[l], !(!u || !u.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 p = a[l + 1];
874
- if (!p)
873
+ let u = a[l + 1];
874
+ if (!u)
875
875
  return this;
876
- const m = p.groupId;
877
- for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
876
+ const m = u.groupId;
877
+ for (; u.groupId === m && (p(u, "redo"), l += 1, u = a[l + 1], !(!u || !u.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 p = a.length;
886
- a = [], l = -1, d && p > 0 && d();
885
+ let u = a.length;
886
+ a = [], l = -1, d && u > 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(p) {
908
- return p ? a.filter((m) => m.groupId === p) : a;
907
+ getCommands: function(u) {
908
+ return u ? a.filter((m) => m.groupId === u) : 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(p) {
922
- i = p;
921
+ setLimit: function(u) {
922
+ i = u;
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 (u) => {
1066
+ const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (p) => {
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 u = l();
1072
- return await r({ blocks: u.blocks, providers: i, brandingOptions: c, themeConfiguration: c }), setTimeout(() => {
1071
+ const p = l();
1072
+ return await r({ blocks: p.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, u = 0; d < o.length; d++)
1115
+ for (let d = 0, p = 0; d < o.length; d++)
1116
1116
  if (o[d]._parent === r) {
1117
- if (u === i) {
1117
+ if (p === i) {
1118
1118
  c = d;
1119
1119
  break;
1120
1120
  }
1121
- u++;
1121
+ p++;
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((u) => u._id === n);
1151
+ const c = flattenTree(i), d = c.find((p) => p._id === n);
1152
1152
  return d && (d._parent = r === "root" ? null : r), c.shift(), c;
1153
1153
  }
1154
1154
  return o;
@@ -1195,65 +1195,65 @@ const useBlocksStoreManager = () => {
1195
1195
  updateBlocksProps: c
1196
1196
  } = useBlocksStoreManager();
1197
1197
  return {
1198
- moveBlocks: (j, f, _) => {
1199
- const v = map(j, (B) => {
1200
- const A = n.find((T) => T._id === B)._parent || null, D = n.filter((T) => A ? T._parent === A : !T._parent).map((T) => T._id).indexOf(B);
1198
+ moveBlocks: (b, f, v) => {
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
1201
  return { _id: B, oldParent: A, oldPosition: D };
1202
- }), S = v.find(({ _id: B }) => B === j[0]);
1203
- S && S.oldParent === f && S.oldPosition === _ || (i(j, f, _), o({
1204
- undo: () => each(v, ({ _id: B, oldParent: w, oldPosition: A }) => {
1205
- i([B], w, A);
1202
+ }), C = _.find(({ _id: B }) => B === b[0]);
1203
+ C && C.oldParent === f && C.oldPosition === v || (i(b, f, v), o({
1204
+ undo: () => each(_, ({ _id: B, oldParent: S, oldPosition: A }) => {
1205
+ i([B], S, A);
1206
1206
  }),
1207
- redo: () => i(j, f, _)
1207
+ redo: () => i(b, f, v)
1208
1208
  }));
1209
1209
  },
1210
- addBlocks: (j, f, _) => {
1211
- a(j, f, _), o({
1212
- undo: () => l(map(j, "_id")),
1213
- redo: () => a(j, f, _)
1210
+ addBlocks: (b, f, v) => {
1211
+ a(b, f, v), o({
1212
+ undo: () => l(map(b, "_id")),
1213
+ redo: () => a(b, f, v)
1214
1214
  });
1215
1215
  },
1216
- removeBlocks: (j) => {
1217
- var S;
1218
- const f = (S = first(j)) == null ? void 0 : S._parent, v = n.filter((B) => f ? B._parent === f : !B._parent).indexOf(first(j));
1219
- l(map(j, "_id")), o({
1220
- undo: () => a(j, f, v),
1221
- redo: () => l(map(j, "_id"))
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"))
1222
1222
  });
1223
1223
  },
1224
- updateBlocks: (j, f, _) => {
1225
- let v = [];
1226
- if (_)
1227
- v = map(j, (S) => ({ _id: S, ..._ }));
1224
+ updateBlocks: (b, f, v) => {
1225
+ let _ = [];
1226
+ if (v)
1227
+ _ = map(b, (C) => ({ _id: C, ...v }));
1228
1228
  else {
1229
- const S = keys(f);
1230
- v = map(j, (B) => {
1231
- const w = n.find((N) => N._id === B), A = { _id: B };
1232
- return each(S, (N) => A[N] = w[N]), A;
1229
+ const C = keys(f);
1230
+ _ = map(b, (B) => {
1231
+ const S = n.find((N) => N._id === B), A = { _id: B };
1232
+ return each(C, (N) => A[N] = S[N]), A;
1233
1233
  });
1234
1234
  }
1235
- c(map(j, (S) => ({ _id: S, ...f }))), o({
1236
- undo: () => c(v),
1237
- redo: () => c(map(j, (S) => ({ _id: S, ...f })))
1235
+ c(map(b, (C) => ({ _id: C, ...f }))), o({
1236
+ undo: () => c(_),
1237
+ redo: () => c(map(b, (C) => ({ _id: C, ...f })))
1238
1238
  });
1239
1239
  },
1240
- updateBlocksRuntime: (j, f) => {
1241
- c(map(j, (_) => ({ _id: _, ...f })));
1240
+ updateBlocksRuntime: (b, f) => {
1241
+ c(map(b, (v) => ({ _id: v, ...f })));
1242
1242
  },
1243
- setNewBlocks: (j) => {
1244
- r(j), o({
1243
+ setNewBlocks: (b) => {
1244
+ r(b), o({
1245
1245
  undo: () => r(n),
1246
- redo: () => r(j)
1246
+ redo: () => r(b)
1247
1247
  });
1248
1248
  },
1249
- updateMultipleBlocksProps: (j) => {
1249
+ updateMultipleBlocksProps: (b) => {
1250
1250
  let f = [];
1251
- f = map(j, (_) => {
1252
- const v = keys(_), S = n.find((w) => w._id === _._id), B = {};
1253
- return each(v, (w) => B[w] = S[w]), B;
1254
- }), c(j), o({
1251
+ f = map(b, (v) => {
1252
+ const _ = keys(v), C = n.find((S) => S._id === v._id), B = {};
1253
+ return each(_, (S) => B[S] = C[S]), B;
1254
+ }), c(b), o({
1255
1255
  undo: () => c(f),
1256
- redo: () => c(j)
1256
+ redo: () => c(b)
1257
1257
  });
1258
1258
  }
1259
1259
  };
@@ -1262,42 +1262,42 @@ const useBlocksStoreManager = () => {
1262
1262
  (i, c, d) => {
1263
1263
  var g;
1264
1264
  for (let E = 0; E < i.length; E++) {
1265
- const { _id: j } = i[E];
1265
+ const { _id: b } = i[E];
1266
1266
  i[E]._id = generateUUID();
1267
- const f = filter(i, { _parent: j });
1268
- for (let _ = 0; _ < f.length; _++)
1269
- f[_]._parent = i[E]._id;
1267
+ const f = filter(i, { _parent: b });
1268
+ for (let v = 0; v < f.length; v++)
1269
+ f[v]._parent = i[E]._id;
1270
1270
  }
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([(g = first(i)) == null ? void 0 : g._id]), first(i);
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);
1274
1274
  },
1275
1275
  [o, n]
1276
1276
  );
1277
1277
  return { addCoreBlock: useCallback(
1278
1278
  (i, c, d) => {
1279
1279
  if (has(i, "blocks")) {
1280
- const _ = i.blocks;
1281
- return a(_, c, d);
1280
+ const v = i.blocks;
1281
+ return a(v, c, d);
1282
1282
  }
1283
- const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
1284
- forIn(p, (_, v) => {
1285
- if (startsWith(_, SLOT_KEY)) {
1286
- const S = _.replace(SLOT_KEY, "");
1283
+ const p = generateUUID(), u = getBlockDefaultProps(i.props), m = [];
1284
+ forIn(u, (v, _) => {
1285
+ if (startsWith(v, SLOT_KEY)) {
1286
+ const C = v.replace(SLOT_KEY, "");
1287
1287
  m.push({
1288
- _id: S,
1288
+ _id: C,
1289
1289
  _type: "Slot",
1290
- _parent: u,
1291
- _name: i.props[v].name,
1292
- _styles: i.props[v].styles,
1293
- _emptyStyles: i.props[v].emptyStyles
1290
+ _parent: p,
1291
+ _name: i.props[_].name,
1292
+ _styles: i.props[_].styles,
1293
+ _emptyStyles: i.props[_].emptyStyles
1294
1294
  });
1295
1295
  }
1296
1296
  });
1297
1297
  const x = {
1298
1298
  _type: i.type,
1299
- _id: u,
1300
- ...p
1299
+ _id: p,
1300
+ ...u
1301
1301
  };
1302
1302
  let g, E;
1303
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);
@@ -2402,15 +2402,15 @@ function getNewClasses(o = "", n = "", r = []) {
2402
2402
  o = o.trim().replace(/ +/g, "");
2403
2403
  let a = filter(
2404
2404
  map(o.split(" "), constructClassObject),
2405
- (p) => !isNull(p)
2406
- ), l = filter(map(n.split(" "), constructClassObject), (p) => !isNull(p));
2405
+ (u) => !isNull(u)
2406
+ ), l = filter(map(n.split(" "), constructClassObject), (u) => !isNull(u));
2407
2407
  l = filter(
2408
2408
  l,
2409
- (p) => !includes(IGNORED_BASES_CLASSES_PROPERTIES, p.property)
2409
+ (u) => !includes(IGNORED_BASES_CLASSES_PROPERTIES, u.property)
2410
2410
  );
2411
2411
  const i = [], c = [];
2412
- each(r, (p) => {
2413
- const m = constructClassObject(p), x = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2412
+ each(r, (u) => {
2413
+ const m = constructClassObject(u), x = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2414
2414
  if (x && (a = filter(
2415
2415
  a,
2416
2416
  (g) => g.fullCls !== (x == null ? void 0 : x.fullCls)
@@ -2427,11 +2427,11 @@ function getNewClasses(o = "", n = "", r = []) {
2427
2427
  }
2428
2428
  });
2429
2429
  const d = map(
2430
- sortBy([...a, ...i], (p) => MEDIA_QUERIES[p.mq]),
2430
+ sortBy([...a, ...i], (u) => MEDIA_QUERIES[u.mq]),
2431
2431
  "fullCls"
2432
2432
  ).join(" ");
2433
2433
  return `${map(
2434
- sortBy([...l, ...c], (p) => MEDIA_QUERIES[p.mq]),
2434
+ sortBy([...l, ...c], (u) => MEDIA_QUERIES[u.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), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
2452
+ const d = o(c), p = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: u, classes: m } = getSplitClasses$1(p);
2453
2453
  return {
2454
2454
  ids: [d._id],
2455
- props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
2455
+ props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, u, a)}` }
2456
2456
  };
2457
2457
  });
2458
2458
  }), useAddClassesToBlocks = () => {
@@ -2548,8 +2548,8 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2548
2548
  ),
2549
2549
  pasteBlocks: useCallback(
2550
2550
  (d) => {
2551
- const u = Array.isArray(d) ? d[0] : d;
2552
- isEmpty(o) ? l(n, d) : a(o, u), r([]);
2551
+ const p = Array.isArray(d) ? d[0] : d;
2552
+ isEmpty(o) ? l(n, d) : a(o, p), 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), u = a;
2573
- let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2574
- return each(u, (x) => {
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
2575
  const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${g}($| )`, "g");
2576
- p = p.replace(E, " ").replace(/ +/g, " ").trim();
2577
- const j = first(x.split(":"));
2578
- includes(["2xl", "xl", "lg", "md", "sm"], j) && u.push(x.split(":").pop().trim());
2579
- }), each(u, (x) => {
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
2580
  const g = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2581
2581
  m = m.replace(g, " ").replace(/ +/g, " ").trim();
2582
2582
  }), {
2583
2583
  ids: [d._id],
2584
2584
  props: {
2585
- [l.prop]: `${STYLES_KEY}${m},${p}`
2585
+ [l.prop]: `${STYLES_KEY}${m},${u}`
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 u = "";
2683
+ let p = "";
2684
2684
  o([n], { [i]: "" });
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));
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));
2687
2687
  }
2688
2688
  }
2689
2689
  },
@@ -2748,7 +2748,19 @@ const xShowBlocksAtom = atom$1([]);
2748
2748
  xShowBlocksAtom.debugLabel = "xShowBlocksAtom";
2749
2749
  const selectedLibraryAtom = atomWithStorage("_selectedLibrary", null);
2750
2750
  selectedLibraryAtom.debugLabel = "selectedLibraryAtom";
2751
- const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}), useGlobalBlocksStore = () => {
2751
+ let lastHighlighted$1 = null;
2752
+ const useBlockHighlight = () => {
2753
+ const [o] = useAtom$1(canvasIframeAtom);
2754
+ return { highlightBlock: (a) => {
2755
+ var c;
2756
+ const l = o.contentDocument || ((c = o.contentWindow) == null ? void 0 : c.document);
2757
+ lastHighlighted$1 && lastHighlighted$1.removeAttribute("data-highlighted");
2758
+ const i = l.querySelector(`[data-block-id="${a}"]`);
2759
+ i ? (i.setAttribute("data-highlighted", "true"), lastHighlighted$1 = i) : lastHighlighted$1 = null;
2760
+ }, clearHighlight: () => {
2761
+ lastHighlighted$1 && (lastHighlighted$1.removeAttribute("data-highlighted"), lastHighlighted$1 = null);
2762
+ } };
2763
+ }, globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}), useGlobalBlocksStore = () => {
2752
2764
  const [o, n] = useAtom(globalBlocksStoreAtom), r = useCallback(
2753
2765
  (l) => get(o, l == null ? void 0 : l.globalBlock, []),
2754
2766
  [o]
@@ -2757,18 +2769,18 @@ const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}),
2757
2769
  }, [n]);
2758
2770
  return { getGlobalBlocks: r, reset: a };
2759
2771
  }, useWatchGlobalBlocks = () => {
2760
- 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]);
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]);
2761
2773
  useEffect(() => {
2762
2774
  forEach(c, (d) => {
2763
- has(n, d) || get(a, `${d}.loading`, !1) || (l((u) => ({ ...u, [d]: { loading: !0, error: null } })), i(d).then((u) => {
2764
- r((p) => ({ ...p, [d]: u })), l((p) => ({
2765
- ...p,
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,
2766
2778
  [d]: { loading: !1, error: null }
2767
2779
  }));
2768
- }).catch((u) => {
2769
- l((p) => ({
2770
- ...p,
2771
- [d]: { loading: !1, error: u.message }
2780
+ }).catch((p) => {
2781
+ l((u) => ({
2782
+ ...u,
2783
+ [d]: { loading: !1, error: p.message }
2772
2784
  }));
2773
2785
  }));
2774
2786
  });
@@ -2790,9 +2802,9 @@ const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}),
2790
2802
  i();
2791
2803
  }, []), { data: r, isLoading: o, refetch: i };
2792
2804
  }, useBuilderReset = () => {
2793
- const o = useSetAtom$1(historyStatesAtom), { clear: n } = useUndoManager(), [, r] = useSelectedBlockIds(), [, a] = useHighlightBlockId(), [, l] = useSelectedStylingBlocks(), [, i] = useAtom(aiAssistantActiveAtom), { reset: c } = useGlobalBlocksStore();
2805
+ const o = useSetAtom$1(historyStatesAtom), { clear: n } = useUndoManager(), [, r] = useSelectedBlockIds(), { clearHighlight: a } = useBlockHighlight(), [, l] = useSelectedStylingBlocks(), [, i] = useAtom(aiAssistantActiveAtom), { reset: c } = useGlobalBlocksStore();
2794
2806
  return () => {
2795
- r([]), l([]), a(""), n(), i(!1), o({ undoCount: 0, redoCount: 0 }), c();
2807
+ r([]), l([]), a(), n(), i(!1), o({ undoCount: 0, redoCount: 0 }), c();
2796
2808
  };
2797
2809
  }, useUILibraryBlocks = () => ({ data: useBuilderProp("uiLibraries", []), isLoading: !1 }), useCopyToClipboard = () => {
2798
2810
  const [o, n] = useState(null), r = useCallback(async (a) => {
@@ -2866,24 +2878,24 @@ const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}),
2866
2878
  </body>
2867
2879
  </html>`, useCanvasScale = (o) => {
2868
2880
  const [n] = useCanvasWidth(), [, r] = useCanvasZoom(), a = useBuilderProp("htmlDir", "ltr"), [l, i] = useState({}), c = useCallback(() => {
2869
- const { width: d, height: u } = o;
2881
+ const { width: d, height: p } = o;
2870
2882
  if (d < n) {
2871
- const p = parseFloat((d / n).toFixed(2).toString());
2883
+ const u = parseFloat((d / n).toFixed(2).toString());
2872
2884
  let m = {};
2873
- const x = u * p, g = d * p;
2874
- u && (m = {
2885
+ const x = p * u, g = d * u;
2886
+ p && (m = {
2875
2887
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
2876
- height: 100 + (u - x) / x * 100 + "%",
2888
+ height: 100 + (p - x) / x * 100 + "%",
2877
2889
  width: 100 + (d - g) / g * 100 + "%"
2878
2890
  }), i({
2879
2891
  position: "relative",
2880
2892
  top: 0,
2881
- transform: `scale(${p})`,
2893
+ transform: `scale(${u})`,
2882
2894
  transformOrigin: a === "rtl" ? "top right" : "top left",
2883
2895
  ...m,
2884
2896
  maxWidth: "none"
2885
2897
  // TODO: Add max-width to the wrapper
2886
- }), r(p * 100);
2898
+ }), r(u * 100);
2887
2899
  } else
2888
2900
  i({}), r(100);
2889
2901
  }, [n, o, a, r]);
@@ -3004,8 +3016,8 @@ let iframeDocument = null, possiblePositions = [], dropTarget = null, dropIndex
3004
3016
  const positionPlaceholder = (o, n, r) => {
3005
3017
  if (!iframeDocument || !o)
3006
3018
  return;
3007
- const a = iframeDocument == null ? void 0 : iframeDocument.getElementById("placeholder"), l = possiblePositions.map(([u]) => u), i = l.reduce(
3008
- (u, p) => Math.abs(p - r) < Math.abs(u - r) ? p : u,
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,
3009
3021
  0
3010
3022
  ), c = l.indexOf(i);
3011
3023
  if (!possiblePositions[c])
@@ -3050,11 +3062,11 @@ function removeDataDrop() {
3050
3062
  o && o.removeAttribute("data-drop");
3051
3063
  }
3052
3064
  const useDnd = () => {
3053
- 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);
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);
3054
3066
  if (!useFeature("dnd"))
3055
3067
  return {};
3056
3068
  const x = () => {
3057
- removePlaceholder(), r(!1), u(null), p(null), possiblePositions = [];
3069
+ removePlaceholder(), r(!1), p(null), u(null), possiblePositions = [];
3058
3070
  };
3059
3071
  return iframeDocument = o, {
3060
3072
  isDragging: n,
@@ -3062,34 +3074,39 @@ const useDnd = () => {
3062
3074
  g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
3063
3075
  },
3064
3076
  onDrop: (g) => {
3065
- var w;
3066
- const E = dropTarget, f = getOrientation(E) === "vertical" ? g.clientY + ((w = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : w.scrollY) : g.clientX;
3077
+ var S;
3078
+ const E = dropTarget, f = getOrientation(E) === "vertical" ? g.clientY + ((S = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : S.scrollY) : g.clientX;
3067
3079
  dropIndex = calculateDropIndex(f, possiblePositions);
3068
- const _ = d, v = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3069
- if ((_ == null ? void 0 : _._id) === v || !S) {
3080
+ const v = d, _ = E.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3081
+ if ((v == null ? void 0 : v._id) === _ || !C) {
3070
3082
  x();
3071
3083
  return;
3072
3084
  }
3073
- if (!has(_, "_id")) {
3074
- a(_, v === "canvas" ? null : v, dropIndex), setTimeout(x, 300);
3085
+ if (!has(v, "_id")) {
3086
+ a(v, _ === "canvas" ? null : _, dropIndex), setTimeout(x, 300);
3075
3087
  return;
3076
3088
  }
3077
3089
  let B = E.getAttribute("data-block-id");
3078
- B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([_._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3090
+ B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([v._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3079
3091
  },
3080
3092
  onDragEnter: (g) => {
3081
- const E = g, j = E.target;
3082
- dropTarget = j;
3083
- const f = j.getAttribute("data-block-id"), _ = j.getAttribute("data-dnd-dragged") !== "yes";
3084
- p(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], _ && calculatePossiblePositions(j), r(!0), l(""), i([]);
3093
+ const E = g, b = E.target;
3094
+ dropTarget = b;
3095
+ const f = b.getAttribute("data-block-id"), v = b.getAttribute("data-dnd-dragged") !== "yes";
3096
+ u(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], v && calculatePossiblePositions(b), r(!0), l(""), i([]);
3085
3097
  },
3086
3098
  onDragLeave: (g) => {
3087
- g.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3099
+ g.target.getAttribute("data-block-id") === "canvas" && (u(null), r(!1), removePlaceholder(), possiblePositions = []);
3088
3100
  }
3089
3101
  };
3090
3102
  };
3091
3103
  function getTargetedBlock(o) {
3092
- return o.getAttribute("data-block-id") ? o : o.closest("[data-block-id]");
3104
+ if (o.getAttribute("data-block-id") === "canvas")
3105
+ return null;
3106
+ if (o.getAttribute("data-block-id"))
3107
+ return o;
3108
+ const n = o.closest("[data-block-id]");
3109
+ return (n == null ? void 0 : n.getAttribute("data-block-id")) === "canvas" ? null : n;
3093
3110
  }
3094
3111
  function destroyQuill(o) {
3095
3112
  o.container.innerHTML = "", o.container.parentNode.removeChild(o.container);
@@ -3097,72 +3114,79 @@ function destroyQuill(o) {
3097
3114
  n && n.parentNode.removeChild(n), o = null;
3098
3115
  }
3099
3116
  const useHandleCanvasDblClick = () => {
3100
- const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], n = useUpdateBlocksProps(), [, r] = useHighlightBlockId(), [a, l] = useAtom$1(inlineEditingActiveAtom);
3101
- return (i) => {
3102
- var x;
3103
- if (a)
3117
+ const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], n = useUpdateBlocksProps(), [r, a] = useAtom$1(inlineEditingActiveAtom);
3118
+ return (l) => {
3119
+ var m;
3120
+ if (r)
3104
3121
  return;
3105
- const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
3106
- if (!d || !o.includes(d))
3122
+ const i = getTargetedBlock(l.target), c = i.getAttribute("data-block-type");
3123
+ if (!c || !o.includes(c))
3107
3124
  return;
3108
- const u = c.cloneNode(!0);
3109
- c.style.display = "none", Array.from(u.attributes).forEach((g) => {
3110
- g.name !== "class" && u.removeAttribute(g.name);
3111
- }), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
3112
- const p = new Quill(u, { placeholder: "Type here..." });
3113
- function m() {
3114
- const g = p.getText(0, p.getLength());
3115
- n([c.getAttribute("data-block-id")], { content: g }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), l(""), r("");
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() {
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);
3116
3133
  }
3117
- u.addEventListener("blur", m, !0), u.addEventListener("keydown", (g) => {
3118
- (g.key === "Enter" || g.key === "Escape") && m();
3119
- }), p.focus(), (x = u.querySelector(".ql-clipboard")) == null || x.remove(), l(c.getAttribute("data-block-id"));
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"));
3120
3137
  };
3121
3138
  }, useHandleCanvasClick = () => {
3122
- const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [, a] = useHighlightBlockId(), [l] = useAtom$1(inlineEditingActiveAtom), [i] = useAtom$1(treeRefAtom);
3123
- return (c) => {
3124
- if (l)
3139
+ const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom);
3140
+ return (i) => {
3141
+ if (a)
3125
3142
  return;
3126
- c.stopPropagation();
3127
- const d = getTargetedBlock(c.target);
3128
- if (d != null && d.getAttribute("data-block-id") && (d == null ? void 0 : d.getAttribute("data-block-id")) === "container") {
3129
- r([]), o([]), a("");
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);
3130
3147
  return;
3131
3148
  }
3132
- if (d != null && d.getAttribute("data-block-parent")) {
3133
- const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
3134
- n.includes(m) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
3135
- } else if (d != null && d.getAttribute("data-block-id")) {
3136
- const u = d.getAttribute("data-block-id");
3137
- n.includes(u) || i == null || i.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
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]);
3138
3155
  }
3139
- a("");
3156
+ lastHighlighted && (lastHighlighted.removeAttribute("data-highlighted"), lastHighlighted = null);
3140
3157
  };
3141
- }, handleMouseMove = throttle((o, n) => {
3142
- const r = getTargetedBlock(o.target);
3143
- r != null && r.getAttribute("data-style-id") && n(r.getAttribute("data-style-id"));
3144
- }, 100), useHandleMouseMove = () => {
3145
- const [, o] = useHighlightBlockId(), [n] = useAtom$1(inlineEditingActiveAtom);
3146
- return (r) => {
3147
- n || handleMouseMove(r, o);
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);
3148
3168
  };
3149
- }, Canvas = ({ children: o }) => {
3169
+ }, clearHighlight = () => {
3170
+ lastHighlighted && (lastHighlighted.removeAttribute("data-highlighted"), lastHighlighted = null);
3171
+ }, useHandleMouseLeave = () => clearHighlight, Canvas = ({ children: o }) => {
3150
3172
  const { document: n } = useFrame(), [r] = useSelectedBlockIds(), [a, l] = useSelectedStylingBlocks();
3151
- useEffect(() => {
3173
+ useEffect(() => () => {
3174
+ clearHighlight();
3175
+ }, []), useEffect(() => {
3152
3176
  setTimeout(() => {
3153
3177
  if (!isEmpty(a))
3154
3178
  return;
3155
- const p = getElementByDataBlockId(n, first(r));
3156
- if (p) {
3157
- const m = p.getAttribute("data-style-prop");
3158
- if (m) {
3159
- const x = p.getAttribute("data-style-id"), g = p.getAttribute("data-block-parent");
3160
- l([{ id: x, prop: m, blockId: g }]);
3179
+ const m = getElementByDataBlockId(n, first(r));
3180
+ if (m) {
3181
+ const x = m.getAttribute("data-style-prop");
3182
+ if (x) {
3183
+ const g = m.getAttribute("data-style-id"), E = m.getAttribute("data-block-parent");
3184
+ l([{ id: g, prop: x, blockId: E }]);
3161
3185
  }
3162
3186
  }
3163
3187
  }, 100);
3164
3188
  }, [n, r, l, a]);
3165
- const i = useHandleCanvasDblClick(), c = useHandleCanvasClick(), d = useHandleMouseMove(), u = useDnd();
3189
+ const i = useHandleCanvasDblClick(), c = useHandleCanvasClick(), d = useHandleMouseMove(), p = useHandleMouseLeave(), u = useDnd();
3166
3190
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3167
3191
  "div",
3168
3192
  {
@@ -3171,20 +3195,21 @@ const useHandleCanvasDblClick = () => {
3171
3195
  onClick: c,
3172
3196
  onDoubleClick: i,
3173
3197
  onMouseMove: d,
3198
+ onMouseLeave: p,
3174
3199
  ...omit(u, "isDragging"),
3175
3200
  className: "relative h-full max-w-full p-px " + (u.isDragging ? "dragging" : ""),
3176
3201
  children: o
3177
3202
  }
3178
3203
  );
3179
3204
  }, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
3180
- const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
3181
- 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(
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(
3182
3207
  "ctrl+v,command+v",
3183
3208
  () => {
3184
- p(n[0]) && m(n);
3209
+ u(n[0]) && m(n);
3185
3210
  },
3186
3211
  {},
3187
- [n, p, m]
3212
+ [n, u, m]
3188
3213
  );
3189
3214
  const x = o ? { document: o } : {};
3190
3215
  useHotkeys("esc", () => r([]), x, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...x, preventDefault: !0 }, [
@@ -3224,7 +3249,7 @@ const useHandleCanvasDblClick = () => {
3224
3249
  }
3225
3250
  );
3226
3251
  }, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
3227
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
3252
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: p, refs: u, update: m } = useFloating({
3228
3253
  placement: "top-start",
3229
3254
  middleware: [shift(), flip()],
3230
3255
  elements: {
@@ -3238,8 +3263,8 @@ const useHandleCanvasDblClick = () => {
3238
3263
  {
3239
3264
  role: "button",
3240
3265
  tabIndex: 0,
3241
- ref: p.setFloating,
3242
- style: u,
3266
+ ref: u.setFloating,
3267
+ style: p,
3243
3268
  onClick: (E) => {
3244
3269
  E.stopPropagation(), E.preventDefault();
3245
3270
  },
@@ -3281,30 +3306,30 @@ const useHandleCanvasDblClick = () => {
3281
3306
  }
3282
3307
  ) });
3283
3308
  }, HeadTags = () => {
3284
- const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), [a] = useHighlightBlockId(), [l] = useSelectedStylingBlocks(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), { document: d, window: u } = useFrame(), [p] = useState(d == null ? void 0 : d.getElementById("highlighted-block")), [m] = useState(
3285
- d == null ? void 0 : d.getElementById("selected-block")
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(
3310
+ c == null ? void 0 : c.getElementById("selected-block")
3311
+ ), [m] = useState(
3312
+ c == null ? void 0 : c.getElementById("selected-styling-block")
3286
3313
  ), [x] = useState(
3287
- d == null ? void 0 : d.getElementById("selected-styling-block")
3288
- ), [g] = useState(
3289
- d == null ? void 0 : d.getElementById("dragged-block")
3314
+ c == null ? void 0 : c.getElementById("dragged-block")
3290
3315
  );
3291
3316
  useEffect(() => {
3292
- r ? d == null || d.documentElement.classList.add("dark") : d == null || d.documentElement.classList.remove("dark");
3293
- }, [r, d]);
3294
- const E = get(o, "headingFont", "DM Sans"), j = get(o, "bodyFont", "DM Sans");
3317
+ r ? c == null || c.documentElement.classList.add("dark") : c == null || c.documentElement.classList.remove("dark");
3318
+ }, [r, c]);
3319
+ const g = get(o, "headingFont", "DM Sans"), E = get(o, "bodyFont", "DM Sans");
3295
3320
  return useEffect(() => {
3296
- const f = get(o, "primaryColor", "#000"), _ = get(o, "secondaryColor", "#FFF"), v = get(o, "bodyBgLightColor", "#fff"), S = get(o, "bodyBgDarkColor", "#000"), B = get(o, "bodyTextDarkColor", "#000"), w = get(o, "bodyTextLightColor", "#fff"), A = s({
3297
- colors: [f, _],
3321
+ const b = get(o, "primaryColor", "#000"), f = get(o, "secondaryColor", "#FFF"), v = get(o, "bodyBgLightColor", "#fff"), _ = get(o, "bodyBgDarkColor", "#000"), C = get(o, "bodyTextDarkColor", "#000"), B = get(o, "bodyTextLightColor", "#fff"), S = s({
3322
+ colors: [b, f],
3298
3323
  names: ["primary", "secondary"]
3299
3324
  });
3300
- set(A, "primary.DEFAULT", f), set(A, "secondary.DEFAULT", _);
3301
- const N = {
3325
+ set(S, "primary.DEFAULT", b), set(S, "secondary.DEFAULT", f);
3326
+ const A = {
3302
3327
  "bg-light": v,
3303
- "bg-dark": S,
3304
- "text-dark": B,
3305
- "text-light": w
3306
- }, D = get(o, "roundedCorners", "0");
3307
- !u || !u.tailwind || (u.tailwind.config = {
3328
+ "bg-dark": _,
3329
+ "text-dark": C,
3330
+ "text-light": B
3331
+ }, N = get(o, "roundedCorners", "0");
3332
+ !d || !d.tailwind || (d.tailwind.config = {
3308
3333
  darkMode: "class",
3309
3334
  theme: {
3310
3335
  extend: {
@@ -3316,72 +3341,72 @@ const useHandleCanvasDblClick = () => {
3316
3341
  }
3317
3342
  },
3318
3343
  fontFamily: {
3319
- heading: [E],
3320
- body: [j]
3344
+ heading: [g],
3345
+ body: [E]
3321
3346
  },
3322
3347
  borderRadius: {
3323
- DEFAULT: `${D || "0"}px`
3348
+ DEFAULT: `${N || "0"}px`
3324
3349
  },
3325
- colors: { ...N, ...A }
3350
+ colors: { ...A, ...S }
3326
3351
  }
3327
3352
  },
3328
3353
  plugins: [
3329
3354
  typography$1,
3330
3355
  forms,
3331
3356
  aspectRatio,
3332
- plugin(function({ addBase: T, theme: b }) {
3333
- T({
3357
+ plugin(function({ addBase: D, theme: I }) {
3358
+ D({
3334
3359
  "h1,h2,h3,h4,h5,h6": {
3335
- fontFamily: b("fontFamily.heading")
3360
+ fontFamily: I("fontFamily.heading")
3336
3361
  },
3337
3362
  body: {
3338
- fontFamily: b("fontFamily.body"),
3339
- color: b("colors.text-light"),
3340
- backgroundColor: b("colors.bg-light")
3363
+ fontFamily: I("fontFamily.body"),
3364
+ color: I("colors.text-light"),
3365
+ backgroundColor: I("colors.bg-light")
3341
3366
  },
3342
3367
  ".dark body": {
3343
- color: b("colors.text-dark"),
3344
- backgroundColor: b("colors.bg-dark")
3368
+ color: I("colors.text-dark"),
3369
+ backgroundColor: I("colors.bg-dark")
3345
3370
  }
3346
3371
  });
3347
3372
  })
3348
3373
  ]
3349
3374
  });
3350
- }, [o, u, E, j]), useEffect(() => {
3351
- m && (m.textContent = `${map(n, (f) => `[data-block-id="${f}"]`).join(",")}{
3375
+ }, [o, d, g, E]), useEffect(() => {
3376
+ u && (u.textContent = `${map(n, (b) => `[data-block-id="${b}"]`).join(",")}{
3352
3377
  outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
3353
3378
  }`);
3354
- }, [n, m]), useEffect(() => {
3355
- g.textContent = i ? `[data-block-id="${i._id}"], [data-block-id="${i._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3356
- }, [i, g]), useEffect(() => {
3357
- p && (p.textContent = a ? `[data-style-id="${a}"], [data-block-id="${a}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
3358
- }, [a, n, p]), useEffect(() => {
3359
- x && (x.textContent = `${map(l, ({ id: f }) => `[data-style-id="${f}"]`).join(",")}{
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(",")}{
3360
3385
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3361
3386
  }`);
3362
- }, [l, x]), useEffect(() => {
3363
- d.querySelector("#drop-target-block").innerHTML = c ? `[data-block-id="${c}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3364
- }, [c]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (E || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3387
+ }, [a, m]), useEffect(() => {
3388
+ 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(
3365
3390
  "link",
3366
3391
  {
3367
3392
  rel: "stylesheet",
3368
- href: `https://fonts.googleapis.com/css2?family=${E ? `${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` : ""}${E && j && E !== j ? "&" : ""}${j && j !== E ? `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`
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`
3369
3394
  }
3370
3395
  ) });
3371
3396
  }, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
3372
3397
  const r = ["xs", "sm", "md", "lg", "xl", "2xl"], a = r.indexOf(n), l = o.split(" ");
3373
3398
  let i = new Array(r.length).fill(!1);
3374
3399
  for (const c of l) {
3375
- let [d, u] = c.split(":");
3376
- u || (u = d, d = "xs");
3377
- const p = r.indexOf(d);
3378
- if (p <= a) {
3400
+ let [d, p] = c.split(":");
3401
+ p || (p = d, d = "xs");
3402
+ const u = r.indexOf(d);
3403
+ if (u <= a) {
3379
3404
  const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
3380
- if (m.includes(u))
3381
- for (let g = p; g < r.length; g++)
3405
+ if (m.includes(p))
3406
+ for (let g = u; g < r.length; g++)
3382
3407
  i[g] = !0;
3383
- else if (x.includes(u))
3384
- for (let g = p; g < r.length; g++)
3408
+ else if (x.includes(p))
3409
+ for (let g = u; g < r.length; g++)
3385
3410
  i[g] = !1;
3386
3411
  }
3387
3412
  }
@@ -3401,24 +3426,24 @@ const useHandleCanvasDblClick = () => {
3401
3426
  );
3402
3427
  return { getRSCBlockMarkup: a, getRSCBlockState: l, reset: i };
3403
3428
  }, useWatchRSCBlocks = () => {
3404
- const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (u) => ""), d = useMemo(() => o.filter((p) => {
3429
+ const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (p) => ""), d = useMemo(() => o.filter((u) => {
3405
3430
  var x;
3406
- return (x = get(i, p._type)) == null ? void 0 : x.server;
3407
- }).map((p) => p._id), [i, o]);
3431
+ return (x = get(i, u._type)) == null ? void 0 : x.server;
3432
+ }).map((u) => u._id), [i, o]);
3408
3433
  useEffect(() => {
3409
- forEach(d, (u) => {
3410
- if (get(n, u, "") || get(a, `${u}.loading`, !1))
3434
+ forEach(d, (p) => {
3435
+ if (get(n, p, "") || get(a, `${p}.loading`, !1))
3411
3436
  return;
3412
- const p = o.find((m) => m._id === u);
3413
- l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
3414
- r((x) => ({ ...x, [u]: m })), l((x) => ({
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) => ({
3415
3440
  ...x,
3416
- [u]: { loading: !1, error: null }
3441
+ [p]: { loading: !1, error: null }
3417
3442
  }));
3418
3443
  }).catch((m) => {
3419
3444
  l((x) => ({
3420
3445
  ...x,
3421
- [u]: { loading: !1, error: m.message }
3446
+ [p]: { loading: !1, error: m.message }
3422
3447
  }));
3423
3448
  });
3424
3449
  });
@@ -3483,29 +3508,29 @@ function applyLanguage(o, n, r) {
3483
3508
  }), a;
3484
3509
  }
3485
3510
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3486
- 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(), x = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), j = useCallback(
3487
- (f) => f.reduce((_, v) => {
3488
- const S = get(u, v, {});
3489
- return { ..._, ...S };
3511
+ const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [p] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), x = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), b = useCallback(
3512
+ (f) => f.reduce((v, _) => {
3513
+ const C = get(p, _, {});
3514
+ return { ...v, ...C };
3490
3515
  }, {}),
3491
- [u]
3516
+ [p]
3492
3517
  );
3493
3518
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3494
- o.map((f, _) => {
3495
- if (E === f._id || p.includes(f._id))
3519
+ o.map((f, v) => {
3520
+ if (E === f._id || u.includes(f._id))
3496
3521
  return null;
3497
- const v = {}, S = filter(n, { _parent: f._id });
3498
- if (v.children = S.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: S }) : null, f._type === "GlobalBlock") {
3499
- const C = m(f);
3500
- v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (R) => !R._parent), allBlocks: C });
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, (R) => !R._parent), allBlocks: w });
3501
3526
  }
3502
- const B = getBlockComponent(f._type), w = get(B, "server", !1), A = w ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
3527
+ const B = getBlockComponent(f._type), S = get(B, "server", !1), A = S ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
3503
3528
  if (isNull(A))
3504
3529
  return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
3505
- const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(f, n) : [], D = j(N), T = x(f);
3506
- if (get(T, "__isHidden", !1) && !includes(a, f._id))
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))
3507
3532
  return null;
3508
- const b = i && isDescendant(i._id, f._id, n), k = {
3533
+ const j = i && isDescendant(i._id, f._id, n), k = {
3509
3534
  ...includes(a, f._id) ? { "force-show": "" } : {},
3510
3535
  "data-block-id": f._id,
3511
3536
  "data-block-type": f._type,
@@ -3513,18 +3538,18 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3513
3538
  // @ts-ignore
3514
3539
  {
3515
3540
  "data-dnd": canAcceptChildBlock(f._type, i == null ? void 0 : i._type) ? "yes" : "no",
3516
- "data-dnd-dragged": i._id === f._id || b ? "yes" : "no"
3541
+ "data-dnd-dragged": i._id === f._id || j ? "yes" : "no"
3517
3542
  }
3518
3543
  ) : {},
3519
- ...c === f._id && !b ? { "data-drop": "yes" } : {},
3544
+ ...c === f._id && !j ? { "data-drop": "yes" } : {},
3520
3545
  ...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
3521
3546
  };
3522
- return w ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: k }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
3547
+ return S ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: k }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
3523
3548
  blockProps: k,
3524
- index: _,
3549
+ index: v,
3525
3550
  ...applyBindings(applyLanguage(f, r, B), g),
3526
- ...omit(T, ["__isHidden"]),
3527
- ...v,
3551
+ ...omit(I, ["__isHidden"]),
3552
+ ..._,
3528
3553
  inBuilder: !0,
3529
3554
  blockState: D
3530
3555
  }) });
@@ -3538,7 +3563,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3538
3563
  if (i) {
3539
3564
  const c = (i == null ? void 0 : i.mockFn) || (i == null ? void 0 : i.dataFn);
3540
3565
  c && c(l.args).then(
3541
- (d) => n((u) => ({ ...u, [l.providerKey]: d }))
3566
+ (d) => n((p) => ({ ...p, [l.providerKey]: d }))
3542
3567
  );
3543
3568
  }
3544
3569
  }), () => {
@@ -3576,14 +3601,14 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3576
3601
  n(i);
3577
3602
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
3578
3603
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3579
- const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [j, f] = useSelectedStylingBlocks(), _ = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), S = (A) => {
3580
- u((N) => ({ ...N, width: A }));
3604
+ const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [b, f] = useSelectedStylingBlocks(), v = useBuilderProp("loading", !1), _ = useBuilderProp("htmlDir", "ltr"), C = (A) => {
3605
+ p((N) => ({ ...N, width: A }));
3581
3606
  };
3582
3607
  useEffect(() => {
3583
3608
  if (!c.current)
3584
3609
  return;
3585
3610
  const { clientWidth: A, clientHeight: N } = c.current;
3586
- u({ width: A, height: N });
3611
+ p({ width: A, height: N });
3587
3612
  }, [c, n]);
3588
3613
  const B = (A, N = 0) => {
3589
3614
  const { top: D } = A.getBoundingClientRect();
@@ -3596,23 +3621,23 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3596
3621
  D && (B(D) || (N = (A = i.current) == null ? void 0 : A.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
3597
3622
  }
3598
3623
  }, [a]), useEffect(() => {
3599
- if (!isEmpty(j) && i.current) {
3624
+ if (!isEmpty(b) && i.current) {
3600
3625
  const A = getElementByStyleId(
3601
3626
  i.current.contentDocument,
3602
- first(j).id
3627
+ first(b).id
3603
3628
  );
3604
3629
  g(A ? [A] : [null]);
3605
3630
  } else
3606
3631
  g([null]);
3607
- }, [j]);
3608
- const w = useMemo(() => {
3632
+ }, [b]);
3633
+ const S = useMemo(() => {
3609
3634
  let A = IframeInitialContent;
3610
- return A = A.replace("__HTML_DIR__", v), o === "offline" && (A = A.replace(
3635
+ return A = A.replace("__HTML_DIR__", _), o === "offline" && (A = A.replace(
3611
3636
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3612
3637
  "/offline/tailwind.cdn.js"
3613
3638
  ), 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;
3614
- }, [o, v]);
3615
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: S, onResize: S, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3639
+ }, [o, _]);
3640
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3616
3641
  "div",
3617
3642
  {
3618
3643
  onClick: () => {
@@ -3627,9 +3652,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3627
3652
  contentDidMount: () => E(i.current),
3628
3653
  ref: i,
3629
3654
  id: "canvas-iframe",
3630
- style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
3655
+ style: { ...u, ...isEmpty(u) ? { width: `${n}px` } : {} },
3631
3656
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3632
- initialContent: w,
3657
+ initialContent: S,
3633
3658
  children: [
3634
3659
  /* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
3635
3660
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3641,7 +3666,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3641
3666
  ),
3642
3667
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {}),
3643
3668
  /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
3644
- _ ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3669
+ v ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3645
3670
  /* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
3646
3671
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
3647
3672
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -3727,7 +3752,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3727
3752
  return /* @__PURE__ */ jsxRuntimeExports.jsx(BoxModelIcon, {});
3728
3753
  }
3729
3754
  }, Breadcrumb = () => {
3730
- const o = useSelectedBlockHierarchy(), [, n] = useSelectedBlockIds(), [, r] = useHighlightBlockId();
3755
+ const o = useSelectedBlockHierarchy(), [, n] = useSelectedBlockIds(), { highlightBlock: r } = useBlockHighlight();
3731
3756
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mx-2 border-t border-border bg-background px-2 py-1 text-xs text-muted-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("ol", { className: "flex items-center whitespace-nowrap", children: [
3732
3757
  /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "inline-flex items-center", children: [
3733
3758
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => n([]), variant: "ghost", className: "h-fit p-1 text-xs font-normal", children: "Body" }),
@@ -3752,7 +3777,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3752
3777
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3753
3778
  ] }, l))
3754
3779
  ] }) });
3755
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-IHn5dpOk.js")), CanvasArea = () => {
3780
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-U9ErQEW3.js")), CanvasArea = () => {
3756
3781
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3757
3782
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
3758
3783
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
@@ -3827,39 +3852,39 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3827
3852
  showHeading: o = !0,
3828
3853
  className: n = ""
3829
3854
  }) => {
3830
- const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: w }, A) => {
3831
- A && (a(w), i.current = w);
3855
+ const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: S }, A) => {
3856
+ A && (a(S), i.current = S);
3832
3857
  }, {
3833
- bodyFont: u,
3834
- headingFont: p,
3858
+ bodyFont: p,
3859
+ headingFont: u,
3835
3860
  primaryColor: m,
3836
3861
  bodyTextDarkColor: x,
3837
3862
  bodyTextLightColor: g,
3838
3863
  bodyBgDarkColor: E,
3839
- secondaryColor: j,
3864
+ secondaryColor: b,
3840
3865
  bodyBgLightColor: f,
3841
- roundedCorners: _
3866
+ roundedCorners: v
3842
3867
  } = r;
3843
- let v = {
3868
+ let _ = {
3844
3869
  headingFont: y({
3845
3870
  title: c("theme_config.heading_font"),
3846
- default: p,
3871
+ default: u,
3847
3872
  options: FONTS
3848
3873
  }),
3849
3874
  bodyFont: y({
3850
3875
  title: c("theme_config.body_font"),
3851
- default: u,
3876
+ default: p,
3852
3877
  options: FONTS
3853
3878
  }),
3854
3879
  roundedCorners: s$1({
3855
3880
  title: c("theme_config.rounded_corner"),
3856
- default: parseInt(_ || 5, 10)
3881
+ default: parseInt(v || 5, 10)
3857
3882
  }),
3858
3883
  primaryColor: h({ title: c("theme_config.primary"), default: m }),
3859
- secondaryColor: h({ title: c("theme_config.secondary"), default: j })
3884
+ secondaryColor: h({ title: c("theme_config.secondary"), default: b })
3860
3885
  };
3861
- l || (v = {
3862
- ...v,
3886
+ l || (_ = {
3887
+ ..._,
3863
3888
  bodyBgLightColor: h({
3864
3889
  title: c("theme_config.background"),
3865
3890
  default: f
@@ -3877,13 +3902,13 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3877
3902
  default: g
3878
3903
  })
3879
3904
  });
3880
- const S = {
3905
+ const C = {
3881
3906
  type: "object",
3882
3907
  properties: {}
3883
3908
  }, B = {};
3884
- return Object.keys(v).forEach((w) => {
3885
- const A = v[w];
3886
- return S.properties || (S.properties = {}), S.properties[w] = A.schema, B[w] = A.uiSchema, !0;
3909
+ return Object.keys(_).forEach((S) => {
3910
+ const A = _[S];
3911
+ return C.properties || (C.properties = {}), C.properties[S] = A.schema, B[S] = A.uiSchema, !0;
3887
3912
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
3888
3913
  o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: c("Theme Configuration") }) }) : null,
3889
3914
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3896,7 +3921,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3896
3921
  liveOmit: !0,
3897
3922
  liveValidate: !0,
3898
3923
  uiSchema: B,
3899
- schema: S,
3924
+ schema: C,
3900
3925
  formData: r,
3901
3926
  validator,
3902
3927
  onChange: d
@@ -4077,36 +4102,36 @@ function BiExpandVertical(o) {
4077
4102
  return GenIcon({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "m12 19.24-4.95-4.95-1.41 1.42L12 22.07l6.36-6.36-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95 1.41-1.42L12 1.93 5.64 8.29z" }, child: [] }] })(o);
4078
4103
  }
4079
4104
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4080
- const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
4105
+ const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
4081
4106
  let p = null;
4082
- const m = o.children.length > 0, { id: x, data: g, isSelected: E, willReceiveDrop: j, isDragging: f, isEditing: _, handleClick: v } = o, S = (T) => {
4083
- T.stopPropagation(), !i.includes(x) && o.toggle();
4084
- }, B = (T) => {
4085
- T.isInternal && (p = T.isOpen, T.isOpen && T.close());
4086
- }, w = (T) => {
4087
- T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
4088
- }, A = (T) => {
4089
- T.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), v(T);
4107
+ const u = o.children.length > 0, { highlightBlock: m } = useBlockHighlight(), { id: x, data: g, isSelected: E, willReceiveDrop: b, isDragging: f, isEditing: v, handleClick: _ } = o, C = (I) => {
4108
+ I.stopPropagation(), !i.includes(x) && o.toggle();
4109
+ }, B = (I) => {
4110
+ I.isInternal && (p = I.isOpen, I.isOpen && I.close());
4111
+ }, S = (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);
4090
4115
  };
4091
4116
  useEffect(() => {
4092
- const T = setTimeout(() => {
4093
- j && !o.isOpen && !f && !i.includes(x) && o.toggle();
4117
+ const I = setTimeout(() => {
4118
+ b && !o.isOpen && !f && !i.includes(x) && o.toggle();
4094
4119
  }, 500);
4095
- return () => clearTimeout(T);
4096
- }, [j, o, f]);
4120
+ return () => clearTimeout(I);
4121
+ }, [b, o, f]);
4097
4122
  const N = useMemo(() => {
4098
- const T = Object.keys(g), b = [];
4099
- for (let k = 0; k < T.length; k++)
4100
- if (T[k].endsWith("_attrs")) {
4101
- const C = g[T[k]], R = Object.keys(C).join("|");
4102
- R.match(/x-data/) && b.push("data"), R.match(/x-on/) && b.push("event"), R.match(/x-show|x-if/) && b.push("show");
4123
+ const I = Object.keys(g), j = [];
4124
+ for (let k = 0; k < I.length; k++)
4125
+ if (I[k].endsWith("_attrs")) {
4126
+ const w = g[I[k]], R = Object.keys(w).join("|");
4127
+ R.match(/x-data/) && j.push("data"), R.match(/x-on/) && j.push("event"), R.match(/x-show|x-if/) && j.push("show");
4103
4128
  }
4104
- return b;
4105
- }, [g]), D = (T, b) => {
4106
- const k = u.contentDocument || u.contentWindow.document, C = k.querySelector(`[data-block-id=${T}]`);
4107
- C && C.setAttribute("data-drop", b);
4108
- const R = C.getBoundingClientRect(), I = u.getBoundingClientRect();
4109
- R.top >= I.top && R.left >= I.left && R.bottom <= I.bottom && R.right <= I.right || (k.documentElement.scrollTop = C.offsetTop - I.top);
4129
+ return j;
4130
+ }, [g]), D = (I, j) => {
4131
+ const k = d.contentDocument || d.contentWindow.document, w = k.querySelector(`[data-block-id=${I}]`);
4132
+ w && w.setAttribute("data-drop", j);
4133
+ const R = w.getBoundingClientRect(), T = d.getBoundingClientRect();
4134
+ R.top >= T.top && R.left >= T.left && R.bottom <= T.bottom && R.right <= T.right || (k.documentElement.scrollTop = w.offsetTop - T.top);
4110
4135
  };
4111
4136
  return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4112
4137
  "button",
@@ -4121,26 +4146,26 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4121
4146
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenu, { id: x, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
4122
4147
  "div",
4123
4148
  {
4124
- onMouseEnter: () => d(x),
4149
+ onMouseEnter: () => m(x),
4125
4150
  onClick: A,
4126
4151
  style: n,
4127
4152
  "data-node-id": x,
4128
4153
  ref: i.includes(x) ? null : r,
4129
4154
  onDragStart: () => B(o),
4130
- onDragEnd: () => w(o),
4131
- onDragOver: (T) => {
4132
- T.preventDefault(), D(x, "yes");
4155
+ onDragEnd: () => S(o),
4156
+ onDragOver: (I) => {
4157
+ I.preventDefault(), D(x, "yes");
4133
4158
  },
4134
- onDragLeave: (T) => {
4135
- T.preventDefault(), D(x, "no");
4159
+ onDragLeave: (I) => {
4160
+ I.preventDefault(), D(x, "no");
4136
4161
  },
4137
- onDrop: (T) => {
4138
- T.preventDefault(), D(x, "no");
4162
+ onDrop: (I) => {
4163
+ I.preventDefault(), D(x, "no");
4139
4164
  },
4140
4165
  className: cn(
4141
4166
  "group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
4142
4167
  E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4143
- j && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
4168
+ b && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
4144
4169
  f && "opacity-20",
4145
4170
  i.includes(x) ? "opacity-50" : ""
4146
4171
  ),
@@ -4150,17 +4175,17 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4150
4175
  "div",
4151
4176
  {
4152
4177
  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" : ""}`,
4153
- children: m && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4178
+ children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: C, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4154
4179
  }
4155
4180
  ),
4156
4181
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4157
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 }) }),
4158
- _ ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4183
+ v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4159
4184
  "div",
4160
4185
  {
4161
4186
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
4162
- onDoubleClick: (T) => {
4163
- T.stopPropagation(), o.edit(), o.deselect();
4187
+ onDoubleClick: (I) => {
4188
+ I.stopPropagation(), o.edit(), o.deselect();
4164
4189
  },
4165
4190
  children: [
4166
4191
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (g == null ? void 0 : g._name) || (g == null ? void 0 : g._type.split("/").pop()) }),
@@ -4173,16 +4198,16 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4173
4198
  ] })
4174
4199
  ] }),
4175
4200
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: [
4176
- !i.includes(x) && a.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4201
+ !i.includes(x) && a.map((I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4177
4202
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4178
4203
  TooltipTrigger,
4179
4204
  {
4180
4205
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
4181
4206
  asChild: !0,
4182
- children: React__default.createElement(T.item, { blockId: x })
4207
+ children: React__default.createElement(I.item, { blockId: x })
4183
4208
  }
4184
4209
  ),
4185
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: T.tooltip })
4210
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: I.tooltip })
4186
4211
  ] })),
4187
4212
  canAddChildBlock(g == null ? void 0 : g._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4188
4213
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -4200,8 +4225,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4200
4225
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4201
4226
  TooltipTrigger,
4202
4227
  {
4203
- onClick: (T) => {
4204
- T.stopPropagation(), c(x), o.isOpen && o.toggle();
4228
+ onClick: (I) => {
4229
+ I.stopPropagation(), c(x), o.isOpen && o.toggle();
4205
4230
  },
4206
4231
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",
4207
4232
  asChild: !0,
@@ -4556,8 +4581,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4556
4581
  const c = stringify([r]);
4557
4582
  return hasVideoEmbed(c) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(c)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = c, [a];
4558
4583
  } else if (r.tagName === "svg") {
4559
- const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px", m = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4560
- return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`, m)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
4584
+ const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), p = get(c, "value") ? `[${get(c, "value")}px]` : "24px", u = get(d, "value") ? `[${get(d, "value")}px]` : "24px", m = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4585
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${u} h-${p}`, m)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
4561
4586
  } else if (r.tagName == "option" && n && ((i = n.block) == null ? void 0 : i._type) === "Select")
4562
4587
  return n.block.options.push({
4563
4588
  label: getTextContent(r.children),
@@ -4616,63 +4641,63 @@ function ExpandableObject(o) {
4616
4641
  openBracket: i,
4617
4642
  closeBracket: c,
4618
4643
  level: d,
4619
- style: u,
4620
- shouldExpandNode: p,
4644
+ style: p,
4645
+ shouldExpandNode: u,
4621
4646
  clickToExpandNode: m
4622
4647
  } = o;
4623
- const x = useRef(!1), [g, E, j] = useBool(() => p(d, r, n));
4648
+ const x = useRef(!1), [g, E, b] = useBool(() => u(d, r, n));
4624
4649
  useEffect(() => {
4625
- x.current ? j(p(d, r, n)) : x.current = !0;
4626
- }, [p]);
4627
- const f = g ? u.collapseIcon : u.expandIcon, _ = g ? "collapse JSON" : "expand JSON", v = useComponentId(), S = d + 1, B = a.length - 1, w = (A) => {
4650
+ x.current ? b(u(d, r, n)) : x.current = !0;
4651
+ }, [u]);
4652
+ const f = g ? p.collapseIcon : p.expandIcon, v = g ? "collapse JSON" : "expand JSON", _ = useComponentId(), C = d + 1, B = a.length - 1, S = (A) => {
4628
4653
  A.key === " " && (A.preventDefault(), E());
4629
4654
  };
4630
4655
  return /* @__PURE__ */ createElement("div", {
4631
- className: u.basicChildStyle,
4656
+ className: p.basicChildStyle,
4632
4657
  role: "list"
4633
4658
  }, /* @__PURE__ */ createElement("span", {
4634
4659
  className: f,
4635
4660
  onClick: E,
4636
- onKeyDown: w,
4661
+ onKeyDown: S,
4637
4662
  role: "button",
4638
4663
  tabIndex: 0,
4639
- "aria-label": _,
4664
+ "aria-label": v,
4640
4665
  "aria-expanded": g,
4641
- "aria-controls": g ? v : void 0
4666
+ "aria-controls": g ? _ : void 0
4642
4667
  }), n && (m ? /* @__PURE__ */ createElement("span", {
4643
- className: u.clickableLabel,
4668
+ className: p.clickableLabel,
4644
4669
  onClick: E,
4645
- onKeyDown: w,
4670
+ onKeyDown: S,
4646
4671
  role: "button",
4647
4672
  tabIndex: -1
4648
4673
  }, n, ":") : /* @__PURE__ */ createElement("span", {
4649
- className: u.label
4674
+ className: p.label
4650
4675
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4651
- className: u.punctuation
4676
+ className: p.punctuation
4652
4677
  }, i), g ? /* @__PURE__ */ createElement("div", {
4653
- id: v
4678
+ id: _
4654
4679
  }, a.map((A, N) => /* @__PURE__ */ createElement(DataRender, {
4655
4680
  key: A[0] || N,
4656
4681
  field: A[0],
4657
4682
  value: A[1],
4658
- style: u,
4683
+ style: p,
4659
4684
  lastElement: N === B,
4660
- level: S,
4661
- shouldExpandNode: p,
4685
+ level: C,
4686
+ shouldExpandNode: u,
4662
4687
  clickToExpandNode: m
4663
4688
  }))) : /* @__PURE__ */ createElement("span", {
4664
- className: u.collapsedContent,
4689
+ className: p.collapsedContent,
4665
4690
  onClick: E,
4666
- onKeyDown: w,
4691
+ onKeyDown: S,
4667
4692
  role: "button",
4668
4693
  tabIndex: -1,
4669
4694
  "aria-hidden": !0,
4670
- "aria-label": _,
4695
+ "aria-label": v,
4671
4696
  "aria-expanded": g
4672
4697
  }), /* @__PURE__ */ createElement("span", {
4673
- className: u.punctuation
4698
+ className: p.punctuation
4674
4699
  }, c), !l && /* @__PURE__ */ createElement("span", {
4675
- className: u.punctuation
4700
+ className: p.punctuation
4676
4701
  }, ","));
4677
4702
  }
4678
4703
  function JsonObject(o) {
@@ -4695,7 +4720,7 @@ function JsonObject(o) {
4695
4720
  style: a,
4696
4721
  shouldExpandNode: i,
4697
4722
  clickToExpandNode: c,
4698
- data: Object.keys(r).map((u) => [u, r[u]])
4723
+ data: Object.keys(r).map((p) => [p, r[p]])
4699
4724
  });
4700
4725
  }
4701
4726
  function JsonArray(o) {
@@ -4718,7 +4743,7 @@ function JsonArray(o) {
4718
4743
  style: a,
4719
4744
  shouldExpandNode: c,
4720
4745
  clickToExpandNode: d,
4721
- data: r.map((u) => [void 0, u])
4746
+ data: r.map((p) => [void 0, p])
4722
4747
  });
4723
4748
  }
4724
4749
  function JsonPrimitiveValue(o) {
@@ -4782,8 +4807,8 @@ function getPathAndTypes(o) {
4782
4807
  const n = [], r = {};
4783
4808
  function a(l, i) {
4784
4809
  forEach(i, (c, d) => {
4785
- const u = l ? `${l}.${d}` : d, p = isArray$1(c) ? "list" : typeof c;
4786
- n.push(u), r[u] = p === "string" ? "text" : p === "object" ? "model" : p, p === "object" && !isArray$1(c) && a(u, c);
4810
+ const p = l ? `${l}.${d}` : d, u = isArray$1(c) ? "list" : typeof c;
4811
+ n.push(p), r[p] = u === "string" ? "text" : u === "object" ? "model" : u, u === "object" && !isArray$1(c) && a(p, c);
4787
4812
  });
4788
4813
  }
4789
4814
  return a("", omit(o, ["styles", "_type", "_id", "_name", "_bindings"])), { paths: n, pathsType: r };
@@ -4821,9 +4846,9 @@ const ViewData = ({ data: o, fullView: n }) => {
4821
4846
  dataType: i,
4822
4847
  appliedBindings: c
4823
4848
  }) => {
4824
- const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [x, g] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
4825
- (j) => !includes(c, j) && get(p, `props.${first(split(j, "."))}.binding`)
4826
- ) : d.filter((j) => i === get(u, j, "")), [o, d, c, i, p]);
4849
+ 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(
4850
+ (b) => !includes(c, b) && get(u, `props.${first(split(b, "."))}.binding`)
4851
+ ) : d.filter((b) => i === get(p, b, "")), [o, d, c, i, u]);
4827
4852
  return useEffect(() => {
4828
4853
  n && l(n);
4829
4854
  }, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -4852,23 +4877,23 @@ const ViewData = ({ data: o, fullView: n }) => {
4852
4877
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
4853
4878
  /* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
4854
4879
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
4855
- /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4880
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4856
4881
  CommandItem,
4857
4882
  {
4858
- value: j,
4883
+ value: b,
4859
4884
  className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4860
4885
  onSelect: (f) => {
4861
- r(find(E, (_) => _ === f) || null), g(!1);
4886
+ r(find(E, (v) => v === f) || null), g(!1);
4862
4887
  },
4863
4888
  children: [
4864
4889
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
4865
- /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === j ? "" : "opacity-0"}` }),
4866
- j
4890
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === b ? "" : "opacity-0"}` }),
4891
+ b
4867
4892
  ] }),
4868
- 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, j, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, j) }) })
4893
+ 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) }) })
4869
4894
  ]
4870
4895
  },
4871
- j
4896
+ b
4872
4897
  )) })
4873
4898
  ] })
4874
4899
  ] }) })
@@ -4882,19 +4907,19 @@ const ViewData = ({ data: o, fullView: n }) => {
4882
4907
  editMode: r,
4883
4908
  item: a
4884
4909
  }) => {
4885
- const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
4886
- (E, j) => {
4910
+ const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), p = useSelectedBlock(), [u] = useChaiExternalData(), m = useCallback(
4911
+ (E, b) => {
4887
4912
  if (isEmpty(E))
4888
4913
  return "";
4889
4914
  {
4890
- const f = get(j === "PROP" ? u : p, E, "");
4915
+ const f = get(b === "PROP" ? p : u, E, "");
4891
4916
  if (isArray$1(f))
4892
4917
  return "list";
4893
- const _ = typeof f;
4894
- return _ === "string" ? "text" : _ === "object" ? "model" : _;
4918
+ const v = typeof f;
4919
+ return v === "string" ? "text" : v === "object" ? "model" : v;
4895
4920
  }
4896
4921
  },
4897
- [u, p]
4922
+ [p, u]
4898
4923
  ), [x, g] = useState(r ? m(a.key, "PROP") : "");
4899
4924
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4900
4925
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
@@ -4911,10 +4936,10 @@ const ViewData = ({ data: o, fullView: n }) => {
4911
4936
  value: l,
4912
4937
  setValue: i,
4913
4938
  onChange: (E) => {
4914
- const j = m(E, "PROP");
4915
- i(E), x !== j && d(""), g(j);
4939
+ const b = m(E, "PROP");
4940
+ i(E), x !== b && d(""), g(b);
4916
4941
  },
4917
- data: u,
4942
+ data: p,
4918
4943
  dataType: x,
4919
4944
  appliedBindings: o
4920
4945
  }
@@ -4929,10 +4954,10 @@ const ViewData = ({ data: o, fullView: n }) => {
4929
4954
  value: c,
4930
4955
  setValue: d,
4931
4956
  onChange: (E) => {
4932
- const j = m(E, "PATH");
4933
- d(x === j ? E : "");
4957
+ const b = m(E, "PATH");
4958
+ d(x === b ? E : "");
4934
4959
  },
4935
- data: p,
4960
+ data: u,
4936
4961
  dataType: x,
4937
4962
  appliedBindings: o
4938
4963
  }
@@ -4959,8 +4984,8 @@ const ViewData = ({ data: o, fullView: n }) => {
4959
4984
  item: i,
4960
4985
  editMode: l,
4961
4986
  appliedBindings: a,
4962
- onAddBinding: (u) => {
4963
- r(u), d(!1);
4987
+ onAddBinding: (p) => {
4988
+ r(p), d(!1);
4964
4989
  }
4965
4990
  }
4966
4991
  ) })
@@ -4973,18 +4998,18 @@ const ViewData = ({ data: o, fullView: n }) => {
4973
4998
  dataProvider: l,
4974
4999
  appliedBindings: i
4975
5000
  }) => {
4976
- const [c, d] = useState("string"), u = (p, m) => {
4977
- if (isEmpty(p))
5001
+ const [c, d] = useState("string"), p = (u, m) => {
5002
+ if (isEmpty(u))
4978
5003
  return "";
4979
5004
  {
4980
- const x = get(m === "PROP" ? a : l, p, "");
5005
+ const x = get(m === "PROP" ? a : l, u, "");
4981
5006
  if (isArray$1(x))
4982
5007
  return "list";
4983
5008
  const g = typeof x;
4984
5009
  return g === "string" ? "text" : g === "object" ? "model" : g;
4985
5010
  }
4986
5011
  };
4987
- 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: [
5012
+ 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: [
4988
5013
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-normal text-gray-500", children: o.key }),
4989
5014
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium leading-5", children: o.value }),
4990
5015
  /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(l, o.value, "") }),
@@ -5014,11 +5039,11 @@ const ViewData = ({ data: o, fullView: n }) => {
5014
5039
  return !1;
5015
5040
  const x = last(i);
5016
5041
  return isEmpty(x == null ? void 0 : x.key) || isEmpty(x == null ? void 0 : x.value);
5017
- }, [a, i]), u = (x) => {
5042
+ }, [a, i]), p = (x) => {
5018
5043
  const g = filter(i, (E) => E.key !== x.key);
5019
5044
  c([...g, x]), m([...g, x]);
5020
- }, p = (x) => {
5021
- const g = filter(i, (E, j) => x !== j);
5045
+ }, u = (x) => {
5046
+ const g = filter(i, (E, b) => x !== b);
5022
5047
  m([...g]);
5023
5048
  }, m = useCallback(
5024
5049
  (x = []) => {
@@ -5042,8 +5067,8 @@ const ViewData = ({ data: o, fullView: n }) => {
5042
5067
  NewDataBindingPair,
5043
5068
  {
5044
5069
  item: x,
5045
- onAddBinding: u,
5046
- onRemove: () => p(g),
5070
+ onAddBinding: p,
5071
+ onRemove: () => u(g),
5047
5072
  selectedBlock: r,
5048
5073
  dataProvider: a,
5049
5074
  appliedBindings: map(i, "key")
@@ -5056,7 +5081,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5056
5081
  {
5057
5082
  disabled: d,
5058
5083
  appliedBindings: map(i, "key"),
5059
- onAddBinding: u,
5084
+ onAddBinding: p,
5060
5085
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5061
5086
  "span",
5062
5087
  {
@@ -5137,7 +5162,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5137
5162
  }
5138
5163
  )
5139
5164
  ] });
5140
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-cgDgay1j.js")), UploadImages = React__default.lazy(() => import("./UploadImages-mC_nhMam.js")), ImagesPanel = ({
5165
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-B5Dq7OwG.js")), UploadImages = React__default.lazy(() => import("./UploadImages-nEQCD1rK.js")), ImagesPanel = ({
5141
5166
  isModalView: o = !1,
5142
5167
  onSelect: n = () => {
5143
5168
  }
@@ -5147,7 +5172,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5147
5172
  );
5148
5173
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col", children: [
5149
5174
  /* @__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" }) }),
5150
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: c, onValueChange: (u) => d(u), className: "flex h-full w-full flex-col py-2", children: [
5175
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: c, onValueChange: (p) => d(p), className: "flex h-full w-full flex-col py-2", children: [
5151
5176
  !(l || i) && /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "w-full", children: [
5152
5177
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "upload", className: "w-full", children: "Upload" }),
5153
5178
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "unsplash", className: "w-full", children: "Unsplash" })
@@ -5184,8 +5209,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5184
5209
  className: "text-xs",
5185
5210
  placeholder: c("enter_image_url"),
5186
5211
  value: o,
5187
- onBlur: ({ target: { value: u } }) => a(r, u),
5188
- onChange: (u) => n(u.target.value)
5212
+ onBlur: ({ target: { value: p } }) => a(r, p),
5213
+ onChange: (p) => n(p.target.value)
5189
5214
  }
5190
5215
  )
5191
5216
  ] })
@@ -5227,25 +5252,25 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5227
5252
  }
5228
5253
  );
5229
5254
  }, LinkField = ({ schema: o, formData: n, onChange: r }) => {
5230
- const [a, l] = useState([]), i = useBuilderProp("getPages", () => []), { type: c = "page", href: d = "", target: u = "self" } = n;
5255
+ const [a, l] = useState([]), i = useBuilderProp("getPages", () => []), { type: c = "page", href: d = "", target: p = "self" } = n;
5231
5256
  return useEffect(() => {
5232
5257
  (async () => {
5233
- const p = await i();
5234
- l(p || []);
5258
+ const u = await i();
5259
+ l(u || []);
5235
5260
  })();
5236
5261
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5237
5262
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
5238
5263
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
5239
- /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: c, onChange: (p) => r({ ...n, type: p.target.value }), children: [
5264
+ /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: c, onChange: (u) => r({ ...n, type: u.target.value }), children: [
5240
5265
  { const: "page", title: "Open Page" },
5241
5266
  { const: "url", title: "Open URL" },
5242
5267
  { const: "email", title: "Compose Email" },
5243
5268
  { const: "telephone", title: "Call Phone" },
5244
5269
  { const: "scroll", title: "Scroll to element" }
5245
- ].map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.const, children: p.title }, p.const)) }),
5246
- c === "page" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { name: "href", value: d, onChange: (p) => r({ ...n, href: p.target.value || "#" }), children: [
5270
+ ].map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.const, children: u.title }, u.const)) }),
5271
+ c === "page" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { name: "href", value: d, onChange: (u) => r({ ...n, href: u.target.value || "#" }), children: [
5247
5272
  /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "Choose page" }),
5248
- map(a, (p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.slug, children: p.name }, p.uuid))
5273
+ map(a, (u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.slug, children: u.name }, u.uuid))
5249
5274
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
5250
5275
  "input",
5251
5276
  {
@@ -5255,7 +5280,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5255
5280
  name: "href",
5256
5281
  type: "text",
5257
5282
  value: d,
5258
- onChange: (p) => r({ ...n, href: p.target.value || "#" }),
5283
+ onChange: (u) => r({ ...n, href: u.target.value || "#" }),
5259
5284
  placeholder: c === "page" || c === "url" ? "Enter URL" : c === "scroll" ? "#ElementID" : "Enter detail"
5260
5285
  }
5261
5286
  ),
@@ -5267,9 +5292,9 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5267
5292
  autoCorrect: "off",
5268
5293
  spellCheck: "false",
5269
5294
  type: "checkbox",
5270
- defaultChecked: u === "_blank",
5295
+ defaultChecked: p === "_blank",
5271
5296
  className: "!w-fit cursor-pointer rounded-md border border-border",
5272
- onChange: () => r({ ...n, target: u === "_blank" ? "_self" : "_blank" })
5297
+ onChange: () => r({ ...n, target: p === "_blank" ? "_self" : "_blank" })
5273
5298
  }
5274
5299
  ),
5275
5300
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pt-1 text-xs", children: "Open in new tab" })
@@ -5281,8 +5306,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5281
5306
  if (typeof window > "u")
5282
5307
  return null;
5283
5308
  const i = o.replace("root.", ""), c = get(l, i, ""), d = () => {
5284
- const u = l == null ? void 0 : l._id;
5285
- a({ blockId: u, blockProp: i, placeholder: n, initialCode: get(l, i, c) });
5309
+ const p = l == null ? void 0 : l._id;
5310
+ a({ blockId: p, blockProp: i, placeholder: n, initialCode: get(l, i, c) });
5286
5311
  };
5287
5312
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex flex-col gap-y-1", children: [
5288
5313
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5296,19 +5321,19 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5296
5321
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
5297
5322
  ] });
5298
5323
  }, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
5299
- const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: m, languages: x } = useLanguages(), g = x.length === 0 ? "" : p.length ? p : m;
5300
- Object.keys(n).forEach((j) => {
5301
- const f = n[j];
5324
+ 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;
5325
+ Object.keys(n).forEach((b) => {
5326
+ const f = n[b];
5302
5327
  if (includes(["slot", "styles"], f.type))
5303
5328
  return;
5304
- const _ = j;
5305
- c.properties[_] = getBlockJSONFromSchemas(f, u, g), d[_] = getBlockJSONFromUISchemas(f);
5329
+ const v = b;
5330
+ c.properties[v] = getBlockJSONFromSchemas(f, p, g), d[v] = getBlockJSONFromUISchemas(f);
5306
5331
  }), useEffect(() => {
5307
5332
  i(r);
5308
- }, [o, p]);
5333
+ }, [o, u]);
5309
5334
  const E = useThrottledCallback(
5310
- async ({ formData: j }, f) => {
5311
- a({ formData: j }, f);
5335
+ async ({ formData: b }, f) => {
5336
+ a({ formData: b }, f);
5312
5337
  },
5313
5338
  [a],
5314
5339
  1e3
@@ -5334,8 +5359,8 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5334
5359
  uiSchema: d,
5335
5360
  schema: c,
5336
5361
  formData: l,
5337
- onChange: ({ formData: j }, f) => {
5338
- f && (i(j), E({ formData: j }, f));
5362
+ onChange: ({ formData: b }, f) => {
5363
+ f && (i(b), E({ formData: b }, f));
5339
5364
  }
5340
5365
  }
5341
5366
  );
@@ -5357,7 +5382,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5357
5382
  id: "show-on-canvas",
5358
5383
  checked: c,
5359
5384
  onCheckedChange: (d) => {
5360
- d ? (n((u) => [...u, r._id]), a([r._id])) : n((u) => u.filter((p) => p !== r._id));
5385
+ d ? (n((p) => [...p, r._id]), a([r._id])) : n((p) => p.filter((u) => u !== r._id));
5361
5386
  }
5362
5387
  }
5363
5388
  ),
@@ -5404,32 +5429,32 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5404
5429
  }), a;
5405
5430
  };
5406
5431
  function BlockSettings() {
5407
- 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: f }, _, v) => {
5408
- if (_ && (c == null ? void 0 : c._id) === n._id) {
5409
- const S = _.replace("root.", "");
5410
- a([n._id], { [S]: get(f, S) }, v);
5432
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), p = useBuilderProp("dataBindingSupport", !1), u = ({ formData: f }, v, _) => {
5433
+ if (v && (c == null ? void 0 : c._id) === n._id) {
5434
+ const C = v.replace("root.", "");
5435
+ a([n._id], { [C]: get(f, C) }, _);
5411
5436
  }
5412
5437
  }, m = useCallback(
5413
- debounce(({ formData: f }, _, v) => {
5414
- p({ formData: f }, _, v), d(f);
5438
+ debounce(({ formData: f }, v, _) => {
5439
+ u({ formData: f }, v, _), d(f);
5415
5440
  }, 1500),
5416
5441
  [n == null ? void 0 : n._id, o]
5417
- ), x = ({ formData: f }, _) => {
5418
- if (_) {
5419
- const v = _.replace("root.", "");
5442
+ ), x = ({ formData: f }, v) => {
5443
+ if (v) {
5444
+ const _ = v.replace("root.", "");
5420
5445
  r(
5421
5446
  [n._id],
5422
- convertDotNotationToObject(v, get(f, v.split(".")))
5423
- ), m({ formData: f }, _, { [v]: get(c, v) });
5447
+ convertDotNotationToObject(_, get(f, _.split(".")))
5448
+ ), m({ formData: f }, v, { [_]: get(c, _) });
5424
5449
  }
5425
5450
  }, g = keys(get(i, "_bindings", {})), E = useMemo(() => {
5426
5451
  const f = cloneDeep(get(l, "props", {}));
5427
- return each(f, (_, v) => {
5428
- get(_, "hidden", !1) && delete f[v];
5429
- }), u && each(g, (_) => delete f[_]), f;
5430
- }, [l, g, u]), j = get(l, "server", !1);
5452
+ return each(f, (v, _) => {
5453
+ get(v, "hidden", !1) && delete f[_];
5454
+ }), p && each(g, (v) => delete f[v]), f;
5455
+ }, [l, g, p]), b = get(l, "server", !1);
5431
5456
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
5432
- u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5457
+ p ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5433
5458
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
5434
5459
  /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
5435
5460
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5445,7 +5470,7 @@ function BlockSettings() {
5445
5470
  {
5446
5471
  bindingData: get(n, "_bindings", {}),
5447
5472
  onChange: (f) => {
5448
- p({ formData: { _bindings: f } }, "root._bindings");
5473
+ u({ formData: { _bindings: f } }, "root._bindings");
5449
5474
  }
5450
5475
  }
5451
5476
  ) })
@@ -5484,7 +5509,7 @@ function BlockSettings() {
5484
5509
  }
5485
5510
  ),
5486
5511
  (n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
5487
- j ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: n == null ? void 0 : n._id }) : null,
5512
+ b ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: n == null ? void 0 : n._id }) : null,
5488
5513
  /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
5489
5514
  ] });
5490
5515
  }
@@ -5508,25 +5533,25 @@ function promptWithLanguage(o, n, r) {
5508
5533
  ${a}`;
5509
5534
  }
5510
5535
  const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5511
- 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;
5536
+ 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;
5512
5537
  return {
5513
5538
  askAi: useCallback(
5514
- async (x, g, E, j) => {
5539
+ async (x, g, E, b) => {
5515
5540
  if (l) {
5516
5541
  n(!0), a(null);
5517
5542
  try {
5518
- const f = x === "content" ? cloneDeep(getBlockWithChildren(g, d)) : [cloneDeep(d.find((w) => w._id === g))];
5543
+ const f = x === "content" ? cloneDeep(getBlockWithChildren(g, d)) : [cloneDeep(d.find((S) => S._id === g))];
5519
5544
  set(f, "0._parent", null);
5520
- const _ = u === p ? "" : u, v = await l(x, promptWithLanguage(E, m, x), f, _), { blocks: S, error: B } = v;
5545
+ const v = p === u ? "" : p, _ = await l(x, promptWithLanguage(E, m, x), f, v), { blocks: C, error: B } = _;
5521
5546
  if (B) {
5522
5547
  a(B);
5523
5548
  return;
5524
5549
  }
5525
- x === "styles" ? c(S) : i(S), j && j(v);
5550
+ x === "styles" ? c(C) : i(C), b && b(_);
5526
5551
  } catch (f) {
5527
5552
  a(f);
5528
5553
  } finally {
5529
- n(!1), j && j();
5554
+ n(!1), b && b();
5530
5555
  }
5531
5556
  }
5532
5557
  },
@@ -5534,8 +5559,8 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5534
5559
  l,
5535
5560
  n,
5536
5561
  d,
5537
- u,
5538
5562
  p,
5563
+ u,
5539
5564
  m,
5540
5565
  c,
5541
5566
  i
@@ -5562,10 +5587,10 @@ function Countdown() {
5562
5587
  const [o, n] = useState(SECONDS), [r, a] = useState(!1);
5563
5588
  useEffect(() => {
5564
5589
  if (r && o > 0) {
5565
- const u = setTimeout(() => {
5590
+ const p = setTimeout(() => {
5566
5591
  n(o - 0.1);
5567
5592
  }, 100);
5568
- return () => clearTimeout(u);
5593
+ return () => clearTimeout(p);
5569
5594
  } else
5570
5595
  o <= 0 && (a(!1), n(SECONDS));
5571
5596
  }, [r, o]);
@@ -5610,14 +5635,14 @@ function Countdown() {
5610
5635
  ] });
5611
5636
  }
5612
5637
  const AskAIStyles = ({ blockId: o }) => {
5613
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
5638
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), [u, m] = useState();
5614
5639
  useEffect(() => {
5615
5640
  var g;
5616
5641
  (g = d.current) == null || g.focus();
5617
5642
  }, []);
5618
5643
  const x = (g) => {
5619
5644
  const { usage: E } = g || {};
5620
- !l && E && m(E), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
5645
+ !l && E && m(E), p.current = setTimeout(() => m(void 0), 1e4), l || c("");
5621
5646
  };
5622
5647
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5623
5648
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
@@ -5631,7 +5656,7 @@ const AskAIStyles = ({ blockId: o }) => {
5631
5656
  className: "w-full border border-border focus:border-0",
5632
5657
  rows: 3,
5633
5658
  onKeyDown: (g) => {
5634
- g.key === "Enter" && (g.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x));
5659
+ g.key === "Enter" && (g.preventDefault(), p.current && clearTimeout(p.current), m(void 0), r("styles", o, i, x));
5635
5660
  }
5636
5661
  }
5637
5662
  ),
@@ -5641,7 +5666,7 @@ const AskAIStyles = ({ blockId: o }) => {
5641
5666
  {
5642
5667
  disabled: i.trim().length < 5 || a,
5643
5668
  onClick: () => {
5644
- u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x);
5669
+ p.current && clearTimeout(p.current), m(void 0), r("styles", o, i, x);
5645
5670
  },
5646
5671
  variant: "default",
5647
5672
  className: "w-fit",
@@ -5660,11 +5685,11 @@ const AskAIStyles = ({ blockId: o }) => {
5660
5685
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("stop") })
5661
5686
  ] }) : null
5662
5687
  ] }),
5663
- 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: [
5688
+ 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: [
5664
5689
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
5665
5690
  n("Total tokens used"),
5666
5691
  ": ",
5667
- p.totalTokens
5692
+ u.totalTokens
5668
5693
  ] }),
5669
5694
  /* @__PURE__ */ jsxRuntimeExports.jsx(Countdown, {})
5670
5695
  ] }) }) : null,
@@ -5678,24 +5703,24 @@ const AskAIStyles = ({ blockId: o }) => {
5678
5703
  });
5679
5704
  function ManualClasses() {
5680
5705
  var A;
5681
- const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (A = first(n)) == null ? void 0 : A.prop, x = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
5706
+ 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 = () => {
5682
5707
  const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5683
- a(i, N, !0), u("");
5684
- }, [E, j] = useState([]), f = ({ value: N }) => {
5685
- const D = N.trim().toLowerCase(), T = D.match(/.+:/g);
5686
- let b = [];
5687
- if (T && T.length > 0) {
5688
- const [k] = T, C = D.replace(k, "");
5689
- b = fuse.search(C).map((I) => ({
5690
- ...I,
5691
- item: { ...I.item, name: k + I.item.name }
5708
+ a(i, N, !0), p("");
5709
+ }, [E, b] = useState([]), f = ({ value: N }) => {
5710
+ const D = N.trim().toLowerCase(), I = D.match(/.+:/g);
5711
+ let j = [];
5712
+ if (I && I.length > 0) {
5713
+ const [k] = I, w = D.replace(k, "");
5714
+ j = fuse.search(w).map((T) => ({
5715
+ ...T,
5716
+ item: { ...T.item, name: k + T.item.name }
5692
5717
  }));
5693
5718
  } else
5694
- b = fuse.search(D);
5695
- return j(map(b, "item"));
5696
- }, _ = () => {
5697
- j([]);
5698
- }, v = (N) => N.name, S = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5719
+ j = fuse.search(D);
5720
+ return b(map(j, "item"));
5721
+ }, v = () => {
5722
+ b([]);
5723
+ }, _ = (N) => N.name, C = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5699
5724
  autoComplete: "off",
5700
5725
  autoCorrect: "off",
5701
5726
  autoCapitalize: "off",
@@ -5705,18 +5730,18 @@ function ManualClasses() {
5705
5730
  onKeyDown: (N) => {
5706
5731
  N.key === "Enter" && d.trim() !== "" && g();
5707
5732
  },
5708
- onChange: (N, { newValue: D }) => u(D),
5733
+ onChange: (N, { newValue: D }) => p(D),
5709
5734
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5710
- }, w = () => {
5735
+ }, S = () => {
5711
5736
  if (navigator.clipboard === void 0) {
5712
- p({
5737
+ u({
5713
5738
  title: o("clipboard_not_supported"),
5714
5739
  description: o("please_use_chrome_firefox_or_safari"),
5715
5740
  variant: "destructive"
5716
5741
  });
5717
5742
  return;
5718
5743
  }
5719
- navigator.clipboard.writeText(x.join(" ")), p({
5744
+ navigator.clipboard.writeText(x.join(" ")), u({
5720
5745
  title: o("copied"),
5721
5746
  description: o("classes_copied_to_clipboard")
5722
5747
  });
@@ -5730,7 +5755,7 @@ function ManualClasses() {
5730
5755
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5731
5756
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
5732
5757
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
5733
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: w, className: "cursor-pointer" }) }),
5758
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: S, className: "cursor-pointer" }) }),
5734
5759
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("copy_classes_to_clipboard") }) })
5735
5760
  ] })
5736
5761
  ] }),
@@ -5748,9 +5773,9 @@ function ManualClasses() {
5748
5773
  {
5749
5774
  suggestions: E,
5750
5775
  onSuggestionsFetchRequested: f,
5751
- onSuggestionsClearRequested: _,
5752
- getSuggestionValue: v,
5753
- renderSuggestion: S,
5776
+ onSuggestionsClearRequested: v,
5777
+ getSuggestionValue: _,
5778
+ renderSuggestion: C,
5754
5779
  inputProps: B,
5755
5780
  containerProps: {
5756
5781
  className: "relative h-8 w-full gap-y-1 py-1 border-border"
@@ -6090,7 +6115,7 @@ const EDITOR_ICONS = {
6090
6115
  DropDown,
6091
6116
  {
6092
6117
  rounded: o,
6093
- onChange: (u) => r(u, n),
6118
+ onChange: (p) => r(p, n),
6094
6119
  selected: i,
6095
6120
  options: a,
6096
6121
  disabled: !c
@@ -6104,23 +6129,23 @@ function DropDown({ selected: o, onChange: n, rounded: r = !1, options: a, disab
6104
6129
  {
6105
6130
  disabled: !a.length || l,
6106
6131
  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`,
6107
- onChange: (u) => n(u.target.value),
6108
- onKeyDown: (u) => {
6109
- u.ctrlKey && (u.key === "z" && c(), u.key === "y" && d());
6132
+ onChange: (p) => n(p.target.value),
6133
+ onKeyDown: (p) => {
6134
+ p.ctrlKey && (p.key === "z" && c(), p.key === "y" && d());
6110
6135
  },
6111
6136
  value: i,
6112
6137
  children: [
6113
6138
  /* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: "" }),
6114
6139
  React__default.Children.toArray(
6115
- a.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: u, children: u }))
6140
+ a.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: p, children: p }))
6116
6141
  )
6117
6142
  ]
6118
6143
  }
6119
6144
  );
6120
6145
  }
6121
6146
  const RangeChoices = ({ property: o, onChange: n }) => {
6122
- 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);
6123
- 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: [
6147
+ 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);
6148
+ 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: [
6124
6149
  /* @__PURE__ */ jsxRuntimeExports.jsx(
6125
6150
  "button",
6126
6151
  {
@@ -6181,12 +6206,12 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6181
6206
  ringColor: "ring",
6182
6207
  ringOffsetColor: "ring-offset"
6183
6208
  }, ColorChoice = ({ property: o, onChange: n }) => {
6184
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), x = get(p, "2", ""), g = useCallback(
6209
+ 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(
6185
6210
  // eslint-disable-next-line no-shadow
6186
- (j) => {
6187
- ["current", "inherit", "transparent", "black", "white"].includes(j) ? (c([]), u({ color: j })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((f) => ({ ...f, color: j, shade: f.shade ? f.shade : "500" })));
6211
+ (b) => {
6212
+ ["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" })));
6188
6213
  },
6189
- [c, u]
6214
+ [c, p]
6190
6215
  );
6191
6216
  useEffect(() => {
6192
6217
  if (["current", "inherit", "transparent", "black", "white"].includes(m))
@@ -6195,13 +6220,13 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6195
6220
  }, [m]);
6196
6221
  const E = useCallback(
6197
6222
  // eslint-disable-next-line no-shadow
6198
- (j) => {
6199
- u({ color: m, shade: j });
6223
+ (b) => {
6224
+ p({ color: m, shade: b });
6200
6225
  },
6201
6226
  [m]
6202
6227
  );
6203
6228
  return useEffect(() => {
6204
- u({ color: "", shade: "" });
6229
+ p({ color: "", shade: "" });
6205
6230
  }, [r]), useEffect(() => {
6206
6231
  const f = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6207
6232
  f.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(f, o);
@@ -6409,18 +6434,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6409
6434
  "button",
6410
6435
  {
6411
6436
  type: "button",
6412
- onMouseDown: (u) => {
6413
- const p = {
6437
+ onMouseDown: (p) => {
6438
+ const u = {
6414
6439
  onDrag: r,
6415
6440
  onDragEnd: a,
6416
6441
  dragging: !0,
6417
- dragStartY: u.pageY,
6442
+ dragStartY: p.pageY,
6418
6443
  dragStartValue: `${n}`,
6419
6444
  dragUnit: o,
6420
6445
  negative: i,
6421
6446
  cssProperty: c
6422
6447
  };
6423
- l(p), d(p);
6448
+ l(u), d(u);
6424
6449
  },
6425
6450
  color: void 0,
6426
6451
  className: "relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",
@@ -6440,50 +6465,50 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6440
6465
  },
6441
6466
  a
6442
6467
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6443
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [x, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, j] = useState(!1), [f, _] = useState(""), [v, S] = useState(!1), [B, w] = useState(!1);
6468
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: m } = o, [x, g] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [E, b] = useState(!1), [f, v] = useState(""), [_, C] = useState(!1), [B, S] = useState(!1);
6444
6469
  useEffect(() => {
6445
- const { value: b, unit: k } = getClassValueAndUnit(i);
6470
+ const { value: j, unit: k } = getClassValueAndUnit(i);
6446
6471
  if (k === "") {
6447
- l(b), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6472
+ l(j), g(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
6448
6473
  return;
6449
6474
  }
6450
- g(k), l(k === "class" || isEmpty(b) ? "" : b);
6451
- }, [i, u, p]);
6452
- const A = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), N = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), D = useCallback(
6453
- (b = !1) => {
6454
- const k = getUserInputValues(`${a}`, p);
6475
+ g(k), l(k === "class" || isEmpty(j) ? "" : j);
6476
+ }, [i, p, u]);
6477
+ const A = useThrottledCallback((j) => c(j), [c], THROTTLE_TIME), N = useThrottledCallback((j) => c(j, !1), [c], THROTTLE_TIME), D = useCallback(
6478
+ (j = !1) => {
6479
+ const k = getUserInputValues(`${a}`, u);
6455
6480
  if (get(k, "error", !1)) {
6456
- j(!0);
6481
+ b(!0);
6457
6482
  return;
6458
6483
  }
6459
- const C = get(k, "unit") !== "" ? get(k, "unit") : x;
6460
- if (C === "auto" || C === "none") {
6461
- A(`${d}${C}`);
6484
+ const w = get(k, "unit") !== "" ? get(k, "unit") : x;
6485
+ if (w === "auto" || w === "none") {
6486
+ A(`${d}${w}`);
6462
6487
  return;
6463
6488
  }
6464
6489
  if (get(k, "value") === "")
6465
6490
  return;
6466
- const I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6467
- b ? N(I) : A(I);
6491
+ const T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6492
+ j ? N(T) : A(T);
6468
6493
  },
6469
- [A, N, a, x, d, p]
6470
- ), T = useCallback(
6471
- (b) => {
6472
- const k = getUserInputValues(`${a}`, p);
6494
+ [A, N, a, x, d, u]
6495
+ ), I = useCallback(
6496
+ (j) => {
6497
+ const k = getUserInputValues(`${a}`, u);
6473
6498
  if (get(k, "error", !1)) {
6474
- j(!0);
6499
+ b(!0);
6475
6500
  return;
6476
6501
  }
6477
- if (b === "auto" || b === "none") {
6478
- A(`${d}${b}`);
6502
+ if (j === "auto" || j === "none") {
6503
+ A(`${d}${j}`);
6479
6504
  return;
6480
6505
  }
6481
6506
  if (get(k, "value") === "")
6482
6507
  return;
6483
- const C = get(k, "unit") !== "" ? get(k, "unit") : b, I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6484
- A(I);
6508
+ const w = get(k, "unit") !== "" ? get(k, "unit") : j, T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6509
+ A(T);
6485
6510
  },
6486
- [A, a, d, p]
6511
+ [A, a, d, u]
6487
6512
  );
6488
6513
  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: [
6489
6514
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
@@ -6491,37 +6516,37 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6491
6516
  /* @__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, {}) }) }),
6492
6517
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6493
6518
  ] })
6494
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
6519
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${_ ? "z-auto" : ""}`, children: [
6495
6520
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6496
6521
  ["none", "auto"].indexOf(x) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6497
6522
  "input",
6498
6523
  {
6499
6524
  readOnly: x === "class",
6500
- onKeyPress: (b) => {
6501
- b.key === "Enter" && D();
6525
+ onKeyPress: (j) => {
6526
+ j.key === "Enter" && D();
6502
6527
  },
6503
- onKeyDown: (b) => {
6504
- if (b.keyCode !== 38 && b.keyCode !== 40)
6528
+ onKeyDown: (j) => {
6529
+ if (j.keyCode !== 38 && j.keyCode !== 40)
6505
6530
  return;
6506
- b.preventDefault(), w(!0);
6507
- const k = parseInt$1(b.target.value);
6508
- let C = isNaN$1(k) ? 0 : k;
6509
- b.keyCode === 38 && (C += 1), b.keyCode === 40 && (C -= 1);
6510
- const R = `${C}`, L = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
6531
+ j.preventDefault(), S(!0);
6532
+ const k = parseInt$1(j.target.value);
6533
+ let w = isNaN$1(k) ? 0 : k;
6534
+ j.keyCode === 38 && (w += 1), j.keyCode === 40 && (w -= 1);
6535
+ const R = `${w}`, L = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
6511
6536
  N(L);
6512
6537
  },
6513
- onKeyUp: (b) => {
6514
- B && (b.preventDefault(), w(!1));
6538
+ onKeyUp: (j) => {
6539
+ B && (j.preventDefault(), S(!1));
6515
6540
  },
6516
6541
  onBlur: () => D(),
6517
- onChange: (b) => {
6518
- j(!1), l(b.target.value);
6542
+ onChange: (j) => {
6543
+ b(!1), l(j.target.value);
6519
6544
  },
6520
- onClick: (b) => {
6545
+ onClick: (j) => {
6521
6546
  var k;
6522
- (k = b == null ? void 0 : b.target) == null || k.select(), r(!1);
6547
+ (k = j == null ? void 0 : j.target) == null || k.select(), r(!1);
6523
6548
  },
6524
- value: v ? f : a,
6549
+ value: _ ? f : a,
6525
6550
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6526
6551
  " ",
6527
6552
  E ? "border-red-500 text-red-500" : "border-foreground/20"
@@ -6536,44 +6561,44 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6536
6561
  onClick: () => r(!n),
6537
6562
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
6538
6563
  children: [
6539
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: x }),
6540
- p.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
6564
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: x }),
6565
+ u.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
6541
6566
  ]
6542
6567
  }
6543
6568
  ) }),
6544
6569
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipPortal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6545
6570
  UnitSelection,
6546
6571
  {
6547
- units: p,
6572
+ units: u,
6548
6573
  current: x,
6549
- onSelect: (b) => {
6550
- r(!1), g(b), T(b);
6574
+ onSelect: (j) => {
6575
+ r(!1), g(j), I(j);
6551
6576
  }
6552
6577
  }
6553
6578
  ) }) })
6554
6579
  ] })
6555
6580
  ] }),
6556
- ["none", "auto"].indexOf(x) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6581
+ ["none", "auto"].indexOf(x) !== -1 || _ ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6557
6582
  DragStyleButton,
6558
6583
  {
6559
- onDragStart: () => S(!0),
6560
- onDragEnd: (b) => {
6561
- if (_(() => ""), S(!1), isEmpty(b))
6584
+ onDragStart: () => C(!0),
6585
+ onDragEnd: (j) => {
6586
+ if (v(() => ""), C(!1), isEmpty(j))
6562
6587
  return;
6563
- const k = `${b}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6588
+ const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6564
6589
  A(R);
6565
6590
  },
6566
- onDrag: (b) => {
6567
- if (isEmpty(b))
6591
+ onDrag: (j) => {
6592
+ if (isEmpty(j))
6568
6593
  return;
6569
- _(b);
6570
- const k = `${b}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6594
+ v(j);
6595
+ const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6571
6596
  N(R);
6572
6597
  },
6573
6598
  currentValue: a,
6574
6599
  unit: x,
6575
6600
  negative: m,
6576
- cssProperty: u
6601
+ cssProperty: p
6577
6602
  }
6578
6603
  )
6579
6604
  ] }) }) });
@@ -6665,21 +6690,21 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6665
6690
  "2xl": "1536px"
6666
6691
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6667
6692
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6668
- }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [j] = useSelectedBlockIds(), f = useMemo(() => get(x, "fullCls", ""), [x]), _ = useCallback(
6693
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), f = useMemo(() => get(x, "fullCls", ""), [x]), v = useCallback(
6669
6694
  (N, D = !0) => {
6670
- const T = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
6671
- (u || p !== "") && (T.mq = "xs");
6672
- const b = generateFullClsName(T);
6673
- g(j, [b], D);
6695
+ const I = { dark: p, mq: m, mod: u, cls: N, property: l, fullCls: "" };
6696
+ (p || u !== "") && (I.mq = "xs");
6697
+ const j = generateFullClsName(I);
6698
+ g(b, [j], D);
6674
6699
  },
6675
- [j, u, m, p, l, g]
6676
- ), v = useCallback(() => {
6677
- E(j, [f]);
6678
- }, [j, f, E]), S = useMemo(() => canChangeClass(x, m), [x, m]);
6700
+ [b, p, m, u, l, g]
6701
+ ), _ = useCallback(() => {
6702
+ E(b, [f]);
6703
+ }, [b, f, E]), C = useMemo(() => canChangeClass(x, m), [x, m]);
6679
6704
  useEffect(() => {
6680
- i(S, x);
6681
- }, [S, i, x]);
6682
- const [, , B] = useCanvasWidth(), w = useCallback(
6705
+ i(C, x);
6706
+ }, [C, i, x]);
6707
+ const [, , B] = useCanvasWidth(), S = useCallback(
6683
6708
  (N) => {
6684
6709
  B({
6685
6710
  xs: 400,
@@ -6691,8 +6716,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6691
6716
  }[N]);
6692
6717
  },
6693
6718
  [B]
6694
- ), A = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === m;
6695
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6719
+ ), A = get(x, "dark", null) === p && get(x, "mod", null) === u && get(x, "mq", null) === m;
6720
+ 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: [
6696
6721
  /* @__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) }) }),
6697
6722
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6698
6723
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
@@ -6702,17 +6727,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6702
6727
  currentClass: get(x, "cls", ""),
6703
6728
  classPrefix: get(CLASS_PREFIXES, l, ""),
6704
6729
  units: c || [],
6705
- onChange: _,
6730
+ onChange: v,
6706
6731
  negative: d,
6707
6732
  cssProperty: l
6708
6733
  }
6709
6734
  ) : null,
6710
- r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: _ }),
6711
- r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: _ }),
6712
- r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: _ }),
6713
- r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: _ })
6735
+ r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: v }),
6736
+ r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: v }),
6737
+ r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: v }),
6738
+ r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: v })
6714
6739
  ] }),
6715
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => v(), 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 && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6740
+ /* @__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: [
6716
6741
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6717
6742
  "button",
6718
6743
  {
@@ -6725,14 +6750,14 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6725
6750
  "Current style is set at  ",
6726
6751
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
6727
6752
  getBreakpoint(get(x, "mq")),
6728
- u && !x.dark ? "(Light mode)" : ""
6753
+ p && !x.dark ? "(Light mode)" : ""
6729
6754
  ] }),
6730
6755
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
6731
6756
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
6732
6757
  "button",
6733
6758
  {
6734
6759
  type: "button",
6735
- onClick: () => w(get(x, "mq")),
6760
+ onClick: () => S(get(x, "mq")),
6736
6761
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6737
6762
  children: [
6738
6763
  "Switch to ",
@@ -6753,7 +6778,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6753
6778
  units: i = basicUnits,
6754
6779
  negative: c = !1
6755
6780
  }) => {
6756
- const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), x = useCallback((g) => map(m, "property").includes(g), [m]);
6781
+ const { t: d } = useTranslation(), [p, u] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), x = useCallback((g) => map(m, "property").includes(g), [m]);
6757
6782
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6758
6783
  "div",
6759
6784
  {
@@ -6767,8 +6792,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6767
6792
  "button",
6768
6793
  {
6769
6794
  type: "button",
6770
- onClick: () => p(E),
6771
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${E === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6795
+ onClick: () => u(E),
6796
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${E === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6772
6797
  children: [
6773
6798
  React__default.createElement("div", {
6774
6799
  className: x(E) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
@@ -6787,7 +6812,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6787
6812
  type: l,
6788
6813
  units: [...i],
6789
6814
  label: "",
6790
- property: u,
6815
+ property: p,
6791
6816
  negative: c
6792
6817
  }
6793
6818
  ) })
@@ -6796,10 +6821,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6796
6821
  );
6797
6822
  }, NestedOptions = ({ heading: o, items: n }) => {
6798
6823
  const { t: r } = useTranslation(), a = useSelectedBlockCurrentClasses(), l = useMemo(() => {
6799
- const i = (u) => flatten(
6800
- u.map((p) => p.styleType === "multiple" ? map(p.options, "key") : p.property)
6824
+ const i = (p) => flatten(
6825
+ p.map((u) => u.styleType === "multiple" ? map(u.options, "key") : u.property)
6801
6826
  ), c = flatten(
6802
- n.map((u) => u.styleType === "accordion" ? i(u.items) : u.styleType === "multiple" ? map(u.options, "key") : u.property)
6827
+ n.map((p) => p.styleType === "accordion" ? i(p.items) : p.styleType === "multiple" ? map(p.options, "key") : p.property)
6803
6828
  ), d = map(a, "property");
6804
6829
  return intersection(c, d).length > 0;
6805
6830
  }, [a, n]);
@@ -6819,11 +6844,11 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6819
6844
  const { t: n } = useTranslation(), r = useSelectedBlockCurrentClasses(), a = useCallback(
6820
6845
  (i = []) => {
6821
6846
  const c = {};
6822
- for (let u = 0; u < r.length; u++)
6823
- c[r[u].property] = r[u].cls;
6847
+ for (let p = 0; p < r.length; p++)
6848
+ c[r[p].property] = r[p].cls;
6824
6849
  let d = !0;
6825
- for (const u in i)
6826
- if (!has(c, u) || c[u] !== i[u]) {
6850
+ for (const p in i)
6851
+ if (!has(c, p) || c[p] !== i[p]) {
6827
6852
  d = !1;
6828
6853
  break;
6829
6854
  }
@@ -6841,8 +6866,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6841
6866
  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`, {});
6842
6867
  if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
6843
6868
  return null;
6844
- const u = (p) => {
6845
- const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6869
+ const p = (u) => {
6870
+ const m = u.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6846
6871
  l([o._id], m, !0);
6847
6872
  };
6848
6873
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
@@ -6858,16 +6883,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6858
6883
  r("presets")
6859
6884
  ] }),
6860
6885
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
6861
- /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(d).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => u(d[p]), children: [
6862
- capitalize(startCase(r(p))),
6886
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(d).map((u) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => p(d[u]), children: [
6887
+ capitalize(startCase(r(u))),
6863
6888
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
6864
6889
  ] })) })
6865
6890
  ] }),
6866
6891
  isEmpty(a) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6867
6892
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuLabel, { children: r("Global presets") }),
6868
6893
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
6869
- /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(a).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => u(a[p]), children: [
6870
- capitalize(startCase(r(p))),
6894
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(a).map((u) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => p(a[u]), children: [
6895
+ capitalize(startCase(r(u))),
6871
6896
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
6872
6897
  ] })) })
6873
6898
  ] })
@@ -6887,8 +6912,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6887
6912
  };
6888
6913
  function BlockStyling() {
6889
6914
  const { flexChild: o, gridChild: n } = useSelectedBlocksDisplayChild(), [r] = useSelectedStylingBlocks(), [a, l] = React__default.useState(""), [i, c] = React__default.useState({
6890
- onDrag: (p) => p,
6891
- onDragEnd: (p) => p,
6915
+ onDrag: (u) => u,
6916
+ onDragEnd: (u) => u,
6892
6917
  dragStartY: 0,
6893
6918
  dragging: !1,
6894
6919
  dragStartValue: 0,
@@ -6896,21 +6921,21 @@ function BlockStyling() {
6896
6921
  negative: !1,
6897
6922
  cssProperty: ""
6898
6923
  }), d = useThrottledCallback(
6899
- (p) => {
6924
+ (u) => {
6900
6925
  const m = !get(i, "negative", !1), x = get(i, "cssProperty", "");
6901
6926
  let g = parseFloat(i.dragStartValue);
6902
6927
  g = isNaN(g) ? 0 : g;
6903
6928
  let E = MAPPER[i.dragUnit];
6904
6929
  (startsWith(x, "scale") || x === "opacity") && (E = 10);
6905
- let f = (i.dragStartY - p.pageY) / E + g;
6930
+ let f = (i.dragStartY - u.pageY) / E + g;
6906
6931
  m && f < 0 && (f = 0), x === "opacity" && f > 1 && (f = 1), i.onDrag(`${f}`), l(`${f}`);
6907
6932
  },
6908
6933
  [i],
6909
6934
  50
6910
- ), u = useCallback(() => {
6935
+ ), p = useCallback(() => {
6911
6936
  setTimeout(() => i.onDragEnd(`${a}`), 100), c({
6912
- onDrag: (p) => p,
6913
- onDragEnd: (p) => p,
6937
+ onDrag: (u) => u,
6938
+ onDragEnd: (u) => u,
6914
6939
  dragStartY: 0,
6915
6940
  dragging: !1,
6916
6941
  dragStartValue: 0,
@@ -6924,7 +6949,7 @@ function BlockStyling() {
6924
6949
  "div",
6925
6950
  {
6926
6951
  onMouseMove: d,
6927
- onMouseUp: () => u(),
6952
+ onMouseUp: () => p(),
6928
6953
  className: "absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"
6929
6954
  }
6930
6955
  ) : null,
@@ -6933,7 +6958,7 @@ function BlockStyling() {
6933
6958
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { defaultValue: ["Styles"], type: "multiple", className: "w-full", children: [
6934
6959
  o && /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: FLEX_CHILD_SECTION }),
6935
6960
  n ? /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: GRID_CHILD_SECTION }) : null,
6936
- SETTINGS_SECTIONS.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: p }, p.heading))
6961
+ SETTINGS_SECTIONS.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: u }, u.heading))
6937
6962
  ] })
6938
6963
  ] })
6939
6964
  ] });
@@ -6945,9 +6970,9 @@ const ChaiSelect = ({
6945
6970
  placeholder: a = "Select",
6946
6971
  className: l = ""
6947
6972
  }) => {
6948
- const [i, c] = useState(o), d = (u) => {
6949
- const p = u.target.value;
6950
- c(p), n(p);
6973
+ const [i, c] = useState(o), d = (p) => {
6974
+ const u = p.target.value;
6975
+ c(u), n(u);
6951
6976
  };
6952
6977
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("relative inline-block w-full", l), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
6953
6978
  "select",
@@ -6957,7 +6982,7 @@ const ChaiSelect = ({
6957
6982
  onChange: d,
6958
6983
  children: [
6959
6984
  /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", disabled: !0, children: a }),
6960
- r.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.value, children: u.label }, u.value))
6985
+ r.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.value, children: p.label }, p.value))
6961
6986
  ]
6962
6987
  }
6963
6988
  ) });
@@ -6989,34 +7014,34 @@ const BlockCard = ({
6989
7014
  library: n,
6990
7015
  parentId: r = void 0
6991
7016
  }) => {
6992
- const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), m = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (_) => {
6993
- const v = has(_, "styles_attrs.data-page-section");
6994
- return _._type === "Box" && v;
6995
- }, j = useCallback(
6996
- async (_) => {
6997
- if (_.stopPropagation(), has(o, "component")) {
7017
+ const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: u } = useBlockHighlight(), m = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (v) => {
7018
+ const _ = has(v, "styles_attrs.data-page-section");
7019
+ return v._type === "Box" && _;
7020
+ }, b = useCallback(
7021
+ async (v) => {
7022
+ if (v.stopPropagation(), has(o, "component")) {
6998
7023
  c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6999
7024
  return;
7000
7025
  }
7001
7026
  l(!0);
7002
- const v = await i(n, o);
7003
- isEmpty(v) || d(syncBlocksWithDefaults(v), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7027
+ const _ = await i(n, o);
7028
+ isEmpty(_) || d(syncBlocksWithDefaults(_), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7004
7029
  },
7005
7030
  [o]
7006
- ), f = async (_) => {
7007
- const v = await i(n, o);
7008
- let S = r;
7009
- if (E(first(v)) && (S = null), !isEmpty(v)) {
7010
- const B = { blocks: v, uiLibrary: !0, parent: S };
7011
- if (_.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
7012
- const w = new Image();
7013
- w.src = o.preview, w.onload = () => {
7014
- _.dataTransfer.setDragImage(w, 0, 0);
7031
+ ), f = async (v) => {
7032
+ const _ = await i(n, o);
7033
+ let C = r;
7034
+ if (E(first(_)) && (C = null), !isEmpty(_)) {
7035
+ const B = { blocks: _, uiLibrary: !0, parent: C };
7036
+ if (v.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
7037
+ const S = new Image();
7038
+ S.src = o.preview, S.onload = () => {
7039
+ v.dataTransfer.setDragImage(S, 0, 0);
7015
7040
  };
7016
7041
  } else
7017
- _.dataTransfer.setDragImage(new Image(), 0, 0);
7042
+ v.dataTransfer.setDragImage(new Image(), 0, 0);
7018
7043
  g(B), setTimeout(() => {
7019
- u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7044
+ p([]), u(), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7020
7045
  }, 200);
7021
7046
  }
7022
7047
  };
@@ -7025,7 +7050,7 @@ const BlockCard = ({
7025
7050
  "div",
7026
7051
  {
7027
7052
  onClick: a ? () => {
7028
- } : j,
7053
+ } : b,
7029
7054
  draggable: x ? "true" : "false",
7030
7055
  onDragStart: f,
7031
7056
  className: clsx(
@@ -7050,31 +7075,31 @@ const BlockCard = ({
7050
7075
  (async () => {
7051
7076
  if (i === "complete" || c.current === "loading")
7052
7077
  return;
7053
- c.current = "loading", r((u) => ({ ...u, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
7078
+ c.current = "loading", r((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
7054
7079
  const d = await a(o);
7055
- c.current = "idle", r((u) => ({ ...u, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
7080
+ c.current = "idle", r((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
7056
7081
  })();
7057
7082
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
7058
7083
  }, UILibrarySection = ({ parentId: o }) => {
7059
- 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, x] = useState("Hero"), g = get(p, m, []), E = useRef(null), { t: j } = useTranslation(), f = (S) => {
7084
+ 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) => {
7060
7085
  E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
7061
- E.current && x(S);
7086
+ E.current && x(C);
7062
7087
  }, 300);
7063
7088
  };
7064
- if (u)
7089
+ if (p)
7065
7090
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 grid h-full w-full grid-cols-12 gap-2", children: [
7066
7091
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7067
7092
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7068
7093
  ] });
7069
- const _ = filter(g, (S, B) => B % 2 === 0), v = filter(g, (S, B) => B % 2 === 1);
7094
+ const v = filter(g, (C, B) => B % 2 === 0), _ = filter(g, (C, B) => B % 2 === 1);
7070
7095
  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: [
7071
7096
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7072
7097
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
7073
7098
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
7074
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: j("groups") }),
7099
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: b("groups") }),
7075
7100
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7076
7101
  /* @__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(
7077
- map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7102
+ map(u, (C, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7078
7103
  "div",
7079
7104
  {
7080
7105
  onMouseEnter: () => f(B),
@@ -7085,7 +7110,7 @@ const BlockCard = ({
7085
7110
  B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7086
7111
  ),
7087
7112
  children: [
7088
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(j(B.toLowerCase())) }),
7113
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(b(B.toLowerCase())) }),
7089
7114
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7090
7115
  ]
7091
7116
  },
@@ -7102,10 +7127,10 @@ const BlockCard = ({
7102
7127
  children: [
7103
7128
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7104
7129
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7105
- _.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
7130
+ v.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7106
7131
  ) }),
7107
7132
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7108
- v.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
7133
+ _.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7109
7134
  ) })
7110
7135
  ] }),
7111
7136
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -7550,10 +7575,10 @@ i18n.use(initReactI18next).init({
7550
7575
  }
7551
7576
  });
7552
7577
  const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7553
- const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, m] = useHighlightBlockId(), x = () => {
7578
+ const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), x = () => {
7554
7579
  if (has(o, "blocks")) {
7555
- const j = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7556
- u(syncBlocksWithDefaults(j), r || null);
7580
+ const b = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7581
+ p(syncBlocksWithDefaults(b), r || null);
7557
7582
  } else
7558
7583
  d(o, r || null);
7559
7584
  emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
@@ -7565,9 +7590,9 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7565
7590
  disabled: n,
7566
7591
  onClick: x,
7567
7592
  type: "button",
7568
- onDragStart: (j) => {
7569
- j.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), j.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7570
- p([]), m(null);
7593
+ onDragStart: (b) => {
7594
+ b.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), b.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7595
+ u([]), m();
7571
7596
  }, 200);
7572
7597
  },
7573
7598
  draggable: g ? "true" : "false",
@@ -7585,19 +7610,19 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7585
7610
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ChaiBuilderBlocks, { gridCols: n, parentId: o, groups: c, blocks: i.core });
7586
7611
  }, CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, gridCols: a = "grid-cols-4" }) => {
7587
7612
  var d;
7588
- const { t: l } = useTranslation(), [i] = useBlocksStore(), c = (d = find(i, (u) => u._id === r)) == null ? void 0 : d._type;
7613
+ const { t: l } = useTranslation(), [i] = useBlocksStore(), c = (d = find(i, (p) => p._id === r)) == null ? void 0 : d._type;
7589
7614
  return React__default.Children.toArray(
7590
7615
  map(
7591
- sortBy(o, (u) => CORE_GROUPS.indexOf(u) === -1 ? 99 : CORE_GROUPS.indexOf(u)),
7592
- (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: [
7593
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "rounded-md bg-background px-4 py-2 capitalize text-foreground hover:no-underline", children: capitalize(l(u.toLowerCase())) }),
7616
+ sortBy(o, (p) => CORE_GROUPS.indexOf(p) === -1 ? 99 : CORE_GROUPS.indexOf(p)),
7617
+ (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: [
7618
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "rounded-md bg-background px-4 py-2 capitalize text-foreground hover:no-underline", children: capitalize(l(p.toLowerCase())) }),
7594
7619
  /* @__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(
7595
- reject(filter(values(n), { group: u }), { hidden: !0 }).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(
7620
+ reject(filter(values(n), { group: p }), { hidden: !0 }).map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx(
7596
7621
  CoreBlock,
7597
7622
  {
7598
7623
  parentId: r,
7599
- block: p,
7600
- disabled: !canAcceptChildBlock(c, p.type) || !canBeNestedInside(c, p.type)
7624
+ block: u,
7625
+ disabled: !canAcceptChildBlock(c, u.type) || !canBeNestedInside(c, u.type)
7601
7626
  }
7602
7627
  ))
7603
7628
  ) }) })
@@ -7618,8 +7643,8 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7618
7643
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7619
7644
  Tabs,
7620
7645
  {
7621
- onValueChange: (u) => {
7622
- c(""), i(u);
7646
+ onValueChange: (p) => {
7647
+ c(""), i(p);
7623
7648
  },
7624
7649
  value: l,
7625
7650
  className: cn("h-max"),
@@ -7904,7 +7929,7 @@ function QuickPrompts({ onClick: o }) {
7904
7929
  icon: FaLanguage$1,
7905
7930
  prompt: `Translate the content to ${get(LANGUAGES, a, a)}. Maintain same tone, style and length.`
7906
7931
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: n ? "pointer-events-none opacity-50" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-2", children: i.map(
7907
- ({ name: c, icon: d, subMenus: u, prompt: p }) => u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [
7932
+ ({ name: c, icon: d, subMenus: p, prompt: u }) => p ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [
7908
7933
  /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7909
7934
  "li",
7910
7935
  {
@@ -7920,7 +7945,7 @@ function QuickPrompts({ onClick: o }) {
7920
7945
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
7921
7946
  "li",
7922
7947
  {
7923
- onClick: () => o(p),
7948
+ onClick: () => o(u),
7924
7949
  className: "flex cursor-pointer items-center space-x-2 rounded p-1 text-sm hover:bg-gray-100 dark:hover:bg-gray-800",
7925
7950
  children: [
7926
7951
  /* @__PURE__ */ jsxRuntimeExports.jsx(d, { className: "h-4 w-4" }),
@@ -7932,20 +7957,20 @@ function QuickPrompts({ onClick: o }) {
7932
7957
  ) }) });
7933
7958
  }
7934
7959
  const AIUserPrompt = ({ blockId: o }) => {
7935
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), x = useRef(null), g = useRef(null);
7960
+ 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);
7936
7961
  useEffect(() => {
7937
- var j;
7938
- (j = x.current) == null || j.focus();
7962
+ var b;
7963
+ (b = x.current) == null || b.focus();
7939
7964
  }, []);
7940
- const E = (j) => {
7941
- const { usage: f } = j || {};
7965
+ const E = (b) => {
7966
+ const { usage: f } = b || {};
7942
7967
  !l && f && m(f), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
7943
7968
  };
7944
7969
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
7945
7970
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
7946
7971
  "div",
7947
7972
  {
7948
- onClick: () => u(!d),
7973
+ onClick: () => p(!d),
7949
7974
  className: "flex cursor-pointer items-center justify-between border-b border-border py-2 text-sm font-bold text-muted-foreground hover:underline",
7950
7975
  children: [
7951
7976
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: n("Ask AI") }),
@@ -7959,12 +7984,12 @@ const AIUserPrompt = ({ blockId: o }) => {
7959
7984
  {
7960
7985
  ref: x,
7961
7986
  value: i,
7962
- onChange: (j) => c(j.target.value),
7987
+ onChange: (b) => c(b.target.value),
7963
7988
  placeholder: n("Ask AI to edit content"),
7964
7989
  className: "w-full",
7965
7990
  rows: 3,
7966
- onKeyDown: (j) => {
7967
- j.key === "Enter" && (j.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E));
7991
+ onKeyDown: (b) => {
7992
+ b.key === "Enter" && (b.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E));
7968
7993
  }
7969
7994
  }
7970
7995
  ),
@@ -7993,11 +8018,11 @@ const AIUserPrompt = ({ blockId: o }) => {
7993
8018
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
7994
8019
  ] }) : null
7995
8020
  ] }),
7996
- 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: [
8021
+ 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: [
7997
8022
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
7998
8023
  n("Total tokens used"),
7999
8024
  ": ",
8000
- p.totalTokens
8025
+ u.totalTokens
8001
8026
  ] }),
8002
8027
  /* @__PURE__ */ jsxRuntimeExports.jsx(Countdown, {})
8003
8028
  ] }) }) : null,
@@ -8006,8 +8031,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8006
8031
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8007
8032
  QuickPrompts,
8008
8033
  {
8009
- onClick: (j) => {
8010
- g.current && clearTimeout(g.current), m(void 0), r("content", o, j, E);
8034
+ onClick: (b) => {
8035
+ g.current && clearTimeout(g.current), m(void 0), r("content", o, b, E);
8011
8036
  }
8012
8037
  }
8013
8038
  )
@@ -8017,19 +8042,19 @@ const AIUserPrompt = ({ blockId: o }) => {
8017
8042
  ] }) }) : null
8018
8043
  ] });
8019
8044
  }, AISetContext = () => {
8020
- const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, m] = useState(!1), { toast: x } = useToast(), g = useRef(null);
8045
+ 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);
8021
8046
  useEffect(() => {
8022
8047
  n && a(n);
8023
8048
  }, [n]);
8024
8049
  const E = async () => {
8025
8050
  try {
8026
- d(!0), p(null), await i(r), x({
8051
+ d(!0), u(null), await i(r), x({
8027
8052
  title: o("Updated AI Context"),
8028
8053
  description: o("You can now Ask AI to edit your content"),
8029
8054
  variant: "default"
8030
8055
  }), g.current.click();
8031
- } catch (j) {
8032
- p(j);
8056
+ } catch (b) {
8057
+ u(b);
8033
8058
  } finally {
8034
8059
  d(!1);
8035
8060
  }
@@ -8037,8 +8062,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8037
8062
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
8038
8063
  Accordion,
8039
8064
  {
8040
- onValueChange: (j) => {
8041
- m(j !== "");
8065
+ onValueChange: (b) => {
8066
+ m(b !== "");
8042
8067
  },
8043
8068
  type: "single",
8044
8069
  collapsible: !0,
@@ -8050,12 +8075,12 @@ const AIUserPrompt = ({ blockId: o }) => {
8050
8075
  {
8051
8076
  ref: l,
8052
8077
  value: r,
8053
- onChange: (j) => a(j.target.value),
8078
+ onChange: (b) => a(b.target.value),
8054
8079
  placeholder: o("Tell about this page eg this page is about"),
8055
8080
  className: "mt-1 w-full",
8056
8081
  rows: 10,
8057
- onKeyDown: (j) => {
8058
- j.key === "Enter" && (j.preventDefault(), E());
8082
+ onKeyDown: (b) => {
8083
+ b.key === "Enter" && (b.preventDefault(), E());
8059
8084
  }
8060
8085
  }
8061
8086
  ),
@@ -8105,7 +8130,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8105
8130
  ] })
8106
8131
  ] }) : null
8107
8132
  ] }),
8108
- /* @__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 }) })
8133
+ /* @__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 }) })
8109
8134
  ] })
8110
8135
  ] })
8111
8136
  }
@@ -8117,7 +8142,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8117
8142
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
8118
8143
  ] });
8119
8144
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
8120
- const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [x, g] = useState(""), E = useRef(null), j = useRef(null);
8145
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, m] = useState(null), [x, g] = useState(""), E = useRef(null), b = useRef(null);
8121
8146
  useEffect(() => {
8122
8147
  l(n);
8123
8148
  }, [n]);
@@ -8127,32 +8152,32 @@ const AIUserPrompt = ({ blockId: o }) => {
8127
8152
  return;
8128
8153
  }
8129
8154
  if (i) {
8130
- const w = [...a, { key: i, value: d }];
8131
- r(w), l(a), c(""), u(""), g("");
8155
+ const S = [...a, { key: i, value: d }];
8156
+ r(S), l(a), c(""), p(""), g("");
8132
8157
  }
8133
- }, _ = (w) => {
8134
- const A = a.filter((N, D) => D !== w);
8158
+ }, v = (S) => {
8159
+ const A = a.filter((N, D) => D !== S);
8135
8160
  r(A), l(A);
8136
- }, v = (w) => {
8137
- m(w), c(a[w].key), u(a[w].value);
8138
- }, S = () => {
8161
+ }, _ = (S) => {
8162
+ m(S), c(a[S].key), p(a[S].value);
8163
+ }, C = () => {
8139
8164
  if (i.startsWith("@")) {
8140
8165
  g("Attribute keys cannot start with '@'");
8141
8166
  return;
8142
8167
  }
8143
- if (p !== null && i) {
8144
- const w = [...a];
8145
- w[p] = { key: i, value: d }, r(w), l(w), m(null), c(""), u(""), g("");
8168
+ if (u !== null && i) {
8169
+ const S = [...a];
8170
+ S[u] = { key: i, value: d }, r(S), l(S), m(null), c(""), p(""), g("");
8146
8171
  }
8147
- }, B = (w) => {
8148
- w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? S() : f());
8172
+ }, B = (S) => {
8173
+ S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? C() : f());
8149
8174
  };
8150
8175
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
8151
8176
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8152
8177
  "form",
8153
8178
  {
8154
- onSubmit: (w) => {
8155
- w.preventDefault(), p !== null ? S() : f();
8179
+ onSubmit: (S) => {
8180
+ S.preventDefault(), u !== null ? C() : f();
8156
8181
  },
8157
8182
  className: "space-y-3",
8158
8183
  children: [
@@ -8168,7 +8193,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8168
8193
  id: "attrKey",
8169
8194
  ref: E,
8170
8195
  value: i,
8171
- onChange: (w) => c(w.target.value),
8196
+ onChange: (S) => c(S.target.value),
8172
8197
  placeholder: "Key",
8173
8198
  className: "h-8 text-sm"
8174
8199
  }
@@ -8184,9 +8209,9 @@ const AIUserPrompt = ({ blockId: o }) => {
8184
8209
  spellCheck: "false",
8185
8210
  id: "attrValue",
8186
8211
  rows: 2,
8187
- ref: j,
8212
+ ref: b,
8188
8213
  value: d,
8189
- onChange: (w) => u(w.target.value),
8214
+ onChange: (S) => p(S.target.value),
8190
8215
  onKeyDown: B,
8191
8216
  placeholder: "Value",
8192
8217
  className: "bg-background text-sm"
@@ -8194,22 +8219,22 @@ const AIUserPrompt = ({ blockId: o }) => {
8194
8219
  )
8195
8220
  ] })
8196
8221
  ] }),
8197
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: p !== null ? "Save" : "Add" }),
8222
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: u !== null ? "Save" : "Add" }),
8198
8223
  x && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: x })
8199
8224
  ]
8200
8225
  }
8201
8226
  ),
8202
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((w, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8227
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((S, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8203
8228
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
8204
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: w.key }),
8205
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: w.value.toString() })
8229
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: S.key }),
8230
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: S.value.toString() })
8206
8231
  ] }),
8207
8232
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
8208
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: [
8233
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => _(A), children: [
8209
8234
  /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
8210
8235
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
8211
8236
  ] }),
8212
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => _(A), children: [
8237
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: [
8213
8238
  /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
8214
8239
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
8215
8240
  ] })
@@ -8219,15 +8244,15 @@ const AIUserPrompt = ({ blockId: o }) => {
8219
8244
  }), BlockAttributesEditor = React.memo(() => {
8220
8245
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
8221
8246
  React.useEffect(() => {
8222
- const d = map(get(o, i), (u, p) => ({ key: p, value: u }));
8247
+ const d = map(get(o, i), (p, u) => ({ key: u, value: p }));
8223
8248
  isEmpty(d) ? r([]) : r(d);
8224
8249
  }, [get(o, i)]);
8225
8250
  const c = React.useCallback(
8226
8251
  (d = []) => {
8227
- const u = {};
8228
- forEach(d, (p) => {
8229
- isEmpty(p.key) || set(u, p.key, p.value);
8230
- }), l([get(o, "_id")], { [i]: u });
8252
+ const p = {};
8253
+ forEach(d, (u) => {
8254
+ isEmpty(u.key) || set(p, u.key, u.value);
8255
+ }), l([get(o, "_id")], { [i]: p });
8231
8256
  },
8232
8257
  [o, l, i]
8233
8258
  );
@@ -8353,7 +8378,7 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
8353
8378
  ] });
8354
8379
  }, Breakpoints = () => {
8355
8380
  const [, o, n] = useCanvasWidth(), [r, a] = useSelectedBreakpoints(), { t: l } = useTranslation(), i = useBuilderProp("breakpoints", WEB_BREAKPOINTS), c = (d) => {
8356
- r.includes(d) ? r.length > 2 && a(r.filter((u) => u !== d)) : a((u) => [...u, d]);
8381
+ r.includes(d) ? r.length > 2 && a(r.filter((p) => p !== d)) : a((p) => [...p, d]);
8357
8382
  };
8358
8383
  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: [
8359
8384
  map(
@@ -8403,8 +8428,8 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
8403
8428
  const { fallbackLang: o, languages: n, selectedLang: r, setSelectedLang: a } = useLanguages(), l = (r == null ? void 0 : r.length) > 0 ? r : o, i = useMemo(() => {
8404
8429
  const c = [];
8405
8430
  return forEach(uniq([o, ...n]), (d) => {
8406
- const u = get(LANGUAGES, d);
8407
- u && c.push({ key: d, value: u, default: d === o });
8431
+ const p = get(LANGUAGES, d);
8432
+ p && c.push({ key: d, value: p, default: d === o });
8408
8433
  }), c;
8409
8434
  }, [o, n]);
8410
8435
  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: [
@@ -8672,15 +8697,15 @@ function RemoveProviderConfirmation({
8672
8697
  const PageDataProviders = () => {
8673
8698
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8674
8699
  filter(n, (f) => map(r, "providerKey").includes(f.providerKey))
8675
- ), [d, u] = useState(""), [p, m] = useState(null), x = filter(
8700
+ ), [d, p] = useState(""), [u, m] = useState(null), x = filter(
8676
8701
  n.map((f) => map(i, "providerKey").includes(f.providerKey) ? null : { value: f.providerKey, label: f.name }),
8677
8702
  (f) => !isNull(f)
8678
8703
  ), g = (f) => {
8679
- const _ = find(n, { providerKey: f });
8680
- c((v) => [...v, _]), a((v) => [...v, { providerKey: _.providerKey, args: {} }]), u(""), l("UNSAVED");
8704
+ const v = find(n, { providerKey: f });
8705
+ c((_) => [..._, v]), a((_) => [..._, { providerKey: v.providerKey, args: {} }]), p(""), l("UNSAVED");
8681
8706
  }, E = (f) => {
8682
- c((_) => filter(_, (v) => v.providerKey !== f.providerKey)), a((_) => filter(_, (v) => v.providerKey !== f.providerKey)), l("UNSAVED");
8683
- }, j = (f) => m(f);
8707
+ c((v) => filter(v, (_) => _.providerKey !== f.providerKey)), a((v) => filter(v, (_) => _.providerKey !== f.providerKey)), l("UNSAVED");
8708
+ }, b = (f) => m(f);
8684
8709
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8685
8710
  o("no_data_providers"),
8686
8711
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8715,7 +8740,7 @@ const PageDataProviders = () => {
8715
8740
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8716
8741
  "button",
8717
8742
  {
8718
- onClick: () => j(f),
8743
+ onClick: () => b(f),
8719
8744
  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",
8720
8745
  children: [
8721
8746
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -8769,14 +8794,14 @@ const PageDataProviders = () => {
8769
8794
  },
8770
8795
  f.providerKey
8771
8796
  )) }),
8772
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
8797
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: u })
8773
8798
  ] })
8774
8799
  ] });
8775
8800
  };
8776
8801
  function AiFillDatabase(o) {
8777
8802
  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);
8778
8803
  }
8779
- const TopBar = lazy(() => import("./Topbar-21XY-_r9.js"));
8804
+ const TopBar = lazy(() => import("./Topbar-XucHTo33.js"));
8780
8805
  function useSidebarMenuItems(o) {
8781
8806
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8782
8807
  return useMemo(() => {
@@ -8810,7 +8835,7 @@ const RootLayout = () => {
8810
8835
  g.preventDefault();
8811
8836
  }, d = (g) => {
8812
8837
  n(o === g ? null : g);
8813
- }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
8838
+ }, p = useSidebarMenuItems(r), { t: u } = useTranslation(), m = [...p, ...i], x = useBuilderProp("htmlDir", "ltr");
8814
8839
  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: [
8815
8840
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8816
8841
  "div",
@@ -8832,12 +8857,12 @@ const RootLayout = () => {
8832
8857
  },
8833
8858
  E
8834
8859
  ) }),
8835
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(g.label) }) })
8860
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: u(g.label) }) })
8836
8861
  ] }, "button" + E)) }),
8837
8862
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
8838
8863
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8839
8864
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", onClick: () => l(!0), children: /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutTemplate, { size: 20 }) }) }),
8840
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p("Choose Builder Layout") }) })
8865
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: u("Choose Builder Layout") }) })
8841
8866
  ] }),
8842
8867
  /* @__PURE__ */ jsxRuntimeExports.jsx(HotKeys, {})
8843
8868
  ] })
@@ -8852,7 +8877,7 @@ const RootLayout = () => {
8852
8877
  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: [
8853
8878
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
8854
8879
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
8855
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
8880
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: u(m[o].label) })
8856
8881
  ] }),
8857
8882
  /* @__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), {}) }) })
8858
8883
  ] }) })
@@ -8872,7 +8897,7 @@ const RootLayout = () => {
8872
8897
  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: [
8873
8898
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
8874
8899
  /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: "16", className: "rtl:ml-2" }),
8875
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p("Block Settings") })
8900
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: u("Block Settings") })
8876
8901
  ] }),
8877
8902
  /* @__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, {}) }) })
8878
8903
  ] }) })
@@ -8960,7 +8985,7 @@ const RootLayout = () => {
8960
8985
  ] }) }) });
8961
8986
  };
8962
8987
  export {
8963
- useSelectedBlockAllClasses as $,
8988
+ useSelectedBlockCurrentClasses as $,
8964
8989
  AddBlocksPanel$1 as A,
8965
8990
  BlockSettings as B,
8966
8991
  ChaiSelect$1 as C,
@@ -8983,22 +9008,23 @@ export {
8983
9008
  ThemeOptions as T,
8984
9009
  UILibraries as U,
8985
9010
  useHighlightBlockId as V,
8986
- usePasteBlocks as W,
8987
- useBrandingOptions as X,
8988
- useRemoveBlocks as Y,
8989
- useRemoveClassesFromBlocks as Z,
8990
- useSelectedBlockCurrentClasses as _,
9011
+ useBlockHighlight as W,
9012
+ usePasteBlocks as X,
9013
+ useBrandingOptions as Y,
9014
+ useRemoveBlocks as Z,
9015
+ useRemoveClassesFromBlocks as _,
8991
9016
  useSelectedBlockIds as a,
8992
- useSelectedBlock as a0,
8993
- useStylingBreakpoint as a1,
8994
- useUILibraryBlocks as a2,
8995
- useStylingState as a3,
8996
- useSelectedBlocksDisplayChild as a4,
8997
- useSelectedBreakpoints as a5,
8998
- useSelectedStylingBlocks as a6,
8999
- useLanguages as a7,
9000
- useLayoutVariant as a8,
9001
- useBlocksStoreUndoableActions as a9,
9017
+ useSelectedBlockAllClasses as a0,
9018
+ useSelectedBlock as a1,
9019
+ useStylingBreakpoint as a2,
9020
+ useUILibraryBlocks as a3,
9021
+ useStylingState as a4,
9022
+ useSelectedBlocksDisplayChild as a5,
9023
+ useSelectedBreakpoints as a6,
9024
+ useSelectedStylingBlocks as a7,
9025
+ useLanguages as a8,
9026
+ useLayoutVariant as a9,
9027
+ useBlocksStoreUndoableActions as aa,
9002
9028
  useUpdateBlocksProps as b,
9003
9029
  useUpdateBlocksPropsRealtime as c,
9004
9030
  useBuilderProp as d,