@chaibuilder/sdk 3.0.29 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,19 +2,19 @@ var U = Object.defineProperty;
2
2
  var W = (o, n, r) => n in o ? U(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
3
3
  var F = (o, n, r) => W(o, typeof n != "symbol" ? n + "" : n, r);
4
4
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
- import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredFonts, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
6
- 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, uniq, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, sortBy, round } from "lodash-es";
7
- import { SquareIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, CaretDownIcon, Cross1Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, ValueIcon, TextAlignCenterIcon, TextAlignRightIcon, TextAlignLeftIcon, Link2Icon, LinkBreak2Icon, EnterFullScreenIcon, ExclamationTriangleIcon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, ReloadIcon, CircleIcon, MagnifyingGlassIcon, CaretRightIcon, FrameIcon, CheckIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, StopIcon, EraserIcon, LightningBoltIcon, ZoomInIcon, StackIcon } from "@radix-ui/react-icons";
5
+ import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, syncBlocksWithDefaults, useRegisteredFonts, getBlockFormSchemas } from "@chaibuilder/runtime";
6
+ 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, kebabCase, uniq, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, sortBy, round } from "lodash-es";
7
+ import { SquareIcon, ChevronRightIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, CaretDownIcon, Cross1Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, ValueIcon, TextAlignCenterIcon, TextAlignRightIcon, TextAlignLeftIcon, Link2Icon, LinkBreak2Icon, EnterFullScreenIcon, ExclamationTriangleIcon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, CircleIcon, MagnifyingGlassIcon, ReloadIcon, CaretRightIcon, FrameIcon, CheckIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, StopIcon, EraserIcon, LightningBoltIcon, ZoomInIcon, StackIcon } from "@radix-ui/react-icons";
8
8
  import * as React from "react";
9
9
  import React__default, { useMemo, useCallback, useEffect, useState, useRef, Component, Children, memo, createElement, createContext, useContext, Suspense, lazy, 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$1 } from "./common-functions-BGzDsf1z.js";
13
- import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, at as Input$1, aW as Skeleton, d as Alert, e as AlertDescription, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, a9 as DialogTitle, av as Popover, b4 as Tooltip, b7 as TooltipTrigger, ay as PopoverTrigger, b5 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, B as Badge, b6 as TooltipProvider, a as AccordionItem, b as AccordionTrigger, c as AccordionContent, ag as DropdownMenuLabel, ak as DropdownMenuSeparator, ac as DropdownMenuCheckboxItem, aq as HoverCard, as as HoverCardTrigger, ar as HoverCardContent, b1 as Textarea, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, z as CardFooter, az as ScrollArea, aZ as Tabs, a$ as TabsList, b0 as TabsTrigger, a_ as TabsContent, a6 as DialogHeader, aX as Slider, aB as Select$1, aJ as SelectTrigger, aK as SelectValue, aC as SelectContent, aE as SelectItem, aL as Separator, aY as Switch, g as AlertDialog, q as AlertDialogTrigger, j as AlertDialogContent, m as AlertDialogHeader, p as AlertDialogTitle, k as AlertDialogDescription, l as AlertDialogFooter, i as AlertDialogCancel, h as AlertDialogAction, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./tooltip-4-b9QGDK.js";
13
+ import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, at as Input$1, aW as Skeleton, d as Alert, e as AlertDescription, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, a9 as DialogTitle, av as Popover, b4 as Tooltip, b7 as TooltipTrigger, ay as PopoverTrigger, b5 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, B as Badge, b6 as TooltipProvider, a as AccordionItem, b as AccordionTrigger, c as AccordionContent, ag as DropdownMenuLabel, ak as DropdownMenuSeparator, ac as DropdownMenuCheckboxItem, aq as HoverCard, as as HoverCardTrigger, ar as HoverCardContent, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, b1 as Textarea, z as CardFooter, az as ScrollArea, aZ as Tabs, a$ as TabsList, b0 as TabsTrigger, a_ as TabsContent, a6 as DialogHeader, aX as Slider, aB as Select$1, aJ as SelectTrigger, aK as SelectValue, aC as SelectContent, aE as SelectItem, aL as Separator, aY as Switch, g as AlertDialog, q as AlertDialogTrigger, j as AlertDialogContent, m as AlertDialogHeader, p as AlertDialogTitle, k as AlertDialogDescription, l as AlertDialogFooter, i as AlertDialogCancel, h as AlertDialogAction, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./tooltip-4-b9QGDK.js";
14
14
  import clsx$1, { clsx } from "clsx";
15
15
  import { twMerge } from "tailwind-merge";
16
16
  import TreeModel from "tree-model";
17
- import { C as COLLECTION_PREFIX, S as STYLES_KEY, i as getSplitChaiClasses, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, h as getBlocksFromHTML, j as ROOT_TEMP_KEY } from "./apply-binding-YbVf4970.js";
17
+ import { C as COLLECTION_PREFIX, S as STYLES_KEY, i as getSplitChaiClasses, h as getBlocksFromHTML, m as mergeBlocksWithExisting, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, j as ROOT_TEMP_KEY } from "./apply-binding-FoDMumPo.js";
18
18
  import { d as defaultThemeOptions, f as defaultThemeValues, a as getChaiThemeCssVariables, g as getChaiThemeOptions, p as plugin, h as getThemeFontsUrls, i as getThemeCustomFontFace } from "./plugin-BOcGV_IY.js";
19
19
  import { isObject } from "@rjsf/utils";
20
20
  import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useDebouncedState, useIntervalEffect } from "@react-hookz/web";
@@ -38,7 +38,7 @@ import validator from "@rjsf/validator-ajv8";
38
38
  import Autosuggest from "react-autosuggest";
39
39
  import { useFeature } from "flagged";
40
40
  import { Tree } from "react-arborist";
41
- import "himalaya";
41
+ import { parse, stringify } from "himalaya";
42
42
  import tailwindAspectRatio from "@tailwindcss/aspect-ratio";
43
43
  import tailwindForms from "@tailwindcss/forms";
44
44
  import tailwindTypography from "@tailwindcss/typography";
@@ -48,6 +48,7 @@ import twContainer from "@tailwindcss/container-queries";
48
48
  import { useHotkeys } from "react-hotkeys-hook";
49
49
  import { ErrorBoundary } from "react-error-boundary";
50
50
  import { motion } from "framer-motion";
51
+ import { compact as compact$1, pick as pick$1 } from "lodash";
51
52
  import { limitShift, flip, size } from "@floating-ui/dom";
52
53
  import { useFloating, shift } from "@floating-ui/react-dom";
53
54
  import { Provider as Provider$1 } from "react-wrap-balancer";
@@ -295,20 +296,20 @@ class PubSub {
295
296
  }
296
297
  }
297
298
  const pubsub = new PubSub(), AddBlockDropdown = ({ block: o, children: n }) => {
298
- const { t: r } = useTranslation(), [a] = useBlocksStore(), { hasPermission: l } = usePermissions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(a, (g) => c ? get(g, "_parent") === c : !get(g, "_parent")), p = canAddChildBlock(get(o, "_type", "")), u = findIndex(d, { _id: i }), m = (g) => {
299
- if (g === "CHILD")
299
+ 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) => {
300
+ if (m === "CHILD")
300
301
  pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, o);
301
302
  else {
302
303
  const h = { _id: c || "", position: d == null ? void 0 : d.length };
303
- g === "BEFORE" ? h.position = Math.max(u, 0) : g === "AFTER" && (h.position = u + 1), pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, h);
304
+ m === "BEFORE" ? h.position = Math.max(u, 0) : m === "AFTER" && (h.position = u + 1), pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, h);
304
305
  }
305
306
  };
306
307
  return l(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
307
308
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { children: n }),
308
309
  /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "border border-blue-500 bg-primary text-white shadow-2xl", children: [
309
- p && /* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => m("CHILD"), children: r("Add inside") }),
310
- /* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => m("BEFORE"), children: r("Add before") }),
311
- /* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => m("AFTER"), children: r("Add after") })
310
+ p && /* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => g("CHILD"), children: r("Add inside") }),
311
+ /* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => g("BEFORE"), children: r("Add before") }),
312
+ /* @__PURE__ */ jsx(DropdownMenuItem, { className: "cursor-pointer text-xs", onClick: () => g("AFTER"), children: r("Add after") })
312
313
  ] })
313
314
  ] }) : null;
314
315
  }, draggedBlockAtom = atom(null);
@@ -334,24 +335,24 @@ function insertBlocksAtPosition(o, n, r, a) {
334
335
  const l = [...n];
335
336
  let i = [...o];
336
337
  if (r) {
337
- const u = o.find((m) => m._id === r);
338
- if (u && u.content !== void 0 && u.content !== "" && !o.some((g) => g._parent === r)) {
338
+ const u = o.find((g) => g._id === r);
339
+ if (u && u.content !== void 0 && u.content !== "" && !o.some((m) => m._parent === r)) {
339
340
  const h = {
340
341
  _id: generateUUID(),
341
342
  _parent: r,
342
343
  _type: "Text",
343
344
  content: u.content
344
345
  };
345
- Object.keys(u).forEach((f) => {
346
- f.startsWith("content-") && (h[f] = u[f]);
347
- }), l.unshift(h), i = i.map((f) => {
348
- if (f._id === r) {
349
- const x = { ...f, content: "" };
350
- return Object.keys(x).forEach((b) => {
351
- b.startsWith("content-") && (x[b] = "");
352
- }), x;
346
+ Object.keys(u).forEach((x) => {
347
+ x.startsWith("content-") && (h[x] = u[x]);
348
+ }), l.unshift(h), i = i.map((x) => {
349
+ if (x._id === r) {
350
+ const f = { ...x, content: "" };
351
+ return Object.keys(f).forEach((b) => {
352
+ b.startsWith("content-") && (f[b] = "");
353
+ }), f;
353
354
  }
354
- return f;
355
+ return x;
355
356
  });
356
357
  }
357
358
  }
@@ -359,13 +360,13 @@ function insertBlocksAtPosition(o, n, r, a) {
359
360
  r && (c = i.filter((u) => u._parent === r));
360
361
  const d = !isNaN(a) || a > -1 ? Math.min(a, c.length) : c.length;
361
362
  let p = i.length;
362
- for (let u = 0, m = 0; u < i.length; u++)
363
+ for (let u = 0, g = 0; u < i.length; u++)
363
364
  if (r !== void 0 ? i[u]._parent === r : !i[u]._parent) {
364
- if (m === d) {
365
+ if (g === d) {
365
366
  p = u;
366
367
  break;
367
368
  }
368
- m++;
369
+ g++;
369
370
  }
370
371
  return !r && a !== void 0 && a >= c.length && (p = i.length), [...i.slice(0, p), ...l, ...i.slice(p)];
371
372
  }
@@ -380,17 +381,17 @@ function findNodeById(o, n) {
380
381
  return o.first((r) => r.model._id === n) || null;
381
382
  }
382
383
  function moveNode(o, n, r, a) {
383
- var u, m;
384
+ var u, g;
384
385
  const l = findNodeById(o, n), i = findNodeById(o, r);
385
386
  if (!l || !i) return !1;
386
387
  i.children || (i.model.children = []);
387
- let c = (u = i == null ? void 0 : i.children) == null ? void 0 : u.findIndex((g) => g.model._id === n);
388
+ let c = (u = i == null ? void 0 : i.children) == null ? void 0 : u.findIndex((m) => m.model._id === n);
388
389
  l.drop(), c = Math.max(c, 0);
389
- const p = (((m = l == null ? void 0 : l.model) == null ? void 0 : m._parent) || "root") === r && c <= a ? a - 1 : a;
390
+ const p = (((g = l == null ? void 0 : l.model) == null ? void 0 : g._parent) || "root") === r && c <= a ? a - 1 : a;
390
391
  try {
391
392
  i.addChildAtIndex(l, p);
392
- } catch (g) {
393
- return console.error("Error adding child to parent:", g), !1;
393
+ } catch (m) {
394
+ return console.error("Error adding child to parent:", m), !1;
394
395
  }
395
396
  return !0;
396
397
  }
@@ -430,10 +431,10 @@ function handleNewParentTextBlock(o, n, r) {
430
431
  });
431
432
  const d = o.map((u) => {
432
433
  if (u._id === r) {
433
- const m = { ...u, content: "" };
434
- return Object.keys(m).forEach((g) => {
435
- g.startsWith("content-") && (m[g] = "");
436
- }), m;
434
+ const g = { ...u, content: "" };
435
+ return Object.keys(g).forEach((m) => {
436
+ m.startsWith("content-") && (g[m] = "");
437
+ }), g;
437
438
  }
438
439
  return u;
439
440
  }), p = d.findIndex((u) => u._id === n._id);
@@ -449,8 +450,8 @@ function moveBlocksWithChildren(o, n, r, a) {
449
450
  const c = r || "root", p = new TreeModel().parse({ _id: "root", children: getBlocksTree(i) });
450
451
  if (moveNode(p, n, c, a)) {
451
452
  let u = flattenTree(p);
452
- const m = u.find((g) => g._id === n);
453
- return m && (m._parent = c === "root" ? null : c), u.shift(), r && (u = handleNewParentTextBlock(u, l, r)), u;
453
+ const g = u.find((m) => m._id === n);
454
+ return g && (g._parent = c === "root" ? null : c), u.shift(), r && (u = handleNewParentTextBlock(u, l, r)), u;
454
455
  }
455
456
  return i;
456
457
  }
@@ -473,22 +474,22 @@ const broadcastChannel = new BroadcastChannel("chaibuilder"), useBroadcastChanne
473
474
  }, removeNestedBlocks = (o, n) => {
474
475
  let r = [...o], a = [];
475
476
  n.forEach((d) => {
476
- const p = r.find((g) => g._id === d);
477
+ const p = r.find((m) => m._id === d);
477
478
  if (!p || !p._parent) return;
478
- const u = p._parent, m = r.filter((g) => g._parent === u);
479
- if (m.length === 2) {
480
- const g = m.find((h) => h._id !== d);
481
- if (g && g._type === "Text") {
482
- const h = r.find((f) => f._id === u);
483
- h && "content" in h && (r = r.map((f) => {
484
- if (f._id === u) {
485
- const x = { ...f, content: g.content };
486
- return Object.keys(g).forEach((b) => {
487
- b.startsWith("content-") && (x[b] = g[b]);
488
- }), x;
479
+ const u = p._parent, g = r.filter((m) => m._parent === u);
480
+ if (g.length === 2) {
481
+ const m = g.find((h) => h._id !== d);
482
+ if (m && m._type === "Text") {
483
+ const h = r.find((x) => x._id === u);
484
+ h && "content" in h && (r = r.map((x) => {
485
+ if (x._id === u) {
486
+ const f = { ...x, content: m.content };
487
+ return Object.keys(m).forEach((b) => {
488
+ b.startsWith("content-") && (f[b] = m[b]);
489
+ }), f;
489
490
  }
490
- return f;
491
- }), a.push(g._id));
491
+ return x;
492
+ }), a.push(m._id));
492
493
  }
493
494
  }
494
495
  });
@@ -551,7 +552,7 @@ const broadcastChannel = new BroadcastChannel("chaibuilder"), useBroadcastChanne
551
552
  for (let p = 0; p < a.length; p++)
552
553
  d = moveBlocksWithChildren(d, a[p], l, i);
553
554
  return each(a, (p) => {
554
- const u = find(d, (m) => m._id === p);
555
+ const u = find(d, (g) => g._id === p);
555
556
  u && r({ id: p, props: { _parent: u._parent || null } });
556
557
  }), n({ type: "blocks-updated", blocks: d }), d;
557
558
  });
@@ -570,34 +571,34 @@ const useBlockRepeaterDataAtom = () => useAtom$1(blockRepeaterDataAtom), useAsyn
570
571
  status: "idle",
571
572
  props: {},
572
573
  error: void 0
573
- }), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (f) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), m = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), g = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
574
+ }), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (x) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), g = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), m = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
574
575
  return useEffect(() => {
575
576
  if (n === "mock") {
576
577
  if (isFunction(a)) {
577
- i((x) => ({ ...x, status: "loading", props: {} }));
578
- const f = a({ block: o });
579
- if (!isObject(f))
578
+ i((f) => ({ ...f, status: "loading", props: {} }));
579
+ const x = a({ block: o });
580
+ if (!isObject(x))
580
581
  throw new Error("mockDataProvider should return an object");
581
- i((x) => ({ ...x, status: "loaded", props: f }));
582
+ i((f) => ({ ...f, status: "loaded", props: x }));
582
583
  }
583
584
  return;
584
585
  }
585
- n === "live" && (!m && !g || (i((f) => ({ ...f, status: "loading", props: {} })), d({ block: o }).then((f = {}) => {
586
- m ? (p((x) => ({
587
- ...x,
586
+ n === "live" && (!g && !m || (i((x) => ({ ...x, status: "loading", props: {} })), d({ block: o }).then((x = {}) => {
587
+ g ? (p((f) => ({
588
+ ...f,
588
589
  [o._id]: {
589
590
  status: "loaded",
590
- props: get(f, "items", []),
591
+ props: get(x, "items", []),
591
592
  repeaterItems: o.repeaterItems
592
593
  }
593
- })), i((x) => ({ ...x, status: "loaded", props: { totalItems: get(f, "totalItems") } })), c([o._id], { totalItems: get(f, "totalItems") })) : i((x) => ({ ...x, status: "loaded", props: isObject(f) ? f : {} }));
594
- }).catch((f) => {
595
- m ? (p((x) => ({
596
- ...x,
597
- [o._id]: { status: "error", error: f, props: [] }
598
- })), i((x) => ({ ...x, status: "error", error: f, props: {} }))) : i((x) => ({ ...x, status: "error", error: f, props: {} }));
594
+ })), i((f) => ({ ...f, status: "loaded", props: { totalItems: get(x, "totalItems") } })), c([o._id], { totalItems: get(x, "totalItems") })) : i((f) => ({ ...f, status: "loaded", props: isObject(x) ? x : {} }));
595
+ }).catch((x) => {
596
+ g ? (p((f) => ({
597
+ ...f,
598
+ [o._id]: { status: "error", error: x, props: [] }
599
+ })), i((f) => ({ ...f, status: "error", error: x, props: {} }))) : i((f) => ({ ...f, status: "error", error: x, props: {} }));
599
600
  })));
600
- }, [o == null ? void 0 : o._id, u, m, g, a, n]), {
601
+ }, [o == null ? void 0 : o._id, u, g, m, a, n]), {
601
602
  $loading: get(l, "status") === "loading",
602
603
  ...o ? get(l, "props", {}) : {}
603
604
  };
@@ -750,22 +751,22 @@ const checkMissingTranslations = (o, n) => n ? o.some((r) => {
750
751
  return console.warn(`Failed to get block definition for type: ${r._type}`, a), !1;
751
752
  }
752
753
  }) : !1, useSavePage = () => {
753
- const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (f) => {
754
- }), a = useBuilderProp("onSaveStateChange", noop), l = useGetPageData(), [i] = useTheme(), { hasPermission: c } = usePermissions(), { selectedLang: d, fallbackLang: p } = useLanguages(), [u] = useIsPageLoaded(), m = () => {
755
- const f = l();
756
- return !d || d === p ? !1 : checkMissingTranslations(f.blocks || [], d);
754
+ const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (x) => {
755
+ }), a = useBuilderProp("onSaveStateChange", noop), l = useGetPageData(), [i] = useTheme(), { hasPermission: c } = usePermissions(), { selectedLang: d, fallbackLang: p } = useLanguages(), [u] = useIsPageLoaded(), g = () => {
756
+ const x = l();
757
+ return !d || d === p ? !1 : checkMissingTranslations(x.blocks || [], d);
757
758
  };
758
759
  return { savePage: useThrottledCallback(
759
- async (f = !1) => {
760
+ async (x = !1) => {
760
761
  if (!c("save_page") || !u)
761
762
  return;
762
763
  n("SAVING"), a("SAVING");
763
- const x = l();
764
+ const f = l();
764
765
  return await r({
765
- autoSave: f,
766
- blocks: x.blocks,
766
+ autoSave: x,
767
+ blocks: f.blocks,
767
768
  theme: i,
768
- needTranslations: m()
769
+ needTranslations: g()
769
770
  }), setTimeout(() => {
770
771
  n("SAVED"), a("SAVED");
771
772
  }, 100), !0;
@@ -777,16 +778,16 @@ const checkMissingTranslations = (o, n) => n ? o.some((r) => {
777
778
  if (!c("save_page") || !u)
778
779
  return;
779
780
  n("SAVING"), a("SAVING");
780
- const f = l();
781
+ const x = l();
781
782
  return await r({
782
783
  autoSave: !0,
783
- blocks: f.blocks,
784
+ blocks: x.blocks,
784
785
  theme: i,
785
- needTranslations: m()
786
+ needTranslations: g()
786
787
  }), setTimeout(() => {
787
788
  n("SAVED"), a("SAVED");
788
789
  }, 100), !0;
789
- }, saveState: o, setSaveState: n, needTranslations: m };
790
+ }, saveState: o, setSaveState: n, needTranslations: g };
790
791
  }, undoManager = new UndoManager();
791
792
  undoManager.setLimit(50);
792
793
  const undoRedoStateAtom = atom({
@@ -838,65 +839,65 @@ const undoRedoStateAtom = atom({
838
839
  updateBlocksProps: c
839
840
  } = useBlocksStoreManager();
840
841
  return {
841
- moveBlocks: (x, b, y) => {
842
- const S = map(x, (B) => {
843
- const j = n.find((I) => I._id === B)._parent || null, k = n.filter((I) => j ? I._parent === j : !I._parent).map((I) => I._id).indexOf(B);
844
- return { _id: B, oldParent: j, oldPosition: k };
845
- }), v = S.find(({ _id: B }) => B === x[0]);
846
- v && v.oldParent === b && v.oldPosition === y || (i(x, b, y), o({
847
- undo: () => each(S, ({ _id: B, oldParent: _, oldPosition: j }) => {
848
- i([B], _, j);
842
+ moveBlocks: (f, b, y) => {
843
+ const C = map(f, (j) => {
844
+ const B = n.find((I) => I._id === j)._parent || null, k = n.filter((I) => B ? I._parent === B : !I._parent).map((I) => I._id).indexOf(j);
845
+ return { _id: j, oldParent: B, oldPosition: k };
846
+ }), v = C.find(({ _id: j }) => j === f[0]);
847
+ v && v.oldParent === b && v.oldPosition === y || (i(f, b, y), o({
848
+ undo: () => each(C, ({ _id: j, oldParent: _, oldPosition: B }) => {
849
+ i([j], _, B);
849
850
  }),
850
- redo: () => i(x, b, y)
851
+ redo: () => i(f, b, y)
851
852
  }));
852
853
  },
853
- addBlocks: (x, b, y) => {
854
- a(x, b, y), o({
855
- undo: () => l(map(x, "_id")),
856
- redo: () => a(x, b, y)
854
+ addBlocks: (f, b, y) => {
855
+ a(f, b, y), o({
856
+ undo: () => l(map(f, "_id")),
857
+ redo: () => a(f, b, y)
857
858
  });
858
859
  },
859
- removeBlocks: (x) => {
860
+ removeBlocks: (f) => {
860
861
  var v;
861
- const b = (v = first(x)) == null ? void 0 : v._parent, S = n.filter((B) => b ? B._parent === b : !B._parent).indexOf(first(x));
862
- l(map(x, "_id")), o({
863
- undo: () => a(x, b, S),
864
- redo: () => l(map(x, "_id"))
862
+ const b = (v = first(f)) == null ? void 0 : v._parent, C = n.filter((j) => b ? j._parent === b : !j._parent).indexOf(first(f));
863
+ l(map(f, "_id")), o({
864
+ undo: () => a(f, b, C),
865
+ redo: () => l(map(f, "_id"))
865
866
  });
866
867
  },
867
- updateBlocks: (x, b, y) => {
868
- let S = [];
868
+ updateBlocks: (f, b, y) => {
869
+ let C = [];
869
870
  if (y)
870
- S = map(x, (v) => ({ _id: v, ...y }));
871
+ C = map(f, (v) => ({ _id: v, ...y }));
871
872
  else {
872
873
  const v = keys(b);
873
- S = map(x, (B) => {
874
- const _ = n.find((C) => C._id === B), j = { _id: B };
875
- return each(v, (C) => j[C] = _[C]), j;
874
+ C = map(f, (j) => {
875
+ const _ = n.find((S) => S._id === j), B = { _id: j };
876
+ return each(v, (S) => B[S] = _[S]), B;
876
877
  });
877
878
  }
878
- c(map(x, (v) => ({ _id: v, ...b }))), o({
879
- undo: () => c(S),
880
- redo: () => c(map(x, (v) => ({ _id: v, ...b })))
879
+ c(map(f, (v) => ({ _id: v, ...b }))), o({
880
+ undo: () => c(C),
881
+ redo: () => c(map(f, (v) => ({ _id: v, ...b })))
881
882
  });
882
883
  },
883
- updateBlocksRuntime: (x, b) => {
884
- c(map(x, (y) => ({ _id: y, ...b })));
884
+ updateBlocksRuntime: (f, b) => {
885
+ c(map(f, (y) => ({ _id: y, ...b })));
885
886
  },
886
- setNewBlocks: (x) => {
887
- r(x), o({
887
+ setNewBlocks: (f) => {
888
+ r(f), o({
888
889
  undo: () => r(n),
889
- redo: () => r(x)
890
+ redo: () => r(f)
890
891
  });
891
892
  },
892
- updateMultipleBlocksProps: (x) => {
893
+ updateMultipleBlocksProps: (f) => {
893
894
  let b = [];
894
- b = map(x, (y) => {
895
- const S = keys(y), v = n.find((_) => _._id === y._id), B = {};
896
- return each(S, (_) => B[_] = v[_]), B;
897
- }), c(x), o({
895
+ b = map(f, (y) => {
896
+ const C = keys(y), v = n.find((_) => _._id === y._id), j = {};
897
+ return each(C, (_) => j[_] = v[_]), j;
898
+ }), c(f), o({
898
899
  undo: () => c(b),
899
- redo: () => c(x)
900
+ redo: () => c(f)
900
901
  });
901
902
  }
902
903
  };
@@ -904,16 +905,16 @@ const undoRedoStateAtom = atom({
904
905
  const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
905
906
  (i, c, d) => {
906
907
  var h;
907
- for (let f = 0; f < i.length; f++) {
908
- const { _id: x } = i[f];
909
- i[f]._id = generateUUID();
910
- const b = filter(i, { _parent: x });
908
+ for (let x = 0; x < i.length; x++) {
909
+ const { _id: f } = i[x];
910
+ i[x]._id = generateUUID();
911
+ const b = filter(i, { _parent: f });
911
912
  for (let y = 0; y < b.length; y++)
912
- b[y]._parent = i[f]._id;
913
+ b[y]._parent = i[x]._id;
913
914
  }
914
915
  const p = first(i);
915
- let u, m;
916
- return c && (u = find(o, { _id: c }), i[0]._parent = c, m = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, m = u._parent), r(i, m, d), n([(h = first(i)) == null ? void 0 : h._id]), first(i);
916
+ let u, g;
917
+ 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);
917
918
  },
918
919
  [r, o, n]
919
920
  );
@@ -923,15 +924,15 @@ const undoRedoStateAtom = atom({
923
924
  const b = i.blocks;
924
925
  return a(b, c, d);
925
926
  }
926
- const p = generateUUID(), u = getDefaultBlockProps(i.type), m = {
927
+ const p = generateUUID(), u = getDefaultBlockProps(i.type), g = {
927
928
  _type: i.type,
928
929
  _id: p,
929
930
  ...u,
930
931
  ...has(i, "_name") && { _name: i._name },
931
932
  ...has(i, "partialBlockId") && { partialBlockId: i.partialBlockId }
932
933
  };
933
- let g, h;
934
- return c && (g = find(o, { _id: c }), m._parent = c, h = c), !canAcceptChildBlock(g == null ? void 0 : g._type, m._type) && g && (m._parent = g._parent, h = g._parent), r([m], h, d), n([m._id]), m;
934
+ let m, h;
935
+ 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;
935
936
  },
936
937
  [r, a, o, n]
937
938
  ), addPredefinedBlock: a };
@@ -2042,7 +2043,7 @@ function removeDuplicateClasses(o) {
2042
2043
  for (const l of r) {
2043
2044
  const i = l.property, c = n.indexOf(l.mq);
2044
2045
  for (let d = c + 1; d < n.length; d++) {
2045
- const p = n[d], u = r.find((m) => m.property === i && m.mq === p);
2046
+ const p = n[d], u = r.find((g) => g.property === i && g.mq === p);
2046
2047
  if (u && u.cls === l.cls)
2047
2048
  a = a.replace(u.fullCls, "");
2048
2049
  else if (u && u.cls !== l.cls)
@@ -2315,7 +2316,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), add
2315
2316
  let p = "";
2316
2317
  o([n], { [i]: "" });
2317
2318
  for (let u = 0; u < d.length; u++)
2318
- p += d[u].join(""), o([n], { [i]: p }), await new Promise((m) => setTimeout(m, a));
2319
+ p += d[u].join(""), o([n], { [i]: p }), await new Promise((g) => setTimeout(g, a));
2319
2320
  }
2320
2321
  }
2321
2322
  },
@@ -2356,45 +2357,45 @@ const getBlockWithChildren = (o, n) => {
2356
2357
  const l = ["_id", "_type", "_parent"], i = pick(a, l), c = getRegisteredChaiBlock(a._type), d = {}, p = get(c, "aiProps", []);
2357
2358
  for (const u in a)
2358
2359
  if (!l.includes(u) && p.includes(u)) {
2359
- const m = get(a, `${u}-${n}`, ""), g = get(a, u, "");
2360
- d[u] = isString(m) && m.trim() || g, r && (d[u] = g);
2360
+ const g = get(a, `${u}-${n}`, ""), m = get(a, u, "");
2361
+ d[u] = isString(g) && g.trim() || m, r && (d[u] = m);
2361
2362
  }
2362
2363
  return isEmpty(d) ? !1 : (has(i, "_parent") && isEmpty(i._parent) && delete i._parent, { ...i, ...d });
2363
2364
  })
2364
2365
  ), addLangToPrompt = (o, n, r) => !n || r !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, n, n)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
2365
- 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(), m = p.length ? p : u, g = (h, f) => {
2366
- const x = cloneDeep(f.find((b) => b._id === h));
2367
- for (const b in x) {
2368
- const y = x[b];
2366
+ 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) => {
2367
+ const f = cloneDeep(x.find((b) => b._id === h));
2368
+ for (const b in f) {
2369
+ const y = f[b];
2369
2370
  if (typeof y == "string" && startsWith(y, STYLES_KEY)) {
2370
- const { baseClasses: S, classes: v } = getSplitChaiClasses(y);
2371
- x[b] = compact(flattenDeep([S, v])).join(" ");
2371
+ const { baseClasses: C, classes: v } = getSplitChaiClasses(y);
2372
+ f[b] = compact(flattenDeep([C, v])).join(" ");
2372
2373
  } else
2373
- b !== "_id" && delete x[b];
2374
+ b !== "_id" && delete f[b];
2374
2375
  }
2375
- return x;
2376
+ return f;
2376
2377
  };
2377
2378
  return {
2378
2379
  askAi: useCallback(
2379
- async (h, f, x, b) => {
2380
+ async (h, x, f, b) => {
2380
2381
  if (l) {
2381
2382
  n(!0), a(null);
2382
2383
  try {
2383
- const y = p === u ? "" : p, S = x.toLowerCase().includes("translate the content"), v = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p, S) : [g(f, d)], B = await l(h, addLangToPrompt(x, m, h), v, y), { blocks: _, error: j } = B;
2384
- if (j) {
2385
- a(j);
2384
+ const y = p === u ? "" : p, C = f.toLowerCase().includes("translate the content"), v = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(x, d)), p, C) : [m(x, d)], j = await l(h, addLangToPrompt(f, g, h), v, y), { blocks: _, error: B } = j;
2385
+ if (B) {
2386
+ a(B);
2386
2387
  return;
2387
2388
  }
2388
2389
  if (h === "styles") {
2389
- const C = _.map((k) => {
2390
+ const S = _.map((k) => {
2390
2391
  for (const I in k)
2391
2392
  I !== "_id" && (k[I] = `${STYLES_KEY},${k[I]}`);
2392
2393
  return k;
2393
2394
  });
2394
- c(C);
2395
+ c(S);
2395
2396
  } else
2396
2397
  i(_);
2397
- b && b(B);
2398
+ b && b(j);
2398
2399
  } catch (y) {
2399
2400
  a(y);
2400
2401
  } finally {
@@ -2408,7 +2409,7 @@ const getBlockWithChildren = (o, n) => {
2408
2409
  p,
2409
2410
  u,
2410
2411
  d,
2411
- m,
2412
+ g,
2412
2413
  c,
2413
2414
  i
2414
2415
  ]
@@ -2470,55 +2471,59 @@ const getBlockWithChildren = (o, n) => {
2470
2471
  );
2471
2472
  return [o, a];
2472
2473
  }, copiedBlockIdsAtom = atom([]), useCopyBlocks = () => {
2473
- const [o] = useBlocksStore(), [n, r] = useAtom$1(copiedBlockIdsAtom), a = useSetAtom$1(cutBlockIdsAtom), { getPartailBlocks: l } = usePartialBlocksStore(), i = useCallback(
2474
- (d) => d.some((p) => getDuplicatedBlocks(o, p, null).some((m) => m._type === "PartialBlock" || m._type === "GlobalBlock")),
2474
+ const [o] = useBlocksStore(), [n, r] = useAtom$1(copiedBlockIdsAtom), a = useSetAtom$1(cutBlockIdsAtom), { getPartailBlocks: l } = usePartialBlocksStore(), i = useBuilderProp("flags.useClipboard", !1), c = useCallback(
2475
+ (p) => p.some((u) => getDuplicatedBlocks(o, u, null).some((m) => m._type === "PartialBlock" || m._type === "GlobalBlock")),
2475
2476
  [o]
2476
- ), c = useCallback(
2477
- async (d, p = !1) => {
2477
+ ), d = useCallback(
2478
+ async (p, u = !1) => {
2478
2479
  try {
2479
- if (isEmpty(d)) return;
2480
- r(d), a([]);
2481
- const u = {
2482
- _chai_copied_blocks: d.flatMap((m) => {
2483
- const g = getDuplicatedBlocks(o, m, null);
2484
- if (!p)
2485
- return g;
2486
- let h = [];
2487
- for (const f of g)
2480
+ if (isEmpty(p)) return;
2481
+ r(p), a([]);
2482
+ const g = {
2483
+ _chai_copied_blocks: p.flatMap((m) => {
2484
+ const h = getDuplicatedBlocks(o, m, null);
2485
+ if (!u)
2486
+ return h;
2487
+ let x = [];
2488
+ for (const f of h)
2488
2489
  if (f._type === "PartialBlock" || f._type === "GlobalBlock") {
2489
- let x = l(f.partialBlockId);
2490
- f._parent && (x == null ? void 0 : x.length) > 0 && (x = x.map((b) => (isEmpty(b._parent) && set(b, "_parent", f._parent), b))), h = [...h, ...x];
2490
+ let b = l(f.partialBlockId);
2491
+ f._parent && (b == null ? void 0 : b.length) > 0 && (b = b.map((y) => (isEmpty(y._parent) && set(y, "_parent", f._parent), y))), x = [...x, ...b];
2491
2492
  } else
2492
- h.push(f);
2493
- return h;
2493
+ x.push(f);
2494
+ return x;
2494
2495
  })
2495
2496
  };
2497
+ if (!i)
2498
+ return;
2496
2499
  if (!navigator.clipboard) {
2497
2500
  toast.error("Clipboard not available.");
2498
2501
  return;
2499
2502
  }
2500
- toast.promise(navigator.clipboard.writeText(JSON.stringify(u)), {
2503
+ toast.promise(navigator.clipboard.writeText(JSON.stringify(g)), {
2501
2504
  success: "Blocks copied successfully",
2502
2505
  error: "Failed to copy blocks to clipboard"
2503
2506
  });
2504
- } catch (u) {
2505
- toast.error("Failed to copy blocks to clipboard"), console.error("Failed to copy blocks to clipboard:", u);
2507
+ } catch (g) {
2508
+ toast.error("Failed to copy blocks to clipboard"), console.error("Failed to copy blocks to clipboard:", g);
2506
2509
  }
2507
2510
  },
2508
2511
  [r, a, o]
2509
2512
  );
2510
- return [n, c, i];
2513
+ return [n, d, c];
2511
2514
  }, useCopyToClipboard = () => {
2512
- const [o, n] = useState(null), r = useCallback(async (a) => {
2515
+ const [o, n] = useState(null), r = useBuilderProp("flags.useClipboard", !1), a = useCallback(async (l) => {
2516
+ if (!r)
2517
+ return console.warn("Clipboard feature is disabled"), !1;
2513
2518
  if (!(navigator != null && navigator.clipboard))
2514
2519
  return console.warn("Clipboard not supported"), !1;
2515
2520
  try {
2516
- return await navigator.clipboard.writeText(a), n(a), !0;
2517
- } catch (l) {
2518
- return console.warn("Copy failed", l), n(null), !1;
2521
+ return await navigator.clipboard.writeText(l), n(l), !0;
2522
+ } catch (i) {
2523
+ return console.warn("Copy failed", i), n(null), !1;
2519
2524
  }
2520
2525
  }, []);
2521
- return [o, r];
2526
+ return [o, a];
2522
2527
  }, darkModeAtom = atomWithStorage("darkMode", !1), useDarkMode = () => {
2523
2528
  const [o, n] = useAtom$1(darkModeAtom);
2524
2529
  return [o, n];
@@ -2530,11 +2535,11 @@ const getBlockWithChildren = (o, n) => {
2530
2535
  each(a, (c) => {
2531
2536
  const d = o.find((h) => h._id === c);
2532
2537
  l ? l === "root" && (l = null) : l = d._parent;
2533
- const m = filter(
2538
+ const g = filter(
2534
2539
  o,
2535
2540
  (h) => isString(l) ? h._parent === l : !h._parent
2536
- ).indexOf(d) + 1, g = getDuplicatedBlocks(o, c, l);
2537
- r(g, l, m), i.push(get(g, "0._id", ""));
2541
+ ).indexOf(d) + 1, m = getDuplicatedBlocks(o, c, l);
2542
+ r(m, l, g), i.push(get(m, "0._id", ""));
2538
2543
  }), n(i);
2539
2544
  },
2540
2545
  [o, n]
@@ -2662,19 +2667,19 @@ const getBlockWithChildren = (o, n) => {
2662
2667
  );
2663
2668
  return map(i, (c) => {
2664
2669
  const d = o(c), p = a;
2665
- let { classes: u, baseClasses: m } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
2666
- return each(p, (g) => {
2667
- const h = g.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2668
- u = u.replace(f, " ").replace(/\s+/g, " ").trim();
2669
- const x = first(g.split(":"));
2670
- includes(["2xl", "xl", "lg", "md", "sm"], x) && p.push(g.split(":").pop().trim());
2671
- }), each(p, (g) => {
2672
- const h = g.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2673
- m = m.replace(f, " ").replace(/\s+/g, " ").trim();
2670
+ let { classes: u, baseClasses: g } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
2671
+ return each(p, (m) => {
2672
+ const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2673
+ u = u.replace(x, " ").replace(/\s+/g, " ").trim();
2674
+ const f = first(m.split(":"));
2675
+ includes(["2xl", "xl", "lg", "md", "sm"], f) && p.push(m.split(":").pop().trim());
2676
+ }), each(p, (m) => {
2677
+ const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2678
+ g = g.replace(x, " ").replace(/\s+/g, " ").trim();
2674
2679
  }), {
2675
2680
  ids: [d._id],
2676
2681
  props: {
2677
- [l.prop]: `${STYLES_KEY}${m},${u}`
2682
+ [l.prop]: `${STYLES_KEY}${g},${u}`
2678
2683
  }
2679
2684
  };
2680
2685
  });
@@ -2787,7 +2792,136 @@ const getBlockWithChildren = (o, n) => {
2787
2792
  return null;
2788
2793
  });
2789
2794
  wrapperBlockAtom.debugLabel = "wrapperBlockAtom";
2790
- const useWrapperBlock = () => useAtomValue$1(wrapperBlockAtom), inlineEditingActiveAtom = atom("");
2795
+ const useWrapperBlock = () => useAtomValue$1(wrapperBlockAtom), useCanvasIframe = () => useAtom$1(canvasIframeAtom), ATTRIBUTES_TO_REMOVE = ["data-block-index", "data-drop", "data-style-id", "data-block-parent", "data-style-prop"], CORE_BLOCKS$1 = [
2796
+ "Box",
2797
+ "Button",
2798
+ "Checkbox",
2799
+ "Divider",
2800
+ "EmptyBox",
2801
+ "Form",
2802
+ "FormButton",
2803
+ "Heading",
2804
+ "Image",
2805
+ "Input",
2806
+ "Label",
2807
+ "LineBreak",
2808
+ "Link",
2809
+ "List",
2810
+ "ListItem",
2811
+ "Paragraph",
2812
+ "Radio",
2813
+ "RichText",
2814
+ "Select",
2815
+ "Span",
2816
+ "Text",
2817
+ "TextArea",
2818
+ "Video"
2819
+ ], cleanNode = (o) => o.type === "element" && ["script", "style", "link"].includes(o.tagName || "") || o.type === "comment" ? null : o.type === "text" ? o : o.type === "element" && o.attributes && o.attributes.find((n) => n.key === "id" && n.value === "add-block-bottom") ? null : (o.type === "element" && o.attributes && (o.attributes = o.attributes.filter((n) => !ATTRIBUTES_TO_REMOVE.includes(n.key))), o.children && (o.children = o.children.map(cleanNode).filter((n) => n !== null)), o), transformNode = (o, n) => {
2820
+ if (o.type !== "element" || !o.attributes)
2821
+ return o;
2822
+ o.tagName === "span" && o.attributes.find((i) => i.key === "role" && i.value === "link") && (o.tagName = "a", o.attributes = o.attributes.filter((i) => i.key !== "role"));
2823
+ const r = o.attributes.find((l) => l.key === "data-block-type"), a = o.attributes.find((l) => l.key === "data-block-id");
2824
+ if (r) {
2825
+ const l = r.value;
2826
+ if (CORE_BLOCKS$1.includes(l))
2827
+ o.attributes = o.attributes.filter((i) => i.key !== "data-block-type"), o.children && (o.children = o.children.map((i) => transformNode(i, n)));
2828
+ else {
2829
+ const i = `chai-${kebabCase(l)}`;
2830
+ o.tagName = i, a ? o.attributes = [{ key: "id", value: a.value }] : o.attributes = [], o.attributes.push({ key: "chai-type", value: l });
2831
+ const c = getRegisteredChaiBlock(l), d = n.find((p) => p._id === (a == null ? void 0 : a.value));
2832
+ if (d && o.attributes.push(
2833
+ ...Object.entries(d).filter(([p]) => !["_id", "_type", "_parent", "_index", "_name"].includes(p)).map(([p, u]) => ({
2834
+ key: p,
2835
+ value: typeof u == "string" ? u : JSON.stringify(u)
2836
+ }))
2837
+ ), c && (c != null && c.description) && o.attributes.push({
2838
+ key: "about-this-component",
2839
+ value: c.description
2840
+ }), c) {
2841
+ if (c.canMove) {
2842
+ const p = typeof c.canMove == "function" ? c.canMove() : c.canMove;
2843
+ o.attributes.push({
2844
+ key: "can-move",
2845
+ value: String(p)
2846
+ });
2847
+ }
2848
+ if (c.canDelete) {
2849
+ const p = typeof c.canDelete == "function" ? c.canDelete() : c.canDelete;
2850
+ o.attributes.push({
2851
+ key: "can-delete",
2852
+ value: String(p)
2853
+ });
2854
+ }
2855
+ }
2856
+ l === "Icon" && (o.attributes = o.attributes.filter((p) => p.key !== "icon")), c && c.canAcceptBlock ? o.children && (o.children = o.children.map((p) => transformNode(p, n))) : o.children = [];
2857
+ }
2858
+ } else
2859
+ o.children && (o.children = o.children.map((l) => transformNode(l, n)));
2860
+ return o.attributes = o.attributes.filter((l) => l.key !== "data-block-type" && l.key !== "data-block-id"), o;
2861
+ }, useBlocksHtmlForAi = () => {
2862
+ const o = useSelectedBlock(), [n] = useBlocksStore(), [r] = useCanvasIframe();
2863
+ return useCallback(() => {
2864
+ var u, g;
2865
+ if (!r) return "";
2866
+ const a = o != null && o._id ? `[data-block-id="${o._id}"]` : "#canvas", l = (g = (u = r.contentDocument) == null ? void 0 : u.querySelector(a)) == null ? void 0 : g[a === "#canvas" ? "innerHTML" : "outerHTML"];
2867
+ if (!l) return "";
2868
+ const d = parse(l).map(cleanNode).filter((m) => m !== null).map((m) => transformNode(m, n));
2869
+ let p = stringify(d);
2870
+ return p = p.replace(/#styles:,/g, "#styles:"), p.replace(/\s+/g, " ").trim();
2871
+ }, [o, r]);
2872
+ }, handlei18N = (o, n) => o.map((r) => {
2873
+ const a = getRegisteredChaiBlock(r._type);
2874
+ if (!a) return r;
2875
+ const l = a.i18nProps;
2876
+ if (!l) return r;
2877
+ const i = filter(n, { _type: r._type }), c = pick(r, l);
2878
+ return each(c, (d, p) => {
2879
+ const u = find(i, (g) => {
2880
+ var x;
2881
+ const m = typeof g[p] == "string" ? (x = g[p]) == null ? void 0 : x.trim().toLowerCase() : JSON.stringify(g[p]), h = typeof d == "string" ? d.trim().toLowerCase() : JSON.stringify(d);
2882
+ return m === h;
2883
+ });
2884
+ if (u) {
2885
+ const g = filter(Object.keys(u), (h) => startsWith(h, `${p}-`)), m = pick(u, g);
2886
+ r = { ...r, ...m };
2887
+ }
2888
+ }), r;
2889
+ }), useHtmlToBlocks = () => {
2890
+ const [o] = useBlocksStore();
2891
+ return useCallback(
2892
+ (n) => {
2893
+ const r = syncBlocksWithDefaults(getBlocksFromHTML(n)), a = mergeBlocksWithExisting(r, o);
2894
+ return handlei18N(a, o);
2895
+ },
2896
+ [o]
2897
+ );
2898
+ }, getAllDescendantBlocks = (o, n) => {
2899
+ const r = o.filter((l) => l._parent === n), a = r.flatMap((l) => getAllDescendantBlocks(o, l._id));
2900
+ return [...r, ...a];
2901
+ }, getBlockWithNestedChildren = (o, n) => {
2902
+ const r = n.find((l) => l._id === o);
2903
+ if (!r) return [];
2904
+ const a = getAllDescendantBlocks(n, o);
2905
+ return [r, ...a];
2906
+ }, useI18nBlocks = () => {
2907
+ const o = useSelectedBlock(), [n] = useBlocksStore();
2908
+ return useCallback(
2909
+ (r = "") => {
2910
+ const a = o != null && o._id ? getBlockWithNestedChildren(o._id, n) : n;
2911
+ return a ? compact$1(
2912
+ a.map((l) => {
2913
+ const i = getRegisteredChaiBlock(l._type);
2914
+ if (!i) return null;
2915
+ const c = (i == null ? void 0 : i.i18nProps) ?? [];
2916
+ if (c.length === 0) return null;
2917
+ const d = r === "ALL" ? Object.keys(l).filter((p) => c.find((u) => p.startsWith(u))) : c.map((p) => r ? `${p}-${r}` : p);
2918
+ return pick$1(l, [...d, "_id"]);
2919
+ })
2920
+ ) : [];
2921
+ },
2922
+ [o == null ? void 0 : o._id, n]
2923
+ );
2924
+ }, inlineEditingActiveAtom = atom("");
2791
2925
  inlineEditingActiveAtom.debugLabel = "inlineEditingActiveAtom";
2792
2926
  const inlineEditingItemIndexAtom = atom(0);
2793
2927
  inlineEditingItemIndexAtom.debugLabel = "inlineEditingItemIndexAtom";
@@ -2805,7 +2939,7 @@ const useInlineEditing = () => {
2805
2939
  }, replaceBlock = (o, n, r) => {
2806
2940
  const a = find(o, { _id: n });
2807
2941
  if (!a) return o;
2808
- const l = o.findIndex((g) => g._id === n), i = getAllDescendantIds(o, n), c = /* @__PURE__ */ new Set([n, ...i]), d = o.filter((g) => !c.has(g._id)), p = new Set(r.map((g) => g._id)), u = r.map((g) => !g._parent || !p.has(g._parent) ? { ...g, _parent: a._parent } : g);
2942
+ const l = o.findIndex((m) => m._id === n), i = getAllDescendantIds(o, n), c = /* @__PURE__ */ new Set([n, ...i]), d = o.filter((m) => !c.has(m._id)), p = new Set(r.map((m) => m._id)), u = r.map((m) => !m._parent || !p.has(m._parent) ? { ...m, _parent: a._parent } : m);
2809
2943
  return [
2810
2944
  ...d.slice(0, l),
2811
2945
  ...u,
@@ -2816,7 +2950,7 @@ const useInlineEditing = () => {
2816
2950
  return useCallback(
2817
2951
  (l, i) => {
2818
2952
  if (!a(PERMISSIONS.EDIT_BLOCK)) return;
2819
- const c = replaceBlock(o, l, i);
2953
+ const c = l ? replaceBlock(o, l, i) : i;
2820
2954
  r(c), i.length > 0 && setTimeout(() => n([i[0]._id]), 200);
2821
2955
  },
2822
2956
  [o, n, r, a]
@@ -2841,21 +2975,21 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2841
2975
  return "VERTICAL";
2842
2976
  }
2843
2977
  }, isDisabledControl = (o, n, r) => !!(o && (r === "UP" || r === "LEFT") || n && (r === "DOWN" || r === "RIGHT")), useBlockController = (o, n) => {
2844
- const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (x) => c ? get(x, "_parent") === c : !get(x, "_parent")), p = (d == null ? void 0 : d.length) <= 1, u = findIndex(d, { _id: i }), m = u <= 0, g = u + 1 === (d == null ? void 0 : d.length), h = getParentBlockOrientation(c, i, a), f = useCallback(
2845
- (x) => {
2846
- isDisabledControl(m, g, x) || p || (x === "UP" || x === "LEFT" ? l([i], c || null, u - 1) : (x === "DOWN" || x === "RIGHT") && l([i], c || null, u + 2), n());
2978
+ 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(
2979
+ (f) => {
2980
+ 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());
2847
2981
  },
2848
- [m, g, p, u, i, c, n]
2982
+ [g, m, p, u, i, c, n]
2849
2983
  );
2850
2984
  return useHotkeys(
2851
2985
  "shift+up, shift+down, shift+left, shift+right",
2852
- ({ key: x }) => {
2986
+ ({ key: f }) => {
2853
2987
  var b;
2854
- f((b = x == null ? void 0 : x.replace("Arrow", "")) == null ? void 0 : b.toUpperCase());
2988
+ x((b = f == null ? void 0 : f.replace("Arrow", "")) == null ? void 0 : b.toUpperCase());
2855
2989
  },
2856
2990
  { document: a == null ? void 0 : a.contentDocument },
2857
- [f]
2858
- ), { isOnlyChild: p, isFirstBlock: m, isLastBlock: g, moveBlock: f, orientation: h };
2991
+ [x]
2992
+ ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: m, moveBlock: x, orientation: h };
2859
2993
  }, BlockController = ({ block: o, updateFloatingBar: n }) => {
2860
2994
  const { isOnlyChild: r, isFirstBlock: a, isLastBlock: l, moveBlock: i, orientation: c } = useBlockController(
2861
2995
  o,
@@ -2863,12 +2997,12 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2863
2997
  );
2864
2998
  return r ? null : /* @__PURE__ */ jsx(Fragment, { children: CONTROLS.map(({ ControlIcon: d, dir: p, key: u }) => {
2865
2999
  if (c !== p) return null;
2866
- const m = isDisabledControl(a, l, u);
2867
- return m ? null : /* @__PURE__ */ jsx(
3000
+ const g = isDisabledControl(a, l, u);
3001
+ return g ? null : /* @__PURE__ */ jsx(
2868
3002
  d,
2869
3003
  {
2870
3004
  onClick: () => i(u),
2871
- className: `${m ? "pointer-events-none cursor-not-allowed opacity-50" : "duration-300 hover:scale-95 hover:opacity-80"}`
3005
+ className: `${g ? "pointer-events-none cursor-not-allowed opacity-50" : "duration-300 hover:scale-95 hover:opacity-80"}`
2872
3006
  },
2873
3007
  u
2874
3008
  );
@@ -2995,7 +3129,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
2995
3129
  i([null]);
2996
3130
  }, [r, n]), /* @__PURE__ */ jsx(BlockFloatingSelector, { block: o, selectedBlockElement: a[0] });
2997
3131
  }, BlockFloatingSelector = ({ block: o, selectedBlockElement: n }) => {
2998
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), { hasPermission: d } = usePermissions(), { editingBlockId: p } = useInlineEditing(), { document: u } = useFrame(), { floatingStyles: m, refs: g, update: h } = useFloating({
3132
+ 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({
2999
3133
  placement: "top-start",
3000
3134
  middleware: [
3001
3135
  shift({
@@ -3012,8 +3146,8 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
3012
3146
  }),
3013
3147
  size({
3014
3148
  boundary: u == null ? void 0 : u.body,
3015
- apply({ availableWidth: b, availableHeight: y, elements: S }) {
3016
- Object.assign(S.floating.style, {
3149
+ apply({ availableWidth: b, availableHeight: y, elements: C }) {
3150
+ Object.assign(C.floating.style, {
3017
3151
  maxWidth: `${Math.max(200, b)}px`,
3018
3152
  maxHeight: `${Math.max(100, y)}px`
3019
3153
  });
@@ -3023,7 +3157,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
3023
3157
  elements: { reference: n }
3024
3158
  });
3025
3159
  useResizeObserver(n, () => h(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => h(), (u == null ? void 0 : u.body) !== null);
3026
- const f = get(o, "_parent", null), x = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
3160
+ const x = get(o, "_parent", null), f = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
3027
3161
  return useEffect(() => {
3028
3162
  if (n) {
3029
3163
  const b = setTimeout(() => h(), 500);
@@ -3035,8 +3169,8 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
3035
3169
  {
3036
3170
  role: "button",
3037
3171
  tabIndex: 0,
3038
- ref: g.setFloating,
3039
- style: m,
3172
+ ref: m.setFloating,
3173
+ style: g,
3040
3174
  onClick: (b) => {
3041
3175
  b.stopPropagation(), b.preventDefault();
3042
3176
  },
@@ -3046,16 +3180,16 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
3046
3180
  onKeyDown: (b) => b.stopPropagation(),
3047
3181
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
3048
3182
  children: [
3049
- f && /* @__PURE__ */ jsx(
3183
+ x && /* @__PURE__ */ jsx(
3050
3184
  ArrowUpIcon,
3051
3185
  {
3052
3186
  className: "hover:scale-105",
3053
3187
  onClick: () => {
3054
- c([]), l([f]);
3188
+ c([]), l([x]);
3055
3189
  }
3056
3190
  }
3057
3191
  ),
3058
- /* @__PURE__ */ jsx(BlockActionLabel, { label: x, block: o }),
3192
+ /* @__PURE__ */ jsx(BlockActionLabel, { label: f, block: o }),
3059
3193
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pl-1 pr-1.5", children: [
3060
3194
  /* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "hover:scale-105" }) }),
3061
3195
  canDuplicateBlock(get(o, "_type", "")) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsx(CopyIcon, { className: "hover:scale-105", onClick: () => a([o == null ? void 0 : o._id]) }) : null,
@@ -3262,7 +3396,7 @@ F(Frame, "defaultProps", {
3262
3396
  initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
3263
3397
  });
3264
3398
  const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame, { ...o, forwardedRef: n })), useKeyEventWatcher = (o) => {
3265
- const [n, r] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlocks(), { canPaste: m, pasteBlocks: g } = usePasteBlocks(), h = o ? { document: o } : {};
3399
+ 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 } : {};
3266
3400
  useHotkeys("ctrl+z,command+z", () => c(), {}, [c]), useHotkeys("ctrl+y,command+y", () => d(), {}, [d]), useHotkeys("ctrl+x,command+x", () => p(n), {}, [n, p]), useHotkeys(
3267
3401
  "ctrl+c,command+c",
3268
3402
  () => u(n),
@@ -3271,17 +3405,17 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3271
3405
  ), useHotkeys(
3272
3406
  "ctrl+v,command+v",
3273
3407
  () => {
3274
- m(n[0]) && g(n);
3408
+ g(n[0]) && m(n);
3275
3409
  },
3276
3410
  { ...h, enabled: !isEmpty(n), preventDefault: !0 },
3277
- [n, m, g]
3411
+ [n, g, m]
3278
3412
  ), useHotkeys("esc", () => r([]), h, [r]), useHotkeys("ctrl+d,command+d", () => i(n), { ...h, enabled: !isEmpty(n), preventDefault: !0 }, [
3279
3413
  n,
3280
3414
  i
3281
3415
  ]), useHotkeys(
3282
3416
  "del, backspace",
3283
- (f) => {
3284
- f.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
3417
+ (x) => {
3418
+ x.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
3285
3419
  },
3286
3420
  h,
3287
3421
  [n, l]
@@ -3291,7 +3425,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3291
3425
  return useKeyEventWatcher(o), null;
3292
3426
  }, AddBlockAtBottom = () => {
3293
3427
  const { t: o } = useTranslation(), { hasPermission: n } = usePermissions();
3294
- return n(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer py-2", children: [
3428
+ return n(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs("div", { id: "add-block-bottom", className: "group relative w-full cursor-pointer py-2", children: [
3295
3429
  /* @__PURE__ */ jsx("br", {}),
3296
3430
  /* @__PURE__ */ jsx(
3297
3431
  "div",
@@ -3306,6 +3440,9 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3306
3440
  ] })
3307
3441
  }
3308
3442
  ),
3443
+ /* @__PURE__ */ jsx("br", {}),
3444
+ /* @__PURE__ */ jsx("br", {}),
3445
+ /* @__PURE__ */ jsx("br", {}),
3309
3446
  /* @__PURE__ */ jsx("br", {})
3310
3447
  ] }) : null;
3311
3448
  }, CssThemeVariables = ({ theme: o }) => {
@@ -3482,28 +3619,28 @@ const RteDropdownMenu = ({
3482
3619
  from: a,
3483
3620
  menuRef: l
3484
3621
  }) => {
3485
- const { document: i } = useFrame(), [c, d] = useState({ left: void 0, right: void 0, top: void 0, bottom: void 0 }), [p, u] = useState(!1), m = useRef(null);
3622
+ const { document: i } = useFrame(), [c, d] = useState({ left: void 0, right: void 0, top: void 0, bottom: void 0 }), [p, u] = useState(!1), g = useRef(null);
3486
3623
  if (useEffect(() => {
3487
- var S, v;
3624
+ var C, v;
3488
3625
  if (!p) {
3489
3626
  d({ left: void 0, right: void 0, top: void 0, bottom: void 0 });
3490
3627
  return;
3491
3628
  }
3492
- const g = (S = m.current) == null ? void 0 : S.getBoundingClientRect(), h = (v = l.current) == null ? void 0 : v.getBoundingClientRect();
3493
- let f = g == null ? void 0 : g.left, x = (g == null ? void 0 : g.bottom) + 4, b, y;
3494
- (h == null ? void 0 : h.left) + (h == null ? void 0 : h.width) + 50 >= i.body.offsetWidth && (f = void 0, b = i.body.offsetWidth - (g == null ? void 0 : g.right)), x + 202 >= i.body.clientHeight && (x = null, y = i.body.clientHeight - (g == null ? void 0 : g.bottom) + (h == null ? void 0 : h.height)), d({ left: f, top: x, right: b, bottom: y });
3629
+ const m = (C = g.current) == null ? void 0 : C.getBoundingClientRect(), h = (v = l.current) == null ? void 0 : v.getBoundingClientRect();
3630
+ let x = m == null ? void 0 : m.left, f = (m == null ? void 0 : m.bottom) + 4, b, y;
3631
+ (h == null ? void 0 : h.left) + (h == null ? void 0 : h.width) + 50 >= i.body.offsetWidth && (x = void 0, b = i.body.offsetWidth - (m == null ? void 0 : m.right)), f + 202 >= i.body.clientHeight && (f = null, y = i.body.clientHeight - (m == null ? void 0 : m.bottom) + (h == null ? void 0 : h.height)), d({ left: x, top: f, right: b, bottom: y });
3495
3632
  }, [p]), a === "canvas") {
3496
- const g = () => {
3633
+ const m = () => {
3497
3634
  u(!1), o && (o == null || o.view.focus(), o == null || o.chain().focus().run());
3498
3635
  };
3499
3636
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3500
- /* @__PURE__ */ jsx("div", { ref: m, onClick: () => u((h) => !h), className: "cursor-pointer", children: n }),
3637
+ /* @__PURE__ */ jsx("div", { ref: g, onClick: () => u((h) => !h), className: "cursor-pointer", children: n }),
3501
3638
  p && (c.left !== void 0 || c.top !== void 0 || c.right !== void 0 || c.bottom !== void 0) && createPortal(
3502
3639
  /* @__PURE__ */ jsx(
3503
3640
  "div",
3504
3641
  {
3505
3642
  id: "chaibuilder-rte-dropdown-menu-content",
3506
- onClick: g,
3643
+ onClick: m,
3507
3644
  className: "fixed inset-0 left-0 top-0 z-[10001] h-full w-screen",
3508
3645
  children: /* @__PURE__ */ jsx(
3509
3646
  "div",
@@ -3514,7 +3651,7 @@ const RteDropdownMenu = ({
3514
3651
  {},
3515
3652
  { left: c.left, top: c.top, right: c.right, bottom: c.bottom }
3516
3653
  ),
3517
- children: typeof r == "function" ? r(g) : r
3654
+ children: typeof r == "function" ? r(m) : r
3518
3655
  }
3519
3656
  )
3520
3657
  }
@@ -3525,7 +3662,7 @@ const RteDropdownMenu = ({
3525
3662
  ] });
3526
3663
  }
3527
3664
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(DropdownMenu, { open: p, onOpenChange: u, children: [
3528
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { className: "relative outline-none", children: n }),
3665
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { className: "relative outline-none", asChild: !0, children: n }),
3529
3666
  /* @__PURE__ */ jsx(DropdownMenuContent, { className: "z-50 rounded-md border bg-white p-1 text-xs shadow-xl", children: p && (typeof r == "function" ? r(() => u(!1)) : r) })
3530
3667
  ] }) });
3531
3668
  };
@@ -3598,13 +3735,13 @@ const getActiveClasses$1 = (o, n, r) => {
3598
3735
  onRemoveHighlightColor: i,
3599
3736
  onClose: c
3600
3737
  }) => {
3601
- const [d] = useDarkMode(), [p] = useAtom$1(lsThemeAtom), u = (p == null ? void 0 : p.colors) || {}, m = Object.values(u).map((f) => get(f, d ? "1" : "0")), [g, h] = useState("TEXT");
3738
+ const [d] = useDarkMode(), [p] = useAtom$1(lsThemeAtom), u = (p == null ? void 0 : p.colors) || {}, g = Object.values(u).map((x) => get(x, d ? "1" : "0")), [m, h] = useState("TEXT");
3602
3739
  return /* @__PURE__ */ jsxs("div", { id: "rte-widget-color-picker", className: "px-1", children: [
3603
3740
  /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between rounded-md border bg-muted", children: [
3604
3741
  /* @__PURE__ */ jsx(
3605
3742
  "div",
3606
3743
  {
3607
- className: `w-full cursor-pointer rounded p-0.5 text-center ${g === "TEXT" ? "bg-blue-500 text-white" : "hover:bg-blue-100 hover:text-blue-500"}`,
3744
+ className: `w-full cursor-pointer rounded p-0.5 text-center ${m === "TEXT" ? "bg-blue-500 text-white" : "hover:bg-blue-100 hover:text-blue-500"}`,
3608
3745
  onClick: () => h("TEXT"),
3609
3746
  children: "Text Color"
3610
3747
  }
@@ -3612,16 +3749,16 @@ const getActiveClasses$1 = (o, n, r) => {
3612
3749
  /* @__PURE__ */ jsx(
3613
3750
  "div",
3614
3751
  {
3615
- className: `w-full cursor-pointer rounded p-0.5 text-center ${g === "HIGHLIGHT" ? "bg-blue-500 text-white" : "hover:bg-blue-100 hover:text-blue-500"}`,
3752
+ className: `w-full cursor-pointer rounded p-0.5 text-center ${m === "HIGHLIGHT" ? "bg-blue-500 text-white" : "hover:bg-blue-100 hover:text-blue-500"}`,
3616
3753
  onClick: () => h("HIGHLIGHT"),
3617
3754
  children: "Highlight Color"
3618
3755
  }
3619
3756
  )
3620
3757
  ] }),
3621
- g === "TEXT" ? /* @__PURE__ */ jsx(
3758
+ m === "TEXT" ? /* @__PURE__ */ jsx(
3622
3759
  Commons,
3623
3760
  {
3624
- themeColors: m,
3761
+ themeColors: g,
3625
3762
  onClose: c,
3626
3763
  onChange: r,
3627
3764
  color: o,
@@ -3630,7 +3767,7 @@ const getActiveClasses$1 = (o, n, r) => {
3630
3767
  ) : /* @__PURE__ */ jsx(
3631
3768
  Commons,
3632
3769
  {
3633
- themeColors: m,
3770
+ themeColors: g,
3634
3771
  onClose: c,
3635
3772
  onChange: a,
3636
3773
  color: n,
@@ -3639,11 +3776,11 @@ const getActiveClasses$1 = (o, n, r) => {
3639
3776
  )
3640
3777
  ] });
3641
3778
  }, RteColorPicker = ({ editor: o, from: n, menuRef: r }) => {
3642
- var v, B;
3643
- const a = (v = o == null ? void 0 : o.getAttributes("textStyle")) == null ? void 0 : v.color, l = (B = o == null ? void 0 : o.getAttributes("highlight")) == null ? void 0 : B.color, [i, c] = useState(a || "#000000F2"), [d, p] = useState(l || "#00000057"), [u, m] = useDebouncedState(i, 150), [g, h] = useDebouncedState(d, 150), f = (_, j) => {
3644
- j ? (c(_), m(_)) : (o == null || o.chain().setColor(_).run(), c(_));
3645
- }, x = (_, j) => {
3646
- j ? (p(_), h(_)) : (o == null || o.chain().setHighlight({ color: _ }).run(), p(_));
3779
+ var v, j;
3780
+ const a = (v = o == null ? void 0 : o.getAttributes("textStyle")) == null ? void 0 : v.color, l = (j = o == null ? void 0 : o.getAttributes("highlight")) == null ? void 0 : j.color, [i, c] = useState(a || "#000000F2"), [d, p] = useState(l || "#00000057"), [u, g] = useDebouncedState(i, 150), [m, h] = useDebouncedState(d, 150), x = (_, B) => {
3781
+ B ? (c(_), g(_)) : (o == null || o.chain().setColor(_).run(), c(_));
3782
+ }, f = (_, B) => {
3783
+ B ? (p(_), h(_)) : (o == null || o.chain().setHighlight({ color: _ }).run(), p(_));
3647
3784
  }, b = () => {
3648
3785
  o == null || o.chain().unsetColor().run(), c("#000000F2");
3649
3786
  }, y = () => {
@@ -3652,8 +3789,8 @@ const getActiveClasses$1 = (o, n, r) => {
3652
3789
  return useEffect(() => {
3653
3790
  l && p(l);
3654
3791
  }, [l]), useEffect(() => {
3655
- g != null && g.includes("#") && (g == null ? void 0 : g.length) >= 3 && (o == null || o.chain().setHighlight({ color: g }).run());
3656
- }, [g]), useEffect(() => {
3792
+ m != null && m.includes("#") && (m == null ? void 0 : m.length) >= 3 && (o == null || o.chain().setHighlight({ color: m }).run());
3793
+ }, [m]), useEffect(() => {
3657
3794
  u != null && u.includes("#") && (u == null ? void 0 : u.length) >= 3 && (o == null || o.chain().setColor(u).run());
3658
3795
  }, [u]), /* @__PURE__ */ jsx(
3659
3796
  RteDropdownMenu,
@@ -3678,8 +3815,8 @@ const getActiveClasses$1 = (o, n, r) => {
3678
3815
  {
3679
3816
  textColor: i,
3680
3817
  highlightColor: d,
3681
- onChangeTextColor: f,
3682
- onChangeHighlightColor: x,
3818
+ onChangeTextColor: x,
3819
+ onChangeHighlightColor: f,
3683
3820
  onRemoveTextColor: b,
3684
3821
  onRemoveHighlightColor: y,
3685
3822
  onClose: _
@@ -3950,30 +4087,30 @@ const RichTextEditor = memo(
3950
4087
  blockId: "active-inline-editing-element",
3951
4088
  placeholder: "Enter text here",
3952
4089
  onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
3953
- onBlur: ({ editor: u, event: m }) => {
3954
- const g = m == null ? void 0 : m.relatedTarget, h = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = i.querySelector("#chai-rich-text-menu-bar"), b = h == null ? void 0 : h.contains(g), y = f == null ? void 0 : f.contains(g), S = x == null ? void 0 : x.contains(g), v = window.document.getElementById("rte-widget-color-picker");
3955
- if (!b && !y && !S && !v) {
3956
- const B = (u == null ? void 0 : u.getHTML()) || "";
3957
- r(B);
4090
+ onBlur: ({ editor: u, event: g }) => {
4091
+ const m = g == null ? void 0 : g.relatedTarget, h = i.querySelector(".ProseMirror"), x = i.querySelector(".tippy-box"), f = i.querySelector("#chai-rich-text-menu-bar"), b = h == null ? void 0 : h.contains(m), y = x == null ? void 0 : x.contains(m), C = f == null ? void 0 : f.contains(m), v = window.document.getElementById("rte-widget-color-picker");
4092
+ if (!b && !y && !C && !v) {
4093
+ const j = (u == null ? void 0 : u.getHTML()) || "";
4094
+ r(j);
3958
4095
  }
3959
4096
  },
3960
4097
  from: "canvas"
3961
4098
  });
3962
4099
  useEffect(() => {
3963
- var m, g;
4100
+ var g, m;
3964
4101
  const u = getInitialTextAlign(n);
3965
- u && ((m = c == null ? void 0 : c.commands) == null || m.setTextAlign(u)), (g = c == null ? void 0 : c.commands) == null || g.focus(), c == null || c.emit("focus", {
4102
+ u && ((g = c == null ? void 0 : c.commands) == null || g.setTextAlign(u)), (m = c == null ? void 0 : c.commands) == null || m.focus(), c == null || c.emit("focus", {
3966
4103
  editor: c,
3967
4104
  event: new FocusEvent("focus"),
3968
4105
  transaction: []
3969
4106
  });
3970
4107
  }, [c]);
3971
4108
  const d = useMemo(() => {
3972
- var g;
4109
+ var m;
3973
4110
  const u = "max-w-none shadow-none outline outline-[2px] outline-green-500 [&_*]:shadow-none";
3974
4111
  if (!n) return u;
3975
- const m = ((g = n == null ? void 0 : n.className) == null ? void 0 : g.replace("sr-only", "")) || "";
3976
- return `${u} ${m}`;
4112
+ const g = ((m = n == null ? void 0 : n.className) == null ? void 0 : m.replace("sr-only", "")) || "";
4113
+ return `${u} ${g}`;
3977
4114
  }, [n]), p = (u) => {
3978
4115
  u.key === "Escape" && l(u);
3979
4116
  };
@@ -4004,74 +4141,74 @@ const RichTextEditor = memo(
4004
4141
  useEffect(() => {
4005
4142
  if (a.current) {
4006
4143
  a.current.innerHTML = n, a.current.focus();
4007
- const h = c.createRange(), f = d.getSelection();
4008
- h.selectNodeContents(a.current), h.collapse(!1), f == null || f.removeAllRanges(), f == null || f.addRange(h), a.current.focus();
4144
+ const h = c.createRange(), x = d.getSelection();
4145
+ h.selectNodeContents(a.current), h.collapse(!1), x == null || x.removeAllRanges(), x == null || x.addRange(h), a.current.focus();
4009
4146
  } else
4010
4147
  r();
4011
4148
  }, [c, d]);
4012
4149
  const p = useMemo(() => {
4013
- var f;
4014
- const h = ((f = o == null ? void 0 : o.tagName) == null ? void 0 : f.toLowerCase()) || "div";
4150
+ var x;
4151
+ const h = ((x = o == null ? void 0 : o.tagName) == null ? void 0 : x.toLowerCase()) || "div";
4015
4152
  return h === "button" ? "div" : h;
4016
4153
  }, [o]), u = useCallback(
4017
4154
  (h) => {
4018
4155
  (h.key === "Enter" || h.key === "Escape") && i(h);
4019
4156
  },
4020
4157
  [i]
4021
- ), m = useCallback(() => {
4158
+ ), g = useCallback(() => {
4022
4159
  r();
4023
- }, [r]), g = useMemo(() => {
4160
+ }, [r]), m = useMemo(() => {
4024
4161
  var h;
4025
4162
  return {
4026
4163
  id: "active-inline-editing-element",
4027
4164
  contentEditable: !0,
4028
4165
  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]`,
4029
4166
  style: cloneDeep(o == null ? void 0 : o.style) || {},
4030
- onInput: (f) => {
4031
- const x = f.target;
4032
- x && (x.innerText.trim() === "" ? (x.setAttribute("data-placeholder", "Enter text here"), x.children.length > 0 && x.children[0].remove()) : f.target.removeAttribute("data-placeholder"), l(f.target.innerText));
4167
+ onInput: (x) => {
4168
+ const f = x.target;
4169
+ f && (f.innerText.trim() === "" ? (f.setAttribute("data-placeholder", "Enter text here"), f.children.length > 0 && f.children[0].remove()) : x.target.removeAttribute("data-placeholder"), l(x.target.innerText));
4033
4170
  },
4034
- onClick: (f) => {
4035
- f.stopPropagation(), f.preventDefault();
4171
+ onClick: (x) => {
4172
+ x.stopPropagation(), x.preventDefault();
4036
4173
  }
4037
4174
  };
4038
4175
  }, [o == null ? void 0 : o.className, o == null ? void 0 : o.style]);
4039
4176
  return /* @__PURE__ */ jsx(Fragment, { children: createElement(p, {
4040
4177
  ref: a,
4041
- onBlur: m,
4178
+ onBlur: g,
4042
4179
  onKeyDown: u,
4043
- ...g
4180
+ ...m
4044
4181
  }) });
4045
4182
  }
4046
4183
  ), WithBlockTextEditor = memo(
4047
4184
  ({ block: o, children: n }) => {
4048
- const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), m = useRef(null), { clearHighlight: g } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), b = useRef(null), y = l, { blockContent: S, blockType: v } = useMemo(() => {
4185
+ 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(), b = useRef(null), y = l, { blockContent: C, blockType: v } = useMemo(() => {
4049
4186
  var E;
4050
4187
  const k = o._type;
4051
4188
  let I = o[r];
4052
4189
  const A = getRegisteredChaiBlock(o._type);
4053
- return f && ((E = A == null ? void 0 : A.i18nProps) == null ? void 0 : E.includes(r)) && has(o, `${r}-${f}`) && (I = get(o, `${r}-${f}`)), { blockContent: I, blockType: k };
4054
- }, [o, f]), B = useCallback(
4190
+ return x && ((E = A == null ? void 0 : A.i18nProps) == null ? void 0 : E.includes(r)) && has(o, `${r}-${x}`) && (I = get(o, `${r}-${x}`)), { blockContent: I, blockType: k };
4191
+ }, [o, x]), j = useCallback(
4055
4192
  (k) => {
4056
4193
  var A;
4057
- const I = k || ((A = m.current) == null ? void 0 : A.innerText);
4058
- h([y], { [r]: I }), u(null), c(null), d(-1), x([]), y && setTimeout(() => x([y]), 100);
4194
+ const I = k || ((A = g.current) == null ? void 0 : A.innerText);
4195
+ h([y], { [r]: I }), u(null), c(null), d(-1), f([]), y && setTimeout(() => f([y]), 100);
4059
4196
  },
4060
- [y, h, c, x, f]
4197
+ [y, h, c, f, x]
4061
4198
  ), _ = useDebouncedCallback(
4062
4199
  (k) => {
4063
4200
  h([y], { [r]: k });
4064
4201
  },
4065
- [y, o, h, f],
4202
+ [y, o, h, x],
4066
4203
  1e3
4067
- ), j = useCallback(
4204
+ ), B = useCallback(
4068
4205
  (k) => {
4069
- k.preventDefault(), y && (b.current = y), B(), setTimeout(() => {
4206
+ k.preventDefault(), y && (b.current = y), j(), setTimeout(() => {
4070
4207
  const I = b.current;
4071
- b.current = null, x([I]);
4208
+ b.current = null, f([I]);
4072
4209
  }, 100);
4073
4210
  },
4074
- [x, y, f]
4211
+ [f, y, x]
4075
4212
  );
4076
4213
  useEffect(() => {
4077
4214
  var w;
@@ -4079,28 +4216,28 @@ const RichTextEditor = memo(
4079
4216
  const k = `[data-block-id="${y}"]`, I = i >= 0 ? `[data-block-index="${i}"]` : "", A = a.querySelector(`${k}${I}`);
4080
4217
  A && ((w = A == null ? void 0 : A.classList) == null || w.add("sr-only"), u(A));
4081
4218
  }, [y, v, a, i]);
4082
- const C = useMemo(() => p ? (g(), ["RichText", "Paragraph"].includes(v) ? /* @__PURE__ */ jsx(
4219
+ const S = useMemo(() => p ? (m(), ["RichText", "Paragraph"].includes(v) ? /* @__PURE__ */ jsx(
4083
4220
  RichTextEditor,
4084
4221
  {
4085
- blockContent: S,
4222
+ blockContent: C,
4086
4223
  editingElement: p,
4087
4224
  onChange: _,
4088
- onClose: B,
4089
- onEscape: j
4225
+ onClose: j,
4226
+ onEscape: B
4090
4227
  }
4091
4228
  ) : /* @__PURE__ */ jsx(
4092
4229
  MemoizedEditor,
4093
4230
  {
4094
- editorRef: m,
4095
- blockContent: S,
4231
+ editorRef: g,
4232
+ blockContent: C,
4096
4233
  editingElement: p,
4097
- onClose: B,
4234
+ onClose: j,
4098
4235
  onChange: _,
4099
- onEscape: j
4236
+ onEscape: B
4100
4237
  }
4101
- )) : null, [p, y, v, S, B, f]);
4238
+ )) : null, [p, y, v, C, j, x]);
4102
4239
  return /* @__PURE__ */ jsxs(Fragment, { children: [
4103
- C,
4240
+ S,
4104
4241
  n
4105
4242
  ] });
4106
4243
  },
@@ -4133,23 +4270,23 @@ const RichTextEditor = memo(
4133
4270
  blockAtom: n,
4134
4271
  children: r
4135
4272
  }) => {
4136
- const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), m = usePageExternalData(), [g] = useAtom$1(dataBindingActiveAtom), h = get(c, "component", null), { index: f, key: x } = useContext(RepeaterContext), b = useMemo(
4137
- () => g ? applyBindingToBlockProps(applyLanguage(i, d, c), m, {
4138
- index: f,
4139
- key: x
4273
+ 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] = useAtom$1(dataBindingActiveAtom), h = get(c, "component", null), { index: x, key: f } = useContext(RepeaterContext), b = useMemo(
4274
+ () => m ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
4275
+ index: x,
4276
+ key: f
4140
4277
  }) : applyLanguage(i, d, c),
4141
- [i, d, c, m, g, f, x]
4142
- ), y = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), S = useMemo(
4278
+ [i, d, c, g, m, x, f]
4279
+ ), y = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), C = useMemo(
4143
4280
  () => u(i._id, getBlockRuntimeProps(i._type)),
4144
4281
  [i._id, i._type, u, getBlockRuntimeProps]
4145
4282
  ), v = useMemo(
4146
4283
  () => ({
4147
- blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": f },
4284
+ blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": x },
4148
4285
  inBuilder: !0,
4149
4286
  lang: d || p,
4150
4287
  ...b,
4151
4288
  ...y,
4152
- ...S,
4289
+ ...C,
4153
4290
  ...o
4154
4291
  }),
4155
4292
  [
@@ -4159,12 +4296,12 @@ const RichTextEditor = memo(
4159
4296
  p,
4160
4297
  b,
4161
4298
  y,
4162
- S,
4299
+ C,
4163
4300
  o
4164
4301
  ]
4165
- ), B = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]), _ = useMemo(() => get(i, "_show", !0), [i]);
4302
+ ), j = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]), _ = useMemo(() => get(i, "_show", !0), [i]);
4166
4303
  if (isNull(h) || !_) return null;
4167
- let j = /* @__PURE__ */ jsx(Suspense, { children: createElement(h, {
4304
+ let B = /* @__PURE__ */ jsx(Suspense, { children: createElement(h, {
4168
4305
  ...v,
4169
4306
  children: r({
4170
4307
  _id: i._id,
@@ -4177,8 +4314,8 @@ const RichTextEditor = memo(
4177
4314
  ...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
4178
4315
  })
4179
4316
  }) });
4180
- const C = a === i._id && (l === f || f < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: j }) : j;
4181
- return B ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: C }) : C;
4317
+ const S = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: B }) : B;
4318
+ return j ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: S }) : S;
4182
4319
  }, PartialWrapper$1 = ({ children: o, partialBlockId: n }) => {
4183
4320
  const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
4184
4321
  (d) => {
@@ -4221,7 +4358,7 @@ const RichTextEditor = memo(
4221
4358
  );
4222
4359
  return c && (a === "Heading" || a === "Paragraph" || a === "Link") && (i = adjustSpacingInContentBlocks(i)), map(i, (d) => {
4223
4360
  const p = l(d._id);
4224
- return p ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: d, children: (u) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: p, asyncProps: u, children: ({ _id: m, _type: g, partialBlockId: h, repeaterItems: f, $repeaterItemsKey: x }) => g === "Repeater" ? isArray(f) && f.map((b, y) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: y, key: x }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: d._id, type: g }) }, `${m}-${y}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: h }) }) : c(m) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: d._id, type: g }) : null }) }, d._id) : null;
4361
+ return p ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: d, children: (u) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: p, asyncProps: u, children: ({ _id: g, _type: m, partialBlockId: h, repeaterItems: x, $repeaterItemsKey: f }) => m === "Repeater" ? isArray(x) && x.map((b, y) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: y, key: f }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: d._id, type: m }) }, `${g}-${y}`)) : m === "GlobalBlock" || m === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: h }) }) : c(g) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: d._id, type: m }) : null }) }, d._id) : null;
4225
4362
  });
4226
4363
  }, PageBlocksRenderer = () => {
4227
4364
  const [o] = useBlocksStore();
@@ -4234,18 +4371,18 @@ const RichTextEditor = memo(
4234
4371
  const { width: d, height: p } = o;
4235
4372
  if (d < n) {
4236
4373
  const u = parseFloat((d / n).toFixed(2).toString());
4237
- let m = {};
4238
- const g = p * u, h = d * u;
4239
- p && (m = {
4374
+ let g = {};
4375
+ const m = p * u, h = d * u;
4376
+ p && (g = {
4240
4377
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
4241
- height: 100 + (p - g) / g * 100 + "%",
4378
+ height: 100 + (p - m) / m * 100 + "%",
4242
4379
  width: 100 + (d - h) / h * 100 + "%"
4243
4380
  }), i({
4244
4381
  position: "relative",
4245
4382
  top: 0,
4246
4383
  transform: `scale(${u})`,
4247
4384
  transformOrigin: a === "rtl" ? "top right" : "top left",
4248
- ...m,
4385
+ ...g,
4249
4386
  maxWidth: "none"
4250
4387
  // TODO: Add max-width to the wrapper
4251
4388
  }), r(u * 100);
@@ -4272,8 +4409,8 @@ const CanvasEventsWatcher = () => {
4272
4409
  if (d) {
4273
4410
  const p = d.getAttribute("data-style-prop");
4274
4411
  if (p) {
4275
- const u = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
4276
- r([{ id: u, prop: p, blockId: m }]);
4412
+ const u = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
4413
+ r([{ id: u, prop: p, blockId: g }]);
4277
4414
  }
4278
4415
  }
4279
4416
  }, 100);
@@ -4281,28 +4418,28 @@ const CanvasEventsWatcher = () => {
4281
4418
  d && (!isEmpty(d) && !includes(i, first(d)) && (c == null || c.closeAll()), o(d));
4282
4419
  }), usePubSub(CHAI_BUILDER_EVENTS.CANVAS_BLOCK_STYLE_SELECTED, (d) => {
4283
4420
  if (!d) return;
4284
- const { blockId: p, styleId: u, styleProp: m } = d;
4285
- p && (includes(i, p) || c == null || c.closeAll(), r([{ id: u, prop: m, blockId: p }]), o([p]));
4421
+ const { blockId: p, styleId: u, styleProp: g } = d;
4422
+ p && (includes(i, p) || c == null || c.closeAll(), r([{ id: u, prop: g, blockId: p }]), o([p]));
4286
4423
  }), usePubSub(CHAI_BUILDER_EVENTS.CLEAR_CANVAS_SELECTION, () => {
4287
4424
  l(), o([]), r([]);
4288
4425
  }), null;
4289
4426
  }, StaticCanvas = () => {
4290
- 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"), m = useCallback(
4427
+ const [o] = useCanvasDisplayWidth(), [, n] = useHighlightBlockId(), r = useRef(null), a = useRef(null), [l, i] = useState({ width: 0, height: 0 }), c = useCanvasScale(l), [, d] = useCanvasIframe(), p = useBuilderProp("loading", !1), u = useBuilderProp("htmlDir", "ltr"), g = useCallback(
4291
4428
  (h) => {
4292
- i((f) => ({ ...f, width: h }));
4429
+ i((x) => ({ ...x, width: h }));
4293
4430
  },
4294
4431
  [i]
4295
4432
  );
4296
4433
  useEffect(() => {
4297
4434
  if (!a.current) return;
4298
- const { clientWidth: h, clientHeight: f } = a.current;
4299
- i({ width: h, height: f });
4435
+ const { clientWidth: h, clientHeight: x } = a.current;
4436
+ i({ width: h, height: x });
4300
4437
  }, [a, o]);
4301
- const g = useMemo(() => {
4438
+ const m = useMemo(() => {
4302
4439
  let h = IframeInitialContent;
4303
4440
  return h = h.replace("__HTML_DIR__", u), h;
4304
4441
  }, [u]);
4305
- return /* @__PURE__ */ jsx(ResizableCanvasWrapper, { onMount: m, onResize: m, children: /* @__PURE__ */ jsx(
4442
+ return /* @__PURE__ */ jsx(ResizableCanvasWrapper, { onMount: g, onResize: g, children: /* @__PURE__ */ jsx(
4306
4443
  "div",
4307
4444
  {
4308
4445
  onMouseLeave: () => setTimeout(() => n(""), 300),
@@ -4316,7 +4453,7 @@ const CanvasEventsWatcher = () => {
4316
4453
  id: "canvas-iframe",
4317
4454
  style: { ...c, ...isEmpty(c) ? { width: `${o}px` } : {} },
4318
4455
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
4319
- initialContent: g,
4456
+ initialContent: m,
4320
4457
  children: [
4321
4458
  /* @__PURE__ */ jsx(KeyboardHandler, {}),
4322
4459
  /* @__PURE__ */ jsx(BlockSelectionHighlighter, {}),
@@ -4324,10 +4461,7 @@ const CanvasEventsWatcher = () => {
4324
4461
  /* @__PURE__ */ jsxs(Provider$1, { children: [
4325
4462
  /* @__PURE__ */ jsxs(Canvas, { children: [
4326
4463
  p ? /* @__PURE__ */ jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsx(StaticBlocksRenderer, {}),
4327
- /* @__PURE__ */ jsx(AddBlockAtBottom, {}),
4328
- /* @__PURE__ */ jsx("br", {}),
4329
- /* @__PURE__ */ jsx("br", {}),
4330
- /* @__PURE__ */ jsx("br", {})
4464
+ /* @__PURE__ */ jsx(AddBlockAtBottom, {})
4331
4465
  ] }),
4332
4466
  /* @__PURE__ */ jsx(CanvasEventsWatcher, {})
4333
4467
  ] }),
@@ -4349,7 +4483,7 @@ const CanvasEventsWatcher = () => {
4349
4483
  /* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
4350
4484
  /* @__PURE__ */ jsx("p", { children: o("Please try again.") })
4351
4485
  ] }) });
4352
- }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-DlWYye4v.js")), CanvasArea = () => {
4486
+ }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-DHjchara.js")), CanvasArea = () => {
4353
4487
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
4354
4488
  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", children: [
4355
4489
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
@@ -4418,15 +4552,15 @@ const CanvasEventsWatcher = () => {
4418
4552
  ] })
4419
4553
  ] });
4420
4554
  }, DefaultMediaManager = ({ close: o, onSelect: n, mode: r = "image" }) => {
4421
- const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, m] = useState(null), g = async (f) => {
4422
- if (!f.trim()) {
4423
- p(!1), m("Please enter a URL");
4555
+ const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), m = async (x) => {
4556
+ if (!x.trim()) {
4557
+ p(!1), g("Please enter a URL");
4424
4558
  return;
4425
4559
  }
4426
4560
  try {
4427
- c(!0), m(null), p(!0), m(null);
4561
+ c(!0), g(null), p(!0), g(null);
4428
4562
  } catch {
4429
- p(!1), m("Error validating URL");
4563
+ p(!1), g("Error validating URL");
4430
4564
  } finally {
4431
4565
  c(!1);
4432
4566
  }
@@ -4443,8 +4577,8 @@ const CanvasEventsWatcher = () => {
4443
4577
  {
4444
4578
  placeholder: h(`Enter ${r} URL`),
4445
4579
  value: a,
4446
- onChange: (f) => l(f.target.value),
4447
- onKeyUp: () => g(a)
4580
+ onChange: (x) => l(x.target.value),
4581
+ onKeyUp: () => m(a)
4448
4582
  }
4449
4583
  ),
4450
4584
  /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
@@ -4488,42 +4622,42 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
4488
4622
  const n = ((l = o.split("/").pop()) == null ? void 0 : l.split("?")[0]) || "";
4489
4623
  return [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".ico", ".avif"].some((i) => n.toLowerCase().endsWith(i)) ? n : "";
4490
4624
  }, ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
4491
- const { t: l } = useTranslation(), { selectedLang: i } = useLanguages(), c = useSelectedBlock(), d = useUpdateBlocksProps(), p = usePageExternalData(), u = r.split(".").pop() || "", m = i ? `_${u}Id-${i}` : `_${u}Id`, g = isEmpty(i) && (c == null ? void 0 : c._type) === "Image" && has(c, "assetId"), h = get(c, m, g ? c == null ? void 0 : c.assetId : ""), f = useMemo(() => {
4625
+ const { t: l } = useTranslation(), { selectedLang: i } = useLanguages(), c = useSelectedBlock(), d = useUpdateBlocksProps(), p = usePageExternalData(), u = r.split(".").pop() || "", g = i ? `_${u}Id-${i}` : `_${u}Id`, m = isEmpty(i) && (c == null ? void 0 : c._type) === "Image" && has(c, "assetId"), h = get(c, g, m ? c == null ? void 0 : c.assetId : ""), x = useMemo(() => {
4492
4626
  if (!o || !c || !/\{\{.*?\}\}/.test(o)) return o;
4493
- const B = { ...c, [u]: o }, _ = applyBindingToBlockProps(B, p, { index: -1, key: "" });
4627
+ const j = { ...c, [u]: o }, _ = applyBindingToBlockProps(j, p, { index: -1, key: "" });
4494
4628
  return get(_, u, o);
4495
- }, [o, c, p, u]), x = !!h || f !== PLACEHOLDER_IMAGE, b = (v) => {
4496
- const B = isArray(v) ? first(v) : v;
4497
- if (B) {
4498
- n(B == null ? void 0 : B.url);
4499
- const _ = B == null ? void 0 : B.width, j = B == null ? void 0 : B.height, C = m.includes("mobile");
4629
+ }, [o, c, p, u]), f = !!h || x !== PLACEHOLDER_IMAGE, b = (v) => {
4630
+ const j = isArray(v) ? first(v) : v;
4631
+ if (j) {
4632
+ n(j == null ? void 0 : j.url);
4633
+ const _ = j == null ? void 0 : j.width, B = j == null ? void 0 : j.height, S = g.includes("mobile");
4500
4634
  if (c != null && c._id) {
4501
4635
  const k = {
4502
- ..._ && { [C ? "mobileWidth" : "width"]: _ },
4503
- ...j && { [C ? "mobileHeight" : "height"]: j },
4504
- ...B.description && { alt: B.description }
4636
+ ..._ && { [S ? "mobileWidth" : "width"]: _ },
4637
+ ...B && { [S ? "mobileHeight" : "height"]: B },
4638
+ ...j.description && { alt: j.description }
4505
4639
  };
4506
- if (set(k, m, B.id), isEmpty(k)) return;
4640
+ if (set(k, g, j.id), isEmpty(k)) return;
4507
4641
  d([c._id], k);
4508
4642
  }
4509
4643
  }
4510
4644
  }, y = useCallback(() => {
4511
4645
  if (n(PLACEHOLDER_IMAGE), c != null && c._id) {
4512
- const v = {}, B = m.includes("mobile");
4513
- set(v, m, ""), set(v, B ? "mobileWidth" : "width", ""), set(v, B ? "mobileHeight" : "height", ""), d([c._id], v);
4646
+ const v = {}, j = g.includes("mobile");
4647
+ set(v, g, ""), set(v, j ? "mobileWidth" : "width", ""), set(v, j ? "mobileHeight" : "height", ""), d([c._id], v);
4514
4648
  }
4515
- }, [n, c == null ? void 0 : c._id, d, m]), S = getFileName(f);
4649
+ }, [n, c == null ? void 0 : c._id, d, g]), C = getFileName(x);
4516
4650
  return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-start gap-x-3", children: [
4517
- f ? /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
4651
+ x ? /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
4518
4652
  /* @__PURE__ */ jsx(
4519
4653
  "img",
4520
4654
  {
4521
- src: f,
4655
+ src: x,
4522
4656
  className: "h-14 w-14 overflow-hidden rounded-md border border-border object-cover transition duration-200 " + (h && h !== "" ? "cursor-pointer group-hover:blur-sm" : ""),
4523
4657
  alt: ""
4524
4658
  }
4525
4659
  ),
4526
- x && /* @__PURE__ */ jsx(
4660
+ f && /* @__PURE__ */ jsx(
4527
4661
  "button",
4528
4662
  {
4529
4663
  type: "button",
@@ -4543,8 +4677,8 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
4543
4677
  ] }) : /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: b, mode: "image", assetId: h, children: /* @__PURE__ */ jsx("div", { className: "h-14 w-14 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
4544
4678
  /* @__PURE__ */ jsxs("div", { className: "flex w-3/5 flex-col", children: [
4545
4679
  /* @__PURE__ */ jsxs(Fragment, { children: [
4546
- /* @__PURE__ */ jsx("p", { className: "max-w-[250px] truncate pr-2 text-xs text-gray-400", children: S }),
4547
- /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: b, assetId: "", children: /* @__PURE__ */ jsx("small", { className: "h-6 mb-1 w-full cursor-pointer rounded-md bg-secondary px-1 py-1 text-center text-xs text-secondary-foreground hover:bg-secondary/80", children: !isEmpty(f) && f !== PLACEHOLDER_IMAGE ? l("Replace image") : l("Choose image") }) }),
4680
+ /* @__PURE__ */ jsx("p", { className: "max-w-[250px] truncate pr-2 text-xs text-gray-400", children: C }),
4681
+ /* @__PURE__ */ jsx(MediaManagerModal, { onSelect: b, assetId: "", children: /* @__PURE__ */ jsx("small", { className: "h-6 mb-1 w-full cursor-pointer rounded-md bg-secondary px-1 py-1 text-center text-xs text-secondary-foreground hover:bg-secondary/80", children: !isEmpty(x) && x !== PLACEHOLDER_IMAGE ? l("Replace image") : l("Choose image") }) }),
4548
4682
  /* @__PURE__ */ jsx("div", { className: "text-center text-xs text-gray-400", children: "OR" })
4549
4683
  ] }),
4550
4684
  /* @__PURE__ */ jsx(
@@ -4565,18 +4699,18 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
4565
4699
  ] })
4566
4700
  ] });
4567
4701
  }, PathDropdown = ({ data: o, onSelect: n, dataType: r }) => {
4568
- const [a, l] = React__default.useState([]), [i, c] = React__default.useState(o), d = (g) => Array.isArray(g) ? "array" : typeof g == "object" && g !== null ? "object" : "value", p = React__default.useCallback(
4569
- (g) => {
4570
- const h = (f) => r === "value" ? f === "value" || f === "object" : r === "array" ? f === "array" : f === r;
4571
- g.type === "object" ? (l((f) => [...f, g.key]), c(g.value)) : h(g.type) && n([...a, g.key].join("."), r);
4702
+ 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(
4703
+ (m) => {
4704
+ const h = (x) => r === "value" ? x === "value" || x === "object" : r === "array" ? x === "array" : x === r;
4705
+ m.type === "object" ? (l((x) => [...x, m.key]), c(m.value)) : h(m.type) && n([...a, m.key].join("."), r);
4572
4706
  },
4573
4707
  [a, n, r]
4574
4708
  ), u = React__default.useCallback(() => {
4575
4709
  if (a.length > 0) {
4576
- const g = a.slice(0, -1);
4577
- l(g), c(g.reduce((h, f) => h[f], o));
4710
+ const m = a.slice(0, -1);
4711
+ l(m), c(m.reduce((h, x) => h[x], o));
4578
4712
  }
4579
- }, [a, o]), m = React__default.useMemo(() => i ? Object.entries(i).map(([g, h]) => ({ key: g, value: h, type: d(h) })).filter((g) => !startsWith(g.key, REPEATER_PREFIX) && g.key.includes("/") ? !1 : r === "value" ? g.type === "value" || g.type === "object" : r === "array" ? g.type === "array" || g.type === "object" : r === "object" ? g.type === "object" : !0) : [], [i, r]);
4713
+ }, [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]);
4580
4714
  return /* @__PURE__ */ jsxs(Command, { className: "fields-command", children: [
4581
4715
  /* @__PURE__ */ jsx(CommandInput, { className: "border-none", placeholder: "Search..." }),
4582
4716
  /* @__PURE__ */ jsxs(CommandList, { children: [
@@ -4586,36 +4720,36 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
4586
4720
  /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "mr-2 h-4 w-4" }),
4587
4721
  t("Back")
4588
4722
  ] }),
4589
- m.map((g) => /* @__PURE__ */ jsxs(
4723
+ g.map((m) => /* @__PURE__ */ jsxs(
4590
4724
  CommandItem,
4591
4725
  {
4592
- value: g.key,
4726
+ value: m.key,
4593
4727
  disabled: !1,
4594
- onSelect: () => p(g),
4728
+ onSelect: () => p(m),
4595
4729
  className: "flex items-center justify-between",
4596
4730
  children: [
4597
4731
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-2", children: [
4598
- startsWith(g.key, REPEATER_PREFIX) ? /* @__PURE__ */ jsx(LoopIcon, {}) : startsWith(g.key, COLLECTION_PREFIX) ? /* @__PURE__ */ jsx(IdCardIcon, {}) : null,
4599
- startsWith(g.key, REPEATER_PREFIX) ? t("Repeater Data") : startsWith(g.key, COLLECTION_PREFIX) ? g.key.replace(COLLECTION_PREFIX, "") : g.key
4732
+ startsWith(m.key, REPEATER_PREFIX) ? /* @__PURE__ */ jsx(LoopIcon, {}) : startsWith(m.key, COLLECTION_PREFIX) ? /* @__PURE__ */ jsx(IdCardIcon, {}) : null,
4733
+ startsWith(m.key, REPEATER_PREFIX) ? t("Repeater Data") : startsWith(m.key, COLLECTION_PREFIX) ? m.key.replace(COLLECTION_PREFIX, "") : m.key
4600
4734
  ] }),
4601
4735
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
4602
- r === "object" && g.type === "object" && /* @__PURE__ */ jsx(
4736
+ r === "object" && m.type === "object" && /* @__PURE__ */ jsx(
4603
4737
  Button,
4604
4738
  {
4605
4739
  size: "sm",
4606
4740
  variant: "ghost",
4607
4741
  className: "h-6 px-2 hover:bg-primary hover:text-primary-foreground",
4608
4742
  onClick: (h) => {
4609
- h.stopPropagation(), n([...a, g.key].join("."), r);
4743
+ h.stopPropagation(), n([...a, m.key].join("."), r);
4610
4744
  },
4611
4745
  children: t("Select")
4612
4746
  }
4613
4747
  ),
4614
- g.type === "object" && /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 opacity-50" }) })
4748
+ m.type === "object" && /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 opacity-50" }) })
4615
4749
  ] })
4616
4750
  ]
4617
4751
  },
4618
- g.key
4752
+ m.key
4619
4753
  ))
4620
4754
  ] })
4621
4755
  ] })
@@ -4667,51 +4801,51 @@ const DataBindingSelector = ({
4667
4801
  }) => {
4668
4802
  const l = usePageExternalData(), i = useSelectedBlockHierarchy(), c = useSelectedBlock(), d = useMemo(() => {
4669
4803
  if (i.length === 1) return "";
4670
- const m = i.find((f) => f._type === "Repeater"), h = get(m, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4671
- return `${REPEATER_PREFIX}${startsWith(h, COLLECTION_PREFIX) ? `${h}/${m._id}` : h}`;
4804
+ const g = i.find((x) => x._type === "Repeater"), h = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4805
+ return `${REPEATER_PREFIX}${startsWith(h, COLLECTION_PREFIX) ? `${h}/${g._id}` : h}`;
4672
4806
  }, [i]), p = useMemo(() => first(get(l, d.replace(REPEATER_PREFIX, ""), [])), [d, l]), u = useCallback(
4673
- (m, g) => {
4674
- if (m = isEmpty(d) ? m : m.replace(`${d}`, "$index"), g === "array" || g === "object") {
4675
- n(`{{${m}}}`, {}, r);
4807
+ (g, m) => {
4808
+ if (g = isEmpty(d) ? g : g.replace(`${d}`, "$index"), m === "array" || m === "object") {
4809
+ n(`{{${g}}}`, {}, r);
4676
4810
  return;
4677
4811
  }
4678
- const h = (y) => /[.,!?;:]/.test(y), f = (y, S, v) => {
4679
- let B = "", _ = "";
4680
- const j = S > 0 ? y[S - 1] : "", C = S < y.length ? y[S] : "";
4681
- return S > 0 && (j === "." || !h(j) && j !== " ") && (B = " "), S < y.length && !h(C) && C !== " " && (_ = " "), {
4682
- text: B + v + _,
4683
- prefixLength: B.length,
4812
+ const h = (y) => /[.,!?;:]/.test(y), x = (y, C, v) => {
4813
+ let j = "", _ = "";
4814
+ const B = C > 0 ? y[C - 1] : "", S = C < y.length ? y[C] : "";
4815
+ return C > 0 && (B === "." || !h(B) && B !== " ") && (j = " "), C < y.length && !h(S) && S !== " " && (_ = " "), {
4816
+ text: j + v + _,
4817
+ prefixLength: j.length,
4684
4818
  suffixLength: _.length
4685
4819
  };
4686
- }, x = document.getElementById(r);
4687
- if (!x) return;
4820
+ }, f = document.getElementById(r);
4821
+ if (!f) return;
4688
4822
  const b = document.getElementById(`chai-rte-${r}`) || document.getElementById(`chai-rte-modal-${r}`);
4689
4823
  if (b && (b.querySelector(".ProseMirror") || b.__chaiRTE)) {
4690
4824
  const y = b.__chaiRTE;
4691
4825
  if (y) {
4692
- const S = `{{${m}}}`;
4826
+ const C = `{{${g}}}`;
4693
4827
  y.commands.focus();
4694
- const { from: v, to: B } = y.state.selection;
4695
- if (v !== B)
4696
- y.chain().deleteSelection().insertContent(S).run();
4828
+ const { from: v, to: j } = y.state.selection;
4829
+ if (v !== j)
4830
+ y.chain().deleteSelection().insertContent(C).run();
4697
4831
  else {
4698
- const { state: j } = y, C = j.selection.from, k = j.doc.textBetween(Math.max(0, C - 1), C), I = j.doc.textBetween(C, Math.min(C + 1, j.doc.content.size));
4832
+ const { state: B } = y, S = B.selection.from, k = B.doc.textBetween(Math.max(0, S - 1), S), I = B.doc.textBetween(S, Math.min(S + 1, B.doc.content.size));
4699
4833
  let A = "";
4700
- C > 0 && k !== " " && !h(k) && (A = " ");
4834
+ S > 0 && k !== " " && !h(k) && (A = " ");
4701
4835
  let w = "";
4702
- I && I !== " " && !h(I) && (w = " "), y.chain().insertContent(A + S + w).run();
4836
+ I && I !== " " && !h(I) && (w = " "), y.chain().insertContent(A + C + w).run();
4703
4837
  }
4704
4838
  setTimeout(() => n(y.getHTML(), {}, r), 100);
4705
4839
  return;
4706
4840
  }
4707
4841
  } else {
4708
- const y = x, S = y.selectionStart || 0, v = y.value || "", B = y.selectionEnd || S;
4709
- if (B > S) {
4710
- const I = `{{${m}}}`, { text: A } = f(v, S, I), w = v.slice(0, S) + A + v.slice(B);
4842
+ const y = f, C = y.selectionStart || 0, v = y.value || "", j = y.selectionEnd || C;
4843
+ if (j > C) {
4844
+ const I = `{{${g}}}`, { text: A } = x(v, C, I), w = v.slice(0, C) + A + v.slice(j);
4711
4845
  n(w, {}, r);
4712
4846
  return;
4713
4847
  }
4714
- const j = `{{${m}}}`, { text: C } = f(v, S, j), k = v.slice(0, S) + C + v.slice(S);
4848
+ const B = `{{${g}}}`, { text: S } = x(v, C, B), k = v.slice(0, C) + S + v.slice(C);
4715
4849
  n(k, {}, r);
4716
4850
  }
4717
4851
  },
@@ -4734,22 +4868,22 @@ const DataBindingSelector = ({
4734
4868
  onChange: r
4735
4869
  }) => {
4736
4870
  var I;
4737
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (A, w) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, m] = useState("page"), [g, h] = useState(""), [f, x] = useState([]), [b, y] = useState(-1), S = useRef(null), v = (I = n == null ? void 0 : n.find((A) => A.key === u)) == null ? void 0 : I.name;
4871
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (A, w) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [x, f] = useState([]), [b, y] = useState(-1), C = useRef(null), v = (I = n == null ? void 0 : n.find((A) => A.key === u)) == null ? void 0 : I.name;
4738
4872
  useEffect(() => {
4739
- if (h(""), x([]), y(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4873
+ if (h(""), f([]), y(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4740
4874
  const A = split(o, ":"), w = get(A, 1, "page") || "page";
4741
- m(w), (async () => {
4875
+ g(w), (async () => {
4742
4876
  const E = await l(w, [get(A, 2, "page")]);
4743
4877
  E && Array.isArray(E) && h(get(E, [0, "name"], ""));
4744
4878
  })();
4745
4879
  }, [o]);
4746
- const B = useDebouncedCallback(
4880
+ const j = useDebouncedCallback(
4747
4881
  async (A) => {
4748
4882
  if (isEmpty(A))
4749
- x([]);
4883
+ f([]);
4750
4884
  else {
4751
4885
  const w = await l(u, A);
4752
- x(w);
4886
+ f(w);
4753
4887
  }
4754
4888
  c(!1), y(-1);
4755
4889
  },
@@ -4757,60 +4891,60 @@ const DataBindingSelector = ({
4757
4891
  300
4758
4892
  ), _ = (A) => {
4759
4893
  const w = ["pageType", u, A.id];
4760
- w[1] && (r(w.join(":")), h(A.name), p(!1), x([]), y(-1));
4761
- }, j = (A) => {
4894
+ w[1] && (r(w.join(":")), h(A.name), p(!1), f([]), y(-1));
4895
+ }, B = (A) => {
4762
4896
  switch (A.key) {
4763
4897
  case "ArrowDown":
4764
- A.preventDefault(), y((w) => w < f.length - 1 ? w + 1 : w);
4898
+ A.preventDefault(), y((w) => w < x.length - 1 ? w + 1 : w);
4765
4899
  break;
4766
4900
  case "ArrowUp":
4767
4901
  A.preventDefault(), y((w) => w > 0 ? w - 1 : w);
4768
4902
  break;
4769
4903
  case "Enter":
4770
- if (A.preventDefault(), f.length === 0) return;
4771
- b >= 0 && _(f[b]);
4904
+ if (A.preventDefault(), x.length === 0) return;
4905
+ b >= 0 && _(x[b]);
4772
4906
  break;
4773
4907
  case "Escape":
4774
- A.preventDefault(), C();
4908
+ A.preventDefault(), S();
4775
4909
  break;
4776
4910
  }
4777
4911
  };
4778
4912
  useEffect(() => {
4779
- if (b >= 0 && S.current) {
4780
- const A = S.current.children[b];
4913
+ if (b >= 0 && C.current) {
4914
+ const A = C.current.children[b];
4781
4915
  A == null || A.scrollIntoView({ block: "nearest" });
4782
4916
  }
4783
4917
  }, [b]);
4784
- const C = () => {
4785
- h(""), x([]), y(-1), p(!1), r("");
4918
+ const S = () => {
4919
+ h(""), f([]), y(-1), p(!1), r("");
4786
4920
  }, k = (A) => {
4787
- h(A), p(!isEmpty(A)), c(!0), B(A);
4921
+ h(A), p(!isEmpty(A)), c(!0), j(A);
4788
4922
  };
4789
4923
  return /* @__PURE__ */ jsxs("div", { children: [
4790
- /* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (A) => m(A.target.value), children: map(n, (A) => /* @__PURE__ */ jsx("option", { value: A.key, children: A.name }, A.key)) }),
4924
+ /* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (A) => g(A.target.value), children: map(n, (A) => /* @__PURE__ */ jsx("option", { value: A.key, children: A.name }, A.key)) }),
4791
4925
  u && /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 flex items-center", children: [
4792
4926
  /* @__PURE__ */ jsx(
4793
4927
  "input",
4794
4928
  {
4795
4929
  type: "text",
4796
- value: g,
4930
+ value: m,
4797
4931
  onChange: (A) => k(A.target.value),
4798
- onKeyDown: j,
4932
+ onKeyDown: B,
4799
4933
  placeholder: a(`Search ${v ?? ""}`),
4800
4934
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
4801
4935
  }
4802
4936
  ),
4803
- /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: g && /* @__PURE__ */ jsx("button", { onClick: C, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-4 w-4" }) }) })
4937
+ /* @__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(Cross1Icon, { className: "h-4 w-4" }) }) })
4804
4938
  ] }),
4805
- (i || !isEmpty(f) || d && isEmpty(f)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
4939
+ (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: [
4806
4940
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
4807
4941
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
4808
- ] }) : d && isEmpty(f) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4942
+ ] }) : d && isEmpty(x) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4809
4943
  a("No results found for"),
4810
4944
  ' "',
4811
- g,
4945
+ m,
4812
4946
  '"'
4813
- ] }) : /* @__PURE__ */ jsx("ul", { ref: S, children: map(f == null ? void 0 : f.slice(0, 20), (A, w) => /* @__PURE__ */ jsxs(
4947
+ ] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(x == null ? void 0 : x.slice(0, 20), (A, w) => /* @__PURE__ */ jsxs(
4814
4948
  "li",
4815
4949
  {
4816
4950
  onClick: () => _(A),
@@ -4829,22 +4963,22 @@ const DataBindingSelector = ({
4829
4963
  )) }) })
4830
4964
  ] });
4831
4965
  }, LinkField = ({ schema: o, formData: n, onChange: r, name: a }) => {
4832
- const { t: l } = useTranslation(), { type: i = "pageType", href: c = "", target: d = "self" } = n ?? {}, p = useBuilderProp("pageTypes", []), { selectedLang: u, fallbackLang: m, languages: g } = useLanguages(), h = useMemo(
4833
- () => isEmpty(g) ? "" : isEmpty(u) ? m : u,
4834
- [g, u, m]
4835
- ), f = useMemo(() => get(LANGUAGES, h, h), [h]), x = i === "pageType" && isEmpty(p) ? "url" : i;
4966
+ const { t: l } = useTranslation(), { type: i = "pageType", href: c = "", target: d = "self" } = n ?? {}, p = useBuilderProp("pageTypes", []), { selectedLang: u, fallbackLang: g, languages: m } = useLanguages(), h = useMemo(
4967
+ () => isEmpty(m) ? "" : isEmpty(u) ? g : u,
4968
+ [m, u, g]
4969
+ ), x = useMemo(() => get(LANGUAGES, h, h), [h]), f = i === "pageType" && isEmpty(p) ? "url" : i;
4836
4970
  return /* @__PURE__ */ jsxs("div", { children: [
4837
4971
  /* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between gap-x-2 text-xs font-medium", children: [
4838
4972
  /* @__PURE__ */ jsxs("span", { children: [
4839
4973
  (o == null ? void 0 : o.title) ?? "Link",
4840
- /* @__PURE__ */ jsx("span", { className: "pl-1 text-[9px] text-zinc-400", children: f })
4974
+ /* @__PURE__ */ jsx("span", { className: "pl-1 text-[9px] text-zinc-400", children: x })
4841
4975
  ] }),
4842
4976
  /* @__PURE__ */ jsx(
4843
4977
  DataBindingSelector,
4844
4978
  {
4845
4979
  schema: o,
4846
4980
  onChange: (b) => {
4847
- r({ ...n, href: b, ...x === "pageType" ? { type: "url" } : {} });
4981
+ r({ ...n, href: b, ...f === "pageType" ? { type: "url" } : {} });
4848
4982
  },
4849
4983
  id: `root.${a}.href`,
4850
4984
  formData: n
@@ -4862,7 +4996,7 @@ const DataBindingSelector = ({
4862
4996
  ],
4863
4997
  (b) => /* @__PURE__ */ jsx("option", { value: b.const, children: b.title }, b.const)
4864
4998
  ) }),
4865
- x === "pageType" && !isEmpty(p) ? /* @__PURE__ */ jsx(
4999
+ f === "pageType" && !isEmpty(p) ? /* @__PURE__ */ jsx(
4866
5000
  PageTypeField,
4867
5001
  {
4868
5002
  href: c,
@@ -4879,13 +5013,13 @@ const DataBindingSelector = ({
4879
5013
  spellCheck: "false",
4880
5014
  name: "href",
4881
5015
  type: "text",
4882
- className: x === "pageType" ? "!hidden" : "",
5016
+ className: f === "pageType" ? "!hidden" : "",
4883
5017
  value: c,
4884
5018
  onChange: (b) => r({ ...n, href: b.target.value }),
4885
5019
  placeholder: l(i === "url" ? "Enter URL" : i === "scroll" ? "#ElementID" : "Enter details")
4886
5020
  }
4887
5021
  ),
4888
- x === "url" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5022
+ f === "url" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
4889
5023
  /* @__PURE__ */ jsx(
4890
5024
  "input",
4891
5025
  {
@@ -4919,26 +5053,26 @@ const DataBindingSelector = ({
4919
5053
  ]
4920
5054
  }
4921
5055
  ) });
4922
- }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-CqBZ4WKt.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: l, onBlur: i }) => {
5056
+ }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-DxyV3u6C.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: l, onBlur: i }) => {
4923
5057
  const c = useRef(null), [d, p] = useState(!1), u = useRTEditor({
4924
5058
  blockId: o,
4925
5059
  value: a,
4926
5060
  placeholder: r,
4927
5061
  onBlur: ({ editor: h }) => {
4928
- const f = h == null ? void 0 : h.getHTML();
4929
- i(n, f);
5062
+ const x = h == null ? void 0 : h.getHTML();
5063
+ i(n, x);
4930
5064
  },
4931
5065
  onUpdate: ({ editor: h }) => {
4932
- const f = h == null ? void 0 : h.getHTML();
4933
- l(f);
5066
+ const x = h == null ? void 0 : h.getHTML();
5067
+ l(x);
4934
5068
  }
4935
5069
  });
4936
5070
  useEffect(() => {
4937
5071
  c.current && u && (c.current.__chaiRTE = u);
4938
5072
  }, [o, u]);
4939
- const m = () => {
5073
+ const g = () => {
4940
5074
  p(!1);
4941
- }, g = /* @__PURE__ */ jsxs("div", { id: `chai-rte-${n}`, ref: c, className: "mt-1 rounded-md border border-input", children: [
5075
+ }, m = /* @__PURE__ */ jsxs("div", { id: `chai-rte-${n}`, ref: c, className: "mt-1 rounded-md border border-input", children: [
4942
5076
  /* @__PURE__ */ jsx(RteMenubar, { editor: u, onExpand: () => p(!0) }),
4943
5077
  /* @__PURE__ */ jsx(
4944
5078
  EditorContent,
@@ -4952,8 +5086,8 @@ const DataBindingSelector = ({
4952
5086
  )
4953
5087
  ] });
4954
5088
  return /* @__PURE__ */ jsxs(Fragment, { children: [
4955
- d && /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsx(RTEModal, { isOpen: d, onClose: m, editor: u, rteElement: g }) }),
4956
- d ? /* @__PURE__ */ jsx("div", { children: "Open in modal" }) : /* @__PURE__ */ jsx("div", { className: "relative", children: g })
5089
+ d && /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsx(RTEModal, { isOpen: d, onClose: g, editor: u, rteElement: m }) }),
5090
+ d ? /* @__PURE__ */ jsx("div", { children: "Open in modal" }) : /* @__PURE__ */ jsx("div", { className: "relative", children: m })
4957
5091
  ] });
4958
5092
  }, RichTextEditorField = (o) => {
4959
5093
  const { editingBlockId: n } = useInlineEditing(), [r, a] = useState(null), l = useSelectedBlock(), i = l == null ? void 0 : l._id;
@@ -4965,49 +5099,49 @@ const DataBindingSelector = ({
4965
5099
  if (!a && !l) return null;
4966
5100
  const d = (a == null ? void 0 : a._type) === "Slider" ? a : l, p = find(r, { _parent: d == null ? void 0 : d._id, _type: "Slides" });
4967
5101
  if (!p) return null;
4968
- const u = filter(r, { _parent: p == null ? void 0 : p._id, _type: "Slide" }), m = (o == null ? void 0 : o.currentSlide) || get(u, "0._id");
5102
+ const u = filter(r, { _parent: p == null ? void 0 : p._id, _type: "Slide" }), g = (o == null ? void 0 : o.currentSlide) || get(u, "0._id");
4969
5103
  useEffect(() => {
4970
5104
  (a == null ? void 0 : a._type) === "Slide" && (o == null ? void 0 : o.currentSlide) !== (a == null ? void 0 : a._id) && n({ ...o, currentSlide: a == null ? void 0 : a._id });
4971
5105
  }, [a]), useEffect(() => {
4972
5106
  u != null && u.length && !find(u, { _id: o == null ? void 0 : o.currentSlide }) && n({ ...o, currentSlide: get(u, "0._id") });
4973
5107
  }, [o, u]);
4974
- const g = () => {
4975
- const x = findIndex(u, { _id: m });
4976
- if (x > -1) {
4977
- const b = (x + 1) % u.length, y = get(u, [b, "_id"]);
5108
+ const m = () => {
5109
+ const f = findIndex(u, { _id: g });
5110
+ if (f > -1) {
5111
+ const b = (f + 1) % u.length, y = get(u, [b, "_id"]);
4978
5112
  if (!y) return;
4979
5113
  n({ ...o, currentSlide: y }), c([y]);
4980
5114
  }
4981
5115
  }, h = () => {
4982
- const x = findIndex(u, { _id: m });
4983
- if (x > -1) {
4984
- const b = (x - 1 + u.length) % u.length, y = get(u, [b, "_id"]);
5116
+ const f = findIndex(u, { _id: g });
5117
+ if (f > -1) {
5118
+ const b = (f - 1 + u.length) % u.length, y = get(u, [b, "_id"]);
4985
5119
  if (!y) return;
4986
5120
  n({ ...o, currentSlide: y }), c([y]);
4987
5121
  }
4988
- }, f = () => {
4989
- const x = i(
5122
+ }, x = () => {
5123
+ const f = i(
4990
5124
  { styles: "#styles:,h-full w-full min-w-full", type: "Slide" },
4991
5125
  p == null ? void 0 : p._id
4992
- ), b = x == null ? void 0 : x._id;
5126
+ ), b = f == null ? void 0 : f._id;
4993
5127
  b && (n({ ...o, currentSlide: b }), c([b]));
4994
5128
  };
4995
5129
  return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
4996
5130
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 pb-2 text-[12px]", children: [
4997
5131
  /* @__PURE__ */ jsx("button", { onClick: h, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "h-3 w-3" }) }),
4998
- /* @__PURE__ */ jsx("div", { className: "whitespace-nowrap text-center text-[10px] text-slate-500", children: m ? /* @__PURE__ */ jsxs("span", { className: "", children: [
5132
+ /* @__PURE__ */ jsx("div", { className: "whitespace-nowrap text-center text-[10px] text-slate-500", children: g ? /* @__PURE__ */ jsxs("span", { className: "", children: [
4999
5133
  /* @__PURE__ */ jsxs("b", { className: "text-[12px]", children: [
5000
5134
  " ",
5001
- findIndex(u, { _id: m }) + 1
5135
+ findIndex(u, { _id: g }) + 1
5002
5136
  ] }),
5003
5137
  "/",
5004
5138
  u.length
5005
5139
  ] }) : "-" }),
5006
- /* @__PURE__ */ jsx("button", { onClick: g, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }) }),
5140
+ /* @__PURE__ */ jsx("button", { onClick: m, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }) }),
5007
5141
  /* @__PURE__ */ jsxs(
5008
5142
  "button",
5009
5143
  {
5010
- onClick: f,
5144
+ onClick: x,
5011
5145
  className: "flex w-full items-center justify-center gap-x-1 rounded bg-gray-200 p-1.5 text-xs font-medium leading-tight hover:opacity-80",
5012
5146
  children: [
5013
5147
  /* @__PURE__ */ jsx(PlusCircledIcon, { className: "h-3 w-3" }),
@@ -5068,8 +5202,8 @@ const DataBindingSelector = ({
5068
5202
  value: o == null ? void 0 : o.autoplayInterval,
5069
5203
  className: "text-xs",
5070
5204
  pattern: "[0-9]*",
5071
- onChange: (x) => {
5072
- let b = x.target.value;
5205
+ onChange: (f) => {
5206
+ let b = f.target.value;
5073
5207
  b.length && (b = b.replace("-", "")), n({ ...o, autoplayInterval: b });
5074
5208
  }
5075
5209
  }
@@ -5081,7 +5215,7 @@ const DataBindingSelector = ({
5081
5215
  const r = get(o, "srcsets", []) || [], a = (c, d) => {
5082
5216
  const p = c.target.name, u = c.target.value;
5083
5217
  n({
5084
- srcsets: map(r, (m, g) => g === d ? { ...m, [p]: u } : m)
5218
+ srcsets: map(r, (g, m) => m === d ? { ...g, [p]: u } : g)
5085
5219
  });
5086
5220
  }, l = () => {
5087
5221
  n({ srcsets: [...r, {}] });
@@ -5160,37 +5294,37 @@ const DataBindingSelector = ({
5160
5294
  ] });
5161
5295
  }, CollectionFilterSortField = ({ id: o, value: n, onChange: r, onBlur: a }) => {
5162
5296
  const l = useBuilderProp("collections", []), i = useSelectedBlock(), c = get(i, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1").replace(COLLECTION_PREFIX, ""), d = find(l, { id: c }), u = get(d, o === "root.filter" ? "filters" : "sorts", []);
5163
- return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("select", { value: n, onChange: (m) => r(m.target.value), onBlur: (m) => a(o, m.target.value), children: [
5297
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("select", { value: n, onChange: (g) => r(g.target.value), onBlur: (g) => a(o, g.target.value), children: [
5164
5298
  /* @__PURE__ */ jsx("option", { value: "", children: "Select" }),
5165
- u.map((m) => /* @__PURE__ */ jsx("option", { value: m.id, children: m.name }, m.id))
5299
+ u.map((g) => /* @__PURE__ */ jsx("option", { value: g.id, children: g.name }, g.id))
5166
5300
  ] }) });
5167
5301
  }, JSONFormFieldTemplate = (o) => {
5168
- const { id: n, classNames: r, label: a, children: l, errors: i, help: c, hidden: d, required: p, schema: u, formData: m, onChange: g } = o, { selectedLang: h, fallbackLang: f, languages: x } = useLanguages(), b = useMemo(
5169
- () => isEmpty(x) ? "" : isEmpty(h) ? f : h,
5170
- [x, h, f]
5171
- ), y = useMemo(() => get(LANGUAGES, b, b), [b]), S = usePageExternalData(), v = useSelectedBlock(), B = useRegisteredChaiBlocks(), _ = useMemo(
5172
- () => get(B, [v == null ? void 0 : v._type, "i18nProps"], []),
5173
- [B, v == null ? void 0 : v._type]
5174
- ), [j, C] = useState(null);
5302
+ const { id: n, classNames: r, label: a, children: l, errors: i, help: c, hidden: d, required: p, schema: u, formData: g, onChange: m } = o, { selectedLang: h, fallbackLang: x, languages: f } = useLanguages(), b = useMemo(
5303
+ () => isEmpty(f) ? "" : isEmpty(h) ? x : h,
5304
+ [f, h, x]
5305
+ ), y = useMemo(() => get(LANGUAGES, b, b), [b]), C = usePageExternalData(), v = useSelectedBlock(), j = useRegisteredChaiBlocks(), _ = useMemo(
5306
+ () => get(j, [v == null ? void 0 : v._type, "i18nProps"], []),
5307
+ [j, v == null ? void 0 : v._type]
5308
+ ), [B, S] = useState(null);
5175
5309
  if (d)
5176
5310
  return null;
5177
5311
  if (u.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: l });
5178
5312
  const I = _ == null ? void 0 : _.includes(n.replace("root.", ""));
5179
5313
  if (u.type === "array") {
5180
- const E = j === n;
5314
+ const E = B === n;
5181
5315
  return /* @__PURE__ */ jsxs("div", { className: `${r} relative`, children: [
5182
5316
  u.title && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-1", children: /* @__PURE__ */ jsxs(
5183
5317
  "label",
5184
5318
  {
5185
5319
  htmlFor: n,
5186
- onClick: () => C(E ? null : n),
5320
+ onClick: () => S(E ? null : n),
5187
5321
  className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
5188
5322
  children: [
5189
5323
  E ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }),
5190
5324
  /* @__PURE__ */ jsx(ListBulletIcon, { className: "h-3 w-3" }),
5191
5325
  /* @__PURE__ */ jsx("span", { className: "leading-tight", children: a }),
5192
5326
  " ",
5193
- /* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children: m == null ? void 0 : m.length }) }),
5327
+ /* @__PURE__ */ jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsx("span", { className: "text-[9px] font-medium text-slate-600", children: g == null ? void 0 : g.length }) }),
5194
5328
  u.description && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
5195
5329
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
5196
5330
  InfoCircledIcon,
@@ -5205,14 +5339,14 @@ const DataBindingSelector = ({
5205
5339
  ]
5206
5340
  }
5207
5341
  ) }),
5208
- (m == null ? void 0 : m.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: l }) : /* @__PURE__ */ jsxs("div", { className: `${E ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
5342
+ (g == null ? void 0 : g.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "h-0 overflow-hidden", children: l }) : /* @__PURE__ */ jsxs("div", { className: `${E ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
5209
5343
  l,
5210
5344
  i,
5211
5345
  c
5212
5346
  ] })
5213
5347
  ] });
5214
5348
  }
5215
- const A = n.replace("root.", ""), w = _.includes(A) && !isEmpty(h) && isEmpty(m);
5349
+ const A = n.replace("root.", ""), w = _.includes(A) && !isEmpty(h) && isEmpty(g);
5216
5350
  return /* @__PURE__ */ jsxs("div", { className: r, children: [
5217
5351
  u.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
5218
5352
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -5230,7 +5364,7 @@ const DataBindingSelector = ({
5230
5364
  /* @__PURE__ */ jsx(TooltipContent, { className: "max-w-xs", children: u.description })
5231
5365
  ] }) })
5232
5366
  ] }),
5233
- !u.enum && !u.oneOf && S && /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-1", children: [
5367
+ !u.enum && !u.oneOf && C && /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-1", children: [
5234
5368
  w ? /* @__PURE__ */ jsxs(Tooltip, { children: [
5235
5369
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
5236
5370
  "svg",
@@ -5263,10 +5397,10 @@ const DataBindingSelector = ({
5263
5397
  {
5264
5398
  schema: u,
5265
5399
  onChange: (E) => {
5266
- g(E, m, n);
5400
+ m(E, g, n);
5267
5401
  },
5268
5402
  id: n,
5269
- formData: m
5403
+ formData: g
5270
5404
  }
5271
5405
  )
5272
5406
  ] })
@@ -5313,8 +5447,8 @@ const DataBindingSelector = ({
5313
5447
  /* @__PURE__ */ jsx("span", { children: "Add" })
5314
5448
  ] }) }), JSONForm = memo(({ blockId: o, schema: n, uiSchema: r, formData: a, onChange: l }) => {
5315
5449
  const { selectedLang: i } = useLanguages(), c = useBlockSettingComponents("widget"), d = useBlockSettingComponents("field"), p = useBlockSettingComponents("template"), u = useThrottledCallback(
5316
- async ({ formData: m }, g) => {
5317
- get(m, g) === void 0 && set(m, g, ""), l({ formData: m }, g);
5450
+ async ({ formData: g }, m) => {
5451
+ get(g, m) === void 0 && set(g, m, ""), l({ formData: g }, m);
5318
5452
  },
5319
5453
  [l, i],
5320
5454
  400
@@ -5355,10 +5489,10 @@ const DataBindingSelector = ({
5355
5489
  uiSchema: r,
5356
5490
  schema: n,
5357
5491
  formData: a,
5358
- onChange: ({ formData: m }, g) => {
5359
- if (!g || o !== (m == null ? void 0 : m._id)) return;
5360
- const h = take(g.split("."), 2).join(".").replace("root.", "");
5361
- u({ formData: m }, h);
5492
+ onChange: ({ formData: g }, m) => {
5493
+ if (!m || o !== (g == null ? void 0 : g._id)) return;
5494
+ const h = take(m.split("."), 2).join(".").replace("root.", "");
5495
+ u({ formData: g }, h);
5362
5496
  }
5363
5497
  },
5364
5498
  i
@@ -5370,52 +5504,52 @@ const DataBindingSelector = ({
5370
5504
  }), a;
5371
5505
  };
5372
5506
  function BlockSettings() {
5373
- 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), m = useWrapperBlock(), g = getRegisteredChaiBlock(m == null ? void 0 : m._type), h = formDataWithSelectedLang(m, o, g), f = ({ formData: j }, C, k) => {
5374
- C && (c == null ? void 0 : c._id) === n._id && a([n._id], { [C]: get(j, C) }, k);
5375
- }, x = useCallback(
5376
- debounce(({ formData: j }, C, k) => {
5377
- f({ formData: j }, C, k), d(j);
5507
+ 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: B }, S, k) => {
5508
+ S && (c == null ? void 0 : c._id) === n._id && a([n._id], { [S]: get(B, S) }, k);
5509
+ }, f = useCallback(
5510
+ debounce(({ formData: B }, S, k) => {
5511
+ x({ formData: B }, S, k), d(B);
5378
5512
  }, 1500),
5379
5513
  [n == null ? void 0 : n._id, o]
5380
- ), b = ({ formData: j }, C) => {
5381
- C && (r([n._id], { [C]: get(j, C) }), x({ formData: j }, C, { [C]: get(c, C) }));
5382
- }, y = ({ formData: j }, C) => {
5383
- C && (r([m._id], { [C]: get(j, C) }), x({ formData: j }, C, { [C]: get(c, C) }));
5384
- }, { schema: S, uiSchema: v } = useMemo(() => {
5385
- const j = n == null ? void 0 : n._type;
5386
- if (!j)
5514
+ ), b = ({ formData: B }, S) => {
5515
+ S && (r([n._id], { [S]: get(B, S) }), f({ formData: B }, S, { [S]: get(c, S) }));
5516
+ }, y = ({ formData: B }, S) => {
5517
+ S && (r([g._id], { [S]: get(B, S) }), f({ formData: B }, S, { [S]: get(c, S) }));
5518
+ }, { schema: C, uiSchema: v } = useMemo(() => {
5519
+ const B = n == null ? void 0 : n._type;
5520
+ if (!B)
5387
5521
  return { schema: {}, uiSchema: {} };
5388
5522
  try {
5389
- const { schema: C, uiSchema: k } = getBlockFormSchemas(j);
5390
- if (j === "Repeater") {
5523
+ const { schema: S, uiSchema: k } = getBlockFormSchemas(B);
5524
+ if (B === "Repeater") {
5391
5525
  const I = get(n, "repeaterItems", "");
5392
5526
  startsWith(I, `{{${COLLECTION_PREFIX}`) ? (set(k, "filter", { "ui:widget": "collectionSelect" }), set(k, "sort", { "ui:widget": "collectionSelect" })) : (set(k, "filter", { "ui:widget": "hidden" }), set(k, "sort", { "ui:widget": "hidden" }));
5393
5527
  }
5394
- return { schema: C, uiSchema: k };
5528
+ return { schema: S, uiSchema: k };
5395
5529
  } catch {
5396
5530
  return { schema: {}, uiSchema: {} };
5397
5531
  }
5398
- }, [n]), { wrapperSchema: B, wrapperUiSchema: _ } = useMemo(() => {
5399
- if (!m || !(m != null && m._type))
5532
+ }, [n]), { wrapperSchema: j, wrapperUiSchema: _ } = useMemo(() => {
5533
+ if (!g || !(g != null && g._type))
5400
5534
  return { wrapperSchema: {}, wrapperUiSchema: {} };
5401
- const j = m == null ? void 0 : m._type, { schema: C = {}, uiSchema: k = {} } = getBlockFormSchemas(j);
5402
- return { wrapperSchema: C, wrapperUiSchema: k };
5403
- }, [m]);
5535
+ const B = g == null ? void 0 : g._type, { schema: S = {}, uiSchema: k = {} } = getBlockFormSchemas(B);
5536
+ return { wrapperSchema: S, wrapperUiSchema: k };
5537
+ }, [g]);
5404
5538
  return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
5405
- !isEmpty(m) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
5539
+ !isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
5406
5540
  /* @__PURE__ */ jsxs(
5407
5541
  "div",
5408
5542
  {
5409
- onClick: () => u((j) => !j),
5543
+ onClick: () => u((B) => !B),
5410
5544
  className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
5411
5545
  children: [
5412
5546
  p ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-4 w-4 text-slate-400" }) : /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4 text-slate-400" }),
5413
- startCase(m._type),
5547
+ startCase(g._type),
5414
5548
  " settings",
5415
5549
  " ",
5416
- m._name && /* @__PURE__ */ jsxs("span", { className: "text-[11px] font-light text-slate-400", children: [
5550
+ g._name && /* @__PURE__ */ jsxs("span", { className: "text-[11px] font-light text-slate-400", children: [
5417
5551
  "(",
5418
- m._name,
5552
+ g._name,
5419
5553
  ")"
5420
5554
  ] })
5421
5555
  ]
@@ -5424,48 +5558,48 @@ function BlockSettings() {
5424
5558
  /* @__PURE__ */ jsx("div", { className: p ? "h-auto" : "invisible h-0", children: /* @__PURE__ */ jsx(
5425
5559
  JSONForm,
5426
5560
  {
5427
- blockId: m == null ? void 0 : m._id,
5561
+ blockId: g == null ? void 0 : g._id,
5428
5562
  onChange: y,
5429
5563
  formData: h,
5430
- schema: B,
5564
+ schema: j,
5431
5565
  uiSchema: _
5432
5566
  }
5433
5567
  ) })
5434
5568
  ] }),
5435
- isEmpty(S) ? null : /* @__PURE__ */ jsx(
5569
+ isEmpty(C) ? null : /* @__PURE__ */ jsx(
5436
5570
  JSONForm,
5437
5571
  {
5438
5572
  blockId: n == null ? void 0 : n._id,
5439
5573
  onChange: b,
5440
5574
  formData: i,
5441
- schema: S,
5575
+ schema: C,
5442
5576
  uiSchema: v
5443
5577
  }
5444
5578
  )
5445
5579
  ] });
5446
5580
  }
5447
5581
  const BlockStylingProps = () => {
5448
- var f;
5582
+ var x;
5449
5583
  const o = useSelectedBlock(), [n, r] = useSelectedStylingBlocks(), a = useRemoveClassesFromBlocks(), [l] = useSelectedBlockIds(), { t: i } = useTranslation();
5450
5584
  if (!o) return null;
5451
5585
  const c = Object.keys(o).filter(
5452
- (x) => typeof o[x] == "string" && o[x].startsWith("#styles:")
5453
- ), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (f = n[0]) == null ? void 0 : f.prop, ""), { classes: m = "" } = getSplitChaiClasses(u) || {}, g = m ? m.split(" ").filter((x) => !isEmpty(x)) : [], h = (x) => find(n, (b) => b.prop === x);
5586
+ (f) => typeof o[f] == "string" && o[f].startsWith("#styles:")
5587
+ ), { reset: d } = useResetBlockStyles(), p = !isEmpty(c) && c.length > 1, u = get(o, (x = n[0]) == null ? void 0 : x.prop, ""), { classes: g = "" } = getSplitChaiClasses(u) || {}, m = g ? g.split(" ").filter((f) => !isEmpty(f)) : [], h = (f) => find(n, (b) => b.prop === f);
5454
5588
  return /* @__PURE__ */ jsx(Fragment, { children: p && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1", children: [
5455
5589
  /* @__PURE__ */ jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
5456
5590
  i("Style element"),
5457
5591
  ":"
5458
5592
  ] }),
5459
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(c, (x) => /* @__PURE__ */ jsxs(
5593
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: map(c, (f) => /* @__PURE__ */ jsxs(
5460
5594
  Badge,
5461
5595
  {
5462
5596
  className: "flex cursor-pointer items-center gap-1 pr-1",
5463
- variant: h(x) ? "default" : "secondary",
5597
+ variant: h(f) ? "default" : "secondary",
5464
5598
  onClick: () => {
5465
- r([{ id: `${x}-${o._id}`, blockId: o._id, prop: x }]);
5599
+ r([{ id: `${f}-${o._id}`, blockId: o._id, prop: f }]);
5466
5600
  },
5467
5601
  children: [
5468
- startCase(x),
5602
+ startCase(f),
5469
5603
  /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5470
5604
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
5471
5605
  "button",
@@ -5482,7 +5616,7 @@ const BlockStylingProps = () => {
5482
5616
  {
5483
5617
  className: "text-xs",
5484
5618
  onClick: () => {
5485
- d(x);
5619
+ d(f);
5486
5620
  },
5487
5621
  children: i("Reset style")
5488
5622
  }
@@ -5492,7 +5626,7 @@ const BlockStylingProps = () => {
5492
5626
  {
5493
5627
  className: "text-xs",
5494
5628
  onClick: () => {
5495
- a(l, g, !0);
5629
+ a(l, m, !0);
5496
5630
  },
5497
5631
  children: i("Clear styles")
5498
5632
  }
@@ -5501,7 +5635,7 @@ const BlockStylingProps = () => {
5501
5635
  ] })
5502
5636
  ]
5503
5637
  },
5504
- x
5638
+ f
5505
5639
  )) }),
5506
5640
  /* @__PURE__ */ jsx("div", { className: "my-2 h-[1px] w-full bg-border" })
5507
5641
  ] }) });
@@ -5650,7 +5784,7 @@ const BlockStylingProps = () => {
5650
5784
  },
5651
5785
  a
5652
5786
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
5653
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: m } = o, [g, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [b, y] = useState(""), [S, v] = useState(!1), [B, _] = useState(!1);
5787
+ 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), [b, y] = useState(""), [C, v] = useState(!1), [j, _] = useState(!1);
5654
5788
  useEffect(() => {
5655
5789
  const { value: A, unit: w } = getClassValueAndUnit(i);
5656
5790
  if (w === "") {
@@ -5659,43 +5793,43 @@ const BlockStylingProps = () => {
5659
5793
  }
5660
5794
  h(w), l(w === "class" || isEmpty(A) ? "" : A);
5661
5795
  }, [i, p, u]);
5662
- const j = useThrottledCallback((A) => c(A), [c], THROTTLE_TIME), C = useThrottledCallback((A) => c(A, !1), [c], THROTTLE_TIME), k = useCallback(
5796
+ const B = useThrottledCallback((A) => c(A), [c], THROTTLE_TIME), S = useThrottledCallback((A) => c(A, !1), [c], THROTTLE_TIME), k = useCallback(
5663
5797
  (A = !1) => {
5664
5798
  const w = getUserInputValues(`${a}`, u);
5665
5799
  if (get(w, "error", !1)) {
5666
- x(!0);
5800
+ f(!0);
5667
5801
  return;
5668
5802
  }
5669
- const E = get(w, "unit") !== "" ? get(w, "unit") : g;
5803
+ const E = get(w, "unit") !== "" ? get(w, "unit") : m;
5670
5804
  if (E === "auto" || E === "none") {
5671
- j(`${d}${E}`);
5805
+ B(`${d}${E}`);
5672
5806
  return;
5673
5807
  }
5674
5808
  if (get(w, "value") === "")
5675
5809
  return;
5676
5810
  const T = `${get(w, "value", "").startsWith("-") ? "-" : ""}${d}[${get(w, "value", "").replace("-", "")}${E === "-" ? "" : E}]`;
5677
- A ? C(T) : j(T);
5811
+ A ? S(T) : B(T);
5678
5812
  },
5679
- [j, C, a, g, d, u]
5813
+ [B, S, a, m, d, u]
5680
5814
  ), I = useCallback(
5681
5815
  (A) => {
5682
5816
  const w = getUserInputValues(`${a}`, u);
5683
5817
  if (get(w, "error", !1)) {
5684
- x(!0);
5818
+ f(!0);
5685
5819
  return;
5686
5820
  }
5687
5821
  if (A === "auto" || A === "none") {
5688
- j(`${d}${A}`);
5822
+ B(`${d}${A}`);
5689
5823
  return;
5690
5824
  }
5691
5825
  if (get(w, "value") === "")
5692
5826
  return;
5693
5827
  const E = get(w, "unit") !== "" ? get(w, "unit") : A, T = `${get(w, "value", "").startsWith("-") ? "-" : ""}${d}[${get(w, "value", "").replace("-", "")}${E === "-" ? "" : E}]`;
5694
- j(T);
5828
+ B(T);
5695
5829
  },
5696
- [j, a, d, u]
5830
+ [B, a, d, u]
5697
5831
  );
5698
- return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: g === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5832
+ 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: [
5699
5833
  /* @__PURE__ */ jsx(
5700
5834
  "input",
5701
5835
  {
@@ -5708,12 +5842,12 @@ const BlockStylingProps = () => {
5708
5842
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsx(InfoCircledIcon, {}) }) }),
5709
5843
  /* @__PURE__ */ jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
5710
5844
  ] })
5711
- ] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${S ? "z-auto" : ""}`, children: [
5845
+ ] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${C ? "z-auto" : ""}`, children: [
5712
5846
  /* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
5713
- ["none", "auto"].indexOf(g) !== -1 ? null : /* @__PURE__ */ jsx(
5847
+ ["none", "auto"].indexOf(m) !== -1 ? null : /* @__PURE__ */ jsx(
5714
5848
  "input",
5715
5849
  {
5716
- readOnly: g === "class",
5850
+ readOnly: m === "class",
5717
5851
  onKeyPress: (A) => {
5718
5852
  A.key === "Enter" && k();
5719
5853
  },
@@ -5724,24 +5858,24 @@ const BlockStylingProps = () => {
5724
5858
  const w = parseInt$1(A.target.value);
5725
5859
  let E = isNaN$1(w) ? 0 : w;
5726
5860
  A.keyCode === 38 && (E += 1), A.keyCode === 40 && (E -= 1);
5727
- const L = `${E}`, P = `${L.startsWith("-") ? "-" : ""}${d}[${L.replace("-", "")}${g === "-" ? "" : g}]`;
5728
- C(P);
5861
+ const L = `${E}`, P = `${L.startsWith("-") ? "-" : ""}${d}[${L.replace("-", "")}${m === "-" ? "" : m}]`;
5862
+ S(P);
5729
5863
  },
5730
5864
  onKeyUp: (A) => {
5731
- B && (A.preventDefault(), _(!1));
5865
+ j && (A.preventDefault(), _(!1));
5732
5866
  },
5733
5867
  onBlur: () => k(),
5734
5868
  onChange: (A) => {
5735
- x(!1), l(A.target.value);
5869
+ f(!1), l(A.target.value);
5736
5870
  },
5737
5871
  onClick: (A) => {
5738
5872
  var w;
5739
5873
  (w = A == null ? void 0 : A.target) == null || w.select(), r(!1);
5740
5874
  },
5741
- value: S ? b : a,
5875
+ value: C ? b : a,
5742
5876
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
5743
5877
  " ",
5744
- f ? "border-red-500 text-red-500" : "border-foreground/20"
5878
+ x ? "border-red-500 text-red-500" : "border-foreground/20"
5745
5879
  )
5746
5880
  }
5747
5881
  ),
@@ -5753,7 +5887,7 @@ const BlockStylingProps = () => {
5753
5887
  onClick: () => r(!n),
5754
5888
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
5755
5889
  children: [
5756
- /* @__PURE__ */ jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: g }),
5890
+ /* @__PURE__ */ jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: m }),
5757
5891
  u.length > 1 ? /* @__PURE__ */ jsx(TriangleDownIcon, {}) : null
5758
5892
  ]
5759
5893
  }
@@ -5762,7 +5896,7 @@ const BlockStylingProps = () => {
5762
5896
  UnitSelection,
5763
5897
  {
5764
5898
  units: u,
5765
- current: g,
5899
+ current: m,
5766
5900
  onSelect: (A) => {
5767
5901
  r(!1), h(A), I(A);
5768
5902
  }
@@ -5770,26 +5904,26 @@ const BlockStylingProps = () => {
5770
5904
  ) })
5771
5905
  ] })
5772
5906
  ] }),
5773
- ["none", "auto"].indexOf(g) !== -1 || S ? null : /* @__PURE__ */ jsx(
5907
+ ["none", "auto"].indexOf(m) !== -1 || C ? null : /* @__PURE__ */ jsx(
5774
5908
  DragStyleButton,
5775
5909
  {
5776
5910
  onDragStart: () => v(!0),
5777
5911
  onDragEnd: (A) => {
5778
5912
  if (y(() => ""), v(!1), isEmpty(A))
5779
5913
  return;
5780
- const w = `${A}`, L = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${g === "-" ? "" : g}]`;
5781
- j(L);
5914
+ const w = `${A}`, L = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${m === "-" ? "" : m}]`;
5915
+ B(L);
5782
5916
  },
5783
5917
  onDrag: (A) => {
5784
5918
  if (isEmpty(A))
5785
5919
  return;
5786
5920
  y(A);
5787
- const w = `${A}`, L = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${g === "-" ? "" : g}]`;
5788
- C(L);
5921
+ const w = `${A}`, L = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${m === "-" ? "" : m}]`;
5922
+ S(L);
5789
5923
  },
5790
5924
  currentValue: a,
5791
- unit: g,
5792
- negative: m,
5925
+ unit: m,
5926
+ negative: g,
5793
5927
  cssProperty: p
5794
5928
  }
5795
5929
  )
@@ -5848,7 +5982,7 @@ const COLOR_PROP = {
5848
5982
  ringColor: "ring",
5849
5983
  ringOffsetColor: "ring-offset"
5850
5984
  }, ColorChoice = ({ property: o, onChange: n }) => {
5851
- 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("-"), m = get(u, "1", ""), g = get(u, "2", ""), h = useCallback(
5985
+ 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(
5852
5986
  // eslint-disable-next-line no-shadow
5853
5987
  (b) => {
5854
5988
  ["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), p({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((y) => ({ ...y, color: b, shade: y.shade ? y.shade : "500" })));
@@ -5856,31 +5990,31 @@ const COLOR_PROP = {
5856
5990
  [c, p]
5857
5991
  );
5858
5992
  useEffect(() => {
5859
- if (["current", "inherit", "transparent", "black", "white"].includes(m))
5993
+ if (["current", "inherit", "transparent", "black", "white"].includes(g))
5860
5994
  return c([]);
5861
5995
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
5862
- }, [m]);
5863
- const f = useCallback(
5996
+ }, [g]);
5997
+ const x = useCallback(
5864
5998
  // eslint-disable-next-line no-shadow
5865
5999
  (b) => {
5866
- p({ color: m, shade: b });
6000
+ p({ color: g, shade: b });
5867
6001
  },
5868
- [m]
6002
+ [g]
5869
6003
  );
5870
6004
  useEffect(() => {
5871
6005
  p({ color: "", shade: "" });
5872
6006
  }, [r]);
5873
- const { match: x } = useTailwindClassList();
6007
+ const { match: f } = useTailwindClassList();
5874
6008
  return useEffect(() => {
5875
6009
  const y = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
5876
- x(o, y) && n(y, o);
5877
- }, [x, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
6010
+ f(o, y) && n(y, o);
6011
+ }, [f, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
5878
6012
  /* @__PURE__ */ jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsx(
5879
6013
  DropDown,
5880
6014
  {
5881
6015
  disabled: !l,
5882
6016
  rounded: !0,
5883
- selected: m,
6017
+ selected: g,
5884
6018
  onChange: h,
5885
6019
  options: [
5886
6020
  "current",
@@ -5914,7 +6048,7 @@ const COLOR_PROP = {
5914
6048
  ]
5915
6049
  }
5916
6050
  ) }),
5917
- /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: g, disabled: !m || !l, onChange: f, options: i }) })
6051
+ /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange: x, options: i }) })
5918
6052
  ] });
5919
6053
  }, EDITOR_ICONS = {
5920
6054
  "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" }) }),
@@ -6248,41 +6382,41 @@ const COLOR_PROP = {
6248
6382
  "2xl": "1536px"
6249
6383
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6250
6384
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6251
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, m] = useScreenSizeWidth(), g = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), b = useMemo(() => get(g, "fullCls", ""), [g]), y = useCallback(
6252
- (C, k = !0) => {
6253
- const I = { dark: p, mq: m, mod: u, cls: C, property: l, fullCls: "" };
6385
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), b = useMemo(() => get(m, "fullCls", ""), [m]), y = useCallback(
6386
+ (S, k = !0) => {
6387
+ const I = { dark: p, mq: g, mod: u, cls: S, property: l, fullCls: "" };
6254
6388
  (p || u !== "") && (I.mq = "xs");
6255
6389
  const A = generateFullClsName(I);
6256
- h(x, [A], k);
6390
+ h(f, [A], k);
6257
6391
  },
6258
- [x, p, m, u, l, h]
6259
- ), S = useCallback(() => {
6260
- f(x, [b], !0);
6261
- }, [x, b, f]), v = useMemo(() => canChangeClass(g, m), [g, m]);
6392
+ [f, p, g, u, l, h]
6393
+ ), C = useCallback(() => {
6394
+ x(f, [b], !0);
6395
+ }, [f, b, x]), v = useMemo(() => canChangeClass(m, g), [m, g]);
6262
6396
  useEffect(() => {
6263
- i(v, g);
6264
- }, [v, i, g]);
6265
- const [, , B] = useScreenSizeWidth(), _ = useCallback(
6266
- (C) => {
6267
- B({
6397
+ i(v, m);
6398
+ }, [v, i, m]);
6399
+ const [, , j] = useScreenSizeWidth(), _ = useCallback(
6400
+ (S) => {
6401
+ j({
6268
6402
  xs: 400,
6269
6403
  sm: 640,
6270
6404
  md: 800,
6271
6405
  lg: 1024,
6272
6406
  xl: 1420,
6273
6407
  "2xl": 1920
6274
- }[C]);
6408
+ }[S]);
6275
6409
  },
6276
- [B]
6277
- ), j = get(g, "dark", null) === p && get(g, "mod", null) === u && get(g, "mq", null) === m;
6278
- return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: v, canReset: g && j, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6279
- /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${g && !j ? "text-foreground" : ""}`, children: n(a) }) }),
6410
+ [j]
6411
+ ), B = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
6412
+ return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: v, canReset: m && B, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6413
+ /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !B ? "text-foreground" : ""}`, children: n(a) }) }),
6280
6414
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
6281
6415
  /* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
6282
6416
  r === "arbitrary" ? /* @__PURE__ */ jsx(
6283
6417
  AdvanceChoices,
6284
6418
  {
6285
- currentClass: get(g, "cls", ""),
6419
+ currentClass: get(m, "cls", ""),
6286
6420
  classPrefix: get(CLASS_PREFIXES, l, ""),
6287
6421
  units: c || [],
6288
6422
  onChange: y,
@@ -6295,7 +6429,7 @@ const COLOR_PROP = {
6295
6429
  r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: y }),
6296
6430
  r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: y })
6297
6431
  ] }),
6298
- /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: j ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => S(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : v && g ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
6432
+ /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: B ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => C(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : v && m ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
6299
6433
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
6300
6434
  "button",
6301
6435
  {
@@ -6307,19 +6441,19 @@ const COLOR_PROP = {
6307
6441
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxs("div", { children: [
6308
6442
  "Current style is set at  ",
6309
6443
  /* @__PURE__ */ jsxs("span", { className: "font-bold", children: [
6310
- getBreakpoint(get(g, "mq")),
6311
- p && !g.dark ? "(Light mode)" : ""
6444
+ getBreakpoint(get(m, "mq")),
6445
+ p && !m.dark ? "(Light mode)" : ""
6312
6446
  ] }),
6313
6447
  /* @__PURE__ */ jsx("br", {}),
6314
6448
  /* @__PURE__ */ jsxs(
6315
6449
  "button",
6316
6450
  {
6317
6451
  type: "button",
6318
- onClick: () => _(get(g, "mq")),
6452
+ onClick: () => _(get(m, "mq")),
6319
6453
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6320
6454
  children: [
6321
6455
  "Switch to ",
6322
- get(g, "mq").toUpperCase()
6456
+ get(m, "mq").toUpperCase()
6323
6457
  ]
6324
6458
  }
6325
6459
  )
@@ -6336,7 +6470,7 @@ const COLOR_PROP = {
6336
6470
  units: i = basicUnits,
6337
6471
  negative: c = !1
6338
6472
  }) => {
6339
- const { t: d } = useTranslation(), [p, u] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), g = useCallback((h) => map(m, "property").includes(h), [m]);
6473
+ const { t: d } = useTranslation(), [p, u] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), m = useCallback((h) => map(g, "property").includes(h), [g]);
6340
6474
  return /* @__PURE__ */ jsxs(
6341
6475
  "div",
6342
6476
  {
@@ -6344,23 +6478,23 @@ const COLOR_PROP = {
6344
6478
  children: [
6345
6479
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
6346
6480
  o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
6347
- /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: h, key: f }, x) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
6481
+ /* @__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: [
6348
6482
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
6349
6483
  "button",
6350
6484
  {
6351
6485
  type: "button",
6352
- onClick: () => u(f),
6353
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${f === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6486
+ onClick: () => u(x),
6487
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${x === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6354
6488
  children: [
6355
6489
  React__default.createElement("div", {
6356
- className: g(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6490
+ className: m(x) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6357
6491
  }),
6358
- React__default.createElement(get(EDITOR_ICONS, f, BoxIcon), { className: "text-inherit w-3 h-3" })
6492
+ React__default.createElement(get(EDITOR_ICONS, x, BoxIcon), { className: "text-inherit w-3 h-3" })
6359
6493
  ]
6360
6494
  }
6361
6495
  ) }),
6362
6496
  /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(h)) })
6363
- ] }) }, `option-${x}`)) })
6497
+ ] }) }, `option-${f}`)) })
6364
6498
  ] }),
6365
6499
  /* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
6366
6500
  BlockStyle,
@@ -6484,7 +6618,7 @@ const COLOR_PROP = {
6484
6618
  icon: p,
6485
6619
  onClick: u
6486
6620
  }) => {
6487
- const { t: m } = useTranslation();
6621
+ const { t: g } = useTranslation();
6488
6622
  return r ? /* @__PURE__ */ jsxs(HoverCard, { openDelay: n, children: [
6489
6623
  /* @__PURE__ */ jsx(HoverCardTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
6490
6624
  Button,
@@ -6497,8 +6631,8 @@ const COLOR_PROP = {
6497
6631
  }
6498
6632
  ) }),
6499
6633
  /* @__PURE__ */ jsx(HoverCardContent, { className: "w-fit max-w-52 border-border", children: /* @__PURE__ */ jsx("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
6500
- /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold", children: m(a) }),
6501
- o && /* @__PURE__ */ jsx("p", { className: "text-xs", children: m(l) })
6634
+ /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold", children: g(a) }),
6635
+ o && /* @__PURE__ */ jsx("p", { className: "text-xs", children: g(l) })
6502
6636
  ] }) }) })
6503
6637
  ] }) : /* @__PURE__ */ jsx(
6504
6638
  Button,
@@ -6515,9 +6649,9 @@ const COLOR_PROP = {
6515
6649
  canvas: n = !1,
6516
6650
  tooltip: r = !0
6517
6651
  }) => {
6518
- const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, m = p, { t: g } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), f = (y) => {
6519
- u.includes(y) ? u.length > 2 && m(u.filter((S) => S !== y)) : m((S) => [...S, y]);
6520
- }, x = (y) => {
6652
+ const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (y) => {
6653
+ u.includes(y) ? u.length > 2 && g(u.filter((C) => C !== y)) : g((C) => [...C, y]);
6654
+ }, f = (y) => {
6521
6655
  n || l(y), c(y);
6522
6656
  }, b = getBreakpointValue(n ? i : a).toLowerCase();
6523
6657
  return h.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(h, (y) => /* @__PURE__ */ createElement(
@@ -6525,7 +6659,7 @@ const COLOR_PROP = {
6525
6659
  {
6526
6660
  canvas: n,
6527
6661
  ...y,
6528
- onClick: x,
6662
+ onClick: f,
6529
6663
  key: y.breakpoint,
6530
6664
  currentBreakpoint: b
6531
6665
  }
@@ -6539,7 +6673,7 @@ const COLOR_PROP = {
6539
6673
  openDelay: o,
6540
6674
  tooltip: r,
6541
6675
  ...y,
6542
- onClick: x,
6676
+ onClick: f,
6543
6677
  key: y.breakpoint,
6544
6678
  currentBreakpoint: b
6545
6679
  }
@@ -6548,15 +6682,15 @@ const COLOR_PROP = {
6548
6682
  /* @__PURE__ */ jsxs(DropdownMenu, { children: [
6549
6683
  /* @__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" }) }) }),
6550
6684
  /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56 border-border text-xs", children: [
6551
- /* @__PURE__ */ jsx(DropdownMenuLabel, { children: g("Screen sizes") }),
6685
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: m("Screen sizes") }),
6552
6686
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6553
6687
  map(h, (y) => /* @__PURE__ */ jsx(
6554
6688
  DropdownMenuCheckboxItem,
6555
6689
  {
6556
6690
  disabled: y.breakpoint === "xs",
6557
- onCheckedChange: () => f(toUpper(y.breakpoint)),
6691
+ onCheckedChange: () => x(toUpper(y.breakpoint)),
6558
6692
  checked: includes(u, toUpper(y.breakpoint)),
6559
- children: g(y.title)
6693
+ children: m(y.title)
6560
6694
  },
6561
6695
  y.breakpoint
6562
6696
  ))
@@ -6581,125 +6715,12 @@ function BreakpointSelector() {
6581
6715
  ] }) }) })
6582
6716
  ] });
6583
6717
  }
6584
- const SECONDS = 10;
6585
- function Countdown() {
6586
- const [o, n] = useState(SECONDS), [r, a] = useState(!1);
6587
- useEffect(() => {
6588
- if (r && o > 0) {
6589
- const p = setTimeout(() => {
6590
- n(o - 0.1);
6591
- }, 100);
6592
- return () => clearTimeout(p);
6593
- } else o <= 0 && (a(!1), n(SECONDS));
6594
- }, [r, o]);
6595
- const l = () => {
6596
- a(!0), n(SECONDS);
6597
- };
6598
- useEffect(() => {
6599
- o === SECONDS && l();
6600
- }, [o]);
6601
- const i = 18, c = 2 * Math.PI * i, d = c * (1 - (SECONDS - o) / SECONDS);
6602
- return /* @__PURE__ */ jsxs("div", { className: "relative h-4 w-4", children: [
6603
- /* @__PURE__ */ jsxs("svg", { className: "h-full w-full", viewBox: "0 0 40 40", children: [
6604
- /* @__PURE__ */ jsx(
6605
- "circle",
6606
- {
6607
- className: "text-gray-300",
6608
- strokeWidth: "4",
6609
- stroke: "currentColor",
6610
- fill: "transparent",
6611
- r: i,
6612
- cx: "20",
6613
- cy: "20"
6614
- }
6615
- ),
6616
- /* @__PURE__ */ jsx(
6617
- "circle",
6618
- {
6619
- className: "text-blue-600",
6620
- strokeWidth: "4",
6621
- strokeDasharray: c,
6622
- strokeDashoffset: d,
6623
- strokeLinecap: "round",
6624
- stroke: "currentColor",
6625
- fill: "transparent",
6626
- r: i,
6627
- cx: "20",
6628
- cy: "20"
6629
- }
6630
- )
6631
- ] }),
6632
- /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold", children: " " }) })
6633
- ] });
6634
- }
6635
- const AskAIStyles = ({ blockId: o }) => {
6636
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), [u, m] = useState();
6637
- useEffect(() => {
6638
- var h;
6639
- (h = d.current) == null || h.focus();
6640
- }, []);
6641
- const g = (h) => {
6642
- const { usage: f } = h || {};
6643
- !l && f && m(f), p.current = setTimeout(() => m(void 0), 1e4), l || c("");
6644
- };
6645
- return /* @__PURE__ */ jsxs("div", { className: "", children: [
6646
- /* @__PURE__ */ jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
6647
- /* @__PURE__ */ jsx(
6648
- Textarea,
6649
- {
6650
- ref: d,
6651
- value: i,
6652
- onChange: (h) => c(h.target.value),
6653
- placeholder: n("Ask AI to edit styles"),
6654
- className: "no-scrollbar my-2 w-full border border-border p-2 text-xs",
6655
- rows: 4,
6656
- onKeyDown: (h) => {
6657
- h.key === "Enter" && (h.preventDefault(), p.current && clearTimeout(p.current), m(void 0), r("styles", o, i, g));
6658
- }
6659
- }
6660
- ),
6661
- /* @__PURE__ */ jsxs("div", { className: "my-2 flex items-center gap-2", children: [
6662
- a ? null : /* @__PURE__ */ jsx(
6663
- Button,
6664
- {
6665
- disabled: i.trim().length < 5 || a,
6666
- onClick: () => {
6667
- p.current && clearTimeout(p.current), m(void 0), r("styles", o, i, g);
6668
- },
6669
- variant: "default",
6670
- className: "w-fit",
6671
- size: "sm",
6672
- children: a ? /* @__PURE__ */ jsxs(Fragment, { children: [
6673
- /* @__PURE__ */ jsx(ReloadIcon, { className: "h-5 w-5 animate-spin" }),
6674
- n("Generating... Please wait...")
6675
- ] }) : n("Edit with AI")
6676
- }
6677
- ),
6678
- a ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
6679
- /* @__PURE__ */ jsxs(Skeleton, { className: "flex w-full items-center space-x-1 px-4 py-1 pl-2", children: [
6680
- /* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4 animate-spin text-gray-500" }),
6681
- /* @__PURE__ */ jsx("p", { className: "text-xs", children: n("Generating... Please wait...") })
6682
- ] }),
6683
- /* @__PURE__ */ jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
6684
- ] }) : null
6685
- ] }),
6686
- u ? /* @__PURE__ */ jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
6687
- /* @__PURE__ */ jsxs("span", { children: [
6688
- n("Total tokens used"),
6689
- ": ",
6690
- u.totalTokens
6691
- ] }),
6692
- /* @__PURE__ */ jsx(Countdown, {})
6693
- ] }) }) : null,
6694
- /* @__PURE__ */ jsx("div", { className: "max-w-full", children: l && /* @__PURE__ */ jsx("p", { className: "break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500", children: l.message }) })
6695
- ] });
6696
- }, AiIcon = ({ className: o = "h-full w-full" }) => /* @__PURE__ */ jsx("svg", { className: o, viewBox: "0 0 256 256", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "m198.39 128.986-52.16-19.216-19.216-52.16a16 16 0 0 0-30.028 0L77.77 109.77l-52.16 19.216a16 16 0 0 0 0 30.028l52.16 19.216 19.216 52.16a16 16 0 0 0 30.028 0l19.216-52.16 52.16-19.216a16 16 0 0 0 0-30.028m-57.69 34.23a15.97 15.97 0 0 0-9.483 9.483l-19.22 52.152-19.214-52.15a15.97 15.97 0 0 0-9.482-9.484l-52.152-19.22 52.15-19.214a15.97 15.97 0 0 0 9.484-9.482l19.22-52.152 19.214 52.15a15.97 15.97 0 0 0 9.482 9.484l52.152 19.22ZM144 40a8 8 0 0 1 8-8h16V16a8 8 0 0 1 16 0v16h16a8 8 0 0 1 0 16h-16v16a8 8 0 0 1-16 0V48h-16a8 8 0 0 1-8-8m104 48a8 8 0 0 1-8 8h-8v8a8 8 0 0 1-16 0v-8h-8a8 8 0 0 1 0-16h8v-8a8 8 0 0 1 16 0v8h8a8 8 0 0 1 8 8" }) });
6697
6718
  function ManualClasses() {
6698
6719
  var L;
6699
- const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), m = useRemoveClassesFromBlocks(), [g] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), b = (L = first(d)) == null ? void 0 : L.prop, { classes: y } = getSplitChaiClasses(get(p, b, "")), S = y.split(" ").filter((T) => !isEmpty(T)), v = () => {
6700
- const T = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6701
- u(g, T, !0), x("");
6702
- }, [B, _] = useState([]), j = ({ value: T }) => {
6720
+ 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, x] = useState(""), f = (L = first(d)) == null ? void 0 : L.prop, { classes: b } = getSplitChaiClasses(get(p, f, "")), y = b.split(" ").filter((T) => !isEmpty(T)), C = useBuilderProp("flags.useClipboard", !1), v = () => {
6721
+ const T = h.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6722
+ u(m, T, !0), x("");
6723
+ }, [j, _] = useState([]), B = ({ value: T }) => {
6703
6724
  const P = T.trim().toLowerCase(), R = P.match(/.+:/g);
6704
6725
  let D = [];
6705
6726
  if (R && R.length > 0) {
@@ -6711,7 +6732,7 @@ function ManualClasses() {
6711
6732
  } else
6712
6733
  D = i.search(P);
6713
6734
  return _(map(D, "item"));
6714
- }, C = () => {
6735
+ }, S = () => {
6715
6736
  _([]);
6716
6737
  }, k = (T) => T.name, I = (T) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: T.name }), A = useMemo(
6717
6738
  () => ({
@@ -6721,54 +6742,45 @@ function ManualClasses() {
6721
6742
  autoCapitalize: "off",
6722
6743
  spellCheck: !1,
6723
6744
  placeholder: c("Enter classes separated by space"),
6724
- value: f,
6745
+ value: h,
6725
6746
  onFocus: (T) => {
6726
6747
  setTimeout(() => {
6727
6748
  T.target && T.target.select();
6728
6749
  }, 0);
6729
6750
  },
6730
6751
  onKeyDown: (T) => {
6731
- T.key === "Enter" && f.trim() !== "" && v();
6752
+ T.key === "Enter" && h.trim() !== "" && v();
6732
6753
  },
6733
6754
  onChange: (T, { newValue: P }) => x(P),
6734
6755
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
6735
6756
  }),
6736
- [f, c, o]
6757
+ [h, c, o]
6737
6758
  ), w = (T) => {
6738
6759
  debugger;
6739
6760
  const P = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6740
- m(g, [T]), u(g, P, !0), r(""), l(-1);
6761
+ g(m, [T]), u(m, P, !0), r(""), l(-1);
6741
6762
  }, E = () => {
6742
6763
  if (navigator.clipboard === void 0) {
6743
6764
  toast.error(c("Clipboard not supported"));
6744
6765
  return;
6745
6766
  }
6746
- navigator.clipboard.writeText(S.join(" ")), toast.success(c("Classes copied to clipboard"));
6767
+ navigator.clipboard.writeText(y.join(" ")), toast.success(c("Classes copied to clipboard"));
6747
6768
  };
6748
6769
  return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-1.5 border-b border-border pb-4", children: [
6749
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
6750
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
6751
- /* @__PURE__ */ jsx("span", { children: c("Classes") }),
6752
- /* @__PURE__ */ jsxs(Tooltip, { children: [
6753
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: E, className: "cursor-pointer" }) }),
6754
- /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: c("Copy classes to clipboard") }) })
6755
- ] })
6756
- ] }),
6757
- h ? /* @__PURE__ */ jsxs(Popover, { children: [
6758
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { variant: "default", className: "h-6 w-fit", size: "sm", children: [
6759
- /* @__PURE__ */ jsx(AiIcon, { className: "h-4 w-4" }),
6760
- /* @__PURE__ */ jsx("span", { className: "ml-2", children: c("Ask AI") })
6761
- ] }) }),
6762
- /* @__PURE__ */ jsx(PopoverContent, { side: "left", className: "p-2", children: /* @__PURE__ */ jsx(AskAIStyles, { blockId: p == null ? void 0 : p._id }) })
6763
- ] }) : null
6764
- ] }),
6770
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-x-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
6771
+ /* @__PURE__ */ jsx("span", { children: c("Classes") }),
6772
+ C && /* @__PURE__ */ jsxs(Tooltip, { children: [
6773
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: E, className: "cursor-pointer" }) }),
6774
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: c("Copy classes to clipboard") }) })
6775
+ ] })
6776
+ ] }) }),
6765
6777
  /* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-x-3", children: [
6766
6778
  /* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
6767
6779
  Autosuggest,
6768
6780
  {
6769
- suggestions: B,
6770
- onSuggestionsFetchRequested: j,
6771
- onSuggestionsClearRequested: C,
6781
+ suggestions: j,
6782
+ onSuggestionsFetchRequested: B,
6783
+ onSuggestionsClearRequested: S,
6772
6784
  getSuggestionValue: k,
6773
6785
  renderSuggestion: I,
6774
6786
  inputProps: A,
@@ -6788,13 +6800,13 @@ function ManualClasses() {
6788
6800
  variant: "outline",
6789
6801
  className: "h-6 border-border",
6790
6802
  onClick: v,
6791
- disabled: f.trim() === "",
6803
+ disabled: h.trim() === "",
6792
6804
  size: "sm",
6793
6805
  children: /* @__PURE__ */ jsx(PlusIcon, {})
6794
6806
  }
6795
6807
  )
6796
6808
  ] }),
6797
- /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: S.map(
6809
+ /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: y.map(
6798
6810
  (T, P) => a === P ? /* @__PURE__ */ jsx(
6799
6811
  "input",
6800
6812
  {
@@ -6819,7 +6831,7 @@ function ManualClasses() {
6819
6831
  "button",
6820
6832
  {
6821
6833
  onDoubleClick: () => {
6822
- x(T), m(g, [T]), setTimeout(() => {
6834
+ x(T), g(m, [T]), setTimeout(() => {
6823
6835
  o.current && o.current.focus();
6824
6836
  }, 10);
6825
6837
  },
@@ -6829,7 +6841,7 @@ function ManualClasses() {
6829
6841
  /* @__PURE__ */ jsx(
6830
6842
  Cross2Icon,
6831
6843
  {
6832
- onClick: () => m(g, [T], !0),
6844
+ onClick: () => g(m, [T], !0),
6833
6845
  className: "hidden h-max w-3.5 cursor-pointer rounded bg-gray-100 p-0.5 text-red-500 hover:bg-gray-50 group-hover:block"
6834
6846
  }
6835
6847
  ),
@@ -6972,13 +6984,13 @@ function BlockStyling() {
6972
6984
  cssProperty: ""
6973
6985
  }), d = useThrottledCallback(
6974
6986
  (u) => {
6975
- const m = !get(i, "negative", !1), g = get(i, "cssProperty", "");
6987
+ const g = !get(i, "negative", !1), m = get(i, "cssProperty", "");
6976
6988
  let h = parseFloat(i.dragStartValue);
6977
6989
  h = isNaN(h) ? 0 : h;
6978
- let f = MAPPER[i.dragUnit];
6979
- (startsWith(g, "scale") || g === "opacity") && (f = 10);
6980
- let b = (i.dragStartY - u.pageY) / f + h;
6981
- m && b < 0 && (b = 0), g === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
6990
+ let x = MAPPER[i.dragUnit];
6991
+ (startsWith(m, "scale") || m === "opacity") && (x = 10);
6992
+ let b = (i.dragStartY - u.pageY) / x + h;
6993
+ g && b < 0 && (b = 0), m === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
6982
6994
  },
6983
6995
  [i],
6984
6996
  50
@@ -7019,14 +7031,14 @@ const CoreBlock = ({
7019
7031
  parentId: r,
7020
7032
  position: a
7021
7033
  }) => {
7022
- const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, m] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = () => {
7034
+ const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, g] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), h = () => {
7023
7035
  if (has(o, "blocks")) {
7024
7036
  const b = isFunction(o.blocks) ? o.blocks() : o.blocks;
7025
7037
  u(syncBlocksWithDefaults(b), r || null, a);
7026
7038
  } else
7027
7039
  p(o, r || null, a);
7028
7040
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7029
- }, f = useFeature("dnd"), { t: x } = useTranslation();
7041
+ }, x = useFeature("dnd"), { t: f } = useTranslation();
7030
7042
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
7031
7043
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
7032
7044
  "button",
@@ -7036,18 +7048,18 @@ const CoreBlock = ({
7036
7048
  type: "button",
7037
7049
  onDragStart: (b) => {
7038
7050
  b.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), b.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
7039
- m([]), g();
7051
+ g([]), m();
7040
7052
  }, 200);
7041
7053
  },
7042
- draggable: f ? "true" : "false",
7054
+ draggable: x ? "true" : "false",
7043
7055
  className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
7044
7056
  children: [
7045
7057
  createElement(c || BoxIcon, { className: "w-4 h-4 mx-auto" }),
7046
- /* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(x(d || i)) })
7058
+ /* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(f(d || i)) })
7047
7059
  ]
7048
7060
  }
7049
7061
  ) }),
7050
- /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: x(d || i) }) })
7062
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: f(d || i) }) })
7051
7063
  ] }) });
7052
7064
  }, DefaultChaiBlocks = ({
7053
7065
  parentId: o,
@@ -7072,8 +7084,8 @@ const registerChaiPreImportHTMLHook = (o) => {
7072
7084
  }, getPreImportHTML = async (o) => await PRE_IMPORT_HTML_HOOK(o), ImportHTML = ({ parentId: o, position: n }) => {
7073
7085
  const { t: r } = useTranslation(), [a, l] = useState(""), { addPredefinedBlock: i } = useAddBlock(), [c, d] = useState(!1), p = async () => {
7074
7086
  d(!0);
7075
- const u = await getPreImportHTML(a), m = getBlocksFromHTML(u);
7076
- i([...m], o, n), l(""), d(!1), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7087
+ const u = await getPreImportHTML(a), g = getBlocksFromHTML(u);
7088
+ i([...g], o, n), l(""), d(!1), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7077
7089
  };
7078
7090
  return /* @__PURE__ */ jsxs(Card, { className: "border-border/0 p-0 shadow-none", children: [
7079
7091
  /* @__PURE__ */ jsx(CardHeader, { className: "p-3", children: /* @__PURE__ */ jsx(CardDescription, { children: r("Use HTML snippets from Tailwind CSS component libraries") }) }),
@@ -7108,8 +7120,8 @@ const registerChaiPreImportHTMLHook = (o) => {
7108
7120
  height: i = ""
7109
7121
  }) => {
7110
7122
  const [c, d] = useState(o), p = (u) => {
7111
- const m = u.target.value;
7112
- d(m), n(m);
7123
+ const g = u.target.value;
7124
+ d(g), n(g);
7113
7125
  };
7114
7126
  return /* @__PURE__ */ jsx("div", { className: cn$1("relative inline-block w-full", l), children: /* @__PURE__ */ jsxs(
7115
7127
  "select",
@@ -7158,9 +7170,9 @@ const registerChaiLibrary = (o, n) => {
7158
7170
  parentId: r = void 0,
7159
7171
  position: a = -1
7160
7172
  }) => {
7161
- const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = get(o, "name", get(o, "label")), h = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), b = (v) => {
7162
- const B = has(v, "styles_attrs.data-page-section");
7163
- return v._type === "Box" && B;
7173
+ 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), b = (v) => {
7174
+ const j = has(v, "styles_attrs.data-page-section");
7175
+ return v._type === "Box" && j;
7164
7176
  }, y = useCallback(
7165
7177
  async (v) => {
7166
7178
  if (v.stopPropagation(), has(o, "component")) {
@@ -7168,8 +7180,8 @@ const registerChaiLibrary = (o, n) => {
7168
7180
  return;
7169
7181
  }
7170
7182
  i(!0);
7171
- let B = await c({ library: n, block: o });
7172
- typeof B == "string" && (B = getBlocksFromHTML(B)), isEmpty(B) || p(syncBlocksWithDefaults(B), r, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7183
+ let j = await c({ library: n, block: o });
7184
+ typeof j == "string" && (j = getBlocksFromHTML(j)), isEmpty(j) || p(syncBlocksWithDefaults(j), r, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7173
7185
  },
7174
7186
  [d, p, o, c, n, r, a]
7175
7187
  );
@@ -7179,21 +7191,21 @@ const registerChaiLibrary = (o, n) => {
7179
7191
  {
7180
7192
  onClick: l ? () => {
7181
7193
  } : y,
7182
- draggable: f ? "true" : "false",
7194
+ draggable: x ? "true" : "false",
7183
7195
  onDragStart: async (v) => {
7184
- const B = await c({ library: n, block: o });
7196
+ const j = await c({ library: n, block: o });
7185
7197
  let _ = r;
7186
- if (b(first(B)) && (_ = null), !isEmpty(B)) {
7187
- const j = { blocks: B, uiLibrary: !0, parent: _ };
7188
- if (v.dataTransfer.setData("text/plain", JSON.stringify(j)), o.preview) {
7189
- const C = new Image();
7190
- C.src = o.preview, C.onload = () => {
7191
- v.dataTransfer.setDragImage(C, 0, 0);
7198
+ if (b(first(j)) && (_ = null), !isEmpty(j)) {
7199
+ const B = { blocks: j, uiLibrary: !0, parent: _ };
7200
+ if (v.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
7201
+ const S = new Image();
7202
+ S.src = o.preview, S.onload = () => {
7203
+ v.dataTransfer.setDragImage(S, 0, 0);
7192
7204
  };
7193
7205
  } else
7194
7206
  v.dataTransfer.setDragImage(new Image(), 0, 0);
7195
- x(j), setTimeout(() => {
7196
- u([]), m(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7207
+ f(B), setTimeout(() => {
7208
+ u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7197
7209
  }, 200);
7198
7210
  }
7199
7211
  },
@@ -7205,50 +7217,50 @@ const registerChaiLibrary = (o, n) => {
7205
7217
  /* @__PURE__ */ jsx(ReloadIcon, { className: "animate-spin h-4 w-4 text-white" }),
7206
7218
  /* @__PURE__ */ jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
7207
7219
  ] }),
7208
- o.preview ? /* @__PURE__ */ jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: g }) : /* @__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: [
7209
- /* @__PURE__ */ jsx("p", { className: "font-medium text-gray-800", children: g }),
7220
+ 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: [
7221
+ /* @__PURE__ */ jsx("p", { className: "font-medium text-gray-800", children: m }),
7210
7222
  h && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: h })
7211
7223
  ] })
7212
7224
  ]
7213
7225
  }
7214
7226
  ) }),
7215
- /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("div", { className: "max-w-xs", children: /* @__PURE__ */ jsx("p", { className: "font-medium", children: g }) }) })
7227
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("div", { className: "max-w-xs", children: /* @__PURE__ */ jsx("p", { className: "font-medium", children: m }) }) })
7216
7228
  ] });
7217
7229
  }, UILibrarySection = ({ parentId: o, position: n }) => {
7218
- const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((w) => w.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, m] = useState(""), [g, h] = useState([]), f = useRef(null);
7230
+ const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((w) => w.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [m, h] = useState([]), x = useRef(null);
7219
7231
  useEffect(() => {
7220
- c && c.length > 0 && (f.current = new Fuse(c, {
7232
+ c && c.length > 0 && (x.current = new Fuse(c, {
7221
7233
  keys: ["name", "label", "description", "group"],
7222
7234
  threshold: 0.4,
7223
7235
  ignoreLocation: !0
7224
7236
  }));
7225
7237
  }, [c]), useEffect(() => {
7226
- if (!u.trim() || !f.current) {
7238
+ if (!u.trim() || !x.current) {
7227
7239
  h([]);
7228
7240
  return;
7229
7241
  }
7230
- const w = f.current.search(u).map((E) => E.item);
7242
+ const w = x.current.search(u).map((E) => E.item);
7231
7243
  h(w);
7232
7244
  }, [u]);
7233
- const x = u.trim() && !isEmpty(g) ? g : c, b = groupBy(x, "group"), [y, S] = useState(null);
7245
+ const f = u.trim() && !isEmpty(m) ? m : c, b = groupBy(f, "group"), [y, C] = useState(null);
7234
7246
  useEffect(() => {
7235
7247
  if (isEmpty(keys(b))) {
7236
- S(null);
7248
+ C(null);
7237
7249
  return;
7238
7250
  }
7239
7251
  if (!y || !b[y]) {
7240
- S(first(keys(b)));
7252
+ C(first(keys(b)));
7241
7253
  return;
7242
7254
  }
7243
7255
  }, [b, y]);
7244
- const v = get(b, y, []), B = useRef(null), { t: _ } = useTranslation(), j = (w) => {
7245
- B.current && (clearTimeout(B.current), B.current = null), B.current = setTimeout(() => {
7246
- B.current && S(w);
7256
+ const v = get(b, y, []), j = useRef(null), { t: _ } = useTranslation(), B = (w) => {
7257
+ j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
7258
+ j.current && C(w);
7247
7259
  }, 400);
7248
- }, C = () => {
7260
+ }, S = () => {
7249
7261
  i != null && i.id && p(i.id);
7250
7262
  }, k = () => {
7251
- m("");
7263
+ g("");
7252
7264
  };
7253
7265
  if (d)
7254
7266
  return /* @__PURE__ */ jsxs("div", { className: "mt-4 grid h-full w-full grid-cols-12 gap-2", children: [
@@ -7264,7 +7276,7 @@ const registerChaiLibrary = (o, n) => {
7264
7276
  {
7265
7277
  placeholder: _("Search blocks..."),
7266
7278
  value: u,
7267
- onChange: (w) => m(w.target.value),
7279
+ onChange: (w) => g(w.target.value),
7268
7280
  className: "w-full pl-8 pr-8"
7269
7281
  }
7270
7282
  ),
@@ -7285,17 +7297,17 @@ const registerChaiLibrary = (o, n) => {
7285
7297
  /* @__PURE__ */ jsx("hr", { className: "mt-1 border-border" }),
7286
7298
  /* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: isEmpty(b) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: u ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: _("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
7287
7299
  /* @__PURE__ */ jsx("p", { className: "text-sm", children: _("Failed to load the UI library. Try again") }),
7288
- /* @__PURE__ */ jsxs(Button, { onClick: C, variant: "outline", size: "sm", className: "gap-2", children: [
7300
+ /* @__PURE__ */ jsxs(Button, { onClick: S, variant: "outline", size: "sm", className: "gap-2", children: [
7289
7301
  /* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4" }),
7290
7302
  _("Retry")
7291
7303
  ] })
7292
7304
  ] }) }) : map(b, (w, E) => /* @__PURE__ */ jsxs(
7293
7305
  "div",
7294
7306
  {
7295
- onMouseEnter: () => j(E),
7296
- onMouseLeave: () => clearTimeout(B.current),
7307
+ onMouseEnter: () => B(E),
7308
+ onMouseLeave: () => clearTimeout(j.current),
7297
7309
  role: "button",
7298
- onClick: () => S(E),
7310
+ onClick: () => C(E),
7299
7311
  className: cn$1(
7300
7312
  "flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
7301
7313
  E === y ? "bg-primary text-primary-foreground hover:bg-primary/80" : ""
@@ -7312,7 +7324,7 @@ const registerChaiLibrary = (o, n) => {
7312
7324
  /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-col border-l border-border", children: /* @__PURE__ */ jsxs(
7313
7325
  ScrollArea,
7314
7326
  {
7315
- onMouseEnter: () => B.current ? clearTimeout(B.current) : null,
7327
+ onMouseEnter: () => j.current ? clearTimeout(j.current) : null,
7316
7328
  className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
7317
7329
  children: [
7318
7330
  isEmpty(v) && !isEmpty(b) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: _("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
@@ -7359,7 +7371,7 @@ const registerChaiLibrary = (o, n) => {
7359
7371
  position: n,
7360
7372
  gridCols: r = "grid-cols-2"
7361
7373
  }) => {
7362
- const { data: a, isLoading: l, refetch: i, error: c } = usePartialBlocksList(), [d, p] = useAtom$1(partialBlocksDataAtom), [u, m] = useAtom$1(hasInitializedPartialBlocksAtom);
7374
+ const { data: a, isLoading: l, refetch: i, error: c } = usePartialBlocksList(), [d, p] = useAtom$1(partialBlocksDataAtom), [u, g] = useAtom$1(hasInitializedPartialBlocksAtom);
7363
7375
  useEffect(() => {
7364
7376
  if (!u || Object.keys(d.blocks).length === 0)
7365
7377
  if (c)
@@ -7368,54 +7380,54 @@ const registerChaiLibrary = (o, n) => {
7368
7380
  groups: [],
7369
7381
  isLoading: !1,
7370
7382
  error: c
7371
- }), m(!0);
7383
+ }), g(!0);
7372
7384
  else if (!l && Object.keys(a || {}).length > 0) {
7373
- const h = Object.entries(a).map(([x, b]) => {
7374
- const y = b, S = y.type || "partial", v = formatReadableName(S);
7385
+ const h = Object.entries(a).map(([f, b]) => {
7386
+ const y = b, C = y.type || "partial", v = formatReadableName(C);
7375
7387
  return {
7376
7388
  type: "PartialBlock",
7377
7389
  // Set the type to PartialBlock
7378
- label: formatReadableName(y.name || x),
7390
+ label: formatReadableName(y.name || f),
7379
7391
  description: y.description || "",
7380
7392
  icon: FrameIcon,
7381
7393
  group: v,
7382
7394
  // Use formatted type as group
7383
7395
  category: "partial",
7384
- partialBlockId: x,
7396
+ partialBlockId: f,
7385
7397
  // Store the original ID as partialBlockId
7386
7398
  _name: y.name
7387
7399
  };
7388
- }), f = uniq(map(h, "group"));
7400
+ }), x = uniq(map(h, "group"));
7389
7401
  p({
7390
7402
  blocks: h,
7391
- groups: f,
7403
+ groups: x,
7392
7404
  isLoading: !1,
7393
7405
  error: null
7394
- }), m(!0);
7406
+ }), g(!0);
7395
7407
  } else l ? p((h) => ({ ...h, isLoading: !0, error: null })) : !l && Object.keys(a || {}).length === 0 && (p({
7396
7408
  blocks: [],
7397
7409
  groups: [],
7398
7410
  isLoading: !1,
7399
7411
  error: "No partial blocks available"
7400
- }), m(!0));
7412
+ }), g(!0));
7401
7413
  }, [
7402
7414
  l,
7403
7415
  a,
7404
7416
  u,
7405
- m,
7417
+ g,
7406
7418
  p,
7407
7419
  d.blocks,
7408
7420
  c
7409
7421
  ]);
7410
- const g = () => {
7411
- p((h) => ({ ...h, isLoading: !0, error: null })), m(!1), i();
7422
+ const m = () => {
7423
+ p((h) => ({ ...h, isLoading: !0, error: null })), g(!1), i();
7412
7424
  };
7413
7425
  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: [
7414
7426
  /* @__PURE__ */ jsx("p", { children: d.error || "No partial blocks available" }),
7415
7427
  /* @__PURE__ */ jsx(
7416
7428
  "button",
7417
7429
  {
7418
- onClick: g,
7430
+ onClick: m,
7419
7431
  className: "rounded-md bg-primary px-3 py-1 text-sm text-primary-foreground hover:bg-primary/90",
7420
7432
  children: "Refresh"
7421
7433
  }
@@ -7434,26 +7446,26 @@ const registerChaiLibrary = (o, n) => {
7434
7446
  has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
7435
7447
  }, 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" }) => {
7436
7448
  var A;
7437
- const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [m] = useAtom$1(addBlockTabAtom), g = (A = find(c, (w) => w._id === r)) == null ? void 0 : A._type, [h, f] = useState("all"), [x, b] = useState(null), y = useRef(null);
7449
+ const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (A = find(c, (w) => w._id === r)) == null ? void 0 : A._type, [h, x] = useState("all"), [f, b] = useState(null), y = useRef(null);
7438
7450
  useEffect(() => {
7439
7451
  const w = setTimeout(() => {
7440
7452
  var E;
7441
7453
  (E = u.current) == null || E.focus();
7442
7454
  }, 0);
7443
7455
  return () => clearTimeout(w);
7444
- }, [m]), useEffect(() => {
7445
- d && (f("all"), b(null));
7456
+ }, [g]), useEffect(() => {
7457
+ d && (x("all"), b(null));
7446
7458
  }, [d]), useEffect(() => (y.current = debounce((w) => {
7447
- f(w);
7459
+ x(w);
7448
7460
  }, 500), () => {
7449
7461
  y.current && y.current.cancel();
7450
7462
  }), []);
7451
- const S = useCallback((w) => {
7463
+ const C = useCallback((w) => {
7452
7464
  b(w), y.current && y.current(w);
7453
7465
  }, []), v = useCallback(() => {
7454
7466
  b(null), y.current && y.current.cancel();
7455
- }, []), B = useCallback((w) => {
7456
- y.current && y.current.cancel(), f(w), b(null);
7467
+ }, []), j = useCallback((w) => {
7468
+ y.current && y.current.cancel(), x(w), b(null);
7457
7469
  }, []), _ = useMemo(
7458
7470
  () => d ? values(n).filter(
7459
7471
  (w) => {
@@ -7462,15 +7474,15 @@ const registerChaiLibrary = (o, n) => {
7462
7474
  }
7463
7475
  ) : n,
7464
7476
  [n, d]
7465
- ), j = useMemo(
7477
+ ), B = useMemo(
7466
7478
  () => d ? o.filter(
7467
7479
  (w) => reject(filter(values(_), { group: w }), { hidden: !0 }).length > 0
7468
7480
  ) : o.filter((w) => reject(filter(values(n), { group: w }), { hidden: !0 }).length > 0),
7469
7481
  [n, _, o, d]
7470
- ), C = useMemo(
7471
- () => sortBy(j, (w) => CORE_GROUPS.indexOf(w) === -1 ? 99 : CORE_GROUPS.indexOf(w)),
7472
- [j]
7473
- ), k = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), I = useMemo(() => h === "all" ? C : [h], [C, h]);
7482
+ ), S = useMemo(
7483
+ () => sortBy(B, (w) => CORE_GROUPS.indexOf(w) === -1 ? 99 : CORE_GROUPS.indexOf(w)),
7484
+ [B]
7485
+ ), k = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), I = useMemo(() => h === "all" ? S : [h], [S, h]);
7474
7486
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
7475
7487
  /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
7476
7488
  Input$1,
@@ -7484,31 +7496,31 @@ const registerChaiLibrary = (o, n) => {
7484
7496
  }
7485
7497
  ) }),
7486
7498
  /* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden", children: [
7487
- C.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
7499
+ S.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
7488
7500
  /* @__PURE__ */ jsx(
7489
7501
  "button",
7490
7502
  {
7491
- onClick: () => B("all"),
7492
- onMouseEnter: () => S("all"),
7503
+ onClick: () => j("all"),
7504
+ onMouseEnter: () => C("all"),
7493
7505
  onMouseLeave: v,
7494
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7506
+ 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"}`,
7495
7507
  children: i("All")
7496
7508
  },
7497
7509
  "sidebar-all"
7498
7510
  ),
7499
- C.map((w) => /* @__PURE__ */ jsx(
7511
+ S.map((w) => /* @__PURE__ */ jsx(
7500
7512
  "button",
7501
7513
  {
7502
- onClick: () => B(w),
7503
- onMouseEnter: () => S(w),
7514
+ onClick: () => j(w),
7515
+ onMouseEnter: () => C(w),
7504
7516
  onMouseLeave: v,
7505
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === w || x === w ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7517
+ className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === w || f === w ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7506
7518
  children: capitalize(i(w.toLowerCase()))
7507
7519
  },
7508
7520
  `sidebar-${w}`
7509
7521
  ))
7510
7522
  ] }) }) }),
7511
- /* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: j.length === 0 && d ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
7523
+ /* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: B.length === 0 && d ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
7512
7524
  i("No blocks found matching"),
7513
7525
  ' "',
7514
7526
  d,
@@ -7524,7 +7536,7 @@ const registerChaiLibrary = (o, n) => {
7524
7536
  parentId: r,
7525
7537
  position: a,
7526
7538
  block: E,
7527
- disabled: !canAcceptChildBlock(g, E.type) || !canBeNestedInside(g, E.type)
7539
+ disabled: !canAcceptChildBlock(m, E.type) || !canBeNestedInside(m, E.type)
7528
7540
  },
7529
7541
  E.type
7530
7542
  )) })
@@ -7537,13 +7549,13 @@ const registerChaiLibrary = (o, n) => {
7537
7549
  parentId: r = void 0,
7538
7550
  position: a = -1
7539
7551
  }) => {
7540
- const { t: l } = useTranslation(), [i, c] = useAtom$1(addBlockTabAtom), [, d] = useAtom$1(showPredefinedBlockCategoryAtom), p = useBuilderProp("importHTMLSupport", !0), { data: u } = usePartialBlocksList(), m = Object.keys(u || {}).length > 0, { hasPermission: g } = usePermissions();
7552
+ 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();
7541
7553
  useEffect(() => {
7542
- i === "partials" && !m && c("library");
7543
- }, [i, m, c]);
7554
+ i === "partials" && !g && c("library");
7555
+ }, [i, g, c]);
7544
7556
  const h = useCallback(() => {
7545
7557
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7546
- }, []), f = useChaiAddBlockTabs(), x = p && g(PERMISSIONS.IMPORT_HTML), y = useChaiLibraries().length > 0;
7558
+ }, []), x = useChaiAddBlockTabs(), f = p && m(PERMISSIONS.IMPORT_HTML), y = useChaiLibraries().length > 0;
7547
7559
  return useEffect(() => {
7548
7560
  i === "library" && !y && c("core");
7549
7561
  }, [i, y, c]), /* @__PURE__ */ jsxs("div", { className: cn$1("flex h-full w-full flex-col overflow-hidden", o), children: [
@@ -7554,8 +7566,8 @@ const registerChaiLibrary = (o, n) => {
7554
7566
  /* @__PURE__ */ jsxs(
7555
7567
  Tabs,
7556
7568
  {
7557
- onValueChange: (S) => {
7558
- d(""), c(S);
7569
+ onValueChange: (C) => {
7570
+ d(""), c(C);
7559
7571
  },
7560
7572
  value: i,
7561
7573
  className: "flex h-full max-h-full flex-col overflow-hidden",
@@ -7563,15 +7575,15 @@ const registerChaiLibrary = (o, n) => {
7563
7575
  /* @__PURE__ */ jsxs(TabsList, { className: "flex w-full items-center", children: [
7564
7576
  y && /* @__PURE__ */ jsx(TabsTrigger, { value: "library", children: l("Library") }),
7565
7577
  /* @__PURE__ */ jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
7566
- m && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
7567
- x ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
7568
- map(f, (S) => /* @__PURE__ */ jsx(TabsTrigger, { value: S.id, children: React__default.createElement(S.tab) }, `tab-add-block-${S.id}`))
7578
+ g && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
7579
+ f ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
7580
+ map(x, (C) => /* @__PURE__ */ jsx(TabsTrigger, { value: C.id, children: React__default.createElement(C.tab) }, `tab-add-block-${C.id}`))
7569
7581
  ] }),
7570
7582
  /* @__PURE__ */ jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
7571
7583
  y && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
7572
- m && /* @__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 }) }) }) }),
7573
- x ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
7574
- map(f, (S) => /* @__PURE__ */ jsx(TabsContent, { value: S.id, children: React__default.createElement(S.tabContent, { close: h, parentId: r, position: a }) }, `panel-add-block-${S.id}`))
7584
+ 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 }) }) }) }),
7585
+ 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,
7586
+ map(x, (C) => /* @__PURE__ */ jsx(TabsContent, { value: C.id, children: React__default.createElement(C.tabContent, { close: h, parentId: r, position: a }) }, `panel-add-block-${C.id}`))
7575
7587
  ]
7576
7588
  }
7577
7589
  )
@@ -7690,40 +7702,40 @@ const registerChaiSaveToLibrary = (o) => {
7690
7702
  " ",
7691
7703
  o("Unlink from library")
7692
7704
  ] });
7693
- }, CANNOT_COPY_BLOCKS = !navigator.clipboard, CopyPasteBlocks = () => {
7694
- const [o] = useBlocksStore(), [n] = useSelectedBlockIds(), { pasteBlocks: r } = usePasteBlocks(), [, a, l] = useCopyBlocks(), { t: i } = useTranslation(), c = useSelectedBlock(), d = useCallback(() => {
7695
- const p = n.map((u) => {
7696
- const m = o.find((g) => g._id === u);
7705
+ }, CopyPasteBlocks = () => {
7706
+ const [o] = useBlocksStore(), [n] = useSelectedBlockIds(), { pasteBlocks: r } = usePasteBlocks(), [, a, l] = useCopyBlocks(), { t: i } = useTranslation(), c = useSelectedBlock(), d = useBuilderProp("flags.useClipboard", !1), p = useCallback(() => {
7707
+ const u = n.map((g) => {
7708
+ const m = o.find((h) => h._id === g);
7697
7709
  return {
7698
- id: u,
7710
+ id: g,
7699
7711
  data: m
7700
7712
  };
7701
7713
  });
7702
- l(p.map((u) => u.id)) ? toast.warning("Partial blocks detected. Clone partial blocks?", {
7714
+ l(u.map((g) => g.id)) ? toast.warning("Partial blocks detected. Clone partial blocks?", {
7703
7715
  cancel: {
7704
7716
  label: i("No"),
7705
7717
  onClick: () => {
7706
- a(p.map((u) => u.id)), toast.dismiss();
7718
+ a(u.map((g) => g.id)), toast.dismiss();
7707
7719
  }
7708
7720
  },
7709
7721
  action: {
7710
7722
  label: i("Yes"),
7711
7723
  onClick: () => {
7712
7724
  a(
7713
- p.map((u) => u.id),
7725
+ u.map((g) => g.id),
7714
7726
  !0
7715
7727
  ), toast.dismiss();
7716
7728
  }
7717
7729
  },
7718
7730
  position: "top-center"
7719
- }) : a(p.map((u) => u.id));
7731
+ }) : a(u.map((g) => g.id));
7720
7732
  }, [n, o, a, l]);
7721
7733
  return /* @__PURE__ */ jsxs(Fragment, { children: [
7722
- !CANNOT_COPY_BLOCKS && /* @__PURE__ */ jsxs(
7734
+ d && /* @__PURE__ */ jsxs(
7723
7735
  DropdownMenuItem,
7724
7736
  {
7725
7737
  disabled: !canDuplicateBlock(c == null ? void 0 : c._type),
7726
- onClick: d,
7738
+ onClick: p,
7727
7739
  className: "flex items-center gap-x-4 text-xs",
7728
7740
  children: [
7729
7741
  /* @__PURE__ */ jsx(CopyIcon, {}),
@@ -7732,7 +7744,7 @@ const registerChaiSaveToLibrary = (o) => {
7732
7744
  ]
7733
7745
  }
7734
7746
  ),
7735
- /* @__PURE__ */ jsxs(
7747
+ d && /* @__PURE__ */ jsxs(
7736
7748
  DropdownMenuItem,
7737
7749
  {
7738
7750
  className: "flex items-center gap-x-4 text-xs",
@@ -7748,12 +7760,12 @@ const registerChaiSaveToLibrary = (o) => {
7748
7760
  )
7749
7761
  ] });
7750
7762
  }, CutBlocks = () => {
7751
- const [o] = useSelectedBlockIds(), [, n] = useCutBlockIds(), { t: r } = useTranslation();
7752
- return /* @__PURE__ */ jsxs(DropdownMenuItem, { className: "flex items-center gap-x-4 text-xs", onClick: () => n(o), children: [
7763
+ const [o] = useSelectedBlockIds(), [, n] = useCutBlockIds(), { t: r } = useTranslation(), a = useBuilderProp("flags", { useClipboard: !1 }).useClipboard;
7764
+ return /* @__PURE__ */ jsx(Fragment, { children: a && /* @__PURE__ */ jsxs(DropdownMenuItem, { className: "flex items-center gap-x-4 text-xs", onClick: () => n(o), children: [
7753
7765
  /* @__PURE__ */ jsx(ScissorsIcon, {}),
7754
7766
  " ",
7755
7767
  r("Cut")
7756
- ] });
7768
+ ] }) });
7757
7769
  }, RemoveBlocks = () => {
7758
7770
  const [o] = useSelectedBlockIds(), n = useRemoveBlocks(), r = useSelectedBlock(), { t: a } = useTranslation();
7759
7771
  return /* @__PURE__ */ jsxs(
@@ -7786,7 +7798,7 @@ const registerChaiSaveToLibrary = (o) => {
7786
7798
  }
7787
7799
  );
7788
7800
  }, BlockContextMenuContent = ({ node: o }) => {
7789
- const { t: n } = useTranslation(), [r] = useSelectedBlockIds(), a = useDuplicateBlocks(), l = useSelectedBlock(), { hasPermission: i } = usePermissions(), { librarySite: c } = useBuilderProp("_tempProps", { librarySite: !1 }), d = useCallback(() => {
7801
+ const { t: n } = useTranslation(), [r] = useSelectedBlockIds(), a = useDuplicateBlocks(), l = useSelectedBlock(), { hasPermission: i } = usePermissions(), { librarySite: c } = useBuilderProp("flags", { librarySite: !1 }), d = useCallback(() => {
7790
7802
  a(r);
7791
7803
  }, [r, a]), p = useMemo(() => has(l, "_libBlockId") && !isEmpty(l._libBlockId), [l == null ? void 0 : l._libBlockId]);
7792
7804
  return /* @__PURE__ */ jsxs(DropdownMenuContent, { side: "bottom", className: "border-border text-xs", children: [
@@ -7881,26 +7893,26 @@ const Input = ({ node: o }) => {
7881
7893
  var D;
7882
7894
  const { t: a } = useTranslation(), l = useUpdateBlocksProps(), [i] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
7883
7895
  let d = null;
7884
- const p = o.children.length > 0, { highlightBlock: u, clearHighlight: m } = useBlockHighlight(), { id: g, data: h, isSelected: f, willReceiveDrop: x, isDragging: b, isEditing: y, handleClick: S } = o, v = get(h, "_show", !0), B = (N) => {
7896
+ const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), { id: m, data: h, isSelected: x, willReceiveDrop: f, isDragging: b, isEditing: y, handleClick: C } = o, v = get(h, "_show", !0), j = (N) => {
7885
7897
  N.stopPropagation(), v && o.toggle();
7886
7898
  }, _ = (N) => {
7887
7899
  N.isInternal && (d = N.isOpen, N.isOpen && N.close());
7888
- }, j = (N) => {
7900
+ }, B = (N) => {
7889
7901
  N.isInternal && d !== null && (d ? N.open() : N.close(), d = null);
7890
- }, [C, k] = useAtom$1(currentAddSelection), I = () => {
7902
+ }, [S, k] = useAtom$1(currentAddSelection), I = () => {
7891
7903
  var N;
7892
7904
  A(), o.parent.isSelected || k((N = o == null ? void 0 : o.parent) == null ? void 0 : N.id);
7893
7905
  }, A = () => {
7894
7906
  k(null);
7895
7907
  }, w = (N) => {
7896
- A(), N.stopPropagation(), !o.isOpen && v && o.toggle(), S(N);
7908
+ A(), N.stopPropagation(), !o.isOpen && v && o.toggle(), C(N);
7897
7909
  };
7898
7910
  useEffect(() => {
7899
7911
  const N = setTimeout(() => {
7900
- x && !o.isOpen && !b && v && o.toggle();
7912
+ f && !o.isOpen && !b && v && o.toggle();
7901
7913
  }, 500);
7902
7914
  return () => clearTimeout(N);
7903
- }, [x, o, b]);
7915
+ }, [f, o, b]);
7904
7916
  const E = (N, O) => {
7905
7917
  const $ = i.contentDocument || i.contentWindow.document, M = $.querySelector(`[data-block-id=${N}]`);
7906
7918
  M && M.setAttribute("data-drop", O);
@@ -7911,7 +7923,7 @@ const Input = ({ node: o }) => {
7911
7923
  const O = get(o, "parent.id");
7912
7924
  O !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: O, position: N }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: N });
7913
7925
  };
7914
- if (g === ROOT_TEMP_KEY)
7926
+ if (m === ROOT_TEMP_KEY)
7915
7927
  return /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer", children: [
7916
7928
  /* @__PURE__ */ jsx("br", {}),
7917
7929
  c(PERMISSIONS.ADD_BLOCK) && /* @__PURE__ */ jsx(
@@ -7929,26 +7941,26 @@ const Input = ({ node: o }) => {
7929
7941
  ),
7930
7942
  /* @__PURE__ */ jsx("br", {})
7931
7943
  ] });
7932
- const { librarySite: T } = useBuilderProp("_tempProps", { librarySite: !1 }), P = useMemo(() => T && has(h, "_libBlockId") && !isEmpty(h._libBlockId) && (c(PERMISSIONS.CREATE_LIBRARY_BLOCK) || c(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [h, c, T]), R = useMemo(() => (h == null ? void 0 : h._type) === "PartialBlock" || (h == null ? void 0 : h._type) === "GlobalBlock", [h]);
7944
+ const { librarySite: T } = useBuilderProp("flags", { librarySite: !1 }), P = useMemo(() => T && has(h, "_libBlockId") && !isEmpty(h._libBlockId) && (c(PERMISSIONS.CREATE_LIBRARY_BLOCK) || c(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [h, c, T]), R = useMemo(() => (h == null ? void 0 : h._type) === "PartialBlock" || (h == null ? void 0 : h._type) === "GlobalBlock", [h]);
7933
7945
  return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
7934
7946
  "div",
7935
7947
  {
7936
- onMouseEnter: () => u(g),
7937
- onMouseLeave: () => m(),
7948
+ onMouseEnter: () => u(m),
7949
+ onMouseLeave: () => g(),
7938
7950
  onClick: w,
7939
7951
  style: n,
7940
- "data-node-id": g,
7952
+ "data-node-id": m,
7941
7953
  ref: r,
7942
7954
  onDragStart: () => _(o),
7943
- onDragEnd: () => j(o),
7955
+ onDragEnd: () => B(o),
7944
7956
  onDragOver: (N) => {
7945
- N.preventDefault(), E(g, "yes");
7957
+ N.preventDefault(), E(m, "yes");
7946
7958
  },
7947
7959
  onDragLeave: (N) => {
7948
- N.preventDefault(), E(g, "no");
7960
+ N.preventDefault(), E(m, "no");
7949
7961
  },
7950
7962
  onDrop: (N) => {
7951
- N.preventDefault(), E(g, "no");
7963
+ N.preventDefault(), E(m, "no");
7952
7964
  },
7953
7965
  children: [
7954
7966
  c(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((D = o == null ? void 0 : o.parent) == null ? void 0 : D.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
@@ -7968,12 +7980,12 @@ const Input = ({ node: o }) => {
7968
7980
  {
7969
7981
  className: cn(
7970
7982
  "group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 py-0 outline-none",
7971
- f ? "bg-primary/20" : "hover:bg-primary/10",
7972
- x && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
7973
- (o == null ? void 0 : o.id) === C ? "bg-primary/10" : "",
7983
+ x ? "bg-primary/20" : "hover:bg-primary/10",
7984
+ f && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
7985
+ (o == null ? void 0 : o.id) === S ? "bg-primary/10" : "",
7974
7986
  b && "opacity-20",
7975
7987
  v ? "" : "line-through opacity-50",
7976
- P && f && "bg-primary/20 text-primary"
7988
+ P && x && "bg-primary/20 text-primary"
7977
7989
  ),
7978
7990
  children: [
7979
7991
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -7981,7 +7993,7 @@ const Input = ({ node: o }) => {
7981
7993
  "div",
7982
7994
  {
7983
7995
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
7984
- children: p && /* @__PURE__ */ jsx("button", { onClick: B, type: "button", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }) })
7996
+ children: p && /* @__PURE__ */ jsx("button", { onClick: j, type: "button", children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-3 w-3" }) })
7985
7997
  }
7986
7998
  ),
7987
7999
  /* @__PURE__ */ jsxs(
@@ -7990,9 +8002,9 @@ const Input = ({ node: o }) => {
7990
8002
  className: cn(
7991
8003
  "leading-1 flex items-center",
7992
8004
  P && "text-orange-600/90",
7993
- P && f && "text-orange-800",
8005
+ P && x && "text-orange-800",
7994
8006
  R && "text-purple-600/90",
7995
- R && f && "text-purple-800"
8007
+ R && x && "text-purple-800"
7996
8008
  ),
7997
8009
  children: [
7998
8010
  /* @__PURE__ */ jsx(TypeIcon, { type: h == null ? void 0 : h._type }),
@@ -8015,7 +8027,7 @@ const Input = ({ node: o }) => {
8015
8027
  /* @__PURE__ */ jsx(
8016
8028
  TooltipTrigger,
8017
8029
  {
8018
- onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: g }),
8030
+ onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: m }),
8019
8031
  className: "cursor-pointer rounded bg-transparent p-px hover:bg-primary/10",
8020
8032
  asChild: !0,
8021
8033
  children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-4 w-4" })
@@ -8028,7 +8040,7 @@ const Input = ({ node: o }) => {
8028
8040
  TooltipTrigger,
8029
8041
  {
8030
8042
  onClick: (N) => {
8031
- N.stopPropagation(), l([g], { _show: !v }), o.isOpen && o.toggle();
8043
+ N.stopPropagation(), l([m], { _show: !v }), o.isOpen && o.toggle();
8032
8044
  },
8033
8045
  className: "cursor-pointer rounded bg-transparent p-0.5 hover:bg-primary/10",
8034
8046
  asChild: !0,
@@ -8037,7 +8049,7 @@ const Input = ({ node: o }) => {
8037
8049
  ),
8038
8050
  /* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999] text-xs", side: "bottom", children: a(v ? "Hide the block from page" : "Show the block on page") })
8039
8051
  ] }),
8040
- /* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: g, children: /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded bg-transparent p-px hover:bg-primary/10", children: /* @__PURE__ */ jsx(DotsVerticalIcon, { className: "h-3 w-3" }) }) })
8052
+ /* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: m, children: /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded bg-transparent p-px hover:bg-primary/10", children: /* @__PURE__ */ jsx(DotsVerticalIcon, { className: "h-3 w-3" }) }) })
8041
8053
  ] })
8042
8054
  ]
8043
8055
  }
@@ -8046,10 +8058,10 @@ const Input = ({ node: o }) => {
8046
8058
  }
8047
8059
  ) });
8048
8060
  }), PasteAtRootContextMenu = ({ parentContext: o, setParentContext: n }) => {
8049
- const { t: r } = useTranslation(), { canPaste: a, pasteBlocks: l } = usePasteBlocks();
8061
+ const { t: r } = useTranslation(), { canPaste: a, pasteBlocks: l } = usePasteBlocks(), i = useBuilderProp("flags.useClipboard", !1);
8050
8062
  return useEffect(() => {
8051
8063
  a("root") || n(null);
8052
- }, [a("root")]), !o || !a("root") ? null : /* @__PURE__ */ jsx("div", { className: "absolute inset-0", children: /* @__PURE__ */ jsxs(DropdownMenu, { open: !0, onOpenChange: () => n(null), children: [
8064
+ }, [a("root")]), !o || !a("root") || !i ? null : /* @__PURE__ */ jsx("div", { className: "absolute inset-0", children: /* @__PURE__ */ jsxs(DropdownMenu, { open: !0, onOpenChange: () => n(null), children: [
8053
8065
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { className: "hidden" }),
8054
8066
  /* @__PURE__ */ jsx(
8055
8067
  DropdownMenuContent,
@@ -8455,106 +8467,106 @@ const Input = ({ node: o }) => {
8455
8467
  }, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
8456
8468
  const [n, r] = useDarkMode(), [a, l] = React.useState(""), [i, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions();
8457
8469
  if (d) {
8458
- const j = d.map((C) => Object.keys(C)[0]);
8459
- DEFAULT_THEME_PRESET.forEach((C) => {
8460
- const k = Object.keys(C)[0];
8461
- j.includes(k) || d.push(C);
8470
+ const B = d.map((S) => Object.keys(S)[0]);
8471
+ DEFAULT_THEME_PRESET.forEach((S) => {
8472
+ const k = Object.keys(S)[0];
8473
+ B.includes(k) || d.push(S);
8462
8474
  });
8463
8475
  }
8464
- const [m, g] = useTheme(), h = useThemeOptions(), { t: f } = useTranslation(), x = React.useCallback(
8465
- (j) => {
8466
- const C = { ...m };
8467
- setPreviousTheme(C), g(j), toast.success("Theme updated", {
8476
+ const [g, m] = useTheme(), h = useThemeOptions(), { t: x } = useTranslation(), f = React.useCallback(
8477
+ (B) => {
8478
+ const S = { ...g };
8479
+ setPreviousTheme(S), m(B), toast.success("Theme updated", {
8468
8480
  action: {
8469
8481
  label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
8470
8482
  /* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
8471
8483
  " Undo"
8472
8484
  ] }),
8473
8485
  onClick: () => {
8474
- g(C), clearPreviousTheme(), toast.dismiss();
8486
+ m(S), clearPreviousTheme(), toast.dismiss();
8475
8487
  }
8476
8488
  },
8477
8489
  closeButton: !0,
8478
8490
  duration: 15e3
8479
8491
  });
8480
8492
  },
8481
- [m, g]
8493
+ [g, m]
8482
8494
  ), b = () => {
8483
- const j = d.find((C) => Object.keys(C)[0] === a);
8484
- if (j) {
8485
- const C = Object.values(j)[0];
8486
- C && typeof C == "object" && "fontFamily" in C && "borderRadius" in C && "colors" in C ? (x(C), l("")) : console.error("Invalid preset structure:", C);
8495
+ const B = d.find((S) => Object.keys(S)[0] === a);
8496
+ if (B) {
8497
+ const S = Object.values(B)[0];
8498
+ S && typeof S == "object" && "fontFamily" in S && "borderRadius" in S && "colors" in S ? (f(S), l("")) : console.error("Invalid preset structure:", S);
8487
8499
  } else
8488
8500
  console.error("Preset not found:", a);
8489
- }, y = (j) => {
8490
- x(j), l("");
8491
- }, S = useDebouncedCallback(
8492
- (j, C) => {
8493
- g(() => ({
8494
- ...m,
8501
+ }, y = (B) => {
8502
+ f(B), l("");
8503
+ }, C = useDebouncedCallback(
8504
+ (B, S) => {
8505
+ m(() => ({
8506
+ ...g,
8495
8507
  fontFamily: {
8496
- ...m.fontFamily,
8497
- [j.replace(/font-/g, "")]: C
8508
+ ...g.fontFamily,
8509
+ [B.replace(/font-/g, "")]: S
8498
8510
  }
8499
8511
  }));
8500
8512
  },
8501
- [m],
8513
+ [g],
8502
8514
  200
8503
8515
  ), v = React.useCallback(
8504
- (j) => {
8505
- g(() => ({
8506
- ...m,
8507
- borderRadius: `${j}px`
8516
+ (B) => {
8517
+ m(() => ({
8518
+ ...g,
8519
+ borderRadius: `${B}px`
8508
8520
  }));
8509
8521
  },
8510
- [m]
8511
- ), B = useDebouncedCallback(
8512
- (j, C) => {
8513
- g(() => {
8514
- const k = get(m, `colors.${j}`);
8515
- return n ? set(k, 1, C) : set(k, 0, C), {
8516
- ...m,
8522
+ [g]
8523
+ ), j = useDebouncedCallback(
8524
+ (B, S) => {
8525
+ m(() => {
8526
+ const k = get(g, `colors.${B}`);
8527
+ return n ? set(k, 1, S) : set(k, 0, S), {
8528
+ ...g,
8517
8529
  colors: {
8518
- ...m.colors,
8519
- [j]: k
8530
+ ...g.colors,
8531
+ [B]: k
8520
8532
  }
8521
8533
  };
8522
8534
  });
8523
8535
  },
8524
- [m],
8536
+ [g],
8525
8537
  200
8526
- ), _ = (j) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(j.items).map(([C]) => {
8527
- const k = get(m, `colors.${C}.${n ? 1 : 0}`);
8538
+ ), _ = (B) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(B.items).map(([S]) => {
8539
+ const k = get(g, `colors.${S}.${n ? 1 : 0}`);
8528
8540
  return k ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
8529
8541
  /* @__PURE__ */ jsx(
8530
8542
  ColorPickerInput,
8531
8543
  {
8532
8544
  value: k,
8533
- onChange: (I) => B(C, I)
8545
+ onChange: (I) => j(S, I)
8534
8546
  }
8535
8547
  ),
8536
- /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: C.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((I) => I.charAt(0).toUpperCase() + I.slice(1)).join(" ") + (!C.toLowerCase().includes("foreground") && !C.toLowerCase().includes("border") && !C.toLowerCase().includes("input") && !C.toLowerCase().includes("ring") && !C.toLowerCase().includes("background") ? " Background" : "") })
8537
- ] }, C) : null;
8548
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: S.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((I) => I.charAt(0).toUpperCase() + I.slice(1)).join(" ") + (!S.toLowerCase().includes("foreground") && !S.toLowerCase().includes("border") && !S.toLowerCase().includes("input") && !S.toLowerCase().includes("ring") && !S.toLowerCase().includes("background") ? " Background" : "") })
8549
+ ] }, S) : null;
8538
8550
  }) });
8539
8551
  return u("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
8540
8552
  /* @__PURE__ */ jsxs("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto", o), children: [
8541
8553
  d.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mx-0 my-2 flex flex-col gap-1 py-2", children: [
8542
8554
  /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
8543
- /* @__PURE__ */ jsx(Label, { className: "text-sm", children: f("Presets") }),
8555
+ /* @__PURE__ */ jsx(Label, { className: "text-sm", children: x("Presets") }),
8544
8556
  /* @__PURE__ */ jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ jsxs(Button, { className: "px-1", variant: "link", size: "sm", onClick: () => c(!0), children: [
8545
8557
  /* @__PURE__ */ jsx(UploadIcon, { className: "h-4 w-4" }),
8546
- f("Import theme")
8558
+ x("Import theme")
8547
8559
  ] }) })
8548
8560
  ] }),
8549
8561
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
8550
8562
  /* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: l, children: [
8551
8563
  /* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select preset" }) }),
8552
- /* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((j) => {
8553
- const C = Object.keys(j)[0], k = C.replaceAll("_", " ");
8554
- return /* @__PURE__ */ jsx(SelectItem, { value: C, children: capitalize(k) }, C);
8564
+ /* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((B) => {
8565
+ const S = Object.keys(B)[0], k = S.replaceAll("_", " ");
8566
+ return /* @__PURE__ */ jsx(SelectItem, { value: S, children: capitalize(k) }, S);
8555
8567
  }) })
8556
8568
  ] }) }),
8557
- /* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: b, children: f("Apply") }) })
8569
+ /* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: b, children: x("Apply") }) })
8558
8570
  ] })
8559
8571
  ] }),
8560
8572
  /* @__PURE__ */ jsx(Separator, {}),
@@ -8563,14 +8575,14 @@ const Input = ({ node: o }) => {
8563
8575
  /* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
8564
8576
  /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Typography" })
8565
8577
  ] }),
8566
- (h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([j, C]) => /* @__PURE__ */ jsx(
8578
+ (h == null ? void 0 : h.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(h.fontFamily).map(([B, S]) => /* @__PURE__ */ jsx(
8567
8579
  FontSelector,
8568
8580
  {
8569
- label: j,
8570
- value: m.fontFamily[j.replace(/font-/g, "")] || C[Object.keys(C)[0]],
8571
- onChange: (k) => S(j, k)
8581
+ label: B,
8582
+ value: g.fontFamily[B.replace(/font-/g, "")] || S[Object.keys(S)[0]],
8583
+ onChange: (k) => C(B, k)
8572
8584
  },
8573
- j
8585
+ B
8574
8586
  )) }),
8575
8587
  /* @__PURE__ */ jsx(Separator, {}),
8576
8588
  (h == null ? void 0 : h.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
@@ -8579,9 +8591,9 @@ const Input = ({ node: o }) => {
8579
8591
  /* @__PURE__ */ jsx(CornerTopRightIcon, { className: "h-3 w-3 text-gray-600" }),
8580
8592
  /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: "Border Radius" })
8581
8593
  ] }),
8582
- /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: m.borderRadius })
8594
+ /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: g.borderRadius })
8583
8595
  ] }),
8584
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: m.borderRadius, onChange: v }) })
8596
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 py-2", children: /* @__PURE__ */ jsx(BorderRadiusInput, { value: g.borderRadius, onChange: v }) })
8585
8597
  ] }),
8586
8598
  /* @__PURE__ */ jsx(Separator, {}),
8587
8599
  (h == null ? void 0 : h.colors) && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
@@ -8596,7 +8608,7 @@ const Input = ({ node: o }) => {
8596
8608
  Switch,
8597
8609
  {
8598
8610
  checked: n,
8599
- onCheckedChange: (j) => r(j),
8611
+ onCheckedChange: (B) => r(B),
8600
8612
  "aria-label": "Toggle dark mode",
8601
8613
  className: "mx-1"
8602
8614
  }
@@ -8604,7 +8616,7 @@ const Input = ({ node: o }) => {
8604
8616
  /* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
8605
8617
  ] }) })
8606
8618
  ] }),
8607
- /* @__PURE__ */ jsx("div", { className: "space-y-2", children: h.colors.map((j) => _(j)) })
8619
+ /* @__PURE__ */ jsx("div", { className: "space-y-2", children: h.colors.map((B) => _(B)) })
8608
8620
  ] }),
8609
8621
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: i && /* @__PURE__ */ jsx(
8610
8622
  LazyCssImportModal,
@@ -9118,7 +9130,7 @@ function QuickPrompts({ onClick: o }) {
9118
9130
  lang: get(LANGUAGES, a, a)
9119
9131
  })
9120
9132
  }), /* @__PURE__ */ jsx("div", { className: n ? "pointer-events-none opacity-50" : "", children: /* @__PURE__ */ jsx("ul", { className: "space-y-1", children: c.map(
9121
- ({ name: d, icon: p, subMenus: u, prompt: m }) => u ? /* @__PURE__ */ jsxs(Popover, { children: [
9133
+ ({ name: d, icon: p, subMenus: u, prompt: g }) => u ? /* @__PURE__ */ jsxs(Popover, { children: [
9122
9134
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
9123
9135
  "li",
9124
9136
  {
@@ -9134,7 +9146,7 @@ function QuickPrompts({ onClick: o }) {
9134
9146
  ] }) : /* @__PURE__ */ jsxs(
9135
9147
  "li",
9136
9148
  {
9137
- onClick: () => o(m),
9149
+ onClick: () => o(g),
9138
9150
  className: "flex cursor-pointer items-center space-x-2 rounded p-1 text-xs hover:bg-primary/10 hover:text-primary dark:hover:bg-gray-800",
9139
9151
  children: [
9140
9152
  /* @__PURE__ */ jsx(p, { className: "h-3.5 w-3.5" }),
@@ -9145,13 +9157,13 @@ function QuickPrompts({ onClick: o }) {
9145
9157
  )
9146
9158
  ) }) });
9147
9159
  }
9148
- const AIUserPrompt = ({ blockId: o }) => {
9160
+ const AiIcon = ({ className: o = "h-full w-full" }) => /* @__PURE__ */ jsx("svg", { className: o, viewBox: "0 0 256 256", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "m198.39 128.986-52.16-19.216-19.216-52.16a16 16 0 0 0-30.028 0L77.77 109.77l-52.16 19.216a16 16 0 0 0 0 30.028l52.16 19.216 19.216 52.16a16 16 0 0 0 30.028 0l19.216-52.16 52.16-19.216a16 16 0 0 0 0-30.028m-57.69 34.23a15.97 15.97 0 0 0-9.483 9.483l-19.22 52.152-19.214-52.15a15.97 15.97 0 0 0-9.482-9.484l-52.152-19.22 52.15-19.214a15.97 15.97 0 0 0 9.484-9.482l19.22-52.152 19.214 52.15a15.97 15.97 0 0 0 9.482 9.484l52.152 19.22ZM144 40a8 8 0 0 1 8-8h16V16a8 8 0 0 1 16 0v16h16a8 8 0 0 1 0 16h-16v16a8 8 0 0 1-16 0V48h-16a8 8 0 0 1-8-8m104 48a8 8 0 0 1-8 8h-8v8a8 8 0 0 1-16 0v-8h-8a8 8 0 0 1 0-16h8v-8a8 8 0 0 1 16 0v8h8a8 8 0 0 1 8 8" }) }), AIUserPrompt = ({ blockId: o }) => {
9149
9161
  const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), u = useSelectedBlock();
9150
9162
  useEffect(() => {
9151
- var g;
9152
- (g = d.current) == null || g.focus();
9163
+ var m;
9164
+ (m = d.current) == null || m.focus();
9153
9165
  }, []);
9154
- const m = () => {
9166
+ const g = () => {
9155
9167
  l || c("");
9156
9168
  };
9157
9169
  return /* @__PURE__ */ jsx("div", { className: "", children: o ? /* @__PURE__ */ jsxs("div", { className: "", children: [
@@ -9166,8 +9178,8 @@ const AIUserPrompt = ({ blockId: o }) => {
9166
9178
  /* @__PURE__ */ jsx("div", { className: "rounded border p-2 text-sm", children: /* @__PURE__ */ jsx(
9167
9179
  QuickPrompts,
9168
9180
  {
9169
- onClick: (g) => {
9170
- p.current && clearTimeout(p.current), r("content", o, g, m);
9181
+ onClick: (m) => {
9182
+ p.current && clearTimeout(p.current), r("content", o, m, g);
9171
9183
  }
9172
9184
  }
9173
9185
  ) }),
@@ -9179,12 +9191,12 @@ const AIUserPrompt = ({ blockId: o }) => {
9179
9191
  {
9180
9192
  ref: d,
9181
9193
  value: i,
9182
- onChange: (g) => c(g.target.value),
9194
+ onChange: (m) => c(m.target.value),
9183
9195
  placeholder: n("Ask AI to edit content"),
9184
9196
  className: "w-full resize-none border-none p-0 text-xs shadow-none outline-none",
9185
9197
  rows: 3,
9186
- onKeyDown: (g) => {
9187
- g.key === "Enter" && (g.preventDefault(), p.current && clearTimeout(p.current), r("content", o, i, m));
9198
+ onKeyDown: (m) => {
9199
+ m.key === "Enter" && (m.preventDefault(), p.current && clearTimeout(p.current), r("content", o, i, g));
9188
9200
  }
9189
9201
  }
9190
9202
  ),
@@ -9194,7 +9206,7 @@ const AIUserPrompt = ({ blockId: o }) => {
9194
9206
  Button,
9195
9207
  {
9196
9208
  onClick: () => {
9197
- p.current && clearTimeout(p.current), r("content", o, i, m);
9209
+ p.current && clearTimeout(p.current), r("content", o, i, g);
9198
9210
  },
9199
9211
  variant: "default",
9200
9212
  className: "h-7 w-7",
@@ -9320,11 +9332,11 @@ const UndoRedo = () => {
9320
9332
  preloadedAttributes: n = [],
9321
9333
  onAttributesChange: r
9322
9334
  }) {
9323
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, m] = useState(null), [g, h] = useState(""), f = useRef(null), x = useRef(null), b = usePageExternalData(), { t: y } = useTranslation();
9335
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [m, h] = useState(""), x = useRef(null), f = useRef(null), b = usePageExternalData(), { t: y } = useTranslation();
9324
9336
  useEffect(() => {
9325
9337
  l(n);
9326
9338
  }, [n]);
9327
- const S = () => {
9339
+ const C = () => {
9328
9340
  if (i.startsWith("@")) {
9329
9341
  h("Attribute keys cannot start with '@'");
9330
9342
  return;
@@ -9336,8 +9348,8 @@ const UndoRedo = () => {
9336
9348
  }, v = (k) => {
9337
9349
  const I = a.filter((A, w) => w !== k);
9338
9350
  r(I), l(I);
9339
- }, B = (k) => {
9340
- m(k), c(a[k].key), p(a[k].value);
9351
+ }, j = (k) => {
9352
+ g(k), c(a[k].key), p(a[k].value);
9341
9353
  }, _ = () => {
9342
9354
  if (i.startsWith("@")) {
9343
9355
  h("Attribute keys cannot start with '@'");
@@ -9345,11 +9357,11 @@ const UndoRedo = () => {
9345
9357
  }
9346
9358
  if (u !== null && i) {
9347
9359
  const k = [...a];
9348
- k[u] = { key: i, value: d }, r(k), l(k), m(null), c(""), p(""), h("");
9360
+ k[u] = { key: i, value: d }, r(k), l(k), g(null), c(""), p(""), h("");
9349
9361
  }
9350
- }, j = (k) => {
9351
- k.key === "Enter" && !k.shiftKey && (k.preventDefault(), u !== null ? _() : S());
9352
- }, C = useCallback((k) => {
9362
+ }, B = (k) => {
9363
+ k.key === "Enter" && !k.shiftKey && (k.preventDefault(), u !== null ? _() : C());
9364
+ }, S = useCallback((k) => {
9353
9365
  const I = (E) => /[.,!?;:]/.test(E), A = (E, L, T) => {
9354
9366
  let P = "", R = "";
9355
9367
  const D = L > 0 ? E[L - 1] : "", N = L < E.length ? E[L] : "";
@@ -9358,7 +9370,7 @@ const UndoRedo = () => {
9358
9370
  prefixLength: P.length,
9359
9371
  suffixLength: R.length
9360
9372
  };
9361
- }, w = x.current;
9373
+ }, w = f.current;
9362
9374
  if (w) {
9363
9375
  const E = w.selectionStart || 0, L = w.value || "", T = w.selectionEnd || E;
9364
9376
  if (T > E) {
@@ -9375,7 +9387,7 @@ const UndoRedo = () => {
9375
9387
  "form",
9376
9388
  {
9377
9389
  onSubmit: (k) => {
9378
- k.preventDefault(), u !== null ? _() : S();
9390
+ k.preventDefault(), u !== null ? _() : C();
9379
9391
  },
9380
9392
  className: "space-y-3",
9381
9393
  children: [
@@ -9389,7 +9401,7 @@ const UndoRedo = () => {
9389
9401
  autoCorrect: "off",
9390
9402
  spellCheck: "false",
9391
9403
  id: "attrKey",
9392
- ref: f,
9404
+ ref: x,
9393
9405
  value: i,
9394
9406
  onChange: (k) => c(k.target.value),
9395
9407
  placeholder: y("Enter Key"),
@@ -9400,7 +9412,7 @@ const UndoRedo = () => {
9400
9412
  /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
9401
9413
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
9402
9414
  /* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
9403
- !isEmpty(b) && /* @__PURE__ */ jsx(NestedPathSelector, { data: b, onSelect: C })
9415
+ !isEmpty(b) && /* @__PURE__ */ jsx(NestedPathSelector, { data: b, onSelect: S })
9404
9416
  ] }),
9405
9417
  /* @__PURE__ */ jsx(
9406
9418
  Textarea,
@@ -9410,10 +9422,10 @@ const UndoRedo = () => {
9410
9422
  spellCheck: "false",
9411
9423
  id: "attrValue",
9412
9424
  rows: 2,
9413
- ref: x,
9425
+ ref: f,
9414
9426
  value: d,
9415
9427
  onChange: (k) => p(k.target.value),
9416
- onKeyDown: j,
9428
+ onKeyDown: B,
9417
9429
  placeholder: "Enter Value",
9418
9430
  className: "text-xs font-normal leading-tight placeholder:text-slate-400"
9419
9431
  }
@@ -9421,7 +9433,7 @@ const UndoRedo = () => {
9421
9433
  ] })
9422
9434
  ] }),
9423
9435
  /* @__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" }) }),
9424
- g && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: g })
9436
+ m && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: m })
9425
9437
  ]
9426
9438
  }
9427
9439
  ),
@@ -9431,7 +9443,7 @@ const UndoRedo = () => {
9431
9443
  /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: k.value.toString() })
9432
9444
  ] }),
9433
9445
  /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
9434
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(I), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
9446
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => j(I), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
9435
9447
  /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(I), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
9436
9448
  ] })
9437
9449
  ] }, I)) })
@@ -9589,49 +9601,49 @@ registerChaiSidebarPanel("outline", {
9589
9601
  position: "top",
9590
9602
  isInternal: !0,
9591
9603
  width: DEFAULT_PANEL_WIDTH,
9592
- panel: () => /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx(ListTree, {}) })
9604
+ panel: () => /* @__PURE__ */ jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsx(ListTree, {}) })
9593
9605
  });
9594
9606
  const RootLayout = () => {
9595
- const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [l, i] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useChaiSidebarPanels("top"), u = useChaiSidebarPanels("bottom"), m = reverse([...u ?? []]), g = useCallback((k) => {
9607
+ const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [l, i] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useChaiSidebarPanels("top"), u = useChaiSidebarPanels("bottom"), g = reverse([...u ?? []]), m = useCallback((k) => {
9596
9608
  k.preventDefault();
9597
9609
  }, []), h = useMemo(() => {
9598
9610
  const k = [p].flat(), I = k.find((w) => w.id === "chai-chat-panel"), A = k.filter((w) => w.id !== "chai-chat-panel");
9599
9611
  return I ? [I, ...A] : k;
9600
- }, [p]), f = useCallback(
9612
+ }, [p]), x = useCallback(
9601
9613
  (k) => {
9602
9614
  console.log("handleMenuItemClick", k, n), r(n === k ? null : k);
9603
9615
  },
9604
9616
  [n, r]
9605
- ), { t: x } = useTranslation(), b = useMemo(() => [...p, ...u], [p, u]), y = useBuilderProp("htmlDir", "ltr"), S = find(b, { id: n }) ?? first(b), v = get(S, "width", DEFAULT_PANEL_WIDTH);
9617
+ ), { t: f } = useTranslation(), b = useMemo(() => [...p, ...u], [p, u]), y = useBuilderProp("htmlDir", "ltr"), C = find(b, { id: n }) ?? first(b), v = get(C, "width", DEFAULT_PANEL_WIDTH);
9606
9618
  useEffect(() => {
9607
9619
  if (n !== null) {
9608
9620
  const k = find(b, { id: n });
9609
9621
  k && get(k, "view", "standard") === "standard" && (a.current = n, i(get(k, "width", DEFAULT_PANEL_WIDTH)));
9610
9622
  }
9611
9623
  }, [n, b]);
9612
- const B = useMemo(() => {
9624
+ const j = useMemo(() => {
9613
9625
  if (n === null) return 0;
9614
9626
  const k = find(b, { id: n });
9615
9627
  return get(k, "view", "standard") === "standard" ? v : l;
9616
9628
  }, [n, v, l, b]), _ = useCallback(() => {
9617
9629
  r(a.current);
9618
- }, [r, n]), j = useCallback(() => {
9630
+ }, [r, n]), B = useCallback(() => {
9619
9631
  r("outline");
9620
9632
  }, [r]);
9621
9633
  useEffect(() => {
9622
9634
  n !== null && !find(b, { id: n }) && r("outline");
9623
9635
  }, [n, b]);
9624
- const C = useCallback(
9636
+ const S = useCallback(
9625
9637
  (k) => {
9626
- f(k);
9638
+ x(k);
9627
9639
  },
9628
- [f]
9640
+ [x]
9629
9641
  );
9630
9642
  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: [
9631
9643
  /* @__PURE__ */ jsxs(
9632
9644
  "div",
9633
9645
  {
9634
- onContextMenu: g,
9646
+ onContextMenu: m,
9635
9647
  className: "flex h-full max-h-full flex-col bg-background text-foreground",
9636
9648
  children: [
9637
9649
  /* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
@@ -9642,19 +9654,19 @@ const RootLayout = () => {
9642
9654
  position: "top",
9643
9655
  panelId: k.id,
9644
9656
  isActive: n === k.id,
9645
- show: () => C(k.id)
9657
+ show: () => S(k.id)
9646
9658
  }) }),
9647
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(k.label) }) })
9659
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(k.label) }) })
9648
9660
  ] }, "button-top-" + I)) }),
9649
9661
  /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
9650
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m == null ? void 0 : m.map((k, I) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9662
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((k, I) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9651
9663
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(k, "button", NoopComponent), {
9652
9664
  position: "bottom",
9653
9665
  panelId: k.id,
9654
9666
  isActive: n === k.id,
9655
- show: () => C(k.id)
9667
+ show: () => S(k.id)
9656
9668
  }) }),
9657
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(k.label) }) })
9669
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(k.label) }) })
9658
9670
  ] }, "button-bottom-" + I)) })
9659
9671
  ] }),
9660
9672
  /* @__PURE__ */ jsx(
@@ -9662,18 +9674,18 @@ const RootLayout = () => {
9662
9674
  {
9663
9675
  id: "left-panel",
9664
9676
  className: "h-full max-h-full border-r border-border",
9665
- initial: { width: B },
9666
- animate: { width: B },
9677
+ initial: { width: j },
9678
+ animate: { width: j },
9667
9679
  transition: { duration: 0.3, ease: "easeInOut" },
9668
- children: n !== null && get(S, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
9680
+ children: n !== null && get(C, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
9669
9681
  /* @__PURE__ */ jsx(
9670
9682
  "div",
9671
9683
  {
9672
- className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(S, "isInternal", !1) ? "" : "w-64"}`,
9673
- children: /* @__PURE__ */ jsx("span", { children: x(get(S, "label", "")) })
9684
+ className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(C, "isInternal", !1) ? "" : "w-64"}`,
9685
+ children: /* @__PURE__ */ jsx("span", { children: f(get(C, "label", "")) })
9674
9686
  }
9675
9687
  ),
9676
- /* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(S, "panel", NoopComponent), {}) }) })
9688
+ /* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {}) }) })
9677
9689
  ] })
9678
9690
  }
9679
9691
  ),
@@ -9693,11 +9705,11 @@ const RootLayout = () => {
9693
9705
  /* @__PURE__ */ jsx("h2", { className: "-mt-1 flex items-center space-x-1 text-base font-bold", children: /* @__PURE__ */ jsx("div", { className: "flex grow items-center gap-2", children: /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-between gap-2", children: c === "ai" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9694
9706
  /* @__PURE__ */ jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
9695
9707
  " ",
9696
- x("AI Assistant")
9708
+ f("AI Assistant")
9697
9709
  ] }) }) : c === "theme" ? /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
9698
9710
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
9699
9711
  /* @__PURE__ */ jsx(MixerHorizontalIcon, { className: "h-4 w-4 text-gray-600" }),
9700
- x("Theme Settings")
9712
+ f("Theme Settings")
9701
9713
  ] }),
9702
9714
  /* @__PURE__ */ jsx(
9703
9715
  Button,
@@ -9719,7 +9731,7 @@ const RootLayout = () => {
9719
9731
  }
9720
9732
  ),
9721
9733
  /* @__PURE__ */ jsx(AddBlocksDialog, {}),
9722
- n !== null && get(S, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(
9734
+ n !== null && get(C, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(
9723
9735
  SheetContent,
9724
9736
  {
9725
9737
  side: "left",
@@ -9727,26 +9739,26 @@ const RootLayout = () => {
9727
9739
  style: { width: `${v}px` },
9728
9740
  children: [
9729
9741
  /* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
9730
- /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(S, "icon", null) }),
9731
- /* @__PURE__ */ jsx("span", { children: x(get(S, "label", "")) })
9742
+ /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(C, "icon", null) }),
9743
+ /* @__PURE__ */ jsx("span", { children: f(get(C, "label", "")) })
9732
9744
  ] }) }),
9733
- /* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(S, "panel", NoopComponent), {
9734
- close: j
9745
+ /* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
9746
+ close: B
9735
9747
  }) }) })
9736
9748
  ]
9737
9749
  }
9738
9750
  ) }),
9739
9751
  " ",
9740
- n !== null && get(S, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${v}px` }, children: [
9752
+ n !== null && get(C, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => _(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${v}px` }, children: [
9741
9753
  /* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
9742
- /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(S, "icon", null) }),
9743
- /* @__PURE__ */ jsx("span", { children: x(get(S, "label", "")) })
9754
+ /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(C, "icon", null) }),
9755
+ /* @__PURE__ */ jsx("span", { children: f(get(C, "label", "")) })
9744
9756
  ] }) }),
9745
- /* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(S, "panel", NoopComponent), {
9746
- close: j
9757
+ /* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
9758
+ close: B
9747
9759
  }) }) })
9748
9760
  ] }) }),
9749
- n !== null && get(S, "view") === "overlay" && /* @__PURE__ */ jsx(
9761
+ n !== null && get(C, "view") === "overlay" && /* @__PURE__ */ jsx(
9750
9762
  motion.div,
9751
9763
  {
9752
9764
  className: "absolute bottom-0 left-12 right-0 top-0 z-50",
@@ -9765,13 +9777,13 @@ const RootLayout = () => {
9765
9777
  children: [
9766
9778
  /* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
9767
9779
  /* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
9768
- /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(S, "icon", null) }),
9769
- /* @__PURE__ */ jsx("span", { children: x(get(S, "label", "")) })
9780
+ /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(C, "icon", null) }),
9781
+ /* @__PURE__ */ jsx("span", { children: f(get(C, "label", "")) })
9770
9782
  ] }),
9771
9783
  /* @__PURE__ */ jsx(Button, { onClick: () => _(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-5 w-5" }) })
9772
9784
  ] }),
9773
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(S, "panel", NoopComponent), {
9774
- close: j
9785
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {
9786
+ close: B
9775
9787
  }) }) })
9776
9788
  ]
9777
9789
  }
@@ -9826,38 +9838,38 @@ const RootLayout = () => {
9826
9838
  position: n,
9827
9839
  updatePosition: r
9828
9840
  }) => {
9829
- const a = useChaiFeatureFlags(), [l, i] = useState(""), [c, d] = useState(!1), [p, u] = useState({ x: 0, y: 0 }), m = useMemo(() => {
9841
+ const a = useChaiFeatureFlags(), [l, i] = useState(""), [c, d] = useState(!1), [p, u] = useState({ x: 0, y: 0 }), g = useMemo(() => {
9830
9842
  if (!l.trim()) return a;
9831
- const x = l.toLowerCase();
9843
+ const f = l.toLowerCase();
9832
9844
  return Object.fromEntries(
9833
9845
  Object.entries(a).filter(([b, y]) => {
9834
- var S;
9835
- return (b == null ? void 0 : b.toLowerCase().includes(x)) || ((S = y == null ? void 0 : y.description) == null ? void 0 : S.toLowerCase().includes(x));
9846
+ var C;
9847
+ return (b == null ? void 0 : b.toLowerCase().includes(f)) || ((C = y == null ? void 0 : y.description) == null ? void 0 : C.toLowerCase().includes(f));
9836
9848
  })
9837
9849
  );
9838
- }, [a, l]), g = (x) => {
9850
+ }, [a, l]), m = (f) => {
9839
9851
  d(!0), u({
9840
- x: x.clientX - n.x,
9841
- y: x.clientY - n.y
9852
+ x: f.clientX - n.x,
9853
+ y: f.clientY - n.y
9842
9854
  });
9843
- }, h = (x) => {
9855
+ }, h = (f) => {
9844
9856
  if (!c) return;
9845
- const b = x.clientX - p.x, y = x.clientY - p.y, S = x.currentTarget, v = S.offsetWidth, B = S.offsetHeight, _ = window.innerWidth - v, j = window.innerHeight - B, C = Math.max(0, Math.min(b, _)), k = Math.max(0, Math.min(y, j));
9846
- r(C, k);
9847
- }, f = () => {
9857
+ const b = f.clientX - p.x, y = f.clientY - p.y, C = f.currentTarget, v = C.offsetWidth, j = C.offsetHeight, _ = window.innerWidth - v, B = window.innerHeight - j, S = Math.max(0, Math.min(b, _)), k = Math.max(0, Math.min(y, B));
9858
+ r(S, k);
9859
+ }, x = () => {
9848
9860
  d(!1);
9849
9861
  };
9850
9862
  return useEffect(() => {
9851
- const x = () => {
9863
+ const f = () => {
9852
9864
  c && d(!1);
9853
9865
  };
9854
- return window.addEventListener("mouseup", x), () => window.removeEventListener("mouseup", x);
9866
+ return window.addEventListener("mouseup", f), () => window.removeEventListener("mouseup", f);
9855
9867
  }, [c]), !n || n.x < 0 || n.y < 0 ? null : /* @__PURE__ */ jsxs(
9856
9868
  "div",
9857
9869
  {
9858
- onMouseDown: g,
9870
+ onMouseDown: m,
9859
9871
  onMouseMove: h,
9860
- onMouseUp: f,
9872
+ onMouseUp: x,
9861
9873
  className: "fixed z-[9999999] select-none rounded-md border border-gray-300 bg-white p-3 shadow-2xl",
9862
9874
  style: {
9863
9875
  left: n.x,
@@ -9899,13 +9911,13 @@ const RootLayout = () => {
9899
9911
  placeholder: "Search features...",
9900
9912
  className: "w-full pl-8",
9901
9913
  value: l,
9902
- onChange: (x) => i(x.target.value),
9914
+ onChange: (f) => i(f.target.value),
9903
9915
  autoFocus: !0
9904
9916
  }
9905
9917
  )
9906
9918
  ] })
9907
9919
  ] }),
9908
- /* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto py-2", children: Object.keys(m).length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(m).map(([x, b]) => /* @__PURE__ */ jsx(FeatureToggle, { featureKey: x, options: b }, x)) }) : /* @__PURE__ */ jsx("div", { className: "py-8 text-center", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
9920
+ /* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto py-2", children: Object.keys(g).length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(g).map(([f, b]) => /* @__PURE__ */ jsx(FeatureToggle, { featureKey: f, options: b }, f)) }) : /* @__PURE__ */ jsx("div", { className: "py-8 text-center", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
9909
9921
  'No features found matching "',
9910
9922
  l,
9911
9923
  '"'
@@ -10038,52 +10050,52 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
10038
10050
  let i = a.get(n);
10039
10051
  return i || (i = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, a.set(n, i), l == null || l(o, n)), i;
10040
10052
  }, flushCallbacks = (o) => {
10041
- const n = getBuildingBlocks(o), r = n[1], a = n[3], l = n[4], i = n[5], c = n[6], d = n[13], p = [], u = (m) => {
10053
+ const n = getBuildingBlocks(o), r = n[1], a = n[3], l = n[4], i = n[5], c = n[6], d = n[13], p = [], u = (g) => {
10042
10054
  try {
10043
- m();
10044
- } catch (g) {
10045
- p.push(g);
10055
+ g();
10056
+ } catch (m) {
10057
+ p.push(m);
10046
10058
  }
10047
10059
  };
10048
10060
  do {
10049
10061
  c.f && u(c.f);
10050
- const m = /* @__PURE__ */ new Set(), g = m.add.bind(m);
10062
+ const g = /* @__PURE__ */ new Set(), m = g.add.bind(g);
10051
10063
  a.forEach((h) => {
10052
- var f;
10053
- return (f = r.get(h)) == null ? void 0 : f.l.forEach(g);
10054
- }), a.clear(), i.forEach(g), i.clear(), l.forEach(g), l.clear(), m.forEach(u), a.size && d(o);
10064
+ var x;
10065
+ return (x = r.get(h)) == null ? void 0 : x.l.forEach(m);
10066
+ }), a.clear(), i.forEach(m), i.clear(), l.forEach(m), l.clear(), g.forEach(u), a.size && d(o);
10055
10067
  } while (a.size || i.size || l.size);
10056
10068
  if (p.length)
10057
10069
  throw new AggregateError(p);
10058
10070
  }, recomputeInvalidatedAtoms = (o) => {
10059
- const n = getBuildingBlocks(o), r = n[1], a = n[2], l = n[3], i = n[11], c = n[14], d = n[17], p = [], u = /* @__PURE__ */ new WeakSet(), m = /* @__PURE__ */ new WeakSet(), g = Array.from(l);
10060
- for (; g.length; ) {
10061
- const h = g[g.length - 1], f = i(o, h);
10062
- if (m.has(h)) {
10063
- g.pop();
10071
+ const n = getBuildingBlocks(o), r = n[1], a = n[2], l = n[3], i = n[11], c = n[14], d = n[17], p = [], u = /* @__PURE__ */ new WeakSet(), g = /* @__PURE__ */ new WeakSet(), m = Array.from(l);
10072
+ for (; m.length; ) {
10073
+ const h = m[m.length - 1], x = i(o, h);
10074
+ if (g.has(h)) {
10075
+ m.pop();
10064
10076
  continue;
10065
10077
  }
10066
10078
  if (u.has(h)) {
10067
- a.get(h) === f.n && p.push([h, f]), m.add(h), g.pop();
10079
+ a.get(h) === x.n && p.push([h, x]), g.add(h), m.pop();
10068
10080
  continue;
10069
10081
  }
10070
10082
  u.add(h);
10071
- for (const x of getMountedOrPendingDependents(h, f, r))
10072
- u.has(x) || g.push(x);
10083
+ for (const f of getMountedOrPendingDependents(h, x, r))
10084
+ u.has(f) || m.push(f);
10073
10085
  }
10074
10086
  for (let h = p.length - 1; h >= 0; --h) {
10075
- const [f, x] = p[h];
10087
+ const [x, f] = p[h];
10076
10088
  let b = !1;
10077
- for (const y of x.d.keys())
10078
- if (y !== f && l.has(y)) {
10089
+ for (const y of f.d.keys())
10090
+ if (y !== x && l.has(y)) {
10079
10091
  b = !0;
10080
10092
  break;
10081
10093
  }
10082
- b && (c(o, f), d(o, f)), a.delete(f);
10094
+ b && (c(o, x), d(o, x)), a.delete(x);
10083
10095
  }
10084
10096
  }, readAtomState = (o, n) => {
10085
10097
  var r;
10086
- const a = getBuildingBlocks(o), l = a[1], i = a[2], c = a[3], d = a[6], p = a[7], u = a[11], m = a[12], g = a[13], h = a[14], f = a[16], x = a[17], b = u(o, n);
10098
+ const a = getBuildingBlocks(o), l = a[1], i = a[2], c = a[3], d = a[6], p = a[7], u = a[11], g = a[12], m = a[13], h = a[14], x = a[16], f = a[17], b = u(o, n);
10087
10099
  if (isAtomStateInitialized(b) && (l.has(n) && i.get(n) !== b.n || Array.from(b.d).every(
10088
10100
  ([k, I]) => (
10089
10101
  // Recursively, read the atom state of the dependency, and
@@ -10094,8 +10106,8 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
10094
10106
  return b;
10095
10107
  b.d.clear();
10096
10108
  let y = !0;
10097
- function S() {
10098
- l.has(n) && (x(o, n), g(o), m(o));
10109
+ function C() {
10110
+ l.has(n) && (f(o, n), m(o), g(o));
10099
10111
  }
10100
10112
  function v(k) {
10101
10113
  var I;
@@ -10112,107 +10124,107 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
10112
10124
  try {
10113
10125
  return returnAtomValue(A);
10114
10126
  } finally {
10115
- b.d.set(k, A.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, A), (I = l.get(k)) == null || I.t.add(n), y || S();
10127
+ b.d.set(k, A.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, A), (I = l.get(k)) == null || I.t.add(n), y || C();
10116
10128
  }
10117
10129
  }
10118
- let B, _;
10119
- const j = {
10130
+ let j, _;
10131
+ const B = {
10120
10132
  get signal() {
10121
- return B || (B = new AbortController()), B.signal;
10133
+ return j || (j = new AbortController()), j.signal;
10122
10134
  },
10123
10135
  get setSelf() {
10124
10136
  return !_ && isActuallyWritableAtom(n) && (_ = (...k) => {
10125
10137
  if (!y)
10126
10138
  try {
10127
- return f(o, n, ...k);
10139
+ return x(o, n, ...k);
10128
10140
  } finally {
10129
- g(o), m(o);
10141
+ m(o), g(o);
10130
10142
  }
10131
10143
  }), _;
10132
10144
  }
10133
- }, C = b.n;
10145
+ }, S = b.n;
10134
10146
  try {
10135
- const k = p(o, n, v, j);
10136
- return setAtomStateValueOrPromise(o, n, k), isPromiseLike$1(k) && (registerAbortHandler(k, () => B == null ? void 0 : B.abort()), k.then(S, S)), b;
10147
+ const k = p(o, n, v, B);
10148
+ return setAtomStateValueOrPromise(o, n, k), isPromiseLike$1(k) && (registerAbortHandler(k, () => j == null ? void 0 : j.abort()), k.then(C, C)), b;
10137
10149
  } catch (k) {
10138
10150
  return delete b.v, b.e = k, ++b.n, b;
10139
10151
  } finally {
10140
- y = !1, C !== b.n && i.get(n) === C && (i.set(n, b.n), c.add(n), (r = d.c) == null || r.call(d, n));
10152
+ y = !1, S !== b.n && i.get(n) === S && (i.set(n, b.n), c.add(n), (r = d.c) == null || r.call(d, n));
10141
10153
  }
10142
10154
  }, invalidateDependents = (o, n) => {
10143
10155
  const r = getBuildingBlocks(o), a = r[1], l = r[2], i = r[11], c = [n];
10144
10156
  for (; c.length; ) {
10145
10157
  const d = c.pop(), p = i(o, d);
10146
10158
  for (const u of getMountedOrPendingDependents(d, p, a)) {
10147
- const m = i(o, u);
10148
- l.set(u, m.n), c.push(u);
10159
+ const g = i(o, u);
10160
+ l.set(u, g.n), c.push(u);
10149
10161
  }
10150
10162
  }
10151
10163
  }, writeAtomState = (o, n, ...r) => {
10152
- const a = getBuildingBlocks(o), l = a[3], i = a[6], c = a[8], d = a[11], p = a[12], u = a[13], m = a[14], g = a[15], h = a[17];
10153
- let f = !0;
10154
- const x = (y) => returnAtomValue(m(o, y)), b = (y, ...S) => {
10164
+ const a = getBuildingBlocks(o), l = a[3], i = a[6], c = a[8], d = a[11], p = a[12], u = a[13], g = a[14], m = a[15], h = a[17];
10165
+ let x = !0;
10166
+ const f = (y) => returnAtomValue(g(o, y)), b = (y, ...C) => {
10155
10167
  var v;
10156
- const B = d(o, y);
10168
+ const j = d(o, y);
10157
10169
  try {
10158
10170
  if (isSelfAtom(n, y)) {
10159
10171
  if (!hasInitialValue(y))
10160
10172
  throw new Error("atom not writable");
10161
- const _ = B.n, j = S[0];
10162
- setAtomStateValueOrPromise(o, y, j), h(o, y), _ !== B.n && (l.add(y), (v = i.c) == null || v.call(i, y), g(o, y));
10173
+ const _ = j.n, B = C[0];
10174
+ setAtomStateValueOrPromise(o, y, B), h(o, y), _ !== j.n && (l.add(y), (v = i.c) == null || v.call(i, y), m(o, y));
10163
10175
  return;
10164
10176
  } else
10165
- return writeAtomState(o, y, ...S);
10177
+ return writeAtomState(o, y, ...C);
10166
10178
  } finally {
10167
- f || (u(o), p(o));
10179
+ x || (u(o), p(o));
10168
10180
  }
10169
10181
  };
10170
10182
  try {
10171
- return c(o, n, x, b, ...r);
10183
+ return c(o, n, f, b, ...r);
10172
10184
  } finally {
10173
- f = !1;
10185
+ x = !1;
10174
10186
  }
10175
10187
  }, mountDependencies = (o, n) => {
10176
10188
  var r;
10177
- const a = getBuildingBlocks(o), l = a[1], i = a[3], c = a[6], d = a[11], p = a[15], u = a[18], m = a[19], g = d(o, n), h = l.get(n);
10178
- if (h && !isPendingPromise(g.v)) {
10179
- for (const [f, x] of g.d)
10180
- if (!h.d.has(f)) {
10181
- const b = d(o, f);
10182
- u(o, f).t.add(n), h.d.add(f), x !== b.n && (i.add(f), (r = c.c) == null || r.call(c, f), p(o, f));
10189
+ const a = getBuildingBlocks(o), l = a[1], i = a[3], c = a[6], d = a[11], p = a[15], u = a[18], g = a[19], m = d(o, n), h = l.get(n);
10190
+ if (h && !isPendingPromise(m.v)) {
10191
+ for (const [x, f] of m.d)
10192
+ if (!h.d.has(x)) {
10193
+ const b = d(o, x);
10194
+ u(o, x).t.add(n), h.d.add(x), f !== b.n && (i.add(x), (r = c.c) == null || r.call(c, x), p(o, x));
10183
10195
  }
10184
- for (const f of h.d || [])
10185
- if (!g.d.has(f)) {
10186
- h.d.delete(f);
10187
- const x = m(o, f);
10188
- x == null || x.t.delete(n);
10196
+ for (const x of h.d || [])
10197
+ if (!m.d.has(x)) {
10198
+ h.d.delete(x);
10199
+ const f = g(o, x);
10200
+ f == null || f.t.delete(n);
10189
10201
  }
10190
10202
  }
10191
10203
  }, mountAtom = (o, n) => {
10192
10204
  var r;
10193
- const a = getBuildingBlocks(o), l = a[1], i = a[4], c = a[6], d = a[10], p = a[11], u = a[12], m = a[13], g = a[14], h = a[16], f = p(o, n);
10194
- let x = l.get(n);
10195
- if (!x) {
10196
- g(o, n);
10197
- for (const b of f.d.keys())
10205
+ const a = getBuildingBlocks(o), l = a[1], i = a[4], c = a[6], d = a[10], p = a[11], u = a[12], g = a[13], m = a[14], h = a[16], x = p(o, n);
10206
+ let f = l.get(n);
10207
+ if (!f) {
10208
+ m(o, n);
10209
+ for (const b of x.d.keys())
10198
10210
  mountAtom(o, b).t.add(n);
10199
- if (x = {
10211
+ if (f = {
10200
10212
  l: /* @__PURE__ */ new Set(),
10201
- d: new Set(f.d.keys()),
10213
+ d: new Set(x.d.keys()),
10202
10214
  t: /* @__PURE__ */ new Set()
10203
- }, l.set(n, x), (r = c.m) == null || r.call(c, n), isActuallyWritableAtom(n)) {
10215
+ }, l.set(n, f), (r = c.m) == null || r.call(c, n), isActuallyWritableAtom(n)) {
10204
10216
  const b = () => {
10205
10217
  let y = !0;
10206
- const S = (...v) => {
10218
+ const C = (...v) => {
10207
10219
  try {
10208
10220
  return h(o, n, ...v);
10209
10221
  } finally {
10210
- y || (m(o), u(o));
10222
+ y || (g(o), u(o));
10211
10223
  }
10212
10224
  };
10213
10225
  try {
10214
- const v = d(o, n, S);
10215
- v && (x.u = () => {
10226
+ const v = d(o, n, C);
10227
+ v && (f.u = () => {
10216
10228
  y = !0;
10217
10229
  try {
10218
10230
  v();
@@ -10227,23 +10239,23 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
10227
10239
  i.add(b);
10228
10240
  }
10229
10241
  }
10230
- return x;
10242
+ return f;
10231
10243
  }, unmountAtom = (o, n) => {
10232
10244
  var r;
10233
10245
  const a = getBuildingBlocks(o), l = a[1], i = a[5], c = a[6], d = a[11], p = a[19], u = d(o, n);
10234
- let m = l.get(n);
10235
- if (m && !m.l.size && !Array.from(m.t).some((g) => {
10246
+ let g = l.get(n);
10247
+ if (g && !g.l.size && !Array.from(g.t).some((m) => {
10236
10248
  var h;
10237
- return (h = l.get(g)) == null ? void 0 : h.d.has(n);
10249
+ return (h = l.get(m)) == null ? void 0 : h.d.has(n);
10238
10250
  })) {
10239
- m.u && i.add(m.u), m = void 0, l.delete(n), (r = c.u) == null || r.call(c, n);
10240
- for (const g of u.d.keys()) {
10241
- const h = p(o, g);
10251
+ g.u && i.add(g.u), g = void 0, l.delete(n), (r = c.u) == null || r.call(c, n);
10252
+ for (const m of u.d.keys()) {
10253
+ const h = p(o, m);
10242
10254
  h == null || h.t.delete(n);
10243
10255
  }
10244
10256
  return;
10245
10257
  }
10246
- return m;
10258
+ return g;
10247
10259
  }, setAtomStateValueOrPromise = (o, n, r) => {
10248
10260
  const a = getBuildingBlocks(o)[11], l = a(o, n), i = "v" in l, c = l.v;
10249
10261
  if (isPromiseLike$1(r))
@@ -10358,10 +10370,10 @@ const isPromiseLike = (o) => typeof (o == null ? void 0 : o.then) == "function",
10358
10370
  let r = continuablePromiseMap.get(o);
10359
10371
  return r || (r = new Promise((a, l) => {
10360
10372
  let i = o;
10361
- const c = (u) => (m) => {
10362
- i === u && a(m);
10363
- }, d = (u) => (m) => {
10364
- i === u && l(m);
10373
+ const c = (u) => (g) => {
10374
+ i === u && a(g);
10375
+ }, d = (u) => (g) => {
10376
+ i === u && l(g);
10365
10377
  }, p = () => {
10366
10378
  try {
10367
10379
  const u = n();
@@ -10375,21 +10387,21 @@ const isPromiseLike = (o) => typeof (o == null ? void 0 : o.then) == "function",
10375
10387
  };
10376
10388
  function useAtomValue(o, n) {
10377
10389
  const { delay: r, unstable_promiseStatus: a = !React__default.use } = {}, l = useStore(), [[i, c, d], p] = useReducer(
10378
- (m) => {
10379
- const g = l.get(o);
10380
- return Object.is(m[0], g) && m[1] === l && m[2] === o ? m : [g, l, o];
10390
+ (g) => {
10391
+ const m = l.get(o);
10392
+ return Object.is(g[0], m) && g[1] === l && g[2] === o ? g : [m, l, o];
10381
10393
  },
10382
10394
  void 0,
10383
10395
  () => [l.get(o), l, o]
10384
10396
  );
10385
10397
  let u = i;
10386
10398
  if ((c !== l || d !== o) && (p(), u = l.get(o)), useEffect(() => {
10387
- const m = l.sub(o, () => {
10399
+ const g = l.sub(o, () => {
10388
10400
  if (a)
10389
10401
  try {
10390
- const g = l.get(o);
10391
- isPromiseLike(g) && attachPromiseStatus(
10392
- createContinuablePromise(g, () => l.get(o))
10402
+ const m = l.get(o);
10403
+ isPromiseLike(m) && attachPromiseStatus(
10404
+ createContinuablePromise(m, () => l.get(o))
10393
10405
  );
10394
10406
  } catch {
10395
10407
  }
@@ -10399,10 +10411,10 @@ function useAtomValue(o, n) {
10399
10411
  }
10400
10412
  p();
10401
10413
  });
10402
- return p(), m;
10414
+ return p(), g;
10403
10415
  }, [l, o, r, a]), useDebugValue(u), isPromiseLike(u)) {
10404
- const m = createContinuablePromise(u, () => l.get(o));
10405
- return a && attachPromiseStatus(m), use(m);
10416
+ const g = createContinuablePromise(u, () => l.get(o));
10417
+ return a && attachPromiseStatus(g), use(g);
10406
10418
  }
10407
10419
  return u;
10408
10420
  }
@@ -10476,7 +10488,7 @@ const useAutoSave = () => {
10476
10488
  if (typeof window > "u")
10477
10489
  throw new Error("@chaibuilder/sdk is only supported in the browser. Avoid using it in the server side.");
10478
10490
  export {
10479
- useDarkMode as $,
10491
+ useCutBlockIds as $,
10480
10492
  AddBlocksPanel as A,
10481
10493
  BlockSettings as B,
10482
10494
  CanvasArea as C,
@@ -10493,53 +10505,57 @@ export {
10493
10505
  NestedPathSelector as N,
10494
10506
  useBlockHighlight as O,
10495
10507
  PERMISSIONS as P,
10496
- useBlocksStore as Q,
10497
- useBrandingOptions as R,
10498
- useBuilderProp as S,
10508
+ useBlocksHtmlForAi as Q,
10509
+ useBlocksStore as R,
10510
+ useBrandingOptions as S,
10499
10511
  ThemeConfigPanel as T,
10500
10512
  UILibrariesPanel as U,
10501
- useBuilderReset as V,
10502
- useCanvasZoom as W,
10503
- useCopyBlocks as X,
10504
- useCopyToClipboard as Y,
10505
- useCurrentPage as Z,
10506
- useCutBlockIds as _,
10513
+ useBuilderProp as V,
10514
+ useBuilderReset as W,
10515
+ useCanvasZoom as X,
10516
+ useCopyBlocks as Y,
10517
+ useCopyToClipboard as Z,
10518
+ useCurrentPage as _,
10507
10519
  useSelectedBlockIds as a,
10508
- useDuplicateBlocks as a0,
10509
- useHighlightBlockId as a1,
10510
- useInlineEditing as a2,
10511
- useIsPageLoaded as a3,
10512
- useLanguages as a4,
10513
- useLibraryBlocks as a5,
10514
- usePartialBlocksStore as a6,
10515
- usePartialBlocksList as a7,
10516
- usePasteBlocks as a8,
10517
- usePermissions as a9,
10518
- usePreviewMode as aa,
10519
- useRemoveAllClassesForBlock as ab,
10520
- useRemoveBlocks as ac,
10521
- useRemoveClassesFromBlocks as ad,
10522
- useReplaceBlock as ae,
10523
- useResetBlockStyles as af,
10524
- useRightPanel as ag,
10525
- useSavePage as ah,
10526
- useSelectedBlock as ai,
10527
- useSelectedBlockAllClasses as aj,
10528
- useSelectedBlockCurrentClasses as ak,
10529
- useSelectedBlocksDisplayChild as al,
10530
- useSelectedBreakpoints as am,
10531
- useSelectedStylingBlocks as an,
10532
- useStylingBreakpoint as ao,
10533
- useStylingState as ap,
10534
- useTheme as aq,
10535
- useThemeOptions as ar,
10536
- useUndoManager as as,
10537
- useWrapperBlock as at,
10538
- useBlocksStoreUndoableActions as au,
10539
- useCanvasDisplayWidth as av,
10540
- useScreenSizeWidth as aw,
10541
- useSelectedLibrary as ax,
10542
- useSidebarActivePanel as ay,
10520
+ useDarkMode as a0,
10521
+ useDuplicateBlocks as a1,
10522
+ useHighlightBlockId as a2,
10523
+ useHtmlToBlocks as a3,
10524
+ useI18nBlocks as a4,
10525
+ useInlineEditing as a5,
10526
+ useIsPageLoaded as a6,
10527
+ useLanguages as a7,
10528
+ useLibraryBlocks as a8,
10529
+ usePartialBlocksStore as a9,
10530
+ useScreenSizeWidth as aA,
10531
+ useSelectedLibrary as aB,
10532
+ useSidebarActivePanel as aC,
10533
+ usePartialBlocksList as aa,
10534
+ usePasteBlocks as ab,
10535
+ usePermissions as ac,
10536
+ usePreviewMode as ad,
10537
+ useRemoveAllClassesForBlock as ae,
10538
+ useRemoveBlocks as af,
10539
+ useRemoveClassesFromBlocks as ag,
10540
+ useReplaceBlock as ah,
10541
+ useResetBlockStyles as ai,
10542
+ useRightPanel as aj,
10543
+ useSavePage as ak,
10544
+ useSelectedBlock as al,
10545
+ useSelectedBlockAllClasses as am,
10546
+ useSelectedBlockCurrentClasses as an,
10547
+ useSelectedBlocksDisplayChild as ao,
10548
+ useSelectedBreakpoints as ap,
10549
+ useSelectedStylingBlocks as aq,
10550
+ useStreamMultipleBlocksProps as ar,
10551
+ useStylingBreakpoint as as,
10552
+ useStylingState as at,
10553
+ useTheme as au,
10554
+ useThemeOptions as av,
10555
+ useUndoManager as aw,
10556
+ useWrapperBlock as ax,
10557
+ useBlocksStoreUndoableActions as ay,
10558
+ useCanvasDisplayWidth as az,
10543
10559
  useUpdateBlocksProps as b,
10544
10560
  useUpdateBlocksPropsRealtime as c,
10545
10561
  usePageExternalData as d,