@chaibuilder/sdk 1.2.113 → 1.2.114

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.
@@ -30,7 +30,7 @@ import ReactDOM from "react-dom";
30
30
  import PropTypes from "prop-types";
31
31
  import { ErrorBoundary } from "react-error-boundary";
32
32
  import { Resizable } from "re-resizable";
33
- import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, EditIcon, TrashIcon as TrashIcon$1, Check, SearchIcon, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, X, LayoutTemplate, Layers, PaintBucketIcon } from "lucide-react";
33
+ import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, EditIcon, TrashIcon as TrashIcon$1, Check, X, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, LayoutTemplate, Layers, PaintBucketIcon } from "lucide-react";
34
34
  import validator from "@rjsf/validator-ajv8";
35
35
  import Form$1 from "@rjsf/core";
36
36
  import { y, s as s$1, h } from "./controls-lEwMTdPQ.js";
@@ -89,278 +89,278 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
89
89
  const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
90
90
  let a, l, i;
91
91
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
92
- const c = (f) => o.get(f), d = (f, S) => {
93
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(S);
94
- const w = o.get(f);
95
- if (o.set(f, S), r.has(f) || r.set(f, w), w && hasPromiseAtomValue(w)) {
96
- const A = "v" in S ? S.v instanceof Promise ? S.v : Promise.resolve(S.v) : Promise.reject(S.e);
97
- cancelPromise(w.v, A);
92
+ const c = (m) => o.get(m), d = (m, v) => {
93
+ (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(v);
94
+ const C = o.get(m);
95
+ if (o.set(m, v), r.has(m) || r.set(m, C), C && hasPromiseAtomValue(C)) {
96
+ const B = "v" in v ? v.v instanceof Promise ? v.v : Promise.resolve(v.v) : Promise.reject(v.e);
97
+ cancelPromise(C.v, B);
98
98
  }
99
- }, u = (f, S, w) => {
100
- const A = /* @__PURE__ */ new Map();
99
+ }, u = (m, v, C) => {
100
+ const B = /* @__PURE__ */ new Map();
101
101
  let I = !1;
102
- w.forEach((T, D) => {
103
- !T && D === f && (T = S), T ? (A.set(D, T), S.d.get(D) !== T && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
- }), (I || S.d.size !== A.size) && (S.d = A);
105
- }, p = (f, S, w) => {
106
- const A = c(f), I = {
107
- d: (A == null ? void 0 : A.d) || /* @__PURE__ */ new Map(),
108
- v: S
102
+ C.forEach((N, P) => {
103
+ !N && P === m && (N = v), N ? (B.set(P, N), v.d.get(P) !== N && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
+ }), (I || v.d.size !== B.size) && (v.d = B);
105
+ }, p = (m, v, C) => {
106
+ const B = c(m), I = {
107
+ d: (B == null ? void 0 : B.d) || /* @__PURE__ */ new Map(),
108
+ v
109
109
  };
110
- if (w && u(f, I, w), A && isEqualAtomValue(A, I) && A.d === I.d)
111
- return A;
112
- if (A && hasPromiseAtomValue(A) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(A, I)) {
113
- if (A.d === I.d)
114
- return A;
115
- I.v = A.v;
110
+ if (C && u(m, I, C), B && isEqualAtomValue(B, I) && B.d === I.d)
111
+ return B;
112
+ if (B && hasPromiseAtomValue(B) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(B, I)) {
113
+ if (B.d === I.d)
114
+ return B;
115
+ I.v = B.v;
116
116
  }
117
- return d(f, I), I;
118
- }, m = (f, S, w, A) => {
119
- if (isPromiseLike$2(S)) {
117
+ return d(m, I), I;
118
+ }, g = (m, v, C, B) => {
119
+ if (isPromiseLike$2(v)) {
120
120
  let I;
121
- const T = new Promise((D, O) => {
121
+ const N = new Promise((P, O) => {
122
122
  let M = !1;
123
- S.then(
123
+ v.then(
124
124
  (V) => {
125
125
  if (!M) {
126
126
  M = !0;
127
- const $ = c(f), H = p(
128
- f,
129
- T,
130
- w
127
+ const $ = c(m), H = p(
128
+ m,
129
+ N,
130
+ C
131
131
  );
132
- resolvePromise(T, V), D(V), ($ == null ? void 0 : $.d) !== H.d && N(f, H, $ == null ? void 0 : $.d);
132
+ resolvePromise(N, V), P(V), ($ == null ? void 0 : $.d) !== H.d && T(m, H, $ == null ? void 0 : $.d);
133
133
  }
134
134
  },
135
135
  (V) => {
136
136
  if (!M) {
137
137
  M = !0;
138
- const $ = c(f), H = p(
139
- f,
140
- T,
141
- w
138
+ const $ = c(m), H = p(
139
+ m,
140
+ N,
141
+ C
142
142
  );
143
- rejectPromise(T, V), O(V), ($ == null ? void 0 : $.d) !== H.d && N(f, H, $ == null ? void 0 : $.d);
143
+ rejectPromise(N, V), O(V), ($ == null ? void 0 : $.d) !== H.d && T(m, H, $ == null ? void 0 : $.d);
144
144
  }
145
145
  }
146
146
  ), I = (V) => {
147
147
  M || (M = !0, V.then(
148
- ($) => resolvePromise(T, $),
149
- ($) => rejectPromise(T, $)
150
- ), D(V));
148
+ ($) => resolvePromise(N, $),
149
+ ($) => rejectPromise(N, $)
150
+ ), P(V));
151
151
  };
152
152
  });
153
- return T.orig = S, T.status = "pending", registerCancelPromise(T, (D) => {
154
- D && I(D), A == null || A();
155
- }), p(f, T, w);
153
+ return N.orig = v, N.status = "pending", registerCancelPromise(N, (P) => {
154
+ P && I(P), B == null || B();
155
+ }), p(m, N, C);
156
156
  }
157
- return p(f, S, w);
158
- }, g = (f, S, w) => {
159
- const A = c(f), I = {
160
- d: (A == null ? void 0 : A.d) || /* @__PURE__ */ new Map(),
161
- e: S
157
+ return p(m, v, C);
158
+ }, f = (m, v, C) => {
159
+ const B = c(m), I = {
160
+ d: (B == null ? void 0 : B.d) || /* @__PURE__ */ new Map(),
161
+ e: v
162
162
  };
163
- return w && u(f, I, w), A && isEqualAtomError(A, I) && A.d === I.d ? A : (d(f, I), I);
164
- }, x = (f) => {
165
- const S = c(f);
166
- if (S && (S.d.forEach((M, V) => {
167
- V !== f && !n.has(V) && x(V);
168
- }), Array.from(S.d).every(([M, V]) => {
163
+ return C && u(m, I, C), B && isEqualAtomError(B, I) && B.d === I.d ? B : (d(m, I), I);
164
+ }, x = (m) => {
165
+ const v = c(m);
166
+ if (v && (v.d.forEach((M, V) => {
167
+ V !== m && !n.has(V) && x(V);
168
+ }), Array.from(v.d).every(([M, V]) => {
169
169
  const $ = c(M);
170
- return M === f || $ === V || // TODO This is a hack, we should find a better solution.
170
+ return M === m || $ === V || // TODO This is a hack, we should find a better solution.
171
171
  $ && !hasPromiseAtomValue($) && isEqualAtomValue($, V);
172
172
  })))
173
- return S;
174
- const w = /* @__PURE__ */ new Map();
175
- let A = !0;
173
+ return v;
174
+ const C = /* @__PURE__ */ new Map();
175
+ let B = !0;
176
176
  const I = (M) => {
177
- if (M === f) {
177
+ if (M === m) {
178
178
  const $ = c(M);
179
179
  if ($)
180
- return w.set(M, $), returnAtomValue($);
180
+ return C.set(M, $), returnAtomValue($);
181
181
  if (hasInitialValue(M))
182
- return w.set(M, void 0), M.init;
182
+ return C.set(M, void 0), M.init;
183
183
  throw new Error("no atom init");
184
184
  }
185
185
  const V = x(M);
186
- return w.set(M, V), returnAtomValue(V);
186
+ return C.set(M, V), returnAtomValue(V);
187
187
  };
188
- let T, D;
188
+ let N, P;
189
189
  const O = {
190
190
  get signal() {
191
- return T || (T = new AbortController()), T.signal;
191
+ return N || (N = new AbortController()), N.signal;
192
192
  },
193
193
  get setSelf() {
194
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(f) && console.warn("setSelf function cannot be used with read-only atom"), !D && isActuallyWritableAtom(f) && (D = (...M) => {
195
- if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && A && console.warn("setSelf function cannot be called in sync"), !A)
196
- return B(f, ...M);
197
- }), D;
194
+ return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(m) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(m) && (P = (...M) => {
195
+ if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && B && console.warn("setSelf function cannot be called in sync"), !B)
196
+ return _(m, ...M);
197
+ }), P;
198
198
  }
199
199
  };
200
200
  try {
201
- const M = f.read(I, O);
202
- return m(
203
- f,
201
+ const M = m.read(I, O);
202
+ return g(
203
+ m,
204
204
  M,
205
- w,
206
- () => T == null ? void 0 : T.abort()
205
+ C,
206
+ () => N == null ? void 0 : N.abort()
207
207
  );
208
208
  } catch (M) {
209
- return g(f, M, w);
209
+ return f(m, M, C);
210
210
  } finally {
211
- A = !1;
211
+ B = !1;
212
212
  }
213
- }, j = (f) => returnAtomValue(x(f)), E = (f) => {
214
- let S = n.get(f);
215
- return S || (S = R(f)), S;
216
- }, b = (f, S) => !S.l.size && (!S.t.size || S.t.size === 1 && S.t.has(f)), k = (f) => {
217
- const S = n.get(f);
218
- S && b(f, S) && _(f);
219
- }, v = (f) => {
220
- const S = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), A = (T) => {
221
- const D = n.get(T);
222
- D == null || D.t.forEach((O) => {
223
- O !== T && (S.set(
213
+ }, j = (m) => returnAtomValue(x(m)), E = (m) => {
214
+ let v = n.get(m);
215
+ return v || (v = R(m)), v;
216
+ }, b = (m, v) => !v.l.size && (!v.t.size || v.t.size === 1 && v.t.has(m)), k = (m) => {
217
+ const v = n.get(m);
218
+ v && b(m, v) && A(m);
219
+ }, S = (m) => {
220
+ const v = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), B = (N) => {
221
+ const P = n.get(N);
222
+ P == null || P.t.forEach((O) => {
223
+ O !== N && (v.set(
224
224
  O,
225
- (S.get(O) || /* @__PURE__ */ new Set()).add(T)
226
- ), w.set(O, (w.get(O) || 0) + 1), A(O));
225
+ (v.get(O) || /* @__PURE__ */ new Set()).add(N)
226
+ ), C.set(O, (C.get(O) || 0) + 1), B(O));
227
227
  });
228
228
  };
229
- A(f);
230
- const I = (T) => {
231
- const D = n.get(T);
232
- D == null || D.t.forEach((O) => {
229
+ B(m);
230
+ const I = (N) => {
231
+ const P = n.get(N);
232
+ P == null || P.t.forEach((O) => {
233
233
  var M;
234
- if (O !== T) {
235
- let V = w.get(O);
236
- if (V && w.set(O, --V), !V) {
237
- let $ = !!((M = S.get(O)) != null && M.size);
234
+ if (O !== N) {
235
+ let V = C.get(O);
236
+ if (V && C.set(O, --V), !V) {
237
+ let $ = !!((M = v.get(O)) != null && M.size);
238
238
  if ($) {
239
239
  const H = c(O), U = x(O);
240
240
  $ = !H || !isEqualAtomValue(H, U);
241
241
  }
242
- $ || S.forEach((H) => H.delete(O));
242
+ $ || v.forEach((H) => H.delete(O));
243
243
  }
244
244
  I(O);
245
245
  }
246
246
  });
247
247
  };
248
- I(f);
249
- }, C = (f, ...S) => {
250
- let w = !0;
251
- const A = (D) => returnAtomValue(x(D)), I = (D, ...O) => {
248
+ I(m);
249
+ }, w = (m, ...v) => {
250
+ let C = !0;
251
+ const B = (P) => returnAtomValue(x(P)), I = (P, ...O) => {
252
252
  let M;
253
- if (D === f) {
254
- if (!hasInitialValue(D))
253
+ if (P === m) {
254
+ if (!hasInitialValue(P))
255
255
  throw new Error("atom not writable");
256
- const V = c(D), $ = m(D, O[0]);
257
- (!V || !isEqualAtomValue(V, $)) && v(D);
256
+ const V = c(P), $ = g(P, O[0]);
257
+ (!V || !isEqualAtomValue(V, $)) && S(P);
258
258
  } else
259
- M = C(D, ...O);
260
- if (!w) {
259
+ M = w(P, ...O);
260
+ if (!C) {
261
261
  const V = L();
262
262
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
263
263
  ($) => $({ type: "async-write", flushed: V })
264
264
  );
265
265
  }
266
266
  return M;
267
- }, T = f.write(A, I, ...S);
268
- return w = !1, T;
269
- }, B = (f, ...S) => {
270
- const w = C(f, ...S), A = L();
267
+ }, N = m.write(B, I, ...v);
268
+ return C = !1, N;
269
+ }, _ = (m, ...v) => {
270
+ const C = w(m, ...v), B = L();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
- (I) => I({ type: "write", flushed: A })
273
- ), w;
274
- }, R = (f, S) => {
275
- const w = {
276
- t: new Set(S && [S]),
272
+ (I) => I({ type: "write", flushed: B })
273
+ ), C;
274
+ }, R = (m, v) => {
275
+ const C = {
276
+ t: new Set(v && [v]),
277
277
  l: /* @__PURE__ */ new Set()
278
278
  };
279
- if (n.set(f, w), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(f), x(f).d.forEach((A, I) => {
280
- const T = n.get(I);
281
- T ? T.t.add(f) : I !== f && R(I, f);
282
- }), x(f), isActuallyWritableAtom(f) && f.onMount) {
283
- const A = f.onMount((...I) => B(f, ...I));
284
- A && (w.u = A);
279
+ if (n.set(m, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(m), x(m).d.forEach((B, I) => {
280
+ const N = n.get(I);
281
+ N ? N.t.add(m) : I !== m && R(I, m);
282
+ }), x(m), isActuallyWritableAtom(m) && m.onMount) {
283
+ const B = m.onMount((...I) => _(m, ...I));
284
+ B && (C.u = B);
285
285
  }
286
- return w;
287
- }, _ = (f) => {
288
- var S;
289
- const w = (S = n.get(f)) == null ? void 0 : S.u;
290
- w && w(), n.delete(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(f);
291
- const A = c(f);
292
- A ? (hasPromiseAtomValue(A) && cancelPromise(A.v), A.d.forEach((I, T) => {
293
- if (T !== f) {
294
- const D = n.get(T);
295
- D && (D.t.delete(f), b(T, D) && _(T));
286
+ return C;
287
+ }, A = (m) => {
288
+ var v;
289
+ const C = (v = n.get(m)) == null ? void 0 : v.u;
290
+ C && C(), n.delete(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(m);
291
+ const B = c(m);
292
+ B ? (hasPromiseAtomValue(B) && cancelPromise(B.v), B.d.forEach((I, N) => {
293
+ if (N !== m) {
294
+ const P = n.get(N);
295
+ P && (P.t.delete(m), b(N, P) && A(N));
296
296
  }
297
- })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", f);
298
- }, N = (f, S, w) => {
299
- const A = new Set(S.d.keys());
300
- w == null || w.forEach((I, T) => {
301
- if (A.has(T)) {
302
- A.delete(T);
297
+ })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", m);
298
+ }, T = (m, v, C) => {
299
+ const B = new Set(v.d.keys());
300
+ C == null || C.forEach((I, N) => {
301
+ if (B.has(N)) {
302
+ B.delete(N);
303
303
  return;
304
304
  }
305
- const D = n.get(T);
306
- D && (D.t.delete(f), b(T, D) && _(T));
307
- }), A.forEach((I) => {
308
- const T = n.get(I);
309
- T ? T.t.add(f) : n.has(f) && R(I, f);
305
+ const P = n.get(N);
306
+ P && (P.t.delete(m), b(N, P) && A(N));
307
+ }), B.forEach((I) => {
308
+ const N = n.get(I);
309
+ N ? N.t.add(m) : n.has(m) && R(I, m);
310
310
  });
311
311
  }, L = () => {
312
- let f;
313
- for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (f = /* @__PURE__ */ new Set()); r.size; ) {
314
- const S = Array.from(r);
315
- r.clear(), S.forEach(([w, A]) => {
316
- const I = c(w);
312
+ let m;
313
+ for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (m = /* @__PURE__ */ new Set()); r.size; ) {
314
+ const v = Array.from(r);
315
+ r.clear(), v.forEach(([C, B]) => {
316
+ const I = c(C);
317
317
  if (I) {
318
- I.d !== (A == null ? void 0 : A.d) && N(w, I, A == null ? void 0 : A.d);
319
- const T = n.get(w);
320
- T && !// TODO This seems pretty hacky. Hope to fix it.
318
+ I.d !== (B == null ? void 0 : B.d) && T(C, I, B == null ? void 0 : B.d);
319
+ const N = n.get(C);
320
+ N && !// TODO This seems pretty hacky. Hope to fix it.
321
321
  // Maybe we could `mountDependencies` in `setAtomState`?
322
- (A && !hasPromiseAtomValue(A) && (isEqualAtomValue(A, I) || isEqualAtomError(A, I))) && (T.l.forEach((D) => D()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && f.add(w));
322
+ (B && !hasPromiseAtomValue(B) && (isEqualAtomValue(B, I) || isEqualAtomError(B, I))) && (N.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && m.add(C));
323
323
  } else
324
324
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
325
325
  });
326
326
  }
327
327
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
328
- return a.forEach((S) => S("state")), f;
329
- }, P = (f, S) => {
330
- const w = E(f), A = L(), I = w.l;
331
- return I.add(S), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("sub")), l.forEach(
332
- (T) => T({ type: "sub", flushed: A })
328
+ return a.forEach((v) => v("state")), m;
329
+ }, D = (m, v) => {
330
+ const C = E(m), B = L(), I = C.l;
331
+ return I.add(v), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((N) => N("sub")), l.forEach(
332
+ (N) => N({ type: "sub", flushed: B })
333
333
  )), () => {
334
- I.delete(S), k(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("unsub")), l.forEach((T) => T({ type: "unsub" })));
334
+ I.delete(v), k(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((N) => N("unsub")), l.forEach((N) => N({ type: "unsub" })));
335
335
  };
336
336
  };
337
337
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
338
338
  get: j,
339
- set: B,
340
- sub: P,
339
+ set: _,
340
+ sub: D,
341
341
  // store dev methods (these are tentative and subject to change without notice)
342
- dev_subscribe_store: (f, S) => S !== 2 ? (console.warn(
342
+ dev_subscribe_store: (m, v) => v !== 2 ? (console.warn(
343
343
  "The current StoreListener revision is 2. The older ones are deprecated."
344
- ), a.add(f), () => {
345
- a.delete(f);
346
- }) : (l.add(f), () => {
347
- l.delete(f);
344
+ ), a.add(m), () => {
345
+ a.delete(m);
346
+ }) : (l.add(m), () => {
347
+ l.delete(m);
348
348
  }),
349
349
  dev_get_mounted_atoms: () => i.values(),
350
- dev_get_atom_state: (f) => o.get(f),
351
- dev_get_mounted: (f) => n.get(f),
352
- dev_restore_atoms: (f) => {
353
- for (const [w, A] of f)
354
- hasInitialValue(w) && (m(w, A), v(w));
355
- const S = L();
350
+ dev_get_atom_state: (m) => o.get(m),
351
+ dev_get_mounted: (m) => n.get(m),
352
+ dev_restore_atoms: (m) => {
353
+ for (const [C, B] of m)
354
+ hasInitialValue(C) && (g(C, B), S(C));
355
+ const v = L();
356
356
  l.forEach(
357
- (w) => w({ type: "restore", flushed: S })
357
+ (C) => C({ type: "restore", flushed: v })
358
358
  );
359
359
  }
360
360
  } : {
361
361
  get: j,
362
- set: B,
363
- sub: P
362
+ set: _,
363
+ sub: D
364
364
  };
365
365
  };
366
366
  let defaultStore;
@@ -377,37 +377,37 @@ function splitAtom(o, n) {
377
377
  let u = r.get(c);
378
378
  if (u)
379
379
  return u;
380
- const p = d && r.get(d), m = [], g = [];
380
+ const p = d && r.get(d), g = [], f = [];
381
381
  return c.forEach((x, j) => {
382
382
  const E = n ? n(x) : j;
383
- g[j] = E;
383
+ f[j] = E;
384
384
  const b = p && p.atomList[p.keyList.indexOf(E)];
385
385
  if (b) {
386
- m[j] = b;
386
+ g[j] = b;
387
387
  return;
388
388
  }
389
- const k = (C) => {
390
- const B = C(l), R = C(o), N = a(R, B == null ? void 0 : B.arr).keyList.indexOf(E);
391
- if (N < 0 || N >= R.length) {
389
+ const k = (w) => {
390
+ const _ = w(l), R = w(o), T = a(R, _ == null ? void 0 : _.arr).keyList.indexOf(E);
391
+ if (T < 0 || T >= R.length) {
392
392
  const L = c[a(c).keyList.indexOf(E)];
393
393
  if (L)
394
394
  return L;
395
395
  throw new Error("splitAtom: index out of bounds for read");
396
396
  }
397
- return R[N];
398
- }, v = (C, B, R) => {
399
- const _ = C(l), N = C(o), P = a(N, _ == null ? void 0 : _.arr).keyList.indexOf(E);
400
- if (P < 0 || P >= N.length)
397
+ return R[T];
398
+ }, S = (w, _, R) => {
399
+ const A = w(l), T = w(o), D = a(T, A == null ? void 0 : A.arr).keyList.indexOf(E);
400
+ if (D < 0 || D >= T.length)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const f = isFunction(R) ? R(N[P]) : R;
403
- B(o, [
404
- ...N.slice(0, P),
405
- f,
406
- ...N.slice(P + 1)
402
+ const m = isFunction(R) ? R(T[D]) : R;
403
+ _(o, [
404
+ ...T.slice(0, D),
405
+ m,
406
+ ...T.slice(D + 1)
407
407
  ]);
408
408
  };
409
- m[j] = isWritable(o) ? atom(k, v) : atom(k);
410
- }), p && p.keyList.length === g.length && p.keyList.every((x, j) => x === g[j]) ? u = p : u = { arr: c, atomList: m, keyList: g }, r.set(c, u), u;
409
+ g[j] = isWritable(o) ? atom(k, S) : atom(k);
410
+ }), p && p.keyList.length === f.length && p.keyList.every((x, j) => x === f[j]) ? u = p : u = { arr: c, atomList: g, keyList: f }, r.set(c, u), u;
411
411
  }, l = atom((c) => {
412
412
  const d = c(l), u = c(o);
413
413
  return a(u, d == null ? void 0 : d.arr);
@@ -420,10 +420,10 @@ function splitAtom(o, n) {
420
420
  case "remove": {
421
421
  const p = c(i).indexOf(u.atom);
422
422
  if (p >= 0) {
423
- const m = c(o);
423
+ const g = c(o);
424
424
  d(o, [
425
- ...m.slice(0, p),
426
- ...m.slice(p + 1)
425
+ ...g.slice(0, p),
426
+ ...g.slice(p + 1)
427
427
  ]);
428
428
  }
429
429
  break;
@@ -431,29 +431,29 @@ function splitAtom(o, n) {
431
431
  case "insert": {
432
432
  const p = u.before ? c(i).indexOf(u.before) : c(i).length;
433
433
  if (p >= 0) {
434
- const m = c(o);
434
+ const g = c(o);
435
435
  d(o, [
436
- ...m.slice(0, p),
436
+ ...g.slice(0, p),
437
437
  u.value,
438
- ...m.slice(p)
438
+ ...g.slice(p)
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) {
446
- const g = c(o);
447
- p < m ? d(o, [
448
- ...g.slice(0, p),
449
- ...g.slice(p + 1, m),
450
- g[p],
451
- ...g.slice(m)
444
+ const p = c(i).indexOf(u.atom), g = u.before ? c(i).indexOf(u.before) : c(i).length;
445
+ if (p >= 0 && g >= 0) {
446
+ const f = c(o);
447
+ p < g ? d(o, [
448
+ ...f.slice(0, p),
449
+ ...f.slice(p + 1, g),
450
+ f[p],
451
+ ...f.slice(g)
452
452
  ]) : d(o, [
453
- ...g.slice(0, m),
454
- g[p],
455
- ...g.slice(m, p),
456
- ...g.slice(p + 1)
453
+ ...f.slice(0, g),
454
+ f[p],
455
+ ...f.slice(g, p),
456
+ ...f.slice(p + 1)
457
457
  ]);
458
458
  }
459
459
  break;
@@ -473,14 +473,14 @@ function createJSONStorage(o) {
473
473
  const a = {
474
474
  getItem: (l, i) => {
475
475
  var c, d;
476
- const u = (m) => {
477
- if (m = m || "", n !== m) {
476
+ const u = (g) => {
477
+ if (g = g || "", n !== g) {
478
478
  try {
479
- r = JSON.parse(m);
479
+ r = JSON.parse(g);
480
480
  } catch {
481
481
  return i;
482
482
  }
483
- n = m;
483
+ n = g;
484
484
  }
485
485
  return r;
486
486
  }, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
@@ -529,8 +529,8 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
529
529
  }, atom(
530
530
  (d) => d(i),
531
531
  (d, u, p) => {
532
- const m = typeof p == "function" ? p(d(i)) : p;
533
- return m === RESET ? (u(i, n), r.removeItem(o)) : m instanceof Promise ? m.then((g) => (u(i, g), r.setItem(o, g))) : (u(i, m), r.setItem(o, m));
532
+ const g = typeof p == "function" ? p(d(i)) : p;
533
+ return g === RESET ? (u(i, n), r.removeItem(o)) : g instanceof Promise ? g.then((f) => (u(i, f), r.setItem(o, f))) : (u(i, g), r.setItem(o, g));
534
534
  }
535
535
  );
536
536
  }
@@ -555,8 +555,8 @@ const StoreContext = createContext(void 0), useStore = (o) => {
555
555
  function useAtomValue(o, n) {
556
556
  const r = useStore(n), [[a, l, i], c] = useReducer(
557
557
  (p) => {
558
- const m = r.get(o);
559
- return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
558
+ const g = r.get(o);
559
+ return Object.is(p[0], g) && p[1] === r && p[2] === o ? p : [g, r, o];
560
560
  },
561
561
  void 0,
562
562
  () => [r.get(o), r, o]
@@ -640,8 +640,8 @@ const getSlots = (o) => {
640
640
  return map(i, (c) => {
641
641
  const d = c, u = getSlots(d);
642
642
  return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
643
- const m = find(i, { oldId: u[p].replace("slot:", "") });
644
- d[p] = `slot:${m._id}`;
643
+ const g = find(i, { oldId: u[p].replace("slot:", "") });
644
+ d[p] = `slot:${g._id}`;
645
645
  }), omit(d, ["global", "oldId"]);
646
646
  });
647
647
  }, presentBlocksAtom = atom$1([]);
@@ -747,7 +747,7 @@ const useSelectedBlocksDisplayChild = () => ({
747
747
  switch (o.type) {
748
748
  case "singular": {
749
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;
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((g) => (g.title && (g.title = n(g.title)), g))), p;
751
751
  }
752
752
  case "model":
753
753
  const { properties: a, title: l } = o, i = {
@@ -756,11 +756,11 @@ const useSelectedBlocksDisplayChild = () => ({
756
756
  properties: {}
757
757
  };
758
758
  return Object.keys(a).forEach((p) => {
759
- const m = a[p];
760
- if (includes(["slot", "styles"], m.type))
759
+ const g = a[p];
760
+ if (includes(["slot", "styles"], g.type))
761
761
  return;
762
- const g = p;
763
- i.properties[g] = getBlockJSONFromSchemas(m, n, r);
762
+ const f = p;
763
+ i.properties[f] = getBlockJSONFromSchemas(g, n, r);
764
764
  }), i;
765
765
  case "list":
766
766
  const { itemProperties: c, title: d } = o, u = {
@@ -772,14 +772,14 @@ const useSelectedBlocksDisplayChild = () => ({
772
772
  }
773
773
  };
774
774
  return Object.keys(c).forEach((p) => {
775
- const m = c[p];
776
- if (includes(["slot", "styles"], m.type))
775
+ const g = c[p];
776
+ if (includes(["slot", "styles"], g.type))
777
777
  return;
778
- const g = p;
779
- u.items.properties[g] = getBlockJSONFromSchemas(m, n, r), set(
778
+ const f = p;
779
+ u.items.properties[f] = getBlockJSONFromSchemas(g, n, r), set(
780
780
  u.items,
781
781
  "title",
782
- titleWithLang(get(m, "itemTitle", `${n(d)} item`), r, get(m, "i18n"))
782
+ titleWithLang(get(g, "itemTitle", `${n(d)} item`), r, get(g, "i18n"))
783
783
  );
784
784
  }), u;
785
785
  default:
@@ -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 u(p, g) {
837
+ return !p || typeof p[g] != "function" ? this : (c = !0, p[g](), c = !1, this);
838
838
  }
839
839
  return {
840
840
  /**
@@ -861,8 +861,8 @@ var undomanager = { exports: {} };
861
861
  let p = a[l];
862
862
  if (!p)
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 g = p.groupId;
865
+ for (; p.groupId === g && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
866
866
  ;
867
867
  return d && d(), this;
868
868
  },
@@ -873,8 +873,8 @@ var undomanager = { exports: {} };
873
873
  let p = a[l + 1];
874
874
  if (!p)
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 g = p.groupId;
877
+ for (; p.groupId === g && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
878
878
  ;
879
879
  return d && d(), this;
880
880
  },
@@ -905,7 +905,7 @@ var undomanager = { exports: {} };
905
905
  * @returns {array}
906
906
  */
907
907
  getCommands: function(p) {
908
- return p ? a.filter((m) => m.groupId === p) : a;
908
+ return p ? a.filter((g) => g.groupId === p) : a;
909
909
  },
910
910
  /**
911
911
  * Returns the index of the actions list.
@@ -1202,13 +1202,13 @@ const useBlocksStoreManager = () => {
1202
1202
  } = useBlocksStoreManager();
1203
1203
  return {
1204
1204
  moveBlocks: (E, b, k) => {
1205
- const v = map(E, (B) => {
1206
- const _ = n.find((P) => P._id === B)._parent || null, L = n.filter((P) => _ ? P._parent === _ : !P._parent).map((P) => P._id).indexOf(B);
1207
- return { _id: B, oldParent: _, oldPosition: L };
1208
- }), C = v.find(({ _id: B }) => B === E[0]);
1209
- C && C.oldParent === b && C.oldPosition === k || (i(E, b, k), o({
1210
- undo: () => each(v, ({ _id: B, oldParent: R, oldPosition: _ }) => {
1211
- i([B], R, _);
1205
+ const S = map(E, (_) => {
1206
+ const A = n.find((D) => D._id === _)._parent || null, L = n.filter((D) => A ? D._parent === A : !D._parent).map((D) => D._id).indexOf(_);
1207
+ return { _id: _, oldParent: A, oldPosition: L };
1208
+ }), w = S.find(({ _id: _ }) => _ === E[0]);
1209
+ w && w.oldParent === b && w.oldPosition === k || (i(E, b, k), o({
1210
+ undo: () => each(S, ({ _id: _, oldParent: R, oldPosition: A }) => {
1211
+ i([_], R, A);
1212
1212
  }),
1213
1213
  redo: () => i(E, b, k)
1214
1214
  }));
@@ -1220,27 +1220,27 @@ const useBlocksStoreManager = () => {
1220
1220
  });
1221
1221
  },
1222
1222
  removeBlocks: (E) => {
1223
- var C;
1224
- const b = (C = first(E)) == null ? void 0 : C._parent, v = n.filter((B) => b ? B._parent === b : !B._parent).indexOf(first(E));
1223
+ var w;
1224
+ const b = (w = first(E)) == null ? void 0 : w._parent, S = n.filter((_) => b ? _._parent === b : !_._parent).indexOf(first(E));
1225
1225
  l(map(E, "_id")), o({
1226
- undo: () => a(E, b, v),
1226
+ undo: () => a(E, b, S),
1227
1227
  redo: () => l(map(E, "_id"))
1228
1228
  });
1229
1229
  },
1230
1230
  updateBlocks: (E, b, k) => {
1231
- let v = [];
1231
+ let S = [];
1232
1232
  if (k)
1233
- v = map(E, (C) => ({ _id: C, ...k }));
1233
+ S = map(E, (w) => ({ _id: w, ...k }));
1234
1234
  else {
1235
- const C = keys(b);
1236
- v = map(E, (B) => {
1237
- const R = n.find((N) => N._id === B), _ = { _id: B };
1238
- return each(C, (N) => _[N] = R[N]), _;
1235
+ const w = keys(b);
1236
+ S = map(E, (_) => {
1237
+ const R = n.find((T) => T._id === _), A = { _id: _ };
1238
+ return each(w, (T) => A[T] = R[T]), A;
1239
1239
  });
1240
1240
  }
1241
- c(map(E, (C) => ({ _id: C, ...b }))), o({
1242
- undo: () => c(v),
1243
- redo: () => c(map(E, (C) => ({ _id: C, ...b })))
1241
+ c(map(E, (w) => ({ _id: w, ...b }))), o({
1242
+ undo: () => c(S),
1243
+ redo: () => c(map(E, (w) => ({ _id: w, ...b })))
1244
1244
  });
1245
1245
  },
1246
1246
  updateBlocksRuntime: (E, b) => {
@@ -1255,8 +1255,8 @@ const useBlocksStoreManager = () => {
1255
1255
  updateMultipleBlocksProps: (E) => {
1256
1256
  let b = [];
1257
1257
  b = map(E, (k) => {
1258
- const v = keys(k), C = n.find((R) => R._id === k._id), B = {};
1259
- return each(v, (R) => B[R] = C[R]), B;
1258
+ const S = keys(k), w = n.find((R) => R._id === k._id), _ = {};
1259
+ return each(S, (R) => _[R] = w[R]), _;
1260
1260
  }), c(E), o({
1261
1261
  undo: () => c(b),
1262
1262
  redo: () => c(E)
@@ -1275,8 +1275,8 @@ const useBlocksStoreManager = () => {
1275
1275
  b[k]._parent = i[j]._id;
1276
1276
  }
1277
1277
  const u = first(i);
1278
- let p, m;
1279
- return c && (p = find(o, { _id: c }), i[0]._parent = c, m = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, m = p._parent), r(i, m, d), n([(x = first(i)) == null ? void 0 : x._id]), first(i);
1278
+ let p, g;
1279
+ return c && (p = find(o, { _id: c }), i[0]._parent = c, g = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, g = p._parent), r(i, g, d), n([(x = first(i)) == null ? void 0 : x._id]), first(i);
1280
1280
  },
1281
1281
  [o, n]
1282
1282
  );
@@ -1286,29 +1286,29 @@ const useBlocksStoreManager = () => {
1286
1286
  const k = i.blocks;
1287
1287
  return a(k, c, d);
1288
1288
  }
1289
- const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
1290
- forIn(p, (k, v) => {
1289
+ const u = generateUUID(), p = getBlockDefaultProps(i.props), g = [];
1290
+ forIn(p, (k, S) => {
1291
1291
  if (startsWith(k, SLOT_KEY)) {
1292
- const C = k.replace(SLOT_KEY, "");
1293
- m.push({
1294
- _id: C,
1292
+ const w = k.replace(SLOT_KEY, "");
1293
+ g.push({
1294
+ _id: w,
1295
1295
  _type: "Slot",
1296
1296
  _parent: u,
1297
- _name: i.props[v].name,
1298
- _styles: i.props[v].styles,
1299
- _emptyStyles: i.props[v].emptyStyles
1297
+ _name: i.props[S].name,
1298
+ _styles: i.props[S].styles,
1299
+ _emptyStyles: i.props[S].emptyStyles
1300
1300
  });
1301
1301
  }
1302
1302
  });
1303
- const g = {
1303
+ const f = {
1304
1304
  _type: i.type,
1305
1305
  _id: u,
1306
1306
  ...p
1307
1307
  };
1308
1308
  let x, j;
1309
- c && (x = find(o, { _id: c }), g._parent = c, j = c), !canAcceptChildBlock(x == null ? void 0 : x._type, g._type) && x && (g._parent = x._parent, j = x._parent);
1310
- const b = [g, ...m];
1311
- return r(b, j, d), n([g._id]), g;
1309
+ c && (x = find(o, { _id: c }), f._parent = c, j = c), !canAcceptChildBlock(x == null ? void 0 : x._type, f._type) && x && (f._parent = x._parent, j = x._parent);
1310
+ const b = [f, ...g];
1311
+ return r(b, j, d), n([f._id]), f;
1312
1312
  },
1313
1313
  [a, o, n]
1314
1314
  ), addPredefinedBlock: a };
@@ -2416,18 +2416,18 @@ function getNewClasses(o = "", n = "", r = []) {
2416
2416
  );
2417
2417
  const i = [], c = [];
2418
2418
  each(r, (p) => {
2419
- const m = constructClassObject(p), g = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2420
- if (g && (a = filter(
2419
+ const g = constructClassObject(p), f = find(a, pick(g, ["dark", "mq", "mod", "property"]));
2420
+ if (f && (a = filter(
2421
2421
  a,
2422
- (x) => x.fullCls !== (g == null ? void 0 : g.fullCls)
2423
- )), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (x) => x.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
2424
- const x = find(l, pick(m, ["property"]));
2425
- g && (l = filter(
2422
+ (x) => x.fullCls !== (f == null ? void 0 : f.fullCls)
2423
+ )), i.push(g), g.mq === "xs" && !g.dark && g.mod === "" && (l = filter(l, (x) => x.property !== g.property)), getBelongsToForClass(a, g) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, g.property)) {
2424
+ const x = find(l, pick(g, ["property"]));
2425
+ f && (l = filter(
2426
2426
  l,
2427
2427
  (j) => j.fullCls !== (x == null ? void 0 : x.fullCls)
2428
2428
  )), c.push({
2429
- ...m,
2430
- fullCls: m.cls,
2429
+ ...g,
2430
+ fullCls: g.cls,
2431
2431
  mq: "xs"
2432
2432
  });
2433
2433
  }
@@ -2455,10 +2455,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2455
2455
  )
2456
2456
  ), i = first(o(selectedStylingBlocksAtom));
2457
2457
  return map(l, (c) => {
2458
- const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
2458
+ const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: g } = getSplitClasses$1(u);
2459
2459
  return {
2460
2460
  ids: [d._id],
2461
- props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
2461
+ props: { [i.prop]: `${STYLES_KEY}${getNewClasses(g, p, a)}` }
2462
2462
  };
2463
2463
  });
2464
2464
  }), useAddClassesToBlocks = () => {
@@ -2509,11 +2509,11 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2509
2509
  each(a, (c) => {
2510
2510
  const d = o.find((x) => x._id === c);
2511
2511
  l || (l = d._parent);
2512
- const m = filter(
2512
+ const g = filter(
2513
2513
  o,
2514
2514
  (x) => isString$1(l) ? x._parent === l : !d._parent
2515
- ).indexOf(d) + 1, g = getDuplicatedBlocks(o, c, l);
2516
- r(g, l, m), i.push(get(g, "0._id", ""));
2515
+ ).indexOf(d) + 1, f = getDuplicatedBlocks(o, c, l);
2516
+ r(f, l, g), i.push(get(f, "0._id", ""));
2517
2517
  }), n(i);
2518
2518
  },
2519
2519
  [o, n]
@@ -2576,19 +2576,19 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2576
2576
  );
2577
2577
  return map(i, (c) => {
2578
2578
  const d = o(c), u = a;
2579
- let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2580
- return each(u, (g) => {
2581
- const x = g.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${x}($| )`, "g");
2579
+ let { classes: p, baseClasses: g } = getSplitClasses(get(d, l.prop, "styles:,"));
2580
+ return each(u, (f) => {
2581
+ const x = f.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${x}($| )`, "g");
2582
2582
  p = p.replace(j, " ").replace(/ +/g, " ").trim();
2583
- const E = first(g.split(":"));
2584
- includes(["2xl", "xl", "lg", "md", "sm"], E) && u.push(g.split(":").pop().trim());
2585
- }), each(u, (g) => {
2586
- const x = new RegExp(`(^| )${g.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2587
- m = m.replace(x, " ").replace(/ +/g, " ").trim();
2583
+ const E = first(f.split(":"));
2584
+ includes(["2xl", "xl", "lg", "md", "sm"], E) && u.push(f.split(":").pop().trim());
2585
+ }), each(u, (f) => {
2586
+ const x = new RegExp(`(^| )${f.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2587
+ g = g.replace(x, " ").replace(/ +/g, " ").trim();
2588
2588
  }), {
2589
2589
  ids: [d._id],
2590
2590
  props: {
2591
- [l.prop]: `${STYLES_KEY}${m},${p}`
2591
+ [l.prop]: `${STYLES_KEY}${g},${p}`
2592
2592
  }
2593
2593
  };
2594
2594
  });
@@ -2689,7 +2689,7 @@ const useLanguages = () => {
2689
2689
  let u = "";
2690
2690
  o([n], { [i]: "" });
2691
2691
  for (let p = 0; p < d.length; p++)
2692
- u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
2692
+ u += d[p].join(""), o([n], { [i]: u }), await new Promise((g) => setTimeout(g, a));
2693
2693
  }
2694
2694
  }
2695
2695
  },
@@ -2887,18 +2887,18 @@ const useBlockHighlight = () => {
2887
2887
  const { width: d, height: u } = o;
2888
2888
  if (d < n) {
2889
2889
  const p = parseFloat((d / n).toFixed(2).toString());
2890
- let m = {};
2891
- const g = u * p, x = d * p;
2892
- u && (m = {
2890
+ let g = {};
2891
+ const f = u * p, x = d * p;
2892
+ u && (g = {
2893
2893
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
2894
- height: 100 + (u - g) / g * 100 + "%",
2894
+ height: 100 + (u - f) / f * 100 + "%",
2895
2895
  width: 100 + (d - x) / x * 100 + "%"
2896
2896
  }), i({
2897
2897
  position: "relative",
2898
2898
  top: 0,
2899
2899
  transform: `scale(${p})`,
2900
2900
  transformOrigin: a === "rtl" ? "top right" : "top left",
2901
- ...m,
2901
+ ...g,
2902
2902
  maxWidth: "none"
2903
2903
  // TODO: Add max-width to the wrapper
2904
2904
  }), r(p * 100);
@@ -3071,7 +3071,7 @@ const useDnd = () => {
3071
3071
  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);
3072
3072
  if (!useFeature("dnd"))
3073
3073
  return {};
3074
- const g = () => {
3074
+ const f = () => {
3075
3075
  removePlaceholder(), r(!1), u(null), p(null), possiblePositions = [];
3076
3076
  };
3077
3077
  return iframeDocument = o, {
@@ -3083,17 +3083,17 @@ const useDnd = () => {
3083
3083
  var R;
3084
3084
  const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((R = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : R.scrollY) : x.clientX;
3085
3085
  dropIndex = calculateDropIndex(b, possiblePositions);
3086
- const k = d, v = j.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3087
- if ((k == null ? void 0 : k._id) === v || !C) {
3088
- g();
3086
+ const k = d, S = j.getAttribute("data-block-id"), w = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3087
+ if ((k == null ? void 0 : k._id) === S || !w) {
3088
+ f();
3089
3089
  return;
3090
3090
  }
3091
3091
  if (!has(k, "_id")) {
3092
- a(k, v === "canvas" ? null : v, dropIndex), setTimeout(g, 300);
3092
+ a(k, S === "canvas" ? null : S, dropIndex), setTimeout(f, 300);
3093
3093
  return;
3094
3094
  }
3095
- let B = j.getAttribute("data-block-id");
3096
- B === null && (B = x.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), g(), setTimeout(removePlaceholder, 300);
3095
+ let _ = j.getAttribute("data-block-id");
3096
+ _ === null && (_ = x.target.parentElement.getAttribute("data-block-id")), c([k._id], _ === "canvas" ? null : _, dropIndex), f(), setTimeout(removePlaceholder, 300);
3097
3097
  },
3098
3098
  onDragEnter: (x) => {
3099
3099
  const j = x, E = j.target;
@@ -3122,7 +3122,7 @@ function destroyQuill(o) {
3122
3122
  const useHandleCanvasDblClick = () => {
3123
3123
  const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], n = useUpdateBlocksProps(), [r, a] = useAtom$1(inlineEditingActiveAtom), { clearHighlight: l } = useBlockHighlight();
3124
3124
  return (i) => {
3125
- var g;
3125
+ var f;
3126
3126
  if (r)
3127
3127
  return;
3128
3128
  const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
@@ -3133,15 +3133,15 @@ const useHandleCanvasDblClick = () => {
3133
3133
  x.name !== "class" && u.removeAttribute(x.name);
3134
3134
  }), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
3135
3135
  const p = new Quill(u, { placeholder: "Type here..." });
3136
- function m() {
3136
+ function g() {
3137
3137
  const x = p.getText(0, p.getLength());
3138
- n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), a(""), l(), u.remove();
3138
+ n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", g, !0), destroyQuill(p), a(""), l(), u.remove();
3139
3139
  }
3140
- u.addEventListener("blur", m, !0), u.addEventListener("click", (x) => {
3140
+ u.addEventListener("blur", g, !0), u.addEventListener("click", (x) => {
3141
3141
  x.stopPropagation();
3142
3142
  }), u.addEventListener("keydown", (x) => {
3143
- (x.key === "Enter" || x.key === "Escape") && m();
3144
- }), p.focus(), (g = u.querySelector(".ql-clipboard")) == null || g.remove(), a(c.getAttribute("data-block-id"));
3143
+ (x.key === "Enter" || x.key === "Escape") && g();
3144
+ }), p.focus(), (f = u.querySelector(".ql-clipboard")) == null || f.remove(), a(c.getAttribute("data-block-id"));
3145
3145
  };
3146
3146
  }, useHandleCanvasClick = () => {
3147
3147
  const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom), { clearHighlight: i } = useBlockHighlight();
@@ -3155,8 +3155,8 @@ const useHandleCanvasDblClick = () => {
3155
3155
  return;
3156
3156
  }
3157
3157
  if (d != null && d.getAttribute("data-block-parent")) {
3158
- const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
3159
- n.includes(m) || l == null || l.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
3158
+ const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
3159
+ n.includes(g) || l == null || l.closeAll(), o([{ id: p, prop: u, blockId: g }]), r([g]);
3160
3160
  } else if (d != null && d.getAttribute("data-block-id")) {
3161
3161
  const u = d.getAttribute("data-block-id");
3162
3162
  n.includes(u) || l == null || l.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
@@ -3180,17 +3180,17 @@ const useHandleCanvasDblClick = () => {
3180
3180
  setTimeout(() => {
3181
3181
  if (!isEmpty(a))
3182
3182
  return;
3183
- const g = getElementByDataBlockId(n, first(r));
3184
- if (g) {
3185
- const x = g.getAttribute("data-style-prop");
3183
+ const f = getElementByDataBlockId(n, first(r));
3184
+ if (f) {
3185
+ const x = f.getAttribute("data-style-prop");
3186
3186
  if (x) {
3187
- const j = g.getAttribute("data-style-id"), E = g.getAttribute("data-block-parent");
3187
+ const j = f.getAttribute("data-style-id"), E = f.getAttribute("data-block-parent");
3188
3188
  l([{ id: j, prop: x, blockId: E }]);
3189
3189
  }
3190
3190
  }
3191
3191
  }, 100);
3192
3192
  }, [n, r, l, a]);
3193
- const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), u = useHandleMouseMove(), p = useHandleMouseLeave(), m = useDnd();
3193
+ const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), u = useHandleMouseMove(), p = useHandleMouseLeave(), g = useDnd();
3194
3194
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3195
3195
  "div",
3196
3196
  {
@@ -3200,23 +3200,23 @@ const useHandleCanvasDblClick = () => {
3200
3200
  onDoubleClick: c,
3201
3201
  onMouseMove: u,
3202
3202
  onMouseLeave: p,
3203
- ...omit(m, "isDragging"),
3204
- className: "relative h-full max-w-full p-px " + (m.isDragging ? "dragging" : ""),
3203
+ ...omit(g, "isDragging"),
3204
+ className: "relative h-full max-w-full p-px " + (g.isDragging ? "dragging" : ""),
3205
3205
  children: o
3206
3206
  }
3207
3207
  );
3208
3208
  }, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
3209
- const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
3209
+ const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: g } = usePasteBlocks();
3210
3210
  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(
3211
3211
  "ctrl+v,command+v",
3212
3212
  () => {
3213
- p(n[0]) && m(n);
3213
+ p(n[0]) && g(n);
3214
3214
  },
3215
3215
  {},
3216
- [n, p, m]
3216
+ [n, p, g]
3217
3217
  );
3218
- const g = o ? { document: o } : {};
3219
- useHotkeys("esc", () => r([]), g, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...g, preventDefault: !0 }, [
3218
+ const f = o ? { document: o } : {};
3219
+ useHotkeys("esc", () => r([]), f, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...f, preventDefault: !0 }, [
3220
3220
  n,
3221
3221
  l
3222
3222
  ]), useHotkeys(
@@ -3224,7 +3224,7 @@ const useHandleCanvasDblClick = () => {
3224
3224
  (x) => {
3225
3225
  x.preventDefault(), a(n);
3226
3226
  },
3227
- g,
3227
+ f,
3228
3228
  [n, a]
3229
3229
  );
3230
3230
  }, KeyboardHandler = () => {
@@ -3253,15 +3253,15 @@ const useHandleCanvasDblClick = () => {
3253
3253
  }
3254
3254
  );
3255
3255
  }, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
3256
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
3256
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: g } = useFloating({
3257
3257
  placement: "top-start",
3258
3258
  middleware: [shift(), flip()],
3259
3259
  elements: {
3260
3260
  reference: o
3261
3261
  }
3262
3262
  });
3263
- useResizeObserver(o, () => m(), o !== null);
3264
- const g = get(n, "_parent", null), x = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3263
+ useResizeObserver(o, () => g(), o !== null);
3264
+ const f = get(n, "_parent", null), x = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3265
3265
  return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3266
3266
  "div",
3267
3267
  {
@@ -3278,12 +3278,12 @@ const useHandleCanvasDblClick = () => {
3278
3278
  onKeyDown: (j) => j.stopPropagation(),
3279
3279
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
3280
3280
  children: [
3281
- g && /* @__PURE__ */ jsxRuntimeExports.jsx(
3281
+ f && /* @__PURE__ */ jsxRuntimeExports.jsx(
3282
3282
  ArrowUpIcon,
3283
3283
  {
3284
3284
  className: "hover:scale-105",
3285
3285
  onClick: () => {
3286
- c([]), l([g]);
3286
+ c([]), l([f]);
3287
3287
  }
3288
3288
  }
3289
3289
  ),
@@ -3312,9 +3312,9 @@ const useHandleCanvasDblClick = () => {
3312
3312
  }, HeadTags = () => {
3313
3313
  const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), [a] = useSelectedStylingBlocks(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), { document: c, window: d } = useFrame(), [u] = useState(c == null ? void 0 : c.getElementById("highlighted-block")), [p] = useState(
3314
3314
  c == null ? void 0 : c.getElementById("selected-block")
3315
- ), [m] = useState(
3316
- c == null ? void 0 : c.getElementById("selected-styling-block")
3317
3315
  ), [g] = useState(
3316
+ c == null ? void 0 : c.getElementById("selected-styling-block")
3317
+ ), [f] = useState(
3318
3318
  c == null ? void 0 : c.getElementById("dragged-block")
3319
3319
  );
3320
3320
  useEffect(() => {
@@ -3322,17 +3322,17 @@ const useHandleCanvasDblClick = () => {
3322
3322
  }, [r, c]);
3323
3323
  const x = get(o, "headingFont", "DM Sans"), j = get(o, "bodyFont", "DM Sans");
3324
3324
  return useEffect(() => {
3325
- const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), v = get(o, "bodyBgDarkColor", "#000"), C = get(o, "bodyTextDarkColor", "#000"), B = get(o, "bodyTextLightColor", "#fff"), R = s({
3325
+ const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), S = get(o, "bodyBgDarkColor", "#000"), w = get(o, "bodyTextDarkColor", "#000"), _ = get(o, "bodyTextLightColor", "#fff"), R = s({
3326
3326
  colors: [E, b],
3327
3327
  names: ["primary", "secondary"]
3328
3328
  });
3329
3329
  set(R, "primary.DEFAULT", E), set(R, "secondary.DEFAULT", b);
3330
- const _ = {
3330
+ const A = {
3331
3331
  "bg-light": k,
3332
- "bg-dark": v,
3333
- "text-dark": C,
3334
- "text-light": B
3335
- }, N = get(o, "roundedCorners", "0");
3332
+ "bg-dark": S,
3333
+ "text-dark": w,
3334
+ "text-light": _
3335
+ }, T = get(o, "roundedCorners", "0");
3336
3336
  !d || !d.tailwind || (d.tailwind.config = {
3337
3337
  darkMode: "class",
3338
3338
  theme: {
@@ -3349,28 +3349,28 @@ const useHandleCanvasDblClick = () => {
3349
3349
  body: [j]
3350
3350
  },
3351
3351
  borderRadius: {
3352
- DEFAULT: `${N || "0"}px`
3352
+ DEFAULT: `${T || "0"}px`
3353
3353
  },
3354
- colors: { ..._, ...R }
3354
+ colors: { ...A, ...R }
3355
3355
  }
3356
3356
  },
3357
3357
  plugins: [
3358
3358
  typography,
3359
3359
  forms,
3360
3360
  aspectRatio,
3361
- plugin(function({ addBase: L, theme: P }) {
3361
+ plugin(function({ addBase: L, theme: D }) {
3362
3362
  L({
3363
3363
  "h1,h2,h3,h4,h5,h6": {
3364
- fontFamily: P("fontFamily.heading")
3364
+ fontFamily: D("fontFamily.heading")
3365
3365
  },
3366
3366
  body: {
3367
- fontFamily: P("fontFamily.body"),
3368
- color: P("colors.text-light"),
3369
- backgroundColor: P("colors.bg-light")
3367
+ fontFamily: D("fontFamily.body"),
3368
+ color: D("colors.text-light"),
3369
+ backgroundColor: D("colors.bg-light")
3370
3370
  },
3371
3371
  ".dark body": {
3372
- color: P("colors.text-dark"),
3373
- backgroundColor: P("colors.bg-dark")
3372
+ color: D("colors.text-dark"),
3373
+ backgroundColor: D("colors.bg-dark")
3374
3374
  }
3375
3375
  });
3376
3376
  })
@@ -3381,14 +3381,14 @@ const useHandleCanvasDblClick = () => {
3381
3381
  outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
3382
3382
  }`);
3383
3383
  }, [n, p]), useEffect(() => {
3384
- g.textContent = l ? `[data-block-id="${l._id}"], [data-block-id="${l._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3385
- }, [l, g]), useEffect(() => {
3384
+ f.textContent = l ? `[data-block-id="${l._id}"], [data-block-id="${l._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3385
+ }, [l, f]), useEffect(() => {
3386
3386
  u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3387
3387
  }, [u]), useEffect(() => {
3388
- m && (m.textContent = `${map(a, ({ id: E }) => `[data-style-id="${E}"]`).join(",")}{
3388
+ g && (g.textContent = `${map(a, ({ id: E }) => `[data-style-id="${E}"]`).join(",")}{
3389
3389
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3390
3390
  }`);
3391
- }, [a, m]), useEffect(() => {
3391
+ }, [a, g]), useEffect(() => {
3392
3392
  c.querySelector("#drop-target-block").innerHTML = i ? `[data-block-id="${i}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3393
3393
  }, [i]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (x || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3394
3394
  "link",
@@ -3405,11 +3405,11 @@ const useHandleCanvasDblClick = () => {
3405
3405
  u || (u = d, d = "xs");
3406
3406
  const p = r.indexOf(d);
3407
3407
  if (p <= a) {
3408
- const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], g = ["hidden"];
3409
- if (m.includes(u))
3408
+ const g = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], f = ["hidden"];
3409
+ if (g.includes(u))
3410
3410
  for (let x = p; x < r.length; x++)
3411
3411
  i[x] = !0;
3412
- else if (g.includes(u))
3412
+ else if (f.includes(u))
3413
3413
  for (let x = p; x < r.length; x++)
3414
3414
  i[x] = !1;
3415
3415
  }
@@ -3431,23 +3431,23 @@ const useHandleCanvasDblClick = () => {
3431
3431
  return { getRSCBlockMarkup: a, getRSCBlockState: l, reset: i };
3432
3432
  }, useWatchRSCBlocks = () => {
3433
3433
  const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (u) => ""), d = useMemo(() => o.filter((p) => {
3434
- var g;
3435
- return (g = get(i, p._type)) == null ? void 0 : g.server;
3434
+ var f;
3435
+ return (f = get(i, p._type)) == null ? void 0 : f.server;
3436
3436
  }).map((p) => p._id), [i, o]);
3437
3437
  useEffect(() => {
3438
3438
  forEach(d, (u) => {
3439
3439
  if (get(n, u, "") || get(a, `${u}.loading`, !1))
3440
3440
  return;
3441
- const p = o.find((m) => m._id === u);
3442
- l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
3443
- r((g) => ({ ...g, [u]: m })), l((g) => ({
3444
- ...g,
3441
+ const p = o.find((g) => g._id === u);
3442
+ l((g) => ({ ...g, [u]: { loading: !0, error: null } })), c(p).then((g) => {
3443
+ r((f) => ({ ...f, [u]: g })), l((f) => ({
3444
+ ...f,
3445
3445
  [u]: { loading: !1, error: null }
3446
3446
  }));
3447
- }).catch((m) => {
3448
- l((g) => ({
3449
- ...g,
3450
- [u]: { loading: !1, error: m.message }
3447
+ }).catch((g) => {
3448
+ l((f) => ({
3449
+ ...f,
3450
+ [u]: { loading: !1, error: g.message }
3451
3451
  }));
3452
3452
  });
3453
3453
  });
@@ -3512,10 +3512,10 @@ function applyLanguage(o, n, r) {
3512
3512
  }), a;
3513
3513
  }
3514
3514
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3515
- const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), g = useCallback((b) => getStyleAttrs(b, d), [d]), [x] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3516
- (b) => b.reduce((k, v) => {
3517
- const C = get(u, v, {});
3518
- return { ...k, ...C };
3515
+ 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: g } = useGlobalBlocksStore(), f = useCallback((b) => getStyleAttrs(b, d), [d]), [x] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3516
+ (b) => b.reduce((k, S) => {
3517
+ const w = get(u, S, {});
3518
+ return { ...k, ...w };
3519
3519
  }, {}),
3520
3520
  [u]
3521
3521
  );
@@ -3523,18 +3523,18 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3523
3523
  o.map((b, k) => {
3524
3524
  if (j === b._id || p.includes(b._id))
3525
3525
  return null;
3526
- const v = {}, C = filter(n, { _parent: b._id });
3527
- if (v.children = C.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: C }) : null, b._type === "GlobalBlock") {
3528
- const w = m(b);
3529
- v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(w, (A) => !A._parent), allBlocks: w });
3526
+ const S = {}, w = filter(n, { _parent: b._id });
3527
+ if (S.children = w.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: w }) : null, b._type === "GlobalBlock") {
3528
+ const C = g(b);
3529
+ S.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (B) => !B._parent), allBlocks: C });
3530
3530
  }
3531
- const B = getBlockComponent(b._type), R = get(B, "server", !1), _ = R ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
3532
- if (isNull(_))
3531
+ const _ = getBlockComponent(b._type), R = get(_, "server", !1), A = R ? RSCBlock : get(_, "builderComponent", get(_, "component", null));
3532
+ if (isNull(A))
3533
3533
  return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
3534
- const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(b, n) : [], L = E(N), P = g(b);
3535
- if (get(P, "__isHidden", !1) && !includes(a, b._id))
3534
+ const T = has(_, "getBlockStateFrom") ? _ == null ? void 0 : _.getBlockStateFrom(b, n) : [], L = E(T), D = f(b);
3535
+ if (get(D, "__isHidden", !1) && !includes(a, b._id))
3536
3536
  return null;
3537
- const f = i && isDescendant(i._id, b._id, n), S = {
3537
+ const m = i && isDescendant(i._id, b._id, n), v = {
3538
3538
  ...includes(a, b._id) ? { "force-show": "" } : {},
3539
3539
  "data-block-id": b._id,
3540
3540
  "data-block-type": b._type,
@@ -3542,18 +3542,18 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3542
3542
  // @ts-ignore
3543
3543
  {
3544
3544
  "data-dnd": canAcceptChildBlock(b._type, i == null ? void 0 : i._type) ? "yes" : "no",
3545
- "data-dnd-dragged": i._id === b._id || f ? "yes" : "no"
3545
+ "data-dnd-dragged": i._id === b._id || m ? "yes" : "no"
3546
3546
  }
3547
3547
  ) : {},
3548
- ...c === b._id && !f ? { "data-drop": "yes" } : {},
3548
+ ...c === b._id && !m ? { "data-drop": "yes" } : {},
3549
3549
  ...includes(l, b._id) ? { "data-cut-block": "yes" } : {}
3550
3550
  };
3551
- return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: S }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(_, {
3552
- blockProps: S,
3551
+ return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: v }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
3552
+ blockProps: v,
3553
3553
  index: k,
3554
- ...applyBindings(applyLanguage(b, r, B), x),
3555
- ...omit(P, ["__isHidden"]),
3556
- ...v,
3554
+ ...applyBindings(applyLanguage(b, r, _), x),
3555
+ ...omit(D, ["__isHidden"]),
3556
+ ...S,
3557
3557
  inBuilder: !0,
3558
3558
  blockState: L
3559
3559
  }) });
@@ -3609,43 +3609,43 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3609
3609
  };
3610
3610
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
3611
3611
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3612
- const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, g] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), C = (_) => {
3613
- u((N) => ({ ...N, width: _ }));
3612
+ const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [g, f] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), S = useBuilderProp("htmlDir", "ltr"), w = (A) => {
3613
+ u((T) => ({ ...T, width: A }));
3614
3614
  };
3615
3615
  useEffect(() => {
3616
3616
  if (!c.current)
3617
3617
  return;
3618
- const { clientWidth: _, clientHeight: N } = c.current;
3619
- u({ width: _, height: N });
3618
+ const { clientWidth: A, clientHeight: T } = c.current;
3619
+ u({ width: A, height: T });
3620
3620
  }, [c, n]);
3621
- const B = (_, N = 0) => {
3622
- const { top: L } = _.getBoundingClientRect();
3623
- return L + N >= 0 && L - N <= window.innerHeight;
3621
+ const _ = (A, T = 0) => {
3622
+ const { top: L } = A.getBoundingClientRect();
3623
+ return L + T >= 0 && L - T <= window.innerHeight;
3624
3624
  };
3625
3625
  useEffect(() => {
3626
- var _, N;
3626
+ var A, T;
3627
3627
  if (a && a.type !== "Multiple" && i.current) {
3628
3628
  const L = getElementByDataBlockId(i.current.contentDocument, a._id);
3629
- L && (B(L) || (N = (_ = i.current) == null ? void 0 : _.contentWindow) == null || N.scrollTo({ top: L.offsetTop, behavior: "smooth" }), g([L]));
3629
+ L && (_(L) || (T = (A = i.current) == null ? void 0 : A.contentWindow) == null || T.scrollTo({ top: L.offsetTop, behavior: "smooth" }), f([L]));
3630
3630
  }
3631
3631
  }, [a]), useEffect(() => {
3632
3632
  if (!isEmpty(E) && i.current) {
3633
- const _ = getElementByStyleId(
3633
+ const A = getElementByStyleId(
3634
3634
  i.current.contentDocument,
3635
3635
  first(E).id
3636
3636
  );
3637
- x(_ ? [_] : [null]);
3637
+ x(A ? [A] : [null]);
3638
3638
  } else
3639
3639
  x([null]);
3640
3640
  }, [E]);
3641
3641
  const R = useMemo(() => {
3642
- let _ = IframeInitialContent;
3643
- return _ = _.replace("__HTML_DIR__", v), o === "offline" && (_ = _.replace(
3642
+ let A = IframeInitialContent;
3643
+ return A = A.replace("__HTML_DIR__", S), o === "offline" && (A = A.replace(
3644
3644
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3645
3645
  "/offline/tailwind.cdn.js"
3646
- ), _ = _.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), _ = _.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), _;
3647
- }, [o, v]);
3648
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3646
+ ), 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;
3647
+ }, [o, S]);
3648
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: w, onResize: w, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3649
3649
  "div",
3650
3650
  {
3651
3651
  onClick: () => {
@@ -3669,7 +3669,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3669
3669
  BlockActionsStatic,
3670
3670
  {
3671
3671
  block: a,
3672
- selectedBlockElement: first(m)
3672
+ selectedBlockElement: first(g)
3673
3673
  }
3674
3674
  ),
3675
3675
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {}),
@@ -3785,7 +3785,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3785
3785
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3786
3786
  ] }, l))
3787
3787
  ] }) });
3788
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-ouljm9CI.js")), CanvasArea = () => {
3788
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-q9he9IC8.js")), CanvasArea = () => {
3789
3789
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3790
3790
  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: [
3791
3791
  /* @__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, {}) }) }),
@@ -3860,20 +3860,20 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3860
3860
  showHeading: o = !0,
3861
3861
  className: n = ""
3862
3862
  }) => {
3863
- const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: R }, _) => {
3864
- _ && (a(R), i.current = R);
3863
+ const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: R }, A) => {
3864
+ A && (a(R), i.current = R);
3865
3865
  }, {
3866
3866
  bodyFont: u,
3867
3867
  headingFont: p,
3868
- primaryColor: m,
3869
- bodyTextDarkColor: g,
3868
+ primaryColor: g,
3869
+ bodyTextDarkColor: f,
3870
3870
  bodyTextLightColor: x,
3871
3871
  bodyBgDarkColor: j,
3872
3872
  secondaryColor: E,
3873
3873
  bodyBgLightColor: b,
3874
3874
  roundedCorners: k
3875
3875
  } = r;
3876
- let v = {
3876
+ let S = {
3877
3877
  headingFont: y({
3878
3878
  title: c("Theme Config.Heading Font"),
3879
3879
  default: p,
@@ -3888,18 +3888,18 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3888
3888
  title: c("Theme Config.Rounded Corner"),
3889
3889
  default: parseInt(k || 5, 10)
3890
3890
  }),
3891
- primaryColor: h({ title: c("Theme Config.Primary"), default: m }),
3891
+ primaryColor: h({ title: c("Theme Config.Primary"), default: g }),
3892
3892
  secondaryColor: h({ title: c("Theme Config.Secondary"), default: E })
3893
3893
  };
3894
- l || (v = {
3895
- ...v,
3894
+ l || (S = {
3895
+ ...S,
3896
3896
  bodyBgLightColor: h({
3897
3897
  title: c("Theme Config.Background"),
3898
3898
  default: b
3899
3899
  }),
3900
3900
  bodyTextLightColor: h({
3901
3901
  title: c("Theme Config.Text Color"),
3902
- default: g
3902
+ default: f
3903
3903
  }),
3904
3904
  bodyBgDarkColor: h({
3905
3905
  title: c("Theme Config.Background Dark Mode"),
@@ -3910,13 +3910,13 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3910
3910
  default: x
3911
3911
  })
3912
3912
  });
3913
- const C = {
3913
+ const w = {
3914
3914
  type: "object",
3915
3915
  properties: {}
3916
- }, B = {};
3917
- return Object.keys(v).forEach((R) => {
3918
- const _ = v[R];
3919
- return C.properties || (C.properties = {}), C.properties[R] = _.schema, B[R] = _.uiSchema, !0;
3916
+ }, _ = {};
3917
+ return Object.keys(S).forEach((R) => {
3918
+ const A = S[R];
3919
+ return w.properties || (w.properties = {}), w.properties[R] = A.schema, _[R] = A.uiSchema, !0;
3920
3920
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
3921
3921
  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,
3922
3922
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3928,8 +3928,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3928
3928
  omitExtraData: !0,
3929
3929
  liveOmit: !0,
3930
3930
  liveValidate: !0,
3931
- uiSchema: B,
3932
- schema: C,
3931
+ uiSchema: _,
3932
+ schema: w,
3933
3933
  formData: r,
3934
3934
  validator,
3935
3935
  onChange: d
@@ -4112,34 +4112,34 @@ function BiExpandVertical(o) {
4112
4112
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4113
4113
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
4114
4114
  let u = null;
4115
- const p = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: v, handleClick: C } = o, B = (f) => {
4116
- f.stopPropagation(), !i.includes(x) && o.toggle();
4117
- }, R = (f) => {
4118
- f.isInternal && (u = f.isOpen, f.isOpen && f.close());
4119
- }, _ = (f) => {
4120
- f.isInternal && u !== null && (u ? f.open() : f.close(), u = null);
4121
- }, N = (f) => {
4122
- f.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), C(f);
4115
+ const p = o.children.length > 0, { highlightBlock: g, clearHighlight: f } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: S, handleClick: w } = o, _ = (m) => {
4116
+ m.stopPropagation(), !i.includes(x) && o.toggle();
4117
+ }, R = (m) => {
4118
+ m.isInternal && (u = m.isOpen, m.isOpen && m.close());
4119
+ }, A = (m) => {
4120
+ m.isInternal && u !== null && (u ? m.open() : m.close(), u = null);
4121
+ }, T = (m) => {
4122
+ m.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), w(m);
4123
4123
  };
4124
4124
  useEffect(() => {
4125
- const f = setTimeout(() => {
4125
+ const m = setTimeout(() => {
4126
4126
  b && !o.isOpen && !k && !i.includes(x) && o.toggle();
4127
4127
  }, 500);
4128
- return () => clearTimeout(f);
4128
+ return () => clearTimeout(m);
4129
4129
  }, [b, o, k]);
4130
4130
  const L = useMemo(() => {
4131
- const f = Object.keys(j), S = [];
4132
- for (let w = 0; w < f.length; w++)
4133
- if (f[w].endsWith("_attrs")) {
4134
- const A = j[f[w]], I = Object.keys(A).join("|");
4135
- I.match(/x-data/) && S.push("data"), I.match(/x-on/) && S.push("event"), I.match(/x-show|x-if/) && S.push("show");
4131
+ const m = Object.keys(j), v = [];
4132
+ for (let C = 0; C < m.length; C++)
4133
+ if (m[C].endsWith("_attrs")) {
4134
+ const B = j[m[C]], I = Object.keys(B).join("|");
4135
+ I.match(/x-data/) && v.push("data"), I.match(/x-on/) && v.push("event"), I.match(/x-show|x-if/) && v.push("show");
4136
4136
  }
4137
- return S;
4138
- }, [j]), P = (f, S) => {
4139
- const w = d.contentDocument || d.contentWindow.document, A = w.querySelector(`[data-block-id=${f}]`);
4140
- A && A.setAttribute("data-drop", S);
4141
- const I = A.getBoundingClientRect(), T = d.getBoundingClientRect();
4142
- I.top >= T.top && I.left >= T.left && I.bottom <= T.bottom && I.right <= T.right || (w.documentElement.scrollTop = A.offsetTop - T.top);
4137
+ return v;
4138
+ }, [j]), D = (m, v) => {
4139
+ const C = d.contentDocument || d.contentWindow.document, B = C.querySelector(`[data-block-id=${m}]`);
4140
+ B && B.setAttribute("data-drop", v);
4141
+ const I = B.getBoundingClientRect(), N = d.getBoundingClientRect();
4142
+ I.top >= N.top && I.left >= N.left && I.bottom <= N.bottom && I.right <= N.right || (C.documentElement.scrollTop = B.offsetTop - N.top);
4143
4143
  };
4144
4144
  return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4145
4145
  "button",
@@ -4154,22 +4154,22 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4154
4154
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenu, { id: x, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
4155
4155
  "div",
4156
4156
  {
4157
- onMouseEnter: () => m(x),
4158
- onMouseLeave: () => g(),
4159
- onClick: N,
4157
+ onMouseEnter: () => g(x),
4158
+ onMouseLeave: () => f(),
4159
+ onClick: T,
4160
4160
  style: n,
4161
4161
  "data-node-id": x,
4162
4162
  ref: i.includes(x) ? null : r,
4163
4163
  onDragStart: () => R(o),
4164
- onDragEnd: () => _(o),
4165
- onDragOver: (f) => {
4166
- f.preventDefault(), P(x, "yes");
4164
+ onDragEnd: () => A(o),
4165
+ onDragOver: (m) => {
4166
+ m.preventDefault(), D(x, "yes");
4167
4167
  },
4168
- onDragLeave: (f) => {
4169
- f.preventDefault(), P(x, "no");
4168
+ onDragLeave: (m) => {
4169
+ m.preventDefault(), D(x, "no");
4170
4170
  },
4171
- onDrop: (f) => {
4172
- f.preventDefault(), P(x, "no");
4171
+ onDrop: (m) => {
4172
+ m.preventDefault(), D(x, "no");
4173
4173
  },
4174
4174
  className: cn(
4175
4175
  "group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
@@ -4184,17 +4184,17 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4184
4184
  "div",
4185
4185
  {
4186
4186
  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" : ""}`,
4187
- children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: B, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4187
+ children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: _, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4188
4188
  }
4189
4189
  ),
4190
4190
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4191
4191
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: j == null ? void 0 : j._type }) }),
4192
- v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4192
+ S ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4193
4193
  "div",
4194
4194
  {
4195
4195
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
4196
- onDoubleClick: (f) => {
4197
- f.stopPropagation(), o.edit(), o.deselect();
4196
+ onDoubleClick: (m) => {
4197
+ m.stopPropagation(), o.edit(), o.deselect();
4198
4198
  },
4199
4199
  children: [
4200
4200
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (j == null ? void 0 : j._name) || (j == null ? void 0 : j._type.split("/").pop()) }),
@@ -4207,16 +4207,16 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4207
4207
  ] })
4208
4208
  ] }),
4209
4209
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: [
4210
- !i.includes(x) && a.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4210
+ !i.includes(x) && a.map((m) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4211
4211
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4212
4212
  TooltipTrigger,
4213
4213
  {
4214
4214
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
4215
4215
  asChild: !0,
4216
- children: React__default.createElement(f.item, { blockId: x })
4216
+ children: React__default.createElement(m.item, { blockId: x })
4217
4217
  }
4218
4218
  ),
4219
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: f.tooltip })
4219
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: m.tooltip })
4220
4220
  ] })),
4221
4221
  canAddChildBlock(j == null ? void 0 : j._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4222
4222
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -4234,8 +4234,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4234
4234
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4235
4235
  TooltipTrigger,
4236
4236
  {
4237
- onClick: (f) => {
4238
- f.stopPropagation(), c(x), o.isOpen && o.toggle();
4237
+ onClick: (m) => {
4238
+ m.stopPropagation(), c(x), o.isOpen && o.toggle();
4239
4239
  },
4240
4240
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",
4241
4241
  asChild: !0,
@@ -4577,7 +4577,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4577
4577
  }
4578
4578
  }
4579
4579
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
4580
- var u, p, m, g, x, j, E, b;
4580
+ var u, p, g, f, x, j, E, b;
4581
4581
  if (r.type === "comment")
4582
4582
  return [];
4583
4583
  let a = { _id: generateUUID() };
@@ -4594,7 +4594,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4594
4594
  ...getAttrs(r),
4595
4595
  ...getStyles(r)
4596
4596
  }, r.attributes) {
4597
- const k = r.attributes.find((v) => includes(NAME_ATTRIBUTES, v.key));
4597
+ const k = r.attributes.find((S) => includes(NAME_ATTRIBUTES, S.key));
4598
4598
  k && (a._name = k.value);
4599
4599
  }
4600
4600
  if (i)
@@ -4612,14 +4612,14 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4612
4612
  ];
4613
4613
  a = {
4614
4614
  ...a,
4615
- href: ((u = l.find((v) => v.key === "href")) == null ? void 0 : u.value) || "",
4616
- hrefType: ((p = l.find((v) => v.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
4617
- autoplay: ((m = l.find((v) => v.key === "data-autoplay")) == null ? void 0 : m.value) === "true",
4618
- maxWidth: ((x = (g = l.find((v) => v.key === "data-maxwidth")) == null ? void 0 : g.value) == null ? void 0 : x.replace("px", "")) || "",
4619
- backdropColor: ((j = l.find((v) => v.key === "data-overlay")) == null ? void 0 : j.value) || "",
4620
- galleryName: ((E = l.find((v) => v.key === "data-gall")) == null ? void 0 : E.value) || ""
4621
- }, forEach(k, (v) => {
4622
- has(a, `styles_attrs.${v}`) && delete a.styles_attrs[v];
4615
+ href: ((u = l.find((S) => S.key === "href")) == null ? void 0 : u.value) || "",
4616
+ hrefType: ((p = l.find((S) => S.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
4617
+ autoplay: ((g = l.find((S) => S.key === "data-autoplay")) == null ? void 0 : g.value) === "true",
4618
+ maxWidth: ((x = (f = l.find((S) => S.key === "data-maxwidth")) == null ? void 0 : f.value) == null ? void 0 : x.replace("px", "")) || "",
4619
+ backdropColor: ((j = l.find((S) => S.key === "data-overlay")) == null ? void 0 : j.value) || "",
4620
+ galleryName: ((E = l.find((S) => S.key === "data-gall")) == null ? void 0 : E.value) || ""
4621
+ }, forEach(k, (S) => {
4622
+ has(a, `styles_attrs.${S}`) && delete a.styles_attrs[S];
4623
4623
  });
4624
4624
  }
4625
4625
  if (a._type === "Input") {
@@ -4629,8 +4629,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4629
4629
  const k = stringify([r]);
4630
4630
  return hasVideoEmbed(k) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(k)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = k, [a];
4631
4631
  } else if (r.tagName === "svg") {
4632
- const k = find(r.attributes, { key: "height" }), v = find(r.attributes, { key: "width" }), C = get(k, "value") ? `[${get(k, "value")}px]` : "24px", B = get(v, "value") ? `[${get(v, "value")}px]` : "24px", R = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4633
- return a.styles = `${STYLES_KEY}, ${cn(`w-${B} h-${C}`, R)}`.trim(), r.attributes = filter(r.attributes, (_) => !includes(["style", "width", "height", "class"], _.key)), a.icon = stringify([r]), [a];
4632
+ const k = find(r.attributes, { key: "height" }), S = find(r.attributes, { key: "width" }), w = get(k, "value") ? `[${get(k, "value")}px]` : "24px", _ = get(S, "value") ? `[${get(S, "value")}px]` : "24px", R = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4633
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${_} h-${w}`, R)}`.trim(), r.attributes = filter(r.attributes, (A) => !includes(["style", "width", "height", "class"], A.key)), a.icon = stringify([r]), [a];
4634
4634
  } else if (r.tagName == "option" && n && ((b = n.block) == null ? void 0 : b._type) === "Select")
4635
4635
  return n.block.options.push({
4636
4636
  label: getTextContent(r.children),
@@ -4691,14 +4691,14 @@ function ExpandableObject(o) {
4691
4691
  level: d,
4692
4692
  style: u,
4693
4693
  shouldExpandNode: p,
4694
- clickToExpandNode: m
4694
+ clickToExpandNode: g
4695
4695
  } = o;
4696
- const g = useRef(!1), [x, j, E] = useBool(() => p(d, r, n));
4696
+ const f = useRef(!1), [x, j, E] = useBool(() => p(d, r, n));
4697
4697
  useEffect(() => {
4698
- g.current ? E(p(d, r, n)) : g.current = !0;
4698
+ f.current ? E(p(d, r, n)) : f.current = !0;
4699
4699
  }, [p]);
4700
- const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", v = useComponentId(), C = d + 1, B = a.length - 1, R = (_) => {
4701
- _.key === " " && (_.preventDefault(), j());
4700
+ const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", S = useComponentId(), w = d + 1, _ = a.length - 1, R = (A) => {
4701
+ A.key === " " && (A.preventDefault(), j());
4702
4702
  };
4703
4703
  return /* @__PURE__ */ createElement("div", {
4704
4704
  className: u.basicChildStyle,
@@ -4711,8 +4711,8 @@ function ExpandableObject(o) {
4711
4711
  tabIndex: 0,
4712
4712
  "aria-label": k,
4713
4713
  "aria-expanded": x,
4714
- "aria-controls": x ? v : void 0
4715
- }), n && (m ? /* @__PURE__ */ createElement("span", {
4714
+ "aria-controls": x ? S : void 0
4715
+ }), n && (g ? /* @__PURE__ */ createElement("span", {
4716
4716
  className: u.clickableLabel,
4717
4717
  onClick: j,
4718
4718
  onKeyDown: R,
@@ -4723,16 +4723,16 @@ function ExpandableObject(o) {
4723
4723
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4724
4724
  className: u.punctuation
4725
4725
  }, i), x ? /* @__PURE__ */ createElement("div", {
4726
- id: v
4727
- }, a.map((_, N) => /* @__PURE__ */ createElement(DataRender, {
4728
- key: _[0] || N,
4729
- field: _[0],
4730
- value: _[1],
4726
+ id: S
4727
+ }, a.map((A, T) => /* @__PURE__ */ createElement(DataRender, {
4728
+ key: A[0] || T,
4729
+ field: A[0],
4730
+ value: A[1],
4731
4731
  style: u,
4732
- lastElement: N === B,
4733
- level: C,
4732
+ lastElement: T === _,
4733
+ level: w,
4734
4734
  shouldExpandNode: p,
4735
- clickToExpandNode: m
4735
+ clickToExpandNode: g
4736
4736
  }))) : /* @__PURE__ */ createElement("span", {
4737
4737
  className: u.collapsedContent,
4738
4738
  onClick: j,
@@ -4894,7 +4894,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4894
4894
  dataType: i,
4895
4895
  appliedBindings: c
4896
4896
  }) => {
4897
- const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [g, x] = useState(!1), j = useMemo(() => o === "PROP" ? d.filter(
4897
+ const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, g = o === "PROP", [f, x] = useState(!1), j = useMemo(() => o === "PROP" ? d.filter(
4898
4898
  (E) => !includes(c, E) && get(p, `props.${first(split(E, "."))}.binding`)
4899
4899
  ) : d.filter((E) => i === get(u, E, "")), [o, d, c, i, p]);
4900
4900
  return useEffect(() => {
@@ -4902,7 +4902,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4902
4902
  }, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4903
4903
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
4904
4904
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
4905
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: g, onOpenChange: x, children: [
4905
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: f, onOpenChange: x, children: [
4906
4906
  /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4907
4907
  Button,
4908
4908
  {
@@ -4911,7 +4911,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4911
4911
  className: ` ${isEmpty(n) ? "w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white" : "min-w-[350px] items-center justify-between"}`,
4912
4912
  children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4913
4913
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "pr-8 text-sm", children: [
4914
- m && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
4914
+ g && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
4915
4915
  n
4916
4916
  ] }),
4917
4917
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
@@ -4929,7 +4929,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4929
4929
  CommandItem,
4930
4930
  {
4931
4931
  value: E,
4932
- className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4932
+ className: `cursor-pointer ${g ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4933
4933
  onSelect: (b) => {
4934
4934
  r(find(j, (k) => k === b) || null), x(!1);
4935
4935
  },
@@ -4938,7 +4938,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4938
4938
  /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === E ? "" : "opacity-0"}` }),
4939
4939
  E
4940
4940
  ] }),
4941
- m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, E, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, E) }) })
4941
+ g ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, E, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, E) }) })
4942
4942
  ]
4943
4943
  },
4944
4944
  E
@@ -4947,7 +4947,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4947
4947
  ] }) })
4948
4948
  ] })
4949
4949
  ] }),
4950
- !m && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4950
+ !g && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4951
4951
  ] });
4952
4952
  }, AddBindingModalContent = ({
4953
4953
  appliedBindings: o = [],
@@ -4955,7 +4955,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4955
4955
  editMode: r,
4956
4956
  item: a
4957
4957
  }) => {
4958
- const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
4958
+ const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), g = useCallback(
4959
4959
  (j, E) => {
4960
4960
  if (isEmpty(j))
4961
4961
  return "";
@@ -4968,7 +4968,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4968
4968
  }
4969
4969
  },
4970
4970
  [u, p]
4971
- ), [g, x] = useState(r ? m(a.key, "PROP") : "");
4971
+ ), [f, x] = useState(r ? g(a.key, "PROP") : "");
4972
4972
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4973
4973
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
4974
4974
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
@@ -4984,11 +4984,11 @@ const ViewData = ({ data: o, fullView: n }) => {
4984
4984
  value: l,
4985
4985
  setValue: i,
4986
4986
  onChange: (j) => {
4987
- const E = m(j, "PROP");
4988
- i(j), g !== E && d(""), x(E);
4987
+ const E = g(j, "PROP");
4988
+ i(j), f !== E && d(""), x(E);
4989
4989
  },
4990
4990
  data: u,
4991
- dataType: g,
4991
+ dataType: f,
4992
4992
  appliedBindings: o
4993
4993
  }
4994
4994
  ),
@@ -5002,11 +5002,11 @@ const ViewData = ({ data: o, fullView: n }) => {
5002
5002
  value: c,
5003
5003
  setValue: d,
5004
5004
  onChange: (j) => {
5005
- const E = m(j, "PATH");
5006
- d(g === E ? j : "");
5005
+ const E = g(j, "PATH");
5006
+ d(f === E ? j : "");
5007
5007
  },
5008
5008
  data: p,
5009
- dataType: g,
5009
+ dataType: f,
5010
5010
  appliedBindings: o
5011
5011
  }
5012
5012
  )
@@ -5046,14 +5046,14 @@ const ViewData = ({ data: o, fullView: n }) => {
5046
5046
  dataProvider: l,
5047
5047
  appliedBindings: i
5048
5048
  }) => {
5049
- const [c, d] = useState("string"), u = (p, m) => {
5049
+ const [c, d] = useState("string"), u = (p, g) => {
5050
5050
  if (isEmpty(p))
5051
5051
  return "";
5052
5052
  {
5053
- const g = get(m === "PROP" ? a : l, p, "");
5054
- if (isArray$1(g))
5053
+ const f = get(g === "PROP" ? a : l, p, "");
5054
+ if (isArray$1(f))
5055
5055
  return "list";
5056
- const x = typeof g;
5056
+ const x = typeof f;
5057
5057
  return x === "string" ? "text" : x === "object" ? "model" : x;
5058
5058
  }
5059
5059
  };
@@ -5075,32 +5075,32 @@ const ViewData = ({ data: o, fullView: n }) => {
5075
5075
  ] });
5076
5076
  }, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
5077
5077
  const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
5078
- map(o, (g, x) => ({ key: x, value: g }))
5078
+ map(o, (f, x) => ({ key: x, value: f }))
5079
5079
  );
5080
5080
  useEffect(() => {
5081
- c(map(o, (g, x) => ({ key: x, value: g })));
5081
+ c(map(o, (f, x) => ({ key: x, value: f })));
5082
5082
  }, [r == null ? void 0 : r._id, o]);
5083
5083
  const d = useMemo(() => {
5084
5084
  if (isEmpty(a))
5085
5085
  return !0;
5086
5086
  if (isEmpty(i))
5087
5087
  return !1;
5088
- const g = last(i);
5089
- return isEmpty(g == null ? void 0 : g.key) || isEmpty(g == null ? void 0 : g.value);
5090
- }, [a, i]), u = (g) => {
5091
- const x = filter(i, (j) => j.key !== g.key);
5092
- c([...x, g]), m([...x, g]);
5093
- }, p = (g) => {
5094
- const x = filter(i, (j, E) => g !== E);
5095
- m([...x]);
5096
- }, m = useCallback(
5097
- (g = []) => {
5098
- if (c(g), isEmpty(g)) {
5088
+ const f = last(i);
5089
+ return isEmpty(f == null ? void 0 : f.key) || isEmpty(f == null ? void 0 : f.value);
5090
+ }, [a, i]), u = (f) => {
5091
+ const x = filter(i, (j) => j.key !== f.key);
5092
+ c([...x, f]), g([...x, f]);
5093
+ }, p = (f) => {
5094
+ const x = filter(i, (j, E) => f !== E);
5095
+ g([...x]);
5096
+ }, g = useCallback(
5097
+ (f = []) => {
5098
+ if (c(f), isEmpty(f)) {
5099
5099
  n({});
5100
5100
  return;
5101
5101
  }
5102
5102
  const x = {};
5103
- forEach(g, (j) => {
5103
+ forEach(f, (j) => {
5104
5104
  !isEmpty(j == null ? void 0 : j.key) && !isEmpty(j == null ? void 0 : j.value) && set(x, j.key, j.value);
5105
5105
  }), n(x);
5106
5106
  },
@@ -5111,17 +5111,17 @@ const ViewData = ({ data: o, fullView: n }) => {
5111
5111
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
5112
5112
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
5113
5113
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
5114
- map(i, (g, x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5114
+ map(i, (f, x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5115
5115
  NewDataBindingPair,
5116
5116
  {
5117
- item: g,
5117
+ item: f,
5118
5118
  onAddBinding: u,
5119
5119
  onRemove: () => p(x),
5120
5120
  selectedBlock: r,
5121
5121
  dataProvider: a,
5122
5122
  appliedBindings: map(i, "key")
5123
5123
  },
5124
- g.key
5124
+ f.key
5125
5125
  )),
5126
5126
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 200, children: [
5127
5127
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { disabled: isEmpty(a), className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5210,7 +5210,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5210
5210
  }
5211
5211
  )
5212
5212
  ] });
5213
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-nDgC7Fr9.js")), UploadImages = React__default.lazy(() => import("./UploadImages-9KvJB0jW.js")), ImagesPanel = ({
5213
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-chQ74Yzq.js")), UploadImages = React__default.lazy(() => import("./UploadImages-Auy8ZPBl.js")), ImagesPanel = ({
5214
5214
  isModalView: o = !1,
5215
5215
  onSelect: n = () => {
5216
5216
  }
@@ -5304,75 +5304,107 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5304
5304
  collections: n,
5305
5305
  onChange: r
5306
5306
  }) => {
5307
- var k;
5308
- const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (v, C) => []), [i, c] = useState(""), [d, u] = useState("pages"), [p, m] = useState(""), [g, x] = useState([]), j = (k = n == null ? void 0 : n.find((v) => v.key === d)) == null ? void 0 : k.name;
5307
+ var D;
5308
+ const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (m, v) => []), [i, c] = useState(""), [d, u] = useState(!1), [p, g] = useState("pages"), [f, x] = useState(""), [j, E] = useState([]), [b, k] = useState(-1), S = useRef(null), w = (D = n == null ? void 0 : n.find((m) => m.key === p)) == null ? void 0 : D.name;
5309
5309
  useEffect(() => {
5310
- const v = split((o == null ? void 0 : o.href) || "", ":"), C = get(v, 1, "pages") || "pages";
5311
- u(C), m(""), x([]), (async () => {
5310
+ const m = split((o == null ? void 0 : o.href) || "", ":"), v = get(m, 1, "pages") || "pages";
5311
+ g(v), x(""), E([]), k(-1), (async () => {
5312
5312
  c("FETCHING_INIT_VALUE");
5313
- const B = await l(C, [get(v, 2, "pages")]);
5314
- B && Array.isArray(B) && m(get(B, [0, "name"], "")), c("");
5313
+ const C = await l(v, [get(m, 2, "pages")]);
5314
+ C && Array.isArray(C) && x(get(C, [0, "name"], "")), c("");
5315
5315
  })();
5316
- }, [o.href]);
5317
- const E = useCallback(
5318
- debounce(async (v) => {
5319
- if (isEmpty(v))
5320
- x([]);
5316
+ }, [o == null ? void 0 : o.href, l]);
5317
+ const _ = useCallback(
5318
+ debounce(async (m) => {
5319
+ if (isEmpty(m))
5320
+ E([]);
5321
5321
  else {
5322
- const C = await l(d, v);
5323
- x(C);
5322
+ const v = await l(p, m);
5323
+ E(v);
5324
5324
  }
5325
- c("");
5325
+ c(""), k(-1);
5326
5326
  }, 300),
5327
- [d]
5328
- ), b = (v) => {
5329
- const C = ["collection", d, v.id];
5330
- C[1] && r({ ...o, href: C.join(":") });
5327
+ [p]
5328
+ ), R = (m) => {
5329
+ const v = ["collection", p, m.id];
5330
+ v[1] && (r({ ...o, href: v.join(":") }), u(!1));
5331
+ }, A = (m) => {
5332
+ switch (m.key) {
5333
+ case "ArrowDown":
5334
+ m.preventDefault(), k((v) => v < j.length - 1 ? v + 1 : v);
5335
+ break;
5336
+ case "ArrowUp":
5337
+ m.preventDefault(), k((v) => v > 0 ? v - 1 : v);
5338
+ break;
5339
+ case "Enter":
5340
+ if (m.preventDefault(), j.length === 0)
5341
+ return;
5342
+ b >= 0 && R(j[b]);
5343
+ break;
5344
+ case "Escape":
5345
+ m.preventDefault(), T();
5346
+ break;
5347
+ }
5348
+ };
5349
+ useEffect(() => {
5350
+ if (b >= 0 && S.current) {
5351
+ const m = S.current.children[b];
5352
+ m == null || m.scrollIntoView({ block: "nearest" });
5353
+ }
5354
+ }, [b]);
5355
+ const T = () => {
5356
+ x(""), E([]), k(-1), u(!1), r({ ...o, href: "" });
5357
+ }, L = (m) => {
5358
+ x(m), u(!isEmpty(m)), c("FETCHING_COLLECTION_ITEMS"), _(m);
5331
5359
  };
5332
5360
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5333
- /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value: d, onChange: (v) => u(v.target.value), children: map(n, (v) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: v.key, children: v.name }, v.key)) }),
5334
- d && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
5361
+ /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value: p, onChange: (m) => g(m.target.value), children: map(n, (m) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: m.key, children: m.name }, m.key)) }),
5362
+ p && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
5335
5363
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5336
5364
  "input",
5337
5365
  {
5338
5366
  type: "text",
5339
- value: p,
5340
- onChange: (v) => {
5341
- m(v.target.value), c("FETCHING_COLLECTION_ITEMS"), E(v.target.value);
5342
- },
5343
- placeholder: a(`Search ${j}`),
5367
+ value: f,
5368
+ onChange: (m) => L(m.target.value),
5369
+ onKeyDown: A,
5370
+ placeholder: a(`Search ${w}`),
5344
5371
  disabled: i === "FETCHING_INIT_VALUE",
5345
- className: "w-full rounded-md border border-gray-300 p-2"
5372
+ className: "w-full rounded-md border border-gray-300 p-2 pr-16"
5346
5373
  }
5347
5374
  ),
5348
- /* @__PURE__ */ jsxRuntimeExports.jsx(SearchIcon, { className: "absolute right-2 top-2 hidden h-5 w-5 pt-0.5 text-gray-400 group-hover:block" })
5375
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: f && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: T, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
5349
5376
  ] }),
5350
- i === "FETCHING_COLLECTION_ITEMS" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 pt-2", children: [
5377
+ (i === "FETCHING_COLLECTION_ITEMS" || !isEmpty(j) || d && isEmpty(j)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i === "FETCHING_COLLECTION_ITEMS" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
5351
5378
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
5352
5379
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
5353
- ] }) : !isEmpty(g) && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "mt-2 max-h-40 overflow-y-auto rounded-md border border-gray-300", children: map(g == null ? void 0 : g.slice(0, 20), (v) => {
5380
+ ] }) : d && isEmpty(j) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
5381
+ a("No results found for"),
5382
+ ' "',
5383
+ f,
5384
+ '"'
5385
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: S, children: map(j == null ? void 0 : j.slice(0, 20), (m, v) => {
5354
5386
  var C;
5355
5387
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
5356
5388
  "li",
5357
5389
  {
5358
- onClick: () => b(v),
5359
- className: `cursor-pointer p-2 text-xs ${(C = o == null ? void 0 : o.href) != null && C.includes(v.id) ? "bg-blue-200" : "hover:bg-gray-100"}`,
5390
+ onClick: () => R(m),
5391
+ className: `cursor-pointer p-2 text-xs ${(C = o == null ? void 0 : o.href) != null && C.includes(m.id) ? "bg-blue-200" : v === b ? "bg-gray-100" : "hover:bg-gray-100"}`,
5360
5392
  children: [
5361
- v.name,
5393
+ m.name,
5362
5394
  " ",
5363
- v.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
5395
+ m.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
5364
5396
  "( ",
5365
- v.slug,
5397
+ m.slug,
5366
5398
  " )"
5367
5399
  ] })
5368
5400
  ]
5369
5401
  },
5370
- v.id
5402
+ m.id
5371
5403
  );
5372
- }) })
5404
+ }) }) })
5373
5405
  ] });
5374
5406
  }, LinkField = ({ schema: o, formData: n, onChange: r }) => {
5375
- const { t: a } = useTranslation(), { type: l = "page", href: i = "#", target: c = "self" } = n, d = useBuilderProp("collections", []);
5407
+ const { t: a } = useTranslation(), { type: l = "collection", href: i = "#", target: c = "self" } = n, d = useBuilderProp("collections", []);
5376
5408
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5377
5409
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
5378
5410
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
@@ -5438,7 +5470,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5438
5470
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
5439
5471
  ] });
5440
5472
  }, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
5441
- const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: m, languages: g } = useLanguages(), x = g.length === 0 ? "" : p.length ? p : m;
5473
+ const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: g, languages: f } = useLanguages(), x = f.length === 0 ? "" : p.length ? p : g;
5442
5474
  Object.keys(n).forEach((E) => {
5443
5475
  const b = n[E];
5444
5476
  if (includes(["slot", "styles"], b.type))
@@ -5547,28 +5579,28 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5547
5579
  }), a;
5548
5580
  };
5549
5581
  function BlockSettings() {
5550
- const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: b }, k, v) => {
5582
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: b }, k, S) => {
5551
5583
  if (k && (c == null ? void 0 : c._id) === n._id) {
5552
- const C = k.replace("root.", "");
5553
- a([n._id], { [C]: get(b, C) }, v);
5584
+ const w = k.replace("root.", "");
5585
+ a([n._id], { [w]: get(b, w) }, S);
5554
5586
  }
5555
- }, m = useCallback(
5556
- debounce(({ formData: b }, k, v) => {
5557
- p({ formData: b }, k, v), d(b);
5587
+ }, g = useCallback(
5588
+ debounce(({ formData: b }, k, S) => {
5589
+ p({ formData: b }, k, S), d(b);
5558
5590
  }, 1500),
5559
5591
  [n == null ? void 0 : n._id, o]
5560
- ), g = ({ formData: b }, k) => {
5592
+ ), f = ({ formData: b }, k) => {
5561
5593
  if (k) {
5562
- const v = k.replace("root.", "");
5594
+ const S = k.replace("root.", "");
5563
5595
  r(
5564
5596
  [n._id],
5565
- convertDotNotationToObject(v, get(b, v.split(".")))
5566
- ), m({ formData: b }, k, { [v]: get(c, v) });
5597
+ convertDotNotationToObject(S, get(b, S.split(".")))
5598
+ ), g({ formData: b }, k, { [S]: get(c, S) });
5567
5599
  }
5568
5600
  }, x = keys(get(i, "_bindings", {})), j = useMemo(() => {
5569
5601
  const b = cloneDeep(get(l, "props", {}));
5570
- return each(b, (k, v) => {
5571
- get(k, "hidden", !1) && delete b[v];
5602
+ return each(b, (k, S) => {
5603
+ get(k, "hidden", !1) && delete b[S];
5572
5604
  }), u && each(x, (k) => delete b[k]), b;
5573
5605
  }, [l, x, u]), E = get(l, "server", !1);
5574
5606
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
@@ -5610,7 +5642,7 @@ function BlockSettings() {
5610
5642
  JSONForm,
5611
5643
  {
5612
5644
  id: n == null ? void 0 : n._id,
5613
- onChange: g,
5645
+ onChange: f,
5614
5646
  formData: i,
5615
5647
  properties: j
5616
5648
  }
@@ -5621,7 +5653,7 @@ function BlockSettings() {
5621
5653
  JSONForm,
5622
5654
  {
5623
5655
  id: n == null ? void 0 : n._id,
5624
- onChange: g,
5656
+ onChange: f,
5625
5657
  formData: i,
5626
5658
  properties: j
5627
5659
  }
@@ -5651,21 +5683,21 @@ function promptWithLanguage(o, n, r) {
5651
5683
  ${a}`;
5652
5684
  }
5653
5685
  const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5654
- 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;
5686
+ 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(), g = u.length ? u : p;
5655
5687
  return {
5656
5688
  askAi: useCallback(
5657
- async (g, x, j, E) => {
5689
+ async (f, x, j, E) => {
5658
5690
  if (l) {
5659
5691
  n(!0), a(null);
5660
5692
  try {
5661
- const b = g === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((R) => R._id === x))];
5693
+ const b = f === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((R) => R._id === x))];
5662
5694
  set(b, "0._parent", null);
5663
- const k = u === p ? "" : u, v = await l(g, promptWithLanguage(j, m, g), b, k), { blocks: C, error: B } = v;
5664
- if (B) {
5665
- a(B);
5695
+ const k = u === p ? "" : u, S = await l(f, promptWithLanguage(j, g, f), b, k), { blocks: w, error: _ } = S;
5696
+ if (_) {
5697
+ a(_);
5666
5698
  return;
5667
5699
  }
5668
- g === "styles" ? c(C) : i(C), E && E(v);
5700
+ f === "styles" ? c(w) : i(w), E && E(S);
5669
5701
  } catch (b) {
5670
5702
  a(b);
5671
5703
  } finally {
@@ -5679,7 +5711,7 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5679
5711
  d,
5680
5712
  u,
5681
5713
  p,
5682
- m,
5714
+ g,
5683
5715
  c,
5684
5716
  i
5685
5717
  ]
@@ -5753,14 +5785,14 @@ function Countdown() {
5753
5785
  ] });
5754
5786
  }
5755
5787
  const AskAIStyles = ({ blockId: o }) => {
5756
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
5788
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, g] = useState();
5757
5789
  useEffect(() => {
5758
5790
  var x;
5759
5791
  (x = d.current) == null || x.focus();
5760
5792
  }, []);
5761
- const g = (x) => {
5793
+ const f = (x) => {
5762
5794
  const { usage: j } = x || {};
5763
- !l && j && m(j), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
5795
+ !l && j && g(j), u.current = setTimeout(() => g(void 0), 1e4), l || c("");
5764
5796
  };
5765
5797
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5766
5798
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
@@ -5774,7 +5806,7 @@ const AskAIStyles = ({ blockId: o }) => {
5774
5806
  className: "w-full border border-border focus:border-0",
5775
5807
  rows: 3,
5776
5808
  onKeyDown: (x) => {
5777
- x.key === "Enter" && (x.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g));
5809
+ x.key === "Enter" && (x.preventDefault(), u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, f));
5778
5810
  }
5779
5811
  }
5780
5812
  ),
@@ -5784,7 +5816,7 @@ const AskAIStyles = ({ blockId: o }) => {
5784
5816
  {
5785
5817
  disabled: i.trim().length < 5 || a,
5786
5818
  onClick: () => {
5787
- u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g);
5819
+ u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, f);
5788
5820
  },
5789
5821
  variant: "default",
5790
5822
  className: "w-fit",
@@ -5820,35 +5852,35 @@ const AskAIStyles = ({ blockId: o }) => {
5820
5852
  keys: ["name"]
5821
5853
  });
5822
5854
  function ManualClasses() {
5823
- var _;
5824
- 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 = (_ = first(n)) == null ? void 0 : _.prop, g = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
5825
- const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5826
- a(i, N, !0), u("");
5827
- }, [j, E] = useState([]), b = ({ value: N }) => {
5828
- const L = N.trim().toLowerCase(), P = L.match(/.+:/g);
5829
- let f = [];
5830
- if (P && P.length > 0) {
5831
- const [S] = P, w = L.replace(S, "");
5832
- f = fuse.search(w).map((I) => ({
5855
+ var A;
5856
+ const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), g = (A = first(n)) == null ? void 0 : A.prop, f = reject((get(r, g, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
5857
+ const T = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5858
+ a(i, T, !0), u("");
5859
+ }, [j, E] = useState([]), b = ({ value: T }) => {
5860
+ const L = T.trim().toLowerCase(), D = L.match(/.+:/g);
5861
+ let m = [];
5862
+ if (D && D.length > 0) {
5863
+ const [v] = D, C = L.replace(v, "");
5864
+ m = fuse.search(C).map((I) => ({
5833
5865
  ...I,
5834
- item: { ...I.item, name: S + I.item.name }
5866
+ item: { ...I.item, name: v + I.item.name }
5835
5867
  }));
5836
5868
  } else
5837
- f = fuse.search(L);
5838
- return E(map(f, "item"));
5869
+ m = fuse.search(L);
5870
+ return E(map(m, "item"));
5839
5871
  }, k = () => {
5840
5872
  E([]);
5841
- }, v = (N) => N.name, C = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5873
+ }, S = (T) => T.name, w = (T) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: T.name }), _ = {
5842
5874
  autoComplete: "off",
5843
5875
  autoCorrect: "off",
5844
5876
  autoCapitalize: "off",
5845
5877
  spellCheck: !1,
5846
5878
  placeholder: o("Enter classes separated by space"),
5847
5879
  value: d,
5848
- onKeyDown: (N) => {
5849
- N.key === "Enter" && d.trim() !== "" && x();
5880
+ onKeyDown: (T) => {
5881
+ T.key === "Enter" && d.trim() !== "" && x();
5850
5882
  },
5851
- onChange: (N, { newValue: L }) => u(L),
5883
+ onChange: (T, { newValue: L }) => u(L),
5852
5884
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5853
5885
  }, R = () => {
5854
5886
  if (navigator.clipboard === void 0) {
@@ -5859,7 +5891,7 @@ function ManualClasses() {
5859
5891
  });
5860
5892
  return;
5861
5893
  }
5862
- navigator.clipboard.writeText(g.join(" ")), p({
5894
+ navigator.clipboard.writeText(f.join(" ")), p({
5863
5895
  title: o("Copied"),
5864
5896
  description: o("Classes copied to clipboard")
5865
5897
  });
@@ -5892,9 +5924,9 @@ function ManualClasses() {
5892
5924
  suggestions: j,
5893
5925
  onSuggestionsFetchRequested: b,
5894
5926
  onSuggestionsClearRequested: k,
5895
- getSuggestionValue: v,
5896
- renderSuggestion: C,
5897
- inputProps: B,
5927
+ getSuggestionValue: S,
5928
+ renderSuggestion: w,
5929
+ inputProps: _,
5898
5930
  containerProps: {
5899
5931
  className: "relative h-8 w-full gap-y-1 py-1 border-border"
5900
5932
  },
@@ -5918,22 +5950,22 @@ function ManualClasses() {
5918
5950
  )
5919
5951
  ] }),
5920
5952
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
5921
- g.map((N) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5953
+ f.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5922
5954
  "div",
5923
5955
  {
5924
5956
  className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
5925
5957
  children: [
5926
- N,
5958
+ T,
5927
5959
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5928
5960
  Cross2Icon,
5929
5961
  {
5930
- onClick: () => l(i, [N]),
5962
+ onClick: () => l(i, [T]),
5931
5963
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
5932
5964
  }
5933
5965
  )
5934
5966
  ]
5935
5967
  },
5936
- N
5968
+ T
5937
5969
  ))
5938
5970
  ) })
5939
5971
  ]
@@ -6324,7 +6356,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6324
6356
  ringColor: "ring",
6325
6357
  ringOffsetColor: "ring-offset"
6326
6358
  }, ColorChoice = ({ property: o, onChange: n }) => {
6327
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), g = get(p, "2", ""), x = useCallback(
6359
+ const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), g = get(p, "1", ""), f = get(p, "2", ""), x = useCallback(
6328
6360
  // eslint-disable-next-line no-shadow
6329
6361
  (E) => {
6330
6362
  ["current", "inherit", "transparent", "black", "white"].includes(E) ? (c([]), u({ color: E })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((b) => ({ ...b, color: E, shade: b.shade ? b.shade : "500" })));
@@ -6332,16 +6364,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6332
6364
  [c, u]
6333
6365
  );
6334
6366
  useEffect(() => {
6335
- if (["current", "inherit", "transparent", "black", "white"].includes(m))
6367
+ if (["current", "inherit", "transparent", "black", "white"].includes(g))
6336
6368
  return c([]);
6337
6369
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
6338
- }, [m]);
6370
+ }, [g]);
6339
6371
  const j = useCallback(
6340
6372
  // eslint-disable-next-line no-shadow
6341
6373
  (E) => {
6342
- u({ color: m, shade: E });
6374
+ u({ color: g, shade: E });
6343
6375
  },
6344
- [m]
6376
+ [g]
6345
6377
  );
6346
6378
  return useEffect(() => {
6347
6379
  u({ color: "", shade: "" });
@@ -6354,7 +6386,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6354
6386
  {
6355
6387
  disabled: !l,
6356
6388
  rounded: !0,
6357
- selected: m,
6389
+ selected: g,
6358
6390
  onChange: x,
6359
6391
  options: [
6360
6392
  "current",
@@ -6388,7 +6420,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6388
6420
  ]
6389
6421
  }
6390
6422
  ) }),
6391
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: g, disabled: !m || !l, onChange: j, options: i }) })
6423
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: f, disabled: !g || !l, onChange: j, options: i }) })
6392
6424
  ] });
6393
6425
  }, getUserInputValues = (o, n) => {
6394
6426
  o = o.toLowerCase();
@@ -6583,88 +6615,88 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6583
6615
  },
6584
6616
  a
6585
6617
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6586
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [g, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [v, C] = useState(!1), [B, R] = useState(!1);
6618
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [f, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [S, w] = useState(!1), [_, R] = useState(!1);
6587
6619
  useEffect(() => {
6588
- const { value: f, unit: S } = getClassValueAndUnit(i);
6589
- if (S === "") {
6590
- l(f), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6620
+ const { value: m, unit: v } = getClassValueAndUnit(i);
6621
+ if (v === "") {
6622
+ l(m), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6591
6623
  return;
6592
6624
  }
6593
- x(S), l(S === "class" || isEmpty(f) ? "" : f);
6625
+ x(v), l(v === "class" || isEmpty(m) ? "" : m);
6594
6626
  }, [i, u, p]);
6595
- const _ = useThrottledCallback((f) => c(f), [c], THROTTLE_TIME), N = useThrottledCallback((f) => c(f, !1), [c], THROTTLE_TIME), L = useCallback(
6596
- (f = !1) => {
6597
- const S = getUserInputValues(`${a}`, p);
6598
- if (get(S, "error", !1)) {
6627
+ const A = useThrottledCallback((m) => c(m), [c], THROTTLE_TIME), T = useThrottledCallback((m) => c(m, !1), [c], THROTTLE_TIME), L = useCallback(
6628
+ (m = !1) => {
6629
+ const v = getUserInputValues(`${a}`, p);
6630
+ if (get(v, "error", !1)) {
6599
6631
  E(!0);
6600
6632
  return;
6601
6633
  }
6602
- const w = get(S, "unit") !== "" ? get(S, "unit") : g;
6603
- if (w === "auto" || w === "none") {
6604
- _(`${d}${w}`);
6634
+ const C = get(v, "unit") !== "" ? get(v, "unit") : f;
6635
+ if (C === "auto" || C === "none") {
6636
+ A(`${d}${C}`);
6605
6637
  return;
6606
6638
  }
6607
- if (get(S, "value") === "")
6639
+ if (get(v, "value") === "")
6608
6640
  return;
6609
- const I = `${get(S, "value", "").startsWith("-") ? "-" : ""}${d}[${get(S, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6610
- f ? N(I) : _(I);
6641
+ const I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6642
+ m ? T(I) : A(I);
6611
6643
  },
6612
- [_, N, a, g, d, p]
6613
- ), P = useCallback(
6614
- (f) => {
6615
- const S = getUserInputValues(`${a}`, p);
6616
- if (get(S, "error", !1)) {
6644
+ [A, T, a, f, d, p]
6645
+ ), D = useCallback(
6646
+ (m) => {
6647
+ const v = getUserInputValues(`${a}`, p);
6648
+ if (get(v, "error", !1)) {
6617
6649
  E(!0);
6618
6650
  return;
6619
6651
  }
6620
- if (f === "auto" || f === "none") {
6621
- _(`${d}${f}`);
6652
+ if (m === "auto" || m === "none") {
6653
+ A(`${d}${m}`);
6622
6654
  return;
6623
6655
  }
6624
- if (get(S, "value") === "")
6656
+ if (get(v, "value") === "")
6625
6657
  return;
6626
- const w = get(S, "unit") !== "" ? get(S, "unit") : f, I = `${get(S, "value", "").startsWith("-") ? "-" : ""}${d}[${get(S, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6627
- _(I);
6658
+ const C = get(v, "unit") !== "" ? get(v, "unit") : m, I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6659
+ A(I);
6628
6660
  },
6629
- [_, a, d, p]
6661
+ [A, a, d, p]
6630
6662
  );
6631
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: g === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6663
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: f === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6632
6664
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
6633
6665
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6634
6666
  /* @__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, {}) }) }),
6635
6667
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6636
6668
  ] })
6637
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
6669
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${S ? "z-auto" : ""}`, children: [
6638
6670
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6639
- ["none", "auto"].indexOf(g) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6671
+ ["none", "auto"].indexOf(f) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6640
6672
  "input",
6641
6673
  {
6642
- readOnly: g === "class",
6643
- onKeyPress: (f) => {
6644
- f.key === "Enter" && L();
6674
+ readOnly: f === "class",
6675
+ onKeyPress: (m) => {
6676
+ m.key === "Enter" && L();
6645
6677
  },
6646
- onKeyDown: (f) => {
6647
- if (f.keyCode !== 38 && f.keyCode !== 40)
6678
+ onKeyDown: (m) => {
6679
+ if (m.keyCode !== 38 && m.keyCode !== 40)
6648
6680
  return;
6649
- f.preventDefault(), R(!0);
6650
- const S = parseInt$1(f.target.value);
6651
- let w = isNaN$1(S) ? 0 : S;
6652
- f.keyCode === 38 && (w += 1), f.keyCode === 40 && (w -= 1);
6653
- const A = `${w}`, T = `${A.startsWith("-") ? "-" : ""}${d}[${A.replace("-", "")}${g === "-" ? "" : g}]`;
6654
- N(T);
6681
+ m.preventDefault(), R(!0);
6682
+ const v = parseInt$1(m.target.value);
6683
+ let C = isNaN$1(v) ? 0 : v;
6684
+ m.keyCode === 38 && (C += 1), m.keyCode === 40 && (C -= 1);
6685
+ const B = `${C}`, N = `${B.startsWith("-") ? "-" : ""}${d}[${B.replace("-", "")}${f === "-" ? "" : f}]`;
6686
+ T(N);
6655
6687
  },
6656
- onKeyUp: (f) => {
6657
- B && (f.preventDefault(), R(!1));
6688
+ onKeyUp: (m) => {
6689
+ _ && (m.preventDefault(), R(!1));
6658
6690
  },
6659
6691
  onBlur: () => L(),
6660
- onChange: (f) => {
6661
- E(!1), l(f.target.value);
6692
+ onChange: (m) => {
6693
+ E(!1), l(m.target.value);
6662
6694
  },
6663
- onClick: (f) => {
6664
- var S;
6665
- (S = f == null ? void 0 : f.target) == null || S.select(), r(!1);
6695
+ onClick: (m) => {
6696
+ var v;
6697
+ (v = m == null ? void 0 : m.target) == null || v.select(), r(!1);
6666
6698
  },
6667
- value: v ? b : a,
6699
+ value: S ? b : a,
6668
6700
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6669
6701
  " ",
6670
6702
  j ? "border-red-500 text-red-500" : "border-foreground/20"
@@ -6679,7 +6711,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6679
6711
  onClick: () => r(!n),
6680
6712
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
6681
6713
  children: [
6682
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: g }),
6714
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: f }),
6683
6715
  p.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
6684
6716
  ]
6685
6717
  }
@@ -6688,34 +6720,34 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6688
6720
  UnitSelection,
6689
6721
  {
6690
6722
  units: p,
6691
- current: g,
6692
- onSelect: (f) => {
6693
- r(!1), x(f), P(f);
6723
+ current: f,
6724
+ onSelect: (m) => {
6725
+ r(!1), x(m), D(m);
6694
6726
  }
6695
6727
  }
6696
6728
  ) }) })
6697
6729
  ] })
6698
6730
  ] }),
6699
- ["none", "auto"].indexOf(g) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6731
+ ["none", "auto"].indexOf(f) !== -1 || S ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6700
6732
  DragStyleButton,
6701
6733
  {
6702
- onDragStart: () => C(!0),
6703
- onDragEnd: (f) => {
6704
- if (k(() => ""), C(!1), isEmpty(f))
6734
+ onDragStart: () => w(!0),
6735
+ onDragEnd: (m) => {
6736
+ if (k(() => ""), w(!1), isEmpty(m))
6705
6737
  return;
6706
- const S = `${f}`, A = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${g === "-" ? "" : g}]`;
6707
- _(A);
6738
+ const v = `${m}`, B = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${f === "-" ? "" : f}]`;
6739
+ A(B);
6708
6740
  },
6709
- onDrag: (f) => {
6710
- if (isEmpty(f))
6741
+ onDrag: (m) => {
6742
+ if (isEmpty(m))
6711
6743
  return;
6712
- k(f);
6713
- const S = `${f}`, A = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${g === "-" ? "" : g}]`;
6714
- N(A);
6744
+ k(m);
6745
+ const v = `${m}`, B = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${f === "-" ? "" : f}]`;
6746
+ T(B);
6715
6747
  },
6716
6748
  currentValue: a,
6717
- unit: g,
6718
- negative: m,
6749
+ unit: f,
6750
+ negative: g,
6719
6751
  cssProperty: u
6720
6752
  }
6721
6753
  )
@@ -6808,41 +6840,41 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6808
6840
  "2xl": "1536px"
6809
6841
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6810
6842
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6811
- }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), g = useCurrentClassByProperty(l), x = useAddClassesToBlocks(), j = useRemoveClassesFromBlocks(), [E] = useSelectedBlockIds(), b = useMemo(() => get(g, "fullCls", ""), [g]), k = useCallback(
6812
- (N, L = !0) => {
6813
- const P = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
6814
- (u || p !== "") && (P.mq = "xs");
6815
- const f = generateFullClsName(P);
6816
- x(E, [f], L);
6843
+ }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useCanvasWidth(), f = useCurrentClassByProperty(l), x = useAddClassesToBlocks(), j = useRemoveClassesFromBlocks(), [E] = useSelectedBlockIds(), b = useMemo(() => get(f, "fullCls", ""), [f]), k = useCallback(
6844
+ (T, L = !0) => {
6845
+ const D = { dark: u, mq: g, mod: p, cls: T, property: l, fullCls: "" };
6846
+ (u || p !== "") && (D.mq = "xs");
6847
+ const m = generateFullClsName(D);
6848
+ x(E, [m], L);
6817
6849
  },
6818
- [E, u, m, p, l, x]
6819
- ), v = useCallback(() => {
6850
+ [E, u, g, p, l, x]
6851
+ ), S = useCallback(() => {
6820
6852
  j(E, [b]);
6821
- }, [E, b, j]), C = useMemo(() => canChangeClass(g, m), [g, m]);
6853
+ }, [E, b, j]), w = useMemo(() => canChangeClass(f, g), [f, g]);
6822
6854
  useEffect(() => {
6823
- i(C, g);
6824
- }, [C, i, g]);
6825
- const [, , B] = useCanvasWidth(), R = useCallback(
6826
- (N) => {
6827
- B({
6855
+ i(w, f);
6856
+ }, [w, i, f]);
6857
+ const [, , _] = useCanvasWidth(), R = useCallback(
6858
+ (T) => {
6859
+ _({
6828
6860
  xs: 400,
6829
6861
  sm: 640,
6830
6862
  md: 800,
6831
6863
  lg: 1024,
6832
6864
  xl: 1420,
6833
6865
  "2xl": 1920
6834
- }[N]);
6866
+ }[T]);
6835
6867
  },
6836
- [B]
6837
- ), _ = get(g, "dark", null) === u && get(g, "mod", null) === p && get(g, "mq", null) === m;
6838
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: g && _, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6839
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !_ ? "text-foreground" : ""}`, children: n(a) }) }),
6868
+ [_]
6869
+ ), A = get(f, "dark", null) === u && get(f, "mod", null) === p && get(f, "mq", null) === g;
6870
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: w, canReset: f && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6871
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${f && !A ? "text-foreground" : ""}`, children: n(a) }) }),
6840
6872
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6841
6873
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
6842
6874
  r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
6843
6875
  AdvanceChoices,
6844
6876
  {
6845
- currentClass: get(g, "cls", ""),
6877
+ currentClass: get(f, "cls", ""),
6846
6878
  classPrefix: get(CLASS_PREFIXES, l, ""),
6847
6879
  units: c || [],
6848
6880
  onChange: k,
@@ -6855,7 +6887,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6855
6887
  r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
6856
6888
  r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
6857
6889
  ] }),
6858
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: _ ? /* @__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" }) }) : C && g ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6890
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => S(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : w && f ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6859
6891
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6860
6892
  "button",
6861
6893
  {
@@ -6867,19 +6899,19 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6867
6899
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
6868
6900
  "Current style is set at  ",
6869
6901
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
6870
- getBreakpoint(get(g, "mq")),
6871
- u && !g.dark ? "(Light mode)" : ""
6902
+ getBreakpoint(get(f, "mq")),
6903
+ u && !f.dark ? "(Light mode)" : ""
6872
6904
  ] }),
6873
6905
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
6874
6906
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
6875
6907
  "button",
6876
6908
  {
6877
6909
  type: "button",
6878
- onClick: () => R(get(g, "mq")),
6910
+ onClick: () => R(get(f, "mq")),
6879
6911
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6880
6912
  children: [
6881
6913
  "Switch to ",
6882
- get(g, "mq").toUpperCase()
6914
+ get(f, "mq").toUpperCase()
6883
6915
  ]
6884
6916
  }
6885
6917
  )
@@ -6896,7 +6928,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6896
6928
  units: i = basicUnits,
6897
6929
  negative: c = !1
6898
6930
  }) => {
6899
- const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), g = useCallback((x) => map(m, "property").includes(x), [m]);
6931
+ const { t: d } = useTranslation(), [u, p] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), f = useCallback((x) => map(g, "property").includes(x), [g]);
6900
6932
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6901
6933
  "div",
6902
6934
  {
@@ -6914,7 +6946,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6914
6946
  className: `relative cursor-pointer rounded-full p-1 text-[8px] ${j === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6915
6947
  children: [
6916
6948
  React__default.createElement("div", {
6917
- className: g(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6949
+ className: f(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6918
6950
  }),
6919
6951
  React__default.createElement(get(EDITOR_ICONS, j, BoxIcon), { className: "text-inherit w-3 h-3" })
6920
6952
  ]
@@ -6985,8 +7017,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6985
7017
  if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
6986
7018
  return null;
6987
7019
  const u = (p) => {
6988
- const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6989
- l([o._id], m, !0);
7020
+ const g = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
7021
+ l([o._id], g, !0);
6990
7022
  };
6991
7023
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
6992
7024
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "default", className: "w-full", size: "sm", children: [
@@ -7040,13 +7072,13 @@ function BlockStyling() {
7040
7072
  cssProperty: ""
7041
7073
  }), d = useThrottledCallback(
7042
7074
  (p) => {
7043
- const m = !get(i, "negative", !1), g = get(i, "cssProperty", "");
7075
+ const g = !get(i, "negative", !1), f = get(i, "cssProperty", "");
7044
7076
  let x = parseFloat(i.dragStartValue);
7045
7077
  x = isNaN(x) ? 0 : x;
7046
7078
  let j = MAPPER[i.dragUnit];
7047
- (startsWith(g, "scale") || g === "opacity") && (j = 10);
7079
+ (startsWith(f, "scale") || f === "opacity") && (j = 10);
7048
7080
  let b = (i.dragStartY - p.pageY) / j + x;
7049
- m && b < 0 && (b = 0), g === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
7081
+ g && b < 0 && (b = 0), f === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
7050
7082
  },
7051
7083
  [i],
7052
7084
  50
@@ -7132,9 +7164,9 @@ const BlockCard = ({
7132
7164
  library: n,
7133
7165
  parentId: r = void 0
7134
7166
  }) => {
7135
- const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), m = get(o, "name", get(o, "label")), g = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), j = (k) => {
7136
- const v = has(k, "styles_attrs.data-page-section");
7137
- return k._type === "Box" && v;
7167
+ const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), g = get(o, "name", get(o, "label")), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), j = (k) => {
7168
+ const S = has(k, "styles_attrs.data-page-section");
7169
+ return k._type === "Box" && S;
7138
7170
  }, E = useCallback(
7139
7171
  async (k) => {
7140
7172
  if (k.stopPropagation(), has(o, "component")) {
@@ -7142,23 +7174,23 @@ const BlockCard = ({
7142
7174
  return;
7143
7175
  }
7144
7176
  l(!0);
7145
- const v = await i(n, o);
7146
- isEmpty(v) || d(syncBlocksWithDefaults(v), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7177
+ const S = await i(n, o);
7178
+ isEmpty(S) || d(syncBlocksWithDefaults(S), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7147
7179
  },
7148
7180
  [o]
7149
7181
  ), b = async (k) => {
7150
- const v = await i(n, o);
7151
- let C = r;
7152
- if (j(first(v)) && (C = null), !isEmpty(v)) {
7153
- const B = { blocks: v, uiLibrary: !0, parent: C };
7154
- if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
7182
+ const S = await i(n, o);
7183
+ let w = r;
7184
+ if (j(first(S)) && (w = null), !isEmpty(S)) {
7185
+ const _ = { blocks: S, uiLibrary: !0, parent: w };
7186
+ if (k.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
7155
7187
  const R = new Image();
7156
7188
  R.src = o.preview, R.onload = () => {
7157
7189
  k.dataTransfer.setDragImage(R, 0, 0);
7158
7190
  };
7159
7191
  } else
7160
7192
  k.dataTransfer.setDragImage(new Image(), 0, 0);
7161
- x(B), setTimeout(() => {
7193
+ x(_), setTimeout(() => {
7162
7194
  u([]), p(), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7163
7195
  }, 200);
7164
7196
  }
@@ -7169,7 +7201,7 @@ const BlockCard = ({
7169
7201
  {
7170
7202
  onClick: a ? () => {
7171
7203
  } : E,
7172
- draggable: g ? "true" : "false",
7204
+ draggable: f ? "true" : "false",
7173
7205
  onDragStart: b,
7174
7206
  className: clsx(
7175
7207
  "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
@@ -7179,11 +7211,11 @@ const BlockCard = ({
7179
7211
  /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
7180
7212
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
7181
7213
  ] }),
7182
- o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: m }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: m }) })
7214
+ o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: g }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: g }) })
7183
7215
  ]
7184
7216
  }
7185
7217
  ) }),
7186
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m }) })
7218
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: g }) })
7187
7219
  ] });
7188
7220
  }, libraryBlocksAtom = atom$1(
7189
7221
  {}
@@ -7199,9 +7231,9 @@ const BlockCard = ({
7199
7231
  })();
7200
7232
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
7201
7233
  }, UILibrarySection = ({ parentId: o }) => {
7202
- const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((C) => C.category === "custom"), c = a.find((C) => C.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, g] = useState("Hero"), x = get(p, m, []), j = useRef(null), { t: E } = useTranslation(), b = (C) => {
7234
+ const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((w) => w.category === "custom"), c = a.find((w) => w.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [g, f] = useState("Hero"), x = get(p, g, []), j = useRef(null), { t: E } = useTranslation(), b = (w) => {
7203
7235
  j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
7204
- j.current && g(C);
7236
+ j.current && f(w);
7205
7237
  }, 300);
7206
7238
  };
7207
7239
  if (u)
@@ -7209,7 +7241,7 @@ const BlockCard = ({
7209
7241
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7210
7242
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7211
7243
  ] });
7212
- const k = filter(x, (C, B) => B % 2 === 0), v = filter(x, (C, B) => B % 2 === 1);
7244
+ const k = filter(x, (w, _) => _ % 2 === 0), S = filter(x, (w, _) => _ % 2 === 1);
7213
7245
  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: [
7214
7246
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7215
7247
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
@@ -7217,22 +7249,22 @@ const BlockCard = ({
7217
7249
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: E("Groups") }),
7218
7250
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7219
7251
  /* @__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(
7220
- map(p, (C, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7252
+ map(p, (w, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7221
7253
  "div",
7222
7254
  {
7223
- onMouseEnter: () => b(B),
7255
+ onMouseEnter: () => b(_),
7224
7256
  onMouseLeave: () => clearTimeout(j.current),
7225
- onClick: () => g(B),
7257
+ onClick: () => f(_),
7226
7258
  className: cn(
7227
7259
  "flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
7228
- B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7260
+ _ === g ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7229
7261
  ),
7230
7262
  children: [
7231
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(B.toLowerCase())) }),
7263
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(_.toLowerCase())) }),
7232
7264
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7233
7265
  ]
7234
7266
  },
7235
- B
7267
+ _
7236
7268
  ))
7237
7269
  ) })
7238
7270
  ] })
@@ -7245,10 +7277,10 @@ const BlockCard = ({
7245
7277
  children: [
7246
7278
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7247
7279
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7248
- k.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7280
+ k.map((w) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: w, library: c }))
7249
7281
  ) }),
7250
7282
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7251
- v.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7283
+ S.map((w) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: w, library: c }))
7252
7284
  ) })
7253
7285
  ] }),
7254
7286
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -7729,7 +7761,10 @@ const BlockCard = ({
7729
7761
  "Fetching...": "Fetching...",
7730
7762
  "No images found": "No images found",
7731
7763
  "It looks like you haven't uploaded any images yet. Start by clicking the upload button above.": "It looks like you haven't uploaded any images yet. Start by clicking the upload button above.",
7732
- "Open Code Editor": "Open Code Editor"
7764
+ "Open Code Editor": "Open Code Editor",
7765
+ "Clear search": "Clear search",
7766
+ "No results found for": "No results found for",
7767
+ "Search {collectionName}": "Search {collectionName}"
7733
7768
  };
7734
7769
  i18n.use(initReactI18next).init({
7735
7770
  // the translations
@@ -7749,7 +7784,7 @@ i18n.use(initReactI18next).init({
7749
7784
  }
7750
7785
  });
7751
7786
  const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7752
- const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = () => {
7787
+ const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), f = () => {
7753
7788
  if (has(o, "blocks")) {
7754
7789
  const E = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7755
7790
  u(syncBlocksWithDefaults(E), r || null);
@@ -7762,11 +7797,11 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7762
7797
  "button",
7763
7798
  {
7764
7799
  disabled: n,
7765
- onClick: g,
7800
+ onClick: f,
7766
7801
  type: "button",
7767
7802
  onDragStart: (E) => {
7768
7803
  E.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), E.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7769
- p([]), m();
7804
+ p([]), g();
7770
7805
  }, 200);
7771
7806
  },
7772
7807
  draggable: x ? "true" : "false",
@@ -7823,9 +7858,9 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7823
7858
  value: l,
7824
7859
  className: cn("h-max"),
7825
7860
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "grid w-full " + (d ? "grid-cols-3" : "grid-cols-2"), children: [
7826
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "library", children: a("library") }),
7827
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "core", children: a("blocks") }),
7828
- d ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "html", children: a("import") }) : null
7861
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "library", children: a("Library") }),
7862
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "core", children: a("Blocks") }),
7863
+ d ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "html", children: a("Import") }) : null
7829
7864
  ] })
7830
7865
  }
7831
7866
  ),
@@ -8131,14 +8166,14 @@ function QuickPrompts({ onClick: o }) {
8131
8166
  ) }) });
8132
8167
  }
8133
8168
  const AIUserPrompt = ({ blockId: o }) => {
8134
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), g = useRef(null), x = useRef(null);
8169
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, g] = useState(), f = useRef(null), x = useRef(null);
8135
8170
  useEffect(() => {
8136
8171
  var E;
8137
- (E = g.current) == null || E.focus();
8172
+ (E = f.current) == null || E.focus();
8138
8173
  }, []);
8139
8174
  const j = (E) => {
8140
8175
  const { usage: b } = E || {};
8141
- !l && b && m(b), x.current = setTimeout(() => m(void 0), 1e4), l || c("");
8176
+ !l && b && g(b), x.current = setTimeout(() => g(void 0), 1e4), l || c("");
8142
8177
  };
8143
8178
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
8144
8179
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -8156,14 +8191,14 @@ const AIUserPrompt = ({ blockId: o }) => {
8156
8191
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8157
8192
  Textarea,
8158
8193
  {
8159
- ref: g,
8194
+ ref: f,
8160
8195
  value: i,
8161
8196
  onChange: (E) => c(E.target.value),
8162
8197
  placeholder: n("Ask AI to edit content"),
8163
8198
  className: "w-full",
8164
8199
  rows: 3,
8165
8200
  onKeyDown: (E) => {
8166
- E.key === "Enter" && (E.preventDefault(), x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j));
8201
+ E.key === "Enter" && (E.preventDefault(), x.current && clearTimeout(x.current), g(void 0), r("content", o, i, j));
8167
8202
  }
8168
8203
  }
8169
8204
  ),
@@ -8173,7 +8208,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8173
8208
  {
8174
8209
  disabled: i.trim().length < 5 || a,
8175
8210
  onClick: () => {
8176
- x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j);
8211
+ x.current && clearTimeout(x.current), g(void 0), r("content", o, i, j);
8177
8212
  },
8178
8213
  variant: "default",
8179
8214
  className: "w-fit",
@@ -8206,7 +8241,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8206
8241
  QuickPrompts,
8207
8242
  {
8208
8243
  onClick: (E) => {
8209
- x.current && clearTimeout(x.current), m(void 0), r("content", o, E, j);
8244
+ x.current && clearTimeout(x.current), g(void 0), r("content", o, E, j);
8210
8245
  }
8211
8246
  }
8212
8247
  )
@@ -8216,13 +8251,13 @@ const AIUserPrompt = ({ blockId: o }) => {
8216
8251
  ] }) }) : null
8217
8252
  ] });
8218
8253
  }, AISetContext = () => {
8219
- const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, m] = useState(!1), { toast: g } = useToast(), x = useRef(null);
8254
+ const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, g] = useState(!1), { toast: f } = useToast(), x = useRef(null);
8220
8255
  useEffect(() => {
8221
8256
  n && a(n);
8222
8257
  }, [n]);
8223
8258
  const j = async () => {
8224
8259
  try {
8225
- d(!0), p(null), await i(r), g({
8260
+ d(!0), p(null), await i(r), f({
8226
8261
  title: o("Updated AI Context"),
8227
8262
  description: o("You can now Ask AI to edit your content"),
8228
8263
  variant: "default"
@@ -8237,7 +8272,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8237
8272
  Accordion,
8238
8273
  {
8239
8274
  onValueChange: (E) => {
8240
- m(E !== "");
8275
+ g(E !== "");
8241
8276
  },
8242
8277
  type: "single",
8243
8278
  collapsible: !0,
@@ -8316,7 +8351,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8316
8351
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
8317
8352
  ] });
8318
8353
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
8319
- const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [g, x] = useState(""), j = useRef(null), E = useRef(null);
8354
+ const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [f, x] = useState(""), j = useRef(null), E = useRef(null);
8320
8355
  useEffect(() => {
8321
8356
  l(n);
8322
8357
  }, [n]);
@@ -8330,28 +8365,28 @@ const AIUserPrompt = ({ blockId: o }) => {
8330
8365
  r(R), l(a), c(""), u(""), x("");
8331
8366
  }
8332
8367
  }, k = (R) => {
8333
- const _ = a.filter((N, L) => L !== R);
8334
- r(_), l(_);
8335
- }, v = (R) => {
8336
- m(R), c(a[R].key), u(a[R].value);
8337
- }, C = () => {
8368
+ const A = a.filter((T, L) => L !== R);
8369
+ r(A), l(A);
8370
+ }, S = (R) => {
8371
+ g(R), c(a[R].key), u(a[R].value);
8372
+ }, w = () => {
8338
8373
  if (i.startsWith("@")) {
8339
8374
  x("Attribute keys cannot start with '@'");
8340
8375
  return;
8341
8376
  }
8342
8377
  if (p !== null && i) {
8343
8378
  const R = [...a];
8344
- R[p] = { key: i, value: d }, r(R), l(R), m(null), c(""), u(""), x("");
8379
+ R[p] = { key: i, value: d }, r(R), l(R), g(null), c(""), u(""), x("");
8345
8380
  }
8346
- }, B = (R) => {
8347
- R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? C() : b());
8381
+ }, _ = (R) => {
8382
+ R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? w() : b());
8348
8383
  };
8349
8384
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
8350
8385
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8351
8386
  "form",
8352
8387
  {
8353
8388
  onSubmit: (R) => {
8354
- R.preventDefault(), p !== null ? C() : b();
8389
+ R.preventDefault(), p !== null ? w() : b();
8355
8390
  },
8356
8391
  className: "space-y-3",
8357
8392
  children: [
@@ -8386,7 +8421,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8386
8421
  ref: E,
8387
8422
  value: d,
8388
8423
  onChange: (R) => u(R.target.value),
8389
- onKeyDown: B,
8424
+ onKeyDown: _,
8390
8425
  placeholder: "Value",
8391
8426
  className: "bg-background text-sm"
8392
8427
  }
@@ -8394,26 +8429,26 @@ const AIUserPrompt = ({ blockId: o }) => {
8394
8429
  ] })
8395
8430
  ] }),
8396
8431
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: p !== null ? "Save" : "Add" }),
8397
- g && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: g })
8432
+ f && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: f })
8398
8433
  ]
8399
8434
  }
8400
8435
  ),
8401
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((R, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8436
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((R, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8402
8437
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
8403
8438
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: R.key }),
8404
8439
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: R.value.toString() })
8405
8440
  ] }),
8406
8441
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
8407
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(_), children: [
8442
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(A), children: [
8408
8443
  /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
8409
8444
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
8410
8445
  ] }),
8411
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(_), children: [
8446
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(A), children: [
8412
8447
  /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
8413
8448
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
8414
8449
  ] })
8415
8450
  ] })
8416
- ] }, _)) })
8451
+ ] }, A)) })
8417
8452
  ] });
8418
8453
  }), BlockAttributesEditor = React.memo(() => {
8419
8454
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -8831,15 +8866,15 @@ function RemoveProviderConfirmation({
8831
8866
  const PageDataProviders = () => {
8832
8867
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8833
8868
  filter(n, (b) => map(r, "providerKey").includes(b.providerKey))
8834
- ), [d, u] = useState(""), [p, m] = useState(null), g = filter(
8869
+ ), [d, u] = useState(""), [p, g] = useState(null), f = filter(
8835
8870
  n.map((b) => map(i, "providerKey").includes(b.providerKey) ? null : { value: b.providerKey, label: b.name }),
8836
8871
  (b) => !isNull(b)
8837
8872
  ), x = (b) => {
8838
8873
  const k = find(n, { providerKey: b });
8839
- c((v) => [...v, k]), a((v) => [...v, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8874
+ c((S) => [...S, k]), a((S) => [...S, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8840
8875
  }, j = (b) => {
8841
- c((k) => filter(k, (v) => v.providerKey !== b.providerKey)), a((k) => filter(k, (v) => v.providerKey !== b.providerKey)), l("UNSAVED");
8842
- }, E = (b) => m(b);
8876
+ c((k) => filter(k, (S) => S.providerKey !== b.providerKey)), a((k) => filter(k, (S) => S.providerKey !== b.providerKey)), l("UNSAVED");
8877
+ }, E = (b) => g(b);
8843
8878
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8844
8879
  o("You have no data providers registered. Please add a data provider to your project."),
8845
8880
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8851,7 +8886,7 @@ const PageDataProviders = () => {
8851
8886
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("Select a provider") }) }),
8852
8887
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
8853
8888
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("Choose") }),
8854
- g.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: b.value, children: b.label }, b.value))
8889
+ f.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: b.value, children: b.label }, b.value))
8855
8890
  ] })
8856
8891
  ] }) }),
8857
8892
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8928,14 +8963,14 @@ const PageDataProviders = () => {
8928
8963
  },
8929
8964
  b.providerKey
8930
8965
  )) }),
8931
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
8966
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => g(null), provider: p })
8932
8967
  ] })
8933
8968
  ] });
8934
8969
  };
8935
8970
  function AiFillDatabase(o) {
8936
8971
  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);
8937
8972
  }
8938
- const TopBar = lazy(() => import("./Topbar-Lvb5K8c2.js"));
8973
+ const TopBar = lazy(() => import("./Topbar-86JxE7Uw.js"));
8939
8974
  function useSidebarMenuItems(o) {
8940
8975
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8941
8976
  return useMemo(() => {
@@ -8969,8 +9004,8 @@ const RootLayout = () => {
8969
9004
  x.preventDefault();
8970
9005
  }, d = (x) => {
8971
9006
  n(o === x ? null : x);
8972
- }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], g = useBuilderProp("htmlDir", "ltr");
8973
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: g, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
9007
+ }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), g = [...u, ...i], f = useBuilderProp("htmlDir", "ltr");
9008
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: f, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
8974
9009
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8975
9010
  "div",
8976
9011
  {
@@ -8980,7 +9015,7 @@ const RootLayout = () => {
8980
9015
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TopBar, {}) }) }),
8981
9016
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
8982
9017
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
8983
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((x, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
9018
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: g.map((x, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8984
9019
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8985
9020
  Button,
8986
9021
  {
@@ -9010,10 +9045,10 @@ const RootLayout = () => {
9010
9045
  transition: { duration: 0.3, ease: "easeInOut" },
9011
9046
  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: [
9012
9047
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
9013
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
9014
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
9048
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(g, `${o}.icon`, null) }),
9049
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(g[o].label) })
9015
9050
  ] }),
9016
- /* @__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), {}) }) })
9051
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(g, `${o}.component`, null), {}) }) })
9017
9052
  ] }) })
9018
9053
  }
9019
9054
  ),