@chaibuilder/sdk 1.2.22 → 1.2.23

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 (106) hide show
  1. package/dist/AddBlocks-b0Vk6eqO.js +206 -0
  2. package/dist/AddBlocks-bgu08YJC.cjs +1 -0
  3. package/dist/BrandingOptions-AljW1cXz.cjs +1 -0
  4. package/dist/{BrandingOptions-4961TxX2.js → BrandingOptions-eUSoIgjj.js} +10 -9
  5. package/dist/CanvasArea-dp1tzDkK.cjs +55 -0
  6. package/dist/CanvasArea-ulUy_rmB.js +951 -0
  7. package/dist/{Class-MmCxz2Ay.cjs → Class-PoYusiA5.cjs} +1 -1
  8. package/dist/{Class-3k8xjeiM.js → Class-lGzsNBOK.js} +1 -1
  9. package/dist/{CurrentPage-oPZN6Gwj.js → CurrentPage-SFhXzQMy.js} +9 -10
  10. package/dist/CurrentPage-rWHgPomd.cjs +1 -0
  11. package/dist/ListTree-5n8U4-IF.cjs +1 -0
  12. package/dist/ListTree-ZeVWczTF.js +309 -0
  13. package/dist/MODIFIERS-0g14w5RS.cjs +1 -0
  14. package/dist/{MODIFIERS-WQdaNvb8.js → MODIFIERS-dytZ-osO.js} +4 -8
  15. package/dist/{PagesPanel-pRKHw-AZ.js → PagesPanel-IkZjy0Gn.js} +9 -10
  16. package/dist/PagesPanel-sBN51kKZ.cjs +1 -0
  17. package/dist/{ProjectPanel-iU6DY-Yp.js → ProjectPanel-e98TJLfI.js} +10 -11
  18. package/dist/ProjectPanel-lbQH31jc.cjs +1 -0
  19. package/dist/STRINGS--j49GZJP.js +7 -0
  20. package/dist/STRINGS-gPz7CUOk.cjs +1 -0
  21. package/dist/{Settings-BhSrj-cE.js → Settings-FZWm8Fc3.js} +862 -865
  22. package/dist/Settings-qytQoyTv.cjs +1 -0
  23. package/dist/SidePanels-YRIM1IPq.cjs +1 -0
  24. package/dist/{SidePanels-OLOUpKn4.js → SidePanels-wrkkpcGE.js} +119 -123
  25. package/dist/{Topbar-Ny9T-7Zb.js → Topbar-LUyDFBkK.js} +6 -5
  26. package/dist/Topbar-NOSnWo7V.cjs +1 -0
  27. package/dist/{UnsplashImages-Y8RGFVSh.js → UnsplashImages-eZedbK2J.js} +16 -15
  28. package/dist/UnsplashImages-f-ObKOC-.cjs +1 -0
  29. package/dist/{UploadImages-dd8LfyFr.js → UploadImages-71QziLbr.js} +11 -10
  30. package/dist/UploadImages-oOnccvT9.cjs +1 -0
  31. package/dist/add-page-modal-g3fd00P5.cjs +1 -0
  32. package/dist/{add-page-modal-Jni6CY1x.js → add-page-modal-yQ6qL6Ui.js} +10 -11
  33. package/dist/{confirm-alert-sc8RaWvD.js → confirm-alert-3flAvzWH.js} +6 -5
  34. package/dist/confirm-alert-LQsGNYz8.cjs +1 -0
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.d.ts +1 -0
  37. package/dist/core.js +48 -49
  38. package/dist/defaultTheme-7VqqhOcp.cjs +1 -0
  39. package/dist/{defaultTheme-gunU_Fe5.js → defaultTheme-D8B4-wHO.js} +1 -1
  40. package/dist/{delete-page-modal-0WiMZFxr.js → delete-page-modal-iMmkPec0.js} +9 -10
  41. package/dist/delete-page-modal-tzZmqGzE.cjs +1 -0
  42. package/dist/email.cjs +1 -1
  43. package/dist/email.d.ts +1 -0
  44. package/dist/email.js +16 -16
  45. package/dist/{form-n1Q6u16z.cjs → form-LBHtTduy.cjs} +1 -1
  46. package/dist/{form-Nj6Kdn3g.js → form-zKUMQFuB.js} +1 -1
  47. package/dist/html-to-json-efmv1pCj.cjs +1 -0
  48. package/dist/{html-to-json-C5sExaSD.js → html-to-json-ngX9ef2u.js} +31 -29
  49. package/dist/{index-nwAgi0aD.cjs → index--dUsFH1I.cjs} +1 -1
  50. package/dist/{index-IPJAbzzO.js → index-HD1UKc4P.js} +1091 -1063
  51. package/dist/{index-0bwkNnA0.cjs → index-bOWwCMRF.cjs} +42 -42
  52. package/dist/index-fvMaxES9.cjs +1 -0
  53. package/dist/{index-_VPpjzJu.js → index-m4WGov7e.js} +4 -4
  54. package/dist/{index-UP_4awU9.js → index-uLtBNl55.js} +4479 -4484
  55. package/dist/lib.cjs +3 -3
  56. package/dist/lib.js +17 -16
  57. package/dist/page-viewer-5gTszT-n.cjs +1 -0
  58. package/dist/{page-viewer-L1Dmgj-c.js → page-viewer-7AwzWRtB.js} +14 -15
  59. package/dist/project-general-setting-52CTYL_w.cjs +1 -0
  60. package/dist/{project-general-setting-sUP7JqWK.js → project-general-setting-pYPoqvqd.js} +10 -11
  61. package/dist/project-seo-setting-jTweI1DX.cjs +1 -0
  62. package/dist/{project-seo-setting-NNvAGt4T.js → project-seo-setting-zXKOcjep.js} +7 -6
  63. package/dist/render.cjs +1 -1
  64. package/dist/render.js +14 -13
  65. package/dist/single-page-detail-jy2SPcp1.cjs +1 -0
  66. package/dist/{single-page-detail-FXg_NebW.js → single-page-detail-q2TDxN-P.js} +11 -12
  67. package/dist/studio.cjs +1 -1
  68. package/dist/studio.d.ts +1 -0
  69. package/dist/studio.js +8 -9
  70. package/dist/ui.cjs +1 -1
  71. package/dist/ui.js +138 -137
  72. package/dist/web-blocks.cjs +6 -1
  73. package/dist/web-blocks.js +462 -354
  74. package/package.json +3 -5
  75. package/dist/AddBlocks-157fSrJX.cjs +0 -1
  76. package/dist/AddBlocks-WgpssWmQ.js +0 -223
  77. package/dist/BrandingOptions-nwXR9TMl.cjs +0 -1
  78. package/dist/CanvasArea-MajWGr9z.js +0 -908
  79. package/dist/CanvasArea-MmTlc5Vb.cjs +0 -55
  80. package/dist/CurrentPage-LpLr0lDI.cjs +0 -1
  81. package/dist/ListTree-dvxHTXs4.js +0 -167
  82. package/dist/ListTree-gTmusfso.cjs +0 -1
  83. package/dist/MODIFIERS-9EwxLM8V.cjs +0 -1
  84. package/dist/Outline-2OxsXs1-.js +0 -294
  85. package/dist/Outline-7CCnnzmK.cjs +0 -1
  86. package/dist/PagesPanel-8536oBWB.cjs +0 -1
  87. package/dist/ProjectPanel-oILsUWOH.cjs +0 -1
  88. package/dist/Settings-jHiYmt0y.cjs +0 -1
  89. package/dist/SidePanels-bcJJocSq.cjs +0 -1
  90. package/dist/Topbar-NMvzqQHW.cjs +0 -1
  91. package/dist/TypeIcon-ElNNPazl.cjs +0 -1
  92. package/dist/TypeIcon-qO96rNbV.js +0 -69
  93. package/dist/UnsplashImages-6tZv1q2_.cjs +0 -1
  94. package/dist/UploadImages-VLlVg9Ur.cjs +0 -1
  95. package/dist/add-page-modal-IsqDdK7X.cjs +0 -1
  96. package/dist/confirm-alert-f26zJ7Js.cjs +0 -1
  97. package/dist/defaultTheme-7Lk2zq60.cjs +0 -1
  98. package/dist/delete-page-modal-c3b-GCap.cjs +0 -1
  99. package/dist/html-to-json-FGufPv9R.cjs +0 -1
  100. package/dist/index-9PHdn80L.cjs +0 -1
  101. package/dist/page-viewer-TnxHhq7S.cjs +0 -1
  102. package/dist/project-general-setting-1Ot1RU43.cjs +0 -1
  103. package/dist/project-seo-setting-3-vBkx2v.cjs +0 -1
  104. package/dist/single-page-detail-btEKYXjE.cjs +0 -1
  105. package/dist/useAddBlockByDrop-V8xo-PNQ.js +0 -20
  106. package/dist/useAddBlockByDrop-qRHgy8_0.cjs +0 -1
@@ -1,908 +0,0 @@
1
- var Le = Object.defineProperty;
2
- var Re = (e, t, n) => t in e ? Le(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var M = (e, t, n) => (Re(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- import { j as s } from "./jsx-runtime-WbnYoNE9.js";
5
- import A, { createElement as oe, useCallback as G, useState as C, useEffect as k, Component as me, Children as Fe, Suspense as ge, useRef as ie, useMemo as Pe } from "react";
6
- import { map as $, includes as ae, toUpper as Y, round as $e, throttle as fe, noop as F, isEmpty as S, first as W, omit as Oe, pick as He, get as f, isString as X, memoize as ze, each as Ue, find as We, filter as xe, isNull as qe, has as Ke } from "lodash-es";
7
- import { ResetIcon as re, MobileIcon as le, LaptopIcon as Ve, DesktopIcon as Ye, DotsVerticalIcon as Je, EraserIcon as Qe, ZoomInIcon as Ze, DragHandleDots2Icon as Ge, ArrowUpIcon as Xe, CopyIcon as et, TrashIcon as tt } from "@radix-ui/react-icons";
8
- import { v as ye, B as q, V as be, aB as nt, aC as st, aD as ot, aE as it, aF as at, N as ee, ab as rt, h as te, aG as lt, aH as dt, aI as ct, aJ as pt, aK as ut, aL as ht, aM as mt, r as B, ac as E, A as gt, a as ft, b as xt, c as yt, d as bt, e as vt, f as kt, g as wt, ai as jt, O as ve, aA as U, aN as Ct, Y as L, a5 as Bt, aO as R, E as ne, t as ke, q as we, s as je, z as Dt, aP as It, aQ as Ce, aR as St, aS as _t, F as Nt, aT as Mt, a1 as At, aU as Et, S as Be } from "./index-IPJAbzzO.js";
9
- import { useTranslation as K } from "react-i18next";
10
- import { useAtom as w } from "jotai";
11
- import de from "react-dom";
12
- import v from "prop-types";
13
- import { Quill as Tt } from "react-quill";
14
- import { u as Lt } from "./useAddBlockByDrop-V8xo-PNQ.js";
15
- import { useFeature as De } from "flagged";
16
- import { flip as Rt } from "@floating-ui/dom";
17
- import { useFloating as Ft, shift as Pt } from "@floating-ui/react-dom";
18
- import { useResizeObserver as $t } from "@react-hookz/web";
19
- import { tailwindcssPaletteGenerator as Ot } from "@bobthered/tailwindcss-palette-generator";
20
- import { Provider as Ht } from "react-wrap-balancer";
21
- import { twMerge as zt } from "tailwind-merge";
22
- import { S as ce, a as Ie } from "./MODIFIERS-WQdaNvb8.js";
23
- import { getBlockComponent as Ut } from "@chaibuilder/runtime";
24
- import { u as Wt, B as qt, E as Kt } from "./index-UP_4awU9.js";
25
- import "./_commonjsHelpers-UyOWmZb0.js";
26
- import "./Functions-7jnEwJyw.js";
27
- import "clsx";
28
- import "@radix-ui/react-toggle";
29
- import "class-variance-authority";
30
- import "./Class-3k8xjeiM.js";
31
- import "@radix-ui/react-switch";
32
- import "@radix-ui/react-slot";
33
- import "@radix-ui/react-accordion";
34
- import "@radix-ui/react-alert-dialog";
35
- import "@radix-ui/react-dialog";
36
- import "@radix-ui/react-label";
37
- import "@radix-ui/react-scroll-area";
38
- import "@radix-ui/react-tabs";
39
- import "@radix-ui/react-tooltip";
40
- import "@radix-ui/react-popover";
41
- import "@radix-ui/react-menubar";
42
- import "@radix-ui/react-hover-card";
43
- import "@radix-ui/react-select";
44
- import "@radix-ui/react-dropdown-menu";
45
- import "@radix-ui/react-separator";
46
- import "@radix-ui/react-toast";
47
- import "cmdk";
48
- import "@radix-ui/react-context-menu";
49
- import "react-icons-picker";
50
- import "i18next";
51
- import "react-dnd";
52
- import "@minoru/react-dnd-treeview";
53
- import "react-hotkeys-hook";
54
- const Vt = () => {
55
- const { hasUndo: e, hasRedo: t, undo: n, redo: a } = ye();
56
- return /* @__PURE__ */ s.jsxs("div", { className: "flex items-center", children: [
57
- /* @__PURE__ */ s.jsx(q, { disabled: !e(), size: "sm", onClick: n, className: "rounded-full", variant: "ghost", children: /* @__PURE__ */ s.jsx(re, {}) }),
58
- /* @__PURE__ */ s.jsx(q, { disabled: !t(), onClick: a, size: "sm", className: "rounded-full", variant: "ghost", children: /* @__PURE__ */ s.jsx(re, { className: "rotate-180 scale-y-[-1] transform" }) })
59
- ] });
60
- };
61
- function Yt() {
62
- const [e, t] = be(), { t: n } = K();
63
- return /* @__PURE__ */ s.jsxs("div", { className: "flex items-center", children: [
64
- /* @__PURE__ */ s.jsx(nt, { htmlFor: "dark-mode-switch", children: n("dark_mode") }),
65
- /* @__PURE__ */ s.jsxs(
66
- st,
67
- {
68
- id: "dark-mode-switch",
69
- checked: e,
70
- onCheckedChange: () => {
71
- t(!e);
72
- },
73
- className: `${e ? "bg-violet-600" : "bg-violet-300"}
74
- 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`,
75
- children: [
76
- /* @__PURE__ */ s.jsx("span", { className: "sr-only", children: n("use_setting") }),
77
- /* @__PURE__ */ s.jsx(
78
- "span",
79
- {
80
- "aria-hidden": "true",
81
- className: `${e ? "translate-x-5" : "translate-x-0"}
82
- 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`
83
- }
84
- )
85
- ]
86
- }
87
- )
88
- ] });
89
- }
90
- const pe = ({ landscape: e = !1 }) => /* @__PURE__ */ s.jsxs(
91
- "svg",
92
- {
93
- className: e ? "rotate-90" : "",
94
- xmlns: "http://www.w3.org/2000/svg",
95
- viewBox: "0 0 13 13",
96
- xmlSpace: "preserve",
97
- width: 13,
98
- height: 13,
99
- children: [
100
- /* @__PURE__ */ s.jsx("g", { strokeWidth: 0 }),
101
- /* @__PURE__ */ s.jsx("g", { strokeLinecap: "round", strokeLinejoin: "round" }),
102
- /* @__PURE__ */ s.jsx(
103
- "path",
104
- {
105
- 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",
106
- style: {
107
- fill: "#000"
108
- }
109
- }
110
- )
111
- ]
112
- }
113
- ), Jt = [
114
- {
115
- title: "mobile_xs_title",
116
- content: "mobile_xs_content",
117
- breakpoint: "xs",
118
- icon: /* @__PURE__ */ s.jsx(le, {}),
119
- width: 400
120
- },
121
- {
122
- title: "mobile_sm_title",
123
- content: "mobile_sm_content",
124
- breakpoint: "sm",
125
- icon: /* @__PURE__ */ s.jsx(le, { className: "rotate-90" }),
126
- width: 640
127
- },
128
- {
129
- title: "tablet_md_title",
130
- content: "tablet_md_content",
131
- breakpoint: "md",
132
- icon: /* @__PURE__ */ s.jsx(pe, {}),
133
- width: 800
134
- },
135
- {
136
- title: "tablet_lg_title",
137
- content: "tablet_lg_content",
138
- breakpoint: "lg",
139
- icon: /* @__PURE__ */ s.jsx(pe, { landscape: !0 }),
140
- width: 1024
141
- },
142
- {
143
- title: "desktop_xl_title",
144
- content: "desktop_xl_content",
145
- breakpoint: "xl",
146
- icon: /* @__PURE__ */ s.jsx(Ve, {}),
147
- width: 1420
148
- },
149
- {
150
- title: "large_desktop_2xl_title",
151
- content: "large_desktop_2xl_content",
152
- breakpoint: "2xl",
153
- icon: /* @__PURE__ */ s.jsx(Ye, {}),
154
- width: 1920
155
- }
156
- ], ue = ({
157
- title: e,
158
- content: t,
159
- currentBreakpoint: n,
160
- breakpoint: a,
161
- width: i,
162
- icon: l,
163
- onClick: d
164
- }) => {
165
- const { t: o } = K();
166
- return /* @__PURE__ */ s.jsxs(ot, { children: [
167
- /* @__PURE__ */ s.jsx(it, { asChild: !0, children: /* @__PURE__ */ s.jsx(
168
- q,
169
- {
170
- onClick: () => d(i),
171
- size: "sm",
172
- variant: a === n ? "secondary" : "ghost",
173
- children: l
174
- }
175
- ) }),
176
- /* @__PURE__ */ s.jsx(at, { className: "w-52 border-border", children: /* @__PURE__ */ s.jsx("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ s.jsxs("div", { className: "space-y-1", children: [
177
- /* @__PURE__ */ s.jsx("h4", { className: "text-sm font-semibold", children: o(e) }),
178
- /* @__PURE__ */ s.jsx("p", { className: "text-xs", children: o(t) })
179
- ] }) }) })
180
- ] });
181
- }, Qt = () => {
182
- const [, e, t] = ee(), [n, a] = rt(), { t: i } = K(), l = te("breakpoints", Jt), d = (o) => {
183
- n.includes(o) ? n.length > 2 && a(n.filter((r) => r !== o)) : a((r) => [...r, o]);
184
- };
185
- return l.length < 4 ? /* @__PURE__ */ s.jsx("div", { className: "flex items-center rounded-md", children: $(l, (o) => /* @__PURE__ */ oe(ue, { ...o, onClick: t, key: o.breakpoint, currentBreakpoint: e })) }) : /* @__PURE__ */ s.jsxs("div", { className: "flex items-center rounded-md", children: [
186
- $(
187
- l.filter((o) => ae(n, Y(o.breakpoint))),
188
- (o) => /* @__PURE__ */ oe(ue, { ...o, onClick: t, key: o.breakpoint, currentBreakpoint: e })
189
- ),
190
- /* @__PURE__ */ s.jsxs(lt, { children: [
191
- /* @__PURE__ */ s.jsx(dt, { asChild: !0, children: /* @__PURE__ */ s.jsx("span", { className: "cursor-pointer px-2.5 hover:opacity-80", children: /* @__PURE__ */ s.jsx(Je, { className: "scale-90 transform" }) }) }),
192
- /* @__PURE__ */ s.jsxs(ct, { className: "w-56 border-border text-xs", children: [
193
- /* @__PURE__ */ s.jsx(pt, { children: i("Breakpoints") }),
194
- /* @__PURE__ */ s.jsx(ut, {}),
195
- $(l, (o) => /* @__PURE__ */ s.jsx(
196
- ht,
197
- {
198
- disabled: o.breakpoint === "xs",
199
- onCheckedChange: () => d(Y(o.breakpoint)),
200
- checked: ae(n, Y(o.breakpoint)),
201
- children: i(o.title)
202
- },
203
- o.breakpoint
204
- ))
205
- ] })
206
- ] })
207
- ] });
208
- }, Zt = () => {
209
- const { t: e } = K(), { setNewBlocks: t } = mt(), [, n] = B(), [, a] = E(), i = G(() => {
210
- t([]), n([]), a([]);
211
- }, [t]);
212
- return /* @__PURE__ */ s.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ s.jsxs(gt, { children: [
213
- /* @__PURE__ */ s.jsx(ft, { asChild: !0, children: /* @__PURE__ */ s.jsxs(q, { size: "sm", variant: "ghost", className: "flex items-center gap-x-1", children: [
214
- /* @__PURE__ */ s.jsx(Qe, {}),
215
- " ",
216
- e("clear")
217
- ] }) }),
218
- /* @__PURE__ */ s.jsxs(xt, { className: "border-border", children: [
219
- /* @__PURE__ */ s.jsxs(yt, { children: [
220
- /* @__PURE__ */ s.jsx(bt, { children: e("clear_canvas_title") }),
221
- /* @__PURE__ */ s.jsx(vt, { children: e("clear_canvas_description") })
222
- ] }),
223
- /* @__PURE__ */ s.jsxs(kt, { children: [
224
- /* @__PURE__ */ s.jsx(wt, { children: e("cancel") }),
225
- /* @__PURE__ */ s.jsx(jt, { onClick: i, children: e("yes") })
226
- ] })
227
- ] })
228
- ] }) });
229
- }, Gt = () => {
230
- const e = te("darkMode", !1), [t] = ve();
231
- return /* @__PURE__ */ s.jsxs("div", { className: "flex h-10 items-center justify-between border-b bg-background/70 px-2", children: [
232
- /* @__PURE__ */ s.jsxs("div", { className: "flex h-full space-x-2", children: [
233
- e ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
234
- /* @__PURE__ */ s.jsx(Yt, {}),
235
- /* @__PURE__ */ s.jsx(U, { orientation: "vertical" })
236
- ] }) : null,
237
- /* @__PURE__ */ s.jsx(Qt, {}),
238
- /* @__PURE__ */ s.jsx(U, { orientation: "vertical" }),
239
- /* @__PURE__ */ s.jsxs("div", { className: "flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium", children: [
240
- /* @__PURE__ */ s.jsx(Ze, { className: "h-3.5 w-3.5 flex-shrink-0" }),
241
- " ",
242
- /* @__PURE__ */ s.jsxs("div", { className: "text-xs leading-3", children: [
243
- $e(t, 0),
244
- "%"
245
- ] })
246
- ] }),
247
- /* @__PURE__ */ s.jsx(U, { orientation: "vertical" }),
248
- /* @__PURE__ */ s.jsx(Vt, {})
249
- ] }),
250
- /* @__PURE__ */ s.jsxs("div", { className: "flex h-full items-center space-x-2", children: [
251
- /* @__PURE__ */ s.jsx(U, { orientation: "vertical" }),
252
- /* @__PURE__ */ s.jsx(Zt, {})
253
- ] })
254
- ] });
255
- }, Xt = `<!doctype html>
256
- <html class="scroll-smooth h-full overflow-y-auto">
257
- <head>
258
- <meta charset="UTF-8">
259
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
260
- <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
261
- <style>
262
- html { height: 100%; overflow:auto; }
263
- body { height: 100%; }
264
- .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
265
- .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
266
- body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
267
- -moz-user-select: none;-ms-user-select: none; user-select: none; }
268
- html{
269
- -ms-overflow-style: none; /* IE and Edge */
270
- scrollbar-width: none; /* Firefox */
271
- }
272
- /** IMPORTANT: Make fields content editable in SAFARI */
273
- [contenteditable] {-webkit-user-select: text;user-select: text;}
274
-
275
- html::-webkit-scrollbar { width: 0 !important }
276
- .aspect-auto{aspect-ratio: auto;}
277
- .aspect-square{aspect-ratio: 1/1;}
278
- .aspect-video{aspect-ratio: 16/9;}
279
- .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
280
- .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
281
- a{ pointer-events: none !important; }
282
- [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
283
- [contenteditable="true"] {
284
- outline: none;
285
- box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
286
- -webkit-user-select: text;
287
- -moz-user-select: text;
288
- user-select: text;
289
- }
290
- .frame-root .frame-content { height: 100%; }
291
- </style>
292
- <style id="hidden-blocks"></style>
293
- <style id="selected-block"></style>
294
- <style id="selected-styling-block"></style>
295
- <style id="highlighted-block"></style>
296
- <style id="dragged-block"></style>
297
-
298
- </head>
299
- <body class="font-body antialiased h-full">
300
- <div class="frame-root h-full"></div>
301
- <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
302
- </body>
303
- </html>`, en = (e) => {
304
- const [t] = ee(), [, n] = ve(), [a, i] = C({}), l = G(() => {
305
- const { width: d, height: o } = e;
306
- if (d < t) {
307
- const r = parseFloat((d / t).toFixed(2).toString());
308
- let c = {};
309
- const p = o * r;
310
- o && (c = {
311
- // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
312
- height: 100 + (o - p) / p * 100 + "%"
313
- }), i({
314
- position: "relative",
315
- top: 0,
316
- transform: `scale(${r})`,
317
- transformOrigin: "top left",
318
- ...c,
319
- maxWidth: "none"
320
- }), n(r * 100);
321
- } else
322
- i({}), n(100);
323
- }, [t, e, n]);
324
- return k(() => {
325
- l();
326
- }, [t, e, n, l]), a;
327
- };
328
- let Se, _e;
329
- typeof document < "u" && (Se = document);
330
- typeof window < "u" && (_e = window);
331
- const Ne = A.createContext({ document: Se, window: _e }), V = () => A.useContext(Ne), { Provider: tn, Consumer: Cs } = Ne;
332
- class Me extends me {
333
- componentDidMount() {
334
- this.props.contentDidMount();
335
- }
336
- componentDidUpdate() {
337
- this.props.contentDidUpdate();
338
- }
339
- render() {
340
- return Fe.only(this.props.children);
341
- }
342
- }
343
- M(Me, "propTypes", {
344
- children: v.element.isRequired,
345
- contentDidMount: v.func.isRequired,
346
- contentDidUpdate: v.func.isRequired
347
- });
348
- class Q extends me {
349
- constructor(n, a) {
350
- super(n, a);
351
- M(this, "setRef", (n) => {
352
- this.nodeRef.current = n;
353
- const { forwardedRef: a } = this.props;
354
- typeof a == "function" ? a(n) : a && (a.current = n);
355
- });
356
- M(this, "handleLoad", () => {
357
- clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
358
- });
359
- // In certain situations on a cold cache DOMContentLoaded never gets called
360
- // fallback to an interval to check if that's the case
361
- M(this, "loadCheck", () => setInterval(() => {
362
- this.handleLoad();
363
- }, 500));
364
- this._isMounted = !1, this.nodeRef = A.createRef(), this.state = { iframeLoaded: !1 };
365
- }
366
- componentDidMount() {
367
- this._isMounted = !0, this.getDoc() && this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded", this.handleLoad);
368
- }
369
- componentWillUnmount() {
370
- this._isMounted = !1, this.nodeRef.current.removeEventListener("DOMContentLoaded", this.handleLoad);
371
- }
372
- getDoc() {
373
- return this.nodeRef.current ? this.nodeRef.current.contentDocument : null;
374
- }
375
- getMountTarget() {
376
- const n = this.getDoc();
377
- return this.props.mountTarget ? n.querySelector(this.props.mountTarget) : n.body.children[0];
378
- }
379
- renderFrameContents() {
380
- if (!this._isMounted)
381
- return null;
382
- const n = this.getDoc();
383
- if (!n)
384
- return null;
385
- const a = this.props.contentDidMount, i = this.props.contentDidUpdate, l = n.defaultView || n.parentView, d = /* @__PURE__ */ s.jsx(Me, { contentDidMount: a, contentDidUpdate: i, children: /* @__PURE__ */ s.jsx(tn, { value: { document: n, window: l }, children: /* @__PURE__ */ s.jsx("div", { className: "frame-content", children: this.props.children }) }) }), o = this.getMountTarget();
386
- return [de.createPortal(this.props.head, this.getDoc().head), de.createPortal(d, o)];
387
- }
388
- render() {
389
- const n = {
390
- ...this.props,
391
- srcDoc: this.props.initialContent,
392
- children: void 0
393
- // The iframe isn't ready so we drop children from props here. #12, #17
394
- };
395
- return delete n.head, delete n.initialContent, delete n.mountTarget, delete n.contentDidMount, delete n.contentDidUpdate, delete n.forwardedRef, /* @__PURE__ */ s.jsx("iframe", { ...n, ref: this.setRef, onLoad: this.handleLoad, children: this.state.iframeLoaded && this.renderFrameContents() });
396
- }
397
- }
398
- // React warns when you render directly into the body since browser extensions
399
- // also inject into the body and can mess up React. For this reason
400
- // initialContent is expected to have a div inside of the body
401
- // element that we render react into.
402
- M(Q, "propTypes", {
403
- style: v.object,
404
- // eslint-disable-line
405
- head: v.node,
406
- initialContent: v.string,
407
- mountTarget: v.string,
408
- contentDidMount: v.func,
409
- contentDidUpdate: v.func,
410
- children: v.oneOfType([v.element, v.arrayOf(v.element)])
411
- }), M(Q, "defaultProps", {
412
- style: {},
413
- head: null,
414
- children: void 0,
415
- mountTarget: void 0,
416
- contentDidMount: () => {
417
- },
418
- contentDidUpdate: () => {
419
- },
420
- initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
421
- });
422
- const nn = A.forwardRef((e, t) => /* @__PURE__ */ s.jsx(Q, { ...e, forwardedRef: t }));
423
- let I = null, O = [], P = null, Ae = null;
424
- function sn(e) {
425
- const t = window.getComputedStyle(e), n = parseInt(t.paddingLeft, 10), a = parseInt(t.paddingTop, 10), i = parseInt(t.paddingRight, 10), l = parseInt(t.paddingBottom, 10);
426
- return { paddingLeft: n, paddingTop: a, paddingRight: i, paddingBottom: l };
427
- }
428
- const he = (e, t, n) => {
429
- if (!I)
430
- return;
431
- const a = e.getBoundingClientRect(), i = I == null ? void 0 : I.getElementById("placeholder"), { paddingLeft: l, paddingTop: d, paddingRight: o, paddingBottom: r } = sn(e);
432
- i.style.width = t === "vertical" ? a.width - l - o + "px" : "2px", i.style.height = t === "vertical" ? "2px" : a.height - d - r + "px", i.style.display = "block";
433
- const c = O.reduce(
434
- (p, h) => Math.abs(h - n) < Math.abs(p - n) ? h : p
435
- );
436
- Ae = O.indexOf(c), t === "vertical" ? (i.style.top = e.offsetTop + c + "px", i.style.left = e.offsetLeft + l + "px") : (i.style.top = e.offsetTop + d + "px", i.style.left = e.offsetLeft + c + "px");
437
- }, on = (e) => {
438
- const t = Ee(e), n = window.getComputedStyle(e), a = t === "horizontal", i = parseInt(n.paddingLeft), l = parseInt(n.paddingTop);
439
- let d = a ? i : l;
440
- O = [d], Array.from(e.children).forEach((o) => {
441
- const r = window.getComputedStyle(o), c = parseInt(
442
- a ? r.marginLeft + r.marginRight : r.marginTop + r.marginBottom
443
- ), p = a ? o.offsetWidth : o.offsetHeight;
444
- O.push(d + p + c), d += p + c;
445
- });
446
- };
447
- function Ee(e) {
448
- const t = window.getComputedStyle(e).display, n = window.getComputedStyle(e).flexDirection;
449
- if (t === "flex")
450
- return n === "column" || n === "column-reverse" ? "vertical" : "horizontal";
451
- if (t === "grid") {
452
- const a = window.getComputedStyle(e).gridTemplateRows, i = window.getComputedStyle(e).gridTemplateColumns;
453
- if (a.includes("auto"))
454
- return "vertical";
455
- if (i.includes("auto"))
456
- return "horizontal";
457
- }
458
- return t === "block" ? "vertical" : "horizontal";
459
- }
460
- const an = fe((e) => {
461
- const t = e.target, n = Ee(t);
462
- if (n === "vertical") {
463
- const a = e.clientY - t.offsetTop;
464
- he(t, n, a);
465
- } else {
466
- const a = e.clientX - t.offsetLeft;
467
- he(t, n, a);
468
- }
469
- }, 200), rn = (e) => {
470
- e.preventDefault(), e.stopPropagation(), an(e);
471
- };
472
- function J() {
473
- const e = I == null ? void 0 : I.getElementById("placeholder");
474
- e.style.display = "none";
475
- }
476
- const ln = () => {
477
- const { document: e } = V(), [t, n] = w(Ct), a = Lt(), i = De("dnd"), [, l] = L(), [, d] = B();
478
- return I = e, {
479
- isDragging: t,
480
- "data-dnd": "branch",
481
- onDragOver: i ? rn : F,
482
- onDrop: i ? (o) => {
483
- P == null || P.classList.remove("outline", "outline-green-300", "outline-2", "-outline-offset-2");
484
- const r = JSON.parse(o.dataTransfer.getData("text/plain"));
485
- let c = o.target.getAttribute("data-block-id");
486
- c === null && (c = o.target.parentElement.getAttribute("data-block-id")), a({ block: r, dropTargetId: c || null, relativeIndex: Ae }), n(!1), J(), setTimeout(() => {
487
- J();
488
- }, 300);
489
- } : F,
490
- onDragEnter: i ? (o) => {
491
- const r = o;
492
- P = r.target, r.stopPropagation(), r.preventDefault(), O = [];
493
- const c = r.target;
494
- on(c), c.classList.add("outline", "outline-green-300", "outline-2", "-outline-offset-2"), n(!0), l(""), d([]);
495
- } : F,
496
- onDragLeave: i ? (o) => {
497
- const r = o;
498
- P = null, r.stopPropagation(), r.preventDefault(), r.target.classList.remove("outline", "outline-green-300", "outline-2", "-outline-offset-2");
499
- } : F,
500
- onMouseOut: i ? () => {
501
- n(!1), J();
502
- } : F
503
- };
504
- };
505
- function se(e) {
506
- return e.getAttribute("data-block-id") ? e : e.closest("[data-block-id]");
507
- }
508
- function dn(e) {
509
- e.container.innerHTML = "", e.container.parentNode.removeChild(e.container);
510
- var t = document.querySelector(".ql-toolbar");
511
- t && t.parentNode.removeChild(t), e = null;
512
- }
513
- const cn = () => {
514
- const e = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], t = Bt(), [, n] = L(), [a, i] = w(R);
515
- return (l) => {
516
- var h;
517
- if (a)
518
- return;
519
- const d = se(l.target), o = d.getAttribute("data-block-type");
520
- if (!o || !e.includes(o))
521
- return;
522
- const r = d.cloneNode(!0);
523
- d.style.display = "none", Array.from(r.attributes).forEach((m) => {
524
- m.name !== "class" && r.removeAttribute(m.name);
525
- }), o === "Text" && (r.style.display = "inline-block"), d.parentNode.insertBefore(r, d.nextSibling);
526
- const c = new Tt(r, { placeholder: "Type here..." });
527
- function p() {
528
- const m = c.getText(0, c.getLength());
529
- t([d.getAttribute("data-block-id")], { content: m }), d.removeAttribute("style"), r.removeEventListener("blur", p, !0), dn(c), i(""), n("");
530
- }
531
- r.addEventListener("blur", p, !0), c.focus(), (h = r.querySelector(".ql-clipboard")) == null || h.remove(), i(d.getAttribute("data-block-id"));
532
- };
533
- }, pn = () => {
534
- const [, e] = E(), [, t] = B(), [n] = w(R);
535
- return (a) => {
536
- if (n)
537
- return;
538
- a.stopPropagation();
539
- const i = se(a.target);
540
- if (i != null && i.getAttribute("data-block-parent")) {
541
- const l = i.getAttribute("data-style-prop"), d = i.getAttribute("data-style-id"), o = i.getAttribute("data-block-parent");
542
- e([{ id: d, prop: l, blockId: o }]), t([o]);
543
- } else
544
- i != null && i.getAttribute("data-block-id") && t([i.getAttribute("data-block-id")]);
545
- };
546
- }, un = fe((e, t) => {
547
- const n = se(e.target);
548
- n != null && n.getAttribute("data-style-id") && t(n.getAttribute("data-style-id"));
549
- }, 100), hn = () => {
550
- const [, e] = L(), [t] = w(R);
551
- return (n) => {
552
- t || un(n, e);
553
- };
554
- }, mn = ({ children: e }) => {
555
- const { document: t } = V(), [n] = B(), [a, i] = E();
556
- k(() => {
557
- setTimeout(() => {
558
- if (!S(a))
559
- return;
560
- const c = Te(t, W(n));
561
- if (c) {
562
- const p = c.getAttribute("data-style-prop");
563
- if (p) {
564
- const h = c.getAttribute("data-style-id"), m = c.getAttribute("data-block-parent");
565
- i([{ id: h, prop: p, blockId: m }]);
566
- }
567
- }
568
- }, 100);
569
- }, [t, n, i, a]);
570
- const l = cn(), d = pn(), o = hn(), r = ln();
571
- return /* @__PURE__ */ s.jsx(
572
- "div",
573
- {
574
- "data-block-id": "container",
575
- id: "canvas",
576
- onClick: d,
577
- onDoubleClick: l,
578
- onMouseMove: o,
579
- ...Oe(r, "isDragging"),
580
- className: "relative mb-5 h-full max-w-full " + (r.isDragging ? "dragging" : ""),
581
- children: e
582
- }
583
- );
584
- }, Te = (e, t) => e.querySelector(`[data-block-id="${t}"]`), gn = () => {
585
- const { window: e } = V(), [t, n] = B(), [a] = ne(), [, i] = E(), { undo: l, redo: d } = ye(), o = ke(), [, r] = we(), c = je(), { savePage: p } = Dt(), [h] = w(R), [, m] = w(It), b = (g) => {
586
- g.key === "Enter" && (g.preventDefault(), t.length === 1 && m(W(t)));
587
- }, j = (g) => {
588
- const u = a.find((y) => y._id === g);
589
- return u ? u._parent : null;
590
- };
591
- return k(() => {
592
- const g = (u) => {
593
- if (u.key === "Escape") {
594
- n([]), i([]);
595
- return;
596
- }
597
- if (b(u), !h && (u.key === "Delete" || u.key === "Backspace") && (u.preventDefault(), c(t)), u.ctrlKey || u.metaKey) {
598
- if (u.key === "ArrowUp") {
599
- u.preventDefault();
600
- const y = t.length > 0 ? j(t[0]) : null;
601
- y && n([y]);
602
- }
603
- if (["z", "y", "d", "x", "c", "p", "s", "v"].includes(u.key)) {
604
- if (h && ["x", "z", "v"].includes(u.key))
605
- return !0;
606
- u.preventDefault();
607
- }
608
- u.key === "s" && (u.stopPropagation(), u.preventDefault(), p()), u.key === "z" && l(), u.key === "y" && d(), u.key === "d" && o(t);
609
- }
610
- };
611
- return e.removeEventListener("keydown", g), e.addEventListener("keydown", g), () => {
612
- e.removeEventListener("keydown", g);
613
- };
614
- }, [t, n, l, c, r, d, o, h, p, e]), null;
615
- }, fn = ({ block: e, label: t }) => {
616
- const [, n] = B(), [, a] = L(), [, i] = w(Ce), l = De("dnd");
617
- return /* @__PURE__ */ s.jsxs(
618
- "div",
619
- {
620
- className: "mr-10 flex cursor-grab items-center space-x-1 px-1",
621
- draggable: l ? "true" : "false",
622
- onDragStart: (d) => {
623
- d.dataTransfer.setData("text/plain", JSON.stringify(He(e, ["_id", "_type"]))), i(e._id), setTimeout(() => {
624
- n([]), a(null);
625
- }, 200);
626
- },
627
- children: [
628
- /* @__PURE__ */ s.jsx(Ge, {}),
629
- t
630
- ]
631
- }
632
- );
633
- }, xn = ({ selectedBlockElement: e, block: t }) => {
634
- const n = je(), a = ke(), [, i] = B(), [, l] = E(), [d] = w(R), { floatingStyles: o, refs: r, update: c } = Ft({
635
- placement: "top-start",
636
- middleware: [Pt(), Rt()],
637
- elements: {
638
- reference: e
639
- }
640
- });
641
- $t(e, () => c(), e !== null);
642
- const p = f(t, "_parent", null), h = S(f(t, "_name", "")) ? f(t, "_type", "") : f(t, "_name", "");
643
- return !e || !t || d ? null : /* @__PURE__ */ s.jsxs(
644
- "div",
645
- {
646
- role: "button",
647
- tabIndex: 0,
648
- ref: r.setFloating,
649
- style: o,
650
- onClick: (m) => {
651
- m.stopPropagation(), m.preventDefault();
652
- },
653
- onKeyDown: (m) => m.stopPropagation(),
654
- className: "z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
655
- children: [
656
- /* @__PURE__ */ s.jsx(fn, { label: h, block: t }),
657
- /* @__PURE__ */ s.jsxs("div", { className: "flex gap-2 px-1", children: [
658
- p && /* @__PURE__ */ s.jsx(
659
- Xe,
660
- {
661
- className: "hover:scale-105",
662
- onClick: () => {
663
- l([]), i([p]);
664
- }
665
- }
666
- ),
667
- St(f(t, "_type", "")) ? /* @__PURE__ */ s.jsx(et, { className: "hover:scale-105", onClick: () => a([t == null ? void 0 : t._id]) }) : null,
668
- _t(f(t, "_type", "")) ? /* @__PURE__ */ s.jsx(tt, { className: "hover:scale-105", onClick: () => n([t == null ? void 0 : t._id]) }) : null
669
- ] })
670
- ]
671
- }
672
- );
673
- }, yn = ({ model: e }) => {
674
- const [t] = Nt(), [n] = B(), [a] = be(), [i] = L(), [l] = E(), [d] = w(Ce), { document: o, window: r } = V(), [c] = C(o == null ? void 0 : o.getElementById("highlighted-block")), [p] = C(
675
- o == null ? void 0 : o.getElementById("selected-block")
676
- ), [h] = C(
677
- o == null ? void 0 : o.getElementById("selected-styling-block")
678
- ), [m] = C(o == null ? void 0 : o.getElementById("dragged-block"));
679
- k(() => {
680
- a ? o == null || o.documentElement.classList.add("dark") : o == null || o.documentElement.classList.remove("dark");
681
- }, [a, o]);
682
- const b = f(t, "headingFont", "DM Sans"), j = f(t, "bodyFont", "DM Sans");
683
- return k(() => {
684
- const g = f(t, "primaryColor", "#000"), u = f(t, "secondaryColor", "#FFF"), y = Ot({
685
- colors: [g, u],
686
- names: ["primary", "secondary"]
687
- });
688
- y.primary.DEFAULT = g, y.secondary.DEFAULT = u;
689
- const T = f(t, "roundedCorners", "0");
690
- !r || !r.tailwind || (r.tailwind.config = {
691
- darkMode: "class",
692
- theme: {
693
- fontFamily: {
694
- heading: [b],
695
- body: [j]
696
- },
697
- extend: {
698
- borderRadius: {
699
- global: `${T || "0"}px`
700
- },
701
- colors: y
702
- }
703
- },
704
- plugins: [
705
- // @ts-ignore
706
- r.tailwind.plugin.withOptions(({ prefix: H = "ui" } = {}) => ({ addVariant: z }) => {
707
- for (const D of ["open", "checked", "selected", "active", "disabled"])
708
- z(`${H}-${D}`, [
709
- `&[data-headlessui-state~="${D}"]`,
710
- `:where([data-headlessui-state~="${D}"]) &`
711
- ]), z(`${H}-not-${D}`, [
712
- `&[data-headlessui-state]:not([data-headlessui-state~="${D}"])`,
713
- `:where([data-headlessui-state]:not([data-headlessui-state~="${D}"])) &:not([data-headlessui-state])`
714
- ]);
715
- })
716
- ]
717
- });
718
- }, [t, r, b, j]), k(() => {
719
- p && (p.textContent = `${$(n, (g) => `[data-block-id="${g}"]`).join(",")}{
720
- outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
721
- }`);
722
- }, [n, p]), k(() => {
723
- if (!d) {
724
- m.textContent = "";
725
- return;
726
- }
727
- m.textContent = `[data-block-id="${d}"]{ pointer-events: none !important; opacity: 0.2 !important}`;
728
- }, [d]), k(() => {
729
- c && (c.textContent = i ? `[data-style-id="${i}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
730
- }, [i, n, c]), k(() => {
731
- h && (h.textContent = `${$(l, ({ id: g }) => `[data-style-id="${g}"]`).join(",")}{
732
- outline: 1px solid #42a1fc !important; outline-offset: -1px;
733
- }`);
734
- }, [l, h]), k(() => {
735
- const g = f(t, "bodyTextLightColor", "#64748b"), u = f(t, "bodyTextDarkColor", "#94a3b8"), y = f(t, "bodyBgLightColor", "#FFFFFF"), T = f(t, "bodyBgDarkColor", "#0f172a");
736
- o.body.className = `font-body antialiased text-[${g}] bg-[${y}] dark:text-[${u}] dark:bg-[${T}]`;
737
- }, [t, o, e]), e === "page" ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
738
- b && /* @__PURE__ */ s.jsx(
739
- "link",
740
- {
741
- id: "heading-font",
742
- rel: "stylesheet",
743
- type: "text/css",
744
- href: `https://fonts.googleapis.com/css2?family=${b.replace(
745
- / /g,
746
- "+"
747
- )}:wght@300;400;500;600;700;800;900&display=swap`,
748
- media: "all"
749
- }
750
- ),
751
- j && b !== j && /* @__PURE__ */ s.jsx(
752
- "link",
753
- {
754
- id: "body-font",
755
- rel: "stylesheet",
756
- type: "text/css",
757
- href: `https://fonts.googleapis.com/css2?family=${j.replace(
758
- / /g,
759
- "+"
760
- )}:wght@300;400;500;600;700;800;900&display=swap`,
761
- media: "all"
762
- }
763
- ),
764
- b && /* @__PURE__ */ s.jsx("style", { children: `h1,h2,h3,h4,h5,h6{font-family: "${b}",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";}` })
765
- ] }) : null;
766
- }, bn = (e) => {
767
- const t = {};
768
- return Object.keys(e).forEach((n) => {
769
- X(e[n]) && e[n].startsWith(ce) && (t[n] = e[n].replace(ce, "").split(","));
770
- }), t;
771
- }, vn = ze((e) => {
772
- const t = e.replace(Ie, "").split(",");
773
- return zt(t[0], t[1]);
774
- });
775
- function kn(e, t) {
776
- return f(e, `${t}_attrs`, {});
777
- }
778
- function wn(e) {
779
- const t = {};
780
- return Object.keys(e).forEach((n) => {
781
- if (X(e[n]) && e[n].startsWith(Ie)) {
782
- const a = vn(e[n]);
783
- t[n] = {
784
- className: a,
785
- "data-style-prop": n,
786
- "data-block-parent": e._id,
787
- "data-style-id": `${n}-${e._id}`,
788
- ...kn(e, n)
789
- };
790
- }
791
- }), t;
792
- }
793
- function jn(e, t) {
794
- const n = f(e, "_bindings", {});
795
- return S(n) ? { ...e } : (Ue(n, (a, i) => {
796
- X(a) && f(t, a, null) && (e[i] = f(t, a, null));
797
- }), e);
798
- }
799
- function Z({ blocks: e }) {
800
- const [t] = ne(), n = G((l) => wn(l), []), [a] = Wt(), [i] = w(R);
801
- return /* @__PURE__ */ s.jsx(s.Fragment, { children: A.Children.toArray(
802
- e.map((l, d) => {
803
- if (i === l._id)
804
- return null;
805
- const o = bn(l), r = {};
806
- S(o) || Object.keys(o).forEach((m) => {
807
- r[m] = A.Children.toArray(
808
- o[m].map((b) => /* @__PURE__ */ s.jsx(Z, { blocks: [We(t, { _id: b })] }))
809
- );
810
- });
811
- const c = xe(t, { _parent: l._id });
812
- r.children = c.length ? /* @__PURE__ */ s.jsx(Z, { blocks: c }) : null;
813
- const p = Ut(l._type), h = f(p, "builderComponent", f(p, "component", null));
814
- return qe(h) ? /* @__PURE__ */ s.jsx("noscript", { children: `<!-- ${l == null ? void 0 : l._type} not registered -->` }) : /* @__PURE__ */ s.jsx(ge, { children: A.createElement(h, {
815
- blockProps: {
816
- "data-block-id": l._id,
817
- "data-block-type": l._type,
818
- "data-dnd": Ke(p, "canAcceptBlock") ? "branch" : "leaf"
819
- },
820
- inBuilder: !0,
821
- index: d,
822
- ...jn(l, a),
823
- ...n(l),
824
- ...r
825
- }) });
826
- })
827
- ) });
828
- }
829
- const Cn = () => {
830
- const [e] = ne(), t = S(e) ? null : /* @__PURE__ */ s.jsx(qt, { children: /* @__PURE__ */ s.jsx(Z, { blocks: xe(e, (n) => S(n._parent)) }) });
831
- return /* @__PURE__ */ s.jsx(Ht, { children: t });
832
- }, Bn = (e, t) => e.querySelector(`[data-style-id="${t}"]`), Dn = () => {
833
- const [e] = w(Mt), [t] = we(), [n] = ee(), [, a] = B(), i = At(), [, l] = L(), d = ie(null), o = ie(null), [r, c] = C({ width: 0, height: 0 }), p = en(r), [h, m] = C(0), [b, j] = C([]), [, g] = C([]), [, u] = w(Et), [y, T] = E(), H = te("loading", !1);
834
- k(() => {
835
- const { clientWidth: x, clientHeight: _ } = o.current;
836
- c({ width: x, height: _ }), h === 0 && m(x);
837
- }, [o, n, h]);
838
- const z = (x, _ = 0) => {
839
- const { top: N } = x.getBoundingClientRect();
840
- return N + _ >= 0 && N - _ <= window.innerHeight;
841
- };
842
- k(() => {
843
- var x, _;
844
- if (i && i.type !== "Multiple" && d.current) {
845
- const N = Te(d.current.contentDocument, i._id);
846
- N && (z(N) || (_ = (x = d.current) == null ? void 0 : x.contentWindow) == null || _.scrollTo({ top: N.offsetTop, behavior: "smooth" }), j([N]));
847
- }
848
- }, [i]), k(() => {
849
- if (!S(y) && d.current) {
850
- const x = Bn(
851
- d.current.contentDocument,
852
- W(y).id
853
- );
854
- g(x ? [x] : [null]);
855
- } else
856
- g([null]);
857
- }, [y]);
858
- const D = Pe(() => {
859
- let x = Xt;
860
- return e === "offline" && (x = x.replace(
861
- "https://old.chaibuilder.com/offline/tailwind.cdn.js",
862
- "/offline/tailwind.cdn.js"
863
- ), x = x.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), x = x.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), x;
864
- }, [e]);
865
- return /* @__PURE__ */ s.jsx(
866
- "div",
867
- {
868
- onClick: () => {
869
- a([]), T([]);
870
- },
871
- onMouseLeave: () => setTimeout(() => l(""), 300),
872
- className: "relative mx-auto h-full w-full overflow-hidden",
873
- style: h > 0 && !S(p) ? { width: t ? "100%" : h } : {},
874
- ref: o,
875
- children: /* @__PURE__ */ s.jsxs(
876
- nn,
877
- {
878
- contentDidMount: () => u(d.current),
879
- ref: d,
880
- id: "canvas-iframe",
881
- style: { width: `${n}px`, ...p },
882
- className: "relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",
883
- initialContent: D,
884
- children: [
885
- /* @__PURE__ */ s.jsx(gn, {}),
886
- /* @__PURE__ */ s.jsx(
887
- xn,
888
- {
889
- block: i,
890
- selectedBlockElement: W(b)
891
- }
892
- ),
893
- /* @__PURE__ */ s.jsx(yn, { model: "page" }),
894
- /* @__PURE__ */ s.jsx(mn, { children: H ? /* @__PURE__ */ s.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ s.jsx(Be, { className: "h-full" }) }) : /* @__PURE__ */ s.jsx(Cn, {}) }),
895
- /* @__PURE__ */ s.jsx("br", {}),
896
- /* @__PURE__ */ s.jsx("div", { id: "placeholder", className: "absolute z-[99999] max-w-full bg-green-500 transition-transform" })
897
- ]
898
- }
899
- )
900
- }
901
- );
902
- }, Bs = () => /* @__PURE__ */ s.jsxs("div", { className: "flex h-full w-full flex-col", children: [
903
- /* @__PURE__ */ s.jsx(Gt, {}),
904
- /* @__PURE__ */ s.jsx("div", { className: "relative h-full overflow-hidden bg-slate-800/90 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px] px-2", children: /* @__PURE__ */ s.jsx(ge, { fallback: /* @__PURE__ */ s.jsx(Be, { className: "h-full" }), children: /* @__PURE__ */ s.jsx(Kt, { children: /* @__PURE__ */ s.jsx(Dn, {}) }) }) })
905
- ] });
906
- export {
907
- Bs as default
908
- };