@chaibuilder/sdk 2.3.1 → 2.3.2

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,14 +3,14 @@ var V = (o, n, r) => n in o ? U(o, n, { enumerable: !0, configurable: !0, writab
3
3
  var F = (o, n, r) => V(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, 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";
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";
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 { 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";
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-DW7GHkUt.js";
14
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";
@@ -32,7 +32,6 @@ 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";
36
35
  import Autosuggest from "react-autosuggest";
37
36
  import { useFeature } from "flagged";
38
37
  import { parse, stringify } from "himalaya";
@@ -47,6 +46,7 @@ import "@mhsdesign/jit-browser-tailwindcss";
47
46
  import twContainer from "@tailwindcss/container-queries";
48
47
  import { ErrorBoundary } from "react-error-boundary";
49
48
  import { motion } from "framer-motion";
49
+ import "next-themes";
50
50
  import { useHotkeys } from "react-hotkeys-hook";
51
51
  import { flip } from "@floating-ui/dom";
52
52
  import { useFloating, shift } from "@floating-ui/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, (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")
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")
302
302
  pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, o);
303
303
  else {
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);
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);
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((m) => m._parent === r)) {
341
- const h = {
340
+ if (u && u.content !== void 0 && u.content !== "" && !o.some((h) => h._parent === r)) {
341
+ const m = {
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((x) => {
348
- x.startsWith("content-") && (h[x] = u[x]);
349
- }), l.unshift(h), i = i.map((x) => {
348
+ x.startsWith("content-") && (m[x] = u[x]);
349
+ }), l.unshift(m), i = i.map((x) => {
350
350
  if (x._id === r) {
351
351
  const f = { ...x, content: "" };
352
352
  return Object.keys(f).forEach((y) => {
@@ -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((m) => m.model._id === n);
389
+ let c = (u = i == null ? void 0 : i.children) == null ? void 0 : u.findIndex((h) => h.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 (m) {
395
- return console.error("Error adding child to parent:", m), !1;
394
+ } catch (h) {
395
+ return console.error("Error adding child to parent:", h), !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((m) => {
437
- m.startsWith("content-") && (g[m] = "");
436
+ return Object.keys(g).forEach((h) => {
437
+ h.startsWith("content-") && (g[h] = "");
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((m) => m._id === n);
454
+ const g = u.find((h) => h._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((m) => m._id === d);
478
+ const p = r.find((h) => h._id === d);
479
479
  if (!p || !p._parent) return;
480
- const u = p._parent, g = r.filter((m) => m._parent === u);
480
+ const u = p._parent, g = r.filter((h) => h._parent === u);
481
481
  if (g.length === 2) {
482
- const m = g.find((h) => h._id !== d);
483
- if (m && m._type === "Text") {
484
- const h = r.find((x) => x._id === u);
485
- h && "content" in h && (r = r.map((x) => {
482
+ const h = g.find((m) => m._id !== d);
483
+ if (h && h._type === "Text") {
484
+ const m = r.find((x) => x._id === u);
485
+ m && "content" in m && (r = r.map((x) => {
486
486
  if (x._id === u) {
487
- const f = { ...x, content: m.content };
488
- return Object.keys(m).forEach((y) => {
489
- y.startsWith("content-") && (f[y] = m[y]);
487
+ const f = { ...x, content: h.content };
488
+ return Object.keys(h).forEach((y) => {
489
+ y.startsWith("content-") && (f[y] = h[y]);
490
490
  }), f;
491
491
  }
492
492
  return x;
493
- }), a.push(m._id));
493
+ }), a.push(h._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 (x) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), g = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), m = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
575
+ }), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (x) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), g = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), h = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
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 && !m || (i((x) => ({ ...x, status: "loading", props: {} })), d({ block: o }).then((x = {}) => {
587
+ n === "live" && (!g && !h || (i((x) => ({ ...x, status: "loading", props: {} })), d({ block: o }).then((x = {}) => {
588
588
  g ? (p((f) => ({
589
589
  ...f,
590
590
  [o._id]: {
@@ -599,7 +599,7 @@ const useBlockRepeaterDataAtom = () => useAtom$1(blockRepeaterDataAtom), useAsyn
599
599
  [o._id]: { status: "error", error: x, props: [] }
600
600
  })), i((f) => ({ ...f, status: "error", error: x, props: {} }))) : i((f) => ({ ...f, status: "error", error: x, props: {} }));
601
601
  })));
602
- }, [o == null ? void 0 : o._id, u, g, m, a, n]), {
602
+ }, [o == null ? void 0 : o._id, u, g, h, 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 h;
867
+ var m;
868
868
  for (let x = 0; x < i.length; x++) {
869
869
  const { _id: f } = i[x];
870
870
  i[x]._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([(h = first(i)) == null ? void 0 : h._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([(m = first(i)) == null ? void 0 : m._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 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;
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;
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, m = (h, x) => {
2336
- const f = cloneDeep(x.find((y) => y._id === h));
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, x) => {
2336
+ const f = cloneDeep(x.find((y) => y._id === m));
2337
2337
  for (const y in f) {
2338
2338
  const b = f[y];
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 (h, x, f, y) => {
2349
+ async (m, x, f, y) => {
2350
2350
  if (l) {
2351
2351
  n(!0), a(null);
2352
2352
  try {
2353
- const b = p === u ? "" : p, v = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(x, d)), p) : [m(x, d)], B = await l(h, addLangToPrompt(f, g, h), v, b), { blocks: w, error: _ } = B;
2353
+ const b = p === u ? "" : p, v = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(x, d)), p) : [h(x, d)], B = await l(m, addLangToPrompt(f, g, m), v, b), { blocks: w, error: _ } = B;
2354
2354
  if (_) {
2355
2355
  a(_);
2356
2356
  return;
2357
2357
  }
2358
- if (h === "styles") {
2358
+ if (m === "styles") {
2359
2359
  const E = w.map((S) => {
2360
2360
  for (const A in S)
2361
2361
  A !== "_id" && (S[A] = `${STYLES_KEY},${S[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 m = getDuplicatedBlocks(o, g, null);
2461
+ const h = getDuplicatedBlocks(o, g, null);
2462
2462
  if (!p)
2463
- return m;
2464
- let h = [];
2465
- for (const x of m)
2463
+ return h;
2464
+ let m = [];
2465
+ for (const x of h)
2466
2466
  if (x._type === "PartialBlock" || x._type === "GlobalBlock") {
2467
2467
  let f = l(x.partialBlockId);
2468
- x._parent && (f == null ? void 0 : f.length) > 0 && (f = f.map((y) => (isEmpty(y._parent) && set(y, "_parent", x._parent), y))), h = [...h, ...f];
2468
+ x._parent && (f == null ? void 0 : f.length) > 0 && (f = f.map((y) => (isEmpty(y._parent) && set(y, "_parent", x._parent), y))), m = [...m, ...f];
2469
2469
  } else
2470
- h.push(x);
2471
- return h;
2470
+ m.push(x);
2471
+ return m;
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((h) => h._id === c);
2509
+ const d = o.find((m) => m._id === c);
2510
2510
  l ? l === "root" && (l = null) : l = d._parent;
2511
2511
  const g = filter(
2512
2512
  o,
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", ""));
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", ""));
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, (m) => {
2653
- const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2652
+ return each(p, (h) => {
2653
+ const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
2654
2654
  u = u.replace(x, " ").replace(/\s+/g, " ").trim();
2655
- const f = first(m.split(":"));
2656
- includes(["2xl", "xl", "lg", "md", "sm"], f) && p.push(m.split(":").pop().trim());
2657
- }), each(p, (m) => {
2658
- const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2655
+ const f = first(h.split(":"));
2656
+ includes(["2xl", "xl", "lg", "md", "sm"], f) && p.push(h.split(":").pop().trim());
2657
+ }), each(p, (h) => {
2658
+ const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
2659
2659
  g = g.replace(x, " ").replace(/\s+/g, " ").trim();
2660
2660
  }), {
2661
2661
  ids: [d._id],
@@ -2789,11 +2789,11 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2789
2789
  return "VERTICAL";
2790
2790
  }
2791
2791
  }, isDisabledControl = (o, n, r) => !!(o && (r === "UP" || r === "LEFT") || n && (r === "DOWN" || r === "RIGHT")), useBlockController = (o, n) => {
2792
- const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (f) => c ? get(f, "_parent") === c : !get(f, "_parent")), p = (d == null ? void 0 : d.length) <= 1, u = findIndex(d, { _id: i }), g = u <= 0, m = u + 1 === (d == null ? void 0 : d.length), h = getParentBlockOrientation(c, i, a), x = useCallback(
2792
+ const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (f) => c ? get(f, "_parent") === c : !get(f, "_parent")), p = (d == null ? void 0 : d.length) <= 1, u = findIndex(d, { _id: i }), g = u <= 0, h = u + 1 === (d == null ? void 0 : d.length), m = getParentBlockOrientation(c, i, a), x = useCallback(
2793
2793
  (f) => {
2794
- isDisabledControl(g, m, f) || p || (f === "UP" || f === "LEFT" ? l([i], c || null, u - 1) : (f === "DOWN" || f === "RIGHT") && l([i], c || null, u + 2), n());
2794
+ isDisabledControl(g, h, f) || p || (f === "UP" || f === "LEFT" ? l([i], c || null, u - 1) : (f === "DOWN" || f === "RIGHT") && l([i], c || null, u + 2), n());
2795
2795
  },
2796
- [g, m, p, u, i, c, n]
2796
+ [g, h, p, u, i, c, n]
2797
2797
  );
2798
2798
  return useHotkeys(
2799
2799
  "shift+up, shift+down, shift+left, shift+right",
@@ -2803,7 +2803,7 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2803
2803
  },
2804
2804
  { document: a == null ? void 0 : a.contentDocument },
2805
2805
  [x]
2806
- ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: m, moveBlock: x, orientation: h };
2806
+ ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: h, moveBlock: x, orientation: m };
2807
2807
  }, BlockController = ({ block: o, updateFloatingBar: n }) => {
2808
2808
  const { isOnlyChild: r, isFirstBlock: a, isLastBlock: l, moveBlock: i, orientation: c } = useBlockController(
2809
2809
  o,
@@ -2943,19 +2943,19 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
2943
2943
  i([null]);
2944
2944
  }, [r, n]), /* @__PURE__ */ jsx(BlockFloatingSelector, { block: o, selectedBlockElement: a[0] });
2945
2945
  }, BlockFloatingSelector = ({ block: o, selectedBlockElement: n }) => {
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({
2946
+ 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({
2947
2947
  placement: "top-start",
2948
2948
  middleware: [shift(), flip()],
2949
2949
  elements: { reference: n }
2950
2950
  });
2951
- useResizeObserver(n, () => h(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => h(), (u == null ? void 0 : u.body) !== null);
2951
+ useResizeObserver(n, () => m(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => m(), (u == null ? void 0 : u.body) !== null);
2952
2952
  const x = get(o, "_parent", null), f = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
2953
2953
  return !n || !o || p ? null : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
2954
2954
  "div",
2955
2955
  {
2956
2956
  role: "button",
2957
2957
  tabIndex: 0,
2958
- ref: m.setFloating,
2958
+ ref: h.setFloating,
2959
2959
  style: g,
2960
2960
  onClick: (y) => {
2961
2961
  y.stopPropagation(), y.preventDefault();
@@ -2980,7 +2980,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
2980
2980
  /* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "hover:scale-105" }) }),
2981
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,
2982
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,
2983
- d(PERMISSIONS.MOVE_BLOCK) && /* @__PURE__ */ jsx(BlockController, { block: o, updateFloatingBar: h })
2983
+ d(PERMISSIONS.MOVE_BLOCK) && /* @__PURE__ */ jsx(BlockController, { block: o, updateFloatingBar: m })
2984
2984
  ] })
2985
2985
  ]
2986
2986
  }
@@ -3115,20 +3115,20 @@ F(Frame, "defaultProps", {
3115
3115
  initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
3116
3116
  });
3117
3117
  const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame, { ...o, forwardedRef: n })), useKeyEventWatcher = (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 } : {};
3118
+ 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 } : {};
3119
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(
3120
3120
  "ctrl+c,command+c",
3121
3121
  () => u(n),
3122
- { ...h, enabled: !isEmpty(n), preventDefault: !0 },
3122
+ { ...m, enabled: !isEmpty(n), preventDefault: !0 },
3123
3123
  [n, u]
3124
3124
  ), useHotkeys(
3125
3125
  "ctrl+v,command+v",
3126
3126
  () => {
3127
- g(n[0]) && m(n);
3127
+ g(n[0]) && h(n);
3128
3128
  },
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 }, [
3129
+ { ...m, enabled: !isEmpty(n), preventDefault: !0 },
3130
+ [n, g, h]
3131
+ ), useHotkeys("esc", () => r([]), m, [r]), useHotkeys("ctrl+d,command+d", () => i(n), { ...m, enabled: !isEmpty(n), preventDefault: !0 }, [
3132
3132
  n,
3133
3133
  i
3134
3134
  ]), useHotkeys(
@@ -3136,7 +3136,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3136
3136
  (x) => {
3137
3137
  x.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
3138
3138
  },
3139
- h,
3139
+ m,
3140
3140
  [n, l]
3141
3141
  );
3142
3142
  }, KeyboardHandler = () => {
@@ -3427,7 +3427,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3427
3427
  ],
3428
3428
  onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
3429
3429
  onBlur: ({ editor: u, event: g }) => {
3430
- const m = g.relatedTarget, h = i.querySelector(".ProseMirror"), x = i.querySelector(".tippy-box"), f = h == null ? void 0 : h.contains(m), y = x == null ? void 0 : x.contains(m);
3430
+ const h = g.relatedTarget, m = i.querySelector(".ProseMirror"), x = i.querySelector(".tippy-box"), f = m == null ? void 0 : m.contains(h), y = x == null ? void 0 : x.contains(h);
3431
3431
  if (!f && !y) {
3432
3432
  const b = (u == null ? void 0 : u.getHTML()) || "";
3433
3433
  r(b);
@@ -3445,10 +3445,10 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3445
3445
  });
3446
3446
  }, [c]);
3447
3447
  const d = useMemo(() => {
3448
- var m;
3448
+ var h;
3449
3449
  const u = "max-w-none shadow-none outline outline-[2px] outline-green-500 [&_*]:shadow-none";
3450
3450
  if (!n) return u;
3451
- const g = ((m = n == null ? void 0 : n.className) == null ? void 0 : m.replace("sr-only", "")) || "";
3451
+ const g = ((h = n == null ? void 0 : n.className) == null ? void 0 : h.replace("sr-only", "")) || "";
3452
3452
  return `${u} ${g}`;
3453
3453
  }, [n]), p = useCallback(
3454
3454
  (u) => {
@@ -3483,28 +3483,28 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3483
3483
  useEffect(() => {
3484
3484
  if (a.current) {
3485
3485
  a.current.innerText = n, a.current.focus();
3486
- const h = c.createRange(), x = d.getSelection();
3487
- h.selectNodeContents(a.current), h.collapse(!1), x == null || x.removeAllRanges(), x == null || x.addRange(h), a.current.focus();
3486
+ const m = c.createRange(), x = d.getSelection();
3487
+ m.selectNodeContents(a.current), m.collapse(!1), x == null || x.removeAllRanges(), x == null || x.addRange(m), a.current.focus();
3488
3488
  } else
3489
3489
  r();
3490
3490
  }, [c, d]);
3491
3491
  const p = useMemo(() => {
3492
3492
  var x;
3493
- const h = ((x = o == null ? void 0 : o.tagName) == null ? void 0 : x.toLowerCase()) || "div";
3494
- return h === "button" ? "div" : h;
3493
+ const m = ((x = o == null ? void 0 : o.tagName) == null ? void 0 : x.toLowerCase()) || "div";
3494
+ return m === "button" ? "div" : m;
3495
3495
  }, [o]), u = useCallback(
3496
- (h) => {
3497
- (h.key === "Enter" || h.key === "Escape") && i(h);
3496
+ (m) => {
3497
+ (m.key === "Enter" || m.key === "Escape") && i(m);
3498
3498
  },
3499
3499
  [i]
3500
3500
  ), g = useCallback(() => {
3501
3501
  r();
3502
- }, [r]), m = useMemo(() => {
3503
- var h;
3502
+ }, [r]), h = useMemo(() => {
3503
+ var m;
3504
3504
  return {
3505
3505
  id: "active-inline-editing-element",
3506
3506
  contentEditable: !0,
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]`,
3507
+ 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]`,
3508
3508
  style: cloneDeep(o == null ? void 0 : o.style) || {},
3509
3509
  onInput: (x) => {
3510
3510
  const f = x.target;
@@ -3519,12 +3519,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3519
3519
  ref: a,
3520
3520
  onBlur: g,
3521
3521
  onKeyDown: u,
3522
- ...m
3522
+ ...h
3523
3523
  }) });
3524
3524
  }
3525
3525
  ), WithBlockTextEditor = memo(
3526
3526
  ({ block: o, children: n }) => {
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: x } = useLanguages(), [, f] = useSelectedBlockIds(), y = 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: h } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: x } = useLanguages(), [, f] = useSelectedBlockIds(), y = useRef(null), b = l, { blockContent: v, blockType: B } = useMemo(() => {
3528
3528
  var j;
3529
3529
  const A = o._type;
3530
3530
  let N = o[r];
@@ -3534,14 +3534,14 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3534
3534
  (A) => {
3535
3535
  var C;
3536
3536
  const N = A || ((C = g.current) == null ? void 0 : C.innerText);
3537
- h([b], { [r]: N }), u(null), c(null), d(-1), f([]);
3537
+ m([b], { [r]: N }), u(null), c(null), d(-1), f([]);
3538
3538
  },
3539
- [b, h, c, f, x]
3539
+ [b, m, c, f, x]
3540
3540
  ), _ = useDebouncedCallback(
3541
3541
  (A) => {
3542
- h([b], { [r]: A });
3542
+ m([b], { [r]: A });
3543
3543
  },
3544
- [b, o, h, x],
3544
+ [b, o, m, x],
3545
3545
  1e3
3546
3546
  ), E = useCallback(
3547
3547
  (A) => {
@@ -3558,7 +3558,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3558
3558
  const A = `[data-block-id="${b}"]`, N = i >= 0 ? `[data-block-index="${i}"]` : "", C = a.querySelector(`${A}${N}`);
3559
3559
  C && ((k = C == null ? void 0 : C.classList) == null || k.add("sr-only"), u(C));
3560
3560
  }, [b, B, a, i]);
3561
- const S = useMemo(() => p ? (m(), B === "RichText" ? /* @__PURE__ */ jsx(
3561
+ const S = useMemo(() => p ? (h(), B === "RichText" ? /* @__PURE__ */ jsx(
3562
3562
  RichTextEditor,
3563
3563
  {
3564
3564
  blockContent: v,
@@ -3612,12 +3612,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3612
3612
  blockAtom: n,
3613
3613
  children: r
3614
3614
  }) => {
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), x = get(c, "component", null), { index: f, key: y } = useContext(RepeaterContext), b = useMemo(
3616
- () => h ? 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(), [h] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom), x = get(c, "component", null), { index: f, key: y } = useContext(RepeaterContext), b = useMemo(
3616
+ () => m ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
3617
3617
  index: f,
3618
3618
  key: y
3619
3619
  }) : applyLanguage(i, d, c),
3620
- [i, d, c, g, h, f, y]
3620
+ [i, d, c, g, m, f, y]
3621
3621
  ), v = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), B = useMemo(
3622
3622
  () => u(i._id, getBlockRuntimeProps(i._type)),
3623
3623
  [i._id, i._type, u, getBlockRuntimeProps]
@@ -3642,7 +3642,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3642
3642
  o
3643
3643
  ]
3644
3644
  ), _ = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
3645
- if (isNull(x) || m.includes(i._id)) return null;
3645
+ if (isNull(x) || h.includes(i._id)) return null;
3646
3646
  let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(x, {
3647
3647
  ...w,
3648
3648
  children: r({
@@ -3697,7 +3697,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3697
3697
  );
3698
3698
  return map(l, (c) => {
3699
3699
  const d = a(c._id);
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: x }) => g === "Repeater" ? isArray(h) && h.map((f, y) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: y, key: x }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) }, `${u}-${y}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: m }) }) : 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: h, repeaterItems: m, $repeaterItemsKey: x }) => g === "Repeater" ? isArray(m) && m.map((f, y) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: y, key: x }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) }, `${u}-${y}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: h }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) : null }) }, c._id) : null;
3701
3701
  });
3702
3702
  }, PageBlocksRenderer = () => {
3703
3703
  const [o] = useBlocksStore();
@@ -3711,11 +3711,11 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3711
3711
  if (d < n) {
3712
3712
  const u = parseFloat((d / n).toFixed(2).toString());
3713
3713
  let g = {};
3714
- const m = p * u, h = d * u;
3714
+ const h = p * u, m = d * u;
3715
3715
  p && (g = {
3716
3716
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
3717
- height: 100 + (p - m) / m * 100 + "%",
3718
- width: 100 + (d - h) / h * 100 + "%"
3717
+ height: 100 + (p - h) / h * 100 + "%",
3718
+ width: 100 + (d - m) / m * 100 + "%"
3719
3719
  }), i({
3720
3720
  position: "relative",
3721
3721
  top: 0,
@@ -3764,19 +3764,19 @@ const CanvasEventsWatcher = () => {
3764
3764
  }), null;
3765
3765
  }, StaticCanvas = () => {
3766
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(
3767
- (h) => {
3768
- i((x) => ({ ...x, width: h }));
3767
+ (m) => {
3768
+ i((x) => ({ ...x, width: m }));
3769
3769
  },
3770
3770
  [i]
3771
3771
  );
3772
3772
  useEffect(() => {
3773
3773
  if (!a.current) return;
3774
- const { clientWidth: h, clientHeight: x } = a.current;
3775
- i({ width: h, height: x });
3774
+ const { clientWidth: m, clientHeight: x } = a.current;
3775
+ i({ width: m, height: x });
3776
3776
  }, [a, o]);
3777
- const m = useMemo(() => {
3778
- let h = IframeInitialContent;
3779
- return h = h.replace("__HTML_DIR__", u), h;
3777
+ const h = useMemo(() => {
3778
+ let m = IframeInitialContent;
3779
+ return m = m.replace("__HTML_DIR__", u), m;
3780
3780
  }, [u]);
3781
3781
  return /* @__PURE__ */ jsx(ResizableCanvasWrapper, { onMount: g, onResize: g, children: /* @__PURE__ */ jsx(
3782
3782
  "div",
@@ -3792,7 +3792,7 @@ const CanvasEventsWatcher = () => {
3792
3792
  id: "canvas-iframe",
3793
3793
  style: { ...c, ...isEmpty(c) ? { width: `${o}px` } : {} },
3794
3794
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3795
- initialContent: m,
3795
+ initialContent: h,
3796
3796
  children: [
3797
3797
  /* @__PURE__ */ jsx(KeyboardHandler, {}),
3798
3798
  /* @__PURE__ */ jsx(BlockSelectionHighlighter, {}),
@@ -3822,7 +3822,7 @@ const CanvasEventsWatcher = () => {
3822
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: [
3823
3823
  /* @__PURE__ */ jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
3824
3824
  /* @__PURE__ */ jsx("p", { children: "Please try again." })
3825
- ] }) }), CodeEditor$1 = React__default.lazy(() => import("./code-editor-DCGe1BPZ.js")), CanvasArea = () => {
3825
+ ] }) }), CodeEditor$1 = React__default.lazy(() => import("./code-editor-BqhH_IQC.js")), CanvasArea = () => {
3826
3826
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3827
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: [
3828
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, {}) }) }),
@@ -3887,7 +3887,7 @@ const CanvasEventsWatcher = () => {
3887
3887
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG code to use as an icon") })
3888
3888
  ] });
3889
3889
  }, DefaultMediaManager = ({ close: o, onSelect: n, mode: r = "image" }) => {
3890
- const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), m = async (x) => {
3890
+ const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), h = async (x) => {
3891
3891
  if (!x.trim()) {
3892
3892
  p(!1), g("Please enter a URL");
3893
3893
  return;
@@ -3899,9 +3899,9 @@ const CanvasEventsWatcher = () => {
3899
3899
  } finally {
3900
3900
  c(!1);
3901
3901
  }
3902
- }, { t: h } = useTranslation();
3902
+ }, { t: m } = useTranslation();
3903
3903
  return /* @__PURE__ */ jsxs("div", { className: "flex w-96 flex-col gap-4 p-4", children: [
3904
- /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: h(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
3904
+ /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: m(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
3905
3905
  u && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
3906
3906
  /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
3907
3907
  /* @__PURE__ */ jsx(AlertDescription, { children: u })
@@ -3910,20 +3910,20 @@ const CanvasEventsWatcher = () => {
3910
3910
  /* @__PURE__ */ jsx(
3911
3911
  Input$1,
3912
3912
  {
3913
- placeholder: h(`Enter ${r} URL`),
3913
+ placeholder: m(`Enter ${r} URL`),
3914
3914
  value: a,
3915
3915
  onChange: (x) => l(x.target.value),
3916
- onKeyUp: () => m(a)
3916
+ onKeyUp: () => h(a)
3917
3917
  }
3918
3918
  ),
3919
3919
  /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
3920
- /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: o, children: h("Cancel") }),
3920
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: o, children: m("Cancel") }),
3921
3921
  /* @__PURE__ */ jsx(
3922
3922
  Button,
3923
3923
  {
3924
3924
  onClick: () => n({ id: "dam-id", url: a, width: 600, height: 400, description: "This is image description" }),
3925
3925
  disabled: !d || i,
3926
- children: h("Insert")
3926
+ children: m("Insert")
3927
3927
  }
3928
3928
  )
3929
3929
  ] })
@@ -3950,16 +3950,16 @@ const CanvasEventsWatcher = () => {
3950
3950
  MediaManagerModal.displayName = "MediaManagerModal";
3951
3951
  const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
3952
3952
  const { t: l } = useTranslation(), i = useSelectedBlock(), c = useUpdateBlocksProps(), d = (g) => {
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, x = m == null ? void 0 : m.height;
3953
+ const h = isArray(g) ? first(g) : g;
3954
+ if (h) {
3955
+ n(h == null ? void 0 : h.url);
3956
+ const m = h == null ? void 0 : h.width, x = h == null ? void 0 : h.height;
3957
3957
  if (i != null && i._id) {
3958
3958
  const f = {
3959
- ...h && { width: h },
3959
+ ...m && { width: m },
3960
3960
  ...x && { height: x },
3961
- ...m.description && { alt: m.description },
3962
- ...m.id && { assetId: m.id }
3961
+ ...h.description && { alt: h.description },
3962
+ ...h.id && { assetId: h.id }
3963
3963
  };
3964
3964
  if (isEmpty(f)) return;
3965
3965
  c([i._id], f);
@@ -4004,18 +4004,18 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
4004
4004
  ] })
4005
4005
  ] });
4006
4006
  }, PathDropdown = ({ data: o, onSelect: n, dataType: 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 = (x) => r === "value" ? x === "value" || x === "object" : r === "array" ? x === "array" : x === r;
4010
- m.type === "object" ? (l((x) => [...x, m.key]), c(m.value)) : h(m.type) && n([...a, m.key].join("."), r);
4007
+ 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(
4008
+ (h) => {
4009
+ const m = (x) => r === "value" ? x === "value" || x === "object" : r === "array" ? x === "array" : x === r;
4010
+ h.type === "object" ? (l((x) => [...x, h.key]), c(h.value)) : m(h.type) && n([...a, h.key].join("."), r);
4011
4011
  },
4012
4012
  [a, n, r]
4013
4013
  ), u = React__default.useCallback(() => {
4014
4014
  if (a.length > 0) {
4015
- const m = a.slice(0, -1);
4016
- l(m), c(m.reduce((h, x) => h[x], o));
4015
+ const h = a.slice(0, -1);
4016
+ l(h), c(h.reduce((m, x) => m[x], o));
4017
4017
  }
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]);
4018
+ }, [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]);
4019
4019
  return /* @__PURE__ */ jsxs(Command, { className: "fields-command", children: [
4020
4020
  /* @__PURE__ */ jsx(CommandInput, { className: "border-none", placeholder: "Search..." }),
4021
4021
  /* @__PURE__ */ jsxs(CommandList, { children: [
@@ -4025,36 +4025,36 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
4025
4025
  /* @__PURE__ */ jsx(ChevronLeft, { className: "mr-2 h-4 w-4" }),
4026
4026
  "Back"
4027
4027
  ] }),
4028
- g.map((m) => /* @__PURE__ */ jsxs(
4028
+ g.map((h) => /* @__PURE__ */ jsxs(
4029
4029
  CommandItem,
4030
4030
  {
4031
- value: m.key,
4031
+ value: h.key,
4032
4032
  disabled: !1,
4033
- onSelect: () => p(m),
4033
+ onSelect: () => p(h),
4034
4034
  className: "flex items-center justify-between",
4035
4035
  children: [
4036
4036
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-2", children: [
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
4037
+ startsWith(h.key, REPEATER_PREFIX) ? /* @__PURE__ */ jsx(LoopIcon, {}) : startsWith(h.key, COLLECTION_PREFIX) ? /* @__PURE__ */ jsx(DatabaseIcon, {}) : null,
4038
+ startsWith(h.key, REPEATER_PREFIX) ? "Repeater Data" : startsWith(h.key, COLLECTION_PREFIX) ? h.key.replace(COLLECTION_PREFIX, "") : h.key
4039
4039
  ] }),
4040
4040
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4041
- r === "object" && m.type === "object" && /* @__PURE__ */ jsx(
4041
+ r === "object" && h.type === "object" && /* @__PURE__ */ jsx(
4042
4042
  Button,
4043
4043
  {
4044
4044
  size: "sm",
4045
4045
  variant: "ghost",
4046
4046
  className: "h-6 px-2 hover:bg-primary hover:text-primary-foreground",
4047
- onClick: (h) => {
4048
- h.stopPropagation(), n([...a, m.key].join("."), r);
4047
+ onClick: (m) => {
4048
+ m.stopPropagation(), n([...a, h.key].join("."), r);
4049
4049
  },
4050
4050
  children: "Select"
4051
4051
  }
4052
4052
  ),
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" }) })
4053
+ 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" }) })
4054
4054
  ] })
4055
4055
  ]
4056
4056
  },
4057
- m.key
4057
+ h.key
4058
4058
  ))
4059
4059
  ] })
4060
4060
  ] })
@@ -4106,18 +4106,18 @@ const DataBindingSelector = ({
4106
4106
  }) => {
4107
4107
  const l = usePageExternalData(), i = useSelectedBlockHierarchy(), c = useSelectedBlock(), d = useMemo(() => {
4108
4108
  if (i.length === 1) return "";
4109
- const g = i.find((x) => x._type === "Repeater"), h = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4110
- return `${REPEATER_PREFIX}${startsWith(h, COLLECTION_PREFIX) ? `${h}/${g._id}` : h}`;
4109
+ const g = i.find((x) => x._type === "Repeater"), m = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4110
+ return `${REPEATER_PREFIX}${startsWith(m, COLLECTION_PREFIX) ? `${m}/${g._id}` : m}`;
4111
4111
  }, [i]), p = useMemo(() => first(get(l, d.replace(REPEATER_PREFIX, ""), [])), [d, l]), u = useCallback(
4112
- (g, m) => {
4113
- if (g = isEmpty(d) ? g : g.replace(`${d}`, "$index"), m === "array" || m === "object") {
4112
+ (g, h) => {
4113
+ if (g = isEmpty(d) ? g : g.replace(`${d}`, "$index"), h === "array" || h === "object") {
4114
4114
  n(`{{${g}}}`, {}, r);
4115
4115
  return;
4116
4116
  }
4117
- const h = (b) => /[.,!?;:]/.test(b), x = (b, v, B) => {
4117
+ const m = (b) => /[.,!?;:]/.test(b), x = (b, v, B) => {
4118
4118
  let w = "", _ = "";
4119
4119
  const E = v > 0 ? b[v - 1] : "", S = v < b.length ? b[v] : "";
4120
- return v > 0 && (E === "." || !h(E) && E !== " ") && (w = " "), v < b.length && !h(S) && S !== " " && (_ = " "), {
4120
+ return v > 0 && (E === "." || !m(E) && E !== " ") && (w = " "), v < b.length && !m(S) && S !== " " && (_ = " "), {
4121
4121
  text: w + B + _,
4122
4122
  prefixLength: w.length,
4123
4123
  suffixLength: _.length
@@ -4136,9 +4136,9 @@ const DataBindingSelector = ({
4136
4136
  else {
4137
4137
  const { state: E } = b, S = E.selection.from, A = E.doc.textBetween(Math.max(0, S - 1), S), N = E.doc.textBetween(S, Math.min(S + 1, E.doc.content.size));
4138
4138
  let C = "";
4139
- S > 0 && A !== " " && !h(A) && (C = " ");
4139
+ S > 0 && A !== " " && !m(A) && (C = " ");
4140
4140
  let k = "";
4141
- N && N !== " " && !h(N) && (k = " "), b.chain().insertContent(C + v + k).run();
4141
+ N && N !== " " && !m(N) && (k = " "), b.chain().insertContent(C + v + k).run();
4142
4142
  }
4143
4143
  setTimeout(() => n(b.getHTML(), {}, r), 100);
4144
4144
  return;
@@ -4173,13 +4173,13 @@ const DataBindingSelector = ({
4173
4173
  onChange: r
4174
4174
  }) => {
4175
4175
  var N;
4176
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [x, f] = useState([]), [y, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((C) => C.key === u)) == null ? void 0 : N.name;
4176
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [x, f] = useState([]), [y, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((C) => C.key === u)) == null ? void 0 : N.name;
4177
4177
  useEffect(() => {
4178
- if (h(""), f([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4178
+ if (m(""), f([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4179
4179
  const C = split(o, ":"), k = get(C, 1, "page") || "page";
4180
4180
  g(k), (async () => {
4181
4181
  const j = await l(k, [get(C, 2, "page")]);
4182
- j && Array.isArray(j) && h(get(j, [0, "name"], ""));
4182
+ j && Array.isArray(j) && m(get(j, [0, "name"], ""));
4183
4183
  })();
4184
4184
  }, [o]);
4185
4185
  const w = useDebouncedCallback(
@@ -4196,7 +4196,7 @@ const DataBindingSelector = ({
4196
4196
  300
4197
4197
  ), _ = (C) => {
4198
4198
  const k = ["pageType", u, C.id];
4199
- k[1] && (r(k.join(":")), h(C.name), p(!1), f([]), b(-1));
4199
+ k[1] && (r(k.join(":")), m(C.name), p(!1), f([]), b(-1));
4200
4200
  }, E = (C) => {
4201
4201
  switch (C.key) {
4202
4202
  case "ArrowDown":
@@ -4221,9 +4221,9 @@ const DataBindingSelector = ({
4221
4221
  }
4222
4222
  }, [y]);
4223
4223
  const S = () => {
4224
- h(""), f([]), b(-1), p(!1), r("");
4224
+ m(""), f([]), b(-1), p(!1), r("");
4225
4225
  }, A = (C) => {
4226
- h(C), p(!isEmpty(C)), c(!0), w(C);
4226
+ m(C), p(!isEmpty(C)), c(!0), w(C);
4227
4227
  };
4228
4228
  return /* @__PURE__ */ jsxs("div", { children: [
4229
4229
  /* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (C) => g(C.target.value), children: map(n, (C) => /* @__PURE__ */ jsx("option", { value: C.key, children: C.name }, C.key)) }),
@@ -4232,14 +4232,14 @@ const DataBindingSelector = ({
4232
4232
  "input",
4233
4233
  {
4234
4234
  type: "text",
4235
- value: m,
4235
+ value: h,
4236
4236
  onChange: (C) => A(C.target.value),
4237
4237
  onKeyDown: E,
4238
4238
  placeholder: a(`Search ${B ?? ""}`),
4239
4239
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
4240
4240
  }
4241
4241
  ),
4242
- /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: S, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4242
+ /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick: S, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4243
4243
  ] }),
4244
4244
  (i || !isEmpty(x) || d && isEmpty(x)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
4245
4245
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
@@ -4247,7 +4247,7 @@ const DataBindingSelector = ({
4247
4247
  ] }) : d && isEmpty(x) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4248
4248
  a("No results found for"),
4249
4249
  ' "',
4250
- m,
4250
+ h,
4251
4251
  '"'
4252
4252
  ] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(x == null ? void 0 : x.slice(0, 20), (C, k) => /* @__PURE__ */ jsxs(
4253
4253
  "li",
@@ -4505,16 +4505,16 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4505
4505
  const c = useRef(null), d = useRef(a || ""), p = usePageExternalData();
4506
4506
  useEffect(() => {
4507
4507
  if (o) {
4508
- const m = document.createElement("style");
4509
- return m.id = "rte-modal-styles", m.innerHTML = `
4508
+ const h = document.createElement("style");
4509
+ return h.id = "rte-modal-styles", h.innerHTML = `
4510
4510
  /* Ensure the NestedPathSelector popover appears above the dialog */
4511
4511
  .rte-path-selector + [data-radix-popper-content-wrapper],
4512
4512
  [data-radix-popper-content-wrapper] {
4513
4513
  z-index: 9999 !important;
4514
4514
  }
4515
- `, document.head.appendChild(m), () => {
4516
- const h = document.getElementById("rte-modal-styles");
4517
- h && h.remove();
4515
+ `, document.head.appendChild(h), () => {
4516
+ const m = document.getElementById("rte-modal-styles");
4517
+ m && m.remove();
4518
4518
  };
4519
4519
  }
4520
4520
  }, [o]);
@@ -4539,13 +4539,13 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4539
4539
  })
4540
4540
  ],
4541
4541
  content: a || "",
4542
- onUpdate: ({ editor: m }) => {
4543
- const h = m.getHTML();
4544
- l(h);
4542
+ onUpdate: ({ editor: h }) => {
4543
+ const m = h.getHTML();
4544
+ l(m);
4545
4545
  },
4546
- onBlur: ({ editor: m }) => {
4547
- const h = m.getHTML();
4548
- i(r, h);
4546
+ onBlur: ({ editor: h }) => {
4547
+ const m = h.getHTML();
4548
+ i(r, m);
4549
4549
  },
4550
4550
  editorProps: {
4551
4551
  attributes: {
@@ -4560,22 +4560,22 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4560
4560
  }, [o, u]), useEffect(() => {
4561
4561
  c.current && u && (c.current.__chaiRTE = u);
4562
4562
  }, [u, o]);
4563
- const g = (m) => {
4563
+ const g = (h) => {
4564
4564
  if (!u) return;
4565
- const h = `{{${m}}}`;
4565
+ const m = `{{${h}}}`;
4566
4566
  u.commands.focus();
4567
4567
  const { from: x, to: f } = u.state.selection;
4568
4568
  if (x !== f)
4569
- u.chain().deleteSelection().insertContent(h).run();
4569
+ u.chain().deleteSelection().insertContent(m).run();
4570
4570
  else {
4571
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));
4572
4572
  let _ = "";
4573
4573
  v > 0 && B !== " " && !/[.,!?;:]/.test(B) && (_ = " ");
4574
4574
  let E = "";
4575
- w && w !== " " && !/[.,!?;:]/.test(w) && (E = " "), u.chain().insertContent(_ + h + E).run();
4575
+ w && w !== " " && !/[.,!?;:]/.test(w) && (E = " "), u.chain().insertContent(_ + m + E).run();
4576
4576
  }
4577
4577
  };
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: [
4578
+ 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: [
4579
4579
  /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center justify-between pr-8", children: [
4580
4580
  /* @__PURE__ */ jsx("span", { children: "Rich Text Editor" }),
4581
4581
  Object.keys(p).length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -4630,9 +4630,9 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4630
4630
  }, [g]), useEffect(() => {
4631
4631
  u(r || "");
4632
4632
  }, [r]);
4633
- const m = (x) => {
4633
+ const h = (x) => {
4634
4634
  a(x);
4635
- }, h = () => {
4635
+ }, m = () => {
4636
4636
  d(!1), g && g.commands.setContent(p);
4637
4637
  };
4638
4638
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -4644,10 +4644,10 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4644
4644
  RTEModal,
4645
4645
  {
4646
4646
  isOpen: c,
4647
- onClose: h,
4647
+ onClose: m,
4648
4648
  id: o,
4649
4649
  value: p,
4650
- onChange: m,
4650
+ onChange: h,
4651
4651
  onBlur: l
4652
4652
  }
4653
4653
  )
@@ -4663,14 +4663,14 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4663
4663
  }, [a]), useEffect(() => {
4664
4664
  u != null && u.length && !find(u, { _id: o == null ? void 0 : o.currentSlide }) && n({ ...o, currentSlide: get(u, "0._id") });
4665
4665
  }, [o, u]);
4666
- const m = () => {
4666
+ const h = () => {
4667
4667
  const f = findIndex(u, { _id: g });
4668
4668
  if (f > -1) {
4669
4669
  const y = (f + 1) % u.length, b = get(u, [y, "_id"]);
4670
4670
  if (!b) return;
4671
4671
  n({ ...o, currentSlide: b }), c([b]);
4672
4672
  }
4673
- }, h = () => {
4673
+ }, m = () => {
4674
4674
  const f = findIndex(u, { _id: g });
4675
4675
  if (f > -1) {
4676
4676
  const y = (f - 1 + u.length) % u.length, b = get(u, [y, "_id"]);
@@ -4686,7 +4686,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4686
4686
  };
4687
4687
  return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
4688
4688
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 pb-2 text-[12px]", children: [
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]" }) }),
4689
+ /* @__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]" }) }),
4690
4690
  /* @__PURE__ */ jsx("div", { className: "whitespace-nowrap text-center text-[10px] text-slate-500", children: g ? /* @__PURE__ */ jsxs("span", { className: "", children: [
4691
4691
  /* @__PURE__ */ jsxs("b", { className: "text-[12px]", children: [
4692
4692
  " ",
@@ -4695,7 +4695,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4695
4695
  "/",
4696
4696
  u.length
4697
4697
  ] }) : "-" }),
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]" }) }),
4698
+ /* @__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]" }) }),
4699
4699
  /* @__PURE__ */ jsxs(
4700
4700
  "button",
4701
4701
  {
@@ -4773,7 +4773,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4773
4773
  const r = get(o, "srcsets", []) || [], a = (c, d) => {
4774
4774
  const p = c.target.name, u = c.target.value;
4775
4775
  n({
4776
- srcsets: map(r, (g, m) => m === d ? { ...g, [p]: u } : g)
4776
+ srcsets: map(r, (g, h) => h === d ? { ...g, [p]: u } : g)
4777
4777
  });
4778
4778
  }, l = () => {
4779
4779
  n({ srcsets: [...r, {}] });
@@ -4868,11 +4868,11 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4868
4868
  required: p,
4869
4869
  schema: u,
4870
4870
  formData: g,
4871
- onChange: m
4871
+ onChange: h
4872
4872
  }) => {
4873
- const { selectedLang: h, fallbackLang: x, languages: f } = useLanguages(), y = useMemo(
4874
- () => isEmpty(f) ? "" : isEmpty(h) ? x : h,
4875
- [f, h, x]
4873
+ const { selectedLang: m, fallbackLang: x, languages: f } = useLanguages(), y = useMemo(
4874
+ () => isEmpty(f) ? "" : isEmpty(m) ? x : m,
4875
+ [f, m, x]
4876
4876
  ), b = useMemo(() => get(LANGUAGES, y, y), [y]), v = usePageExternalData(), B = useSelectedBlock(), w = useRegisteredChaiBlocks(), _ = useMemo(
4877
4877
  () => get(w, [B == null ? void 0 : B._type, "i18nProps"], []),
4878
4878
  [w, B == null ? void 0 : B._type]
@@ -4923,7 +4923,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4923
4923
  {
4924
4924
  schema: u,
4925
4925
  onChange: (C) => {
4926
- m(C, g, o);
4926
+ h(C, g, o);
4927
4927
  },
4928
4928
  id: o,
4929
4929
  formData: g
@@ -4970,8 +4970,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4970
4970
  /* @__PURE__ */ jsx("span", { children: "Add" })
4971
4971
  ] }) }), JSONForm = memo(({ blockId: o, schema: n, uiSchema: r, formData: a, onChange: l }) => {
4972
4972
  const { selectedLang: i } = useLanguages(), c = useBlockSettingComponents("widget"), d = useBlockSettingComponents("field"), p = useBlockSettingComponents("template"), u = useThrottledCallback(
4973
- async ({ formData: g }, m) => {
4974
- l({ formData: g }, m);
4973
+ async ({ formData: g }, h) => {
4974
+ l({ formData: g }, h);
4975
4975
  },
4976
4976
  [l, i],
4977
4977
  400
@@ -5012,10 +5012,10 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
5012
5012
  uiSchema: r,
5013
5013
  schema: n,
5014
5014
  formData: a,
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);
5015
+ onChange: ({ formData: g }, h) => {
5016
+ if (!h || o !== (g == null ? void 0 : g._id)) return;
5017
+ const m = take(h.split("."), 2).join(".").replace("root.", "");
5018
+ u({ formData: g }, m);
5019
5019
  }
5020
5020
  },
5021
5021
  i
@@ -5027,7 +5027,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
5027
5027
  }), a;
5028
5028
  };
5029
5029
  function BlockSettings() {
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), x = ({ formData: E }, S, 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(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h), x = ({ formData: E }, S, A) => {
5031
5031
  S && (c == null ? void 0 : c._id) === n._id && a([n._id], { [S]: get(E, S) }, A);
5032
5032
  }, f = useCallback(
5033
5033
  debounce(({ formData: E }, S, A) => {
@@ -5083,7 +5083,7 @@ function BlockSettings() {
5083
5083
  {
5084
5084
  blockId: g == null ? void 0 : g._id,
5085
5085
  onChange: b,
5086
- formData: h,
5086
+ formData: m,
5087
5087
  schema: w,
5088
5088
  uiSchema: _
5089
5089
  }
@@ -5105,56 +5105,50 @@ const BlockStylingProps = () => {
5105
5105
  const o = useSelectedBlock(), [n, r] = useSelectedStylingBlocks(), { t: a } = useTranslation();
5106
5106
  if (!o) return null;
5107
5107
  const l = Object.keys(o).filter(
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
- ]
5108
+ (p) => typeof o[p] == "string" && o[p].startsWith("#styles:")
5109
+ ), { reset: i } = useResetBlockStyles(), c = !isEmpty(l) && l.length > 1, d = (p) => find(n, (u) => u.prop === p);
5110
+ return /* @__PURE__ */ jsx(Fragment, { children: c && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
5111
+ /* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
5112
+ a("Style element"),
5113
+ ":"
5114
+ ] }),
5115
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(l, (p) => /* @__PURE__ */ jsxs(
5116
+ Badge,
5117
+ {
5118
+ className: "flex cursor-pointer items-center gap-1 pr-1",
5119
+ variant: d(p) ? "default" : "secondary",
5120
+ onClick: () => {
5121
+ r([{ id: `${p}-${o._id}`, blockId: o._id, prop: p }]);
5152
5122
  },
5153
- g
5154
- )) }),
5155
- /* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
5156
- ] })
5157
- ] });
5123
+ children: [
5124
+ startCase(p),
5125
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5126
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
5127
+ "button",
5128
+ {
5129
+ type: "button",
5130
+ className: "ml-1 rounded-sm p-0.5 hover:bg-blue-300 hover:text-blue-600",
5131
+ onClick: (u) => u.stopPropagation(),
5132
+ children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" })
5133
+ }
5134
+ ) }),
5135
+ /* @__PURE__ */ jsx(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: /* @__PURE__ */ jsx(
5136
+ DropdownMenuItem,
5137
+ {
5138
+ className: "text-xs",
5139
+ onClick: () => {
5140
+ i(p);
5141
+ },
5142
+ children: a("Reset style")
5143
+ }
5144
+ ) })
5145
+ ] })
5146
+ ]
5147
+ },
5148
+ p
5149
+ )) }),
5150
+ /* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
5151
+ ] }) });
5158
5152
  }, BlockSettingsContext = React__default.createContext({
5159
5153
  setDragData: () => {
5160
5154
  }
@@ -5300,14 +5294,14 @@ const BlockStylingProps = () => {
5300
5294
  },
5301
5295
  a
5302
5296
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
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]), [x, f] = useState(!1), [y, b] = useState(""), [v, B] = useState(!1), [w, _] = useState(!1);
5297
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [x, f] = useState(!1), [y, b] = useState(""), [v, B] = useState(!1), [w, _] = useState(!1);
5304
5298
  useEffect(() => {
5305
5299
  const { value: C, unit: k } = getClassValueAndUnit(i);
5306
5300
  if (k === "") {
5307
- l(C), h(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
5301
+ l(C), m(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
5308
5302
  return;
5309
5303
  }
5310
- h(k), l(k === "class" || isEmpty(C) ? "" : C);
5304
+ m(k), l(k === "class" || isEmpty(C) ? "" : C);
5311
5305
  }, [i, p, u]);
5312
5306
  const E = useThrottledCallback((C) => c(C), [c], THROTTLE_TIME), S = useThrottledCallback((C) => c(C, !1), [c], THROTTLE_TIME), A = useCallback(
5313
5307
  (C = !1) => {
@@ -5316,7 +5310,7 @@ const BlockStylingProps = () => {
5316
5310
  f(!0);
5317
5311
  return;
5318
5312
  }
5319
- const j = get(k, "unit") !== "" ? get(k, "unit") : m;
5313
+ const j = get(k, "unit") !== "" ? get(k, "unit") : h;
5320
5314
  if (j === "auto" || j === "none") {
5321
5315
  E(`${d}${j}`);
5322
5316
  return;
@@ -5326,7 +5320,7 @@ const BlockStylingProps = () => {
5326
5320
  const L = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
5327
5321
  C ? S(L) : E(L);
5328
5322
  },
5329
- [E, S, a, m, d, u]
5323
+ [E, S, a, h, d, u]
5330
5324
  ), N = useCallback(
5331
5325
  (C) => {
5332
5326
  const k = getUserInputValues(`${a}`, u);
@@ -5345,7 +5339,7 @@ const BlockStylingProps = () => {
5345
5339
  },
5346
5340
  [E, a, d, u]
5347
5341
  );
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: [
5342
+ 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: [
5349
5343
  /* @__PURE__ */ jsx(
5350
5344
  "input",
5351
5345
  {
@@ -5360,10 +5354,10 @@ const BlockStylingProps = () => {
5360
5354
  ] })
5361
5355
  ] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
5362
5356
  /* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
5363
- ["none", "auto"].indexOf(m) !== -1 ? null : /* @__PURE__ */ jsx(
5357
+ ["none", "auto"].indexOf(h) !== -1 ? null : /* @__PURE__ */ jsx(
5364
5358
  "input",
5365
5359
  {
5366
- readOnly: m === "class",
5360
+ readOnly: h === "class",
5367
5361
  onKeyPress: (C) => {
5368
5362
  C.key === "Enter" && A();
5369
5363
  },
@@ -5374,7 +5368,7 @@ const BlockStylingProps = () => {
5374
5368
  const k = parseInt$1(C.target.value);
5375
5369
  let j = isNaN$1(k) ? 0 : k;
5376
5370
  C.keyCode === 38 && (j += 1), C.keyCode === 40 && (j -= 1);
5377
- const I = `${j}`, R = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
5371
+ const I = `${j}`, R = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${h === "-" ? "" : h}]`;
5378
5372
  S(R);
5379
5373
  },
5380
5374
  onKeyUp: (C) => {
@@ -5403,7 +5397,7 @@ const BlockStylingProps = () => {
5403
5397
  onClick: () => r(!n),
5404
5398
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
5405
5399
  children: [
5406
- /* @__PURE__ */ jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: m }),
5400
+ /* @__PURE__ */ jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: h }),
5407
5401
  u.length > 1 ? /* @__PURE__ */ jsx(TriangleDownIcon, {}) : null
5408
5402
  ]
5409
5403
  }
@@ -5412,33 +5406,33 @@ const BlockStylingProps = () => {
5412
5406
  UnitSelection,
5413
5407
  {
5414
5408
  units: u,
5415
- current: m,
5409
+ current: h,
5416
5410
  onSelect: (C) => {
5417
- r(!1), h(C), N(C);
5411
+ r(!1), m(C), N(C);
5418
5412
  }
5419
5413
  }
5420
5414
  ) })
5421
5415
  ] })
5422
5416
  ] }),
5423
- ["none", "auto"].indexOf(m) !== -1 || v ? null : /* @__PURE__ */ jsx(
5417
+ ["none", "auto"].indexOf(h) !== -1 || v ? null : /* @__PURE__ */ jsx(
5424
5418
  DragStyleButton,
5425
5419
  {
5426
5420
  onDragStart: () => B(!0),
5427
5421
  onDragEnd: (C) => {
5428
5422
  if (b(() => ""), B(!1), isEmpty(C))
5429
5423
  return;
5430
- const k = `${C}`, I = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${m === "-" ? "" : m}]`;
5424
+ const k = `${C}`, I = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${h === "-" ? "" : h}]`;
5431
5425
  E(I);
5432
5426
  },
5433
5427
  onDrag: (C) => {
5434
5428
  if (isEmpty(C))
5435
5429
  return;
5436
5430
  b(C);
5437
- const k = `${C}`, I = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${m === "-" ? "" : m}]`;
5431
+ const k = `${C}`, I = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${h === "-" ? "" : h}]`;
5438
5432
  S(I);
5439
5433
  },
5440
5434
  currentValue: a,
5441
- unit: m,
5435
+ unit: h,
5442
5436
  negative: g,
5443
5437
  cssProperty: p
5444
5438
  }
@@ -5498,7 +5492,7 @@ const COLOR_PROP = {
5498
5492
  ringColor: "ring",
5499
5493
  ringOffsetColor: "ring-offset"
5500
5494
  }, ColorChoice = ({ property: o, onChange: n }) => {
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(
5495
+ 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(
5502
5496
  // eslint-disable-next-line no-shadow
5503
5497
  (y) => {
5504
5498
  ["current", "inherit", "transparent", "black", "white"].includes(y) ? (c([]), p({ color: y })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((b) => ({ ...b, color: y, shade: b.shade ? b.shade : "500" })));
@@ -5531,7 +5525,7 @@ const COLOR_PROP = {
5531
5525
  disabled: !l,
5532
5526
  rounded: !0,
5533
5527
  selected: g,
5534
- onChange: h,
5528
+ onChange: m,
5535
5529
  options: [
5536
5530
  "current",
5537
5531
  "transparent",
@@ -5564,7 +5558,7 @@ const COLOR_PROP = {
5564
5558
  ]
5565
5559
  }
5566
5560
  ) }),
5567
- /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange: x, options: i }) })
5561
+ /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: h, disabled: !g || !l, onChange: x, options: i }) })
5568
5562
  ] });
5569
5563
  }, EDITOR_ICONS = {
5570
5564
  "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" }) }),
@@ -5898,20 +5892,20 @@ const COLOR_PROP = {
5898
5892
  "2xl": "1536px"
5899
5893
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
5900
5894
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
5901
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), y = useMemo(() => get(m, "fullCls", ""), [m]), b = useCallback(
5895
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), y = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
5902
5896
  (S, A = !0) => {
5903
5897
  const N = { dark: p, mq: g, mod: u, cls: S, property: l, fullCls: "" };
5904
5898
  (p || u !== "") && (N.mq = "xs");
5905
5899
  const C = generateFullClsName(N);
5906
- h(f, [C], A);
5900
+ m(f, [C], A);
5907
5901
  },
5908
- [f, p, g, u, l, h]
5902
+ [f, p, g, u, l, m]
5909
5903
  ), v = useCallback(() => {
5910
5904
  x(f, [y], !0);
5911
- }, [f, y, x]), B = useMemo(() => canChangeClass(m, g), [m, g]);
5905
+ }, [f, y, x]), B = useMemo(() => canChangeClass(h, g), [h, g]);
5912
5906
  useEffect(() => {
5913
- i(B, m);
5914
- }, [B, i, m]);
5907
+ i(B, h);
5908
+ }, [B, i, h]);
5915
5909
  const [, , w] = useScreenSizeWidth(), _ = useCallback(
5916
5910
  (S) => {
5917
5911
  w({
@@ -5924,15 +5918,15 @@ const COLOR_PROP = {
5924
5918
  }[S]);
5925
5919
  },
5926
5920
  [w]
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) }) }),
5921
+ ), E = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === g;
5922
+ 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: [
5923
+ /* @__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) }) }),
5930
5924
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
5931
5925
  /* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
5932
5926
  r === "arbitrary" ? /* @__PURE__ */ jsx(
5933
5927
  AdvanceChoices,
5934
5928
  {
5935
- currentClass: get(m, "cls", ""),
5929
+ currentClass: get(h, "cls", ""),
5936
5930
  classPrefix: get(CLASS_PREFIXES, l, ""),
5937
5931
  units: c || [],
5938
5932
  onChange: b,
@@ -5945,7 +5939,7 @@ const COLOR_PROP = {
5945
5939
  r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
5946
5940
  r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
5947
5941
  ] }),
5948
- /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "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: [
5942
+ /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "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: [
5949
5943
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
5950
5944
  "button",
5951
5945
  {
@@ -5957,19 +5951,19 @@ const COLOR_PROP = {
5957
5951
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxs("div", { children: [
5958
5952
  "Current style is set at  ",
5959
5953
  /* @__PURE__ */ jsxs("span", { className: "font-bold", children: [
5960
- getBreakpoint(get(m, "mq")),
5961
- p && !m.dark ? "(Light mode)" : ""
5954
+ getBreakpoint(get(h, "mq")),
5955
+ p && !h.dark ? "(Light mode)" : ""
5962
5956
  ] }),
5963
5957
  /* @__PURE__ */ jsx("br", {}),
5964
5958
  /* @__PURE__ */ jsxs(
5965
5959
  "button",
5966
5960
  {
5967
5961
  type: "button",
5968
- onClick: () => _(get(m, "mq")),
5962
+ onClick: () => _(get(h, "mq")),
5969
5963
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
5970
5964
  children: [
5971
5965
  "Switch to ",
5972
- get(m, "mq").toUpperCase()
5966
+ get(h, "mq").toUpperCase()
5973
5967
  ]
5974
5968
  }
5975
5969
  )
@@ -5986,7 +5980,7 @@ const COLOR_PROP = {
5986
5980
  units: i = basicUnits,
5987
5981
  negative: c = !1
5988
5982
  }) => {
5989
- const { t: d } = useTranslation(), [p, u] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), m = useCallback((h) => map(g, "property").includes(h), [g]);
5983
+ const { t: d } = useTranslation(), [p, u] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), h = useCallback((m) => map(g, "property").includes(m), [g]);
5990
5984
  return /* @__PURE__ */ jsxs(
5991
5985
  "div",
5992
5986
  {
@@ -5994,7 +5988,7 @@ const COLOR_PROP = {
5994
5988
  children: [
5995
5989
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
5996
5990
  o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
5997
- /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: h, key: x }, f) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
5991
+ /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: m, key: x }, f) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
5998
5992
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
5999
5993
  "button",
6000
5994
  {
@@ -6003,13 +5997,13 @@ const COLOR_PROP = {
6003
5997
  className: `relative cursor-pointer rounded-full p-1 text-[8px] ${x === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6004
5998
  children: [
6005
5999
  React__default.createElement("div", {
6006
- className: m(x) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6000
+ className: h(x) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6007
6001
  }),
6008
6002
  React__default.createElement(get(EDITOR_ICONS, x, BoxIcon), { className: "text-inherit w-3 h-3" })
6009
6003
  ]
6010
6004
  }
6011
6005
  ) }),
6012
- /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(h)) })
6006
+ /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(m)) })
6013
6007
  ] }) }, `option-${f}`)) })
6014
6008
  ] }),
6015
6009
  /* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
@@ -6165,12 +6159,12 @@ const COLOR_PROP = {
6165
6159
  canvas: n = !1,
6166
6160
  tooltip: r = !0
6167
6161
  }) => {
6168
- const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (b) => {
6162
+ const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: h } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (b) => {
6169
6163
  u.includes(b) ? u.length > 2 && g(u.filter((v) => v !== b)) : g((v) => [...v, b]);
6170
6164
  }, f = (b) => {
6171
6165
  n || l(b), c(b);
6172
6166
  }, y = getBreakpointValue(n ? i : a).toLowerCase();
6173
- return h.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(h, (b) => /* @__PURE__ */ createElement(
6167
+ return m.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(m, (b) => /* @__PURE__ */ createElement(
6174
6168
  BreakpointCard,
6175
6169
  {
6176
6170
  canvas: n,
@@ -6181,7 +6175,7 @@ const COLOR_PROP = {
6181
6175
  }
6182
6176
  )) }) : /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between rounded-md", children: [
6183
6177
  /* @__PURE__ */ jsx("div", { className: "flex items-center", children: map(
6184
- h.filter((b) => includes(u, toUpper(b.breakpoint))),
6178
+ m.filter((b) => includes(u, toUpper(b.breakpoint))),
6185
6179
  (b) => /* @__PURE__ */ createElement(
6186
6180
  BreakpointCard,
6187
6181
  {
@@ -6198,15 +6192,15 @@ const COLOR_PROP = {
6198
6192
  /* @__PURE__ */ jsxs(DropdownMenu, { children: [
6199
6193
  /* @__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" }) }) }),
6200
6194
  /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56 border-border text-xs", children: [
6201
- /* @__PURE__ */ jsx(DropdownMenuLabel, { children: m("Screen sizes") }),
6195
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: h("Screen sizes") }),
6202
6196
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6203
- map(h, (b) => /* @__PURE__ */ jsx(
6197
+ map(m, (b) => /* @__PURE__ */ jsx(
6204
6198
  DropdownMenuCheckboxItem,
6205
6199
  {
6206
6200
  disabled: b.breakpoint === "xs",
6207
6201
  onCheckedChange: () => x(toUpper(b.breakpoint)),
6208
6202
  checked: includes(u, toUpper(b.breakpoint)),
6209
- children: m(b.title)
6203
+ children: h(b.title)
6210
6204
  },
6211
6205
  b.breakpoint
6212
6206
  ))
@@ -6285,11 +6279,11 @@ function Countdown() {
6285
6279
  const AskAIStyles = ({ blockId: o }) => {
6286
6280
  const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), [u, g] = useState();
6287
6281
  useEffect(() => {
6288
- var h;
6289
- (h = d.current) == null || h.focus();
6282
+ var m;
6283
+ (m = d.current) == null || m.focus();
6290
6284
  }, []);
6291
- const m = (h) => {
6292
- const { usage: x } = h || {};
6285
+ const h = (m) => {
6286
+ const { usage: x } = m || {};
6293
6287
  !l && x && g(x), p.current = setTimeout(() => g(void 0), 1e4), l || c("");
6294
6288
  };
6295
6289
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
@@ -6299,12 +6293,12 @@ const AskAIStyles = ({ blockId: o }) => {
6299
6293
  {
6300
6294
  ref: d,
6301
6295
  value: i,
6302
- onChange: (h) => c(h.target.value),
6296
+ onChange: (m) => c(m.target.value),
6303
6297
  placeholder: n("Ask AI to edit styles"),
6304
6298
  className: "no-scrollbar my-2 w-full border border-border p-2 text-xs",
6305
6299
  rows: 4,
6306
- onKeyDown: (h) => {
6307
- h.key === "Enter" && (h.preventDefault(), p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, m));
6300
+ onKeyDown: (m) => {
6301
+ m.key === "Enter" && (m.preventDefault(), p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, h));
6308
6302
  }
6309
6303
  }
6310
6304
  ),
@@ -6314,7 +6308,7 @@ const AskAIStyles = ({ blockId: o }) => {
6314
6308
  {
6315
6309
  disabled: i.trim().length < 5 || a,
6316
6310
  onClick: () => {
6317
- p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, m);
6311
+ p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, h);
6318
6312
  },
6319
6313
  variant: "default",
6320
6314
  className: "w-fit",
@@ -6346,9 +6340,9 @@ const AskAIStyles = ({ blockId: o }) => {
6346
6340
  };
6347
6341
  function ManualClasses() {
6348
6342
  var I;
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), [x, f] = useState(""), y = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
6343
+ const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [x, f] = useState(""), y = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
6350
6344
  const L = x.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6351
- u(m, L, !0), f("");
6345
+ u(h, L, !0), f("");
6352
6346
  }, [w, _] = useState([]), E = ({ value: L }) => {
6353
6347
  const R = L.trim().toLowerCase(), T = R.match(/.+:/g);
6354
6348
  let D = [];
@@ -6387,7 +6381,7 @@ function ManualClasses() {
6387
6381
  ), k = (L) => {
6388
6382
  debugger;
6389
6383
  const R = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6390
- g(m, [L]), u(m, R, !0), r(""), l(-1);
6384
+ g(h, [L]), u(h, R, !0), r(""), l(-1);
6391
6385
  }, j = () => {
6392
6386
  if (navigator.clipboard === void 0) {
6393
6387
  toast.error(c("Clipboard not supported"));
@@ -6404,7 +6398,7 @@ function ManualClasses() {
6404
6398
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: c("Copy classes to clipboard") }) })
6405
6399
  ] })
6406
6400
  ] }),
6407
- h ? /* @__PURE__ */ jsxs(Popover, { children: [
6401
+ m ? /* @__PURE__ */ jsxs(Popover, { children: [
6408
6402
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { variant: "default", className: "h-6 w-fit", size: "sm", children: [
6409
6403
  /* @__PURE__ */ jsx(SparklesIcon, { className: "h-4 w-4" }),
6410
6404
  /* @__PURE__ */ jsx("span", { className: "ml-2", children: c("Ask AI") })
@@ -6469,7 +6463,7 @@ function ManualClasses() {
6469
6463
  "button",
6470
6464
  {
6471
6465
  onDoubleClick: () => {
6472
- f(L), g(m, [L]), setTimeout(() => {
6466
+ f(L), g(h, [L]), setTimeout(() => {
6473
6467
  o.current && o.current.focus();
6474
6468
  }, 10);
6475
6469
  },
@@ -6479,7 +6473,7 @@ function ManualClasses() {
6479
6473
  n !== L && /* @__PURE__ */ jsx(
6480
6474
  Cross2Icon,
6481
6475
  {
6482
- onClick: () => g(m, [L], !0),
6476
+ onClick: () => g(h, [L], !0),
6483
6477
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
6484
6478
  }
6485
6479
  )
@@ -6599,13 +6593,13 @@ function BlockStyling() {
6599
6593
  cssProperty: ""
6600
6594
  }), d = useThrottledCallback(
6601
6595
  (u) => {
6602
- const g = !get(i, "negative", !1), m = get(i, "cssProperty", "");
6603
- let h = parseFloat(i.dragStartValue);
6604
- h = isNaN(h) ? 0 : h;
6596
+ const g = !get(i, "negative", !1), h = get(i, "cssProperty", "");
6597
+ let m = parseFloat(i.dragStartValue);
6598
+ m = isNaN(m) ? 0 : m;
6605
6599
  let x = MAPPER[i.dragUnit];
6606
- (startsWith(m, "scale") || m === "opacity") && (x = 10);
6607
- let y = (i.dragStartY - u.pageY) / x + h;
6608
- g && y < 0 && (y = 0), m === "opacity" && y > 1 && (y = 1), i.onDrag(`${y}`), l(`${y}`);
6600
+ (startsWith(h, "scale") || h === "opacity") && (x = 10);
6601
+ let y = (i.dragStartY - u.pageY) / x + m;
6602
+ g && y < 0 && (y = 0), h === "opacity" && y > 1 && (y = 1), i.onDrag(`${y}`), l(`${y}`);
6609
6603
  },
6610
6604
  [i],
6611
6605
  50
@@ -6646,7 +6640,7 @@ const CoreBlock = ({
6646
6640
  parentId: r,
6647
6641
  position: a
6648
6642
  }) => {
6649
- const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, g] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), h = () => {
6643
+ const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, g] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(), m = () => {
6650
6644
  if (has(o, "blocks")) {
6651
6645
  const y = isFunction(o.blocks) ? o.blocks() : o.blocks;
6652
6646
  u(syncBlocksWithDefaults(y), r || null, a);
@@ -6659,11 +6653,11 @@ const CoreBlock = ({
6659
6653
  "button",
6660
6654
  {
6661
6655
  disabled: n,
6662
- onClick: h,
6656
+ onClick: m,
6663
6657
  type: "button",
6664
6658
  onDragStart: (y) => {
6665
6659
  y.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), y.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
6666
- g([]), m();
6660
+ g([]), h();
6667
6661
  }, 200);
6668
6662
  },
6669
6663
  draggable: x ? "true" : "false",
@@ -6862,7 +6856,7 @@ const CoreBlock = ({
6862
6856
  }
6863
6857
  }
6864
6858
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
6865
- var m, h, x, f, y, b, v, B;
6859
+ var h, m, x, f, y, b, v, B;
6866
6860
  if (r.type === "comment") return [];
6867
6861
  let a = { _id: generateUUID() };
6868
6862
  if (n && (a._parent = n.block._id), r.type === "text")
@@ -6902,8 +6896,8 @@ const CoreBlock = ({
6902
6896
  ];
6903
6897
  a = {
6904
6898
  ...a,
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",
6899
+ href: ((h = l.find((_) => _.key === "href")) == null ? void 0 : h.value) || "",
6900
+ hrefType: ((m = l.find((_) => _.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
6907
6901
  autoplay: ((x = l.find((_) => _.key === "data-autoplay")) == null ? void 0 : x.value) === "true" ? "true" : "false",
6908
6902
  maxWidth: ((y = (f = l.find((_) => _.key === "data-maxwidth")) == null ? void 0 : f.value) == null ? void 0 : y.replace("px", "")) || "",
6909
6903
  backdropColor: ((b = l.find((_) => _.key === "data-overlay")) == null ? void 0 : b.value) || "",
@@ -7046,7 +7040,7 @@ const registerChaiLibrary = (o, n) => {
7046
7040
  parentId: r = void 0,
7047
7041
  position: a = -1
7048
7042
  }) => {
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", ""), x = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), y = (B) => {
7043
+ const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), x = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), y = (B) => {
7050
7044
  const w = has(B, "styles_attrs.data-page-section");
7051
7045
  return B._type === "Box" && w;
7052
7046
  }, b = useCallback(
@@ -7093,20 +7087,20 @@ const registerChaiLibrary = (o, n) => {
7093
7087
  /* @__PURE__ */ jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
7094
7088
  /* @__PURE__ */ jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
7095
7089
  ] }),
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 })
7090
+ 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: [
7091
+ /* @__PURE__ */ jsx("p", { className: "font-medium text-gray-800", children: h }),
7092
+ m && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: m })
7099
7093
  ] })
7100
7094
  ]
7101
7095
  }
7102
7096
  ) }),
7103
7097
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsxs("div", { className: "max-w-xs", children: [
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 })
7098
+ /* @__PURE__ */ jsx("p", { className: "font-medium", children: h }),
7099
+ m && o.preview && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-primary-foreground", children: m })
7106
7100
  ] }) })
7107
7101
  ] });
7108
7102
  }, UILibrarySection = ({ parentId: o, position: n }) => {
7109
- const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((k) => k.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [m, h] = useState([]), x = useRef(null);
7103
+ const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((k) => k.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), x = useRef(null);
7110
7104
  useEffect(() => {
7111
7105
  c && c.length > 0 && (x.current = new Fuse(c, {
7112
7106
  keys: ["name", "label", "description", "group"],
@@ -7115,13 +7109,13 @@ const registerChaiLibrary = (o, n) => {
7115
7109
  }));
7116
7110
  }, [c]), useEffect(() => {
7117
7111
  if (!u.trim() || !x.current) {
7118
- h([]);
7112
+ m([]);
7119
7113
  return;
7120
7114
  }
7121
7115
  const k = x.current.search(u).map((j) => j.item);
7122
- h(k);
7116
+ m(k);
7123
7117
  }, [u]);
7124
- const f = u.trim() && !isEmpty(m) ? m : c, y = groupBy(f, "group"), [b, v] = useState(null);
7118
+ const f = u.trim() && !isEmpty(h) ? h : c, y = groupBy(f, "group"), [b, v] = useState(null);
7125
7119
  useEffect(() => {
7126
7120
  if (isEmpty(keys(y))) {
7127
7121
  v(null);
@@ -7261,7 +7255,7 @@ const registerChaiLibrary = (o, n) => {
7261
7255
  error: c
7262
7256
  }), g(!0);
7263
7257
  else if (!l && Object.keys(a || {}).length > 0) {
7264
- const h = Object.entries(a).map(([f, y]) => {
7258
+ const m = Object.entries(a).map(([f, y]) => {
7265
7259
  const b = y, v = b.type || "partial", B = formatReadableName(v);
7266
7260
  return {
7267
7261
  type: "PartialBlock",
@@ -7276,14 +7270,14 @@ const registerChaiLibrary = (o, n) => {
7276
7270
  // Store the original ID as partialBlockId
7277
7271
  _name: b.name
7278
7272
  };
7279
- }), x = uniq(map(h, "group"));
7273
+ }), x = uniq(map(m, "group"));
7280
7274
  p({
7281
- blocks: h,
7275
+ blocks: m,
7282
7276
  groups: x,
7283
7277
  isLoading: !1,
7284
7278
  error: null
7285
7279
  }), g(!0);
7286
- } else l ? p((h) => ({ ...h, isLoading: !0, error: null })) : !l && Object.keys(a || {}).length === 0 && (p({
7280
+ } else l ? p((m) => ({ ...m, isLoading: !0, error: null })) : !l && Object.keys(a || {}).length === 0 && (p({
7287
7281
  blocks: [],
7288
7282
  groups: [],
7289
7283
  isLoading: !1,
@@ -7298,15 +7292,15 @@ const registerChaiLibrary = (o, n) => {
7298
7292
  d.blocks,
7299
7293
  c
7300
7294
  ]);
7301
- const m = () => {
7302
- p((h) => ({ ...h, isLoading: !0, error: null })), g(!1), i();
7295
+ const h = () => {
7296
+ p((m) => ({ ...m, isLoading: !0, error: null })), g(!1), i();
7303
7297
  };
7304
7298
  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: [
7305
7299
  /* @__PURE__ */ jsx("p", { children: d.error || "No partial blocks available" }),
7306
7300
  /* @__PURE__ */ jsx(
7307
7301
  "button",
7308
7302
  {
7309
- onClick: m,
7303
+ onClick: h,
7310
7304
  className: "rounded-md bg-primary px-3 py-1 text-sm text-primary-foreground hover:bg-primary/90",
7311
7305
  children: "Refresh"
7312
7306
  }
@@ -7325,7 +7319,7 @@ const registerChaiLibrary = (o, n) => {
7325
7319
  has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
7326
7320
  }, 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" }) => {
7327
7321
  var C;
7328
- const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (C = find(c, (k) => k._id === r)) == null ? void 0 : C._type, [h, x] = useState("all"), [f, y] = useState(null), b = useRef(null);
7322
+ const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (C = find(c, (k) => k._id === r)) == null ? void 0 : C._type, [m, x] = useState("all"), [f, y] = useState(null), b = useRef(null);
7329
7323
  useEffect(() => {
7330
7324
  const k = setTimeout(() => {
7331
7325
  var j;
@@ -7361,7 +7355,7 @@ const registerChaiLibrary = (o, n) => {
7361
7355
  ), S = useMemo(
7362
7356
  () => sortBy(E, (k) => CORE_GROUPS.indexOf(k) === -1 ? 99 : CORE_GROUPS.indexOf(k)),
7363
7357
  [E]
7364
- ), A = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), N = useMemo(() => h === "all" ? S : [h], [S, h]);
7358
+ ), A = useMemo(() => m === "all" ? _ : filter(values(_), { group: m }), [_, m]), N = useMemo(() => m === "all" ? S : [m], [S, m]);
7365
7359
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
7366
7360
  /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
7367
7361
  Input$1,
@@ -7382,7 +7376,7 @@ const registerChaiLibrary = (o, n) => {
7382
7376
  onClick: () => w("all"),
7383
7377
  onMouseEnter: () => v("all"),
7384
7378
  onMouseLeave: B,
7385
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || f === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7379
+ className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" || f === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7386
7380
  children: i("All")
7387
7381
  },
7388
7382
  "sidebar-all"
@@ -7393,7 +7387,7 @@ const registerChaiLibrary = (o, n) => {
7393
7387
  onClick: () => w(k),
7394
7388
  onMouseEnter: () => v(k),
7395
7389
  onMouseLeave: B,
7396
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === k || f === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7390
+ className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === k || f === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7397
7391
  children: capitalize(i(k.toLowerCase()))
7398
7392
  },
7399
7393
  `sidebar-${k}`
@@ -7407,7 +7401,7 @@ const registerChaiLibrary = (o, n) => {
7407
7401
  ] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: N.map((k) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
7408
7402
  /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(k.toLowerCase())) }),
7409
7403
  /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
7410
- h === "all" ? filter(values(A), { group: k }) : values(A),
7404
+ m === "all" ? filter(values(A), { group: k }) : values(A),
7411
7405
  { hidden: !0 }
7412
7406
  ).map((j) => /* @__PURE__ */ jsx(
7413
7407
  CoreBlock,
@@ -7415,7 +7409,7 @@ const registerChaiLibrary = (o, n) => {
7415
7409
  parentId: r,
7416
7410
  position: a,
7417
7411
  block: j,
7418
- disabled: !canAcceptChildBlock(m, j.type) || !canBeNestedInside(m, j.type)
7412
+ disabled: !canAcceptChildBlock(h, j.type) || !canBeNestedInside(h, j.type)
7419
7413
  },
7420
7414
  j.type
7421
7415
  )) })
@@ -7428,13 +7422,13 @@ const registerChaiLibrary = (o, n) => {
7428
7422
  parentId: r = void 0,
7429
7423
  position: a = -1
7430
7424
  }) => {
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();
7425
+ 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();
7432
7426
  useEffect(() => {
7433
7427
  i === "partials" && !g && c("library");
7434
7428
  }, [i, g, c]);
7435
- const h = useCallback(() => {
7429
+ const m = useCallback(() => {
7436
7430
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7437
- }, []), x = useChaiAddBlockTabs(), f = p && m(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
7431
+ }, []), x = useChaiAddBlockTabs(), f = p && h(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
7438
7432
  return useEffect(() => {
7439
7433
  i === "library" && !b && c("core");
7440
7434
  }, [i, b, c]), /* @__PURE__ */ jsxs("div", { className: cn$2("flex h-full w-full flex-col overflow-hidden", o), children: [
@@ -7462,7 +7456,7 @@ const registerChaiLibrary = (o, n) => {
7462
7456
  b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
7463
7457
  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 }) }) }) }),
7464
7458
  f ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
7465
- map(x, (v) => /* @__PURE__ */ jsx(TabsContent, { value: v.id, children: React__default.createElement(v.tabContent, { close: h, parentId: r, position: a }) }, `panel-add-block-${v.id}`))
7459
+ map(x, (v) => /* @__PURE__ */ jsx(TabsContent, { value: v.id, children: React__default.createElement(v.tabContent, { close: m, parentId: r, position: a }) }, `panel-add-block-${v.id}`))
7466
7460
  ]
7467
7461
  }
7468
7462
  )
@@ -7584,7 +7578,7 @@ const registerChaiSaveToLibrary = (o) => {
7584
7578
  }, CANNOT_COPY_BLOCKS = !navigator.clipboard, CopyPasteBlocks = () => {
7585
7579
  const [o] = useBlocksStore(), [n] = useSelectedBlockIds(), { pasteBlocks: r } = usePasteBlocks(), [, a, l] = useCopyBlocks(), { t: i } = useTranslation(), c = useSelectedBlock(), d = useCallback(() => {
7586
7580
  const p = n.map((u) => {
7587
- const g = o.find((m) => m._id === u);
7581
+ const g = o.find((h) => h._id === u);
7588
7582
  return {
7589
7583
  id: u,
7590
7584
  data: g
@@ -7769,8 +7763,8 @@ const Input = ({ node: o }) => {
7769
7763
  var R;
7770
7764
  const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
7771
7765
  let p = null;
7772
- const u = o.children.length > 0, { highlightBlock: g, clearHighlight: m } = useBlockHighlight(), { id: h, data: x, isSelected: f, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (T) => {
7773
- T.stopPropagation(), !l.includes(h) && o.toggle();
7766
+ const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: x, isSelected: f, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (T) => {
7767
+ T.stopPropagation(), !l.includes(m) && o.toggle();
7774
7768
  }, _ = (T) => {
7775
7769
  T.isInternal && (p = T.isOpen, T.isOpen && T.close());
7776
7770
  }, E = (T) => {
@@ -7781,11 +7775,11 @@ const Input = ({ node: o }) => {
7781
7775
  }, C = () => {
7782
7776
  A(null);
7783
7777
  }, k = (T) => {
7784
- C(), T.stopPropagation(), !o.isOpen && !l.includes(h) && o.toggle(), B(T);
7778
+ C(), T.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), B(T);
7785
7779
  };
7786
7780
  useEffect(() => {
7787
7781
  const T = setTimeout(() => {
7788
- y && !o.isOpen && !b && !l.includes(h) && o.toggle();
7782
+ y && !o.isOpen && !b && !l.includes(m) && o.toggle();
7789
7783
  }, 500);
7790
7784
  return () => clearTimeout(T);
7791
7785
  }, [y, o, b]);
@@ -7799,7 +7793,7 @@ const Input = ({ node: o }) => {
7799
7793
  const D = get(o, "parent.id");
7800
7794
  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 });
7801
7795
  };
7802
- if (h === ROOT_TEMP_KEY)
7796
+ if (m === ROOT_TEMP_KEY)
7803
7797
  return /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer", children: [
7804
7798
  /* @__PURE__ */ jsx("br", {}),
7805
7799
  d(PERMISSIONS.ADD_BLOCK) && /* @__PURE__ */ jsx(
@@ -7821,22 +7815,22 @@ const Input = ({ node: o }) => {
7821
7815
  return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
7822
7816
  "div",
7823
7817
  {
7824
- onMouseEnter: () => g(h),
7825
- onMouseLeave: () => m(),
7818
+ onMouseEnter: () => g(m),
7819
+ onMouseLeave: () => h(),
7826
7820
  onClick: k,
7827
7821
  style: n,
7828
- "data-node-id": h,
7829
- ref: l.includes(h) ? null : r,
7822
+ "data-node-id": m,
7823
+ ref: l.includes(m) ? null : r,
7830
7824
  onDragStart: () => _(o),
7831
7825
  onDragEnd: () => E(o),
7832
7826
  onDragOver: (T) => {
7833
- T.preventDefault(), j(h, "yes");
7827
+ T.preventDefault(), j(m, "yes");
7834
7828
  },
7835
7829
  onDragLeave: (T) => {
7836
- T.preventDefault(), j(h, "no");
7830
+ T.preventDefault(), j(m, "no");
7837
7831
  },
7838
7832
  onDrop: (T) => {
7839
- T.preventDefault(), j(h, "no");
7833
+ T.preventDefault(), j(m, "no");
7840
7834
  },
7841
7835
  children: [
7842
7836
  d(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((R = o == null ? void 0 : o.parent) == null ? void 0 : R.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
@@ -7860,7 +7854,7 @@ const Input = ({ node: o }) => {
7860
7854
  y && canAcceptChildBlock(x._type, "Icon") ? "bg-green-200" : "",
7861
7855
  (o == null ? void 0 : o.id) === S ? "bg-primary/10" : "",
7862
7856
  b && "opacity-20",
7863
- l.includes(h) ? "opacity-50" : "",
7857
+ l.includes(m) ? "opacity-50" : "",
7864
7858
  L && f && "bg-primary/20 text-primary"
7865
7859
  ),
7866
7860
  children: [
@@ -7897,11 +7891,11 @@ const Input = ({ node: o }) => {
7897
7891
  )
7898
7892
  ] }),
7899
7893
  /* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
7900
- canAddChildBlock(x == null ? void 0 : x._type) && !l.includes(h) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
7894
+ canAddChildBlock(x == null ? void 0 : x._type) && !l.includes(m) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
7901
7895
  /* @__PURE__ */ jsx(
7902
7896
  TooltipTrigger,
7903
7897
  {
7904
- onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: h }),
7898
+ onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: m }),
7905
7899
  className: "cursor-pointer rounded bg-transparent",
7906
7900
  asChild: !0,
7907
7901
  children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3" })
@@ -7914,7 +7908,7 @@ const Input = ({ node: o }) => {
7914
7908
  TooltipTrigger,
7915
7909
  {
7916
7910
  onClick: (T) => {
7917
- T.stopPropagation(), i(h), o.isOpen && o.toggle();
7911
+ T.stopPropagation(), i(m), o.isOpen && o.toggle();
7918
7912
  },
7919
7913
  className: "cursor-pointer rounded bg-transparent",
7920
7914
  asChild: !0,
@@ -7923,7 +7917,7 @@ const Input = ({ node: o }) => {
7923
7917
  ),
7924
7918
  /* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", side: "bottom", children: a("Hide block") })
7925
7919
  ] }),
7926
- /* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: h, children: /* @__PURE__ */ jsx(MoreVertical, { size: "15" }) })
7920
+ /* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: m, children: /* @__PURE__ */ jsx(MoreVertical, { size: "15" }) })
7927
7921
  ] })
7928
7922
  ]
7929
7923
  }
@@ -8188,9 +8182,9 @@ const Input = ({ node: o }) => {
8188
8182
  )
8189
8183
  ] });
8190
8184
  }, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
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) => {
8185
+ 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) => {
8192
8186
  a(v);
8193
- }, h = () => {
8187
+ }, m = () => {
8194
8188
  const v = l.find((B) => Object.keys(B)[0] === r);
8195
8189
  if (v) {
8196
8190
  const B = Object.values(v)[0];
@@ -8255,7 +8249,7 @@ const Input = ({ node: o }) => {
8255
8249
  "select",
8256
8250
  {
8257
8251
  value: r,
8258
- onChange: (v) => m(v.target.value),
8252
+ onChange: (v) => h(v.target.value),
8259
8253
  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",
8260
8254
  children: [
8261
8255
  /* @__PURE__ */ jsx("option", { value: "", children: "Select preset" }),
@@ -8270,7 +8264,7 @@ const Input = ({ node: o }) => {
8270
8264
  className: "w-full text-sm",
8271
8265
  disabled: r === "",
8272
8266
  variant: "default",
8273
- onClick: h,
8267
+ onClick: m,
8274
8268
  children: g("Apply")
8275
8269
  }
8276
8270
  ) })
@@ -8764,14 +8758,14 @@ function QuickPrompts({ onClick: o }) {
8764
8758
  ) }) });
8765
8759
  }
8766
8760
  const AIUserPrompt = ({ blockId: o }) => {
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);
8761
+ 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);
8768
8762
  useEffect(() => {
8769
8763
  var f;
8770
- (f = m.current) == null || f.focus();
8764
+ (f = h.current) == null || f.focus();
8771
8765
  }, []);
8772
8766
  const x = (f) => {
8773
8767
  const { usage: y } = f || {};
8774
- !l && y && g(y), h.current = setTimeout(() => g(void 0), 1e4), l || c("");
8768
+ !l && y && g(y), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
8775
8769
  };
8776
8770
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
8777
8771
  /* @__PURE__ */ jsxs(
@@ -8789,14 +8783,14 @@ const AIUserPrompt = ({ blockId: o }) => {
8789
8783
  /* @__PURE__ */ jsx(
8790
8784
  Textarea,
8791
8785
  {
8792
- ref: m,
8786
+ ref: h,
8793
8787
  value: i,
8794
8788
  onChange: (f) => c(f.target.value),
8795
8789
  placeholder: n("Ask AI to edit content"),
8796
8790
  className: "w-full",
8797
8791
  rows: 3,
8798
8792
  onKeyDown: (f) => {
8799
- f.key === "Enter" && (f.preventDefault(), h.current && clearTimeout(h.current), g(void 0), r("content", o, i, x));
8793
+ f.key === "Enter" && (f.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, x));
8800
8794
  }
8801
8795
  }
8802
8796
  ),
@@ -8806,7 +8800,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8806
8800
  {
8807
8801
  disabled: i.trim().length < 5 || a,
8808
8802
  onClick: () => {
8809
- h.current && clearTimeout(h.current), g(void 0), r("content", o, i, x);
8803
+ m.current && clearTimeout(m.current), g(void 0), r("content", o, i, x);
8810
8804
  },
8811
8805
  variant: "default",
8812
8806
  className: "w-fit",
@@ -8839,7 +8833,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8839
8833
  QuickPrompts,
8840
8834
  {
8841
8835
  onClick: (f) => {
8842
- h.current && clearTimeout(h.current), g(void 0), r("content", o, f, x);
8836
+ m.current && clearTimeout(m.current), g(void 0), r("content", o, f, x);
8843
8837
  }
8844
8838
  }
8845
8839
  )
@@ -8849,13 +8843,13 @@ const AIUserPrompt = ({ blockId: o }) => {
8849
8843
  ] }) }) : null
8850
8844
  ] });
8851
8845
  }, AISetContext = () => {
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);
8846
+ 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);
8853
8847
  useEffect(() => {
8854
8848
  n && a(n);
8855
8849
  }, [n]);
8856
- const h = async () => {
8850
+ const m = async () => {
8857
8851
  try {
8858
- d(!0), u(null), await i(r), toast.success(o("Updated AI Context")), m.current.click();
8852
+ d(!0), u(null), await i(r), toast.success(o("Updated AI Context")), h.current.click();
8859
8853
  } catch (x) {
8860
8854
  u(x);
8861
8855
  } finally {
@@ -8871,7 +8865,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8871
8865
  type: "single",
8872
8866
  collapsible: !0,
8873
8867
  children: /* @__PURE__ */ jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
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") }) }) }),
8868
+ /* @__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") }) }) }),
8875
8869
  /* @__PURE__ */ jsxs(AccordionContent, { children: [
8876
8870
  /* @__PURE__ */ jsx(
8877
8871
  Textarea,
@@ -8883,7 +8877,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8883
8877
  className: "mt-1 w-full",
8884
8878
  rows: 10,
8885
8879
  onKeyDown: (x) => {
8886
- x.key === "Enter" && (x.preventDefault(), h());
8880
+ x.key === "Enter" && (x.preventDefault(), m());
8887
8881
  }
8888
8882
  }
8889
8883
  ),
@@ -8895,7 +8889,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8895
8889
  Button,
8896
8890
  {
8897
8891
  disabled: r.trim().length < 5,
8898
- onClick: () => h(),
8892
+ onClick: () => m(),
8899
8893
  variant: "default",
8900
8894
  className: "w-fit",
8901
8895
  size: "sm",
@@ -8924,7 +8918,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8924
8918
  AlertDialogAction,
8925
8919
  {
8926
8920
  onClick: () => {
8927
- a(""), h();
8921
+ a(""), m();
8928
8922
  },
8929
8923
  children: o("Yes, Delete")
8930
8924
  }
@@ -8985,7 +8979,7 @@ function AIChatPanel() {
8985
8979
  }, [o]), useEffect(() => {
8986
8980
  g.current && (g.current.style.height = "auto", g.current.style.height = `${Math.min(g.current.scrollHeight, 120)}px`);
8987
8981
  }, [r]);
8988
- const m = async () => {
8982
+ const h = async () => {
8989
8983
  if (!r.trim() && !c) return;
8990
8984
  const b = {
8991
8985
  id: Date.now().toString(),
@@ -9002,8 +8996,8 @@ function AIChatPanel() {
9002
8996
  };
9003
8997
  n((B) => [...B, v]), i(!1), d(null);
9004
8998
  }, 1500);
9005
- }, h = (b) => {
9006
- b.key === "Enter" && !b.shiftKey && (b.preventDefault(), m());
8999
+ }, m = (b) => {
9000
+ b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
9007
9001
  }, x = (b) => {
9008
9002
  var B;
9009
9003
  const v = (B = b.target.files) == null ? void 0 : B[0];
@@ -9076,7 +9070,7 @@ function AIChatPanel() {
9076
9070
  ref: g,
9077
9071
  value: r,
9078
9072
  onChange: (b) => a(b.target.value),
9079
- onKeyDown: h,
9073
+ onKeyDown: m,
9080
9074
  placeholder: "Ask something...",
9081
9075
  className: "max-h-[120px] min-h-[40px] resize-none border-0 bg-muted/50 py-2.5 pr-10 focus-visible:ring-1"
9082
9076
  }
@@ -9098,7 +9092,7 @@ function AIChatPanel() {
9098
9092
  {
9099
9093
  size: "sm",
9100
9094
  className: "h-10 px-3",
9101
- onClick: m,
9095
+ onClick: h,
9102
9096
  disabled: l || !r.trim() && !c,
9103
9097
  children: [
9104
9098
  /* @__PURE__ */ jsx(Send, { className: "mr-1 h-4 w-4" }),
@@ -9206,18 +9200,18 @@ const AiAssistant = () => {
9206
9200
  preloadedAttributes: n = [],
9207
9201
  onAttributesChange: r
9208
9202
  }) {
9209
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [m, h] = useState(""), x = useRef(null), f = useRef(null), y = usePageExternalData();
9203
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""), x = useRef(null), f = useRef(null), y = usePageExternalData();
9210
9204
  useEffect(() => {
9211
9205
  l(n);
9212
9206
  }, [n]);
9213
9207
  const b = () => {
9214
9208
  if (i.startsWith("@")) {
9215
- h("Attribute keys cannot start with '@'");
9209
+ m("Attribute keys cannot start with '@'");
9216
9210
  return;
9217
9211
  }
9218
9212
  if (i) {
9219
9213
  const S = [...a, { key: i, value: d }];
9220
- r(S), l(a), c(""), p(""), h("");
9214
+ r(S), l(a), c(""), p(""), m("");
9221
9215
  }
9222
9216
  }, v = (S) => {
9223
9217
  const A = a.filter((N, C) => C !== S);
@@ -9226,12 +9220,12 @@ const AiAssistant = () => {
9226
9220
  g(S), c(a[S].key), p(a[S].value);
9227
9221
  }, w = () => {
9228
9222
  if (i.startsWith("@")) {
9229
- h("Attribute keys cannot start with '@'");
9223
+ m("Attribute keys cannot start with '@'");
9230
9224
  return;
9231
9225
  }
9232
9226
  if (u !== null && i) {
9233
9227
  const S = [...a];
9234
- S[u] = { key: i, value: d }, r(S), l(S), g(null), c(""), p(""), h("");
9228
+ S[u] = { key: i, value: d }, r(S), l(S), g(null), c(""), p(""), m("");
9235
9229
  }
9236
9230
  }, _ = (S) => {
9237
9231
  S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? w() : b());
@@ -9307,7 +9301,7 @@ const AiAssistant = () => {
9307
9301
  ] })
9308
9302
  ] }),
9309
9303
  /* @__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" }) }),
9310
- m && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: m })
9304
+ h && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: h })
9311
9305
  ]
9312
9306
  }
9313
9307
  ),
@@ -9338,7 +9332,33 @@ const AiAssistant = () => {
9338
9332
  [o, l, i]
9339
9333
  );
9340
9334
  return /* @__PURE__ */ jsx("div", { className: "flex-col gap-y-2", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AttrsEditor, { preloadedAttributes: n, onAttributesChange: c }) }) }) });
9341
- }), NoopComponent = () => null;
9335
+ }), NoopComponent = () => null, ResetStylesButton = () => {
9336
+ const { resetAll: o } = useResetBlockStyles(), { t: n } = useTranslation();
9337
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
9338
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
9339
+ "button",
9340
+ {
9341
+ type: "button",
9342
+ className: "ml-1 rounded-sm p-0.5 hover:bg-blue-300 hover:text-blue-600",
9343
+ onClick: (r) => r.stopPropagation(),
9344
+ children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3 w-3" })
9345
+ }
9346
+ ) }),
9347
+ /* @__PURE__ */ jsx(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: /* @__PURE__ */ jsxs(
9348
+ DropdownMenuItem,
9349
+ {
9350
+ className: "flex items-center gap-1 text-xs",
9351
+ onClick: () => {
9352
+ o();
9353
+ },
9354
+ children: [
9355
+ /* @__PURE__ */ jsx(ResetIcon, { className: "h-3 w-3" }),
9356
+ n("Reset styles")
9357
+ ]
9358
+ }
9359
+ ) })
9360
+ ] });
9361
+ };
9342
9362
  function BlockAttributesToggle() {
9343
9363
  const { t: o } = useTranslation(), [n, r] = useState(!0), [a] = useSelectedStylingBlocks();
9344
9364
  return isEmpty(a) ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -9372,16 +9392,20 @@ const SettingsPanel = () => {
9372
9392
  /* @__PURE__ */ jsx("br", {}),
9373
9393
  /* @__PURE__ */ jsx("br", {})
9374
9394
  ] }) }) : l ? /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxs("div", { className: "no-scrollbar h-full max-h-min w-full overflow-y-auto overflow-x-hidden", children: [
9395
+ /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-end", children: /* @__PURE__ */ jsx(ResetStylesButton, {}) }),
9375
9396
  /* @__PURE__ */ jsx(BlockStyling, {}),
9376
9397
  /* @__PURE__ */ jsx(BlockAttributesToggle, {}),
9377
9398
  /* @__PURE__ */ jsx("br", {}),
9378
9399
  /* @__PURE__ */ jsx("br", {}),
9379
9400
  /* @__PURE__ */ jsx("br", {})
9380
9401
  ] }) }) : /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxs(Tabs, { defaultValue: "settings", className: "flex flex-1 flex-col", children: [
9381
- /* @__PURE__ */ jsxs(TabsList, { className: "grid h-auto w-full grid-cols-2 p-1 py-1", children: [
9402
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs(TabsList, { className: "grid h-auto w-full grid-cols-2 p-1 py-1", children: [
9382
9403
  /* @__PURE__ */ jsx(TabsTrigger, { value: "settings", className: "text-xs", children: "Settings" }),
9383
- /* @__PURE__ */ jsx(TabsTrigger, { value: "styles", className: "text-xs", children: "Styles" })
9384
- ] }),
9404
+ /* @__PURE__ */ jsxs(TabsTrigger, { value: "styles", className: "flex items-center justify-between text-xs", children: [
9405
+ "Styles",
9406
+ /* @__PURE__ */ jsx(ResetStylesButton, {})
9407
+ ] })
9408
+ ] }) }),
9385
9409
  /* @__PURE__ */ jsxs(TabsContent, { value: "settings", className: "no-scrollbar h-full max-h-min overflow-y-auto", children: [
9386
9410
  /* @__PURE__ */ jsx(BlockSettings, {}),
9387
9411
  /* @__PURE__ */ jsx("br", {}),
@@ -9438,9 +9462,9 @@ const RootLayout = () => {
9438
9462
  usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
9439
9463
  r("outline");
9440
9464
  });
9441
- const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = useCallback((S) => {
9465
+ const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), h = useCallback((S) => {
9442
9466
  S.preventDefault();
9443
- }, []), h = useCallback(
9467
+ }, []), m = useCallback(
9444
9468
  (S) => {
9445
9469
  r(n === S ? null : S);
9446
9470
  },
@@ -9469,15 +9493,15 @@ const RootLayout = () => {
9469
9493
  }, [n, f]);
9470
9494
  const E = useCallback(
9471
9495
  (S) => {
9472
- h(S);
9496
+ m(S);
9473
9497
  },
9474
- [h]
9498
+ [m]
9475
9499
  );
9476
9500
  return /* @__PURE__ */ jsx("div", { dir: y, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
9477
9501
  /* @__PURE__ */ jsxs(
9478
9502
  "div",
9479
9503
  {
9480
- onContextMenu: m,
9504
+ onContextMenu: h,
9481
9505
  className: "flex h-screen max-h-full flex-col bg-background text-foreground",
9482
9506
  children: [
9483
9507
  /* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
@@ -9681,12 +9705,12 @@ const RootLayout = () => {
9681
9705
  return (y == null ? void 0 : y.toLowerCase().includes(f)) || ((v = b == null ? void 0 : b.description) == null ? void 0 : v.toLowerCase().includes(f));
9682
9706
  })
9683
9707
  );
9684
- }, [a, l]), m = (f) => {
9708
+ }, [a, l]), h = (f) => {
9685
9709
  d(!0), u({
9686
9710
  x: f.clientX - n.x,
9687
9711
  y: f.clientY - n.y
9688
9712
  });
9689
- }, h = (f) => {
9713
+ }, m = (f) => {
9690
9714
  if (!c) return;
9691
9715
  const y = f.clientX - p.x, b = f.clientY - p.y, v = f.currentTarget, B = v.offsetWidth, w = v.offsetHeight, _ = window.innerWidth - B, E = window.innerHeight - w, S = Math.max(0, Math.min(y, _)), A = Math.max(0, Math.min(b, E));
9692
9716
  r(S, A);
@@ -9701,8 +9725,8 @@ const RootLayout = () => {
9701
9725
  }, [c]), !n || n.x < 0 || n.y < 0 ? null : /* @__PURE__ */ jsxs(
9702
9726
  "div",
9703
9727
  {
9704
- onMouseDown: m,
9705
- onMouseMove: h,
9728
+ onMouseDown: h,
9729
+ onMouseMove: m,
9706
9730
  onMouseUp: x,
9707
9731
  className: "fixed z-[9999999] select-none rounded-md border border-gray-300 bg-white p-3 shadow-2xl",
9708
9732
  style: {
@@ -9862,17 +9886,17 @@ const RootLayout = () => {
9862
9886
  for (const i of n.p)
9863
9887
  l.add(i);
9864
9888
  return l;
9865
- }, 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, ...x) => h.read(...x), p = (h, ...x) => h.write(...x), u = (h, x) => {
9889
+ }, BUILDING_BLOCKS = Symbol(), buildStore = (o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = {}, d = (m, ...x) => m.read(...x), p = (m, ...x) => m.write(...x), u = (m, x) => {
9866
9890
  var f;
9867
- return (f = h.unstable_onInit) == null ? void 0 : f.call(h, x);
9868
- }, g = (h, x) => {
9891
+ return (f = m.unstable_onInit) == null ? void 0 : f.call(m, x);
9892
+ }, g = (m, x) => {
9869
9893
  var f;
9870
- return (f = h.onMount) == null ? void 0 : f.call(h, x);
9871
- }, ...m) => {
9872
- const h = m[0] || ((A) => {
9894
+ return (f = m.onMount) == null ? void 0 : f.call(m, x);
9895
+ }, ...h) => {
9896
+ const m = h[0] || ((A) => {
9873
9897
  let N = o.get(A);
9874
9898
  return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(A, N), u == null || u(A, S)), N;
9875
- }), x = m[1] || (() => {
9899
+ }), x = h[1] || (() => {
9876
9900
  let A, N;
9877
9901
  const C = (k) => {
9878
9902
  try {
@@ -9891,10 +9915,10 @@ const RootLayout = () => {
9891
9915
  } while (a.size || i.size || l.size);
9892
9916
  if (A)
9893
9917
  throw N;
9894
- }), f = m[2] || (() => {
9918
+ }), f = h[2] || (() => {
9895
9919
  const A = [], N = /* @__PURE__ */ new WeakSet(), C = /* @__PURE__ */ new WeakSet(), k = Array.from(a);
9896
9920
  for (; k.length; ) {
9897
- const j = k[k.length - 1], I = h(j);
9921
+ const j = k[k.length - 1], I = m(j);
9898
9922
  if (C.has(j)) {
9899
9923
  k.pop();
9900
9924
  continue;
@@ -9917,9 +9941,9 @@ const RootLayout = () => {
9917
9941
  }
9918
9942
  R && (y(I), B(I)), r.delete(I);
9919
9943
  }
9920
- }), y = m[3] || ((A) => {
9944
+ }), y = h[3] || ((A) => {
9921
9945
  var N, C;
9922
- const k = h(A);
9946
+ const k = m(A);
9923
9947
  if (isAtomStateInitialized(k) && (n.has(A) && r.get(A) !== k.n || Array.from(k.d).every(
9924
9948
  ([P, $]) => (
9925
9949
  // Recursively, read the atom state of the dependency, and
@@ -9935,10 +9959,10 @@ const RootLayout = () => {
9935
9959
  }, L = (P) => {
9936
9960
  var $;
9937
9961
  if (isSelfAtom(A, P)) {
9938
- const H = h(P);
9962
+ const H = m(P);
9939
9963
  if (!isAtomStateInitialized(H))
9940
9964
  if (hasInitialValue(P))
9941
- setAtomStateValueOrPromise(P, P.init, h);
9965
+ setAtomStateValueOrPromise(P, P.init, m);
9942
9966
  else
9943
9967
  throw new Error("no atom init");
9944
9968
  return returnAtomValue(H);
@@ -9968,7 +9992,7 @@ const RootLayout = () => {
9968
9992
  }, O = k.n;
9969
9993
  try {
9970
9994
  const P = d(A, L, D);
9971
- return setAtomStateValueOrPromise(A, P, h), isPromiseLike$1(P) && ((N = P.onCancel) == null || N.call(P, () => R == null ? void 0 : R.abort()), P.then(
9995
+ return setAtomStateValueOrPromise(A, P, m), isPromiseLike$1(P) && ((N = P.onCancel) == null || N.call(P, () => R == null ? void 0 : R.abort()), P.then(
9972
9996
  I,
9973
9997
  I
9974
9998
  )), k;
@@ -9977,26 +10001,26 @@ const RootLayout = () => {
9977
10001
  } finally {
9978
10002
  j = !1, O !== k.n && r.get(A) === O && (r.set(A, k.n), a.add(A), (C = c.c) == null || C.call(c, A));
9979
10003
  }
9980
- }), b = m[4] || ((A) => {
10004
+ }), b = h[4] || ((A) => {
9981
10005
  const N = [A];
9982
10006
  for (; N.length; ) {
9983
- const C = N.pop(), k = h(C);
10007
+ const C = N.pop(), k = m(C);
9984
10008
  for (const j of getMountedOrPendingDependents(C, k, n)) {
9985
- const I = h(j);
10009
+ const I = m(j);
9986
10010
  r.set(j, I.n), N.push(j);
9987
10011
  }
9988
10012
  }
9989
- }), v = m[5] || ((A, ...N) => {
10013
+ }), v = h[5] || ((A, ...N) => {
9990
10014
  let C = !0;
9991
10015
  const k = (I) => returnAtomValue(y(I)), j = (I, ...L) => {
9992
10016
  var R;
9993
- const T = h(I);
10017
+ const T = m(I);
9994
10018
  try {
9995
10019
  if (isSelfAtom(A, I)) {
9996
10020
  if (!hasInitialValue(I))
9997
10021
  throw new Error("atom not writable");
9998
10022
  const D = T.n, O = L[0];
9999
- setAtomStateValueOrPromise(I, O, h), B(I), D !== T.n && (a.add(I), (R = c.c) == null || R.call(c, I), b(I));
10023
+ setAtomStateValueOrPromise(I, O, m), B(I), D !== T.n && (a.add(I), (R = c.c) == null || R.call(c, I), b(I));
10000
10024
  return;
10001
10025
  } else
10002
10026
  return v(I, ...L);
@@ -10009,13 +10033,13 @@ const RootLayout = () => {
10009
10033
  } finally {
10010
10034
  C = !1;
10011
10035
  }
10012
- }), B = m[6] || ((A) => {
10036
+ }), B = h[6] || ((A) => {
10013
10037
  var N;
10014
- const C = h(A), k = n.get(A);
10038
+ const C = m(A), k = n.get(A);
10015
10039
  if (k && !isPendingPromise(C.v)) {
10016
10040
  for (const [j, I] of C.d)
10017
10041
  if (!k.d.has(j)) {
10018
- const L = h(j);
10042
+ const L = m(j);
10019
10043
  w(j).t.add(A), k.d.add(j), I !== L.n && (a.add(j), (N = c.c) == null || N.call(c, j), b(j));
10020
10044
  }
10021
10045
  for (const j of k.d || [])
@@ -10025,9 +10049,9 @@ const RootLayout = () => {
10025
10049
  I == null || I.t.delete(A);
10026
10050
  }
10027
10051
  }
10028
- }), w = m[7] || ((A) => {
10052
+ }), w = h[7] || ((A) => {
10029
10053
  var N;
10030
- const C = h(A);
10054
+ const C = m(A);
10031
10055
  let k = n.get(A);
10032
10056
  if (!k) {
10033
10057
  y(A);
@@ -10065,9 +10089,9 @@ const RootLayout = () => {
10065
10089
  }
10066
10090
  }
10067
10091
  return k;
10068
- }), _ = m[8] || ((A) => {
10092
+ }), _ = h[8] || ((A) => {
10069
10093
  var N;
10070
- const C = h(A);
10094
+ const C = m(A);
10071
10095
  let k = n.get(A);
10072
10096
  if (k && !k.l.size && !Array.from(k.t).some((j) => {
10073
10097
  var I;
@@ -10096,7 +10120,7 @@ const RootLayout = () => {
10096
10120
  u,
10097
10121
  g,
10098
10122
  // building-block functions
10099
- h,
10123
+ m,
10100
10124
  x,
10101
10125
  f,
10102
10126
  y,