@chaibuilder/sdk 1.2.14 → 1.2.15

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 (55) hide show
  1. package/dist/{AddBlocks-zN5--UP6.js → AddBlocks-IE14csoo.js} +63 -57
  2. package/dist/{AddBlocks-tomDo_Is.cjs → AddBlocks-OpGQyVQZ.cjs} +1 -1
  3. package/dist/{BrandingOptions-BUmE4f72.cjs → BrandingOptions-tBWzqas5.cjs} +1 -1
  4. package/dist/{BrandingOptions-LbizrmRI.js → BrandingOptions-t_MjeHSM.js} +1 -1
  5. package/dist/{CanvasArea-1PwexKQz.cjs → CanvasArea-SBeW-Kdq.cjs} +4 -4
  6. package/dist/{CanvasArea-leUzGAdQ.js → CanvasArea-TR5t1xxh.js} +3 -3
  7. package/dist/{CurrentPage-M6uJPKhj.cjs → CurrentPage--ag-4O2R.cjs} +1 -1
  8. package/dist/{CurrentPage-XSq62fdk.js → CurrentPage-JUlhyVbI.js} +2 -2
  9. package/dist/{Layers-tasAbEc8.cjs → Layers-05Ut4xZA.cjs} +1 -1
  10. package/dist/{Layers-JoV3wull.js → Layers-Dav1kBNN.js} +125 -148
  11. package/dist/{PagesPanel-5KjlPTtj.js → PagesPanel--feFCDeH.js} +3 -3
  12. package/dist/{PagesPanel-v1B780fd.cjs → PagesPanel-TLVCJtcF.cjs} +1 -1
  13. package/dist/{ProjectPanel-4X2KLnOi.js → ProjectPanel--Vq6HSMl.js} +3 -3
  14. package/dist/{ProjectPanel-NZYWWYTt.cjs → ProjectPanel-Q8sNFs1f.cjs} +1 -1
  15. package/dist/{Settings-FW-bX28i.cjs → Settings-9iryF0yE.cjs} +1 -1
  16. package/dist/{Settings-1WP3BWxr.js → Settings-DjE6HR2E.js} +2 -2
  17. package/dist/{SidePanels-ZlDXRldT.js → SidePanels-4zpCzCM6.js} +68 -68
  18. package/dist/{SidePanels-YpyBLRub.cjs → SidePanels-LVED6uuT.cjs} +1 -1
  19. package/dist/{Topbar-2sOsQD2d.cjs → Topbar-iH2L4pe0.cjs} +1 -1
  20. package/dist/{Topbar-xvrno03z.js → Topbar-ryFhl-PC.js} +1 -1
  21. package/dist/{UnsplashImages-EiYSWkBa.cjs → UnsplashImages-SrxA-yNu.cjs} +1 -1
  22. package/dist/{UnsplashImages-hhPOf7kt.js → UnsplashImages-ppQXZ28F.js} +1 -1
  23. package/dist/{UploadImages-JKjE44i7.js → UploadImages-IKR4oX2k.js} +1 -1
  24. package/dist/{UploadImages-GGCExfQd.cjs → UploadImages-VBiO6lqp.cjs} +1 -1
  25. package/dist/{add-page-modal-ueEpfep_.cjs → add-page-modal-KixvLXAG.cjs} +1 -1
  26. package/dist/{add-page-modal-iYgzDs08.js → add-page-modal-nZJaunuz.js} +3 -3
  27. package/dist/{confirm-alert-Nw1JCtuu.js → confirm-alert-QKtbNbWz.js} +1 -1
  28. package/dist/{confirm-alert-_DCO6hCV.cjs → confirm-alert-uV_PtYc3.cjs} +1 -1
  29. package/dist/core.cjs +1 -1
  30. package/dist/core.js +2 -2
  31. package/dist/{delete-page-modal-CT-ZA6H5.cjs → delete-page-modal-6GxLQkEk.cjs} +1 -1
  32. package/dist/{delete-page-modal-hlR-A69E.js → delete-page-modal-pN5cFz-m.js} +2 -2
  33. package/dist/email.cjs +1 -1
  34. package/dist/email.js +2 -2
  35. package/dist/{form-vNgf0kO2.cjs → form-KkP1F7h1.cjs} +1 -1
  36. package/dist/{form-lbFCPUoE.js → form-faX0Yn4Q.js} +1 -1
  37. package/dist/{index-bfKqnRvZ.cjs → index-ERorPL9q.cjs} +1 -1
  38. package/dist/{index-m9VziIOy.js → index-QGA4ayU7.js} +275 -275
  39. package/dist/{index-DXznIJrr.js → index-nrRnwUaC.js} +3 -3
  40. package/dist/{index-TBa4RPnS.cjs → index-xJ8LmB04.cjs} +2 -2
  41. package/dist/{page-viewer-voX6SLpK.cjs → page-viewer-Nn__90Uo.cjs} +1 -1
  42. package/dist/{page-viewer-Hgr72mrQ.js → page-viewer-U7o88VvR.js} +3 -3
  43. package/dist/{project-general-setting-VFFXhGpN.cjs → project-general-setting-C98_GooL.cjs} +1 -1
  44. package/dist/{project-general-setting-OdZj-lfx.js → project-general-setting-h0TeKYRf.js} +3 -3
  45. package/dist/{project-seo-setting-aRDdqu88.cjs → project-seo-setting-8oJUrOqk.cjs} +1 -1
  46. package/dist/{project-seo-setting-9V67NFil.js → project-seo-setting-Sl6AE-Q7.js} +2 -2
  47. package/dist/{single-page-detail-FIwXvGx2.cjs → single-page-detail-RYI1ukX6.cjs} +1 -1
  48. package/dist/{single-page-detail-AjhWBVK1.js → single-page-detail-a8zY-XHs.js} +4 -4
  49. package/dist/studio.cjs +1 -1
  50. package/dist/studio.js +2 -2
  51. package/dist/ui.cjs +1 -1
  52. package/dist/ui.js +1 -1
  53. package/dist/{useAddBlockByDrop-1WvPoBXa.cjs → useAddBlockByDrop-LBgi6GL7.cjs} +1 -1
  54. package/dist/{useAddBlockByDrop-bs_SH7Tw.js → useAddBlockByDrop-Y-g4O8UC.js} +1 -1
  55. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import y, { createElement as z, useState as f, useCallback as G, useMemo as M, useEffect as q, Suspense as V } from "react";
3
- import { has as S, first as x, omit as K, isEmpty as g, filter as j, values as b, groupBy as N, mergeWith as O, isArray as T, keys as R, get as U, map as B, uniq as W, includes as J, find as X, reject as _ } from "lodash-es";
3
+ import { has as S, first as h, omit as K, isEmpty as g, filter as j, values as b, groupBy as N, mergeWith as O, isArray as T, keys as R, get as U, map as B, uniq as W, includes as J, find as X, reject as _ } from "lodash-es";
4
4
  import { useAtom as v } from "jotai";
5
5
  import { useTranslation as L } from "react-i18next";
6
- import { K as w, j as C, X as Q, ao as A, av as Y, aw as Z, ax as $, i as I, a2 as F, aj as ee, ak as se, al as re, am as te, an as P, bg as oe, bh as ae, bi as le, bj as ce, az as ie, bk as ne, bl as de, B as me, bm as pe, bn as ue, bo as xe, ap as he, aq as fe, ar as k, bf as ge, b8 as je, b9 as be, ba as ye, bb as ve, S as ke } from "./index-m9VziIOy.js";
6
+ import { K as w, j as C, X as Q, ao as A, av as Y, aw as Z, ax as $, i as I, a2 as F, aj as ee, ak as se, al as re, am as te, an as P, bg as oe, bh as le, bi as ae, bj as ce, az as ie, bk as ne, bl as de, B as me, bm as pe, bn as ue, bo as xe, ap as he, aq as fe, ar as k, bf as ge, b8 as je, b9 as be, ba as ye, bb as ve, S as ke } from "./index-QGA4ayU7.js";
7
7
  import { BoxIcon as Ne } from "@radix-ui/react-icons";
8
8
  import { syncBlocksWithDefaults as H, useChaiBlocks as E } from "@chaibuilder/runtime";
9
9
  import { useFeature as Be } from "flagged";
@@ -43,47 +43,47 @@ import "react-dom";
43
43
  import "react-quill";
44
44
  import "himalaya";
45
45
  const _e = ({ block: s }) => {
46
- const { type: t, icon: i, label: l } = s, { addCoreBlock: d, addPredefinedBlock: c } = w(), [n, o] = C(), [, u] = Q(), [, p] = v(A), a = () => {
47
- S(s, "blocks") ? c(H(s.blocks), x(n)) : d(s, x(n)), p("layers");
48
- }, r = Be("dnd");
46
+ const { type: o, icon: i, label: a } = s, { addCoreBlock: d, addPredefinedBlock: c } = w(), [n, r] = C(), [, u] = Q(), [, p] = v(A), l = () => {
47
+ S(s, "blocks") ? c(H(s.blocks), h(n)) : d(s, h(n)), p("layers");
48
+ }, t = Be("dnd");
49
49
  return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(Y, { children: [
50
50
  /* @__PURE__ */ e.jsx(Z, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
51
51
  "button",
52
52
  {
53
- onClick: a,
53
+ onClick: l,
54
54
  type: "button",
55
- onDragStart: (h) => {
56
- h.dataTransfer.setData("text/plain", JSON.stringify(K(s, ["component", "icon"]))), setTimeout(() => {
57
- o([]), u(null), p("layers");
55
+ onDragStart: (x) => {
56
+ x.dataTransfer.setData("text/plain", JSON.stringify(K(s, ["component", "icon"]))), setTimeout(() => {
57
+ r([]), u(null), p("layers");
58
58
  }, 200);
59
59
  },
60
- draggable: r ? "true" : "false",
61
- className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (r ? "cursor-grab" : "cursor-pointer"),
60
+ draggable: t ? "true" : "false",
61
+ className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (t ? "cursor-grab" : "cursor-pointer"),
62
62
  children: [
63
63
  z(i || Ne, { className: "w-4 h-4 mx-auto" }),
64
- /* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: l || t })
64
+ /* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: a || o })
65
65
  ]
66
66
  }
67
67
  ) }),
68
- /* @__PURE__ */ e.jsx($, { children: /* @__PURE__ */ e.jsx("p", { children: l || t }) })
68
+ /* @__PURE__ */ e.jsx($, { children: /* @__PURE__ */ e.jsx("p", { children: a || o }) })
69
69
  ] }) });
70
- }, Pe = ({ block: s, closePopover: t }) => {
71
- var r;
72
- const [i, l] = f(!1), d = I("getExternalPredefinedBlock"), { addCoreBlock: c, addPredefinedBlock: n } = w(), [o] = C(), [, u, p] = Ce(
70
+ }, Pe = ({ block: s, closePopover: o }) => {
71
+ var t;
72
+ const [i, a] = f(!1), d = I("getExternalPredefinedBlock"), { addCoreBlock: c, addPredefinedBlock: n } = w(), [r] = C(), [, u, p] = Ce(
73
73
  () => ({
74
74
  type: "CHAI_BLOCK",
75
75
  item: s
76
76
  }),
77
77
  [s]
78
- ), a = G(
79
- async (h) => {
80
- if (h.stopPropagation(), S(s, "component")) {
81
- c(s, x(o)), t();
78
+ ), l = G(
79
+ async (x) => {
80
+ if (x.stopPropagation(), S(s, "component")) {
81
+ c(s, h(r)), o();
82
82
  return;
83
83
  }
84
- l(!0);
84
+ a(!0);
85
85
  const m = await d(s);
86
- g(m) || n(H(m), x(o)), t();
86
+ g(m) || n(H(m), h(r)), o();
87
87
  },
88
88
  [s]
89
89
  );
@@ -92,7 +92,7 @@ const _e = ({ block: s }) => {
92
92
  Ae,
93
93
  {
94
94
  connect: p,
95
- src: "https://placehold.co/100x30/000000/FFF?text=" + ((r = s.name || s.label) == null ? void 0 : r.replace(" ", "+"))
95
+ src: "https://placehold.co/100x30/000000/FFF?text=" + ((t = s.name || s.label) == null ? void 0 : t.replace(" ", "+"))
96
96
  }
97
97
  ),
98
98
  /* @__PURE__ */ e.jsxs(
@@ -100,7 +100,7 @@ const _e = ({ block: s }) => {
100
100
  {
101
101
  ref: u,
102
102
  onClick: i ? () => {
103
- } : a,
103
+ } : l,
104
104
  className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
105
105
  children: [
106
106
  i && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
@@ -121,31 +121,31 @@ const _e = ({ block: s }) => {
121
121
  )
122
122
  ] });
123
123
  }, Se = () => {
124
- const { data: s } = F(), t = E(), i = j(b(t), { category: "custom" }), l = N(i, "group"), d = N(s, "group"), c = M(() => O(l, d, (a, r) => {
125
- if (T(a) && T(r))
126
- return [...a, ...r];
127
- }), [l, d]), [n, o] = f(x(R(c)) || ""), [, u] = v(A), p = U(c, n, []);
124
+ const { data: s } = F(), o = E(), i = j(b(o), { category: "custom" }), a = N(i, "group"), d = N(s, "group"), c = M(() => O(a, d, (l, t) => {
125
+ if (T(l) && T(t))
126
+ return [...l, ...t];
127
+ }), [a, d]), [n, r] = f(h(R(c)) || ""), [, u] = v(A), p = U(c, n, []);
128
128
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex flex-col h-full max-h-full overflow-hidden py-2", children: [
129
- /* @__PURE__ */ e.jsx("div", { className: "p-3 sticky top-0 flex w-full items-center", children: /* @__PURE__ */ e.jsxs(ee, { value: n, onValueChange: (a) => o(a), children: [
129
+ /* @__PURE__ */ e.jsx("div", { className: "p-3 sticky top-0 flex w-full items-center", children: /* @__PURE__ */ e.jsxs(ee, { value: n, onValueChange: (l) => r(l), children: [
130
130
  /* @__PURE__ */ e.jsx(se, { className: "w-full", children: /* @__PURE__ */ e.jsx(re, { placeholder: "Select a provider" }) }),
131
131
  /* @__PURE__ */ e.jsxs(te, { children: [
132
132
  /* @__PURE__ */ e.jsx(P, { value: "", children: "Choose" }),
133
133
  y.Children.toArray(
134
- B(c, (a, r) => /* @__PURE__ */ e.jsx(P, { value: r, children: r }, r))
134
+ B(c, (l, t) => /* @__PURE__ */ e.jsx(P, { value: t, children: t }, t))
135
135
  )
136
136
  ] })
137
137
  ] }) }),
138
138
  /* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children: y.Children.toArray(
139
- p.map((a) => /* @__PURE__ */ e.jsx(Pe, { block: a, closePopover: () => u("layers") }))
139
+ p.map((l) => /* @__PURE__ */ e.jsx(Pe, { block: l, closePopover: () => u("layers") }))
140
140
  ) })
141
141
  ] });
142
142
  }, Le = () => {
143
- const { t: s } = L(), [t, i] = f(""), { addPredefinedBlock: l } = w(), [d] = C(), [, c] = v(A), n = () => {
144
- const o = Te(t);
145
- l([...o], x(d) || null), i(""), c("layers");
143
+ const { t: s } = L(), [o, i] = f(""), { addPredefinedBlock: a } = w(), [d] = C(), [, c] = v(A), n = () => {
144
+ const r = Te(o);
145
+ a([...r], h(d) || null), i(""), c("layers");
146
146
  };
147
147
  return /* @__PURE__ */ e.jsxs(oe, { className: "border-border/0 p-0 shadow-none", children: [
148
- /* @__PURE__ */ e.jsx(ae, { className: "p-3", children: /* @__PURE__ */ e.jsx(le, { children: s("html_snippet_description") }) }),
148
+ /* @__PURE__ */ e.jsx(le, { className: "p-3", children: /* @__PURE__ */ e.jsx(ae, { children: s("html_snippet_description") }) }),
149
149
  /* @__PURE__ */ e.jsx(ce, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
150
150
  /* @__PURE__ */ e.jsx(ie, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
151
151
  /* @__PURE__ */ e.jsx(
@@ -153,33 +153,33 @@ const _e = ({ block: s }) => {
153
153
  {
154
154
  autoFocus: !0,
155
155
  tabIndex: 1,
156
- ref: (o) => o && o.focus(),
157
- onChange: (o) => i(o.target.value),
156
+ ref: (r) => r && r.focus(),
157
+ onChange: (r) => i(r.target.value),
158
158
  rows: 12,
159
- value: t,
159
+ value: o,
160
160
  placeholder: s("enter_code_snippet"),
161
161
  className: "resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"
162
162
  }
163
163
  )
164
164
  ] }) }),
165
165
  /* @__PURE__ */ e.jsxs(de, { className: "flex flex-col justify-end p-3", children: [
166
- /* @__PURE__ */ e.jsx(me, { disabled: t.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: s("import_html") }),
166
+ /* @__PURE__ */ e.jsx(me, { disabled: o.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: s("import_html") }),
167
167
  /* @__PURE__ */ e.jsx(pe, { variant: "default", className: "mt-2 p-1 border-none text-gray-400", children: /* @__PURE__ */ e.jsx(ue, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
168
168
  ] })
169
169
  ] });
170
170
  }, Ie = () => !0, Bs = () => {
171
- const { t: s } = L(), [t, i] = f("core"), [l, d] = f("basic"), c = E(), [, n] = v(xe), o = I("importHTMLSupport", !0), { data: u, isLoading: p } = F(), a = N(
171
+ const { t: s } = L(), [o, i] = f("core"), [a, d] = f("basic"), c = E(), [, n] = v(xe), r = I("importHTMLSupport", !0), { data: u, isLoading: p } = F(), l = N(
172
172
  j(c, () => Ie()),
173
173
  "category"
174
- ), r = W(B(a.core, "group"));
174
+ ), t = W(B(l.core, "group"));
175
175
  q(() => {
176
- !J(r, l) && !g(r) && !g(l) && d(x(r));
177
- }, [r, l]);
178
- const h = !p && !g(u) || X(b(c), { category: "custom" }) !== void 0;
176
+ !J(t, a) && !g(t) && !g(a) && d(h(t));
177
+ }, [t, a]);
178
+ const x = !p && !g(u) || X(b(c), { category: "custom" }) !== void 0;
179
179
  return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
180
180
  /* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
181
181
  /* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: s("add_block") }),
182
- /* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(t === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
182
+ /* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(o === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
183
183
  ] }),
184
184
  /* @__PURE__ */ e.jsx(
185
185
  he,
@@ -187,30 +187,36 @@ const _e = ({ block: s }) => {
187
187
  onValueChange: (m) => {
188
188
  n(""), i(m);
189
189
  },
190
- value: t,
190
+ value: o,
191
191
  className: "h-max",
192
- children: /* @__PURE__ */ e.jsxs(fe, { className: "grid w-full " + (h && o ? "grid-cols-3" : "grid-cols-2"), children: [
193
- /* @__PURE__ */ e.jsx(k, { value: "core", children: s("core") }),
194
- h ? /* @__PURE__ */ e.jsx(k, { value: "ui-blocks", children: s("custom_blocks") }) : null,
195
- o ? /* @__PURE__ */ e.jsx(k, { value: "html", children: s("import") }) : null
196
- ] })
192
+ children: /* @__PURE__ */ e.jsxs(
193
+ fe,
194
+ {
195
+ className: "grid w-full " + (x && r ? "grid-cols-3" : x && !r ? "grid-cols-2" : "grid-cols-1"),
196
+ children: [
197
+ /* @__PURE__ */ e.jsx(k, { value: "core", children: s("core") }),
198
+ x ? /* @__PURE__ */ e.jsx(k, { value: "ui-blocks", children: s("custom_blocks") }) : null,
199
+ r ? /* @__PURE__ */ e.jsx(k, { value: "html", children: s("import") }) : null
200
+ ]
201
+ }
202
+ )
197
203
  }
198
204
  ),
199
- t === "core" && /* @__PURE__ */ e.jsx(ge, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx("div", { className: "mt-2 w-full", children: y.Children.toArray(
205
+ o === "core" && /* @__PURE__ */ e.jsx(ge, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx("div", { className: "mt-2 w-full", children: y.Children.toArray(
200
206
  B(
201
- r,
202
- (m) => _(j(b(a.core), { group: m }), {
207
+ t,
208
+ (m) => _(j(b(l.core), { group: m }), {
203
209
  hidden: !0
204
210
  }).length ? /* @__PURE__ */ e.jsx(je, { type: "single", value: m, collapsible: !0, className: "w-full", children: /* @__PURE__ */ e.jsxs(be, { value: m, children: [
205
211
  /* @__PURE__ */ e.jsx(ye, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize", children: m }),
206
212
  /* @__PURE__ */ e.jsx(ve, { className: "p-3", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: y.Children.toArray(
207
- _(j(b(a.core), { group: m }), { hidden: !0 }).map((D) => /* @__PURE__ */ e.jsx(_e, { block: D }))
213
+ _(j(b(l.core), { group: m }), { hidden: !0 }).map((D) => /* @__PURE__ */ e.jsx(_e, { block: D }))
208
214
  ) }) })
209
215
  ] }) }) : null
210
216
  )
211
217
  ) }) }),
212
- t === "ui-blocks" && /* @__PURE__ */ e.jsx(V, { fallback: /* @__PURE__ */ e.jsx(ke, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Se, {}) }),
213
- t === "html" && o ? /* @__PURE__ */ e.jsx(Le, {}) : null
218
+ o === "ui-blocks" && /* @__PURE__ */ e.jsx(V, { fallback: /* @__PURE__ */ e.jsx(ke, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Se, {}) }),
219
+ o === "html" && r ? /* @__PURE__ */ e.jsx(Le, {}) : null
214
220
  ] });
215
221
  };
216
222
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),c=require("react"),t=require("lodash-es"),g=require("jotai"),y=require("react-i18next"),s=require("./index-bfKqnRvZ.cjs"),b=require("@radix-ui/react-icons"),E=require("@chaibuilder/runtime"),q=require("flagged"),B=require("lucide-react"),R=require("react-dnd"),k=require("./html-to-json-2PeOCVey.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("himalaya");const N=({block:r})=>{const{type:i,icon:d,label:a}=r,{addCoreBlock:m,addPredefinedBlock:u}=s.useAddBlock(),[x,l]=s.useSelectedBlockIds(),[,h]=s.useHighlightBlockId(),[,j]=g.useAtom(s.activePanelAtom),n=()=>{t.has(r,"blocks")?u(E.syncBlocksWithDefaults(r.blocks),t.first(x)):m(r,t.first(x)),j("layers")},o=q.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:n,type:"button",onDragStart:f=>{f.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{l([]),h(null),j("layers")},200)},draggable:o?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(o?"cursor-grab":"cursor-pointer"),children:[c.createElement(d||b.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:a||i})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:a||i})})]})})},A=({block:r,closePopover:i})=>{var o;const[d,a]=c.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:u,addPredefinedBlock:x}=s.useAddBlock(),[l]=s.useSelectedBlockIds(),[,h,j]=R.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),n=c.useCallback(async f=>{if(f.stopPropagation(),t.has(r,"component")){u(r,t.first(l)),i();return}a(!0);const p=await m(r);t.isEmpty(p)||x(E.syncBlocksWithDefaults(p),t.first(l)),i()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(R.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+((o=r.name||r.label)==null?void 0:o.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:h,onClick:d?()=>{}:n,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[d&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(B.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})]})},C=()=>{const{data:r}=s.useUILibraryBlocks(),i=E.useChaiBlocks(),d=t.filter(t.values(i),{category:"custom"}),a=t.groupBy(d,"group"),m=t.groupBy(r,"group"),u=c.useMemo(()=>t.mergeWith(a,m,(n,o)=>{if(t.isArray(n)&&t.isArray(o))return[...n,...o]}),[a,m]),[x,l]=c.useState(t.first(t.keys(u))||""),[,h]=g.useAtom(s.activePanelAtom),j=t.get(u,x,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:x,onValueChange:n=>l(n),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),c.Children.toArray(t.map(u,(n,o)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:o,children:o},o)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:c.Children.toArray(j.map(n=>e.jsxRuntimeExports.jsx(A,{block:n,closePopover:()=>h("layers")})))})]})},w=()=>{const{t:r}=y.useTranslation(),[i,d]=c.useState(""),{addPredefinedBlock:a}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,u]=g.useAtom(s.activePanelAtom),x=()=>{const l=k.getBlocksFromHTML(i);a([...l],t.first(m)||null),d(""),u("layers")};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:l=>l&&l.focus(),onChange:l=>d(l.target.value),rows:12,value:i,placeholder:r("enter_code_snippet"),className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:i.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},T=()=>!0,S=()=>{const{t:r}=y.useTranslation(),[i,d]=c.useState("core"),[a,m]=c.useState("basic"),u=E.useChaiBlocks(),[,x]=g.useAtom(s.showPredefinedBlockCategoryAtom),l=s.useBuilderProp("importHTMLSupport",!0),{data:h,isLoading:j}=s.useUILibraryBlocks(),n=t.groupBy(t.filter(u,()=>T()),"category"),o=t.uniq(t.map(n.core,"group"));c.useEffect(()=>{!t.includes(o,a)&&!t.isEmpty(o)&&!t.isEmpty(a)&&m(t.first(o))},[o,a]);const f=!j&&!t.isEmpty(h)||t.find(t.values(u),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(i==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:p=>{x(""),d(p)},value:i,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(f&&l?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("core")}),f?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("custom_blocks")}):null,l?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),i==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:c.Children.toArray(t.map(o,p=>t.reject(t.filter(t.values(n.core),{group:p}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:p,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:p,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:p}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:c.Children.toArray(t.reject(t.filter(t.values(n.core),{group:p}),{hidden:!0}).map(v=>e.jsxRuntimeExports.jsx(N,{block:v})))})})]})}):null))})}),i==="ui-blocks"&&e.jsxRuntimeExports.jsx(c.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(C,{})}),i==="html"&&l?e.jsxRuntimeExports.jsx(w,{}):null]})};exports.default=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),c=require("react"),t=require("lodash-es"),g=require("jotai"),y=require("react-i18next"),s=require("./index-ERorPL9q.cjs"),b=require("@radix-ui/react-icons"),E=require("@chaibuilder/runtime"),q=require("flagged"),B=require("lucide-react"),R=require("react-dnd"),k=require("./html-to-json-2PeOCVey.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("himalaya");const N=({block:r})=>{const{type:l,icon:d,label:a}=r,{addCoreBlock:m,addPredefinedBlock:u}=s.useAddBlock(),[x,o]=s.useSelectedBlockIds(),[,h]=s.useHighlightBlockId(),[,j]=g.useAtom(s.activePanelAtom),n=()=>{t.has(r,"blocks")?u(E.syncBlocksWithDefaults(r.blocks),t.first(x)):m(r,t.first(x)),j("layers")},i=q.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:n,type:"button",onDragStart:f=>{f.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{o([]),h(null),j("layers")},200)},draggable:i?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(i?"cursor-grab":"cursor-pointer"),children:[c.createElement(d||b.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:a||l})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:a||l})})]})})},A=({block:r,closePopover:l})=>{var i;const[d,a]=c.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:u,addPredefinedBlock:x}=s.useAddBlock(),[o]=s.useSelectedBlockIds(),[,h,j]=R.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),n=c.useCallback(async f=>{if(f.stopPropagation(),t.has(r,"component")){u(r,t.first(o)),l();return}a(!0);const p=await m(r);t.isEmpty(p)||x(E.syncBlocksWithDefaults(p),t.first(o)),l()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(R.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+((i=r.name||r.label)==null?void 0:i.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:h,onClick:d?()=>{}:n,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[d&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(B.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})]})},C=()=>{const{data:r}=s.useUILibraryBlocks(),l=E.useChaiBlocks(),d=t.filter(t.values(l),{category:"custom"}),a=t.groupBy(d,"group"),m=t.groupBy(r,"group"),u=c.useMemo(()=>t.mergeWith(a,m,(n,i)=>{if(t.isArray(n)&&t.isArray(i))return[...n,...i]}),[a,m]),[x,o]=c.useState(t.first(t.keys(u))||""),[,h]=g.useAtom(s.activePanelAtom),j=t.get(u,x,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:x,onValueChange:n=>o(n),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),c.Children.toArray(t.map(u,(n,i)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:i,children:i},i)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:c.Children.toArray(j.map(n=>e.jsxRuntimeExports.jsx(A,{block:n,closePopover:()=>h("layers")})))})]})},w=()=>{const{t:r}=y.useTranslation(),[l,d]=c.useState(""),{addPredefinedBlock:a}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,u]=g.useAtom(s.activePanelAtom),x=()=>{const o=k.getBlocksFromHTML(l);a([...o],t.first(m)||null),d(""),u("layers")};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:o=>o&&o.focus(),onChange:o=>d(o.target.value),rows:12,value:l,placeholder:r("enter_code_snippet"),className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:l.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},T=()=>!0,S=()=>{const{t:r}=y.useTranslation(),[l,d]=c.useState("core"),[a,m]=c.useState("basic"),u=E.useChaiBlocks(),[,x]=g.useAtom(s.showPredefinedBlockCategoryAtom),o=s.useBuilderProp("importHTMLSupport",!0),{data:h,isLoading:j}=s.useUILibraryBlocks(),n=t.groupBy(t.filter(u,()=>T()),"category"),i=t.uniq(t.map(n.core,"group"));c.useEffect(()=>{!t.includes(i,a)&&!t.isEmpty(i)&&!t.isEmpty(a)&&m(t.first(i))},[i,a]);const f=!j&&!t.isEmpty(h)||t.find(t.values(u),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(l==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:p=>{x(""),d(p)},value:l,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(f&&o?"grid-cols-3":f&&!o?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("core")}),f?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("custom_blocks")}):null,o?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),l==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:c.Children.toArray(t.map(i,p=>t.reject(t.filter(t.values(n.core),{group:p}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:p,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:p,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:p}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:c.Children.toArray(t.reject(t.filter(t.values(n.core),{group:p}),{hidden:!0}).map(v=>e.jsxRuntimeExports.jsx(N,{block:v})))})})]})}):null))})}),l==="ui-blocks"&&e.jsxRuntimeExports.jsx(c.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(C,{})}),l==="html"&&o?e.jsxRuntimeExports.jsx(w,{}):null]})};exports.default=S;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),R=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./index-bfKqnRvZ.cjs"),r=require("./empty-slot-2LSrWJaY.cjs"),m=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("react-i18next");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=N(B),k=({value:t,onChange:e,id:i,onBlur:l})=>{const n=m.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},f=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",async()=>{}),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=x.useRef(e);x.useEffect(()=>()=>{m.isEqual(e,n.current)||t(n.current)},[]);const v=({formData:o},c)=>{c&&(i(o),n.current=o)},{bodyFont:u,headingFont:y,primaryColor:q,bodyTextDarkColor:b,bodyTextLightColor:h,bodyBgDarkColor:S,secondaryColor:C,bodyBgLightColor:O,roundedCorners:j}=e;let s={headingFont:r.f({title:"Heading font",default:y,options:f}),bodyFont:r.f({title:"Body font",default:u,options:f}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(j||5,10)}),primaryColor:r.y({title:"Primary",default:q}),secondaryColor:r.y({title:"Secondary",default:C})};l||(s={...s,bodyBgLightColor:r.y({title:"Body Background (Light)",default:O}),bodyTextLightColor:r.y({title:"Body Text (Light)",default:b}),bodyBgDarkColor:r.y({title:"Body Background (Dark)",default:S}),bodyTextDarkColor:r.y({title:"Body Text (Dark)",default:h})});const d={type:"object",properties:{}},g={};return Object.keys(s).forEach(o=>{const c=s[o];return d.properties||(d.properties={}),d.properties[o]=c.schema,g[o]=c.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:k},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:g,schema:d,formData:e,validator:R,onChange:v})})]})};exports.default=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),R=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./index-ERorPL9q.cjs"),r=require("./empty-slot-2LSrWJaY.cjs"),m=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("react-i18next");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=N(B),k=({value:t,onChange:e,id:i,onBlur:l})=>{const n=m.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},f=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",async()=>{}),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=x.useRef(e);x.useEffect(()=>()=>{m.isEqual(e,n.current)||t(n.current)},[]);const v=({formData:o},c)=>{c&&(i(o),n.current=o)},{bodyFont:u,headingFont:y,primaryColor:q,bodyTextDarkColor:b,bodyTextLightColor:h,bodyBgDarkColor:S,secondaryColor:C,bodyBgLightColor:O,roundedCorners:j}=e;let s={headingFont:r.f({title:"Heading font",default:y,options:f}),bodyFont:r.f({title:"Body font",default:u,options:f}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(j||5,10)}),primaryColor:r.y({title:"Primary",default:q}),secondaryColor:r.y({title:"Secondary",default:C})};l||(s={...s,bodyBgLightColor:r.y({title:"Body Background (Light)",default:O}),bodyTextLightColor:r.y({title:"Body Text (Light)",default:b}),bodyBgDarkColor:r.y({title:"Body Background (Dark)",default:S}),bodyTextDarkColor:r.y({title:"Body Text (Dark)",default:h})});const d={type:"object",properties:{}},g={};return Object.keys(s).forEach(o=>{const c=s[o];return d.properties||(d.properties={}),d.properties[o]=c.schema,g[o]=c.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:k},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:g,schema:d,formData:e,validator:R,onChange:v})})]})};exports.default=P;
@@ -2,7 +2,7 @@ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import * as c from "react";
3
3
  import N from "@rjsf/validator-ajv8";
4
4
  import j from "@rjsf/core";
5
- import { i as k, t as D, bt as P } from "./index-m9VziIOy.js";
5
+ import { i as k, t as D, bt as P } from "./index-QGA4ayU7.js";
6
6
  import { f, c as R, y as a } from "./empty-slot-5FRrRq1E.js";
7
7
  import { debounce as w, isEqual as L } from "lodash-es";
8
8
  import "./_commonjsHelpers-UyOWmZb0.js";
@@ -1,4 +1,4 @@
1
- "use strict";var Ue=Object.defineProperty;var $e=(e,t,n)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var z=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-Z_BpKhVy.cjs"),m=require("react"),p=require("lodash-es"),P=require("@radix-ui/react-icons"),o=require("./index-bfKqnRvZ.cjs"),ne=require("react-i18next"),L=require("jotai"),ge=require("react-dom"),ze=require("./_commonjsHelpers-wDK0ZLPo.cjs"),G=require("./index-TBa4RPnS.cjs"),Ye=require("react-quill"),Ke=require("./useAddBlockByDrop-1WvPoBXa.cjs"),Te=require("flagged"),Je=require("@floating-ui/dom"),me=require("@floating-ui/react-dom"),Ve=require("@react-hookz/web"),Ze=require("@bobthered/tailwindcss-palette-generator"),Qe=require("react-wrap-balancer"),Ge=require("tailwind-merge"),ee=require("./MODIFIERS-2FeVfZQ9.cjs"),Xe=require("@chaibuilder/runtime");require("./Functions-N3yhPYKY.cjs");require("clsx");require("flat-to-nested");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("lucide-react");require("./web-blocks.cjs");require("./empty-slot-2LSrWJaY.cjs");const et=()=>{const{hasUndo:e,hasRedo:t,undo:n,redo:i}=o.useUndoManager();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Button,{disabled:!e(),size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(P.ResetIcon,{})}),s.jsxRuntimeExports.jsx(o.Button,{disabled:!t(),onClick:i,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(P.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function tt(){const[e,t]=o.useDarkMode(),{t:n}=ne.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(o.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
1
+ "use strict";var $e=Object.defineProperty;var Ue=(e,t,n)=>t in e?$e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var z=(e,t,n)=>(Ue(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-Z_BpKhVy.cjs"),m=require("react"),p=require("lodash-es"),P=require("@radix-ui/react-icons"),o=require("./index-ERorPL9q.cjs"),ne=require("react-i18next"),L=require("jotai"),ge=require("react-dom"),ze=require("./_commonjsHelpers-wDK0ZLPo.cjs"),G=require("./index-xJ8LmB04.cjs"),Ye=require("react-quill"),Ke=require("./useAddBlockByDrop-LBgi6GL7.cjs"),Te=require("flagged"),Je=require("@floating-ui/dom"),me=require("@floating-ui/react-dom"),Ve=require("@react-hookz/web"),Ze=require("@bobthered/tailwindcss-palette-generator"),Qe=require("react-wrap-balancer"),Ge=require("tailwind-merge"),ee=require("./MODIFIERS-2FeVfZQ9.cjs"),Xe=require("@chaibuilder/runtime");require("./Functions-N3yhPYKY.cjs");require("clsx");require("flat-to-nested");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("lucide-react");require("./web-blocks.cjs");require("./empty-slot-2LSrWJaY.cjs");const et=()=>{const{hasUndo:e,hasRedo:t,undo:n,redo:i}=o.useUndoManager();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Button,{disabled:!e(),size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(P.ResetIcon,{})}),s.jsxRuntimeExports.jsx(o.Button,{disabled:!t(),onClick:i,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(P.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function tt(){const[e,t]=o.useDarkMode(),{t:n}=ne.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(o.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
2
2
  relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[s.jsxRuntimeExports.jsx("span",{className:"sr-only",children:n("use_setting")}),s.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
3
3
  pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const ye=({landscape:e=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),nt=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(P.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:s.jsxRuntimeExports.jsx(P.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(ye,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(ye,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:s.jsxRuntimeExports.jsx(P.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(P.DesktopIcon,{}),width:1920}],ve=({title:e,content:t,currentBreakpoint:n,breakpoint:i,width:a,icon:c,onClick:u})=>{const{t:r}=ne.useTranslation();return s.jsxRuntimeExports.jsxs(o.HoverCard,{children:[s.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(o.Button,{onClick:()=>u(a),size:"sm",variant:i===n?"secondary":"ghost",children:c})}),s.jsxRuntimeExports.jsx(o.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:r(e)}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:r(t)})]})})})]})},st=()=>{const[,e,t]=o.useCanvasWidth(),[n,i]=o.useSelectedBreakpoints(),{t:a}=ne.useTranslation(),c=o.useBuilderProp("breakpoints",nt),u=r=>{n.includes(r)?n.length>2&&i(n.filter(d=>d!==r)):i(d=>[...d,r])};return c.length<4?s.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:p.map(c,r=>m.createElement(ve,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:e}))}):s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[p.map(c.filter(r=>p.includes(n,p.toUpper(r.breakpoint))),r=>m.createElement(ve,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(P.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:a("Breakpoints")}),s.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),p.map(c,r=>s.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:r.breakpoint==="xs",onCheckedChange:()=>u(p.toUpper(r.breakpoint)),checked:p.includes(n,p.toUpper(r.breakpoint)),children:a(r.title)},r.breakpoint))]})]})]})},rt=()=>{const{t:e}=ne.useTranslation(),{setNewBlocks:t}=o.useBlocksStoreUndoableActions(),[,n]=o.useSelectedBlockIds(),[,i]=o.useSelectedStylingBlocks(),a=m.useCallback(()=>{t([]),n([]),i([])},[t]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(o.AlertDialog,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(o.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(P.EraserIcon,{})," ",e("clear")]})}),s.jsxRuntimeExports.jsxs(o.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(o.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTitle,{children:e("clear_canvas_title")}),s.jsxRuntimeExports.jsx(o.AlertDialogDescription,{children:e("clear_canvas_description")})]}),s.jsxRuntimeExports.jsxs(o.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogCancel,{children:e("cancel")}),s.jsxRuntimeExports.jsx(o.AlertDialogAction,{onClick:a,children:e("yes")})]})]})]})})},ot=()=>{const e=o.useBuilderProp("darkMode",!1),[t]=o.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(tt,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(st,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[s.jsxRuntimeExports.jsx(P.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[p.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(et,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(rt,{})]})]})},it=`<!doctype html>
4
4
  <html class="scroll-smooth h-full overflow-y-auto">
@@ -52,9 +52,9 @@
52
52
  object-assign
53
53
  (c) Sindre Sorhus
54
54
  @license MIT
55
- */var re,je;function lt(){if(je)return re;je=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function i(c){if(c==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(c)}function a(){try{if(!Object.assign)return!1;var c=new String("abc");if(c[5]="de",Object.getOwnPropertyNames(c)[0]==="5")return!1;for(var u={},r=0;r<10;r++)u["_"+String.fromCharCode(r)]=r;var d=Object.getOwnPropertyNames(u).map(function(h){return u[h]});if(d.join("")!=="0123456789")return!1;var x={};return"abcdefghijklmnopqrst".split("").forEach(function(h){x[h]=h}),Object.keys(Object.assign({},x)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return re=a()?Object.assign:function(c,u){for(var r,d=i(c),x,h=1;h<arguments.length;h++){r=Object(arguments[h]);for(var g in r)t.call(r,g)&&(d[g]=r[g]);if(e){x=e(r);for(var b=0;b<x.length;b++)n.call(r,x[b])&&(d[x[b]]=r[x[b]])}}return d},re}var oe,be;function fe(){if(be)return oe;be=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return oe=e,oe}var ie,Ee;function Ce(){return Ee||(Ee=1,ie=Function.call.bind(Object.prototype.hasOwnProperty)),ie}var ae,ke;function ct(){if(ke)return ae;ke=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=fe(),n={},i=Ce();e=function(c){var u="Warning: "+c;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}}}function a(c,u,r,d,x){if(process.env.NODE_ENV!=="production"){for(var h in c)if(i(c,h)){var g;try{if(typeof c[h]!="function"){var b=Error((d||"React class")+": "+r+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof c[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw b.name="Invariant Violation",b}g=c[h](u,h,d,r,null,t)}catch(O){g=O}if(g&&!(g instanceof Error)&&e((d||"React class")+": type specification of "+r+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof g+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),g instanceof Error&&!(g.message in n)){n[g.message]=!0;var D=x?x():"";e("Failed "+r+" type: "+g.message+(D??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ae=a,ae}var le,Re;function dt(){if(Re)return le;Re=1;var e=G.reactIsExports,t=lt(),n=fe(),i=Ce(),a=ct(),c=function(){};process.env.NODE_ENV!=="production"&&(c=function(r){var d="Warning: "+r;typeof console<"u"&&console.error(d);try{throw new Error(d)}catch{}});function u(){return null}return le=function(r,d){var x=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function g(l){var f=l&&(x&&l[x]||l[h]);if(typeof f=="function")return f}var b="<<anonymous>>",D={array:B("array"),bigint:B("bigint"),bool:B("boolean"),func:B("function"),number:B("number"),object:B("object"),string:B("string"),symbol:B("symbol"),any:W(),arrayOf:Y,element:K(),elementType:N(),instanceOf:A,node:Me(),objectOf:H,oneOf:F,oneOfType:Pe,shape:Le,exact:Ne};function O(l,f){return l===f?l!==0||1/l===1/f:l!==l&&f!==f}function v(l,f){this.message=l,this.data=f&&typeof f=="object"?f:{},this.stack=""}v.prototype=Error.prototype;function y(l){if(process.env.NODE_ENV!=="production")var f={},w=0;function k(S,E,R,T,I,C,M){if(T=T||b,C=C||R,M!==n){if(d){var _=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw _.name="Invariant Violation",_}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var J=T+":"+R;!f[J]&&w<3&&(c("You are manually calling a React.PropTypes validation function for the `"+C+"` prop on `"+T+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),f[J]=!0,w++)}}return E[R]==null?S?E[R]===null?new v("The "+I+" `"+C+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new v("The "+I+" `"+C+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:l(E,R,T,I,C)}var j=k.bind(null,!1);return j.isRequired=k.bind(null,!0),j}function B(l){function f(w,k,j,S,E,R){var T=w[k],I=U(T);if(I!==l){var C=V(T);return new v("Invalid "+S+" `"+E+"` of type "+("`"+C+"` supplied to `"+j+"`, expected ")+("`"+l+"`."),{expectedType:l})}return null}return y(f)}function W(){return y(u)}function Y(l){function f(w,k,j,S,E){if(typeof l!="function")return new v("Property `"+E+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var R=w[k];if(!Array.isArray(R)){var T=U(R);return new v("Invalid "+S+" `"+E+"` of type "+("`"+T+"` supplied to `"+j+"`, expected an array."))}for(var I=0;I<R.length;I++){var C=l(R,I,j,S,E+"["+I+"]",n);if(C instanceof Error)return C}return null}return y(f)}function K(){function l(f,w,k,j,S){var E=f[w];if(!r(E)){var R=U(E);return new v("Invalid "+j+" `"+S+"` of type "+("`"+R+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return y(l)}function N(){function l(f,w,k,j,S){var E=f[w];if(!e.isValidElementType(E)){var R=U(E);return new v("Invalid "+j+" `"+S+"` of type "+("`"+R+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return y(l)}function A(l){function f(w,k,j,S,E){if(!(w[k]instanceof l)){var R=l.name||b,T=We(w[k]);return new v("Invalid "+S+" `"+E+"` of type "+("`"+T+"` supplied to `"+j+"`, expected ")+("instance of `"+R+"`."))}return null}return y(f)}function F(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&(arguments.length>1?c("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):c("Invalid argument supplied to oneOf, expected an array.")),u;function f(w,k,j,S,E){for(var R=w[k],T=0;T<l.length;T++)if(O(R,l[T]))return null;var I=JSON.stringify(l,function(M,_){var J=V(_);return J==="symbol"?String(_):_});return new v("Invalid "+S+" `"+E+"` of value `"+String(R)+"` "+("supplied to `"+j+"`, expected one of "+I+"."))}return y(f)}function H(l){function f(w,k,j,S,E){if(typeof l!="function")return new v("Property `"+E+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var R=w[k],T=U(R);if(T!=="object")return new v("Invalid "+S+" `"+E+"` of type "+("`"+T+"` supplied to `"+j+"`, expected an object."));for(var I in R)if(i(R,I)){var C=l(R,I,j,S,E+"."+I,n);if(C instanceof Error)return C}return null}return y(f)}function Pe(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&c("Invalid argument supplied to oneOfType, expected an instance of array."),u;for(var f=0;f<l.length;f++){var w=l[f];if(typeof w!="function")return c("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+He(w)+" at index "+f+"."),u}function k(j,S,E,R,T){for(var I=[],C=0;C<l.length;C++){var M=l[C],_=M(j,S,E,R,T,n);if(_==null)return null;_.data&&i(_.data,"expectedType")&&I.push(_.data.expectedType)}var J=I.length>0?", expected one of type ["+I.join(", ")+"]":"";return new v("Invalid "+R+" `"+T+"` supplied to "+("`"+E+"`"+J+"."))}return y(k)}function Me(){function l(f,w,k,j,S){return X(f[w])?null:new v("Invalid "+j+" `"+S+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return y(l)}function he(l,f,w,k,j){return new v((l||"React class")+": "+f+" type `"+w+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function Le(l){function f(w,k,j,S,E){var R=w[k],T=U(R);if(T!=="object")return new v("Invalid "+S+" `"+E+"` of type `"+T+"` "+("supplied to `"+j+"`, expected `object`."));for(var I in l){var C=l[I];if(typeof C!="function")return he(j,S,E,I,V(C));var M=C(R,I,j,S,E+"."+I,n);if(M)return M}return null}return y(f)}function Ne(l){function f(w,k,j,S,E){var R=w[k],T=U(R);if(T!=="object")return new v("Invalid "+S+" `"+E+"` of type `"+T+"` "+("supplied to `"+j+"`, expected `object`."));var I=t({},w[k],l);for(var C in I){var M=l[C];if(i(l,C)&&typeof M!="function")return he(j,S,E,C,V(M));if(!M)return new v("Invalid "+S+" `"+E+"` key `"+C+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(w[k],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(l),null," "));var _=M(R,C,j,S,E+"."+C,n);if(_)return _}return null}return y(f)}function X(l){switch(typeof l){case"number":case"string":case"undefined":return!0;case"boolean":return!l;case"object":if(Array.isArray(l))return l.every(X);if(l===null||r(l))return!0;var f=g(l);if(f){var w=f.call(l),k;if(f!==l.entries){for(;!(k=w.next()).done;)if(!X(k.value))return!1}else for(;!(k=w.next()).done;){var j=k.value;if(j&&!X(j[1]))return!1}}else return!1;return!0;default:return!1}}function Fe(l,f){return l==="symbol"?!0:f?f["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&f instanceof Symbol:!1}function U(l){var f=typeof l;return Array.isArray(l)?"array":l instanceof RegExp?"object":Fe(f,l)?"symbol":f}function V(l){if(typeof l>"u"||l===null)return""+l;var f=U(l);if(f==="object"){if(l instanceof Date)return"date";if(l instanceof RegExp)return"regexp"}return f}function He(l){var f=V(l);switch(f){case"array":case"object":return"an "+f;case"boolean":case"date":case"regexp":return"a "+f;default:return f}}function We(l){return!l.constructor||!l.constructor.name?b:l.constructor.name}return D.checkPropTypes=a,D.resetWarningCache=a.resetWarningCache,D.PropTypes=D,D},le}var ce,we;function ut(){if(we)return ce;we=1;var e=fe();function t(){}function n(){}return n.resetWarningCache=t,ce=function(){function i(u,r,d,x,h,g){if(g!==e){var b=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw b.name="Invariant Violation",b}}i.isRequired=i;function a(){return i}var c={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:a,element:i,elementType:i,instanceOf:a,node:i,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return c.PropTypes=c,c},ce}var Wt=te.exports;if(process.env.NODE_ENV!=="production"){var pt=G.reactIsExports,ft=!0;te.exports=dt()(pt.isElement,ft)}else te.exports=ut()();var xt=te.exports;const q=ze.getDefaultExportFromCjs(xt);let Ie,Be;typeof document<"u"&&(Ie=document);typeof window<"u"&&(Be=window);const De=m.createContext({document:Ie,window:Be}),se=()=>m.useContext(De),{Provider:ht,Consumer:Ut}=De;class Ae extends m.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return m.Children.only(this.props.children)}}z(Ae,"propTypes",{children:q.element.isRequired,contentDidMount:q.func.isRequired,contentDidUpdate:q.func.isRequired});class ue extends m.Component{constructor(n,i){super(n,i);z(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:i}=this.props;typeof i=="function"?i(n):i&&(i.current=n)});z(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});z(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=m.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const i=this.props.contentDidMount,a=this.props.contentDidUpdate,c=n.defaultView||n.parentView,u=s.jsxRuntimeExports.jsx(Ae,{contentDidMount:i,contentDidUpdate:a,children:s.jsxRuntimeExports.jsx(ht,{value:{document:n,window:c},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),r=this.getMountTarget();return[ge.createPortal(this.props.head,this.getDoc().head),ge.createPortal(u,r)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}z(ue,"propTypes",{style:q.object,head:q.node,initialContent:q.string,mountTarget:q.string,contentDidMount:q.func,contentDidUpdate:q.func,children:q.oneOfType([q.element,q.arrayOf(q.element)])}),z(ue,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const gt=m.forwardRef((e,t)=>s.jsxRuntimeExports.jsx(ue,{...e,forwardedRef:t}));let $=null,Q=[],Z=null,_e=null;function mt(e){const t=window.getComputedStyle(e),n=parseInt(t.paddingLeft,10),i=parseInt(t.paddingTop,10),a=parseInt(t.paddingRight,10),c=parseInt(t.paddingBottom,10);return{paddingLeft:n,paddingTop:i,paddingRight:a,paddingBottom:c}}const Se=(e,t,n)=>{if(!$)return;const i=e.getBoundingClientRect(),a=$==null?void 0:$.getElementById("placeholder"),{paddingLeft:c,paddingTop:u,paddingRight:r,paddingBottom:d}=mt(e);a.style.width=t==="vertical"?i.width-c-r+"px":"2px",a.style.height=t==="vertical"?"2px":i.height-u-d+"px",a.style.display="block";const x=Q.reduce((h,g)=>Math.abs(g-n)<Math.abs(h-n)?g:h);_e=Q.indexOf(x),t==="vertical"?(a.style.top=e.offsetTop+x+"px",a.style.left=e.offsetLeft+c+"px"):(a.style.top=e.offsetTop+u+"px",a.style.left=e.offsetLeft+x+"px")},yt=e=>{const t=Oe(e),n=window.getComputedStyle(e),i=t==="horizontal",a=parseInt(n.paddingLeft),c=parseInt(n.paddingTop);let u=i?a:c;Q=[u],Array.from(e.children).forEach(r=>{const d=window.getComputedStyle(r),x=parseInt(i?d.marginLeft+d.marginRight:d.marginTop+d.marginBottom),h=i?r.offsetWidth:r.offsetHeight;Q.push(u+h+x),u+=h+x})};function Oe(e){const t=window.getComputedStyle(e).display,n=window.getComputedStyle(e).flexDirection;if(t==="flex")return n==="column"||n==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const i=window.getComputedStyle(e).gridTemplateRows,a=window.getComputedStyle(e).gridTemplateColumns;if(i.includes("auto"))return"vertical";if(a.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const vt=p.throttle(e=>{const t=e.target,n=Oe(t);if(n==="vertical"){const i=e.clientY-t.offsetTop;Se(t,n,i)}else{const i=e.clientX-t.offsetLeft;Se(t,n,i)}},200),jt=e=>{e.preventDefault(),e.stopPropagation(),vt(e)};function de(){const e=$==null?void 0:$.getElementById("placeholder");e.style.display="none"}const bt=()=>{const{document:e}=se(),[t,n]=L.useAtom(o.draggingFlagAtom),i=Ke.useAddBlockByDrop(),a=Te.useFeature("dnd"),[,c]=o.useHighlightBlockId(),[,u]=o.useSelectedBlockIds();return $=e,{isDragging:t,"data-dnd":"branch",onDragOver:a?jt:p.noop,onDrop:a?r=>{Z==null||Z.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const d=JSON.parse(r.dataTransfer.getData("text/plain"));let x=r.target.getAttribute("data-block-id");x===null&&(x=r.target.parentElement.getAttribute("data-block-id")),i({block:d,dropTargetId:x||null,relativeIndex:_e}),n(!1),de(),setTimeout(()=>{de()},300)}:p.noop,onDragEnter:a?r=>{const d=r;Z=d.target,d.stopPropagation(),d.preventDefault(),Q=[];const x=d.target;yt(x),x.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),n(!0),c(""),u([])}:p.noop,onDragLeave:a?r=>{const d=r;Z=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:p.noop,onMouseOut:a?()=>{n(!1),de()}:p.noop}};function xe(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function Et(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const kt=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=o.useUpdateBlocksProps(),[,n]=o.useHighlightBlockId(),[i,a]=L.useAtom(o.inlineEditingActiveAtom);return c=>{var g;if(i)return;const u=xe(c.target),r=u.getAttribute("data-block-type");if(!r||!e.includes(r))return;const d=u.cloneNode(!0);u.style.display="none",Array.from(d.attributes).forEach(b=>{b.name!=="class"&&d.removeAttribute(b.name)}),r==="Text"&&(d.style.display="inline-block"),u.parentNode.insertBefore(d,u.nextSibling);const x=new Ye.Quill(d,{placeholder:"Type here..."});function h(){const b=x.getText(0,x.getLength());t([u.getAttribute("data-block-id")],{content:b}),u.removeAttribute("style"),d.removeEventListener("blur",h,!0),Et(x),a(""),n("")}d.addEventListener("blur",h,!0),x.focus(),(g=d.querySelector(".ql-clipboard"))==null||g.remove(),a(u.getAttribute("data-block-id"))}},Rt=()=>{const[,e]=o.useSelectedStylingBlocks(),[,t]=o.useSelectedBlockIds(),[n]=L.useAtom(o.inlineEditingActiveAtom);return i=>{if(n)return;i.stopPropagation();const a=xe(i.target);if(a!=null&&a.getAttribute("data-block-parent")){const c=a.getAttribute("data-style-prop"),u=a.getAttribute("data-style-id"),r=a.getAttribute("data-block-parent");e([{id:u,prop:c,blockId:r}]),t([r])}else a!=null&&a.getAttribute("data-block-id")&&t([a.getAttribute("data-block-id")])}},wt=p.throttle((e,t)=>{const n=xe(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),St=()=>{const[,e]=o.useHighlightBlockId(),[t]=L.useAtom(o.inlineEditingActiveAtom);return n=>{t||wt(n,e)}},Tt=({children:e})=>{const{document:t}=se(),[n]=o.useSelectedBlockIds(),[i,a]=o.useSelectedStylingBlocks();m.useEffect(()=>{setTimeout(()=>{if(!p.isEmpty(i))return;const x=qe(t,p.first(n));if(x){const h=x.getAttribute("data-style-prop");if(h){const g=x.getAttribute("data-style-id"),b=x.getAttribute("data-block-parent");a([{id:g,prop:h,blockId:b}])}}},100)},[t,n,a,i]);const c=kt(),u=Rt(),r=St(),d=bt();return s.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:u,onDoubleClick:c,onMouseMove:r,...p.omit(d,"isDragging"),className:"relative mb-5 h-full max-w-full "+(d.isDragging?"dragging":""),children:e})},qe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ct=()=>{const{window:e}=se(),[t,n]=o.useSelectedBlockIds(),[i]=o.useBlocksStore(),[,a]=o.useSelectedStylingBlocks(),{undo:c,redo:u}=o.useUndoManager(),r=o.useDuplicateBlocks(),[,d]=o.usePreviewMode(),x=o.useRemoveBlocks(),{savePage:h}=o.useSavePage(),[g]=L.useAtom(o.inlineEditingActiveAtom),[,b]=L.useAtom(o.editLayerNameAtom),D=v=>{v.key==="Enter"&&(v.preventDefault(),t.length===1&&b(p.first(t)))},O=v=>{const y=i.find(B=>B._id===v);return y?y._parent:null};return m.useEffect(()=>{const v=y=>{if(y.key==="Escape"){n([]),a([]);return}if(D(y),!g&&(y.key==="Delete"||y.key==="Backspace")&&(y.preventDefault(),x(t)),y.ctrlKey||y.metaKey){if(y.key==="ArrowUp"){y.preventDefault();const B=t.length>0?O(t[0]):null;B&&n([B])}if(["z","y","d","x","c","p","s","v"].includes(y.key)){if(g&&["x","z","v"].includes(y.key))return!0;y.preventDefault()}y.key==="s"&&(y.stopPropagation(),y.preventDefault(),h()),y.key==="z"&&c(),y.key==="y"&&u(),y.key==="d"&&r(t)}};return e.removeEventListener("keydown",v),e.addEventListener("keydown",v),()=>{e.removeEventListener("keydown",v)}},[t,n,c,x,d,u,r,g,h,e]),null},It=({block:e,label:t})=>{const[,n]=o.useSelectedBlockIds(),[,i]=o.useHighlightBlockId(),[,a]=L.useAtom(o.draggedBlockIdAtom),c=Te.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:c?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(p.pick(e,["_id","_type"]))),a(e._id),setTimeout(()=>{n([]),i(null)},200)},children:[s.jsxRuntimeExports.jsx(P.DragHandleDots2Icon,{}),t]})},Bt=({selectedBlockElement:e,block:t})=>{const n=o.useRemoveBlocks(),i=o.useDuplicateBlocks(),[,a]=o.useSelectedBlockIds(),[,c]=o.useSelectedStylingBlocks(),[u]=L.useAtom(o.inlineEditingActiveAtom),{floatingStyles:r,refs:d,update:x}=me.useFloating({placement:"top-start",middleware:[me.shift(),Je.flip()],elements:{reference:e}});Ve.useResizeObserver(e,()=>x(),e!==null);const h=p.get(t,"_parent",null),g=p.isEmpty(p.get(t,"_name",""))?p.get(t,"_type",""):p.get(t,"_name","");return!e||!t||u?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:d.setFloating,style:r,onClick:b=>{b.stopPropagation(),b.preventDefault()},onKeyDown:b=>b.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(It,{label:g,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[h&&s.jsxRuntimeExports.jsx(P.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{c([]),a([h])}}),o.canDuplicateBlock(p.get(t,"_type",""))?s.jsxRuntimeExports.jsx(P.CopyIcon,{className:"hover:scale-105",onClick:()=>i([t==null?void 0:t._id])}):null,o.canDeleteBlock(p.get(t,"_type",""))?s.jsxRuntimeExports.jsx(P.TrashIcon,{className:"hover:scale-105",onClick:()=>n([t==null?void 0:t._id])}):null]})]})},Dt=({model:e})=>{const[t]=o.useBrandingOptions(),[n]=o.useSelectedBlockIds(),[i]=o.useDarkMode(),[a]=o.useHighlightBlockId(),[c]=o.useSelectedStylingBlocks(),[u]=L.useAtom(o.draggedBlockIdAtom),{document:r,window:d}=se(),[x]=m.useState(r==null?void 0:r.getElementById("highlighted-block")),[h]=m.useState(r==null?void 0:r.getElementById("selected-block")),[g]=m.useState(r==null?void 0:r.getElementById("selected-styling-block")),[b]=m.useState(r==null?void 0:r.getElementById("dragged-block"));m.useEffect(()=>{i?r==null||r.documentElement.classList.add("dark"):r==null||r.documentElement.classList.remove("dark")},[i,r]);const D=p.get(t,"headingFont","DM Sans"),O=p.get(t,"bodyFont","DM Sans");return m.useEffect(()=>{const v=p.get(t,"primaryColor","#000"),y=p.get(t,"secondaryColor","#FFF"),B=Ze.tailwindcssPaletteGenerator({colors:[v,y],names:["primary","secondary"]});B.primary.DEFAULT=v,B.secondary.DEFAULT=y;const W=p.get(t,"roundedCorners","0");!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[D],body:[O]},extend:{borderRadius:{global:`${W||"0"}px`},colors:B}},plugins:[d.tailwind.plugin.withOptions(({prefix:Y="ui"}={})=>({addVariant:K})=>{for(const N of["open","checked","selected","active","disabled"])K(`${Y}-${N}`,[`&[data-headlessui-state~="${N}"]`,`:where([data-headlessui-state~="${N}"]) &`]),K(`${Y}-not-${N}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${N}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${N}"])) &:not([data-headlessui-state])`])})]})},[t,d,D,O]),m.useEffect(()=>{h&&(h.textContent=`${p.map(n,v=>`[data-block-id="${v}"]`).join(",")}{
55
+ */var re,je;function lt(){if(je)return re;je=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function i(c){if(c==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(c)}function a(){try{if(!Object.assign)return!1;var c=new String("abc");if(c[5]="de",Object.getOwnPropertyNames(c)[0]==="5")return!1;for(var u={},r=0;r<10;r++)u["_"+String.fromCharCode(r)]=r;var d=Object.getOwnPropertyNames(u).map(function(h){return u[h]});if(d.join("")!=="0123456789")return!1;var x={};return"abcdefghijklmnopqrst".split("").forEach(function(h){x[h]=h}),Object.keys(Object.assign({},x)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return re=a()?Object.assign:function(c,u){for(var r,d=i(c),x,h=1;h<arguments.length;h++){r=Object(arguments[h]);for(var g in r)t.call(r,g)&&(d[g]=r[g]);if(e){x=e(r);for(var b=0;b<x.length;b++)n.call(r,x[b])&&(d[x[b]]=r[x[b]])}}return d},re}var oe,be;function fe(){if(be)return oe;be=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return oe=e,oe}var ie,Ee;function Ce(){return Ee||(Ee=1,ie=Function.call.bind(Object.prototype.hasOwnProperty)),ie}var ae,ke;function ct(){if(ke)return ae;ke=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=fe(),n={},i=Ce();e=function(c){var u="Warning: "+c;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}}}function a(c,u,r,d,x){if(process.env.NODE_ENV!=="production"){for(var h in c)if(i(c,h)){var g;try{if(typeof c[h]!="function"){var b=Error((d||"React class")+": "+r+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof c[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw b.name="Invariant Violation",b}g=c[h](u,h,d,r,null,t)}catch(O){g=O}if(g&&!(g instanceof Error)&&e((d||"React class")+": type specification of "+r+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof g+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),g instanceof Error&&!(g.message in n)){n[g.message]=!0;var D=x?x():"";e("Failed "+r+" type: "+g.message+(D??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ae=a,ae}var le,Re;function dt(){if(Re)return le;Re=1;var e=G.reactIsExports,t=lt(),n=fe(),i=Ce(),a=ct(),c=function(){};process.env.NODE_ENV!=="production"&&(c=function(r){var d="Warning: "+r;typeof console<"u"&&console.error(d);try{throw new Error(d)}catch{}});function u(){return null}return le=function(r,d){var x=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function g(l){var f=l&&(x&&l[x]||l[h]);if(typeof f=="function")return f}var b="<<anonymous>>",D={array:B("array"),bigint:B("bigint"),bool:B("boolean"),func:B("function"),number:B("number"),object:B("object"),string:B("string"),symbol:B("symbol"),any:H(),arrayOf:Y,element:K(),elementType:N(),instanceOf:A,node:Me(),objectOf:F,oneOf:W,oneOfType:Pe,shape:Le,exact:Ne};function O(l,f){return l===f?l!==0||1/l===1/f:l!==l&&f!==f}function v(l,f){this.message=l,this.data=f&&typeof f=="object"?f:{},this.stack=""}v.prototype=Error.prototype;function y(l){if(process.env.NODE_ENV!=="production")var f={},w=0;function k(S,E,R,T,I,C,M){if(T=T||b,C=C||R,M!==n){if(d){var _=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw _.name="Invariant Violation",_}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var J=T+":"+R;!f[J]&&w<3&&(c("You are manually calling a React.PropTypes validation function for the `"+C+"` prop on `"+T+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),f[J]=!0,w++)}}return E[R]==null?S?E[R]===null?new v("The "+I+" `"+C+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new v("The "+I+" `"+C+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:l(E,R,T,I,C)}var j=k.bind(null,!1);return j.isRequired=k.bind(null,!0),j}function B(l){function f(w,k,j,S,E,R){var T=w[k],I=$(T);if(I!==l){var C=V(T);return new v("Invalid "+S+" `"+E+"` of type "+("`"+C+"` supplied to `"+j+"`, expected ")+("`"+l+"`."),{expectedType:l})}return null}return y(f)}function H(){return y(u)}function Y(l){function f(w,k,j,S,E){if(typeof l!="function")return new v("Property `"+E+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var R=w[k];if(!Array.isArray(R)){var T=$(R);return new v("Invalid "+S+" `"+E+"` of type "+("`"+T+"` supplied to `"+j+"`, expected an array."))}for(var I=0;I<R.length;I++){var C=l(R,I,j,S,E+"["+I+"]",n);if(C instanceof Error)return C}return null}return y(f)}function K(){function l(f,w,k,j,S){var E=f[w];if(!r(E)){var R=$(E);return new v("Invalid "+j+" `"+S+"` of type "+("`"+R+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return y(l)}function N(){function l(f,w,k,j,S){var E=f[w];if(!e.isValidElementType(E)){var R=$(E);return new v("Invalid "+j+" `"+S+"` of type "+("`"+R+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return y(l)}function A(l){function f(w,k,j,S,E){if(!(w[k]instanceof l)){var R=l.name||b,T=He(w[k]);return new v("Invalid "+S+" `"+E+"` of type "+("`"+T+"` supplied to `"+j+"`, expected ")+("instance of `"+R+"`."))}return null}return y(f)}function W(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&(arguments.length>1?c("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):c("Invalid argument supplied to oneOf, expected an array.")),u;function f(w,k,j,S,E){for(var R=w[k],T=0;T<l.length;T++)if(O(R,l[T]))return null;var I=JSON.stringify(l,function(M,_){var J=V(_);return J==="symbol"?String(_):_});return new v("Invalid "+S+" `"+E+"` of value `"+String(R)+"` "+("supplied to `"+j+"`, expected one of "+I+"."))}return y(f)}function F(l){function f(w,k,j,S,E){if(typeof l!="function")return new v("Property `"+E+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var R=w[k],T=$(R);if(T!=="object")return new v("Invalid "+S+" `"+E+"` of type "+("`"+T+"` supplied to `"+j+"`, expected an object."));for(var I in R)if(i(R,I)){var C=l(R,I,j,S,E+"."+I,n);if(C instanceof Error)return C}return null}return y(f)}function Pe(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&c("Invalid argument supplied to oneOfType, expected an instance of array."),u;for(var f=0;f<l.length;f++){var w=l[f];if(typeof w!="function")return c("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Fe(w)+" at index "+f+"."),u}function k(j,S,E,R,T){for(var I=[],C=0;C<l.length;C++){var M=l[C],_=M(j,S,E,R,T,n);if(_==null)return null;_.data&&i(_.data,"expectedType")&&I.push(_.data.expectedType)}var J=I.length>0?", expected one of type ["+I.join(", ")+"]":"";return new v("Invalid "+R+" `"+T+"` supplied to "+("`"+E+"`"+J+"."))}return y(k)}function Me(){function l(f,w,k,j,S){return X(f[w])?null:new v("Invalid "+j+" `"+S+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return y(l)}function he(l,f,w,k,j){return new v((l||"React class")+": "+f+" type `"+w+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function Le(l){function f(w,k,j,S,E){var R=w[k],T=$(R);if(T!=="object")return new v("Invalid "+S+" `"+E+"` of type `"+T+"` "+("supplied to `"+j+"`, expected `object`."));for(var I in l){var C=l[I];if(typeof C!="function")return he(j,S,E,I,V(C));var M=C(R,I,j,S,E+"."+I,n);if(M)return M}return null}return y(f)}function Ne(l){function f(w,k,j,S,E){var R=w[k],T=$(R);if(T!=="object")return new v("Invalid "+S+" `"+E+"` of type `"+T+"` "+("supplied to `"+j+"`, expected `object`."));var I=t({},w[k],l);for(var C in I){var M=l[C];if(i(l,C)&&typeof M!="function")return he(j,S,E,C,V(M));if(!M)return new v("Invalid "+S+" `"+E+"` key `"+C+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(w[k],null," ")+`
56
+ Valid keys: `+JSON.stringify(Object.keys(l),null," "));var _=M(R,C,j,S,E+"."+C,n);if(_)return _}return null}return y(f)}function X(l){switch(typeof l){case"number":case"string":case"undefined":return!0;case"boolean":return!l;case"object":if(Array.isArray(l))return l.every(X);if(l===null||r(l))return!0;var f=g(l);if(f){var w=f.call(l),k;if(f!==l.entries){for(;!(k=w.next()).done;)if(!X(k.value))return!1}else for(;!(k=w.next()).done;){var j=k.value;if(j&&!X(j[1]))return!1}}else return!1;return!0;default:return!1}}function We(l,f){return l==="symbol"?!0:f?f["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&f instanceof Symbol:!1}function $(l){var f=typeof l;return Array.isArray(l)?"array":l instanceof RegExp?"object":We(f,l)?"symbol":f}function V(l){if(typeof l>"u"||l===null)return""+l;var f=$(l);if(f==="object"){if(l instanceof Date)return"date";if(l instanceof RegExp)return"regexp"}return f}function Fe(l){var f=V(l);switch(f){case"array":case"object":return"an "+f;case"boolean":case"date":case"regexp":return"a "+f;default:return f}}function He(l){return!l.constructor||!l.constructor.name?b:l.constructor.name}return D.checkPropTypes=a,D.resetWarningCache=a.resetWarningCache,D.PropTypes=D,D},le}var ce,we;function ut(){if(we)return ce;we=1;var e=fe();function t(){}function n(){}return n.resetWarningCache=t,ce=function(){function i(u,r,d,x,h,g){if(g!==e){var b=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw b.name="Invariant Violation",b}}i.isRequired=i;function a(){return i}var c={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:a,element:i,elementType:i,instanceOf:a,node:i,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return c.PropTypes=c,c},ce}var Ht=te.exports;if(process.env.NODE_ENV!=="production"){var pt=G.reactIsExports,ft=!0;te.exports=dt()(pt.isElement,ft)}else te.exports=ut()();var xt=te.exports;const q=ze.getDefaultExportFromCjs(xt);let Ie,Be;typeof document<"u"&&(Ie=document);typeof window<"u"&&(Be=window);const De=m.createContext({document:Ie,window:Be}),se=()=>m.useContext(De),{Provider:ht,Consumer:$t}=De;class Ae extends m.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return m.Children.only(this.props.children)}}z(Ae,"propTypes",{children:q.element.isRequired,contentDidMount:q.func.isRequired,contentDidUpdate:q.func.isRequired});class ue extends m.Component{constructor(n,i){super(n,i);z(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:i}=this.props;typeof i=="function"?i(n):i&&(i.current=n)});z(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});z(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=m.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const i=this.props.contentDidMount,a=this.props.contentDidUpdate,c=n.defaultView||n.parentView,u=s.jsxRuntimeExports.jsx(Ae,{contentDidMount:i,contentDidUpdate:a,children:s.jsxRuntimeExports.jsx(ht,{value:{document:n,window:c},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),r=this.getMountTarget();return[ge.createPortal(this.props.head,this.getDoc().head),ge.createPortal(u,r)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}z(ue,"propTypes",{style:q.object,head:q.node,initialContent:q.string,mountTarget:q.string,contentDidMount:q.func,contentDidUpdate:q.func,children:q.oneOfType([q.element,q.arrayOf(q.element)])}),z(ue,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const gt=m.forwardRef((e,t)=>s.jsxRuntimeExports.jsx(ue,{...e,forwardedRef:t}));let U=null,Q=[],Z=null,_e=null;function mt(e){const t=window.getComputedStyle(e),n=parseInt(t.paddingLeft,10),i=parseInt(t.paddingTop,10),a=parseInt(t.paddingRight,10),c=parseInt(t.paddingBottom,10);return{paddingLeft:n,paddingTop:i,paddingRight:a,paddingBottom:c}}const Se=(e,t,n)=>{if(!U)return;const i=e.getBoundingClientRect(),a=U==null?void 0:U.getElementById("placeholder"),{paddingLeft:c,paddingTop:u,paddingRight:r,paddingBottom:d}=mt(e);a.style.width=t==="vertical"?i.width-c-r+"px":"2px",a.style.height=t==="vertical"?"2px":i.height-u-d+"px",a.style.display="block";const x=Q.reduce((h,g)=>Math.abs(g-n)<Math.abs(h-n)?g:h);_e=Q.indexOf(x),t==="vertical"?(a.style.top=e.offsetTop+x+"px",a.style.left=e.offsetLeft+c+"px"):(a.style.top=e.offsetTop+u+"px",a.style.left=e.offsetLeft+x+"px")},yt=e=>{const t=Oe(e),n=window.getComputedStyle(e),i=t==="horizontal",a=parseInt(n.paddingLeft),c=parseInt(n.paddingTop);let u=i?a:c;Q=[u],Array.from(e.children).forEach(r=>{const d=window.getComputedStyle(r),x=parseInt(i?d.marginLeft+d.marginRight:d.marginTop+d.marginBottom),h=i?r.offsetWidth:r.offsetHeight;Q.push(u+h+x),u+=h+x})};function Oe(e){const t=window.getComputedStyle(e).display,n=window.getComputedStyle(e).flexDirection;if(t==="flex")return n==="column"||n==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const i=window.getComputedStyle(e).gridTemplateRows,a=window.getComputedStyle(e).gridTemplateColumns;if(i.includes("auto"))return"vertical";if(a.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const vt=p.throttle(e=>{const t=e.target,n=Oe(t);if(n==="vertical"){const i=e.clientY-t.offsetTop;Se(t,n,i)}else{const i=e.clientX-t.offsetLeft;Se(t,n,i)}},200),jt=e=>{e.preventDefault(),e.stopPropagation(),vt(e)};function de(){const e=U==null?void 0:U.getElementById("placeholder");e.style.display="none"}const bt=()=>{const{document:e}=se(),[t,n]=L.useAtom(o.draggingFlagAtom),i=Ke.useAddBlockByDrop(),a=Te.useFeature("dnd"),[,c]=o.useHighlightBlockId(),[,u]=o.useSelectedBlockIds();return U=e,{isDragging:t,"data-dnd":"branch",onDragOver:a?jt:p.noop,onDrop:a?r=>{Z==null||Z.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const d=JSON.parse(r.dataTransfer.getData("text/plain"));let x=r.target.getAttribute("data-block-id");x===null&&(x=r.target.parentElement.getAttribute("data-block-id")),i({block:d,dropTargetId:x||null,relativeIndex:_e}),n(!1),de(),setTimeout(()=>{de()},300)}:p.noop,onDragEnter:a?r=>{const d=r;Z=d.target,d.stopPropagation(),d.preventDefault(),Q=[];const x=d.target;yt(x),x.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),n(!0),c(""),u([])}:p.noop,onDragLeave:a?r=>{const d=r;Z=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:p.noop,onMouseOut:a?()=>{n(!1),de()}:p.noop}};function xe(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function Et(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const kt=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=o.useUpdateBlocksProps(),[,n]=o.useHighlightBlockId(),[i,a]=L.useAtom(o.inlineEditingActiveAtom);return c=>{var g;if(i)return;const u=xe(c.target),r=u.getAttribute("data-block-type");if(!r||!e.includes(r))return;const d=u.cloneNode(!0);u.style.display="none",Array.from(d.attributes).forEach(b=>{b.name!=="class"&&d.removeAttribute(b.name)}),r==="Text"&&(d.style.display="inline-block"),u.parentNode.insertBefore(d,u.nextSibling);const x=new Ye.Quill(d,{placeholder:"Type here..."});function h(){const b=x.getText(0,x.getLength());t([u.getAttribute("data-block-id")],{content:b}),u.removeAttribute("style"),d.removeEventListener("blur",h,!0),Et(x),a(""),n("")}d.addEventListener("blur",h,!0),x.focus(),(g=d.querySelector(".ql-clipboard"))==null||g.remove(),a(u.getAttribute("data-block-id"))}},Rt=()=>{const[,e]=o.useSelectedStylingBlocks(),[,t]=o.useSelectedBlockIds(),[n]=L.useAtom(o.inlineEditingActiveAtom);return i=>{if(n)return;i.stopPropagation();const a=xe(i.target);if(a!=null&&a.getAttribute("data-block-parent")){const c=a.getAttribute("data-style-prop"),u=a.getAttribute("data-style-id"),r=a.getAttribute("data-block-parent");e([{id:u,prop:c,blockId:r}]),t([r])}else a!=null&&a.getAttribute("data-block-id")&&t([a.getAttribute("data-block-id")])}},wt=p.throttle((e,t)=>{const n=xe(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),St=()=>{const[,e]=o.useHighlightBlockId(),[t]=L.useAtom(o.inlineEditingActiveAtom);return n=>{t||wt(n,e)}},Tt=({children:e})=>{const{document:t}=se(),[n]=o.useSelectedBlockIds(),[i,a]=o.useSelectedStylingBlocks();m.useEffect(()=>{setTimeout(()=>{if(!p.isEmpty(i))return;const x=qe(t,p.first(n));if(x){const h=x.getAttribute("data-style-prop");if(h){const g=x.getAttribute("data-style-id"),b=x.getAttribute("data-block-parent");a([{id:g,prop:h,blockId:b}])}}},100)},[t,n,a,i]);const c=kt(),u=Rt(),r=St(),d=bt();return s.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:u,onDoubleClick:c,onMouseMove:r,...p.omit(d,"isDragging"),className:"relative mb-5 h-full max-w-full "+(d.isDragging?"dragging":""),children:e})},qe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ct=()=>{const{window:e}=se(),[t,n]=o.useSelectedBlockIds(),[i]=o.useBlocksStore(),[,a]=o.useSelectedStylingBlocks(),{undo:c,redo:u}=o.useUndoManager(),r=o.useDuplicateBlocks(),[,d]=o.usePreviewMode(),x=o.useRemoveBlocks(),{savePage:h}=o.useSavePage(),[g]=L.useAtom(o.inlineEditingActiveAtom),[,b]=L.useAtom(o.editLayerNameAtom),D=v=>{v.key==="Enter"&&(v.preventDefault(),t.length===1&&b(p.first(t)))},O=v=>{const y=i.find(B=>B._id===v);return y?y._parent:null};return m.useEffect(()=>{const v=y=>{if(y.key==="Escape"){n([]),a([]);return}if(D(y),!g&&(y.key==="Delete"||y.key==="Backspace")&&(y.preventDefault(),x(t)),y.ctrlKey||y.metaKey){if(y.key==="ArrowUp"){y.preventDefault();const B=t.length>0?O(t[0]):null;B&&n([B])}if(["z","y","d","x","c","p","s","v"].includes(y.key)){if(g&&["x","z","v"].includes(y.key))return!0;y.preventDefault()}y.key==="s"&&(y.stopPropagation(),y.preventDefault(),h()),y.key==="z"&&c(),y.key==="y"&&u(),y.key==="d"&&r(t)}};return e.removeEventListener("keydown",v),e.addEventListener("keydown",v),()=>{e.removeEventListener("keydown",v)}},[t,n,c,x,d,u,r,g,h,e]),null},It=({block:e,label:t})=>{const[,n]=o.useSelectedBlockIds(),[,i]=o.useHighlightBlockId(),[,a]=L.useAtom(o.draggedBlockIdAtom),c=Te.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:c?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(p.pick(e,["_id","_type"]))),a(e._id),setTimeout(()=>{n([]),i(null)},200)},children:[s.jsxRuntimeExports.jsx(P.DragHandleDots2Icon,{}),t]})},Bt=({selectedBlockElement:e,block:t})=>{const n=o.useRemoveBlocks(),i=o.useDuplicateBlocks(),[,a]=o.useSelectedBlockIds(),[,c]=o.useSelectedStylingBlocks(),[u]=L.useAtom(o.inlineEditingActiveAtom),{floatingStyles:r,refs:d,update:x}=me.useFloating({placement:"top-start",middleware:[me.shift(),Je.flip()],elements:{reference:e}});Ve.useResizeObserver(e,()=>x(),e!==null);const h=p.get(t,"_parent",null),g=p.isEmpty(p.get(t,"_name",""))?p.get(t,"_type",""):p.get(t,"_name","");return!e||!t||u?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:d.setFloating,style:r,onClick:b=>{b.stopPropagation(),b.preventDefault()},onKeyDown:b=>b.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(It,{label:g,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[h&&s.jsxRuntimeExports.jsx(P.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{c([]),a([h])}}),o.canDuplicateBlock(p.get(t,"_type",""))?s.jsxRuntimeExports.jsx(P.CopyIcon,{className:"hover:scale-105",onClick:()=>i([t==null?void 0:t._id])}):null,o.canDeleteBlock(p.get(t,"_type",""))?s.jsxRuntimeExports.jsx(P.TrashIcon,{className:"hover:scale-105",onClick:()=>n([t==null?void 0:t._id])}):null]})]})},Dt=({model:e})=>{const[t]=o.useBrandingOptions(),[n]=o.useSelectedBlockIds(),[i]=o.useDarkMode(),[a]=o.useHighlightBlockId(),[c]=o.useSelectedStylingBlocks(),[u]=L.useAtom(o.draggedBlockIdAtom),{document:r,window:d}=se(),[x]=m.useState(r==null?void 0:r.getElementById("highlighted-block")),[h]=m.useState(r==null?void 0:r.getElementById("selected-block")),[g]=m.useState(r==null?void 0:r.getElementById("selected-styling-block")),[b]=m.useState(r==null?void 0:r.getElementById("dragged-block"));m.useEffect(()=>{i?r==null||r.documentElement.classList.add("dark"):r==null||r.documentElement.classList.remove("dark")},[i,r]);const D=p.get(t,"headingFont","DM Sans"),O=p.get(t,"bodyFont","DM Sans");return m.useEffect(()=>{const v=p.get(t,"primaryColor","#000"),y=p.get(t,"secondaryColor","#FFF"),B=Ze.tailwindcssPaletteGenerator({colors:[v,y],names:["primary","secondary"]});B.primary.DEFAULT=v,B.secondary.DEFAULT=y;const H=p.get(t,"roundedCorners","0");!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[D],body:[O]},extend:{borderRadius:{global:`${H||"0"}px`},colors:B}},plugins:[d.tailwind.plugin.withOptions(({prefix:Y="ui"}={})=>({addVariant:K})=>{for(const N of["open","checked","selected","active","disabled"])K(`${Y}-${N}`,[`&[data-headlessui-state~="${N}"]`,`:where([data-headlessui-state~="${N}"]) &`]),K(`${Y}-not-${N}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${N}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${N}"])) &:not([data-headlessui-state])`])})]})},[t,d,D,O]),m.useEffect(()=>{h&&(h.textContent=`${p.map(n,v=>`[data-block-id="${v}"]`).join(",")}{
57
57
  outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
58
58
  }`)},[n,h]),m.useEffect(()=>{if(!u){b.textContent="";return}b.textContent=`[data-block-id="${u}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[u]),m.useEffect(()=>{x&&(x.textContent=a?`[data-style-id="${a}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[a,n,x]),m.useEffect(()=>{g&&(g.textContent=`${p.map(c,({id:v})=>`[data-style-id="${v}"]`).join(",")}{
59
59
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
60
- }`)},[c,g]),m.useEffect(()=>{const v=p.get(t,"bodyTextLightColor","#64748b"),y=p.get(t,"bodyTextDarkColor","#94a3b8"),B=p.get(t,"bodyBgLightColor","#FFFFFF"),W=p.get(t,"bodyBgDarkColor","#0f172a");r.body.className=`font-body antialiased text-[${v}] bg-[${B}] dark:text-[${y}] dark:bg-[${W}]`},[t,r,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[D&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${D.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),O&&D!==O&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${O.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),D&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${D}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},At=e=>{const t={};return Object.keys(e).forEach(n=>{p.isString(e[n])&&e[n].startsWith(ee.SLOT_KEY)&&(t[n]=e[n].replace(ee.SLOT_KEY,"").split(","))}),t},_t=p.memoize(e=>{const t=e.replace(ee.STYLES_KEY,"").split(",");return Ge.twMerge(t[0],t[1])});function Ot(e,t){return p.get(e,`${t}_attrs`,{})}function qt(e){const t={};return Object.keys(e).forEach(n=>{if(p.isString(e[n])&&e[n].startsWith(ee.STYLES_KEY)){const i=_t(e[n]);t[n]={className:i,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,...Ot(e,n)}}}),t}function Pt(e,t){const n=p.get(e,"_bindings",{});return p.isEmpty(n)?{...e}:(p.each(n,(i,a)=>{p.isString(i)&&p.get(t,i,null)&&(e[a]=p.get(t,i,null))}),e)}function pe({blocks:e}){const[t]=o.useBlocksStore(),n=m.useCallback(c=>qt(c),[]),[i]=G.useChaiExternalData(),[a]=L.useAtom(o.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(e.map((c,u)=>{if(a===c._id)return null;const r=At(c),d={};p.isEmpty(r)||Object.keys(r).forEach(b=>{d[b]=m.Children.toArray(r[b].map(D=>s.jsxRuntimeExports.jsx(pe,{blocks:[p.find(t,{_id:D})]})))});const x=p.filter(t,{_parent:c._id});d.children=x.length?s.jsxRuntimeExports.jsx(pe,{blocks:x}):null;const h=Xe.getBlockComponent(c._type),g=p.get(h,"builderComponent",p.get(h,"component",null));return p.isNull(g)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${c==null?void 0:c._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(g,{blockProps:{"data-block-id":c._id,"data-block-type":c._type,"data-dnd":p.has(h,"canAcceptBlock")?"branch":"leaf"},inBuilder:!0,index:u,...Pt(c,i),...n(c),...d})})}))})}const Mt=()=>{const[e]=o.useBlocksStore(),t=p.isEmpty(e)?null:s.jsxRuntimeExports.jsx(G.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(pe,{blocks:p.filter(e,n=>p.isEmpty(n._parent))})});return s.jsxRuntimeExports.jsx(Qe.Provider,{children:t})},Lt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Nt=()=>{const[e]=L.useAtom(o.networkModeAtom),[t]=o.usePreviewMode(),[n]=o.useCanvasWidth(),[,i]=o.useSelectedBlockIds(),a=o.useSelectedBlock(),[,c]=o.useHighlightBlockId(),u=m.useRef(null),r=m.useRef(null),[d,x]=m.useState({width:0,height:0}),h=at(d),[g,b]=m.useState(0),[D,O]=m.useState([]),[,v]=m.useState([]),[,y]=L.useAtom(o.canvasIframeAtom),[B,W]=o.useSelectedStylingBlocks(),Y=o.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:A,clientHeight:F}=r.current;x({width:A,height:F}),g===0&&b(A)},[r,n,g]);const K=(A,F=0)=>{const{top:H}=A.getBoundingClientRect();return H+F>=0&&H-F<=window.innerHeight};m.useEffect(()=>{var A,F;if(a&&a.type!=="Multiple"&&u.current){const H=qe(u.current.contentDocument,a._id);H&&(K(H)||(F=(A=u.current)==null?void 0:A.contentWindow)==null||F.scrollTo({top:H.offsetTop,behavior:"smooth"}),O([H]))}},[a]),m.useEffect(()=>{if(!p.isEmpty(B)&&u.current){const A=Lt(u.current.contentDocument,p.first(B).id);v(A?[A]:[null])}else v([null])},[B]);const N=m.useMemo(()=>{let A=it;return e==="offline"&&(A=A.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),A=A.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),A=A.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),A},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{i([]),W([])},onMouseLeave:()=>setTimeout(()=>c(""),300),className:"relative mx-auto overflow-hidden h-full w-full",style:g>0&&!p.isEmpty(h)?{width:t?"100%":g}:{},ref:r,children:s.jsxRuntimeExports.jsxs(gt,{contentDidMount:()=>y(u.current),ref:u,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:N,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(Bt,{block:a,selectedBlockElement:p.first(D)}),s.jsxRuntimeExports.jsx(Dt,{model:"page"}),s.jsxRuntimeExports.jsx(Tt,{children:Y?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"})]})})},Ft=()=>s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(ot,{}),s.jsxRuntimeExports.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:s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(G.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(Nt,{})})})})]});exports.default=Ft;
60
+ }`)},[c,g]),m.useEffect(()=>{const v=p.get(t,"bodyTextLightColor","#64748b"),y=p.get(t,"bodyTextDarkColor","#94a3b8"),B=p.get(t,"bodyBgLightColor","#FFFFFF"),H=p.get(t,"bodyBgDarkColor","#0f172a");r.body.className=`font-body antialiased text-[${v}] bg-[${B}] dark:text-[${y}] dark:bg-[${H}]`},[t,r,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[D&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${D.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),O&&D!==O&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${O.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),D&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${D}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},At=e=>{const t={};return Object.keys(e).forEach(n=>{p.isString(e[n])&&e[n].startsWith(ee.SLOT_KEY)&&(t[n]=e[n].replace(ee.SLOT_KEY,"").split(","))}),t},_t=p.memoize(e=>{const t=e.replace(ee.STYLES_KEY,"").split(",");return Ge.twMerge(t[0],t[1])});function Ot(e,t){return p.get(e,`${t}_attrs`,{})}function qt(e){const t={};return Object.keys(e).forEach(n=>{if(p.isString(e[n])&&e[n].startsWith(ee.STYLES_KEY)){const i=_t(e[n]);t[n]={className:i,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,...Ot(e,n)}}}),t}function Pt(e,t){const n=p.get(e,"_bindings",{});return p.isEmpty(n)?{...e}:(p.each(n,(i,a)=>{p.isString(i)&&p.get(t,i,null)&&(e[a]=p.get(t,i,null))}),e)}function pe({blocks:e}){const[t]=o.useBlocksStore(),n=m.useCallback(c=>qt(c),[]),[i]=G.useChaiExternalData(),[a]=L.useAtom(o.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(e.map((c,u)=>{if(a===c._id)return null;const r=At(c),d={};p.isEmpty(r)||Object.keys(r).forEach(b=>{d[b]=m.Children.toArray(r[b].map(D=>s.jsxRuntimeExports.jsx(pe,{blocks:[p.find(t,{_id:D})]})))});const x=p.filter(t,{_parent:c._id});d.children=x.length?s.jsxRuntimeExports.jsx(pe,{blocks:x}):null;const h=Xe.getBlockComponent(c._type),g=p.get(h,"builderComponent",p.get(h,"component",null));return p.isNull(g)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${c==null?void 0:c._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(g,{blockProps:{"data-block-id":c._id,"data-block-type":c._type,"data-dnd":p.has(h,"canAcceptBlock")?"branch":"leaf"},inBuilder:!0,index:u,...Pt(c,i),...n(c),...d})})}))})}const Mt=()=>{const[e]=o.useBlocksStore(),t=p.isEmpty(e)?null:s.jsxRuntimeExports.jsx(G.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(pe,{blocks:p.filter(e,n=>p.isEmpty(n._parent))})});return s.jsxRuntimeExports.jsx(Qe.Provider,{children:t})},Lt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Nt=()=>{const[e]=L.useAtom(o.networkModeAtom),[t]=o.usePreviewMode(),[n]=o.useCanvasWidth(),[,i]=o.useSelectedBlockIds(),a=o.useSelectedBlock(),[,c]=o.useHighlightBlockId(),u=m.useRef(null),r=m.useRef(null),[d,x]=m.useState({width:0,height:0}),h=at(d),[g,b]=m.useState(0),[D,O]=m.useState([]),[,v]=m.useState([]),[,y]=L.useAtom(o.canvasIframeAtom),[B,H]=o.useSelectedStylingBlocks(),Y=o.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:A,clientHeight:W}=r.current;x({width:A,height:W}),g===0&&b(A)},[r,n,g]);const K=(A,W=0)=>{const{top:F}=A.getBoundingClientRect();return F+W>=0&&F-W<=window.innerHeight};m.useEffect(()=>{var A,W;if(a&&a.type!=="Multiple"&&u.current){const F=qe(u.current.contentDocument,a._id);F&&(K(F)||(W=(A=u.current)==null?void 0:A.contentWindow)==null||W.scrollTo({top:F.offsetTop,behavior:"smooth"}),O([F]))}},[a]),m.useEffect(()=>{if(!p.isEmpty(B)&&u.current){const A=Lt(u.current.contentDocument,p.first(B).id);v(A?[A]:[null])}else v([null])},[B]);const N=m.useMemo(()=>{let A=it;return e==="offline"&&(A=A.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),A=A.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),A=A.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),A},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{i([]),H([])},onMouseLeave:()=>setTimeout(()=>c(""),300),className:"relative mx-auto overflow-hidden h-full w-full",style:g>0&&!p.isEmpty(h)?{width:t?"100%":g}:{},ref:r,children:s.jsxRuntimeExports.jsxs(gt,{contentDidMount:()=>y(u.current),ref:u,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:N,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(Bt,{block:a,selectedBlockElement:p.first(D)}),s.jsxRuntimeExports.jsx(Dt,{model:"page"}),s.jsxRuntimeExports.jsx(Tt,{children:Y?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"})]})})},Wt=()=>s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(ot,{}),s.jsxRuntimeExports.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:s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(G.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(Nt,{})})})})]});exports.default=Wt;
@@ -5,14 +5,14 @@ import { j as r } from "./jsx-runtime-WbnYoNE9.js";
5
5
  import K, { createElement as _e, useCallback as ke, useState as $, useEffect as R, Component as Ye, Children as Tt, Suspense as Ke, useRef as Be, useMemo as Ct } from "react";
6
6
  import { map as re, includes as Oe, toUpper as pe, round as Et, throttle as Je, noop as te, isEmpty as z, first as ae, omit as It, pick as St, get as D, isString as je, memoize as Dt, each as _t, find as Bt, filter as Ve, isNull as Ot, has as At } from "lodash-es";
7
7
  import { ResetIcon as Ae, MobileIcon as Re, LaptopIcon as Rt, DesktopIcon as Pt, DotsVerticalIcon as Mt, EraserIcon as Lt, ZoomInIcon as Nt, DragHandleDots2Icon as Ft, ArrowUpIcon as $t, CopyIcon as Wt, TrashIcon as Ht } from "@radix-ui/react-icons";
8
- import { m as Ge, B as le, U as Qe, az as Ut, aA as qt, aB as zt, aC as Yt, aD as Kt, M as Te, ab as Jt, i as Ce, aE as Vt, aF as Gt, aG as Qt, aH as Xt, aI as Zt, aJ as en, aK as tn, j as W, ac as J, A as nn, z as rn, C as on, D as sn, E as an, F as ln, G as cn, H as dn, ai as un, N as Xe, ay as ie, aL as pn, X, a4 as fn, aM as Z, s as Ee, l as Ze, h as et, k as tt, a9 as hn, aN as gn, aO as nt, aP as mn, aQ as yn, t as vn, aR as xn, a0 as bn, aS as wn, S as rt } from "./index-m9VziIOy.js";
8
+ import { m as Ge, B as le, U as Qe, az as Ut, aA as qt, aB as zt, aC as Yt, aD as Kt, M as Te, ab as Jt, i as Ce, aE as Vt, aF as Gt, aG as Qt, aH as Xt, aI as Zt, aJ as en, aK as tn, j as W, ac as J, A as nn, z as rn, C as on, D as sn, E as an, F as ln, G as cn, H as dn, ai as un, N as Xe, ay as ie, aL as pn, X, a4 as fn, aM as Z, s as Ee, l as Ze, h as et, k as tt, a9 as hn, aN as gn, aO as nt, aP as mn, aQ as yn, t as vn, aR as xn, a0 as bn, aS as wn, S as rt } from "./index-QGA4ayU7.js";
9
9
  import { useTranslation as de } from "react-i18next";
10
10
  import { useAtom as M } from "jotai";
11
11
  import Pe from "react-dom";
12
12
  import { g as kn } from "./_commonjsHelpers-UyOWmZb0.js";
13
- import { r as ot, u as jn, B as Tn, E as Cn } from "./index-DXznIJrr.js";
13
+ import { r as ot, u as jn, B as Tn, E as Cn } from "./index-nrRnwUaC.js";
14
14
  import { Quill as En } from "react-quill";
15
- import { u as In } from "./useAddBlockByDrop-bs_SH7Tw.js";
15
+ import { u as In } from "./useAddBlockByDrop-Y-g4O8UC.js";
16
16
  import { useFeature as st } from "flagged";
17
17
  import { flip as Sn } from "@floating-ui/dom";
18
18
  import { useFloating as Dn, shift as _n } from "@floating-ui/react-dom";