@chaibuilder/sdk 0.1.2 → 0.1.3

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.
Files changed (78) hide show
  1. package/dist/{AddBlocks-e23baf9a.cjs → AddBlocks-0916e841.cjs} +1 -1
  2. package/dist/{AddBlocks-b5f37f2f.js → AddBlocks-c195f577.js} +19 -19
  3. package/dist/{BrandingOptions-3d1bd24a.cjs → BrandingOptions-742992b6.cjs} +1 -1
  4. package/dist/{BrandingOptions-cfd1b740.js → BrandingOptions-766c19c6.js} +27 -27
  5. package/dist/{CanvasArea-a065a586.js → CanvasArea-25800a3e.js} +19 -18
  6. package/dist/CanvasArea-e855c4a2.cjs +60 -0
  7. package/dist/Class-7d6aadbc.cjs +1 -0
  8. package/dist/{Class-e6b07b79.js → Class-e34b2337.js} +9 -9
  9. package/dist/{ImagesPanel-eccf9a56.js → ImagesPanel-8ccab6d9.js} +1 -1
  10. package/dist/{ImagesPanel-cc136c92.cjs → ImagesPanel-addb2bf9.cjs} +1 -1
  11. package/dist/{Layers-f002ba1a.cjs → Layers-a2169d0b.cjs} +1 -1
  12. package/dist/{Layers-f935e07b.js → Layers-f7e792f6.js} +3 -3
  13. package/dist/{MarkAsGlobalBlock-5f435dd5.cjs → MarkAsGlobalBlock-6187e6fd.cjs} +1 -1
  14. package/dist/{MarkAsGlobalBlock-613bfdab.js → MarkAsGlobalBlock-6bac1842.js} +2 -2
  15. package/dist/PagesPanel-0827c264.js +46 -0
  16. package/dist/PagesPanel-5698953d.cjs +1 -0
  17. package/dist/ProjectPanel-a3cb7396.cjs +1 -0
  18. package/dist/ProjectPanel-e577029a.js +66 -0
  19. package/dist/{Settings-a19fbb69.js → Settings-b214f859.js} +25 -24
  20. package/dist/Settings-bee21026.cjs +1 -0
  21. package/dist/{SidePanels-67ebbcb4.js → SidePanels-03fa10e8.js} +3 -3
  22. package/dist/{SidePanels-af222189.cjs → SidePanels-934159a4.cjs} +1 -1
  23. package/dist/{Topbar-fcb01371.js → Topbar-9bc8c9cf.js} +2 -2
  24. package/dist/{Topbar-e92351cc.cjs → Topbar-c083cc2a.cjs} +1 -1
  25. package/dist/UnsplashImages-68492dc9.cjs +1 -0
  26. package/dist/{UnsplashImages-fda2f29a.js → UnsplashImages-afaa7706.js} +19 -28
  27. package/dist/add-page-modal-63858244.js +92 -0
  28. package/dist/add-page-modal-cb367c9d.cjs +1 -0
  29. package/dist/alert-dialog-4ce6ed22.cjs +1 -0
  30. package/dist/alert-dialog-ee98f47e.js +64 -0
  31. package/dist/confirm-alert-4f50caa7.cjs +1 -0
  32. package/dist/confirm-alert-f2a47cc7.js +36 -0
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.d.ts +20 -12
  35. package/dist/core.js +53 -52
  36. package/dist/delete-page-modal-1e3914e3.cjs +1 -0
  37. package/dist/delete-page-modal-def9012d.js +64 -0
  38. package/dist/dropdown-menu-84b2439e.cjs +1 -0
  39. package/dist/dropdown-menu-ae3ed09b.js +164 -0
  40. package/dist/form-5d5c5c9e.js +125 -0
  41. package/dist/form-6eac0287.cjs +1 -0
  42. package/dist/{html-to-json-7510f587.js → html-to-json-9304dbda.js} +1 -1
  43. package/dist/{html-to-json-7eba915f.cjs → html-to-json-9c9961da.cjs} +1 -1
  44. package/dist/index-207f2cbf.cjs +2 -0
  45. package/dist/index-390f7bef.js +4749 -0
  46. package/dist/index-824a7bd0.js +188 -0
  47. package/dist/index-ebd86d7f.cjs +2 -0
  48. package/dist/input-42acea7e.cjs +1 -0
  49. package/dist/input-a0ea2bc7.js +19 -0
  50. package/dist/lib.cjs +1 -1
  51. package/dist/lib.js +3 -3
  52. package/dist/link-86c532b5.cjs +1 -0
  53. package/dist/{link-e406254f.js → link-f80a947d.js} +44 -60
  54. package/dist/mockServiceWorker.js +292 -0
  55. package/dist/page-viewer-41cbb548.js +88 -0
  56. package/dist/page-viewer-83ce2c70.cjs +1 -0
  57. package/dist/project-general-setting-0262fe62.js +65 -0
  58. package/dist/project-general-setting-2c8bed74.cjs +1 -0
  59. package/dist/project-seo-setting-01536592.js +67 -0
  60. package/dist/project-seo-setting-e3924578.cjs +1 -0
  61. package/dist/single-page-detail-924d57fc.js +206 -0
  62. package/dist/single-page-detail-cfeae896.cjs +1 -0
  63. package/dist/ui.cjs +1 -1
  64. package/dist/ui.js +124 -122
  65. package/dist/usePageActions-3bed2330.cjs +1 -0
  66. package/dist/usePageActions-f86f6f65.js +36 -0
  67. package/dist/useProjectActions-1de05f63.js +17 -0
  68. package/dist/useProjectActions-5092ed79.cjs +1 -0
  69. package/package.json +14 -1
  70. package/dist/CanvasArea-c4554d61.cjs +0 -60
  71. package/dist/Class-0801d193.cjs +0 -1
  72. package/dist/Settings-05b9b5fe.cjs +0 -1
  73. package/dist/UnsplashImages-cca34e45.cjs +0 -1
  74. package/dist/dropdown-menu-a9b096f9.cjs +0 -1
  75. package/dist/dropdown-menu-d912a52e.js +0 -223
  76. package/dist/index-73cf645f.cjs +0 -2
  77. package/dist/index-7e212fbc.js +0 -2657
  78. package/dist/link-1ee70bca.cjs +0 -1
package/dist/ui.js CHANGED
@@ -1,29 +1,30 @@
1
1
  import { T as Fe, t as He } from "./toggle-00c9d11e.js";
2
- import { A as Ve, g as Ee, h as Be, b as Oe, f as qe, d as $e, c as Je, e as Ke, a as Qe, D as Ue, n as We, l as Xe, s as Ye, m as Ze, p as et, t as tt, x as at, o as ot, q as st, r as rt, u as nt, v as dt, w as it, k as lt, H as mt, j as ct, i as pt, S as ut } from "./dropdown-menu-d912a52e.js";
3
- import { B as xt, S as gt, a as bt, d as ht, f as yt, g as Nt, T as wt, e as Ct, b as St, r as vt, t as jt, h as Mt } from "./useBuilderProp-81a14920.js";
4
- import { A as Dt, c as kt, a as Rt, b as It } from "./accordion-c0176dc5.js";
5
- import { A as At, b as Pt, a as Lt, C as Gt, g as Ft, f as Ht, d as zt, c as Vt, e as Et, T as Bt } from "./textarea-0750bcd2.js";
2
+ import { D as Ve, f as Ee, d as Be, k as Oe, e as $e, h as qe, l as Je, p as Ke, g as Qe, i as Ue, j as We, m as Xe, n as Ye, o as Ze, c as et, H as tt, b as at, a as ot, S as st } from "./dropdown-menu-ae3ed09b.js";
3
+ import { B as nt, S as dt, a as it, d as lt, f as mt, g as ct, T as pt, e as ut, b as ft, r as xt, t as gt, h as bt } from "./useBuilderProp-81a14920.js";
4
+ import { A as yt, c as Nt, a as wt, b as Ct } from "./accordion-c0176dc5.js";
5
+ import { A as vt, b as jt, a as Mt, C as Tt, g as Dt, f as kt, d as Rt, c as It, e as _t, T as At } from "./textarea-0750bcd2.js";
6
6
  import { j as a } from "./jsx-runtime-944c88e2.js";
7
7
  import { cva as c } from "class-variance-authority";
8
8
  import { c as r } from "./utils-ac68b2c8.js";
9
+ import { A as Lt, g as Gt, h as Ft, b as Ht, f as zt, d as Vt, c as Et, e as Bt, a as Ot } from "./alert-dialog-ee98f47e.js";
9
10
  import { D as g, a as b } from "./dialog-3d4e82ed.js";
10
- import { f as qt, d as $t, c as Jt, e as Kt, b as Qt } from "./dialog-3d4e82ed.js";
11
- import { a as Wt, b as Xt, I as Yt, L as Zt, R as ea } from "./link-e406254f.js";
12
- import { L as aa } from "./label-e770a087.js";
13
- import { S as sa, a as ra } from "./scroll-area-9f64a082.js";
14
- import { T as da, c as ia, a as la, b as ma } from "./tabs-85caa1e8.js";
15
- import { P as pa, b as ua, a as fa } from "./popover-f7addcf4.js";
11
+ import { f as qt, d as Jt, c as Kt, e as Qt, b as Ut } from "./dialog-3d4e82ed.js";
12
+ import { I as Xt } from "./input-a0ea2bc7.js";
13
+ import { L as Zt } from "./label-e770a087.js";
14
+ import { S as ta, a as aa } from "./scroll-area-9f64a082.js";
15
+ import { T as sa, c as ra, a as na, b as da } from "./tabs-85caa1e8.js";
16
+ import { P as la, b as ma, a as ca } from "./popover-f7addcf4.js";
16
17
  import * as n from "react";
17
18
  import { ChevronRightIcon as h, CheckIcon as y, DotFilledIcon as N, Cross2Icon as w, MagnifyingGlassIcon as C } from "@radix-ui/react-icons";
18
19
  import * as s from "@radix-ui/react-menubar";
19
- import { S as ga, d as ba, a as ha, f as ya, e as Na, g as wa, c as Ca, b as Sa } from "./select-7fddd7c3.js";
20
+ import { S as ua, d as fa, a as xa, f as ga, e as ba, g as ha, c as ya, b as Na } from "./select-7fddd7c3.js";
20
21
  import * as d from "@radix-ui/react-dialog";
21
- import { S as ja } from "./separator-a80d065b.js";
22
+ import { S as Ca } from "./separator-a80d065b.js";
22
23
  import { Command as i } from "cmdk";
23
- import { C as Ta, d as Da, b as ka, i as Ra, c as Ia, f as _a, j as Aa, n as Pa, e as La, g as Ga, h as Fa, k as Ha, l as za, m as Va, a as Ea } from "./context-menu-e1c240ce.js";
24
+ import { C as va, d as ja, b as Ma, i as Ta, c as Da, f as ka, j as Ra, n as Ia, e as _a, g as Aa, h as Pa, k as La, l as Ga, m as Fa, a as Ha } from "./context-menu-e1c240ce.js";
25
+ import { I as Va, a as Ea, L as Ba, R as Oa } from "./link-f80a947d.js";
24
26
  import "@radix-ui/react-toggle";
25
27
  import "@radix-ui/react-switch";
26
- import "@radix-ui/react-alert-dialog";
27
28
  import "@radix-ui/react-hover-card";
28
29
  import "@radix-ui/react-dropdown-menu";
29
30
  import "@radix-ui/react-slot";
@@ -34,11 +35,7 @@ import "lodash";
34
35
  import "@radix-ui/react-accordion";
35
36
  import "clsx";
36
37
  import "tailwind-merge";
37
- import "react-icons-picker";
38
- import "react-dom";
39
- import "./ImagesPanel-eccf9a56.js";
40
- import "react-quill";
41
- import "react-i18next";
38
+ import "@radix-ui/react-alert-dialog";
42
39
  import "@radix-ui/react-label";
43
40
  import "@radix-ui/react-scroll-area";
44
41
  import "@radix-ui/react-tabs";
@@ -46,6 +43,11 @@ import "@radix-ui/react-popover";
46
43
  import "@radix-ui/react-select";
47
44
  import "@radix-ui/react-separator";
48
45
  import "@radix-ui/react-context-menu";
46
+ import "react-icons-picker";
47
+ import "react-dom";
48
+ import "./ImagesPanel-8ccab6d9.js";
49
+ import "react-quill";
50
+ import "react-i18next";
49
51
  const S = c(
50
52
  "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
51
53
  {
@@ -273,7 +275,7 @@ const B = n.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a.jsx(
273
275
  B.displayName = i.List.displayName;
274
276
  const O = n.forwardRef((e, t) => /* @__PURE__ */ a.jsx(i.Empty, { ref: t, className: "py-6 text-center text-sm", ...e }));
275
277
  O.displayName = i.Empty.displayName;
276
- const q = n.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a.jsx(
278
+ const $ = n.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a.jsx(
277
279
  i.Group,
278
280
  {
279
281
  ref: o,
@@ -284,9 +286,9 @@ const q = n.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a.jsx(
284
286
  ...t
285
287
  }
286
288
  ));
287
- q.displayName = i.Group.displayName;
288
- const $ = n.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a.jsx(i.Separator, { ref: o, className: r("-mx-1 h-px bg-border", e), ...t }));
289
- $.displayName = i.Separator.displayName;
289
+ $.displayName = i.Group.displayName;
290
+ const q = n.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a.jsx(i.Separator, { ref: o, className: r("-mx-1 h-px bg-border", e), ...t }));
291
+ q.displayName = i.Separator.displayName;
290
292
  const J = n.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ a.jsx(
291
293
  i.Item,
292
294
  {
@@ -302,84 +304,84 @@ J.displayName = i.Item.displayName;
302
304
  const K = ({ className: e, ...t }) => /* @__PURE__ */ a.jsx("span", { className: r("ml-auto text-xs tracking-widest text-muted-foreground", e), ...t });
303
305
  K.displayName = "CommandShortcut";
304
306
  export {
305
- Dt as Accordion,
306
- kt as AccordionContent,
307
- Rt as AccordionItem,
308
- It as AccordionTrigger,
309
- At as Alert,
310
- Pt as AlertDescription,
311
- Ve as AlertDialog,
312
- Ee as AlertDialogAction,
313
- Be as AlertDialogCancel,
314
- Oe as AlertDialogContent,
315
- qe as AlertDialogDescription,
316
- $e as AlertDialogFooter,
317
- Je as AlertDialogHeader,
318
- Ke as AlertDialogTitle,
319
- Qe as AlertDialogTrigger,
320
- Lt as AlertTitle,
307
+ yt as Accordion,
308
+ Nt as AccordionContent,
309
+ wt as AccordionItem,
310
+ Ct as AccordionTrigger,
311
+ vt as Alert,
312
+ jt as AlertDescription,
313
+ Lt as AlertDialog,
314
+ Gt as AlertDialogAction,
315
+ Ft as AlertDialogCancel,
316
+ Ht as AlertDialogContent,
317
+ zt as AlertDialogDescription,
318
+ Vt as AlertDialogFooter,
319
+ Et as AlertDialogHeader,
320
+ Bt as AlertDialogTitle,
321
+ Ot as AlertDialogTrigger,
322
+ Mt as AlertTitle,
321
323
  je as Badge,
322
- xt as Button,
323
- Gt as Card,
324
- Ft as CardContent,
325
- Ht as CardDescription,
326
- zt as CardFooter,
327
- Vt as CardHeader,
328
- Et as CardTitle,
324
+ nt as Button,
325
+ Tt as Card,
326
+ Dt as CardContent,
327
+ kt as CardDescription,
328
+ Rt as CardFooter,
329
+ It as CardHeader,
330
+ _t as CardTitle,
329
331
  f as Command,
330
332
  Pe as CommandDialog,
331
333
  O as CommandEmpty,
332
- q as CommandGroup,
334
+ $ as CommandGroup,
333
335
  E as CommandInput,
334
336
  J as CommandItem,
335
337
  B as CommandList,
336
- $ as CommandSeparator,
338
+ q as CommandSeparator,
337
339
  K as CommandShortcut,
338
- Ta as ContextMenu,
339
- Da as ContextMenuCheckboxItem,
340
- ka as ContextMenuContent,
341
- Ra as ContextMenuGroup,
342
- Ia as ContextMenuItem,
343
- _a as ContextMenuLabel,
344
- Aa as ContextMenuPortal,
345
- Pa as ContextMenuRadioGroup,
346
- La as ContextMenuRadioItem,
347
- Ga as ContextMenuSeparator,
348
- Fa as ContextMenuShortcut,
349
- Ha as ContextMenuSub,
350
- za as ContextMenuSubContent,
351
- Va as ContextMenuSubTrigger,
352
- Ea as ContextMenuTrigger,
340
+ va as ContextMenu,
341
+ ja as ContextMenuCheckboxItem,
342
+ Ma as ContextMenuContent,
343
+ Ta as ContextMenuGroup,
344
+ Da as ContextMenuItem,
345
+ ka as ContextMenuLabel,
346
+ Ra as ContextMenuPortal,
347
+ Ia as ContextMenuRadioGroup,
348
+ _a as ContextMenuRadioItem,
349
+ Aa as ContextMenuSeparator,
350
+ Pa as ContextMenuShortcut,
351
+ La as ContextMenuSub,
352
+ Ga as ContextMenuSubContent,
353
+ Fa as ContextMenuSubTrigger,
354
+ Ha as ContextMenuTrigger,
353
355
  g as Dialog,
354
356
  b as DialogContent,
355
357
  qt as DialogDescription,
356
- $t as DialogFooter,
357
- Jt as DialogHeader,
358
- Kt as DialogTitle,
359
- Qt as DialogTrigger,
360
- Ue as DropdownMenu,
361
- We as DropdownMenuCheckboxItem,
362
- Xe as DropdownMenuContent,
363
- Ye as DropdownMenuGroup,
364
- Ze as DropdownMenuItem,
365
- et as DropdownMenuLabel,
366
- tt as DropdownMenuPortal,
367
- at as DropdownMenuRadioGroup,
368
- ot as DropdownMenuRadioItem,
369
- st as DropdownMenuSeparator,
370
- rt as DropdownMenuShortcut,
371
- nt as DropdownMenuSub,
372
- dt as DropdownMenuSubContent,
373
- it as DropdownMenuSubTrigger,
374
- lt as DropdownMenuTrigger,
375
- mt as HoverCard,
376
- ct as HoverCardContent,
377
- pt as HoverCardTrigger,
378
- Wt as IconPickerField,
379
- Xt as ImagePickerField,
380
- Yt as Input,
381
- aa as Label,
382
- Zt as LinkField,
358
+ Jt as DialogFooter,
359
+ Kt as DialogHeader,
360
+ Qt as DialogTitle,
361
+ Ut as DialogTrigger,
362
+ Ve as DropdownMenu,
363
+ Ee as DropdownMenuCheckboxItem,
364
+ Be as DropdownMenuContent,
365
+ Oe as DropdownMenuGroup,
366
+ $e as DropdownMenuItem,
367
+ qe as DropdownMenuLabel,
368
+ Je as DropdownMenuPortal,
369
+ Ke as DropdownMenuRadioGroup,
370
+ Qe as DropdownMenuRadioItem,
371
+ Ue as DropdownMenuSeparator,
372
+ We as DropdownMenuShortcut,
373
+ Xe as DropdownMenuSub,
374
+ Ye as DropdownMenuSubContent,
375
+ Ze as DropdownMenuSubTrigger,
376
+ et as DropdownMenuTrigger,
377
+ tt as HoverCard,
378
+ at as HoverCardContent,
379
+ ot as HoverCardTrigger,
380
+ Va as IconPickerField,
381
+ Ea as ImagePickerField,
382
+ Xt as Input,
383
+ Zt as Label,
384
+ Ba as LinkField,
383
385
  v as Menubar,
384
386
  R as MenubarCheckboxItem,
385
387
  D as MenubarContent,
@@ -396,21 +398,21 @@ export {
396
398
  T as MenubarSubContent,
397
399
  M as MenubarSubTrigger,
398
400
  j as MenubarTrigger,
399
- pa as Popover,
400
- ua as PopoverContent,
401
- fa as PopoverTrigger,
402
- ea as RTEField,
403
- sa as ScrollArea,
404
- ra as ScrollBar,
405
- ga as Select,
406
- ba as SelectContent,
407
- ha as SelectGroup,
408
- ya as SelectItem,
409
- Na as SelectLabel,
410
- wa as SelectSeparator,
411
- Ca as SelectTrigger,
412
- Sa as SelectValue,
413
- ja as Separator,
401
+ la as Popover,
402
+ ma as PopoverContent,
403
+ ca as PopoverTrigger,
404
+ Oa as RTEField,
405
+ ta as ScrollArea,
406
+ aa as ScrollBar,
407
+ ua as Select,
408
+ fa as SelectContent,
409
+ xa as SelectGroup,
410
+ ga as SelectItem,
411
+ ba as SelectLabel,
412
+ ha as SelectSeparator,
413
+ ya as SelectTrigger,
414
+ Na as SelectValue,
415
+ Ca as Separator,
414
416
  Ie as Sheet,
415
417
  Ae as SheetClose,
416
418
  G as SheetContent,
@@ -419,24 +421,24 @@ export {
419
421
  F as SheetHeader,
420
422
  z as SheetTitle,
421
423
  _e as SheetTrigger,
422
- gt as Skeleton,
423
- ut as Switch,
424
- da as Tabs,
425
- ia as TabsContent,
426
- la as TabsList,
427
- ma as TabsTrigger,
428
- Bt as Textarea,
429
- bt as Toaster,
424
+ dt as Skeleton,
425
+ st as Switch,
426
+ sa as Tabs,
427
+ ra as TabsContent,
428
+ na as TabsList,
429
+ da as TabsTrigger,
430
+ At as Textarea,
431
+ it as Toaster,
430
432
  Fe as Toggle,
431
- ht as Tooltip,
432
- yt as TooltipContent,
433
- Nt as TooltipPortal,
434
- wt as TooltipProvider,
435
- Ct as TooltipTrigger,
433
+ lt as Tooltip,
434
+ mt as TooltipContent,
435
+ ct as TooltipPortal,
436
+ pt as TooltipProvider,
437
+ ut as TooltipTrigger,
436
438
  S as badgeVariants,
437
- St as buttonVariants,
438
- vt as reducer,
439
- jt as toast,
439
+ ft as buttonVariants,
440
+ xt as reducer,
441
+ gt as toast,
440
442
  He as toggleVariants,
441
- Mt as useToast
443
+ bt as useToast
442
444
  };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("./index-ebd86d7f.cjs"),n=require("./index-207f2cbf.cjs");require("react-i18next");const a=require("./useBuilderProp-5e57d0c8.cjs"),c=()=>{const[s]=["SAVED"],[e,u]=t.useCurrentPage(),r=t.useBuilderReset();return i=>s==="UNSAVED"?(a.toast({variant:"destructive",title:"Please save unsaved changes"}),!1):e===i.uuid?!1:(r(),setTimeout(()=>{u(i.uuid)},100),!0)},d=()=>{const s=t.useQueryClient(),e=c();return n.useMutation({mutationFn:async u=>fetch("/pages",{method:"POST",body:JSON.stringify(u)}).then(r=>r.json()),onSuccess:u=>{s.invalidateQueries({queryKey:["pages"]}),e({uuid:u.uuid,slug:u.slug}),n.Nt.success("Page added successfully.")}})},o=()=>{const s=t.useQueryClient();return n.useMutation({mutationFn:async e=>fetch(`/page?uuid=${e.uuid}`,{method:"DELETE",body:JSON.stringify(e)}),onSuccess:()=>{n.Nt.success("Page deleted successfully."),s.invalidateQueries({queryKey:["pages"]})}})};exports.useAddPage=d;exports.useDeletePage=o;
@@ -0,0 +1,36 @@
1
+ import { a2 as c, a3 as o, X as n } from "./index-390f7bef.js";
2
+ import { u as r, N as i } from "./index-824a7bd0.js";
3
+ import "react-i18next";
4
+ import { t as d } from "./useBuilderProp-81a14920.js";
5
+ const g = () => {
6
+ const [t] = ["SAVED"], [e, s] = c(), u = o();
7
+ return (a) => t === "UNSAVED" ? (d({ variant: "destructive", title: "Please save unsaved changes" }), !1) : e === a.uuid ? !1 : (u(), setTimeout(() => {
8
+ s(a.uuid);
9
+ }, 100), !0);
10
+ }, P = () => {
11
+ const t = n(), e = g();
12
+ return r({
13
+ mutationFn: async (s) => fetch("/pages", {
14
+ method: "POST",
15
+ body: JSON.stringify(s)
16
+ }).then((u) => u.json()),
17
+ onSuccess: (s) => {
18
+ t.invalidateQueries({ queryKey: ["pages"] }), e({ uuid: s.uuid, slug: s.slug }), i.success("Page added successfully.");
19
+ }
20
+ });
21
+ }, h = () => {
22
+ const t = n();
23
+ return r({
24
+ mutationFn: async (e) => fetch(`/page?uuid=${e.uuid}`, {
25
+ method: "DELETE",
26
+ body: JSON.stringify(e)
27
+ }),
28
+ onSuccess: () => {
29
+ i.success("Page deleted successfully."), t.invalidateQueries({ queryKey: ["pages"] });
30
+ }
31
+ });
32
+ };
33
+ export {
34
+ h as a,
35
+ P as u
36
+ };
@@ -0,0 +1,17 @@
1
+ import { X as u, Y as o } from "./index-390f7bef.js";
2
+ import { u as a, N as c } from "./index-824a7bd0.js";
3
+ const p = (e = "Project updated successfully.") => {
4
+ const s = u(), t = o();
5
+ return a({
6
+ mutationFn: async (r) => await fetch(`${t}/project`, {
7
+ method: "PUT",
8
+ body: JSON.stringify(r)
9
+ }),
10
+ onSuccess: () => {
11
+ s.invalidateQueries({ queryKey: ["project"] }), c.success(e);
12
+ }
13
+ });
14
+ };
15
+ export {
16
+ p as u
17
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./index-ebd86d7f.cjs"),t=require("./index-207f2cbf.cjs"),n=(s="Project updated successfully.")=>{const c=e.useQueryClient(),r=e.useApiBaseUrl();return t.useMutation({mutationFn:async u=>await fetch(`${r}/project`,{method:"PUT",body:JSON.stringify(u)}),onSuccess:()=>{c.invalidateQueries({queryKey:["project"]}),t.Nt.success(s)}})};exports.useUpdateProject=n;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chaibuilder/sdk",
3
3
  "private": false,
4
- "version": "0.1.2",
4
+ "version": "0.1.3",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -83,6 +83,7 @@
83
83
  "@tailwindcss/forms": "^0.5.6",
84
84
  "@tailwindcss/line-clamp": "^0.4.4",
85
85
  "@tailwindcss/typography": "^0.5.10",
86
+ "@tanstack/react-query": "^5.8.4",
86
87
  "analytics": "^0.8.9",
87
88
  "class-variance-authority": "0.6.1",
88
89
  "clsx": "1.2.1",
@@ -117,6 +118,7 @@
117
118
  "react-textarea-autosize": "^8.5.2",
118
119
  "react-wrap-balancer": "^1.0.0",
119
120
  "redux-undo": "1.1.0",
121
+ "sonner": "^1.2.0",
120
122
  "tailwind-merge": "1.13.2",
121
123
  "tailwindcss-animate": "1.0.6",
122
124
  "tippy.js": "^6.3.7",
@@ -126,7 +128,11 @@
126
128
  "devDependencies": {
127
129
  "@commitlint/cli": "17.7.1",
128
130
  "@commitlint/config-conventional": "17.7.0",
131
+ "@faker-js/faker": "^8.3.1",
132
+ "@nozbe/watermelondb": "^0.27.1",
129
133
  "@playwright/test": "^1.39.0",
134
+ "@tanstack/eslint-plugin-query": "^5.8.4",
135
+ "@types/better-sqlite3": "^7.6.7",
130
136
  "@types/jest": "^29.5.7",
131
137
  "@types/lodash": "^4.14.200",
132
138
  "@types/node": "^20.8.10",
@@ -137,12 +143,16 @@
137
143
  "@vitejs/plugin-react-swc": "^3.3.2",
138
144
  "autoprefixer": "^10.4.16",
139
145
  "better-docs": "^2.7.2",
146
+ "better-sqlite3": "^9.1.1",
147
+ "drizzle-kit": "^0.20.4",
148
+ "drizzle-orm": "^0.29.0",
140
149
  "eslint": "^8.45.0",
141
150
  "eslint-plugin-react-hooks": "^4.6.0",
142
151
  "eslint-plugin-react-refresh": "^0.4.3",
143
152
  "jest": "^29.7.0",
144
153
  "jest-environment-jsdom": "^29.7.0",
145
154
  "jsdoc": "^4.0.2",
155
+ "msw": "^2.0.8",
146
156
  "postcss": "^8.4.31",
147
157
  "prettier": "^3.0.3",
148
158
  "prettier-plugin-tailwindcss": "^0.5.6",
@@ -152,5 +162,8 @@
152
162
  "typescript": "^5.0.2",
153
163
  "vite": "^4.4.5",
154
164
  "vite-plugin-dts": "^3.6.3"
165
+ },
166
+ "msw": {
167
+ "workerDirectory": "public"
155
168
  }
156
169
  }
@@ -1,60 +0,0 @@
1
- "use strict";var He=Object.defineProperty;var Ke=(e,n,r)=>n in e?He(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var Z=(e,n,r)=>(Ke(e,typeof n!="symbol"?n+"":n,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),v=require("lodash"),Y=require("@radix-ui/react-icons"),G=require("./useBuilderProp-5e57d0c8.cjs"),h=require("./index-73cf645f.cjs"),$e=require("react-i18next"),re=require("./separator-a597dba7.cjs"),L=require("./dropdown-menu-a9b096f9.cjs"),Ve=require("./label-167415e5.cjs"),Q=require("jotai"),Ge=require("@floating-ui/dom"),we=require("@floating-ui/react-dom"),Xe=require("react-dnd"),Ze=require("@react-hookz/web"),Je=require("@bobthered/tailwindcss-palette-generator"),Qe=require("react-wrap-balancer"),et=require("tailwind-merge"),oe=require("./CONTROLS-031e1de3.cjs"),tt=require("@chaibuilder/blocks"),ke=require("react-dom"),nt=require("./_commonjsHelpers-5a53b418.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@radix-ui/react-separator");require("@radix-ui/react-switch");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-label");const rt=()=>{const{undoCount:e,redoCount:n,undo:r,redo:a}=h.useCanvasHistory();return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[t.jsxRuntimeExports.jsx(G.Button,{disabled:!e,size:"sm",onClick:r,className:"rounded-full",variant:"ghost",children:t.jsxRuntimeExports.jsx(Y.ResetIcon,{})}),t.jsxRuntimeExports.jsx(G.Button,{disabled:!n,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:t.jsxRuntimeExports.jsx(Y.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function st(){const[e,n]=h.useDarkMode(),{t:r}=$e.useTranslation();return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[t.jsxRuntimeExports.jsx(Ve.Label,{htmlFor:"dark-mode-switch",children:r("dark_mode")}),t.jsxRuntimeExports.jsxs(L.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{n(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
2
- relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[t.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),t.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
3
- pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const Ce=({landscape:e=!1})=>t.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[t.jsxRuntimeExports.jsx("g",{strokeWidth:0}),t.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),t.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),Te=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:t.jsxRuntimeExports.jsx(Y.MobileIcon,{}),width:400},{title:"Mobile landscape (SM)",content:"Styles set here are applied at 640px and up unless edited at higher breakpoint",breakpoint:"sm",icon:t.jsxRuntimeExports.jsx(Y.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:t.jsxRuntimeExports.jsx(Ce,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:t.jsxRuntimeExports.jsx(Ce,{landscape:!0}),width:1024},{title:"Desktop (XL)",content:"Styles set here are applied at 1280px and up unless edited at higher breakpoint",breakpoint:"xl",icon:t.jsxRuntimeExports.jsx(Y.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:t.jsxRuntimeExports.jsx(Y.DesktopIcon,{}),width:1920}],ot=({title:e,content:n,currentBreakpoint:r,breakpoint:a,width:u,icon:o,onClick:i})=>t.jsxRuntimeExports.jsxs(L.HoverCard,{children:[t.jsxRuntimeExports.jsx(L.HoverCardTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx(G.Button,{onClick:()=>i(u),size:"sm",variant:a===r?"secondary":"ghost",children:o})}),t.jsxRuntimeExports.jsx(L.HoverCardContent,{className:"w-52 border-border",children:t.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:t.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[t.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:e}),t.jsxRuntimeExports.jsx("p",{className:"text-xs",children:n})]})})})]}),it=()=>{const[,e,n]=h.useCanvasWidth(),[r,a]=h.useSelectedBreakpoints(),u=o=>{r.includes(o)?r.length>2&&a(r.filter(i=>i!==o)):a(i=>[...i,o])};return t.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[v.map(Te.filter(o=>v.includes(r,v.toUpper(o.breakpoint))),o=>g.createElement(ot,{...o,onClick:n,key:o.breakpoint,currentBreakpoint:e})),t.jsxRuntimeExports.jsxs(L.DropdownMenu,{children:[t.jsxRuntimeExports.jsx(L.DropdownMenuTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:t.jsxRuntimeExports.jsx(Y.DotsVerticalIcon,{className:"scale-90 transform"})})}),t.jsxRuntimeExports.jsxs(L.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[t.jsxRuntimeExports.jsx(L.DropdownMenuLabel,{children:"Breakpoints"}),t.jsxRuntimeExports.jsx(L.DropdownMenuSeparator,{}),v.map(Te,o=>t.jsxRuntimeExports.jsx(L.DropdownMenuCheckboxItem,{disabled:o.breakpoint==="xs",onCheckedChange:()=>u(v.toUpper(o.breakpoint)),checked:v.includes(r,v.toUpper(o.breakpoint)),children:o.title},o.breakpoint))]})]})]})},at=()=>{const[e]=h.useSetAllBlocks(),{createSnapshot:n}=h.useCanvasHistory(),[,r]=h.useSelectedBlockIds(),[,a]=h.useSelectedStylingBlocks(),u=g.useCallback(()=>{e([]),r([]),a([]),n()},[e,n]);return t.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:t.jsxRuntimeExports.jsxs(L.AlertDialog,{children:[t.jsxRuntimeExports.jsx(L.AlertDialogTrigger,{asChild:!0,children:t.jsxRuntimeExports.jsxs(G.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[t.jsxRuntimeExports.jsx(Y.EraserIcon,{})," Clear"]})}),t.jsxRuntimeExports.jsxs(L.AlertDialogContent,{className:"border-border",children:[t.jsxRuntimeExports.jsxs(L.AlertDialogHeader,{children:[t.jsxRuntimeExports.jsx(L.AlertDialogTitle,{children:"Clear whole canvas?"}),t.jsxRuntimeExports.jsx(L.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),t.jsxRuntimeExports.jsxs(L.AlertDialogFooter,{children:[t.jsxRuntimeExports.jsx(L.AlertDialogCancel,{children:"Cancel"}),t.jsxRuntimeExports.jsx(L.AlertDialogAction,{onClick:u,children:"Yes"})]})]})]})})},ct=()=>{const e=h.useFeatureSupport("darkMode",!1),[n]=h.useCanvasZoom();return t.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[t.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(st,{}),t.jsxRuntimeExports.jsx(re.Separator,{orientation:"vertical"})]}):null,t.jsxRuntimeExports.jsx(it,{}),t.jsxRuntimeExports.jsx(re.Separator,{orientation:"vertical"}),t.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[t.jsxRuntimeExports.jsx(Y.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",t.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[v.round(n,0),"%"]})]}),t.jsxRuntimeExports.jsx(re.Separator,{orientation:"vertical"}),t.jsxRuntimeExports.jsx(rt,{})]}),t.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[t.jsxRuntimeExports.jsx(re.Separator,{orientation:"vertical"}),t.jsxRuntimeExports.jsx(at,{})]})]})},pe={FRAMEWORK:"FRAMEWORK",STATIC:"STATIC",EMAIL:"EMAIL",PRESENTATION:"PRESENTATION",GRAPHIC:"GRAPHIC"},lt=`<!doctype html>
4
- <html class="scroll-smooth h-full overflow-y-auto">
5
- <head>
6
- <meta charset="UTF-8">
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
- <script src="https://old.chaibuilder.com/offline/tailwind.cdn.js"><\/script>
9
- <style>
10
- html { height: 100%; overflow:auto; }
11
- body { height: 100%; }
12
- .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
13
- .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
14
- body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
15
- -moz-user-select: none;-ms-user-select: none; user-select: none; }
16
- html{
17
- -ms-overflow-style: none; /* IE and Edge */
18
- scrollbar-width: none; /* Firefox */
19
- }
20
- /** IMPORTANT: Make fields content editable in SAFARI */
21
- [contenteditable] {-webkit-user-select: text;user-select: text;}
22
-
23
- html::-webkit-scrollbar { width: 0 !important }
24
- .aspect-auto{aspect-ratio: auto;}
25
- .aspect-square{aspect-ratio: 1/1;}
26
- .aspect-video{aspect-ratio: 16/9;}
27
- a{ pointer-events: none !important; }
28
- </style>
29
- <style id="hidden-blocks"></style>
30
- <style id="selected-block"></style>
31
- <style id="selected-styling-block"></style>
32
- <style id="highlighted-block"></style>
33
- </head>
34
- <body class="font-body antialiased h-full">
35
- <div class="frame-root"></div>
36
- </body>
37
- </html>`,ut=e=>{const[n]=h.useCanvasWidth(),[,r]=h.useCanvasZoom(),[a,u]=g.useState({}),o=g.useCallback(()=>{const{width:i,height:p}=e;if(i<n){const y=parseFloat((i/n).toString());let f={};p&&(f={height:p+2*p*(1-y)}),u({transform:`scale(${y})`,transformOrigin:"top left",...f,maxWidth:"none"}),r(y*100)}else u({}),r(100)},[n,e,r]);return g.useEffect(()=>{o()},[n,e,r,o]),a};var ge={exports:{}},se={exports:{}},O={};/** @license React v16.13.1
38
- * react-is.production.min.js
39
- *
40
- * Copyright (c) Facebook, Inc. and its affiliates.
41
- *
42
- * This source code is licensed under the MIT license found in the
43
- * LICENSE file in the root directory of this source tree.
44
- */var _e;function dt(){if(_e)return O;_e=1;var e=typeof Symbol=="function"&&Symbol.for,n=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,a=e?Symbol.for("react.fragment"):60107,u=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,p=e?Symbol.for("react.context"):60110,y=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,x=e?Symbol.for("react.suspense"):60113,R=e?Symbol.for("react.suspense_list"):60120,E=e?Symbol.for("react.memo"):60115,B=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,j=e?Symbol.for("react.responder"):60118,H=e?Symbol.for("react.scope"):60119;function q(l){if(typeof l=="object"&&l!==null){var $=l.$$typeof;switch($){case n:switch(l=l.type,l){case y:case f:case a:case o:case u:case x:return l;default:switch(l=l&&l.$$typeof,l){case p:case m:case B:case E:case i:return l;default:return $}}case r:return $}}}function N(l){return q(l)===f}return O.AsyncMode=y,O.ConcurrentMode=f,O.ContextConsumer=p,O.ContextProvider=i,O.Element=n,O.ForwardRef=m,O.Fragment=a,O.Lazy=B,O.Memo=E,O.Portal=r,O.Profiler=o,O.StrictMode=u,O.Suspense=x,O.isAsyncMode=function(l){return N(l)||q(l)===y},O.isConcurrentMode=N,O.isContextConsumer=function(l){return q(l)===p},O.isContextProvider=function(l){return q(l)===i},O.isElement=function(l){return typeof l=="object"&&l!==null&&l.$$typeof===n},O.isForwardRef=function(l){return q(l)===m},O.isFragment=function(l){return q(l)===a},O.isLazy=function(l){return q(l)===B},O.isMemo=function(l){return q(l)===E},O.isPortal=function(l){return q(l)===r},O.isProfiler=function(l){return q(l)===o},O.isStrictMode=function(l){return q(l)===u},O.isSuspense=function(l){return q(l)===x},O.isValidElementType=function(l){return typeof l=="string"||typeof l=="function"||l===a||l===f||l===o||l===u||l===x||l===R||typeof l=="object"&&l!==null&&(l.$$typeof===B||l.$$typeof===E||l.$$typeof===i||l.$$typeof===p||l.$$typeof===m||l.$$typeof===_||l.$$typeof===j||l.$$typeof===H||l.$$typeof===w)},O.typeOf=q,O}var M={};/** @license React v16.13.1
45
- * react-is.development.js
46
- *
47
- * Copyright (c) Facebook, Inc. and its affiliates.
48
- *
49
- * This source code is licensed under the MIT license found in the
50
- * LICENSE file in the root directory of this source tree.
51
- */var Ae;function pt(){return Ae||(Ae=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,n=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,a=e?Symbol.for("react.fragment"):60107,u=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,p=e?Symbol.for("react.context"):60110,y=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,m=e?Symbol.for("react.forward_ref"):60112,x=e?Symbol.for("react.suspense"):60113,R=e?Symbol.for("react.suspense_list"):60120,E=e?Symbol.for("react.memo"):60115,B=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,j=e?Symbol.for("react.responder"):60118,H=e?Symbol.for("react.scope"):60119;function q(c){return typeof c=="string"||typeof c=="function"||c===a||c===f||c===o||c===u||c===x||c===R||typeof c=="object"&&c!==null&&(c.$$typeof===B||c.$$typeof===E||c.$$typeof===i||c.$$typeof===p||c.$$typeof===m||c.$$typeof===_||c.$$typeof===j||c.$$typeof===H||c.$$typeof===w)}function N(c){if(typeof c=="object"&&c!==null){var V=c.$$typeof;switch(V){case n:var ne=c.type;switch(ne){case y:case f:case a:case o:case u:case x:return ne;default:var Se=ne&&ne.$$typeof;switch(Se){case p:case m:case B:case E:case i:return Se;default:return V}}case r:return V}}}var l=y,$=f,U=p,z=i,ie=n,ae=m,ee=a,ce=B,le=E,J=r,ue=o,K=u,X=x,te=!1;function de(c){return te||(te=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),s(c)||N(c)===y}function s(c){return N(c)===f}function d(c){return N(c)===p}function T(c){return N(c)===i}function k(c){return typeof c=="object"&&c!==null&&c.$$typeof===n}function b(c){return N(c)===m}function A(c){return N(c)===a}function S(c){return N(c)===B}function C(c){return N(c)===E}function I(c){return N(c)===r}function D(c){return N(c)===o}function P(c){return N(c)===u}function F(c){return N(c)===x}M.AsyncMode=l,M.ConcurrentMode=$,M.ContextConsumer=U,M.ContextProvider=z,M.Element=ie,M.ForwardRef=ae,M.Fragment=ee,M.Lazy=ce,M.Memo=le,M.Portal=J,M.Profiler=ue,M.StrictMode=K,M.Suspense=X,M.isAsyncMode=de,M.isConcurrentMode=s,M.isContextConsumer=d,M.isContextProvider=T,M.isElement=k,M.isForwardRef=b,M.isFragment=A,M.isLazy=S,M.isMemo=C,M.isPortal=I,M.isProfiler=D,M.isStrictMode=P,M.isSuspense=F,M.isValidElementType=q,M.typeOf=N}()),M}var Ie;function Ne(){return Ie||(Ie=1,process.env.NODE_ENV==="production"?se.exports=dt():se.exports=pt()),se.exports}/*
52
- object-assign
53
- (c) Sindre Sorhus
54
- @license MIT
55
- */var fe,Pe;function ft(){if(Pe)return fe;Pe=1;var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function a(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function u(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var i={},p=0;p<10;p++)i["_"+String.fromCharCode(p)]=p;var y=Object.getOwnPropertyNames(i).map(function(m){return i[m]});if(y.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(m){f[m]=m}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return fe=u()?Object.assign:function(o,i){for(var p,y=a(o),f,m=1;m<arguments.length;m++){p=Object(arguments[m]);for(var x in p)n.call(p,x)&&(y[x]=p[x]);if(e){f=e(p);for(var R=0;R<f.length;R++)r.call(p,f[R])&&(y[f[R]]=p[f[R]])}}return y},fe}var xe,Oe;function be(){if(Oe)return xe;Oe=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return xe=e,xe}var me,Me;function Le(){return Me||(Me=1,me=Function.call.bind(Object.prototype.hasOwnProperty)),me}var he,De;function xt(){if(De)return he;De=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var n=be(),r={},a=Le();e=function(o){var i="Warning: "+o;typeof console<"u"&&console.error(i);try{throw new Error(i)}catch{}}}function u(o,i,p,y,f){if(process.env.NODE_ENV!=="production"){for(var m in o)if(a(o,m)){var x;try{if(typeof o[m]!="function"){var R=Error((y||"React class")+": "+p+" type `"+m+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[m]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}x=o[m](i,m,y,p,null,n)}catch(B){x=B}if(x&&!(x instanceof Error)&&e((y||"React class")+": type specification of "+p+" `"+m+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof x+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),x instanceof Error&&!(x.message in r)){r[x.message]=!0;var E=f?f():"";e("Failed "+p+" type: "+x.message+(E??""))}}}}return u.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},he=u,he}var ye,Be;function mt(){if(Be)return ye;Be=1;var e=Ne(),n=ft(),r=be(),a=Le(),u=xt(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(p){var y="Warning: "+p;typeof console<"u"&&console.error(y);try{throw new Error(y)}catch{}});function i(){return null}return ye=function(p,y){var f=typeof Symbol=="function"&&Symbol.iterator,m="@@iterator";function x(s){var d=s&&(f&&s[f]||s[m]);if(typeof d=="function")return d}var R="<<anonymous>>",E={array:j("array"),bigint:j("bigint"),bool:j("boolean"),func:j("function"),number:j("number"),object:j("object"),string:j("string"),symbol:j("symbol"),any:H(),arrayOf:q,element:N(),elementType:l(),instanceOf:$,node:ae(),objectOf:z,oneOf:U,oneOfType:ie,shape:ce,exact:le};function B(s,d){return s===d?s!==0||1/s===1/d:s!==s&&d!==d}function w(s,d){this.message=s,this.data=d&&typeof d=="object"?d:{},this.stack=""}w.prototype=Error.prototype;function _(s){if(process.env.NODE_ENV!=="production")var d={},T=0;function k(A,S,C,I,D,P,F){if(I=I||R,P=P||C,F!==r){if(y){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var V=I+":"+C;!d[V]&&T<3&&(o("You are manually calling a React.PropTypes validation function for the `"+P+"` prop on `"+I+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),d[V]=!0,T++)}}return S[C]==null?A?S[C]===null?new w("The "+D+" `"+P+"` is marked as required "+("in `"+I+"`, but its value is `null`.")):new w("The "+D+" `"+P+"` is marked as required in "+("`"+I+"`, but its value is `undefined`.")):null:s(S,C,I,D,P)}var b=k.bind(null,!1);return b.isRequired=k.bind(null,!0),b}function j(s){function d(T,k,b,A,S,C){var I=T[k],D=K(I);if(D!==s){var P=X(I);return new w("Invalid "+A+" `"+S+"` of type "+("`"+P+"` supplied to `"+b+"`, expected ")+("`"+s+"`."),{expectedType:s})}return null}return _(d)}function H(){return _(i)}function q(s){function d(T,k,b,A,S){if(typeof s!="function")return new w("Property `"+S+"` of component `"+b+"` has invalid PropType notation inside arrayOf.");var C=T[k];if(!Array.isArray(C)){var I=K(C);return new w("Invalid "+A+" `"+S+"` of type "+("`"+I+"` supplied to `"+b+"`, expected an array."))}for(var D=0;D<C.length;D++){var P=s(C,D,b,A,S+"["+D+"]",r);if(P instanceof Error)return P}return null}return _(d)}function N(){function s(d,T,k,b,A){var S=d[T];if(!p(S)){var C=K(S);return new w("Invalid "+b+" `"+A+"` of type "+("`"+C+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return _(s)}function l(){function s(d,T,k,b,A){var S=d[T];if(!e.isValidElementType(S)){var C=K(S);return new w("Invalid "+b+" `"+A+"` of type "+("`"+C+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return _(s)}function $(s){function d(T,k,b,A,S){if(!(T[k]instanceof s)){var C=s.name||R,I=de(T[k]);return new w("Invalid "+A+" `"+S+"` of type "+("`"+I+"` supplied to `"+b+"`, expected ")+("instance of `"+C+"`."))}return null}return _(d)}function U(s){if(!Array.isArray(s))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),i;function d(T,k,b,A,S){for(var C=T[k],I=0;I<s.length;I++)if(B(C,s[I]))return null;var D=JSON.stringify(s,function(F,c){var V=X(c);return V==="symbol"?String(c):c});return new w("Invalid "+A+" `"+S+"` of value `"+String(C)+"` "+("supplied to `"+b+"`, expected one of "+D+"."))}return _(d)}function z(s){function d(T,k,b,A,S){if(typeof s!="function")return new w("Property `"+S+"` of component `"+b+"` has invalid PropType notation inside objectOf.");var C=T[k],I=K(C);if(I!=="object")return new w("Invalid "+A+" `"+S+"` of type "+("`"+I+"` supplied to `"+b+"`, expected an object."));for(var D in C)if(a(C,D)){var P=s(C,D,b,A,S+"."+D,r);if(P instanceof Error)return P}return null}return _(d)}function ie(s){if(!Array.isArray(s))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),i;for(var d=0;d<s.length;d++){var T=s[d];if(typeof T!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+te(T)+" at index "+d+"."),i}function k(b,A,S,C,I){for(var D=[],P=0;P<s.length;P++){var F=s[P],c=F(b,A,S,C,I,r);if(c==null)return null;c.data&&a(c.data,"expectedType")&&D.push(c.data.expectedType)}var V=D.length>0?", expected one of type ["+D.join(", ")+"]":"";return new w("Invalid "+C+" `"+I+"` supplied to "+("`"+S+"`"+V+"."))}return _(k)}function ae(){function s(d,T,k,b,A){return J(d[T])?null:new w("Invalid "+b+" `"+A+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return _(s)}function ee(s,d,T,k,b){return new w((s||"React class")+": "+d+" type `"+T+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+b+"`.")}function ce(s){function d(T,k,b,A,S){var C=T[k],I=K(C);if(I!=="object")return new w("Invalid "+A+" `"+S+"` of type `"+I+"` "+("supplied to `"+b+"`, expected `object`."));for(var D in s){var P=s[D];if(typeof P!="function")return ee(b,A,S,D,X(P));var F=P(C,D,b,A,S+"."+D,r);if(F)return F}return null}return _(d)}function le(s){function d(T,k,b,A,S){var C=T[k],I=K(C);if(I!=="object")return new w("Invalid "+A+" `"+S+"` of type `"+I+"` "+("supplied to `"+b+"`, expected `object`."));var D=n({},T[k],s);for(var P in D){var F=s[P];if(a(s,P)&&typeof F!="function")return ee(b,A,S,P,X(F));if(!F)return new w("Invalid "+A+" `"+S+"` key `"+P+"` supplied to `"+b+"`.\nBad object: "+JSON.stringify(T[k],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(s),null," "));var c=F(C,P,b,A,S+"."+P,r);if(c)return c}return null}return _(d)}function J(s){switch(typeof s){case"number":case"string":case"undefined":return!0;case"boolean":return!s;case"object":if(Array.isArray(s))return s.every(J);if(s===null||p(s))return!0;var d=x(s);if(d){var T=d.call(s),k;if(d!==s.entries){for(;!(k=T.next()).done;)if(!J(k.value))return!1}else for(;!(k=T.next()).done;){var b=k.value;if(b&&!J(b[1]))return!1}}else return!1;return!0;default:return!1}}function ue(s,d){return s==="symbol"?!0:d?d["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&d instanceof Symbol:!1}function K(s){var d=typeof s;return Array.isArray(s)?"array":s instanceof RegExp?"object":ue(d,s)?"symbol":d}function X(s){if(typeof s>"u"||s===null)return""+s;var d=K(s);if(d==="object"){if(s instanceof Date)return"date";if(s instanceof RegExp)return"regexp"}return d}function te(s){var d=X(s);switch(d){case"array":case"object":return"an "+d;case"boolean":case"date":case"regexp":return"a "+d;default:return d}}function de(s){return!s.constructor||!s.constructor.name?R:s.constructor.name}return E.checkPropTypes=u,E.resetWarningCache=u.resetWarningCache,E.PropTypes=E,E},ye}var ve,qe;function ht(){if(qe)return ve;qe=1;var e=be();function n(){}function r(){}return r.resetWarningCache=n,ve=function(){function a(i,p,y,f,m,x){if(x!==e){var R=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw R.name="Invariant Violation",R}}a.isRequired=a;function u(){return a}var o={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:u,element:a,elementType:a,instanceOf:u,node:a,objectOf:u,oneOf:u,oneOfType:u,shape:u,exact:u,checkPropTypes:r,resetWarningCache:n};return o.PropTypes=o,o},ve}if(process.env.NODE_ENV!=="production"){var yt=Ne(),vt=!0;ge.exports=mt()(yt.isElement,vt)}else ge.exports=ht()();var gt=ge.exports;const W=nt.getDefaultExportFromCjs(gt);let Fe,We;typeof document<"u"&&(Fe=document);typeof window<"u"&&(We=window);const Ye=g.createContext({document:Fe,window:We}),Re=()=>g.useContext(Ye),{Provider:Et,Consumer:$t}=Ye;class Ue extends g.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return g.Children.only(this.props.children)}}Z(Ue,"propTypes",{children:W.element.isRequired,contentDidMount:W.func.isRequired,contentDidUpdate:W.func.isRequired});class Ee extends g.Component{constructor(r,a){super(r,a);Z(this,"setRef",r=>{this.nodeRef.current=r;const{forwardedRef:a}=this.props;typeof a=="function"?a(r):a&&(a.current=r)});Z(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});Z(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=g.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const r=this.getDoc();return this.props.mountTarget?r.querySelector(this.props.mountTarget):r.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const r=this.getDoc();if(!r)return null;const a=this.props.contentDidMount,u=this.props.contentDidUpdate,o=r.defaultView||r.parentView,i=t.jsxRuntimeExports.jsx(Ue,{contentDidMount:a,contentDidUpdate:u,children:t.jsxRuntimeExports.jsx(Et,{value:{document:r,window:o},children:t.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),p=this.getMountTarget();return[ke.createPortal(this.props.head,this.getDoc().head),ke.createPortal(i,p)]}render(){const r={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete r.head,delete r.initialContent,delete r.mountTarget,delete r.contentDidMount,delete r.contentDidUpdate,delete r.forwardedRef,t.jsxRuntimeExports.jsx("iframe",{...r,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}Z(Ee,"propTypes",{style:W.object,head:W.node,initialContent:W.string,mountTarget:W.string,contentDidMount:W.func,contentDidUpdate:W.func,children:W.oneOfType([W.element,W.arrayOf(W.element)])}),Z(Ee,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const jt=g.forwardRef((e,n)=>t.jsxRuntimeExports.jsx(Ee,{...e,forwardedRef:n})),bt=({children:e})=>{const{document:n}=Re(),[r]=h.useSelectedBlockIds(),[a,u]=h.useSelectedStylingBlocks();return g.useEffect(()=>{setTimeout(()=>{if(!v.isEmpty(a))return;const o=ze(n,v.first(r));if(o){const i=o.getAttribute("data-style-prop");if(i){const p=o.getAttribute("data-style-id"),y=o.getAttribute("data-block-parent");u([{id:p,prop:i,blockId:y}])}}},100)},[n,r,u,a]),t.jsxRuntimeExports.jsx("div",{id:"canvas",className:"relative h-screen max-w-full outline-2",children:e})},ze=(e,n)=>e.querySelector(`[data-block-id="${n}"]`),Rt=()=>{const{window:e}=Re(),[n,r]=h.useSelectedBlockIds(),[,a]=h.useSelectedStylingBlocks(),{undo:u,redo:o}=h.useCanvasHistory(),i=h.useDuplicateBlocks(),[,p]=h.useCutBlockIds(),[,y]=h.useCopyBlockIds(),{pasteBlocks:f}=h.usePasteBlocks(),[,m]=h.usePreviewMode(),x=h.useRemoveBlocks(),{savePage:R}=h.useSavePage(),[E]=Q.useAtom(h.inlineEditingActiveAtom),[,B]=Q.useAtom(h.editLayerNameAtom),w=_=>{_.key==="Enter"&&(_.preventDefault(),n.length===1&&B(v.first(n)))};return g.useEffect(()=>{const _=j=>{if(j.key==="Escape"){r([]),a([]);return}if(w(j),!E&&(j.key==="Delete"||j.key==="Backspace")&&(j.preventDefault(),x(n)),j.ctrlKey||j.metaKey){if(["z","y","d","x","c","p","s","v"].includes(j.key)){if(E&&["x","z","v"].includes(j.key))return!0;j.preventDefault()}j.key==="s"&&(j.stopPropagation(),j.preventDefault(),R()),j.key==="z"&&u(),j.key==="y"&&o(),j.key==="d"&&i(n),j.key==="x"&&p(n),j.key==="c"&&y(n),j.key==="v"&&n.length>0&&f(n[0])}};return e.removeEventListener("keydown",_),e.addEventListener("keydown",_),()=>{e.removeEventListener("keydown",_)}},[n,r,u,x,m,o,i,p,y,f,E,R,e]),null},St=({block:e,label:n})=>{const[,r]=Xe.useDrag(()=>({type:"CANVAS_BLOCK",item:e}));return t.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",ref:r,onDragStart:()=>{console.log("drag start")},children:[t.jsxRuntimeExports.jsx(Y.DragHandleDots2Icon,{}),n]})},wt=({selectedBlockElement:e,block:n})=>{const r=h.useRemoveBlocks(),a=h.useDuplicateBlocks(),[,u]=h.useSelectedBlockIds(),[,o]=h.useSelectedStylingBlocks(),{floatingStyles:i,refs:p,update:y}=we.useFloating({placement:"top-start",middleware:[we.shift(),Ge.flip()],elements:{reference:e}});Ze.useResizeObserver(e,()=>y(),e!==null);const f=v.get(n,"_parent",null),m=v.isEmpty(v.get(n,"_name",""))?v.get(n,"_type",""):v.get(n,"_name","");return!e||!n?null:t.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:p.setFloating,style:i,onClick:x=>{x.stopPropagation(),x.preventDefault()},onKeyDown:x=>x.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[t.jsxRuntimeExports.jsx(St,{label:m,block:n}),t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[f&&t.jsxRuntimeExports.jsx(Y.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{o([]),u([f])}}),h.canDuplicateBlock(v.get(n,"_type",""))?t.jsxRuntimeExports.jsx(Y.CopyIcon,{className:"hover:scale-105 ",onClick:()=>a([n==null?void 0:n._id])}):null,h.canDeleteBlock(v.get(n,"_type",""))?t.jsxRuntimeExports.jsx(Y.TrashIcon,{className:"hover:scale-105 ",onClick:()=>r([n==null?void 0:n._id])}):null]})]})},kt=({model:e})=>{const[n]=h.useBrandingOptions(),[r]=h.useSelectedBlockIds(),[a]=h.useDarkMode(),[u]=h.useHighlightBlockId(),[o]=h.useSelectedStylingBlocks(),{document:i,window:p}=Re(),[y]=g.useState(i==null?void 0:i.getElementById("highlighted-block")),[f]=g.useState(i==null?void 0:i.getElementById("selected-block")),[m]=g.useState(i==null?void 0:i.getElementById("selected-styling-block"));g.useEffect(()=>{a?i==null||i.documentElement.classList.add("dark"):i==null||i.documentElement.classList.remove("dark")},[a,i]);const x=v.get(n,"_headingFont","DM Sans"),R=v.get(n,"_bodyFont","DM Sans");return g.useEffect(()=>{const E=v.get(n,"_primaryColor","#000"),B=v.get(n,"_secondaryColor","#FFF"),w=Je.tailwindcssPaletteGenerator({colors:[E,B],names:["primary","secondary"]});w.primary.DEFAULT=E,w.secondary.DEFAULT=B;const _=v.get(n,"_roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[x],body:[R]},extend:{borderRadius:{global:`${_||"0"}px`},colors:w}},plugins:[p.tailwind.plugin.withOptions(({prefix:j="ui"}={})=>({addVariant:H})=>{for(const q of["open","checked","selected","active","disabled"])H(`${j}-${q}`,[`&[data-headlessui-state~="${q}"]`,`:where([data-headlessui-state~="${q}"]) &`]),H(`${j}-not-${q}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${q}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${q}"])) &:not([data-headlessui-state])`])})]})},[n,p,x,R]),g.useEffect(()=>{f&&(f.textContent=`${v.map(r,E=>`[data-block-id="${E}"]`).join(",")}{
57
- outline: 1px solid ${r.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
58
- }`)},[r,f]),g.useEffect(()=>{y&&(y.textContent=u?`[data-style-id="${u}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[u,r,y]),g.useEffect(()=>{m&&(m.textContent=`${v.map(o,({id:E})=>`[data-style-id="${E}"]`).join(",")}{
59
- outline: 1px solid orange !important; outline-offset: -1px;
60
- }`)},[o,m]),g.useEffect(()=>{if(e==="section")return;const E=v.get(n,"_bodyTextLightColor","#64748b"),B=v.get(n,"_bodyTextDarkColor","#94a3b8"),w=v.get(n,"_bodyBgLightColor","#FFFFFF"),_=v.get(n,"_bodyBgDarkColor","#0f172a");i.body.className=`font-body antialiased text-[${E}] bg-[${w}] dark:text-[${B}] dark:bg-[${_}]`},[n,i,e]),e==="page"?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[x&&t.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${x.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),R&&x!==R&&t.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${R.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),x&&t.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${x}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},Ct=()=>{const{t:e}=$e.useTranslation();return t.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:t.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:e("canvas_empty")})})},Tt=e=>{const n={};return Object.keys(e).forEach(r=>{v.isString(e[r])&&e[r].startsWith(oe.SLOT_KEY)&&(n[r]=e[r].replace(oe.SLOT_KEY,"").split(","))}),n},_t=v.memoize(e=>{const n=e.replace(oe.STYLES_KEY,"").split(",");return et.twMerge(n[0],n[1])});function At(e,n){return v.get(e,`${n}_attrs`,{})}function It(e,n,r,a){const u={};return Object.keys(e).forEach(o=>{if(v.isString(e[o])&&e[o].startsWith(oe.STYLES_KEY)){const i=_t(e[o]);u[o]={className:i,"data-style-prop":o,"data-block-parent":e._id,"data-style-id":`${o}-${e._id}`,onMouseEnter:n,onMouseLeave:r,onClick:a,...At(e,o)}}}),u}function je({blocks:e}){const n=h.useAllBlocks(),[,r]=h.useHighlightBlockId(),[,a]=h.useSelectedStylingBlocks(),[,u]=h.useSelectedBlockIds(),o=g.useCallback(f=>{var x;const m=(x=f.currentTarget)==null?void 0:x.getAttribute("data-style-id");r(m||""),f.stopPropagation()},[r]),i=g.useCallback(f=>{r(""),f.stopPropagation()},[r]),p=g.useCallback(f=>{f.stopPropagation();const m=f.currentTarget;if(m.getAttribute("data-block-parent")){const x=m.getAttribute("data-style-prop"),R=m.getAttribute("data-style-id"),E=m.getAttribute("data-block-parent");a([{id:R,prop:x,blockId:E}]),u([E])}else if(m.getAttribute("data-block-id")&&(u([m.getAttribute("data-block-id")]),m.getAttribute("data-block-parent"))){const x=m.getAttribute("data-style-prop"),R=m.getAttribute("data-style-id"),E=m.getAttribute("data-block-parent");a([{id:R,prop:x,blockId:E}])}},[a,u]),y=g.useCallback(f=>It(f,o,i,p),[o,i]);return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:g.Children.toArray(e.map((f,m)=>{const x=Tt(f),R={};v.isEmpty(x)||Object.keys(x).forEach(_=>{R[_]=g.Children.toArray(x[_].map(j=>t.jsxRuntimeExports.jsx(je,{blocks:[v.find(n,{_id:j})]})))});const E=v.filter(n,{_parent:f._id});R.children=E.length?t.jsxRuntimeExports.jsx(je,{blocks:E}):null;const B=tt.getBlockComponent(f._type),w=(B==null?void 0:B.component)||null;return g.createElement(w,{blockProps:{onClick:p,"data-block-id":f._id,"data-block-type":f._type},...f,index:m,...y(f),...R,inBuilder:!0})}))})}const Pt=()=>{const e=h.useAllBlocks();return t.jsxRuntimeExports.jsx(Qe.Provider,{children:e.length?t.jsxRuntimeExports.jsx(je,{blocks:v.filter(e,n=>v.isEmpty(n._parent))}):t.jsxRuntimeExports.jsx(Ct,{})})},Ot=(e,n)=>e.querySelector(`[data-style-id="${n}"]`),Mt=()=>{const[e]=Q.useAtom(h.networkModeAtom),[n]=h.usePreviewMode(),[r]=h.useCanvasWidth(),[,a]=h.useSelectedBlockIds(),u=h.useSelectedBlock(),[,o]=h.useHighlightBlockId(),i=g.useRef(null),p=g.useRef(null),[y,f]=g.useState({width:0,height:0}),m=ut(y),[x,R]=g.useState(0),[E,B]=g.useState([]),[,w]=g.useState([]),[,_]=Q.useAtom(h.canvasIframeAtom),[j,H]=h.useSelectedStylingBlocks(),q=G.useBuilderProp("loadingCanvas",!1);g.useEffect(()=>{const{clientWidth:$,clientHeight:U}=p.current;f({width:$,height:U}),x===0&&R($)},[p,r,x]);const N=($,U=0)=>{const{top:z}=$.getBoundingClientRect();return z+U>=0&&z-U<=window.innerHeight};g.useEffect(()=>{var $,U;if(u&&u.type!=="Multiple"&&i.current){const z=ze(i.current.contentDocument,u._id);z&&(N(z)||(U=($=i.current)==null?void 0:$.contentWindow)==null||U.scrollTo({top:z.offsetTop,behavior:"smooth"}),B([z]))}},[u]),g.useEffect(()=>{if(!v.isEmpty(j)&&i.current){const $=Ot(i.current.contentDocument,v.first(j).id);w($?[$]:[null])}else w([null])},[j]);const l=g.useMemo(()=>{let $=lt;return e==="offline"&&($=$.replace("https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio","/offline/tailwind.cdn.js"),$=$.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),$=$.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),$},[e]);return t.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),H([])},onMouseLeave:()=>setTimeout(()=>o(""),300),className:"relative mx-auto h-full w-full bg-black/80",style:x>0&&!v.isEmpty(m)?{width:n?"100%":x}:{},ref:p,children:t.jsxRuntimeExports.jsxs(jt,{contentDidMount:()=>_(i.current),ref:i,id:"canvas-iframe",style:{width:`${r}px`,...m},className:"relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",initialContent:l,children:[t.jsxRuntimeExports.jsx(Rt,{}),t.jsxRuntimeExports.jsx(wt,{block:u,selectedBlockElement:v.first(E)}),t.jsxRuntimeExports.jsx(kt,{model:"page"}),t.jsxRuntimeExports.jsxs(bt,{children:[q?t.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:t.jsxRuntimeExports.jsx(G.Skeleton,{className:"h-full"})}):t.jsxRuntimeExports.jsx(Pt,{}),t.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},Dt=g.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-e23baf9a.cjs"))),Bt=()=>{const e=G.useBuilderProp("mode",pe.STATIC),[n,r]=Q.useAtom(h.addBlocksModalAtom),a={[pe.STATIC]:t.jsxRuntimeExports.jsx(Mt,{}),[pe.FRAMEWORK]:null}[e];return t.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[t.jsxRuntimeExports.jsx(ct,{}),t.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/20 bg-[linear-gradient(to_right,#EEE_0.5px,transparent_0.5px),linear-gradient(to_bottom,#EEE_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[t.jsxRuntimeExports.jsx(g.Suspense,{fallback:t.jsxRuntimeExports.jsx(G.Skeleton,{className:"h-full"}),children:t.jsxRuntimeExports.jsx(h.ErrorBoundary,{children:a})}),n?t.jsxRuntimeExports.jsx("div",{onClick:()=>r(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:t.jsxRuntimeExports.jsx("div",{onClick:u=>u.stopPropagation(),className:"mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",children:t.jsxRuntimeExports.jsx(Dt,{})})}):null]})]})};exports.default=Bt;