@chaibuilder/sdk 2.3.7 → 2.3.8

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
@@ -10,8 +10,8 @@ import React__default, { useMemo, useCallback, useEffect, useState, useRef, Comp
10
10
  import { atom, useAtom as useAtom$1, useAtomValue as useAtomValue$1, getDefaultStore as getDefaultStore$1, useSetAtom as useSetAtom$1, Provider } from "jotai";
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
- 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, 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, 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, aY as Switch, r as Avatar, aL as Separator, b6 as TooltipProvider, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./toggle-BKtuoy5e.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, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Moon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Paintbrush, Layers } from "lucide-react";
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, 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, aY as Switch, r as Avatar, aL as Separator, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./toggle-BKtuoy5e.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, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Moon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Paintbrush, 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";
@@ -343,16 +343,16 @@ function insertBlocksAtPosition(o, n, r, a) {
343
343
  _type: "Text",
344
344
  content: u.content
345
345
  };
346
- Object.keys(u).forEach((x) => {
347
- x.startsWith("content-") && (m[x] = u[x]);
348
- }), l.unshift(m), i = i.map((x) => {
349
- if (x._id === r) {
350
- const f = { ...x, content: "" };
351
- return Object.keys(f).forEach((y) => {
352
- y.startsWith("content-") && (f[y] = "");
353
- }), f;
346
+ Object.keys(u).forEach((f) => {
347
+ f.startsWith("content-") && (m[f] = u[f]);
348
+ }), l.unshift(m), i = i.map((f) => {
349
+ if (f._id === r) {
350
+ const x = { ...f, content: "" };
351
+ return Object.keys(x).forEach((y) => {
352
+ y.startsWith("content-") && (x[y] = "");
353
+ }), x;
354
354
  }
355
- return x;
355
+ return f;
356
356
  });
357
357
  }
358
358
  }
@@ -480,15 +480,15 @@ const broadcastChannel = new BroadcastChannel("chaibuilder"), useBroadcastChanne
480
480
  if (g.length === 2) {
481
481
  const h = g.find((m) => m._id !== d);
482
482
  if (h && h._type === "Text") {
483
- const m = r.find((x) => x._id === u);
484
- m && "content" in m && (r = r.map((x) => {
485
- if (x._id === u) {
486
- const f = { ...x, content: h.content };
483
+ const m = r.find((f) => f._id === u);
484
+ m && "content" in m && (r = r.map((f) => {
485
+ if (f._id === u) {
486
+ const x = { ...f, content: h.content };
487
487
  return Object.keys(h).forEach((y) => {
488
- y.startsWith("content-") && (f[y] = h[y]);
489
- }), f;
488
+ y.startsWith("content-") && (x[y] = h[y]);
489
+ }), x;
490
490
  }
491
- return x;
491
+ return f;
492
492
  }), a.push(h._id));
493
493
  }
494
494
  }
@@ -571,32 +571,32 @@ const useBlockRepeaterDataAtom = () => useAtom$1(blockRepeaterDataAtom), useAsyn
571
571
  status: "idle",
572
572
  props: {},
573
573
  error: void 0
574
- }), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (x) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), g = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), h = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
574
+ }), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (f) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), g = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), h = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
575
575
  return useEffect(() => {
576
576
  if (n === "mock") {
577
577
  if (isFunction(a)) {
578
- i((f) => ({ ...f, status: "loading", props: {} }));
579
- const x = a({ block: o });
580
- if (!isObject(x))
578
+ i((x) => ({ ...x, status: "loading", props: {} }));
579
+ const f = a({ block: o });
580
+ if (!isObject(f))
581
581
  throw new Error("mockDataProvider should return an object");
582
- i((f) => ({ ...f, status: "loaded", props: x }));
582
+ i((x) => ({ ...x, status: "loaded", props: f }));
583
583
  }
584
584
  return;
585
585
  }
586
- n === "live" && (!g && !h || (i((x) => ({ ...x, status: "loading", props: {} })), d({ block: o }).then((x = {}) => {
587
- g ? (p((f) => ({
588
- ...f,
586
+ n === "live" && (!g && !h || (i((f) => ({ ...f, status: "loading", props: {} })), d({ block: o }).then((f = {}) => {
587
+ g ? (p((x) => ({
588
+ ...x,
589
589
  [o._id]: {
590
590
  status: "loaded",
591
- props: get(x, "items", []),
591
+ props: get(f, "items", []),
592
592
  repeaterItems: o.repeaterItems
593
593
  }
594
- })), i((f) => ({ ...f, status: "loaded", props: { totalItems: get(x, "totalItems") } })), c([o._id], { totalItems: get(x, "totalItems") })) : i((f) => ({ ...f, status: "loaded", props: isObject(x) ? x : {} }));
595
- }).catch((x) => {
596
- g ? (p((f) => ({
597
- ...f,
598
- [o._id]: { status: "error", error: x, props: [] }
599
- })), i((f) => ({ ...f, status: "error", error: x, props: {} }))) : i((f) => ({ ...f, status: "error", error: x, props: {} }));
594
+ })), i((x) => ({ ...x, status: "loaded", props: { totalItems: get(f, "totalItems") } })), c([o._id], { totalItems: get(f, "totalItems") })) : i((x) => ({ ...x, status: "loaded", props: isObject(f) ? f : {} }));
595
+ }).catch((f) => {
596
+ g ? (p((x) => ({
597
+ ...x,
598
+ [o._id]: { status: "error", error: f, props: [] }
599
+ })), i((x) => ({ ...x, status: "error", error: f, props: {} }))) : i((x) => ({ ...x, status: "error", error: f, props: {} }));
600
600
  })));
601
601
  }, [o == null ? void 0 : o._id, u, g, h, a, n]), {
602
602
  $loading: get(l, "status") === "loading",
@@ -810,65 +810,65 @@ const undoRedoStateAtom = atom({
810
810
  updateBlocksProps: c
811
811
  } = useBlocksStoreManager();
812
812
  return {
813
- moveBlocks: (f, y, b) => {
814
- const v = map(f, (w) => {
813
+ moveBlocks: (x, y, b) => {
814
+ const v = map(x, (w) => {
815
815
  const E = n.find((N) => N._id === w)._parent || null, A = n.filter((N) => E ? N._parent === E : !N._parent).map((N) => N._id).indexOf(w);
816
816
  return { _id: w, oldParent: E, oldPosition: A };
817
- }), B = v.find(({ _id: w }) => w === f[0]);
818
- B && B.oldParent === y && B.oldPosition === b || (i(f, y, b), o({
817
+ }), B = v.find(({ _id: w }) => w === x[0]);
818
+ B && B.oldParent === y && B.oldPosition === b || (i(x, y, b), o({
819
819
  undo: () => each(v, ({ _id: w, oldParent: _, oldPosition: E }) => {
820
820
  i([w], _, E);
821
821
  }),
822
- redo: () => i(f, y, b)
822
+ redo: () => i(x, y, b)
823
823
  }));
824
824
  },
825
- addBlocks: (f, y, b) => {
826
- a(f, y, b), o({
827
- undo: () => l(map(f, "_id")),
828
- redo: () => a(f, y, b)
825
+ addBlocks: (x, y, b) => {
826
+ a(x, y, b), o({
827
+ undo: () => l(map(x, "_id")),
828
+ redo: () => a(x, y, b)
829
829
  });
830
830
  },
831
- removeBlocks: (f) => {
831
+ removeBlocks: (x) => {
832
832
  var B;
833
- const y = (B = first(f)) == null ? void 0 : B._parent, v = n.filter((w) => y ? w._parent === y : !w._parent).indexOf(first(f));
834
- l(map(f, "_id")), o({
835
- undo: () => a(f, y, v),
836
- redo: () => l(map(f, "_id"))
833
+ const y = (B = first(x)) == null ? void 0 : B._parent, v = n.filter((w) => y ? w._parent === y : !w._parent).indexOf(first(x));
834
+ l(map(x, "_id")), o({
835
+ undo: () => a(x, y, v),
836
+ redo: () => l(map(x, "_id"))
837
837
  });
838
838
  },
839
- updateBlocks: (f, y, b) => {
839
+ updateBlocks: (x, y, b) => {
840
840
  let v = [];
841
841
  if (b)
842
- v = map(f, (B) => ({ _id: B, ...b }));
842
+ v = map(x, (B) => ({ _id: B, ...b }));
843
843
  else {
844
844
  const B = keys(y);
845
- v = map(f, (w) => {
845
+ v = map(x, (w) => {
846
846
  const _ = n.find((S) => S._id === w), E = { _id: w };
847
847
  return each(B, (S) => E[S] = _[S]), E;
848
848
  });
849
849
  }
850
- c(map(f, (B) => ({ _id: B, ...y }))), o({
850
+ c(map(x, (B) => ({ _id: B, ...y }))), o({
851
851
  undo: () => c(v),
852
- redo: () => c(map(f, (B) => ({ _id: B, ...y })))
852
+ redo: () => c(map(x, (B) => ({ _id: B, ...y })))
853
853
  });
854
854
  },
855
- updateBlocksRuntime: (f, y) => {
856
- c(map(f, (b) => ({ _id: b, ...y })));
855
+ updateBlocksRuntime: (x, y) => {
856
+ c(map(x, (b) => ({ _id: b, ...y })));
857
857
  },
858
- setNewBlocks: (f) => {
859
- r(f), o({
858
+ setNewBlocks: (x) => {
859
+ r(x), o({
860
860
  undo: () => r(n),
861
- redo: () => r(f)
861
+ redo: () => r(x)
862
862
  });
863
863
  },
864
- updateMultipleBlocksProps: (f) => {
864
+ updateMultipleBlocksProps: (x) => {
865
865
  let y = [];
866
- y = map(f, (b) => {
866
+ y = map(x, (b) => {
867
867
  const v = keys(b), B = n.find((_) => _._id === b._id), w = {};
868
868
  return each(v, (_) => w[_] = B[_]), w;
869
- }), c(f), o({
869
+ }), c(x), o({
870
870
  undo: () => c(y),
871
- redo: () => c(f)
871
+ redo: () => c(x)
872
872
  });
873
873
  }
874
874
  };
@@ -876,12 +876,12 @@ const undoRedoStateAtom = atom({
876
876
  const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
877
877
  (i, c, d) => {
878
878
  var m;
879
- for (let x = 0; x < i.length; x++) {
880
- const { _id: f } = i[x];
881
- i[x]._id = generateUUID();
882
- const y = filter(i, { _parent: f });
879
+ for (let f = 0; f < i.length; f++) {
880
+ const { _id: x } = i[f];
881
+ i[f]._id = generateUUID();
882
+ const y = filter(i, { _parent: x });
883
883
  for (let b = 0; b < y.length; b++)
884
- y[b]._parent = i[x]._id;
884
+ y[b]._parent = i[f]._id;
885
885
  }
886
886
  const p = first(i);
887
887
  let u, g;
@@ -2343,25 +2343,25 @@ const getBlockWithChildren = (o, n) => {
2343
2343
  return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
2344
2344
  })
2345
2345
  ), addLangToPrompt = (o, n, r) => !n || r !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, n, n)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
2346
- const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, h = (m, x) => {
2347
- const f = cloneDeep(x.find((y) => y._id === m));
2348
- for (const y in f) {
2349
- const b = f[y];
2346
+ const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, h = (m, f) => {
2347
+ const x = cloneDeep(f.find((y) => y._id === m));
2348
+ for (const y in x) {
2349
+ const b = x[y];
2350
2350
  if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
2351
2351
  const { baseClasses: v, classes: B } = getSplitChaiClasses(b);
2352
- f[y] = compact(flattenDeep([v, B])).join(" ");
2352
+ x[y] = compact(flattenDeep([v, B])).join(" ");
2353
2353
  } else
2354
- y !== "_id" && delete f[y];
2354
+ y !== "_id" && delete x[y];
2355
2355
  }
2356
- return f;
2356
+ return x;
2357
2357
  };
2358
2358
  return {
2359
2359
  askAi: useCallback(
2360
- async (m, x, f, y) => {
2360
+ async (m, f, x, y) => {
2361
2361
  if (l) {
2362
2362
  n(!0), a(null);
2363
2363
  try {
2364
- const b = p === u ? "" : p, v = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(x, d)), p) : [h(x, d)], B = await l(m, addLangToPrompt(f, g, m), v, b), { blocks: w, error: _ } = B;
2364
+ const b = p === u ? "" : p, v = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [h(f, d)], B = await l(m, addLangToPrompt(x, g, m), v, b), { blocks: w, error: _ } = B;
2365
2365
  if (_) {
2366
2366
  a(_);
2367
2367
  return;
@@ -2473,12 +2473,12 @@ const getBlockWithChildren = (o, n) => {
2473
2473
  if (!p)
2474
2474
  return h;
2475
2475
  let m = [];
2476
- for (const x of h)
2477
- if (x._type === "PartialBlock" || x._type === "GlobalBlock") {
2478
- let f = l(x.partialBlockId);
2479
- x._parent && (f == null ? void 0 : f.length) > 0 && (f = f.map((y) => (isEmpty(y._parent) && set(y, "_parent", x._parent), y))), m = [...m, ...f];
2476
+ for (const f of h)
2477
+ if (f._type === "PartialBlock" || f._type === "GlobalBlock") {
2478
+ let x = l(f.partialBlockId);
2479
+ 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];
2480
2480
  } else
2481
- m.push(x);
2481
+ m.push(f);
2482
2482
  return m;
2483
2483
  })
2484
2484
  };
@@ -2661,13 +2661,13 @@ const getBlockWithChildren = (o, n) => {
2661
2661
  const d = o(c), p = a;
2662
2662
  let { classes: u, baseClasses: g } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
2663
2663
  return each(p, (h) => {
2664
- const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
2665
- u = u.replace(x, " ").replace(/\s+/g, " ").trim();
2666
- const f = first(h.split(":"));
2667
- includes(["2xl", "xl", "lg", "md", "sm"], f) && p.push(h.split(":").pop().trim());
2664
+ const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
2665
+ u = u.replace(f, " ").replace(/\s+/g, " ").trim();
2666
+ const x = first(h.split(":"));
2667
+ includes(["2xl", "xl", "lg", "md", "sm"], x) && p.push(h.split(":").pop().trim());
2668
2668
  }), each(p, (h) => {
2669
- const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
2670
- g = g.replace(x, " ").replace(/\s+/g, " ").trim();
2669
+ const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
2670
+ g = g.replace(f, " ").replace(/\s+/g, " ").trim();
2671
2671
  }), {
2672
2672
  ids: [d._id],
2673
2673
  props: {
@@ -2675,7 +2675,23 @@ const getBlockWithChildren = (o, n) => {
2675
2675
  }
2676
2676
  };
2677
2677
  });
2678
- }), useRemoveClassesFromBlocks = () => {
2678
+ }), removeAllClassesForBlock = (o) => {
2679
+ const n = Object.keys(o).filter(
2680
+ (a) => typeof o[a] == "string" && o[a].startsWith(STYLES_KEY)
2681
+ ), r = {};
2682
+ return n.forEach((a) => {
2683
+ r[a] = `${STYLES_KEY},`;
2684
+ }), {
2685
+ ids: [o._id],
2686
+ props: r
2687
+ };
2688
+ }, useRemoveAllClassesForBlock = () => {
2689
+ const { updateBlocks: o, updateBlocksRuntime: n } = useBlocksStoreUndoableActions();
2690
+ return useCallback((r, a = !1) => {
2691
+ const { ids: l, props: i } = removeAllClassesForBlock(r);
2692
+ a ? o(l, i) : n(l, i);
2693
+ }, [o, n]);
2694
+ }, useRemoveClassesFromBlocks = () => {
2679
2695
  const { updateBlocks: o, updateBlocksRuntime: n } = useBlocksStoreUndoableActions(), r = useSetAtom$1(removeClassFromBlocksAtom);
2680
2696
  return useCallback(
2681
2697
  (a, l, i = !1) => {
@@ -2800,21 +2816,21 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2800
2816
  return "VERTICAL";
2801
2817
  }
2802
2818
  }, isDisabledControl = (o, n, r) => !!(o && (r === "UP" || r === "LEFT") || n && (r === "DOWN" || r === "RIGHT")), useBlockController = (o, n) => {
2803
- const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (f) => c ? get(f, "_parent") === c : !get(f, "_parent")), p = (d == null ? void 0 : d.length) <= 1, u = findIndex(d, { _id: i }), g = u <= 0, h = u + 1 === (d == null ? void 0 : d.length), m = getParentBlockOrientation(c, i, a), x = useCallback(
2804
- (f) => {
2805
- isDisabledControl(g, h, f) || p || (f === "UP" || f === "LEFT" ? l([i], c || null, u - 1) : (f === "DOWN" || f === "RIGHT") && l([i], c || null, u + 2), n());
2819
+ const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (x) => c ? get(x, "_parent") === c : !get(x, "_parent")), p = (d == null ? void 0 : d.length) <= 1, u = findIndex(d, { _id: i }), g = u <= 0, h = u + 1 === (d == null ? void 0 : d.length), m = getParentBlockOrientation(c, i, a), f = useCallback(
2820
+ (x) => {
2821
+ isDisabledControl(g, h, x) || p || (x === "UP" || x === "LEFT" ? l([i], c || null, u - 1) : (x === "DOWN" || x === "RIGHT") && l([i], c || null, u + 2), n());
2806
2822
  },
2807
2823
  [g, h, p, u, i, c, n]
2808
2824
  );
2809
2825
  return useHotkeys(
2810
2826
  "shift+up, shift+down, shift+left, shift+right",
2811
- ({ key: f }) => {
2827
+ ({ key: x }) => {
2812
2828
  var y;
2813
- x((y = f == null ? void 0 : f.replace("Arrow", "")) == null ? void 0 : y.toUpperCase());
2829
+ f((y = x == null ? void 0 : x.replace("Arrow", "")) == null ? void 0 : y.toUpperCase());
2814
2830
  },
2815
2831
  { document: a == null ? void 0 : a.contentDocument },
2816
- [x]
2817
- ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: h, moveBlock: x, orientation: m };
2832
+ [f]
2833
+ ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: h, moveBlock: f, orientation: m };
2818
2834
  }, BlockController = ({ block: o, updateFloatingBar: n }) => {
2819
2835
  const { isOnlyChild: r, isFirstBlock: a, isLastBlock: l, moveBlock: i, orientation: c } = useBlockController(
2820
2836
  o,
@@ -2960,7 +2976,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
2960
2976
  elements: { reference: n }
2961
2977
  });
2962
2978
  useResizeObserver(n, () => m(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => m(), (u == null ? void 0 : u.body) !== null);
2963
- const x = get(o, "_parent", null), f = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
2979
+ const f = get(o, "_parent", null), x = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
2964
2980
  return !n || !o || p ? null : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
2965
2981
  "div",
2966
2982
  {
@@ -2977,16 +2993,16 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
2977
2993
  onKeyDown: (y) => y.stopPropagation(),
2978
2994
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
2979
2995
  children: [
2980
- x && /* @__PURE__ */ jsx(
2996
+ f && /* @__PURE__ */ jsx(
2981
2997
  ArrowUpIcon,
2982
2998
  {
2983
2999
  className: "hover:scale-105",
2984
3000
  onClick: () => {
2985
- c([]), l([x]);
3001
+ c([]), l([f]);
2986
3002
  }
2987
3003
  }
2988
3004
  ),
2989
- /* @__PURE__ */ jsx(BlockActionLabel, { label: f, block: o }),
3005
+ /* @__PURE__ */ jsx(BlockActionLabel, { label: x, block: o }),
2990
3006
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pl-1 pr-1.5", children: [
2991
3007
  /* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "hover:scale-105" }) }),
2992
3008
  canDuplicateBlock(get(o, "_type", "")) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsx(CopyIcon, { className: "hover:scale-105", onClick: () => a([o == null ? void 0 : o._id]) }) : null,
@@ -3144,8 +3160,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3144
3160
  i
3145
3161
  ]), useHotkeys(
3146
3162
  "del, backspace",
3147
- (x) => {
3148
- x.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
3163
+ (f) => {
3164
+ f.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
3149
3165
  },
3150
3166
  m,
3151
3167
  [n, l]
@@ -3438,8 +3454,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3438
3454
  ],
3439
3455
  onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
3440
3456
  onBlur: ({ editor: u, event: g }) => {
3441
- const h = g.relatedTarget, m = i.querySelector(".ProseMirror"), x = i.querySelector(".tippy-box"), f = m == null ? void 0 : m.contains(h), y = x == null ? void 0 : x.contains(h);
3442
- if (!f && !y) {
3457
+ 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);
3458
+ if (!x && !y) {
3443
3459
  const b = (u == null ? void 0 : u.getHTML()) || "";
3444
3460
  r(b);
3445
3461
  }
@@ -3494,14 +3510,14 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3494
3510
  useEffect(() => {
3495
3511
  if (a.current) {
3496
3512
  a.current.innerText = n, a.current.focus();
3497
- const m = c.createRange(), x = d.getSelection();
3498
- m.selectNodeContents(a.current), m.collapse(!1), x == null || x.removeAllRanges(), x == null || x.addRange(m), a.current.focus();
3513
+ const m = c.createRange(), f = d.getSelection();
3514
+ m.selectNodeContents(a.current), m.collapse(!1), f == null || f.removeAllRanges(), f == null || f.addRange(m), a.current.focus();
3499
3515
  } else
3500
3516
  r();
3501
3517
  }, [c, d]);
3502
3518
  const p = useMemo(() => {
3503
- var x;
3504
- const m = ((x = o == null ? void 0 : o.tagName) == null ? void 0 : x.toLowerCase()) || "div";
3519
+ var f;
3520
+ const m = ((f = o == null ? void 0 : o.tagName) == null ? void 0 : f.toLowerCase()) || "div";
3505
3521
  return m === "button" ? "div" : m;
3506
3522
  }, [o]), u = useCallback(
3507
3523
  (m) => {
@@ -3517,12 +3533,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3517
3533
  contentEditable: !0,
3518
3534
  className: `${((m = o == null ? void 0 : o.className) == null ? void 0 : m.replace("sr-only", "")) || ""} outline outline-[2px] outline-green-500 shadow-none empty:before:content-[attr(data-placeholder)] empty:before:text-gray-400 empty:before:absolute empty:before:pointer-events-none empty:before:select-none empty:before:inset-0 empty:before:z-0 relative min-h-[1em]`,
3519
3535
  style: cloneDeep(o == null ? void 0 : o.style) || {},
3520
- onInput: (x) => {
3521
- const f = x.target;
3522
- f && (f.innerText.trim() === "" ? (f.setAttribute("data-placeholder", "Enter text here"), f.children.length > 0 && f.children[0].remove()) : x.target.removeAttribute("data-placeholder"), l(x.target.innerText));
3536
+ onInput: (f) => {
3537
+ const x = f.target;
3538
+ x && (x.innerText.trim() === "" ? (x.setAttribute("data-placeholder", "Enter text here"), x.children.length > 0 && x.children[0].remove()) : f.target.removeAttribute("data-placeholder"), l(f.target.innerText));
3523
3539
  },
3524
- onClick: (x) => {
3525
- x.stopPropagation(), x.preventDefault();
3540
+ onClick: (f) => {
3541
+ f.stopPropagation(), f.preventDefault();
3526
3542
  }
3527
3543
  };
3528
3544
  }, [o == null ? void 0 : o.className, o == null ? void 0 : o.style]);
@@ -3535,33 +3551,33 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3535
3551
  }
3536
3552
  ), WithBlockTextEditor = memo(
3537
3553
  ({ block: o, children: n }) => {
3538
- const r = "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: x } = useLanguages(), [, f] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: v, blockType: B } = useMemo(() => {
3554
+ const r = "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: v, blockType: B } = useMemo(() => {
3539
3555
  var j;
3540
3556
  const A = o._type;
3541
3557
  let N = o[r];
3542
3558
  const C = getRegisteredChaiBlock(o._type);
3543
- return x && ((j = C == null ? void 0 : C.i18nProps) == null ? void 0 : j.includes(r)) && has(o, `${r}-${x}`) && (N = get(o, `${r}-${x}`)), { blockContent: N, blockType: A };
3544
- }, [o, x]), w = useCallback(
3559
+ return f && ((j = C == null ? void 0 : C.i18nProps) == null ? void 0 : j.includes(r)) && has(o, `${r}-${f}`) && (N = get(o, `${r}-${f}`)), { blockContent: N, blockType: A };
3560
+ }, [o, f]), w = useCallback(
3545
3561
  (A) => {
3546
3562
  var C;
3547
3563
  const N = A || ((C = g.current) == null ? void 0 : C.innerText);
3548
- m([b], { [r]: N }), u(null), c(null), d(-1), f([]);
3564
+ m([b], { [r]: N }), u(null), c(null), d(-1), x([]);
3549
3565
  },
3550
- [b, m, c, f, x]
3566
+ [b, m, c, x, f]
3551
3567
  ), _ = useDebouncedCallback(
3552
3568
  (A) => {
3553
3569
  m([b], { [r]: A });
3554
3570
  },
3555
- [b, o, m, x],
3571
+ [b, o, m, f],
3556
3572
  1e3
3557
3573
  ), E = useCallback(
3558
3574
  (A) => {
3559
3575
  A.preventDefault(), b && (y.current = b), w(), setTimeout(() => {
3560
3576
  const N = y.current;
3561
- y.current = null, f([N]);
3577
+ y.current = null, x([N]);
3562
3578
  }, 100);
3563
3579
  },
3564
- [f, b, x]
3580
+ [x, b, f]
3565
3581
  );
3566
3582
  useEffect(() => {
3567
3583
  var k;
@@ -3588,7 +3604,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3588
3604
  onChange: _,
3589
3605
  onEscape: E
3590
3606
  }
3591
- )) : null, [p, b, B, v, w, x]);
3607
+ )) : null, [p, b, B, v, w, f]);
3592
3608
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3593
3609
  S,
3594
3610
  n
@@ -3623,18 +3639,18 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3623
3639
  blockAtom: n,
3624
3640
  children: r
3625
3641
  }) => {
3626
- const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [h] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom), x = get(c, "component", null), { index: f, key: y } = useContext(RepeaterContext), b = useMemo(
3642
+ const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), 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(
3627
3643
  () => m ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
3628
- index: f,
3644
+ index: x,
3629
3645
  key: y
3630
3646
  }) : applyLanguage(i, d, c),
3631
- [i, d, c, g, m, f, y]
3647
+ [i, d, c, g, m, x, y]
3632
3648
  ), v = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), B = useMemo(
3633
3649
  () => u(i._id, getBlockRuntimeProps(i._type)),
3634
3650
  [i._id, i._type, u, getBlockRuntimeProps]
3635
3651
  ), w = useMemo(
3636
3652
  () => ({
3637
- blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": f },
3653
+ blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": x },
3638
3654
  inBuilder: !0,
3639
3655
  lang: d || p,
3640
3656
  ...b,
@@ -3653,8 +3669,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3653
3669
  o
3654
3670
  ]
3655
3671
  ), _ = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
3656
- if (isNull(x) || h.includes(i._id)) return null;
3657
- let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(x, {
3672
+ if (isNull(f) || h.includes(i._id)) return null;
3673
+ let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
3658
3674
  ...w,
3659
3675
  children: r({
3660
3676
  _id: i._id,
@@ -3667,7 +3683,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3667
3683
  ...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
3668
3684
  })
3669
3685
  }) });
3670
- const S = a === i._id && (l === f || f < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: E }) : E;
3686
+ const S = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: E }) : E;
3671
3687
  return _ ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: S }) : S;
3672
3688
  }, PartialWrapper = ({ children: o, partialBlockId: n }) => {
3673
3689
  const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
@@ -3708,7 +3724,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3708
3724
  );
3709
3725
  return map(l, (c) => {
3710
3726
  const d = a(c._id);
3711
- 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: x }) => g === "Repeater" ? isArray(m) && m.map((f, y) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: y, key: x }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, 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: r, blocks: o, parent: c._id }) : null }) }, c._id) : null;
3727
+ 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: r, 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: r, blocks: o, parent: c._id }) : null }) }, c._id) : null;
3712
3728
  });
3713
3729
  }, PageBlocksRenderer = () => {
3714
3730
  const [o] = useBlocksStore();
@@ -3776,14 +3792,14 @@ const CanvasEventsWatcher = () => {
3776
3792
  }, StaticCanvas = () => {
3777
3793
  const [o] = useCanvasDisplayWidth(), [, n] = useHighlightBlockId(), r = useRef(null), a = useRef(null), [l, i] = useState({ width: 0, height: 0 }), c = useCanvasScale(l), [, d] = useAtom$1(canvasIframeAtom), p = useBuilderProp("loading", !1), u = useBuilderProp("htmlDir", "ltr"), g = useCallback(
3778
3794
  (m) => {
3779
- i((x) => ({ ...x, width: m }));
3795
+ i((f) => ({ ...f, width: m }));
3780
3796
  },
3781
3797
  [i]
3782
3798
  );
3783
3799
  useEffect(() => {
3784
3800
  if (!a.current) return;
3785
- const { clientWidth: m, clientHeight: x } = a.current;
3786
- i({ width: m, height: x });
3801
+ const { clientWidth: m, clientHeight: f } = a.current;
3802
+ i({ width: m, height: f });
3787
3803
  }, [a, o]);
3788
3804
  const h = useMemo(() => {
3789
3805
  let m = IframeInitialContent;
@@ -3898,8 +3914,8 @@ const CanvasEventsWatcher = () => {
3898
3914
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG code to use as an icon") })
3899
3915
  ] });
3900
3916
  }, DefaultMediaManager = ({ close: o, onSelect: n, mode: r = "image" }) => {
3901
- const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), h = async (x) => {
3902
- if (!x.trim()) {
3917
+ const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), h = async (f) => {
3918
+ if (!f.trim()) {
3903
3919
  p(!1), g("Please enter a URL");
3904
3920
  return;
3905
3921
  }
@@ -3923,7 +3939,7 @@ const CanvasEventsWatcher = () => {
3923
3939
  {
3924
3940
  placeholder: m(`Enter ${r} URL`),
3925
3941
  value: a,
3926
- onChange: (x) => l(x.target.value),
3942
+ onChange: (f) => l(f.target.value),
3927
3943
  onKeyUp: () => h(a)
3928
3944
  }
3929
3945
  ),
@@ -3964,16 +3980,16 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
3964
3980
  const h = isArray(g) ? first(g) : g;
3965
3981
  if (h) {
3966
3982
  n(h == null ? void 0 : h.url);
3967
- const m = h == null ? void 0 : h.width, x = h == null ? void 0 : h.height;
3983
+ const m = h == null ? void 0 : h.width, f = h == null ? void 0 : h.height;
3968
3984
  if (i != null && i._id) {
3969
- const f = {
3985
+ const x = {
3970
3986
  ...m && { width: m },
3971
- ...x && { height: x },
3987
+ ...f && { height: f },
3972
3988
  ...h.description && { alt: h.description },
3973
3989
  ...h.id && { assetId: h.id }
3974
3990
  };
3975
- if (isEmpty(f)) return;
3976
- c([i._id], f);
3991
+ if (isEmpty(x)) return;
3992
+ c([i._id], x);
3977
3993
  }
3978
3994
  }
3979
3995
  }, p = useCallback(() => {
@@ -4017,14 +4033,14 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
4017
4033
  }, PathDropdown = ({ data: o, onSelect: n, dataType: r }) => {
4018
4034
  const [a, l] = React__default.useState([]), [i, c] = React__default.useState(o), d = (h) => Array.isArray(h) ? "array" : typeof h == "object" && h !== null ? "object" : "value", p = React__default.useCallback(
4019
4035
  (h) => {
4020
- const m = (x) => r === "value" ? x === "value" || x === "object" : r === "array" ? x === "array" : x === r;
4021
- h.type === "object" ? (l((x) => [...x, h.key]), c(h.value)) : m(h.type) && n([...a, h.key].join("."), r);
4036
+ const m = (f) => r === "value" ? f === "value" || f === "object" : r === "array" ? f === "array" : f === r;
4037
+ h.type === "object" ? (l((f) => [...f, h.key]), c(h.value)) : m(h.type) && n([...a, h.key].join("."), r);
4022
4038
  },
4023
4039
  [a, n, r]
4024
4040
  ), u = React__default.useCallback(() => {
4025
4041
  if (a.length > 0) {
4026
4042
  const h = a.slice(0, -1);
4027
- l(h), c(h.reduce((m, x) => m[x], o));
4043
+ l(h), c(h.reduce((m, f) => m[f], o));
4028
4044
  }
4029
4045
  }, [a, o]), g = React__default.useMemo(() => i ? Object.entries(i).map(([h, m]) => ({ key: h, value: m, type: d(m) })).filter((h) => !startsWith(h.key, REPEATER_PREFIX) && h.key.includes("/") ? !1 : r === "value" ? h.type === "value" || h.type === "object" : r === "array" ? h.type === "array" || h.type === "object" : r === "object" ? h.type === "object" : !0) : [], [i, r]);
4030
4046
  return /* @__PURE__ */ jsxs(Command, { className: "fields-command", children: [
@@ -4117,7 +4133,7 @@ const DataBindingSelector = ({
4117
4133
  }) => {
4118
4134
  const l = usePageExternalData(), i = useSelectedBlockHierarchy(), c = useSelectedBlock(), d = useMemo(() => {
4119
4135
  if (i.length === 1) return "";
4120
- const g = i.find((x) => x._type === "Repeater"), m = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4136
+ const g = i.find((f) => f._type === "Repeater"), m = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4121
4137
  return `${REPEATER_PREFIX}${startsWith(m, COLLECTION_PREFIX) ? `${m}/${g._id}` : m}`;
4122
4138
  }, [i]), p = useMemo(() => first(get(l, d.replace(REPEATER_PREFIX, ""), [])), [d, l]), u = useCallback(
4123
4139
  (g, h) => {
@@ -4125,7 +4141,7 @@ const DataBindingSelector = ({
4125
4141
  n(`{{${g}}}`, {}, r);
4126
4142
  return;
4127
4143
  }
4128
- const m = (b) => /[.,!?;:]/.test(b), x = (b, v, B) => {
4144
+ const m = (b) => /[.,!?;:]/.test(b), f = (b, v, B) => {
4129
4145
  let w = "", _ = "";
4130
4146
  const E = v > 0 ? b[v - 1] : "", S = v < b.length ? b[v] : "";
4131
4147
  return v > 0 && (E === "." || !m(E) && E !== " ") && (w = " "), v < b.length && !m(S) && S !== " " && (_ = " "), {
@@ -4133,8 +4149,8 @@ const DataBindingSelector = ({
4133
4149
  prefixLength: w.length,
4134
4150
  suffixLength: _.length
4135
4151
  };
4136
- }, f = document.getElementById(r);
4137
- if (!f) return;
4152
+ }, x = document.getElementById(r);
4153
+ if (!x) return;
4138
4154
  const y = document.getElementById(`chai-rte-${r}`) || document.getElementById(`chai-rte-modal-${r}`);
4139
4155
  if (y && (y.querySelector(".ProseMirror") || y.__chaiRTE)) {
4140
4156
  const b = y.__chaiRTE;
@@ -4155,13 +4171,13 @@ const DataBindingSelector = ({
4155
4171
  return;
4156
4172
  }
4157
4173
  } else {
4158
- const b = f, v = b.selectionStart || 0, B = b.value || "", w = b.selectionEnd || v;
4174
+ const b = x, v = b.selectionStart || 0, B = b.value || "", w = b.selectionEnd || v;
4159
4175
  if (w > v) {
4160
- const N = `{{${g}}}`, { text: C } = x(B, v, N), k = B.slice(0, v) + C + B.slice(w);
4176
+ const N = `{{${g}}}`, { text: C } = f(B, v, N), k = B.slice(0, v) + C + B.slice(w);
4161
4177
  n(k, {}, r);
4162
4178
  return;
4163
4179
  }
4164
- const E = `{{${g}}}`, { text: S } = x(B, v, E), A = B.slice(0, v) + S + B.slice(v);
4180
+ const E = `{{${g}}}`, { text: S } = f(B, v, E), A = B.slice(0, v) + S + B.slice(v);
4165
4181
  n(A, {}, r);
4166
4182
  }
4167
4183
  },
@@ -4184,9 +4200,9 @@ const DataBindingSelector = ({
4184
4200
  onChange: r
4185
4201
  }) => {
4186
4202
  var N;
4187
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [x, f] = useState([]), [y, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((C) => C.key === u)) == null ? void 0 : N.name;
4203
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((C) => C.key === u)) == null ? void 0 : N.name;
4188
4204
  useEffect(() => {
4189
- if (m(""), f([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4205
+ if (m(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4190
4206
  const C = split(o, ":"), k = get(C, 1, "page") || "page";
4191
4207
  g(k), (async () => {
4192
4208
  const j = await l(k, [get(C, 2, "page")]);
@@ -4196,10 +4212,10 @@ const DataBindingSelector = ({
4196
4212
  const w = useDebouncedCallback(
4197
4213
  async (C) => {
4198
4214
  if (isEmpty(C))
4199
- f([]);
4215
+ x([]);
4200
4216
  else {
4201
4217
  const k = await l(u, C);
4202
- f(k);
4218
+ x(k);
4203
4219
  }
4204
4220
  c(!1), b(-1);
4205
4221
  },
@@ -4207,18 +4223,18 @@ const DataBindingSelector = ({
4207
4223
  300
4208
4224
  ), _ = (C) => {
4209
4225
  const k = ["pageType", u, C.id];
4210
- k[1] && (r(k.join(":")), m(C.name), p(!1), f([]), b(-1));
4226
+ k[1] && (r(k.join(":")), m(C.name), p(!1), x([]), b(-1));
4211
4227
  }, E = (C) => {
4212
4228
  switch (C.key) {
4213
4229
  case "ArrowDown":
4214
- C.preventDefault(), b((k) => k < x.length - 1 ? k + 1 : k);
4230
+ C.preventDefault(), b((k) => k < f.length - 1 ? k + 1 : k);
4215
4231
  break;
4216
4232
  case "ArrowUp":
4217
4233
  C.preventDefault(), b((k) => k > 0 ? k - 1 : k);
4218
4234
  break;
4219
4235
  case "Enter":
4220
- if (C.preventDefault(), x.length === 0) return;
4221
- y >= 0 && _(x[y]);
4236
+ if (C.preventDefault(), f.length === 0) return;
4237
+ y >= 0 && _(f[y]);
4222
4238
  break;
4223
4239
  case "Escape":
4224
4240
  C.preventDefault(), S();
@@ -4232,7 +4248,7 @@ const DataBindingSelector = ({
4232
4248
  }
4233
4249
  }, [y]);
4234
4250
  const S = () => {
4235
- m(""), f([]), b(-1), p(!1), r("");
4251
+ m(""), x([]), b(-1), p(!1), r("");
4236
4252
  }, A = (C) => {
4237
4253
  m(C), p(!isEmpty(C)), c(!0), w(C);
4238
4254
  };
@@ -4252,15 +4268,15 @@ const DataBindingSelector = ({
4252
4268
  ),
4253
4269
  /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick: S, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4254
4270
  ] }),
4255
- (i || !isEmpty(x) || d && isEmpty(x)) && /* @__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: [
4271
+ (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: [
4256
4272
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
4257
4273
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
4258
- ] }) : d && isEmpty(x) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4274
+ ] }) : d && isEmpty(f) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4259
4275
  a("No results found for"),
4260
4276
  ' "',
4261
4277
  h,
4262
4278
  '"'
4263
- ] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(x == null ? void 0 : x.slice(0, 20), (C, k) => /* @__PURE__ */ jsxs(
4279
+ ] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(f == null ? void 0 : f.slice(0, 20), (C, k) => /* @__PURE__ */ jsxs(
4264
4280
  "li",
4265
4281
  {
4266
4282
  onClick: () => _(C),
@@ -4575,8 +4591,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4575
4591
  if (!u) return;
4576
4592
  const m = `{{${h}}}`;
4577
4593
  u.commands.focus();
4578
- const { from: x, to: f } = u.state.selection;
4579
- if (x !== f)
4594
+ const { from: f, to: x } = u.state.selection;
4595
+ if (f !== x)
4580
4596
  u.chain().deleteSelection().insertContent(m).run();
4581
4597
  else {
4582
4598
  const { state: b } = u, v = b.selection.from, B = b.doc.textBetween(Math.max(0, v - 1), v), w = b.doc.textBetween(v, Math.min(v + 1, b.doc.content.size));
@@ -4622,13 +4638,13 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4622
4638
  })
4623
4639
  ],
4624
4640
  content: r || "",
4625
- onUpdate: ({ editor: x }) => {
4626
- const f = x.getHTML();
4627
- a(f), c || u(f);
4641
+ onUpdate: ({ editor: f }) => {
4642
+ const x = f.getHTML();
4643
+ a(x), c || u(x);
4628
4644
  },
4629
- onBlur: ({ editor: x }) => {
4630
- const f = x.getHTML();
4631
- l(o, f);
4645
+ onBlur: ({ editor: f }) => {
4646
+ const x = f.getHTML();
4647
+ l(o, x);
4632
4648
  },
4633
4649
  editorProps: {
4634
4650
  attributes: {
@@ -4641,8 +4657,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4641
4657
  }, [g]), useEffect(() => {
4642
4658
  u(r || "");
4643
4659
  }, [r]);
4644
- const h = (x) => {
4645
- a(x);
4660
+ const h = (f) => {
4661
+ a(f);
4646
4662
  }, m = () => {
4647
4663
  d(!1), g && g.commands.setContent(p);
4648
4664
  };
@@ -4675,24 +4691,24 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4675
4691
  u != null && u.length && !find(u, { _id: o == null ? void 0 : o.currentSlide }) && n({ ...o, currentSlide: get(u, "0._id") });
4676
4692
  }, [o, u]);
4677
4693
  const h = () => {
4678
- const f = findIndex(u, { _id: g });
4679
- if (f > -1) {
4680
- const y = (f + 1) % u.length, b = get(u, [y, "_id"]);
4694
+ const x = findIndex(u, { _id: g });
4695
+ if (x > -1) {
4696
+ const y = (x + 1) % u.length, b = get(u, [y, "_id"]);
4681
4697
  if (!b) return;
4682
4698
  n({ ...o, currentSlide: b }), c([b]);
4683
4699
  }
4684
4700
  }, m = () => {
4685
- const f = findIndex(u, { _id: g });
4686
- if (f > -1) {
4687
- const y = (f - 1 + u.length) % u.length, b = get(u, [y, "_id"]);
4701
+ const x = findIndex(u, { _id: g });
4702
+ if (x > -1) {
4703
+ const y = (x - 1 + u.length) % u.length, b = get(u, [y, "_id"]);
4688
4704
  if (!b) return;
4689
4705
  n({ ...o, currentSlide: b }), c([b]);
4690
4706
  }
4691
- }, x = () => {
4692
- const f = i(
4707
+ }, f = () => {
4708
+ const x = i(
4693
4709
  { styles: "#styles:,h-full w-full min-w-full", type: "Slide" },
4694
4710
  p == null ? void 0 : p._id
4695
- ), y = f == null ? void 0 : f._id;
4711
+ ), y = x == null ? void 0 : x._id;
4696
4712
  y && (n({ ...o, currentSlide: y }), c([y]));
4697
4713
  };
4698
4714
  return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
@@ -4710,7 +4726,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4710
4726
  /* @__PURE__ */ jsxs(
4711
4727
  "button",
4712
4728
  {
4713
- onClick: x,
4729
+ onClick: f,
4714
4730
  className: "flex w-full items-center justify-center gap-x-1 rounded bg-gray-200 p-1.5 text-xs font-medium leading-tight hover:opacity-80",
4715
4731
  children: [
4716
4732
  /* @__PURE__ */ jsx(PlusCircle, { className: "h-3 w-3 stroke-[2]" }),
@@ -4771,8 +4787,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4771
4787
  value: o == null ? void 0 : o.autoplayInterval,
4772
4788
  className: "text-xs",
4773
4789
  pattern: "[0-9]*",
4774
- onChange: (f) => {
4775
- let y = f.target.value;
4790
+ onChange: (x) => {
4791
+ let y = x.target.value;
4776
4792
  y.length && (y = y.replace("-", "")), n({ ...o, autoplayInterval: y });
4777
4793
  }
4778
4794
  }
@@ -4881,9 +4897,9 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4881
4897
  formData: g,
4882
4898
  onChange: h
4883
4899
  }) => {
4884
- const { selectedLang: m, fallbackLang: x, languages: f } = useLanguages(), y = useMemo(
4885
- () => isEmpty(f) ? "" : isEmpty(m) ? x : m,
4886
- [f, m, x]
4900
+ const { selectedLang: m, fallbackLang: f, languages: x } = useLanguages(), y = useMemo(
4901
+ () => isEmpty(x) ? "" : isEmpty(m) ? f : m,
4902
+ [x, m, f]
4887
4903
  ), b = useMemo(() => get(LANGUAGES, y, y), [y]), v = usePageExternalData(), B = useSelectedBlock(), w = useRegisteredChaiBlocks(), _ = useMemo(
4888
4904
  () => get(w, [B == null ? void 0 : B._type, "i18nProps"], []),
4889
4905
  [w, B == null ? void 0 : B._type]
@@ -4920,14 +4936,20 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4920
4936
  }
4921
4937
  return /* @__PURE__ */ jsxs("div", { className: n, children: [
4922
4938
  u.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
4923
- /* @__PURE__ */ jsxs("label", { htmlFor: o, className: u.type === "object" ? "pb-2" : "", children: [
4924
- r,
4925
- " ",
4926
- N && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
4939
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4940
+ /* @__PURE__ */ jsxs("label", { htmlFor: o, className: u.type === "object" ? "pb-2" : "", children: [
4941
+ r,
4927
4942
  " ",
4928
- b
4943
+ N && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
4944
+ " ",
4945
+ b
4946
+ ] }),
4947
+ p && u.type !== "object" ? " *" : null
4929
4948
  ] }),
4930
- p && u.type !== "object" ? " *" : null
4949
+ u.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
4950
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Info, { className: "h-3 w-3 text-muted-foreground/70" }) }),
4951
+ /* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: u.description })
4952
+ ] }) })
4931
4953
  ] }),
4932
4954
  !u.enum && !u.oneOf && v && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
4933
4955
  DataBindingSelector,
@@ -5041,17 +5063,17 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
5041
5063
  }), a;
5042
5064
  };
5043
5065
  function BlockSettings() {
5044
- const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, 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), x = ({ formData: E }, S, A) => {
5066
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, 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: E }, S, A) => {
5045
5067
  S && (c == null ? void 0 : c._id) === n._id && a([n._id], { [S]: get(E, S) }, A);
5046
- }, f = useCallback(
5068
+ }, x = useCallback(
5047
5069
  debounce(({ formData: E }, S, A) => {
5048
- x({ formData: E }, S, A), d(E);
5070
+ f({ formData: E }, S, A), d(E);
5049
5071
  }, 1500),
5050
5072
  [n == null ? void 0 : n._id, o]
5051
5073
  ), y = ({ formData: E }, S) => {
5052
- S && (r([n._id], { [S]: get(E, S) }), f({ formData: E }, S, { [S]: get(c, S) }));
5074
+ S && (r([n._id], { [S]: get(E, S) }), x({ formData: E }, S, { [S]: get(c, S) }));
5053
5075
  }, b = ({ formData: E }, S) => {
5054
- S && (r([g._id], { [S]: get(E, S) }), f({ formData: E }, S, { [S]: get(c, S) }));
5076
+ S && (r([g._id], { [S]: get(E, S) }), x({ formData: E }, S, { [S]: get(c, S) }));
5055
5077
  }, { schema: v, uiSchema: B } = useMemo(() => {
5056
5078
  const E = n == null ? void 0 : n._type;
5057
5079
  if (!E)
@@ -5116,50 +5138,63 @@ function BlockSettings() {
5116
5138
  ] });
5117
5139
  }
5118
5140
  const BlockStylingProps = () => {
5119
- const o = useSelectedBlock(), [n, r] = useSelectedStylingBlocks(), { t: a } = useTranslation();
5141
+ var f;
5142
+ const o = useSelectedBlock(), [n, r] = useSelectedStylingBlocks(), a = useRemoveClassesFromBlocks(), [l] = useSelectedBlockIds(), { t: i } = useTranslation();
5120
5143
  if (!o) return null;
5121
- const l = Object.keys(o).filter(
5122
- (p) => typeof o[p] == "string" && o[p].startsWith("#styles:")
5123
- ), { reset: i } = useResetBlockStyles(), c = !isEmpty(l) && l.length > 1, d = (p) => find(n, (u) => u.prop === p);
5124
- return /* @__PURE__ */ jsx(Fragment, { children: c && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
5144
+ const c = Object.keys(o).filter(
5145
+ (x) => typeof o[x] == "string" && o[x].startsWith("#styles:")
5146
+ ), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (f = n[0]) == null ? void 0 : f.prop, ""), { classes: g = "" } = getSplitChaiClasses(u) || {}, h = g ? g.split(" ").filter((x) => !isEmpty(x)) : [], m = (x) => find(n, (y) => y.prop === x);
5147
+ return /* @__PURE__ */ jsx(Fragment, { children: p && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
5125
5148
  /* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
5126
- a("Style element"),
5149
+ i("Style element"),
5127
5150
  ":"
5128
5151
  ] }),
5129
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(l, (p) => /* @__PURE__ */ jsxs(
5152
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(c, (x) => /* @__PURE__ */ jsxs(
5130
5153
  Badge,
5131
5154
  {
5132
5155
  className: "flex cursor-pointer items-center gap-1 pr-1",
5133
- variant: d(p) ? "default" : "secondary",
5156
+ variant: m(x) ? "default" : "secondary",
5134
5157
  onClick: () => {
5135
- r([{ id: `${p}-${o._id}`, blockId: o._id, prop: p }]);
5158
+ r([{ id: `${x}-${o._id}`, blockId: o._id, prop: x }]);
5136
5159
  },
5137
5160
  children: [
5138
- startCase(p),
5161
+ startCase(x),
5139
5162
  /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5140
5163
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
5141
5164
  "button",
5142
5165
  {
5143
5166
  type: "button",
5144
5167
  className: "ml-1 rounded-sm p-0.5 hover:bg-blue-300 hover:text-blue-600",
5145
- onClick: (u) => u.stopPropagation(),
5168
+ onClick: (y) => y.stopPropagation(),
5146
5169
  children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" })
5147
5170
  }
5148
5171
  ) }),
5149
- /* @__PURE__ */ jsx(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: /* @__PURE__ */ jsx(
5150
- DropdownMenuItem,
5151
- {
5152
- className: "text-xs",
5153
- onClick: () => {
5154
- i(p);
5155
- },
5156
- children: a("Reset style")
5157
- }
5158
- ) })
5172
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: [
5173
+ /* @__PURE__ */ jsx(
5174
+ DropdownMenuItem,
5175
+ {
5176
+ className: "text-xs",
5177
+ onClick: () => {
5178
+ d(x);
5179
+ },
5180
+ children: i("Reset style")
5181
+ }
5182
+ ),
5183
+ /* @__PURE__ */ jsx(
5184
+ DropdownMenuItem,
5185
+ {
5186
+ className: "text-xs",
5187
+ onClick: () => {
5188
+ a(l, h, !0);
5189
+ },
5190
+ children: i("Clear styles")
5191
+ }
5192
+ )
5193
+ ] })
5159
5194
  ] })
5160
5195
  ]
5161
5196
  },
5162
- p
5197
+ x
5163
5198
  )) }),
5164
5199
  /* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
5165
5200
  ] }) });
@@ -5308,7 +5343,7 @@ const BlockStylingProps = () => {
5308
5343
  },
5309
5344
  a
5310
5345
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
5311
- const [n, r] = 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]), [x, f] = useState(!1), [y, b] = useState(""), [v, B] = useState(!1), [w, _] = useState(!1);
5346
+ const [n, r] = 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(""), [v, B] = useState(!1), [w, _] = useState(!1);
5312
5347
  useEffect(() => {
5313
5348
  const { value: C, unit: k } = getClassValueAndUnit(i);
5314
5349
  if (k === "") {
@@ -5321,7 +5356,7 @@ const BlockStylingProps = () => {
5321
5356
  (C = !1) => {
5322
5357
  const k = getUserInputValues(`${a}`, u);
5323
5358
  if (get(k, "error", !1)) {
5324
- f(!0);
5359
+ x(!0);
5325
5360
  return;
5326
5361
  }
5327
5362
  const j = get(k, "unit") !== "" ? get(k, "unit") : h;
@@ -5339,7 +5374,7 @@ const BlockStylingProps = () => {
5339
5374
  (C) => {
5340
5375
  const k = getUserInputValues(`${a}`, u);
5341
5376
  if (get(k, "error", !1)) {
5342
- f(!0);
5377
+ x(!0);
5343
5378
  return;
5344
5379
  }
5345
5380
  if (C === "auto" || C === "none") {
@@ -5390,7 +5425,7 @@ const BlockStylingProps = () => {
5390
5425
  },
5391
5426
  onBlur: () => A(),
5392
5427
  onChange: (C) => {
5393
- f(!1), l(C.target.value);
5428
+ x(!1), l(C.target.value);
5394
5429
  },
5395
5430
  onClick: (C) => {
5396
5431
  var k;
@@ -5399,7 +5434,7 @@ const BlockStylingProps = () => {
5399
5434
  value: v ? y : a,
5400
5435
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
5401
5436
  " ",
5402
- x ? "border-red-500 text-red-500" : "border-foreground/20"
5437
+ f ? "border-red-500 text-red-500" : "border-foreground/20"
5403
5438
  )
5404
5439
  }
5405
5440
  ),
@@ -5518,7 +5553,7 @@ const COLOR_PROP = {
5518
5553
  return c([]);
5519
5554
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
5520
5555
  }, [g]);
5521
- const x = useCallback(
5556
+ const f = useCallback(
5522
5557
  // eslint-disable-next-line no-shadow
5523
5558
  (y) => {
5524
5559
  p({ color: g, shade: y });
@@ -5528,11 +5563,11 @@ const COLOR_PROP = {
5528
5563
  useEffect(() => {
5529
5564
  p({ color: "", shade: "" });
5530
5565
  }, [r]);
5531
- const { match: f } = useTailwindClassList();
5566
+ const { match: x } = useTailwindClassList();
5532
5567
  return useEffect(() => {
5533
5568
  const b = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
5534
- f(o, b) && n(b, o);
5535
- }, [f, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
5569
+ x(o, b) && n(b, o);
5570
+ }, [x, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
5536
5571
  /* @__PURE__ */ jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsx(
5537
5572
  DropDown,
5538
5573
  {
@@ -5572,7 +5607,7 @@ const COLOR_PROP = {
5572
5607
  ]
5573
5608
  }
5574
5609
  ) }),
5575
- /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: h, disabled: !g || !l, onChange: x, options: i }) })
5610
+ /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: h, disabled: !g || !l, onChange: f, options: i }) })
5576
5611
  ] });
5577
5612
  }, EDITOR_ICONS = {
5578
5613
  "not-italic": () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z", fill: "white" }) }),
@@ -5906,17 +5941,17 @@ const COLOR_PROP = {
5906
5941
  "2xl": "1536px"
5907
5942
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
5908
5943
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
5909
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), y = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
5944
+ }, 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(
5910
5945
  (S, A = !0) => {
5911
5946
  const N = { dark: p, mq: g, mod: u, cls: S, property: l, fullCls: "" };
5912
5947
  (p || u !== "") && (N.mq = "xs");
5913
5948
  const C = generateFullClsName(N);
5914
- m(f, [C], A);
5949
+ m(x, [C], A);
5915
5950
  },
5916
- [f, p, g, u, l, m]
5951
+ [x, p, g, u, l, m]
5917
5952
  ), v = useCallback(() => {
5918
- x(f, [y], !0);
5919
- }, [f, y, x]), B = useMemo(() => canChangeClass(h, g), [h, g]);
5953
+ f(x, [y], !0);
5954
+ }, [x, y, f]), B = useMemo(() => canChangeClass(h, g), [h, g]);
5920
5955
  useEffect(() => {
5921
5956
  i(B, h);
5922
5957
  }, [B, i, h]);
@@ -6002,23 +6037,23 @@ const COLOR_PROP = {
6002
6037
  children: [
6003
6038
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
6004
6039
  o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
6005
- /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: m, key: x }, f) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
6040
+ /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: m, key: f }, x) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
6006
6041
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
6007
6042
  "button",
6008
6043
  {
6009
6044
  type: "button",
6010
- onClick: () => u(x),
6011
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${x === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6045
+ onClick: () => u(f),
6046
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${f === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6012
6047
  children: [
6013
6048
  React__default.createElement("div", {
6014
- className: h(x) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6049
+ className: h(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6015
6050
  }),
6016
- React__default.createElement(get(EDITOR_ICONS, x, BoxIcon), { className: "text-inherit w-3 h-3" })
6051
+ React__default.createElement(get(EDITOR_ICONS, f, BoxIcon), { className: "text-inherit w-3 h-3" })
6017
6052
  ]
6018
6053
  }
6019
6054
  ) }),
6020
6055
  /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(m)) })
6021
- ] }) }, `option-${f}`)) })
6056
+ ] }) }, `option-${x}`)) })
6022
6057
  ] }),
6023
6058
  /* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
6024
6059
  BlockStyle,
@@ -6173,9 +6208,9 @@ const COLOR_PROP = {
6173
6208
  canvas: n = !1,
6174
6209
  tooltip: r = !0
6175
6210
  }) => {
6176
- const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: h } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (b) => {
6211
+ const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: h } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS), f = (b) => {
6177
6212
  u.includes(b) ? u.length > 2 && g(u.filter((v) => v !== b)) : g((v) => [...v, b]);
6178
- }, f = (b) => {
6213
+ }, x = (b) => {
6179
6214
  n || l(b), c(b);
6180
6215
  }, y = getBreakpointValue(n ? i : a).toLowerCase();
6181
6216
  return m.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(m, (b) => /* @__PURE__ */ createElement(
@@ -6183,7 +6218,7 @@ const COLOR_PROP = {
6183
6218
  {
6184
6219
  canvas: n,
6185
6220
  ...b,
6186
- onClick: f,
6221
+ onClick: x,
6187
6222
  key: b.breakpoint,
6188
6223
  currentBreakpoint: y
6189
6224
  }
@@ -6197,7 +6232,7 @@ const COLOR_PROP = {
6197
6232
  openDelay: o,
6198
6233
  tooltip: r,
6199
6234
  ...b,
6200
- onClick: f,
6235
+ onClick: x,
6201
6236
  key: b.breakpoint,
6202
6237
  currentBreakpoint: y
6203
6238
  }
@@ -6212,7 +6247,7 @@ const COLOR_PROP = {
6212
6247
  DropdownMenuCheckboxItem,
6213
6248
  {
6214
6249
  disabled: b.breakpoint === "xs",
6215
- onCheckedChange: () => x(toUpper(b.breakpoint)),
6250
+ onCheckedChange: () => f(toUpper(b.breakpoint)),
6216
6251
  checked: includes(u, toUpper(b.breakpoint)),
6217
6252
  children: h(b.title)
6218
6253
  },
@@ -6297,8 +6332,8 @@ const AskAIStyles = ({ blockId: o }) => {
6297
6332
  (m = d.current) == null || m.focus();
6298
6333
  }, []);
6299
6334
  const h = (m) => {
6300
- const { usage: x } = m || {};
6301
- !l && x && g(x), p.current = setTimeout(() => g(void 0), 1e4), l || c("");
6335
+ const { usage: f } = m || {};
6336
+ !l && f && g(f), p.current = setTimeout(() => g(void 0), 1e4), l || c("");
6302
6337
  };
6303
6338
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
6304
6339
  /* @__PURE__ */ jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
@@ -6354,9 +6389,9 @@ const AskAIStyles = ({ blockId: o }) => {
6354
6389
  };
6355
6390
  function ManualClasses() {
6356
6391
  var I;
6357
- const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [x, f] = useState(""), y = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
6358
- const L = x.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6359
- u(h, L, !0), f("");
6392
+ const o = useRef(null), [n, r] = 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, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
6393
+ const L = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6394
+ u(h, L, !0), x("");
6360
6395
  }, [w, _] = useState([]), E = ({ value: L }) => {
6361
6396
  const R = L.trim().toLowerCase(), T = R.match(/.+:/g);
6362
6397
  let D = [];
@@ -6379,19 +6414,19 @@ function ManualClasses() {
6379
6414
  autoCapitalize: "off",
6380
6415
  spellCheck: !1,
6381
6416
  placeholder: c("Enter classes separated by space"),
6382
- value: x,
6417
+ value: f,
6383
6418
  onFocus: (L) => {
6384
6419
  setTimeout(() => {
6385
6420
  L.target && L.target.select();
6386
6421
  }, 0);
6387
6422
  },
6388
6423
  onKeyDown: (L) => {
6389
- L.key === "Enter" && x.trim() !== "" && B();
6424
+ L.key === "Enter" && f.trim() !== "" && B();
6390
6425
  },
6391
- onChange: (L, { newValue: R }) => f(R),
6426
+ onChange: (L, { newValue: R }) => x(R),
6392
6427
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
6393
6428
  }),
6394
- [x, c, o]
6429
+ [f, c, o]
6395
6430
  ), k = (L) => {
6396
6431
  debugger;
6397
6432
  const R = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
@@ -6446,7 +6481,7 @@ function ManualClasses() {
6446
6481
  variant: "outline",
6447
6482
  className: "h-6 border-border",
6448
6483
  onClick: B,
6449
- disabled: x.trim() === "",
6484
+ disabled: f.trim() === "",
6450
6485
  size: "sm",
6451
6486
  children: /* @__PURE__ */ jsx(PlusIcon, {})
6452
6487
  }
@@ -6473,28 +6508,49 @@ function ManualClasses() {
6473
6508
  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"
6474
6509
  },
6475
6510
  L
6476
- ) : /* @__PURE__ */ jsxs(
6511
+ ) : /* @__PURE__ */ jsx("div", { className: "group relative flex max-w-[260px] items-center", children: /* @__PURE__ */ jsxs(
6477
6512
  "button",
6478
6513
  {
6479
6514
  onDoubleClick: () => {
6480
- f(L), g(h, [L]), setTimeout(() => {
6515
+ x(L), g(h, [L]), setTimeout(() => {
6481
6516
  o.current && o.current.focus();
6482
6517
  }, 10);
6483
6518
  },
6484
- 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",
6519
+ 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",
6485
6520
  children: [
6486
6521
  L,
6487
- n !== L && /* @__PURE__ */ jsx(
6522
+ /* @__PURE__ */ jsx(
6488
6523
  Cross2Icon,
6489
6524
  {
6490
6525
  onClick: () => g(h, [L], !0),
6491
- className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
6526
+ 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 "
6527
+ }
6528
+ ),
6529
+ /* @__PURE__ */ jsxs(
6530
+ "svg",
6531
+ {
6532
+ className: "absolute left-0.5 mr-0.5 group-hover:hidden h-3.5 w-3.5 ",
6533
+ fill: "rgba(55, 65, 81, 0.4)",
6534
+ viewBox: "0 0 24 24",
6535
+ xmlns: "http://www.w3.org/2000/svg",
6536
+ xmlSpace: "preserve",
6537
+ children: [
6538
+ /* @__PURE__ */ jsx("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
6539
+ /* @__PURE__ */ jsx("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
6540
+ /* @__PURE__ */ jsx("g", { id: "SVGRepo_iconCarrier", children: /* @__PURE__ */ jsx(
6541
+ "path",
6542
+ {
6543
+ fillRule: "evenodd",
6544
+ clipRule: "evenodd",
6545
+ 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"
6546
+ }
6547
+ ) })
6548
+ ]
6492
6549
  }
6493
6550
  )
6494
6551
  ]
6495
- },
6496
- L
6497
- )
6552
+ }
6553
+ ) }, L)
6498
6554
  ) })
6499
6555
  ] });
6500
6556
  }
@@ -6610,9 +6666,9 @@ function BlockStyling() {
6610
6666
  const g = !get(i, "negative", !1), h = get(i, "cssProperty", "");
6611
6667
  let m = parseFloat(i.dragStartValue);
6612
6668
  m = isNaN(m) ? 0 : m;
6613
- let x = MAPPER[i.dragUnit];
6614
- (startsWith(h, "scale") || h === "opacity") && (x = 10);
6615
- let y = (i.dragStartY - u.pageY) / x + m;
6669
+ let f = MAPPER[i.dragUnit];
6670
+ (startsWith(h, "scale") || h === "opacity") && (f = 10);
6671
+ let y = (i.dragStartY - u.pageY) / f + m;
6616
6672
  g && y < 0 && (y = 0), h === "opacity" && y > 1 && (y = 1), i.onDrag(`${y}`), l(`${y}`);
6617
6673
  },
6618
6674
  [i],
@@ -6661,7 +6717,7 @@ const CoreBlock = ({
6661
6717
  } else
6662
6718
  p(o, r || null, a);
6663
6719
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
6664
- }, x = useFeature("dnd"), { t: f } = useTranslation();
6720
+ }, f = useFeature("dnd"), { t: x } = useTranslation();
6665
6721
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
6666
6722
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
6667
6723
  "button",
@@ -6674,15 +6730,15 @@ const CoreBlock = ({
6674
6730
  g([]), h();
6675
6731
  }, 200);
6676
6732
  },
6677
- draggable: x ? "true" : "false",
6733
+ draggable: f ? "true" : "false",
6678
6734
  className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
6679
6735
  children: [
6680
6736
  createElement(c || BoxIcon, { className: "w-4 h-4 mx-auto" }),
6681
- /* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(f(d || i)) })
6737
+ /* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(x(d || i)) })
6682
6738
  ]
6683
6739
  }
6684
6740
  ) }),
6685
- /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: f(d || i) }) })
6741
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: x(d || i) }) })
6686
6742
  ] }) });
6687
6743
  }, DefaultChaiBlocks = ({
6688
6744
  parentId: o,
@@ -6870,7 +6926,7 @@ const CoreBlock = ({
6870
6926
  }
6871
6927
  }
6872
6928
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
6873
- var h, m, x, f, y, b, v, B;
6929
+ var h, m, f, x, y, b, v, B;
6874
6930
  if (r.type === "comment") return [];
6875
6931
  let a = { _id: generateUUID() };
6876
6932
  if (n && (a._parent = n.block._id), r.type === "text")
@@ -6912,8 +6968,8 @@ const CoreBlock = ({
6912
6968
  ...a,
6913
6969
  href: ((h = l.find((_) => _.key === "href")) == null ? void 0 : h.value) || "",
6914
6970
  hrefType: ((m = l.find((_) => _.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
6915
- autoplay: ((x = l.find((_) => _.key === "data-autoplay")) == null ? void 0 : x.value) === "true" ? "true" : "false",
6916
- maxWidth: ((y = (f = l.find((_) => _.key === "data-maxwidth")) == null ? void 0 : f.value) == null ? void 0 : y.replace("px", "")) || "",
6971
+ autoplay: ((f = l.find((_) => _.key === "data-autoplay")) == null ? void 0 : f.value) === "true" ? "true" : "false",
6972
+ maxWidth: ((y = (x = l.find((_) => _.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : y.replace("px", "")) || "",
6917
6973
  backdropColor: ((b = l.find((_) => _.key === "data-overlay")) == null ? void 0 : b.value) || "",
6918
6974
  galleryName: ((v = l.find((_) => _.key === "data-gall")) == null ? void 0 : v.value) || ""
6919
6975
  }, forEach(w, (_) => {
@@ -7054,7 +7110,7 @@ const registerChaiLibrary = (o, n) => {
7054
7110
  parentId: r = void 0,
7055
7111
  position: a = -1
7056
7112
  }) => {
7057
- const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), x = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), y = (B) => {
7113
+ const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { 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 = (B) => {
7058
7114
  const w = has(B, "styles_attrs.data-page-section");
7059
7115
  return B._type === "Box" && w;
7060
7116
  }, b = useCallback(
@@ -7075,7 +7131,7 @@ const registerChaiLibrary = (o, n) => {
7075
7131
  {
7076
7132
  onClick: l ? () => {
7077
7133
  } : b,
7078
- draggable: x ? "true" : "false",
7134
+ draggable: f ? "true" : "false",
7079
7135
  onDragStart: async (B) => {
7080
7136
  const w = await c({ library: n, block: o });
7081
7137
  let _ = r;
@@ -7088,7 +7144,7 @@ const registerChaiLibrary = (o, n) => {
7088
7144
  };
7089
7145
  } else
7090
7146
  B.dataTransfer.setDragImage(new Image(), 0, 0);
7091
- f(E), setTimeout(() => {
7147
+ x(E), setTimeout(() => {
7092
7148
  u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7093
7149
  }, 200);
7094
7150
  }
@@ -7114,22 +7170,22 @@ const registerChaiLibrary = (o, n) => {
7114
7170
  ] }) })
7115
7171
  ] });
7116
7172
  }, UILibrarySection = ({ parentId: o, position: n }) => {
7117
- const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((k) => k.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), x = useRef(null);
7173
+ const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((k) => k.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), f = useRef(null);
7118
7174
  useEffect(() => {
7119
- c && c.length > 0 && (x.current = new Fuse(c, {
7175
+ c && c.length > 0 && (f.current = new Fuse(c, {
7120
7176
  keys: ["name", "label", "description", "group"],
7121
7177
  threshold: 0.4,
7122
7178
  ignoreLocation: !0
7123
7179
  }));
7124
7180
  }, [c]), useEffect(() => {
7125
- if (!u.trim() || !x.current) {
7181
+ if (!u.trim() || !f.current) {
7126
7182
  m([]);
7127
7183
  return;
7128
7184
  }
7129
- const k = x.current.search(u).map((j) => j.item);
7185
+ const k = f.current.search(u).map((j) => j.item);
7130
7186
  m(k);
7131
7187
  }, [u]);
7132
- const f = u.trim() && !isEmpty(h) ? h : c, y = groupBy(f, "group"), [b, v] = useState(null);
7188
+ const x = u.trim() && !isEmpty(h) ? h : c, y = groupBy(x, "group"), [b, v] = useState(null);
7133
7189
  useEffect(() => {
7134
7190
  if (isEmpty(keys(y))) {
7135
7191
  v(null);
@@ -7269,25 +7325,25 @@ const registerChaiLibrary = (o, n) => {
7269
7325
  error: c
7270
7326
  }), g(!0);
7271
7327
  else if (!l && Object.keys(a || {}).length > 0) {
7272
- const m = Object.entries(a).map(([f, y]) => {
7328
+ const m = Object.entries(a).map(([x, y]) => {
7273
7329
  const b = y, v = b.type || "partial", B = formatReadableName(v);
7274
7330
  return {
7275
7331
  type: "PartialBlock",
7276
7332
  // Set the type to PartialBlock
7277
- label: formatReadableName(b.name || f),
7333
+ label: formatReadableName(b.name || x),
7278
7334
  description: b.description || "",
7279
7335
  icon: Globe,
7280
7336
  group: B,
7281
7337
  // Use formatted type as group
7282
7338
  category: "partial",
7283
- partialBlockId: f,
7339
+ partialBlockId: x,
7284
7340
  // Store the original ID as partialBlockId
7285
7341
  _name: b.name
7286
7342
  };
7287
- }), x = uniq(map(m, "group"));
7343
+ }), f = uniq(map(m, "group"));
7288
7344
  p({
7289
7345
  blocks: m,
7290
- groups: x,
7346
+ groups: f,
7291
7347
  isLoading: !1,
7292
7348
  error: null
7293
7349
  }), g(!0);
@@ -7333,7 +7389,7 @@ const registerChaiLibrary = (o, n) => {
7333
7389
  has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
7334
7390
  }, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, position: a, gridCols: l = "grid-cols-4" }) => {
7335
7391
  var C;
7336
- const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (C = find(c, (k) => k._id === r)) == null ? void 0 : C._type, [m, x] = useState("all"), [f, y] = useState(null), b = useRef(null);
7392
+ const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (C = find(c, (k) => k._id === r)) == null ? void 0 : C._type, [m, f] = useState("all"), [x, y] = useState(null), b = useRef(null);
7337
7393
  useEffect(() => {
7338
7394
  const k = setTimeout(() => {
7339
7395
  var j;
@@ -7341,9 +7397,9 @@ const registerChaiLibrary = (o, n) => {
7341
7397
  }, 0);
7342
7398
  return () => clearTimeout(k);
7343
7399
  }, [g]), useEffect(() => {
7344
- d && (x("all"), y(null));
7400
+ d && (f("all"), y(null));
7345
7401
  }, [d]), useEffect(() => (b.current = debounce((k) => {
7346
- x(k);
7402
+ f(k);
7347
7403
  }, 500), () => {
7348
7404
  b.current && b.current.cancel();
7349
7405
  }), []);
@@ -7352,7 +7408,7 @@ const registerChaiLibrary = (o, n) => {
7352
7408
  }, []), B = useCallback(() => {
7353
7409
  y(null), b.current && b.current.cancel();
7354
7410
  }, []), w = useCallback((k) => {
7355
- b.current && b.current.cancel(), x(k), y(null);
7411
+ b.current && b.current.cancel(), f(k), y(null);
7356
7412
  }, []), _ = useMemo(
7357
7413
  () => d ? values(n).filter(
7358
7414
  (k) => {
@@ -7390,7 +7446,7 @@ const registerChaiLibrary = (o, n) => {
7390
7446
  onClick: () => w("all"),
7391
7447
  onMouseEnter: () => v("all"),
7392
7448
  onMouseLeave: B,
7393
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" || f === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7449
+ 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"}`,
7394
7450
  children: i("All")
7395
7451
  },
7396
7452
  "sidebar-all"
@@ -7401,7 +7457,7 @@ const registerChaiLibrary = (o, n) => {
7401
7457
  onClick: () => w(k),
7402
7458
  onMouseEnter: () => v(k),
7403
7459
  onMouseLeave: B,
7404
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === k || f === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7460
+ className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === k || x === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7405
7461
  children: capitalize(i(k.toLowerCase()))
7406
7462
  },
7407
7463
  `sidebar-${k}`
@@ -7442,7 +7498,7 @@ const registerChaiLibrary = (o, n) => {
7442
7498
  }, [i, g, c]);
7443
7499
  const m = useCallback(() => {
7444
7500
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7445
- }, []), x = useChaiAddBlockTabs(), f = p && h(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
7501
+ }, []), f = useChaiAddBlockTabs(), x = p && h(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
7446
7502
  return useEffect(() => {
7447
7503
  i === "library" && !b && c("core");
7448
7504
  }, [i, b, c]), /* @__PURE__ */ jsxs("div", { className: cn$2("flex h-full w-full flex-col overflow-hidden", o), children: [
@@ -7463,14 +7519,14 @@ const registerChaiLibrary = (o, n) => {
7463
7519
  b && /* @__PURE__ */ jsx(TabsTrigger, { value: "library", children: l("Library") }),
7464
7520
  /* @__PURE__ */ jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
7465
7521
  g && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
7466
- f ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
7467
- map(x, (v) => /* @__PURE__ */ jsx(TabsTrigger, { value: v.id, children: React__default.createElement(v.tab) }, `tab-add-block-${v.id}`))
7522
+ x ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
7523
+ map(f, (v) => /* @__PURE__ */ jsx(TabsTrigger, { value: v.id, children: React__default.createElement(v.tab) }, `tab-add-block-${v.id}`))
7468
7524
  ] }),
7469
7525
  /* @__PURE__ */ jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
7470
7526
  b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
7471
7527
  g && /* @__PURE__ */ jsx(TabsContent, { value: "partials", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(PartialBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
7472
- f ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
7473
- map(x, (v) => /* @__PURE__ */ jsx(TabsContent, { value: v.id, children: React__default.createElement(v.tabContent, { close: m, parentId: r, position: a }) }, `panel-add-block-${v.id}`))
7528
+ x ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
7529
+ map(f, (v) => /* @__PURE__ */ jsx(TabsContent, { value: v.id, children: React__default.createElement(v.tabContent, { close: m, parentId: r, position: a }) }, `panel-add-block-${v.id}`))
7474
7530
  ]
7475
7531
  }
7476
7532
  )
@@ -7780,7 +7836,7 @@ const Input = ({ node: o }) => {
7780
7836
  var R;
7781
7837
  const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
7782
7838
  let p = null;
7783
- const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: x, isSelected: f, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (T) => {
7839
+ const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (T) => {
7784
7840
  T.stopPropagation(), !l.includes(m) && o.toggle();
7785
7841
  }, _ = (T) => {
7786
7842
  T.isInternal && (p = T.isOpen, T.isOpen && T.close());
@@ -7828,7 +7884,7 @@ const Input = ({ node: o }) => {
7828
7884
  ),
7829
7885
  /* @__PURE__ */ jsx("br", {})
7830
7886
  ] });
7831
- const L = useMemo(() => has(x, "_libBlockId") && !isEmpty(x._libBlockId) && (d(PERMISSIONS.CREATE_LIBRARY_BLOCK) || d(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [x, d]);
7887
+ const L = useMemo(() => has(f, "_libBlockId") && !isEmpty(f._libBlockId) && (d(PERMISSIONS.CREATE_LIBRARY_BLOCK) || d(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [f, d]);
7832
7888
  return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
7833
7889
  "div",
7834
7890
  {
@@ -7867,12 +7923,12 @@ const Input = ({ node: o }) => {
7867
7923
  {
7868
7924
  className: cn(
7869
7925
  "group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 outline-none",
7870
- f ? "bg-primary text-primary-foreground" : "hover:bg-primary/10 dark:hover:bg-gray-800",
7871
- y && canAcceptChildBlock(x._type, "Icon") ? "bg-green-200" : "",
7926
+ x ? "bg-primary text-primary-foreground" : "hover:bg-primary/10 dark:hover:bg-gray-800",
7927
+ y && canAcceptChildBlock(f._type, "Icon") ? "bg-green-200" : "",
7872
7928
  (o == null ? void 0 : o.id) === S ? "bg-primary/10" : "",
7873
7929
  b && "opacity-20",
7874
7930
  l.includes(m) ? "opacity-50" : "",
7875
- L && f && "bg-primary/20 text-primary"
7931
+ L && x && "bg-primary/20 text-primary"
7876
7932
  ),
7877
7933
  children: [
7878
7934
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -7880,7 +7936,7 @@ const Input = ({ node: o }) => {
7880
7936
  "div",
7881
7937
  {
7882
7938
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
7883
- children: u && /* @__PURE__ */ jsx("button", { onClick: w, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${f ? "text-white" : "text-slate-400"}` }) })
7939
+ children: u && /* @__PURE__ */ jsx("button", { onClick: w, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-white" : "text-slate-400"}` }) })
7884
7940
  }
7885
7941
  ),
7886
7942
  /* @__PURE__ */ jsxs(
@@ -7889,10 +7945,10 @@ const Input = ({ node: o }) => {
7889
7945
  className: cn(
7890
7946
  "leading-1 flex items-center",
7891
7947
  L && "text-primary/60",
7892
- L && f && "text-primary/80"
7948
+ L && x && "text-primary/80"
7893
7949
  ),
7894
7950
  children: [
7895
- /* @__PURE__ */ jsx(TypeIcon, { type: x == null ? void 0 : x._type }),
7951
+ /* @__PURE__ */ jsx(TypeIcon, { type: f == null ? void 0 : f._type }),
7896
7952
  v ? /* @__PURE__ */ jsx(Input, { node: o }) : /* @__PURE__ */ jsx(
7897
7953
  "div",
7898
7954
  {
@@ -7900,7 +7956,7 @@ const Input = ({ node: o }) => {
7900
7956
  onDoubleClick: (T) => {
7901
7957
  T.stopPropagation(), o.edit(), o.deselect();
7902
7958
  },
7903
- children: /* @__PURE__ */ jsx("span", { children: getBlockDisplayName(x) })
7959
+ children: /* @__PURE__ */ jsx("span", { children: getBlockDisplayName(f) })
7904
7960
  }
7905
7961
  )
7906
7962
  ]
@@ -7908,7 +7964,7 @@ const Input = ({ node: o }) => {
7908
7964
  )
7909
7965
  ] }),
7910
7966
  /* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
7911
- canAddChildBlock(x == null ? void 0 : x._type) && !l.includes(m) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
7967
+ canAddChildBlock(f == null ? void 0 : f._type) && !l.includes(m) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
7912
7968
  /* @__PURE__ */ jsx(
7913
7969
  TooltipTrigger,
7914
7970
  {
@@ -8208,7 +8264,7 @@ const Input = ({ node: o }) => {
8208
8264
  B && typeof B == "object" && "fontFamily" in B && "borderRadius" in B && "colors" in B ? p(B) : console.error("Invalid preset structure:", B);
8209
8265
  } else
8210
8266
  console.error("Preset not found:", r);
8211
- }, x = useDebouncedCallback(
8267
+ }, f = useDebouncedCallback(
8212
8268
  (v, B) => {
8213
8269
  p(() => ({
8214
8270
  ...d,
@@ -8220,7 +8276,7 @@ const Input = ({ node: o }) => {
8220
8276
  },
8221
8277
  [d],
8222
8278
  200
8223
- ), f = useDebouncedCallback(
8279
+ ), x = useDebouncedCallback(
8224
8280
  (v) => {
8225
8281
  p(() => ({
8226
8282
  ...d,
@@ -8292,14 +8348,14 @@ const Input = ({ node: o }) => {
8292
8348
  {
8293
8349
  label: v,
8294
8350
  value: d.fontFamily[v.replace(/font-/g, "")] || B[Object.keys(B)[0]],
8295
- onChange: (w) => x(v, w)
8351
+ onChange: (w) => f(v, w)
8296
8352
  },
8297
8353
  v
8298
8354
  )) }),
8299
8355
  (u == null ? void 0 : u.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5 py-3", children: [
8300
8356
  /* @__PURE__ */ jsx(Label, { className: "text-sm", children: g("Border Radius") }),
8301
8357
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 py-2", children: [
8302
- /* @__PURE__ */ jsx(BorderRadiusInput, { value: d.borderRadius, onChange: f }),
8358
+ /* @__PURE__ */ jsx(BorderRadiusInput, { value: d.borderRadius, onChange: x }),
8303
8359
  /* @__PURE__ */ jsx("span", { className: "w-12 text-sm", children: d.borderRadius })
8304
8360
  ] })
8305
8361
  ] }),
@@ -8799,11 +8855,11 @@ function QuickPrompts({ onClick: o }) {
8799
8855
  const AIUserPrompt = ({ blockId: o }) => {
8800
8856
  const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, g] = useState(), h = useRef(null), m = useRef(null);
8801
8857
  useEffect(() => {
8802
- var f;
8803
- (f = h.current) == null || f.focus();
8858
+ var x;
8859
+ (x = h.current) == null || x.focus();
8804
8860
  }, []);
8805
- const x = (f) => {
8806
- const { usage: y } = f || {};
8861
+ const f = (x) => {
8862
+ const { usage: y } = x || {};
8807
8863
  !l && y && g(y), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
8808
8864
  };
8809
8865
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
@@ -8824,12 +8880,12 @@ const AIUserPrompt = ({ blockId: o }) => {
8824
8880
  {
8825
8881
  ref: h,
8826
8882
  value: i,
8827
- onChange: (f) => c(f.target.value),
8883
+ onChange: (x) => c(x.target.value),
8828
8884
  placeholder: n("Ask AI to edit content"),
8829
8885
  className: "w-full",
8830
8886
  rows: 3,
8831
- onKeyDown: (f) => {
8832
- f.key === "Enter" && (f.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, x));
8887
+ onKeyDown: (x) => {
8888
+ x.key === "Enter" && (x.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, f));
8833
8889
  }
8834
8890
  }
8835
8891
  ),
@@ -8839,7 +8895,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8839
8895
  {
8840
8896
  disabled: i.trim().length < 5 || a,
8841
8897
  onClick: () => {
8842
- m.current && clearTimeout(m.current), g(void 0), r("content", o, i, x);
8898
+ m.current && clearTimeout(m.current), g(void 0), r("content", o, i, f);
8843
8899
  },
8844
8900
  variant: "default",
8845
8901
  className: "w-fit",
@@ -8871,8 +8927,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8871
8927
  /* @__PURE__ */ jsx(
8872
8928
  QuickPrompts,
8873
8929
  {
8874
- onClick: (f) => {
8875
- m.current && clearTimeout(m.current), g(void 0), r("content", o, f, x);
8930
+ onClick: (x) => {
8931
+ m.current && clearTimeout(m.current), g(void 0), r("content", o, x, f);
8876
8932
  }
8877
8933
  }
8878
8934
  )
@@ -8889,8 +8945,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8889
8945
  const m = async () => {
8890
8946
  try {
8891
8947
  d(!0), u(null), await i(r), toast.success(o("Updated AI Context")), h.current.click();
8892
- } catch (x) {
8893
- u(x);
8948
+ } catch (f) {
8949
+ u(f);
8894
8950
  } finally {
8895
8951
  d(!1);
8896
8952
  }
@@ -8898,8 +8954,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8898
8954
  return /* @__PURE__ */ jsx(
8899
8955
  Accordion,
8900
8956
  {
8901
- onValueChange: (x) => {
8902
- g(x !== "");
8957
+ onValueChange: (f) => {
8958
+ g(f !== "");
8903
8959
  },
8904
8960
  type: "single",
8905
8961
  collapsible: !0,
@@ -8911,12 +8967,12 @@ const AIUserPrompt = ({ blockId: o }) => {
8911
8967
  {
8912
8968
  ref: l,
8913
8969
  value: r,
8914
- onChange: (x) => a(x.target.value),
8970
+ onChange: (f) => a(f.target.value),
8915
8971
  placeholder: o("Tell about this page eg this page is about"),
8916
8972
  className: "mt-1 w-full",
8917
8973
  rows: 10,
8918
- onKeyDown: (x) => {
8919
- x.key === "Enter" && (x.preventDefault(), m());
8974
+ onKeyDown: (f) => {
8975
+ f.key === "Enter" && (f.preventDefault(), m());
8920
8976
  }
8921
8977
  }
8922
8978
  ),
@@ -9037,7 +9093,7 @@ function AIChatPanel() {
9037
9093
  }, 1500);
9038
9094
  }, m = (b) => {
9039
9095
  b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
9040
- }, x = (b) => {
9096
+ }, f = (b) => {
9041
9097
  var B;
9042
9098
  const v = (B = b.target.files) == null ? void 0 : B[0];
9043
9099
  if (v) {
@@ -9047,7 +9103,7 @@ function AIChatPanel() {
9047
9103
  d((E = _.target) == null ? void 0 : E.result);
9048
9104
  }, w.readAsDataURL(v);
9049
9105
  }
9050
- }, f = () => {
9106
+ }, x = () => {
9051
9107
  var b;
9052
9108
  (b = p.current) == null || b.click();
9053
9109
  }, y = () => {
@@ -9114,14 +9170,14 @@ function AIChatPanel() {
9114
9170
  className: "max-h-[120px] min-h-[40px] resize-none border-0 bg-muted/50 py-2.5 pr-10 focus-visible:ring-1"
9115
9171
  }
9116
9172
  ),
9117
- /* @__PURE__ */ jsx("input", { type: "file", ref: p, onChange: x, accept: "image/*", className: "hidden" }),
9173
+ /* @__PURE__ */ jsx("input", { type: "file", ref: p, onChange: f, accept: "image/*", className: "hidden" }),
9118
9174
  /* @__PURE__ */ jsx(
9119
9175
  Button,
9120
9176
  {
9121
9177
  size: "icon",
9122
9178
  variant: "ghost",
9123
9179
  className: "absolute bottom-2 right-2 h-6 w-6",
9124
- onClick: f,
9180
+ onClick: x,
9125
9181
  children: /* @__PURE__ */ jsx(Image$1, { className: "h-4 w-4 text-muted-foreground" })
9126
9182
  }
9127
9183
  )
@@ -9239,7 +9295,7 @@ const AiAssistant = () => {
9239
9295
  preloadedAttributes: n = [],
9240
9296
  onAttributesChange: r
9241
9297
  }) {
9242
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""), x = useRef(null), f = useRef(null), y = usePageExternalData();
9298
+ 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();
9243
9299
  useEffect(() => {
9244
9300
  l(n);
9245
9301
  }, [n]);
@@ -9277,7 +9333,7 @@ const AiAssistant = () => {
9277
9333
  prefixLength: L.length,
9278
9334
  suffixLength: R.length
9279
9335
  };
9280
- }, C = f.current;
9336
+ }, C = x.current;
9281
9337
  if (C) {
9282
9338
  const k = C.selectionStart || 0, j = C.value || "", I = C.selectionEnd || k;
9283
9339
  if (I > k) {
@@ -9308,7 +9364,7 @@ const AiAssistant = () => {
9308
9364
  autoCorrect: "off",
9309
9365
  spellCheck: "false",
9310
9366
  id: "attrKey",
9311
- ref: x,
9367
+ ref: f,
9312
9368
  value: i,
9313
9369
  onChange: (S) => c(S.target.value),
9314
9370
  placeholder: "Enter Key",
@@ -9329,7 +9385,7 @@ const AiAssistant = () => {
9329
9385
  spellCheck: "false",
9330
9386
  id: "attrValue",
9331
9387
  rows: 2,
9332
- ref: f,
9388
+ ref: x,
9333
9389
  value: d,
9334
9390
  onChange: (S) => p(S.target.value),
9335
9391
  onKeyDown: _,
@@ -9372,30 +9428,37 @@ const AiAssistant = () => {
9372
9428
  );
9373
9429
  return /* @__PURE__ */ jsx("div", { className: "flex-col gap-y-2", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AttrsEditor, { preloadedAttributes: n, onAttributesChange: c }) }) }) });
9374
9430
  }), NoopComponent = () => null, ResetStylesButton = () => {
9375
- const { resetAll: o } = useResetBlockStyles(), { t: n } = useTranslation();
9376
- return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
9377
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
9378
- "button",
9379
- {
9380
- type: "button",
9381
- className: " p-0.5 rounded-sm hover:bg-gray-300",
9382
- onClick: (r) => r.stopPropagation(),
9383
- children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" })
9384
- }
9385
- ) }),
9386
- /* @__PURE__ */ jsx(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: /* @__PURE__ */ jsxs(
9387
- DropdownMenuItem,
9388
- {
9389
- className: "flex items-center gap-1 text-xs",
9390
- onClick: () => {
9391
- o();
9392
- },
9393
- children: [
9394
- /* @__PURE__ */ jsx(ResetIcon, { className: "h-3 w-3" }),
9395
- n("Reset styles")
9396
- ]
9397
- }
9398
- ) })
9431
+ const { resetAll: o } = useResetBlockStyles(), n = useSelectedBlock(), [r] = useSelectedStylingBlocks(), a = useRemoveAllClassesForBlock(), { t: l } = useTranslation();
9432
+ return !n || isEmpty(r) ? null : /* @__PURE__ */ jsxs(DropdownMenu, { children: [
9433
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("div", { className: "inline-flex rounded-sm p-0.5 hover:bg-gray-300", onClick: (i) => i.stopPropagation(), children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" }) }) }),
9434
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: [
9435
+ /* @__PURE__ */ jsxs(
9436
+ DropdownMenuItem,
9437
+ {
9438
+ className: "flex items-center gap-1 text-xs",
9439
+ onClick: () => {
9440
+ o();
9441
+ },
9442
+ children: [
9443
+ /* @__PURE__ */ jsx(ResetIcon, { className: "h-3 w-3" }),
9444
+ l("Reset styles")
9445
+ ]
9446
+ }
9447
+ ),
9448
+ /* @__PURE__ */ jsxs(
9449
+ DropdownMenuItem,
9450
+ {
9451
+ className: "text-xs",
9452
+ onClick: () => {
9453
+ n && a(n, !0);
9454
+ },
9455
+ children: [
9456
+ /* @__PURE__ */ jsx(Cross2Icon, { className: "h-3 w-3" }),
9457
+ l("Clear styles")
9458
+ ]
9459
+ }
9460
+ )
9461
+ ] })
9399
9462
  ] });
9400
9463
  };
9401
9464
  function BlockAttributesToggle() {
@@ -9515,28 +9578,28 @@ const RootLayout = () => {
9515
9578
  r(n === S ? null : S);
9516
9579
  },
9517
9580
  [n]
9518
- ), { t: x } = useTranslation(), f = useMemo(
9581
+ ), { t: f } = useTranslation(), x = useMemo(
9519
9582
  () => [...p, ...u, ...g],
9520
9583
  [p, u, g]
9521
- ), y = useBuilderProp("htmlDir", "ltr"), b = find(f, { id: n }) ?? first(f), v = get(b, "width", DEFAULT_PANEL_WIDTH);
9584
+ ), y = useBuilderProp("htmlDir", "ltr"), b = find(x, { id: n }) ?? first(x), v = get(b, "width", DEFAULT_PANEL_WIDTH);
9522
9585
  useEffect(() => {
9523
9586
  if (n !== null) {
9524
- const S = find(f, { id: n });
9587
+ const S = find(x, { id: n });
9525
9588
  S && get(S, "view", "standard") === "standard" && (a.current = n, i(get(S, "width", DEFAULT_PANEL_WIDTH)));
9526
9589
  }
9527
- }, [n, f]);
9590
+ }, [n, x]);
9528
9591
  const B = useMemo(() => {
9529
9592
  if (n === null) return 0;
9530
- const S = find(f, { id: n });
9593
+ const S = find(x, { id: n });
9531
9594
  return get(S, "view", "standard") === "standard" ? v : l;
9532
- }, [n, v, l, f]), w = useCallback(() => {
9595
+ }, [n, v, l, x]), w = useCallback(() => {
9533
9596
  r(a.current);
9534
9597
  }, [r]), _ = useCallback(() => {
9535
9598
  r("outline");
9536
9599
  }, [r]);
9537
9600
  useEffect(() => {
9538
- find(f, { id: n }) || r("outline");
9539
- }, [n, f]);
9601
+ find(x, { id: n }) || r("outline");
9602
+ }, [n, x]);
9540
9603
  const E = useCallback(
9541
9604
  (S) => {
9542
9605
  m(S);
@@ -9560,7 +9623,7 @@ const RootLayout = () => {
9560
9623
  isActive: n === S.id,
9561
9624
  show: () => E(S.id)
9562
9625
  }) }),
9563
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(S.label) }) })
9626
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
9564
9627
  ] }, "button-top-" + A)) }),
9565
9628
  /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
9566
9629
  /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((S, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
@@ -9570,7 +9633,7 @@ const RootLayout = () => {
9570
9633
  isActive: n === S.id,
9571
9634
  show: () => E(S.id)
9572
9635
  }) }),
9573
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(S.label) }) })
9636
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
9574
9637
  ] }, "button-bottom-" + A)) })
9575
9638
  ] }),
9576
9639
  /* @__PURE__ */ jsx(
@@ -9586,7 +9649,7 @@ const RootLayout = () => {
9586
9649
  "div",
9587
9650
  {
9588
9651
  className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(b, "isInternal", !1) ? "" : "w-64"}`,
9589
- children: /* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
9652
+ children: /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9590
9653
  }
9591
9654
  ),
9592
9655
  /* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {}) }) })
@@ -9609,11 +9672,11 @@ const RootLayout = () => {
9609
9672
  /* @__PURE__ */ jsx("h2", { className: "-mt-1 flex items-center space-x-1 text-base font-bold", children: /* @__PURE__ */ jsx("div", { className: "flex grow items-center gap-2", children: /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-between gap-2", children: c === "ai" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9610
9673
  /* @__PURE__ */ jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
9611
9674
  " ",
9612
- x("AI Assistant")
9675
+ f("AI Assistant")
9613
9676
  ] }) }) : c === "theme" ? /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
9614
9677
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
9615
9678
  /* @__PURE__ */ jsx(Paintbrush, { className: "h-4 w-4 rtl:ml-2" }),
9616
- x("Theme Settings")
9679
+ f("Theme Settings")
9617
9680
  ] }),
9618
9681
  /* @__PURE__ */ jsx(
9619
9682
  Button,
@@ -9644,7 +9707,7 @@ const RootLayout = () => {
9644
9707
  children: [
9645
9708
  /* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
9646
9709
  /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
9647
- /* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
9710
+ /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9648
9711
  ] }) }),
9649
9712
  /* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
9650
9713
  close: _
@@ -9656,7 +9719,7 @@ const RootLayout = () => {
9656
9719
  n !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${v}px` }, children: [
9657
9720
  /* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
9658
9721
  /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
9659
- /* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
9722
+ /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9660
9723
  ] }) }),
9661
9724
  /* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
9662
9725
  close: _
@@ -9682,7 +9745,7 @@ const RootLayout = () => {
9682
9745
  /* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
9683
9746
  /* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
9684
9747
  /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
9685
- /* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
9748
+ /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9686
9749
  ] }),
9687
9750
  /* @__PURE__ */ jsx(Button, { onClick: () => w(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
9688
9751
  ] }),
@@ -9726,36 +9789,36 @@ const RootLayout = () => {
9726
9789
  }) => {
9727
9790
  const a = useChaiFeatureFlags(), [l, i] = useState(""), [c, d] = useState(!1), [p, u] = useState({ x: 0, y: 0 }), g = useMemo(() => {
9728
9791
  if (!l.trim()) return a;
9729
- const f = l.toLowerCase();
9792
+ const x = l.toLowerCase();
9730
9793
  return Object.fromEntries(
9731
9794
  Object.entries(a).filter(([y, b]) => {
9732
9795
  var v;
9733
- return (y == null ? void 0 : y.toLowerCase().includes(f)) || ((v = b == null ? void 0 : b.description) == null ? void 0 : v.toLowerCase().includes(f));
9796
+ return (y == null ? void 0 : y.toLowerCase().includes(x)) || ((v = b == null ? void 0 : b.description) == null ? void 0 : v.toLowerCase().includes(x));
9734
9797
  })
9735
9798
  );
9736
- }, [a, l]), h = (f) => {
9799
+ }, [a, l]), h = (x) => {
9737
9800
  d(!0), u({
9738
- x: f.clientX - n.x,
9739
- y: f.clientY - n.y
9801
+ x: x.clientX - n.x,
9802
+ y: x.clientY - n.y
9740
9803
  });
9741
- }, m = (f) => {
9804
+ }, m = (x) => {
9742
9805
  if (!c) return;
9743
- const y = f.clientX - p.x, b = f.clientY - p.y, v = f.currentTarget, B = v.offsetWidth, w = v.offsetHeight, _ = window.innerWidth - B, E = window.innerHeight - w, S = Math.max(0, Math.min(y, _)), A = Math.max(0, Math.min(b, E));
9806
+ const y = x.clientX - p.x, b = x.clientY - p.y, v = x.currentTarget, B = v.offsetWidth, w = v.offsetHeight, _ = window.innerWidth - B, E = window.innerHeight - w, S = Math.max(0, Math.min(y, _)), A = Math.max(0, Math.min(b, E));
9744
9807
  r(S, A);
9745
- }, x = () => {
9808
+ }, f = () => {
9746
9809
  d(!1);
9747
9810
  };
9748
9811
  return useEffect(() => {
9749
- const f = () => {
9812
+ const x = () => {
9750
9813
  c && d(!1);
9751
9814
  };
9752
- return window.addEventListener("mouseup", f), () => window.removeEventListener("mouseup", f);
9815
+ return window.addEventListener("mouseup", x), () => window.removeEventListener("mouseup", x);
9753
9816
  }, [c]), !n || n.x < 0 || n.y < 0 ? null : /* @__PURE__ */ jsxs(
9754
9817
  "div",
9755
9818
  {
9756
9819
  onMouseDown: h,
9757
9820
  onMouseMove: m,
9758
- onMouseUp: x,
9821
+ onMouseUp: f,
9759
9822
  className: "fixed z-[9999999] select-none rounded-md border border-gray-300 bg-white p-3 shadow-2xl",
9760
9823
  style: {
9761
9824
  left: n.x,
@@ -9797,13 +9860,13 @@ const RootLayout = () => {
9797
9860
  placeholder: "Search features...",
9798
9861
  className: "w-full pl-8",
9799
9862
  value: l,
9800
- onChange: (f) => i(f.target.value),
9863
+ onChange: (x) => i(x.target.value),
9801
9864
  autoFocus: !0
9802
9865
  }
9803
9866
  )
9804
9867
  ] })
9805
9868
  ] }),
9806
- /* @__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(([f, y]) => /* @__PURE__ */ jsx(FeatureToggle, { featureKey: f, options: y }, f)) }) : /* @__PURE__ */ jsx("div", { className: "py-8 text-center", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
9869
+ /* @__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: [
9807
9870
  'No features found matching "',
9808
9871
  l,
9809
9872
  '"'
@@ -9914,17 +9977,17 @@ const RootLayout = () => {
9914
9977
  for (const i of n.p)
9915
9978
  l.add(i);
9916
9979
  return l;
9917
- }, BUILDING_BLOCKS = Symbol(), buildStore = (o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = {}, d = (m, ...x) => m.read(...x), p = (m, ...x) => m.write(...x), u = (m, x) => {
9918
- var f;
9919
- return (f = m.unstable_onInit) == null ? void 0 : f.call(m, x);
9920
- }, g = (m, x) => {
9921
- var f;
9922
- return (f = m.onMount) == null ? void 0 : f.call(m, x);
9980
+ }, BUILDING_BLOCKS = Symbol(), buildStore = (o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = {}, d = (m, ...f) => m.read(...f), p = (m, ...f) => m.write(...f), u = (m, f) => {
9981
+ var x;
9982
+ return (x = m.unstable_onInit) == null ? void 0 : x.call(m, f);
9983
+ }, g = (m, f) => {
9984
+ var x;
9985
+ return (x = m.onMount) == null ? void 0 : x.call(m, f);
9923
9986
  }, ...h) => {
9924
9987
  const m = h[0] || ((A) => {
9925
9988
  let N = o.get(A);
9926
9989
  return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(A, N), u == null || u(A, S)), N;
9927
- }), x = h[1] || (() => {
9990
+ }), f = h[1] || (() => {
9928
9991
  let A, N;
9929
9992
  const C = (k) => {
9930
9993
  try {
@@ -9939,11 +10002,11 @@ const RootLayout = () => {
9939
10002
  a.forEach((I) => {
9940
10003
  var L;
9941
10004
  return (L = n.get(I)) == null ? void 0 : L.l.forEach(j);
9942
- }), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), k.forEach(C), a.size && f();
10005
+ }), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), k.forEach(C), a.size && x();
9943
10006
  } while (a.size || i.size || l.size);
9944
10007
  if (A)
9945
10008
  throw N;
9946
- }), f = h[2] || (() => {
10009
+ }), x = h[2] || (() => {
9947
10010
  const A = [], N = /* @__PURE__ */ new WeakSet(), C = /* @__PURE__ */ new WeakSet(), k = Array.from(a);
9948
10011
  for (; k.length; ) {
9949
10012
  const j = k[k.length - 1], I = m(j);
@@ -9983,7 +10046,7 @@ const RootLayout = () => {
9983
10046
  k.d.clear();
9984
10047
  let j = !0;
9985
10048
  const I = () => {
9986
- n.has(A) && (B(A), f(), x());
10049
+ n.has(A) && (B(A), x(), f());
9987
10050
  }, L = (P) => {
9988
10051
  var $;
9989
10052
  if (isSelfAtom(A, P)) {
@@ -10013,7 +10076,7 @@ const RootLayout = () => {
10013
10076
  try {
10014
10077
  return v(A, ...P);
10015
10078
  } finally {
10016
- f(), x();
10079
+ x(), f();
10017
10080
  }
10018
10081
  }), T;
10019
10082
  }
@@ -10053,7 +10116,7 @@ const RootLayout = () => {
10053
10116
  } else
10054
10117
  return v(I, ...L);
10055
10118
  } finally {
10056
- C || (f(), x());
10119
+ C || (x(), f());
10057
10120
  }
10058
10121
  };
10059
10122
  try {
@@ -10096,7 +10159,7 @@ const RootLayout = () => {
10096
10159
  try {
10097
10160
  return v(A, ...R);
10098
10161
  } finally {
10099
- I || (f(), x());
10162
+ I || (x(), f());
10100
10163
  }
10101
10164
  };
10102
10165
  try {
@@ -10149,8 +10212,8 @@ const RootLayout = () => {
10149
10212
  g,
10150
10213
  // building-block functions
10151
10214
  m,
10152
- x,
10153
10215
  f,
10216
+ x,
10154
10217
  y,
10155
10218
  b,
10156
10219
  v,
@@ -10163,13 +10226,13 @@ const RootLayout = () => {
10163
10226
  try {
10164
10227
  return v(A, ...N);
10165
10228
  } finally {
10166
- f(), x();
10229
+ x(), f();
10167
10230
  }
10168
10231
  },
10169
10232
  sub: (A, N) => {
10170
10233
  const k = w(A).l;
10171
- return k.add(N), x(), () => {
10172
- k.delete(N), _(A), x();
10234
+ return k.add(N), f(), () => {
10235
+ k.delete(N), _(A), f();
10173
10236
  };
10174
10237
  }
10175
10238
  };
@@ -10364,6 +10427,7 @@ export {
10364
10427
  usePasteBlocks,
10365
10428
  usePermissions,
10366
10429
  usePreviewMode,
10430
+ useRemoveAllClassesForBlock,
10367
10431
  useRemoveBlocks,
10368
10432
  useRemoveClassesFromBlocks,
10369
10433
  useResetBlockStyles,