@chaibuilder/sdk 2.2.34 → 2.2.35

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
@@ -3,15 +3,15 @@ var F = (o, n, r) => n in o ? V(o, n, { enumerable: !0, configurable: !0, writab
3
3
  var H = (o, n, r) => F(o, typeof n != "symbol" ? n + "" : n, r);
4
4
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
5
  import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredFonts, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
6
- import { BoxModelIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, LoopIcon, InfoCircledIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, Cross1Icon, BoxIcon, MinusIcon, CrossCircledIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, CaretRightIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, CheckIcon, ResetIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
6
+ import { BoxModelIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, LoopIcon, ResetIcon, InfoCircledIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, Cross1Icon, BoxIcon, MinusIcon, CrossCircledIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, CaretRightIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, CheckIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
7
7
  import { get, find, filter, flatten, has, map, includes, without, compact, reverse, findIndex, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, uniq, flatMapDeep, some, sortBy, round } from "lodash-es";
8
8
  import * as React from "react";
9
9
  import React__default, { useMemo, useCallback, useEffect, useState, useRef, Component, Children, memo, createElement, createContext, useContext, Suspense, useReducer, useDebugValue } from "react";
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 { B as Button, Z as DropdownMenu, ab as DropdownMenuTrigger, $ as DropdownMenuContent, a1 as DropdownMenuItem, c as cn$1, ay as Skeleton, e as Alert, f as AlertDescription, af as Input$1, P as Dialog, Y as DialogTrigger, R as DialogContent, ah as Popover, aG as Tooltip, aJ as TooltipTrigger, ak as PopoverTrigger, aH as TooltipContent, aj as PopoverContent, G as Command, I as CommandInput, J as CommandList, K as CommandEmpty, L as CommandGroup, M as CommandItem, U as DialogHeader, X as DialogTitle, v as Badge, a as AccordionItem, b as AccordionTrigger, d as AccordionContent, a2 as DropdownMenuLabel, a6 as DropdownMenuSeparator, _ as DropdownMenuCheckboxItem, ac as HoverCard, ae as HoverCardTrigger, ad as HoverCardContent, aF as Textarea, A as Accordion, C as Card, E as CardHeader, z as CardDescription, y as CardContent, ag as Label, D as CardFooter, al as ScrollArea, aB as Tabs, aD as TabsList, aE as TabsTrigger, aC as TabsContent, h as AlertDialog, r as AlertDialogTrigger, k as AlertDialogContent, n as AlertDialogHeader, q as AlertDialogTitle, l as AlertDialogDescription, m as AlertDialogFooter, j as AlertDialogCancel, i as AlertDialogAction, aA as Switch, s as Avatar, an as Separator, aI as TooltipProvider, ao as Sheet, aq as SheetContent, at as SheetHeader, aw as SheetTitle, az as Toaster } from "./sooner-H65duPYc.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, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, MoreVertical, 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, b9 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, b5 as Tooltip, b8 as TooltipTrigger, ay as PopoverTrigger, b6 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, b2 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, a_ as Tabs, b0 as TabsList, b1 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, aZ as Switch, r as Avatar, aL as Separator, b7 as TooltipProvider, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle, aY as Toaster } from "./toggle-BFR6fqvM.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";
15
15
  import clsx$1, { clsx } from "clsx";
16
16
  import { twMerge } from "tailwind-merge";
17
17
  import TreeModel from "tree-model";
@@ -32,6 +32,7 @@ import { useEditor, BubbleMenu as BubbleMenu$1, EditorContent } from "@tiptap/re
32
32
  import StarterKit from "@tiptap/starter-kit";
33
33
  import RjForm from "@rjsf/core";
34
34
  import validator from "@rjsf/validator-ajv8";
35
+ import "next-themes";
35
36
  import Autosuggest from "react-autosuggest";
36
37
  import { useFeature, FlagsProvider } from "flagged";
37
38
  import { parse, stringify } from "himalaya";
@@ -47,7 +48,6 @@ import twContainer from "@tailwindcss/container-queries";
47
48
  import { ErrorBoundary } from "react-error-boundary";
48
49
  import { motion } from "framer-motion";
49
50
  import { useHotkeys } from "react-hotkeys-hook";
50
- import "next-themes";
51
51
  import { flip } from "@floating-ui/dom";
52
52
  import { useFloating, shift } from "@floating-ui/react-dom";
53
53
  import ReactDOM from "react-dom";
@@ -297,12 +297,12 @@ class PubSub {
297
297
  }
298
298
  }
299
299
  const pubsub = new PubSub(), AddBlockDropdown = ({ block: o, children: n }) => {
300
- const { t: r } = useTranslation(), [a] = useBlocksStore(), { hasPermission: l } = usePermissions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(a, (h) => c ? get(h, "_parent") === c : !get(h, "_parent")), p = canAddChildBlock(get(o, "_type", "")), u = findIndex(d, { _id: i }), g = (h) => {
301
- if (h === "CHILD")
300
+ const { t: r } = useTranslation(), [a] = useBlocksStore(), { hasPermission: l } = usePermissions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(a, (m) => c ? get(m, "_parent") === c : !get(m, "_parent")), p = canAddChildBlock(get(o, "_type", "")), u = findIndex(d, { _id: i }), g = (m) => {
301
+ if (m === "CHILD")
302
302
  pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, o);
303
303
  else {
304
- const m = { _id: c || "", position: d == null ? void 0 : d.length };
305
- h === "BEFORE" ? m.position = Math.max(u, 0) : h === "AFTER" && (m.position = u + 1), pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, m);
304
+ const h = { _id: c || "", position: d == null ? void 0 : d.length };
305
+ m === "BEFORE" ? h.position = Math.max(u, 0) : m === "AFTER" && (h.position = u + 1), pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, h);
306
306
  }
307
307
  };
308
308
  return l(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
@@ -337,16 +337,16 @@ function insertBlocksAtPosition(o, n, r, a) {
337
337
  let i = [...o];
338
338
  if (r) {
339
339
  const u = o.find((g) => g._id === r);
340
- if (u && u.content !== void 0 && u.content !== "" && !o.some((h) => h._parent === r)) {
341
- const m = {
340
+ if (u && u.content !== void 0 && u.content !== "" && !o.some((m) => m._parent === r)) {
341
+ const h = {
342
342
  _id: generateUUID(),
343
343
  _parent: r,
344
344
  _type: "Text",
345
345
  content: u.content
346
346
  };
347
347
  Object.keys(u).forEach((f) => {
348
- f.startsWith("content-") && (m[f] = u[f]);
349
- }), l.unshift(m), i = i.map((f) => {
348
+ f.startsWith("content-") && (h[f] = u[f]);
349
+ }), l.unshift(h), i = i.map((f) => {
350
350
  if (f._id === r) {
351
351
  const x = { ...f, content: "" };
352
352
  return Object.keys(x).forEach((k) => {
@@ -386,13 +386,13 @@ function moveNode(o, n, r, a) {
386
386
  const l = findNodeById(o, n), i = findNodeById(o, r);
387
387
  if (!l || !i) return !1;
388
388
  i.children || (i.model.children = []);
389
- let c = (u = i == null ? void 0 : i.children) == null ? void 0 : u.findIndex((h) => h.model._id === n);
389
+ let c = (u = i == null ? void 0 : i.children) == null ? void 0 : u.findIndex((m) => m.model._id === n);
390
390
  l.drop(), c = Math.max(c, 0);
391
391
  const p = (((g = l == null ? void 0 : l.model) == null ? void 0 : g._parent) || "root") === r && c <= a ? a - 1 : a;
392
392
  try {
393
393
  i.addChildAtIndex(l, p);
394
- } catch (h) {
395
- return console.error("Error adding child to parent:", h), !1;
394
+ } catch (m) {
395
+ return console.error("Error adding child to parent:", m), !1;
396
396
  }
397
397
  return !0;
398
398
  }
@@ -433,8 +433,8 @@ function handleNewParentTextBlock(o, n, r) {
433
433
  const d = o.map((u) => {
434
434
  if (u._id === r) {
435
435
  const g = { ...u, content: "" };
436
- return Object.keys(g).forEach((h) => {
437
- h.startsWith("content-") && (g[h] = "");
436
+ return Object.keys(g).forEach((m) => {
437
+ m.startsWith("content-") && (g[m] = "");
438
438
  }), g;
439
439
  }
440
440
  return u;
@@ -451,7 +451,7 @@ function moveBlocksWithChildren(o, n, r, a) {
451
451
  const c = r || "root", p = new TreeModel().parse({ _id: "root", children: getBlocksTree(i) });
452
452
  if (moveNode(p, n, c, a)) {
453
453
  let u = flattenTree(p);
454
- const g = u.find((h) => h._id === n);
454
+ const g = u.find((m) => m._id === n);
455
455
  return g && (g._parent = c === "root" ? null : c), u.shift(), r && (u = handleNewParentTextBlock(u, l, r)), u;
456
456
  }
457
457
  return i;
@@ -475,22 +475,22 @@ const broadcastChannel = new BroadcastChannel("chaibuilder"), useBroadcastChanne
475
475
  }, removeNestedBlocks = (o, n) => {
476
476
  let r = [...o], a = [];
477
477
  n.forEach((d) => {
478
- const p = r.find((h) => h._id === d);
478
+ const p = r.find((m) => m._id === d);
479
479
  if (!p || !p._parent) return;
480
- const u = p._parent, g = r.filter((h) => h._parent === u);
480
+ const u = p._parent, g = r.filter((m) => m._parent === u);
481
481
  if (g.length === 2) {
482
- const h = g.find((m) => m._id !== d);
483
- if (h && h._type === "Text") {
484
- const m = r.find((f) => f._id === u);
485
- m && "content" in m && (r = r.map((f) => {
482
+ const m = g.find((h) => h._id !== d);
483
+ if (m && m._type === "Text") {
484
+ const h = r.find((f) => f._id === u);
485
+ h && "content" in h && (r = r.map((f) => {
486
486
  if (f._id === u) {
487
- const x = { ...f, content: h.content };
488
- return Object.keys(h).forEach((k) => {
489
- k.startsWith("content-") && (x[k] = h[k]);
487
+ const x = { ...f, content: m.content };
488
+ return Object.keys(m).forEach((k) => {
489
+ k.startsWith("content-") && (x[k] = m[k]);
490
490
  }), x;
491
491
  }
492
492
  return f;
493
- }), a.push(h._id));
493
+ }), a.push(m._id));
494
494
  }
495
495
  }
496
496
  });
@@ -572,7 +572,7 @@ const useBlockRepeaterDataAtom = () => useAtom$1(blockRepeaterDataAtom), useAsyn
572
572
  status: "idle",
573
573
  props: {},
574
574
  error: void 0
575
- }), 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
+ }), 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}`), m = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
576
576
  return useEffect(() => {
577
577
  if (n === "mock") {
578
578
  if (isFunction(a)) {
@@ -584,7 +584,7 @@ const useBlockRepeaterDataAtom = () => useAtom$1(blockRepeaterDataAtom), useAsyn
584
584
  }
585
585
  return;
586
586
  }
587
- n === "live" && (!g && !h || (i((f) => ({ ...f, status: "loading", props: {} })), d({ block: o }).then((f = {}) => {
587
+ n === "live" && (!g && !m || (i((f) => ({ ...f, status: "loading", props: {} })), d({ block: o }).then((f = {}) => {
588
588
  g ? (p((x) => ({
589
589
  ...x,
590
590
  [o._id]: {
@@ -599,7 +599,7 @@ const useBlockRepeaterDataAtom = () => useAtom$1(blockRepeaterDataAtom), useAsyn
599
599
  [o._id]: { status: "error", error: f, props: [] }
600
600
  })), i((x) => ({ ...x, status: "error", error: f, props: {} }))) : i((x) => ({ ...x, status: "error", error: f, props: {} }));
601
601
  })));
602
- }, [o == null ? void 0 : o._id, u, g, h, a, n]), {
602
+ }, [o == null ? void 0 : o._id, u, g, m, a, n]), {
603
603
  $loading: get(l, "status") === "loading",
604
604
  ...o ? get(l, "props", {}) : {}
605
605
  };
@@ -864,7 +864,7 @@ const undoRedoStateAtom = atom({
864
864
  }, useAddBlock = () => {
865
865
  const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
866
866
  (i, c, d) => {
867
- var m;
867
+ var h;
868
868
  for (let f = 0; f < i.length; f++) {
869
869
  const { _id: x } = i[f];
870
870
  i[f]._id = generateUUID();
@@ -874,7 +874,7 @@ const undoRedoStateAtom = atom({
874
874
  }
875
875
  const p = first(i);
876
876
  let u, g;
877
- return c && (u = find(o, { _id: c }), i[0]._parent = c, g = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, g = u._parent), r(i, g, d), n([(m = first(i)) == null ? void 0 : m._id]), first(i);
877
+ return c && (u = find(o, { _id: c }), i[0]._parent = c, g = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, g = u._parent), r(i, g, d), n([(h = first(i)) == null ? void 0 : h._id]), first(i);
878
878
  },
879
879
  [r, o, n]
880
880
  );
@@ -891,8 +891,8 @@ const undoRedoStateAtom = atom({
891
891
  ...has(i, "_name") && { _name: i._name },
892
892
  ...has(i, "partialBlockId") && { partialBlockId: i.partialBlockId }
893
893
  };
894
- let h, m;
895
- return c && (h = find(o, { _id: c }), g._parent = c, m = c), !canAcceptChildBlock(h == null ? void 0 : h._type, g._type) && h && (g._parent = h._parent, m = h._parent), r([g], m, d), n([g._id]), g;
894
+ let m, h;
895
+ return c && (m = find(o, { _id: c }), g._parent = c, h = c), !canAcceptChildBlock(m == null ? void 0 : m._type, g._type) && m && (g._parent = m._parent, h = m._parent), r([g], h, d), n([g._id]), g;
896
896
  },
897
897
  [r, a, o, n]
898
898
  ), addPredefinedBlock: a };
@@ -2332,8 +2332,8 @@ const getBlockWithChildren = (o, n) => {
2332
2332
  return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
2333
2333
  })
2334
2334
  ), addLangToPrompt = (o, n, r) => !n || r !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, n, n)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
2335
- 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) => {
2336
- const x = cloneDeep(f.find((k) => k._id === m));
2335
+ 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, m = (h, f) => {
2336
+ const x = cloneDeep(f.find((k) => k._id === h));
2337
2337
  for (const k in x) {
2338
2338
  const b = x[k];
2339
2339
  if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
@@ -2346,16 +2346,16 @@ const getBlockWithChildren = (o, n) => {
2346
2346
  };
2347
2347
  return {
2348
2348
  askAi: useCallback(
2349
- async (m, f, x, k) => {
2349
+ async (h, f, x, k) => {
2350
2350
  if (l) {
2351
2351
  n(!0), a(null);
2352
2352
  try {
2353
- 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;
2353
+ const b = p === u ? "" : p, v = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [m(f, d)], B = await l(h, addLangToPrompt(x, g, h), v, b), { blocks: w, error: _ } = B;
2354
2354
  if (_) {
2355
2355
  a(_);
2356
2356
  return;
2357
2357
  }
2358
- if (m === "styles") {
2358
+ if (h === "styles") {
2359
2359
  const E = w.map((C) => {
2360
2360
  for (const A in C)
2361
2361
  A !== "_id" && (C[A] = `${STYLES_KEY},${C[A]}`);
@@ -2458,17 +2458,17 @@ const getBlockWithChildren = (o, n) => {
2458
2458
  r(d), a([]);
2459
2459
  const u = {
2460
2460
  _chai_copied_blocks: d.flatMap((g) => {
2461
- const h = getDuplicatedBlocks(o, g, null);
2461
+ const m = getDuplicatedBlocks(o, g, null);
2462
2462
  if (!p)
2463
- return h;
2464
- let m = [];
2465
- for (const f of h)
2463
+ return m;
2464
+ let h = [];
2465
+ for (const f of m)
2466
2466
  if (f._type === "PartialBlock" || f._type === "GlobalBlock") {
2467
2467
  let x = l(f.partialBlockId);
2468
- f._parent && (x == null ? void 0 : x.length) > 0 && (x = x.map((k) => (isEmpty(k._parent) && set(k, "_parent", f._parent), k))), m = [...m, ...x];
2468
+ f._parent && (x == null ? void 0 : x.length) > 0 && (x = x.map((k) => (isEmpty(k._parent) && set(k, "_parent", f._parent), k))), h = [...h, ...x];
2469
2469
  } else
2470
- m.push(f);
2471
- return m;
2470
+ h.push(f);
2471
+ return h;
2472
2472
  })
2473
2473
  };
2474
2474
  if (!navigator.clipboard) {
@@ -2506,13 +2506,13 @@ const getBlockWithChildren = (o, n) => {
2506
2506
  (a, l = null) => {
2507
2507
  const i = [];
2508
2508
  each(a, (c) => {
2509
- const d = o.find((m) => m._id === c);
2509
+ const d = o.find((h) => h._id === c);
2510
2510
  l ? l === "root" && (l = null) : l = d._parent;
2511
2511
  const g = filter(
2512
2512
  o,
2513
- (m) => isString(l) ? m._parent === l : !m._parent
2514
- ).indexOf(d) + 1, h = getDuplicatedBlocks(o, c, l);
2515
- r(h, l, g), i.push(get(h, "0._id", ""));
2513
+ (h) => isString(l) ? h._parent === l : !h._parent
2514
+ ).indexOf(d) + 1, m = getDuplicatedBlocks(o, c, l);
2515
+ r(m, l, g), i.push(get(m, "0._id", ""));
2516
2516
  }), n(i);
2517
2517
  },
2518
2518
  [o, n]
@@ -2649,13 +2649,13 @@ const getBlockWithChildren = (o, n) => {
2649
2649
  return map(i, (c) => {
2650
2650
  const d = o(c), p = a;
2651
2651
  let { classes: u, baseClasses: g } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
2652
- return each(p, (h) => {
2653
- const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
2652
+ return each(p, (m) => {
2653
+ const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2654
2654
  u = u.replace(f, " ").replace(/\s+/g, " ").trim();
2655
- const x = first(h.split(":"));
2656
- includes(["2xl", "xl", "lg", "md", "sm"], x) && p.push(h.split(":").pop().trim());
2657
- }), each(p, (h) => {
2658
- const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
2655
+ const x = first(m.split(":"));
2656
+ includes(["2xl", "xl", "lg", "md", "sm"], x) && p.push(m.split(":").pop().trim());
2657
+ }), each(p, (m) => {
2658
+ const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2659
2659
  g = g.replace(f, " ").replace(/\s+/g, " ").trim();
2660
2660
  }), {
2661
2661
  ids: [d._id],
@@ -2673,6 +2673,24 @@ const getBlockWithChildren = (o, n) => {
2673
2673
  },
2674
2674
  [r]
2675
2675
  );
2676
+ }, useResetBlockStyles = () => {
2677
+ const o = useSelectedBlock(), n = useUpdateBlocksProps(), r = useCallback((c) => getDefaultBlockProps(c) || {}, []), a = useCallback((c) => Object.keys(c).filter(
2678
+ (d) => typeof c[d] == "string" && c[d].startsWith("#styles:")
2679
+ ), []), l = useCallback(
2680
+ (c) => {
2681
+ if (!o) return;
2682
+ const p = r(o._type)[c] ?? "#styles:,";
2683
+ n([o._id], { [c]: p });
2684
+ },
2685
+ [o, r, n]
2686
+ );
2687
+ return { resetAll: useCallback(() => {
2688
+ if (!o) return;
2689
+ const c = a(o);
2690
+ if (c.length === 0) return;
2691
+ const d = r(o._type), p = pick(d, c);
2692
+ n([o._id], p);
2693
+ }, [o, a, r, n]), reset: l };
2676
2694
  }, useStylingBreakpoint = () => useAtom$1(styleBreakpointAtom), canvasWidthAtom = atomWithStorage("canvasWidth", 800), canvasDisplayWidthAtom = atomWithStorage("canvasDisplayWidth", 800), canvasBreakpointAtom = atom((o) => {
2677
2695
  const n = o(canvasWidthAtom);
2678
2696
  return getBreakpointValue(n).toLowerCase();
@@ -2771,11 +2789,11 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2771
2789
  return "VERTICAL";
2772
2790
  }
2773
2791
  }, isDisabledControl = (o, n, r) => !!(o && (r === "UP" || r === "LEFT") || n && (r === "DOWN" || r === "RIGHT")), useBlockController = (o, n) => {
2774
- 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(
2792
+ 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, m = u + 1 === (d == null ? void 0 : d.length), h = getParentBlockOrientation(c, i, a), f = useCallback(
2775
2793
  (x) => {
2776
- 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());
2794
+ isDisabledControl(g, m, x) || p || (x === "UP" || x === "LEFT" ? l([i], c || null, u - 1) : (x === "DOWN" || x === "RIGHT") && l([i], c || null, u + 2), n());
2777
2795
  },
2778
- [g, h, p, u, i, c, n]
2796
+ [g, m, p, u, i, c, n]
2779
2797
  );
2780
2798
  return useHotkeys(
2781
2799
  "shift+up, shift+down, shift+left, shift+right",
@@ -2785,7 +2803,7 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2785
2803
  },
2786
2804
  { document: a == null ? void 0 : a.contentDocument },
2787
2805
  [f]
2788
- ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: h, moveBlock: f, orientation: m };
2806
+ ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: m, moveBlock: f, orientation: h };
2789
2807
  }, BlockController = ({ block: o, updateFloatingBar: n }) => {
2790
2808
  const { isOnlyChild: r, isFirstBlock: a, isLastBlock: l, moveBlock: i, orientation: c } = useBlockController(
2791
2809
  o,
@@ -2925,19 +2943,19 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
2925
2943
  i([null]);
2926
2944
  }, [r, n]), /* @__PURE__ */ jsx(BlockFloatingSelector, { block: o, selectedBlockElement: a[0] });
2927
2945
  }, BlockFloatingSelector = ({ block: o, selectedBlockElement: n }) => {
2928
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), { hasPermission: d } = usePermissions(), { editingBlockId: p } = useInlineEditing(), { document: u } = useFrame(), { floatingStyles: g, refs: h, update: m } = useFloating({
2946
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), { hasPermission: d } = usePermissions(), { editingBlockId: p } = useInlineEditing(), { document: u } = useFrame(), { floatingStyles: g, refs: m, update: h } = useFloating({
2929
2947
  placement: "top-start",
2930
2948
  middleware: [shift(), flip()],
2931
2949
  elements: { reference: n }
2932
2950
  });
2933
- useResizeObserver(n, () => m(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => m(), (u == null ? void 0 : u.body) !== null);
2951
+ useResizeObserver(n, () => h(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => h(), (u == null ? void 0 : u.body) !== null);
2934
2952
  const f = get(o, "_parent", null), x = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
2935
2953
  return !n || !o || p ? null : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
2936
2954
  "div",
2937
2955
  {
2938
2956
  role: "button",
2939
2957
  tabIndex: 0,
2940
- ref: h.setFloating,
2958
+ ref: m.setFloating,
2941
2959
  style: g,
2942
2960
  onClick: (k) => {
2943
2961
  k.stopPropagation(), k.preventDefault();
@@ -2962,7 +2980,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
2962
2980
  /* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "hover:scale-105" }) }),
2963
2981
  canDuplicateBlock(get(o, "_type", "")) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsx(CopyIcon, { className: "hover:scale-105", onClick: () => a([o == null ? void 0 : o._id]) }) : null,
2964
2982
  canDeleteBlock(get(o, "_type", "")) && d(PERMISSIONS.DELETE_BLOCK) ? /* @__PURE__ */ jsx(TrashIcon, { className: "hover:scale-105", onClick: () => r([o == null ? void 0 : o._id]) }) : null,
2965
- d(PERMISSIONS.MOVE_BLOCK) && /* @__PURE__ */ jsx(BlockController, { block: o, updateFloatingBar: m })
2983
+ d(PERMISSIONS.MOVE_BLOCK) && /* @__PURE__ */ jsx(BlockController, { block: o, updateFloatingBar: h })
2966
2984
  ] })
2967
2985
  ]
2968
2986
  }
@@ -3097,20 +3115,20 @@ H(Frame, "defaultProps", {
3097
3115
  initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
3098
3116
  });
3099
3117
  const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame, { ...o, forwardedRef: n })), useKeyEventWatcher = (o) => {
3100
- const [n, r] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlocks(), { canPaste: g, pasteBlocks: h } = usePasteBlocks(), m = o ? { document: o } : {};
3118
+ const [n, r] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlocks(), { canPaste: g, pasteBlocks: m } = usePasteBlocks(), h = o ? { document: o } : {};
3101
3119
  useHotkeys("ctrl+z,command+z", () => c(), {}, [c]), useHotkeys("ctrl+y,command+y", () => d(), {}, [d]), useHotkeys("ctrl+x,command+x", () => p(n), {}, [n, p]), useHotkeys(
3102
3120
  "ctrl+c,command+c",
3103
3121
  () => u(n),
3104
- { ...m, enabled: !isEmpty(n), preventDefault: !0 },
3122
+ { ...h, enabled: !isEmpty(n), preventDefault: !0 },
3105
3123
  [n, u]
3106
3124
  ), useHotkeys(
3107
3125
  "ctrl+v,command+v",
3108
3126
  () => {
3109
- g(n[0]) && h(n);
3127
+ g(n[0]) && m(n);
3110
3128
  },
3111
- { ...m, enabled: !isEmpty(n), preventDefault: !0 },
3112
- [n, g, h]
3113
- ), useHotkeys("esc", () => r([]), m, [r]), useHotkeys("ctrl+d,command+d", () => i(n), { ...m, enabled: !isEmpty(n), preventDefault: !0 }, [
3129
+ { ...h, enabled: !isEmpty(n), preventDefault: !0 },
3130
+ [n, g, m]
3131
+ ), useHotkeys("esc", () => r([]), h, [r]), useHotkeys("ctrl+d,command+d", () => i(n), { ...h, enabled: !isEmpty(n), preventDefault: !0 }, [
3114
3132
  n,
3115
3133
  i
3116
3134
  ]), useHotkeys(
@@ -3118,7 +3136,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3118
3136
  (f) => {
3119
3137
  f.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
3120
3138
  },
3121
- m,
3139
+ h,
3122
3140
  [n, l]
3123
3141
  );
3124
3142
  }, KeyboardHandler = () => {
@@ -3409,7 +3427,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3409
3427
  ],
3410
3428
  onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
3411
3429
  onBlur: ({ editor: u, event: g }) => {
3412
- const h = g.relatedTarget, m = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = m == null ? void 0 : m.contains(h), k = f == null ? void 0 : f.contains(h);
3430
+ const m = g.relatedTarget, h = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = h == null ? void 0 : h.contains(m), k = f == null ? void 0 : f.contains(m);
3413
3431
  if (!x && !k) {
3414
3432
  const b = (u == null ? void 0 : u.getHTML()) || "";
3415
3433
  r(b);
@@ -3427,10 +3445,10 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3427
3445
  });
3428
3446
  }, [c]);
3429
3447
  const d = useMemo(() => {
3430
- var h;
3448
+ var m;
3431
3449
  const u = "max-w-none shadow-none outline outline-[2px] outline-green-500 [&_*]:shadow-none";
3432
3450
  if (!n) return u;
3433
- const g = ((h = n == null ? void 0 : n.className) == null ? void 0 : h.replace("sr-only", "")) || "";
3451
+ const g = ((m = n == null ? void 0 : n.className) == null ? void 0 : m.replace("sr-only", "")) || "";
3434
3452
  return `${u} ${g}`;
3435
3453
  }, [n]), p = useCallback(
3436
3454
  (u) => {
@@ -3465,28 +3483,28 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3465
3483
  useEffect(() => {
3466
3484
  if (a.current) {
3467
3485
  a.current.innerText = n, a.current.focus();
3468
- const m = c.createRange(), f = d.getSelection();
3469
- m.selectNodeContents(a.current), m.collapse(!1), f == null || f.removeAllRanges(), f == null || f.addRange(m), a.current.focus();
3486
+ const h = c.createRange(), f = d.getSelection();
3487
+ h.selectNodeContents(a.current), h.collapse(!1), f == null || f.removeAllRanges(), f == null || f.addRange(h), a.current.focus();
3470
3488
  } else
3471
3489
  r();
3472
3490
  }, [c, d]);
3473
3491
  const p = useMemo(() => {
3474
3492
  var f;
3475
- const m = ((f = o == null ? void 0 : o.tagName) == null ? void 0 : f.toLowerCase()) || "div";
3476
- return m === "button" ? "div" : m;
3493
+ const h = ((f = o == null ? void 0 : o.tagName) == null ? void 0 : f.toLowerCase()) || "div";
3494
+ return h === "button" ? "div" : h;
3477
3495
  }, [o]), u = useCallback(
3478
- (m) => {
3479
- (m.key === "Enter" || m.key === "Escape") && i(m);
3496
+ (h) => {
3497
+ (h.key === "Enter" || h.key === "Escape") && i(h);
3480
3498
  },
3481
3499
  [i]
3482
3500
  ), g = useCallback(() => {
3483
3501
  r();
3484
- }, [r]), h = useMemo(() => {
3485
- var m;
3502
+ }, [r]), m = useMemo(() => {
3503
+ var h;
3486
3504
  return {
3487
3505
  id: "active-inline-editing-element",
3488
3506
  contentEditable: !0,
3489
- 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]`,
3507
+ className: `${((h = o == null ? void 0 : o.className) == null ? void 0 : h.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]`,
3490
3508
  style: cloneDeep(o == null ? void 0 : o.style) || {},
3491
3509
  onInput: (f) => {
3492
3510
  const x = f.target;
@@ -3501,12 +3519,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3501
3519
  ref: a,
3502
3520
  onBlur: g,
3503
3521
  onKeyDown: u,
3504
- ...h
3522
+ ...m
3505
3523
  }) });
3506
3524
  }
3507
3525
  ), WithBlockTextEditor = memo(
3508
3526
  ({ block: o, children: n }) => {
3509
- 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(), k = useRef(null), b = l, { blockContent: v, blockType: B } = useMemo(() => {
3527
+ const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), k = useRef(null), b = l, { blockContent: v, blockType: B } = useMemo(() => {
3510
3528
  var j;
3511
3529
  const A = o._type;
3512
3530
  let N = o[r];
@@ -3516,14 +3534,14 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3516
3534
  (A) => {
3517
3535
  var S;
3518
3536
  const N = A || ((S = g.current) == null ? void 0 : S.innerText);
3519
- m([b], { [r]: N }), u(null), c(null), d(-1), x([]);
3537
+ h([b], { [r]: N }), u(null), c(null), d(-1), x([]);
3520
3538
  },
3521
- [b, m, c, x, f]
3539
+ [b, h, c, x, f]
3522
3540
  ), _ = useDebouncedCallback(
3523
3541
  (A) => {
3524
- m([b], { [r]: A });
3542
+ h([b], { [r]: A });
3525
3543
  },
3526
- [b, o, m, f],
3544
+ [b, o, h, f],
3527
3545
  1e3
3528
3546
  ), E = useCallback(
3529
3547
  (A) => {
@@ -3540,7 +3558,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3540
3558
  const A = `[data-block-id="${b}"]`, N = i >= 0 ? `[data-block-index="${i}"]` : "", S = a.querySelector(`${A}${N}`);
3541
3559
  S && ((y = S == null ? void 0 : S.classList) == null || y.add("sr-only"), u(S));
3542
3560
  }, [b, B, a, i]);
3543
- const C = useMemo(() => p ? (h(), B === "RichText" ? /* @__PURE__ */ jsx(
3561
+ const C = useMemo(() => p ? (m(), B === "RichText" ? /* @__PURE__ */ jsx(
3544
3562
  RichTextEditor,
3545
3563
  {
3546
3564
  blockContent: v,
@@ -3594,12 +3612,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3594
3612
  blockAtom: n,
3595
3613
  children: r
3596
3614
  }) => {
3597
- 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: k } = useContext(RepeaterContext), b = useMemo(
3598
- () => m ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
3615
+ 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(), [m] = useHiddenBlockIds(), [h] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: x, key: k } = useContext(RepeaterContext), b = useMemo(
3616
+ () => h ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
3599
3617
  index: x,
3600
3618
  key: k
3601
3619
  }) : applyLanguage(i, d, c),
3602
- [i, d, c, g, m, x, k]
3620
+ [i, d, c, g, h, x, k]
3603
3621
  ), v = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), B = useMemo(
3604
3622
  () => u(i._id, getBlockRuntimeProps(i._type)),
3605
3623
  [i._id, i._type, u, getBlockRuntimeProps]
@@ -3624,7 +3642,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3624
3642
  o
3625
3643
  ]
3626
3644
  ), _ = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
3627
- if (isNull(f) || h.includes(i._id)) return null;
3645
+ if (isNull(f) || m.includes(i._id)) return null;
3628
3646
  let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
3629
3647
  ...w,
3630
3648
  children: r({
@@ -3679,7 +3697,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3679
3697
  );
3680
3698
  return map(l, (c) => {
3681
3699
  const d = a(c._id);
3682
- return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: h, repeaterItems: m, $repeaterItemsKey: f }) => g === "Repeater" ? isArray(m) && m.map((x, k) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: k, key: f }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) }, `${u}-${k}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: h }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) : null }) }, c._id) : null;
3700
+ return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: m, repeaterItems: h, $repeaterItemsKey: f }) => g === "Repeater" ? isArray(h) && h.map((x, k) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: k, key: f }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) }, `${u}-${k}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: m }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) : null }) }, c._id) : null;
3683
3701
  });
3684
3702
  }, PageBlocksRenderer = () => {
3685
3703
  const [o] = useBlocksStore();
@@ -3693,11 +3711,11 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3693
3711
  if (d < n) {
3694
3712
  const u = parseFloat((d / n).toFixed(2).toString());
3695
3713
  let g = {};
3696
- const h = p * u, m = d * u;
3714
+ const m = p * u, h = d * u;
3697
3715
  p && (g = {
3698
3716
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
3699
- height: 100 + (p - h) / h * 100 + "%",
3700
- width: 100 + (d - m) / m * 100 + "%"
3717
+ height: 100 + (p - m) / m * 100 + "%",
3718
+ width: 100 + (d - h) / h * 100 + "%"
3701
3719
  }), i({
3702
3720
  position: "relative",
3703
3721
  top: 0,
@@ -3746,19 +3764,19 @@ const CanvasEventsWatcher = () => {
3746
3764
  }), null;
3747
3765
  }, StaticCanvas = () => {
3748
3766
  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(
3749
- (m) => {
3750
- i((f) => ({ ...f, width: m }));
3767
+ (h) => {
3768
+ i((f) => ({ ...f, width: h }));
3751
3769
  },
3752
3770
  [i]
3753
3771
  );
3754
3772
  useEffect(() => {
3755
3773
  if (!a.current) return;
3756
- const { clientWidth: m, clientHeight: f } = a.current;
3757
- i({ width: m, height: f });
3774
+ const { clientWidth: h, clientHeight: f } = a.current;
3775
+ i({ width: h, height: f });
3758
3776
  }, [a, o]);
3759
- const h = useMemo(() => {
3760
- let m = IframeInitialContent;
3761
- return m = m.replace("__HTML_DIR__", u), m;
3777
+ const m = useMemo(() => {
3778
+ let h = IframeInitialContent;
3779
+ return h = h.replace("__HTML_DIR__", u), h;
3762
3780
  }, [u]);
3763
3781
  return /* @__PURE__ */ jsx(ResizableCanvasWrapper, { onMount: g, onResize: g, children: /* @__PURE__ */ jsx(
3764
3782
  "div",
@@ -3774,7 +3792,7 @@ const CanvasEventsWatcher = () => {
3774
3792
  id: "canvas-iframe",
3775
3793
  style: { ...c, ...isEmpty(c) ? { width: `${o}px` } : {} },
3776
3794
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3777
- initialContent: h,
3795
+ initialContent: m,
3778
3796
  children: [
3779
3797
  /* @__PURE__ */ jsx(KeyboardHandler, {}),
3780
3798
  /* @__PURE__ */ jsx(BlockSelectionHighlighter, {}),
@@ -3804,7 +3822,7 @@ const CanvasEventsWatcher = () => {
3804
3822
  }, FallbackError = () => /* @__PURE__ */ jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
3805
3823
  /* @__PURE__ */ jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
3806
3824
  /* @__PURE__ */ jsx("p", { children: "Please try again." })
3807
- ] }) }), CodeEditor$1 = React__default.lazy(() => import("./code-editor-r_v4m0s7.js")), CanvasArea = () => {
3825
+ ] }) }), CodeEditor$1 = React__default.lazy(() => import("./code-editor-DCGe1BPZ.js")), CanvasArea = () => {
3808
3826
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3809
3827
  return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
3810
3828
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
@@ -3869,7 +3887,7 @@ const CanvasEventsWatcher = () => {
3869
3887
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG code to use as an icon") })
3870
3888
  ] });
3871
3889
  }, DefaultMediaManager = ({ close: o, onSelect: n, mode: r = "image" }) => {
3872
- const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), h = async (f) => {
3890
+ const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), m = async (f) => {
3873
3891
  if (!f.trim()) {
3874
3892
  p(!1), g("Please enter a URL");
3875
3893
  return;
@@ -3881,9 +3899,9 @@ const CanvasEventsWatcher = () => {
3881
3899
  } finally {
3882
3900
  c(!1);
3883
3901
  }
3884
- }, { t: m } = useTranslation();
3902
+ }, { t: h } = useTranslation();
3885
3903
  return /* @__PURE__ */ jsxs("div", { className: "flex w-96 flex-col gap-4 p-4", children: [
3886
- /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: m(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
3904
+ /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: h(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
3887
3905
  u && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
3888
3906
  /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
3889
3907
  /* @__PURE__ */ jsx(AlertDescription, { children: u })
@@ -3892,20 +3910,20 @@ const CanvasEventsWatcher = () => {
3892
3910
  /* @__PURE__ */ jsx(
3893
3911
  Input$1,
3894
3912
  {
3895
- placeholder: m(`Enter ${r} URL`),
3913
+ placeholder: h(`Enter ${r} URL`),
3896
3914
  value: a,
3897
3915
  onChange: (f) => l(f.target.value),
3898
- onKeyUp: () => h(a)
3916
+ onKeyUp: () => m(a)
3899
3917
  }
3900
3918
  ),
3901
3919
  /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
3902
- /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: o, children: m("Cancel") }),
3920
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: o, children: h("Cancel") }),
3903
3921
  /* @__PURE__ */ jsx(
3904
3922
  Button,
3905
3923
  {
3906
3924
  onClick: () => n({ id: "dam-id", url: a, width: 600, height: 400, description: "This is image description" }),
3907
3925
  disabled: !d || i,
3908
- children: m("Insert")
3926
+ children: h("Insert")
3909
3927
  }
3910
3928
  )
3911
3929
  ] })
@@ -3932,16 +3950,16 @@ const CanvasEventsWatcher = () => {
3932
3950
  MediaManagerModal.displayName = "MediaManagerModal";
3933
3951
  const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
3934
3952
  const { t: l } = useTranslation(), i = useSelectedBlock(), c = useUpdateBlocksProps(), d = (g) => {
3935
- const h = isArray(g) ? first(g) : g;
3936
- if (h) {
3937
- n(h == null ? void 0 : h.url);
3938
- const m = h == null ? void 0 : h.width, f = h == null ? void 0 : h.height;
3953
+ const m = isArray(g) ? first(g) : g;
3954
+ if (m) {
3955
+ n(m == null ? void 0 : m.url);
3956
+ const h = m == null ? void 0 : m.width, f = m == null ? void 0 : m.height;
3939
3957
  if (i != null && i._id) {
3940
3958
  const x = {
3941
- ...m && { width: m },
3959
+ ...h && { width: h },
3942
3960
  ...f && { height: f },
3943
- ...h.description && { alt: h.description },
3944
- ...h.id && { assetId: h.id }
3961
+ ...m.description && { alt: m.description },
3962
+ ...m.id && { assetId: m.id }
3945
3963
  };
3946
3964
  if (isEmpty(x)) return;
3947
3965
  c([i._id], x);
@@ -3986,18 +4004,18 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
3986
4004
  ] })
3987
4005
  ] });
3988
4006
  }, PathDropdown = ({ data: o, onSelect: n, dataType: r }) => {
3989
- 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(
3990
- (h) => {
3991
- const m = (f) => r === "value" ? f === "value" || f === "object" : r === "array" ? f === "array" : f === r;
3992
- h.type === "object" ? (l((f) => [...f, h.key]), c(h.value)) : m(h.type) && n([...a, h.key].join("."), r);
4007
+ const [a, l] = React__default.useState([]), [i, c] = React__default.useState(o), d = (m) => Array.isArray(m) ? "array" : typeof m == "object" && m !== null ? "object" : "value", p = React__default.useCallback(
4008
+ (m) => {
4009
+ const h = (f) => r === "value" ? f === "value" || f === "object" : r === "array" ? f === "array" : f === r;
4010
+ m.type === "object" ? (l((f) => [...f, m.key]), c(m.value)) : h(m.type) && n([...a, m.key].join("."), r);
3993
4011
  },
3994
4012
  [a, n, r]
3995
4013
  ), u = React__default.useCallback(() => {
3996
4014
  if (a.length > 0) {
3997
- const h = a.slice(0, -1);
3998
- l(h), c(h.reduce((m, f) => m[f], o));
4015
+ const m = a.slice(0, -1);
4016
+ l(m), c(m.reduce((h, f) => h[f], o));
3999
4017
  }
4000
- }, [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]);
4018
+ }, [a, o]), g = React__default.useMemo(() => i ? Object.entries(i).map(([m, h]) => ({ key: m, value: h, type: d(h) })).filter((m) => !startsWith(m.key, REPEATER_PREFIX) && m.key.includes("/") ? !1 : r === "value" ? m.type === "value" || m.type === "object" : r === "array" ? m.type === "array" || m.type === "object" : r === "object" ? m.type === "object" : !0) : [], [i, r]);
4001
4019
  return /* @__PURE__ */ jsxs(Command, { className: "fields-command", children: [
4002
4020
  /* @__PURE__ */ jsx(CommandInput, { className: "border-none", placeholder: "Search..." }),
4003
4021
  /* @__PURE__ */ jsxs(CommandList, { children: [
@@ -4007,36 +4025,36 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
4007
4025
  /* @__PURE__ */ jsx(ChevronLeft, { className: "mr-2 h-4 w-4" }),
4008
4026
  "Back"
4009
4027
  ] }),
4010
- g.map((h) => /* @__PURE__ */ jsxs(
4028
+ g.map((m) => /* @__PURE__ */ jsxs(
4011
4029
  CommandItem,
4012
4030
  {
4013
- value: h.key,
4031
+ value: m.key,
4014
4032
  disabled: !1,
4015
- onSelect: () => p(h),
4033
+ onSelect: () => p(m),
4016
4034
  className: "flex items-center justify-between",
4017
4035
  children: [
4018
4036
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-2", children: [
4019
- startsWith(h.key, REPEATER_PREFIX) ? /* @__PURE__ */ jsx(LoopIcon, {}) : startsWith(h.key, COLLECTION_PREFIX) ? /* @__PURE__ */ jsx(DatabaseIcon, {}) : null,
4020
- startsWith(h.key, REPEATER_PREFIX) ? "Repeater Data" : startsWith(h.key, COLLECTION_PREFIX) ? h.key.replace(COLLECTION_PREFIX, "") : h.key
4037
+ startsWith(m.key, REPEATER_PREFIX) ? /* @__PURE__ */ jsx(LoopIcon, {}) : startsWith(m.key, COLLECTION_PREFIX) ? /* @__PURE__ */ jsx(DatabaseIcon, {}) : null,
4038
+ startsWith(m.key, REPEATER_PREFIX) ? "Repeater Data" : startsWith(m.key, COLLECTION_PREFIX) ? m.key.replace(COLLECTION_PREFIX, "") : m.key
4021
4039
  ] }),
4022
4040
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4023
- r === "object" && h.type === "object" && /* @__PURE__ */ jsx(
4041
+ r === "object" && m.type === "object" && /* @__PURE__ */ jsx(
4024
4042
  Button,
4025
4043
  {
4026
4044
  size: "sm",
4027
4045
  variant: "ghost",
4028
4046
  className: "h-6 px-2 hover:bg-primary hover:text-primary-foreground",
4029
- onClick: (m) => {
4030
- m.stopPropagation(), n([...a, h.key].join("."), r);
4047
+ onClick: (h) => {
4048
+ h.stopPropagation(), n([...a, m.key].join("."), r);
4031
4049
  },
4032
4050
  children: "Select"
4033
4051
  }
4034
4052
  ),
4035
- h.type === "object" && /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 opacity-50" }) })
4053
+ m.type === "object" && /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 opacity-50" }) })
4036
4054
  ] })
4037
4055
  ]
4038
4056
  },
4039
- h.key
4057
+ m.key
4040
4058
  ))
4041
4059
  ] })
4042
4060
  ] })
@@ -4088,18 +4106,18 @@ const DataBindingSelector = ({
4088
4106
  }) => {
4089
4107
  const l = usePageExternalData(), i = useSelectedBlockHierarchy(), c = useSelectedBlock(), d = useMemo(() => {
4090
4108
  if (i.length === 1) return "";
4091
- const g = i.find((f) => f._type === "Repeater"), m = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4092
- return `${REPEATER_PREFIX}${startsWith(m, COLLECTION_PREFIX) ? `${m}/${g._id}` : m}`;
4109
+ const g = i.find((f) => f._type === "Repeater"), h = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4110
+ return `${REPEATER_PREFIX}${startsWith(h, COLLECTION_PREFIX) ? `${h}/${g._id}` : h}`;
4093
4111
  }, [i]), p = useMemo(() => first(get(l, d.replace(REPEATER_PREFIX, ""), [])), [d, l]), u = useCallback(
4094
- (g, h) => {
4095
- if (g = isEmpty(d) ? g : g.replace(`${d}`, "$index"), h === "array" || h === "object") {
4112
+ (g, m) => {
4113
+ if (g = isEmpty(d) ? g : g.replace(`${d}`, "$index"), m === "array" || m === "object") {
4096
4114
  n(`{{${g}}}`, {}, r);
4097
4115
  return;
4098
4116
  }
4099
- const m = (b) => /[.,!?;:]/.test(b), f = (b, v, B) => {
4117
+ const h = (b) => /[.,!?;:]/.test(b), f = (b, v, B) => {
4100
4118
  let w = "", _ = "";
4101
4119
  const E = v > 0 ? b[v - 1] : "", C = v < b.length ? b[v] : "";
4102
- return v > 0 && (E === "." || !m(E) && E !== " ") && (w = " "), v < b.length && !m(C) && C !== " " && (_ = " "), {
4120
+ return v > 0 && (E === "." || !h(E) && E !== " ") && (w = " "), v < b.length && !h(C) && C !== " " && (_ = " "), {
4103
4121
  text: w + B + _,
4104
4122
  prefixLength: w.length,
4105
4123
  suffixLength: _.length
@@ -4118,9 +4136,9 @@ const DataBindingSelector = ({
4118
4136
  else {
4119
4137
  const { state: E } = b, C = E.selection.from, A = E.doc.textBetween(Math.max(0, C - 1), C), N = E.doc.textBetween(C, Math.min(C + 1, E.doc.content.size));
4120
4138
  let S = "";
4121
- C > 0 && A !== " " && !m(A) && (S = " ");
4139
+ C > 0 && A !== " " && !h(A) && (S = " ");
4122
4140
  let y = "";
4123
- N && N !== " " && !m(N) && (y = " "), b.chain().insertContent(S + v + y).run();
4141
+ N && N !== " " && !h(N) && (y = " "), b.chain().insertContent(S + v + y).run();
4124
4142
  }
4125
4143
  setTimeout(() => n(b.getHTML(), {}, r), 100);
4126
4144
  return;
@@ -4155,13 +4173,13 @@ const DataBindingSelector = ({
4155
4173
  onChange: r
4156
4174
  }) => {
4157
4175
  var N;
4158
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (S, y) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [k, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((S) => S.key === u)) == null ? void 0 : N.name;
4176
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (S, y) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [f, x] = useState([]), [k, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((S) => S.key === u)) == null ? void 0 : N.name;
4159
4177
  useEffect(() => {
4160
- if (m(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4178
+ if (h(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4161
4179
  const S = split(o, ":"), y = get(S, 1, "page") || "page";
4162
4180
  g(y), (async () => {
4163
4181
  const j = await l(y, [get(S, 2, "page")]);
4164
- j && Array.isArray(j) && m(get(j, [0, "name"], ""));
4182
+ j && Array.isArray(j) && h(get(j, [0, "name"], ""));
4165
4183
  })();
4166
4184
  }, [o]);
4167
4185
  const w = useDebouncedCallback(
@@ -4178,7 +4196,7 @@ const DataBindingSelector = ({
4178
4196
  300
4179
4197
  ), _ = (S) => {
4180
4198
  const y = ["pageType", u, S.id];
4181
- y[1] && (r(y.join(":")), m(S.name), p(!1), x([]), b(-1));
4199
+ y[1] && (r(y.join(":")), h(S.name), p(!1), x([]), b(-1));
4182
4200
  }, E = (S) => {
4183
4201
  switch (S.key) {
4184
4202
  case "ArrowDown":
@@ -4203,9 +4221,9 @@ const DataBindingSelector = ({
4203
4221
  }
4204
4222
  }, [k]);
4205
4223
  const C = () => {
4206
- m(""), x([]), b(-1), p(!1), r("");
4224
+ h(""), x([]), b(-1), p(!1), r("");
4207
4225
  }, A = (S) => {
4208
- m(S), p(!isEmpty(S)), c(!0), w(S);
4226
+ h(S), p(!isEmpty(S)), c(!0), w(S);
4209
4227
  };
4210
4228
  return /* @__PURE__ */ jsxs("div", { children: [
4211
4229
  /* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (S) => g(S.target.value), children: map(n, (S) => /* @__PURE__ */ jsx("option", { value: S.key, children: S.name }, S.key)) }),
@@ -4214,14 +4232,14 @@ const DataBindingSelector = ({
4214
4232
  "input",
4215
4233
  {
4216
4234
  type: "text",
4217
- value: h,
4235
+ value: m,
4218
4236
  onChange: (S) => A(S.target.value),
4219
4237
  onKeyDown: E,
4220
4238
  placeholder: a(`Search ${B ?? ""}`),
4221
4239
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
4222
4240
  }
4223
4241
  ),
4224
- /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick: C, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4242
+ /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: C, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4225
4243
  ] }),
4226
4244
  (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: [
4227
4245
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
@@ -4229,7 +4247,7 @@ const DataBindingSelector = ({
4229
4247
  ] }) : d && isEmpty(f) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4230
4248
  a("No results found for"),
4231
4249
  ' "',
4232
- h,
4250
+ m,
4233
4251
  '"'
4234
4252
  ] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(f == null ? void 0 : f.slice(0, 20), (S, y) => /* @__PURE__ */ jsxs(
4235
4253
  "li",
@@ -4487,16 +4505,16 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4487
4505
  const c = useRef(null), d = useRef(a || ""), p = usePageExternalData();
4488
4506
  useEffect(() => {
4489
4507
  if (o) {
4490
- const h = document.createElement("style");
4491
- return h.id = "rte-modal-styles", h.innerHTML = `
4508
+ const m = document.createElement("style");
4509
+ return m.id = "rte-modal-styles", m.innerHTML = `
4492
4510
  /* Ensure the NestedPathSelector popover appears above the dialog */
4493
4511
  .rte-path-selector + [data-radix-popper-content-wrapper],
4494
4512
  [data-radix-popper-content-wrapper] {
4495
4513
  z-index: 9999 !important;
4496
4514
  }
4497
- `, document.head.appendChild(h), () => {
4498
- const m = document.getElementById("rte-modal-styles");
4499
- m && m.remove();
4515
+ `, document.head.appendChild(m), () => {
4516
+ const h = document.getElementById("rte-modal-styles");
4517
+ h && h.remove();
4500
4518
  };
4501
4519
  }
4502
4520
  }, [o]);
@@ -4521,13 +4539,13 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4521
4539
  })
4522
4540
  ],
4523
4541
  content: a || "",
4524
- onUpdate: ({ editor: h }) => {
4525
- const m = h.getHTML();
4526
- l(m);
4542
+ onUpdate: ({ editor: m }) => {
4543
+ const h = m.getHTML();
4544
+ l(h);
4527
4545
  },
4528
- onBlur: ({ editor: h }) => {
4529
- const m = h.getHTML();
4530
- i(r, m);
4546
+ onBlur: ({ editor: m }) => {
4547
+ const h = m.getHTML();
4548
+ i(r, h);
4531
4549
  },
4532
4550
  editorProps: {
4533
4551
  attributes: {
@@ -4542,22 +4560,22 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4542
4560
  }, [o, u]), useEffect(() => {
4543
4561
  c.current && u && (c.current.__chaiRTE = u);
4544
4562
  }, [u, o]);
4545
- const g = (h) => {
4563
+ const g = (m) => {
4546
4564
  if (!u) return;
4547
- const m = `{{${h}}}`;
4565
+ const h = `{{${m}}}`;
4548
4566
  u.commands.focus();
4549
4567
  const { from: f, to: x } = u.state.selection;
4550
4568
  if (f !== x)
4551
- u.chain().deleteSelection().insertContent(m).run();
4569
+ u.chain().deleteSelection().insertContent(h).run();
4552
4570
  else {
4553
4571
  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));
4554
4572
  let _ = "";
4555
4573
  v > 0 && B !== " " && !/[.,!?;:]/.test(B) && (_ = " ");
4556
4574
  let E = "";
4557
- w && w !== " " && !/[.,!?;:]/.test(w) && (E = " "), u.chain().insertContent(_ + m + E).run();
4575
+ w && w !== " " && !/[.,!?;:]/.test(w) && (E = " "), u.chain().insertContent(_ + h + E).run();
4558
4576
  }
4559
4577
  };
4560
- return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (h) => !h && n(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
4578
+ return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (m) => !m && n(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
4561
4579
  /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center justify-between pr-8", children: [
4562
4580
  /* @__PURE__ */ jsx("span", { children: "Rich Text Editor" }),
4563
4581
  Object.keys(p).length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -4612,9 +4630,9 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4612
4630
  }, [g]), useEffect(() => {
4613
4631
  u(r || "");
4614
4632
  }, [r]);
4615
- const h = (f) => {
4633
+ const m = (f) => {
4616
4634
  a(f);
4617
- }, m = () => {
4635
+ }, h = () => {
4618
4636
  d(!1), g && g.commands.setContent(p);
4619
4637
  };
4620
4638
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -4626,10 +4644,10 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4626
4644
  RTEModal,
4627
4645
  {
4628
4646
  isOpen: c,
4629
- onClose: m,
4647
+ onClose: h,
4630
4648
  id: o,
4631
4649
  value: p,
4632
- onChange: h,
4650
+ onChange: m,
4633
4651
  onBlur: l
4634
4652
  }
4635
4653
  )
@@ -4645,14 +4663,14 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4645
4663
  }, [a]), useEffect(() => {
4646
4664
  u != null && u.length && !find(u, { _id: o == null ? void 0 : o.currentSlide }) && n({ ...o, currentSlide: get(u, "0._id") });
4647
4665
  }, [o, u]);
4648
- const h = () => {
4666
+ const m = () => {
4649
4667
  const x = findIndex(u, { _id: g });
4650
4668
  if (x > -1) {
4651
4669
  const k = (x + 1) % u.length, b = get(u, [k, "_id"]);
4652
4670
  if (!b) return;
4653
4671
  n({ ...o, currentSlide: b }), c([b]);
4654
4672
  }
4655
- }, m = () => {
4673
+ }, h = () => {
4656
4674
  const x = findIndex(u, { _id: g });
4657
4675
  if (x > -1) {
4658
4676
  const k = (x - 1 + u.length) % u.length, b = get(u, [k, "_id"]);
@@ -4668,7 +4686,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4668
4686
  };
4669
4687
  return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
4670
4688
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 pb-2 text-[12px]", children: [
4671
- /* @__PURE__ */ jsx("button", { onClick: m, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-3 w-3 stroke-[3]" }) }),
4689
+ /* @__PURE__ */ jsx("button", { onClick: h, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-3 w-3 stroke-[3]" }) }),
4672
4690
  /* @__PURE__ */ jsx("div", { className: "whitespace-nowrap text-center text-[10px] text-slate-500", children: g ? /* @__PURE__ */ jsxs("span", { className: "", children: [
4673
4691
  /* @__PURE__ */ jsxs("b", { className: "text-[12px]", children: [
4674
4692
  " ",
@@ -4677,7 +4695,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4677
4695
  "/",
4678
4696
  u.length
4679
4697
  ] }) : "-" }),
4680
- /* @__PURE__ */ jsx("button", { onClick: h, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3 stroke-[3]" }) }),
4698
+ /* @__PURE__ */ jsx("button", { onClick: m, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3 stroke-[3]" }) }),
4681
4699
  /* @__PURE__ */ jsxs(
4682
4700
  "button",
4683
4701
  {
@@ -4755,7 +4773,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4755
4773
  const r = get(o, "srcsets", []) || [], a = (c, d) => {
4756
4774
  const p = c.target.name, u = c.target.value;
4757
4775
  n({
4758
- srcsets: map(r, (g, h) => h === d ? { ...g, [p]: u } : g)
4776
+ srcsets: map(r, (g, m) => m === d ? { ...g, [p]: u } : g)
4759
4777
  });
4760
4778
  }, l = () => {
4761
4779
  n({ srcsets: [...r, {}] });
@@ -4850,11 +4868,11 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4850
4868
  required: p,
4851
4869
  schema: u,
4852
4870
  formData: g,
4853
- onChange: h
4871
+ onChange: m
4854
4872
  }) => {
4855
- const { selectedLang: m, fallbackLang: f, languages: x } = useLanguages(), k = useMemo(
4856
- () => isEmpty(x) ? "" : isEmpty(m) ? f : m,
4857
- [x, m, f]
4873
+ const { selectedLang: h, fallbackLang: f, languages: x } = useLanguages(), k = useMemo(
4874
+ () => isEmpty(x) ? "" : isEmpty(h) ? f : h,
4875
+ [x, h, f]
4858
4876
  ), b = useMemo(() => get(LANGUAGES, k, k), [k]), v = usePageExternalData(), B = useSelectedBlock(), w = useRegisteredChaiBlocks(), _ = useMemo(
4859
4877
  () => get(w, [B == null ? void 0 : B._type, "i18nProps"], []),
4860
4878
  [w, B == null ? void 0 : B._type]
@@ -4905,7 +4923,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4905
4923
  {
4906
4924
  schema: u,
4907
4925
  onChange: (S) => {
4908
- h(S, g, o);
4926
+ m(S, g, o);
4909
4927
  },
4910
4928
  id: o,
4911
4929
  formData: g
@@ -4952,8 +4970,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4952
4970
  /* @__PURE__ */ jsx("span", { children: "Add" })
4953
4971
  ] }) }), JSONForm = memo(({ blockId: o, schema: n, uiSchema: r, formData: a, onChange: l }) => {
4954
4972
  const { selectedLang: i } = useLanguages(), c = useBlockSettingComponents("widget"), d = useBlockSettingComponents("field"), p = useBlockSettingComponents("template"), u = useThrottledCallback(
4955
- async ({ formData: g }, h) => {
4956
- l({ formData: g }, h);
4973
+ async ({ formData: g }, m) => {
4974
+ l({ formData: g }, m);
4957
4975
  },
4958
4976
  [l, i],
4959
4977
  400
@@ -4994,10 +5012,10 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4994
5012
  uiSchema: r,
4995
5013
  schema: n,
4996
5014
  formData: a,
4997
- onChange: ({ formData: g }, h) => {
4998
- if (!h || o !== (g == null ? void 0 : g._id)) return;
4999
- const m = take(h.split("."), 2).join(".").replace("root.", "");
5000
- u({ formData: g }, m);
5015
+ onChange: ({ formData: g }, m) => {
5016
+ if (!m || o !== (g == null ? void 0 : g._id)) return;
5017
+ const h = take(m.split("."), 2).join(".").replace("root.", "");
5018
+ u({ formData: g }, h);
5001
5019
  }
5002
5020
  },
5003
5021
  i
@@ -5009,7 +5027,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
5009
5027
  }), a;
5010
5028
  };
5011
5029
  function BlockSettings() {
5012
- 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 }, C, A) => {
5030
+ 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(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), f = ({ formData: E }, C, A) => {
5013
5031
  C && (c == null ? void 0 : c._id) === n._id && a([n._id], { [C]: get(E, C) }, A);
5014
5032
  }, x = useCallback(
5015
5033
  debounce(({ formData: E }, C, A) => {
@@ -5065,7 +5083,7 @@ function BlockSettings() {
5065
5083
  {
5066
5084
  blockId: g == null ? void 0 : g._id,
5067
5085
  onChange: b,
5068
- formData: m,
5086
+ formData: h,
5069
5087
  schema: w,
5070
5088
  uiSchema: _
5071
5089
  }
@@ -5087,28 +5105,55 @@ const BlockStylingProps = () => {
5087
5105
  const o = useSelectedBlock(), [n, r] = useSelectedStylingBlocks(), { t: a } = useTranslation();
5088
5106
  if (!o) return null;
5089
5107
  const l = Object.keys(o).filter(
5090
- (c) => typeof o[c] == "string" && o[c].startsWith("#styles:")
5091
- );
5092
- if (isEmpty(l) || l.length <= 1) return null;
5093
- const i = (c) => find(n, (d) => d.prop === c);
5094
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
5095
- /* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
5096
- a("Style element"),
5097
- ":"
5098
- ] }),
5099
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(l, (c) => /* @__PURE__ */ jsx(
5100
- Badge,
5101
- {
5102
- className: "cursor-pointer",
5103
- onClick: () => {
5104
- r([{ id: `${c}-${o._id}`, blockId: o._id, prop: c }]);
5108
+ (g) => typeof o[g] == "string" && o[g].startsWith("#styles:")
5109
+ ), { reset: i, resetAll: c } = useResetBlockStyles(), d = !isEmpty(l) && l.length > 1, p = /* @__PURE__ */ jsxs(Button, { className: "h-6 w-full", variant: "outline", size: "sm", onClick: () => c(), children: [
5110
+ /* @__PURE__ */ jsx(ResetIcon, {}),
5111
+ a("Reset styles")
5112
+ ] }), u = (g) => find(n, (m) => m.prop === g);
5113
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
5114
+ p,
5115
+ d && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
5116
+ /* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
5117
+ a("Style element"),
5118
+ ":"
5119
+ ] }),
5120
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(l, (g) => /* @__PURE__ */ jsxs(
5121
+ Badge,
5122
+ {
5123
+ className: "flex cursor-pointer items-center gap-1 pr-1",
5124
+ variant: u(g) ? "default" : "secondary",
5125
+ onClick: () => {
5126
+ r([{ id: `${g}-${o._id}`, blockId: o._id, prop: g }]);
5127
+ },
5128
+ children: [
5129
+ startCase(g),
5130
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5131
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
5132
+ "button",
5133
+ {
5134
+ type: "button",
5135
+ className: "ml-1 rounded-sm p-0.5 hover:bg-blue-300 hover:text-blue-600",
5136
+ onClick: (m) => m.stopPropagation(),
5137
+ children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" })
5138
+ }
5139
+ ) }),
5140
+ /* @__PURE__ */ jsx(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: /* @__PURE__ */ jsx(
5141
+ DropdownMenuItem,
5142
+ {
5143
+ className: "text-xs",
5144
+ onClick: () => {
5145
+ i(g);
5146
+ },
5147
+ children: a("Reset style")
5148
+ }
5149
+ ) })
5150
+ ] })
5151
+ ]
5105
5152
  },
5106
- variant: i(c) ? "default" : "secondary",
5107
- children: startCase(c)
5108
- },
5109
- c
5110
- )) }),
5111
- /* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
5153
+ g
5154
+ )) }),
5155
+ /* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
5156
+ ] })
5112
5157
  ] });
5113
5158
  }, BlockSettingsContext = React__default.createContext({
5114
5159
  setDragData: () => {
@@ -5255,14 +5300,14 @@ const BlockStylingProps = () => {
5255
5300
  },
5256
5301
  a
5257
5302
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
5258
- 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), [k, b] = useState(""), [v, B] = useState(!1), [w, _] = useState(!1);
5303
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [k, b] = useState(""), [v, B] = useState(!1), [w, _] = useState(!1);
5259
5304
  useEffect(() => {
5260
5305
  const { value: S, unit: y } = getClassValueAndUnit(i);
5261
5306
  if (y === "") {
5262
- l(S), m(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
5307
+ l(S), h(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
5263
5308
  return;
5264
5309
  }
5265
- m(y), l(y === "class" || isEmpty(S) ? "" : S);
5310
+ h(y), l(y === "class" || isEmpty(S) ? "" : S);
5266
5311
  }, [i, p, u]);
5267
5312
  const E = useThrottledCallback((S) => c(S), [c], THROTTLE_TIME), C = useThrottledCallback((S) => c(S, !1), [c], THROTTLE_TIME), A = useCallback(
5268
5313
  (S = !1) => {
@@ -5271,7 +5316,7 @@ const BlockStylingProps = () => {
5271
5316
  x(!0);
5272
5317
  return;
5273
5318
  }
5274
- const j = get(y, "unit") !== "" ? get(y, "unit") : h;
5319
+ const j = get(y, "unit") !== "" ? get(y, "unit") : m;
5275
5320
  if (j === "auto" || j === "none") {
5276
5321
  E(`${d}${j}`);
5277
5322
  return;
@@ -5281,7 +5326,7 @@ const BlockStylingProps = () => {
5281
5326
  const L = `${get(y, "value", "").startsWith("-") ? "-" : ""}${d}[${get(y, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
5282
5327
  S ? C(L) : E(L);
5283
5328
  },
5284
- [E, C, a, h, d, u]
5329
+ [E, C, a, m, d, u]
5285
5330
  ), N = useCallback(
5286
5331
  (S) => {
5287
5332
  const y = getUserInputValues(`${a}`, u);
@@ -5300,7 +5345,7 @@ const BlockStylingProps = () => {
5300
5345
  },
5301
5346
  [E, a, d, u]
5302
5347
  );
5303
- return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: h === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5348
+ return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: m === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5304
5349
  /* @__PURE__ */ jsx(
5305
5350
  "input",
5306
5351
  {
@@ -5315,10 +5360,10 @@ const BlockStylingProps = () => {
5315
5360
  ] })
5316
5361
  ] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
5317
5362
  /* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
5318
- ["none", "auto"].indexOf(h) !== -1 ? null : /* @__PURE__ */ jsx(
5363
+ ["none", "auto"].indexOf(m) !== -1 ? null : /* @__PURE__ */ jsx(
5319
5364
  "input",
5320
5365
  {
5321
- readOnly: h === "class",
5366
+ readOnly: m === "class",
5322
5367
  onKeyPress: (S) => {
5323
5368
  S.key === "Enter" && A();
5324
5369
  },
@@ -5329,7 +5374,7 @@ const BlockStylingProps = () => {
5329
5374
  const y = parseInt$1(S.target.value);
5330
5375
  let j = isNaN$1(y) ? 0 : y;
5331
5376
  S.keyCode === 38 && (j += 1), S.keyCode === 40 && (j -= 1);
5332
- const I = `${j}`, P = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${h === "-" ? "" : h}]`;
5377
+ const I = `${j}`, P = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
5333
5378
  C(P);
5334
5379
  },
5335
5380
  onKeyUp: (S) => {
@@ -5358,7 +5403,7 @@ const BlockStylingProps = () => {
5358
5403
  onClick: () => r(!n),
5359
5404
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
5360
5405
  children: [
5361
- /* @__PURE__ */ jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: h }),
5406
+ /* @__PURE__ */ jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: m }),
5362
5407
  u.length > 1 ? /* @__PURE__ */ jsx(TriangleDownIcon, {}) : null
5363
5408
  ]
5364
5409
  }
@@ -5367,33 +5412,33 @@ const BlockStylingProps = () => {
5367
5412
  UnitSelection,
5368
5413
  {
5369
5414
  units: u,
5370
- current: h,
5415
+ current: m,
5371
5416
  onSelect: (S) => {
5372
- r(!1), m(S), N(S);
5417
+ r(!1), h(S), N(S);
5373
5418
  }
5374
5419
  }
5375
5420
  ) })
5376
5421
  ] })
5377
5422
  ] }),
5378
- ["none", "auto"].indexOf(h) !== -1 || v ? null : /* @__PURE__ */ jsx(
5423
+ ["none", "auto"].indexOf(m) !== -1 || v ? null : /* @__PURE__ */ jsx(
5379
5424
  DragStyleButton,
5380
5425
  {
5381
5426
  onDragStart: () => B(!0),
5382
5427
  onDragEnd: (S) => {
5383
5428
  if (b(() => ""), B(!1), isEmpty(S))
5384
5429
  return;
5385
- const y = `${S}`, I = `${y.startsWith("-") ? "-" : ""}${d}[${y.replace("-", "")}${h === "-" ? "" : h}]`;
5430
+ const y = `${S}`, I = `${y.startsWith("-") ? "-" : ""}${d}[${y.replace("-", "")}${m === "-" ? "" : m}]`;
5386
5431
  E(I);
5387
5432
  },
5388
5433
  onDrag: (S) => {
5389
5434
  if (isEmpty(S))
5390
5435
  return;
5391
5436
  b(S);
5392
- const y = `${S}`, I = `${y.startsWith("-") ? "-" : ""}${d}[${y.replace("-", "")}${h === "-" ? "" : h}]`;
5437
+ const y = `${S}`, I = `${y.startsWith("-") ? "-" : ""}${d}[${y.replace("-", "")}${m === "-" ? "" : m}]`;
5393
5438
  C(I);
5394
5439
  },
5395
5440
  currentValue: a,
5396
- unit: h,
5441
+ unit: m,
5397
5442
  negative: g,
5398
5443
  cssProperty: p
5399
5444
  }
@@ -5453,7 +5498,7 @@ const COLOR_PROP = {
5453
5498
  ringColor: "ring",
5454
5499
  ringOffsetColor: "ring-offset"
5455
5500
  }, ColorChoice = ({ property: o, onChange: n }) => {
5456
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), g = get(u, "1", ""), h = get(u, "2", ""), m = useCallback(
5501
+ const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), g = get(u, "1", ""), m = get(u, "2", ""), h = useCallback(
5457
5502
  // eslint-disable-next-line no-shadow
5458
5503
  (k) => {
5459
5504
  ["current", "inherit", "transparent", "black", "white"].includes(k) ? (c([]), p({ color: k })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((b) => ({ ...b, color: k, shade: b.shade ? b.shade : "500" })));
@@ -5486,7 +5531,7 @@ const COLOR_PROP = {
5486
5531
  disabled: !l,
5487
5532
  rounded: !0,
5488
5533
  selected: g,
5489
- onChange: m,
5534
+ onChange: h,
5490
5535
  options: [
5491
5536
  "current",
5492
5537
  "transparent",
@@ -5519,7 +5564,7 @@ const COLOR_PROP = {
5519
5564
  ]
5520
5565
  }
5521
5566
  ) }),
5522
- /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: h, disabled: !g || !l, onChange: f, options: i }) })
5567
+ /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange: f, options: i }) })
5523
5568
  ] });
5524
5569
  }, EDITOR_ICONS = {
5525
5570
  "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" }) }),
@@ -5853,20 +5898,20 @@ const COLOR_PROP = {
5853
5898
  "2xl": "1536px"
5854
5899
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
5855
5900
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
5856
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), k = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
5901
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), k = useMemo(() => get(m, "fullCls", ""), [m]), b = useCallback(
5857
5902
  (C, A = !0) => {
5858
5903
  const N = { dark: p, mq: g, mod: u, cls: C, property: l, fullCls: "" };
5859
5904
  (p || u !== "") && (N.mq = "xs");
5860
5905
  const S = generateFullClsName(N);
5861
- m(x, [S], A);
5906
+ h(x, [S], A);
5862
5907
  },
5863
- [x, p, g, u, l, m]
5908
+ [x, p, g, u, l, h]
5864
5909
  ), v = useCallback(() => {
5865
5910
  f(x, [k], !0);
5866
- }, [x, k, f]), B = useMemo(() => canChangeClass(h, g), [h, g]);
5911
+ }, [x, k, f]), B = useMemo(() => canChangeClass(m, g), [m, g]);
5867
5912
  useEffect(() => {
5868
- i(B, h);
5869
- }, [B, i, h]);
5913
+ i(B, m);
5914
+ }, [B, i, m]);
5870
5915
  const [, , w] = useScreenSizeWidth(), _ = useCallback(
5871
5916
  (C) => {
5872
5917
  w({
@@ -5879,15 +5924,15 @@ const COLOR_PROP = {
5879
5924
  }[C]);
5880
5925
  },
5881
5926
  [w]
5882
- ), E = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === g;
5883
- return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: h && E, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
5884
- /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${h && !E ? "text-foreground" : ""}`, children: n(a) }) }),
5927
+ ), E = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
5928
+ return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: m && E, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
5929
+ /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !E ? "text-foreground" : ""}`, children: n(a) }) }),
5885
5930
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
5886
5931
  /* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
5887
5932
  r === "arbitrary" ? /* @__PURE__ */ jsx(
5888
5933
  AdvanceChoices,
5889
5934
  {
5890
- currentClass: get(h, "cls", ""),
5935
+ currentClass: get(m, "cls", ""),
5891
5936
  classPrefix: get(CLASS_PREFIXES, l, ""),
5892
5937
  units: c || [],
5893
5938
  onChange: b,
@@ -5900,7 +5945,7 @@ const COLOR_PROP = {
5900
5945
  r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
5901
5946
  r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
5902
5947
  ] }),
5903
- /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${k ? "visible" : "invisible"}`, children: E ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && h ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
5948
+ /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${k ? "visible" : "invisible"}`, children: E ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && m ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
5904
5949
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
5905
5950
  "button",
5906
5951
  {
@@ -5912,19 +5957,19 @@ const COLOR_PROP = {
5912
5957
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxs("div", { children: [
5913
5958
  "Current style is set at  ",
5914
5959
  /* @__PURE__ */ jsxs("span", { className: "font-bold", children: [
5915
- getBreakpoint(get(h, "mq")),
5916
- p && !h.dark ? "(Light mode)" : ""
5960
+ getBreakpoint(get(m, "mq")),
5961
+ p && !m.dark ? "(Light mode)" : ""
5917
5962
  ] }),
5918
5963
  /* @__PURE__ */ jsx("br", {}),
5919
5964
  /* @__PURE__ */ jsxs(
5920
5965
  "button",
5921
5966
  {
5922
5967
  type: "button",
5923
- onClick: () => _(get(h, "mq")),
5968
+ onClick: () => _(get(m, "mq")),
5924
5969
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
5925
5970
  children: [
5926
5971
  "Switch to ",
5927
- get(h, "mq").toUpperCase()
5972
+ get(m, "mq").toUpperCase()
5928
5973
  ]
5929
5974
  }
5930
5975
  )
@@ -5941,7 +5986,7 @@ const COLOR_PROP = {
5941
5986
  units: i = basicUnits,
5942
5987
  negative: c = !1
5943
5988
  }) => {
5944
- const { t: d } = useTranslation(), [p, u] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), h = useCallback((m) => map(g, "property").includes(m), [g]);
5989
+ const { t: d } = useTranslation(), [p, u] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), m = useCallback((h) => map(g, "property").includes(h), [g]);
5945
5990
  return /* @__PURE__ */ jsxs(
5946
5991
  "div",
5947
5992
  {
@@ -5949,7 +5994,7 @@ const COLOR_PROP = {
5949
5994
  children: [
5950
5995
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
5951
5996
  o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
5952
- /* @__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: [
5997
+ /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: h, key: f }, x) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
5953
5998
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
5954
5999
  "button",
5955
6000
  {
@@ -5958,13 +6003,13 @@ const COLOR_PROP = {
5958
6003
  className: `relative cursor-pointer rounded-full p-1 text-[8px] ${f === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
5959
6004
  children: [
5960
6005
  React__default.createElement("div", {
5961
- className: h(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6006
+ className: m(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
5962
6007
  }),
5963
6008
  React__default.createElement(get(EDITOR_ICONS, f, BoxIcon), { className: "text-inherit w-3 h-3" })
5964
6009
  ]
5965
6010
  }
5966
6011
  ) }),
5967
- /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(m)) })
6012
+ /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(h)) })
5968
6013
  ] }) }, `option-${x}`)) })
5969
6014
  ] }),
5970
6015
  /* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
@@ -6120,12 +6165,12 @@ const COLOR_PROP = {
6120
6165
  canvas: n = !1,
6121
6166
  tooltip: r = !0
6122
6167
  }) => {
6123
- const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: h } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS), f = (b) => {
6168
+ const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), f = (b) => {
6124
6169
  u.includes(b) ? u.length > 2 && g(u.filter((v) => v !== b)) : g((v) => [...v, b]);
6125
6170
  }, x = (b) => {
6126
6171
  n || l(b), c(b);
6127
6172
  }, k = getBreakpointValue(n ? i : a).toLowerCase();
6128
- return m.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(m, (b) => /* @__PURE__ */ createElement(
6173
+ return h.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(h, (b) => /* @__PURE__ */ createElement(
6129
6174
  BreakpointCard,
6130
6175
  {
6131
6176
  canvas: n,
@@ -6136,7 +6181,7 @@ const COLOR_PROP = {
6136
6181
  }
6137
6182
  )) }) : /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between rounded-md", children: [
6138
6183
  /* @__PURE__ */ jsx("div", { className: "flex items-center", children: map(
6139
- m.filter((b) => includes(u, toUpper(b.breakpoint))),
6184
+ h.filter((b) => includes(u, toUpper(b.breakpoint))),
6140
6185
  (b) => /* @__PURE__ */ createElement(
6141
6186
  BreakpointCard,
6142
6187
  {
@@ -6153,15 +6198,15 @@ const COLOR_PROP = {
6153
6198
  /* @__PURE__ */ jsxs(DropdownMenu, { children: [
6154
6199
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("span", { className: "cursor-pointer px-2.5 hover:opacity-80", children: /* @__PURE__ */ jsx(DotsVerticalIcon, { className: "scale-90 transform" }) }) }),
6155
6200
  /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56 border-border text-xs", children: [
6156
- /* @__PURE__ */ jsx(DropdownMenuLabel, { children: h("Screen sizes") }),
6201
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: m("Screen sizes") }),
6157
6202
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6158
- map(m, (b) => /* @__PURE__ */ jsx(
6203
+ map(h, (b) => /* @__PURE__ */ jsx(
6159
6204
  DropdownMenuCheckboxItem,
6160
6205
  {
6161
6206
  disabled: b.breakpoint === "xs",
6162
6207
  onCheckedChange: () => f(toUpper(b.breakpoint)),
6163
6208
  checked: includes(u, toUpper(b.breakpoint)),
6164
- children: h(b.title)
6209
+ children: m(b.title)
6165
6210
  },
6166
6211
  b.breakpoint
6167
6212
  ))
@@ -6240,11 +6285,11 @@ function Countdown() {
6240
6285
  const AskAIStyles = ({ blockId: o }) => {
6241
6286
  const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), [u, g] = useState();
6242
6287
  useEffect(() => {
6243
- var m;
6244
- (m = d.current) == null || m.focus();
6288
+ var h;
6289
+ (h = d.current) == null || h.focus();
6245
6290
  }, []);
6246
- const h = (m) => {
6247
- const { usage: f } = m || {};
6291
+ const m = (h) => {
6292
+ const { usage: f } = h || {};
6248
6293
  !l && f && g(f), p.current = setTimeout(() => g(void 0), 1e4), l || c("");
6249
6294
  };
6250
6295
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
@@ -6254,12 +6299,12 @@ const AskAIStyles = ({ blockId: o }) => {
6254
6299
  {
6255
6300
  ref: d,
6256
6301
  value: i,
6257
- onChange: (m) => c(m.target.value),
6302
+ onChange: (h) => c(h.target.value),
6258
6303
  placeholder: n("Ask AI to edit styles"),
6259
6304
  className: "no-scrollbar my-2 w-full border border-border p-2 text-xs",
6260
6305
  rows: 4,
6261
- onKeyDown: (m) => {
6262
- m.key === "Enter" && (m.preventDefault(), p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, h));
6306
+ onKeyDown: (h) => {
6307
+ h.key === "Enter" && (h.preventDefault(), p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, m));
6263
6308
  }
6264
6309
  }
6265
6310
  ),
@@ -6269,7 +6314,7 @@ const AskAIStyles = ({ blockId: o }) => {
6269
6314
  {
6270
6315
  disabled: i.trim().length < 5 || a,
6271
6316
  onClick: () => {
6272
- p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, h);
6317
+ p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, m);
6273
6318
  },
6274
6319
  variant: "default",
6275
6320
  className: "w-fit",
@@ -6301,9 +6346,9 @@ const AskAIStyles = ({ blockId: o }) => {
6301
6346
  };
6302
6347
  function ManualClasses() {
6303
6348
  var I;
6304
- 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(""), k = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, k, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
6349
+ const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), k = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, k, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
6305
6350
  const L = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6306
- u(h, L, !0), x("");
6351
+ u(m, L, !0), x("");
6307
6352
  }, [w, _] = useState([]), E = ({ value: L }) => {
6308
6353
  const P = L.trim().toLowerCase(), T = P.match(/.+:/g);
6309
6354
  let D = [];
@@ -6342,7 +6387,7 @@ function ManualClasses() {
6342
6387
  ), y = (L) => {
6343
6388
  debugger;
6344
6389
  const P = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6345
- g(h, [L]), u(h, P, !0), r(""), l(-1);
6390
+ g(m, [L]), u(m, P, !0), r(""), l(-1);
6346
6391
  }, j = () => {
6347
6392
  if (navigator.clipboard === void 0) {
6348
6393
  toast.error(c("Clipboard not supported"));
@@ -6359,7 +6404,7 @@ function ManualClasses() {
6359
6404
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: c("Copy classes to clipboard") }) })
6360
6405
  ] })
6361
6406
  ] }),
6362
- m ? /* @__PURE__ */ jsxs(Popover, { children: [
6407
+ h ? /* @__PURE__ */ jsxs(Popover, { children: [
6363
6408
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { variant: "default", className: "h-6 w-fit", size: "sm", children: [
6364
6409
  /* @__PURE__ */ jsx(SparklesIcon, { className: "h-4 w-4" }),
6365
6410
  /* @__PURE__ */ jsx("span", { className: "ml-2", children: c("Ask AI") })
@@ -6424,7 +6469,7 @@ function ManualClasses() {
6424
6469
  "button",
6425
6470
  {
6426
6471
  onDoubleClick: () => {
6427
- x(L), g(h, [L]), setTimeout(() => {
6472
+ x(L), g(m, [L]), setTimeout(() => {
6428
6473
  o.current && o.current.focus();
6429
6474
  }, 10);
6430
6475
  },
@@ -6434,7 +6479,7 @@ function ManualClasses() {
6434
6479
  n !== L && /* @__PURE__ */ jsx(
6435
6480
  Cross2Icon,
6436
6481
  {
6437
- onClick: () => g(h, [L], !0),
6482
+ onClick: () => g(m, [L], !0),
6438
6483
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
6439
6484
  }
6440
6485
  )
@@ -6554,13 +6599,13 @@ function BlockStyling() {
6554
6599
  cssProperty: ""
6555
6600
  }), d = useThrottledCallback(
6556
6601
  (u) => {
6557
- const g = !get(i, "negative", !1), h = get(i, "cssProperty", "");
6558
- let m = parseFloat(i.dragStartValue);
6559
- m = isNaN(m) ? 0 : m;
6602
+ const g = !get(i, "negative", !1), m = get(i, "cssProperty", "");
6603
+ let h = parseFloat(i.dragStartValue);
6604
+ h = isNaN(h) ? 0 : h;
6560
6605
  let f = MAPPER[i.dragUnit];
6561
- (startsWith(h, "scale") || h === "opacity") && (f = 10);
6562
- let k = (i.dragStartY - u.pageY) / f + m;
6563
- g && k < 0 && (k = 0), h === "opacity" && k > 1 && (k = 1), i.onDrag(`${k}`), l(`${k}`);
6606
+ (startsWith(m, "scale") || m === "opacity") && (f = 10);
6607
+ let k = (i.dragStartY - u.pageY) / f + h;
6608
+ g && k < 0 && (k = 0), m === "opacity" && k > 1 && (k = 1), i.onDrag(`${k}`), l(`${k}`);
6564
6609
  },
6565
6610
  [i],
6566
6611
  50
@@ -6601,7 +6646,7 @@ const CoreBlock = ({
6601
6646
  parentId: r,
6602
6647
  position: a
6603
6648
  }) => {
6604
- const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, g] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(), m = () => {
6649
+ const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, g] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), h = () => {
6605
6650
  if (has(o, "blocks")) {
6606
6651
  const k = isFunction(o.blocks) ? o.blocks() : o.blocks;
6607
6652
  u(syncBlocksWithDefaults(k), r || null, a);
@@ -6614,11 +6659,11 @@ const CoreBlock = ({
6614
6659
  "button",
6615
6660
  {
6616
6661
  disabled: n,
6617
- onClick: m,
6662
+ onClick: h,
6618
6663
  type: "button",
6619
6664
  onDragStart: (k) => {
6620
6665
  k.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), k.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
6621
- g([]), h();
6666
+ g([]), m();
6622
6667
  }, 200);
6623
6668
  },
6624
6669
  draggable: f ? "true" : "false",
@@ -6817,7 +6862,7 @@ const CoreBlock = ({
6817
6862
  }
6818
6863
  }
6819
6864
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
6820
- var h, m, f, x, k, b, v, B;
6865
+ var m, h, f, x, k, b, v, B;
6821
6866
  if (r.type === "comment") return [];
6822
6867
  let a = { _id: generateUUID() };
6823
6868
  if (n && (a._parent = n.block._id), r.type === "text")
@@ -6857,8 +6902,8 @@ const CoreBlock = ({
6857
6902
  ];
6858
6903
  a = {
6859
6904
  ...a,
6860
- href: ((h = l.find((_) => _.key === "href")) == null ? void 0 : h.value) || "",
6861
- hrefType: ((m = l.find((_) => _.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
6905
+ href: ((m = l.find((_) => _.key === "href")) == null ? void 0 : m.value) || "",
6906
+ hrefType: ((h = l.find((_) => _.key === "data-vbtype")) == null ? void 0 : h.value) || "video",
6862
6907
  autoplay: ((f = l.find((_) => _.key === "data-autoplay")) == null ? void 0 : f.value) === "true" ? "true" : "false",
6863
6908
  maxWidth: ((k = (x = l.find((_) => _.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : k.replace("px", "")) || "",
6864
6909
  backdropColor: ((b = l.find((_) => _.key === "data-overlay")) == null ? void 0 : b.value) || "",
@@ -7001,7 +7046,7 @@ const registerChaiLibrary = (o, n) => {
7001
7046
  parentId: r = void 0,
7002
7047
  position: a = -1
7003
7048
  }) => {
7004
- 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), k = (B) => {
7049
+ const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), m = get(o, "name", get(o, "label")), h = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), k = (B) => {
7005
7050
  const w = has(B, "styles_attrs.data-page-section");
7006
7051
  return B._type === "Box" && w;
7007
7052
  }, b = useCallback(
@@ -7048,20 +7093,20 @@ const registerChaiLibrary = (o, n) => {
7048
7093
  /* @__PURE__ */ jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
7049
7094
  /* @__PURE__ */ jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
7050
7095
  ] }),
7051
- o.preview ? /* @__PURE__ */ jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: h }) : /* @__PURE__ */ jsxs("div", { className: "flex h-fit w-full flex-col items-center justify-center gap-1 rounded-md border border-border p-6 py-10 text-center", children: [
7052
- /* @__PURE__ */ jsx("p", { className: "font-medium text-gray-800", children: h }),
7053
- m && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: m })
7096
+ o.preview ? /* @__PURE__ */ jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: m }) : /* @__PURE__ */ jsxs("div", { className: "flex h-fit w-full flex-col items-center justify-center gap-1 rounded-md border border-border p-6 py-10 text-center", children: [
7097
+ /* @__PURE__ */ jsx("p", { className: "font-medium text-gray-800", children: m }),
7098
+ h && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: h })
7054
7099
  ] })
7055
7100
  ]
7056
7101
  }
7057
7102
  ) }),
7058
7103
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsxs("div", { className: "max-w-xs", children: [
7059
- /* @__PURE__ */ jsx("p", { className: "font-medium", children: h }),
7060
- m && o.preview && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-primary-foreground", children: m })
7104
+ /* @__PURE__ */ jsx("p", { className: "font-medium", children: m }),
7105
+ h && o.preview && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-primary-foreground", children: h })
7061
7106
  ] }) })
7062
7107
  ] });
7063
7108
  }, UILibrarySection = ({ parentId: o, position: n }) => {
7064
- const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((y) => y.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), f = useRef(null);
7109
+ const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((y) => y.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [m, h] = useState([]), f = useRef(null);
7065
7110
  useEffect(() => {
7066
7111
  c && c.length > 0 && (f.current = new Fuse(c, {
7067
7112
  keys: ["name", "label", "description", "group"],
@@ -7070,13 +7115,13 @@ const registerChaiLibrary = (o, n) => {
7070
7115
  }));
7071
7116
  }, [c]), useEffect(() => {
7072
7117
  if (!u.trim() || !f.current) {
7073
- m([]);
7118
+ h([]);
7074
7119
  return;
7075
7120
  }
7076
7121
  const y = f.current.search(u).map((j) => j.item);
7077
- m(y);
7122
+ h(y);
7078
7123
  }, [u]);
7079
- const x = u.trim() && !isEmpty(h) ? h : c, k = groupBy(x, "group"), [b, v] = useState(null);
7124
+ const x = u.trim() && !isEmpty(m) ? m : c, k = groupBy(x, "group"), [b, v] = useState(null);
7080
7125
  useEffect(() => {
7081
7126
  if (isEmpty(keys(k))) {
7082
7127
  v(null);
@@ -7216,7 +7261,7 @@ const registerChaiLibrary = (o, n) => {
7216
7261
  error: c
7217
7262
  }), g(!0);
7218
7263
  else if (!l && Object.keys(a || {}).length > 0) {
7219
- const m = Object.entries(a).map(([x, k]) => {
7264
+ const h = Object.entries(a).map(([x, k]) => {
7220
7265
  const b = k, v = b.type || "partial", B = formatReadableName(v);
7221
7266
  return {
7222
7267
  type: "PartialBlock",
@@ -7231,14 +7276,14 @@ const registerChaiLibrary = (o, n) => {
7231
7276
  // Store the original ID as partialBlockId
7232
7277
  _name: b.name
7233
7278
  };
7234
- }), f = uniq(map(m, "group"));
7279
+ }), f = uniq(map(h, "group"));
7235
7280
  p({
7236
- blocks: m,
7281
+ blocks: h,
7237
7282
  groups: f,
7238
7283
  isLoading: !1,
7239
7284
  error: null
7240
7285
  }), g(!0);
7241
- } else l ? p((m) => ({ ...m, isLoading: !0, error: null })) : !l && Object.keys(a || {}).length === 0 && (p({
7286
+ } else l ? p((h) => ({ ...h, isLoading: !0, error: null })) : !l && Object.keys(a || {}).length === 0 && (p({
7242
7287
  blocks: [],
7243
7288
  groups: [],
7244
7289
  isLoading: !1,
@@ -7253,15 +7298,15 @@ const registerChaiLibrary = (o, n) => {
7253
7298
  d.blocks,
7254
7299
  c
7255
7300
  ]);
7256
- const h = () => {
7257
- p((m) => ({ ...m, isLoading: !0, error: null })), g(!1), i();
7301
+ const m = () => {
7302
+ p((h) => ({ ...h, isLoading: !0, error: null })), g(!1), i();
7258
7303
  };
7259
7304
  return d.isLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-8 text-center text-muted-foreground", children: "Loading partial blocks..." }) : d.error || d.blocks.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-4 p-8 text-center text-muted-foreground", children: [
7260
7305
  /* @__PURE__ */ jsx("p", { children: d.error || "No partial blocks available" }),
7261
7306
  /* @__PURE__ */ jsx(
7262
7307
  "button",
7263
7308
  {
7264
- onClick: h,
7309
+ onClick: m,
7265
7310
  className: "rounded-md bg-primary px-3 py-1 text-sm text-primary-foreground hover:bg-primary/90",
7266
7311
  children: "Refresh"
7267
7312
  }
@@ -7280,7 +7325,7 @@ const registerChaiLibrary = (o, n) => {
7280
7325
  has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
7281
7326
  }, 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" }) => {
7282
7327
  var S;
7283
- const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (S = find(c, (y) => y._id === r)) == null ? void 0 : S._type, [m, f] = useState("all"), [x, k] = useState(null), b = useRef(null);
7328
+ const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (S = find(c, (y) => y._id === r)) == null ? void 0 : S._type, [h, f] = useState("all"), [x, k] = useState(null), b = useRef(null);
7284
7329
  useEffect(() => {
7285
7330
  const y = setTimeout(() => {
7286
7331
  var j;
@@ -7316,7 +7361,7 @@ const registerChaiLibrary = (o, n) => {
7316
7361
  ), C = useMemo(
7317
7362
  () => sortBy(E, (y) => CORE_GROUPS.indexOf(y) === -1 ? 99 : CORE_GROUPS.indexOf(y)),
7318
7363
  [E]
7319
- ), A = useMemo(() => m === "all" ? _ : filter(values(_), { group: m }), [_, m]), N = useMemo(() => m === "all" ? C : [m], [C, m]);
7364
+ ), A = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), N = useMemo(() => h === "all" ? C : [h], [C, h]);
7320
7365
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
7321
7366
  /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
7322
7367
  Input$1,
@@ -7337,7 +7382,7 @@ const registerChaiLibrary = (o, n) => {
7337
7382
  onClick: () => w("all"),
7338
7383
  onMouseEnter: () => v("all"),
7339
7384
  onMouseLeave: B,
7340
- 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"}`,
7385
+ className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7341
7386
  children: i("All")
7342
7387
  },
7343
7388
  "sidebar-all"
@@ -7348,7 +7393,7 @@ const registerChaiLibrary = (o, n) => {
7348
7393
  onClick: () => w(y),
7349
7394
  onMouseEnter: () => v(y),
7350
7395
  onMouseLeave: B,
7351
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === y || x === y ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7396
+ className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === y || x === y ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7352
7397
  children: capitalize(i(y.toLowerCase()))
7353
7398
  },
7354
7399
  `sidebar-${y}`
@@ -7362,7 +7407,7 @@ const registerChaiLibrary = (o, n) => {
7362
7407
  ] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: N.map((y) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
7363
7408
  /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(y.toLowerCase())) }),
7364
7409
  /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
7365
- m === "all" ? filter(values(A), { group: y }) : values(A),
7410
+ h === "all" ? filter(values(A), { group: y }) : values(A),
7366
7411
  { hidden: !0 }
7367
7412
  ).map((j) => /* @__PURE__ */ jsx(
7368
7413
  CoreBlock,
@@ -7370,7 +7415,7 @@ const registerChaiLibrary = (o, n) => {
7370
7415
  parentId: r,
7371
7416
  position: a,
7372
7417
  block: j,
7373
- disabled: !canAcceptChildBlock(h, j.type) || !canBeNestedInside(h, j.type)
7418
+ disabled: !canAcceptChildBlock(m, j.type) || !canBeNestedInside(m, j.type)
7374
7419
  },
7375
7420
  j.type
7376
7421
  )) })
@@ -7383,13 +7428,13 @@ const registerChaiLibrary = (o, n) => {
7383
7428
  parentId: r = void 0,
7384
7429
  position: a = -1
7385
7430
  }) => {
7386
- const { t: l } = useTranslation(), [i, c] = useAtom$1(addBlockTabAtom), [, d] = useAtom$1(showPredefinedBlockCategoryAtom), p = useBuilderProp("importHTMLSupport", !0), { data: u } = usePartialBlocksList(), g = Object.keys(u || {}).length > 0, { hasPermission: h } = usePermissions();
7431
+ const { t: l } = useTranslation(), [i, c] = useAtom$1(addBlockTabAtom), [, d] = useAtom$1(showPredefinedBlockCategoryAtom), p = useBuilderProp("importHTMLSupport", !0), { data: u } = usePartialBlocksList(), g = Object.keys(u || {}).length > 0, { hasPermission: m } = usePermissions();
7387
7432
  useEffect(() => {
7388
7433
  i === "partials" && !g && c("library");
7389
7434
  }, [i, g, c]);
7390
- const m = useCallback(() => {
7435
+ const h = useCallback(() => {
7391
7436
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7392
- }, []), f = useChaiAddBlockTabs(), x = p && h(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
7437
+ }, []), f = useChaiAddBlockTabs(), x = p && m(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
7393
7438
  return useEffect(() => {
7394
7439
  i === "library" && !b && c("core");
7395
7440
  }, [i, b, c]), /* @__PURE__ */ jsxs("div", { className: cn$2("flex h-full w-full flex-col overflow-hidden", o), children: [
@@ -7417,7 +7462,7 @@ const registerChaiLibrary = (o, n) => {
7417
7462
  b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
7418
7463
  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 }) }) }) }),
7419
7464
  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,
7420
- 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}`))
7465
+ map(f, (v) => /* @__PURE__ */ jsx(TabsContent, { value: v.id, children: React__default.createElement(v.tabContent, { close: h, parentId: r, position: a }) }, `panel-add-block-${v.id}`))
7421
7466
  ]
7422
7467
  }
7423
7468
  )
@@ -7539,7 +7584,7 @@ const registerChaiSaveToLibrary = (o) => {
7539
7584
  }, CANNOT_COPY_BLOCKS = !navigator.clipboard, CopyPasteBlocks = () => {
7540
7585
  const [o] = useBlocksStore(), [n] = useSelectedBlockIds(), { pasteBlocks: r } = usePasteBlocks(), [, a, l] = useCopyBlocks(), { t: i } = useTranslation(), c = useSelectedBlock(), d = useCallback(() => {
7541
7586
  const p = n.map((u) => {
7542
- const g = o.find((h) => h._id === u);
7587
+ const g = o.find((m) => m._id === u);
7543
7588
  return {
7544
7589
  id: u,
7545
7590
  data: g
@@ -7724,8 +7769,8 @@ const Input = ({ node: o }) => {
7724
7769
  var P;
7725
7770
  const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
7726
7771
  let p = null;
7727
- const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: k, isDragging: b, isEditing: v, handleClick: B } = o, w = (T) => {
7728
- T.stopPropagation(), !l.includes(m) && o.toggle();
7772
+ const u = o.children.length > 0, { highlightBlock: g, clearHighlight: m } = useBlockHighlight(), { id: h, data: f, isSelected: x, willReceiveDrop: k, isDragging: b, isEditing: v, handleClick: B } = o, w = (T) => {
7773
+ T.stopPropagation(), !l.includes(h) && o.toggle();
7729
7774
  }, _ = (T) => {
7730
7775
  T.isInternal && (p = T.isOpen, T.isOpen && T.close());
7731
7776
  }, E = (T) => {
@@ -7736,11 +7781,11 @@ const Input = ({ node: o }) => {
7736
7781
  }, S = () => {
7737
7782
  A(null);
7738
7783
  }, y = (T) => {
7739
- S(), T.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), B(T);
7784
+ S(), T.stopPropagation(), !o.isOpen && !l.includes(h) && o.toggle(), B(T);
7740
7785
  };
7741
7786
  useEffect(() => {
7742
7787
  const T = setTimeout(() => {
7743
- k && !o.isOpen && !b && !l.includes(m) && o.toggle();
7788
+ k && !o.isOpen && !b && !l.includes(h) && o.toggle();
7744
7789
  }, 500);
7745
7790
  return () => clearTimeout(T);
7746
7791
  }, [k, o, b]);
@@ -7754,7 +7799,7 @@ const Input = ({ node: o }) => {
7754
7799
  const D = get(o, "parent.id");
7755
7800
  D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: T }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: T });
7756
7801
  };
7757
- if (m === ROOT_TEMP_KEY)
7802
+ if (h === ROOT_TEMP_KEY)
7758
7803
  return /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer", children: [
7759
7804
  /* @__PURE__ */ jsx("br", {}),
7760
7805
  d(PERMISSIONS.ADD_BLOCK) && /* @__PURE__ */ jsx(
@@ -7776,22 +7821,22 @@ const Input = ({ node: o }) => {
7776
7821
  return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
7777
7822
  "div",
7778
7823
  {
7779
- onMouseEnter: () => g(m),
7780
- onMouseLeave: () => h(),
7824
+ onMouseEnter: () => g(h),
7825
+ onMouseLeave: () => m(),
7781
7826
  onClick: y,
7782
7827
  style: n,
7783
- "data-node-id": m,
7784
- ref: l.includes(m) ? null : r,
7828
+ "data-node-id": h,
7829
+ ref: l.includes(h) ? null : r,
7785
7830
  onDragStart: () => _(o),
7786
7831
  onDragEnd: () => E(o),
7787
7832
  onDragOver: (T) => {
7788
- T.preventDefault(), j(m, "yes");
7833
+ T.preventDefault(), j(h, "yes");
7789
7834
  },
7790
7835
  onDragLeave: (T) => {
7791
- T.preventDefault(), j(m, "no");
7836
+ T.preventDefault(), j(h, "no");
7792
7837
  },
7793
7838
  onDrop: (T) => {
7794
- T.preventDefault(), j(m, "no");
7839
+ T.preventDefault(), j(h, "no");
7795
7840
  },
7796
7841
  children: [
7797
7842
  d(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((P = o == null ? void 0 : o.parent) == null ? void 0 : P.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
@@ -7815,7 +7860,7 @@ const Input = ({ node: o }) => {
7815
7860
  k && canAcceptChildBlock(f._type, "Icon") ? "bg-green-200" : "",
7816
7861
  (o == null ? void 0 : o.id) === C ? "bg-primary/10" : "",
7817
7862
  b && "opacity-20",
7818
- l.includes(m) ? "opacity-50" : "",
7863
+ l.includes(h) ? "opacity-50" : "",
7819
7864
  L && x && "bg-primary/20 text-primary"
7820
7865
  ),
7821
7866
  children: [
@@ -7852,11 +7897,11 @@ const Input = ({ node: o }) => {
7852
7897
  )
7853
7898
  ] }),
7854
7899
  /* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
7855
- canAddChildBlock(f == null ? void 0 : f._type) && !l.includes(m) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
7900
+ canAddChildBlock(f == null ? void 0 : f._type) && !l.includes(h) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
7856
7901
  /* @__PURE__ */ jsx(
7857
7902
  TooltipTrigger,
7858
7903
  {
7859
- onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: m }),
7904
+ onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: h }),
7860
7905
  className: "cursor-pointer rounded bg-transparent",
7861
7906
  asChild: !0,
7862
7907
  children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3" })
@@ -7869,7 +7914,7 @@ const Input = ({ node: o }) => {
7869
7914
  TooltipTrigger,
7870
7915
  {
7871
7916
  onClick: (T) => {
7872
- T.stopPropagation(), i(m), o.isOpen && o.toggle();
7917
+ T.stopPropagation(), i(h), o.isOpen && o.toggle();
7873
7918
  },
7874
7919
  className: "cursor-pointer rounded bg-transparent",
7875
7920
  asChild: !0,
@@ -7878,7 +7923,7 @@ const Input = ({ node: o }) => {
7878
7923
  ),
7879
7924
  /* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", side: "bottom", children: a("Hide block") })
7880
7925
  ] }),
7881
- /* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: m, children: /* @__PURE__ */ jsx(MoreVertical, { size: "15" }) })
7926
+ /* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: h, children: /* @__PURE__ */ jsx(MoreVertical, { size: "15" }) })
7882
7927
  ] })
7883
7928
  ]
7884
7929
  }
@@ -8143,9 +8188,9 @@ const Input = ({ node: o }) => {
8143
8188
  )
8144
8189
  ] });
8145
8190
  }, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
8146
- const [n] = useDarkMode(), [r, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), { hasPermission: c } = usePermissions(), [d, p] = useTheme(), u = useThemeOptions(), { t: g } = useTranslation(), h = (v) => {
8191
+ const [n] = useDarkMode(), [r, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), { hasPermission: c } = usePermissions(), [d, p] = useTheme(), u = useThemeOptions(), { t: g } = useTranslation(), m = (v) => {
8147
8192
  a(v);
8148
- }, m = () => {
8193
+ }, h = () => {
8149
8194
  const v = l.find((B) => Object.keys(B)[0] === r);
8150
8195
  if (v) {
8151
8196
  const B = Object.values(v)[0];
@@ -8210,7 +8255,7 @@ const Input = ({ node: o }) => {
8210
8255
  "select",
8211
8256
  {
8212
8257
  value: r,
8213
- onChange: (v) => h(v.target.value),
8258
+ onChange: (v) => m(v.target.value),
8214
8259
  className: "w-full space-y-0.5 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8215
8260
  children: [
8216
8261
  /* @__PURE__ */ jsx("option", { value: "", children: "Select preset" }),
@@ -8225,7 +8270,7 @@ const Input = ({ node: o }) => {
8225
8270
  className: "w-full text-sm",
8226
8271
  disabled: r === "",
8227
8272
  variant: "default",
8228
- onClick: m,
8273
+ onClick: h,
8229
8274
  children: g("Apply")
8230
8275
  }
8231
8276
  ) })
@@ -8719,14 +8764,14 @@ function QuickPrompts({ onClick: o }) {
8719
8764
  ) }) });
8720
8765
  }
8721
8766
  const AIUserPrompt = ({ blockId: o }) => {
8722
- 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);
8767
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, g] = useState(), m = useRef(null), h = useRef(null);
8723
8768
  useEffect(() => {
8724
8769
  var x;
8725
- (x = h.current) == null || x.focus();
8770
+ (x = m.current) == null || x.focus();
8726
8771
  }, []);
8727
8772
  const f = (x) => {
8728
8773
  const { usage: k } = x || {};
8729
- !l && k && g(k), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
8774
+ !l && k && g(k), h.current = setTimeout(() => g(void 0), 1e4), l || c("");
8730
8775
  };
8731
8776
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
8732
8777
  /* @__PURE__ */ jsxs(
@@ -8744,14 +8789,14 @@ const AIUserPrompt = ({ blockId: o }) => {
8744
8789
  /* @__PURE__ */ jsx(
8745
8790
  Textarea,
8746
8791
  {
8747
- ref: h,
8792
+ ref: m,
8748
8793
  value: i,
8749
8794
  onChange: (x) => c(x.target.value),
8750
8795
  placeholder: n("Ask AI to edit content"),
8751
8796
  className: "w-full",
8752
8797
  rows: 3,
8753
8798
  onKeyDown: (x) => {
8754
- x.key === "Enter" && (x.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, f));
8799
+ x.key === "Enter" && (x.preventDefault(), h.current && clearTimeout(h.current), g(void 0), r("content", o, i, f));
8755
8800
  }
8756
8801
  }
8757
8802
  ),
@@ -8761,7 +8806,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8761
8806
  {
8762
8807
  disabled: i.trim().length < 5 || a,
8763
8808
  onClick: () => {
8764
- m.current && clearTimeout(m.current), g(void 0), r("content", o, i, f);
8809
+ h.current && clearTimeout(h.current), g(void 0), r("content", o, i, f);
8765
8810
  },
8766
8811
  variant: "default",
8767
8812
  className: "w-fit",
@@ -8794,7 +8839,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8794
8839
  QuickPrompts,
8795
8840
  {
8796
8841
  onClick: (x) => {
8797
- m.current && clearTimeout(m.current), g(void 0), r("content", o, x, f);
8842
+ h.current && clearTimeout(h.current), g(void 0), r("content", o, x, f);
8798
8843
  }
8799
8844
  }
8800
8845
  )
@@ -8804,13 +8849,13 @@ const AIUserPrompt = ({ blockId: o }) => {
8804
8849
  ] }) }) : null
8805
8850
  ] });
8806
8851
  }, AISetContext = () => {
8807
- const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, g] = useState(!1), h = useRef(null);
8852
+ const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, g] = useState(!1), m = useRef(null);
8808
8853
  useEffect(() => {
8809
8854
  n && a(n);
8810
8855
  }, [n]);
8811
- const m = async () => {
8856
+ const h = async () => {
8812
8857
  try {
8813
- d(!0), u(null), await i(r), toast.success(o("Updated AI Context")), h.current.click();
8858
+ d(!0), u(null), await i(r), toast.success(o("Updated AI Context")), m.current.click();
8814
8859
  } catch (f) {
8815
8860
  u(f);
8816
8861
  } finally {
@@ -8826,7 +8871,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8826
8871
  type: "single",
8827
8872
  collapsible: !0,
8828
8873
  children: /* @__PURE__ */ jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
8829
- /* @__PURE__ */ jsx(AccordionTrigger, { ref: h, className: "border-0 border-border py-2", children: /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsx("span", { className: "font-medium", children: o("AI Context") }) }) }),
8874
+ /* @__PURE__ */ jsx(AccordionTrigger, { ref: m, className: "border-0 border-border py-2", children: /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsx("span", { className: "font-medium", children: o("AI Context") }) }) }),
8830
8875
  /* @__PURE__ */ jsxs(AccordionContent, { children: [
8831
8876
  /* @__PURE__ */ jsx(
8832
8877
  Textarea,
@@ -8838,7 +8883,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8838
8883
  className: "mt-1 w-full",
8839
8884
  rows: 10,
8840
8885
  onKeyDown: (f) => {
8841
- f.key === "Enter" && (f.preventDefault(), m());
8886
+ f.key === "Enter" && (f.preventDefault(), h());
8842
8887
  }
8843
8888
  }
8844
8889
  ),
@@ -8850,7 +8895,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8850
8895
  Button,
8851
8896
  {
8852
8897
  disabled: r.trim().length < 5,
8853
- onClick: () => m(),
8898
+ onClick: () => h(),
8854
8899
  variant: "default",
8855
8900
  className: "w-fit",
8856
8901
  size: "sm",
@@ -8879,7 +8924,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8879
8924
  AlertDialogAction,
8880
8925
  {
8881
8926
  onClick: () => {
8882
- a(""), m();
8927
+ a(""), h();
8883
8928
  },
8884
8929
  children: o("Yes, Delete")
8885
8930
  }
@@ -8940,7 +8985,7 @@ function AIChatPanel() {
8940
8985
  }, [o]), useEffect(() => {
8941
8986
  g.current && (g.current.style.height = "auto", g.current.style.height = `${Math.min(g.current.scrollHeight, 120)}px`);
8942
8987
  }, [r]);
8943
- const h = async () => {
8988
+ const m = async () => {
8944
8989
  if (!r.trim() && !c) return;
8945
8990
  const b = {
8946
8991
  id: Date.now().toString(),
@@ -8957,8 +9002,8 @@ function AIChatPanel() {
8957
9002
  };
8958
9003
  n((B) => [...B, v]), i(!1), d(null);
8959
9004
  }, 1500);
8960
- }, m = (b) => {
8961
- b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
9005
+ }, h = (b) => {
9006
+ b.key === "Enter" && !b.shiftKey && (b.preventDefault(), m());
8962
9007
  }, f = (b) => {
8963
9008
  var B;
8964
9009
  const v = (B = b.target.files) == null ? void 0 : B[0];
@@ -9031,7 +9076,7 @@ function AIChatPanel() {
9031
9076
  ref: g,
9032
9077
  value: r,
9033
9078
  onChange: (b) => a(b.target.value),
9034
- onKeyDown: m,
9079
+ onKeyDown: h,
9035
9080
  placeholder: "Ask something...",
9036
9081
  className: "max-h-[120px] min-h-[40px] resize-none border-0 bg-muted/50 py-2.5 pr-10 focus-visible:ring-1"
9037
9082
  }
@@ -9053,7 +9098,7 @@ function AIChatPanel() {
9053
9098
  {
9054
9099
  size: "sm",
9055
9100
  className: "h-10 px-3",
9056
- onClick: h,
9101
+ onClick: m,
9057
9102
  disabled: l || !r.trim() && !c,
9058
9103
  children: [
9059
9104
  /* @__PURE__ */ jsx(Send, { className: "mr-1 h-4 w-4" }),
@@ -9161,18 +9206,18 @@ const AiAssistant = () => {
9161
9206
  preloadedAttributes: n = [],
9162
9207
  onAttributesChange: r
9163
9208
  }) {
9164
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""), f = useRef(null), x = useRef(null), k = usePageExternalData();
9209
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [m, h] = useState(""), f = useRef(null), x = useRef(null), k = usePageExternalData();
9165
9210
  useEffect(() => {
9166
9211
  l(n);
9167
9212
  }, [n]);
9168
9213
  const b = () => {
9169
9214
  if (i.startsWith("@")) {
9170
- m("Attribute keys cannot start with '@'");
9215
+ h("Attribute keys cannot start with '@'");
9171
9216
  return;
9172
9217
  }
9173
9218
  if (i) {
9174
9219
  const C = [...a, { key: i, value: d }];
9175
- r(C), l(a), c(""), p(""), m("");
9220
+ r(C), l(a), c(""), p(""), h("");
9176
9221
  }
9177
9222
  }, v = (C) => {
9178
9223
  const A = a.filter((N, S) => S !== C);
@@ -9181,12 +9226,12 @@ const AiAssistant = () => {
9181
9226
  g(C), c(a[C].key), p(a[C].value);
9182
9227
  }, w = () => {
9183
9228
  if (i.startsWith("@")) {
9184
- m("Attribute keys cannot start with '@'");
9229
+ h("Attribute keys cannot start with '@'");
9185
9230
  return;
9186
9231
  }
9187
9232
  if (u !== null && i) {
9188
9233
  const C = [...a];
9189
- C[u] = { key: i, value: d }, r(C), l(C), g(null), c(""), p(""), m("");
9234
+ C[u] = { key: i, value: d }, r(C), l(C), g(null), c(""), p(""), h("");
9190
9235
  }
9191
9236
  }, _ = (C) => {
9192
9237
  C.key === "Enter" && !C.shiftKey && (C.preventDefault(), u !== null ? w() : b());
@@ -9262,7 +9307,7 @@ const AiAssistant = () => {
9262
9307
  ] })
9263
9308
  ] }),
9264
9309
  /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(Button, { type: "submit", disabled: !i.length, variant: "default", size: "sm", className: "h-8 w-24 text-xs", children: u !== null ? "Save" : "Add" }) }),
9265
- h && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: h })
9310
+ m && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: m })
9266
9311
  ]
9267
9312
  }
9268
9313
  ),
@@ -9393,9 +9438,9 @@ const RootLayout = () => {
9393
9438
  usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
9394
9439
  r("outline");
9395
9440
  });
9396
- const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), h = useCallback((C) => {
9441
+ const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = useCallback((C) => {
9397
9442
  C.preventDefault();
9398
- }, []), m = useCallback(
9443
+ }, []), h = useCallback(
9399
9444
  (C) => {
9400
9445
  r(n === C ? null : C);
9401
9446
  },
@@ -9424,15 +9469,15 @@ const RootLayout = () => {
9424
9469
  }, [n, x]);
9425
9470
  const E = useCallback(
9426
9471
  (C) => {
9427
- m(C);
9472
+ h(C);
9428
9473
  },
9429
- [m]
9474
+ [h]
9430
9475
  );
9431
9476
  return /* @__PURE__ */ jsx("div", { dir: k, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
9432
9477
  /* @__PURE__ */ jsxs(
9433
9478
  "div",
9434
9479
  {
9435
- onContextMenu: h,
9480
+ onContextMenu: m,
9436
9481
  className: "flex h-screen max-h-full flex-col bg-background text-foreground",
9437
9482
  children: [
9438
9483
  /* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
@@ -9686,17 +9731,17 @@ const FEATURE_TOGGLES = {
9686
9731
  for (const i of n.p)
9687
9732
  l.add(i);
9688
9733
  return l;
9689
- }, 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) => {
9734
+ }, 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 = (h, ...f) => h.read(...f), p = (h, ...f) => h.write(...f), u = (h, f) => {
9690
9735
  var x;
9691
- return (x = m.unstable_onInit) == null ? void 0 : x.call(m, f);
9692
- }, g = (m, f) => {
9736
+ return (x = h.unstable_onInit) == null ? void 0 : x.call(h, f);
9737
+ }, g = (h, f) => {
9693
9738
  var x;
9694
- return (x = m.onMount) == null ? void 0 : x.call(m, f);
9695
- }, ...h) => {
9696
- const m = h[0] || ((A) => {
9739
+ return (x = h.onMount) == null ? void 0 : x.call(h, f);
9740
+ }, ...m) => {
9741
+ const h = m[0] || ((A) => {
9697
9742
  let N = o.get(A);
9698
9743
  return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(A, N), u == null || u(A, C)), N;
9699
- }), f = h[1] || (() => {
9744
+ }), f = m[1] || (() => {
9700
9745
  let A, N;
9701
9746
  const S = (y) => {
9702
9747
  try {
@@ -9715,10 +9760,10 @@ const FEATURE_TOGGLES = {
9715
9760
  } while (a.size || i.size || l.size);
9716
9761
  if (A)
9717
9762
  throw N;
9718
- }), x = h[2] || (() => {
9763
+ }), x = m[2] || (() => {
9719
9764
  const A = [], N = /* @__PURE__ */ new WeakSet(), S = /* @__PURE__ */ new WeakSet(), y = Array.from(a);
9720
9765
  for (; y.length; ) {
9721
- const j = y[y.length - 1], I = m(j);
9766
+ const j = y[y.length - 1], I = h(j);
9722
9767
  if (S.has(j)) {
9723
9768
  y.pop();
9724
9769
  continue;
@@ -9741,9 +9786,9 @@ const FEATURE_TOGGLES = {
9741
9786
  }
9742
9787
  P && (k(I), B(I)), r.delete(I);
9743
9788
  }
9744
- }), k = h[3] || ((A) => {
9789
+ }), k = m[3] || ((A) => {
9745
9790
  var N, S;
9746
- const y = m(A);
9791
+ const y = h(A);
9747
9792
  if (isAtomStateInitialized(y) && (n.has(A) && r.get(A) !== y.n || Array.from(y.d).every(
9748
9793
  ([R, $]) => (
9749
9794
  // Recursively, read the atom state of the dependency, and
@@ -9759,10 +9804,10 @@ const FEATURE_TOGGLES = {
9759
9804
  }, L = (R) => {
9760
9805
  var $;
9761
9806
  if (isSelfAtom(A, R)) {
9762
- const U = m(R);
9807
+ const U = h(R);
9763
9808
  if (!isAtomStateInitialized(U))
9764
9809
  if (hasInitialValue(R))
9765
- setAtomStateValueOrPromise(R, R.init, m);
9810
+ setAtomStateValueOrPromise(R, R.init, h);
9766
9811
  else
9767
9812
  throw new Error("no atom init");
9768
9813
  return returnAtomValue(U);
@@ -9792,7 +9837,7 @@ const FEATURE_TOGGLES = {
9792
9837
  }, O = y.n;
9793
9838
  try {
9794
9839
  const R = d(A, L, D);
9795
- return setAtomStateValueOrPromise(A, R, m), isPromiseLike$1(R) && ((N = R.onCancel) == null || N.call(R, () => P == null ? void 0 : P.abort()), R.then(
9840
+ return setAtomStateValueOrPromise(A, R, h), isPromiseLike$1(R) && ((N = R.onCancel) == null || N.call(R, () => P == null ? void 0 : P.abort()), R.then(
9796
9841
  I,
9797
9842
  I
9798
9843
  )), y;
@@ -9801,26 +9846,26 @@ const FEATURE_TOGGLES = {
9801
9846
  } finally {
9802
9847
  j = !1, O !== y.n && r.get(A) === O && (r.set(A, y.n), a.add(A), (S = c.c) == null || S.call(c, A));
9803
9848
  }
9804
- }), b = h[4] || ((A) => {
9849
+ }), b = m[4] || ((A) => {
9805
9850
  const N = [A];
9806
9851
  for (; N.length; ) {
9807
- const S = N.pop(), y = m(S);
9852
+ const S = N.pop(), y = h(S);
9808
9853
  for (const j of getMountedOrPendingDependents(S, y, n)) {
9809
- const I = m(j);
9854
+ const I = h(j);
9810
9855
  r.set(j, I.n), N.push(j);
9811
9856
  }
9812
9857
  }
9813
- }), v = h[5] || ((A, ...N) => {
9858
+ }), v = m[5] || ((A, ...N) => {
9814
9859
  let S = !0;
9815
9860
  const y = (I) => returnAtomValue(k(I)), j = (I, ...L) => {
9816
9861
  var P;
9817
- const T = m(I);
9862
+ const T = h(I);
9818
9863
  try {
9819
9864
  if (isSelfAtom(A, I)) {
9820
9865
  if (!hasInitialValue(I))
9821
9866
  throw new Error("atom not writable");
9822
9867
  const D = T.n, O = L[0];
9823
- setAtomStateValueOrPromise(I, O, m), B(I), D !== T.n && (a.add(I), (P = c.c) == null || P.call(c, I), b(I));
9868
+ setAtomStateValueOrPromise(I, O, h), B(I), D !== T.n && (a.add(I), (P = c.c) == null || P.call(c, I), b(I));
9824
9869
  return;
9825
9870
  } else
9826
9871
  return v(I, ...L);
@@ -9833,13 +9878,13 @@ const FEATURE_TOGGLES = {
9833
9878
  } finally {
9834
9879
  S = !1;
9835
9880
  }
9836
- }), B = h[6] || ((A) => {
9881
+ }), B = m[6] || ((A) => {
9837
9882
  var N;
9838
- const S = m(A), y = n.get(A);
9883
+ const S = h(A), y = n.get(A);
9839
9884
  if (y && !isPendingPromise(S.v)) {
9840
9885
  for (const [j, I] of S.d)
9841
9886
  if (!y.d.has(j)) {
9842
- const L = m(j);
9887
+ const L = h(j);
9843
9888
  w(j).t.add(A), y.d.add(j), I !== L.n && (a.add(j), (N = c.c) == null || N.call(c, j), b(j));
9844
9889
  }
9845
9890
  for (const j of y.d || [])
@@ -9849,9 +9894,9 @@ const FEATURE_TOGGLES = {
9849
9894
  I == null || I.t.delete(A);
9850
9895
  }
9851
9896
  }
9852
- }), w = h[7] || ((A) => {
9897
+ }), w = m[7] || ((A) => {
9853
9898
  var N;
9854
- const S = m(A);
9899
+ const S = h(A);
9855
9900
  let y = n.get(A);
9856
9901
  if (!y) {
9857
9902
  k(A);
@@ -9889,9 +9934,9 @@ const FEATURE_TOGGLES = {
9889
9934
  }
9890
9935
  }
9891
9936
  return y;
9892
- }), _ = h[8] || ((A) => {
9937
+ }), _ = m[8] || ((A) => {
9893
9938
  var N;
9894
- const S = m(A);
9939
+ const S = h(A);
9895
9940
  let y = n.get(A);
9896
9941
  if (y && !y.l.size && !Array.from(y.t).some((j) => {
9897
9942
  var I;
@@ -9920,7 +9965,7 @@ const FEATURE_TOGGLES = {
9920
9965
  u,
9921
9966
  g,
9922
9967
  // building-block functions
9923
- m,
9968
+ h,
9924
9969
  f,
9925
9970
  x,
9926
9971
  k,
@@ -10131,6 +10176,7 @@ export {
10131
10176
  usePreviewMode,
10132
10177
  useRemoveBlocks,
10133
10178
  useRemoveClassesFromBlocks,
10179
+ useResetBlockStyles,
10134
10180
  useRightPanel,
10135
10181
  useSavePage,
10136
10182
  useScreenSizeWidth,