@chaibuilder/sdk 1.2.27 → 1.2.28

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 (99) hide show
  1. package/dist/{AddBlocks-ksZjjn0k.js → AddBlocks-0sW6gkCO.js} +8 -7
  2. package/dist/AddBlocks-YJPdSqcY.cjs +1 -0
  3. package/dist/{BrandingOptions-T_kbQFQv.js → BrandingOptions--vgnQvD1.js} +11 -10
  4. package/dist/BrandingOptions-RDn_Nhcq.cjs +1 -0
  5. package/dist/CanvasArea-41QoxuLf.cjs +55 -0
  6. package/dist/CanvasArea-aii0PyU-.js +1179 -0
  7. package/dist/{Class-3k8xjeiM.js → Class-6Hz2KzYb.js} +1 -1
  8. package/dist/{Class-MmCxz2Ay.cjs → Class-Zc8hpE7f.cjs} +1 -1
  9. package/dist/{CurrentPage-0eeU1V_c.js → CurrentPage-06Iacwyp.js} +9 -8
  10. package/dist/CurrentPage-2W1pdAOG.cjs +1 -0
  11. package/dist/ListTree-DnA8gj-7.js +314 -0
  12. package/dist/ListTree-pdQ14QJC.cjs +1 -0
  13. package/dist/MODIFIERS-YPHRtwrM.cjs +1 -0
  14. package/dist/{MODIFIERS-WQdaNvb8.js → MODIFIERS-cBT31iqE.js} +7 -19
  15. package/dist/PagesPanel-PBFzPSNY.cjs +1 -0
  16. package/dist/{PagesPanel-rYN28QpN.js → PagesPanel-_1CDTUdE.js} +9 -8
  17. package/dist/ProjectPanel-755bbzEQ.cjs +1 -0
  18. package/dist/{ProjectPanel-ivFOhdcz.js → ProjectPanel-pUMeIiUW.js} +14 -13
  19. package/dist/STRINGS--j49GZJP.js +7 -0
  20. package/dist/STRINGS-gPz7CUOk.cjs +1 -0
  21. package/dist/Settings-G9Xtqr7n.cjs +1 -0
  22. package/dist/{Settings-XWmKzRl9.js → Settings-dnO-s6x0.js} +596 -559
  23. package/dist/SidePanels-Gq2LdVuY.cjs +1 -0
  24. package/dist/{SidePanels-ODktnGbC.js → SidePanels-VxSXXkt_.js} +62 -61
  25. package/dist/{Topbar-Yunooh00.js → Topbar-5zbOSGF6.js} +6 -5
  26. package/dist/Topbar-J2tb4SA1.cjs +1 -0
  27. package/dist/{UnsplashImages-QMl0bxix.js → UnsplashImages-4WAWgA4s.js} +20 -19
  28. package/dist/UnsplashImages-XwjKheek.cjs +1 -0
  29. package/dist/{UploadImages-Si-A26bc.js → UploadImages-PONIHtn6.js} +11 -10
  30. package/dist/UploadImages-y7LAQVrT.cjs +1 -0
  31. package/dist/{add-page-modal-U7AUUrI1.js → add-page-modal-4VrFvgEm.js} +25 -24
  32. package/dist/add-page-modal-jWcp0w-S.cjs +1 -0
  33. package/dist/confirm-alert-4OQlXZTJ.cjs +1 -0
  34. package/dist/{confirm-alert-kV5-c70T.js → confirm-alert-j7b88hsW.js} +6 -5
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.js +47 -46
  37. package/dist/defaultTheme-7VqqhOcp.cjs +1 -0
  38. package/dist/{defaultTheme-gunU_Fe5.js → defaultTheme-D8B4-wHO.js} +1 -1
  39. package/dist/{delete-page-modal-UCBpdjLe.js → delete-page-modal--xHHdRAq.js} +9 -8
  40. package/dist/delete-page-modal-p6b0upz4.cjs +1 -0
  41. package/dist/email.cjs +1 -1
  42. package/dist/email.js +7 -6
  43. package/dist/{form-zmlTjM9j.js → form-_GJb9YcB.js} +1 -1
  44. package/dist/{form-Ap63cNec.cjs → form-jQj7E-hS.cjs} +1 -1
  45. package/dist/html-to-json-LJyJsnmZ.js +228 -0
  46. package/dist/html-to-json-vP1ESB_e.cjs +1 -0
  47. package/dist/{index-lOJfSheQ.js → index-0QJwevON.js} +2 -2
  48. package/dist/index-12HbDLon.cjs +1 -0
  49. package/dist/{index-f0AbmoYY.js → index-Eb5zyh2F.js} +4 -4
  50. package/dist/{index-Qk028f-N.cjs → index-KArv7pNz.cjs} +1 -1
  51. package/dist/{index-CFUoB97-.js → index-UHaqEdws.js} +993 -956
  52. package/dist/{index-l19JVVXI.cjs → index-mlMvwv2b.cjs} +2 -2
  53. package/dist/lib.cjs +3 -3
  54. package/dist/lib.js +17 -16
  55. package/dist/{page-viewer-jOwy--9A.js → page-viewer-00Xx4u8e.js} +10 -9
  56. package/dist/page-viewer-SZNm7b1n.cjs +1 -0
  57. package/dist/project-general-setting-C_pHNuZE.cjs +1 -0
  58. package/dist/{project-general-setting-3N8HZ2fe.js → project-general-setting-asDxlmhZ.js} +10 -9
  59. package/dist/{project-seo-setting-bSiNgO_1.js → project-seo-setting-DuAaDfDR.js} +7 -6
  60. package/dist/project-seo-setting-q2953ybQ.cjs +1 -0
  61. package/dist/render.cjs +1 -1
  62. package/dist/render.js +14 -13
  63. package/dist/{single-page-detail--AZlZ-pC.js → single-page-detail-UNxXvhl4.js} +17 -16
  64. package/dist/single-page-detail-oqj6zsLU.cjs +1 -0
  65. package/dist/studio.cjs +1 -1
  66. package/dist/studio.js +8 -7
  67. package/dist/ui.cjs +1 -1
  68. package/dist/ui.js +134 -133
  69. package/dist/useCanvasSettings-MR0Glu1b.cjs +1 -0
  70. package/dist/useCanvasSettings-R6br4J9i.js +6 -0
  71. package/dist/web-blocks.cjs +33 -1
  72. package/dist/web-blocks.js +603 -429
  73. package/package.json +1 -1
  74. package/dist/AddBlocks-S-4jzdWv.cjs +0 -1
  75. package/dist/BrandingOptions-EMCT0Wa3.cjs +0 -1
  76. package/dist/CanvasArea-SDzbubar.cjs +0 -55
  77. package/dist/CanvasArea-rhOeubmu.js +0 -950
  78. package/dist/CurrentPage-aTjWjc3o.cjs +0 -1
  79. package/dist/ListTree-Muu4rAtp.js +0 -308
  80. package/dist/ListTree-SWsqdfcG.cjs +0 -1
  81. package/dist/MODIFIERS-9EwxLM8V.cjs +0 -1
  82. package/dist/PagesPanel-n3x-0ozR.cjs +0 -1
  83. package/dist/ProjectPanel-pBePMOta.cjs +0 -1
  84. package/dist/Settings-JRyJayf5.cjs +0 -1
  85. package/dist/SidePanels-BtUeo6M9.cjs +0 -1
  86. package/dist/Topbar-QMeD3hvq.cjs +0 -1
  87. package/dist/UnsplashImages-05JR8oIu.cjs +0 -1
  88. package/dist/UploadImages-OgSN1HVt.cjs +0 -1
  89. package/dist/add-page-modal-9pTKItY-.cjs +0 -1
  90. package/dist/confirm-alert-DhRc-Zcd.cjs +0 -1
  91. package/dist/defaultTheme-7Lk2zq60.cjs +0 -1
  92. package/dist/delete-page-modal-4s-6AIy4.cjs +0 -1
  93. package/dist/html-to-json-C_Eobs_d.cjs +0 -1
  94. package/dist/html-to-json-p__Fgqdg.js +0 -210
  95. package/dist/index-F4AQQ6qq.cjs +0 -1
  96. package/dist/page-viewer-YFrIG3L7.cjs +0 -1
  97. package/dist/project-general-setting-hK7I7FuN.cjs +0 -1
  98. package/dist/project-seo-setting-x-FK0pez.cjs +0 -1
  99. package/dist/single-page-detail-9abF2g2R.cjs +0 -1
@@ -1,950 +0,0 @@
1
- var Re = Object.defineProperty;
2
- var $e = (e, t, n) => t in e ? Re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var E = (e, t, n) => ($e(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- import { j as o } from "./jsx-runtime-WbnYoNE9.js";
5
- import M, { createElement as se, useCallback as K, useState as I, useEffect as j, Component as me, Children as Fe, Suspense as ge, useRef as ie, useMemo as Pe } from "react";
6
- import { map as O, includes as re, toUpper as Q, round as Oe, noop as $, has as fe, throttle as xe, isEmpty as N, first as W, omit as He, pick as ze, get as y, isString as ee, memoize as Ue, each as We, find as qe, filter as ye, isNull as Ke } from "lodash-es";
7
- import { ResetIcon as ae, 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 ve, B as q, V as be, aB as nt, aC as ot, aD as st, aE as it, aF as rt, N as te, ab as at, h as V, aG as lt, aH as ct, aI as dt, aJ as pt, aK as ut, aL as ht, aM as mt, r as S, ac as T, A as gt, a as ft, b as xt, c as yt, d as vt, e as bt, f as kt, g as wt, ai as jt, O as ke, aA as U, L as Ct, aN as Bt, Y as L, a5 as Dt, aO as F, E as ne, t as we, q as je, s as Ce, z as It, aP as St, aQ as Be, aR as _t, aS as Nt, F as At, aT as Et, a1 as Mt, aU as Tt, S as De } from "./index-CFUoB97-.js";
9
- import { useTranslation as Y } from "react-i18next";
10
- import { useAtom as C } from "jotai";
11
- import ce from "react-dom";
12
- import w from "prop-types";
13
- import { Quill as Lt } from "react-quill";
14
- import { useFeature as Ie } from "flagged";
15
- import { flip as Rt } from "@floating-ui/dom";
16
- import { useFloating as $t, shift as Ft } from "@floating-ui/react-dom";
17
- import { useResizeObserver as Pt } from "@react-hookz/web";
18
- import { tailwindcssPaletteGenerator as Ot } from "@bobthered/tailwindcss-palette-generator";
19
- import Ht from "@tailwindcss/typography";
20
- import zt from "@tailwindcss/forms";
21
- import Ut from "@tailwindcss/aspect-ratio";
22
- import { Provider as Wt } from "react-wrap-balancer";
23
- import { twMerge as qt } from "tailwind-merge";
24
- import { S as de, a as Se } from "./MODIFIERS-WQdaNvb8.js";
25
- import { getBlockComponent as Kt } from "@chaibuilder/runtime";
26
- import { u as Vt, B as Yt, E as Jt } from "./index-lOJfSheQ.js";
27
- import "./_commonjsHelpers-UyOWmZb0.js";
28
- import "./Functions-7jnEwJyw.js";
29
- import "clsx";
30
- import "./Class-3k8xjeiM.js";
31
- import "@radix-ui/react-toggle";
32
- import "class-variance-authority";
33
- import "@radix-ui/react-switch";
34
- import "@radix-ui/react-slot";
35
- import "@radix-ui/react-accordion";
36
- import "@radix-ui/react-alert-dialog";
37
- import "@radix-ui/react-dialog";
38
- import "@radix-ui/react-label";
39
- import "@radix-ui/react-scroll-area";
40
- import "@radix-ui/react-tabs";
41
- import "@radix-ui/react-tooltip";
42
- import "@radix-ui/react-popover";
43
- import "@radix-ui/react-menubar";
44
- import "@radix-ui/react-hover-card";
45
- import "@radix-ui/react-select";
46
- import "@radix-ui/react-dropdown-menu";
47
- import "@radix-ui/react-separator";
48
- import "@radix-ui/react-toast";
49
- import "cmdk";
50
- import "@radix-ui/react-context-menu";
51
- import "react-icons-picker";
52
- import "i18next";
53
- import "react-hotkeys-hook";
54
- const Qt = () => {
55
- const { hasUndo: e, hasRedo: t, undo: n, redo: r } = ve();
56
- return /* @__PURE__ */ o.jsxs("div", { className: "flex items-center", children: [
57
- /* @__PURE__ */ o.jsx(q, { disabled: !e(), size: "sm", onClick: n, className: "rounded-full", variant: "ghost", children: /* @__PURE__ */ o.jsx(ae, {}) }),
58
- /* @__PURE__ */ o.jsx(q, { disabled: !t(), onClick: r, size: "sm", className: "rounded-full", variant: "ghost", children: /* @__PURE__ */ o.jsx(ae, { className: "rotate-180 scale-y-[-1] transform" }) })
59
- ] });
60
- };
61
- function Zt() {
62
- const [e, t] = be(), { t: n } = Y();
63
- return /* @__PURE__ */ o.jsxs("div", { className: "flex items-center", children: [
64
- /* @__PURE__ */ o.jsx(nt, { htmlFor: "dark-mode-switch", children: n("dark_mode") }),
65
- /* @__PURE__ */ o.jsxs(
66
- ot,
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__ */ o.jsx("span", { className: "sr-only", children: n("use_setting") }),
77
- /* @__PURE__ */ o.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__ */ o.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__ */ o.jsx("g", { strokeWidth: 0 }),
101
- /* @__PURE__ */ o.jsx("g", { strokeLinecap: "round", strokeLinejoin: "round" }),
102
- /* @__PURE__ */ o.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
- ), Gt = [
114
- {
115
- title: "mobile_xs_title",
116
- content: "mobile_xs_content",
117
- breakpoint: "xs",
118
- icon: /* @__PURE__ */ o.jsx(le, {}),
119
- width: 400
120
- },
121
- {
122
- title: "mobile_sm_title",
123
- content: "mobile_sm_content",
124
- breakpoint: "sm",
125
- icon: /* @__PURE__ */ o.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__ */ o.jsx(pe, {}),
133
- width: 800
134
- },
135
- {
136
- title: "tablet_lg_title",
137
- content: "tablet_lg_content",
138
- breakpoint: "lg",
139
- icon: /* @__PURE__ */ o.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__ */ o.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__ */ o.jsx(Ye, {}),
154
- width: 1920
155
- }
156
- ], ue = ({
157
- title: e,
158
- content: t,
159
- currentBreakpoint: n,
160
- breakpoint: r,
161
- width: a,
162
- icon: i,
163
- onClick: c
164
- }) => {
165
- const { t: s } = Y();
166
- return /* @__PURE__ */ o.jsxs(st, { children: [
167
- /* @__PURE__ */ o.jsx(it, { asChild: !0, children: /* @__PURE__ */ o.jsx(
168
- q,
169
- {
170
- onClick: () => c(a),
171
- size: "sm",
172
- variant: r === n ? "secondary" : "ghost",
173
- children: i
174
- }
175
- ) }),
176
- /* @__PURE__ */ o.jsx(rt, { className: "w-52 border-border", children: /* @__PURE__ */ o.jsx("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ o.jsxs("div", { className: "space-y-1", children: [
177
- /* @__PURE__ */ o.jsx("h4", { className: "text-sm font-semibold", children: s(e) }),
178
- /* @__PURE__ */ o.jsx("p", { className: "text-xs", children: s(t) })
179
- ] }) }) })
180
- ] });
181
- }, Xt = () => {
182
- const [, e, t] = te(), [n, r] = at(), { t: a } = Y(), i = V("breakpoints", Gt), c = (s) => {
183
- n.includes(s) ? n.length > 2 && r(n.filter((l) => l !== s)) : r((l) => [...l, s]);
184
- };
185
- return i.length < 4 ? /* @__PURE__ */ o.jsx("div", { className: "flex items-center rounded-md", children: O(i, (s) => /* @__PURE__ */ se(ue, { ...s, onClick: t, key: s.breakpoint, currentBreakpoint: e })) }) : /* @__PURE__ */ o.jsxs("div", { className: "flex items-center rounded-md", children: [
186
- O(
187
- i.filter((s) => re(n, Q(s.breakpoint))),
188
- (s) => /* @__PURE__ */ se(ue, { ...s, onClick: t, key: s.breakpoint, currentBreakpoint: e })
189
- ),
190
- /* @__PURE__ */ o.jsxs(lt, { children: [
191
- /* @__PURE__ */ o.jsx(ct, { asChild: !0, children: /* @__PURE__ */ o.jsx("span", { className: "cursor-pointer px-2.5 hover:opacity-80", children: /* @__PURE__ */ o.jsx(Je, { className: "scale-90 transform" }) }) }),
192
- /* @__PURE__ */ o.jsxs(dt, { className: "w-56 border-border text-xs", children: [
193
- /* @__PURE__ */ o.jsx(pt, { children: a("Breakpoints") }),
194
- /* @__PURE__ */ o.jsx(ut, {}),
195
- O(i, (s) => /* @__PURE__ */ o.jsx(
196
- ht,
197
- {
198
- disabled: s.breakpoint === "xs",
199
- onCheckedChange: () => c(Q(s.breakpoint)),
200
- checked: re(n, Q(s.breakpoint)),
201
- children: a(s.title)
202
- },
203
- s.breakpoint
204
- ))
205
- ] })
206
- ] })
207
- ] });
208
- }, en = () => {
209
- const { t: e } = Y(), { setNewBlocks: t } = mt(), [, n] = S(), [, r] = T(), a = K(() => {
210
- t([]), n([]), r([]);
211
- }, [t]);
212
- return /* @__PURE__ */ o.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ o.jsxs(gt, { children: [
213
- /* @__PURE__ */ o.jsx(ft, { asChild: !0, children: /* @__PURE__ */ o.jsxs(q, { size: "sm", variant: "ghost", className: "flex items-center gap-x-1", children: [
214
- /* @__PURE__ */ o.jsx(Qe, {}),
215
- " ",
216
- e("clear")
217
- ] }) }),
218
- /* @__PURE__ */ o.jsxs(xt, { className: "border-border", children: [
219
- /* @__PURE__ */ o.jsxs(yt, { children: [
220
- /* @__PURE__ */ o.jsx(vt, { children: e("clear_canvas_title") }),
221
- /* @__PURE__ */ o.jsx(bt, { children: e("clear_canvas_description") })
222
- ] }),
223
- /* @__PURE__ */ o.jsxs(kt, { children: [
224
- /* @__PURE__ */ o.jsx(wt, { children: e("cancel") }),
225
- /* @__PURE__ */ o.jsx(jt, { onClick: a, children: e("yes") })
226
- ] })
227
- ] })
228
- ] }) });
229
- }, tn = () => {
230
- const e = V("darkMode", !1), [t] = ke();
231
- return /* @__PURE__ */ o.jsxs("div", { className: "flex h-10 items-center justify-between border-b bg-background/70 px-2", children: [
232
- /* @__PURE__ */ o.jsxs("div", { className: "flex h-full space-x-2", children: [
233
- e ? /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
234
- /* @__PURE__ */ o.jsx(Zt, {}),
235
- /* @__PURE__ */ o.jsx(U, { orientation: "vertical" })
236
- ] }) : null,
237
- /* @__PURE__ */ o.jsx(Xt, {}),
238
- /* @__PURE__ */ o.jsx(U, { orientation: "vertical" }),
239
- /* @__PURE__ */ o.jsxs("div", { className: "flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium", children: [
240
- /* @__PURE__ */ o.jsx(Ze, { className: "h-3.5 w-3.5 flex-shrink-0" }),
241
- " ",
242
- /* @__PURE__ */ o.jsxs("div", { className: "text-xs leading-3", children: [
243
- Oe(t, 0),
244
- "%"
245
- ] })
246
- ] }),
247
- /* @__PURE__ */ o.jsx(U, { orientation: "vertical" }),
248
- /* @__PURE__ */ o.jsx(Qt, {})
249
- ] }),
250
- /* @__PURE__ */ o.jsxs("div", { className: "flex h-full items-center space-x-2", children: [
251
- /* @__PURE__ */ o.jsx(U, { orientation: "vertical" }),
252
- /* @__PURE__ */ o.jsx(en, {})
253
- ] })
254
- ] });
255
- }, nn = `<!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>`, on = (e) => {
304
- const [t] = te(), [, n] = ke(), [r, a] = I({}), i = K(() => {
305
- const { width: c, height: s } = e;
306
- if (c < t) {
307
- const l = parseFloat((c / t).toFixed(2).toString());
308
- let d = {};
309
- const p = s * l;
310
- s && (d = {
311
- // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
312
- height: 100 + (s - p) / p * 100 + "%"
313
- }), a({
314
- position: "relative",
315
- top: 0,
316
- transform: `scale(${l})`,
317
- transformOrigin: "top left",
318
- ...d,
319
- maxWidth: "none"
320
- }), n(l * 100);
321
- } else
322
- a({}), n(100);
323
- }, [t, e, n]);
324
- return j(() => {
325
- i();
326
- }, [t, e, n, i]), r;
327
- };
328
- let _e, Ne;
329
- typeof document < "u" && (_e = document);
330
- typeof window < "u" && (Ne = window);
331
- const Ae = M.createContext({ document: _e, window: Ne }), J = () => M.useContext(Ae), { Provider: sn, Consumer: _o } = Ae;
332
- class Ee 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
- E(Ee, "propTypes", {
344
- children: w.element.isRequired,
345
- contentDidMount: w.func.isRequired,
346
- contentDidUpdate: w.func.isRequired
347
- });
348
- class G extends me {
349
- constructor(n, r) {
350
- super(n, r);
351
- E(this, "setRef", (n) => {
352
- this.nodeRef.current = n;
353
- const { forwardedRef: r } = this.props;
354
- typeof r == "function" ? r(n) : r && (r.current = n);
355
- });
356
- E(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
- E(this, "loadCheck", () => setInterval(() => {
362
- this.handleLoad();
363
- }, 500));
364
- this._isMounted = !1, this.nodeRef = M.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 r = this.props.contentDidMount, a = this.props.contentDidUpdate, i = n.defaultView || n.parentView, c = /* @__PURE__ */ o.jsx(Ee, { contentDidMount: r, contentDidUpdate: a, children: /* @__PURE__ */ o.jsx(sn, { value: { document: n, window: i }, children: /* @__PURE__ */ o.jsx("div", { className: "frame-content", children: this.props.children }) }) }), s = this.getMountTarget();
386
- return [ce.createPortal(this.props.head, this.getDoc().head), ce.createPortal(c, s)];
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__ */ o.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
- E(G, "propTypes", {
403
- style: w.object,
404
- // eslint-disable-line
405
- head: w.node,
406
- initialContent: w.string,
407
- mountTarget: w.string,
408
- contentDidMount: w.func,
409
- contentDidUpdate: w.func,
410
- children: w.oneOfType([w.element, w.arrayOf(w.element)])
411
- }), E(G, "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 rn = M.forwardRef((e, t) => /* @__PURE__ */ o.jsx(G, { ...e, forwardedRef: t })), an = () => {
423
- const { addCoreBlock: e } = Ct(), t = V("getExternalPredefinedBlock", $);
424
- return K(
425
- async (n) => {
426
- const { block: r, dropTargetId: a, relativeIndex: i } = n;
427
- if (fe(r, "format")) {
428
- const c = await t(r);
429
- return e({ blocks: c }, a === 0 ? null : a, i);
430
- }
431
- return e(r, a === 0 ? null : a, i);
432
- },
433
- [e]
434
- );
435
- };
436
- let _ = null, H = [], P = null, Me = null;
437
- function ln(e) {
438
- const t = window.getComputedStyle(e), n = parseInt(t.paddingLeft, 10), r = parseInt(t.paddingTop, 10), a = parseInt(t.paddingRight, 10), i = parseInt(t.paddingBottom, 10);
439
- return { paddingLeft: n, paddingTop: r, paddingRight: a, paddingBottom: i };
440
- }
441
- const he = (e, t, n) => {
442
- if (!_)
443
- return;
444
- const r = e.getBoundingClientRect(), a = _ == null ? void 0 : _.getElementById("placeholder"), { paddingLeft: i, paddingTop: c, paddingRight: s, paddingBottom: l } = ln(e);
445
- a.style.width = t === "vertical" ? r.width - i - s + "px" : "2px", a.style.height = t === "vertical" ? "2px" : r.height - c - l + "px", a.style.display = "block";
446
- const d = H.reduce(
447
- (p, m) => Math.abs(m - n) < Math.abs(p - n) ? m : p
448
- );
449
- Me = H.indexOf(d), t === "vertical" ? (a.style.top = e.offsetTop + d + "px", a.style.left = e.offsetLeft + i + "px") : (a.style.top = e.offsetTop + c + "px", a.style.left = e.offsetLeft + d + "px");
450
- }, cn = (e) => {
451
- const t = Te(e), n = window.getComputedStyle(e), r = t === "horizontal", a = parseInt(n.paddingLeft), i = parseInt(n.paddingTop);
452
- let c = r ? a : i;
453
- H = [c], Array.from(e.children).forEach((s) => {
454
- const l = window.getComputedStyle(s), d = parseInt(
455
- r ? l.marginLeft + l.marginRight : l.marginTop + l.marginBottom
456
- ), p = r ? s.offsetWidth : s.offsetHeight;
457
- H.push(c + p + d), c += p + d;
458
- });
459
- };
460
- function Te(e) {
461
- const t = window.getComputedStyle(e).display, n = window.getComputedStyle(e).flexDirection;
462
- if (t === "flex")
463
- return n === "column" || n === "column-reverse" ? "vertical" : "horizontal";
464
- if (t === "grid") {
465
- const r = window.getComputedStyle(e).gridTemplateRows, a = window.getComputedStyle(e).gridTemplateColumns;
466
- if (r.includes("auto"))
467
- return "vertical";
468
- if (a.includes("auto"))
469
- return "horizontal";
470
- }
471
- return t === "block" ? "vertical" : "horizontal";
472
- }
473
- const dn = xe((e) => {
474
- const t = e.target, n = Te(t);
475
- if (n === "vertical") {
476
- const r = e.clientY - t.offsetTop;
477
- he(t, n, r);
478
- } else {
479
- const r = e.clientX - t.offsetLeft;
480
- he(t, n, r);
481
- }
482
- }, 200), pn = (e) => {
483
- e.preventDefault(), e.stopPropagation(), dn(e);
484
- };
485
- function Z() {
486
- const e = _ == null ? void 0 : _.getElementById("placeholder");
487
- e.style.display = "none";
488
- }
489
- const un = () => {
490
- const { document: e } = J(), [t, n] = C(Bt), r = an(), a = Ie("dnd"), [, i] = L(), [, c] = S();
491
- return _ = e, {
492
- isDragging: t,
493
- "data-dnd": "branch",
494
- onDragOver: a ? pn : $,
495
- onDrop: a ? (s) => {
496
- P == null || P.classList.remove("outline", "outline-green-300", "outline-2", "-outline-offset-2");
497
- const l = JSON.parse(s.dataTransfer.getData("text/plain"));
498
- let d = s.target.getAttribute("data-block-id");
499
- d === null && (d = s.target.parentElement.getAttribute("data-block-id")), r({ block: l, dropTargetId: d || null, relativeIndex: Me }), n(!1), Z(), setTimeout(() => {
500
- Z();
501
- }, 300);
502
- } : $,
503
- onDragEnter: a ? (s) => {
504
- const l = s;
505
- P = l.target, l.stopPropagation(), l.preventDefault(), H = [];
506
- const d = l.target;
507
- cn(d), d.classList.add("outline", "outline-green-300", "outline-2", "-outline-offset-2"), n(!0), i(""), c([]);
508
- } : $,
509
- onDragLeave: a ? (s) => {
510
- const l = s;
511
- P = null, l.stopPropagation(), l.preventDefault(), l.target.classList.remove("outline", "outline-green-300", "outline-2", "-outline-offset-2");
512
- } : $,
513
- onMouseOut: a ? () => {
514
- n(!1), Z();
515
- } : $
516
- };
517
- };
518
- function oe(e) {
519
- return e.getAttribute("data-block-id") ? e : e.closest("[data-block-id]");
520
- }
521
- function hn(e) {
522
- e.container.innerHTML = "", e.container.parentNode.removeChild(e.container);
523
- var t = document.querySelector(".ql-toolbar");
524
- t && t.parentNode.removeChild(t), e = null;
525
- }
526
- const mn = () => {
527
- const e = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], t = Dt(), [, n] = L(), [r, a] = C(F);
528
- return (i) => {
529
- var m;
530
- if (r)
531
- return;
532
- const c = oe(i.target), s = c.getAttribute("data-block-type");
533
- if (!s || !e.includes(s))
534
- return;
535
- const l = c.cloneNode(!0);
536
- c.style.display = "none", Array.from(l.attributes).forEach((g) => {
537
- g.name !== "class" && l.removeAttribute(g.name);
538
- }), s === "Text" && (l.style.display = "inline-block"), c.parentNode.insertBefore(l, c.nextSibling);
539
- const d = new Lt(l, { placeholder: "Type here..." });
540
- function p() {
541
- const g = d.getText(0, d.getLength());
542
- t([c.getAttribute("data-block-id")], { content: g }), c.removeAttribute("style"), l.removeEventListener("blur", p, !0), hn(d), a(""), n("");
543
- }
544
- l.addEventListener("blur", p, !0), d.focus(), (m = l.querySelector(".ql-clipboard")) == null || m.remove(), a(c.getAttribute("data-block-id"));
545
- };
546
- }, gn = () => {
547
- const [, e] = T(), [, t] = S(), [, n] = L(), [r] = C(F);
548
- return (a) => {
549
- if (r)
550
- return;
551
- a.stopPropagation();
552
- const i = oe(a.target);
553
- if (i != null && i.getAttribute("data-block-id") && (i == null ? void 0 : i.getAttribute("data-block-id")) === "container") {
554
- t([]), e([]), n("");
555
- return;
556
- }
557
- if (i != null && i.getAttribute("data-block-parent")) {
558
- const c = i.getAttribute("data-style-prop"), s = i.getAttribute("data-style-id"), l = i.getAttribute("data-block-parent");
559
- e([{ id: s, prop: c, blockId: l }]), t([l]);
560
- } else
561
- i != null && i.getAttribute("data-block-id") && t([i.getAttribute("data-block-id")]);
562
- n("");
563
- };
564
- }, fn = xe((e, t) => {
565
- const n = oe(e.target);
566
- n != null && n.getAttribute("data-style-id") && t(n.getAttribute("data-style-id"));
567
- }, 100), xn = () => {
568
- const [, e] = L(), [t] = C(F);
569
- return (n) => {
570
- t || fn(n, e);
571
- };
572
- }, yn = ({ children: e }) => {
573
- const { document: t } = J(), [n] = S(), [r, a] = T();
574
- j(() => {
575
- setTimeout(() => {
576
- if (!N(r))
577
- return;
578
- const d = Le(t, W(n));
579
- if (d) {
580
- const p = d.getAttribute("data-style-prop");
581
- if (p) {
582
- const m = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
583
- a([{ id: m, prop: p, blockId: g }]);
584
- }
585
- }
586
- }, 100);
587
- }, [t, n, a, r]);
588
- const i = mn(), c = gn(), s = xn(), l = un();
589
- return /* @__PURE__ */ o.jsx(
590
- "div",
591
- {
592
- "data-block-id": "container",
593
- id: "canvas",
594
- onClick: c,
595
- onDoubleClick: i,
596
- onMouseMove: s,
597
- ...He(l, "isDragging"),
598
- className: "relative mb-5 h-full max-w-full " + (l.isDragging ? "dragging" : ""),
599
- children: e
600
- }
601
- );
602
- }, Le = (e, t) => e.querySelector(`[data-block-id="${t}"]`), vn = () => {
603
- const { window: e } = J(), [t, n] = S(), [r] = ne(), [, a] = T(), { undo: i, redo: c } = ve(), s = we(), [, l] = je(), d = Ce(), { savePage: p } = It(), [m] = C(F), [, g] = C(St), k = (f) => {
604
- f.key === "Enter" && (f.preventDefault(), t.length === 1 && g(W(t)));
605
- }, B = (f) => {
606
- const h = r.find((b) => b._id === f);
607
- return h ? h._parent : null;
608
- };
609
- return j(() => {
610
- const f = (h) => {
611
- if (h.key === "Escape") {
612
- n([]), a([]);
613
- return;
614
- }
615
- if (k(h), !m && (h.key === "Delete" || h.key === "Backspace") && (h.preventDefault(), d(t)), h.ctrlKey || h.metaKey) {
616
- if (h.key === "ArrowUp") {
617
- h.preventDefault();
618
- const b = t.length > 0 ? B(t[0]) : null;
619
- b && n([b]);
620
- }
621
- if (["z", "y", "d", "x", "c", "p", "s", "v"].includes(h.key)) {
622
- if (m && ["x", "z", "v"].includes(h.key))
623
- return !0;
624
- h.preventDefault();
625
- }
626
- h.key === "s" && (h.stopPropagation(), h.preventDefault(), p()), h.key === "z" && i(), h.key === "y" && c(), h.key === "d" && s(t);
627
- }
628
- };
629
- return e.removeEventListener("keydown", f), e.addEventListener("keydown", f), () => {
630
- e.removeEventListener("keydown", f);
631
- };
632
- }, [t, n, i, d, l, c, s, m, p, e]), null;
633
- }, bn = ({ block: e, label: t }) => {
634
- const [, n] = S(), [, r] = L(), [, a] = C(Be), i = Ie("dnd");
635
- return /* @__PURE__ */ o.jsxs(
636
- "div",
637
- {
638
- className: "mr-10 flex cursor-grab items-center space-x-1 px-1",
639
- draggable: i ? "true" : "false",
640
- onDragStart: (c) => {
641
- c.dataTransfer.setData("text/plain", JSON.stringify(ze(e, ["_id", "_type"]))), a(e._id), setTimeout(() => {
642
- n([]), r(null);
643
- }, 200);
644
- },
645
- children: [
646
- /* @__PURE__ */ o.jsx(Ge, {}),
647
- t
648
- ]
649
- }
650
- );
651
- }, kn = ({ selectedBlockElement: e, block: t }) => {
652
- const n = Ce(), r = we(), [, a] = S(), [, i] = T(), [c] = C(F), { floatingStyles: s, refs: l, update: d } = $t({
653
- placement: "top-start",
654
- middleware: [Ft(), Rt()],
655
- elements: {
656
- reference: e
657
- }
658
- });
659
- Pt(e, () => d(), e !== null);
660
- const p = y(t, "_parent", null), m = N(y(t, "_name", "")) ? y(t, "_type", "") : y(t, "_name", "");
661
- return !e || !t || c ? null : /* @__PURE__ */ o.jsxs(
662
- "div",
663
- {
664
- role: "button",
665
- tabIndex: 0,
666
- ref: l.setFloating,
667
- style: s,
668
- onClick: (g) => {
669
- g.stopPropagation(), g.preventDefault();
670
- },
671
- onKeyDown: (g) => g.stopPropagation(),
672
- className: "z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
673
- children: [
674
- /* @__PURE__ */ o.jsx(bn, { label: m, block: t }),
675
- /* @__PURE__ */ o.jsxs("div", { className: "flex gap-2 px-1", children: [
676
- p && /* @__PURE__ */ o.jsx(
677
- Xe,
678
- {
679
- className: "hover:scale-105",
680
- onClick: () => {
681
- i([]), a([p]);
682
- }
683
- }
684
- ),
685
- _t(y(t, "_type", "")) ? /* @__PURE__ */ o.jsx(et, { className: "hover:scale-105", onClick: () => r([t == null ? void 0 : t._id]) }) : null,
686
- Nt(y(t, "_type", "")) ? /* @__PURE__ */ o.jsx(tt, { className: "hover:scale-105", onClick: () => n([t == null ? void 0 : t._id]) }) : null
687
- ] })
688
- ]
689
- }
690
- );
691
- }, wn = ({ model: e }) => {
692
- const [t] = At(), [n] = S(), [r] = be(), [a] = L(), [i] = T(), [c] = C(Be), { document: s, window: l } = J(), [d] = I(s == null ? void 0 : s.getElementById("highlighted-block")), [p] = I(
693
- s == null ? void 0 : s.getElementById("selected-block")
694
- ), [m] = I(
695
- s == null ? void 0 : s.getElementById("selected-styling-block")
696
- ), [g] = I(s == null ? void 0 : s.getElementById("dragged-block"));
697
- j(() => {
698
- r ? s == null || s.documentElement.classList.add("dark") : s == null || s.documentElement.classList.remove("dark");
699
- }, [r, s]);
700
- const k = y(t, "headingFont", "DM Sans"), B = y(t, "bodyFont", "DM Sans");
701
- return j(() => {
702
- const f = y(t, "primaryColor", "#000"), h = y(t, "secondaryColor", "#FFF"), b = Ot({
703
- colors: [f, h],
704
- names: ["primary", "secondary"]
705
- });
706
- b.primary.DEFAULT = f, b.secondary.DEFAULT = h;
707
- const R = y(t, "roundedCorners", "0");
708
- !l || !l.tailwind || (l.tailwind.config = {
709
- darkMode: "class",
710
- theme: {
711
- fontFamily: {
712
- heading: [k],
713
- body: [B]
714
- },
715
- extend: {
716
- borderRadius: {
717
- global: `${R || "0"}px`
718
- },
719
- colors: b
720
- }
721
- },
722
- plugins: [
723
- Ht,
724
- zt,
725
- Ut,
726
- l.tailwind.plugin.withOptions(() => ({ addVariant: z, e: D }) => {
727
- z("hs-accordion-active", [
728
- ({ modifySelectors: v, separator: u }) => {
729
- v(({ className: x }) => `.hs-accordion.active.${D(`hs-accordion-active${u}${x}`)}`);
730
- },
731
- ({ modifySelectors: v, separator: u }) => {
732
- v(({ className: x }) => `.hs-accordion.active > .${D(`hs-accordion-active${u}${x}`)}`);
733
- },
734
- ({ modifySelectors: v, separator: u }) => {
735
- v(({ className: x }) => `.hs-accordion.active > .hs-accordion-toggle .${D(
736
- `hs-accordion-active${u}${x}`
737
- )}`);
738
- },
739
- ({ modifySelectors: v, separator: u }) => {
740
- v(({ className: x }) => `.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${D(
741
- `hs-accordion-active${u}${x}`
742
- )}`);
743
- },
744
- ({ modifySelectors: v, separator: u }) => {
745
- v(({ className: x }) => `.hs-accordion.active > .hs-accordion-toggle.${D(
746
- `hs-accordion-active${u}${x}`
747
- )}`);
748
- },
749
- ({ modifySelectors: v, separator: u }) => {
750
- v(({ className: x }) => `.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${D(
751
- `hs-accordion-active${u}${x}`
752
- )}`);
753
- }
754
- ]), z("hs-accordion-selected", ({ modifySelectors: v, separator: u }) => {
755
- v(({ className: x }) => `.hs-accordion .selected.${D(`hs-accordion-selected${u}${x}`)}`);
756
- });
757
- })
758
- ]
759
- });
760
- }, [t, l, k, B]), j(() => {
761
- p && (p.textContent = `${O(n, (f) => `[data-block-id="${f}"]`).join(",")}{
762
- outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
763
- }`);
764
- }, [n, p]), j(() => {
765
- if (!c) {
766
- g.textContent = "";
767
- return;
768
- }
769
- g.textContent = `[data-block-id="${c}"]{ pointer-events: none !important; opacity: 0.2 !important}`;
770
- }, [c]), j(() => {
771
- d && (d.textContent = a ? `[data-style-id="${a}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
772
- }, [a, n, d]), j(() => {
773
- m && (m.textContent = `${O(i, ({ id: f }) => `[data-style-id="${f}"]`).join(",")}{
774
- outline: 1px solid #42a1fc !important; outline-offset: -1px;
775
- }`);
776
- }, [i, m]), j(() => {
777
- const f = y(t, "bodyTextLightColor", "#64748b"), h = y(t, "bodyTextDarkColor", "#94a3b8"), b = y(t, "bodyBgLightColor", "#FFFFFF"), R = y(t, "bodyBgDarkColor", "#0f172a");
778
- s.body.className = `font-body antialiased text-[${f}] bg-[${b}] dark:text-[${h}] dark:bg-[${R}]`;
779
- }, [t, s, e]), e === "page" ? /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
780
- k && /* @__PURE__ */ o.jsx(
781
- "link",
782
- {
783
- id: "heading-font",
784
- rel: "stylesheet",
785
- type: "text/css",
786
- href: `https://fonts.googleapis.com/css2?family=${k.replace(
787
- / /g,
788
- "+"
789
- )}:wght@300;400;500;600;700;800;900&display=swap`,
790
- media: "all"
791
- }
792
- ),
793
- B && k !== B && /* @__PURE__ */ o.jsx(
794
- "link",
795
- {
796
- id: "body-font",
797
- rel: "stylesheet",
798
- type: "text/css",
799
- href: `https://fonts.googleapis.com/css2?family=${B.replace(
800
- / /g,
801
- "+"
802
- )}:wght@300;400;500;600;700;800;900&display=swap`,
803
- media: "all"
804
- }
805
- ),
806
- k && /* @__PURE__ */ o.jsx("style", { children: `h1,h2,h3,h4,h5,h6{font-family: "${k}",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";}` })
807
- ] }) : null;
808
- }, jn = (e) => {
809
- const t = {};
810
- return Object.keys(e).forEach((n) => {
811
- ee(e[n]) && e[n].startsWith(de) && (t[n] = e[n].replace(de, "").split(","));
812
- }), t;
813
- }, Cn = Ue((e) => {
814
- const t = e.replace(Se, "").split(",");
815
- return qt(t[0], t[1]);
816
- });
817
- function Bn(e, t) {
818
- return y(e, `${t}_attrs`, {});
819
- }
820
- function Dn(e) {
821
- const t = {};
822
- return Object.keys(e).forEach((n) => {
823
- if (ee(e[n]) && e[n].startsWith(Se)) {
824
- const r = Cn(e[n]);
825
- t[n] = {
826
- className: r,
827
- "data-style-prop": n,
828
- "data-block-parent": e._id,
829
- "data-style-id": `${n}-${e._id}`,
830
- ...Bn(e, n)
831
- };
832
- }
833
- }), t;
834
- }
835
- function In(e, t) {
836
- const n = y(e, "_bindings", {});
837
- return N(n) ? { ...e } : (We(n, (r, a) => {
838
- ee(r) && y(t, r, null) && (e[a] = y(t, r, null));
839
- }), e);
840
- }
841
- function X({ blocks: e }) {
842
- const [t] = ne(), n = K((i) => Dn(i), []), [r] = Vt(), [a] = C(F);
843
- return /* @__PURE__ */ o.jsx(o.Fragment, { children: M.Children.toArray(
844
- e.map((i, c) => {
845
- if (a === i._id)
846
- return null;
847
- const s = jn(i), l = {};
848
- N(s) || Object.keys(s).forEach((g) => {
849
- l[g] = M.Children.toArray(
850
- s[g].map((k) => /* @__PURE__ */ o.jsx(X, { blocks: [qe(t, { _id: k })] }))
851
- );
852
- });
853
- const d = ye(t, { _parent: i._id });
854
- l.children = d.length ? /* @__PURE__ */ o.jsx(X, { blocks: d }) : null;
855
- const p = Kt(i._type), m = y(p, "builderComponent", y(p, "component", null));
856
- return Ke(m) ? /* @__PURE__ */ o.jsx("noscript", { children: `<!-- ${i == null ? void 0 : i._type} not registered -->` }) : /* @__PURE__ */ o.jsx(ge, { children: M.createElement(m, {
857
- blockProps: {
858
- "data-block-id": i._id,
859
- "data-block-type": i._type,
860
- "data-dnd": fe(p, "canAcceptBlock") ? "branch" : "leaf"
861
- },
862
- inBuilder: !0,
863
- index: c,
864
- ...In(i, r),
865
- ...n(i),
866
- ...l
867
- }) });
868
- })
869
- ) });
870
- }
871
- const Sn = () => {
872
- const [e] = ne(), t = N(e) ? null : /* @__PURE__ */ o.jsx(Yt, { children: /* @__PURE__ */ o.jsx(X, { blocks: ye(e, (n) => N(n._parent)) }) });
873
- return /* @__PURE__ */ o.jsx(Wt, { children: t });
874
- }, _n = (e, t) => e.querySelector(`[data-style-id="${t}"]`), Nn = () => {
875
- const [e] = C(Et), [t] = je(), [n] = te(), [, r] = S(), a = Mt(), [, i] = L(), c = ie(null), s = ie(null), [l, d] = I({ width: 0, height: 0 }), p = on(l), [m, g] = I(0), [k, B] = I([]), [, f] = I([]), [, h] = C(Tt), [b, R] = T(), z = V("loading", !1);
876
- j(() => {
877
- const { clientWidth: u, clientHeight: x } = s.current;
878
- d({ width: u, height: x }), m === 0 && g(u);
879
- }, [s, n, m]);
880
- const D = (u, x = 0) => {
881
- const { top: A } = u.getBoundingClientRect();
882
- return A + x >= 0 && A - x <= window.innerHeight;
883
- };
884
- j(() => {
885
- var u, x;
886
- if (a && a.type !== "Multiple" && c.current) {
887
- const A = Le(c.current.contentDocument, a._id);
888
- A && (D(A) || (x = (u = c.current) == null ? void 0 : u.contentWindow) == null || x.scrollTo({ top: A.offsetTop, behavior: "smooth" }), B([A]));
889
- }
890
- }, [a]), j(() => {
891
- if (!N(b) && c.current) {
892
- const u = _n(
893
- c.current.contentDocument,
894
- W(b).id
895
- );
896
- f(u ? [u] : [null]);
897
- } else
898
- f([null]);
899
- }, [b]);
900
- const v = Pe(() => {
901
- let u = nn;
902
- return e === "offline" && (u = u.replace(
903
- "https://old.chaibuilder.com/offline/tailwind.cdn.js",
904
- "/offline/tailwind.cdn.js"
905
- ), u = u.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), u = u.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), u;
906
- }, [e]);
907
- return /* @__PURE__ */ o.jsx(
908
- "div",
909
- {
910
- onClick: () => {
911
- r([]), R([]);
912
- },
913
- onMouseLeave: () => setTimeout(() => i(""), 300),
914
- className: "relative mx-auto h-full w-full overflow-hidden",
915
- style: m > 0 && !N(p) ? { width: t ? "100%" : m } : {},
916
- ref: s,
917
- children: /* @__PURE__ */ o.jsxs(
918
- rn,
919
- {
920
- contentDidMount: () => h(c.current),
921
- ref: c,
922
- id: "canvas-iframe",
923
- style: { width: `${n}px`, ...p },
924
- className: "relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",
925
- initialContent: v,
926
- children: [
927
- /* @__PURE__ */ o.jsx(vn, {}),
928
- /* @__PURE__ */ o.jsx(
929
- kn,
930
- {
931
- block: a,
932
- selectedBlockElement: W(k)
933
- }
934
- ),
935
- /* @__PURE__ */ o.jsx(wn, { model: "page" }),
936
- /* @__PURE__ */ o.jsx(yn, { children: z ? /* @__PURE__ */ o.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ o.jsx(De, { className: "h-full" }) }) : /* @__PURE__ */ o.jsx(Sn, {}) }),
937
- /* @__PURE__ */ o.jsx("br", {}),
938
- /* @__PURE__ */ o.jsx("div", { id: "placeholder", className: "absolute z-[99999] max-w-full bg-green-500 transition-transform" })
939
- ]
940
- }
941
- )
942
- }
943
- );
944
- }, No = () => /* @__PURE__ */ o.jsxs("div", { className: "flex h-full w-full flex-col", children: [
945
- /* @__PURE__ */ o.jsx(tn, {}),
946
- /* @__PURE__ */ o.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__ */ o.jsx(ge, { fallback: /* @__PURE__ */ o.jsx(De, { className: "h-full" }), children: /* @__PURE__ */ o.jsx(Jt, { children: /* @__PURE__ */ o.jsx(Nn, {}) }) }) })
947
- ] });
948
- export {
949
- No as default
950
- };