@chaibuilder/sdk 1.2.22 → 1.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/AddBlocks-b0Vk6eqO.js +206 -0
  2. package/dist/AddBlocks-bgu08YJC.cjs +1 -0
  3. package/dist/BrandingOptions-AljW1cXz.cjs +1 -0
  4. package/dist/{BrandingOptions-4961TxX2.js → BrandingOptions-eUSoIgjj.js} +10 -9
  5. package/dist/CanvasArea-dp1tzDkK.cjs +55 -0
  6. package/dist/CanvasArea-ulUy_rmB.js +951 -0
  7. package/dist/{Class-MmCxz2Ay.cjs → Class-PoYusiA5.cjs} +1 -1
  8. package/dist/{Class-3k8xjeiM.js → Class-lGzsNBOK.js} +1 -1
  9. package/dist/{CurrentPage-oPZN6Gwj.js → CurrentPage-SFhXzQMy.js} +9 -10
  10. package/dist/CurrentPage-rWHgPomd.cjs +1 -0
  11. package/dist/ListTree-5n8U4-IF.cjs +1 -0
  12. package/dist/ListTree-ZeVWczTF.js +309 -0
  13. package/dist/MODIFIERS-0g14w5RS.cjs +1 -0
  14. package/dist/{MODIFIERS-WQdaNvb8.js → MODIFIERS-dytZ-osO.js} +4 -8
  15. package/dist/{PagesPanel-pRKHw-AZ.js → PagesPanel-IkZjy0Gn.js} +9 -10
  16. package/dist/PagesPanel-sBN51kKZ.cjs +1 -0
  17. package/dist/{ProjectPanel-iU6DY-Yp.js → ProjectPanel-e98TJLfI.js} +10 -11
  18. package/dist/ProjectPanel-lbQH31jc.cjs +1 -0
  19. package/dist/STRINGS--j49GZJP.js +7 -0
  20. package/dist/STRINGS-gPz7CUOk.cjs +1 -0
  21. package/dist/{Settings-BhSrj-cE.js → Settings-FZWm8Fc3.js} +862 -865
  22. package/dist/Settings-qytQoyTv.cjs +1 -0
  23. package/dist/SidePanels-YRIM1IPq.cjs +1 -0
  24. package/dist/{SidePanels-OLOUpKn4.js → SidePanels-wrkkpcGE.js} +119 -123
  25. package/dist/{Topbar-Ny9T-7Zb.js → Topbar-LUyDFBkK.js} +6 -5
  26. package/dist/Topbar-NOSnWo7V.cjs +1 -0
  27. package/dist/{UnsplashImages-Y8RGFVSh.js → UnsplashImages-eZedbK2J.js} +16 -15
  28. package/dist/UnsplashImages-f-ObKOC-.cjs +1 -0
  29. package/dist/{UploadImages-dd8LfyFr.js → UploadImages-71QziLbr.js} +11 -10
  30. package/dist/UploadImages-oOnccvT9.cjs +1 -0
  31. package/dist/add-page-modal-g3fd00P5.cjs +1 -0
  32. package/dist/{add-page-modal-Jni6CY1x.js → add-page-modal-yQ6qL6Ui.js} +10 -11
  33. package/dist/{confirm-alert-sc8RaWvD.js → confirm-alert-3flAvzWH.js} +6 -5
  34. package/dist/confirm-alert-LQsGNYz8.cjs +1 -0
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.d.ts +1 -0
  37. package/dist/core.js +48 -49
  38. package/dist/defaultTheme-7VqqhOcp.cjs +1 -0
  39. package/dist/{defaultTheme-gunU_Fe5.js → defaultTheme-D8B4-wHO.js} +1 -1
  40. package/dist/{delete-page-modal-0WiMZFxr.js → delete-page-modal-iMmkPec0.js} +9 -10
  41. package/dist/delete-page-modal-tzZmqGzE.cjs +1 -0
  42. package/dist/email.cjs +1 -1
  43. package/dist/email.d.ts +1 -0
  44. package/dist/email.js +16 -16
  45. package/dist/{form-n1Q6u16z.cjs → form-LBHtTduy.cjs} +1 -1
  46. package/dist/{form-Nj6Kdn3g.js → form-zKUMQFuB.js} +1 -1
  47. package/dist/html-to-json-efmv1pCj.cjs +1 -0
  48. package/dist/{html-to-json-C5sExaSD.js → html-to-json-ngX9ef2u.js} +31 -29
  49. package/dist/{index-nwAgi0aD.cjs → index--dUsFH1I.cjs} +1 -1
  50. package/dist/{index-IPJAbzzO.js → index-HD1UKc4P.js} +1091 -1063
  51. package/dist/{index-0bwkNnA0.cjs → index-bOWwCMRF.cjs} +42 -42
  52. package/dist/index-fvMaxES9.cjs +1 -0
  53. package/dist/{index-_VPpjzJu.js → index-m4WGov7e.js} +4 -4
  54. package/dist/{index-UP_4awU9.js → index-uLtBNl55.js} +4479 -4484
  55. package/dist/lib.cjs +3 -3
  56. package/dist/lib.js +17 -16
  57. package/dist/page-viewer-5gTszT-n.cjs +1 -0
  58. package/dist/{page-viewer-L1Dmgj-c.js → page-viewer-7AwzWRtB.js} +14 -15
  59. package/dist/project-general-setting-52CTYL_w.cjs +1 -0
  60. package/dist/{project-general-setting-sUP7JqWK.js → project-general-setting-pYPoqvqd.js} +10 -11
  61. package/dist/project-seo-setting-jTweI1DX.cjs +1 -0
  62. package/dist/{project-seo-setting-NNvAGt4T.js → project-seo-setting-zXKOcjep.js} +7 -6
  63. package/dist/render.cjs +1 -1
  64. package/dist/render.js +14 -13
  65. package/dist/single-page-detail-jy2SPcp1.cjs +1 -0
  66. package/dist/{single-page-detail-FXg_NebW.js → single-page-detail-q2TDxN-P.js} +11 -12
  67. package/dist/studio.cjs +1 -1
  68. package/dist/studio.d.ts +1 -0
  69. package/dist/studio.js +8 -9
  70. package/dist/ui.cjs +1 -1
  71. package/dist/ui.js +138 -137
  72. package/dist/web-blocks.cjs +6 -1
  73. package/dist/web-blocks.js +462 -354
  74. package/package.json +3 -5
  75. package/dist/AddBlocks-157fSrJX.cjs +0 -1
  76. package/dist/AddBlocks-WgpssWmQ.js +0 -223
  77. package/dist/BrandingOptions-nwXR9TMl.cjs +0 -1
  78. package/dist/CanvasArea-MajWGr9z.js +0 -908
  79. package/dist/CanvasArea-MmTlc5Vb.cjs +0 -55
  80. package/dist/CurrentPage-LpLr0lDI.cjs +0 -1
  81. package/dist/ListTree-dvxHTXs4.js +0 -167
  82. package/dist/ListTree-gTmusfso.cjs +0 -1
  83. package/dist/MODIFIERS-9EwxLM8V.cjs +0 -1
  84. package/dist/Outline-2OxsXs1-.js +0 -294
  85. package/dist/Outline-7CCnnzmK.cjs +0 -1
  86. package/dist/PagesPanel-8536oBWB.cjs +0 -1
  87. package/dist/ProjectPanel-oILsUWOH.cjs +0 -1
  88. package/dist/Settings-jHiYmt0y.cjs +0 -1
  89. package/dist/SidePanels-bcJJocSq.cjs +0 -1
  90. package/dist/Topbar-NMvzqQHW.cjs +0 -1
  91. package/dist/TypeIcon-ElNNPazl.cjs +0 -1
  92. package/dist/TypeIcon-qO96rNbV.js +0 -69
  93. package/dist/UnsplashImages-6tZv1q2_.cjs +0 -1
  94. package/dist/UploadImages-VLlVg9Ur.cjs +0 -1
  95. package/dist/add-page-modal-IsqDdK7X.cjs +0 -1
  96. package/dist/confirm-alert-f26zJ7Js.cjs +0 -1
  97. package/dist/defaultTheme-7Lk2zq60.cjs +0 -1
  98. package/dist/delete-page-modal-c3b-GCap.cjs +0 -1
  99. package/dist/html-to-json-FGufPv9R.cjs +0 -1
  100. package/dist/index-9PHdn80L.cjs +0 -1
  101. package/dist/page-viewer-TnxHhq7S.cjs +0 -1
  102. package/dist/project-general-setting-1Ot1RU43.cjs +0 -1
  103. package/dist/project-seo-setting-3-vBkx2v.cjs +0 -1
  104. package/dist/single-page-detail-btEKYXjE.cjs +0 -1
  105. package/dist/useAddBlockByDrop-V8xo-PNQ.js +0 -20
  106. package/dist/useAddBlockByDrop-qRHgy8_0.cjs +0 -1
@@ -0,0 +1,206 @@
1
+ import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
+ import y, { createElement as D, useState as g, useCallback as O, useMemo as U, useEffect as V, Suspense as R } from "react";
3
+ import { has as F, isFunction as W, first as h, omit as Y, noop as J, isEmpty as b, filter as v, values as k, groupBy as w, mergeWith as K, isArray as L, keys as Q, get as X, map as A, uniq as Z, includes as $, find as ee, reject as I } from "lodash-es";
4
+ import { useAtom as N } from "jotai";
5
+ import { useTranslation as H } from "react-i18next";
6
+ import { L as _, r as S, Y as se, at as P, ap as te, aq as re, ar as oe, h as T, a3 as G, aj as le, ak as ae, al as ce, am as ie, an as E, bj as ne, bk as de, bl as me, bm as pe, aB as ue, bn as xe, bo as he, B as fe, bp as ge, bq as je, br as be, au as ve, av as ke, aw as C, bf as ye, b9 as Be, ba as Ne, bb as Ce, bc as we, S as Ae } from "./index-HD1UKc4P.js";
7
+ import { BoxIcon as Te } from "@radix-ui/react-icons";
8
+ import { syncBlocksWithDefaults as M, useChaiBlocks as q } from "@chaibuilder/runtime";
9
+ import { useFeature as _e } from "flagged";
10
+ import { O as B } from "./STRINGS--j49GZJP.js";
11
+ import { Loader as Se } from "lucide-react";
12
+ import { g as Pe } from "./html-to-json-ngX9ef2u.js";
13
+ import "./_commonjsHelpers-UyOWmZb0.js";
14
+ import "./Functions-7jnEwJyw.js";
15
+ import "clsx";
16
+ import "tailwind-merge";
17
+ import "@react-hookz/web";
18
+ import "./MODIFIERS-dytZ-osO.js";
19
+ import "@radix-ui/react-toggle";
20
+ import "class-variance-authority";
21
+ import "./Class-lGzsNBOK.js";
22
+ import "@radix-ui/react-switch";
23
+ import "@radix-ui/react-slot";
24
+ import "@radix-ui/react-accordion";
25
+ import "@radix-ui/react-alert-dialog";
26
+ import "@radix-ui/react-dialog";
27
+ import "@radix-ui/react-label";
28
+ import "@radix-ui/react-scroll-area";
29
+ import "@radix-ui/react-tabs";
30
+ import "@radix-ui/react-tooltip";
31
+ import "@radix-ui/react-popover";
32
+ import "@radix-ui/react-menubar";
33
+ import "@radix-ui/react-hover-card";
34
+ import "@radix-ui/react-select";
35
+ import "@radix-ui/react-dropdown-menu";
36
+ import "@radix-ui/react-separator";
37
+ import "@radix-ui/react-toast";
38
+ import "cmdk";
39
+ import "@radix-ui/react-context-menu";
40
+ import "react-icons-picker";
41
+ import "react-dom";
42
+ import "react-quill";
43
+ import "himalaya";
44
+ const Le = ({ block: s }) => {
45
+ const { type: r, icon: c, label: l } = s, { addCoreBlock: d, addPredefinedBlock: i } = _(), [n, t] = S(), [, p] = se(), [, m] = N(P), o = () => {
46
+ if (F(s, "blocks")) {
47
+ const u = W(s.blocks) ? s.blocks() : s.blocks;
48
+ i(M(u), h(n));
49
+ } else
50
+ d(s, h(n));
51
+ m(B);
52
+ }, a = _e("dnd");
53
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(te, { children: [
54
+ /* @__PURE__ */ e.jsx(re, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
55
+ "button",
56
+ {
57
+ onClick: o,
58
+ type: "button",
59
+ onDragStart: (u) => {
60
+ u.dataTransfer.setData("text/plain", JSON.stringify(Y(s, ["component", "icon"]))), setTimeout(() => {
61
+ t([]), p(null), m(B);
62
+ }, 200);
63
+ },
64
+ draggable: a ? "true" : "false",
65
+ className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (a ? "cursor-grab" : "cursor-pointer"),
66
+ children: [
67
+ D(c || Te, { className: "w-4 h-4 mx-auto" }),
68
+ /* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: l || r })
69
+ ]
70
+ }
71
+ ) }),
72
+ /* @__PURE__ */ e.jsx(oe, { children: /* @__PURE__ */ e.jsx("p", { children: l || r }) })
73
+ ] }) });
74
+ }, Ie = ({ block: s, closePopover: r }) => {
75
+ const [c, l] = g(!1), d = T("getExternalPredefinedBlock", J()), { addCoreBlock: i, addPredefinedBlock: n } = _(), [t] = S(), p = O(
76
+ async (m) => {
77
+ if (m.stopPropagation(), F(s, "component")) {
78
+ i(s, h(t)), r();
79
+ return;
80
+ }
81
+ l(!0);
82
+ const o = await d(s);
83
+ b(o) || n(M(o), h(t)), r();
84
+ },
85
+ [s]
86
+ );
87
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
88
+ "div",
89
+ {
90
+ onClick: c ? () => {
91
+ } : p,
92
+ className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
93
+ children: [
94
+ c && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
95
+ /* @__PURE__ */ e.jsx(Se, { className: "animate-spin", size: 15, color: "white" }),
96
+ " ",
97
+ /* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
98
+ ] }),
99
+ s.preview ? /* @__PURE__ */ e.jsx(
100
+ "img",
101
+ {
102
+ src: s.preview,
103
+ className: "min-h-[50px] w-full rounded-md border border-gray-300",
104
+ alt: s.label
105
+ }
106
+ ) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: s.label }) })
107
+ ]
108
+ }
109
+ ) });
110
+ }, Ee = () => {
111
+ const { data: s } = G(), r = q(), c = v(k(r), { category: "custom" }), l = w(c, "group"), d = w(s, "group"), i = U(() => K(l, d, (o, a) => {
112
+ if (L(o) && L(a))
113
+ return [...o, ...a];
114
+ }), [l, d]), [n, t] = g(h(Q(i)) || ""), [, p] = N(P), m = X(i, n, []);
115
+ return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden py-2", children: [
116
+ /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex w-full items-center p-3", children: /* @__PURE__ */ e.jsxs(le, { value: n, onValueChange: (o) => t(o), children: [
117
+ /* @__PURE__ */ e.jsx(ae, { className: "w-full", children: /* @__PURE__ */ e.jsx(ce, { placeholder: "Select a provider" }) }),
118
+ /* @__PURE__ */ e.jsxs(ie, { children: [
119
+ /* @__PURE__ */ e.jsx(E, { value: "", children: "Choose" }),
120
+ y.Children.toArray(
121
+ A(i, (o, a) => /* @__PURE__ */ e.jsx(E, { value: a, children: a }, a))
122
+ )
123
+ ] })
124
+ ] }) }),
125
+ /* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-2", children: y.Children.toArray(
126
+ m.map((o) => /* @__PURE__ */ e.jsx(Ie, { block: o, closePopover: () => p(B) }))
127
+ ) })
128
+ ] });
129
+ }, Fe = () => {
130
+ const { t: s } = H(), [r, c] = g(""), { addPredefinedBlock: l } = _(), [d] = S(), [, i] = N(P), n = () => {
131
+ const t = Pe(r);
132
+ l([...t], h(d) || null), c(""), i(B);
133
+ };
134
+ return /* @__PURE__ */ e.jsxs(ne, { className: "border-border/0 p-0 shadow-none", children: [
135
+ /* @__PURE__ */ e.jsx(de, { className: "p-3", children: /* @__PURE__ */ e.jsx(me, { children: s("html_snippet_description") }) }),
136
+ /* @__PURE__ */ e.jsx(pe, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
137
+ /* @__PURE__ */ e.jsx(ue, { htmlFor: "current", className: "text-sm", children: s("tailwind_html_snippet") }),
138
+ /* @__PURE__ */ e.jsx(
139
+ xe,
140
+ {
141
+ autoFocus: !0,
142
+ tabIndex: 1,
143
+ ref: (t) => t && t.focus(),
144
+ onChange: (t) => c(t.target.value),
145
+ rows: 12,
146
+ value: r,
147
+ placeholder: s("enter_code_snippet"),
148
+ className: "resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"
149
+ }
150
+ )
151
+ ] }) }),
152
+ /* @__PURE__ */ e.jsxs(he, { className: "flex flex-col justify-end p-3", children: [
153
+ /* @__PURE__ */ e.jsx(fe, { disabled: r.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: s("import_html") }),
154
+ /* @__PURE__ */ e.jsx(ge, { variant: "default", className: "mt-2 border-none p-1 text-gray-400", children: /* @__PURE__ */ e.jsx(je, { className: "text-xs font-normal leading-4", children: s("note_imported_html") }) })
155
+ ] })
156
+ ] });
157
+ }, Cs = () => {
158
+ const { t: s } = H(), [r, c] = g("core"), [l, d] = g("basic"), i = q(), [, n] = N(be), t = T("importHTMLSupport", !0), p = T("filterChaiBlock", () => !0), { data: m, isLoading: o } = G(), a = v(i, p), u = w(a, "category"), f = Z(A(u.core, "group"));
159
+ V(() => {
160
+ !$(f, l) && !b(f) && !b(l) && d(h(f));
161
+ }, [f, l]);
162
+ const j = !o && !b(m) || ee(k(a), { category: "custom" }) !== void 0;
163
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full w-72 flex-col overflow-hidden", children: [
164
+ /* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
165
+ /* @__PURE__ */ e.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: s("add_block") }),
166
+ /* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s(r === "html" ? "enter_paste_tailwind_html" : "click_to_add_block") })
167
+ ] }),
168
+ /* @__PURE__ */ e.jsx(
169
+ ve,
170
+ {
171
+ onValueChange: (x) => {
172
+ n(""), c(x);
173
+ },
174
+ value: r,
175
+ className: "h-max",
176
+ children: /* @__PURE__ */ e.jsxs(
177
+ ke,
178
+ {
179
+ className: "grid w-full " + (j && t ? "grid-cols-3" : j && !t || !j && t ? "grid-cols-2" : "grid-cols-1"),
180
+ children: [
181
+ /* @__PURE__ */ e.jsx(C, { value: "core", children: s("Blocks") }),
182
+ j ? /* @__PURE__ */ e.jsx(C, { value: "ui-blocks", children: s("ui_library") }) : null,
183
+ t ? /* @__PURE__ */ e.jsx(C, { value: "html", children: s("import") }) : null
184
+ ]
185
+ }
186
+ )
187
+ }
188
+ ),
189
+ r === "core" && /* @__PURE__ */ e.jsx(ye, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx("div", { className: "mt-2 w-full", children: y.Children.toArray(
190
+ A(
191
+ f,
192
+ (x) => I(v(k(u.core), { group: x }), { hidden: !0 }).length ? /* @__PURE__ */ e.jsx(Be, { type: "single", value: x, collapsible: !0, className: "w-full", children: /* @__PURE__ */ e.jsxs(Ne, { value: x, children: [
193
+ /* @__PURE__ */ e.jsx(Ce, { className: "rounded-md bg-gray-100 px-4 py-2 capitalize", children: x }),
194
+ /* @__PURE__ */ e.jsx(we, { className: "p-3", children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3 gap-2", children: y.Children.toArray(
195
+ I(v(k(u.core), { group: x }), { hidden: !0 }).map((z) => /* @__PURE__ */ e.jsx(Le, { block: z }))
196
+ ) }) })
197
+ ] }) }) : null
198
+ )
199
+ ) }) }),
200
+ r === "ui-blocks" && /* @__PURE__ */ e.jsx(R, { fallback: /* @__PURE__ */ e.jsx(Ae, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Ee, {}) }),
201
+ r === "html" && t ? /* @__PURE__ */ e.jsx(Fe, {}) : null
202
+ ] });
203
+ };
204
+ export {
205
+ Cs as default
206
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),t=require("lodash-es"),y=require("jotai"),v=require("react-i18next"),s=require("./index-fvMaxES9.cjs"),B=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),q=require("flagged"),R=require("./STRINGS-gPz7CUOk.cjs"),N=require("lucide-react"),C=require("./html-to-json-efmv1pCj.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@react-hookz/web");require("./MODIFIERS-0g14w5RS.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-PoYusiA5.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 T=({block:r})=>{const{type:i,icon:u,label:c}=r,{addCoreBlock:m,addPredefinedBlock:d}=s.useAddBlock(),[x,o]=s.useSelectedBlockIds(),[,j]=s.useHighlightBlockId(),[,p]=y.useAtom(s.activePanelAtom),l=()=>{if(t.has(r,"blocks")){const h=t.isFunction(r.blocks)?r.blocks():r.blocks;d(b.syncBlocksWithDefaults(h),t.first(x))}else m(r,t.first(x));p(R.OUTLINE_KEY)},a=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:l,type:"button",onDragStart:h=>{h.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{o([]),j(null),p(R.OUTLINE_KEY)},200)},draggable:a?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(a?"cursor-grab":"cursor-pointer"),children:[n.createElement(u||B.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||i})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||i})})]})})},A=({block:r,closePopover:i})=>{const[u,c]=n.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock",t.noop()),{addCoreBlock:d,addPredefinedBlock:x}=s.useAddBlock(),[o]=s.useSelectedBlockIds(),j=n.useCallback(async p=>{if(p.stopPropagation(),t.has(r,"component")){d(r,t.first(o)),i();return}c(!0);const l=await m(r);t.isEmpty(l)||x(b.syncBlocksWithDefaults(l),t.first(o)),i()},[r]);return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:u?()=>{}:j,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:[u&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(N.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})})]})})},w=()=>{const{data:r}=s.useUILibraryBlocks(),i=b.useChaiBlocks(),u=t.filter(t.values(i),{category:"custom"}),c=t.groupBy(u,"group"),m=t.groupBy(r,"group"),d=n.useMemo(()=>t.mergeWith(c,m,(l,a)=>{if(t.isArray(l)&&t.isArray(a))return[...l,...a]}),[c,m]),[x,o]=n.useState(t.first(t.keys(d))||""),[,j]=y.useAtom(s.activePanelAtom),p=t.get(d,x,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex w-full items-center p-3",children:e.jsxRuntimeExports.jsxs(s.Select,{value:x,onValueChange:l=>o(l),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"}),n.Children.toArray(t.map(d,(l,a)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:a,children:a},a)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:n.Children.toArray(p.map(l=>e.jsxRuntimeExports.jsx(A,{block:l,closePopover:()=>j(R.OUTLINE_KEY)})))})]})},S=()=>{const{t:r}=v.useTranslation(),[i,u]=n.useState(""),{addPredefinedBlock:c}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,d]=y.useAtom(s.activePanelAtom),x=()=>{const o=C.getBlocksFromHTML(i);c([...o],t.first(m)||null),u(""),d(R.OUTLINE_KEY)};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=>u(o.target.value),rows:12,value:i,placeholder:r("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs 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 border-none p-1 text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},_=()=>{const{t:r}=v.useTranslation(),[i,u]=n.useState("core"),[c,m]=n.useState("basic"),d=b.useChaiBlocks(),[,x]=y.useAtom(s.showPredefinedBlockCategoryAtom),o=s.useBuilderProp("importHTMLSupport",!0),j=s.useBuilderProp("filterChaiBlock",()=>!0),{data:p,isLoading:l}=s.useUILibraryBlocks(),a=t.filter(d,j),h=t.groupBy(a,"category"),g=t.uniq(t.map(h.core,"group"));n.useEffect(()=>{!t.includes(g,c)&&!t.isEmpty(g)&&!t.isEmpty(c)&&m(t.first(g))},[g,c]);const E=!l&&!t.isEmpty(p)||t.find(t.values(a),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-72 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:f=>{x(""),u(f)},value:i,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(E&&o?"grid-cols-3":E&&!o||!E&&o?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("Blocks")}),E?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("ui_library")}):null,o?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:n.Children.toArray(t.map(g,f=>t.reject(t.filter(t.values(h.core),{group:f}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:f,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:f,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:f}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:n.Children.toArray(t.reject(t.filter(t.values(h.core),{group:f}),{hidden:!0}).map(k=>e.jsxRuntimeExports.jsx(T,{block:k})))})})]})}):null))})}),i==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(w,{})}),i==="html"&&o?e.jsxRuntimeExports.jsx(S,{}):null]})};exports.default=_;
@@ -0,0 +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-fvMaxES9.cjs"),r=require("./controls-KK2oLIa8.cjs"),f=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./STRINGS-gPz7CUOk.cjs");require("@react-hookz/web");require("./MODIFIERS-0g14w5RS.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-PoYusiA5.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=f.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})})})},m=[{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",f.noop),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=x.useRef(e);x.useEffect(()=>()=>{f.isEqual(e,n.current)||t(n.current)},[]);const v=({formData:o},c)=>{c&&(i(o),n.current=o)},{bodyFont:u,headingFont:q,primaryColor:b,bodyTextDarkColor:h,bodyTextLightColor:y,bodyBgDarkColor:S,secondaryColor:C,bodyBgLightColor:O,roundedCorners:j}=e;let s={headingFont:r.s({title:"Heading font",default:q,options:m}),bodyFont:r.s({title:"Body font",default:u,options:m}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(j||5,10)}),primaryColor:r.f({title:"Primary",default:b}),secondaryColor:r.f({title:"Secondary",default:C})};l||(s={...s,bodyBgLightColor:r.f({title:"Body Background (Light Mode)",default:O}),bodyTextLightColor:r.f({title:"Body Text (Light Mode)",default:h}),bodyBgDarkColor:r.f({title:"Body Background (Dark mode)",default:S}),bodyTextDarkColor:r.f({title:"Body Text (Dark mode)",default:y})});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 w-60 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 { h as k, F as w, bw as D } from "./index-IPJAbzzO.js";
5
+ import { h as k, F as w, by as D } from "./index-HD1UKc4P.js";
6
6
  import { s as f, c as P, f as a } from "./controls-OfJWSEqC.js";
7
7
  import { debounce as R, noop as F, isEqual as L } from "lodash-es";
8
8
  import "./_commonjsHelpers-UyOWmZb0.js";
@@ -11,11 +11,12 @@ import "clsx";
11
11
  import "tailwind-merge";
12
12
  import "@chaibuilder/runtime";
13
13
  import "jotai";
14
- import "./MODIFIERS-WQdaNvb8.js";
14
+ import "./STRINGS--j49GZJP.js";
15
15
  import "@react-hookz/web";
16
+ import "./MODIFIERS-dytZ-osO.js";
16
17
  import "@radix-ui/react-toggle";
17
18
  import "class-variance-authority";
18
- import "./Class-3k8xjeiM.js";
19
+ import "./Class-lGzsNBOK.js";
19
20
  import "@radix-ui/react-switch";
20
21
  import "@radix-ui/react-slot";
21
22
  import "@radix-ui/react-accordion";
@@ -101,7 +102,7 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
101
102
  { title: "Lustria", value: "Lustria" },
102
103
  { title: "Ovo", value: "Ovo" },
103
104
  { title: "Suranna", value: "Suranna" }
104
- ], Ct = () => {
105
+ ], St = () => {
105
106
  const u = k("onSaveBrandingOptions", F), [e, p] = w(), [d] = D(), i = c.useRef(e);
106
107
  c.useEffect(() => () => {
107
108
  L(e, i.current) || u(i.current);
@@ -112,8 +113,8 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
112
113
  bodyFont: l,
113
114
  headingFont: h,
114
115
  primaryColor: x,
115
- bodyTextDarkColor: b,
116
- bodyTextLightColor: y,
116
+ bodyTextDarkColor: y,
117
+ bodyTextLightColor: b,
117
118
  bodyBgDarkColor: C,
118
119
  secondaryColor: S,
119
120
  bodyBgLightColor: B,
@@ -145,7 +146,7 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
145
146
  }),
146
147
  bodyTextLightColor: a({
147
148
  title: "Body Text (Light Mode)",
148
- default: b
149
+ default: y
149
150
  }),
150
151
  bodyBgDarkColor: a({
151
152
  title: "Body Background (Dark mode)",
@@ -153,7 +154,7 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
153
154
  }),
154
155
  bodyTextDarkColor: a({
155
156
  title: "Body Text (Dark mode)",
156
- default: y
157
+ default: b
157
158
  })
158
159
  });
159
160
  const n = {
@@ -184,5 +185,5 @@ const M = ({ value: u, onChange: e, id: p, onBlur: d }) => {
184
185
  ] });
185
186
  };
186
187
  export {
187
- Ct as default
188
+ St as default
188
189
  };
@@ -0,0 +1,55 @@
1
+ "use strict";var ne=Object.defineProperty;var oe=(e,t,s)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var A=(e,t,s)=>(oe(e,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-Z_BpKhVy.cjs"),p=require("react"),c=require("lodash-es"),w=require("@radix-ui/react-icons"),o=require("./index-fvMaxES9.cjs"),L=require("react-i18next"),B=require("jotai"),z=require("react-dom"),R=require("prop-types"),ie=require("react-quill"),Z=require("flagged"),re=require("@floating-ui/dom"),W=require("@floating-ui/react-dom"),le=require("@react-hookz/web"),ae=require("@bobthered/tailwindcss-palette-generator"),ce=require("@tailwindcss/typography"),de=require("@tailwindcss/forms"),ue=require("@tailwindcss/aspect-ratio"),pe=require("react-wrap-balancer"),xe=require("tailwind-merge"),q=require("./STRINGS-gPz7CUOk.cjs"),me=require("@chaibuilder/runtime"),O=require("./index-bOWwCMRF.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("./MODIFIERS-0g14w5RS.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-PoYusiA5.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-hotkeys-hook");const ge=()=>{const{hasUndo:e,hasRedo:t,undo:s,redo:l}=o.useUndoManager();return n.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[n.jsxRuntimeExports.jsx(o.Button,{disabled:!e(),size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:n.jsxRuntimeExports.jsx(w.ResetIcon,{})}),n.jsxRuntimeExports.jsx(o.Button,{disabled:!t(),onClick:l,size:"sm",className:"rounded-full",variant:"ghost",children:n.jsxRuntimeExports.jsx(w.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function he(){const[e,t]=o.useDarkMode(),{t:s}=L.useTranslation();return n.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[n.jsxRuntimeExports.jsx(o.Label,{htmlFor:"dark-mode-switch",children:s("dark_mode")}),n.jsxRuntimeExports.jsxs(o.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
2
+ relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[n.jsxRuntimeExports.jsx("span",{className:"sr-only",children:s("use_setting")}),n.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
3
+ pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const K=({landscape:e=!1})=>n.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:[n.jsxRuntimeExports.jsx("g",{strokeWidth:0}),n.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),n.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"}})]}),fe=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:n.jsxRuntimeExports.jsx(w.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:n.jsxRuntimeExports.jsx(w.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:n.jsxRuntimeExports.jsx(K,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:n.jsxRuntimeExports.jsx(K,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:n.jsxRuntimeExports.jsx(w.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:n.jsxRuntimeExports.jsx(w.DesktopIcon,{}),width:1920}],Y=({title:e,content:t,currentBreakpoint:s,breakpoint:l,width:a,icon:r,onClick:u})=>{const{t:i}=L.useTranslation();return n.jsxRuntimeExports.jsxs(o.HoverCard,{children:[n.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsx(o.Button,{onClick:()=>u(a),size:"sm",variant:l===s?"secondary":"ghost",children:r})}),n.jsxRuntimeExports.jsx(o.HoverCardContent,{className:"w-52 border-border",children:n.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:n.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[n.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:i(e)}),n.jsxRuntimeExports.jsx("p",{className:"text-xs",children:i(t)})]})})})]})},je=()=>{const[,e,t]=o.useCanvasWidth(),[s,l]=o.useSelectedBreakpoints(),{t:a}=L.useTranslation(),r=o.useBuilderProp("breakpoints",fe),u=i=>{s.includes(i)?s.length>2&&l(s.filter(d=>d!==i)):l(d=>[...d,i])};return r.length<4?n.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:c.map(r,i=>p.createElement(Y,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e}))}):n.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[c.map(r.filter(i=>c.includes(s,c.toUpper(i.breakpoint))),i=>p.createElement(Y,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e})),n.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[n.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:n.jsxRuntimeExports.jsx(w.DotsVerticalIcon,{className:"scale-90 transform"})})}),n.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[n.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:a("Breakpoints")}),n.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),c.map(r,i=>n.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:i.breakpoint==="xs",onCheckedChange:()=>u(c.toUpper(i.breakpoint)),checked:c.includes(s,c.toUpper(i.breakpoint)),children:a(i.title)},i.breakpoint))]})]})]})},ye=()=>{const{t:e}=L.useTranslation(),{setNewBlocks:t}=o.useBlocksStoreUndoableActions(),[,s]=o.useSelectedBlockIds(),[,l]=o.useSelectedStylingBlocks(),a=p.useCallback(()=>{t([]),s([]),l([])},[t]);return n.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:n.jsxRuntimeExports.jsxs(o.AlertDialog,{children:[n.jsxRuntimeExports.jsx(o.AlertDialogTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsxs(o.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[n.jsxRuntimeExports.jsx(w.EraserIcon,{})," ",e("clear")]})}),n.jsxRuntimeExports.jsxs(o.AlertDialogContent,{className:"border-border",children:[n.jsxRuntimeExports.jsxs(o.AlertDialogHeader,{children:[n.jsxRuntimeExports.jsx(o.AlertDialogTitle,{children:e("clear_canvas_title")}),n.jsxRuntimeExports.jsx(o.AlertDialogDescription,{children:e("clear_canvas_description")})]}),n.jsxRuntimeExports.jsxs(o.AlertDialogFooter,{children:[n.jsxRuntimeExports.jsx(o.AlertDialogCancel,{children:e("cancel")}),n.jsxRuntimeExports.jsx(o.AlertDialogAction,{onClick:a,children:e("yes")})]})]})]})})},Ee=()=>{const e=o.useBuilderProp("darkMode",!1),[t]=o.useCanvasZoom();return n.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[n.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(he,{}),n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,n.jsxRuntimeExports.jsx(je,{}),n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[n.jsxRuntimeExports.jsx(w.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",n.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[c.round(t,0),"%"]})]}),n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsx(ge,{})]}),n.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsx(ye,{})]})]})},ke=`<!doctype html>
4
+ <html class="scroll-smooth h-full overflow-y-auto">
5
+ <head>
6
+ <meta charset="UTF-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
9
+ <style>
10
+ html { height: 100%; overflow:auto; }
11
+ body { height: 100%; }
12
+ .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
13
+ .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
14
+ body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
15
+ -moz-user-select: none;-ms-user-select: none; user-select: none; }
16
+ html{
17
+ -ms-overflow-style: none; /* IE and Edge */
18
+ scrollbar-width: none; /* Firefox */
19
+ }
20
+ /** IMPORTANT: Make fields content editable in SAFARI */
21
+ [contenteditable] {-webkit-user-select: text;user-select: text;}
22
+
23
+ html::-webkit-scrollbar { width: 0 !important }
24
+ .aspect-auto{aspect-ratio: auto;}
25
+ .aspect-square{aspect-ratio: 1/1;}
26
+ .aspect-video{aspect-ratio: 16/9;}
27
+ .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
28
+ .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
29
+ a{ pointer-events: none !important; }
30
+ [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
31
+ [contenteditable="true"] {
32
+ outline: none;
33
+ box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
34
+ -webkit-user-select: text;
35
+ -moz-user-select: text;
36
+ user-select: text;
37
+ }
38
+ .frame-root .frame-content { height: 100%; }
39
+ </style>
40
+ <style id="hidden-blocks"></style>
41
+ <style id="selected-block"></style>
42
+ <style id="selected-styling-block"></style>
43
+ <style id="highlighted-block"></style>
44
+ <style id="dragged-block"></style>
45
+
46
+ </head>
47
+ <body class="font-body antialiased h-full">
48
+ <div class="frame-root h-full"></div>
49
+ <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
50
+ </body>
51
+ </html>`,ve=e=>{const[t]=o.useCanvasWidth(),[,s]=o.useCanvasZoom(),[l,a]=p.useState({}),r=p.useCallback(()=>{const{width:u,height:i}=e;if(u<t){const d=parseFloat((u/t).toFixed(2).toString());let x={};const m=i*d;i&&(x={height:100+(i-m)/m*100+"%"}),a({position:"relative",top:0,transform:`scale(${d})`,transformOrigin:"top left",...x,maxWidth:"none"}),s(d*100)}else a({}),s(100)},[t,e,s]);return p.useEffect(()=>{r()},[t,e,s,r]),l};let G,Q;typeof document<"u"&&(G=document);typeof window<"u"&&(Q=window);const J=p.createContext({document:G,window:Q}),$=()=>p.useContext(J),{Provider:be,Consumer:Qe}=J;class X extends p.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return p.Children.only(this.props.children)}}A(X,"propTypes",{children:R.element.isRequired,contentDidMount:R.func.isRequired,contentDidUpdate:R.func.isRequired});class F extends p.Component{constructor(s,l){super(s,l);A(this,"setRef",s=>{this.nodeRef.current=s;const{forwardedRef:l}=this.props;typeof l=="function"?l(s):l&&(l.current=s)});A(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});A(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=p.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 s=this.getDoc();return this.props.mountTarget?s.querySelector(this.props.mountTarget):s.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const s=this.getDoc();if(!s)return null;const l=this.props.contentDidMount,a=this.props.contentDidUpdate,r=s.defaultView||s.parentView,u=n.jsxRuntimeExports.jsx(X,{contentDidMount:l,contentDidUpdate:a,children:n.jsxRuntimeExports.jsx(be,{value:{document:s,window:r},children:n.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),i=this.getMountTarget();return[z.createPortal(this.props.head,this.getDoc().head),z.createPortal(u,i)]}render(){const s={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete s.head,delete s.initialContent,delete s.mountTarget,delete s.contentDidMount,delete s.contentDidUpdate,delete s.forwardedRef,n.jsxRuntimeExports.jsx("iframe",{...s,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}A(F,"propTypes",{style:R.object,head:R.node,initialContent:R.string,mountTarget:R.string,contentDidMount:R.func,contentDidUpdate:R.func,children:R.oneOfType([R.element,R.arrayOf(R.element)])}),A(F,"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 Re=p.forwardRef((e,t)=>n.jsxRuntimeExports.jsx(F,{...e,forwardedRef:t})),we=()=>{const{addCoreBlock:e}=o.useAddBlock(),t=o.useBuilderProp("getExternalPredefinedBlock",c.noop);return p.useCallback(async s=>{const{block:l,dropTargetId:a,relativeIndex:r}=s;if(c.has(l,"format")){const u=await t(l);return e({blocks:u},a===0?null:a,r)}return e(l,a===0?null:a,r)},[e])};let I=null,M=[],T=null,ee=null;function Be(e){const t=window.getComputedStyle(e),s=parseInt(t.paddingLeft,10),l=parseInt(t.paddingTop,10),a=parseInt(t.paddingRight,10),r=parseInt(t.paddingBottom,10);return{paddingLeft:s,paddingTop:l,paddingRight:a,paddingBottom:r}}const V=(e,t,s)=>{if(!I)return;const l=e.getBoundingClientRect(),a=I==null?void 0:I.getElementById("placeholder"),{paddingLeft:r,paddingTop:u,paddingRight:i,paddingBottom:d}=Be(e);a.style.width=t==="vertical"?l.width-r-i+"px":"2px",a.style.height=t==="vertical"?"2px":l.height-u-d+"px",a.style.display="block";const x=M.reduce((m,f)=>Math.abs(f-s)<Math.abs(m-s)?f:m);ee=M.indexOf(x),t==="vertical"?(a.style.top=e.offsetTop+x+"px",a.style.left=e.offsetLeft+r+"px"):(a.style.top=e.offsetTop+u+"px",a.style.left=e.offsetLeft+x+"px")},Se=e=>{const t=te(e),s=window.getComputedStyle(e),l=t==="horizontal",a=parseInt(s.paddingLeft),r=parseInt(s.paddingTop);let u=l?a:r;M=[u],Array.from(e.children).forEach(i=>{const d=window.getComputedStyle(i),x=parseInt(l?d.marginLeft+d.marginRight:d.marginTop+d.marginBottom),m=l?i.offsetWidth:i.offsetHeight;M.push(u+m+x),u+=m+x})};function te(e){const t=window.getComputedStyle(e).display,s=window.getComputedStyle(e).flexDirection;if(t==="flex")return s==="column"||s==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const l=window.getComputedStyle(e).gridTemplateRows,a=window.getComputedStyle(e).gridTemplateColumns;if(l.includes("auto"))return"vertical";if(a.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const Ce=c.throttle(e=>{const t=e.target,s=te(t);if(s==="vertical"){const l=e.clientY-t.offsetTop;V(t,s,l)}else{const l=e.clientX-t.offsetLeft;V(t,s,l)}},200),Ie=e=>{e.preventDefault(),e.stopPropagation(),Ce(e)};function P(){const e=I==null?void 0:I.getElementById("placeholder");e.style.display="none"}const De=()=>{const{document:e}=$(),[t,s]=B.useAtom(o.draggingFlagAtom),l=we(),a=Z.useFeature("dnd"),[,r]=o.useHighlightBlockId(),[,u]=o.useSelectedBlockIds();return I=e,{isDragging:t,"data-dnd":"branch",onDragOver:a?Ie:c.noop,onDrop:a?i=>{T==null||T.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const d=JSON.parse(i.dataTransfer.getData("text/plain"));let x=i.target.getAttribute("data-block-id");x===null&&(x=i.target.parentElement.getAttribute("data-block-id")),l({block:d,dropTargetId:x||null,relativeIndex:ee}),s(!1),P(),setTimeout(()=>{P()},300)}:c.noop,onDragEnter:a?i=>{const d=i;T=d.target,d.stopPropagation(),d.preventDefault(),M=[];const x=d.target;Se(x),x.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),s(!0),r(""),u([])}:c.noop,onDragLeave:a?i=>{const d=i;T=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:c.noop,onMouseOut:a?()=>{s(!1),P()}:c.noop}};function U(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function Ae(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const _e=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=o.useUpdateBlocksProps(),[,s]=o.useHighlightBlockId(),[l,a]=B.useAtom(o.inlineEditingActiveAtom);return r=>{var f;if(l)return;const u=U(r.target),i=u.getAttribute("data-block-type");if(!i||!e.includes(i))return;const d=u.cloneNode(!0);u.style.display="none",Array.from(d.attributes).forEach(j=>{j.name!=="class"&&d.removeAttribute(j.name)}),i==="Text"&&(d.style.display="inline-block"),u.parentNode.insertBefore(d,u.nextSibling);const x=new ie.Quill(d,{placeholder:"Type here..."});function m(){const j=x.getText(0,x.getLength());t([u.getAttribute("data-block-id")],{content:j}),u.removeAttribute("style"),d.removeEventListener("blur",m,!0),Ae(x),a(""),s("")}d.addEventListener("blur",m,!0),x.focus(),(f=d.querySelector(".ql-clipboard"))==null||f.remove(),a(u.getAttribute("data-block-id"))}},Te=()=>{const[,e]=o.useSelectedStylingBlocks(),[,t]=o.useSelectedBlockIds(),[,s]=o.useHighlightBlockId(),[l]=B.useAtom(o.inlineEditingActiveAtom);return a=>{if(l)return;a.stopPropagation();const r=U(a.target);if(r!=null&&r.getAttribute("data-block-id")&&(r==null?void 0:r.getAttribute("data-block-id"))==="container"){t([]),e([]),s("");return}if(r!=null&&r.getAttribute("data-block-parent")){const u=r.getAttribute("data-style-prop"),i=r.getAttribute("data-style-id"),d=r.getAttribute("data-block-parent");e([{id:i,prop:u,blockId:d}]),t([d])}else r!=null&&r.getAttribute("data-block-id")&&t([r.getAttribute("data-block-id")]);s("")}},Me=c.throttle((e,t)=>{const s=U(e.target);s!=null&&s.getAttribute("data-style-id")&&t(s.getAttribute("data-style-id"))},100),Ne=()=>{const[,e]=o.useHighlightBlockId(),[t]=B.useAtom(o.inlineEditingActiveAtom);return s=>{t||Me(s,e)}},qe=({children:e})=>{const{document:t}=$(),[s]=o.useSelectedBlockIds(),[l,a]=o.useSelectedStylingBlocks();p.useEffect(()=>{setTimeout(()=>{if(!c.isEmpty(l))return;const x=se(t,c.first(s));if(x){const m=x.getAttribute("data-style-prop");if(m){const f=x.getAttribute("data-style-id"),j=x.getAttribute("data-block-parent");a([{id:f,prop:m,blockId:j}])}}},100)},[t,s,a,l]);const r=_e(),u=Te(),i=Ne(),d=De();return n.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:u,onDoubleClick:r,onMouseMove:i,...c.omit(d,"isDragging"),className:"relative mb-5 h-full max-w-full "+(d.isDragging?"dragging":""),children:e})},se=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Le=()=>{const{window:e}=$(),[t,s]=o.useSelectedBlockIds(),[l]=o.useBlocksStore(),[,a]=o.useSelectedStylingBlocks(),{undo:r,redo:u}=o.useUndoManager(),i=o.useDuplicateBlocks(),[,d]=o.usePreviewMode(),x=o.useRemoveBlocks(),{savePage:m}=o.useSavePage(),[f]=B.useAtom(o.inlineEditingActiveAtom),[,j]=B.useAtom(o.editLayerNameAtom),b=y=>{y.key==="Enter"&&(y.preventDefault(),t.length===1&&j(c.first(t)))},S=y=>{const h=l.find(v=>v._id===y);return h?h._parent:null};return p.useEffect(()=>{const y=h=>{if(h.key==="Escape"){s([]),a([]);return}if(b(h),!f&&(h.key==="Delete"||h.key==="Backspace")&&(h.preventDefault(),x(t)),h.ctrlKey||h.metaKey){if(h.key==="ArrowUp"){h.preventDefault();const v=t.length>0?S(t[0]):null;v&&s([v])}if(["z","y","d","x","c","p","s","v"].includes(h.key)){if(f&&["x","z","v"].includes(h.key))return!0;h.preventDefault()}h.key==="s"&&(h.stopPropagation(),h.preventDefault(),m()),h.key==="z"&&r(),h.key==="y"&&u(),h.key==="d"&&i(t)}};return e.removeEventListener("keydown",y),e.addEventListener("keydown",y),()=>{e.removeEventListener("keydown",y)}},[t,s,r,x,d,u,i,f,m,e]),null},$e=({block:e,label:t})=>{const[,s]=o.useSelectedBlockIds(),[,l]=o.useHighlightBlockId(),[,a]=B.useAtom(o.draggedBlockIdAtom),r=Z.useFeature("dnd");return n.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:r?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(c.pick(e,["_id","_type"]))),a(e._id),setTimeout(()=>{s([]),l(null)},200)},children:[n.jsxRuntimeExports.jsx(w.DragHandleDots2Icon,{}),t]})},Pe=({selectedBlockElement:e,block:t})=>{const s=o.useRemoveBlocks(),l=o.useDuplicateBlocks(),[,a]=o.useSelectedBlockIds(),[,r]=o.useSelectedStylingBlocks(),[u]=B.useAtom(o.inlineEditingActiveAtom),{floatingStyles:i,refs:d,update:x}=W.useFloating({placement:"top-start",middleware:[W.shift(),re.flip()],elements:{reference:e}});le.useResizeObserver(e,()=>x(),e!==null);const m=c.get(t,"_parent",null),f=c.isEmpty(c.get(t,"_name",""))?c.get(t,"_type",""):c.get(t,"_name","");return!e||!t||u?null:n.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:d.setFloating,style:i,onClick:j=>{j.stopPropagation(),j.preventDefault()},onKeyDown:j=>j.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[n.jsxRuntimeExports.jsx($e,{label:f,block:t}),n.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[m&&n.jsxRuntimeExports.jsx(w.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{r([]),a([m])}}),o.canDuplicateBlock(c.get(t,"_type",""))?n.jsxRuntimeExports.jsx(w.CopyIcon,{className:"hover:scale-105",onClick:()=>l([t==null?void 0:t._id])}):null,o.canDeleteBlock(c.get(t,"_type",""))?n.jsxRuntimeExports.jsx(w.TrashIcon,{className:"hover:scale-105",onClick:()=>s([t==null?void 0:t._id])}):null]})]})},Fe=({model:e})=>{const[t]=o.useBrandingOptions(),[s]=o.useSelectedBlockIds(),[l]=o.useDarkMode(),[a]=o.useHighlightBlockId(),[r]=o.useSelectedStylingBlocks(),[u]=B.useAtom(o.draggedBlockIdAtom),{document:i,window:d}=$(),[x]=p.useState(i==null?void 0:i.getElementById("highlighted-block")),[m]=p.useState(i==null?void 0:i.getElementById("selected-block")),[f]=p.useState(i==null?void 0:i.getElementById("selected-styling-block")),[j]=p.useState(i==null?void 0:i.getElementById("dragged-block"));p.useEffect(()=>{l?i==null||i.documentElement.classList.add("dark"):i==null||i.documentElement.classList.remove("dark")},[l,i]);const b=c.get(t,"headingFont","DM Sans"),S=c.get(t,"bodyFont","DM Sans");return p.useEffect(()=>{const y=c.get(t,"primaryColor","#000"),h=c.get(t,"secondaryColor","#FFF"),v=ae.tailwindcssPaletteGenerator({colors:[y,h],names:["primary","secondary"]});v.primary.DEFAULT=y,v.secondary.DEFAULT=h;const _=c.get(t,"roundedCorners","0");!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[b],body:[S]},extend:{borderRadius:{global:`${_||"0"}px`},colors:v}},plugins:[ce,de,ue,d.tailwind.plugin.withOptions(()=>({addVariant:N,e:C})=>{N("hs-accordion-active",[({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active.${C(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .${C(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-toggle .${C(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${C(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-toggle.${C(`hs-accordion-active${g}${E}`)}`)},({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${C(`hs-accordion-active${g}${E}`)}`)}]),N("hs-accordion-selected",({modifySelectors:k,separator:g})=>{k(({className:E})=>`.hs-accordion .selected.${C(`hs-accordion-selected${g}${E}`)}`)})})]})},[t,d,b,S]),p.useEffect(()=>{m&&(m.textContent=`${c.map(s,y=>`[data-block-id="${y}"]`).join(",")}{
52
+ outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
53
+ }`)},[s,m]),p.useEffect(()=>{if(!u){j.textContent="";return}j.textContent=`[data-block-id="${u}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[u]),p.useEffect(()=>{x&&(x.textContent=a?`[data-style-id="${a}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[a,s,x]),p.useEffect(()=>{f&&(f.textContent=`${c.map(r,({id:y})=>`[data-style-id="${y}"]`).join(",")}{
54
+ outline: 1px solid #42a1fc !important; outline-offset: -1px;
55
+ }`)},[r,f]),p.useEffect(()=>{const y=c.get(t,"bodyTextLightColor","#64748b"),h=c.get(t,"bodyTextDarkColor","#94a3b8"),v=c.get(t,"bodyBgLightColor","#FFFFFF"),_=c.get(t,"bodyBgDarkColor","#0f172a");i.body.className=`font-body antialiased text-[${y}] bg-[${v}] dark:text-[${h}] dark:bg-[${_}]`},[t,i,e]),e==="page"?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[b&&n.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${b.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),S&&b!==S&&n.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${S.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),b&&n.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${b}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},He=e=>{const t={};return Object.keys(e).forEach(s=>{c.isString(e[s])&&e[s].startsWith(q.SLOT_KEY)&&(t[s]=e[s].replace(q.SLOT_KEY,"").split(","))}),t},Oe=c.memoize(e=>{const t=e.replace(q.STYLES_KEY,"").split(",");return xe.twMerge(t[0],t[1])});function Ue(e,t){return c.get(e,`${t}_attrs`,{})}function ze(e){const t={};return Object.keys(e).forEach(s=>{if(c.isString(e[s])&&e[s].startsWith(q.STYLES_KEY)){const l=Oe(e[s]);t[s]={className:l,"data-style-prop":s,"data-block-parent":e._id,"data-style-id":`${s}-${e._id}`,...Ue(e,s)}}}),t}function We(e,t){const s=c.get(e,"_bindings",{});return c.isEmpty(s)?{...e}:(c.each(s,(l,a)=>{c.isString(l)&&c.get(t,l,null)&&(e[a]=c.get(t,l,null))}),e)}function H({blocks:e}){const[t]=o.useBlocksStore(),s=p.useCallback(r=>ze(r),[]),[l]=O.useChaiExternalData(),[a]=B.useAtom(o.inlineEditingActiveAtom);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:p.Children.toArray(e.map((r,u)=>{if(a===r._id)return null;const i=He(r),d={};c.isEmpty(i)||Object.keys(i).forEach(j=>{d[j]=p.Children.toArray(i[j].map(b=>n.jsxRuntimeExports.jsx(H,{blocks:[c.find(t,{_id:b})]})))});const x=c.filter(t,{_parent:r._id});d.children=x.length?n.jsxRuntimeExports.jsx(H,{blocks:x}):null;const m=me.getBlockComponent(r._type),f=c.get(m,"builderComponent",c.get(m,"component",null));return c.isNull(f)?n.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${r==null?void 0:r._type} not registered -->`}):n.jsxRuntimeExports.jsx(p.Suspense,{children:p.createElement(f,{blockProps:{"data-block-id":r._id,"data-block-type":r._type,"data-dnd":c.has(m,"canAcceptBlock")?"branch":"leaf"},inBuilder:!0,index:u,...We(r,l),...s(r),...d})})}))})}const Ke=()=>{const[e]=o.useBlocksStore(),t=c.isEmpty(e)?null:n.jsxRuntimeExports.jsx(O.BlocksExternalDataProvider,{children:n.jsxRuntimeExports.jsx(H,{blocks:c.filter(e,s=>c.isEmpty(s._parent))})});return n.jsxRuntimeExports.jsx(pe.Provider,{children:t})},Ye=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Ve=()=>{const[e]=B.useAtom(o.networkModeAtom),[t]=o.usePreviewMode(),[s]=o.useCanvasWidth(),[,l]=o.useSelectedBlockIds(),a=o.useSelectedBlock(),[,r]=o.useHighlightBlockId(),u=p.useRef(null),i=p.useRef(null),[d,x]=p.useState({width:0,height:0}),m=ve(d),[f,j]=p.useState(0),[b,S]=p.useState([]),[,y]=p.useState([]),[,h]=B.useAtom(o.canvasIframeAtom),[v,_]=o.useSelectedStylingBlocks(),N=o.useBuilderProp("loading",!1);p.useEffect(()=>{const{clientWidth:g,clientHeight:E}=i.current;x({width:g,height:E}),f===0&&j(g)},[i,s,f]);const C=(g,E=0)=>{const{top:D}=g.getBoundingClientRect();return D+E>=0&&D-E<=window.innerHeight};p.useEffect(()=>{var g,E;if(a&&a.type!=="Multiple"&&u.current){const D=se(u.current.contentDocument,a._id);D&&(C(D)||(E=(g=u.current)==null?void 0:g.contentWindow)==null||E.scrollTo({top:D.offsetTop,behavior:"smooth"}),S([D]))}},[a]),p.useEffect(()=>{if(!c.isEmpty(v)&&u.current){const g=Ye(u.current.contentDocument,c.first(v).id);y(g?[g]:[null])}else y([null])},[v]);const k=p.useMemo(()=>{let g=ke;return e==="offline"&&(g=g.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),g=g.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),g=g.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),g},[e]);return n.jsxRuntimeExports.jsx("div",{onClick:()=>{l([]),_([])},onMouseLeave:()=>setTimeout(()=>r(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:f>0&&!c.isEmpty(m)?{width:t?"100%":f}:{},ref:i,children:n.jsxRuntimeExports.jsxs(Re,{contentDidMount:()=>h(u.current),ref:u,id:"canvas-iframe",style:{width:`${s}px`,...m},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:k,children:[n.jsxRuntimeExports.jsx(Le,{}),n.jsxRuntimeExports.jsx(Pe,{block:a,selectedBlockElement:c.first(b)}),n.jsxRuntimeExports.jsx(Fe,{model:"page"}),n.jsxRuntimeExports.jsx(qe,{children:N?n.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:n.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):n.jsxRuntimeExports.jsx(Ke,{})}),n.jsxRuntimeExports.jsx("br",{}),n.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},Ze=()=>n.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[n.jsxRuntimeExports.jsx(Ee,{}),n.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:n.jsxRuntimeExports.jsx(p.Suspense,{fallback:n.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:n.jsxRuntimeExports.jsx(O.ErrorBoundary,{children:n.jsxRuntimeExports.jsx(Ve,{})})})})]});exports.default=Ze;