@chaibuilder/sdk 1.2.97 → 1.2.99

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.
@@ -1,13 +1,13 @@
1
- var W = Object.defineProperty;
2
- var G = (o, n, r) => n in o ? W(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
3
- var F = (o, n, r) => (G(o, typeof n != "symbol" ? n + "" : n, r), r);
1
+ var z = Object.defineProperty;
2
+ var W = (o, n, r) => n in o ? z(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
3
+ var U = (o, n, r) => (W(o, typeof n != "symbol" ? n + "" : n, r), r);
4
4
  import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
5
5
  import * as React from "react";
6
6
  import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
7
7
  import { S as Skeleton, B as Button, C as ContextMenu, a as ContextMenuTrigger, b as ContextMenuContent, c as ContextMenuItem, T as Tooltip, d as TooltipTrigger, e as TooltipContent, f as Card, g as CardHeader, h as CardDescription, i as CardContent, L as Label, j as Textarea, k as CardFooter, D as Dialog, l as DialogTrigger, m as DialogContent, n as DialogHeader, o as DialogTitle, p as DialogDescription, q as DialogFooter, P as Popover, r as PopoverTrigger, s as PopoverContent, t as Command, u as CommandInput, v as CommandList, w as CommandEmpty, x as CommandGroup, y as CommandItem, z as Tabs, A as TabsList, E as TabsTrigger, F as TabsContent, G as Switch, H as Accordion, I as AccordionItem, J as AccordionTrigger, K as AccordionContent, M as useToast, N as Input$1, O as TooltipPortal, Q as DropdownMenu, R as DropdownMenuTrigger, U as DropdownMenuContent, V as ScrollArea, W as DropdownMenuLabel, X as DropdownMenuSeparator, Y as DropdownMenuGroup, Z as DropdownMenuItem, _ as DropdownMenuShortcut, $ as AlertDialog, a0 as AlertDialogContent, a1 as AlertDialogHeader, a2 as AlertDialogTitle, a3 as AlertDialogTrigger, a4 as AlertDialogDescription, a5 as AlertDialogFooter, a6 as AlertDialogCancel, a7 as AlertDialogAction, a8 as DropdownMenuCheckboxItem, a9 as HoverCard, aa as HoverCardTrigger, ab as HoverCardContent, ac as Separator, ad as Badge, ae as Select, af as SelectTrigger, ag as SelectValue, ah as SelectContent, ai as SelectItem, aj as TooltipProvider, ak as Toaster } from "./context-menu-9cWJcKdh.js";
8
8
  import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, chunk, forEach, throttle, memoize, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, cloneDeep, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
9
9
  import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
10
- import { g as generateUUID, a as getBreakpointValue, f, y, h, c as cn, G as GenIcon } from "./iconBase-HBZkvN04.js";
10
+ import { g as generateUUID, a as getBreakpointValue, y, s, h, c as cn, G as GenIcon } from "./iconBase-RFUjwZUN.js";
11
11
  import { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
12
12
  import { useTranslation, initReactI18next } from "react-i18next";
13
13
  import { g as getDefaultExportFromCjs, p as plugin } from "./plugin-ooqqxWRQ.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 = (j) => o.get(j), d = (j, k) => {
93
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(k);
94
- const S = o.get(j);
95
- if (o.set(j, k), r.has(j) || r.set(j, S), S && hasPromiseAtomValue(S)) {
96
- const R = "v" in k ? k.v instanceof Promise ? k.v : Promise.resolve(k.v) : Promise.reject(k.e);
97
- cancelPromise(S.v, R);
92
+ const c = (b) => o.get(b), d = (b, _) => {
93
+ (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(_);
94
+ const R = o.get(b);
95
+ if (o.set(b, _), r.has(b) || r.set(b, R), R && hasPromiseAtomValue(R)) {
96
+ const v = "v" in _ ? _.v instanceof Promise ? _.v : Promise.resolve(_.v) : Promise.reject(_.e);
97
+ cancelPromise(R.v, v);
98
98
  }
99
- }, u = (j, k, S) => {
100
- const R = /* @__PURE__ */ new Map();
101
- let N = !1;
102
- S.forEach((D, $) => {
103
- !D && $ === j && (D = k), D ? (R.set($, D), k.d.get($) !== D && (N = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
- }), (N || k.d.size !== R.size) && (k.d = R);
105
- }, p = (j, k, S) => {
106
- const R = c(j), N = {
107
- d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
108
- v: k
99
+ }, u = (b, _, R) => {
100
+ const v = /* @__PURE__ */ new Map();
101
+ let I = !1;
102
+ R.forEach((L, P) => {
103
+ !L && P === b && (L = _), L ? (v.set(P, L), _.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
+ }), (I || _.d.size !== v.size) && (_.d = v);
105
+ }, p = (b, _, R) => {
106
+ const v = c(b), I = {
107
+ d: (v == null ? void 0 : v.d) || /* @__PURE__ */ new Map(),
108
+ v: _
109
109
  };
110
- if (S && u(j, N, S), R && isEqualAtomValue(R, N) && R.d === N.d)
111
- return R;
112
- if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(N) && isEqualPromiseAtomValue(R, N)) {
113
- if (R.d === N.d)
114
- return R;
115
- N.v = R.v;
110
+ if (R && u(b, I, R), v && isEqualAtomValue(v, I) && v.d === I.d)
111
+ return v;
112
+ if (v && hasPromiseAtomValue(v) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(v, I)) {
113
+ if (v.d === I.d)
114
+ return v;
115
+ I.v = v.v;
116
116
  }
117
- return d(j, N), N;
118
- }, m = (j, k, S, R) => {
119
- if (isPromiseLike$2(k)) {
120
- let N;
121
- const D = new Promise(($, H) => {
122
- let M = !1;
123
- k.then(
124
- (V) => {
125
- if (!M) {
126
- M = !0;
127
- const O = c(j), U = p(
128
- j,
129
- D,
130
- S
117
+ return d(b, I), I;
118
+ }, g = (b, _, R, v) => {
119
+ if (isPromiseLike$2(_)) {
120
+ let I;
121
+ const L = new Promise((P, V) => {
122
+ let $ = !1;
123
+ _.then(
124
+ (O) => {
125
+ if (!$) {
126
+ $ = !0;
127
+ const M = c(b), H = p(
128
+ b,
129
+ L,
130
+ R
131
131
  );
132
- resolvePromise(D, V), $(V), (O == null ? void 0 : O.d) !== U.d && T(j, U, O == null ? void 0 : O.d);
132
+ resolvePromise(L, O), P(O), (M == null ? void 0 : M.d) !== H.d && N(b, H, M == null ? void 0 : M.d);
133
133
  }
134
134
  },
135
- (V) => {
136
- if (!M) {
137
- M = !0;
138
- const O = c(j), U = p(
139
- j,
140
- D,
141
- S
135
+ (O) => {
136
+ if (!$) {
137
+ $ = !0;
138
+ const M = c(b), H = p(
139
+ b,
140
+ L,
141
+ R
142
142
  );
143
- rejectPromise(D, V), H(V), (O == null ? void 0 : O.d) !== U.d && T(j, U, O == null ? void 0 : O.d);
143
+ rejectPromise(L, O), V(O), (M == null ? void 0 : M.d) !== H.d && N(b, H, M == null ? void 0 : M.d);
144
144
  }
145
145
  }
146
- ), N = (V) => {
147
- M || (M = !0, V.then(
148
- (O) => resolvePromise(D, O),
149
- (O) => rejectPromise(D, O)
150
- ), $(V));
146
+ ), I = (O) => {
147
+ $ || ($ = !0, O.then(
148
+ (M) => resolvePromise(L, M),
149
+ (M) => rejectPromise(L, M)
150
+ ), P(O));
151
151
  };
152
152
  });
153
- return D.orig = k, D.status = "pending", registerCancelPromise(D, ($) => {
154
- $ && N($), R == null || R();
155
- }), p(j, D, S);
153
+ return L.orig = _, L.status = "pending", registerCancelPromise(L, (P) => {
154
+ P && I(P), v == null || v();
155
+ }), p(b, L, R);
156
156
  }
157
- return p(j, k, S);
158
- }, x = (j, k, S) => {
159
- const R = c(j), N = {
160
- d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
161
- e: k
157
+ return p(b, _, R);
158
+ }, x = (b, _, R) => {
159
+ const v = c(b), I = {
160
+ d: (v == null ? void 0 : v.d) || /* @__PURE__ */ new Map(),
161
+ e: _
162
162
  };
163
- return S && u(j, N, S), R && isEqualAtomError(R, N) && R.d === N.d ? R : (d(j, N), N);
164
- }, g = (j) => {
165
- const k = c(j);
166
- if (k && (k.d.forEach((M, V) => {
167
- V !== j && !n.has(V) && g(V);
168
- }), Array.from(k.d).every(([M, V]) => {
169
- const O = c(M);
170
- return M === j || O === V || // TODO This is a hack, we should find a better solution.
171
- O && !hasPromiseAtomValue(O) && isEqualAtomValue(O, V);
163
+ return R && u(b, I, R), v && isEqualAtomError(v, I) && v.d === I.d ? v : (d(b, I), I);
164
+ }, m = (b) => {
165
+ const _ = c(b);
166
+ if (_ && (_.d.forEach(($, O) => {
167
+ O !== b && !n.has(O) && m(O);
168
+ }), Array.from(_.d).every(([$, O]) => {
169
+ const M = c($);
170
+ return $ === b || M === O || // TODO This is a hack, we should find a better solution.
171
+ M && !hasPromiseAtomValue(M) && isEqualAtomValue(M, O);
172
172
  })))
173
- return k;
174
- const S = /* @__PURE__ */ new Map();
175
- let R = !0;
176
- const N = (M) => {
177
- if (M === j) {
178
- const O = c(M);
179
- if (O)
180
- return S.set(M, O), returnAtomValue(O);
181
- if (hasInitialValue(M))
182
- return S.set(M, void 0), M.init;
173
+ return _;
174
+ const R = /* @__PURE__ */ new Map();
175
+ let v = !0;
176
+ const I = ($) => {
177
+ if ($ === b) {
178
+ const M = c($);
179
+ if (M)
180
+ return R.set($, M), returnAtomValue(M);
181
+ if (hasInitialValue($))
182
+ return R.set($, void 0), $.init;
183
183
  throw new Error("no atom init");
184
184
  }
185
- const V = g(M);
186
- return S.set(M, V), returnAtomValue(V);
185
+ const O = m($);
186
+ return R.set($, O), returnAtomValue(O);
187
187
  };
188
- let D, $;
189
- const H = {
188
+ let L, P;
189
+ const V = {
190
190
  get signal() {
191
- return D || (D = new AbortController()), D.signal;
191
+ return L || (L = new AbortController()), L.signal;
192
192
  },
193
193
  get setSelf() {
194
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(j) && console.warn("setSelf function cannot be used with read-only atom"), !$ && isActuallyWritableAtom(j) && ($ = (...M) => {
195
- if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && R && console.warn("setSelf function cannot be called in sync"), !R)
196
- return I(j, ...M);
197
- }), $;
194
+ return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(b) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(b) && (P = (...$) => {
195
+ if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && v && console.warn("setSelf function cannot be called in sync"), !v)
196
+ return B(b, ...$);
197
+ }), P;
198
198
  }
199
199
  };
200
200
  try {
201
- const M = j.read(N, H);
202
- return m(
203
- j,
204
- M,
205
- S,
206
- () => D == null ? void 0 : D.abort()
201
+ const $ = b.read(I, V);
202
+ return g(
203
+ b,
204
+ $,
205
+ R,
206
+ () => L == null ? void 0 : L.abort()
207
207
  );
208
- } catch (M) {
209
- return x(j, M, S);
208
+ } catch ($) {
209
+ return x(b, $, R);
210
210
  } finally {
211
- R = !1;
211
+ v = !1;
212
212
  }
213
- }, _ = (j) => returnAtomValue(g(j)), b = (j) => {
214
- let k = n.get(j);
215
- return k || (k = w(j)), k;
216
- }, E = (j, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(j)), v = (j) => {
217
- const k = n.get(j);
218
- k && E(j, k) && A(j);
219
- }, B = (j) => {
220
- const k = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new WeakMap(), R = (D) => {
221
- const $ = n.get(D);
222
- $ == null || $.t.forEach((H) => {
223
- H !== D && (k.set(
224
- H,
225
- (k.get(H) || /* @__PURE__ */ new Set()).add(D)
226
- ), S.set(H, (S.get(H) || 0) + 1), R(H));
213
+ }, E = (b) => returnAtomValue(m(b)), f = (b) => {
214
+ let _ = n.get(b);
215
+ return _ || (_ = C(b)), _;
216
+ }, j = (b, _) => !_.l.size && (!_.t.size || _.t.size === 1 && _.t.has(b)), k = (b) => {
217
+ const _ = n.get(b);
218
+ _ && j(b, _) && w(b);
219
+ }, A = (b) => {
220
+ const _ = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), v = (L) => {
221
+ const P = n.get(L);
222
+ P == null || P.t.forEach((V) => {
223
+ V !== L && (_.set(
224
+ V,
225
+ (_.get(V) || /* @__PURE__ */ new Set()).add(L)
226
+ ), R.set(V, (R.get(V) || 0) + 1), v(V));
227
227
  });
228
228
  };
229
- R(j);
230
- const N = (D) => {
231
- const $ = n.get(D);
232
- $ == null || $.t.forEach((H) => {
233
- var M;
234
- if (H !== D) {
235
- let V = S.get(H);
236
- if (V && S.set(H, --V), !V) {
237
- let O = !!((M = k.get(H)) != null && M.size);
238
- if (O) {
239
- const U = c(H), z = g(H);
240
- O = !U || !isEqualAtomValue(U, z);
229
+ v(b);
230
+ const I = (L) => {
231
+ const P = n.get(L);
232
+ P == null || P.t.forEach((V) => {
233
+ var $;
234
+ if (V !== L) {
235
+ let O = R.get(V);
236
+ if (O && R.set(V, --O), !O) {
237
+ let M = !!(($ = _.get(V)) != null && $.size);
238
+ if (M) {
239
+ const H = c(V), F = m(V);
240
+ M = !H || !isEqualAtomValue(H, F);
241
241
  }
242
- O || k.forEach((U) => U.delete(H));
242
+ M || _.forEach((H) => H.delete(V));
243
243
  }
244
- N(H);
244
+ I(V);
245
245
  }
246
246
  });
247
247
  };
248
- N(j);
249
- }, C = (j, ...k) => {
250
- let S = !0;
251
- const R = ($) => returnAtomValue(g($)), N = ($, ...H) => {
252
- let M;
253
- if ($ === j) {
254
- if (!hasInitialValue($))
248
+ I(b);
249
+ }, S = (b, ..._) => {
250
+ let R = !0;
251
+ const v = (P) => returnAtomValue(m(P)), I = (P, ...V) => {
252
+ let $;
253
+ if (P === b) {
254
+ if (!hasInitialValue(P))
255
255
  throw new Error("atom not writable");
256
- const V = c($), O = m($, H[0]);
257
- (!V || !isEqualAtomValue(V, O)) && B($);
256
+ const O = c(P), M = g(P, V[0]);
257
+ (!O || !isEqualAtomValue(O, M)) && A(P);
258
258
  } else
259
- M = C($, ...H);
260
- if (!S) {
261
- const V = P();
259
+ $ = S(P, ...V);
260
+ if (!R) {
261
+ const O = D();
262
262
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
263
- (O) => O({ type: "async-write", flushed: V })
263
+ (M) => M({ type: "async-write", flushed: O })
264
264
  );
265
265
  }
266
- return M;
267
- }, D = j.write(R, N, ...k);
268
- return S = !1, D;
269
- }, I = (j, ...k) => {
270
- const S = C(j, ...k), R = P();
266
+ return $;
267
+ }, L = b.write(v, I, ..._);
268
+ return R = !1, L;
269
+ }, B = (b, ..._) => {
270
+ const R = S(b, ..._), v = D();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
- (N) => N({ type: "write", flushed: R })
273
- ), S;
274
- }, w = (j, k) => {
275
- const S = {
276
- t: new Set(k && [k]),
272
+ (I) => I({ type: "write", flushed: v })
273
+ ), R;
274
+ }, C = (b, _) => {
275
+ const R = {
276
+ t: new Set(_ && [_]),
277
277
  l: /* @__PURE__ */ new Set()
278
278
  };
279
- if (n.set(j, S), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(j), g(j).d.forEach((R, N) => {
280
- const D = n.get(N);
281
- D ? D.t.add(j) : N !== j && w(N, j);
282
- }), g(j), isActuallyWritableAtom(j) && j.onMount) {
283
- const R = j.onMount((...N) => I(j, ...N));
284
- R && (S.u = R);
279
+ if (n.set(b, R), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b), m(b).d.forEach((v, I) => {
280
+ const L = n.get(I);
281
+ L ? L.t.add(b) : I !== b && C(I, b);
282
+ }), m(b), isActuallyWritableAtom(b) && b.onMount) {
283
+ const v = b.onMount((...I) => B(b, ...I));
284
+ v && (R.u = v);
285
285
  }
286
- return S;
287
- }, A = (j) => {
288
- var k;
289
- const S = (k = n.get(j)) == null ? void 0 : k.u;
290
- S && S(), n.delete(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(j);
291
- const R = c(j);
292
- R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((N, D) => {
293
- if (D !== j) {
294
- const $ = n.get(D);
295
- $ && ($.t.delete(j), E(D, $) && A(D));
286
+ return R;
287
+ }, w = (b) => {
288
+ var _;
289
+ const R = (_ = n.get(b)) == null ? void 0 : _.u;
290
+ R && R(), n.delete(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(b);
291
+ const v = c(b);
292
+ v ? (hasPromiseAtomValue(v) && cancelPromise(v.v), v.d.forEach((I, L) => {
293
+ if (L !== b) {
294
+ const P = n.get(L);
295
+ P && (P.t.delete(b), j(L, P) && w(L));
296
296
  }
297
- })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", j);
298
- }, T = (j, k, S) => {
299
- const R = new Set(k.d.keys());
300
- S == null || S.forEach((N, D) => {
301
- if (R.has(D)) {
302
- R.delete(D);
297
+ })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", b);
298
+ }, N = (b, _, R) => {
299
+ const v = new Set(_.d.keys());
300
+ R == null || R.forEach((I, L) => {
301
+ if (v.has(L)) {
302
+ v.delete(L);
303
303
  return;
304
304
  }
305
- const $ = n.get(D);
306
- $ && ($.t.delete(j), E(D, $) && A(D));
307
- }), R.forEach((N) => {
308
- const D = n.get(N);
309
- D ? D.t.add(j) : n.has(j) && w(N, j);
305
+ const P = n.get(L);
306
+ P && (P.t.delete(b), j(L, P) && w(L));
307
+ }), v.forEach((I) => {
308
+ const L = n.get(I);
309
+ L ? L.t.add(b) : n.has(b) && C(I, b);
310
310
  });
311
- }, P = () => {
312
- let j;
313
- for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (j = /* @__PURE__ */ new Set()); r.size; ) {
314
- const k = Array.from(r);
315
- r.clear(), k.forEach(([S, R]) => {
316
- const N = c(S);
317
- if (N) {
318
- N.d !== (R == null ? void 0 : R.d) && T(S, N, R == null ? void 0 : R.d);
319
- const D = n.get(S);
320
- D && !// TODO This seems pretty hacky. Hope to fix it.
311
+ }, D = () => {
312
+ let b;
313
+ for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (b = /* @__PURE__ */ new Set()); r.size; ) {
314
+ const _ = Array.from(r);
315
+ r.clear(), _.forEach(([R, v]) => {
316
+ const I = c(R);
317
+ if (I) {
318
+ I.d !== (v == null ? void 0 : v.d) && N(R, I, v == null ? void 0 : v.d);
319
+ const L = n.get(R);
320
+ L && !// TODO This seems pretty hacky. Hope to fix it.
321
321
  // Maybe we could `mountDependencies` in `setAtomState`?
322
- (R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, N) || isEqualAtomError(R, N))) && (D.l.forEach(($) => $()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && j.add(S));
322
+ (v && !hasPromiseAtomValue(v) && (isEqualAtomValue(v, I) || isEqualAtomError(v, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && b.add(R));
323
323
  } else
324
324
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
325
325
  });
326
326
  }
327
327
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
328
- return a.forEach((k) => k("state")), j;
329
- }, L = (j, k) => {
330
- const S = b(j), R = P(), N = S.l;
331
- return N.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((D) => D("sub")), l.forEach(
332
- (D) => D({ type: "sub", flushed: R })
328
+ return a.forEach((_) => _("state")), b;
329
+ }, T = (b, _) => {
330
+ const R = f(b), v = D(), I = R.l;
331
+ return I.add(_), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
332
+ (L) => L({ type: "sub", flushed: v })
333
333
  )), () => {
334
- N.delete(k), v(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((D) => D("unsub")), l.forEach((D) => D({ type: "unsub" })));
334
+ I.delete(_), k(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
335
335
  };
336
336
  };
337
337
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
338
- get: _,
339
- set: I,
340
- sub: L,
338
+ get: E,
339
+ set: B,
340
+ sub: T,
341
341
  // store dev methods (these are tentative and subject to change without notice)
342
- dev_subscribe_store: (j, k) => k !== 2 ? (console.warn(
342
+ dev_subscribe_store: (b, _) => _ !== 2 ? (console.warn(
343
343
  "The current StoreListener revision is 2. The older ones are deprecated."
344
- ), a.add(j), () => {
345
- a.delete(j);
346
- }) : (l.add(j), () => {
347
- l.delete(j);
344
+ ), a.add(b), () => {
345
+ a.delete(b);
346
+ }) : (l.add(b), () => {
347
+ l.delete(b);
348
348
  }),
349
349
  dev_get_mounted_atoms: () => i.values(),
350
- dev_get_atom_state: (j) => o.get(j),
351
- dev_get_mounted: (j) => n.get(j),
352
- dev_restore_atoms: (j) => {
353
- for (const [S, R] of j)
354
- hasInitialValue(S) && (m(S, R), B(S));
355
- const k = P();
350
+ dev_get_atom_state: (b) => o.get(b),
351
+ dev_get_mounted: (b) => n.get(b),
352
+ dev_restore_atoms: (b) => {
353
+ for (const [R, v] of b)
354
+ hasInitialValue(R) && (g(R, v), A(R));
355
+ const _ = D();
356
356
  l.forEach(
357
- (S) => S({ type: "restore", flushed: k })
357
+ (R) => R({ type: "restore", flushed: _ })
358
358
  );
359
359
  }
360
360
  } : {
361
- get: _,
362
- set: I,
363
- sub: L
361
+ get: E,
362
+ set: B,
363
+ sub: T
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 = [], x = [];
381
- return c.forEach((g, _) => {
382
- const b = n ? n(g) : _;
383
- x[_] = b;
384
- const E = p && p.atomList[p.keyList.indexOf(b)];
385
- if (E) {
386
- m[_] = E;
380
+ const p = d && r.get(d), g = [], x = [];
381
+ return c.forEach((m, E) => {
382
+ const f = n ? n(m) : E;
383
+ x[E] = f;
384
+ const j = p && p.atomList[p.keyList.indexOf(f)];
385
+ if (j) {
386
+ g[E] = j;
387
387
  return;
388
388
  }
389
- const v = (C) => {
390
- const I = C(l), w = C(o), T = a(w, I == null ? void 0 : I.arr).keyList.indexOf(b);
391
- if (T < 0 || T >= w.length) {
392
- const P = c[a(c).keyList.indexOf(b)];
393
- if (P)
394
- return P;
389
+ const k = (S) => {
390
+ const B = S(l), C = S(o), N = a(C, B == null ? void 0 : B.arr).keyList.indexOf(f);
391
+ if (N < 0 || N >= C.length) {
392
+ const D = c[a(c).keyList.indexOf(f)];
393
+ if (D)
394
+ return D;
395
395
  throw new Error("splitAtom: index out of bounds for read");
396
396
  }
397
- return w[T];
398
- }, B = (C, I, w) => {
399
- const A = C(l), T = C(o), L = a(T, A == null ? void 0 : A.arr).keyList.indexOf(b);
400
- if (L < 0 || L >= T.length)
397
+ return C[N];
398
+ }, A = (S, B, C) => {
399
+ const w = S(l), N = S(o), T = a(N, w == null ? void 0 : w.arr).keyList.indexOf(f);
400
+ if (T < 0 || T >= N.length)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const j = isFunction(w) ? w(T[L]) : w;
403
- I(o, [
404
- ...T.slice(0, L),
405
- j,
406
- ...T.slice(L + 1)
402
+ const b = isFunction(C) ? C(N[T]) : C;
403
+ B(o, [
404
+ ...N.slice(0, T),
405
+ b,
406
+ ...N.slice(T + 1)
407
407
  ]);
408
408
  };
409
- m[_] = isWritable(o) ? atom(v, B) : atom(v);
410
- }), p && p.keyList.length === x.length && p.keyList.every((g, _) => g === x[_]) ? u = p : u = { arr: c, atomList: m, keyList: x }, r.set(c, u), u;
409
+ g[E] = isWritable(o) ? atom(k, A) : atom(k);
410
+ }), p && p.keyList.length === x.length && p.keyList.every((m, E) => m === x[E]) ? u = p : u = { arr: c, atomList: g, keyList: x }, 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,28 +431,28 @@ 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) {
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
446
  const x = c(o);
447
- p < m ? d(o, [
447
+ p < g ? d(o, [
448
448
  ...x.slice(0, p),
449
- ...x.slice(p + 1, m),
449
+ ...x.slice(p + 1, g),
450
450
  x[p],
451
- ...x.slice(m)
451
+ ...x.slice(g)
452
452
  ]) : d(o, [
453
- ...x.slice(0, m),
453
+ ...x.slice(0, g),
454
454
  x[p],
455
- ...x.slice(m, p),
455
+ ...x.slice(g, p),
456
456
  ...x.slice(p + 1)
457
457
  ]);
458
458
  }
@@ -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((x) => (u(i, x), r.setItem(o, x))) : (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((x) => (u(i, x), r.setItem(o, x))) : (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([]);
@@ -759,8 +759,8 @@ const useSelectedBlocksDisplayChild = () => ({
759
759
  const p = r[u];
760
760
  if (includes(["slot", "styles"], p.type))
761
761
  return;
762
- const m = u;
763
- l.properties[m] = getBlockJSONFromSchemas(p, n);
762
+ const g = u;
763
+ l.properties[g] = getBlockJSONFromSchemas(p, n);
764
764
  }), l;
765
765
  case "list":
766
766
  const { itemProperties: i, title: c } = o, d = {
@@ -775,8 +775,8 @@ const useSelectedBlocksDisplayChild = () => ({
775
775
  const p = i[u];
776
776
  if (includes(["slot", "styles"], p.type))
777
777
  return;
778
- const m = u;
779
- d.items.properties[m] = getBlockJSONFromSchemas(p, n), set(d.items, "title", get(p, "itemTitle", `${n(c)} item`));
778
+ const g = u;
779
+ d.items.properties[g] = getBlockJSONFromSchemas(p, n), set(d.items, "title", get(p, "itemTitle", `${n(c)} item`));
780
780
  }), d;
781
781
  default:
782
782
  return {};
@@ -829,8 +829,8 @@ var undomanager = { exports: {} };
829
829
  }
830
830
  let r = function() {
831
831
  let a = [], l = -1, i = 0, c = !1, d;
832
- function u(p, m) {
833
- return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
832
+ function u(p, g) {
833
+ return !p || typeof p[g] != "function" ? this : (c = !0, p[g](), c = !1, this);
834
834
  }
835
835
  return {
836
836
  /**
@@ -857,8 +857,8 @@ var undomanager = { exports: {} };
857
857
  let p = a[l];
858
858
  if (!p)
859
859
  return this;
860
- const m = p.groupId;
861
- for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
860
+ const g = p.groupId;
861
+ for (; p.groupId === g && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
862
862
  ;
863
863
  return d && d(), this;
864
864
  },
@@ -869,8 +869,8 @@ var undomanager = { exports: {} };
869
869
  let p = a[l + 1];
870
870
  if (!p)
871
871
  return this;
872
- const m = p.groupId;
873
- for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
872
+ const g = p.groupId;
873
+ for (; p.groupId === g && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
874
874
  ;
875
875
  return d && d(), this;
876
876
  },
@@ -901,7 +901,7 @@ var undomanager = { exports: {} };
901
901
  * @returns {array}
902
902
  */
903
903
  getCommands: function(p) {
904
- return p ? a.filter((m) => m.groupId === p) : a;
904
+ return p ? a.filter((g) => g.groupId === p) : a;
905
905
  },
906
906
  /**
907
907
  * Returns the index of the actions list.
@@ -1191,102 +1191,102 @@ const useBlocksStoreManager = () => {
1191
1191
  updateBlocksProps: c
1192
1192
  } = useBlocksStoreManager();
1193
1193
  return {
1194
- moveBlocks: (b, E, v) => {
1195
- const B = map(b, (I) => {
1196
- const A = n.find((L) => L._id === I)._parent || null, P = n.filter((L) => A ? L._parent === A : !L._parent).map((L) => L._id).indexOf(I);
1197
- return { _id: I, oldParent: A, oldPosition: P };
1198
- }), C = B.find(({ _id: I }) => I === b[0]);
1199
- C && C.oldParent === E && C.oldPosition === v || (i(b, E, v), o({
1200
- undo: () => each(B, ({ _id: I, oldParent: w, oldPosition: A }) => {
1201
- i([I], w, A);
1194
+ moveBlocks: (f, j, k) => {
1195
+ const A = map(f, (B) => {
1196
+ const w = n.find((T) => T._id === B)._parent || null, D = n.filter((T) => w ? T._parent === w : !T._parent).map((T) => T._id).indexOf(B);
1197
+ return { _id: B, oldParent: w, oldPosition: D };
1198
+ }), S = A.find(({ _id: B }) => B === f[0]);
1199
+ S && S.oldParent === j && S.oldPosition === k || (i(f, j, k), o({
1200
+ undo: () => each(A, ({ _id: B, oldParent: C, oldPosition: w }) => {
1201
+ i([B], C, w);
1202
1202
  }),
1203
- redo: () => i(b, E, v)
1203
+ redo: () => i(f, j, k)
1204
1204
  }));
1205
1205
  },
1206
- addBlocks: (b, E, v) => {
1207
- a(b, E, v), o({
1208
- undo: () => l(map(b, "_id")),
1209
- redo: () => a(b, E, v)
1206
+ addBlocks: (f, j, k) => {
1207
+ a(f, j, k), o({
1208
+ undo: () => l(map(f, "_id")),
1209
+ redo: () => a(f, j, k)
1210
1210
  });
1211
1211
  },
1212
- removeBlocks: (b) => {
1213
- var C;
1214
- const E = (C = first(b)) == null ? void 0 : C._parent, B = n.filter((I) => E ? I._parent === E : !I._parent).indexOf(first(b));
1215
- l(map(b, "_id")), o({
1216
- undo: () => a(b, E, B),
1217
- redo: () => l(map(b, "_id"))
1212
+ removeBlocks: (f) => {
1213
+ var S;
1214
+ const j = (S = first(f)) == null ? void 0 : S._parent, A = n.filter((B) => j ? B._parent === j : !B._parent).indexOf(first(f));
1215
+ l(map(f, "_id")), o({
1216
+ undo: () => a(f, j, A),
1217
+ redo: () => l(map(f, "_id"))
1218
1218
  });
1219
1219
  },
1220
- updateBlocks: (b, E, v) => {
1221
- let B = [];
1222
- if (v)
1223
- B = map(b, (C) => ({ _id: C, ...v }));
1220
+ updateBlocks: (f, j, k) => {
1221
+ let A = [];
1222
+ if (k)
1223
+ A = map(f, (S) => ({ _id: S, ...k }));
1224
1224
  else {
1225
- const C = keys(E);
1226
- B = map(b, (I) => {
1227
- const w = n.find((T) => T._id === I), A = { _id: I };
1228
- return each(C, (T) => A[T] = w[T]), A;
1225
+ const S = keys(j);
1226
+ A = map(f, (B) => {
1227
+ const C = n.find((N) => N._id === B), w = { _id: B };
1228
+ return each(S, (N) => w[N] = C[N]), w;
1229
1229
  });
1230
1230
  }
1231
- c(map(b, (C) => ({ _id: C, ...E }))), o({
1232
- undo: () => c(B),
1233
- redo: () => c(map(b, (C) => ({ _id: C, ...E })))
1231
+ c(map(f, (S) => ({ _id: S, ...j }))), o({
1232
+ undo: () => c(A),
1233
+ redo: () => c(map(f, (S) => ({ _id: S, ...j })))
1234
1234
  });
1235
1235
  },
1236
- updateBlocksRuntime: (b, E) => {
1237
- c(map(b, (v) => ({ _id: v, ...E })));
1236
+ updateBlocksRuntime: (f, j) => {
1237
+ c(map(f, (k) => ({ _id: k, ...j })));
1238
1238
  },
1239
- setNewBlocks: (b) => {
1240
- r(b), o({
1239
+ setNewBlocks: (f) => {
1240
+ r(f), o({
1241
1241
  undo: () => r(n),
1242
- redo: () => r(b)
1242
+ redo: () => r(f)
1243
1243
  });
1244
1244
  },
1245
- updateMultipleBlocksProps: (b) => {
1246
- let E = [];
1247
- E = map(b, (v) => {
1248
- const B = keys(v), C = n.find((w) => w._id === v._id), I = {};
1249
- return each(B, (w) => I[w] = C[w]), I;
1250
- }), c(b), o({
1251
- undo: () => c(E),
1252
- redo: () => c(b)
1245
+ updateMultipleBlocksProps: (f) => {
1246
+ let j = [];
1247
+ j = map(f, (k) => {
1248
+ const A = keys(k), S = n.find((C) => C._id === k._id), B = {};
1249
+ return each(A, (C) => B[C] = S[C]), B;
1250
+ }), c(f), o({
1251
+ undo: () => c(j),
1252
+ redo: () => c(f)
1253
1253
  });
1254
1254
  }
1255
1255
  };
1256
1256
  }, useAddBlock = () => {
1257
1257
  const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
1258
1258
  (i, c, d) => {
1259
- var g;
1260
- for (let _ = 0; _ < i.length; _++) {
1261
- const { _id: b } = i[_];
1262
- i[_]._id = generateUUID();
1263
- const E = filter(i, { _parent: b });
1264
- for (let v = 0; v < E.length; v++)
1265
- E[v]._parent = i[_]._id;
1259
+ var m;
1260
+ for (let E = 0; E < i.length; E++) {
1261
+ const { _id: f } = i[E];
1262
+ i[E]._id = generateUUID();
1263
+ const j = filter(i, { _parent: f });
1264
+ for (let k = 0; k < j.length; k++)
1265
+ j[k]._parent = i[E]._id;
1266
1266
  }
1267
1267
  const u = first(i);
1268
- let p, m;
1269
- return c && (p = find(o, { _id: c }), i[0]._parent = c, m = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, m = p._parent), r(i, m, d), n([(g = first(i)) == null ? void 0 : g._id]), first(i);
1268
+ let p, g;
1269
+ 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([(m = first(i)) == null ? void 0 : m._id]), first(i);
1270
1270
  },
1271
1271
  [o, n]
1272
1272
  );
1273
1273
  return { addCoreBlock: useCallback(
1274
1274
  (i, c, d) => {
1275
1275
  if (has(i, "blocks")) {
1276
- const v = i.blocks;
1277
- return a(v, c, d);
1276
+ const k = i.blocks;
1277
+ return a(k, c, d);
1278
1278
  }
1279
- const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
1280
- forIn(p, (v, B) => {
1281
- if (startsWith(v, SLOT_KEY)) {
1282
- const C = v.replace(SLOT_KEY, "");
1283
- m.push({
1284
- _id: C,
1279
+ const u = generateUUID(), p = getBlockDefaultProps(i.props), g = [];
1280
+ forIn(p, (k, A) => {
1281
+ if (startsWith(k, SLOT_KEY)) {
1282
+ const S = k.replace(SLOT_KEY, "");
1283
+ g.push({
1284
+ _id: S,
1285
1285
  _type: "Slot",
1286
1286
  _parent: u,
1287
- _name: i.props[B].name,
1288
- _styles: i.props[B].styles,
1289
- _emptyStyles: i.props[B].emptyStyles
1287
+ _name: i.props[A].name,
1288
+ _styles: i.props[A].styles,
1289
+ _emptyStyles: i.props[A].emptyStyles
1290
1290
  });
1291
1291
  }
1292
1292
  });
@@ -1295,10 +1295,10 @@ const useBlocksStoreManager = () => {
1295
1295
  _id: u,
1296
1296
  ...p
1297
1297
  };
1298
- let g, _;
1299
- c && (g = find(o, { _id: c }), x._parent = c, _ = c), !canAcceptChildBlock(g == null ? void 0 : g._type, x._type) && g && (x._parent = g._parent, _ = g._parent);
1300
- const E = [x, ...m];
1301
- return r(E, _, d), n([x._id]), x;
1298
+ let m, E;
1299
+ c && (m = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(m == null ? void 0 : m._type, x._type) && m && (x._parent = m._parent, E = m._parent);
1300
+ const j = [x, ...g];
1301
+ return r(j, E, d), n([x._id]), x;
1302
1302
  },
1303
1303
  [a, o, n]
1304
1304
  ), addPredefinedBlock: a };
@@ -2406,18 +2406,18 @@ function getNewClasses(o = "", n = "", r = []) {
2406
2406
  );
2407
2407
  const i = [], c = [];
2408
2408
  each(r, (p) => {
2409
- const m = constructClassObject(p), x = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2409
+ const g = constructClassObject(p), x = find(a, pick(g, ["dark", "mq", "mod", "property"]));
2410
2410
  if (x && (a = filter(
2411
2411
  a,
2412
- (g) => g.fullCls !== (x == null ? void 0 : x.fullCls)
2413
- )), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (g) => g.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
2414
- const g = find(l, pick(m, ["property"]));
2412
+ (m) => m.fullCls !== (x == null ? void 0 : x.fullCls)
2413
+ )), i.push(g), g.mq === "xs" && !g.dark && g.mod === "" && (l = filter(l, (m) => m.property !== g.property)), getBelongsToForClass(a, g) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, g.property)) {
2414
+ const m = find(l, pick(g, ["property"]));
2415
2415
  x && (l = filter(
2416
2416
  l,
2417
- (_) => _.fullCls !== (g == null ? void 0 : g.fullCls)
2417
+ (E) => E.fullCls !== (m == null ? void 0 : m.fullCls)
2418
2418
  )), c.push({
2419
- ...m,
2420
- fullCls: m.cls,
2419
+ ...g,
2420
+ fullCls: g.cls,
2421
2421
  mq: "xs"
2422
2422
  });
2423
2423
  }
@@ -2445,10 +2445,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2445
2445
  )
2446
2446
  ), i = first(o(selectedStylingBlocksAtom));
2447
2447
  return map(l, (c) => {
2448
- const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
2448
+ const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: g } = getSplitClasses$1(u);
2449
2449
  return {
2450
2450
  ids: [d._id],
2451
- props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
2451
+ props: { [i.prop]: `${STYLES_KEY}${getNewClasses(g, p, a)}` }
2452
2452
  };
2453
2453
  });
2454
2454
  }), useAddClassesToBlocks = () => {
@@ -2497,13 +2497,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2497
2497
  (a, l = null) => {
2498
2498
  const i = [];
2499
2499
  each(a, (c) => {
2500
- const d = o.find((g) => g._id === c);
2500
+ const d = o.find((m) => m._id === c);
2501
2501
  l || (l = d._parent);
2502
- const m = filter(
2502
+ const g = filter(
2503
2503
  o,
2504
- (g) => isString$1(l) ? g._parent === l : !d._parent
2504
+ (m) => isString$1(l) ? m._parent === l : !d._parent
2505
2505
  ).indexOf(d) + 1, x = getDuplicatedBlocks(o, c, l);
2506
- r(x, l, m), i.push(get(x, "0._id", ""));
2506
+ r(x, l, g), i.push(get(x, "0._id", ""));
2507
2507
  }), n(i);
2508
2508
  },
2509
2509
  [o, n]
@@ -2566,19 +2566,19 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2566
2566
  );
2567
2567
  return map(i, (c) => {
2568
2568
  const d = o(c), u = a;
2569
- let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2569
+ let { classes: p, baseClasses: g } = getSplitClasses(get(d, l.prop, "styles:,"));
2570
2570
  return each(u, (x) => {
2571
- const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), _ = new RegExp(`(^| )${g}($| )`, "g");
2572
- p = p.replace(_, " ").replace(/ +/g, " ").trim();
2573
- const b = first(x.split(":"));
2574
- includes(["2xl", "xl", "lg", "md", "sm"], b) && u.push(x.split(":").pop().trim());
2571
+ const m = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${m}($| )`, "g");
2572
+ p = p.replace(E, " ").replace(/ +/g, " ").trim();
2573
+ const f = first(x.split(":"));
2574
+ includes(["2xl", "xl", "lg", "md", "sm"], f) && u.push(x.split(":").pop().trim());
2575
2575
  }), each(u, (x) => {
2576
- const g = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2577
- m = m.replace(g, " ").replace(/ +/g, " ").trim();
2576
+ const m = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2577
+ g = g.replace(m, " ").replace(/ +/g, " ").trim();
2578
2578
  }), {
2579
2579
  ids: [d._id],
2580
2580
  props: {
2581
- [l.prop]: `${STYLES_KEY}${m},${p}`
2581
+ [l.prop]: `${STYLES_KEY}${g},${p}`
2582
2582
  }
2583
2583
  };
2584
2584
  });
@@ -2655,7 +2655,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2655
2655
  let u = "";
2656
2656
  o([n], { [i]: "" });
2657
2657
  for (let p = 0; p < d.length; p++)
2658
- u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
2658
+ u += d[p].join(""), o([n], { [i]: u }), await new Promise((g) => setTimeout(g, a));
2659
2659
  }
2660
2660
  }
2661
2661
  },
@@ -2836,31 +2836,31 @@ const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}),
2836
2836
  <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
2837
2837
  </body>
2838
2838
  </html>`, useCanvasScale = (o) => {
2839
- const [n] = useCanvasWidth(), [, r] = useCanvasZoom(), [a, l] = useState({}), i = useCallback(() => {
2840
- const { width: c, height: d } = o;
2841
- if (c < n) {
2842
- const u = parseFloat((c / n).toFixed(2).toString());
2843
- let p = {};
2844
- const m = d * u, x = c * u;
2845
- d && (p = {
2839
+ const [n] = useCanvasWidth(), [, r] = useCanvasZoom(), a = useBuilderProp("htmlDir", "ltr"), [l, i] = useState({}), c = useCallback(() => {
2840
+ const { width: d, height: u } = o;
2841
+ if (d < n) {
2842
+ const p = parseFloat((d / n).toFixed(2).toString());
2843
+ let g = {};
2844
+ const x = u * p, m = d * p;
2845
+ u && (g = {
2846
2846
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
2847
- height: 100 + (d - m) / m * 100 + "%",
2848
- width: 100 + (c - x) / x * 100 + "%"
2849
- }), l({
2847
+ height: 100 + (u - x) / x * 100 + "%",
2848
+ width: 100 + (d - m) / m * 100 + "%"
2849
+ }), i({
2850
2850
  position: "relative",
2851
2851
  top: 0,
2852
- transform: `scale(${u})`,
2853
- transformOrigin: "top left",
2854
- ...p,
2852
+ transform: `scale(${p})`,
2853
+ transformOrigin: a === "rtl" ? "top right" : "top left",
2854
+ ...g,
2855
2855
  maxWidth: "none"
2856
2856
  // TODO: Add max-width to the wrapper
2857
- }), r(u * 100);
2857
+ }), r(p * 100);
2858
2858
  } else
2859
- l({}), r(100);
2860
- }, [n, o, r]);
2859
+ i({}), r(100);
2860
+ }, [n, o, a, r]);
2861
2861
  return useEffect(() => {
2862
- i();
2863
- }, [n, o, r, i]), a;
2862
+ c();
2863
+ }, [n, o, r, c]), l;
2864
2864
  };
2865
2865
  let doc, win;
2866
2866
  typeof document < "u" && (doc = document);
@@ -2877,7 +2877,7 @@ class Content extends Component {
2877
2877
  return Children.only(this.props.children);
2878
2878
  }
2879
2879
  }
2880
- F(Content, "propTypes", {
2880
+ U(Content, "propTypes", {
2881
2881
  children: PropTypes.element.isRequired,
2882
2882
  contentDidMount: PropTypes.func.isRequired,
2883
2883
  contentDidUpdate: PropTypes.func.isRequired
@@ -2885,17 +2885,17 @@ F(Content, "propTypes", {
2885
2885
  class Frame extends Component {
2886
2886
  constructor(r, a) {
2887
2887
  super(r, a);
2888
- F(this, "setRef", (r) => {
2888
+ U(this, "setRef", (r) => {
2889
2889
  this.nodeRef.current = r;
2890
2890
  const { forwardedRef: a } = this.props;
2891
2891
  typeof a == "function" ? a(r) : a && (a.current = r);
2892
2892
  });
2893
- F(this, "handleLoad", () => {
2893
+ U(this, "handleLoad", () => {
2894
2894
  clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
2895
2895
  });
2896
2896
  // In certain situations on a cold cache DOMContentLoaded never gets called
2897
2897
  // fallback to an interval to check if that's the case
2898
- F(this, "loadCheck", () => setInterval(() => {
2898
+ U(this, "loadCheck", () => setInterval(() => {
2899
2899
  this.handleLoad();
2900
2900
  }, 500));
2901
2901
  this._isMounted = !1, this.nodeRef = React__default.createRef(), this.state = { iframeLoaded: !1 };
@@ -2936,7 +2936,7 @@ class Frame extends Component {
2936
2936
  // also inject into the body and can mess up React. For this reason
2937
2937
  // initialContent is expected to have a div inside of the body
2938
2938
  // element that we render react into.
2939
- F(Frame, "propTypes", {
2939
+ U(Frame, "propTypes", {
2940
2940
  style: PropTypes.object,
2941
2941
  // eslint-disable-line
2942
2942
  head: PropTypes.node,
@@ -2946,7 +2946,7 @@ F(Frame, "propTypes", {
2946
2946
  contentDidMount: PropTypes.func,
2947
2947
  contentDidUpdate: PropTypes.func,
2948
2948
  children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)])
2949
- }), F(Frame, "defaultProps", {
2949
+ }), U(Frame, "defaultProps", {
2950
2950
  style: {},
2951
2951
  head: null,
2952
2952
  children: void 0,
@@ -3029,33 +3029,33 @@ const useDnd = () => {
3029
3029
  };
3030
3030
  return iframeDocument = o, {
3031
3031
  isDragging: n,
3032
- onDragOver: (g) => {
3033
- g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
3032
+ onDragOver: (m) => {
3033
+ m.preventDefault(), m.stopPropagation(), throttledDragOver(m);
3034
3034
  },
3035
- onDrop: (g) => {
3036
- var w;
3037
- const _ = dropTarget, E = getOrientation(_) === "vertical" ? g.clientY + ((w = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : w.scrollY) : g.clientX;
3038
- dropIndex = calculateDropIndex(E, possiblePositions);
3039
- const v = d, B = _.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3040
- if ((v == null ? void 0 : v._id) === B || !C) {
3035
+ onDrop: (m) => {
3036
+ var C;
3037
+ const E = dropTarget, j = getOrientation(E) === "vertical" ? m.clientY + ((C = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : C.scrollY) : m.clientX;
3038
+ dropIndex = calculateDropIndex(j, possiblePositions);
3039
+ const k = d, A = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3040
+ if ((k == null ? void 0 : k._id) === A || !S) {
3041
3041
  x();
3042
3042
  return;
3043
3043
  }
3044
- if (!has(v, "_id")) {
3045
- a(v, B === "canvas" ? null : B, dropIndex), setTimeout(x, 300);
3044
+ if (!has(k, "_id")) {
3045
+ a(k, A === "canvas" ? null : A, dropIndex), setTimeout(x, 300);
3046
3046
  return;
3047
3047
  }
3048
- let I = _.getAttribute("data-block-id");
3049
- I === null && (I = g.target.parentElement.getAttribute("data-block-id")), c([v._id], I === "canvas" ? null : I, dropIndex), x(), setTimeout(removePlaceholder, 300);
3048
+ let B = E.getAttribute("data-block-id");
3049
+ B === null && (B = m.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3050
3050
  },
3051
- onDragEnter: (g) => {
3052
- const _ = g, b = _.target;
3053
- dropTarget = b;
3054
- const E = b.getAttribute("data-block-id"), v = b.getAttribute("data-dnd-dragged") !== "yes";
3055
- p(E), _.stopPropagation(), _.preventDefault(), possiblePositions = [], v && calculatePossiblePositions(b), r(!0), l(""), i([]);
3051
+ onDragEnter: (m) => {
3052
+ const E = m, f = E.target;
3053
+ dropTarget = f;
3054
+ const j = f.getAttribute("data-block-id"), k = f.getAttribute("data-dnd-dragged") !== "yes";
3055
+ p(j), E.stopPropagation(), E.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(f), r(!0), l(""), i([]);
3056
3056
  },
3057
- onDragLeave: (g) => {
3058
- g.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3057
+ onDragLeave: (m) => {
3058
+ m.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3059
3059
  }
3060
3060
  };
3061
3061
  };
@@ -3077,16 +3077,16 @@ const useHandleCanvasDblClick = () => {
3077
3077
  if (!d || !o.includes(d))
3078
3078
  return;
3079
3079
  const u = c.cloneNode(!0);
3080
- c.style.display = "none", Array.from(u.attributes).forEach((g) => {
3081
- g.name !== "class" && u.removeAttribute(g.name);
3080
+ c.style.display = "none", Array.from(u.attributes).forEach((m) => {
3081
+ m.name !== "class" && u.removeAttribute(m.name);
3082
3082
  }), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
3083
3083
  const p = new Quill(u, { placeholder: "Type here..." });
3084
- function m() {
3085
- const g = p.getText(0, p.getLength());
3086
- n([c.getAttribute("data-block-id")], { content: g }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), l(""), r("");
3084
+ function g() {
3085
+ const m = p.getText(0, p.getLength());
3086
+ n([c.getAttribute("data-block-id")], { content: m }), c.removeAttribute("style"), u.removeEventListener("blur", g, !0), destroyQuill(p), l(""), r("");
3087
3087
  }
3088
- u.addEventListener("blur", m, !0), u.addEventListener("keydown", (g) => {
3089
- (g.key === "Enter" || g.key === "Escape") && m();
3088
+ u.addEventListener("blur", g, !0), u.addEventListener("keydown", (m) => {
3089
+ (m.key === "Enter" || m.key === "Escape") && g();
3090
3090
  }), p.focus(), (x = u.querySelector(".ql-clipboard")) == null || x.remove(), l(c.getAttribute("data-block-id"));
3091
3091
  };
3092
3092
  }, useHandleCanvasClick = () => {
@@ -3101,8 +3101,8 @@ const useHandleCanvasDblClick = () => {
3101
3101
  return;
3102
3102
  }
3103
3103
  if (d != null && d.getAttribute("data-block-parent")) {
3104
- const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
3105
- n.includes(m) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
3104
+ const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
3105
+ n.includes(g) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: g }]), r([g]);
3106
3106
  } else if (d != null && d.getAttribute("data-block-id")) {
3107
3107
  let u = d.getAttribute("data-block-id");
3108
3108
  n.includes(u) || i == null || i.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
@@ -3125,10 +3125,10 @@ const useHandleCanvasDblClick = () => {
3125
3125
  return;
3126
3126
  const p = getElementByDataBlockId(n, first(r));
3127
3127
  if (p) {
3128
- const m = p.getAttribute("data-style-prop");
3129
- if (m) {
3130
- const x = p.getAttribute("data-style-id"), g = p.getAttribute("data-block-parent");
3131
- l([{ id: x, prop: m, blockId: g }]);
3128
+ const g = p.getAttribute("data-style-prop");
3129
+ if (g) {
3130
+ const x = p.getAttribute("data-style-id"), m = p.getAttribute("data-block-parent");
3131
+ l([{ id: x, prop: g, blockId: m }]);
3132
3132
  }
3133
3133
  }
3134
3134
  }, 100);
@@ -3148,14 +3148,14 @@ const useHandleCanvasDblClick = () => {
3148
3148
  }
3149
3149
  );
3150
3150
  }, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
3151
- const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
3151
+ const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: g } = usePasteBlocks();
3152
3152
  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(
3153
3153
  "ctrl+v,command+v",
3154
3154
  () => {
3155
- p(n[0]) && m(n);
3155
+ p(n[0]) && g(n);
3156
3156
  },
3157
3157
  {},
3158
- [n, p, m]
3158
+ [n, p, g]
3159
3159
  );
3160
3160
  const x = o ? { document: o } : {};
3161
3161
  useHotkeys("esc", () => r([]), x, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...x, preventDefault: !0 }, [
@@ -3163,8 +3163,8 @@ const useHandleCanvasDblClick = () => {
3163
3163
  l
3164
3164
  ]), useHotkeys(
3165
3165
  "del, backspace",
3166
- (g) => {
3167
- g.preventDefault(), a(n);
3166
+ (m) => {
3167
+ m.preventDefault(), a(n);
3168
3168
  },
3169
3169
  x,
3170
3170
  [n, a]
@@ -3195,15 +3195,15 @@ const useHandleCanvasDblClick = () => {
3195
3195
  }
3196
3196
  );
3197
3197
  }, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
3198
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
3198
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: g } = useFloating({
3199
3199
  placement: "top-start",
3200
3200
  middleware: [shift(), flip()],
3201
3201
  elements: {
3202
3202
  reference: o
3203
3203
  }
3204
3204
  });
3205
- useResizeObserver(o, () => m(), o !== null);
3206
- const x = get(n, "_parent", null), g = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3205
+ useResizeObserver(o, () => g(), o !== null);
3206
+ const x = get(n, "_parent", null), m = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3207
3207
  return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3208
3208
  "div",
3209
3209
  {
@@ -3211,13 +3211,13 @@ const useHandleCanvasDblClick = () => {
3211
3211
  tabIndex: 0,
3212
3212
  ref: p.setFloating,
3213
3213
  style: u,
3214
- onClick: (_) => {
3215
- _.stopPropagation(), _.preventDefault();
3214
+ onClick: (E) => {
3215
+ E.stopPropagation(), E.preventDefault();
3216
3216
  },
3217
- onMouseEnter: (_) => {
3218
- _.stopPropagation(), i(null);
3217
+ onMouseEnter: (E) => {
3218
+ E.stopPropagation(), i(null);
3219
3219
  },
3220
- onKeyDown: (_) => _.stopPropagation(),
3220
+ onKeyDown: (E) => E.stopPropagation(),
3221
3221
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
3222
3222
  children: [
3223
3223
  x && /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3229,7 +3229,7 @@ const useHandleCanvasDblClick = () => {
3229
3229
  }
3230
3230
  }
3231
3231
  ),
3232
- /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: g, block: n }),
3232
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: m, block: n }),
3233
3233
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
3234
3234
  canAddChildBlock(get(n, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3235
3235
  PlusIcon,
@@ -3252,27 +3252,27 @@ const useHandleCanvasDblClick = () => {
3252
3252
  }
3253
3253
  ) });
3254
3254
  }, HeadTags = ({ model: o }) => {
3255
- const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [m] = useState(u == null ? void 0 : u.getElementById("highlighted-block")), [x] = useState(
3255
+ const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [g] = useState(u == null ? void 0 : u.getElementById("highlighted-block")), [x] = useState(
3256
3256
  u == null ? void 0 : u.getElementById("selected-block")
3257
- ), [g] = useState(
3257
+ ), [m] = useState(
3258
3258
  u == null ? void 0 : u.getElementById("selected-styling-block")
3259
- ), [_] = useState(
3259
+ ), [E] = useState(
3260
3260
  u == null ? void 0 : u.getElementById("dragged-block")
3261
3261
  );
3262
3262
  useEffect(() => {
3263
3263
  a ? u == null || u.documentElement.classList.add("dark") : u == null || u.documentElement.classList.remove("dark");
3264
3264
  }, [a, u]);
3265
- const b = get(n, "headingFont", "DM Sans"), E = get(n, "bodyFont", "DM Sans");
3265
+ const f = get(n, "headingFont", "DM Sans"), j = get(n, "bodyFont", "DM Sans");
3266
3266
  return useEffect(() => {
3267
- const v = get(n, "primaryColor", "#000"), B = get(n, "secondaryColor", "#FFF"), C = get(n, "bodyBgLightColor", "#fff"), I = get(n, "bodyBgDarkColor", "#000"), w = get(n, "bodyTextDarkColor", "#000"), A = get(n, "bodyTextLightColor", "#fff"), T = getPalette([
3268
- { color: v, name: "primary" },
3269
- { color: B, name: "secondary" }
3270
- ]), P = {
3271
- "bg-light": C,
3272
- "bg-dark": I,
3273
- "text-dark": w,
3274
- "text-light": A
3275
- }, L = get(n, "roundedCorners", "0");
3267
+ const k = get(n, "primaryColor", "#000"), A = get(n, "secondaryColor", "#FFF"), S = get(n, "bodyBgLightColor", "#fff"), B = get(n, "bodyBgDarkColor", "#000"), C = get(n, "bodyTextDarkColor", "#000"), w = get(n, "bodyTextLightColor", "#fff"), N = getPalette([
3268
+ { color: k, name: "primary" },
3269
+ { color: A, name: "secondary" }
3270
+ ]), D = {
3271
+ "bg-light": S,
3272
+ "bg-dark": B,
3273
+ "text-dark": C,
3274
+ "text-light": w
3275
+ }, T = get(n, "roundedCorners", "0");
3276
3276
  !p || !p.tailwind || (p.tailwind.config = {
3277
3277
  darkMode: "class",
3278
3278
  theme: {
@@ -3285,56 +3285,56 @@ const useHandleCanvasDblClick = () => {
3285
3285
  }
3286
3286
  },
3287
3287
  fontFamily: {
3288
- heading: [b],
3289
- body: [E]
3288
+ heading: [f],
3289
+ body: [j]
3290
3290
  },
3291
3291
  borderRadius: {
3292
- DEFAULT: `${L || "0"}px`
3292
+ DEFAULT: `${T || "0"}px`
3293
3293
  },
3294
- colors: { ...P, ...T }
3294
+ colors: { ...D, ...N }
3295
3295
  }
3296
3296
  },
3297
3297
  plugins: [
3298
3298
  typography$1,
3299
3299
  forms,
3300
3300
  aspectRatio,
3301
- plugin(function({ addBase: j, theme: k }) {
3302
- j({
3301
+ plugin(function({ addBase: b, theme: _ }) {
3302
+ b({
3303
3303
  "h1,h2,h3,h4,h5,h6": {
3304
- fontFamily: k("fontFamily.heading")
3304
+ fontFamily: _("fontFamily.heading")
3305
3305
  },
3306
3306
  body: {
3307
- fontFamily: k("fontFamily.body"),
3308
- color: k("colors.text-light"),
3309
- backgroundColor: k("colors.bg-light")
3307
+ fontFamily: _("fontFamily.body"),
3308
+ color: _("colors.text-light"),
3309
+ backgroundColor: _("colors.bg-light")
3310
3310
  },
3311
3311
  ".dark body": {
3312
- color: k("colors.text-dark"),
3313
- backgroundColor: k("colors.bg-dark")
3312
+ color: _("colors.text-dark"),
3313
+ backgroundColor: _("colors.bg-dark")
3314
3314
  }
3315
3315
  });
3316
3316
  })
3317
3317
  ]
3318
3318
  });
3319
- }, [n, p, b, E]), useEffect(() => {
3320
- x && (x.textContent = `${map(r, (v) => `[data-block-id="${v}"]`).join(",")}{
3319
+ }, [n, p, f, j]), useEffect(() => {
3320
+ x && (x.textContent = `${map(r, (k) => `[data-block-id="${k}"]`).join(",")}{
3321
3321
  outline: 1px solid ${r.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
3322
3322
  }`);
3323
3323
  }, [r, x]), useEffect(() => {
3324
- _.textContent = c ? `[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3325
- }, [c, _]), useEffect(() => {
3326
- m && (m.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
3327
- }, [l, r, m]), useEffect(() => {
3328
- g && (g.textContent = `${map(i, ({ id: v }) => `[data-style-id="${v}"]`).join(",")}{
3324
+ E.textContent = c ? `[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3325
+ }, [c, E]), useEffect(() => {
3326
+ g && (g.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
3327
+ }, [l, r, g]), useEffect(() => {
3328
+ m && (m.textContent = `${map(i, ({ id: k }) => `[data-style-id="${k}"]`).join(",")}{
3329
3329
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3330
3330
  }`);
3331
- }, [i, g]), useEffect(() => {
3331
+ }, [i, m]), useEffect(() => {
3332
3332
  u.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3333
- }, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (b || E) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3333
+ }, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (f || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3334
3334
  "link",
3335
3335
  {
3336
3336
  rel: "stylesheet",
3337
- href: `https://fonts.googleapis.com/css2?family=${b ? `${b.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${b && E && b !== E ? "&" : ""}${E && E !== b ? `family=${E.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
3337
+ href: `https://fonts.googleapis.com/css2?family=${f ? `${f.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${f && j && f !== j ? "&" : ""}${j && j !== f ? `family=${j.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
3338
3338
  }
3339
3339
  ) });
3340
3340
  }, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
@@ -3345,13 +3345,13 @@ const useHandleCanvasDblClick = () => {
3345
3345
  u || (u = d, d = "xs");
3346
3346
  const p = r.indexOf(d);
3347
3347
  if (p <= a) {
3348
- const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
3349
- if (m.includes(u))
3350
- for (let g = p; g < r.length; g++)
3351
- i[g] = !0;
3348
+ const g = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
3349
+ if (g.includes(u))
3350
+ for (let m = p; m < r.length; m++)
3351
+ i[m] = !0;
3352
3352
  else if (x.includes(u))
3353
- for (let g = p; g < r.length; g++)
3354
- i[g] = !1;
3353
+ for (let m = p; m < r.length; m++)
3354
+ i[m] = !1;
3355
3355
  }
3356
3356
  }
3357
3357
  return i[a];
@@ -3378,16 +3378,16 @@ const useHandleCanvasDblClick = () => {
3378
3378
  forEach(d, (u) => {
3379
3379
  if (get(n, u, "") || get(a, `${u}.loading`, !1))
3380
3380
  return;
3381
- const p = o.find((m) => m._id === u);
3382
- l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
3383
- r((x) => ({ ...x, [u]: m })), l((x) => ({
3381
+ const p = o.find((g) => g._id === u);
3382
+ l((g) => ({ ...g, [u]: { loading: !0, error: null } })), c(p).then((g) => {
3383
+ r((x) => ({ ...x, [u]: g })), l((x) => ({
3384
3384
  ...x,
3385
3385
  [u]: { loading: !1, error: null }
3386
3386
  }));
3387
- }).catch((m) => {
3387
+ }).catch((g) => {
3388
3388
  l((x) => ({
3389
3389
  ...x,
3390
- [u]: { loading: !1, error: m.message }
3390
+ [u]: { loading: !1, error: g.message }
3391
3391
  }));
3392
3392
  });
3393
3393
  });
@@ -3444,50 +3444,50 @@ function isDescendant(o, n, r) {
3444
3444
  }
3445
3445
  const RenderGlobalBlock = ({ blocks: o, allBlocks: n }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: o });
3446
3446
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3447
- const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), m = useCallback((b) => getStyleAttrs(b, c), [c]), [x] = useChaiExternalData(), [g] = useAtom$1(inlineEditingActiveAtom), _ = useCallback(
3448
- (b) => b.reduce((E, v) => {
3449
- const B = get(d, v, {});
3450
- return { ...E, ...B };
3447
+ const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), g = useCallback((f) => getStyleAttrs(f, c), [c]), [x] = useChaiExternalData(), [m] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3448
+ (f) => f.reduce((j, k) => {
3449
+ const A = get(d, k, {});
3450
+ return { ...j, ...A };
3451
3451
  }, {}),
3452
3452
  [d]
3453
3453
  );
3454
3454
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3455
- o.map((b, E) => {
3456
- if (g === b._id || u.includes(b._id))
3455
+ o.map((f, j) => {
3456
+ if (m === f._id || u.includes(f._id))
3457
3457
  return null;
3458
- const v = {}, B = filter(n, { _parent: b._id });
3459
- if (v.children = B.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: B }) : null, b._type === "GlobalBlock") {
3460
- const k = p(b);
3461
- v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(k, (S) => !S._parent), allBlocks: k });
3458
+ const k = {}, A = filter(n, { _parent: f._id });
3459
+ if (k.children = A.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: A }) : null, f._type === "GlobalBlock") {
3460
+ const _ = p(f);
3461
+ k.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(_, (R) => !R._parent), allBlocks: _ });
3462
3462
  }
3463
- const C = getBlockComponent(b._type), I = get(C, "server", !1), w = I ? RSCBlock : get(C, "builderComponent", get(C, "component", null));
3464
- if (isNull(w))
3465
- return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
3466
- const A = has(C, "getBlockStateFrom") ? C == null ? void 0 : C.getBlockStateFrom(b, n) : [], T = _(A), P = m(b);
3467
- if (get(P, "__isHidden", !1) && !includes(r, b._id))
3463
+ const S = getBlockComponent(f._type), B = get(S, "server", !1), C = B ? RSCBlock : get(S, "builderComponent", get(S, "component", null));
3464
+ if (isNull(C))
3465
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
3466
+ const w = has(S, "getBlockStateFrom") ? S == null ? void 0 : S.getBlockStateFrom(f, n) : [], N = E(w), D = g(f);
3467
+ if (get(D, "__isHidden", !1) && !includes(r, f._id))
3468
3468
  return null;
3469
- const L = l && isDescendant(l._id, b._id, n), j = {
3470
- ...includes(r, b._id) ? { "force-show": "" } : {},
3471
- "data-block-id": b._id,
3472
- "data-block-type": b._type,
3469
+ const T = l && isDescendant(l._id, f._id, n), b = {
3470
+ ...includes(r, f._id) ? { "force-show": "" } : {},
3471
+ "data-block-id": f._id,
3472
+ "data-block-type": f._type,
3473
3473
  ...l ? (
3474
3474
  // @ts-ignore
3475
3475
  {
3476
- "data-dnd": canAcceptChildBlock(b._type, l == null ? void 0 : l._type) ? "yes" : "no",
3477
- "data-dnd-dragged": l._id === b._id || L ? "yes" : "no"
3476
+ "data-dnd": canAcceptChildBlock(f._type, l == null ? void 0 : l._type) ? "yes" : "no",
3477
+ "data-dnd-dragged": l._id === f._id || T ? "yes" : "no"
3478
3478
  }
3479
3479
  ) : {},
3480
- ...i === b._id && !L ? { "data-drop": "yes" } : {},
3481
- ...includes(a, b._id) ? { "data-cut-block": "yes" } : {}
3480
+ ...i === f._id && !T ? { "data-drop": "yes" } : {},
3481
+ ...includes(a, f._id) ? { "data-cut-block": "yes" } : {}
3482
3482
  };
3483
- return I ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: j }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(w, {
3484
- blockProps: j,
3485
- index: E,
3486
- ...applyBindings(b, x),
3487
- ...omit(P, ["__isHidden"]),
3488
- ...v,
3483
+ return B ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: b }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(C, {
3484
+ blockProps: b,
3485
+ index: j,
3486
+ ...applyBindings(f, x),
3487
+ ...omit(D, ["__isHidden"]),
3488
+ ...k,
3489
3489
  inBuilder: !0,
3490
- blockState: T
3490
+ blockState: N
3491
3491
  }) });
3492
3492
  })
3493
3493
  ) });
@@ -3537,47 +3537,47 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3537
3537
  n(i);
3538
3538
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
3539
3539
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3540
- const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, x] = useState([]), [, g] = useState([]), [, _] = useAtom$1(canvasIframeAtom), [b, E] = useSelectedStylingBlocks(), v = useBuilderProp("loading", !1), B = useBuilderProp("htmlDir", "ltr"), C = (A) => {
3541
- u((T) => ({ ...T, width: A }));
3540
+ 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, x] = useState([]), [, m] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [f, j] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), A = useBuilderProp("htmlDir", "ltr"), S = (w) => {
3541
+ u((N) => ({ ...N, width: w }));
3542
3542
  };
3543
3543
  useEffect(() => {
3544
3544
  if (!c.current)
3545
3545
  return;
3546
- const { clientWidth: A, clientHeight: T } = c.current;
3547
- u({ width: A, height: T });
3546
+ const { clientWidth: w, clientHeight: N } = c.current;
3547
+ u({ width: w, height: N });
3548
3548
  }, [c, n]);
3549
- const I = (A, T = 0) => {
3550
- const { top: P } = A.getBoundingClientRect();
3551
- return P + T >= 0 && P - T <= window.innerHeight;
3549
+ const B = (w, N = 0) => {
3550
+ const { top: D } = w.getBoundingClientRect();
3551
+ return D + N >= 0 && D - N <= window.innerHeight;
3552
3552
  };
3553
3553
  useEffect(() => {
3554
- var A, T;
3554
+ var w, N;
3555
3555
  if (a && a.type !== "Multiple" && i.current) {
3556
- const P = getElementByDataBlockId(i.current.contentDocument, a._id);
3557
- P && (I(P) || (T = (A = i.current) == null ? void 0 : A.contentWindow) == null || T.scrollTo({ top: P.offsetTop, behavior: "smooth" }), x([P]));
3556
+ const D = getElementByDataBlockId(i.current.contentDocument, a._id);
3557
+ D && (B(D) || (N = (w = i.current) == null ? void 0 : w.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
3558
3558
  }
3559
3559
  }, [a]), useEffect(() => {
3560
- if (!isEmpty(b) && i.current) {
3561
- const A = getElementByStyleId(
3560
+ if (!isEmpty(f) && i.current) {
3561
+ const w = getElementByStyleId(
3562
3562
  i.current.contentDocument,
3563
- first(b).id
3563
+ first(f).id
3564
3564
  );
3565
- g(A ? [A] : [null]);
3565
+ m(w ? [w] : [null]);
3566
3566
  } else
3567
- g([null]);
3568
- }, [b]);
3569
- const w = useMemo(() => {
3570
- let A = IframeInitialContent;
3571
- return A = A.replace("__HTML_DIR__", B), o === "offline" && (A = A.replace(
3567
+ m([null]);
3568
+ }, [f]);
3569
+ const C = useMemo(() => {
3570
+ let w = IframeInitialContent;
3571
+ return w = w.replace("__HTML_DIR__", A), o === "offline" && (w = w.replace(
3572
3572
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3573
3573
  "/offline/tailwind.cdn.js"
3574
- ), 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;
3575
- }, [o, B]);
3576
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3574
+ ), w = w.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), w = w.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), w;
3575
+ }, [o, A]);
3576
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: S, onResize: S, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3577
3577
  "div",
3578
3578
  {
3579
3579
  onClick: () => {
3580
- r([]), E([]);
3580
+ r([]), j([]);
3581
3581
  },
3582
3582
  onMouseLeave: () => setTimeout(() => l(""), 300),
3583
3583
  className: "relative mx-auto h-full w-full overflow-hidden",
@@ -3585,24 +3585,24 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3585
3585
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3586
3586
  ChaiFrame,
3587
3587
  {
3588
- contentDidMount: () => _(i.current),
3588
+ contentDidMount: () => E(i.current),
3589
3589
  ref: i,
3590
3590
  id: "canvas-iframe",
3591
3591
  style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
3592
3592
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3593
- initialContent: w,
3593
+ initialContent: C,
3594
3594
  children: [
3595
3595
  /* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
3596
3596
  /* @__PURE__ */ jsxRuntimeExports.jsx(
3597
3597
  BlockActionsStatic,
3598
3598
  {
3599
3599
  block: a,
3600
- selectedBlockElement: first(m)
3600
+ selectedBlockElement: first(g)
3601
3601
  }
3602
3602
  ),
3603
3603
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, { model: "page" }),
3604
3604
  /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
3605
- v ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3605
+ k ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3606
3606
  /* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
3607
3607
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
3608
3608
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -3692,7 +3692,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3692
3692
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mx-2 border-t border-border bg-background px-2 py-1 text-xs text-muted-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("ol", { className: "flex items-center whitespace-nowrap", children: [
3693
3693
  /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "inline-flex items-center", children: [
3694
3694
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => n([]), variant: "ghost", className: "h-fit p-1 text-xs font-normal", children: "Body" }),
3695
- /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { size: 16 })
3695
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3696
3696
  ] }),
3697
3697
  reverse(o).map((a, l) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "inline-flex items-center", children: [
3698
3698
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -3710,10 +3710,10 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3710
3710
  ]
3711
3711
  }
3712
3712
  ),
3713
- l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { size: 16 })
3713
+ l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3714
3714
  ] }, l))
3715
3715
  ] }) });
3716
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-_PTE1mX9.js")), CanvasArea = () => {
3716
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-v7zBTMpR.js")), CanvasArea = () => {
3717
3717
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3718
3718
  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: [
3719
3719
  /* @__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, {}) }) }),
@@ -3788,42 +3788,42 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3788
3788
  showHeading: o = !0,
3789
3789
  className: n = ""
3790
3790
  }) => {
3791
- const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: w }, A) => {
3792
- A && (a(w), i.current = w);
3791
+ const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: C }, w) => {
3792
+ w && (a(C), i.current = C);
3793
3793
  }, {
3794
3794
  bodyFont: u,
3795
3795
  headingFont: p,
3796
- primaryColor: m,
3796
+ primaryColor: g,
3797
3797
  bodyTextDarkColor: x,
3798
- bodyTextLightColor: g,
3799
- bodyBgDarkColor: _,
3800
- secondaryColor: b,
3801
- bodyBgLightColor: E,
3802
- roundedCorners: v
3798
+ bodyTextLightColor: m,
3799
+ bodyBgDarkColor: E,
3800
+ secondaryColor: f,
3801
+ bodyBgLightColor: j,
3802
+ roundedCorners: k
3803
3803
  } = r;
3804
- let B = {
3805
- headingFont: f({
3804
+ let A = {
3805
+ headingFont: y({
3806
3806
  title: c("theme_config.heading_font"),
3807
3807
  default: p,
3808
3808
  options: FONTS
3809
3809
  }),
3810
- bodyFont: f({
3810
+ bodyFont: y({
3811
3811
  title: c("theme_config.body_font"),
3812
3812
  default: u,
3813
3813
  options: FONTS
3814
3814
  }),
3815
- roundedCorners: y({
3815
+ roundedCorners: s({
3816
3816
  title: c("theme_config.rounded_corner"),
3817
- default: parseInt(v || 5, 10)
3817
+ default: parseInt(k || 5, 10)
3818
3818
  }),
3819
- primaryColor: h({ title: c("theme_config.primary"), default: m }),
3820
- secondaryColor: h({ title: c("theme_config.secondary"), default: b })
3819
+ primaryColor: h({ title: c("theme_config.primary"), default: g }),
3820
+ secondaryColor: h({ title: c("theme_config.secondary"), default: f })
3821
3821
  };
3822
- l || (B = {
3823
- ...B,
3822
+ l || (A = {
3823
+ ...A,
3824
3824
  bodyBgLightColor: h({
3825
3825
  title: c("theme_config.background"),
3826
- default: E
3826
+ default: j
3827
3827
  }),
3828
3828
  bodyTextLightColor: h({
3829
3829
  title: c("theme_config.text_color"),
@@ -3831,20 +3831,20 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3831
3831
  }),
3832
3832
  bodyBgDarkColor: h({
3833
3833
  title: c("theme_config.background_dark_mode"),
3834
- default: _
3834
+ default: E
3835
3835
  }),
3836
3836
  bodyTextDarkColor: h({
3837
3837
  title: c("theme_config.text_color_dark_mode"),
3838
- default: g
3838
+ default: m
3839
3839
  })
3840
3840
  });
3841
- const C = {
3841
+ const S = {
3842
3842
  type: "object",
3843
3843
  properties: {}
3844
- }, I = {};
3845
- return Object.keys(B).forEach((w) => {
3846
- const A = B[w];
3847
- return C.properties || (C.properties = {}), C.properties[w] = A.schema, I[w] = A.uiSchema, !0;
3844
+ }, B = {};
3845
+ return Object.keys(A).forEach((C) => {
3846
+ const w = A[C];
3847
+ return S.properties || (S.properties = {}), S.properties[C] = w.schema, B[C] = w.uiSchema, !0;
3848
3848
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
3849
3849
  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,
3850
3850
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3856,8 +3856,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3856
3856
  omitExtraData: !0,
3857
3857
  liveOmit: !0,
3858
3858
  liveValidate: !0,
3859
- uiSchema: I,
3860
- schema: C,
3859
+ uiSchema: B,
3860
+ schema: S,
3861
3861
  formData: r,
3862
3862
  validator,
3863
3863
  onChange: d
@@ -4040,34 +4040,34 @@ function BiExpandVertical(o) {
4040
4040
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4041
4041
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
4042
4042
  let p = null;
4043
- const m = o.children.length > 0, { id: x, data: g, isSelected: _, willReceiveDrop: b, isDragging: E, isEditing: v, handleClick: B } = o, C = (L) => {
4044
- L.stopPropagation(), !i.includes(x) && o.toggle();
4045
- }, I = (L) => {
4046
- L.isInternal && (p = L.isOpen, L.isOpen && L.close());
4047
- }, w = (L) => {
4048
- L.isInternal && p !== null && (p ? L.open() : L.close(), p = null);
4049
- }, A = (L) => {
4050
- L.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), B(L);
4043
+ const g = o.children.length > 0, { id: x, data: m, isSelected: E, willReceiveDrop: f, isDragging: j, isEditing: k, handleClick: A } = o, S = (T) => {
4044
+ T.stopPropagation(), !i.includes(x) && o.toggle();
4045
+ }, B = (T) => {
4046
+ T.isInternal && (p = T.isOpen, T.isOpen && T.close());
4047
+ }, C = (T) => {
4048
+ T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
4049
+ }, w = (T) => {
4050
+ T.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), A(T);
4051
4051
  };
4052
4052
  useEffect(() => {
4053
- const L = setTimeout(() => {
4054
- b && !o.isOpen && !E && !i.includes(x) && o.toggle();
4053
+ const T = setTimeout(() => {
4054
+ f && !o.isOpen && !j && !i.includes(x) && o.toggle();
4055
4055
  }, 500);
4056
- return () => clearTimeout(L);
4057
- }, [b, o, E]);
4058
- const T = useMemo(() => {
4059
- const L = Object.keys(g), j = [];
4060
- for (let k = 0; k < L.length; k++)
4061
- if (L[k].endsWith("_attrs")) {
4062
- const S = g[L[k]], R = Object.keys(S).join("|");
4063
- R.match(/x-data/) && j.push("data"), R.match(/x-on/) && j.push("event"), R.match(/x-show|x-if/) && j.push("show");
4056
+ return () => clearTimeout(T);
4057
+ }, [f, o, j]);
4058
+ const N = useMemo(() => {
4059
+ const T = Object.keys(m), b = [];
4060
+ for (let _ = 0; _ < T.length; _++)
4061
+ if (T[_].endsWith("_attrs")) {
4062
+ const R = m[T[_]], v = Object.keys(R).join("|");
4063
+ v.match(/x-data/) && b.push("data"), v.match(/x-on/) && b.push("event"), v.match(/x-show|x-if/) && b.push("show");
4064
4064
  }
4065
- return j;
4066
- }, [g]), P = (L, j) => {
4067
- const k = u.contentDocument || u.contentWindow.document, S = k.querySelector(`[data-block-id=${L}]`);
4068
- S && S.setAttribute("data-drop", j);
4069
- const R = S.getBoundingClientRect(), N = u.getBoundingClientRect();
4070
- R.top >= N.top && R.left >= N.left && R.bottom <= N.bottom && R.right <= N.right || (k.documentElement.scrollTop = S.offsetTop - N.top);
4065
+ return b;
4066
+ }, [m]), D = (T, b) => {
4067
+ const _ = u.contentDocument || u.contentWindow.document, R = _.querySelector(`[data-block-id=${T}]`);
4068
+ R && R.setAttribute("data-drop", b);
4069
+ const v = R.getBoundingClientRect(), I = u.getBoundingClientRect();
4070
+ v.top >= I.top && v.left >= I.left && v.bottom <= I.bottom && v.right <= I.right || (_.documentElement.scrollTop = R.offsetTop - I.top);
4071
4071
  };
4072
4072
  return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4073
4073
  "button",
@@ -4083,26 +4083,26 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4083
4083
  "div",
4084
4084
  {
4085
4085
  onMouseEnter: () => d(x),
4086
- onClick: A,
4086
+ onClick: w,
4087
4087
  style: n,
4088
4088
  "data-node-id": x,
4089
4089
  ref: i.includes(x) ? null : r,
4090
- onDragStart: () => I(o),
4091
- onDragEnd: () => w(o),
4092
- onDragOver: (L) => {
4093
- L.preventDefault(), P(x, "yes");
4090
+ onDragStart: () => B(o),
4091
+ onDragEnd: () => C(o),
4092
+ onDragOver: (T) => {
4093
+ T.preventDefault(), D(x, "yes");
4094
4094
  },
4095
- onDragLeave: (L) => {
4096
- L.preventDefault(), P(x, "no");
4095
+ onDragLeave: (T) => {
4096
+ T.preventDefault(), D(x, "no");
4097
4097
  },
4098
- onDrop: (L) => {
4099
- L.preventDefault(), P(x, "no");
4098
+ onDrop: (T) => {
4099
+ T.preventDefault(), D(x, "no");
4100
4100
  },
4101
4101
  className: cn(
4102
4102
  "group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
4103
- _ ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4104
- b && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
4105
- E && "opacity-20",
4103
+ E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4104
+ f && canAcceptChildBlock(m._type, "Icon") ? "bg-green-200" : "",
4105
+ j && "opacity-20",
4106
4106
  i.includes(x) ? "opacity-50" : ""
4107
4107
  ),
4108
4108
  children: [
@@ -4111,41 +4111,41 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4111
4111
  "div",
4112
4112
  {
4113
4113
  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" : ""}`,
4114
- children: m && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: C, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4114
+ children: g && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4115
4115
  }
4116
4116
  ),
4117
4117
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4118
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: g == null ? void 0 : g._type }) }),
4119
- v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4118
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: m == null ? void 0 : m._type }) }),
4119
+ k ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4120
4120
  "div",
4121
4121
  {
4122
4122
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
4123
- onDoubleClick: (L) => {
4124
- L.stopPropagation(), o.edit(), o.deselect();
4123
+ onDoubleClick: (T) => {
4124
+ T.stopPropagation(), o.edit(), o.deselect();
4125
4125
  },
4126
4126
  children: [
4127
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (g == null ? void 0 : g._name) || (g == null ? void 0 : g._type.split("/").pop()) }),
4128
- T.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4129
- T.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4130
- T.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
4127
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (m == null ? void 0 : m._name) || (m == null ? void 0 : m._type.split("/").pop()) }),
4128
+ N.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4129
+ N.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4130
+ N.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
4131
4131
  ]
4132
4132
  }
4133
4133
  )
4134
4134
  ] })
4135
4135
  ] }),
4136
4136
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: [
4137
- !i.includes(x) && a.map((L) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4137
+ !i.includes(x) && a.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4138
4138
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4139
4139
  TooltipTrigger,
4140
4140
  {
4141
4141
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
4142
4142
  asChild: !0,
4143
- children: React__default.createElement(L.item, { blockId: x })
4143
+ children: React__default.createElement(T.item, { blockId: x })
4144
4144
  }
4145
4145
  ),
4146
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: L.tooltip })
4146
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: T.tooltip })
4147
4147
  ] })),
4148
- canAddChildBlock(g == null ? void 0 : g._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4148
+ canAddChildBlock(m == null ? void 0 : m._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4149
4149
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4150
4150
  TooltipTrigger,
4151
4151
  {
@@ -4161,8 +4161,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4161
4161
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4162
4162
  TooltipTrigger,
4163
4163
  {
4164
- onClick: (L) => {
4165
- L.stopPropagation(), c(x), o.isOpen && o.toggle();
4164
+ onClick: (T) => {
4165
+ T.stopPropagation(), c(x), o.isOpen && o.toggle();
4166
4166
  },
4167
4167
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",
4168
4168
  asChild: !0,
@@ -4213,7 +4213,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4213
4213
  }, [treeData, cutBlocksIds]);
4214
4214
  useEffect(() => {
4215
4215
  setTreeRef(treeRef.current);
4216
- }, [treeRef.current]);
4216
+ }, [setTreeRef, treeRef]);
4217
4217
  const onRename = ({ id: o, name: n, node: r }) => {
4218
4218
  updateBlockProps([o], { _name: n }, r.data._name);
4219
4219
  }, onMove = ({ dragIds: o, parentId: n, index: r }) => {
@@ -4280,7 +4280,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4280
4280
  size: "sm",
4281
4281
  children: [
4282
4282
  "+ ",
4283
- t("add_block")
4283
+ t("Add Block")
4284
4284
  ]
4285
4285
  }
4286
4286
  )
@@ -4517,8 +4517,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4517
4517
  const c = stringify([r]);
4518
4518
  return hasVideoEmbed(c) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(c)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = c, [a];
4519
4519
  } else if (r.tagName === "svg") {
4520
- const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px", m = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4521
- return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`, m)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
4520
+ const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px", g = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4521
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`, g)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
4522
4522
  } else if (r.tagName == "option" && n && ((i = n.block) == null ? void 0 : i._type) === "Select")
4523
4523
  return n.block.options.push({
4524
4524
  label: getTextContent(r.children),
@@ -4579,57 +4579,57 @@ function ExpandableObject(o) {
4579
4579
  level: d,
4580
4580
  style: u,
4581
4581
  shouldExpandNode: p,
4582
- clickToExpandNode: m
4582
+ clickToExpandNode: g
4583
4583
  } = o;
4584
- const x = useRef(!1), [g, _, b] = useBool(() => p(d, r, n));
4584
+ const x = useRef(!1), [m, E, f] = useBool(() => p(d, r, n));
4585
4585
  useEffect(() => {
4586
- x.current ? b(p(d, r, n)) : x.current = !0;
4586
+ x.current ? f(p(d, r, n)) : x.current = !0;
4587
4587
  }, [p]);
4588
- const E = g ? u.collapseIcon : u.expandIcon, v = g ? "collapse JSON" : "expand JSON", B = useComponentId(), C = d + 1, I = a.length - 1, w = (A) => {
4589
- A.key === " " && (A.preventDefault(), _());
4588
+ const j = m ? u.collapseIcon : u.expandIcon, k = m ? "collapse JSON" : "expand JSON", A = useComponentId(), S = d + 1, B = a.length - 1, C = (w) => {
4589
+ w.key === " " && (w.preventDefault(), E());
4590
4590
  };
4591
4591
  return /* @__PURE__ */ createElement("div", {
4592
4592
  className: u.basicChildStyle,
4593
4593
  role: "list"
4594
4594
  }, /* @__PURE__ */ createElement("span", {
4595
- className: E,
4596
- onClick: _,
4597
- onKeyDown: w,
4595
+ className: j,
4596
+ onClick: E,
4597
+ onKeyDown: C,
4598
4598
  role: "button",
4599
4599
  tabIndex: 0,
4600
- "aria-label": v,
4601
- "aria-expanded": g,
4602
- "aria-controls": g ? B : void 0
4603
- }), n && (m ? /* @__PURE__ */ createElement("span", {
4600
+ "aria-label": k,
4601
+ "aria-expanded": m,
4602
+ "aria-controls": m ? A : void 0
4603
+ }), n && (g ? /* @__PURE__ */ createElement("span", {
4604
4604
  className: u.clickableLabel,
4605
- onClick: _,
4606
- onKeyDown: w,
4605
+ onClick: E,
4606
+ onKeyDown: C,
4607
4607
  role: "button",
4608
4608
  tabIndex: -1
4609
4609
  }, n, ":") : /* @__PURE__ */ createElement("span", {
4610
4610
  className: u.label
4611
4611
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4612
4612
  className: u.punctuation
4613
- }, i), g ? /* @__PURE__ */ createElement("div", {
4614
- id: B
4615
- }, a.map((A, T) => /* @__PURE__ */ createElement(DataRender, {
4616
- key: A[0] || T,
4617
- field: A[0],
4618
- value: A[1],
4613
+ }, i), m ? /* @__PURE__ */ createElement("div", {
4614
+ id: A
4615
+ }, a.map((w, N) => /* @__PURE__ */ createElement(DataRender, {
4616
+ key: w[0] || N,
4617
+ field: w[0],
4618
+ value: w[1],
4619
4619
  style: u,
4620
- lastElement: T === I,
4621
- level: C,
4620
+ lastElement: N === B,
4621
+ level: S,
4622
4622
  shouldExpandNode: p,
4623
- clickToExpandNode: m
4623
+ clickToExpandNode: g
4624
4624
  }))) : /* @__PURE__ */ createElement("span", {
4625
4625
  className: u.collapsedContent,
4626
- onClick: _,
4627
- onKeyDown: w,
4626
+ onClick: E,
4627
+ onKeyDown: C,
4628
4628
  role: "button",
4629
4629
  tabIndex: -1,
4630
4630
  "aria-hidden": !0,
4631
- "aria-label": v,
4632
- "aria-expanded": g
4631
+ "aria-label": k,
4632
+ "aria-expanded": m
4633
4633
  }), /* @__PURE__ */ createElement("span", {
4634
4634
  className: u.punctuation
4635
4635
  }, c), !l && /* @__PURE__ */ createElement("span", {
@@ -4782,15 +4782,15 @@ const ViewData = ({ data: o, fullView: n }) => {
4782
4782
  dataType: i,
4783
4783
  appliedBindings: c
4784
4784
  }) => {
4785
- const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [x, g] = useState(!1), _ = useMemo(() => o === "PROP" ? d.filter(
4786
- (b) => !includes(c, b) && get(p, `props.${first(split(b, "."))}.binding`)
4787
- ) : d.filter((b) => i === get(u, b, "")), [o, d, c, i, p]);
4785
+ const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, g = o === "PROP", [x, m] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
4786
+ (f) => !includes(c, f) && get(p, `props.${first(split(f, "."))}.binding`)
4787
+ ) : d.filter((f) => i === get(u, f, "")), [o, d, c, i, p]);
4788
4788
  return useEffect(() => {
4789
4789
  n && l(n);
4790
4790
  }, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4791
4791
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
4792
4792
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
4793
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: g, children: [
4793
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: m, children: [
4794
4794
  /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4795
4795
  Button,
4796
4796
  {
@@ -4799,7 +4799,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4799
4799
  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"}`,
4800
4800
  children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4801
4801
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "pr-8 text-sm", children: [
4802
- 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) }),
4802
+ 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) }),
4803
4803
  n
4804
4804
  ] }),
4805
4805
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
@@ -4813,29 +4813,29 @@ const ViewData = ({ data: o, fullView: n }) => {
4813
4813
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
4814
4814
  /* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
4815
4815
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
4816
- /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(_, (b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4816
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4817
4817
  CommandItem,
4818
4818
  {
4819
- value: b,
4820
- className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4821
- onSelect: (E) => {
4822
- r(find(_, (v) => v === E) || null), g(!1);
4819
+ value: f,
4820
+ className: `cursor-pointer ${g ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4821
+ onSelect: (j) => {
4822
+ r(find(E, (k) => k === j) || null), m(!1);
4823
4823
  },
4824
4824
  children: [
4825
4825
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
4826
- /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === b ? "" : "opacity-0"}` }),
4827
- b
4826
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === f ? "" : "opacity-0"}` }),
4827
+ f
4828
4828
  ] }),
4829
- 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, b, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, b) }) })
4829
+ 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, f, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, f) }) })
4830
4830
  ]
4831
4831
  },
4832
- b
4832
+ f
4833
4833
  )) })
4834
4834
  ] })
4835
4835
  ] }) })
4836
4836
  ] })
4837
4837
  ] }),
4838
- !m && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4838
+ !g && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4839
4839
  ] });
4840
4840
  }, AddBindingModalContent = ({
4841
4841
  appliedBindings: o = [],
@@ -4843,20 +4843,20 @@ const ViewData = ({ data: o, fullView: n }) => {
4843
4843
  editMode: r,
4844
4844
  item: a
4845
4845
  }) => {
4846
- const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
4847
- (_, b) => {
4848
- if (isEmpty(_))
4846
+ const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), g = useCallback(
4847
+ (E, f) => {
4848
+ if (isEmpty(E))
4849
4849
  return "";
4850
4850
  {
4851
- const E = get(b === "PROP" ? u : p, _, "");
4852
- if (isArray$1(E))
4851
+ const j = get(f === "PROP" ? u : p, E, "");
4852
+ if (isArray$1(j))
4853
4853
  return "list";
4854
- const v = typeof E;
4855
- return v === "string" ? "text" : v === "object" ? "model" : v;
4854
+ const k = typeof j;
4855
+ return k === "string" ? "text" : k === "object" ? "model" : k;
4856
4856
  }
4857
4857
  },
4858
4858
  [u, p]
4859
- ), [x, g] = useState(r ? m(a.key, "PROP") : "");
4859
+ ), [x, m] = useState(r ? g(a.key, "PROP") : "");
4860
4860
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4861
4861
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
4862
4862
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
@@ -4871,9 +4871,9 @@ const ViewData = ({ data: o, fullView: n }) => {
4871
4871
  placeholder: "Enter prop key",
4872
4872
  value: l,
4873
4873
  setValue: i,
4874
- onChange: (_) => {
4875
- const b = m(_, "PROP");
4876
- i(_), x !== b && d(""), g(b);
4874
+ onChange: (E) => {
4875
+ const f = g(E, "PROP");
4876
+ i(E), x !== f && d(""), m(f);
4877
4877
  },
4878
4878
  data: u,
4879
4879
  dataType: x,
@@ -4889,9 +4889,9 @@ const ViewData = ({ data: o, fullView: n }) => {
4889
4889
  placeholder: "Enter data path",
4890
4890
  value: c,
4891
4891
  setValue: d,
4892
- onChange: (_) => {
4893
- const b = m(_, "PATH");
4894
- d(x === b ? _ : "");
4892
+ onChange: (E) => {
4893
+ const f = g(E, "PATH");
4894
+ d(x === f ? E : "");
4895
4895
  },
4896
4896
  data: p,
4897
4897
  dataType: x,
@@ -4934,15 +4934,15 @@ const ViewData = ({ data: o, fullView: n }) => {
4934
4934
  dataProvider: l,
4935
4935
  appliedBindings: i
4936
4936
  }) => {
4937
- const [c, d] = useState("string"), u = (p, m) => {
4937
+ const [c, d] = useState("string"), u = (p, g) => {
4938
4938
  if (isEmpty(p))
4939
4939
  return "";
4940
4940
  {
4941
- const x = get(m === "PROP" ? a : l, p, "");
4941
+ const x = get(g === "PROP" ? a : l, p, "");
4942
4942
  if (isArray$1(x))
4943
4943
  return "list";
4944
- const g = typeof x;
4945
- return g === "string" ? "text" : g === "object" ? "model" : g;
4944
+ const m = typeof x;
4945
+ return m === "string" ? "text" : m === "object" ? "model" : m;
4946
4946
  }
4947
4947
  };
4948
4948
  return useEffect(() => d(() => u(o.key, "PROP")), [o.key]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col rounded-md border border-border p-2", children: [
@@ -4963,10 +4963,10 @@ const ViewData = ({ data: o, fullView: n }) => {
4963
4963
  ] });
4964
4964
  }, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
4965
4965
  const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
4966
- map(o, (x, g) => ({ key: g, value: x }))
4966
+ map(o, (x, m) => ({ key: m, value: x }))
4967
4967
  );
4968
4968
  useEffect(() => {
4969
- c(map(o, (x, g) => ({ key: g, value: x })));
4969
+ c(map(o, (x, m) => ({ key: m, value: x })));
4970
4970
  }, [r == null ? void 0 : r._id, o]);
4971
4971
  const d = useMemo(() => {
4972
4972
  if (isEmpty(a))
@@ -4976,21 +4976,21 @@ const ViewData = ({ data: o, fullView: n }) => {
4976
4976
  const x = last(i);
4977
4977
  return isEmpty(x == null ? void 0 : x.key) || isEmpty(x == null ? void 0 : x.value);
4978
4978
  }, [a, i]), u = (x) => {
4979
- const g = filter(i, (_) => _.key !== x.key);
4980
- c([...g, x]), m([...g, x]);
4979
+ const m = filter(i, (E) => E.key !== x.key);
4980
+ c([...m, x]), g([...m, x]);
4981
4981
  }, p = (x) => {
4982
- const g = filter(i, (_, b) => x !== b);
4983
- m([...g]);
4984
- }, m = useCallback(
4982
+ const m = filter(i, (E, f) => x !== f);
4983
+ g([...m]);
4984
+ }, g = useCallback(
4985
4985
  (x = []) => {
4986
4986
  if (c(x), isEmpty(x)) {
4987
4987
  n({});
4988
4988
  return;
4989
4989
  }
4990
- const g = {};
4991
- forEach(x, (_) => {
4992
- !isEmpty(_ == null ? void 0 : _.key) && !isEmpty(_ == null ? void 0 : _.value) && set(g, _.key, _.value);
4993
- }), n(g);
4990
+ const m = {};
4991
+ forEach(x, (E) => {
4992
+ !isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(m, E.key, E.value);
4993
+ }), n(m);
4994
4994
  },
4995
4995
  [n]
4996
4996
  );
@@ -4999,12 +4999,12 @@ const ViewData = ({ data: o, fullView: n }) => {
4999
4999
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
5000
5000
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
5001
5001
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
5002
- map(i, (x, g) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5002
+ map(i, (x, m) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5003
5003
  NewDataBindingPair,
5004
5004
  {
5005
5005
  item: x,
5006
5006
  onAddBinding: u,
5007
- onRemove: () => p(g),
5007
+ onRemove: () => p(m),
5008
5008
  selectedBlock: r,
5009
5009
  dataProvider: a,
5010
5010
  appliedBindings: map(i, "key")
@@ -5098,7 +5098,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5098
5098
  }
5099
5099
  )
5100
5100
  ] });
5101
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-Pchz4LmI.js")), UploadImages = React__default.lazy(() => import("./UploadImages-9dzylU64.js")), ImagesPanel = ({
5101
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-LYK9w6rM.js")), UploadImages = React__default.lazy(() => import("./UploadImages-D5RhqXgu.js")), ImagesPanel = ({
5102
5102
  isModalView: o = !1,
5103
5103
  onSelect: n = () => {
5104
5104
  }
@@ -5256,18 +5256,18 @@ const ViewData = ({ data: o, fullView: n }) => {
5256
5256
  ] });
5257
5257
  }, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
5258
5258
  const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation();
5259
- Object.keys(n).forEach((m) => {
5260
- const x = n[m];
5259
+ Object.keys(n).forEach((g) => {
5260
+ const x = n[g];
5261
5261
  if (includes(["slot", "styles"], x.type))
5262
5262
  return;
5263
- const g = m;
5264
- c.properties[g] = getBlockJSONFromSchemas(x, u), d[g] = getBlockJSONFromUISchemas(x);
5263
+ const m = g;
5264
+ c.properties[m] = getBlockJSONFromSchemas(x, u), d[m] = getBlockJSONFromUISchemas(x);
5265
5265
  }), useEffect(() => {
5266
5266
  i(r);
5267
5267
  }, [o]);
5268
5268
  const p = useThrottledCallback(
5269
- async ({ formData: m }, x) => {
5270
- a({ formData: m }, x);
5269
+ async ({ formData: g }, x) => {
5270
+ a({ formData: g }, x);
5271
5271
  },
5272
5272
  [a],
5273
5273
  1e3
@@ -5293,8 +5293,8 @@ const ViewData = ({ data: o, fullView: n }) => {
5293
5293
  uiSchema: d,
5294
5294
  schema: c,
5295
5295
  formData: l,
5296
- onChange: ({ formData: m }, x) => {
5297
- x && (i(m), p({ formData: m }, x));
5296
+ onChange: ({ formData: g }, x) => {
5297
+ x && (i(g), p({ formData: g }, x));
5298
5298
  }
5299
5299
  }
5300
5300
  );
@@ -5358,30 +5358,30 @@ const ViewData = ({ data: o, fullView: n }) => {
5358
5358
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "outline", onClick: () => r(o), children: n("Reload") });
5359
5359
  };
5360
5360
  function BlockSettings() {
5361
- const o = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), r = useUpdateBlocksProps(), a = getBlockComponent(o == null ? void 0 : o._type), l = { ...o }, [i, c] = useState(l), d = useBuilderProp("dataBindingSupport", !1), u = ({ formData: b }, E, v) => {
5362
- if (E && (i == null ? void 0 : i._id) === o._id) {
5363
- const B = E.replace("root.", "");
5364
- r([o._id], { [B]: get(b, B) }, v);
5361
+ const o = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), r = useUpdateBlocksProps(), a = getBlockComponent(o == null ? void 0 : o._type), l = { ...o }, [i, c] = useState(l), d = useBuilderProp("dataBindingSupport", !1), u = ({ formData: f }, j, k) => {
5362
+ if (j && (i == null ? void 0 : i._id) === o._id) {
5363
+ const A = j.replace("root.", "");
5364
+ r([o._id], { [A]: get(f, A) }, k);
5365
5365
  }
5366
5366
  }, p = useCallback(
5367
- debounce(({ formData: b }, E, v) => {
5368
- u({ formData: b }, E, v), c(b);
5367
+ debounce(({ formData: f }, j, k) => {
5368
+ u({ formData: f }, j, k), c(f);
5369
5369
  }, 1500),
5370
5370
  [o == null ? void 0 : o._id]
5371
- ), m = ({ formData: b }, E) => {
5372
- if (E) {
5373
- const v = E.replace("root.", "");
5371
+ ), g = ({ formData: f }, j) => {
5372
+ if (j) {
5373
+ const k = j.replace("root.", "");
5374
5374
  n(
5375
5375
  [o._id],
5376
- convertDotNotationToObject(v, get(b, v.split(".")))
5377
- ), p({ formData: b }, E, { [v]: get(i, v) });
5376
+ convertDotNotationToObject(k, get(f, k.split(".")))
5377
+ ), p({ formData: f }, j, { [k]: get(i, k) });
5378
5378
  }
5379
- }, x = keys(get(l, "_bindings", {})), g = useMemo(() => {
5380
- const b = cloneDeep(get(a, "props", {}));
5381
- return each(b, (E, v) => {
5382
- get(E, "hidden", !1) && delete b[v];
5383
- }), d && each(x, (E) => delete b[E]), b;
5384
- }, [a, x, d]), _ = get(a, "server", !1);
5379
+ }, x = keys(get(l, "_bindings", {})), m = useMemo(() => {
5380
+ const f = cloneDeep(get(a, "props", {}));
5381
+ return each(f, (j, k) => {
5382
+ get(j, "hidden", !1) && delete f[k];
5383
+ }), d && each(x, (j) => delete f[j]), f;
5384
+ }, [a, x, d]), E = get(a, "server", !1);
5385
5385
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
5386
5386
  d ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5387
5387
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
@@ -5398,8 +5398,8 @@ function BlockSettings() {
5398
5398
  DataBindingSetting$1,
5399
5399
  {
5400
5400
  bindingData: get(o, "_bindings", {}),
5401
- onChange: (b) => {
5402
- u({ formData: { _bindings: b } }, "root._bindings");
5401
+ onChange: (f) => {
5402
+ u({ formData: { _bindings: f } }, "root._bindings");
5403
5403
  }
5404
5404
  }
5405
5405
  ) })
@@ -5421,24 +5421,24 @@ function BlockSettings() {
5421
5421
  JSONForm,
5422
5422
  {
5423
5423
  id: o == null ? void 0 : o._id,
5424
- onChange: m,
5424
+ onChange: g,
5425
5425
  formData: l,
5426
- properties: g
5426
+ properties: m
5427
5427
  }
5428
5428
  )
5429
5429
  ] })
5430
5430
  ] })
5431
- ] }) : isEmpty(g) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5431
+ ] }) : isEmpty(m) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5432
5432
  JSONForm,
5433
5433
  {
5434
5434
  id: o == null ? void 0 : o._id,
5435
- onChange: m,
5435
+ onChange: g,
5436
5436
  formData: l,
5437
- properties: g
5437
+ properties: m
5438
5438
  }
5439
5439
  ),
5440
5440
  (o == null ? void 0 : o._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
5441
- _ ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: o == null ? void 0 : o._id }) : null,
5441
+ E ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: o == null ? void 0 : o._id }) : null,
5442
5442
  /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
5443
5443
  ] });
5444
5444
  }
@@ -5456,20 +5456,20 @@ const getBlockWithChildren = (o, n) => {
5456
5456
  const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore();
5457
5457
  return {
5458
5458
  askAi: useCallback(
5459
- async (u, p, m, x) => {
5459
+ async (u, p, g, x) => {
5460
5460
  if (l) {
5461
5461
  n(!0), a(null);
5462
5462
  try {
5463
- const g = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((v) => v._id === p))];
5464
- set(g, "0._parent", null);
5465
- const _ = await l(u, m, g), { blocks: b, error: E } = _;
5466
- if (E) {
5467
- a(E);
5463
+ const m = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((k) => k._id === p))];
5464
+ set(m, "0._parent", null);
5465
+ const E = await l(u, g, m), { blocks: f, error: j } = E;
5466
+ if (j) {
5467
+ a(j);
5468
5468
  return;
5469
5469
  }
5470
- u === "styles" ? c(b) : i(b), x && x(_);
5471
- } catch (g) {
5472
- a(g);
5470
+ u === "styles" ? c(f) : i(f), x && x(E);
5471
+ } catch (m) {
5472
+ a(m);
5473
5473
  } finally {
5474
5474
  n(!1), x && x();
5475
5475
  }
@@ -5543,14 +5543,14 @@ function Countdown() {
5543
5543
  ] });
5544
5544
  }
5545
5545
  const AskAIStyles = ({ blockId: o }) => {
5546
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
5546
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, g] = useState();
5547
5547
  useEffect(() => {
5548
- var g;
5549
- (g = d.current) == null || g.focus();
5548
+ var m;
5549
+ (m = d.current) == null || m.focus();
5550
5550
  }, []);
5551
- const x = (g) => {
5552
- const { usage: _ } = g || {};
5553
- !l && _ && m(_), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
5551
+ const x = (m) => {
5552
+ const { usage: E } = m || {};
5553
+ !l && E && g(E), u.current = setTimeout(() => g(void 0), 1e4), l || c("");
5554
5554
  };
5555
5555
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5556
5556
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
@@ -5559,12 +5559,12 @@ const AskAIStyles = ({ blockId: o }) => {
5559
5559
  {
5560
5560
  ref: d,
5561
5561
  value: i,
5562
- onChange: (g) => c(g.target.value),
5562
+ onChange: (m) => c(m.target.value),
5563
5563
  placeholder: n("ask_ai_to_edit_styles"),
5564
5564
  className: "w-full border border-border focus:border-0",
5565
5565
  rows: 3,
5566
- onKeyDown: (g) => {
5567
- g.key === "Enter" && (g.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x));
5566
+ onKeyDown: (m) => {
5567
+ m.key === "Enter" && (m.preventDefault(), u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, x));
5568
5568
  }
5569
5569
  }
5570
5570
  ),
@@ -5574,7 +5574,7 @@ const AskAIStyles = ({ blockId: o }) => {
5574
5574
  {
5575
5575
  disabled: i.trim().length < 5 || a,
5576
5576
  onClick: () => {
5577
- u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x);
5577
+ u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, x);
5578
5578
  },
5579
5579
  variant: "default",
5580
5580
  className: "w-fit",
@@ -5610,37 +5610,37 @@ const AskAIStyles = ({ blockId: o }) => {
5610
5610
  keys: ["name"]
5611
5611
  });
5612
5612
  function ManualClasses() {
5613
- var A;
5614
- const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (A = first(n)) == null ? void 0 : A.prop, x = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
5615
- const T = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5616
- a(i, T, !0), u("");
5617
- }, [_, b] = useState([]), E = ({ value: T }) => {
5618
- const P = T.trim().toLowerCase(), L = P.match(/.+:/g);
5619
- let j = [];
5620
- if (L && L.length > 0) {
5621
- const [k] = L, S = P.replace(k, "");
5622
- j = fuse.search(S).map((N) => ({
5623
- ...N,
5624
- item: { ...N.item, name: k + N.item.name }
5613
+ var w;
5614
+ 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 = (w = first(n)) == null ? void 0 : w.prop, x = reject((get(r, g, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), m = () => {
5615
+ const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5616
+ a(i, N, !0), u("");
5617
+ }, [E, f] = useState([]), j = ({ value: N }) => {
5618
+ const D = N.trim().toLowerCase(), T = D.match(/.+:/g);
5619
+ let b = [];
5620
+ if (T && T.length > 0) {
5621
+ const [_] = T, R = D.replace(_, "");
5622
+ b = fuse.search(R).map((I) => ({
5623
+ ...I,
5624
+ item: { ...I.item, name: _ + I.item.name }
5625
5625
  }));
5626
5626
  } else
5627
- j = fuse.search(P);
5628
- return b(map(j, "item"));
5629
- }, v = () => {
5630
- b([]);
5631
- }, B = (T) => T.name, C = (T) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: T.name }), I = {
5627
+ b = fuse.search(D);
5628
+ return f(map(b, "item"));
5629
+ }, k = () => {
5630
+ f([]);
5631
+ }, A = (N) => N.name, S = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5632
5632
  autoComplete: "off",
5633
5633
  autoCorrect: "off",
5634
5634
  autoCapitalize: "off",
5635
5635
  spellCheck: !1,
5636
5636
  placeholder: o("enter_classes_separated_by_space"),
5637
5637
  value: d,
5638
- onKeyDown: (T) => {
5639
- T.key === "Enter" && d.trim() !== "" && g();
5638
+ onKeyDown: (N) => {
5639
+ N.key === "Enter" && d.trim() !== "" && m();
5640
5640
  },
5641
- onChange: (T, { newValue: P }) => u(P),
5641
+ onChange: (N, { newValue: D }) => u(D),
5642
5642
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5643
- }, w = () => {
5643
+ }, C = () => {
5644
5644
  if (navigator.clipboard === void 0) {
5645
5645
  p({
5646
5646
  title: o("clipboard_not_supported"),
@@ -5657,13 +5657,13 @@ function ManualClasses() {
5657
5657
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
5658
5658
  "div",
5659
5659
  {
5660
- className: `flex ${_.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
5660
+ className: `flex ${E.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
5661
5661
  children: [
5662
5662
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
5663
5663
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5664
5664
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
5665
5665
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
5666
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: w, className: "cursor-pointer" }) }),
5666
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: C, className: "cursor-pointer" }) }),
5667
5667
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("copy_classes_to_clipboard") }) })
5668
5668
  ] })
5669
5669
  ] }),
@@ -5679,12 +5679,12 @@ function ManualClasses() {
5679
5679
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5680
5680
  Autosuggest,
5681
5681
  {
5682
- suggestions: _,
5683
- onSuggestionsFetchRequested: E,
5684
- onSuggestionsClearRequested: v,
5685
- getSuggestionValue: B,
5686
- renderSuggestion: C,
5687
- inputProps: I,
5682
+ suggestions: E,
5683
+ onSuggestionsFetchRequested: j,
5684
+ onSuggestionsClearRequested: k,
5685
+ getSuggestionValue: A,
5686
+ renderSuggestion: S,
5687
+ inputProps: B,
5688
5688
  containerProps: {
5689
5689
  className: "relative h-8 w-full gap-y-1 py-1 border-border"
5690
5690
  },
@@ -5700,7 +5700,7 @@ function ManualClasses() {
5700
5700
  {
5701
5701
  variant: "outline",
5702
5702
  className: "h-6 border-border",
5703
- onClick: g,
5703
+ onClick: m,
5704
5704
  disabled: d.trim() === "",
5705
5705
  size: "sm",
5706
5706
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
@@ -5708,22 +5708,22 @@ function ManualClasses() {
5708
5708
  )
5709
5709
  ] }),
5710
5710
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
5711
- x.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5711
+ x.map((N) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5712
5712
  "div",
5713
5713
  {
5714
5714
  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",
5715
5715
  children: [
5716
- T,
5716
+ N,
5717
5717
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5718
5718
  Cross2Icon,
5719
5719
  {
5720
- onClick: () => l(i, [T]),
5720
+ onClick: () => l(i, [N]),
5721
5721
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
5722
5722
  }
5723
5723
  )
5724
5724
  ]
5725
5725
  },
5726
- T
5726
+ N
5727
5727
  ))
5728
5728
  ) })
5729
5729
  ]
@@ -6114,38 +6114,38 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6114
6114
  ringColor: "ring",
6115
6115
  ringOffsetColor: "ring-offset"
6116
6116
  }, ColorChoice = ({ property: o, onChange: n }) => {
6117
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), x = get(p, "2", ""), g = useCallback(
6117
+ 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", ""), x = get(p, "2", ""), m = useCallback(
6118
6118
  // eslint-disable-next-line no-shadow
6119
- (b) => {
6120
- ["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), u({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((E) => ({ ...E, color: b, shade: E.shade ? E.shade : "500" })));
6119
+ (f) => {
6120
+ ["current", "inherit", "transparent", "black", "white"].includes(f) ? (c([]), u({ color: f })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((j) => ({ ...j, color: f, shade: j.shade ? j.shade : "500" })));
6121
6121
  },
6122
6122
  [c, u]
6123
6123
  );
6124
6124
  useEffect(() => {
6125
- if (["current", "inherit", "transparent", "black", "white"].includes(m))
6125
+ if (["current", "inherit", "transparent", "black", "white"].includes(g))
6126
6126
  return c([]);
6127
6127
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
6128
- }, [m]);
6129
- const _ = useCallback(
6128
+ }, [g]);
6129
+ const E = useCallback(
6130
6130
  // eslint-disable-next-line no-shadow
6131
- (b) => {
6132
- u({ color: m, shade: b });
6131
+ (f) => {
6132
+ u({ color: g, shade: f });
6133
6133
  },
6134
- [m]
6134
+ [g]
6135
6135
  );
6136
6136
  return useEffect(() => {
6137
6137
  u({ color: "", shade: "" });
6138
6138
  }, [r]), useEffect(() => {
6139
- const E = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6140
- E.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(E, o);
6139
+ const j = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6140
+ j.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(j, o);
6141
6141
  }, [d, n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
6142
6142
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6143
6143
  DropDown,
6144
6144
  {
6145
6145
  disabled: !l,
6146
6146
  rounded: !0,
6147
- selected: m,
6148
- onChange: g,
6147
+ selected: g,
6148
+ onChange: m,
6149
6149
  options: [
6150
6150
  "current",
6151
6151
  "transparent",
@@ -6178,7 +6178,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6178
6178
  ]
6179
6179
  }
6180
6180
  ) }),
6181
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !m || !l, onChange: _, options: i }) })
6181
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !g || !l, onChange: E, options: i }) })
6182
6182
  ] });
6183
6183
  }, getUserInputValues = (o, n) => {
6184
6184
  o = o.toLowerCase();
@@ -6373,50 +6373,50 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6373
6373
  },
6374
6374
  a
6375
6375
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6376
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [x, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [_, b] = useState(!1), [E, v] = useState(""), [B, C] = useState(!1), [I, w] = useState(!1);
6376
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [x, m] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, f] = useState(!1), [j, k] = useState(""), [A, S] = useState(!1), [B, C] = useState(!1);
6377
6377
  useEffect(() => {
6378
- const { value: j, unit: k } = getClassValueAndUnit(i);
6379
- if (k === "") {
6380
- l(j), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6378
+ const { value: b, unit: _ } = getClassValueAndUnit(i);
6379
+ if (_ === "") {
6380
+ l(b), m(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6381
6381
  return;
6382
6382
  }
6383
- g(k), l(k === "class" || isEmpty(j) ? "" : j);
6383
+ m(_), l(_ === "class" || isEmpty(b) ? "" : b);
6384
6384
  }, [i, u, p]);
6385
- const A = useThrottledCallback((j) => c(j), [c], THROTTLE_TIME), T = useThrottledCallback((j) => c(j, !1), [c], THROTTLE_TIME), P = useCallback(
6386
- (j = !1) => {
6387
- const k = getUserInputValues(`${a}`, p);
6388
- if (get(k, "error", !1)) {
6389
- b(!0);
6385
+ const w = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), N = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), D = useCallback(
6386
+ (b = !1) => {
6387
+ const _ = getUserInputValues(`${a}`, p);
6388
+ if (get(_, "error", !1)) {
6389
+ f(!0);
6390
6390
  return;
6391
6391
  }
6392
- const S = get(k, "unit") !== "" ? get(k, "unit") : x;
6393
- if (S === "auto" || S === "none") {
6394
- A(`${d}${S}`);
6392
+ const R = get(_, "unit") !== "" ? get(_, "unit") : x;
6393
+ if (R === "auto" || R === "none") {
6394
+ w(`${d}${R}`);
6395
6395
  return;
6396
6396
  }
6397
- if (get(k, "value") === "")
6397
+ if (get(_, "value") === "")
6398
6398
  return;
6399
- const N = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
6400
- j ? T(N) : A(N);
6399
+ const I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6400
+ b ? N(I) : w(I);
6401
6401
  },
6402
- [A, T, a, x, d, p]
6403
- ), L = useCallback(
6404
- (j) => {
6405
- const k = getUserInputValues(`${a}`, p);
6406
- if (get(k, "error", !1)) {
6407
- b(!0);
6402
+ [w, N, a, x, d, p]
6403
+ ), T = useCallback(
6404
+ (b) => {
6405
+ const _ = getUserInputValues(`${a}`, p);
6406
+ if (get(_, "error", !1)) {
6407
+ f(!0);
6408
6408
  return;
6409
6409
  }
6410
- if (j === "auto" || j === "none") {
6411
- A(`${d}${j}`);
6410
+ if (b === "auto" || b === "none") {
6411
+ w(`${d}${b}`);
6412
6412
  return;
6413
6413
  }
6414
- if (get(k, "value") === "")
6414
+ if (get(_, "value") === "")
6415
6415
  return;
6416
- const S = get(k, "unit") !== "" ? get(k, "unit") : j, N = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
6417
- A(N);
6416
+ const R = get(_, "unit") !== "" ? get(_, "unit") : b, I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6417
+ w(I);
6418
6418
  },
6419
- [A, a, d, p]
6419
+ [w, a, d, p]
6420
6420
  );
6421
6421
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: x === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6422
6422
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
@@ -6424,40 +6424,40 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6424
6424
  /* @__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, {}) }) }),
6425
6425
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6426
6426
  ] })
6427
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${B ? "z-auto" : ""}`, children: [
6427
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${A ? "z-auto" : ""}`, children: [
6428
6428
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6429
6429
  ["none", "auto"].indexOf(x) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6430
6430
  "input",
6431
6431
  {
6432
6432
  readOnly: x === "class",
6433
- onKeyPress: (j) => {
6434
- j.key === "Enter" && P();
6433
+ onKeyPress: (b) => {
6434
+ b.key === "Enter" && D();
6435
6435
  },
6436
- onKeyDown: (j) => {
6437
- if (j.keyCode !== 38 && j.keyCode !== 40)
6436
+ onKeyDown: (b) => {
6437
+ if (b.keyCode !== 38 && b.keyCode !== 40)
6438
6438
  return;
6439
- j.preventDefault(), w(!0);
6440
- const k = parseInt$1(j.target.value);
6441
- let S = isNaN$1(k) ? 0 : k;
6442
- j.keyCode === 38 && (S += 1), j.keyCode === 40 && (S -= 1);
6443
- const R = `${S}`, D = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
6444
- T(D);
6439
+ b.preventDefault(), C(!0);
6440
+ const _ = parseInt$1(b.target.value);
6441
+ let R = isNaN$1(_) ? 0 : _;
6442
+ b.keyCode === 38 && (R += 1), b.keyCode === 40 && (R -= 1);
6443
+ const v = `${R}`, L = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${x === "-" ? "" : x}]`;
6444
+ N(L);
6445
6445
  },
6446
- onKeyUp: (j) => {
6447
- I && (j.preventDefault(), w(!1));
6446
+ onKeyUp: (b) => {
6447
+ B && (b.preventDefault(), C(!1));
6448
6448
  },
6449
- onBlur: () => P(),
6450
- onChange: (j) => {
6451
- b(!1), l(j.target.value);
6449
+ onBlur: () => D(),
6450
+ onChange: (b) => {
6451
+ f(!1), l(b.target.value);
6452
6452
  },
6453
- onClick: (j) => {
6454
- var k;
6455
- (k = j == null ? void 0 : j.target) == null || k.select(), r(!1);
6453
+ onClick: (b) => {
6454
+ var _;
6455
+ (_ = b == null ? void 0 : b.target) == null || _.select(), r(!1);
6456
6456
  },
6457
- value: B ? E : a,
6457
+ value: A ? j : a,
6458
6458
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6459
6459
  " ",
6460
- _ ? "border-red-500 text-red-500" : "border-foreground/20"
6460
+ E ? "border-red-500 text-red-500" : "border-foreground/20"
6461
6461
  )
6462
6462
  }
6463
6463
  ),
@@ -6479,33 +6479,33 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6479
6479
  {
6480
6480
  units: p,
6481
6481
  current: x,
6482
- onSelect: (j) => {
6483
- r(!1), g(j), L(j);
6482
+ onSelect: (b) => {
6483
+ r(!1), m(b), T(b);
6484
6484
  }
6485
6485
  }
6486
6486
  ) }) })
6487
6487
  ] })
6488
6488
  ] }),
6489
- ["none", "auto"].indexOf(x) !== -1 || B ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6489
+ ["none", "auto"].indexOf(x) !== -1 || A ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6490
6490
  DragStyleButton,
6491
6491
  {
6492
- onDragStart: () => C(!0),
6493
- onDragEnd: (j) => {
6494
- if (v(() => ""), C(!1), isEmpty(j))
6492
+ onDragStart: () => S(!0),
6493
+ onDragEnd: (b) => {
6494
+ if (k(() => ""), S(!1), isEmpty(b))
6495
6495
  return;
6496
- const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6497
- A(R);
6496
+ const _ = `${b}`, v = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${x === "-" ? "" : x}]`;
6497
+ w(v);
6498
6498
  },
6499
- onDrag: (j) => {
6500
- if (isEmpty(j))
6499
+ onDrag: (b) => {
6500
+ if (isEmpty(b))
6501
6501
  return;
6502
- v(j);
6503
- const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6504
- T(R);
6502
+ k(b);
6503
+ const _ = `${b}`, v = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${x === "-" ? "" : x}]`;
6504
+ N(v);
6505
6505
  },
6506
6506
  currentValue: a,
6507
6507
  unit: x,
6508
- negative: m,
6508
+ negative: g,
6509
6509
  cssProperty: u
6510
6510
  }
6511
6511
  )
@@ -6598,35 +6598,35 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6598
6598
  "2xl": "1536px"
6599
6599
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6600
6600
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6601
- }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), _ = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), E = useMemo(() => get(x, "fullCls", ""), [x]), v = useCallback(
6602
- (T, P = !0) => {
6603
- const L = { dark: u, mq: m, mod: p, cls: T, property: l, fullCls: "" };
6604
- (u || p !== "") && (L.mq = "xs");
6605
- const j = generateFullClsName(L);
6606
- g(b, [j], P);
6601
+ }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useCanvasWidth(), x = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), j = useMemo(() => get(x, "fullCls", ""), [x]), k = useCallback(
6602
+ (N, D = !0) => {
6603
+ const T = { dark: u, mq: g, mod: p, cls: N, property: l, fullCls: "" };
6604
+ (u || p !== "") && (T.mq = "xs");
6605
+ const b = generateFullClsName(T);
6606
+ m(f, [b], D);
6607
6607
  },
6608
- [b, u, m, p, l, g]
6609
- ), B = useCallback(() => {
6610
- _(b, [E]);
6611
- }, [b, E, _]), C = useMemo(() => canChangeClass(x, m), [x, m]);
6608
+ [f, u, g, p, l, m]
6609
+ ), A = useCallback(() => {
6610
+ E(f, [j]);
6611
+ }, [f, j, E]), S = useMemo(() => canChangeClass(x, g), [x, g]);
6612
6612
  useEffect(() => {
6613
- i(C, x);
6614
- }, [C, i, x]);
6615
- const [, , I] = useCanvasWidth(), w = useCallback(
6616
- (T) => {
6617
- I({
6613
+ i(S, x);
6614
+ }, [S, i, x]);
6615
+ const [, , B] = useCanvasWidth(), C = useCallback(
6616
+ (N) => {
6617
+ B({
6618
6618
  xs: 400,
6619
6619
  sm: 640,
6620
6620
  md: 800,
6621
6621
  lg: 1024,
6622
6622
  xl: 1420,
6623
6623
  "2xl": 1920
6624
- }[T]);
6624
+ }[N]);
6625
6625
  },
6626
- [I]
6627
- ), A = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === m;
6628
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: x && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6629
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !A ? "text-foreground" : ""}`, children: n(a) }) }),
6626
+ [B]
6627
+ ), w = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === g;
6628
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && w, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6629
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !w ? "text-foreground" : ""}`, children: n(a) }) }),
6630
6630
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6631
6631
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
6632
6632
  r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -6635,17 +6635,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6635
6635
  currentClass: get(x, "cls", ""),
6636
6636
  classPrefix: get(CLASS_PREFIXES, l, ""),
6637
6637
  units: c || [],
6638
- onChange: v,
6638
+ onChange: k,
6639
6639
  negative: d,
6640
6640
  cssProperty: l
6641
6641
  }
6642
6642
  ) : null,
6643
- r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: v }),
6644
- r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: v }),
6645
- r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: v }),
6646
- r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: v })
6643
+ r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: k }),
6644
+ r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: k }),
6645
+ r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
6646
+ r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
6647
6647
  ] }),
6648
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${E ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => B(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : C && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6648
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${j ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : S && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6649
6649
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6650
6650
  "button",
6651
6651
  {
@@ -6665,7 +6665,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6665
6665
  "button",
6666
6666
  {
6667
6667
  type: "button",
6668
- onClick: () => w(get(x, "mq")),
6668
+ onClick: () => C(get(x, "mq")),
6669
6669
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6670
6670
  children: [
6671
6671
  "Switch to ",
@@ -6686,7 +6686,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6686
6686
  units: i = basicUnits,
6687
6687
  negative: c = !1
6688
6688
  }) => {
6689
- const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), x = useCallback((g) => map(m, "property").includes(g), [m]);
6689
+ const { t: d } = useTranslation(), [u, p] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), x = useCallback((m) => map(g, "property").includes(m), [g]);
6690
6690
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6691
6691
  "div",
6692
6692
  {
@@ -6695,22 +6695,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6695
6695
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
6696
6696
  o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
6697
6697
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
6698
- n.map(({ label: g, key: _ }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6698
+ n.map(({ label: m, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6699
6699
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
6700
6700
  "button",
6701
6701
  {
6702
6702
  type: "button",
6703
- onClick: () => p(_),
6704
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${_ === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6703
+ onClick: () => p(E),
6704
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${E === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6705
6705
  children: [
6706
6706
  React__default.createElement("div", {
6707
- className: x(_) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6707
+ className: x(E) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6708
6708
  }),
6709
- React__default.createElement(get(EDITOR_ICONS, _, BoxIcon), { className: "text-inherit w-3 h-3" })
6709
+ React__default.createElement(get(EDITOR_ICONS, E, BoxIcon), { className: "text-inherit w-3 h-3" })
6710
6710
  ]
6711
6711
  }
6712
6712
  ) }),
6713
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(g)) })
6713
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(m)) })
6714
6714
  ] }) }))
6715
6715
  ) })
6716
6716
  ] }),
@@ -6775,8 +6775,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6775
6775
  if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
6776
6776
  return null;
6777
6777
  const u = (p) => {
6778
- const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6779
- l([o._id], m, !0);
6778
+ const g = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6779
+ l([o._id], g, !0);
6780
6780
  };
6781
6781
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
6782
6782
  /* @__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: [
@@ -6830,13 +6830,13 @@ function BlockStyling() {
6830
6830
  cssProperty: ""
6831
6831
  }), d = useThrottledCallback(
6832
6832
  (p) => {
6833
- const m = !get(i, "negative", !1), x = get(i, "cssProperty", "");
6834
- let g = parseFloat(i.dragStartValue);
6835
- g = isNaN(g) ? 0 : g;
6836
- let _ = MAPPER[i.dragUnit];
6837
- (startsWith(x, "scale") || x === "opacity") && (_ = 10);
6838
- let E = (i.dragStartY - p.pageY) / _ + g;
6839
- m && E < 0 && (E = 0), x === "opacity" && E > 1 && (E = 1), i.onDrag(`${E}`), l(`${E}`);
6833
+ const g = !get(i, "negative", !1), x = get(i, "cssProperty", "");
6834
+ let m = parseFloat(i.dragStartValue);
6835
+ m = isNaN(m) ? 0 : m;
6836
+ let E = MAPPER[i.dragUnit];
6837
+ (startsWith(x, "scale") || x === "opacity") && (E = 10);
6838
+ let j = (i.dragStartY - p.pageY) / E + m;
6839
+ g && j < 0 && (j = 0), x === "opacity" && j > 1 && (j = 1), i.onDrag(`${j}`), l(`${j}`);
6840
6840
  },
6841
6841
  [i],
6842
6842
  50
@@ -6922,33 +6922,33 @@ const BlockCard = ({
6922
6922
  library: n,
6923
6923
  parentId: r = void 0
6924
6924
  }) => {
6925
- const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), m = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), _ = (v) => {
6926
- const B = has(v, "styles_attrs.data-page-section");
6927
- return v._type === "Box" && B;
6928
- }, b = useCallback(
6929
- async (v) => {
6930
- if (v.stopPropagation(), has(o, "component")) {
6925
+ const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), g = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, m] = useAtom$1(draggedBlockAtom), E = (k) => {
6926
+ const A = has(k, "styles_attrs.data-page-section");
6927
+ return k._type === "Box" && A;
6928
+ }, f = useCallback(
6929
+ async (k) => {
6930
+ if (k.stopPropagation(), has(o, "component")) {
6931
6931
  c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6932
6932
  return;
6933
6933
  }
6934
6934
  l(!0);
6935
- const B = await i(n, o);
6936
- isEmpty(B) || d(syncBlocksWithDefaults(B), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6935
+ const A = await i(n, o);
6936
+ isEmpty(A) || d(syncBlocksWithDefaults(A), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6937
6937
  },
6938
6938
  [o]
6939
- ), E = async (v) => {
6940
- const B = await i(n, o);
6941
- let C = r;
6942
- if (_(first(B)) && (C = null), !isEmpty(B)) {
6943
- const I = { blocks: B, uiLibrary: !0, parent: C };
6944
- if (v.dataTransfer.setData("text/plain", JSON.stringify(I)), o.preview) {
6945
- const w = new Image();
6946
- w.src = o.preview, w.onload = () => {
6947
- v.dataTransfer.setDragImage(w, 0, 0);
6939
+ ), j = async (k) => {
6940
+ const A = await i(n, o);
6941
+ let S = r;
6942
+ if (E(first(A)) && (S = null), !isEmpty(A)) {
6943
+ const B = { blocks: A, uiLibrary: !0, parent: S };
6944
+ if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
6945
+ const C = new Image();
6946
+ C.src = o.preview, C.onload = () => {
6947
+ k.dataTransfer.setDragImage(C, 0, 0);
6948
6948
  };
6949
6949
  } else
6950
- v.dataTransfer.setDragImage(new Image(), 0, 0);
6951
- g(I), setTimeout(() => {
6950
+ k.dataTransfer.setDragImage(new Image(), 0, 0);
6951
+ m(B), setTimeout(() => {
6952
6952
  u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6953
6953
  }, 200);
6954
6954
  }
@@ -6958,9 +6958,9 @@ const BlockCard = ({
6958
6958
  "div",
6959
6959
  {
6960
6960
  onClick: a ? () => {
6961
- } : b,
6961
+ } : f,
6962
6962
  draggable: x ? "true" : "false",
6963
- onDragStart: E,
6963
+ onDragStart: j,
6964
6964
  className: clsx(
6965
6965
  "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
6966
6966
  ),
@@ -6969,11 +6969,11 @@ const BlockCard = ({
6969
6969
  /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
6970
6970
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
6971
6971
  ] }),
6972
- 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 }) })
6972
+ 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 }) })
6973
6973
  ]
6974
6974
  }
6975
6975
  ) }),
6976
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m }) })
6976
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: g }) })
6977
6977
  ] });
6978
6978
  }, libraryBlocksAtom = atom$1(
6979
6979
  {}
@@ -6989,9 +6989,9 @@ const BlockCard = ({
6989
6989
  })();
6990
6990
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
6991
6991
  }, UILibrarySection = ({ parentId: o }) => {
6992
- 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, x] = useState("Hero"), g = get(p, m, []), _ = useRef(null), { t: b } = useTranslation(), E = (C) => {
6993
- _.current && (clearTimeout(_.current), _.current = null), _.current = setTimeout(() => {
6994
- _.current && x(C);
6992
+ const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [g, x] = useState("Hero"), m = get(p, g, []), E = useRef(null), { t: f } = useTranslation(), j = (S) => {
6993
+ E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
6994
+ E.current && x(S);
6995
6995
  }, 300);
6996
6996
  };
6997
6997
  if (u)
@@ -6999,30 +6999,30 @@ const BlockCard = ({
6999
6999
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7000
7000
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7001
7001
  ] });
7002
- const v = filter(g, (C, I) => I % 2 === 0), B = filter(g, (C, I) => I % 2 === 1);
7002
+ const k = filter(m, (S, B) => B % 2 === 0), A = filter(m, (S, B) => B % 2 === 1);
7003
7003
  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: [
7004
7004
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7005
7005
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
7006
7006
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
7007
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: b("groups") }),
7007
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: f("groups") }),
7008
7008
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7009
7009
  /* @__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(
7010
- map(p, (C, I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7010
+ map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7011
7011
  "div",
7012
7012
  {
7013
- onMouseEnter: () => E(I),
7014
- onMouseLeave: () => clearTimeout(_.current),
7015
- onClick: () => x(I),
7013
+ onMouseEnter: () => j(B),
7014
+ onMouseLeave: () => clearTimeout(E.current),
7015
+ onClick: () => x(B),
7016
7016
  className: cn(
7017
7017
  "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",
7018
- I === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7018
+ B === g ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7019
7019
  ),
7020
7020
  children: [
7021
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(b(I.toLowerCase())) }),
7021
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(f(B.toLowerCase())) }),
7022
7022
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7023
7023
  ]
7024
7024
  },
7025
- I
7025
+ B
7026
7026
  ))
7027
7027
  ) })
7028
7028
  ] })
@@ -7030,15 +7030,15 @@ const BlockCard = ({
7030
7030
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
7031
7031
  ScrollArea,
7032
7032
  {
7033
- onMouseEnter: () => _.current ? clearTimeout(_.current) : null,
7033
+ onMouseEnter: () => E.current ? clearTimeout(E.current) : null,
7034
7034
  className: "z-10 -mt-2 flex h-full max-h-full w-full flex-col gap-2 border-l border-border transition-all ease-linear",
7035
7035
  children: [
7036
7036
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7037
7037
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7038
- v.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7038
+ k.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
7039
7039
  ) }),
7040
7040
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7041
- B.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7041
+ A.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
7042
7042
  ) })
7043
7043
  ] }),
7044
7044
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -7483,14 +7483,14 @@ i18n.use(initReactI18next).init({
7483
7483
  }
7484
7484
  });
7485
7485
  const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7486
- const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, m] = useHighlightBlockId(), x = () => {
7487
- if (console.log("addBlockToPage", o, r), has(o, "blocks")) {
7488
- const b = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7489
- u(syncBlocksWithDefaults(b), r || null);
7486
+ const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, g] = useHighlightBlockId(), x = () => {
7487
+ if (has(o, "blocks")) {
7488
+ const f = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7489
+ u(syncBlocksWithDefaults(f), r || null);
7490
7490
  } else
7491
7491
  d(o, r || null);
7492
7492
  emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7493
- }, g = useFeature("dnd"), { t: _ } = useTranslation();
7493
+ }, m = useFeature("dnd"), { t: E } = useTranslation();
7494
7494
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
7495
7495
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7496
7496
  "button",
@@ -7498,20 +7498,20 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7498
7498
  disabled: n,
7499
7499
  onClick: x,
7500
7500
  type: "button",
7501
- onDragStart: (b) => {
7502
- b.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), b.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7503
- p([]), m(null);
7501
+ onDragStart: (f) => {
7502
+ f.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), f.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7503
+ p([]), g(null);
7504
7504
  }, 200);
7505
7505
  },
7506
- draggable: g ? "true" : "false",
7506
+ draggable: m ? "true" : "false",
7507
7507
  className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
7508
7508
  children: [
7509
7509
  createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
7510
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(_(c || l)) })
7510
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(E(c || l)) })
7511
7511
  ]
7512
7512
  }
7513
7513
  ) }),
7514
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: _(c || l) }) })
7514
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: E(c || l) }) })
7515
7515
  ] }) });
7516
7516
  }, DefaultChaiBlocks = ({ parentId: o, gridCols: n = "grid-cols-2" }) => {
7517
7517
  const r = useChaiBlocks(), a = useBuilderProp("filterChaiBlock", () => !0), l = filter(r, a), i = groupBy(l, "category"), c = uniq(map(i.core, "group"));
@@ -7672,14 +7672,14 @@ function QuickPrompts({ onClick: o }) {
7672
7672
  ) }) });
7673
7673
  }
7674
7674
  const AIUserPrompt = ({ blockId: o }) => {
7675
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), x = useRef(null), g = useRef(null);
7675
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, g] = useState(), x = useRef(null), m = useRef(null);
7676
7676
  useEffect(() => {
7677
- var b;
7678
- (b = x.current) == null || b.focus();
7677
+ var f;
7678
+ (f = x.current) == null || f.focus();
7679
7679
  }, []);
7680
- const _ = (b) => {
7681
- const { usage: E } = b || {};
7682
- !l && E && m(E), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
7680
+ const E = (f) => {
7681
+ const { usage: j } = f || {};
7682
+ !l && j && g(j), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
7683
7683
  };
7684
7684
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
7685
7685
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -7699,12 +7699,12 @@ const AIUserPrompt = ({ blockId: o }) => {
7699
7699
  {
7700
7700
  ref: x,
7701
7701
  value: i,
7702
- onChange: (b) => c(b.target.value),
7702
+ onChange: (f) => c(f.target.value),
7703
7703
  placeholder: n("Ask AI to edit content"),
7704
7704
  className: "w-full",
7705
7705
  rows: 3,
7706
- onKeyDown: (b) => {
7707
- b.key === "Enter" && (b.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, _));
7706
+ onKeyDown: (f) => {
7707
+ f.key === "Enter" && (f.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E));
7708
7708
  }
7709
7709
  }
7710
7710
  ),
@@ -7714,7 +7714,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7714
7714
  {
7715
7715
  disabled: i.trim().length < 5 || a,
7716
7716
  onClick: () => {
7717
- g.current && clearTimeout(g.current), m(void 0), r("content", o, i, _);
7717
+ m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E);
7718
7718
  },
7719
7719
  variant: "default",
7720
7720
  className: "w-fit",
@@ -7746,8 +7746,8 @@ const AIUserPrompt = ({ blockId: o }) => {
7746
7746
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7747
7747
  QuickPrompts,
7748
7748
  {
7749
- onClick: (b) => {
7750
- g.current && clearTimeout(g.current), m(void 0), r("content", o, b, _);
7749
+ onClick: (f) => {
7750
+ m.current && clearTimeout(m.current), g(void 0), r("content", o, f, E);
7751
7751
  }
7752
7752
  }
7753
7753
  )
@@ -7757,19 +7757,19 @@ const AIUserPrompt = ({ blockId: o }) => {
7757
7757
  ] }) }) : null
7758
7758
  ] });
7759
7759
  }, AISetContext = () => {
7760
- const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, m] = useState(!1), { toast: x } = useToast(), g = useRef(null);
7760
+ 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: x } = useToast(), m = useRef(null);
7761
7761
  useEffect(() => {
7762
7762
  n && a(n);
7763
7763
  }, [n]);
7764
- const _ = async () => {
7764
+ const E = async () => {
7765
7765
  try {
7766
7766
  d(!0), p(null), await i(r), x({
7767
7767
  title: o("Updated AI Context"),
7768
7768
  description: o("You can now Ask AI to edit your content"),
7769
7769
  variant: "default"
7770
- }), g.current.click();
7771
- } catch (b) {
7772
- p(b);
7770
+ }), m.current.click();
7771
+ } catch (f) {
7772
+ p(f);
7773
7773
  } finally {
7774
7774
  d(!1);
7775
7775
  }
@@ -7777,25 +7777,25 @@ const AIUserPrompt = ({ blockId: o }) => {
7777
7777
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
7778
7778
  Accordion,
7779
7779
  {
7780
- onValueChange: (b) => {
7781
- m(b !== "");
7780
+ onValueChange: (f) => {
7781
+ g(f !== "");
7782
7782
  },
7783
7783
  type: "single",
7784
7784
  collapsible: !0,
7785
7785
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
7786
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: g, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
7786
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: m, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
7787
7787
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
7788
7788
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7789
7789
  Textarea,
7790
7790
  {
7791
7791
  ref: l,
7792
7792
  value: r,
7793
- onChange: (b) => a(b.target.value),
7793
+ onChange: (f) => a(f.target.value),
7794
7794
  placeholder: o("Tell about this page eg this page is about"),
7795
7795
  className: "mt-1 w-full",
7796
7796
  rows: 10,
7797
- onKeyDown: (b) => {
7798
- b.key === "Enter" && (b.preventDefault(), _());
7797
+ onKeyDown: (f) => {
7798
+ f.key === "Enter" && (f.preventDefault(), E());
7799
7799
  }
7800
7800
  }
7801
7801
  ),
@@ -7807,7 +7807,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7807
7807
  Button,
7808
7808
  {
7809
7809
  disabled: r.trim().length < 5,
7810
- onClick: () => _(),
7810
+ onClick: () => E(),
7811
7811
  variant: "default",
7812
7812
  className: "w-fit",
7813
7813
  size: "sm",
@@ -7836,7 +7836,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7836
7836
  AlertDialogAction,
7837
7837
  {
7838
7838
  onClick: () => {
7839
- a(""), _();
7839
+ a(""), E();
7840
7840
  },
7841
7841
  children: o("Yes, Delete")
7842
7842
  }
@@ -7857,42 +7857,42 @@ const AIUserPrompt = ({ blockId: o }) => {
7857
7857
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
7858
7858
  ] });
7859
7859
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
7860
- const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [x, g] = useState(""), _ = useRef(null), b = useRef(null);
7860
+ const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [x, m] = useState(""), E = useRef(null), f = useRef(null);
7861
7861
  useEffect(() => {
7862
7862
  l(n);
7863
7863
  }, [n]);
7864
- const E = () => {
7864
+ const j = () => {
7865
7865
  if (i.startsWith("@")) {
7866
- g("Attribute keys cannot start with '@'");
7866
+ m("Attribute keys cannot start with '@'");
7867
7867
  return;
7868
7868
  }
7869
7869
  if (i) {
7870
- const w = [...a, { key: i, value: d }];
7871
- r(w), l(a), c(""), u(""), g("");
7870
+ const C = [...a, { key: i, value: d }];
7871
+ r(C), l(a), c(""), u(""), m("");
7872
7872
  }
7873
- }, v = (w) => {
7874
- const A = a.filter((T, P) => P !== w);
7875
- r(A), l(A);
7876
- }, B = (w) => {
7877
- m(w), c(a[w].key), u(a[w].value);
7878
- }, C = () => {
7873
+ }, k = (C) => {
7874
+ const w = a.filter((N, D) => D !== C);
7875
+ r(w), l(w);
7876
+ }, A = (C) => {
7877
+ g(C), c(a[C].key), u(a[C].value);
7878
+ }, S = () => {
7879
7879
  if (i.startsWith("@")) {
7880
- g("Attribute keys cannot start with '@'");
7880
+ m("Attribute keys cannot start with '@'");
7881
7881
  return;
7882
7882
  }
7883
7883
  if (p !== null && i) {
7884
- const w = [...a];
7885
- w[p] = { key: i, value: d }, r(w), l(w), m(null), c(""), u(""), g("");
7884
+ const C = [...a];
7885
+ C[p] = { key: i, value: d }, r(C), l(C), g(null), c(""), u(""), m("");
7886
7886
  }
7887
- }, I = (w) => {
7888
- w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? C() : E());
7887
+ }, B = (C) => {
7888
+ C.key === "Enter" && !C.shiftKey && (C.preventDefault(), p !== null ? S() : j());
7889
7889
  };
7890
7890
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
7891
7891
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
7892
7892
  "form",
7893
7893
  {
7894
- onSubmit: (w) => {
7895
- w.preventDefault(), p !== null ? C() : E();
7894
+ onSubmit: (C) => {
7895
+ C.preventDefault(), p !== null ? S() : j();
7896
7896
  },
7897
7897
  className: "space-y-3",
7898
7898
  children: [
@@ -7906,9 +7906,9 @@ const AIUserPrompt = ({ blockId: o }) => {
7906
7906
  autoCorrect: "off",
7907
7907
  spellCheck: "false",
7908
7908
  id: "attrKey",
7909
- ref: _,
7909
+ ref: E,
7910
7910
  value: i,
7911
- onChange: (w) => c(w.target.value),
7911
+ onChange: (C) => c(C.target.value),
7912
7912
  placeholder: "Key",
7913
7913
  className: "h-8 text-sm"
7914
7914
  }
@@ -7924,10 +7924,10 @@ const AIUserPrompt = ({ blockId: o }) => {
7924
7924
  spellCheck: "false",
7925
7925
  id: "attrValue",
7926
7926
  rows: 2,
7927
- ref: b,
7927
+ ref: f,
7928
7928
  value: d,
7929
- onChange: (w) => u(w.target.value),
7930
- onKeyDown: I,
7929
+ onChange: (C) => u(C.target.value),
7930
+ onKeyDown: B,
7931
7931
  placeholder: "Value",
7932
7932
  className: "bg-background text-sm"
7933
7933
  }
@@ -7939,22 +7939,22 @@ const AIUserPrompt = ({ blockId: o }) => {
7939
7939
  ]
7940
7940
  }
7941
7941
  ),
7942
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((w, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
7942
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((C, w) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
7943
7943
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
7944
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: w.key }),
7945
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: w.value.toString() })
7944
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: C.key }),
7945
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: C.value.toString() })
7946
7946
  ] }),
7947
7947
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
7948
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(A), children: [
7948
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(w), children: [
7949
7949
  /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
7950
7950
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
7951
7951
  ] }),
7952
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: [
7952
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(w), children: [
7953
7953
  /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
7954
7954
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
7955
7955
  ] })
7956
7956
  ] })
7957
- ] }, A)) })
7957
+ ] }, w)) })
7958
7958
  ] });
7959
7959
  }), BlockAttributesEditor = React.memo(() => {
7960
7960
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -8371,16 +8371,16 @@ function RemoveProviderConfirmation({
8371
8371
  }
8372
8372
  const PageDataProviders = () => {
8373
8373
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8374
- filter(n, (E) => map(r, "providerKey").includes(E.providerKey))
8375
- ), [d, u] = useState(""), [p, m] = useState(null), x = filter(
8376
- n.map((E) => map(i, "providerKey").includes(E.providerKey) ? null : { value: E.providerKey, label: E.name }),
8377
- (E) => !isNull(E)
8378
- ), g = (E) => {
8379
- const v = find(n, { providerKey: E });
8380
- c((B) => [...B, v]), a((B) => [...B, { providerKey: v.providerKey, args: {} }]), u(""), l("UNSAVED");
8381
- }, _ = (E) => {
8382
- c((v) => filter(v, (B) => B.providerKey !== E.providerKey)), a((v) => filter(v, (B) => B.providerKey !== E.providerKey)), l("UNSAVED");
8383
- }, b = (E) => m(E);
8374
+ filter(n, (j) => map(r, "providerKey").includes(j.providerKey))
8375
+ ), [d, u] = useState(""), [p, g] = useState(null), x = filter(
8376
+ n.map((j) => map(i, "providerKey").includes(j.providerKey) ? null : { value: j.providerKey, label: j.name }),
8377
+ (j) => !isNull(j)
8378
+ ), m = (j) => {
8379
+ const k = find(n, { providerKey: j });
8380
+ c((A) => [...A, k]), a((A) => [...A, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8381
+ }, E = (j) => {
8382
+ c((k) => filter(k, (A) => A.providerKey !== j.providerKey)), a((k) => filter(k, (A) => A.providerKey !== j.providerKey)), l("UNSAVED");
8383
+ }, f = (j) => g(j);
8384
8384
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8385
8385
  o("no_data_providers"),
8386
8386
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8388,11 +8388,11 @@ const PageDataProviders = () => {
8388
8388
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
8389
8389
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
8390
8390
  /* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
8391
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (E) => g(E), children: [
8391
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (j) => m(j), children: [
8392
8392
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
8393
8393
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
8394
8394
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
8395
- x.map((E) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: E.value, children: E.label }, E.value))
8395
+ x.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: j.value, children: j.label }, j.value))
8396
8396
  ] })
8397
8397
  ] }) }),
8398
8398
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8401,21 +8401,21 @@ const PageDataProviders = () => {
8401
8401
  o("page_data_providers"),
8402
8402
  ":"
8403
8403
  ] }),
8404
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
8404
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
8405
8405
  "div",
8406
8406
  {
8407
8407
  className: "w-full rounded-lg border border-border bg-card text-card-foreground shadow-sm",
8408
8408
  "data-v0-t": "card",
8409
8409
  children: [
8410
8410
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
8411
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: E.name }),
8412
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: E.description })
8411
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: j.name }),
8412
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: j.description })
8413
8413
  ] }) }) }),
8414
8414
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
8415
8415
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8416
8416
  "button",
8417
8417
  {
8418
- onClick: () => b(E),
8418
+ onClick: () => f(j),
8419
8419
  className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
8420
8420
  children: [
8421
8421
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -8441,7 +8441,7 @@ const PageDataProviders = () => {
8441
8441
  ]
8442
8442
  }
8443
8443
  ),
8444
- /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => _(E), name: E.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
8444
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(j), name: j.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
8445
8445
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8446
8446
  "svg",
8447
8447
  {
@@ -8467,16 +8467,16 @@ const PageDataProviders = () => {
8467
8467
  ] })
8468
8468
  ]
8469
8469
  },
8470
- E.providerKey
8470
+ j.providerKey
8471
8471
  )) }),
8472
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
8472
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => g(null), provider: p })
8473
8473
  ] })
8474
8474
  ] });
8475
8475
  };
8476
8476
  function AiFillDatabase(o) {
8477
8477
  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);
8478
8478
  }
8479
- const TopBar = lazy(() => import("./Topbar-EPvh-p9w.js"));
8479
+ const TopBar = lazy(() => import("./Topbar-ULSrUjT1.js"));
8480
8480
  function useSidebarMenuItems(o) {
8481
8481
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8482
8482
  return useMemo(() => {
@@ -8503,14 +8503,14 @@ function isDualLayout(o) {
8503
8503
  }
8504
8504
  const RootLayout = () => {
8505
8505
  const [o, n] = useState(0), [r] = useLayoutVariant(), [a, l] = useState(!1);
8506
- useChaiBuilderMsgListener(({ name: g }) => {
8507
- g === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
8506
+ useChaiBuilderMsgListener(({ name: m }) => {
8507
+ m === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
8508
8508
  });
8509
- const i = useBuilderProp("sideBarComponents.top", []), c = (g) => {
8510
- g.preventDefault();
8511
- }, d = (g) => {
8512
- n(o === g ? null : g);
8513
- }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
8509
+ const i = useBuilderProp("sideBarComponents.top", []), c = (m) => {
8510
+ m.preventDefault();
8511
+ }, d = (m) => {
8512
+ n(o === m ? null : m);
8513
+ }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), g = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
8514
8514
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: x, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
8515
8515
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8516
8516
  "div",
@@ -8521,19 +8521,19 @@ const RootLayout = () => {
8521
8521
  /* @__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, {}) }) }),
8522
8522
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
8523
8523
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
8524
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8524
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: g.map((m, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8525
8525
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8526
8526
  Button,
8527
8527
  {
8528
- variant: o === _ ? "default" : "ghost",
8528
+ variant: o === E ? "default" : "ghost",
8529
8529
  className: "mb-2 rounded-lg p-2 transition-colors",
8530
- onClick: () => d(_),
8531
- children: get(g, "icon", null)
8530
+ onClick: () => d(E),
8531
+ children: get(m, "icon", null)
8532
8532
  },
8533
- _
8533
+ E
8534
8534
  ) }),
8535
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(g.label) }) })
8536
- ] }, "button" + _)) }),
8535
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(m.label) }) })
8536
+ ] }, "button" + E)) }),
8537
8537
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
8538
8538
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8539
8539
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", onClick: () => l(!0), children: /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutTemplate, { size: 20 }) }) }),
@@ -8551,10 +8551,10 @@ const RootLayout = () => {
8551
8551
  transition: { duration: 0.3, ease: "easeInOut" },
8552
8552
  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: [
8553
8553
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
8554
- get(m, `${o}.icon`, null),
8555
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
8554
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(g, `${o}.icon`, null) }),
8555
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(g[o].label) })
8556
8556
  ] }),
8557
- /* @__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), {}) }) })
8557
+ /* @__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), {}) }) })
8558
8558
  ] }) })
8559
8559
  }
8560
8560
  ),
@@ -8571,7 +8571,7 @@ const RootLayout = () => {
8571
8571
  transition: { duration: 0.3, ease: "easeInOut" },
8572
8572
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full max-h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-col p-3", children: [
8573
8573
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
8574
- /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: "16" }),
8574
+ /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: "16", className: "rtl:ml-2" }),
8575
8575
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p("Block Settings") })
8576
8576
  ] }),
8577
8577
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsPanel$1, {}) }) })