@chaibuilder/sdk 1.2.60 → 1.2.62

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 (74) hide show
  1. package/README.md +1 -1
  2. package/dist/AddBlocks-Wja5xsTO.cjs +1 -0
  3. package/dist/{AddBlocks-L-3Io1jR.js → AddBlocks-ucNQHhx7.js} +18 -18
  4. package/dist/CanvasArea-1lUzUorh.js +975 -0
  5. package/dist/CanvasArea-dsxnMndK.cjs +60 -0
  6. package/dist/{CodeEditor-cY6z8D4N.js → CodeEditor-LeNocbY6.js} +1 -1
  7. package/dist/{CodeEditor-NuzOGqRn.cjs → CodeEditor-kk0bmQ3P.cjs} +1 -1
  8. package/dist/{CurrentPage-XXy2OzNq.js → CurrentPage-huy7O-ih.js} +3 -3
  9. package/dist/{CurrentPage-ccOL3l6S.cjs → CurrentPage-oPzQ-MY2.cjs} +1 -1
  10. package/dist/{ListTree-yoltG7gq.js → ListTree-5T-2KuBE.js} +1 -1
  11. package/dist/{ListTree-8jpTvI-s.cjs → ListTree-Fwl6Dtgc.cjs} +1 -1
  12. package/dist/{PagesPanel-t3NlycIl.cjs → PagesPanel-85U4O4ex.cjs} +1 -1
  13. package/dist/{PagesPanel-XUtE4Aou.js → PagesPanel-IT7AmWMs.js} +4 -4
  14. package/dist/{ProjectPanel-UClucyIl.cjs → ProjectPanel-NiOqTkub.cjs} +1 -1
  15. package/dist/{ProjectPanel-3zkDX3az.js → ProjectPanel-hhxqbHEX.js} +4 -4
  16. package/dist/{Settings-GVs7UvAX.cjs → Settings-NqIs7PLQ.cjs} +1 -1
  17. package/dist/{Settings-C9AegLbF.js → Settings-UO9zB4rm.js} +2 -2
  18. package/dist/{SidePanels-Y3z3wyQx.js → SidePanels-2ZXeWnl7.js} +3 -3
  19. package/dist/{SidePanels--qxWuuF-.cjs → SidePanels-n5WUkXLw.cjs} +1 -1
  20. package/dist/{ThemeConfiguration-03I3INEI.cjs → ThemeConfiguration-UNRnCxnU.cjs} +1 -1
  21. package/dist/{ThemeConfiguration-e_4e_ZcS.js → ThemeConfiguration-VSQaQn9_.js} +4 -4
  22. package/dist/{Topbar-lnCz7TLm.js → Topbar-Tkn___pR.js} +2 -2
  23. package/dist/{Topbar-Yrhyc6IQ.cjs → Topbar-m48Xdj0O.cjs} +1 -1
  24. package/dist/UILibrariesPanel-0NMxbnSZ.js +215 -0
  25. package/dist/UILibrariesPanel-9V4REpxW.cjs +1 -0
  26. package/dist/{UnsplashImages-Y0TGxNbH.js → UnsplashImages-LU3fiooG.js} +1 -1
  27. package/dist/{UnsplashImages-5JbDig-S.cjs → UnsplashImages-fm761J9M.cjs} +1 -1
  28. package/dist/{UploadImages-f6wPPJxc.cjs → UploadImages-2_SIuRI7.cjs} +1 -1
  29. package/dist/{UploadImages-Dh35M55S.js → UploadImages-MjYi7gfH.js} +1 -1
  30. package/dist/{add-page-modal-j2foeVKa.cjs → add-page-modal-QdlPDeMk.cjs} +1 -1
  31. package/dist/{add-page-modal-sKH5SHMa.js → add-page-modal-TWTjEGxY.js} +4 -4
  32. package/dist/{atoms-a0H_593V.cjs → atoms-KQpaDRnF.cjs} +1 -1
  33. package/dist/{atoms-ZOWyNoiC.js → atoms-Oomqut88.js} +2 -2
  34. package/dist/{confirm-alert-pGxJwZ2Q.js → confirm-alert-RNzVJyhU.js} +1 -1
  35. package/dist/{confirm-alert-C3wsf6lk.cjs → confirm-alert-gFBHhF1C.cjs} +1 -1
  36. package/dist/core.cjs +1 -1
  37. package/dist/core.js +2 -2
  38. package/dist/{delete-page-modal-XObwAnNB.cjs → delete-page-modal-B5W3a1ZW.cjs} +1 -1
  39. package/dist/{delete-page-modal-4Tp_VPx1.js → delete-page-modal-sUlXQ02P.js} +3 -3
  40. package/dist/email.cjs +1 -1
  41. package/dist/email.js +2 -2
  42. package/dist/{form-pya-o19L.js → form-c4b4A8Ap.js} +1 -1
  43. package/dist/{form-D9cWMUJ4.cjs → form-lqNXs-pv.cjs} +1 -1
  44. package/dist/{index-1teL5Lld.js → index-0M3H1dVb.js} +3 -3
  45. package/dist/{index-TzLilp-0.js → index-SyrshOUV.js} +399 -402
  46. package/dist/{index-849lneVZ.cjs → index-TKS5_SlD.cjs} +1 -1
  47. package/dist/{index-ZZTdYO7r.js → index-WN67ca4z.js} +9 -9
  48. package/dist/{index-8Fxmy4tt.cjs → index-afblGXKA.cjs} +2 -2
  49. package/dist/index-upb0eDoG.cjs +1 -0
  50. package/dist/lib.cjs +2 -2
  51. package/dist/lib.js +97 -146
  52. package/dist/{page-viewer-Q-eOjWmS.js → page-viewer-qb3ot43w.js} +4 -4
  53. package/dist/{page-viewer-tNzhbu_E.cjs → page-viewer-v4K0Wkhx.cjs} +1 -1
  54. package/dist/plugin-2hf9pCRy.cjs +1 -0
  55. package/dist/plugin-wDnsBVPp.js +54 -0
  56. package/dist/{project-general-setting-uDDo2ktT.js → project-general-setting-LfoijnjK.js} +4 -4
  57. package/dist/{project-general-setting-9fI_iZ_Q.cjs → project-general-setting-Q7hgQy5G.cjs} +1 -1
  58. package/dist/{project-seo-setting-rjrO9KDR.cjs → project-seo-setting-rjVkahzj.cjs} +1 -1
  59. package/dist/{project-seo-setting-PXJe5SSV.js → project-seo-setting-ztis1_yw.js} +2 -2
  60. package/dist/{single-page-detail-0ipAHwTX.js → single-page-detail-Neoai4eq.js} +11 -11
  61. package/dist/{single-page-detail-s_kkO9Zj.cjs → single-page-detail-tR7Qp9T4.cjs} +1 -1
  62. package/dist/studio.cjs +1 -1
  63. package/dist/studio.js +3 -3
  64. package/dist/ui.cjs +1 -1
  65. package/dist/ui.js +44 -44
  66. package/dist/web-blocks.cjs +1 -1
  67. package/dist/web-blocks.js +1 -1
  68. package/package.json +1 -1
  69. package/dist/AddBlocks-BtMNa99n.cjs +0 -1
  70. package/dist/CanvasArea-KBfW2Hh3.js +0 -978
  71. package/dist/CanvasArea-ZNRxUJR7.cjs +0 -59
  72. package/dist/UILibrariesPanel-LGbh-IZP.cjs +0 -1
  73. package/dist/UILibrariesPanel-PP4QDQRZ.js +0 -216
  74. package/dist/index-cH1CfTbV.cjs +0 -1
@@ -0,0 +1,975 @@
1
+ var Rt = Object.defineProperty;
2
+ var Ht = (t, e, n) => e in t ? Rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var L = (t, e, n) => (Ht(t, typeof e != "symbol" ? e + "" : e, n), n);
4
+ import { j as s } from "./jsx-runtime-WbnYoNE9.js";
5
+ import D, { createElement as ct, useCallback as W, useState as I, useEffect as C, Component as vt, Children as Pt, Suspense as tt, useRef as dt, useMemo as $t } from "react";
6
+ import { map as $, includes as pt, toUpper as Z, round as Ot, throttle as jt, has as q, isEmpty as T, first as et, omit as wt, pick as zt, get as g, isString as it, memoize as Ut, each as Wt, find as qt, filter as Ct, isNull as Vt } from "lodash-es";
7
+ import { ResetIcon as ut, SunIcon as Kt, MobileIcon as mt, LaptopIcon as Yt, DesktopIcon as Xt, DotsVerticalIcon as Gt, EraserIcon as Zt, ZoomInIcon as Qt, DragHandleDots2Icon as Jt, ArrowUpIcon as te, CopyIcon as ee, TrashIcon as ne } from "@radix-ui/react-icons";
8
+ import { v as se, B as V, aa as _t, aR as At, aS as oe, aT as ie, aU as re, a4 as K, as as ae, h as O, E as le, F as ce, G as de, H as pe, I as ue, aV as me, aW as Bt, r as M, at as H, A as he, a as ge, b as fe, c as xe, d as ye, e as be, f as ke, g as ve, P as je, U as we, aX as Ce, a5 as It, aQ as U, aY as _e, a2 as Ae, ad as E, am as Be, aZ as z, a_ as Ie, s as Se, t as De, a$ as Te, b0 as Me, X as Ee, b1 as Ne, D as St, b2 as Le, b3 as Fe, b4 as Re, q as He, ai as Pe, b5 as $e, S as nt, $ as Oe } from "./index-SyrshOUV.js";
9
+ import { a as ze, u as Ue, b as We, B as qe, E as Ve } from "./index-WN67ca4z.js";
10
+ import { useTranslation as rt } from "react-i18next";
11
+ import { useAtom as b } from "jotai";
12
+ import { SparklesIcon as Ke } from "lucide-react";
13
+ import ht from "react-dom";
14
+ import v from "prop-types";
15
+ import { Quill as Ye } from "react-quill";
16
+ import { d as Y, a as Dt } from "./atoms-Oomqut88.js";
17
+ import { flip as Xe } from "@floating-ui/dom";
18
+ import { useFloating as Ge, shift as Ze } from "@floating-ui/react-dom";
19
+ import { useResizeObserver as Qe } from "@react-hookz/web";
20
+ import { useFeature as Je } from "flagged";
21
+ import tn from "@tailwindcss/typography";
22
+ import en from "@tailwindcss/forms";
23
+ import nn from "@tailwindcss/aspect-ratio";
24
+ import sn from "tailwindcss-palette-generator";
25
+ import { p as on } from "./plugin-wDnsBVPp.js";
26
+ import { twMerge as rn } from "tailwind-merge";
27
+ import { S as gt, a as Tt } from "./MODIFIERS-fd5XOmum.js";
28
+ import { getBlockComponent as an } from "@chaibuilder/runtime";
29
+ import { includes as ft } from "lodash";
30
+ import { Provider as ln } from "react-wrap-balancer";
31
+ import { Resizable as cn } from "re-resizable";
32
+ import "./_commonjsHelpers-UyOWmZb0.js";
33
+ import "@radix-ui/react-toggle";
34
+ import "class-variance-authority";
35
+ import "./utils-VpVqnC9m.js";
36
+ import "clsx";
37
+ import "@radix-ui/react-switch";
38
+ import "@radix-ui/react-slot";
39
+ import "@radix-ui/react-accordion";
40
+ import "@radix-ui/react-alert-dialog";
41
+ import "@radix-ui/react-dialog";
42
+ import "@radix-ui/react-label";
43
+ import "@radix-ui/react-scroll-area";
44
+ import "@radix-ui/react-tabs";
45
+ import "@radix-ui/react-tooltip";
46
+ import "@radix-ui/react-popover";
47
+ import "@radix-ui/react-menubar";
48
+ import "@radix-ui/react-hover-card";
49
+ import "@radix-ui/react-select";
50
+ import "@radix-ui/react-dropdown-menu";
51
+ import "@radix-ui/react-separator";
52
+ import "@radix-ui/react-toast";
53
+ import "cmdk";
54
+ import "@radix-ui/react-context-menu";
55
+ import "react-icons-picker";
56
+ import "./Functions-7jnEwJyw.js";
57
+ import "tree-model";
58
+ import "i18next";
59
+ import "react-hotkeys-hook";
60
+ import "./index-VBXQixVm.js";
61
+ const dn = () => {
62
+ const { hasUndo: t, hasRedo: e, undo: n, redo: o } = se();
63
+ return /* @__PURE__ */ s.jsxs("div", { className: "flex items-center", children: [
64
+ /* @__PURE__ */ s.jsx(V, { disabled: !t(), size: "sm", onClick: n, className: "rounded-full", variant: "ghost", children: /* @__PURE__ */ s.jsx(ut, {}) }),
65
+ /* @__PURE__ */ s.jsx(V, { disabled: !e(), onClick: o, size: "sm", className: "rounded-full", variant: "ghost", children: /* @__PURE__ */ s.jsx(ut, { className: "rotate-180 scale-y-[-1] transform" }) })
66
+ ] });
67
+ };
68
+ function pn() {
69
+ const [t, e] = _t();
70
+ return /* @__PURE__ */ s.jsxs("div", { className: "flex items-center", children: [
71
+ /* @__PURE__ */ s.jsx(Kt, { className: "size-4 shrink-0" }),
72
+ /* @__PURE__ */ s.jsx(
73
+ At,
74
+ {
75
+ id: "dark-mode-switch",
76
+ checked: t,
77
+ onCheckedChange: () => {
78
+ e(!t);
79
+ },
80
+ className: `${t ? "bg-violet-600" : "bg-violet-300"} 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`,
81
+ children: /* @__PURE__ */ s.jsx(
82
+ "span",
83
+ {
84
+ "aria-hidden": "true",
85
+ className: `${t ? "translate-x-5" : "translate-x-0"} 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`
86
+ }
87
+ )
88
+ }
89
+ ),
90
+ /* @__PURE__ */ s.jsx(ze, { className: "size-4 ml-3 shrink-0" })
91
+ ] });
92
+ }
93
+ const xt = ({ landscape: t = !1 }) => /* @__PURE__ */ s.jsxs(
94
+ "svg",
95
+ {
96
+ className: t ? "rotate-90" : "",
97
+ xmlns: "http://www.w3.org/2000/svg",
98
+ viewBox: "0 0 13 13",
99
+ xmlSpace: "preserve",
100
+ width: 13,
101
+ height: 13,
102
+ children: [
103
+ /* @__PURE__ */ s.jsx("g", { strokeWidth: 0 }),
104
+ /* @__PURE__ */ s.jsx("g", { strokeLinecap: "round", strokeLinejoin: "round" }),
105
+ /* @__PURE__ */ s.jsx(
106
+ "path",
107
+ {
108
+ 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",
109
+ style: {
110
+ fill: "#000"
111
+ }
112
+ }
113
+ )
114
+ ]
115
+ }
116
+ ), un = [
117
+ {
118
+ title: "mobile_xs_title",
119
+ content: "mobile_xs_content",
120
+ breakpoint: "xs",
121
+ icon: /* @__PURE__ */ s.jsx(mt, {}),
122
+ width: 400
123
+ },
124
+ {
125
+ title: "mobile_sm_title",
126
+ content: "mobile_sm_content",
127
+ breakpoint: "sm",
128
+ icon: /* @__PURE__ */ s.jsx(mt, { className: "rotate-90" }),
129
+ width: 640
130
+ },
131
+ {
132
+ title: "tablet_md_title",
133
+ content: "tablet_md_content",
134
+ breakpoint: "md",
135
+ icon: /* @__PURE__ */ s.jsx(xt, {}),
136
+ width: 800
137
+ },
138
+ {
139
+ title: "tablet_lg_title",
140
+ content: "tablet_lg_content",
141
+ breakpoint: "lg",
142
+ icon: /* @__PURE__ */ s.jsx(xt, { landscape: !0 }),
143
+ width: 1024
144
+ },
145
+ {
146
+ title: "desktop_xl_title",
147
+ content: "desktop_xl_content",
148
+ breakpoint: "xl",
149
+ icon: /* @__PURE__ */ s.jsx(Yt, {}),
150
+ width: 1420
151
+ },
152
+ {
153
+ title: "large_desktop_2xl_title",
154
+ content: "large_desktop_2xl_content",
155
+ breakpoint: "2xl",
156
+ icon: /* @__PURE__ */ s.jsx(Xt, {}),
157
+ width: 1920
158
+ }
159
+ ], yt = ({
160
+ title: t,
161
+ content: e,
162
+ currentBreakpoint: n,
163
+ breakpoint: o,
164
+ width: l,
165
+ icon: c,
166
+ onClick: a
167
+ }) => {
168
+ const { t: i } = rt();
169
+ return /* @__PURE__ */ s.jsxs(oe, { children: [
170
+ /* @__PURE__ */ s.jsx(ie, { asChild: !0, children: /* @__PURE__ */ s.jsx(
171
+ V,
172
+ {
173
+ onClick: () => a(l),
174
+ size: "sm",
175
+ variant: o === n ? "secondary" : "ghost",
176
+ children: c
177
+ }
178
+ ) }),
179
+ /* @__PURE__ */ s.jsx(re, { 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: [
180
+ /* @__PURE__ */ s.jsx("h4", { className: "text-sm font-semibold", children: i(t) }),
181
+ /* @__PURE__ */ s.jsx("p", { className: "text-xs", children: i(e) })
182
+ ] }) }) })
183
+ ] });
184
+ }, mn = () => {
185
+ const [, t, e] = K(), [n, o] = ae(), { t: l } = rt(), c = O("breakpoints", un), a = (i) => {
186
+ n.includes(i) ? n.length > 2 && o(n.filter((r) => r !== i)) : o((r) => [...r, i]);
187
+ };
188
+ return c.length < 4 ? /* @__PURE__ */ s.jsx("div", { className: "flex items-center rounded-md", children: $(c, (i) => /* @__PURE__ */ ct(yt, { ...i, onClick: e, key: i.breakpoint, currentBreakpoint: t })) }) : /* @__PURE__ */ s.jsxs("div", { className: "flex items-center rounded-md", children: [
189
+ $(
190
+ c.filter((i) => pt(n, Z(i.breakpoint))),
191
+ (i) => /* @__PURE__ */ ct(yt, { ...i, onClick: e, key: i.breakpoint, currentBreakpoint: t })
192
+ ),
193
+ /* @__PURE__ */ s.jsxs(le, { children: [
194
+ /* @__PURE__ */ s.jsx(ce, { asChild: !0, children: /* @__PURE__ */ s.jsx("span", { className: "cursor-pointer px-2.5 hover:opacity-80", children: /* @__PURE__ */ s.jsx(Gt, { className: "scale-90 transform" }) }) }),
195
+ /* @__PURE__ */ s.jsxs(de, { className: "w-56 border-border text-xs", children: [
196
+ /* @__PURE__ */ s.jsx(pe, { children: l("Breakpoints") }),
197
+ /* @__PURE__ */ s.jsx(ue, {}),
198
+ $(c, (i) => /* @__PURE__ */ s.jsx(
199
+ me,
200
+ {
201
+ disabled: i.breakpoint === "xs",
202
+ onCheckedChange: () => a(Z(i.breakpoint)),
203
+ checked: pt(n, Z(i.breakpoint)),
204
+ children: l(i.title)
205
+ },
206
+ i.breakpoint
207
+ ))
208
+ ] })
209
+ ] })
210
+ ] });
211
+ }, hn = () => {
212
+ const { t } = rt(), { setNewBlocks: e } = Bt(), [, n] = M(), [, o] = H(), l = W(() => {
213
+ e([]), n([]), o([]);
214
+ }, [e]);
215
+ return /* @__PURE__ */ s.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ s.jsxs(he, { children: [
216
+ /* @__PURE__ */ s.jsx(ge, { asChild: !0, children: /* @__PURE__ */ s.jsxs(V, { size: "sm", variant: "ghost", className: "flex items-center gap-x-1", children: [
217
+ /* @__PURE__ */ s.jsx(Zt, {}),
218
+ " ",
219
+ t("clear")
220
+ ] }) }),
221
+ /* @__PURE__ */ s.jsxs(fe, { className: "border-border", children: [
222
+ /* @__PURE__ */ s.jsxs(xe, { children: [
223
+ /* @__PURE__ */ s.jsx(ye, { children: t("clear_canvas_title") }),
224
+ /* @__PURE__ */ s.jsx(be, { children: t("clear_canvas_description") })
225
+ ] }),
226
+ /* @__PURE__ */ s.jsxs(ke, { children: [
227
+ /* @__PURE__ */ s.jsx(ve, { children: t("cancel") }),
228
+ /* @__PURE__ */ s.jsx(je, { onClick: l, children: t("yes") })
229
+ ] })
230
+ ] })
231
+ ] }) });
232
+ }, gn = () => {
233
+ const [t, e] = b(we);
234
+ return O("askAiCallBack", null) ? /* @__PURE__ */ s.jsxs("div", { className: "flex items-center space-x-2", children: [
235
+ /* @__PURE__ */ s.jsxs(Ce, { htmlFor: "ai-assistant", className: "flex items-center gap-x-1 text-sm text-yellow-600", children: [
236
+ /* @__PURE__ */ s.jsx(Ke, { className: "w-4" }),
237
+ "AI Assistant"
238
+ ] }),
239
+ /* @__PURE__ */ s.jsx(
240
+ At,
241
+ {
242
+ className: "scale-90",
243
+ checked: t,
244
+ onCheckedChange: (o) => {
245
+ e(o);
246
+ },
247
+ id: "ai-assitantt"
248
+ }
249
+ )
250
+ ] }) : null;
251
+ }, fn = () => {
252
+ const t = O("darkMode", !0), [e] = It();
253
+ return /* @__PURE__ */ s.jsxs("div", { className: "flex h-10 items-center justify-between border-b bg-background/70 px-2", children: [
254
+ /* @__PURE__ */ s.jsxs("div", { className: "flex h-full space-x-2", children: [
255
+ /* @__PURE__ */ s.jsx(mn, {}),
256
+ /* @__PURE__ */ s.jsx(U, { orientation: "vertical" }),
257
+ t ? /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
258
+ /* @__PURE__ */ s.jsx(pn, {}),
259
+ /* @__PURE__ */ s.jsx(U, { orientation: "vertical" })
260
+ ] }) : null,
261
+ /* @__PURE__ */ s.jsxs("div", { className: "flex w-12 cursor-not-allowed items-center justify-center gap-x-1 space-x-0 font-medium text-gray-400", children: [
262
+ /* @__PURE__ */ s.jsx(Qt, { className: "h-3.5 w-3.5 flex-shrink-0" }),
263
+ " ",
264
+ /* @__PURE__ */ s.jsxs("div", { className: "text-xs leading-3", children: [
265
+ Ot(e, 0),
266
+ "%"
267
+ ] })
268
+ ] }),
269
+ /* @__PURE__ */ s.jsx(U, { orientation: "vertical" }),
270
+ /* @__PURE__ */ s.jsx(dn, {})
271
+ ] }),
272
+ /* @__PURE__ */ s.jsxs("div", { className: "flex h-full items-center space-x-2", children: [
273
+ /* @__PURE__ */ s.jsx(hn, {}),
274
+ /* @__PURE__ */ s.jsx(U, { orientation: "vertical" }),
275
+ /* @__PURE__ */ s.jsx(gn, {})
276
+ ] })
277
+ ] });
278
+ }, xn = `<!doctype html>
279
+ <html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
280
+ <head>
281
+ <meta charset="UTF-8">
282
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
283
+ <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
284
+ <style>
285
+ html { height: 100%; overflow:auto; }
286
+ body { height: 100%; }
287
+ .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
288
+ .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
289
+ body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
290
+ -moz-user-select: none;-ms-user-select: none; user-select: none; }
291
+ html{
292
+ -ms-overflow-style: none; /* IE and Edge */
293
+ scrollbar-width: none; /* Firefox */
294
+ }
295
+ /** IMPORTANT: Make fields content editable in SAFARI */
296
+ [contenteditable] {-webkit-user-select: text;user-select: text;}
297
+
298
+ html::-webkit-scrollbar { width: 0 !important }
299
+ .aspect-auto{aspect-ratio: auto;}
300
+ .aspect-square{aspect-ratio: 1/1;}
301
+ .aspect-video{aspect-ratio: 16/9;}
302
+ .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
303
+ .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
304
+ a{ pointer-events: none !important; }
305
+ [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
306
+ [contenteditable="true"] {
307
+ outline: none;
308
+ box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
309
+ -webkit-user-select: text;
310
+ -moz-user-select: text;
311
+ user-select: text;
312
+ }
313
+ .frame-root .frame-content { height: 100%; }
314
+ [data-drop="yes"] { outline: 2px dashed orange !important; outline-offset: -2px }
315
+ [data-dnd="yes"] { pointer-events: auto !important}
316
+ [data-dnd="no"] { pointer-events: none !important; }
317
+ [data-dnd-dragged="yes"] { opacity: 0.6; pointer-events: none; }
318
+ [data-dnd-dragged="no"] { opacity: 1; pointer-events: auto !important; }
319
+ [force-show] { display: block !important; }
320
+ </style>
321
+ <style id="hidden-blocks"></style>
322
+ <style id="selected-block"></style>
323
+ <style id="selected-styling-block"></style>
324
+ <style id="highlighted-block"></style>
325
+ <style id="dragged-block"></style>
326
+ <style id="drop-target-block"></style>
327
+
328
+ </head>
329
+ <body class="font-body antialiased h-full">
330
+ <div class="frame-root h-full"></div>
331
+ <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
332
+ </body>
333
+ </html>`, yn = (t) => {
334
+ const [e] = K(), [, n] = It(), [o, l] = I({}), c = W(() => {
335
+ const { width: a, height: i } = t;
336
+ if (a < e) {
337
+ const r = parseFloat((a / e).toFixed(2).toString());
338
+ let u = {};
339
+ const d = i * r;
340
+ i && (u = {
341
+ // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
342
+ height: 100 + (i - d) / d * 100 + "%"
343
+ }), l({
344
+ position: "relative",
345
+ top: 0,
346
+ transform: `scale(${r})`,
347
+ transformOrigin: "top left",
348
+ ...u,
349
+ maxWidth: "none"
350
+ }), n(r * 100);
351
+ } else
352
+ l({}), n(100);
353
+ }, [e, t, n]);
354
+ return C(() => {
355
+ c();
356
+ }, [e, t, n, c]), o;
357
+ };
358
+ let Mt, Et;
359
+ typeof document < "u" && (Mt = document);
360
+ typeof window < "u" && (Et = window);
361
+ const Nt = D.createContext({ document: Mt, window: Et }), X = () => D.useContext(Nt), { Provider: bn, Consumer: Qs } = Nt;
362
+ class Lt extends vt {
363
+ componentDidMount() {
364
+ this.props.contentDidMount();
365
+ }
366
+ componentDidUpdate() {
367
+ this.props.contentDidUpdate();
368
+ }
369
+ render() {
370
+ return Pt.only(this.props.children);
371
+ }
372
+ }
373
+ L(Lt, "propTypes", {
374
+ children: v.element.isRequired,
375
+ contentDidMount: v.func.isRequired,
376
+ contentDidUpdate: v.func.isRequired
377
+ });
378
+ class st extends vt {
379
+ constructor(n, o) {
380
+ super(n, o);
381
+ L(this, "setRef", (n) => {
382
+ this.nodeRef.current = n;
383
+ const { forwardedRef: o } = this.props;
384
+ typeof o == "function" ? o(n) : o && (o.current = n);
385
+ });
386
+ L(this, "handleLoad", () => {
387
+ clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
388
+ });
389
+ // In certain situations on a cold cache DOMContentLoaded never gets called
390
+ // fallback to an interval to check if that's the case
391
+ L(this, "loadCheck", () => setInterval(() => {
392
+ this.handleLoad();
393
+ }, 500));
394
+ this._isMounted = !1, this.nodeRef = D.createRef(), this.state = { iframeLoaded: !1 };
395
+ }
396
+ componentDidMount() {
397
+ this._isMounted = !0, this.getDoc() && this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded", this.handleLoad);
398
+ }
399
+ componentWillUnmount() {
400
+ this._isMounted = !1, this.nodeRef.current.removeEventListener("DOMContentLoaded", this.handleLoad);
401
+ }
402
+ getDoc() {
403
+ return this.nodeRef.current ? this.nodeRef.current.contentDocument : null;
404
+ }
405
+ getMountTarget() {
406
+ const n = this.getDoc();
407
+ return this.props.mountTarget ? n.querySelector(this.props.mountTarget) : n.body.children[0];
408
+ }
409
+ renderFrameContents() {
410
+ if (!this._isMounted)
411
+ return null;
412
+ const n = this.getDoc();
413
+ if (!n)
414
+ return null;
415
+ const o = this.props.contentDidMount, l = this.props.contentDidUpdate, c = n.defaultView || n.parentView, a = /* @__PURE__ */ s.jsx(Lt, { contentDidMount: o, contentDidUpdate: l, children: /* @__PURE__ */ s.jsx(bn, { value: { document: n, window: c }, children: /* @__PURE__ */ s.jsx("div", { className: "frame-content", children: this.props.children }) }) }), i = this.getMountTarget();
416
+ return [ht.createPortal(this.props.head, this.getDoc().head), ht.createPortal(a, i)];
417
+ }
418
+ render() {
419
+ const n = {
420
+ ...this.props,
421
+ srcDoc: this.props.initialContent,
422
+ children: void 0
423
+ // The iframe isn't ready so we drop children from props here. #12, #17
424
+ };
425
+ 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() });
426
+ }
427
+ }
428
+ // React warns when you render directly into the body since browser extensions
429
+ // also inject into the body and can mess up React. For this reason
430
+ // initialContent is expected to have a div inside of the body
431
+ // element that we render react into.
432
+ L(st, "propTypes", {
433
+ style: v.object,
434
+ // eslint-disable-line
435
+ head: v.node,
436
+ initialContent: v.string,
437
+ mountTarget: v.string,
438
+ className: v.string,
439
+ contentDidMount: v.func,
440
+ contentDidUpdate: v.func,
441
+ children: v.oneOfType([v.element, v.arrayOf(v.element)])
442
+ }), L(st, "defaultProps", {
443
+ style: {},
444
+ head: null,
445
+ children: void 0,
446
+ mountTarget: void 0,
447
+ contentDidMount: () => {
448
+ },
449
+ contentDidUpdate: () => {
450
+ },
451
+ initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
452
+ });
453
+ const kn = D.forwardRef((t, e) => /* @__PURE__ */ s.jsx(st, { ...t, forwardedRef: e }));
454
+ function at(t) {
455
+ const e = window.getComputedStyle(t), n = e.display;
456
+ if (n === "flex" || n === "inline-flex") {
457
+ const o = e.flexDirection;
458
+ return o === "column" || o === "column-reverse" ? "vertical" : "horizontal";
459
+ } else if (n === "grid") {
460
+ const o = e.gridAutoFlow, l = e.gridTemplateRows, c = e.gridTemplateColumns;
461
+ return o.includes("column") || l.split(" ").length > c.split(" ").length ? "vertical" : "horizontal";
462
+ } else if (n === "block" || n === "inline-block")
463
+ return "vertical";
464
+ return "horizontal";
465
+ }
466
+ let y = null, A = [], bt = null, Q = null;
467
+ const kt = (t, e, n) => {
468
+ if (!y || !t)
469
+ return;
470
+ const o = y == null ? void 0 : y.getElementById("placeholder"), l = A.map(([r]) => r), c = l.reduce(
471
+ (r, u) => Math.abs(u - n) < Math.abs(r - n) ? u : r,
472
+ 0
473
+ ), a = l.indexOf(c);
474
+ if (!A[a])
475
+ return;
476
+ const i = A[a];
477
+ o.style.width = e === "vertical" ? i[2] + "px" : "2px", o.style.height = e === "vertical" ? "2px" : i[2] + "px", o.style.display = "block", e === "vertical" ? (o.style.top = i[0] + "px", o.style.left = i[1] + "px") : (o.style.top = i[1] + "px", o.style.left = i[0] + "px");
478
+ };
479
+ function vn(t, e) {
480
+ let n = 0, o = 1 / 0;
481
+ return e.forEach((l, c) => {
482
+ const a = Math.abs(l[0] - t);
483
+ a < o && (o = a, n = c);
484
+ }), n;
485
+ }
486
+ const jn = (t) => {
487
+ const n = at(t) === "horizontal";
488
+ A = [], Array.from(t.children).forEach((o, l) => {
489
+ if (o.classList.contains("pointer-events-none"))
490
+ return;
491
+ const c = n ? o.offsetLeft : o.offsetTop, a = n ? [o.offsetTop, o.clientHeight] : [o.offsetLeft, o.clientWidth];
492
+ if (A.push([c, a[0], a[1]]), l === t.children.length - 1) {
493
+ const i = n ? o.offsetLeft + o.clientWidth : o.offsetTop + o.clientHeight;
494
+ A.push([i, a[0], a[1]]);
495
+ }
496
+ });
497
+ }, wn = jt((t) => {
498
+ var l;
499
+ const e = t.target, n = at(e), o = (l = y == null ? void 0 : y.defaultView) == null ? void 0 : l.scrollY;
500
+ n === "vertical" ? kt(e, n, t.clientY + o) : kt(e, n, t.clientX);
501
+ }, 0);
502
+ function J() {
503
+ const t = y == null ? void 0 : y.getElementById("placeholder");
504
+ t.style.display = "none", Cn("pointer-none"), _n();
505
+ }
506
+ function Cn(t) {
507
+ (y == null ? void 0 : y.querySelectorAll(`.${t}`)).forEach((n) => {
508
+ n.classList.remove(t);
509
+ });
510
+ }
511
+ function _n() {
512
+ const t = y == null ? void 0 : y.querySelector('[data-drop="yes"]');
513
+ t && t.removeAttribute("data-drop");
514
+ }
515
+ const An = () => {
516
+ const { document: t } = X(), [e, n] = b(_e), { addCoreBlock: o } = Ae(), [, l] = E(), [, c] = M(), { moveBlocks: a } = Bt(), [i, r] = b(Y), [, u] = b(Dt), d = () => {
517
+ J(), n(!1), c([i._id]), r(null), u(null), A = [];
518
+ };
519
+ return y = t, {
520
+ isDragging: e,
521
+ onDragOver: (m) => {
522
+ m.preventDefault(), m.stopPropagation(), wn(m);
523
+ },
524
+ onDrop: (m) => {
525
+ var S;
526
+ const p = bt, k = at(p) === "vertical" ? m.clientY + ((S = y == null ? void 0 : y.defaultView) == null ? void 0 : S.scrollY) : m.clientX;
527
+ Q = vn(k, A);
528
+ const h = i, j = p.getAttribute("data-block-id");
529
+ if (!q(h, "_id")) {
530
+ o(h, j === "canvas" ? null : j, Q), setTimeout(d, 300);
531
+ return;
532
+ }
533
+ let w = p.getAttribute("data-block-id");
534
+ w === null && (w = m.target.parentElement.getAttribute("data-block-id")), a([h._id], w === "canvas" ? null : w, Q), d(), setTimeout(J, 300);
535
+ },
536
+ onDragEnter: (m) => {
537
+ const p = m, f = p.target;
538
+ bt = f;
539
+ const k = f.getAttribute("data-block-id");
540
+ u(k), p.stopPropagation(), p.preventDefault(), A = [], jn(f), n(!0), l(""), c([]);
541
+ },
542
+ onDragLeave: (m) => {
543
+ m.target.getAttribute("data-block-id") === "canvas" && (u(null), n(!1), J(), A = []);
544
+ }
545
+ };
546
+ };
547
+ function lt(t) {
548
+ return t.getAttribute("data-block-id") ? t : t.closest("[data-block-id]");
549
+ }
550
+ function Bn(t) {
551
+ t.container.innerHTML = "", t.container.parentNode.removeChild(t.container);
552
+ var e = document.querySelector(".ql-toolbar");
553
+ e && e.parentNode.removeChild(e), t = null;
554
+ }
555
+ const In = () => {
556
+ const t = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], e = Be(), [, n] = E(), [o, l] = b(z);
557
+ return (c) => {
558
+ var m;
559
+ if (o)
560
+ return;
561
+ const a = lt(c.target), i = a.getAttribute("data-block-type");
562
+ if (!i || !t.includes(i))
563
+ return;
564
+ const r = a.cloneNode(!0);
565
+ a.style.display = "none", Array.from(r.attributes).forEach((p) => {
566
+ p.name !== "class" && r.removeAttribute(p.name);
567
+ }), i === "Text" && (r.style.display = "inline-block"), a.parentNode.insertBefore(r, a.nextSibling);
568
+ const u = new Ye(r, { placeholder: "Type here..." });
569
+ function d() {
570
+ const p = u.getText(0, u.getLength());
571
+ e([a.getAttribute("data-block-id")], { content: p }), a.removeAttribute("style"), r.removeEventListener("blur", d, !0), Bn(u), l(""), n("");
572
+ }
573
+ r.addEventListener("blur", d, !0), r.addEventListener("keydown", (p) => {
574
+ (p.key === "Enter" || p.key === "Escape") && d();
575
+ }), u.focus(), (m = r.querySelector(".ql-clipboard")) == null || m.remove(), l(a.getAttribute("data-block-id"));
576
+ };
577
+ }, Sn = () => {
578
+ const [, t] = H(), [e, n] = M(), [, o] = E(), [l] = b(z), [c] = b(Ie);
579
+ return (a) => {
580
+ if (l)
581
+ return;
582
+ a.stopPropagation();
583
+ const i = lt(a.target);
584
+ if (i != null && i.getAttribute("data-block-id") && (i == null ? void 0 : i.getAttribute("data-block-id")) === "container") {
585
+ n([]), t([]), o("");
586
+ return;
587
+ }
588
+ if (i != null && i.getAttribute("data-block-parent")) {
589
+ const r = i.getAttribute("data-style-prop"), u = i.getAttribute("data-style-id"), d = i.getAttribute("data-block-parent");
590
+ e.includes(d) || c == null || c.closeAll(), t([{ id: u, prop: r, blockId: d }]), n([d]);
591
+ } else if (i != null && i.getAttribute("data-block-id")) {
592
+ let r = i.getAttribute("data-block-id");
593
+ e.includes(r) || c == null || c.closeAll(), t([]), n([r]);
594
+ }
595
+ o("");
596
+ };
597
+ }, Dn = jt((t, e) => {
598
+ const n = lt(t.target);
599
+ n != null && n.getAttribute("data-style-id") && e(n.getAttribute("data-style-id"));
600
+ }, 100), Tn = () => {
601
+ const [, t] = E(), [e] = b(z);
602
+ return (n) => {
603
+ e || Dn(n, t);
604
+ };
605
+ }, Mn = ({ children: t }) => {
606
+ const { document: e } = X(), [n] = M(), [o, l] = H();
607
+ C(() => {
608
+ setTimeout(() => {
609
+ if (!T(o))
610
+ return;
611
+ const u = Ft(e, et(n));
612
+ if (u) {
613
+ const d = u.getAttribute("data-style-prop");
614
+ if (d) {
615
+ const m = u.getAttribute("data-style-id"), p = u.getAttribute("data-block-parent");
616
+ l([{ id: m, prop: d, blockId: p }]);
617
+ }
618
+ }
619
+ }, 100);
620
+ }, [e, n, l, o]);
621
+ const c = In(), a = Sn(), i = Tn(), r = An();
622
+ return /* @__PURE__ */ s.jsx(
623
+ "div",
624
+ {
625
+ "data-block-id": "canvas",
626
+ id: "canvas",
627
+ onClick: a,
628
+ onDoubleClick: c,
629
+ onMouseMove: i,
630
+ ...wt(r, "isDragging"),
631
+ className: "relative mb-5 h-full max-w-full px-1 " + (r.isDragging ? "dragging" : ""),
632
+ children: t
633
+ }
634
+ );
635
+ }, Ft = (t, e) => t.querySelector(`[data-block-id="${e}"]`), En = () => {
636
+ const { document: t } = X();
637
+ return Ue(t), null;
638
+ }, Nn = ({ block: t, label: e }) => {
639
+ const [, n] = M(), [, o] = E(), [, l] = b(Y), c = Je("dnd");
640
+ return /* @__PURE__ */ s.jsxs(
641
+ "div",
642
+ {
643
+ className: "mr-10 flex cursor-default items-center space-x-1 px-1",
644
+ draggable: c ? "true" : "false",
645
+ onDragStart: (a) => {
646
+ a.dataTransfer.setData("text/plain", JSON.stringify(zt(t, ["_id", "_type", "_name"]))), l(t), setTimeout(() => {
647
+ n([]), o(null);
648
+ }, 200);
649
+ },
650
+ children: [
651
+ /* @__PURE__ */ s.jsx(Jt, {}),
652
+ e
653
+ ]
654
+ }
655
+ );
656
+ }, Ln = ({ selectedBlockElement: t, block: e }) => {
657
+ const n = Se(), o = De(), [, l] = M(), [, c] = E(), [, a] = H(), [i] = b(z), { floatingStyles: r, refs: u, update: d } = Ge({
658
+ placement: "top-start",
659
+ middleware: [Ze(), Xe()],
660
+ elements: {
661
+ reference: t
662
+ }
663
+ });
664
+ Qe(t, () => d(), t !== null);
665
+ const m = g(e, "_parent", null), p = T(g(e, "_name", "")) ? g(e, "_type", "") : g(e, "_name", "");
666
+ return !t || !e || i ? null : /* @__PURE__ */ s.jsx(s.Fragment, { children: /* @__PURE__ */ s.jsxs(
667
+ "div",
668
+ {
669
+ role: "button",
670
+ tabIndex: 0,
671
+ ref: u.setFloating,
672
+ style: r,
673
+ onClick: (f) => {
674
+ f.stopPropagation(), f.preventDefault();
675
+ },
676
+ onMouseEnter: (f) => {
677
+ f.stopPropagation(), c(null);
678
+ },
679
+ onKeyDown: (f) => f.stopPropagation(),
680
+ className: "z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
681
+ children: [
682
+ /* @__PURE__ */ s.jsx(Nn, { label: p, block: e }),
683
+ /* @__PURE__ */ s.jsxs("div", { className: "flex gap-2 px-1", children: [
684
+ m && /* @__PURE__ */ s.jsx(
685
+ te,
686
+ {
687
+ className: "hover:scale-105",
688
+ onClick: () => {
689
+ a([]), l([m]);
690
+ }
691
+ }
692
+ ),
693
+ Te(g(e, "_type", "")) ? /* @__PURE__ */ s.jsx(ee, { className: "hover:scale-105", onClick: () => o([e == null ? void 0 : e._id]) }) : null,
694
+ Me(g(e, "_type", "")) ? /* @__PURE__ */ s.jsx(ne, { className: "hover:scale-105", onClick: () => n([e == null ? void 0 : e._id]) }) : null
695
+ ] })
696
+ ]
697
+ }
698
+ ) });
699
+ }, Fn = ({ model: t }) => {
700
+ const [e] = Ee(), [n] = M(), [o] = _t(), [l] = E(), [c] = H(), [a] = b(Y), [i] = b(Dt), { document: r, window: u } = X(), [d] = I(r == null ? void 0 : r.getElementById("highlighted-block")), [m] = I(
701
+ r == null ? void 0 : r.getElementById("selected-block")
702
+ ), [p] = I(
703
+ r == null ? void 0 : r.getElementById("selected-styling-block")
704
+ ), [f] = I(
705
+ r == null ? void 0 : r.getElementById("dragged-block")
706
+ );
707
+ C(() => {
708
+ o ? r == null || r.documentElement.classList.add("dark") : r == null || r.documentElement.classList.remove("dark");
709
+ }, [o, r]);
710
+ const k = g(e, "headingFont", "DM Sans"), h = g(e, "bodyFont", "DM Sans");
711
+ return C(() => {
712
+ const j = g(e, "primaryColor", "#000"), w = g(e, "secondaryColor", "#FFF"), S = g(e, "bodyBgLightColor", "#fff"), N = g(e, "bodyBgDarkColor", "#000"), F = g(e, "bodyTextDarkColor", "#000"), P = g(e, "bodyTextLightColor", "#fff"), G = sn([
713
+ { color: j, name: "primary" },
714
+ { color: w, name: "secondary" }
715
+ ]), x = {
716
+ "bg-light": S,
717
+ "bg-dark": N,
718
+ "text-dark": F,
719
+ "text-light": P
720
+ }, _ = g(e, "roundedCorners", "0");
721
+ !u || !u.tailwind || (u.tailwind.config = {
722
+ darkMode: "class",
723
+ theme: {
724
+ extend: {
725
+ container: {
726
+ center: !0,
727
+ padding: "1rem",
728
+ screens: {
729
+ "2xl": "1400px"
730
+ }
731
+ },
732
+ fontFamily: {
733
+ heading: [k],
734
+ body: [h]
735
+ },
736
+ borderRadius: {
737
+ DEFAULT: `${_ || "0"}px`
738
+ },
739
+ colors: { ...x, ...G }
740
+ }
741
+ },
742
+ plugins: [
743
+ tn,
744
+ en,
745
+ nn,
746
+ on(function({ addBase: B, theme: R }) {
747
+ B({
748
+ "h1,h2,h3,h4,h5,h6": {
749
+ fontFamily: R("fontFamily.heading")
750
+ },
751
+ body: {
752
+ fontFamily: R("fontFamily.body"),
753
+ color: R("colors.text-light"),
754
+ backgroundColor: R("colors.bg-light")
755
+ },
756
+ ".dark body": {
757
+ color: R("colors.text-dark"),
758
+ backgroundColor: R("colors.bg-dark")
759
+ }
760
+ });
761
+ })
762
+ ]
763
+ });
764
+ }, [e, u, k, h]), C(() => {
765
+ m && (m.textContent = `${$(n, (j) => `[data-block-id="${j}"]`).join(",")}{
766
+ outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
767
+ }`);
768
+ }, [n, m]), C(() => {
769
+ f.textContent = a ? `[data-block-id="${a._id}"], [data-block-id="${a._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
770
+ }, [a, f]), C(() => {
771
+ d && (d.textContent = l ? `[data-style-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
772
+ }, [l, n, d]), C(() => {
773
+ p && (p.textContent = `${$(c, ({ id: j }) => `[data-style-id="${j}"]`).join(",")}{
774
+ outline: 1px solid #42a1fc !important; outline-offset: -1px;
775
+ }`);
776
+ }, [c, p]), C(() => {
777
+ r.querySelector("#drop-target-block").innerHTML = i ? `[data-block-id="${i}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
778
+ }, [i]), /* @__PURE__ */ s.jsx(s.Fragment, { children: (k || h) && /* @__PURE__ */ s.jsx(
779
+ "link",
780
+ {
781
+ rel: "stylesheet",
782
+ href: `https://fonts.googleapis.com/css2?family=${k ? `${k.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${k && h && k !== h ? "&" : ""}${h && h !== k ? `family=${h.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
783
+ }
784
+ ) });
785
+ }, Rn = () => b(Ne), Hn = (t, e) => {
786
+ const n = ["xs", "sm", "md", "lg", "xl", "2xl"], o = n.indexOf(e), l = t.split(" ");
787
+ let c = new Array(n.length).fill(!1);
788
+ for (const a of l) {
789
+ let [i, r] = a.split(":");
790
+ r || (r = i, i = "xs");
791
+ const u = n.indexOf(i);
792
+ if (u <= o) {
793
+ const d = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], m = ["hidden"];
794
+ if (d.includes(r))
795
+ for (let p = u; p < n.length; p++)
796
+ c[p] = !0;
797
+ else if (m.includes(r))
798
+ for (let p = u; p < n.length; p++)
799
+ c[p] = !1;
800
+ }
801
+ }
802
+ return c[o];
803
+ }, Pn = (t) => {
804
+ const e = {};
805
+ return Object.keys(t).forEach((n) => {
806
+ it(t[n]) && t[n].startsWith(gt) && (e[n] = t[n].replace(gt, "").split(","));
807
+ }), e;
808
+ }, $n = Ut((t) => {
809
+ const e = t.replace(Tt, "").split(",");
810
+ return rn(e[0], e[1]);
811
+ });
812
+ function On(t, e) {
813
+ return g(t, `${e}_attrs`, {});
814
+ }
815
+ function zn(t, e) {
816
+ const n = {};
817
+ return Object.keys(t).forEach((o) => {
818
+ if (it(t[o]) && t[o].startsWith(Tt)) {
819
+ const l = $n(t[o]), c = On(t, o);
820
+ n[o] = {
821
+ className: l,
822
+ "data-style-prop": o,
823
+ "data-block-parent": t._id,
824
+ "data-style-id": `${o}-${t._id}`,
825
+ ...c
826
+ };
827
+ const a = q(c, "x-show") || q(c, "x-if");
828
+ a && (n.__isHidden = a && !Hn(l, e));
829
+ }
830
+ }), n;
831
+ }
832
+ function Un(t, e) {
833
+ const n = g(t, "_bindings", {});
834
+ return T(n) ? { ...t } : (Wt(n, (o, l) => {
835
+ it(o) && g(e, o, null) && (t[l] = g(e, o, null));
836
+ }), t);
837
+ }
838
+ function ot({ blocks: t }) {
839
+ const [e] = St(), [n] = b(Le), [o] = b(Y), [, l] = K(), [c] = Rn(), a = W((d) => zn(d, l), [l]), [i] = We(), [r] = b(z), u = W(
840
+ (d) => d.reduce((m, p) => {
841
+ const f = g(c, p, {});
842
+ return { ...m, ...f };
843
+ }, {}),
844
+ [c, e]
845
+ );
846
+ return /* @__PURE__ */ s.jsx(s.Fragment, { children: D.Children.toArray(
847
+ t.map((d, m) => {
848
+ if (r === d._id)
849
+ return null;
850
+ const p = Pn(d), f = {};
851
+ T(p) || Object.keys(p).forEach((F) => {
852
+ f[F] = D.Children.toArray(
853
+ p[F].map((P) => /* @__PURE__ */ s.jsx(ot, { blocks: [qt(e, { _id: P })] }))
854
+ );
855
+ });
856
+ const k = Ct(e, { _parent: d._id });
857
+ f.children = k.length ? /* @__PURE__ */ s.jsx(ot, { blocks: k }) : null;
858
+ const h = an(d._type), j = g(h, "builderComponent", g(h, "component", null));
859
+ if (Vt(j))
860
+ return /* @__PURE__ */ s.jsx("noscript", { children: `<!-- ${d == null ? void 0 : d._type} not registered -->` });
861
+ const w = q(h, "getBlockStateFrom") ? h == null ? void 0 : h.getBlockStateFrom(d, e) : [], S = u(w), N = a(d);
862
+ return g(N, "__isHidden", !1) && !ft(n, d._id) ? null : /* @__PURE__ */ s.jsx(tt, { children: D.createElement(j, {
863
+ blockProps: {
864
+ ...ft(n, d._id) ? { "force-show": "" } : {},
865
+ "data-block-id": d._id,
866
+ "data-block-type": d._type,
867
+ ...o ? (
868
+ // @ts-ignore
869
+ {
870
+ "data-dnd": Fe(d._type, o == null ? void 0 : o._type) ? "yes" : "no"
871
+ }
872
+ ) : {}
873
+ },
874
+ index: m,
875
+ ...Un(d, i),
876
+ ...wt(N, ["__isHidden"]),
877
+ ...f,
878
+ inBuilder: !0,
879
+ blockState: S
880
+ }) });
881
+ })
882
+ ) });
883
+ }
884
+ const Wn = () => {
885
+ const [t] = St(), e = T(t) ? null : /* @__PURE__ */ s.jsx(qe, { children: /* @__PURE__ */ s.jsx(ot, { blocks: Ct(t, (n) => T(n._parent)) }) });
886
+ return /* @__PURE__ */ s.jsx(s.Fragment, { children: e });
887
+ }, qn = (t, e) => t.querySelector(`[data-style-id="${e}"]`), Vn = () => {
888
+ const [t] = b(Re), [e] = He(), [n] = K(), [, o] = M(), l = Pe(), [, c] = E(), a = dt(null), i = dt(null), [r, u] = I({ width: 0, height: 0 }), d = yn(r), [m, p] = I(0), [f, k] = I([]), [, h] = I([]), [, j] = b($e), [w, S] = H(), N = O("loading", !1), F = O("htmlDir", "ltr");
889
+ C(() => {
890
+ const { clientWidth: x, clientHeight: _ } = i.current;
891
+ u({ width: x, height: _ }), m === 0 && p(x);
892
+ }, [i, n, m]);
893
+ const P = (x, _ = 0) => {
894
+ const { top: B } = x.getBoundingClientRect();
895
+ return B + _ >= 0 && B - _ <= window.innerHeight;
896
+ };
897
+ C(() => {
898
+ var x, _;
899
+ if (l && l.type !== "Multiple" && a.current) {
900
+ const B = Ft(a.current.contentDocument, l._id);
901
+ B && (P(B) || (_ = (x = a.current) == null ? void 0 : x.contentWindow) == null || _.scrollTo({ top: B.offsetTop, behavior: "smooth" }), k([B]));
902
+ }
903
+ }, [l]), C(() => {
904
+ if (!T(w) && a.current) {
905
+ const x = qn(
906
+ a.current.contentDocument,
907
+ et(w).id
908
+ );
909
+ h(x ? [x] : [null]);
910
+ } else
911
+ h([null]);
912
+ }, [w]);
913
+ const G = $t(() => {
914
+ let x = xn;
915
+ return x = x.replace("__HTML_DIR__", F), t === "offline" && (x = x.replace(
916
+ "https://old.chaibuilder.com/offline/tailwind.cdn.js",
917
+ "/offline/tailwind.cdn.js"
918
+ ), 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;
919
+ }, [t]);
920
+ return /* @__PURE__ */ s.jsx(
921
+ "div",
922
+ {
923
+ onClick: () => {
924
+ o([]), S([]);
925
+ },
926
+ onMouseLeave: () => setTimeout(() => c(""), 300),
927
+ className: "relative mx-auto h-full w-full overflow-hidden",
928
+ style: m > 0 && !T(d) ? { width: e ? "100%" : m } : {},
929
+ ref: i,
930
+ children: /* @__PURE__ */ s.jsxs(
931
+ kn,
932
+ {
933
+ contentDidMount: () => j(a.current),
934
+ ref: a,
935
+ id: "canvas-iframe",
936
+ style: { width: `${n}px`, ...d },
937
+ className: "relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",
938
+ initialContent: G,
939
+ children: [
940
+ /* @__PURE__ */ s.jsx(En, {}),
941
+ /* @__PURE__ */ s.jsx(
942
+ Ln,
943
+ {
944
+ block: l,
945
+ selectedBlockElement: et(f)
946
+ }
947
+ ),
948
+ /* @__PURE__ */ s.jsx(Fn, { model: "page" }),
949
+ /* @__PURE__ */ s.jsx(ln, { children: /* @__PURE__ */ s.jsx(Mn, { children: N ? /* @__PURE__ */ s.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ s.jsx(nt, { className: "h-full" }) }) : /* @__PURE__ */ s.jsx(Wn, {}) }) }),
950
+ /* @__PURE__ */ s.jsx("br", {}),
951
+ /* @__PURE__ */ s.jsx(
952
+ "div",
953
+ {
954
+ id: "placeholder",
955
+ className: "pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"
956
+ }
957
+ )
958
+ ]
959
+ }
960
+ )
961
+ }
962
+ );
963
+ }, Kn = D.lazy(() => import("./CodeEditor-LeNocbY6.js")), Js = () => {
964
+ const [t] = Oe();
965
+ return /* @__PURE__ */ s.jsxs("div", { className: "flex h-full w-full flex-col", children: [
966
+ /* @__PURE__ */ s.jsx(fn, {}),
967
+ /* @__PURE__ */ s.jsxs("div", { className: "relative flex h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
968
+ /* @__PURE__ */ s.jsx(tt, { fallback: /* @__PURE__ */ s.jsx(nt, { className: "h-full" }), children: /* @__PURE__ */ s.jsx(Ve, { children: /* @__PURE__ */ s.jsx(Vn, {}) }) }),
969
+ t ? /* @__PURE__ */ s.jsx(tt, { fallback: /* @__PURE__ */ s.jsx(nt, { className: "h-full" }), children: /* @__PURE__ */ s.jsx(cn, { enable: { top: !0, bottom: !1 }, className: "max-h-[400px] min-h-[200px]", children: /* @__PURE__ */ s.jsx(Kn, {}) }) }) : null
970
+ ] })
971
+ ] });
972
+ };
973
+ export {
974
+ Js as default
975
+ };