@chaibuilder/sdk 1.2.98 → 1.2.100

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.
Files changed (33) hide show
  1. package/dist/{CodeEditor-JFNyNUeD.js → CodeEditor-4u3Q97EK.js} +7 -6
  2. package/dist/CodeEditor-arptm_-Q.cjs +1 -0
  3. package/dist/{STRINGS-TDN5UhWi.js → STRINGS-Xxstm-7I.js} +2 -2
  4. package/dist/{Topbar-bca7NmyC.js → Topbar-i55trLGw.js} +17 -16
  5. package/dist/Topbar-ziTrNsmI.cjs +1 -0
  6. package/dist/UnsplashImages-9-OD1Sje.cjs +1 -0
  7. package/dist/{UnsplashImages-vR5ig3Lz.js → UnsplashImages-y0LQATX2.js} +16 -15
  8. package/dist/UploadImages--tvMDTKi.cjs +1 -0
  9. package/dist/{UploadImages-jCqfO33R.js → UploadImages-Nbpt6WL2.js} +12 -11
  10. package/dist/{context-menu-9cWJcKdh.js → context-menu-YGd09SE1.js} +91 -91
  11. package/dist/controls-lEwMTdPQ.js +234 -0
  12. package/dist/controls-p9IwFnPx.cjs +1 -0
  13. package/dist/core.cjs +1 -1
  14. package/dist/core.js +74 -73
  15. package/dist/iconBase-Ief2hJUZ.js +130 -0
  16. package/dist/iconBase-aZzpqff_.cjs +1 -0
  17. package/dist/index-EyRQyWtP.cjs +61 -0
  18. package/dist/{index-5aoq9X96.js → index-jfezM1fH.js} +326 -325
  19. package/dist/render.js +1 -1
  20. package/dist/runtime.cjs +1 -0
  21. package/dist/runtime.d.ts +5 -0
  22. package/dist/runtime.js +21 -0
  23. package/dist/ui.js +2 -2
  24. package/dist/web-blocks.cjs +2 -2
  25. package/dist/web-blocks.js +16 -15
  26. package/package.json +6 -1
  27. package/dist/CodeEditor-v6e1cv9g.cjs +0 -1
  28. package/dist/Topbar--bKmw8Qf.cjs +0 -1
  29. package/dist/UnsplashImages-Xfn4852d.cjs +0 -1
  30. package/dist/UploadImages-Yl-90dxh.cjs +0 -1
  31. package/dist/iconBase-5hdsfZ0z.cjs +0 -1
  32. package/dist/iconBase-RFUjwZUN.js +0 -339
  33. package/dist/index-M74Ml_9k.cjs +0 -61
@@ -4,17 +4,17 @@ 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
- 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";
7
+ import { a as Skeleton, B as Button, aA as ContextMenu, aB as ContextMenuTrigger, aC as ContextMenuContent, aD as ContextMenuItem, P as Tooltip, Q as TooltipTrigger, R as TooltipContent, C as Card, z as CardHeader, G as CardDescription, H as CardContent, L as Label, T as Textarea, E as CardFooter, D as Dialog, t as DialogTrigger, u as DialogContent, v as DialogHeader, x as DialogTitle, y as DialogDescription, w as DialogFooter, W as Popover, X as PopoverTrigger, Y as PopoverContent, ar as Command, at as CommandInput, au as CommandList, av as CommandEmpty, aw as CommandGroup, ax as CommandItem, K as Tabs, M as TabsList, N as TabsTrigger, O as TabsContent, d as Switch, A as Accordion, f as AccordionItem, g as AccordionTrigger, h as AccordionContent, ao as useToast, I as Input$1, V as TooltipPortal, a8 as DropdownMenu, a9 as DropdownMenuTrigger, aa as DropdownMenuContent, S as ScrollArea, ae as DropdownMenuLabel, af as DropdownMenuSeparator, ah as DropdownMenuGroup, ab as DropdownMenuItem, ag as DropdownMenuShortcut, k as AlertDialog, m as AlertDialogContent, n as AlertDialogHeader, p as AlertDialogTitle, l as AlertDialogTrigger, q as AlertDialogDescription, o as AlertDialogFooter, s as AlertDialogCancel, r as AlertDialogAction, ac as DropdownMenuCheckboxItem, Z as HoverCard, _ as HoverCardTrigger, $ as HoverCardContent, b as Separator, i as Badge, a0 as Select, a3 as SelectTrigger, a2 as SelectValue, a4 as SelectContent, a6 as SelectItem, U as TooltipProvider, aq as Toaster } from "./context-menu-YGd09SE1.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, y, s, h, c as cn, G as GenIcon } from "./iconBase-RFUjwZUN.js";
10
+ import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-Ief2hJUZ.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";
14
14
  import { useThrottledCallback, useResizeObserver, useDebouncedCallback, useIntervalEffect } from "@react-hookz/web";
15
15
  import TreeModel from "tree-model";
16
16
  import ReactQuill, { Quill } from "react-quill";
17
- import { S as SLOT_KEY, I as I18N_KEY, a as STYLES_KEY, R as ROOT_TEMP_KEY } from "./STRINGS-TDN5UhWi.js";
17
+ import { a as SLOT_KEY, I as I18N_KEY, S as STYLES_KEY, R as ROOT_TEMP_KEY } from "./STRINGS-Xxstm-7I.js";
18
18
  import { useFeature, FlagsProvider } from "flagged";
19
19
  import { useHotkeys } from "react-hotkeys-hook";
20
20
  import { flip } from "@floating-ui/dom";
@@ -34,6 +34,7 @@ import { Resizable } from "re-resizable";
34
34
  import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, EditIcon, TrashIcon as TrashIcon$1, Check, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, X, LayoutTemplate, Layers, PaintBucketIcon } from "lucide-react";
35
35
  import validator from "@rjsf/validator-ajv8";
36
36
  import Form from "@rjsf/core";
37
+ import { y, s, h } from "./controls-lEwMTdPQ.js";
37
38
  import { Tree } from "react-arborist";
38
39
  import { parse, stringify } from "himalaya";
39
40
  import IconPicker, { IconPickerItem } from "react-icons-picker";
@@ -115,7 +116,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
115
116
  I.v = v.v;
116
117
  }
117
118
  return d(b, I), I;
118
- }, m = (b, _, R, v) => {
119
+ }, g = (b, _, R, v) => {
119
120
  if (isPromiseLike$2(_)) {
120
121
  let I;
121
122
  const L = new Promise((P, V) => {
@@ -161,10 +162,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
161
162
  e: _
162
163
  };
163
164
  return R && u(b, I, R), v && isEqualAtomError(v, I) && v.d === I.d ? v : (d(b, I), I);
164
- }, g = (b) => {
165
+ }, m = (b) => {
165
166
  const _ = c(b);
166
167
  if (_ && (_.d.forEach(($, O) => {
167
- O !== b && !n.has(O) && g(O);
168
+ O !== b && !n.has(O) && m(O);
168
169
  }), Array.from(_.d).every(([$, O]) => {
169
170
  const M = c($);
170
171
  return $ === b || M === O || // TODO This is a hack, we should find a better solution.
@@ -182,7 +183,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
182
183
  return R.set($, void 0), $.init;
183
184
  throw new Error("no atom init");
184
185
  }
185
- const O = g($);
186
+ const O = m($);
186
187
  return R.set($, O), returnAtomValue(O);
187
188
  };
188
189
  let L, P;
@@ -199,7 +200,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
199
200
  };
200
201
  try {
201
202
  const $ = b.read(I, V);
202
- return m(
203
+ return g(
203
204
  b,
204
205
  $,
205
206
  R,
@@ -210,7 +211,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
210
211
  } finally {
211
212
  v = !1;
212
213
  }
213
- }, E = (b) => returnAtomValue(g(b)), f = (b) => {
214
+ }, E = (b) => returnAtomValue(m(b)), f = (b) => {
214
215
  let _ = n.get(b);
215
216
  return _ || (_ = C(b)), _;
216
217
  }, j = (b, _) => !_.l.size && (!_.t.size || _.t.size === 1 && _.t.has(b)), k = (b) => {
@@ -236,7 +237,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
236
237
  if (O && R.set(V, --O), !O) {
237
238
  let M = !!(($ = _.get(V)) != null && $.size);
238
239
  if (M) {
239
- const H = c(V), F = g(V);
240
+ const H = c(V), F = m(V);
240
241
  M = !H || !isEqualAtomValue(H, F);
241
242
  }
242
243
  M || _.forEach((H) => H.delete(V));
@@ -248,12 +249,12 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
248
249
  I(b);
249
250
  }, S = (b, ..._) => {
250
251
  let R = !0;
251
- const v = (P) => returnAtomValue(g(P)), I = (P, ...V) => {
252
+ const v = (P) => returnAtomValue(m(P)), I = (P, ...V) => {
252
253
  let $;
253
254
  if (P === b) {
254
255
  if (!hasInitialValue(P))
255
256
  throw new Error("atom not writable");
256
- const O = c(P), M = m(P, V[0]);
257
+ const O = c(P), M = g(P, V[0]);
257
258
  (!O || !isEqualAtomValue(O, M)) && A(P);
258
259
  } else
259
260
  $ = S(P, ...V);
@@ -276,10 +277,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
276
277
  t: new Set(_ && [_]),
277
278
  l: /* @__PURE__ */ new Set()
278
279
  };
279
- if (n.set(b, R), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b), g(b).d.forEach((v, I) => {
280
+ 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
281
  const L = n.get(I);
281
282
  L ? L.t.add(b) : I !== b && C(I, b);
282
- }), g(b), isActuallyWritableAtom(b) && b.onMount) {
283
+ }), m(b), isActuallyWritableAtom(b) && b.onMount) {
283
284
  const v = b.onMount((...I) => B(b, ...I));
284
285
  v && (R.u = v);
285
286
  }
@@ -351,7 +352,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
351
352
  dev_get_mounted: (b) => n.get(b),
352
353
  dev_restore_atoms: (b) => {
353
354
  for (const [R, v] of b)
354
- hasInitialValue(R) && (m(R, v), A(R));
355
+ hasInitialValue(R) && (g(R, v), A(R));
355
356
  const _ = D();
356
357
  l.forEach(
357
358
  (R) => R({ type: "restore", flushed: _ })
@@ -377,13 +378,13 @@ function splitAtom(o, n) {
377
378
  let u = r.get(c);
378
379
  if (u)
379
380
  return u;
380
- const p = d && r.get(d), m = [], x = [];
381
- return c.forEach((g, E) => {
382
- const f = n ? n(g) : E;
381
+ const p = d && r.get(d), g = [], x = [];
382
+ return c.forEach((m, E) => {
383
+ const f = n ? n(m) : E;
383
384
  x[E] = f;
384
385
  const j = p && p.atomList[p.keyList.indexOf(f)];
385
386
  if (j) {
386
- m[E] = j;
387
+ g[E] = j;
387
388
  return;
388
389
  }
389
390
  const k = (S) => {
@@ -406,8 +407,8 @@ function splitAtom(o, n) {
406
407
  ...N.slice(T + 1)
407
408
  ]);
408
409
  };
409
- m[E] = isWritable(o) ? atom(k, A) : atom(k);
410
- }), p && p.keyList.length === x.length && p.keyList.every((g, E) => g === x[E]) ? u = p : u = { arr: c, atomList: m, keyList: x }, r.set(c, u), u;
410
+ g[E] = isWritable(o) ? atom(k, A) : atom(k);
411
+ }), 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
412
  }, l = atom((c) => {
412
413
  const d = c(l), u = c(o);
413
414
  return a(u, d == null ? void 0 : d.arr);
@@ -420,10 +421,10 @@ function splitAtom(o, n) {
420
421
  case "remove": {
421
422
  const p = c(i).indexOf(u.atom);
422
423
  if (p >= 0) {
423
- const m = c(o);
424
+ const g = c(o);
424
425
  d(o, [
425
- ...m.slice(0, p),
426
- ...m.slice(p + 1)
426
+ ...g.slice(0, p),
427
+ ...g.slice(p + 1)
427
428
  ]);
428
429
  }
429
430
  break;
@@ -431,28 +432,28 @@ function splitAtom(o, n) {
431
432
  case "insert": {
432
433
  const p = u.before ? c(i).indexOf(u.before) : c(i).length;
433
434
  if (p >= 0) {
434
- const m = c(o);
435
+ const g = c(o);
435
436
  d(o, [
436
- ...m.slice(0, p),
437
+ ...g.slice(0, p),
437
438
  u.value,
438
- ...m.slice(p)
439
+ ...g.slice(p)
439
440
  ]);
440
441
  }
441
442
  break;
442
443
  }
443
444
  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) {
445
+ const p = c(i).indexOf(u.atom), g = u.before ? c(i).indexOf(u.before) : c(i).length;
446
+ if (p >= 0 && g >= 0) {
446
447
  const x = c(o);
447
- p < m ? d(o, [
448
+ p < g ? d(o, [
448
449
  ...x.slice(0, p),
449
- ...x.slice(p + 1, m),
450
+ ...x.slice(p + 1, g),
450
451
  x[p],
451
- ...x.slice(m)
452
+ ...x.slice(g)
452
453
  ]) : d(o, [
453
- ...x.slice(0, m),
454
+ ...x.slice(0, g),
454
455
  x[p],
455
- ...x.slice(m, p),
456
+ ...x.slice(g, p),
456
457
  ...x.slice(p + 1)
457
458
  ]);
458
459
  }
@@ -473,14 +474,14 @@ function createJSONStorage(o) {
473
474
  const a = {
474
475
  getItem: (l, i) => {
475
476
  var c, d;
476
- const u = (m) => {
477
- if (m = m || "", n !== m) {
477
+ const u = (g) => {
478
+ if (g = g || "", n !== g) {
478
479
  try {
479
- r = JSON.parse(m);
480
+ r = JSON.parse(g);
480
481
  } catch {
481
482
  return i;
482
483
  }
483
- n = m;
484
+ n = g;
484
485
  }
485
486
  return r;
486
487
  }, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
@@ -529,8 +530,8 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
529
530
  }, atom(
530
531
  (d) => d(i),
531
532
  (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));
533
+ const g = typeof p == "function" ? p(d(i)) : p;
534
+ 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
535
  }
535
536
  );
536
537
  }
@@ -555,8 +556,8 @@ const StoreContext = createContext(void 0), useStore = (o) => {
555
556
  function useAtomValue(o, n) {
556
557
  const r = useStore(n), [[a, l, i], c] = useReducer(
557
558
  (p) => {
558
- const m = r.get(o);
559
- return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
559
+ const g = r.get(o);
560
+ return Object.is(p[0], g) && p[1] === r && p[2] === o ? p : [g, r, o];
560
561
  },
561
562
  void 0,
562
563
  () => [r.get(o), r, o]
@@ -640,8 +641,8 @@ const getSlots = (o) => {
640
641
  return map(i, (c) => {
641
642
  const d = c, u = getSlots(d);
642
643
  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}`;
644
+ const g = find(i, { oldId: u[p].replace("slot:", "") });
645
+ d[p] = `slot:${g._id}`;
645
646
  }), omit(d, ["global", "oldId"]);
646
647
  });
647
648
  }, presentBlocksAtom = atom$1([]);
@@ -759,8 +760,8 @@ const useSelectedBlocksDisplayChild = () => ({
759
760
  const p = r[u];
760
761
  if (includes(["slot", "styles"], p.type))
761
762
  return;
762
- const m = u;
763
- l.properties[m] = getBlockJSONFromSchemas(p, n);
763
+ const g = u;
764
+ l.properties[g] = getBlockJSONFromSchemas(p, n);
764
765
  }), l;
765
766
  case "list":
766
767
  const { itemProperties: i, title: c } = o, d = {
@@ -775,8 +776,8 @@ const useSelectedBlocksDisplayChild = () => ({
775
776
  const p = i[u];
776
777
  if (includes(["slot", "styles"], p.type))
777
778
  return;
778
- const m = u;
779
- d.items.properties[m] = getBlockJSONFromSchemas(p, n), set(d.items, "title", get(p, "itemTitle", `${n(c)} item`));
779
+ const g = u;
780
+ d.items.properties[g] = getBlockJSONFromSchemas(p, n), set(d.items, "title", get(p, "itemTitle", `${n(c)} item`));
780
781
  }), d;
781
782
  default:
782
783
  return {};
@@ -829,8 +830,8 @@ var undomanager = { exports: {} };
829
830
  }
830
831
  let r = function() {
831
832
  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);
833
+ function u(p, g) {
834
+ return !p || typeof p[g] != "function" ? this : (c = !0, p[g](), c = !1, this);
834
835
  }
835
836
  return {
836
837
  /**
@@ -857,8 +858,8 @@ var undomanager = { exports: {} };
857
858
  let p = a[l];
858
859
  if (!p)
859
860
  return this;
860
- const m = p.groupId;
861
- for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
861
+ const g = p.groupId;
862
+ for (; p.groupId === g && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
862
863
  ;
863
864
  return d && d(), this;
864
865
  },
@@ -869,8 +870,8 @@ var undomanager = { exports: {} };
869
870
  let p = a[l + 1];
870
871
  if (!p)
871
872
  return this;
872
- const m = p.groupId;
873
- for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
873
+ const g = p.groupId;
874
+ for (; p.groupId === g && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
874
875
  ;
875
876
  return d && d(), this;
876
877
  },
@@ -901,7 +902,7 @@ var undomanager = { exports: {} };
901
902
  * @returns {array}
902
903
  */
903
904
  getCommands: function(p) {
904
- return p ? a.filter((m) => m.groupId === p) : a;
905
+ return p ? a.filter((g) => g.groupId === p) : a;
905
906
  },
906
907
  /**
907
908
  * Returns the index of the actions list.
@@ -1256,7 +1257,7 @@ const useBlocksStoreManager = () => {
1256
1257
  }, useAddBlock = () => {
1257
1258
  const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
1258
1259
  (i, c, d) => {
1259
- var g;
1260
+ var m;
1260
1261
  for (let E = 0; E < i.length; E++) {
1261
1262
  const { _id: f } = i[E];
1262
1263
  i[E]._id = generateUUID();
@@ -1265,8 +1266,8 @@ const useBlocksStoreManager = () => {
1265
1266
  j[k]._parent = i[E]._id;
1266
1267
  }
1267
1268
  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);
1269
+ let p, g;
1270
+ 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
1271
  },
1271
1272
  [o, n]
1272
1273
  );
@@ -1276,11 +1277,11 @@ const useBlocksStoreManager = () => {
1276
1277
  const k = i.blocks;
1277
1278
  return a(k, c, d);
1278
1279
  }
1279
- const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
1280
+ const u = generateUUID(), p = getBlockDefaultProps(i.props), g = [];
1280
1281
  forIn(p, (k, A) => {
1281
1282
  if (startsWith(k, SLOT_KEY)) {
1282
1283
  const S = k.replace(SLOT_KEY, "");
1283
- m.push({
1284
+ g.push({
1284
1285
  _id: S,
1285
1286
  _type: "Slot",
1286
1287
  _parent: u,
@@ -1295,9 +1296,9 @@ const useBlocksStoreManager = () => {
1295
1296
  _id: u,
1296
1297
  ...p
1297
1298
  };
1298
- let g, E;
1299
- c && (g = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(g == null ? void 0 : g._type, x._type) && g && (x._parent = g._parent, E = g._parent);
1300
- const j = [x, ...m];
1299
+ let m, E;
1300
+ 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);
1301
+ const j = [x, ...g];
1301
1302
  return r(j, E, d), n([x._id]), x;
1302
1303
  },
1303
1304
  [a, o, n]
@@ -2406,18 +2407,18 @@ function getNewClasses(o = "", n = "", r = []) {
2406
2407
  );
2407
2408
  const i = [], c = [];
2408
2409
  each(r, (p) => {
2409
- const m = constructClassObject(p), x = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2410
+ const g = constructClassObject(p), x = find(a, pick(g, ["dark", "mq", "mod", "property"]));
2410
2411
  if (x && (a = filter(
2411
2412
  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"]));
2413
+ (m) => m.fullCls !== (x == null ? void 0 : x.fullCls)
2414
+ )), 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)) {
2415
+ const m = find(l, pick(g, ["property"]));
2415
2416
  x && (l = filter(
2416
2417
  l,
2417
- (E) => E.fullCls !== (g == null ? void 0 : g.fullCls)
2418
+ (E) => E.fullCls !== (m == null ? void 0 : m.fullCls)
2418
2419
  )), c.push({
2419
- ...m,
2420
- fullCls: m.cls,
2420
+ ...g,
2421
+ fullCls: g.cls,
2421
2422
  mq: "xs"
2422
2423
  });
2423
2424
  }
@@ -2445,10 +2446,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2445
2446
  )
2446
2447
  ), i = first(o(selectedStylingBlocksAtom));
2447
2448
  return map(l, (c) => {
2448
- const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
2449
+ const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: g } = getSplitClasses$1(u);
2449
2450
  return {
2450
2451
  ids: [d._id],
2451
- props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
2452
+ props: { [i.prop]: `${STYLES_KEY}${getNewClasses(g, p, a)}` }
2452
2453
  };
2453
2454
  });
2454
2455
  }), useAddClassesToBlocks = () => {
@@ -2497,13 +2498,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2497
2498
  (a, l = null) => {
2498
2499
  const i = [];
2499
2500
  each(a, (c) => {
2500
- const d = o.find((g) => g._id === c);
2501
+ const d = o.find((m) => m._id === c);
2501
2502
  l || (l = d._parent);
2502
- const m = filter(
2503
+ const g = filter(
2503
2504
  o,
2504
- (g) => isString$1(l) ? g._parent === l : !d._parent
2505
+ (m) => isString$1(l) ? m._parent === l : !d._parent
2505
2506
  ).indexOf(d) + 1, x = getDuplicatedBlocks(o, c, l);
2506
- r(x, l, m), i.push(get(x, "0._id", ""));
2507
+ r(x, l, g), i.push(get(x, "0._id", ""));
2507
2508
  }), n(i);
2508
2509
  },
2509
2510
  [o, n]
@@ -2566,19 +2567,19 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2566
2567
  );
2567
2568
  return map(i, (c) => {
2568
2569
  const d = o(c), u = a;
2569
- let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2570
+ let { classes: p, baseClasses: g } = getSplitClasses(get(d, l.prop, "styles:,"));
2570
2571
  return each(u, (x) => {
2571
- const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${g}($| )`, "g");
2572
+ const m = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${m}($| )`, "g");
2572
2573
  p = p.replace(E, " ").replace(/ +/g, " ").trim();
2573
2574
  const f = first(x.split(":"));
2574
2575
  includes(["2xl", "xl", "lg", "md", "sm"], f) && u.push(x.split(":").pop().trim());
2575
2576
  }), each(u, (x) => {
2576
- const g = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2577
- m = m.replace(g, " ").replace(/ +/g, " ").trim();
2577
+ const m = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2578
+ g = g.replace(m, " ").replace(/ +/g, " ").trim();
2578
2579
  }), {
2579
2580
  ids: [d._id],
2580
2581
  props: {
2581
- [l.prop]: `${STYLES_KEY}${m},${p}`
2582
+ [l.prop]: `${STYLES_KEY}${g},${p}`
2582
2583
  }
2583
2584
  };
2584
2585
  });
@@ -2655,7 +2656,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2655
2656
  let u = "";
2656
2657
  o([n], { [i]: "" });
2657
2658
  for (let p = 0; p < d.length; p++)
2658
- u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
2659
+ u += d[p].join(""), o([n], { [i]: u }), await new Promise((g) => setTimeout(g, a));
2659
2660
  }
2660
2661
  }
2661
2662
  },
@@ -2836,31 +2837,31 @@ const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}),
2836
2837
  <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
2837
2838
  </body>
2838
2839
  </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 = {
2840
+ const [n] = useCanvasWidth(), [, r] = useCanvasZoom(), a = useBuilderProp("htmlDir", "ltr"), [l, i] = useState({}), c = useCallback(() => {
2841
+ const { width: d, height: u } = o;
2842
+ if (d < n) {
2843
+ const p = parseFloat((d / n).toFixed(2).toString());
2844
+ let g = {};
2845
+ const x = u * p, m = d * p;
2846
+ u && (g = {
2846
2847
  // 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({
2848
+ height: 100 + (u - x) / x * 100 + "%",
2849
+ width: 100 + (d - m) / m * 100 + "%"
2850
+ }), i({
2850
2851
  position: "relative",
2851
2852
  top: 0,
2852
- transform: `scale(${u})`,
2853
- transformOrigin: "top left",
2854
- ...p,
2853
+ transform: `scale(${p})`,
2854
+ transformOrigin: a === "rtl" ? "top right" : "top left",
2855
+ ...g,
2855
2856
  maxWidth: "none"
2856
2857
  // TODO: Add max-width to the wrapper
2857
- }), r(u * 100);
2858
+ }), r(p * 100);
2858
2859
  } else
2859
- l({}), r(100);
2860
- }, [n, o, r]);
2860
+ i({}), r(100);
2861
+ }, [n, o, a, r]);
2861
2862
  return useEffect(() => {
2862
- i();
2863
- }, [n, o, r, i]), a;
2863
+ c();
2864
+ }, [n, o, r, c]), l;
2864
2865
  };
2865
2866
  let doc, win;
2866
2867
  typeof document < "u" && (doc = document);
@@ -3029,12 +3030,12 @@ const useDnd = () => {
3029
3030
  };
3030
3031
  return iframeDocument = o, {
3031
3032
  isDragging: n,
3032
- onDragOver: (g) => {
3033
- g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
3033
+ onDragOver: (m) => {
3034
+ m.preventDefault(), m.stopPropagation(), throttledDragOver(m);
3034
3035
  },
3035
- onDrop: (g) => {
3036
+ onDrop: (m) => {
3036
3037
  var C;
3037
- const E = dropTarget, j = getOrientation(E) === "vertical" ? g.clientY + ((C = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : C.scrollY) : g.clientX;
3038
+ const E = dropTarget, j = getOrientation(E) === "vertical" ? m.clientY + ((C = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : C.scrollY) : m.clientX;
3038
3039
  dropIndex = calculateDropIndex(j, possiblePositions);
3039
3040
  const k = d, A = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3040
3041
  if ((k == null ? void 0 : k._id) === A || !S) {
@@ -3046,16 +3047,16 @@ const useDnd = () => {
3046
3047
  return;
3047
3048
  }
3048
3049
  let B = E.getAttribute("data-block-id");
3049
- B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3050
+ B === null && (B = m.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3050
3051
  },
3051
- onDragEnter: (g) => {
3052
- const E = g, f = E.target;
3052
+ onDragEnter: (m) => {
3053
+ const E = m, f = E.target;
3053
3054
  dropTarget = f;
3054
3055
  const j = f.getAttribute("data-block-id"), k = f.getAttribute("data-dnd-dragged") !== "yes";
3055
3056
  p(j), E.stopPropagation(), E.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(f), r(!0), l(""), i([]);
3056
3057
  },
3057
- onDragLeave: (g) => {
3058
- g.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3058
+ onDragLeave: (m) => {
3059
+ m.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3059
3060
  }
3060
3061
  };
3061
3062
  };
@@ -3077,16 +3078,16 @@ const useHandleCanvasDblClick = () => {
3077
3078
  if (!d || !o.includes(d))
3078
3079
  return;
3079
3080
  const u = c.cloneNode(!0);
3080
- c.style.display = "none", Array.from(u.attributes).forEach((g) => {
3081
- g.name !== "class" && u.removeAttribute(g.name);
3081
+ c.style.display = "none", Array.from(u.attributes).forEach((m) => {
3082
+ m.name !== "class" && u.removeAttribute(m.name);
3082
3083
  }), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
3083
3084
  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("");
3085
+ function g() {
3086
+ const m = p.getText(0, p.getLength());
3087
+ n([c.getAttribute("data-block-id")], { content: m }), c.removeAttribute("style"), u.removeEventListener("blur", g, !0), destroyQuill(p), l(""), r("");
3087
3088
  }
3088
- u.addEventListener("blur", m, !0), u.addEventListener("keydown", (g) => {
3089
- (g.key === "Enter" || g.key === "Escape") && m();
3089
+ u.addEventListener("blur", g, !0), u.addEventListener("keydown", (m) => {
3090
+ (m.key === "Enter" || m.key === "Escape") && g();
3090
3091
  }), p.focus(), (x = u.querySelector(".ql-clipboard")) == null || x.remove(), l(c.getAttribute("data-block-id"));
3091
3092
  };
3092
3093
  }, useHandleCanvasClick = () => {
@@ -3101,8 +3102,8 @@ const useHandleCanvasDblClick = () => {
3101
3102
  return;
3102
3103
  }
3103
3104
  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]);
3105
+ const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
3106
+ n.includes(g) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: g }]), r([g]);
3106
3107
  } else if (d != null && d.getAttribute("data-block-id")) {
3107
3108
  let u = d.getAttribute("data-block-id");
3108
3109
  n.includes(u) || i == null || i.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
@@ -3125,10 +3126,10 @@ const useHandleCanvasDblClick = () => {
3125
3126
  return;
3126
3127
  const p = getElementByDataBlockId(n, first(r));
3127
3128
  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 }]);
3129
+ const g = p.getAttribute("data-style-prop");
3130
+ if (g) {
3131
+ const x = p.getAttribute("data-style-id"), m = p.getAttribute("data-block-parent");
3132
+ l([{ id: x, prop: g, blockId: m }]);
3132
3133
  }
3133
3134
  }
3134
3135
  }, 100);
@@ -3148,14 +3149,14 @@ const useHandleCanvasDblClick = () => {
3148
3149
  }
3149
3150
  );
3150
3151
  }, 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();
3152
+ const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: g } = usePasteBlocks();
3152
3153
  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
3154
  "ctrl+v,command+v",
3154
3155
  () => {
3155
- p(n[0]) && m(n);
3156
+ p(n[0]) && g(n);
3156
3157
  },
3157
3158
  {},
3158
- [n, p, m]
3159
+ [n, p, g]
3159
3160
  );
3160
3161
  const x = o ? { document: o } : {};
3161
3162
  useHotkeys("esc", () => r([]), x, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...x, preventDefault: !0 }, [
@@ -3163,8 +3164,8 @@ const useHandleCanvasDblClick = () => {
3163
3164
  l
3164
3165
  ]), useHotkeys(
3165
3166
  "del, backspace",
3166
- (g) => {
3167
- g.preventDefault(), a(n);
3167
+ (m) => {
3168
+ m.preventDefault(), a(n);
3168
3169
  },
3169
3170
  x,
3170
3171
  [n, a]
@@ -3195,15 +3196,15 @@ const useHandleCanvasDblClick = () => {
3195
3196
  }
3196
3197
  );
3197
3198
  }, 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({
3199
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: g } = useFloating({
3199
3200
  placement: "top-start",
3200
3201
  middleware: [shift(), flip()],
3201
3202
  elements: {
3202
3203
  reference: o
3203
3204
  }
3204
3205
  });
3205
- useResizeObserver(o, () => m(), o !== null);
3206
- const x = get(n, "_parent", null), g = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3206
+ useResizeObserver(o, () => g(), o !== null);
3207
+ const x = get(n, "_parent", null), m = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3207
3208
  return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3208
3209
  "div",
3209
3210
  {
@@ -3229,7 +3230,7 @@ const useHandleCanvasDblClick = () => {
3229
3230
  }
3230
3231
  }
3231
3232
  ),
3232
- /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: g, block: n }),
3233
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: m, block: n }),
3233
3234
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
3234
3235
  canAddChildBlock(get(n, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3235
3236
  PlusIcon,
@@ -3252,9 +3253,9 @@ const useHandleCanvasDblClick = () => {
3252
3253
  }
3253
3254
  ) });
3254
3255
  }, 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(
3256
+ 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
3257
  u == null ? void 0 : u.getElementById("selected-block")
3257
- ), [g] = useState(
3258
+ ), [m] = useState(
3258
3259
  u == null ? void 0 : u.getElementById("selected-styling-block")
3259
3260
  ), [E] = useState(
3260
3261
  u == null ? void 0 : u.getElementById("dragged-block")
@@ -3323,12 +3324,12 @@ const useHandleCanvasDblClick = () => {
3323
3324
  }, [r, x]), useEffect(() => {
3324
3325
  E.textContent = c ? `[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3325
3326
  }, [c, E]), 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: k }) => `[data-style-id="${k}"]`).join(",")}{
3327
+ g && (g.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
3328
+ }, [l, r, g]), useEffect(() => {
3329
+ m && (m.textContent = `${map(i, ({ id: k }) => `[data-style-id="${k}"]`).join(",")}{
3329
3330
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3330
3331
  }`);
3331
- }, [i, g]), useEffect(() => {
3332
+ }, [i, m]), useEffect(() => {
3332
3333
  u.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3333
3334
  }, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (f || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3334
3335
  "link",
@@ -3345,13 +3346,13 @@ const useHandleCanvasDblClick = () => {
3345
3346
  u || (u = d, d = "xs");
3346
3347
  const p = r.indexOf(d);
3347
3348
  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;
3349
+ const g = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
3350
+ if (g.includes(u))
3351
+ for (let m = p; m < r.length; m++)
3352
+ i[m] = !0;
3352
3353
  else if (x.includes(u))
3353
- for (let g = p; g < r.length; g++)
3354
- i[g] = !1;
3354
+ for (let m = p; m < r.length; m++)
3355
+ i[m] = !1;
3355
3356
  }
3356
3357
  }
3357
3358
  return i[a];
@@ -3378,16 +3379,16 @@ const useHandleCanvasDblClick = () => {
3378
3379
  forEach(d, (u) => {
3379
3380
  if (get(n, u, "") || get(a, `${u}.loading`, !1))
3380
3381
  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) => ({
3382
+ const p = o.find((g) => g._id === u);
3383
+ l((g) => ({ ...g, [u]: { loading: !0, error: null } })), c(p).then((g) => {
3384
+ r((x) => ({ ...x, [u]: g })), l((x) => ({
3384
3385
  ...x,
3385
3386
  [u]: { loading: !1, error: null }
3386
3387
  }));
3387
- }).catch((m) => {
3388
+ }).catch((g) => {
3388
3389
  l((x) => ({
3389
3390
  ...x,
3390
- [u]: { loading: !1, error: m.message }
3391
+ [u]: { loading: !1, error: g.message }
3391
3392
  }));
3392
3393
  });
3393
3394
  });
@@ -3444,7 +3445,7 @@ function isDescendant(o, n, r) {
3444
3445
  }
3445
3446
  const RenderGlobalBlock = ({ blocks: o, allBlocks: n }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: o });
3446
3447
  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((f) => getStyleAttrs(f, c), [c]), [x] = useChaiExternalData(), [g] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3448
+ 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
3449
  (f) => f.reduce((j, k) => {
3449
3450
  const A = get(d, k, {});
3450
3451
  return { ...j, ...A };
@@ -3453,7 +3454,7 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3453
3454
  );
3454
3455
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3455
3456
  o.map((f, j) => {
3456
- if (g === f._id || u.includes(f._id))
3457
+ if (m === f._id || u.includes(f._id))
3457
3458
  return null;
3458
3459
  const k = {}, A = filter(n, { _parent: f._id });
3459
3460
  if (k.children = A.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: A }) : null, f._type === "GlobalBlock") {
@@ -3463,7 +3464,7 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3463
3464
  const S = getBlockComponent(f._type), B = get(S, "server", !1), C = B ? RSCBlock : get(S, "builderComponent", get(S, "component", null));
3464
3465
  if (isNull(C))
3465
3466
  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 = m(f);
3467
+ const w = has(S, "getBlockStateFrom") ? S == null ? void 0 : S.getBlockStateFrom(f, n) : [], N = E(w), D = g(f);
3467
3468
  if (get(D, "__isHidden", !1) && !includes(r, f._id))
3468
3469
  return null;
3469
3470
  const T = l && isDescendant(l._id, f._id, n), b = {
@@ -3537,7 +3538,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3537
3538
  n(i);
3538
3539
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
3539
3540
  }, 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([]), [, E] = useAtom$1(canvasIframeAtom), [f, j] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), A = useBuilderProp("htmlDir", "ltr"), S = (w) => {
3541
+ 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
3542
  u((N) => ({ ...N, width: w }));
3542
3543
  };
3543
3544
  useEffect(() => {
@@ -3562,9 +3563,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3562
3563
  i.current.contentDocument,
3563
3564
  first(f).id
3564
3565
  );
3565
- g(w ? [w] : [null]);
3566
+ m(w ? [w] : [null]);
3566
3567
  } else
3567
- g([null]);
3568
+ m([null]);
3568
3569
  }, [f]);
3569
3570
  const C = useMemo(() => {
3570
3571
  let w = IframeInitialContent;
@@ -3597,7 +3598,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3597
3598
  BlockActionsStatic,
3598
3599
  {
3599
3600
  block: a,
3600
- selectedBlockElement: first(m)
3601
+ selectedBlockElement: first(g)
3601
3602
  }
3602
3603
  ),
3603
3604
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, { model: "page" }),
@@ -3692,7 +3693,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3692
3693
  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
3694
  /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "inline-flex items-center", children: [
3694
3695
  /* @__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 })
3696
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3696
3697
  ] }),
3697
3698
  reverse(o).map((a, l) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "inline-flex items-center", children: [
3698
3699
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -3710,10 +3711,10 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3710
3711
  ]
3711
3712
  }
3712
3713
  ),
3713
- l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { size: 16 })
3714
+ l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3714
3715
  ] }, l))
3715
3716
  ] }) });
3716
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-JFNyNUeD.js")), CanvasArea = () => {
3717
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-4u3Q97EK.js")), CanvasArea = () => {
3717
3718
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3718
3719
  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
3720
  /* @__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, {}) }) }),
@@ -3793,9 +3794,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3793
3794
  }, {
3794
3795
  bodyFont: u,
3795
3796
  headingFont: p,
3796
- primaryColor: m,
3797
+ primaryColor: g,
3797
3798
  bodyTextDarkColor: x,
3798
- bodyTextLightColor: g,
3799
+ bodyTextLightColor: m,
3799
3800
  bodyBgDarkColor: E,
3800
3801
  secondaryColor: f,
3801
3802
  bodyBgLightColor: j,
@@ -3816,7 +3817,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3816
3817
  title: c("theme_config.rounded_corner"),
3817
3818
  default: parseInt(k || 5, 10)
3818
3819
  }),
3819
- primaryColor: h({ title: c("theme_config.primary"), default: m }),
3820
+ primaryColor: h({ title: c("theme_config.primary"), default: g }),
3820
3821
  secondaryColor: h({ title: c("theme_config.secondary"), default: f })
3821
3822
  };
3822
3823
  l || (A = {
@@ -3835,7 +3836,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3835
3836
  }),
3836
3837
  bodyTextDarkColor: h({
3837
3838
  title: c("theme_config.text_color_dark_mode"),
3838
- default: g
3839
+ default: m
3839
3840
  })
3840
3841
  });
3841
3842
  const S = {
@@ -4040,7 +4041,7 @@ function BiExpandVertical(o) {
4040
4041
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4041
4042
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
4042
4043
  let p = null;
4043
- const m = o.children.length > 0, { id: x, data: g, isSelected: E, willReceiveDrop: f, isDragging: j, isEditing: k, handleClick: A } = o, S = (T) => {
4044
+ const g = o.children.length > 0, { id: x, data: m, isSelected: E, willReceiveDrop: f, isDragging: j, isEditing: k, handleClick: A } = o, S = (T) => {
4044
4045
  T.stopPropagation(), !i.includes(x) && o.toggle();
4045
4046
  }, B = (T) => {
4046
4047
  T.isInternal && (p = T.isOpen, T.isOpen && T.close());
@@ -4056,14 +4057,14 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4056
4057
  return () => clearTimeout(T);
4057
4058
  }, [f, o, j]);
4058
4059
  const N = useMemo(() => {
4059
- const T = Object.keys(g), b = [];
4060
+ const T = Object.keys(m), b = [];
4060
4061
  for (let _ = 0; _ < T.length; _++)
4061
4062
  if (T[_].endsWith("_attrs")) {
4062
- const R = g[T[_]], v = Object.keys(R).join("|");
4063
+ const R = m[T[_]], v = Object.keys(R).join("|");
4063
4064
  v.match(/x-data/) && b.push("data"), v.match(/x-on/) && b.push("event"), v.match(/x-show|x-if/) && b.push("show");
4064
4065
  }
4065
4066
  return b;
4066
- }, [g]), D = (T, b) => {
4067
+ }, [m]), D = (T, b) => {
4067
4068
  const _ = u.contentDocument || u.contentWindow.document, R = _.querySelector(`[data-block-id=${T}]`);
4068
4069
  R && R.setAttribute("data-drop", b);
4069
4070
  const v = R.getBoundingClientRect(), I = u.getBoundingClientRect();
@@ -4101,7 +4102,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4101
4102
  className: cn(
4102
4103
  "group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
4103
4104
  E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4104
- f && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
4105
+ f && canAcceptChildBlock(m._type, "Icon") ? "bg-green-200" : "",
4105
4106
  j && "opacity-20",
4106
4107
  i.includes(x) ? "opacity-50" : ""
4107
4108
  ),
@@ -4111,11 +4112,11 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4111
4112
  "div",
4112
4113
  {
4113
4114
  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: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4115
+ children: g && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4115
4116
  }
4116
4117
  ),
4117
4118
  /* @__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
+ /* @__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
4120
  k ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4120
4121
  "div",
4121
4122
  {
@@ -4124,7 +4125,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4124
4125
  T.stopPropagation(), o.edit(), o.deselect();
4125
4126
  },
4126
4127
  children: [
4127
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (g == null ? void 0 : g._name) || (g == null ? void 0 : g._type.split("/").pop()) }),
4128
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (m == null ? void 0 : m._name) || (m == null ? void 0 : m._type.split("/").pop()) }),
4128
4129
  N.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4129
4130
  N.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4130
4131
  N.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
@@ -4145,7 +4146,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4145
4146
  ),
4146
4147
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: T.tooltip })
4147
4148
  ] })),
4148
- canAddChildBlock(g == null ? void 0 : g._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4149
+ canAddChildBlock(m == null ? void 0 : m._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4149
4150
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4150
4151
  TooltipTrigger,
4151
4152
  {
@@ -4213,7 +4214,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4213
4214
  }, [treeData, cutBlocksIds]);
4214
4215
  useEffect(() => {
4215
4216
  setTreeRef(treeRef.current);
4216
- }, [treeRef.current]);
4217
+ }, [setTreeRef, treeRef]);
4217
4218
  const onRename = ({ id: o, name: n, node: r }) => {
4218
4219
  updateBlockProps([o], { _name: n }, r.data._name);
4219
4220
  }, onMove = ({ dragIds: o, parentId: n, index: r }) => {
@@ -4280,7 +4281,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4280
4281
  size: "sm",
4281
4282
  children: [
4282
4283
  "+ ",
4283
- t("add_block")
4284
+ t("Add Block")
4284
4285
  ]
4285
4286
  }
4286
4287
  )
@@ -4517,8 +4518,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4517
4518
  const c = stringify([r]);
4518
4519
  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
4520
  } 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];
4521
+ 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");
4522
+ 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
4523
  } else if (r.tagName == "option" && n && ((i = n.block) == null ? void 0 : i._type) === "Select")
4523
4524
  return n.block.options.push({
4524
4525
  label: getTextContent(r.children),
@@ -4579,13 +4580,13 @@ function ExpandableObject(o) {
4579
4580
  level: d,
4580
4581
  style: u,
4581
4582
  shouldExpandNode: p,
4582
- clickToExpandNode: m
4583
+ clickToExpandNode: g
4583
4584
  } = o;
4584
- const x = useRef(!1), [g, E, f] = useBool(() => p(d, r, n));
4585
+ const x = useRef(!1), [m, E, f] = useBool(() => p(d, r, n));
4585
4586
  useEffect(() => {
4586
4587
  x.current ? f(p(d, r, n)) : x.current = !0;
4587
4588
  }, [p]);
4588
- const j = g ? u.collapseIcon : u.expandIcon, k = g ? "collapse JSON" : "expand JSON", A = useComponentId(), S = d + 1, B = a.length - 1, C = (w) => {
4589
+ 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
4590
  w.key === " " && (w.preventDefault(), E());
4590
4591
  };
4591
4592
  return /* @__PURE__ */ createElement("div", {
@@ -4598,9 +4599,9 @@ function ExpandableObject(o) {
4598
4599
  role: "button",
4599
4600
  tabIndex: 0,
4600
4601
  "aria-label": k,
4601
- "aria-expanded": g,
4602
- "aria-controls": g ? A : void 0
4603
- }), n && (m ? /* @__PURE__ */ createElement("span", {
4602
+ "aria-expanded": m,
4603
+ "aria-controls": m ? A : void 0
4604
+ }), n && (g ? /* @__PURE__ */ createElement("span", {
4604
4605
  className: u.clickableLabel,
4605
4606
  onClick: E,
4606
4607
  onKeyDown: C,
@@ -4610,7 +4611,7 @@ function ExpandableObject(o) {
4610
4611
  className: u.label
4611
4612
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4612
4613
  className: u.punctuation
4613
- }, i), g ? /* @__PURE__ */ createElement("div", {
4614
+ }, i), m ? /* @__PURE__ */ createElement("div", {
4614
4615
  id: A
4615
4616
  }, a.map((w, N) => /* @__PURE__ */ createElement(DataRender, {
4616
4617
  key: w[0] || N,
@@ -4620,7 +4621,7 @@ function ExpandableObject(o) {
4620
4621
  lastElement: N === B,
4621
4622
  level: S,
4622
4623
  shouldExpandNode: p,
4623
- clickToExpandNode: m
4624
+ clickToExpandNode: g
4624
4625
  }))) : /* @__PURE__ */ createElement("span", {
4625
4626
  className: u.collapsedContent,
4626
4627
  onClick: E,
@@ -4629,7 +4630,7 @@ function ExpandableObject(o) {
4629
4630
  tabIndex: -1,
4630
4631
  "aria-hidden": !0,
4631
4632
  "aria-label": k,
4632
- "aria-expanded": g
4633
+ "aria-expanded": m
4633
4634
  }), /* @__PURE__ */ createElement("span", {
4634
4635
  className: u.punctuation
4635
4636
  }, c), !l && /* @__PURE__ */ createElement("span", {
@@ -4782,7 +4783,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4782
4783
  dataType: i,
4783
4784
  appliedBindings: c
4784
4785
  }) => {
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), E = useMemo(() => o === "PROP" ? d.filter(
4786
+ 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
4787
  (f) => !includes(c, f) && get(p, `props.${first(split(f, "."))}.binding`)
4787
4788
  ) : d.filter((f) => i === get(u, f, "")), [o, d, c, i, p]);
4788
4789
  return useEffect(() => {
@@ -4790,7 +4791,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4790
4791
  }, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4791
4792
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
4792
4793
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
4793
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: g, children: [
4794
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: m, children: [
4794
4795
  /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4795
4796
  Button,
4796
4797
  {
@@ -4799,7 +4800,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4799
4800
  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
4801
  children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4801
4802
  /* @__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) }),
4803
+ 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
4804
  n
4804
4805
  ] }),
4805
4806
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
@@ -4817,16 +4818,16 @@ const ViewData = ({ data: o, fullView: n }) => {
4817
4818
  CommandItem,
4818
4819
  {
4819
4820
  value: f,
4820
- className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4821
+ className: `cursor-pointer ${g ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4821
4822
  onSelect: (j) => {
4822
- r(find(E, (k) => k === j) || null), g(!1);
4823
+ r(find(E, (k) => k === j) || null), m(!1);
4823
4824
  },
4824
4825
  children: [
4825
4826
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
4826
4827
  /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === f ? "" : "opacity-0"}` }),
4827
4828
  f
4828
4829
  ] }),
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, f, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, f) }) })
4830
+ 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
4831
  ]
4831
4832
  },
4832
4833
  f
@@ -4835,7 +4836,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4835
4836
  ] }) })
4836
4837
  ] })
4837
4838
  ] }),
4838
- !m && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4839
+ !g && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4839
4840
  ] });
4840
4841
  }, AddBindingModalContent = ({
4841
4842
  appliedBindings: o = [],
@@ -4843,7 +4844,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4843
4844
  editMode: r,
4844
4845
  item: a
4845
4846
  }) => {
4846
- const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
4847
+ const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), g = useCallback(
4847
4848
  (E, f) => {
4848
4849
  if (isEmpty(E))
4849
4850
  return "";
@@ -4856,7 +4857,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4856
4857
  }
4857
4858
  },
4858
4859
  [u, p]
4859
- ), [x, g] = useState(r ? m(a.key, "PROP") : "");
4860
+ ), [x, m] = useState(r ? g(a.key, "PROP") : "");
4860
4861
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4861
4862
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
4862
4863
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
@@ -4872,8 +4873,8 @@ const ViewData = ({ data: o, fullView: n }) => {
4872
4873
  value: l,
4873
4874
  setValue: i,
4874
4875
  onChange: (E) => {
4875
- const f = m(E, "PROP");
4876
- i(E), x !== f && d(""), g(f);
4876
+ const f = g(E, "PROP");
4877
+ i(E), x !== f && d(""), m(f);
4877
4878
  },
4878
4879
  data: u,
4879
4880
  dataType: x,
@@ -4890,7 +4891,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4890
4891
  value: c,
4891
4892
  setValue: d,
4892
4893
  onChange: (E) => {
4893
- const f = m(E, "PATH");
4894
+ const f = g(E, "PATH");
4894
4895
  d(x === f ? E : "");
4895
4896
  },
4896
4897
  data: p,
@@ -4934,15 +4935,15 @@ const ViewData = ({ data: o, fullView: n }) => {
4934
4935
  dataProvider: l,
4935
4936
  appliedBindings: i
4936
4937
  }) => {
4937
- const [c, d] = useState("string"), u = (p, m) => {
4938
+ const [c, d] = useState("string"), u = (p, g) => {
4938
4939
  if (isEmpty(p))
4939
4940
  return "";
4940
4941
  {
4941
- const x = get(m === "PROP" ? a : l, p, "");
4942
+ const x = get(g === "PROP" ? a : l, p, "");
4942
4943
  if (isArray$1(x))
4943
4944
  return "list";
4944
- const g = typeof x;
4945
- return g === "string" ? "text" : g === "object" ? "model" : g;
4945
+ const m = typeof x;
4946
+ return m === "string" ? "text" : m === "object" ? "model" : m;
4946
4947
  }
4947
4948
  };
4948
4949
  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 +4964,10 @@ const ViewData = ({ data: o, fullView: n }) => {
4963
4964
  ] });
4964
4965
  }, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
4965
4966
  const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
4966
- map(o, (x, g) => ({ key: g, value: x }))
4967
+ map(o, (x, m) => ({ key: m, value: x }))
4967
4968
  );
4968
4969
  useEffect(() => {
4969
- c(map(o, (x, g) => ({ key: g, value: x })));
4970
+ c(map(o, (x, m) => ({ key: m, value: x })));
4970
4971
  }, [r == null ? void 0 : r._id, o]);
4971
4972
  const d = useMemo(() => {
4972
4973
  if (isEmpty(a))
@@ -4976,21 +4977,21 @@ const ViewData = ({ data: o, fullView: n }) => {
4976
4977
  const x = last(i);
4977
4978
  return isEmpty(x == null ? void 0 : x.key) || isEmpty(x == null ? void 0 : x.value);
4978
4979
  }, [a, i]), u = (x) => {
4979
- const g = filter(i, (E) => E.key !== x.key);
4980
- c([...g, x]), m([...g, x]);
4980
+ const m = filter(i, (E) => E.key !== x.key);
4981
+ c([...m, x]), g([...m, x]);
4981
4982
  }, p = (x) => {
4982
- const g = filter(i, (E, f) => x !== f);
4983
- m([...g]);
4984
- }, m = useCallback(
4983
+ const m = filter(i, (E, f) => x !== f);
4984
+ g([...m]);
4985
+ }, g = useCallback(
4985
4986
  (x = []) => {
4986
4987
  if (c(x), isEmpty(x)) {
4987
4988
  n({});
4988
4989
  return;
4989
4990
  }
4990
- const g = {};
4991
+ const m = {};
4991
4992
  forEach(x, (E) => {
4992
- !isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(g, E.key, E.value);
4993
- }), n(g);
4993
+ !isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(m, E.key, E.value);
4994
+ }), n(m);
4994
4995
  },
4995
4996
  [n]
4996
4997
  );
@@ -4999,12 +5000,12 @@ const ViewData = ({ data: o, fullView: n }) => {
4999
5000
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
5000
5001
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
5001
5002
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
5002
- map(i, (x, g) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5003
+ map(i, (x, m) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5003
5004
  NewDataBindingPair,
5004
5005
  {
5005
5006
  item: x,
5006
5007
  onAddBinding: u,
5007
- onRemove: () => p(g),
5008
+ onRemove: () => p(m),
5008
5009
  selectedBlock: r,
5009
5010
  dataProvider: a,
5010
5011
  appliedBindings: map(i, "key")
@@ -5098,7 +5099,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5098
5099
  }
5099
5100
  )
5100
5101
  ] });
5101
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-vR5ig3Lz.js")), UploadImages = React__default.lazy(() => import("./UploadImages-jCqfO33R.js")), ImagesPanel = ({
5102
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-y0LQATX2.js")), UploadImages = React__default.lazy(() => import("./UploadImages-Nbpt6WL2.js")), ImagesPanel = ({
5102
5103
  isModalView: o = !1,
5103
5104
  onSelect: n = () => {
5104
5105
  }
@@ -5256,18 +5257,18 @@ const ViewData = ({ data: o, fullView: n }) => {
5256
5257
  ] });
5257
5258
  }, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
5258
5259
  const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation();
5259
- Object.keys(n).forEach((m) => {
5260
- const x = n[m];
5260
+ Object.keys(n).forEach((g) => {
5261
+ const x = n[g];
5261
5262
  if (includes(["slot", "styles"], x.type))
5262
5263
  return;
5263
- const g = m;
5264
- c.properties[g] = getBlockJSONFromSchemas(x, u), d[g] = getBlockJSONFromUISchemas(x);
5264
+ const m = g;
5265
+ c.properties[m] = getBlockJSONFromSchemas(x, u), d[m] = getBlockJSONFromUISchemas(x);
5265
5266
  }), useEffect(() => {
5266
5267
  i(r);
5267
5268
  }, [o]);
5268
5269
  const p = useThrottledCallback(
5269
- async ({ formData: m }, x) => {
5270
- a({ formData: m }, x);
5270
+ async ({ formData: g }, x) => {
5271
+ a({ formData: g }, x);
5271
5272
  },
5272
5273
  [a],
5273
5274
  1e3
@@ -5293,8 +5294,8 @@ const ViewData = ({ data: o, fullView: n }) => {
5293
5294
  uiSchema: d,
5294
5295
  schema: c,
5295
5296
  formData: l,
5296
- onChange: ({ formData: m }, x) => {
5297
- x && (i(m), p({ formData: m }, x));
5297
+ onChange: ({ formData: g }, x) => {
5298
+ x && (i(g), p({ formData: g }, x));
5298
5299
  }
5299
5300
  }
5300
5301
  );
@@ -5368,7 +5369,7 @@ function BlockSettings() {
5368
5369
  u({ formData: f }, j, k), c(f);
5369
5370
  }, 1500),
5370
5371
  [o == null ? void 0 : o._id]
5371
- ), m = ({ formData: f }, j) => {
5372
+ ), g = ({ formData: f }, j) => {
5372
5373
  if (j) {
5373
5374
  const k = j.replace("root.", "");
5374
5375
  n(
@@ -5376,7 +5377,7 @@ function BlockSettings() {
5376
5377
  convertDotNotationToObject(k, get(f, k.split(".")))
5377
5378
  ), p({ formData: f }, j, { [k]: get(i, k) });
5378
5379
  }
5379
- }, x = keys(get(l, "_bindings", {})), g = useMemo(() => {
5380
+ }, x = keys(get(l, "_bindings", {})), m = useMemo(() => {
5380
5381
  const f = cloneDeep(get(a, "props", {}));
5381
5382
  return each(f, (j, k) => {
5382
5383
  get(j, "hidden", !1) && delete f[k];
@@ -5421,20 +5422,20 @@ function BlockSettings() {
5421
5422
  JSONForm,
5422
5423
  {
5423
5424
  id: o == null ? void 0 : o._id,
5424
- onChange: m,
5425
+ onChange: g,
5425
5426
  formData: l,
5426
- properties: g
5427
+ properties: m
5427
5428
  }
5428
5429
  )
5429
5430
  ] })
5430
5431
  ] })
5431
- ] }) : isEmpty(g) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5432
+ ] }) : isEmpty(m) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5432
5433
  JSONForm,
5433
5434
  {
5434
5435
  id: o == null ? void 0 : o._id,
5435
- onChange: m,
5436
+ onChange: g,
5436
5437
  formData: l,
5437
- properties: g
5438
+ properties: m
5438
5439
  }
5439
5440
  ),
5440
5441
  (o == null ? void 0 : o._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
@@ -5456,20 +5457,20 @@ const getBlockWithChildren = (o, n) => {
5456
5457
  const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore();
5457
5458
  return {
5458
5459
  askAi: useCallback(
5459
- async (u, p, m, x) => {
5460
+ async (u, p, g, x) => {
5460
5461
  if (l) {
5461
5462
  n(!0), a(null);
5462
5463
  try {
5463
- const g = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((k) => k._id === p))];
5464
- set(g, "0._parent", null);
5465
- const E = await l(u, m, g), { blocks: f, error: j } = E;
5464
+ const m = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((k) => k._id === p))];
5465
+ set(m, "0._parent", null);
5466
+ const E = await l(u, g, m), { blocks: f, error: j } = E;
5466
5467
  if (j) {
5467
5468
  a(j);
5468
5469
  return;
5469
5470
  }
5470
5471
  u === "styles" ? c(f) : i(f), x && x(E);
5471
- } catch (g) {
5472
- a(g);
5472
+ } catch (m) {
5473
+ a(m);
5473
5474
  } finally {
5474
5475
  n(!1), x && x();
5475
5476
  }
@@ -5543,14 +5544,14 @@ function Countdown() {
5543
5544
  ] });
5544
5545
  }
5545
5546
  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();
5547
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, g] = useState();
5547
5548
  useEffect(() => {
5548
- var g;
5549
- (g = d.current) == null || g.focus();
5549
+ var m;
5550
+ (m = d.current) == null || m.focus();
5550
5551
  }, []);
5551
- const x = (g) => {
5552
- const { usage: E } = g || {};
5553
- !l && E && m(E), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
5552
+ const x = (m) => {
5553
+ const { usage: E } = m || {};
5554
+ !l && E && g(E), u.current = setTimeout(() => g(void 0), 1e4), l || c("");
5554
5555
  };
5555
5556
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5556
5557
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
@@ -5559,12 +5560,12 @@ const AskAIStyles = ({ blockId: o }) => {
5559
5560
  {
5560
5561
  ref: d,
5561
5562
  value: i,
5562
- onChange: (g) => c(g.target.value),
5563
+ onChange: (m) => c(m.target.value),
5563
5564
  placeholder: n("ask_ai_to_edit_styles"),
5564
5565
  className: "w-full border border-border focus:border-0",
5565
5566
  rows: 3,
5566
- onKeyDown: (g) => {
5567
- g.key === "Enter" && (g.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x));
5567
+ onKeyDown: (m) => {
5568
+ m.key === "Enter" && (m.preventDefault(), u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, x));
5568
5569
  }
5569
5570
  }
5570
5571
  ),
@@ -5574,7 +5575,7 @@ const AskAIStyles = ({ blockId: o }) => {
5574
5575
  {
5575
5576
  disabled: i.trim().length < 5 || a,
5576
5577
  onClick: () => {
5577
- u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x);
5578
+ u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, x);
5578
5579
  },
5579
5580
  variant: "default",
5580
5581
  className: "w-fit",
@@ -5611,7 +5612,7 @@ const AskAIStyles = ({ blockId: o }) => {
5611
5612
  });
5612
5613
  function ManualClasses() {
5613
5614
  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(), m = (w = first(n)) == null ? void 0 : w.prop, x = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
5615
+ 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
5616
  const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5616
5617
  a(i, N, !0), u("");
5617
5618
  }, [E, f] = useState([]), j = ({ value: N }) => {
@@ -5636,7 +5637,7 @@ function ManualClasses() {
5636
5637
  placeholder: o("enter_classes_separated_by_space"),
5637
5638
  value: d,
5638
5639
  onKeyDown: (N) => {
5639
- N.key === "Enter" && d.trim() !== "" && g();
5640
+ N.key === "Enter" && d.trim() !== "" && m();
5640
5641
  },
5641
5642
  onChange: (N, { newValue: D }) => u(D),
5642
5643
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
@@ -5700,7 +5701,7 @@ function ManualClasses() {
5700
5701
  {
5701
5702
  variant: "outline",
5702
5703
  className: "h-6 border-border",
5703
- onClick: g,
5704
+ onClick: m,
5704
5705
  disabled: d.trim() === "",
5705
5706
  size: "sm",
5706
5707
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
@@ -6114,7 +6115,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6114
6115
  ringColor: "ring",
6115
6116
  ringOffsetColor: "ring-offset"
6116
6117
  }, 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(
6118
+ 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
6119
  // eslint-disable-next-line no-shadow
6119
6120
  (f) => {
6120
6121
  ["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" })));
@@ -6122,16 +6123,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6122
6123
  [c, u]
6123
6124
  );
6124
6125
  useEffect(() => {
6125
- if (["current", "inherit", "transparent", "black", "white"].includes(m))
6126
+ if (["current", "inherit", "transparent", "black", "white"].includes(g))
6126
6127
  return c([]);
6127
6128
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
6128
- }, [m]);
6129
+ }, [g]);
6129
6130
  const E = useCallback(
6130
6131
  // eslint-disable-next-line no-shadow
6131
6132
  (f) => {
6132
- u({ color: m, shade: f });
6133
+ u({ color: g, shade: f });
6133
6134
  },
6134
- [m]
6135
+ [g]
6135
6136
  );
6136
6137
  return useEffect(() => {
6137
6138
  u({ color: "", shade: "" });
@@ -6144,8 +6145,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6144
6145
  {
6145
6146
  disabled: !l,
6146
6147
  rounded: !0,
6147
- selected: m,
6148
- onChange: g,
6148
+ selected: g,
6149
+ onChange: m,
6149
6150
  options: [
6150
6151
  "current",
6151
6152
  "transparent",
@@ -6178,7 +6179,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6178
6179
  ]
6179
6180
  }
6180
6181
  ) }),
6181
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !m || !l, onChange: E, options: i }) })
6182
+ /* @__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
6183
  ] });
6183
6184
  }, getUserInputValues = (o, n) => {
6184
6185
  o = o.toLowerCase();
@@ -6373,14 +6374,14 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6373
6374
  },
6374
6375
  a
6375
6376
  )) }), 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]), [E, f] = useState(!1), [j, k] = useState(""), [A, S] = useState(!1), [B, C] = useState(!1);
6377
+ 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
6378
  useEffect(() => {
6378
6379
  const { value: b, unit: _ } = getClassValueAndUnit(i);
6379
6380
  if (_ === "") {
6380
- l(b), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6381
+ l(b), m(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6381
6382
  return;
6382
6383
  }
6383
- g(_), l(_ === "class" || isEmpty(b) ? "" : b);
6384
+ m(_), l(_ === "class" || isEmpty(b) ? "" : b);
6384
6385
  }, [i, u, p]);
6385
6386
  const w = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), N = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), D = useCallback(
6386
6387
  (b = !1) => {
@@ -6480,7 +6481,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6480
6481
  units: p,
6481
6482
  current: x,
6482
6483
  onSelect: (b) => {
6483
- r(!1), g(b), T(b);
6484
+ r(!1), m(b), T(b);
6484
6485
  }
6485
6486
  }
6486
6487
  ) }) })
@@ -6505,7 +6506,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6505
6506
  },
6506
6507
  currentValue: a,
6507
6508
  unit: x,
6508
- negative: m,
6509
+ negative: g,
6509
6510
  cssProperty: u
6510
6511
  }
6511
6512
  )
@@ -6598,17 +6599,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6598
6599
  "2xl": "1536px"
6599
6600
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6600
6601
  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(), E = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), j = useMemo(() => get(x, "fullCls", ""), [x]), k = useCallback(
6602
+ }, 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
6603
  (N, D = !0) => {
6603
- const T = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
6604
+ const T = { dark: u, mq: g, mod: p, cls: N, property: l, fullCls: "" };
6604
6605
  (u || p !== "") && (T.mq = "xs");
6605
6606
  const b = generateFullClsName(T);
6606
- g(f, [b], D);
6607
+ m(f, [b], D);
6607
6608
  },
6608
- [f, u, m, p, l, g]
6609
+ [f, u, g, p, l, m]
6609
6610
  ), A = useCallback(() => {
6610
6611
  E(f, [j]);
6611
- }, [f, j, E]), S = useMemo(() => canChangeClass(x, m), [x, m]);
6612
+ }, [f, j, E]), S = useMemo(() => canChangeClass(x, g), [x, g]);
6612
6613
  useEffect(() => {
6613
6614
  i(S, x);
6614
6615
  }, [S, i, x]);
@@ -6624,7 +6625,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6624
6625
  }[N]);
6625
6626
  },
6626
6627
  [B]
6627
- ), w = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === m;
6628
+ ), w = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === g;
6628
6629
  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
6630
  /* @__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
6631
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
@@ -6686,7 +6687,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6686
6687
  units: i = basicUnits,
6687
6688
  negative: c = !1
6688
6689
  }) => {
6689
- const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), x = useCallback((g) => map(m, "property").includes(g), [m]);
6690
+ const { t: d } = useTranslation(), [u, p] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), x = useCallback((m) => map(g, "property").includes(m), [g]);
6690
6691
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6691
6692
  "div",
6692
6693
  {
@@ -6695,7 +6696,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6695
6696
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
6696
6697
  o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
6697
6698
  /* @__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: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6699
+ n.map(({ label: m, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6699
6700
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
6700
6701
  "button",
6701
6702
  {
@@ -6710,7 +6711,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6710
6711
  ]
6711
6712
  }
6712
6713
  ) }),
6713
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(g)) })
6714
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(m)) })
6714
6715
  ] }) }))
6715
6716
  ) })
6716
6717
  ] }),
@@ -6775,8 +6776,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6775
6776
  if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
6776
6777
  return null;
6777
6778
  const u = (p) => {
6778
- const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6779
- l([o._id], m, !0);
6779
+ const g = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6780
+ l([o._id], g, !0);
6780
6781
  };
6781
6782
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
6782
6783
  /* @__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 +6831,13 @@ function BlockStyling() {
6830
6831
  cssProperty: ""
6831
6832
  }), d = useThrottledCallback(
6832
6833
  (p) => {
6833
- const m = !get(i, "negative", !1), x = get(i, "cssProperty", "");
6834
- let g = parseFloat(i.dragStartValue);
6835
- g = isNaN(g) ? 0 : g;
6834
+ const g = !get(i, "negative", !1), x = get(i, "cssProperty", "");
6835
+ let m = parseFloat(i.dragStartValue);
6836
+ m = isNaN(m) ? 0 : m;
6836
6837
  let E = MAPPER[i.dragUnit];
6837
6838
  (startsWith(x, "scale") || x === "opacity") && (E = 10);
6838
- let j = (i.dragStartY - p.pageY) / E + g;
6839
- m && j < 0 && (j = 0), x === "opacity" && j > 1 && (j = 1), i.onDrag(`${j}`), l(`${j}`);
6839
+ let j = (i.dragStartY - p.pageY) / E + m;
6840
+ g && j < 0 && (j = 0), x === "opacity" && j > 1 && (j = 1), i.onDrag(`${j}`), l(`${j}`);
6840
6841
  },
6841
6842
  [i],
6842
6843
  50
@@ -6922,7 +6923,7 @@ const BlockCard = ({
6922
6923
  library: n,
6923
6924
  parentId: r = void 0
6924
6925
  }) => {
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), E = (k) => {
6926
+ 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
6927
  const A = has(k, "styles_attrs.data-page-section");
6927
6928
  return k._type === "Box" && A;
6928
6929
  }, f = useCallback(
@@ -6948,7 +6949,7 @@ const BlockCard = ({
6948
6949
  };
6949
6950
  } else
6950
6951
  k.dataTransfer.setDragImage(new Image(), 0, 0);
6951
- g(B), setTimeout(() => {
6952
+ m(B), setTimeout(() => {
6952
6953
  u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6953
6954
  }, 200);
6954
6955
  }
@@ -6969,11 +6970,11 @@ const BlockCard = ({
6969
6970
  /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
6970
6971
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
6971
6972
  ] }),
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 }) })
6973
+ 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
6974
  ]
6974
6975
  }
6975
6976
  ) }),
6976
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m }) })
6977
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: g }) })
6977
6978
  ] });
6978
6979
  }, libraryBlocksAtom = atom$1(
6979
6980
  {}
@@ -6989,7 +6990,7 @@ const BlockCard = ({
6989
6990
  })();
6990
6991
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
6991
6992
  }, UILibrarySection = ({ parentId: o }) => {
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"), [m, x] = useState("Hero"), g = get(p, m, []), E = useRef(null), { t: f } = useTranslation(), j = (S) => {
6993
+ 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
6994
  E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
6994
6995
  E.current && x(S);
6995
6996
  }, 300);
@@ -6999,7 +7000,7 @@ const BlockCard = ({
6999
7000
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7000
7001
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7001
7002
  ] });
7002
- const k = filter(g, (S, B) => B % 2 === 0), A = filter(g, (S, B) => B % 2 === 1);
7003
+ const k = filter(m, (S, B) => B % 2 === 0), A = filter(m, (S, B) => B % 2 === 1);
7003
7004
  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
7005
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7005
7006
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
@@ -7015,7 +7016,7 @@ const BlockCard = ({
7015
7016
  onClick: () => x(B),
7016
7017
  className: cn(
7017
7018
  "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
- B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7019
+ B === g ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7019
7020
  ),
7020
7021
  children: [
7021
7022
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(f(B.toLowerCase())) }),
@@ -7483,14 +7484,14 @@ i18n.use(initReactI18next).init({
7483
7484
  }
7484
7485
  });
7485
7486
  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")) {
7487
+ const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, g] = useHighlightBlockId(), x = () => {
7488
+ if (has(o, "blocks")) {
7488
7489
  const f = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7489
7490
  u(syncBlocksWithDefaults(f), r || null);
7490
7491
  } else
7491
7492
  d(o, r || null);
7492
7493
  emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7493
- }, g = useFeature("dnd"), { t: E } = useTranslation();
7494
+ }, m = useFeature("dnd"), { t: E } = useTranslation();
7494
7495
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
7495
7496
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7496
7497
  "button",
@@ -7500,10 +7501,10 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7500
7501
  type: "button",
7501
7502
  onDragStart: (f) => {
7502
7503
  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([]), m(null);
7504
+ p([]), g(null);
7504
7505
  }, 200);
7505
7506
  },
7506
- draggable: g ? "true" : "false",
7507
+ draggable: m ? "true" : "false",
7507
7508
  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
7509
  children: [
7509
7510
  createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
@@ -7672,14 +7673,14 @@ function QuickPrompts({ onClick: o }) {
7672
7673
  ) }) });
7673
7674
  }
7674
7675
  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);
7676
+ 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
7677
  useEffect(() => {
7677
7678
  var f;
7678
7679
  (f = x.current) == null || f.focus();
7679
7680
  }, []);
7680
7681
  const E = (f) => {
7681
7682
  const { usage: j } = f || {};
7682
- !l && j && m(j), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
7683
+ !l && j && g(j), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
7683
7684
  };
7684
7685
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
7685
7686
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -7704,7 +7705,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7704
7705
  className: "w-full",
7705
7706
  rows: 3,
7706
7707
  onKeyDown: (f) => {
7707
- f.key === "Enter" && (f.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E));
7708
+ f.key === "Enter" && (f.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E));
7708
7709
  }
7709
7710
  }
7710
7711
  ),
@@ -7714,7 +7715,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7714
7715
  {
7715
7716
  disabled: i.trim().length < 5 || a,
7716
7717
  onClick: () => {
7717
- g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E);
7718
+ m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E);
7718
7719
  },
7719
7720
  variant: "default",
7720
7721
  className: "w-fit",
@@ -7747,7 +7748,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7747
7748
  QuickPrompts,
7748
7749
  {
7749
7750
  onClick: (f) => {
7750
- g.current && clearTimeout(g.current), m(void 0), r("content", o, f, E);
7751
+ m.current && clearTimeout(m.current), g(void 0), r("content", o, f, E);
7751
7752
  }
7752
7753
  }
7753
7754
  )
@@ -7757,7 +7758,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7757
7758
  ] }) }) : null
7758
7759
  ] });
7759
7760
  }, 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);
7761
+ 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
7762
  useEffect(() => {
7762
7763
  n && a(n);
7763
7764
  }, [n]);
@@ -7767,7 +7768,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7767
7768
  title: o("Updated AI Context"),
7768
7769
  description: o("You can now Ask AI to edit your content"),
7769
7770
  variant: "default"
7770
- }), g.current.click();
7771
+ }), m.current.click();
7771
7772
  } catch (f) {
7772
7773
  p(f);
7773
7774
  } finally {
@@ -7778,12 +7779,12 @@ const AIUserPrompt = ({ blockId: o }) => {
7778
7779
  Accordion,
7779
7780
  {
7780
7781
  onValueChange: (f) => {
7781
- m(f !== "");
7782
+ g(f !== "");
7782
7783
  },
7783
7784
  type: "single",
7784
7785
  collapsible: !0,
7785
7786
  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") }) }) }),
7787
+ /* @__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
7788
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
7788
7789
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7789
7790
  Textarea,
@@ -7857,32 +7858,32 @@ const AIUserPrompt = ({ blockId: o }) => {
7857
7858
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
7858
7859
  ] });
7859
7860
  }, 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(""), E = useRef(null), f = useRef(null);
7861
+ const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [x, m] = useState(""), E = useRef(null), f = useRef(null);
7861
7862
  useEffect(() => {
7862
7863
  l(n);
7863
7864
  }, [n]);
7864
7865
  const j = () => {
7865
7866
  if (i.startsWith("@")) {
7866
- g("Attribute keys cannot start with '@'");
7867
+ m("Attribute keys cannot start with '@'");
7867
7868
  return;
7868
7869
  }
7869
7870
  if (i) {
7870
7871
  const C = [...a, { key: i, value: d }];
7871
- r(C), l(a), c(""), u(""), g("");
7872
+ r(C), l(a), c(""), u(""), m("");
7872
7873
  }
7873
7874
  }, k = (C) => {
7874
7875
  const w = a.filter((N, D) => D !== C);
7875
7876
  r(w), l(w);
7876
7877
  }, A = (C) => {
7877
- m(C), c(a[C].key), u(a[C].value);
7878
+ g(C), c(a[C].key), u(a[C].value);
7878
7879
  }, S = () => {
7879
7880
  if (i.startsWith("@")) {
7880
- g("Attribute keys cannot start with '@'");
7881
+ m("Attribute keys cannot start with '@'");
7881
7882
  return;
7882
7883
  }
7883
7884
  if (p !== null && i) {
7884
7885
  const C = [...a];
7885
- C[p] = { key: i, value: d }, r(C), l(C), m(null), c(""), u(""), g("");
7886
+ C[p] = { key: i, value: d }, r(C), l(C), g(null), c(""), u(""), m("");
7886
7887
  }
7887
7888
  }, B = (C) => {
7888
7889
  C.key === "Enter" && !C.shiftKey && (C.preventDefault(), p !== null ? S() : j());
@@ -8372,15 +8373,15 @@ function RemoveProviderConfirmation({
8372
8373
  const PageDataProviders = () => {
8373
8374
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8374
8375
  filter(n, (j) => map(r, "providerKey").includes(j.providerKey))
8375
- ), [d, u] = useState(""), [p, m] = useState(null), x = filter(
8376
+ ), [d, u] = useState(""), [p, g] = useState(null), x = filter(
8376
8377
  n.map((j) => map(i, "providerKey").includes(j.providerKey) ? null : { value: j.providerKey, label: j.name }),
8377
8378
  (j) => !isNull(j)
8378
- ), g = (j) => {
8379
+ ), m = (j) => {
8379
8380
  const k = find(n, { providerKey: j });
8380
8381
  c((A) => [...A, k]), a((A) => [...A, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8381
8382
  }, E = (j) => {
8382
8383
  c((k) => filter(k, (A) => A.providerKey !== j.providerKey)), a((k) => filter(k, (A) => A.providerKey !== j.providerKey)), l("UNSAVED");
8383
- }, f = (j) => m(j);
8384
+ }, f = (j) => g(j);
8384
8385
  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
8386
  o("no_data_providers"),
8386
8387
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8388,7 +8389,7 @@ const PageDataProviders = () => {
8388
8389
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
8389
8390
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
8390
8391
  /* @__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: (j) => g(j), children: [
8392
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (j) => m(j), children: [
8392
8393
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
8393
8394
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
8394
8395
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
@@ -8469,14 +8470,14 @@ const PageDataProviders = () => {
8469
8470
  },
8470
8471
  j.providerKey
8471
8472
  )) }),
8472
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
8473
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => g(null), provider: p })
8473
8474
  ] })
8474
8475
  ] });
8475
8476
  };
8476
8477
  function AiFillDatabase(o) {
8477
8478
  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
8479
  }
8479
- const TopBar = lazy(() => import("./Topbar-bca7NmyC.js"));
8480
+ const TopBar = lazy(() => import("./Topbar-i55trLGw.js"));
8480
8481
  function useSidebarMenuItems(o) {
8481
8482
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8482
8483
  return useMemo(() => {
@@ -8503,14 +8504,14 @@ function isDualLayout(o) {
8503
8504
  }
8504
8505
  const RootLayout = () => {
8505
8506
  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);
8507
+ useChaiBuilderMsgListener(({ name: m }) => {
8508
+ m === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
8508
8509
  });
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");
8510
+ const i = useBuilderProp("sideBarComponents.top", []), c = (m) => {
8511
+ m.preventDefault();
8512
+ }, d = (m) => {
8513
+ n(o === m ? null : m);
8514
+ }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), g = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
8514
8515
  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
8516
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8516
8517
  "div",
@@ -8521,18 +8522,18 @@ const RootLayout = () => {
8521
8522
  /* @__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
8523
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
8523
8524
  /* @__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, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8525
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: g.map((m, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8525
8526
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8526
8527
  Button,
8527
8528
  {
8528
8529
  variant: o === E ? "default" : "ghost",
8529
8530
  className: "mb-2 rounded-lg p-2 transition-colors",
8530
8531
  onClick: () => d(E),
8531
- children: get(g, "icon", null)
8532
+ children: get(m, "icon", null)
8532
8533
  },
8533
8534
  E
8534
8535
  ) }),
8535
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(g.label) }) })
8536
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(m.label) }) })
8536
8537
  ] }, "button" + E)) }),
8537
8538
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
8538
8539
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
@@ -8551,10 +8552,10 @@ const RootLayout = () => {
8551
8552
  transition: { duration: 0.3, ease: "easeInOut" },
8552
8553
  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
8554
  /* @__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) })
8555
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(g, `${o}.icon`, null) }),
8556
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(g[o].label) })
8556
8557
  ] }),
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), {}) }) })
8558
+ /* @__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
8559
  ] }) })
8559
8560
  }
8560
8561
  ),
@@ -8571,7 +8572,7 @@ const RootLayout = () => {
8571
8572
  transition: { duration: 0.3, ease: "easeInOut" },
8572
8573
  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
8574
  /* @__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" }),
8575
+ /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: "16", className: "rtl:ml-2" }),
8575
8576
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p("Block Settings") })
8576
8577
  ] }),
8577
8578
  /* @__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, {}) }) })
@@ -8700,8 +8701,8 @@ export {
8700
8701
  useBlocksStoreUndoableActions as a8,
8701
8702
  useUpdateBlocksProps as b,
8702
8703
  useUpdateBlocksPropsRealtime as c,
8703
- useSavePage as d,
8704
- useBuilderProp as e,
8704
+ useBuilderProp as d,
8705
+ useSavePage as e,
8705
8706
  usePreviewMode as f,
8706
8707
  CanvasArea$1 as g,
8707
8708
  BlockStyling as h,