@chaibuilder/sdk 2.4.5 → 2.5.0

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.
package/dist/core.js CHANGED
@@ -11,7 +11,7 @@ import { atom, useAtom as useAtom$1, useAtomValue as useAtomValue$1, getDefaultS
11
11
  import { atomWithStorage, splitAtom, useAtomCallback } from "jotai/utils";
12
12
  import { g as generateUUID, a as getBreakpointValue, c as cn$2 } from "./common-functions-BGzDsf1z.js";
13
13
  import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, b8 as cn$1, aW as Skeleton, d as Alert, e as AlertDescription, at as Input$1, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, av as Popover, b4 as Tooltip, b7 as TooltipTrigger, ay as PopoverTrigger, b5 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, a6 as DialogHeader, a9 as DialogTitle, B as Badge, b6 as TooltipProvider, a as AccordionItem, b as AccordionTrigger, c as AccordionContent, ag as DropdownMenuLabel, ak as DropdownMenuSeparator, ac as DropdownMenuCheckboxItem, aq as HoverCard, as as HoverCardTrigger, ar as HoverCardContent, b1 as Textarea, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, z as CardFooter, az as ScrollArea, aZ as Tabs, a$ as TabsList, b0 as TabsTrigger, a_ as TabsContent, aX as Slider, aB as Select$1, aJ as SelectTrigger, aK as SelectValue, aC as SelectContent, aE as SelectItem, aL as Separator, aY as Switch, g as AlertDialog, q as AlertDialogTrigger, j as AlertDialogContent, m as AlertDialogHeader, p as AlertDialogTitle, k as AlertDialogDescription, l as AlertDialogFooter, i as AlertDialogCancel, h as AlertDialogAction, r as Avatar, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./toggle-CyXEVUOu.js";
14
- import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, ChevronLeft, DatabaseIcon, Plus, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, PlusCircle, ChevronDown, Info, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Undo as Undo$1, ImportIcon, Type, CornerUpRight, Palette, Sun, Moon, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Layers } from "lucide-react";
14
+ import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, Edit2Icon, ChevronLeft, DatabaseIcon, Plus, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, PlusCircle, ChevronDown, Info, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Undo as Undo$1, ImportIcon, Type, CornerUpRight, Palette, Sun, Moon, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Layers } from "lucide-react";
15
15
  import clsx$1, { clsx } from "clsx";
16
16
  import { twMerge } from "tailwind-merge";
17
17
  import TreeModel from "tree-model";
@@ -37,7 +37,7 @@ import { useFeature } from "flagged";
37
37
  import { parse, stringify } from "himalaya";
38
38
  import { Tree } from "react-arborist";
39
39
  import i18n from "i18next";
40
- import { default as We } from "i18next";
40
+ import { default as ze } from "i18next";
41
41
  import tailwindAspectRatio from "@tailwindcss/aspect-ratio";
42
42
  import tailwindForms from "@tailwindcss/forms";
43
43
  import tailwindTypography from "@tailwindcss/typography";
@@ -348,8 +348,8 @@ function insertBlocksAtPosition(o, r, n, a) {
348
348
  }), l.unshift(m), i = i.map((f) => {
349
349
  if (f._id === n) {
350
350
  const x = { ...f, content: "" };
351
- return Object.keys(x).forEach((k) => {
352
- k.startsWith("content-") && (x[k] = "");
351
+ return Object.keys(x).forEach((y) => {
352
+ y.startsWith("content-") && (x[y] = "");
353
353
  }), x;
354
354
  }
355
355
  return f;
@@ -484,8 +484,8 @@ const broadcastChannel = new BroadcastChannel("chaibuilder"), useBroadcastChanne
484
484
  m && "content" in m && (n = n.map((f) => {
485
485
  if (f._id === u) {
486
486
  const x = { ...f, content: h.content };
487
- return Object.keys(h).forEach((k) => {
488
- k.startsWith("content-") && (x[k] = h[k]);
487
+ return Object.keys(h).forEach((y) => {
488
+ y.startsWith("content-") && (x[y] = h[y]);
489
489
  }), x;
490
490
  }
491
491
  return f;
@@ -839,50 +839,50 @@ const undoRedoStateAtom = atom({
839
839
  updateBlocksProps: c
840
840
  } = useBlocksStoreManager();
841
841
  return {
842
- moveBlocks: (x, k, b) => {
843
- const A = map(x, (_) => {
844
- const w = r.find((E) => E._id === _)._parent || null, C = r.filter((E) => w ? E._parent === w : !E._parent).map((E) => E._id).indexOf(_);
845
- return { _id: _, oldParent: w, oldPosition: C };
846
- }), B = A.find(({ _id: _ }) => _ === x[0]);
847
- B && B.oldParent === k && B.oldPosition === b || (i(x, k, b), o({
848
- undo: () => each(A, ({ _id: _, oldParent: N, oldPosition: w }) => {
849
- i([_], N, w);
842
+ moveBlocks: (x, y, b) => {
843
+ const A = map(x, (B) => {
844
+ const w = r.find((E) => E._id === B)._parent || null, S = r.filter((E) => w ? E._parent === w : !E._parent).map((E) => E._id).indexOf(B);
845
+ return { _id: B, oldParent: w, oldPosition: S };
846
+ }), _ = A.find(({ _id: B }) => B === x[0]);
847
+ _ && _.oldParent === y && _.oldPosition === b || (i(x, y, b), o({
848
+ undo: () => each(A, ({ _id: B, oldParent: N, oldPosition: w }) => {
849
+ i([B], N, w);
850
850
  }),
851
- redo: () => i(x, k, b)
851
+ redo: () => i(x, y, b)
852
852
  }));
853
853
  },
854
- addBlocks: (x, k, b) => {
855
- a(x, k, b), o({
854
+ addBlocks: (x, y, b) => {
855
+ a(x, y, b), o({
856
856
  undo: () => l(map(x, "_id")),
857
- redo: () => a(x, k, b)
857
+ redo: () => a(x, y, b)
858
858
  });
859
859
  },
860
860
  removeBlocks: (x) => {
861
- var B;
862
- const k = (B = first(x)) == null ? void 0 : B._parent, A = r.filter((_) => k ? _._parent === k : !_._parent).indexOf(first(x));
861
+ var _;
862
+ const y = (_ = first(x)) == null ? void 0 : _._parent, A = r.filter((B) => y ? B._parent === y : !B._parent).indexOf(first(x));
863
863
  l(map(x, "_id")), o({
864
- undo: () => a(x, k, A),
864
+ undo: () => a(x, y, A),
865
865
  redo: () => l(map(x, "_id"))
866
866
  });
867
867
  },
868
- updateBlocks: (x, k, b) => {
868
+ updateBlocks: (x, y, b) => {
869
869
  let A = [];
870
870
  if (b)
871
- A = map(x, (B) => ({ _id: B, ...b }));
871
+ A = map(x, (_) => ({ _id: _, ...b }));
872
872
  else {
873
- const B = keys(k);
874
- A = map(x, (_) => {
875
- const N = r.find((y) => y._id === _), w = { _id: _ };
876
- return each(B, (y) => w[y] = N[y]), w;
873
+ const _ = keys(y);
874
+ A = map(x, (B) => {
875
+ const N = r.find((k) => k._id === B), w = { _id: B };
876
+ return each(_, (k) => w[k] = N[k]), w;
877
877
  });
878
878
  }
879
- c(map(x, (B) => ({ _id: B, ...k }))), o({
879
+ c(map(x, (_) => ({ _id: _, ...y }))), o({
880
880
  undo: () => c(A),
881
- redo: () => c(map(x, (B) => ({ _id: B, ...k })))
881
+ redo: () => c(map(x, (_) => ({ _id: _, ...y })))
882
882
  });
883
883
  },
884
- updateBlocksRuntime: (x, k) => {
885
- c(map(x, (b) => ({ _id: b, ...k })));
884
+ updateBlocksRuntime: (x, y) => {
885
+ c(map(x, (b) => ({ _id: b, ...y })));
886
886
  },
887
887
  setNewBlocks: (x) => {
888
888
  n(x), o({
@@ -891,12 +891,12 @@ const undoRedoStateAtom = atom({
891
891
  });
892
892
  },
893
893
  updateMultipleBlocksProps: (x) => {
894
- let k = [];
895
- k = map(x, (b) => {
896
- const A = keys(b), B = r.find((N) => N._id === b._id), _ = {};
897
- return each(A, (N) => _[N] = B[N]), _;
894
+ let y = [];
895
+ y = map(x, (b) => {
896
+ const A = keys(b), _ = r.find((N) => N._id === b._id), B = {};
897
+ return each(A, (N) => B[N] = _[N]), B;
898
898
  }), c(x), o({
899
- undo: () => c(k),
899
+ undo: () => c(y),
900
900
  redo: () => c(x)
901
901
  });
902
902
  }
@@ -908,9 +908,9 @@ const undoRedoStateAtom = atom({
908
908
  for (let f = 0; f < i.length; f++) {
909
909
  const { _id: x } = i[f];
910
910
  i[f]._id = generateUUID();
911
- const k = filter(i, { _parent: x });
912
- for (let b = 0; b < k.length; b++)
913
- k[b]._parent = i[f]._id;
911
+ const y = filter(i, { _parent: x });
912
+ for (let b = 0; b < y.length; b++)
913
+ y[b]._parent = i[f]._id;
914
914
  }
915
915
  const p = first(i);
916
916
  let u, g;
@@ -921,8 +921,8 @@ const undoRedoStateAtom = atom({
921
921
  return { addCoreBlock: useCallback(
922
922
  (i, c, d) => {
923
923
  if (has(i, "blocks")) {
924
- const k = i.blocks;
925
- return a(k, c, d);
924
+ const y = i.blocks;
925
+ return a(y, c, d);
926
926
  }
927
927
  const p = generateUUID(), u = getDefaultBlockProps(i.type), g = {
928
928
  _type: i.type,
@@ -2361,42 +2361,42 @@ const getBlockWithChildren = (o, r) => {
2361
2361
  })
2362
2362
  ), addLangToPrompt = (o, r, n) => !r || n !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, r, r)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
2363
2363
  const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, h = (m, f) => {
2364
- const x = cloneDeep(f.find((k) => k._id === m));
2365
- for (const k in x) {
2366
- const b = x[k];
2364
+ const x = cloneDeep(f.find((y) => y._id === m));
2365
+ for (const y in x) {
2366
+ const b = x[y];
2367
2367
  if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
2368
- const { baseClasses: A, classes: B } = getSplitChaiClasses(b);
2369
- x[k] = compact(flattenDeep([A, B])).join(" ");
2368
+ const { baseClasses: A, classes: _ } = getSplitChaiClasses(b);
2369
+ x[y] = compact(flattenDeep([A, _])).join(" ");
2370
2370
  } else
2371
- k !== "_id" && delete x[k];
2371
+ y !== "_id" && delete x[y];
2372
2372
  }
2373
2373
  return x;
2374
2374
  };
2375
2375
  return {
2376
2376
  askAi: useCallback(
2377
- async (m, f, x, k) => {
2377
+ async (m, f, x, y) => {
2378
2378
  if (l) {
2379
2379
  r(!0), a(null);
2380
2380
  try {
2381
- const b = p === u ? "" : p, A = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [h(f, d)], B = await l(m, addLangToPrompt(x, g, m), A, b), { blocks: _, error: N } = B;
2381
+ const b = p === u ? "" : p, A = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [h(f, d)], _ = await l(m, addLangToPrompt(x, g, m), A, b), { blocks: B, error: N } = _;
2382
2382
  if (N) {
2383
2383
  a(N);
2384
2384
  return;
2385
2385
  }
2386
2386
  if (m === "styles") {
2387
- const w = _.map((y) => {
2388
- for (const C in y)
2389
- C !== "_id" && (y[C] = `${STYLES_KEY},${y[C]}`);
2390
- return y;
2387
+ const w = B.map((k) => {
2388
+ for (const S in k)
2389
+ S !== "_id" && (k[S] = `${STYLES_KEY},${k[S]}`);
2390
+ return k;
2391
2391
  });
2392
2392
  c(w);
2393
2393
  } else
2394
- i(_);
2395
- k && k(B);
2394
+ i(B);
2395
+ y && y(_);
2396
2396
  } catch (b) {
2397
2397
  a(b);
2398
2398
  } finally {
2399
- r(!1), k && k();
2399
+ r(!1), y && y();
2400
2400
  }
2401
2401
  }
2402
2402
  },
@@ -2493,7 +2493,7 @@ const getBlockWithChildren = (o, r) => {
2493
2493
  for (const f of h)
2494
2494
  if (f._type === "PartialBlock" || f._type === "GlobalBlock") {
2495
2495
  let x = l(f.partialBlockId);
2496
- f._parent && (x == null ? void 0 : x.length) > 0 && (x = x.map((k) => (isEmpty(k._parent) && set(k, "_parent", f._parent), k))), m = [...m, ...x];
2496
+ f._parent && (x == null ? void 0 : x.length) > 0 && (x = x.map((y) => (isEmpty(y._parent) && set(y, "_parent", f._parent), y))), m = [...m, ...x];
2497
2497
  } else
2498
2498
  m.push(f);
2499
2499
  return m;
@@ -2842,8 +2842,8 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2842
2842
  return useHotkeys(
2843
2843
  "shift+up, shift+down, shift+left, shift+right",
2844
2844
  ({ key: x }) => {
2845
- var k;
2846
- f((k = x == null ? void 0 : x.replace("Arrow", "")) == null ? void 0 : k.toUpperCase());
2845
+ var y;
2846
+ f((y = x == null ? void 0 : x.replace("Arrow", "")) == null ? void 0 : y.toUpperCase());
2847
2847
  },
2848
2848
  { document: a == null ? void 0 : a.contentDocument },
2849
2849
  [f]
@@ -3004,9 +3004,9 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
3004
3004
  }),
3005
3005
  size({
3006
3006
  boundary: u == null ? void 0 : u.body,
3007
- apply({ availableWidth: k, availableHeight: b, elements: A }) {
3007
+ apply({ availableWidth: y, availableHeight: b, elements: A }) {
3008
3008
  Object.assign(A.floating.style, {
3009
- maxWidth: `${Math.max(200, k)}px`,
3009
+ maxWidth: `${Math.max(200, y)}px`,
3010
3010
  maxHeight: `${Math.max(100, b)}px`
3011
3011
  });
3012
3012
  }
@@ -3018,8 +3018,8 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
3018
3018
  const f = get(o, "_parent", null), x = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
3019
3019
  return useEffect(() => {
3020
3020
  if (r) {
3021
- const k = setTimeout(() => m(), 500);
3022
- return () => clearTimeout(k);
3021
+ const y = setTimeout(() => m(), 500);
3022
+ return () => clearTimeout(y);
3023
3023
  } else
3024
3024
  m();
3025
3025
  }, [r]), !r || !o || p ? null : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
@@ -3029,13 +3029,13 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
3029
3029
  tabIndex: 0,
3030
3030
  ref: h.setFloating,
3031
3031
  style: g,
3032
- onClick: (k) => {
3033
- k.stopPropagation(), k.preventDefault();
3032
+ onClick: (y) => {
3033
+ y.stopPropagation(), y.preventDefault();
3034
3034
  },
3035
- onMouseEnter: (k) => {
3036
- k.stopPropagation(), i(null);
3035
+ onMouseEnter: (y) => {
3036
+ y.stopPropagation(), i(null);
3037
3037
  },
3038
- onKeyDown: (k) => k.stopPropagation(),
3038
+ onKeyDown: (y) => y.stopPropagation(),
3039
3039
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
3040
3040
  children: [
3041
3041
  f && /* @__PURE__ */ jsx(
@@ -3499,8 +3499,8 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3499
3499
  ],
3500
3500
  onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
3501
3501
  onBlur: ({ editor: u, event: g }) => {
3502
- const h = g.relatedTarget, m = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = m == null ? void 0 : m.contains(h), k = f == null ? void 0 : f.contains(h);
3503
- if (!x && !k) {
3502
+ const h = g.relatedTarget, m = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = m == null ? void 0 : m.contains(h), y = f == null ? void 0 : f.contains(h);
3503
+ if (!x && !y) {
3504
3504
  const b = (u == null ? void 0 : u.getHTML()) || "";
3505
3505
  n(b);
3506
3506
  }
@@ -3596,47 +3596,47 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3596
3596
  }
3597
3597
  ), WithBlockTextEditor = memo(
3598
3598
  ({ block: o, children: r }) => {
3599
- const n = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), k = useRef(null), b = l, { blockContent: A, blockType: B } = useMemo(() => {
3599
+ const n = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: A, blockType: _ } = useMemo(() => {
3600
3600
  var j;
3601
- const C = o._type;
3601
+ const S = o._type;
3602
3602
  let E = o[n];
3603
3603
  const v = getRegisteredChaiBlock(o._type);
3604
- return f && ((j = v == null ? void 0 : v.i18nProps) == null ? void 0 : j.includes(n)) && has(o, `${n}-${f}`) && (E = get(o, `${n}-${f}`)), { blockContent: E, blockType: C };
3605
- }, [o, f]), _ = useCallback(
3606
- (C) => {
3604
+ return f && ((j = v == null ? void 0 : v.i18nProps) == null ? void 0 : j.includes(n)) && has(o, `${n}-${f}`) && (E = get(o, `${n}-${f}`)), { blockContent: E, blockType: S };
3605
+ }, [o, f]), B = useCallback(
3606
+ (S) => {
3607
3607
  var v;
3608
- const E = C || ((v = g.current) == null ? void 0 : v.innerText);
3609
- m([b], { [n]: E }), u(null), c(null), d(-1), x([]);
3608
+ const E = S || ((v = g.current) == null ? void 0 : v.innerText);
3609
+ m([b], { [n]: E }), u(null), c(null), d(-1), x(b ? [b] : []);
3610
3610
  },
3611
3611
  [b, m, c, x, f]
3612
3612
  ), N = useDebouncedCallback(
3613
- (C) => {
3614
- m([b], { [n]: C });
3613
+ (S) => {
3614
+ m([b], { [n]: S });
3615
3615
  },
3616
3616
  [b, o, m, f],
3617
3617
  1e3
3618
3618
  ), w = useCallback(
3619
- (C) => {
3620
- C.preventDefault(), b && (k.current = b), _(), setTimeout(() => {
3621
- const E = k.current;
3622
- k.current = null, x([E]);
3619
+ (S) => {
3620
+ S.preventDefault(), b && (y.current = b), B(), setTimeout(() => {
3621
+ const E = y.current;
3622
+ y.current = null, x([E]);
3623
3623
  }, 100);
3624
3624
  },
3625
3625
  [x, b, f]
3626
3626
  );
3627
3627
  useEffect(() => {
3628
- var S;
3628
+ var C;
3629
3629
  if (!b) return;
3630
- const C = `[data-block-id="${b}"]`, E = i >= 0 ? `[data-block-index="${i}"]` : "", v = a.querySelector(`${C}${E}`);
3631
- v && ((S = v == null ? void 0 : v.classList) == null || S.add("sr-only"), u(v));
3632
- }, [b, B, a, i]);
3633
- const y = useMemo(() => p ? (h(), B === "RichText" ? /* @__PURE__ */ jsx(
3630
+ const S = `[data-block-id="${b}"]`, E = i >= 0 ? `[data-block-index="${i}"]` : "", v = a.querySelector(`${S}${E}`);
3631
+ v && ((C = v == null ? void 0 : v.classList) == null || C.add("sr-only"), u(v));
3632
+ }, [b, _, a, i]);
3633
+ const k = useMemo(() => p ? (h(), _ === "RichText" ? /* @__PURE__ */ jsx(
3634
3634
  RichTextEditor,
3635
3635
  {
3636
3636
  blockContent: A,
3637
3637
  editingElement: p,
3638
3638
  onChange: N,
3639
- onClose: _,
3639
+ onClose: B,
3640
3640
  onEscape: w
3641
3641
  }
3642
3642
  ) : /* @__PURE__ */ jsx(
@@ -3645,13 +3645,13 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3645
3645
  editorRef: g,
3646
3646
  blockContent: A,
3647
3647
  editingElement: p,
3648
- onClose: _,
3648
+ onClose: B,
3649
3649
  onChange: N,
3650
3650
  onEscape: w
3651
3651
  }
3652
- )) : null, [p, b, B, A, _, f]);
3652
+ )) : null, [p, b, _, A, B, f]);
3653
3653
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3654
- y,
3654
+ k,
3655
3655
  r
3656
3656
  ] });
3657
3657
  },
@@ -3684,23 +3684,23 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3684
3684
  blockAtom: r,
3685
3685
  children: n
3686
3686
  }) => {
3687
- const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(r), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [h] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: x, key: k } = useContext(RepeaterContext), b = useMemo(
3687
+ const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(r), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [h] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: x, key: y } = useContext(RepeaterContext), b = useMemo(
3688
3688
  () => m ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
3689
3689
  index: x,
3690
- key: k
3690
+ key: y
3691
3691
  }) : applyLanguage(i, d, c),
3692
- [i, d, c, g, m, x, k]
3693
- ), A = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), B = useMemo(
3692
+ [i, d, c, g, m, x, y]
3693
+ ), A = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), _ = useMemo(
3694
3694
  () => u(i._id, getBlockRuntimeProps(i._type)),
3695
3695
  [i._id, i._type, u, getBlockRuntimeProps]
3696
- ), _ = useMemo(
3696
+ ), B = useMemo(
3697
3697
  () => ({
3698
3698
  blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": x },
3699
3699
  inBuilder: !0,
3700
3700
  lang: d || p,
3701
3701
  ...b,
3702
3702
  ...A,
3703
- ...B,
3703
+ ..._,
3704
3704
  ...o
3705
3705
  }),
3706
3706
  [
@@ -3710,13 +3710,13 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3710
3710
  p,
3711
3711
  b,
3712
3712
  A,
3713
- B,
3713
+ _,
3714
3714
  o
3715
3715
  ]
3716
3716
  ), N = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
3717
3717
  if (isNull(f) || h.includes(i._id)) return null;
3718
3718
  let w = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
3719
- ..._,
3719
+ ...B,
3720
3720
  children: n({
3721
3721
  _id: i._id,
3722
3722
  _type: i._type,
@@ -3728,8 +3728,8 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3728
3728
  ...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
3729
3729
  })
3730
3730
  }) });
3731
- const y = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: w }) : w;
3732
- return N ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: y }) : y;
3731
+ const k = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: w }) : w;
3732
+ return N ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: k }) : k;
3733
3733
  }, PartialWrapper = ({ children: o, partialBlockId: r }) => {
3734
3734
  const n = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
3735
3735
  (d) => {
@@ -3769,7 +3769,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3769
3769
  );
3770
3770
  return map(l, (c) => {
3771
3771
  const d = a(c._id);
3772
- return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: h, repeaterItems: m, $repeaterItemsKey: f }) => g === "Repeater" ? isArray(m) && m.map((x, k) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: k, key: f }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: n, blocks: o, parent: c._id }) }, `${u}-${k}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: h }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: n, blocks: o, parent: c._id }) : null }) }, c._id) : null;
3772
+ return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: h, repeaterItems: m, $repeaterItemsKey: f }) => g === "Repeater" ? isArray(m) && m.map((x, y) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: y, key: f }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: n, blocks: o, parent: c._id }) }, `${u}-${y}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: h }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: n, blocks: o, parent: c._id }) : null }) }, c._id) : null;
3773
3773
  });
3774
3774
  }, PageBlocksRenderer = () => {
3775
3775
  const [o] = useBlocksStore();
@@ -4020,42 +4020,56 @@ const CanvasEventsWatcher = () => {
4020
4020
  ] });
4021
4021
  };
4022
4022
  MediaManagerModal.displayName = "MediaManagerModal";
4023
- const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
4024
- const { t: l } = useTranslation(), i = useSelectedBlock(), c = useUpdateBlocksProps(), d = (g) => {
4025
- const h = isArray(g) ? first(g) : g;
4026
- if (h) {
4027
- r(h == null ? void 0 : h.url);
4028
- const m = h == null ? void 0 : h.width, f = h == null ? void 0 : h.height;
4029
- if (i != null && i._id) {
4030
- const x = {
4031
- ...m && { width: m },
4032
- ...f && { height: f },
4033
- ...h.description && { alt: h.description },
4034
- ...h.id && { assetId: h.id }
4023
+ const PLACEHOLDER_IMAGE_URL = "https://fldwljgzcktqnysdkxnn.supabase.co/storage/v1/object/public/dam-assets/02817647-2581-4c50-a005-f72de13d3da7/banner-placeholder.png", ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
4024
+ const { t: l } = useTranslation(), { selectedLang: i } = useLanguages(), c = useSelectedBlock(), d = useUpdateBlocksProps(), p = n.split(".").pop() || "", u = i ? `_${p}Id-${i}` : `${p}Id`, g = isEmpty(i) && (c == null ? void 0 : c._type) === "Image" && has(c, "assetId"), h = get(c, u, g ? c == null ? void 0 : c.assetId : ""), m = !!h, f = (y) => {
4025
+ const b = isArray(y) ? first(y) : y;
4026
+ if (b) {
4027
+ r(b == null ? void 0 : b.url);
4028
+ const A = b == null ? void 0 : b.width, _ = b == null ? void 0 : b.height;
4029
+ if (c != null && c._id) {
4030
+ const B = {
4031
+ ...A && { width: A },
4032
+ ..._ && { height: _ },
4033
+ ...b.description && { alt: b.description }
4035
4034
  };
4036
- if (isEmpty(x)) return;
4037
- c([i._id], x);
4035
+ if (set(B, u, b.id), isEmpty(B)) return;
4036
+ d([c._id], B);
4038
4037
  }
4039
4038
  }
4040
- }, p = useCallback(() => {
4041
- r("https://placehold.co/400"), i != null && i._id && c([i._id], { assetId: "" });
4042
- }, [r, i == null ? void 0 : i._id, c]), u = get(i, "assetId", "");
4039
+ }, x = useCallback(() => {
4040
+ r(PLACEHOLDER_IMAGE_URL), c != null && c._id && d([c._id], { assetId: "" });
4041
+ }, [r, c == null ? void 0 : c._id, d]);
4043
4042
  return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
4044
- o ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
4045
- /* @__PURE__ */ jsx("img", { src: o, className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover", alt: "" }),
4043
+ o ? /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
4046
4044
  /* @__PURE__ */ jsx(
4045
+ "img",
4046
+ {
4047
+ src: o,
4048
+ className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover transition duration-200 " + (h && h !== "" ? "cursor-pointer group-hover:blur-sm" : ""),
4049
+ alt: ""
4050
+ }
4051
+ ),
4052
+ m && /* @__PURE__ */ jsx(
4047
4053
  "button",
4048
4054
  {
4049
4055
  type: "button",
4050
- onClick: p,
4051
- className: "absolute -right-2 -top-2 rounded-full bg-destructive p-1 text-destructive-foreground hover:bg-destructive/90",
4056
+ onClick: x,
4057
+ className: "absolute -right-2 -top-2 z-20 rounded-full bg-destructive p-1 text-destructive-foreground hover:bg-destructive/90",
4052
4058
  children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
4053
4059
  }
4054
- )
4055
- ] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: d, mode: "image", assetId: u, children: /* @__PURE__ */ jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
4060
+ ),
4061
+ h && h !== "" && /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: f, assetId: h, children: /* @__PURE__ */ jsx(
4062
+ "button",
4063
+ {
4064
+ type: "button",
4065
+ className: "absolute inset-0 z-10 flex cursor-pointer items-center justify-center bg-black/10 opacity-0 transition duration-200 group-hover:bg-black/30 group-hover:opacity-100",
4066
+ children: /* @__PURE__ */ jsx(Edit2Icon, { className: "h-4 w-4 text-white" })
4067
+ }
4068
+ ) })
4069
+ ] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: f, mode: "image", assetId: h, children: /* @__PURE__ */ jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
4056
4070
  /* @__PURE__ */ jsxs("div", { className: "flex w-3/5 flex-col", children: [
4057
4071
  /* @__PURE__ */ jsxs(Fragment, { children: [
4058
- /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: d, assetId: u, children: /* @__PURE__ */ jsx("small", { className: "h-6 cursor-pointer rounded-md bg-secondary px-2 py-1 text-center text-xs text-secondary-foreground hover:bg-secondary/80", children: o || !isEmpty(o) ? l("Replace image") : l("Choose image") }) }),
4072
+ /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: f, assetId: "", children: /* @__PURE__ */ jsx("small", { className: "h-6 cursor-pointer rounded-md bg-secondary px-2 py-1 text-center text-xs text-secondary-foreground hover:bg-secondary/80", children: o || !isEmpty(o) ? l("Replace image") : l("Choose image") }) }),
4059
4073
  /* @__PURE__ */ jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-secondary-foreground", children: "OR" })
4060
4074
  ] }),
4061
4075
  /* @__PURE__ */ jsx(
@@ -4069,8 +4083,8 @@ const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
4069
4083
  className: "text-xs",
4070
4084
  placeholder: l("Enter image URL"),
4071
4085
  value: o,
4072
- onBlur: ({ target: { value: g } }) => a(n, g),
4073
- onChange: (g) => r(g.target.value)
4086
+ onBlur: ({ target: { value: y } }) => a(n, y),
4087
+ onChange: (y) => r(y.target.value)
4074
4088
  }
4075
4089
  )
4076
4090
  ] })
@@ -4186,44 +4200,44 @@ const DataBindingSelector = ({
4186
4200
  r(`{{${g}}}`, {}, n);
4187
4201
  return;
4188
4202
  }
4189
- const m = (b) => /[.,!?;:]/.test(b), f = (b, A, B) => {
4190
- let _ = "", N = "";
4191
- const w = A > 0 ? b[A - 1] : "", y = A < b.length ? b[A] : "";
4192
- return A > 0 && (w === "." || !m(w) && w !== " ") && (_ = " "), A < b.length && !m(y) && y !== " " && (N = " "), {
4193
- text: _ + B + N,
4194
- prefixLength: _.length,
4203
+ const m = (b) => /[.,!?;:]/.test(b), f = (b, A, _) => {
4204
+ let B = "", N = "";
4205
+ const w = A > 0 ? b[A - 1] : "", k = A < b.length ? b[A] : "";
4206
+ return A > 0 && (w === "." || !m(w) && w !== " ") && (B = " "), A < b.length && !m(k) && k !== " " && (N = " "), {
4207
+ text: B + _ + N,
4208
+ prefixLength: B.length,
4195
4209
  suffixLength: N.length
4196
4210
  };
4197
4211
  }, x = document.getElementById(n);
4198
4212
  if (!x) return;
4199
- const k = document.getElementById(`chai-rte-${n}`) || document.getElementById(`chai-rte-modal-${n}`);
4200
- if (k && (k.querySelector(".ProseMirror") || k.__chaiRTE)) {
4201
- const b = k.__chaiRTE;
4213
+ const y = document.getElementById(`chai-rte-${n}`) || document.getElementById(`chai-rte-modal-${n}`);
4214
+ if (y && (y.querySelector(".ProseMirror") || y.__chaiRTE)) {
4215
+ const b = y.__chaiRTE;
4202
4216
  if (b) {
4203
4217
  const A = `{{${g}}}`;
4204
4218
  b.commands.focus();
4205
- const { from: B, to: _ } = b.state.selection;
4206
- if (B !== _)
4219
+ const { from: _, to: B } = b.state.selection;
4220
+ if (_ !== B)
4207
4221
  b.chain().deleteSelection().insertContent(A).run();
4208
4222
  else {
4209
- const { state: w } = b, y = w.selection.from, C = w.doc.textBetween(Math.max(0, y - 1), y), E = w.doc.textBetween(y, Math.min(y + 1, w.doc.content.size));
4223
+ const { state: w } = b, k = w.selection.from, S = w.doc.textBetween(Math.max(0, k - 1), k), E = w.doc.textBetween(k, Math.min(k + 1, w.doc.content.size));
4210
4224
  let v = "";
4211
- y > 0 && C !== " " && !m(C) && (v = " ");
4212
- let S = "";
4213
- E && E !== " " && !m(E) && (S = " "), b.chain().insertContent(v + A + S).run();
4225
+ k > 0 && S !== " " && !m(S) && (v = " ");
4226
+ let C = "";
4227
+ E && E !== " " && !m(E) && (C = " "), b.chain().insertContent(v + A + C).run();
4214
4228
  }
4215
4229
  setTimeout(() => r(b.getHTML(), {}, n), 100);
4216
4230
  return;
4217
4231
  }
4218
4232
  } else {
4219
- const b = x, A = b.selectionStart || 0, B = b.value || "", _ = b.selectionEnd || A;
4220
- if (_ > A) {
4221
- const E = `{{${g}}}`, { text: v } = f(B, A, E), S = B.slice(0, A) + v + B.slice(_);
4222
- r(S, {}, n);
4233
+ const b = x, A = b.selectionStart || 0, _ = b.value || "", B = b.selectionEnd || A;
4234
+ if (B > A) {
4235
+ const E = `{{${g}}}`, { text: v } = f(_, A, E), C = _.slice(0, A) + v + _.slice(B);
4236
+ r(C, {}, n);
4223
4237
  return;
4224
4238
  }
4225
- const w = `{{${g}}}`, { text: y } = f(B, A, w), C = B.slice(0, A) + y + B.slice(A);
4226
- r(C, {}, n);
4239
+ const w = `{{${g}}}`, { text: k } = f(_, A, w), S = _.slice(0, A) + k + _.slice(A);
4240
+ r(S, {}, n);
4227
4241
  }
4228
4242
  },
4229
4243
  [n, r, a, c == null ? void 0 : c._id, d]
@@ -4245,57 +4259,57 @@ const DataBindingSelector = ({
4245
4259
  onChange: n
4246
4260
  }) => {
4247
4261
  var E;
4248
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, S) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [k, b] = useState(-1), A = useRef(null), B = (E = r == null ? void 0 : r.find((v) => v.key === u)) == null ? void 0 : E.name;
4262
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, C) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), A = useRef(null), _ = (E = r == null ? void 0 : r.find((v) => v.key === u)) == null ? void 0 : E.name;
4249
4263
  useEffect(() => {
4250
4264
  if (m(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4251
- const v = split(o, ":"), S = get(v, 1, "page") || "page";
4252
- g(S), (async () => {
4253
- const j = await l(S, [get(v, 2, "page")]);
4265
+ const v = split(o, ":"), C = get(v, 1, "page") || "page";
4266
+ g(C), (async () => {
4267
+ const j = await l(C, [get(v, 2, "page")]);
4254
4268
  j && Array.isArray(j) && m(get(j, [0, "name"], ""));
4255
4269
  })();
4256
4270
  }, [o]);
4257
- const _ = useDebouncedCallback(
4271
+ const B = useDebouncedCallback(
4258
4272
  async (v) => {
4259
4273
  if (isEmpty(v))
4260
4274
  x([]);
4261
4275
  else {
4262
- const S = await l(u, v);
4263
- x(S);
4276
+ const C = await l(u, v);
4277
+ x(C);
4264
4278
  }
4265
4279
  c(!1), b(-1);
4266
4280
  },
4267
4281
  [u],
4268
4282
  300
4269
4283
  ), N = (v) => {
4270
- const S = ["pageType", u, v.id];
4271
- S[1] && (n(S.join(":")), m(v.name), p(!1), x([]), b(-1));
4284
+ const C = ["pageType", u, v.id];
4285
+ C[1] && (n(C.join(":")), m(v.name), p(!1), x([]), b(-1));
4272
4286
  }, w = (v) => {
4273
4287
  switch (v.key) {
4274
4288
  case "ArrowDown":
4275
- v.preventDefault(), b((S) => S < f.length - 1 ? S + 1 : S);
4289
+ v.preventDefault(), b((C) => C < f.length - 1 ? C + 1 : C);
4276
4290
  break;
4277
4291
  case "ArrowUp":
4278
- v.preventDefault(), b((S) => S > 0 ? S - 1 : S);
4292
+ v.preventDefault(), b((C) => C > 0 ? C - 1 : C);
4279
4293
  break;
4280
4294
  case "Enter":
4281
4295
  if (v.preventDefault(), f.length === 0) return;
4282
- k >= 0 && N(f[k]);
4296
+ y >= 0 && N(f[y]);
4283
4297
  break;
4284
4298
  case "Escape":
4285
- v.preventDefault(), y();
4299
+ v.preventDefault(), k();
4286
4300
  break;
4287
4301
  }
4288
4302
  };
4289
4303
  useEffect(() => {
4290
- if (k >= 0 && A.current) {
4291
- const v = A.current.children[k];
4304
+ if (y >= 0 && A.current) {
4305
+ const v = A.current.children[y];
4292
4306
  v == null || v.scrollIntoView({ block: "nearest" });
4293
4307
  }
4294
- }, [k]);
4295
- const y = () => {
4308
+ }, [y]);
4309
+ const k = () => {
4296
4310
  m(""), x([]), b(-1), p(!1), n("");
4297
- }, C = (v) => {
4298
- m(v), p(!isEmpty(v)), c(!0), _(v);
4311
+ }, S = (v) => {
4312
+ m(v), p(!isEmpty(v)), c(!0), B(v);
4299
4313
  };
4300
4314
  return /* @__PURE__ */ jsxs("div", { children: [
4301
4315
  /* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (v) => g(v.target.value), children: map(r, (v) => /* @__PURE__ */ jsx("option", { value: v.key, children: v.name }, v.key)) }),
@@ -4305,13 +4319,13 @@ const DataBindingSelector = ({
4305
4319
  {
4306
4320
  type: "text",
4307
4321
  value: h,
4308
- onChange: (v) => C(v.target.value),
4322
+ onChange: (v) => S(v.target.value),
4309
4323
  onKeyDown: w,
4310
- placeholder: a(`Search ${B ?? ""}`),
4324
+ placeholder: a(`Search ${_ ?? ""}`),
4311
4325
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
4312
4326
  }
4313
4327
  ),
4314
- /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick: y, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4328
+ /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick: k, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4315
4329
  ] }),
4316
4330
  (i || !isEmpty(f) || d && isEmpty(f)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
4317
4331
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
@@ -4321,11 +4335,11 @@ const DataBindingSelector = ({
4321
4335
  ' "',
4322
4336
  h,
4323
4337
  '"'
4324
- ] }) : /* @__PURE__ */ jsx("ul", { ref: A, children: map(f == null ? void 0 : f.slice(0, 20), (v, S) => /* @__PURE__ */ jsxs(
4338
+ ] }) : /* @__PURE__ */ jsx("ul", { ref: A, children: map(f == null ? void 0 : f.slice(0, 20), (v, C) => /* @__PURE__ */ jsxs(
4325
4339
  "li",
4326
4340
  {
4327
4341
  onClick: () => N(v),
4328
- className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : S === k ? "bg-gray-100" : "hover:bg-gray-100"}`,
4342
+ className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : C === y ? "bg-gray-100" : "hover:bg-gray-100"}`,
4329
4343
  children: [
4330
4344
  v.name,
4331
4345
  " ",
@@ -4640,11 +4654,11 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
4640
4654
  if (f !== x)
4641
4655
  u.chain().deleteSelection().insertContent(m).run();
4642
4656
  else {
4643
- const { state: b } = u, A = b.selection.from, B = b.doc.textBetween(Math.max(0, A - 1), A), _ = b.doc.textBetween(A, Math.min(A + 1, b.doc.content.size));
4657
+ const { state: b } = u, A = b.selection.from, _ = b.doc.textBetween(Math.max(0, A - 1), A), B = b.doc.textBetween(A, Math.min(A + 1, b.doc.content.size));
4644
4658
  let N = "";
4645
- A > 0 && B !== " " && !/[.,!?;:]/.test(B) && (N = " ");
4659
+ A > 0 && _ !== " " && !/[.,!?;:]/.test(_) && (N = " ");
4646
4660
  let w = "";
4647
- _ && _ !== " " && !/[.,!?;:]/.test(_) && (w = " "), u.chain().insertContent(N + m + w).run();
4661
+ B && B !== " " && !/[.,!?;:]/.test(B) && (w = " "), u.chain().insertContent(N + m + w).run();
4648
4662
  }
4649
4663
  };
4650
4664
  return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (h) => !h && r(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
@@ -4738,14 +4752,14 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
4738
4752
  const h = () => {
4739
4753
  const x = findIndex(u, { _id: g });
4740
4754
  if (x > -1) {
4741
- const k = (x + 1) % u.length, b = get(u, [k, "_id"]);
4755
+ const y = (x + 1) % u.length, b = get(u, [y, "_id"]);
4742
4756
  if (!b) return;
4743
4757
  r({ ...o, currentSlide: b }), c([b]);
4744
4758
  }
4745
4759
  }, m = () => {
4746
4760
  const x = findIndex(u, { _id: g });
4747
4761
  if (x > -1) {
4748
- const k = (x - 1 + u.length) % u.length, b = get(u, [k, "_id"]);
4762
+ const y = (x - 1 + u.length) % u.length, b = get(u, [y, "_id"]);
4749
4763
  if (!b) return;
4750
4764
  r({ ...o, currentSlide: b }), c([b]);
4751
4765
  }
@@ -4753,8 +4767,8 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
4753
4767
  const x = i(
4754
4768
  { styles: "#styles:,h-full w-full min-w-full", type: "Slide" },
4755
4769
  p == null ? void 0 : p._id
4756
- ), k = x == null ? void 0 : x._id;
4757
- k && (r({ ...o, currentSlide: k }), c([k]));
4770
+ ), y = x == null ? void 0 : x._id;
4771
+ y && (r({ ...o, currentSlide: y }), c([y]));
4758
4772
  };
4759
4773
  return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
4760
4774
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 pb-2 text-[12px]", children: [
@@ -4833,8 +4847,8 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
4833
4847
  className: "text-xs",
4834
4848
  pattern: "[0-9]*",
4835
4849
  onChange: (x) => {
4836
- let k = x.target.value;
4837
- k.length && (k = k.replace("-", "")), r({ ...o, autoplayInterval: k });
4850
+ let y = x.target.value;
4851
+ y.length && (y = y.replace("-", "")), r({ ...o, autoplayInterval: y });
4838
4852
  }
4839
4853
  }
4840
4854
  )
@@ -4935,44 +4949,53 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
4935
4949
  children: a,
4936
4950
  errors: l,
4937
4951
  help: i,
4938
- description: c,
4939
- hidden: d,
4940
- required: p,
4941
- schema: u,
4942
- formData: g,
4943
- onChange: h
4952
+ hidden: c,
4953
+ required: d,
4954
+ schema: p,
4955
+ formData: u,
4956
+ onChange: g
4944
4957
  }) => {
4945
- const { selectedLang: m, fallbackLang: f, languages: x } = useLanguages(), k = useMemo(
4946
- () => isEmpty(x) ? "" : isEmpty(m) ? f : m,
4947
- [x, m, f]
4948
- ), b = useMemo(() => get(LANGUAGES, k, k), [k]), A = usePageExternalData(), B = useSelectedBlock(), _ = useRegisteredChaiBlocks(), N = useMemo(
4949
- () => get(_, [B == null ? void 0 : B._type, "i18nProps"], []),
4950
- [_, B == null ? void 0 : B._type]
4951
- ), [w, y] = useState(null);
4952
- if (d)
4958
+ const { selectedLang: h, fallbackLang: m, languages: f } = useLanguages(), x = useMemo(
4959
+ () => isEmpty(f) ? "" : isEmpty(h) ? m : h,
4960
+ [f, h, m]
4961
+ ), y = useMemo(() => get(LANGUAGES, x, x), [x]), b = usePageExternalData(), A = useSelectedBlock(), _ = useRegisteredChaiBlocks(), B = useMemo(
4962
+ () => get(_, [A == null ? void 0 : A._type, "i18nProps"], []),
4963
+ [_, A == null ? void 0 : A._type]
4964
+ ), [N, w] = useState(null);
4965
+ if (c)
4953
4966
  return null;
4954
- if (u.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: a });
4955
- const E = N == null ? void 0 : N.includes(o.replace("root.", ""));
4956
- if (u.type === "array") {
4957
- const v = w === o;
4967
+ if (p.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: a });
4968
+ const S = B == null ? void 0 : B.includes(o.replace("root.", ""));
4969
+ if (p.type === "array") {
4970
+ const E = N === o;
4958
4971
  return /* @__PURE__ */ jsxs("div", { className: `${r} relative`, children: [
4959
- u.title && /* @__PURE__ */ jsxs(
4972
+ p.title && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ jsxs(
4960
4973
  "label",
4961
4974
  {
4962
4975
  htmlFor: o,
4963
- onClick: () => y(v ? null : o),
4976
+ onClick: () => w(E ? null : o),
4964
4977
  className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
4965
4978
  children: [
4966
- v ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
4979
+ E ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
4967
4980
  /* @__PURE__ */ jsx(List, { className: "h-3 w-3" }),
4968
4981
  /* @__PURE__ */ jsx("span", { className: "leading-tight", children: n }),
4969
4982
  " ",
4970
- /* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children: g == null ? void 0 : g.length }) })
4983
+ /* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children: u == null ? void 0 : u.length }) }),
4984
+ p.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
4985
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
4986
+ Info,
4987
+ {
4988
+ className: "h-3 w-3 text-muted-foreground/70",
4989
+ onClick: (v) => v.stopPropagation(),
4990
+ onMouseDown: (v) => v.stopPropagation()
4991
+ }
4992
+ ) }),
4993
+ /* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: p.description })
4994
+ ] }) })
4971
4995
  ]
4972
4996
  }
4973
- ),
4974
- (g == null ? void 0 : g.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxs("div", { className: `${v ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
4975
- c,
4997
+ ) }),
4998
+ (u == null ? void 0 : u.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxs("div", { className: `${E ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
4976
4999
  a,
4977
5000
  l,
4978
5001
  i
@@ -4980,35 +5003,34 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
4980
5003
  ] });
4981
5004
  }
4982
5005
  return /* @__PURE__ */ jsxs("div", { className: r, children: [
4983
- u.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
5006
+ p.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
4984
5007
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4985
- /* @__PURE__ */ jsxs("label", { htmlFor: o, className: u.type === "object" ? "pb-2" : "", children: [
5008
+ /* @__PURE__ */ jsxs("label", { htmlFor: o, className: p.type === "object" ? "pb-2" : "", children: [
4986
5009
  n,
4987
5010
  " ",
4988
- E && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
5011
+ S && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
4989
5012
  " ",
4990
- b
5013
+ y
4991
5014
  ] }),
4992
- p && u.type !== "object" ? " *" : null
5015
+ d && p.type !== "object" ? " *" : null
4993
5016
  ] }),
4994
- u.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
5017
+ p.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
4995
5018
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Info, { className: "h-3 w-3 text-muted-foreground/70" }) }),
4996
- /* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: u.description })
5019
+ /* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: p.description })
4997
5020
  ] }) })
4998
5021
  ] }),
4999
- !u.enum && !u.oneOf && A && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
5022
+ !p.enum && !p.oneOf && b && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
5000
5023
  DataBindingSelector,
5001
5024
  {
5002
- schema: u,
5003
- onChange: (v) => {
5004
- h(v, g, o);
5025
+ schema: p,
5026
+ onChange: (E) => {
5027
+ g(E, u, o);
5005
5028
  },
5006
5029
  id: o,
5007
- formData: g
5030
+ formData: u
5008
5031
  }
5009
5032
  ) })
5010
5033
  ] }),
5011
- c,
5012
5034
  a,
5013
5035
  l,
5014
5036
  i
@@ -5108,36 +5130,36 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
5108
5130
  }), a;
5109
5131
  };
5110
5132
  function BlockSettings() {
5111
- const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h), f = ({ formData: w }, y, C) => {
5112
- y && (c == null ? void 0 : c._id) === r._id && a([r._id], { [y]: get(w, y) }, C);
5133
+ const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h), f = ({ formData: w }, k, S) => {
5134
+ k && (c == null ? void 0 : c._id) === r._id && a([r._id], { [k]: get(w, k) }, S);
5113
5135
  }, x = useCallback(
5114
- debounce(({ formData: w }, y, C) => {
5115
- f({ formData: w }, y, C), d(w);
5136
+ debounce(({ formData: w }, k, S) => {
5137
+ f({ formData: w }, k, S), d(w);
5116
5138
  }, 1500),
5117
5139
  [r == null ? void 0 : r._id, o]
5118
- ), k = ({ formData: w }, y) => {
5119
- y && (n([r._id], { [y]: get(w, y) }), x({ formData: w }, y, { [y]: get(c, y) }));
5120
- }, b = ({ formData: w }, y) => {
5121
- y && (n([g._id], { [y]: get(w, y) }), x({ formData: w }, y, { [y]: get(c, y) }));
5122
- }, { schema: A, uiSchema: B } = useMemo(() => {
5140
+ ), y = ({ formData: w }, k) => {
5141
+ k && (n([r._id], { [k]: get(w, k) }), x({ formData: w }, k, { [k]: get(c, k) }));
5142
+ }, b = ({ formData: w }, k) => {
5143
+ k && (n([g._id], { [k]: get(w, k) }), x({ formData: w }, k, { [k]: get(c, k) }));
5144
+ }, { schema: A, uiSchema: _ } = useMemo(() => {
5123
5145
  const w = r == null ? void 0 : r._type;
5124
5146
  if (!w)
5125
5147
  return { schema: {}, uiSchema: {} };
5126
5148
  try {
5127
- const { schema: y, uiSchema: C } = getBlockFormSchemas(w);
5149
+ const { schema: k, uiSchema: S } = getBlockFormSchemas(w);
5128
5150
  if (w === "Repeater") {
5129
5151
  const E = get(r, "repeaterItems", "");
5130
- startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(C, "filter", { "ui:widget": "collectionSelect" }), set(C, "sort", { "ui:widget": "collectionSelect" })) : (set(C, "filter", { "ui:widget": "hidden" }), set(C, "sort", { "ui:widget": "hidden" }));
5152
+ startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(S, "filter", { "ui:widget": "collectionSelect" }), set(S, "sort", { "ui:widget": "collectionSelect" })) : (set(S, "filter", { "ui:widget": "hidden" }), set(S, "sort", { "ui:widget": "hidden" }));
5131
5153
  }
5132
- return { schema: y, uiSchema: C };
5154
+ return { schema: k, uiSchema: S };
5133
5155
  } catch {
5134
5156
  return { schema: {}, uiSchema: {} };
5135
5157
  }
5136
- }, [r]), { wrapperSchema: _, wrapperUiSchema: N } = useMemo(() => {
5158
+ }, [r]), { wrapperSchema: B, wrapperUiSchema: N } = useMemo(() => {
5137
5159
  if (!g || !(g != null && g._type))
5138
5160
  return { wrapperSchema: {}, wrapperUiSchema: {} };
5139
- const w = g == null ? void 0 : g._type, { schema: y = {}, uiSchema: C = {} } = getBlockFormSchemas(w);
5140
- return { wrapperSchema: y, wrapperUiSchema: C };
5161
+ const w = g == null ? void 0 : g._type, { schema: k = {}, uiSchema: S = {} } = getBlockFormSchemas(w);
5162
+ return { wrapperSchema: k, wrapperUiSchema: S };
5141
5163
  }, [g]);
5142
5164
  return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
5143
5165
  !isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
@@ -5165,7 +5187,7 @@ function BlockSettings() {
5165
5187
  blockId: g == null ? void 0 : g._id,
5166
5188
  onChange: b,
5167
5189
  formData: m,
5168
- schema: _,
5190
+ schema: B,
5169
5191
  uiSchema: N
5170
5192
  }
5171
5193
  ) })
@@ -5174,10 +5196,10 @@ function BlockSettings() {
5174
5196
  JSONForm,
5175
5197
  {
5176
5198
  blockId: r == null ? void 0 : r._id,
5177
- onChange: k,
5199
+ onChange: y,
5178
5200
  formData: i,
5179
5201
  schema: A,
5180
- uiSchema: B
5202
+ uiSchema: _
5181
5203
  }
5182
5204
  )
5183
5205
  ] });
@@ -5188,7 +5210,7 @@ const BlockStylingProps = () => {
5188
5210
  if (!o) return null;
5189
5211
  const c = Object.keys(o).filter(
5190
5212
  (x) => typeof o[x] == "string" && o[x].startsWith("#styles:")
5191
- ), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (f = r[0]) == null ? void 0 : f.prop, ""), { classes: g = "" } = getSplitChaiClasses(u) || {}, h = g ? g.split(" ").filter((x) => !isEmpty(x)) : [], m = (x) => find(r, (k) => k.prop === x);
5213
+ ), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (f = r[0]) == null ? void 0 : f.prop, ""), { classes: g = "" } = getSplitChaiClasses(u) || {}, h = g ? g.split(" ").filter((x) => !isEmpty(x)) : [], m = (x) => find(r, (y) => y.prop === x);
5192
5214
  return /* @__PURE__ */ jsx(Fragment, { children: p && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
5193
5215
  /* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
5194
5216
  i("Style element"),
@@ -5210,7 +5232,7 @@ const BlockStylingProps = () => {
5210
5232
  {
5211
5233
  type: "button",
5212
5234
  className: "ml-1 rounded-sm p-0.5 hover:bg-blue-300 hover:text-blue-600",
5213
- onClick: (k) => k.stopPropagation(),
5235
+ onClick: (y) => y.stopPropagation(),
5214
5236
  children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" })
5215
5237
  }
5216
5238
  ) }),
@@ -5388,37 +5410,37 @@ const BlockStylingProps = () => {
5388
5410
  },
5389
5411
  a
5390
5412
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
5391
- const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [k, b] = useState(""), [A, B] = useState(!1), [_, N] = useState(!1);
5413
+ const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [A, _] = useState(!1), [B, N] = useState(!1);
5392
5414
  useEffect(() => {
5393
- const { value: v, unit: S } = getClassValueAndUnit(i);
5394
- if (S === "") {
5415
+ const { value: v, unit: C } = getClassValueAndUnit(i);
5416
+ if (C === "") {
5395
5417
  l(v), m(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
5396
5418
  return;
5397
5419
  }
5398
- m(S), l(S === "class" || isEmpty(v) ? "" : v);
5420
+ m(C), l(C === "class" || isEmpty(v) ? "" : v);
5399
5421
  }, [i, p, u]);
5400
- const w = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), y = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), C = useCallback(
5422
+ const w = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), k = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), S = useCallback(
5401
5423
  (v = !1) => {
5402
- const S = getUserInputValues(`${a}`, u);
5403
- if (get(S, "error", !1)) {
5424
+ const C = getUserInputValues(`${a}`, u);
5425
+ if (get(C, "error", !1)) {
5404
5426
  x(!0);
5405
5427
  return;
5406
5428
  }
5407
- const j = get(S, "unit") !== "" ? get(S, "unit") : h;
5429
+ const j = get(C, "unit") !== "" ? get(C, "unit") : h;
5408
5430
  if (j === "auto" || j === "none") {
5409
5431
  w(`${d}${j}`);
5410
5432
  return;
5411
5433
  }
5412
- if (get(S, "value") === "")
5434
+ if (get(C, "value") === "")
5413
5435
  return;
5414
- const L = `${get(S, "value", "").startsWith("-") ? "-" : ""}${d}[${get(S, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
5415
- v ? y(L) : w(L);
5436
+ const L = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
5437
+ v ? k(L) : w(L);
5416
5438
  },
5417
- [w, y, a, h, d, u]
5439
+ [w, k, a, h, d, u]
5418
5440
  ), E = useCallback(
5419
5441
  (v) => {
5420
- const S = getUserInputValues(`${a}`, u);
5421
- if (get(S, "error", !1)) {
5442
+ const C = getUserInputValues(`${a}`, u);
5443
+ if (get(C, "error", !1)) {
5422
5444
  x(!0);
5423
5445
  return;
5424
5446
  }
@@ -5426,9 +5448,9 @@ const BlockStylingProps = () => {
5426
5448
  w(`${d}${v}`);
5427
5449
  return;
5428
5450
  }
5429
- if (get(S, "value") === "")
5451
+ if (get(C, "value") === "")
5430
5452
  return;
5431
- const j = get(S, "unit") !== "" ? get(S, "unit") : v, L = `${get(S, "value", "").startsWith("-") ? "-" : ""}${d}[${get(S, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
5453
+ const j = get(C, "unit") !== "" ? get(C, "unit") : v, L = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
5432
5454
  w(L);
5433
5455
  },
5434
5456
  [w, a, d, u]
@@ -5453,30 +5475,30 @@ const BlockStylingProps = () => {
5453
5475
  {
5454
5476
  readOnly: h === "class",
5455
5477
  onKeyPress: (v) => {
5456
- v.key === "Enter" && C();
5478
+ v.key === "Enter" && S();
5457
5479
  },
5458
5480
  onKeyDown: (v) => {
5459
5481
  if (v.keyCode !== 38 && v.keyCode !== 40)
5460
5482
  return;
5461
5483
  v.preventDefault(), N(!0);
5462
- const S = parseInt$1(v.target.value);
5463
- let j = isNaN$1(S) ? 0 : S;
5484
+ const C = parseInt$1(v.target.value);
5485
+ let j = isNaN$1(C) ? 0 : C;
5464
5486
  v.keyCode === 38 && (j += 1), v.keyCode === 40 && (j -= 1);
5465
- const T = `${j}`, R = `${T.startsWith("-") ? "-" : ""}${d}[${T.replace("-", "")}${h === "-" ? "" : h}]`;
5466
- y(R);
5487
+ const I = `${j}`, R = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${h === "-" ? "" : h}]`;
5488
+ k(R);
5467
5489
  },
5468
5490
  onKeyUp: (v) => {
5469
- _ && (v.preventDefault(), N(!1));
5491
+ B && (v.preventDefault(), N(!1));
5470
5492
  },
5471
- onBlur: () => C(),
5493
+ onBlur: () => S(),
5472
5494
  onChange: (v) => {
5473
5495
  x(!1), l(v.target.value);
5474
5496
  },
5475
5497
  onClick: (v) => {
5476
- var S;
5477
- (S = v == null ? void 0 : v.target) == null || S.select(), n(!1);
5498
+ var C;
5499
+ (C = v == null ? void 0 : v.target) == null || C.select(), n(!1);
5478
5500
  },
5479
- value: A ? k : a,
5501
+ value: A ? y : a,
5480
5502
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
5481
5503
  " ",
5482
5504
  f ? "border-red-500 text-red-500" : "border-foreground/20"
@@ -5511,19 +5533,19 @@ const BlockStylingProps = () => {
5511
5533
  ["none", "auto"].indexOf(h) !== -1 || A ? null : /* @__PURE__ */ jsx(
5512
5534
  DragStyleButton,
5513
5535
  {
5514
- onDragStart: () => B(!0),
5536
+ onDragStart: () => _(!0),
5515
5537
  onDragEnd: (v) => {
5516
- if (b(() => ""), B(!1), isEmpty(v))
5538
+ if (b(() => ""), _(!1), isEmpty(v))
5517
5539
  return;
5518
- const S = `${v}`, T = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${h === "-" ? "" : h}]`;
5519
- w(T);
5540
+ const C = `${v}`, I = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
5541
+ w(I);
5520
5542
  },
5521
5543
  onDrag: (v) => {
5522
5544
  if (isEmpty(v))
5523
5545
  return;
5524
5546
  b(v);
5525
- const S = `${v}`, T = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${h === "-" ? "" : h}]`;
5526
- y(T);
5547
+ const C = `${v}`, I = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
5548
+ k(I);
5527
5549
  },
5528
5550
  currentValue: a,
5529
5551
  unit: h,
@@ -5588,8 +5610,8 @@ const COLOR_PROP = {
5588
5610
  }, ColorChoice = ({ property: o, onChange: r }) => {
5589
5611
  const n = useCurrentClassByProperty(o), a = useMemo(() => get(n, "cls", ""), [n]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), g = get(u, "1", ""), h = get(u, "2", ""), m = useCallback(
5590
5612
  // eslint-disable-next-line no-shadow
5591
- (k) => {
5592
- ["current", "inherit", "transparent", "black", "white"].includes(k) ? (c([]), p({ color: k })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((b) => ({ ...b, color: k, shade: b.shade ? b.shade : "500" })));
5613
+ (y) => {
5614
+ ["current", "inherit", "transparent", "black", "white"].includes(y) ? (c([]), p({ color: y })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((b) => ({ ...b, color: y, shade: b.shade ? b.shade : "500" })));
5593
5615
  },
5594
5616
  [c, p]
5595
5617
  );
@@ -5600,8 +5622,8 @@ const COLOR_PROP = {
5600
5622
  }, [g]);
5601
5623
  const f = useCallback(
5602
5624
  // eslint-disable-next-line no-shadow
5603
- (k) => {
5604
- p({ color: g, shade: k });
5625
+ (y) => {
5626
+ p({ color: g, shade: y });
5605
5627
  },
5606
5628
  [g]
5607
5629
  );
@@ -5986,34 +6008,34 @@ const COLOR_PROP = {
5986
6008
  "2xl": "1536px"
5987
6009
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
5988
6010
  const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
5989
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), k = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
5990
- (y, C = !0) => {
5991
- const E = { dark: p, mq: g, mod: u, cls: y, property: l, fullCls: "" };
6011
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), y = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
6012
+ (k, S = !0) => {
6013
+ const E = { dark: p, mq: g, mod: u, cls: k, property: l, fullCls: "" };
5992
6014
  (p || u !== "") && (E.mq = "xs");
5993
6015
  const v = generateFullClsName(E);
5994
- m(x, [v], C);
6016
+ m(x, [v], S);
5995
6017
  },
5996
6018
  [x, p, g, u, l, m]
5997
6019
  ), A = useCallback(() => {
5998
- f(x, [k], !0);
5999
- }, [x, k, f]), B = useMemo(() => canChangeClass(h, g), [h, g]);
6020
+ f(x, [y], !0);
6021
+ }, [x, y, f]), _ = useMemo(() => canChangeClass(h, g), [h, g]);
6000
6022
  useEffect(() => {
6001
- i(B, h);
6002
- }, [B, i, h]);
6003
- const [, , _] = useScreenSizeWidth(), N = useCallback(
6004
- (y) => {
6005
- _({
6023
+ i(_, h);
6024
+ }, [_, i, h]);
6025
+ const [, , B] = useScreenSizeWidth(), N = useCallback(
6026
+ (k) => {
6027
+ B({
6006
6028
  xs: 400,
6007
6029
  sm: 640,
6008
6030
  md: 800,
6009
6031
  lg: 1024,
6010
6032
  xl: 1420,
6011
6033
  "2xl": 1920
6012
- }[y]);
6034
+ }[k]);
6013
6035
  },
6014
- [_]
6036
+ [B]
6015
6037
  ), w = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === g;
6016
- return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: h && w, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6038
+ return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: _, canReset: h && w, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6017
6039
  /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${h && !w ? "text-foreground" : ""}`, children: r(a) }) }),
6018
6040
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
6019
6041
  /* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
@@ -6033,7 +6055,7 @@ const COLOR_PROP = {
6033
6055
  n === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
6034
6056
  n === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
6035
6057
  ] }),
6036
- /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${k ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && h ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
6058
+ /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : _ && h ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
6037
6059
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
6038
6060
  "button",
6039
6061
  {
@@ -6257,7 +6279,7 @@ const COLOR_PROP = {
6257
6279
  u.includes(b) ? u.length > 2 && g(u.filter((A) => A !== b)) : g((A) => [...A, b]);
6258
6280
  }, x = (b) => {
6259
6281
  r || l(b), c(b);
6260
- }, k = getBreakpointValue(r ? i : a).toLowerCase();
6282
+ }, y = getBreakpointValue(r ? i : a).toLowerCase();
6261
6283
  return m.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(m, (b) => /* @__PURE__ */ createElement(
6262
6284
  BreakpointCard,
6263
6285
  {
@@ -6265,7 +6287,7 @@ const COLOR_PROP = {
6265
6287
  ...b,
6266
6288
  onClick: x,
6267
6289
  key: b.breakpoint,
6268
- currentBreakpoint: k
6290
+ currentBreakpoint: y
6269
6291
  }
6270
6292
  )) }) : /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between rounded-md", children: [
6271
6293
  /* @__PURE__ */ jsx("div", { className: "flex items-center", children: map(
@@ -6279,7 +6301,7 @@ const COLOR_PROP = {
6279
6301
  ...b,
6280
6302
  onClick: x,
6281
6303
  key: b.breakpoint,
6282
- currentBreakpoint: k
6304
+ currentBreakpoint: y
6283
6305
  }
6284
6306
  )
6285
6307
  ) }),
@@ -6433,15 +6455,15 @@ const AskAIStyles = ({ blockId: o }) => {
6433
6455
  ] });
6434
6456
  };
6435
6457
  function ManualClasses() {
6436
- var T;
6437
- const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), k = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, k, "")), A = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
6458
+ var I;
6459
+ const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), A = b.split(" ").filter((L) => !isEmpty(L)), _ = () => {
6438
6460
  const L = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6439
6461
  u(h, L, !0), x("");
6440
- }, [_, N] = useState([]), w = ({ value: L }) => {
6441
- const R = L.trim().toLowerCase(), I = R.match(/.+:/g);
6462
+ }, [B, N] = useState([]), w = ({ value: L }) => {
6463
+ const R = L.trim().toLowerCase(), T = R.match(/.+:/g);
6442
6464
  let D = [];
6443
- if (I && I.length > 0) {
6444
- const [O] = I, P = R.replace(O, "");
6465
+ if (T && T.length > 0) {
6466
+ const [O] = T, P = R.replace(O, "");
6445
6467
  D = i.search(P).map((M) => ({
6446
6468
  ...M,
6447
6469
  item: { ...M.item, name: O + M.item.name }
@@ -6449,9 +6471,9 @@ function ManualClasses() {
6449
6471
  } else
6450
6472
  D = i.search(R);
6451
6473
  return N(map(D, "item"));
6452
- }, y = () => {
6474
+ }, k = () => {
6453
6475
  N([]);
6454
- }, C = (L) => L.name, E = (L) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: L.name }), v = useMemo(
6476
+ }, S = (L) => L.name, E = (L) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: L.name }), v = useMemo(
6455
6477
  () => ({
6456
6478
  ref: o,
6457
6479
  autoComplete: "off",
@@ -6466,13 +6488,13 @@ function ManualClasses() {
6466
6488
  }, 0);
6467
6489
  },
6468
6490
  onKeyDown: (L) => {
6469
- L.key === "Enter" && f.trim() !== "" && B();
6491
+ L.key === "Enter" && f.trim() !== "" && _();
6470
6492
  },
6471
6493
  onChange: (L, { newValue: R }) => x(R),
6472
6494
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
6473
6495
  }),
6474
6496
  [f, c, o]
6475
- ), S = (L) => {
6497
+ ), C = (L) => {
6476
6498
  debugger;
6477
6499
  const R = r.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6478
6500
  g(h, [L]), u(h, R, !0), n(""), l(-1);
@@ -6504,10 +6526,10 @@ function ManualClasses() {
6504
6526
  /* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
6505
6527
  Autosuggest,
6506
6528
  {
6507
- suggestions: _,
6529
+ suggestions: B,
6508
6530
  onSuggestionsFetchRequested: w,
6509
- onSuggestionsClearRequested: y,
6510
- getSuggestionValue: C,
6531
+ onSuggestionsClearRequested: k,
6532
+ getSuggestionValue: S,
6511
6533
  renderSuggestion: E,
6512
6534
  inputProps: v,
6513
6535
  containerProps: {
@@ -6525,7 +6547,7 @@ function ManualClasses() {
6525
6547
  {
6526
6548
  variant: "outline",
6527
6549
  className: "h-6 border-border",
6528
- onClick: B,
6550
+ onClick: _,
6529
6551
  disabled: f.trim() === "",
6530
6552
  size: "sm",
6531
6553
  children: /* @__PURE__ */ jsx(PlusIcon, {})
@@ -6538,16 +6560,16 @@ function ManualClasses() {
6538
6560
  {
6539
6561
  ref: o,
6540
6562
  value: r,
6541
- onChange: (I) => n(I.target.value),
6563
+ onChange: (T) => n(T.target.value),
6542
6564
  onBlur: () => {
6543
- S(L);
6565
+ C(L);
6544
6566
  },
6545
- onKeyDown: (I) => {
6546
- I.key === "Enter" && S(L);
6567
+ onKeyDown: (T) => {
6568
+ T.key === "Enter" && C(L);
6547
6569
  },
6548
- onFocus: (I) => {
6570
+ onFocus: (T) => {
6549
6571
  setTimeout(() => {
6550
- I.target.select();
6572
+ T.target.select();
6551
6573
  }, 0);
6552
6574
  },
6553
6575
  className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300"
@@ -6561,38 +6583,40 @@ function ManualClasses() {
6561
6583
  o.current && o.current.focus();
6562
6584
  }, 10);
6563
6585
  },
6564
- className: "flex cursor-default items-center gap-x-1 truncate break-words border border-border bg-gray-200 p-px pl-5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 hover:pl-5 group-hover:pl-5 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
6586
+ className: "flex h-max cursor-default items-center gap-x-1 truncate break-words rounded bg-gray-200 py-px pl-0.5 pr-1 text-[11px] text-gray-600 dark:bg-gray-800 dark:text-gray-300",
6565
6587
  children: [
6566
- L,
6567
- /* @__PURE__ */ jsx(
6568
- Cross2Icon,
6569
- {
6570
- onClick: () => g(h, [L], !0),
6571
- className: "absolute left-0.5 mr-0.5 hidden group-hover:block h-4 w-4 bg-gray-500 font-bold group-hover:bg-gray-300 group-hover:text-red-500 "
6572
- }
6573
- ),
6574
- /* @__PURE__ */ jsxs(
6575
- "svg",
6576
- {
6577
- className: "absolute left-0.5 mr-0.5 group-hover:hidden h-3.5 w-3.5 ",
6578
- fill: "rgba(55, 65, 81, 0.4)",
6579
- viewBox: "0 0 24 24",
6580
- xmlns: "http://www.w3.org/2000/svg",
6581
- xmlSpace: "preserve",
6582
- children: [
6583
- /* @__PURE__ */ jsx("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
6584
- /* @__PURE__ */ jsx("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
6585
- /* @__PURE__ */ jsx("g", { id: "SVGRepo_iconCarrier", children: /* @__PURE__ */ jsx(
6586
- "path",
6587
- {
6588
- fillRule: "evenodd",
6589
- clipRule: "evenodd",
6590
- d: "M12 6.036c-2.667 0-4.333 1.325-5 3.976 1-1.325 2.167-1.822 3.5-1.491.761.189 1.305.738 1.906 1.345C13.387 10.855 14.522 12 17 12c2.667 0 4.333-1.325 5-3.976-1 1.325-2.166 1.822-3.5 1.491-.761-.189-1.305-.738-1.907-1.345-.98-.99-2.114-2.134-4.593-2.134zM7 12c-2.667 0-4.333 1.325-5 3.976 1-1.326 2.167-1.822 3.5-1.491.761.189 1.305.738 1.907 1.345.98.989 2.115 2.134 4.594 2.134 2.667 0 4.333-1.325 5-3.976-1 1.325-2.167 1.822-3.5 1.491-.761-.189-1.305-.738-1.906-1.345C10.613 13.145 9.478 12 7 12z"
6591
- }
6592
- ) })
6593
- ]
6594
- }
6595
- )
6588
+ /* @__PURE__ */ jsxs("div", { className: "z-10 flex h-full w-max items-center justify-center", children: [
6589
+ /* @__PURE__ */ jsx(
6590
+ Cross2Icon,
6591
+ {
6592
+ onClick: () => g(h, [L], !0),
6593
+ className: "hidden h-max w-3.5 cursor-pointer rounded bg-gray-100 p-0.5 text-red-500 hover:bg-gray-50 group-hover:block"
6594
+ }
6595
+ ),
6596
+ /* @__PURE__ */ jsxs(
6597
+ "svg",
6598
+ {
6599
+ className: "h-3.5 w-3.5 group-hover:hidden",
6600
+ fill: "rgba(55, 65, 81, 0.4)",
6601
+ viewBox: "0 0 24 24",
6602
+ xmlns: "http://www.w3.org/2000/svg",
6603
+ xmlSpace: "preserve",
6604
+ children: [
6605
+ /* @__PURE__ */ jsx("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
6606
+ /* @__PURE__ */ jsx("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
6607
+ /* @__PURE__ */ jsx("g", { id: "SVGRepo_iconCarrier", children: /* @__PURE__ */ jsx(
6608
+ "path",
6609
+ {
6610
+ fillRule: "evenodd",
6611
+ clipRule: "evenodd",
6612
+ d: "M12 6.036c-2.667 0-4.333 1.325-5 3.976 1-1.325 2.167-1.822 3.5-1.491.761.189 1.305.738 1.906 1.345C13.387 10.855 14.522 12 17 12c2.667 0 4.333-1.325 5-3.976-1 1.325-2.166 1.822-3.5 1.491-.761-.189-1.305-.738-1.907-1.345-.98-.99-2.114-2.134-4.593-2.134zM7 12c-2.667 0-4.333 1.325-5 3.976 1-1.326 2.167-1.822 3.5-1.491.761.189 1.305.738 1.907 1.345.98.989 2.115 2.134 4.594 2.134 2.667 0 4.333-1.325 5-3.976-1 1.325-2.167 1.822-3.5 1.491-.761-.189-1.305-.738-1.906-1.345C10.613 13.145 9.478 12 7 12z"
6613
+ }
6614
+ ) })
6615
+ ]
6616
+ }
6617
+ )
6618
+ ] }),
6619
+ /* @__PURE__ */ jsx("div", { children: L })
6596
6620
  ]
6597
6621
  }
6598
6622
  ) }, L)
@@ -6713,8 +6737,8 @@ function BlockStyling() {
6713
6737
  m = isNaN(m) ? 0 : m;
6714
6738
  let f = MAPPER[i.dragUnit];
6715
6739
  (startsWith(h, "scale") || h === "opacity") && (f = 10);
6716
- let k = (i.dragStartY - u.pageY) / f + m;
6717
- g && k < 0 && (k = 0), h === "opacity" && k > 1 && (k = 1), i.onDrag(`${k}`), l(`${k}`);
6740
+ let y = (i.dragStartY - u.pageY) / f + m;
6741
+ g && y < 0 && (y = 0), h === "opacity" && y > 1 && (y = 1), i.onDrag(`${y}`), l(`${y}`);
6718
6742
  },
6719
6743
  [i],
6720
6744
  50
@@ -6757,8 +6781,8 @@ const CoreBlock = ({
6757
6781
  }) => {
6758
6782
  const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, g] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(), m = () => {
6759
6783
  if (has(o, "blocks")) {
6760
- const k = isFunction(o.blocks) ? o.blocks() : o.blocks;
6761
- u(syncBlocksWithDefaults(k), n || null, a);
6784
+ const y = isFunction(o.blocks) ? o.blocks() : o.blocks;
6785
+ u(syncBlocksWithDefaults(y), n || null, a);
6762
6786
  } else
6763
6787
  p(o, n || null, a);
6764
6788
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
@@ -6770,8 +6794,8 @@ const CoreBlock = ({
6770
6794
  disabled: r,
6771
6795
  onClick: m,
6772
6796
  type: "button",
6773
- onDragStart: (k) => {
6774
- k.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), k.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
6797
+ onDragStart: (y) => {
6798
+ y.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), y.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
6775
6799
  g([]), h();
6776
6800
  }, 200);
6777
6801
  },
@@ -6986,7 +7010,7 @@ const CoreBlock = ({
6986
7010
  }
6987
7011
  }
6988
7012
  }, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
6989
- var h, m, f, x, k, b, A, B, _, N;
7013
+ var h, m, f, x, y, b, A, _, B, N;
6990
7014
  if (n.type === "comment") return [];
6991
7015
  let a = { _id: generateUUID() };
6992
7016
  if (r && (a._parent = r.block._id), n.type === "text")
@@ -7008,7 +7032,7 @@ const CoreBlock = ({
7008
7032
  ...getAttrs(n),
7009
7033
  ...getStyles(n)
7010
7034
  }, n.attributes) {
7011
- const w = n.attributes.find((y) => includes(NAME_ATTRIBUTES, y.key));
7035
+ const w = n.attributes.find((k) => includes(NAME_ATTRIBUTES, k.key));
7012
7036
  w && (a._name = w.value);
7013
7037
  }
7014
7038
  if (i)
@@ -7026,29 +7050,29 @@ const CoreBlock = ({
7026
7050
  ];
7027
7051
  a = {
7028
7052
  ...a,
7029
- href: ((h = l.find((y) => y.key === "href")) == null ? void 0 : h.value) || "",
7030
- hrefType: ((m = l.find((y) => y.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
7031
- autoplay: ((f = l.find((y) => y.key === "data-autoplay")) == null ? void 0 : f.value) === "true" ? "true" : "false",
7032
- maxWidth: ((k = (x = l.find((y) => y.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : k.replace("px", "")) || "",
7033
- backdropColor: ((b = l.find((y) => y.key === "data-overlay")) == null ? void 0 : b.value) || "",
7034
- galleryName: ((A = l.find((y) => y.key === "data-gall")) == null ? void 0 : A.value) || ""
7035
- }, forEach(w, (y) => {
7036
- has(a, `styles_attrs.${y}`) && delete a.styles_attrs[y];
7053
+ href: ((h = l.find((k) => k.key === "href")) == null ? void 0 : h.value) || "",
7054
+ hrefType: ((m = l.find((k) => k.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
7055
+ autoplay: ((f = l.find((k) => k.key === "data-autoplay")) == null ? void 0 : f.value) === "true" ? "true" : "false",
7056
+ maxWidth: ((y = (x = l.find((k) => k.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : y.replace("px", "")) || "",
7057
+ backdropColor: ((b = l.find((k) => k.key === "data-overlay")) == null ? void 0 : b.value) || "",
7058
+ galleryName: ((A = l.find((k) => k.key === "data-gall")) == null ? void 0 : A.value) || ""
7059
+ }, forEach(w, (k) => {
7060
+ has(a, `styles_attrs.${k}`) && delete a.styles_attrs[k];
7037
7061
  });
7038
7062
  }
7039
7063
  if (d && (delete a.styles_attrs, a.showDropdown = !1), u && delete a.styles_attrs, p) {
7040
7064
  delete a.styles_attrs;
7041
- const w = filter(n.children || [], (C) => (C == null ? void 0 : C.tagName) !== "span");
7065
+ const w = filter(n.children || [], (S) => (S == null ? void 0 : S.tagName) !== "span");
7042
7066
  a.content = getTextContent(w);
7043
- const y = find(
7067
+ const k = find(
7044
7068
  n.children || [],
7045
- (C) => (C == null ? void 0 : C.tagName) === "span" && some(C.children || [], (E) => (E == null ? void 0 : E.tagName) === "svg")
7069
+ (S) => (S == null ? void 0 : S.tagName) === "span" && some(S.children || [], (E) => (E == null ? void 0 : E.tagName) === "svg")
7046
7070
  );
7047
- if (y) {
7048
- const C = find(y.children || [], (E) => (E == null ? void 0 : E.tagName) === "svg");
7049
- if (C) {
7050
- a.icon = stringify([C]);
7051
- const { height: E, width: v } = getSvgDimensions(C, "16px", "16px");
7071
+ if (k) {
7072
+ const S = find(k.children || [], (E) => (E == null ? void 0 : E.tagName) === "svg");
7073
+ if (S) {
7074
+ a.icon = stringify([S]);
7075
+ const { height: E, width: v } = getSvgDimensions(S, "16px", "16px");
7052
7076
  a.iconHeight = E, a.iconWidth = v;
7053
7077
  }
7054
7078
  }
@@ -7061,11 +7085,11 @@ const CoreBlock = ({
7061
7085
  const w = stringify([n]);
7062
7086
  return hasVideoEmbed(w) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(w)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = w, [a];
7063
7087
  } else if (n.tagName === "svg") {
7064
- const w = get(find(n.attributes, { key: "class" }), "value", ""), { height: y, width: C } = getHeightAndWidthFromClass(w);
7065
- if (y && C)
7066
- a.styles = `${STYLES_KEY}, ${cn$2(`w-${C} h-${y}`, w)}`.trim(), a.height = y == null ? void 0 : y.replace("px", ""), a.width = C == null ? void 0 : C.replace("px", "");
7088
+ const w = get(find(n.attributes, { key: "class" }), "value", ""), { height: k, width: S } = getHeightAndWidthFromClass(w);
7089
+ if (k && S)
7090
+ a.styles = `${STYLES_KEY}, ${cn$2(`w-${S} h-${k}`, w)}`.trim(), a.height = k == null ? void 0 : k.replace("px", ""), a.width = S == null ? void 0 : S.replace("px", "");
7067
7091
  else {
7068
- const E = (B = find(n.attributes, { key: "height" })) == null ? void 0 : B.value, v = (_ = find(n.attributes, { key: "width" })) == null ? void 0 : _.value;
7092
+ const E = (_ = find(n.attributes, { key: "height" })) == null ? void 0 : _.value, v = (B = find(n.attributes, { key: "width" })) == null ? void 0 : B.value;
7069
7093
  E && v ? (a.styles = `${STYLES_KEY}, ${cn$2(`w-[${v}px] h-[${E}px]`, w)}`.trim(), a.height = E, a.width = v) : a.styles = `${STYLES_KEY}, ${cn$2("w-full h-full", w)}`.trim();
7070
7094
  }
7071
7095
  return n.attributes = filter(n.attributes, (E) => !includes(["style", "width", "height", "class"], E.key)), a.icon = stringify([n]), [a];
@@ -7185,18 +7209,18 @@ const registerChaiLibrary = (o, r) => {
7185
7209
  parentId: n = void 0,
7186
7210
  position: a = -1
7187
7211
  }) => {
7188
- const [l, i] = useState(!1), c = useMemo(() => (r == null ? void 0 : r.getBlock) || (() => []), [r]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), k = (B) => {
7189
- const _ = has(B, "styles_attrs.data-page-section");
7190
- return B._type === "Box" && _;
7212
+ const [l, i] = useState(!1), c = useMemo(() => (r == null ? void 0 : r.getBlock) || (() => []), [r]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (_) => {
7213
+ const B = has(_, "styles_attrs.data-page-section");
7214
+ return _._type === "Box" && B;
7191
7215
  }, b = useCallback(
7192
- async (B) => {
7193
- if (B.stopPropagation(), has(o, "component")) {
7216
+ async (_) => {
7217
+ if (_.stopPropagation(), has(o, "component")) {
7194
7218
  d(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7195
7219
  return;
7196
7220
  }
7197
7221
  i(!0);
7198
- let _ = await c({ library: r, block: o });
7199
- typeof _ == "string" && (_ = getBlocksFromHTML(_)), isEmpty(_) || p(syncBlocksWithDefaults(_), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7222
+ let B = await c({ library: r, block: o });
7223
+ typeof B == "string" && (B = getBlocksFromHTML(B)), isEmpty(B) || p(syncBlocksWithDefaults(B), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7200
7224
  },
7201
7225
  [d, p, o, c, r, n, a]
7202
7226
  );
@@ -7207,18 +7231,18 @@ const registerChaiLibrary = (o, r) => {
7207
7231
  onClick: l ? () => {
7208
7232
  } : b,
7209
7233
  draggable: f ? "true" : "false",
7210
- onDragStart: async (B) => {
7211
- const _ = await c({ library: r, block: o });
7234
+ onDragStart: async (_) => {
7235
+ const B = await c({ library: r, block: o });
7212
7236
  let N = n;
7213
- if (k(first(_)) && (N = null), !isEmpty(_)) {
7214
- const w = { blocks: _, uiLibrary: !0, parent: N };
7215
- if (B.dataTransfer.setData("text/plain", JSON.stringify(w)), o.preview) {
7216
- const y = new Image();
7217
- y.src = o.preview, y.onload = () => {
7218
- B.dataTransfer.setDragImage(y, 0, 0);
7237
+ if (y(first(B)) && (N = null), !isEmpty(B)) {
7238
+ const w = { blocks: B, uiLibrary: !0, parent: N };
7239
+ if (_.dataTransfer.setData("text/plain", JSON.stringify(w)), o.preview) {
7240
+ const k = new Image();
7241
+ k.src = o.preview, k.onload = () => {
7242
+ _.dataTransfer.setDragImage(k, 0, 0);
7219
7243
  };
7220
7244
  } else
7221
- B.dataTransfer.setDragImage(new Image(), 0, 0);
7245
+ _.dataTransfer.setDragImage(new Image(), 0, 0);
7222
7246
  x(w), setTimeout(() => {
7223
7247
  u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7224
7248
  }, 200);
@@ -7245,7 +7269,7 @@ const registerChaiLibrary = (o, r) => {
7245
7269
  ] }) })
7246
7270
  ] });
7247
7271
  }, UILibrarySection = ({ parentId: o, position: r }) => {
7248
- const [n, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((S) => S.id === n) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), f = useRef(null);
7272
+ const [n, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((C) => C.id === n) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), f = useRef(null);
7249
7273
  useEffect(() => {
7250
7274
  c && c.length > 0 && (f.current = new Fuse(c, {
7251
7275
  keys: ["name", "label", "description", "group"],
@@ -7257,27 +7281,27 @@ const registerChaiLibrary = (o, r) => {
7257
7281
  m([]);
7258
7282
  return;
7259
7283
  }
7260
- const S = f.current.search(u).map((j) => j.item);
7261
- m(S);
7284
+ const C = f.current.search(u).map((j) => j.item);
7285
+ m(C);
7262
7286
  }, [u]);
7263
- const x = u.trim() && !isEmpty(h) ? h : c, k = groupBy(x, "group"), [b, A] = useState(null);
7287
+ const x = u.trim() && !isEmpty(h) ? h : c, y = groupBy(x, "group"), [b, A] = useState(null);
7264
7288
  useEffect(() => {
7265
- if (isEmpty(keys(k))) {
7289
+ if (isEmpty(keys(y))) {
7266
7290
  A(null);
7267
7291
  return;
7268
7292
  }
7269
- if (!b || !k[b]) {
7270
- A(first(keys(k)));
7293
+ if (!b || !y[b]) {
7294
+ A(first(keys(y)));
7271
7295
  return;
7272
7296
  }
7273
- }, [k, b]);
7274
- const B = get(k, b, []), _ = useRef(null), { t: N } = useTranslation(), w = (S) => {
7275
- _.current && (clearTimeout(_.current), _.current = null), _.current = setTimeout(() => {
7276
- _.current && A(S);
7297
+ }, [y, b]);
7298
+ const _ = get(y, b, []), B = useRef(null), { t: N } = useTranslation(), w = (C) => {
7299
+ B.current && (clearTimeout(B.current), B.current = null), B.current = setTimeout(() => {
7300
+ B.current && A(C);
7277
7301
  }, 400);
7278
- }, y = () => {
7302
+ }, k = () => {
7279
7303
  i != null && i.id && p(i.id);
7280
- }, C = () => {
7304
+ }, S = () => {
7281
7305
  g("");
7282
7306
  };
7283
7307
  if (d)
@@ -7285,7 +7309,7 @@ const registerChaiLibrary = (o, r) => {
7285
7309
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
7286
7310
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
7287
7311
  ] });
7288
- const E = filter(B, (S, j) => j % 2 === 0), v = filter(B, (S, j) => j % 2 === 1);
7312
+ const E = filter(_, (C, j) => j % 2 === 0), v = filter(_, (C, j) => j % 2 === 1);
7289
7313
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
7290
7314
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
7291
7315
  /* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
@@ -7294,14 +7318,14 @@ const registerChaiLibrary = (o, r) => {
7294
7318
  {
7295
7319
  placeholder: N("Search blocks..."),
7296
7320
  value: u,
7297
- onChange: (S) => g(S.target.value),
7321
+ onChange: (C) => g(C.target.value),
7298
7322
  className: "w-full pl-8 pr-8"
7299
7323
  }
7300
7324
  ),
7301
7325
  u && /* @__PURE__ */ jsx(
7302
7326
  "button",
7303
7327
  {
7304
- onClick: C,
7328
+ onClick: S,
7305
7329
  className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
7306
7330
  children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
7307
7331
  }
@@ -7313,17 +7337,17 @@ const registerChaiLibrary = (o, r) => {
7313
7337
  /* @__PURE__ */ jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
7314
7338
  /* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-gray-500", children: N("Groups") }),
7315
7339
  /* @__PURE__ */ jsx("hr", { className: "mt-1 border-border" }),
7316
- /* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(k) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: u ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: N("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
7340
+ /* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: u ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: N("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
7317
7341
  /* @__PURE__ */ jsx("p", { className: "text-sm", children: N("Failed to load the UI library. Try again") }),
7318
- /* @__PURE__ */ jsxs(Button, { onClick: y, variant: "outline", size: "sm", className: "gap-2", children: [
7342
+ /* @__PURE__ */ jsxs(Button, { onClick: k, variant: "outline", size: "sm", className: "gap-2", children: [
7319
7343
  /* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" }),
7320
7344
  N("Retry")
7321
7345
  ] })
7322
- ] }) }) : map(k, (S, j) => /* @__PURE__ */ jsxs(
7346
+ ] }) }) : map(y, (C, j) => /* @__PURE__ */ jsxs(
7323
7347
  "div",
7324
7348
  {
7325
7349
  onMouseEnter: () => w(j),
7326
- onMouseLeave: () => clearTimeout(_.current),
7350
+ onMouseLeave: () => clearTimeout(B.current),
7327
7351
  role: "button",
7328
7352
  onClick: () => A(j),
7329
7353
  className: cn$2(
@@ -7342,26 +7366,26 @@ const registerChaiLibrary = (o, r) => {
7342
7366
  /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-col border-l border-border", children: /* @__PURE__ */ jsxs(
7343
7367
  ScrollArea,
7344
7368
  {
7345
- onMouseEnter: () => _.current ? clearTimeout(_.current) : null,
7369
+ onMouseEnter: () => B.current ? clearTimeout(B.current) : null,
7346
7370
  className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
7347
7371
  children: [
7348
- isEmpty(B) && !isEmpty(k) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: N("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
7349
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: E.map((S, j) => /* @__PURE__ */ jsx(
7372
+ isEmpty(_) && !isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: N("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
7373
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: E.map((C, j) => /* @__PURE__ */ jsx(
7350
7374
  BlockCard,
7351
7375
  {
7352
7376
  parentId: o,
7353
7377
  position: r,
7354
- block: S,
7378
+ block: C,
7355
7379
  library: i
7356
7380
  },
7357
7381
  `block-${j}`
7358
7382
  )) }),
7359
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: v.map((S, j) => /* @__PURE__ */ jsx(
7383
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: v.map((C, j) => /* @__PURE__ */ jsx(
7360
7384
  BlockCard,
7361
7385
  {
7362
7386
  parentId: o,
7363
7387
  position: r,
7364
- block: S,
7388
+ block: C,
7365
7389
  library: i
7366
7390
  },
7367
7391
  `block-second-${j}`
@@ -7400,15 +7424,15 @@ const registerChaiLibrary = (o, r) => {
7400
7424
  error: c
7401
7425
  }), g(!0);
7402
7426
  else if (!l && Object.keys(a || {}).length > 0) {
7403
- const m = Object.entries(a).map(([x, k]) => {
7404
- const b = k, A = b.type || "partial", B = formatReadableName(A);
7427
+ const m = Object.entries(a).map(([x, y]) => {
7428
+ const b = y, A = b.type || "partial", _ = formatReadableName(A);
7405
7429
  return {
7406
7430
  type: "PartialBlock",
7407
7431
  // Set the type to PartialBlock
7408
7432
  label: formatReadableName(b.name || x),
7409
7433
  description: b.description || "",
7410
7434
  icon: Globe,
7411
- group: B,
7435
+ group: _,
7412
7436
  // Use formatted type as group
7413
7437
  category: "partial",
7414
7438
  partialBlockId: x,
@@ -7464,43 +7488,43 @@ const registerChaiLibrary = (o, r) => {
7464
7488
  has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...r });
7465
7489
  }, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: r, parentId: n, position: a, gridCols: l = "grid-cols-4" }) => {
7466
7490
  var v;
7467
- const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (v = find(c, (S) => S._id === n)) == null ? void 0 : v._type, [m, f] = useState("all"), [x, k] = useState(null), b = useRef(null);
7491
+ const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (v = find(c, (C) => C._id === n)) == null ? void 0 : v._type, [m, f] = useState("all"), [x, y] = useState(null), b = useRef(null);
7468
7492
  useEffect(() => {
7469
- const S = setTimeout(() => {
7493
+ const C = setTimeout(() => {
7470
7494
  var j;
7471
7495
  (j = u.current) == null || j.focus();
7472
7496
  }, 0);
7473
- return () => clearTimeout(S);
7497
+ return () => clearTimeout(C);
7474
7498
  }, [g]), useEffect(() => {
7475
- d && (f("all"), k(null));
7476
- }, [d]), useEffect(() => (b.current = debounce((S) => {
7477
- f(S);
7499
+ d && (f("all"), y(null));
7500
+ }, [d]), useEffect(() => (b.current = debounce((C) => {
7501
+ f(C);
7478
7502
  }, 500), () => {
7479
7503
  b.current && b.current.cancel();
7480
7504
  }), []);
7481
- const A = useCallback((S) => {
7482
- k(S), b.current && b.current(S);
7483
- }, []), B = useCallback(() => {
7484
- k(null), b.current && b.current.cancel();
7485
- }, []), _ = useCallback((S) => {
7486
- b.current && b.current.cancel(), f(S), k(null);
7505
+ const A = useCallback((C) => {
7506
+ y(C), b.current && b.current(C);
7507
+ }, []), _ = useCallback(() => {
7508
+ y(null), b.current && b.current.cancel();
7509
+ }, []), B = useCallback((C) => {
7510
+ b.current && b.current.cancel(), f(C), y(null);
7487
7511
  }, []), N = useMemo(
7488
7512
  () => d ? values(r).filter(
7489
- (S) => {
7490
- var j, T;
7491
- return (((j = S.label) == null ? void 0 : j.toLowerCase()) + " " + ((T = S.type) == null ? void 0 : T.toLowerCase())).includes(d.toLowerCase());
7513
+ (C) => {
7514
+ var j, I;
7515
+ return (((j = C.label) == null ? void 0 : j.toLowerCase()) + " " + ((I = C.type) == null ? void 0 : I.toLowerCase())).includes(d.toLowerCase());
7492
7516
  }
7493
7517
  ) : r,
7494
7518
  [r, d]
7495
7519
  ), w = useMemo(
7496
7520
  () => d ? o.filter(
7497
- (S) => reject(filter(values(N), { group: S }), { hidden: !0 }).length > 0
7498
- ) : o.filter((S) => reject(filter(values(r), { group: S }), { hidden: !0 }).length > 0),
7521
+ (C) => reject(filter(values(N), { group: C }), { hidden: !0 }).length > 0
7522
+ ) : o.filter((C) => reject(filter(values(r), { group: C }), { hidden: !0 }).length > 0),
7499
7523
  [r, N, o, d]
7500
- ), y = useMemo(
7501
- () => sortBy(w, (S) => CORE_GROUPS.indexOf(S) === -1 ? 99 : CORE_GROUPS.indexOf(S)),
7524
+ ), k = useMemo(
7525
+ () => sortBy(w, (C) => CORE_GROUPS.indexOf(C) === -1 ? 99 : CORE_GROUPS.indexOf(C)),
7502
7526
  [w]
7503
- ), C = useMemo(() => m === "all" ? N : filter(values(N), { group: m }), [N, m]), E = useMemo(() => m === "all" ? y : [m], [y, m]);
7527
+ ), S = useMemo(() => m === "all" ? N : filter(values(N), { group: m }), [N, m]), E = useMemo(() => m === "all" ? k : [m], [k, m]);
7504
7528
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
7505
7529
  /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
7506
7530
  Input$1,
@@ -7510,32 +7534,32 @@ const registerChaiLibrary = (o, r) => {
7510
7534
  placeholder: i("Search blocks..."),
7511
7535
  value: d,
7512
7536
  className: "-ml-2",
7513
- onChange: (S) => p(S.target.value)
7537
+ onChange: (C) => p(C.target.value)
7514
7538
  }
7515
7539
  ) }),
7516
7540
  /* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden", children: [
7517
- y.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
7541
+ k.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
7518
7542
  /* @__PURE__ */ jsx(
7519
7543
  "button",
7520
7544
  {
7521
- onClick: () => _("all"),
7545
+ onClick: () => B("all"),
7522
7546
  onMouseEnter: () => A("all"),
7523
- onMouseLeave: B,
7547
+ onMouseLeave: _,
7524
7548
  className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7525
7549
  children: i("All")
7526
7550
  },
7527
7551
  "sidebar-all"
7528
7552
  ),
7529
- y.map((S) => /* @__PURE__ */ jsx(
7553
+ k.map((C) => /* @__PURE__ */ jsx(
7530
7554
  "button",
7531
7555
  {
7532
- onClick: () => _(S),
7533
- onMouseEnter: () => A(S),
7534
- onMouseLeave: B,
7535
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === S || x === S ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7536
- children: capitalize(i(S.toLowerCase()))
7556
+ onClick: () => B(C),
7557
+ onMouseEnter: () => A(C),
7558
+ onMouseLeave: _,
7559
+ className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === C || x === C ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7560
+ children: capitalize(i(C.toLowerCase()))
7537
7561
  },
7538
- `sidebar-${S}`
7562
+ `sidebar-${C}`
7539
7563
  ))
7540
7564
  ] }) }) }),
7541
7565
  /* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: w.length === 0 && d ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
@@ -7543,10 +7567,10 @@ const registerChaiLibrary = (o, r) => {
7543
7567
  ' "',
7544
7568
  d,
7545
7569
  '"'
7546
- ] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: E.map((S) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
7547
- /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(S.toLowerCase())) }),
7570
+ ] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: E.map((C) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
7571
+ /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(C.toLowerCase())) }),
7548
7572
  /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
7549
- m === "all" ? filter(values(C), { group: S }) : values(C),
7573
+ m === "all" ? filter(values(S), { group: C }) : values(S),
7550
7574
  { hidden: !0 }
7551
7575
  ).map((j) => /* @__PURE__ */ jsx(
7552
7576
  CoreBlock,
@@ -7558,7 +7582,7 @@ const registerChaiLibrary = (o, r) => {
7558
7582
  },
7559
7583
  j.type
7560
7584
  )) })
7561
- ] }, S)) }) }) })
7585
+ ] }, C)) }) }) })
7562
7586
  ] })
7563
7587
  ] });
7564
7588
  }, addBlockTabAtom = atomWithStorage("__add_block_tab", "library"), AddBlocksPanel = ({
@@ -7911,35 +7935,35 @@ const Input = ({ node: o }) => {
7911
7935
  var R;
7912
7936
  const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
7913
7937
  let p = null;
7914
- const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: k, isDragging: b, isEditing: A, handleClick: B } = o, _ = (I) => {
7915
- I.stopPropagation(), !l.includes(m) && o.toggle();
7916
- }, N = (I) => {
7917
- I.isInternal && (p = I.isOpen, I.isOpen && I.close());
7918
- }, w = (I) => {
7919
- I.isInternal && p !== null && (p ? I.open() : I.close(), p = null);
7920
- }, [y, C] = useAtom$1(currentAddSelection), E = () => {
7921
- var I;
7922
- v(), o.parent.isSelected || C((I = o == null ? void 0 : o.parent) == null ? void 0 : I.id);
7938
+ const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: A, handleClick: _ } = o, B = (T) => {
7939
+ T.stopPropagation(), !l.includes(m) && o.toggle();
7940
+ }, N = (T) => {
7941
+ T.isInternal && (p = T.isOpen, T.isOpen && T.close());
7942
+ }, w = (T) => {
7943
+ T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
7944
+ }, [k, S] = useAtom$1(currentAddSelection), E = () => {
7945
+ var T;
7946
+ v(), o.parent.isSelected || S((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
7923
7947
  }, v = () => {
7924
- C(null);
7925
- }, S = (I) => {
7926
- v(), I.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), B(I);
7948
+ S(null);
7949
+ }, C = (T) => {
7950
+ v(), T.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), _(T);
7927
7951
  };
7928
7952
  useEffect(() => {
7929
- const I = setTimeout(() => {
7930
- k && !o.isOpen && !b && !l.includes(m) && o.toggle();
7953
+ const T = setTimeout(() => {
7954
+ y && !o.isOpen && !b && !l.includes(m) && o.toggle();
7931
7955
  }, 500);
7932
- return () => clearTimeout(I);
7933
- }, [k, o, b]);
7934
- const j = (I, D) => {
7935
- const O = c.contentDocument || c.contentWindow.document, P = O.querySelector(`[data-block-id=${I}]`);
7956
+ return () => clearTimeout(T);
7957
+ }, [y, o, b]);
7958
+ const j = (T, D) => {
7959
+ const O = c.contentDocument || c.contentWindow.document, P = O.querySelector(`[data-block-id=${T}]`);
7936
7960
  P && P.setAttribute("data-drop", D);
7937
7961
  const $ = P.getBoundingClientRect(), M = c.getBoundingClientRect();
7938
7962
  $.top >= M.top && $.left >= M.left && $.bottom <= M.bottom && $.right <= M.right || (O.documentElement.scrollTop = P.offsetTop - M.top);
7939
- }, T = (I) => {
7963
+ }, I = (T) => {
7940
7964
  v();
7941
7965
  const D = get(o, "parent.id");
7942
- D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: I }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: I });
7966
+ D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: T }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: T });
7943
7967
  };
7944
7968
  if (m === ROOT_TEMP_KEY)
7945
7969
  return /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer", children: [
@@ -7948,7 +7972,7 @@ const Input = ({ node: o }) => {
7948
7972
  "div",
7949
7973
  {
7950
7974
  role: "button",
7951
- onClick: () => T(-1),
7975
+ onClick: () => I(-1),
7952
7976
  className: "h-1 rounded bg-primary opacity-0 duration-200 group-hover:opacity-100",
7953
7977
  children: /* @__PURE__ */ jsxs("div", { className: "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform items-center gap-x-1 rounded-full bg-primary px-3 py-1 text-[9px] leading-tight text-white hover:bg-primary", children: [
7954
7978
  /* @__PURE__ */ jsx(PlusIcon, { className: "h-2 w-2 stroke-[3]" }),
@@ -7965,27 +7989,27 @@ const Input = ({ node: o }) => {
7965
7989
  {
7966
7990
  onMouseEnter: () => g(m),
7967
7991
  onMouseLeave: () => h(),
7968
- onClick: S,
7992
+ onClick: C,
7969
7993
  style: r,
7970
7994
  "data-node-id": m,
7971
7995
  ref: l.includes(m) ? null : n,
7972
7996
  onDragStart: () => N(o),
7973
7997
  onDragEnd: () => w(o),
7974
- onDragOver: (I) => {
7975
- I.preventDefault(), j(m, "yes");
7998
+ onDragOver: (T) => {
7999
+ T.preventDefault(), j(m, "yes");
7976
8000
  },
7977
- onDragLeave: (I) => {
7978
- I.preventDefault(), j(m, "no");
8001
+ onDragLeave: (T) => {
8002
+ T.preventDefault(), j(m, "no");
7979
8003
  },
7980
- onDrop: (I) => {
7981
- I.preventDefault(), j(m, "no");
8004
+ onDrop: (T) => {
8005
+ T.preventDefault(), j(m, "no");
7982
8006
  },
7983
8007
  children: [
7984
8008
  d(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((R = o == null ? void 0 : o.parent) == null ? void 0 : R.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
7985
8009
  "div",
7986
8010
  {
7987
- onClick: (I) => {
7988
- I.stopPropagation(), T(o.childIndex);
8011
+ onClick: (T) => {
8012
+ T.stopPropagation(), I(o.childIndex);
7989
8013
  },
7990
8014
  onMouseEnter: E,
7991
8015
  onMouseLeave: v,
@@ -7999,8 +8023,8 @@ const Input = ({ node: o }) => {
7999
8023
  className: cn(
8000
8024
  "group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 outline-none",
8001
8025
  x ? "bg-primary text-primary-foreground" : "hover:bg-primary/10 dark:hover:bg-gray-800",
8002
- k && canAcceptChildBlock(f._type, "Icon") ? "bg-green-200" : "",
8003
- (o == null ? void 0 : o.id) === y ? "bg-primary/10" : "",
8026
+ y && canAcceptChildBlock(f._type, "Icon") ? "bg-green-200" : "",
8027
+ (o == null ? void 0 : o.id) === k ? "bg-primary/10" : "",
8004
8028
  b && "opacity-20",
8005
8029
  l.includes(m) ? "opacity-50" : "",
8006
8030
  L && x && "bg-primary/20 text-primary"
@@ -8011,7 +8035,7 @@ const Input = ({ node: o }) => {
8011
8035
  "div",
8012
8036
  {
8013
8037
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
8014
- children: u && /* @__PURE__ */ jsx("button", { onClick: _, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-white" : "text-slate-400"}` }) })
8038
+ children: u && /* @__PURE__ */ jsx("button", { onClick: B, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-white" : "text-slate-400"}` }) })
8015
8039
  }
8016
8040
  ),
8017
8041
  /* @__PURE__ */ jsxs(
@@ -8028,8 +8052,8 @@ const Input = ({ node: o }) => {
8028
8052
  "div",
8029
8053
  {
8030
8054
  className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
8031
- onDoubleClick: (I) => {
8032
- I.stopPropagation(), o.edit(), o.deselect();
8055
+ onDoubleClick: (T) => {
8056
+ T.stopPropagation(), o.edit(), o.deselect();
8033
8057
  },
8034
8058
  children: /* @__PURE__ */ jsx("span", { children: getBlockDisplayName(f) })
8035
8059
  }
@@ -8055,8 +8079,8 @@ const Input = ({ node: o }) => {
8055
8079
  /* @__PURE__ */ jsx(
8056
8080
  TooltipTrigger,
8057
8081
  {
8058
- onClick: (I) => {
8059
- I.stopPropagation(), i(m), o.isOpen && o.toggle();
8082
+ onClick: (T) => {
8083
+ T.stopPropagation(), i(m), o.isOpen && o.toggle();
8060
8084
  },
8061
8085
  className: "cursor-pointer rounded bg-transparent",
8062
8086
  asChild: !0,
@@ -8346,15 +8370,15 @@ const Input = ({ node: o }) => {
8346
8370
  }, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
8347
8371
  const [r, n] = useDarkMode(), [a, l] = React.useState(""), [i, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions(), [g, h] = useTheme(), m = useThemeOptions(), { t: f } = useTranslation(), x = React.useCallback(
8348
8372
  (w) => {
8349
- const y = { ...g };
8350
- setPreviousTheme(y), h(w), toast.success("Theme updated", {
8373
+ const k = { ...g };
8374
+ setPreviousTheme(k), h(w), toast.success("Theme updated", {
8351
8375
  action: {
8352
8376
  label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
8353
8377
  /* @__PURE__ */ jsx(Undo$1, { className: "h-4 w-4" }),
8354
8378
  " Undo"
8355
8379
  ] }),
8356
8380
  onClick: () => {
8357
- h(y), clearPreviousTheme(), toast.dismiss();
8381
+ h(k), clearPreviousTheme(), toast.dismiss();
8358
8382
  }
8359
8383
  },
8360
8384
  closeButton: !0,
@@ -8362,28 +8386,28 @@ const Input = ({ node: o }) => {
8362
8386
  });
8363
8387
  },
8364
8388
  [g, h]
8365
- ), k = () => {
8366
- const w = d.find((y) => Object.keys(y)[0] === a);
8389
+ ), y = () => {
8390
+ const w = d.find((k) => Object.keys(k)[0] === a);
8367
8391
  if (w) {
8368
- const y = Object.values(w)[0];
8369
- y && typeof y == "object" && "fontFamily" in y && "borderRadius" in y && "colors" in y ? (x(y), l("")) : console.error("Invalid preset structure:", y);
8392
+ const k = Object.values(w)[0];
8393
+ k && typeof k == "object" && "fontFamily" in k && "borderRadius" in k && "colors" in k ? (x(k), l("")) : console.error("Invalid preset structure:", k);
8370
8394
  } else
8371
8395
  console.error("Preset not found:", a);
8372
8396
  }, b = (w) => {
8373
8397
  x(w), l("");
8374
8398
  }, A = useDebouncedCallback(
8375
- (w, y) => {
8399
+ (w, k) => {
8376
8400
  h(() => ({
8377
8401
  ...g,
8378
8402
  fontFamily: {
8379
8403
  ...g.fontFamily,
8380
- [w.replace(/font-/g, "")]: y
8404
+ [w.replace(/font-/g, "")]: k
8381
8405
  }
8382
8406
  }));
8383
8407
  },
8384
8408
  [g],
8385
8409
  200
8386
- ), B = React.useCallback(
8410
+ ), _ = React.useCallback(
8387
8411
  (w) => {
8388
8412
  h(() => ({
8389
8413
  ...g,
@@ -8391,33 +8415,33 @@ const Input = ({ node: o }) => {
8391
8415
  }));
8392
8416
  },
8393
8417
  [g]
8394
- ), _ = useDebouncedCallback(
8395
- (w, y) => {
8418
+ ), B = useDebouncedCallback(
8419
+ (w, k) => {
8396
8420
  h(() => {
8397
- const C = get(g, `colors.${w}`);
8398
- return r ? set(C, 1, y) : set(C, 0, y), {
8421
+ const S = get(g, `colors.${w}`);
8422
+ return r ? set(S, 1, k) : set(S, 0, k), {
8399
8423
  ...g,
8400
8424
  colors: {
8401
8425
  ...g.colors,
8402
- [w]: C
8426
+ [w]: S
8403
8427
  }
8404
8428
  };
8405
8429
  });
8406
8430
  },
8407
8431
  [g],
8408
8432
  200
8409
- ), N = (w) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(w.items).map(([y]) => {
8410
- const C = get(g, `colors.${y}.${r ? 1 : 0}`);
8411
- return C ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
8433
+ ), N = (w) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(w.items).map(([k]) => {
8434
+ const S = get(g, `colors.${k}.${r ? 1 : 0}`);
8435
+ return S ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
8412
8436
  /* @__PURE__ */ jsx(
8413
8437
  ColorPickerInput,
8414
8438
  {
8415
- value: C,
8416
- onChange: (E) => _(y, E)
8439
+ value: S,
8440
+ onChange: (E) => B(k, E)
8417
8441
  }
8418
8442
  ),
8419
- /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: y.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" ") + (!y.toLowerCase().includes("foreground") && !y.toLowerCase().includes("border") && !y.toLowerCase().includes("input") && !y.toLowerCase().includes("ring") && !y.toLowerCase().includes("background") ? " Background" : "") })
8420
- ] }, y) : null;
8443
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: k.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" ") + (!k.toLowerCase().includes("foreground") && !k.toLowerCase().includes("border") && !k.toLowerCase().includes("input") && !k.toLowerCase().includes("ring") && !k.toLowerCase().includes("background") ? " Background" : "") })
8444
+ ] }, k) : null;
8421
8445
  }) });
8422
8446
  return u("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
8423
8447
  /* @__PURE__ */ jsxs("div", { className: cn$2("no-scrollbar h-full w-full overflow-y-auto", o), children: [
@@ -8433,11 +8457,11 @@ const Input = ({ node: o }) => {
8433
8457
  /* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
8434
8458
  /* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
8435
8459
  /* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((w) => {
8436
- const y = Object.keys(w)[0], C = y.replaceAll("_", " ");
8437
- return /* @__PURE__ */ jsx(SelectItem, { value: y, children: capitalize(C) }, y);
8460
+ const k = Object.keys(w)[0], S = k.replaceAll("_", " ");
8461
+ return /* @__PURE__ */ jsx(SelectItem, { value: k, children: capitalize(S) }, k);
8438
8462
  }) })
8439
8463
  ] }) }),
8440
- /* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: k, children: f("Apply") }) })
8464
+ /* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: y, children: f("Apply") }) })
8441
8465
  ] })
8442
8466
  ] }),
8443
8467
  /* @__PURE__ */ jsx(Separator, {}),
@@ -8446,12 +8470,12 @@ const Input = ({ node: o }) => {
8446
8470
  /* @__PURE__ */ jsx(Type, { className: "h-3 w-3 text-gray-600" }),
8447
8471
  /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
8448
8472
  ] }),
8449
- (m == null ? void 0 : m.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(m.fontFamily).map(([w, y]) => /* @__PURE__ */ jsx(
8473
+ (m == null ? void 0 : m.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(m.fontFamily).map(([w, k]) => /* @__PURE__ */ jsx(
8450
8474
  FontSelector,
8451
8475
  {
8452
8476
  label: w,
8453
- value: g.fontFamily[w.replace(/font-/g, "")] || y[Object.keys(y)[0]],
8454
- onChange: (C) => A(w, C)
8477
+ value: g.fontFamily[w.replace(/font-/g, "")] || k[Object.keys(k)[0]],
8478
+ onChange: (S) => A(w, S)
8455
8479
  },
8456
8480
  w
8457
8481
  )) }),
@@ -8464,7 +8488,7 @@ const Input = ({ node: o }) => {
8464
8488
  ] }),
8465
8489
  /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: g.borderRadius })
8466
8490
  ] }),
8467
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange: B }) })
8491
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange: _ }) })
8468
8492
  ] }),
8469
8493
  /* @__PURE__ */ jsx(Separator, {}),
8470
8494
  (m == null ? void 0 : m.colors) && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
@@ -8993,8 +9017,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8993
9017
  (x = h.current) == null || x.focus();
8994
9018
  }, []);
8995
9019
  const f = (x) => {
8996
- const { usage: k } = x || {};
8997
- !l && k && g(k), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
9020
+ const { usage: y } = x || {};
9021
+ !l && y && g(y), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
8998
9022
  };
8999
9023
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
9000
9024
  /* @__PURE__ */ jsxs(
@@ -9223,24 +9247,24 @@ function AIChatPanel() {
9223
9247
  content: "This is a sample response from the AI assistant. In a real implementation, this would be replaced with an actual response from the AI model.",
9224
9248
  timestamp: /* @__PURE__ */ new Date()
9225
9249
  };
9226
- r((B) => [...B, A]), i(!1), d(null);
9250
+ r((_) => [..._, A]), i(!1), d(null);
9227
9251
  }, 1500);
9228
9252
  }, m = (b) => {
9229
9253
  b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
9230
9254
  }, f = (b) => {
9231
- var B;
9232
- const A = (B = b.target.files) == null ? void 0 : B[0];
9255
+ var _;
9256
+ const A = (_ = b.target.files) == null ? void 0 : _[0];
9233
9257
  if (A) {
9234
- const _ = new FileReader();
9235
- _.onload = (N) => {
9258
+ const B = new FileReader();
9259
+ B.onload = (N) => {
9236
9260
  var w;
9237
9261
  d((w = N.target) == null ? void 0 : w.result);
9238
- }, _.readAsDataURL(A);
9262
+ }, B.readAsDataURL(A);
9239
9263
  }
9240
9264
  }, x = () => {
9241
9265
  var b;
9242
9266
  (b = p.current) == null || b.click();
9243
- }, k = () => {
9267
+ }, y = () => {
9244
9268
  d(null), p.current && (p.current.value = "");
9245
9269
  };
9246
9270
  return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col rounded-lg bg-background shadow-sm", children: [
@@ -9286,7 +9310,7 @@ function AIChatPanel() {
9286
9310
  size: "icon",
9287
9311
  variant: "destructive",
9288
9312
  className: "absolute right-0 top-0 h-5 w-5 rounded-full p-0",
9289
- onClick: k,
9313
+ onClick: y,
9290
9314
  children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
9291
9315
  }
9292
9316
  )
@@ -9429,7 +9453,7 @@ const AiAssistant = () => {
9429
9453
  preloadedAttributes: r = [],
9430
9454
  onAttributesChange: n
9431
9455
  }) {
9432
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""), f = useRef(null), x = useRef(null), k = usePageExternalData();
9456
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""), f = useRef(null), x = useRef(null), y = usePageExternalData();
9433
9457
  useEffect(() => {
9434
9458
  l(r);
9435
9459
  }, [r]);
@@ -9439,43 +9463,43 @@ const AiAssistant = () => {
9439
9463
  return;
9440
9464
  }
9441
9465
  if (i) {
9442
- const y = [...a, { key: i, value: d }];
9443
- n(y), l(a), c(""), p(""), m("");
9466
+ const k = [...a, { key: i, value: d }];
9467
+ n(k), l(a), c(""), p(""), m("");
9444
9468
  }
9445
- }, A = (y) => {
9446
- const C = a.filter((E, v) => v !== y);
9447
- n(C), l(C);
9448
- }, B = (y) => {
9449
- g(y), c(a[y].key), p(a[y].value);
9450
- }, _ = () => {
9469
+ }, A = (k) => {
9470
+ const S = a.filter((E, v) => v !== k);
9471
+ n(S), l(S);
9472
+ }, _ = (k) => {
9473
+ g(k), c(a[k].key), p(a[k].value);
9474
+ }, B = () => {
9451
9475
  if (i.startsWith("@")) {
9452
9476
  m("Attribute keys cannot start with '@'");
9453
9477
  return;
9454
9478
  }
9455
9479
  if (u !== null && i) {
9456
- const y = [...a];
9457
- y[u] = { key: i, value: d }, n(y), l(y), g(null), c(""), p(""), m("");
9480
+ const k = [...a];
9481
+ k[u] = { key: i, value: d }, n(k), l(k), g(null), c(""), p(""), m("");
9458
9482
  }
9459
- }, N = (y) => {
9460
- y.key === "Enter" && !y.shiftKey && (y.preventDefault(), u !== null ? _() : b());
9461
- }, w = useCallback((y) => {
9462
- const C = (S) => /[.,!?;:]/.test(S), E = (S, j, T) => {
9483
+ }, N = (k) => {
9484
+ k.key === "Enter" && !k.shiftKey && (k.preventDefault(), u !== null ? B() : b());
9485
+ }, w = useCallback((k) => {
9486
+ const S = (C) => /[.,!?;:]/.test(C), E = (C, j, I) => {
9463
9487
  let L = "", R = "";
9464
- const I = j > 0 ? S[j - 1] : "", D = j < S.length ? S[j] : "";
9465
- return j > 0 && (I === "." || !C(I) && I !== " ") && (L = " "), j < S.length && !C(D) && D !== " " && (R = " "), {
9466
- text: L + T + R,
9488
+ const T = j > 0 ? C[j - 1] : "", D = j < C.length ? C[j] : "";
9489
+ return j > 0 && (T === "." || !S(T) && T !== " ") && (L = " "), j < C.length && !S(D) && D !== " " && (R = " "), {
9490
+ text: L + I + R,
9467
9491
  prefixLength: L.length,
9468
9492
  suffixLength: R.length
9469
9493
  };
9470
9494
  }, v = x.current;
9471
9495
  if (v) {
9472
- const S = v.selectionStart || 0, j = v.value || "", T = v.selectionEnd || S;
9473
- if (T > S) {
9474
- const O = `{{${y}}}`, { text: P } = E(j, S, O), $ = j.slice(0, S) + P + j.slice(T);
9496
+ const C = v.selectionStart || 0, j = v.value || "", I = v.selectionEnd || C;
9497
+ if (I > C) {
9498
+ const O = `{{${k}}}`, { text: P } = E(j, C, O), $ = j.slice(0, C) + P + j.slice(I);
9475
9499
  p($);
9476
9500
  return;
9477
9501
  }
9478
- const R = `{{${y}}}`, { text: I } = E(j, S, R), D = j.slice(0, S) + I + j.slice(S);
9502
+ const R = `{{${k}}}`, { text: T } = E(j, C, R), D = j.slice(0, C) + T + j.slice(C);
9479
9503
  p(D);
9480
9504
  }
9481
9505
  }, []);
@@ -9483,8 +9507,8 @@ const AiAssistant = () => {
9483
9507
  /* @__PURE__ */ jsxs(
9484
9508
  "form",
9485
9509
  {
9486
- onSubmit: (y) => {
9487
- y.preventDefault(), u !== null ? _() : b();
9510
+ onSubmit: (k) => {
9511
+ k.preventDefault(), u !== null ? B() : b();
9488
9512
  },
9489
9513
  className: "space-y-3",
9490
9514
  children: [
@@ -9500,7 +9524,7 @@ const AiAssistant = () => {
9500
9524
  id: "attrKey",
9501
9525
  ref: f,
9502
9526
  value: i,
9503
- onChange: (y) => c(y.target.value),
9527
+ onChange: (k) => c(k.target.value),
9504
9528
  placeholder: "Enter Key",
9505
9529
  className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
9506
9530
  }
@@ -9509,7 +9533,7 @@ const AiAssistant = () => {
9509
9533
  /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
9510
9534
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
9511
9535
  /* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
9512
- !isEmpty(k) && /* @__PURE__ */ jsx(NestedPathSelector, { data: k, onSelect: w })
9536
+ !isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect: w })
9513
9537
  ] }),
9514
9538
  /* @__PURE__ */ jsx(
9515
9539
  Textarea,
@@ -9521,7 +9545,7 @@ const AiAssistant = () => {
9521
9545
  rows: 2,
9522
9546
  ref: x,
9523
9547
  value: d,
9524
- onChange: (y) => p(y.target.value),
9548
+ onChange: (k) => p(k.target.value),
9525
9549
  onKeyDown: N,
9526
9550
  placeholder: "Enter Value",
9527
9551
  className: "text-xs font-normal leading-tight placeholder:text-slate-400"
@@ -9534,16 +9558,16 @@ const AiAssistant = () => {
9534
9558
  ]
9535
9559
  }
9536
9560
  ),
9537
- /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((y, C) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
9561
+ /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((k, S) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
9538
9562
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
9539
- /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: y.key }),
9540
- /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: y.value.toString() })
9563
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: k.key }),
9564
+ /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: k.value.toString() })
9541
9565
  ] }),
9542
9566
  /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
9543
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(C), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
9544
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(C), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
9567
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => _(S), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
9568
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(S), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
9545
9569
  ] })
9546
- ] }, C)) })
9570
+ ] }, S)) })
9547
9571
  ] });
9548
9572
  }), BlockAttributesEditor = React.memo(() => {
9549
9573
  const o = useSelectedBlock(), [r, n] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -9705,28 +9729,28 @@ const RootLayout = () => {
9705
9729
  usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
9706
9730
  n("outline");
9707
9731
  });
9708
- const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), h = useCallback((y) => {
9709
- y.preventDefault();
9732
+ const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), h = useCallback((k) => {
9733
+ k.preventDefault();
9710
9734
  }, []), m = useCallback(
9711
- (y) => {
9712
- n(r === y ? null : y);
9735
+ (k) => {
9736
+ n(r === k ? null : k);
9713
9737
  },
9714
9738
  [r]
9715
9739
  ), { t: f } = useTranslation(), x = useMemo(
9716
9740
  () => [...p, ...u, ...g],
9717
9741
  [p, u, g]
9718
- ), k = useBuilderProp("htmlDir", "ltr"), b = find(x, { id: r }) ?? first(x), A = get(b, "width", DEFAULT_PANEL_WIDTH);
9742
+ ), y = useBuilderProp("htmlDir", "ltr"), b = find(x, { id: r }) ?? first(x), A = get(b, "width", DEFAULT_PANEL_WIDTH);
9719
9743
  useEffect(() => {
9720
9744
  if (r !== null) {
9721
- const y = find(x, { id: r });
9722
- y && get(y, "view", "standard") === "standard" && (a.current = r, i(get(y, "width", DEFAULT_PANEL_WIDTH)));
9745
+ const k = find(x, { id: r });
9746
+ k && get(k, "view", "standard") === "standard" && (a.current = r, i(get(k, "width", DEFAULT_PANEL_WIDTH)));
9723
9747
  }
9724
9748
  }, [r, x]);
9725
- const B = useMemo(() => {
9749
+ const _ = useMemo(() => {
9726
9750
  if (r === null) return 0;
9727
- const y = find(x, { id: r });
9728
- return get(y, "view", "standard") === "standard" ? A : l;
9729
- }, [r, A, l, x]), _ = useCallback(() => {
9751
+ const k = find(x, { id: r });
9752
+ return get(k, "view", "standard") === "standard" ? A : l;
9753
+ }, [r, A, l, x]), B = useCallback(() => {
9730
9754
  n(a.current);
9731
9755
  }, [n]), N = useCallback(() => {
9732
9756
  n("outline");
@@ -9735,12 +9759,12 @@ const RootLayout = () => {
9735
9759
  find(x, { id: r }) || n("outline");
9736
9760
  }, [r, x]);
9737
9761
  const w = useCallback(
9738
- (y) => {
9739
- m(y);
9762
+ (k) => {
9763
+ m(k);
9740
9764
  },
9741
9765
  [m]
9742
9766
  );
9743
- return /* @__PURE__ */ jsx("div", { dir: k, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
9767
+ return /* @__PURE__ */ jsx("div", { dir: y, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
9744
9768
  /* @__PURE__ */ jsxs(
9745
9769
  "div",
9746
9770
  {
@@ -9750,33 +9774,33 @@ const RootLayout = () => {
9750
9774
  /* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
9751
9775
  /* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
9752
9776
  /* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
9753
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((y, C) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9754
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(y, "button", NoopComponent), {
9777
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: [p, u].flat().map((k, S) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9778
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(k, "button", NoopComponent), {
9755
9779
  position: "top",
9756
- panelId: y.id,
9757
- isActive: r === y.id,
9758
- show: () => w(y.id)
9780
+ panelId: k.id,
9781
+ isActive: r === k.id,
9782
+ show: () => w(k.id)
9759
9783
  }) }),
9760
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(y.label) }) })
9761
- ] }, "button-top-" + C)) }),
9784
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(k.label) }) })
9785
+ ] }, "button-top-" + S)) }),
9762
9786
  /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
9763
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((y, C) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9764
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(y, "button", NoopComponent), {
9787
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((k, S) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9788
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(k, "button", NoopComponent), {
9765
9789
  position: "bottom",
9766
- panelId: y.id,
9767
- isActive: r === y.id,
9768
- show: () => w(y.id)
9790
+ panelId: k.id,
9791
+ isActive: r === k.id,
9792
+ show: () => w(k.id)
9769
9793
  }) }),
9770
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(y.label) }) })
9771
- ] }, "button-bottom-" + C)) })
9794
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(k.label) }) })
9795
+ ] }, "button-bottom-" + S)) })
9772
9796
  ] }),
9773
9797
  /* @__PURE__ */ jsx(
9774
9798
  motion.div,
9775
9799
  {
9776
9800
  id: "left-panel",
9777
9801
  className: "h-full max-h-full border-r border-border",
9778
- initial: { width: B },
9779
- animate: { width: B },
9802
+ initial: { width: _ },
9803
+ animate: { width: _ },
9780
9804
  transition: { duration: 0.3, ease: "easeInOut" },
9781
9805
  children: r !== null && get(b, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
9782
9806
  /* @__PURE__ */ jsx(
@@ -9832,7 +9856,7 @@ const RootLayout = () => {
9832
9856
  }
9833
9857
  ),
9834
9858
  /* @__PURE__ */ jsx(AddBlocksDialog, {}),
9835
- r !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(
9859
+ r !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => B(), children: /* @__PURE__ */ jsxs(
9836
9860
  SheetContent,
9837
9861
  {
9838
9862
  side: "left",
@@ -9850,7 +9874,7 @@ const RootLayout = () => {
9850
9874
  }
9851
9875
  ) }),
9852
9876
  " ",
9853
- r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${A}px` }, children: [
9877
+ r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => B(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${A}px` }, children: [
9854
9878
  /* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
9855
9879
  /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
9856
9880
  /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
@@ -9881,7 +9905,7 @@ const RootLayout = () => {
9881
9905
  /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
9882
9906
  /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9883
9907
  ] }),
9884
- /* @__PURE__ */ jsx(Button, { onClick: () => _(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
9908
+ /* @__PURE__ */ jsx(Button, { onClick: () => B(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
9885
9909
  ] }),
9886
9910
  /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
9887
9911
  close: N
@@ -9925,9 +9949,9 @@ const RootLayout = () => {
9925
9949
  if (!l.trim()) return a;
9926
9950
  const x = l.toLowerCase();
9927
9951
  return Object.fromEntries(
9928
- Object.entries(a).filter(([k, b]) => {
9952
+ Object.entries(a).filter(([y, b]) => {
9929
9953
  var A;
9930
- return (k == null ? void 0 : k.toLowerCase().includes(x)) || ((A = b == null ? void 0 : b.description) == null ? void 0 : A.toLowerCase().includes(x));
9954
+ return (y == null ? void 0 : y.toLowerCase().includes(x)) || ((A = b == null ? void 0 : b.description) == null ? void 0 : A.toLowerCase().includes(x));
9931
9955
  })
9932
9956
  );
9933
9957
  }, [a, l]), h = (x) => {
@@ -9937,8 +9961,8 @@ const RootLayout = () => {
9937
9961
  });
9938
9962
  }, m = (x) => {
9939
9963
  if (!c) return;
9940
- const k = x.clientX - p.x, b = x.clientY - p.y, A = x.currentTarget, B = A.offsetWidth, _ = A.offsetHeight, N = window.innerWidth - B, w = window.innerHeight - _, y = Math.max(0, Math.min(k, N)), C = Math.max(0, Math.min(b, w));
9941
- n(y, C);
9964
+ const y = x.clientX - p.x, b = x.clientY - p.y, A = x.currentTarget, _ = A.offsetWidth, B = A.offsetHeight, N = window.innerWidth - _, w = window.innerHeight - B, k = Math.max(0, Math.min(y, N)), S = Math.max(0, Math.min(b, w));
9965
+ n(k, S);
9942
9966
  }, f = () => {
9943
9967
  d(!1);
9944
9968
  };
@@ -10000,7 +10024,7 @@ const RootLayout = () => {
10000
10024
  )
10001
10025
  ] })
10002
10026
  ] }),
10003
- /* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto py-2", children: Object.keys(g).length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(g).map(([x, k]) => /* @__PURE__ */ jsx(FeatureToggle, { featureKey: x, options: k }, x)) }) : /* @__PURE__ */ jsx("div", { className: "py-8 text-center", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
10027
+ /* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto py-2", children: Object.keys(g).length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(g).map(([x, y]) => /* @__PURE__ */ jsx(FeatureToggle, { featureKey: x, options: y }, x)) }) : /* @__PURE__ */ jsx("div", { className: "py-8 text-center", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
10004
10028
  'No features found matching "',
10005
10029
  l,
10006
10030
  '"'
@@ -10118,72 +10142,72 @@ const RootLayout = () => {
10118
10142
  var x;
10119
10143
  return (x = m.onMount) == null ? void 0 : x.call(m, f);
10120
10144
  }, ...h) => {
10121
- const m = h[0] || ((C) => {
10122
- let E = o.get(C);
10123
- return E || (E = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(C, E), u == null || u(C, y)), E;
10145
+ const m = h[0] || ((S) => {
10146
+ let E = o.get(S);
10147
+ return E || (E = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(S, E), u == null || u(S, k)), E;
10124
10148
  }), f = h[1] || (() => {
10125
- let C, E;
10126
- const v = (S) => {
10149
+ let S, E;
10150
+ const v = (C) => {
10127
10151
  try {
10128
- S();
10152
+ C();
10129
10153
  } catch (j) {
10130
- C || (C = !0, E = j);
10154
+ S || (S = !0, E = j);
10131
10155
  }
10132
10156
  };
10133
10157
  do {
10134
10158
  c.f && v(c.f);
10135
- const S = /* @__PURE__ */ new Set(), j = S.add.bind(S);
10136
- a.forEach((T) => {
10159
+ const C = /* @__PURE__ */ new Set(), j = C.add.bind(C);
10160
+ a.forEach((I) => {
10137
10161
  var L;
10138
- return (L = r.get(T)) == null ? void 0 : L.l.forEach(j);
10139
- }), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), S.forEach(v), a.size && x();
10162
+ return (L = r.get(I)) == null ? void 0 : L.l.forEach(j);
10163
+ }), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), C.forEach(v), a.size && x();
10140
10164
  } while (a.size || i.size || l.size);
10141
- if (C)
10165
+ if (S)
10142
10166
  throw E;
10143
10167
  }), x = h[2] || (() => {
10144
- const C = [], E = /* @__PURE__ */ new WeakSet(), v = /* @__PURE__ */ new WeakSet(), S = Array.from(a);
10145
- for (; S.length; ) {
10146
- const j = S[S.length - 1], T = m(j);
10168
+ const S = [], E = /* @__PURE__ */ new WeakSet(), v = /* @__PURE__ */ new WeakSet(), C = Array.from(a);
10169
+ for (; C.length; ) {
10170
+ const j = C[C.length - 1], I = m(j);
10147
10171
  if (v.has(j)) {
10148
- S.pop();
10172
+ C.pop();
10149
10173
  continue;
10150
10174
  }
10151
10175
  if (E.has(j)) {
10152
- n.get(j) === T.n && C.push([j, T]), v.add(j), S.pop();
10176
+ n.get(j) === I.n && S.push([j, I]), v.add(j), C.pop();
10153
10177
  continue;
10154
10178
  }
10155
10179
  E.add(j);
10156
- for (const L of getMountedOrPendingDependents(j, T, r))
10157
- E.has(L) || S.push(L);
10180
+ for (const L of getMountedOrPendingDependents(j, I, r))
10181
+ E.has(L) || C.push(L);
10158
10182
  }
10159
- for (let j = C.length - 1; j >= 0; --j) {
10160
- const [T, L] = C[j];
10183
+ for (let j = S.length - 1; j >= 0; --j) {
10184
+ const [I, L] = S[j];
10161
10185
  let R = !1;
10162
- for (const I of L.d.keys())
10163
- if (I !== T && a.has(I)) {
10186
+ for (const T of L.d.keys())
10187
+ if (T !== I && a.has(T)) {
10164
10188
  R = !0;
10165
10189
  break;
10166
10190
  }
10167
- R && (k(T), B(T)), n.delete(T);
10191
+ R && (y(I), _(I)), n.delete(I);
10168
10192
  }
10169
- }), k = h[3] || ((C) => {
10193
+ }), y = h[3] || ((S) => {
10170
10194
  var E, v;
10171
- const S = m(C);
10172
- if (isAtomStateInitialized(S) && (r.has(C) && n.get(C) !== S.n || Array.from(S.d).every(
10195
+ const C = m(S);
10196
+ if (isAtomStateInitialized(C) && (r.has(S) && n.get(S) !== C.n || Array.from(C.d).every(
10173
10197
  ([P, $]) => (
10174
10198
  // Recursively, read the atom state of the dependency, and
10175
10199
  // check if the atom epoch number is unchanged
10176
- k(P).n === $
10200
+ y(P).n === $
10177
10201
  )
10178
10202
  )))
10179
- return S;
10180
- S.d.clear();
10203
+ return C;
10204
+ C.d.clear();
10181
10205
  let j = !0;
10182
- const T = () => {
10183
- r.has(C) && (B(C), x(), f());
10206
+ const I = () => {
10207
+ r.has(S) && (_(S), x(), f());
10184
10208
  }, L = (P) => {
10185
10209
  var $;
10186
- if (isSelfAtom(C, P)) {
10210
+ if (isSelfAtom(S, P)) {
10187
10211
  const H = m(P);
10188
10212
  if (!isAtomStateInitialized(H))
10189
10213
  if (hasInitialValue(P))
@@ -10192,144 +10216,144 @@ const RootLayout = () => {
10192
10216
  throw new Error("no atom init");
10193
10217
  return returnAtomValue(H);
10194
10218
  }
10195
- const M = k(P);
10219
+ const M = y(P);
10196
10220
  try {
10197
10221
  return returnAtomValue(M);
10198
10222
  } finally {
10199
- S.d.set(P, M.n), isPendingPromise(S.v) && addPendingPromiseToDependency(C, S.v, M), ($ = r.get(P)) == null || $.t.add(C), j || T();
10223
+ C.d.set(P, M.n), isPendingPromise(C.v) && addPendingPromiseToDependency(S, C.v, M), ($ = r.get(P)) == null || $.t.add(S), j || I();
10200
10224
  }
10201
10225
  };
10202
- let R, I;
10226
+ let R, T;
10203
10227
  const D = {
10204
10228
  get signal() {
10205
10229
  return R || (R = new AbortController()), R.signal;
10206
10230
  },
10207
10231
  get setSelf() {
10208
- return !I && isActuallyWritableAtom(C) && (I = (...P) => {
10232
+ return !T && isActuallyWritableAtom(S) && (T = (...P) => {
10209
10233
  if (!j)
10210
10234
  try {
10211
- return A(C, ...P);
10235
+ return A(S, ...P);
10212
10236
  } finally {
10213
10237
  x(), f();
10214
10238
  }
10215
- }), I;
10239
+ }), T;
10216
10240
  }
10217
- }, O = S.n;
10241
+ }, O = C.n;
10218
10242
  try {
10219
- const P = d(C, L, D);
10220
- return setAtomStateValueOrPromise(C, P, m), isPromiseLike$1(P) && ((E = P.onCancel) == null || E.call(P, () => R == null ? void 0 : R.abort()), P.then(
10221
- T,
10222
- T
10223
- )), S;
10243
+ const P = d(S, L, D);
10244
+ return setAtomStateValueOrPromise(S, P, m), isPromiseLike$1(P) && ((E = P.onCancel) == null || E.call(P, () => R == null ? void 0 : R.abort()), P.then(
10245
+ I,
10246
+ I
10247
+ )), C;
10224
10248
  } catch (P) {
10225
- return delete S.v, S.e = P, ++S.n, S;
10249
+ return delete C.v, C.e = P, ++C.n, C;
10226
10250
  } finally {
10227
- j = !1, O !== S.n && n.get(C) === O && (n.set(C, S.n), a.add(C), (v = c.c) == null || v.call(c, C));
10251
+ j = !1, O !== C.n && n.get(S) === O && (n.set(S, C.n), a.add(S), (v = c.c) == null || v.call(c, S));
10228
10252
  }
10229
- }), b = h[4] || ((C) => {
10230
- const E = [C];
10253
+ }), b = h[4] || ((S) => {
10254
+ const E = [S];
10231
10255
  for (; E.length; ) {
10232
- const v = E.pop(), S = m(v);
10233
- for (const j of getMountedOrPendingDependents(v, S, r)) {
10234
- const T = m(j);
10235
- n.set(j, T.n), E.push(j);
10256
+ const v = E.pop(), C = m(v);
10257
+ for (const j of getMountedOrPendingDependents(v, C, r)) {
10258
+ const I = m(j);
10259
+ n.set(j, I.n), E.push(j);
10236
10260
  }
10237
10261
  }
10238
- }), A = h[5] || ((C, ...E) => {
10262
+ }), A = h[5] || ((S, ...E) => {
10239
10263
  let v = !0;
10240
- const S = (T) => returnAtomValue(k(T)), j = (T, ...L) => {
10264
+ const C = (I) => returnAtomValue(y(I)), j = (I, ...L) => {
10241
10265
  var R;
10242
- const I = m(T);
10266
+ const T = m(I);
10243
10267
  try {
10244
- if (isSelfAtom(C, T)) {
10245
- if (!hasInitialValue(T))
10268
+ if (isSelfAtom(S, I)) {
10269
+ if (!hasInitialValue(I))
10246
10270
  throw new Error("atom not writable");
10247
- const D = I.n, O = L[0];
10248
- setAtomStateValueOrPromise(T, O, m), B(T), D !== I.n && (a.add(T), (R = c.c) == null || R.call(c, T), b(T));
10271
+ const D = T.n, O = L[0];
10272
+ setAtomStateValueOrPromise(I, O, m), _(I), D !== T.n && (a.add(I), (R = c.c) == null || R.call(c, I), b(I));
10249
10273
  return;
10250
10274
  } else
10251
- return A(T, ...L);
10275
+ return A(I, ...L);
10252
10276
  } finally {
10253
10277
  v || (x(), f());
10254
10278
  }
10255
10279
  };
10256
10280
  try {
10257
- return p(C, S, j, ...E);
10281
+ return p(S, C, j, ...E);
10258
10282
  } finally {
10259
10283
  v = !1;
10260
10284
  }
10261
- }), B = h[6] || ((C) => {
10285
+ }), _ = h[6] || ((S) => {
10262
10286
  var E;
10263
- const v = m(C), S = r.get(C);
10264
- if (S && !isPendingPromise(v.v)) {
10265
- for (const [j, T] of v.d)
10266
- if (!S.d.has(j)) {
10287
+ const v = m(S), C = r.get(S);
10288
+ if (C && !isPendingPromise(v.v)) {
10289
+ for (const [j, I] of v.d)
10290
+ if (!C.d.has(j)) {
10267
10291
  const L = m(j);
10268
- _(j).t.add(C), S.d.add(j), T !== L.n && (a.add(j), (E = c.c) == null || E.call(c, j), b(j));
10292
+ B(j).t.add(S), C.d.add(j), I !== L.n && (a.add(j), (E = c.c) == null || E.call(c, j), b(j));
10269
10293
  }
10270
- for (const j of S.d || [])
10294
+ for (const j of C.d || [])
10271
10295
  if (!v.d.has(j)) {
10272
- S.d.delete(j);
10273
- const T = N(j);
10274
- T == null || T.t.delete(C);
10296
+ C.d.delete(j);
10297
+ const I = N(j);
10298
+ I == null || I.t.delete(S);
10275
10299
  }
10276
10300
  }
10277
- }), _ = h[7] || ((C) => {
10301
+ }), B = h[7] || ((S) => {
10278
10302
  var E;
10279
- const v = m(C);
10280
- let S = r.get(C);
10281
- if (!S) {
10282
- k(C);
10303
+ const v = m(S);
10304
+ let C = r.get(S);
10305
+ if (!C) {
10306
+ y(S);
10283
10307
  for (const j of v.d.keys())
10284
- _(j).t.add(C);
10285
- if (S = {
10308
+ B(j).t.add(S);
10309
+ if (C = {
10286
10310
  l: /* @__PURE__ */ new Set(),
10287
10311
  d: new Set(v.d.keys()),
10288
10312
  t: /* @__PURE__ */ new Set()
10289
- }, r.set(C, S), (E = c.m) == null || E.call(c, C), isActuallyWritableAtom(C)) {
10313
+ }, r.set(S, C), (E = c.m) == null || E.call(c, S), isActuallyWritableAtom(S)) {
10290
10314
  const j = () => {
10291
- let T = !0;
10315
+ let I = !0;
10292
10316
  const L = (...R) => {
10293
10317
  try {
10294
- return A(C, ...R);
10318
+ return A(S, ...R);
10295
10319
  } finally {
10296
- T || (x(), f());
10320
+ I || (x(), f());
10297
10321
  }
10298
10322
  };
10299
10323
  try {
10300
- const R = g(C, L);
10301
- R && (S.u = () => {
10302
- T = !0;
10324
+ const R = g(S, L);
10325
+ R && (C.u = () => {
10326
+ I = !0;
10303
10327
  try {
10304
10328
  R();
10305
10329
  } finally {
10306
- T = !1;
10330
+ I = !1;
10307
10331
  }
10308
10332
  });
10309
10333
  } finally {
10310
- T = !1;
10334
+ I = !1;
10311
10335
  }
10312
10336
  };
10313
10337
  l.add(j);
10314
10338
  }
10315
10339
  }
10316
- return S;
10317
- }), N = h[8] || ((C) => {
10340
+ return C;
10341
+ }), N = h[8] || ((S) => {
10318
10342
  var E;
10319
- const v = m(C);
10320
- let S = r.get(C);
10321
- if (S && !S.l.size && !Array.from(S.t).some((j) => {
10322
- var T;
10323
- return (T = r.get(j)) == null ? void 0 : T.d.has(C);
10343
+ const v = m(S);
10344
+ let C = r.get(S);
10345
+ if (C && !C.l.size && !Array.from(C.t).some((j) => {
10346
+ var I;
10347
+ return (I = r.get(j)) == null ? void 0 : I.d.has(S);
10324
10348
  })) {
10325
- S.u && i.add(S.u), S = void 0, r.delete(C), (E = c.u) == null || E.call(c, C);
10349
+ C.u && i.add(C.u), C = void 0, r.delete(S), (E = c.u) == null || E.call(c, S);
10326
10350
  for (const j of v.d.keys()) {
10327
- const T = N(j);
10328
- T == null || T.t.delete(C);
10351
+ const I = N(j);
10352
+ I == null || I.t.delete(S);
10329
10353
  }
10330
10354
  return;
10331
10355
  }
10332
- return S;
10356
+ return C;
10333
10357
  }), w = [
10334
10358
  // store state
10335
10359
  o,
@@ -10348,29 +10372,29 @@ const RootLayout = () => {
10348
10372
  m,
10349
10373
  f,
10350
10374
  x,
10351
- k,
10375
+ y,
10352
10376
  b,
10353
10377
  A,
10354
- B,
10355
10378
  _,
10379
+ B,
10356
10380
  N
10357
- ], y = {
10358
- get: (C) => returnAtomValue(k(C)),
10359
- set: (C, ...E) => {
10381
+ ], k = {
10382
+ get: (S) => returnAtomValue(y(S)),
10383
+ set: (S, ...E) => {
10360
10384
  try {
10361
- return A(C, ...E);
10385
+ return A(S, ...E);
10362
10386
  } finally {
10363
10387
  x(), f();
10364
10388
  }
10365
10389
  },
10366
- sub: (C, E) => {
10367
- const S = _(C).l;
10368
- return S.add(E), f(), () => {
10369
- S.delete(E), N(C), f();
10390
+ sub: (S, E) => {
10391
+ const C = B(S).l;
10392
+ return C.add(E), f(), () => {
10393
+ C.delete(E), N(S), f();
10370
10394
  };
10371
10395
  }
10372
10396
  };
10373
- return Object.defineProperty(y, BUILDING_BLOCKS, { value: w }), y;
10397
+ return Object.defineProperty(k, BUILDING_BLOCKS, { value: w }), k;
10374
10398
  }, INTERNAL_buildStoreRev1 = buildStore, createStore = () => INTERNAL_buildStoreRev1();
10375
10399
  let defaultStore;
10376
10400
  const getDefaultStore = () => (defaultStore || (defaultStore = createStore()), defaultStore), StoreContext = createContext(
@@ -10517,7 +10541,7 @@ export {
10517
10541
  getBlocksFromHTML as convertHTMLToChaiBlocks,
10518
10542
  generateUUID as generateBlockId,
10519
10543
  getBlocksFromHTML,
10520
- We as i18n,
10544
+ ze as i18n,
10521
10545
  cn$2 as mergeClasses,
10522
10546
  registerBlockSettingField,
10523
10547
  registerBlockSettingTemplate,