@chaibuilder/sdk 4.0.0-beta.1 → 4.0.0-beta.2

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 (184) hide show
  1. package/README.md +27 -20
  2. package/dist/2SSKDMRQ-C4VFVd-q.cjs +1 -0
  3. package/dist/2SSKDMRQ-DSnzF_1o.js +42 -0
  4. package/dist/AP7HFJJL-B7YYCY9q.cjs +1228 -0
  5. package/dist/AP7HFJJL-Cxwj01Aq.js +9214 -0
  6. package/dist/IconPicker-C9-ieDWm.cjs +1 -0
  7. package/dist/IconPicker-RqVvq6G2.js +59 -0
  8. package/dist/WDYDFRGG-C7aSUcjs.js +33 -0
  9. package/dist/WDYDFRGG-b3T2SQbz.cjs +1 -0
  10. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  11. package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
  12. package/dist/actions-registery-CZ1w0NKa.js +15545 -0
  13. package/dist/actions-registery-YnFmU21O.cjs +418 -0
  14. package/dist/actions.cjs +1 -0
  15. package/dist/actions.d.ts +3202 -0
  16. package/dist/actions.js +216 -0
  17. package/dist/active-in-another-tab-Clng6zpY.cjs +1 -0
  18. package/dist/active-in-another-tab-wb8qolB8.js +34 -0
  19. package/dist/add-new-language-page-C4BuMTaN.cjs +1 -0
  20. package/dist/add-new-language-page-D7NDABl1.js +401 -0
  21. package/dist/add-new-page-B4hc0B-g.js +31 -0
  22. package/dist/add-new-page-BNfwKjRd.cjs +1 -0
  23. package/dist/ai-panel-content-BnbURb7j.js +61 -0
  24. package/dist/ai-panel-content-DPy2jgKw.cjs +1 -0
  25. package/dist/ai-panel-default-lang-3tCHzab5.cjs +3 -0
  26. package/dist/ai-panel-default-lang-oVk4TDeb.js +341 -0
  27. package/dist/ai-panel-other-lang-BBHCCSen.cjs +1 -0
  28. package/dist/ai-panel-other-lang-DmQ3QMDD.js +162 -0
  29. package/dist/ai-prompt-input-DaTyfib-.js +655 -0
  30. package/dist/ai-prompt-input-b5ty81RB.cjs +1 -0
  31. package/dist/ai-translation-prompt-DJPe2O-n.js +28 -0
  32. package/dist/ai-translation-prompt-c0Q3zkT2.cjs +1 -0
  33. package/dist/apply-binding-6iwlED02.js +833 -0
  34. package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
  35. package/dist/{code-display-337R7Dev.js → code-display-BzBq5xSn.js} +1 -1
  36. package/dist/code-display-Q3_sK_Ta.cjs +1 -0
  37. package/dist/code-editor-BQZi6-FB.cjs +1 -0
  38. package/dist/code-editor-DWWnphW9.js +50 -0
  39. package/dist/common-functions-B3a4xKt_.cjs +1 -0
  40. package/dist/common-functions-D2lMFR6K.js +13 -0
  41. package/dist/continue-editing-in-this-client-BllU94XG.js +24 -0
  42. package/dist/continue-editing-in-this-client-D9HyD4GP.cjs +1 -0
  43. package/dist/core-BoRDjj4h.cjs +1 -0
  44. package/dist/core-yvI6kCyw.js +56 -0
  45. package/dist/core.cjs +1 -1
  46. package/dist/core.d.ts +51 -383
  47. package/dist/core.js +39 -106
  48. package/dist/css-import-modal-BSMGKA2T.cjs +13 -0
  49. package/dist/{css-import-modal-DA2L6kwP.js → css-import-modal-D72a-16X.js} +39 -38
  50. package/dist/delete-design-token-Cd1ZDtqT.js +40 -0
  51. package/dist/delete-design-token-D_TLlO3I.cjs +1 -0
  52. package/dist/delete-page-ByQwBupJ.cjs +1 -0
  53. package/dist/delete-page-DC8pzvWW.js +70 -0
  54. package/dist/design-token-usage-BqZeR1sT.cjs +1 -0
  55. package/dist/design-token-usage-DE4XCDdn.js +113 -0
  56. package/dist/digital-asset-manager-BYLKFEYi.cjs +1 -0
  57. package/dist/digital-asset-manager-C_gL_0YY.js +876 -0
  58. package/dist/duplicate-page-BoVhko2q.js +133 -0
  59. package/dist/duplicate-page-vdvwLQLo.cjs +1 -0
  60. package/dist/dynamic-page-selector-CSndg2-y.js +85 -0
  61. package/dist/dynamic-page-selector-DdnbCuQZ.cjs +1 -0
  62. package/dist/fonts-B-Xt29pe.cjs +1 -0
  63. package/dist/fonts-DRly3Wzd.js +78 -0
  64. package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
  65. package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
  66. package/dist/{get-chai-builder-theme-D0IsUvK4.js → get-chai-builder-theme-BYtp20KD.js} +4 -4
  67. package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
  68. package/dist/get-seo-defaults-9zHebckY.js +65 -0
  69. package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
  70. package/dist/image-compression-DZ9WMmyn.cjs +1 -0
  71. package/dist/image-compression-DsZ1oqpb.js +37 -0
  72. package/dist/image-editor-DTspjj_c.cjs +1 -0
  73. package/dist/image-editor-oypq8asR.js +108 -0
  74. package/dist/index-B-rSiAp_.cjs +1 -0
  75. package/dist/index-BDnwJqMw.js +4732 -0
  76. package/dist/index-CbwxUFy_.cjs +5 -0
  77. package/dist/index-CnSjWE1P.cjs +160 -0
  78. package/dist/index-Dxfyt4d4.js +39 -0
  79. package/dist/index-S8ibZk9Q.js +19069 -0
  80. package/dist/json-diff-viewer-B5dr-Y_L.js +258 -0
  81. package/dist/json-diff-viewer-XX1pgabt.cjs +8 -0
  82. package/dist/lang-panel-BPxex-M2.cjs +1 -0
  83. package/dist/lang-panel-Cn83SRzd.js +215 -0
  84. package/dist/manage-design-tokens-ConiyuPr.cjs +1 -0
  85. package/dist/manage-design-tokens-lP4HLS0P.js +240 -0
  86. package/dist/mark-as-template-DYRxre1f.cjs +1 -0
  87. package/dist/mark-as-template-jncsjfHm.js +156 -0
  88. package/dist/models-5gOsRC56.cjs +1 -0
  89. package/dist/models-D95ZYr_x.js +70 -0
  90. package/dist/nested-path-selector-content-B-8LqhXI.js +87 -0
  91. package/dist/nested-path-selector-content-BYtLi7mC.cjs +1 -0
  92. package/dist/no-language-page-content-DAbLq0gX.cjs +1 -0
  93. package/dist/no-language-page-content-D_zd9Rb0.js +42 -0
  94. package/dist/no-language-page-dialog-C5Ps6YYL.js +10 -0
  95. package/dist/no-language-page-dialog-fXmbQO7L.cjs +1 -0
  96. package/dist/page-creator-VWIB2VAs.cjs +1 -0
  97. package/dist/page-creator-wCMtlE6Z.js +795 -0
  98. package/dist/page-lock-BPCxfv9J.js +30 -0
  99. package/dist/page-lock-DweiYy1w.cjs +1 -0
  100. package/dist/page-locked-dialog-BlbgvaG2.cjs +1 -0
  101. package/dist/page-locked-dialog-ByGl18_m.js +133 -0
  102. package/dist/page-manager-new-BWFE-S-O.js +394 -0
  103. package/dist/page-manager-new-D0lGfNnS.cjs +1 -0
  104. package/dist/page-manager-search-and-filter-DpGMoOII.cjs +1 -0
  105. package/dist/page-manager-search-and-filter-kNJFWJ86.js +201 -0
  106. package/dist/page-revisions-content-DYxXZqmh.cjs +1 -0
  107. package/dist/page-revisions-content-Ulr8slUN.js +445 -0
  108. package/dist/pages.cjs +1 -0
  109. package/dist/pages.d.ts +492 -0
  110. package/dist/pages.js +27 -0
  111. package/dist/plugin-3ZKK6RXm.js +245 -0
  112. package/dist/plugin-C6rgJDNQ.cjs +22 -0
  113. package/dist/publish-pages-content-BTPzt_m4.js +178 -0
  114. package/dist/publish-pages-content-D6g8GAsd.cjs +1 -0
  115. package/dist/register-partial-type-BjtdfKHE.js +36 -0
  116. package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
  117. package/dist/render.cjs +2 -2
  118. package/dist/render.d.ts +26 -13
  119. package/dist/render.js +130 -124
  120. package/dist/rte-widget-modal-DrMzWWjw.cjs +1 -0
  121. package/dist/rte-widget-modal-Rk_NW3KU.js +38 -0
  122. package/dist/runtime.cjs +1 -1
  123. package/dist/runtime.d.ts +306 -7
  124. package/dist/runtime.js +44 -1
  125. package/dist/save-to-lib-BK3uTFss.js +422 -0
  126. package/dist/save-to-lib-DHHUO12i.cjs +1 -0
  127. package/dist/sdk.css +1 -1
  128. package/dist/selected-block-display-CU3TwIMA.js +319 -0
  129. package/dist/selected-block-display-DSFhddPj.cjs +16 -0
  130. package/dist/seo-panel-Dl0IDV09.cjs +2 -0
  131. package/dist/seo-panel-jbzxFioc.js +798 -0
  132. package/dist/shared-json-ld-BL_dv3_q.js +565 -0
  133. package/dist/shared-json-ld-DPNkqDC1.cjs +1 -0
  134. package/dist/slug-input-1qwKkXhA.js +86 -0
  135. package/dist/slug-input-YVLjtTI3.cjs +1 -0
  136. package/dist/supabase-actions.cjs +1 -0
  137. package/dist/supabase-actions.d.ts +284 -0
  138. package/dist/supabase-actions.js +524 -0
  139. package/dist/take-over-request-DKvKi3mM.js +63 -0
  140. package/dist/take-over-request-DvMIg_cZ.cjs +1 -0
  141. package/dist/theme-panel-footer-BMOaPLWc.cjs +1 -0
  142. package/dist/theme-panel-footer-DbMDLYGI.js +25 -0
  143. package/dist/translation-warning-modal-9wTwIy_9.js +26 -0
  144. package/dist/translation-warning-modal-DjTwz75c.cjs +1 -0
  145. package/dist/unmark-as-template-CdqIJJER.cjs +1 -0
  146. package/dist/unmark-as-template-Dulvf7Zw.js +39 -0
  147. package/dist/unpublish-page-BwSVBf0_.cjs +1 -0
  148. package/dist/unpublish-page-Degu5Cy9.js +27 -0
  149. package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
  150. package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
  151. package/dist/{tailwind.cjs → utils.cjs} +1 -1
  152. package/dist/{tailwind.d.ts → utils.d.ts} +12 -11
  153. package/dist/utils.js +7 -0
  154. package/dist/web-blocks.cjs +1 -1
  155. package/dist/web-blocks.d.ts +0 -6
  156. package/dist/web-blocks.js +258 -251
  157. package/dist/web-preview-DXE4Jnf5.js +73 -0
  158. package/dist/web-preview-YzKxyXft.cjs +1 -0
  159. package/package.json +175 -105
  160. package/dist/IconPicker-CGWn9C4u.cjs +0 -1
  161. package/dist/IconPicker-QvxJ-4Ez.js +0 -64
  162. package/dist/apply-binding-DCno1xQL.js +0 -711
  163. package/dist/apply-binding-DvHNFLQD.cjs +0 -1
  164. package/dist/code-display-BZ1x7SqI.cjs +0 -1
  165. package/dist/code-editor-B28LoECM.cjs +0 -1
  166. package/dist/code-editor-CfG2FhJ-.js +0 -58
  167. package/dist/common-functions-BGzDsf1z.js +0 -14
  168. package/dist/common-functions-BZmyleS1.cjs +0 -1
  169. package/dist/css-import-modal-CENUYvcl.cjs +0 -13
  170. package/dist/get-chai-builder-theme-Ck_Z4Q-M.cjs +0 -1
  171. package/dist/index-CaGNHF7f.js +0 -12209
  172. package/dist/index-Gn6pJt2v.cjs +0 -166
  173. package/dist/mockServiceWorker.js +0 -307
  174. package/dist/plugin-B5627hMN.js +0 -195
  175. package/dist/plugin-UxTRfDum.cjs +0 -22
  176. package/dist/rte-widget-modal-DL739qeQ.cjs +0 -1
  177. package/dist/rte-widget-modal-Dte0od04.js +0 -41
  178. package/dist/tailwind.js +0 -7
  179. package/dist/tooltip-A4qGk781.cjs +0 -1
  180. package/dist/tooltip-tLiIOgjq.js +0 -1067
  181. package/dist/ui.cjs +0 -1
  182. package/dist/ui.d.ts +0 -415
  183. package/dist/ui.js +0 -129
  184. package/dist/vite.svg +0 -1
@@ -0,0 +1,422 @@
1
+ import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
+ import { B as b, c as z, a9 as se, aa as ie, P as oe, I as L, aE as le, am as ce, aF as de, L as P } from "./index-S8ibZk9Q.js";
3
+ import { ar as D, as as G, A as _, ay as ue } from "./index-BDnwJqMw.js";
4
+ import { useQuery as K, useMutation as U, useQueryClient as me } from "@tanstack/react-query";
5
+ import { toast as N } from "sonner";
6
+ import { Trash2 as Y, Plus as pe, ImageIcon as he, X as fe, AlertCircle as ge } from "lucide-react";
7
+ import { useState as f, useRef as V, useMemo as S, useEffect as w, useCallback as be } from "react";
8
+ import { c as ve } from "./image-compression-DsZ1oqpb.js";
9
+ import { isEmpty as ye, set as ke, has as Ne } from "lodash-es";
10
+ const Be = (r) => {
11
+ const a = D(), o = G();
12
+ return U({
13
+ mutationFn: async (t) => o(a, {
14
+ action: _.UPSERT_LIBRARY_ITEM,
15
+ data: t
16
+ }),
17
+ onSuccess: (t) => {
18
+ r ? r(t) : N.success("Block saved successfully");
19
+ },
20
+ onError: (t) => {
21
+ console.error("Error saving block:", t), N.error("Failed to save block", {
22
+ description: t instanceof Error ? t.message : "Unknown error"
23
+ });
24
+ }
25
+ });
26
+ }, Ce = (r) => {
27
+ const a = D(), o = G();
28
+ return K({
29
+ staleTime: "static",
30
+ queryKey: [_.GET_LIBRARY_ITEM, r],
31
+ enabled: !!r,
32
+ // Only run query if blockId is provided
33
+ queryFn: async () => {
34
+ if (!r) return null;
35
+ try {
36
+ return await o(a, {
37
+ action: _.GET_LIBRARY_ITEM,
38
+ data: { id: r }
39
+ });
40
+ } catch (t) {
41
+ throw console.error(t), new Error("The block could not be found on the server. It may have been deleted.");
42
+ }
43
+ },
44
+ retry: !1
45
+ });
46
+ }, Ie = (r) => {
47
+ const a = D(), o = G();
48
+ return U({
49
+ mutationFn: async (t) => o(a, {
50
+ action: _.DELETE_LIBRARY_ITEM,
51
+ data: { id: t }
52
+ }),
53
+ onSuccess: () => {
54
+ r ? r() : N.success("Block deleted successfully");
55
+ },
56
+ onError: (t) => {
57
+ console.error("Error deleting block:", t), N.error("Failed to delete block", {
58
+ description: t instanceof Error ? t.message : "Unknown error"
59
+ });
60
+ }
61
+ });
62
+ }, we = ({
63
+ blockId: r,
64
+ libBlockId: a,
65
+ isOpen: o,
66
+ onClose: t,
67
+ blockName: u,
68
+ trigger: p
69
+ }) => {
70
+ const [d, l] = f(!1), c = z(), v = Ie(() => {
71
+ c([r], { _libBlockId: void 0 }), N.success("Block deleted successfully"), l(!1), t();
72
+ });
73
+ return /* @__PURE__ */ i(se, { open: o, onOpenChange: (m) => !m && t(), children: [
74
+ /* @__PURE__ */ e(ie, { asChild: !0, children: p || /* @__PURE__ */ i(b, { type: "button", variant: "destructive", size: "sm", onClick: (m) => m.preventDefault(), disabled: d, children: [
75
+ /* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4" }),
76
+ "Delete"
77
+ ] }) }),
78
+ /* @__PURE__ */ e(
79
+ oe,
80
+ {
81
+ className: "z-[9999] w-72 p-4",
82
+ sideOffset: 5,
83
+ align: "center",
84
+ children: /* @__PURE__ */ i("div", { className: "space-y-3", children: [
85
+ /* @__PURE__ */ e("h4", { className: "font-medium", children: "Delete Block" }),
86
+ /* @__PURE__ */ i("p", { className: "text-sm", children: [
87
+ "Are you sure you want to delete the block",
88
+ /* @__PURE__ */ i("span", { className: "font-medium", children: [
89
+ ' "',
90
+ u,
91
+ '"'
92
+ ] }),
93
+ "?"
94
+ ] }),
95
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "This block will be permanently removed from the library. This action cannot be undone." }),
96
+ /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-2", children: [
97
+ /* @__PURE__ */ e(b, { type: "button", variant: "outline", size: "sm", onClick: t, disabled: d, children: "Cancel" }),
98
+ /* @__PURE__ */ e(b, { type: "button", variant: "destructive", size: "sm", onClick: () => {
99
+ l(!0), v.mutate(a);
100
+ }, disabled: d, children: d ? "Deleting..." : "Delete" })
101
+ ] })
102
+ ] })
103
+ }
104
+ )
105
+ ] });
106
+ }, Ee = ({
107
+ blockId: r,
108
+ libBlockId: a,
109
+ blockName: o,
110
+ size: t = "sm",
111
+ className: u = "",
112
+ close: p
113
+ }) => {
114
+ const [d, l] = f(!1);
115
+ return /* @__PURE__ */ e(
116
+ we,
117
+ {
118
+ blockId: r,
119
+ libBlockId: a,
120
+ isOpen: d,
121
+ onClose: () => {
122
+ l(!1), p();
123
+ },
124
+ blockName: o,
125
+ trigger: /* @__PURE__ */ i(
126
+ b,
127
+ {
128
+ type: "button",
129
+ variant: "destructive",
130
+ size: t,
131
+ className: u,
132
+ onClick: () => l(!0),
133
+ children: [
134
+ /* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4" }),
135
+ "Delete"
136
+ ]
137
+ }
138
+ )
139
+ }
140
+ );
141
+ }, xe = () => {
142
+ const r = D(), a = G(), o = me(), {
143
+ data: t = [],
144
+ isLoading: u,
145
+ error: p
146
+ } = K({
147
+ queryKey: ["library-groups"],
148
+ staleTime: "static",
149
+ placeholderData: [],
150
+ queryFn: async () => {
151
+ try {
152
+ return await a(r, {
153
+ action: "GET_LIBRARY_GROUPS"
154
+ }) || [];
155
+ } catch (c) {
156
+ return console.error("Error fetching library groups:", c), [];
157
+ }
158
+ }
159
+ }), { mutateAsync: d, isPending: l } = U({
160
+ mutationFn: async (c) => {
161
+ if (!c.trim())
162
+ throw new Error("Group name is required");
163
+ return a(r, {
164
+ action: "CREATE_BLOCK_GROUP",
165
+ data: { name: c }
166
+ });
167
+ },
168
+ onSuccess: () => {
169
+ o.invalidateQueries({
170
+ queryKey: ["library-groups"]
171
+ }), N.success("Group created successfully");
172
+ },
173
+ onError: (c) => {
174
+ console.error("Error creating group:", c), N.error("Failed to create group", {
175
+ description: c instanceof Error ? c.message : "Unknown error"
176
+ });
177
+ }
178
+ });
179
+ return {
180
+ groups: t,
181
+ isLoading: u,
182
+ error: p,
183
+ createGroup: d,
184
+ isCreating: l
185
+ };
186
+ }, Pe = ({ value: r, onChange: a }) => {
187
+ const [o, t] = f(!1), [u, p] = f(""), d = V(null), { groups: l } = xe(), [c, v] = f([
188
+ { id: "hero", name: "Hero" },
189
+ { id: "feature", name: "Feature" },
190
+ { id: "footer", name: "Footer" },
191
+ { id: "content", name: "Content" },
192
+ { id: "testimonial", name: "Testimonial" },
193
+ { id: "pricing", name: "Pricing" },
194
+ { id: "login", name: "Login" },
195
+ { id: "logos", name: "Logos" },
196
+ { id: "about", name: "About" },
197
+ { id: "banner", name: "Banner" },
198
+ { id: "blog", name: "Blog" },
199
+ { id: "careers", name: "Careers" },
200
+ { id: "casestudy", name: "Casestudy" },
201
+ { id: "changelog", name: "Changelog" },
202
+ { id: "compare", name: "Compare" },
203
+ { id: "contact", name: "Contact" },
204
+ { id: "cta", name: "Cta" },
205
+ { id: "faq", name: "Faq" },
206
+ { id: "gallery", name: "Gallery" },
207
+ { id: "integration", name: "Integration" },
208
+ { id: "list", name: "List" },
209
+ { id: "navbar", name: "Navbar" },
210
+ { id: "product", name: "Product" },
211
+ { id: "signup", name: "Signup" },
212
+ { id: "stats", name: "Stats" },
213
+ { id: "team", name: "Team" },
214
+ { id: "timeline", name: "Timeline" }
215
+ ]), h = S(
216
+ () => [
217
+ ...l,
218
+ ...c.filter((n) => !l.some((B) => B.id === n.id))
219
+ ],
220
+ [l, c]
221
+ ), g = () => {
222
+ const n = u.trim();
223
+ if (!n) return;
224
+ const B = { id: n, name: n };
225
+ v((E) => [...E, B]), a(B.id), p(""), t(!1);
226
+ };
227
+ w(() => {
228
+ o && d.current && d.current.focus();
229
+ }, [o]);
230
+ const m = (n) => {
231
+ n.key === "Enter" && (n.preventDefault(), g());
232
+ };
233
+ return w(() => {
234
+ r && !h.some((n) => n.id === r) && a("");
235
+ }, [r, h, a]), o ? /* @__PURE__ */ i("div", { className: "space-y-2", children: [
236
+ /* @__PURE__ */ e(
237
+ L,
238
+ {
239
+ ref: d,
240
+ placeholder: "Enter new group name",
241
+ value: u,
242
+ onChange: (n) => p(n.target.value),
243
+ onKeyDown: m
244
+ }
245
+ ),
246
+ /* @__PURE__ */ i("div", { className: "flex justify-end gap-2", children: [
247
+ /* @__PURE__ */ e(b, { variant: "outline", size: "sm", onClick: () => t(!1), children: "Cancel" }),
248
+ /* @__PURE__ */ e(b, { size: "sm", onClick: g, children: "Create" })
249
+ ] })
250
+ ] }) : /* @__PURE__ */ i("div", { className: "flex gap-2", children: [
251
+ /* @__PURE__ */ i(
252
+ "select",
253
+ {
254
+ className: "w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
255
+ value: r,
256
+ onChange: (n) => a(n.target.value),
257
+ children: [
258
+ /* @__PURE__ */ e("option", { value: "", children: "Select a group" }),
259
+ l.length > 0 && /* @__PURE__ */ e("optgroup", { label: "Library Groups", children: l.map((n) => /* @__PURE__ */ e("option", { value: n.id, children: n.name }, `lib-${n.id}`)) }),
260
+ c.length > 0 && /* @__PURE__ */ e("optgroup", { label: "Predefined Groups", children: c.filter((n) => !l.some((B) => B.id === n.id)).map((n) => /* @__PURE__ */ e("option", { value: n.id, children: n.name }, `local-${n.id}`)) })
261
+ ]
262
+ }
263
+ ),
264
+ /* @__PURE__ */ e(b, { type: "button", size: "icon", variant: "outline", onClick: () => t(!0), children: /* @__PURE__ */ e(pe, { className: "h-4 w-4" }) })
265
+ ] });
266
+ }, Le = ({ value: r, onChange: a }) => {
267
+ const [o, t] = f(!1), u = V(null), p = be(
268
+ async (c) => {
269
+ var h;
270
+ const v = (h = c.target.files) == null ? void 0 : h[0];
271
+ if (v)
272
+ try {
273
+ t(!0);
274
+ let g = v;
275
+ v.type.startsWith("image/") && (g = await ve(v));
276
+ const m = new FileReader();
277
+ m.onloadend = () => {
278
+ a(m.result), t(!1);
279
+ }, m.readAsDataURL(g);
280
+ } catch (g) {
281
+ console.error("Error reading file:", g), t(!1), N.error("Failed to process image", {
282
+ description: g instanceof Error ? g.message : "Unknown error"
283
+ });
284
+ }
285
+ },
286
+ [a]
287
+ );
288
+ return /* @__PURE__ */ i("div", { className: "space-y-2", children: [
289
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
290
+ /* @__PURE__ */ e(L, { type: "file", ref: u, onChange: p, accept: "image/*", className: "hidden" }),
291
+ /* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick: () => {
292
+ var c;
293
+ (c = u.current) == null || c.click();
294
+ }, disabled: o, className: "w-full", children: o ? /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
295
+ /* @__PURE__ */ e("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
296
+ "Uploading..."
297
+ ] }) : /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
298
+ /* @__PURE__ */ e(he, { className: "h-4 w-4" }),
299
+ "Select image"
300
+ ] }) }),
301
+ r && /* @__PURE__ */ e(b, { type: "button", variant: "outline", size: "icon", onClick: () => {
302
+ a(""), u.current && (u.current.value = "");
303
+ }, children: /* @__PURE__ */ e(fe, { className: "h-4 w-4" }) })
304
+ ] }),
305
+ r && /* @__PURE__ */ e("div", { className: "aspect-video h-[200px] max-h-[200px] overflow-hidden rounded-md border", children: /* @__PURE__ */ e("img", { src: r, alt: "Preview", className: "h-full w-full object-contain" }) })
306
+ ] });
307
+ }, qe = (r) => {
308
+ const { blocks: a, close: o, blockId: t } = r, { getPartailBlocks: u } = le(), p = a.find((s) => s._id === t), d = p == null ? void 0 : p._libBlockId, l = !!d, c = S(() => a.some((s) => s._type === "PartialBlock" || s._type === "GlobalBlock"), [a]), v = S(() => {
309
+ let s = [];
310
+ for (const y of a)
311
+ if (y._type === "PartialBlock" || y._type === "GlobalBlock") {
312
+ let k = u(y.partialBlockId);
313
+ y._parent && (k == null ? void 0 : k.length) > 0 && (k = k.map((R) => (ye(R._parent) && ke(R, "_parent", y._parent), R))), s = [...s, ...k];
314
+ } else
315
+ s.push(y);
316
+ return s;
317
+ }, [a, u]), [h, g] = f(""), [m, n] = f(""), [B, E] = f(""), [x, A] = f(""), [C, W] = f({}), [Q, $] = f(!1), [H, q] = f(l), [X, J] = f(!1), { hasPermission: Z } = ce(), ee = Z(ue.DELETE_LIBRARY_BLOCK), M = z(), te = () => {
318
+ M([t], { _libBlockId: void 0 }), N.success("Block delinked from library"), o();
319
+ }, {
320
+ data: I,
321
+ isLoading: F,
322
+ isError: O
323
+ } = Ce(d);
324
+ w(() => {
325
+ O && l && (J(!0), q(!1));
326
+ }, [O, l]), w(() => {
327
+ I && !F && (g(I.name || ""), n(I.group || ""), E(I.description || ""), A(I.preview || ""), q(!1));
328
+ }, [I, F]), w(() => {
329
+ const s = h.trim().length >= 2, y = m.trim() !== "";
330
+ $(s && y);
331
+ }, [h, m]);
332
+ const re = () => {
333
+ const s = {};
334
+ return h.trim() ? h.length < 2 && (s.name = "Name must be at least 2 characters") : s.name = "Name is required", m || (s.group = "Group is required"), W(s), Object.keys(s).length === 0;
335
+ }, { resetLibrary: ae } = de({ id: "" }), j = Be((s) => {
336
+ l || M([t], { _libBlockId: s.id }), N.success(`Block ${l ? "updated" : "saved"} successfully`), ae(s.library), o();
337
+ }), ne = async (s) => {
338
+ if (s.preventDefault(), !re()) return;
339
+ const y = v.map((k) => (Ne(k, "_libBlockId") && delete k._libBlockId, k));
340
+ j.mutate({
341
+ name: h.trim(),
342
+ group: m,
343
+ blocks: y,
344
+ description: B.trim(),
345
+ // Only include previewImage if it exists and is a base64 image
346
+ ...x && x.startsWith("data:") ? { previewImage: x } : {},
347
+ // Include id if in edit mode
348
+ ...l ? { id: d } : {}
349
+ });
350
+ }, T = j.isPending;
351
+ return H || F ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ e("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }) }) : X ? /* @__PURE__ */ i("div", { className: "space-y-4 p-6", children: [
352
+ /* @__PURE__ */ e("div", { className: "font-medium text-destructive", children: "Block Not Found" }),
353
+ /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "This block could not be found on the server. It may have been deleted." }),
354
+ /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-4", children: [
355
+ /* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick: o, children: "Cancel" }),
356
+ /* @__PURE__ */ e(b, { onClick: te, variant: "destructive", children: "Delink Block" })
357
+ ] })
358
+ ] }) : /* @__PURE__ */ i("div", { children: [
359
+ c && /* @__PURE__ */ i("div", { className: "mb-4 flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive", children: [
360
+ /* @__PURE__ */ e(ge, { className: "mt-0.5 h-5 w-5 flex-shrink-0" }),
361
+ /* @__PURE__ */ i("div", { children: [
362
+ /* @__PURE__ */ e("p", { className: "font-medium", children: "Partial Blocks Detected" }),
363
+ /* @__PURE__ */ e("p", { className: "mt-1 text-xs", children: "This block contains one or more Partial Blocks. Partial blocks will be merged into the library block" })
364
+ ] })
365
+ ] }),
366
+ /* @__PURE__ */ i("form", { onSubmit: ne, className: "space-y-4", children: [
367
+ /* @__PURE__ */ i("div", { className: "space-y-2", children: [
368
+ /* @__PURE__ */ e(P, { htmlFor: "name", className: C.name ? "text-destructive" : "", children: "Name" }),
369
+ /* @__PURE__ */ e(
370
+ L,
371
+ {
372
+ id: "name",
373
+ placeholder: "Enter block name",
374
+ value: h,
375
+ onChange: (s) => g(s.target.value),
376
+ className: C.name ? "border-destructive" : ""
377
+ }
378
+ ),
379
+ C.name && /* @__PURE__ */ e("p", { className: "text-xs text-destructive", children: C.name })
380
+ ] }),
381
+ /* @__PURE__ */ i("div", { className: "space-y-2", children: [
382
+ /* @__PURE__ */ e(P, { htmlFor: "group", className: C.group ? "text-destructive" : "", children: "Group" }),
383
+ /* @__PURE__ */ e(Pe, { value: m, onChange: n }),
384
+ C.group && /* @__PURE__ */ e("p", { className: "text-xs text-destructive", children: C.group })
385
+ ] }),
386
+ /* @__PURE__ */ i("div", { className: "space-y-2", children: [
387
+ /* @__PURE__ */ e(P, { htmlFor: "description", children: "Description (optional)" }),
388
+ /* @__PURE__ */ e(
389
+ L,
390
+ {
391
+ id: "description",
392
+ placeholder: "Enter a brief description",
393
+ className: "resize-none",
394
+ value: B,
395
+ onChange: (s) => E(s.target.value)
396
+ }
397
+ )
398
+ ] }),
399
+ /* @__PURE__ */ i("div", { className: "space-y-2", children: [
400
+ /* @__PURE__ */ e(P, { htmlFor: "previewImage", children: "Preview Image (optional)" }),
401
+ /* @__PURE__ */ e(Le, { value: x, onChange: A })
402
+ ] }),
403
+ /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-2", children: [
404
+ l && ee && /* @__PURE__ */ e(
405
+ Ee,
406
+ {
407
+ blockId: t,
408
+ libBlockId: d,
409
+ blockName: h,
410
+ className: "mr-auto",
411
+ close: o
412
+ }
413
+ ),
414
+ /* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick: o, disabled: T, children: "Cancel" }),
415
+ /* @__PURE__ */ e(b, { type: "submit", disabled: T || !Q, children: T ? "Saving..." : l ? "Update Block" : "Save Block" })
416
+ ] })
417
+ ] })
418
+ ] });
419
+ };
420
+ export {
421
+ qe as default
422
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-CnSjWE1P.cjs"),x=require("./index-CbwxUFy_.cjs"),I=require("@tanstack/react-query"),k=require("sonner"),C=require("lucide-react"),l=require("react"),H=require("./image-compression-DZ9WMmyn.cjs"),T=require("lodash-es"),X=r=>{const n=x.useApiUrl(),c=x.useFetch();return I.useMutation({mutationFn:async t=>c(n,{action:x.ACTIONS.UPSERT_LIBRARY_ITEM,data:t}),onSuccess:t=>{r?r(t):k.toast.success("Block saved successfully")},onError:t=>{console.error("Error saving block:",t),k.toast.error("Failed to save block",{description:t instanceof Error?t.message:"Unknown error"})}})},J=r=>{const n=x.useApiUrl(),c=x.useFetch();return I.useQuery({staleTime:"static",queryKey:[x.ACTIONS.GET_LIBRARY_ITEM,r],enabled:!!r,queryFn:async()=>{if(!r)return null;try{return await c(n,{action:x.ACTIONS.GET_LIBRARY_ITEM,data:{id:r}})}catch(t){throw console.error(t),new Error("The block could not be found on the server. It may have been deleted.")}},retry:!1})},Z=r=>{const n=x.useApiUrl(),c=x.useFetch();return I.useMutation({mutationFn:async t=>c(n,{action:x.ACTIONS.DELETE_LIBRARY_ITEM,data:{id:t}}),onSuccess:()=>{r?r():k.toast.success("Block deleted successfully")},onError:t=>{console.error("Error deleting block:",t),k.toast.error("Failed to delete block",{description:t instanceof Error?t.message:"Unknown error"})}})},ee=({blockId:r,libBlockId:n,isOpen:c,onClose:t,blockName:m,trigger:f})=>{const[u,i]=l.useState(!1),d=s.useUpdateBlocksPropsRealtime(),b=Z(()=>{d([r],{_libBlockId:void 0}),k.toast.success("Block deleted successfully"),i(!1),t()}),p=()=>{i(!0),b.mutate(n)},g=e.jsxs(s.Button,{type:"button",variant:"destructive",size:"sm",onClick:h=>h.preventDefault(),disabled:u,children:[e.jsx(C.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]});return e.jsxs(s.Popover,{open:c,onOpenChange:h=>!h&&t(),children:[e.jsx(s.PopoverTrigger,{asChild:!0,children:f||g}),e.jsx(s.PopoverContent,{className:"z-[9999] w-72 p-4",sideOffset:5,align:"center",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"font-medium",children:"Delete Block"}),e.jsxs("p",{className:"text-sm",children:["Are you sure you want to delete the block",e.jsxs("span",{className:"font-medium",children:[' "',m,'"']}),"?"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This block will be permanently removed from the library. This action cannot be undone."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(s.Button,{type:"button",variant:"outline",size:"sm",onClick:t,disabled:u,children:"Cancel"}),e.jsx(s.Button,{type:"button",variant:"destructive",size:"sm",onClick:p,disabled:u,children:u?"Deleting...":"Delete"})]})]})})]})},te=({blockId:r,libBlockId:n,blockName:c,size:t="sm",className:m="",close:f})=>{const[u,i]=l.useState(!1);return e.jsx(ee,{blockId:r,libBlockId:n,isOpen:u,onClose:()=>{i(!1),f()},blockName:c,trigger:e.jsxs(s.Button,{type:"button",variant:"destructive",size:t,className:m,onClick:()=>i(!0),children:[e.jsx(C.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]})})},se=()=>{const r=x.useApiUrl(),n=x.useFetch(),c=I.useQueryClient(),{data:t=[],isLoading:m,error:f}=I.useQuery({queryKey:["library-groups"],staleTime:"static",placeholderData:[],queryFn:async()=>{try{return await n(r,{action:"GET_LIBRARY_GROUPS"})||[]}catch(d){return console.error("Error fetching library groups:",d),[]}}}),{mutateAsync:u,isPending:i}=I.useMutation({mutationFn:async d=>{if(!d.trim())throw new Error("Group name is required");return n(r,{action:"CREATE_BLOCK_GROUP",data:{name:d}})},onSuccess:()=>{c.invalidateQueries({queryKey:["library-groups"]}),k.toast.success("Group created successfully")},onError:d=>{console.error("Error creating group:",d),k.toast.error("Failed to create group",{description:d instanceof Error?d.message:"Unknown error"})}});return{groups:t,isLoading:m,error:f,createGroup:u,isCreating:i}},re=({value:r,onChange:n})=>{const[c,t]=l.useState(!1),[m,f]=l.useState(""),u=l.useRef(null),{groups:i}=se(),[d,b]=l.useState([{id:"hero",name:"Hero"},{id:"feature",name:"Feature"},{id:"footer",name:"Footer"},{id:"content",name:"Content"},{id:"testimonial",name:"Testimonial"},{id:"pricing",name:"Pricing"},{id:"login",name:"Login"},{id:"logos",name:"Logos"},{id:"about",name:"About"},{id:"banner",name:"Banner"},{id:"blog",name:"Blog"},{id:"careers",name:"Careers"},{id:"casestudy",name:"Casestudy"},{id:"changelog",name:"Changelog"},{id:"compare",name:"Compare"},{id:"contact",name:"Contact"},{id:"cta",name:"Cta"},{id:"faq",name:"Faq"},{id:"gallery",name:"Gallery"},{id:"integration",name:"Integration"},{id:"list",name:"List"},{id:"navbar",name:"Navbar"},{id:"product",name:"Product"},{id:"signup",name:"Signup"},{id:"stats",name:"Stats"},{id:"team",name:"Team"},{id:"timeline",name:"Timeline"}]),p=l.useMemo(()=>[...i,...d.filter(a=>!i.some(j=>j.id===a.id))],[i,d]),g=()=>{const a=m.trim();if(!a)return;const j={id:a,name:a};b(E=>[...E,j]),n(j.id),f(""),t(!1)};l.useEffect(()=>{c&&u.current&&u.current.focus()},[c]);const h=a=>{a.key==="Enter"&&(a.preventDefault(),g())};return l.useEffect(()=>{r&&!p.some(a=>a.id===r)&&n("")},[r,p,n]),c?e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Input,{ref:u,placeholder:"Enter new group name",value:m,onChange:a=>f(a.target.value),onKeyDown:h}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(s.Button,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),e.jsx(s.Button,{size:"sm",onClick:g,children:"Create"})]})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",value:r,onChange:a=>n(a.target.value),children:[e.jsx("option",{value:"",children:"Select a group"}),i.length>0&&e.jsx("optgroup",{label:"Library Groups",children:i.map(a=>e.jsx("option",{value:a.id,children:a.name},`lib-${a.id}`))}),d.length>0&&e.jsx("optgroup",{label:"Predefined Groups",children:d.filter(a=>!i.some(j=>j.id===a.id)).map(a=>e.jsx("option",{value:a.id,children:a.name},`local-${a.id}`))})]}),e.jsx(s.Button,{type:"button",size:"icon",variant:"outline",onClick:()=>t(!0),children:e.jsx(C.Plus,{className:"h-4 w-4"})})]})},ne=({value:r,onChange:n})=>{const[c,t]=l.useState(!1),m=l.useRef(null),f=l.useCallback(async d=>{var p;const b=(p=d.target.files)==null?void 0:p[0];if(b)try{t(!0);let g=b;b.type.startsWith("image/")&&(g=await H.compressImageIfNeeded(b));const h=new FileReader;h.onloadend=()=>{n(h.result),t(!1)},h.readAsDataURL(g)}catch(g){console.error("Error reading file:",g),t(!1),k.toast.error("Failed to process image",{description:g instanceof Error?g.message:"Unknown error"})}},[n]),u=()=>{n(""),m.current&&(m.current.value="")},i=()=>{var d;(d=m.current)==null||d.click()};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Input,{type:"file",ref:m,onChange:f,accept:"image/*",className:"hidden"}),e.jsx(s.Button,{type:"button",variant:"outline",onClick:i,disabled:c,className:"w-full",children:c?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Uploading..."]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(C.ImageIcon,{className:"h-4 w-4"}),"Select image"]})}),r&&e.jsx(s.Button,{type:"button",variant:"outline",size:"icon",onClick:u,children:e.jsx(C.X,{className:"h-4 w-4"})})]}),r&&e.jsx("div",{className:"aspect-video h-[200px] max-h-[200px] overflow-hidden rounded-md border",children:e.jsx("img",{src:r,alt:"Preview",className:"h-full w-full object-contain"})})]})},ae=r=>{const{blocks:n,close:c,blockId:t}=r,{getPartailBlocks:m}=s.usePartialBlocksStore(),f=n.find(o=>o._id===t),u=f==null?void 0:f._libBlockId,i=!!u,d=l.useMemo(()=>n.some(o=>o._type==="PartialBlock"||o._type==="GlobalBlock"),[n]),b=l.useMemo(()=>{let o=[];for(const y of n)if(y._type==="PartialBlock"||y._type==="GlobalBlock"){let v=m(y.partialBlockId);y._parent&&(v==null?void 0:v.length)>0&&(v=v.map(L=>(T.isEmpty(L._parent)&&T.set(L,"_parent",y._parent),L))),o=[...o,...v]}else o.push(y);return o},[n,m]),[p,g]=l.useState(""),[h,a]=l.useState(""),[j,E]=l.useState(""),[w,R]=l.useState(""),[B,U]=l.useState({}),[A,q]=l.useState(!1),[M,_]=l.useState(i),[O,z]=l.useState(!1),{hasPermission:K}=s.usePermissions(),Y=K(x.PAGES_PERMISSIONS.DELETE_LIBRARY_BLOCK),F=s.useUpdateBlocksPropsRealtime(),Q=()=>{F([t],{_libBlockId:void 0}),k.toast.success("Block delinked from library"),c()},{data:N,isLoading:S,isError:D}=J(u);l.useEffect(()=>{D&&i&&(z(!0),_(!1))},[D,i]),l.useEffect(()=>{N&&!S&&(g(N.name||""),a(N.group||""),E(N.description||""),R(N.preview||""),_(!1))},[N,S]),l.useEffect(()=>{const o=p.trim().length>=2,y=h.trim()!=="";q(o&&y)},[p,h]);const V=()=>{const o={};return p.trim()?p.length<2&&(o.name="Name must be at least 2 characters"):o.name="Name is required",h||(o.group="Group is required"),U(o),Object.keys(o).length===0},{resetLibrary:W}=s.useLibraryBlocks({id:""}),G=X(o=>{i||F([t],{_libBlockId:o.id}),k.toast.success(`Block ${i?"updated":"saved"} successfully`),W(o.library),c()}),$=async o=>{if(o.preventDefault(),!V())return;const y=b.map(v=>(T.has(v,"_libBlockId")&&delete v._libBlockId,v));G.mutate({name:p.trim(),group:h,blocks:y,description:j.trim(),...w&&w.startsWith("data:")?{previewImage:w}:{},...i?{id:u}:{}})},P=G.isPending;return M||S?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):O?e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsx("div",{className:"font-medium text-destructive",children:"Block Not Found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This block could not be found on the server. It may have been deleted."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(s.Button,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),e.jsx(s.Button,{onClick:Q,variant:"destructive",children:"Delink Block"})]})]}):e.jsxs("div",{children:[d&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive",children:[e.jsx(C.AlertCircle,{className:"mt-0.5 h-5 w-5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Partial Blocks Detected"}),e.jsx("p",{className:"mt-1 text-xs",children:"This block contains one or more Partial Blocks. Partial blocks will be merged into the library block"})]})]}),e.jsxs("form",{onSubmit:$,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{htmlFor:"name",className:B.name?"text-destructive":"",children:"Name"}),e.jsx(s.Input,{id:"name",placeholder:"Enter block name",value:p,onChange:o=>g(o.target.value),className:B.name?"border-destructive":""}),B.name&&e.jsx("p",{className:"text-xs text-destructive",children:B.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{htmlFor:"group",className:B.group?"text-destructive":"",children:"Group"}),e.jsx(re,{value:h,onChange:a}),B.group&&e.jsx("p",{className:"text-xs text-destructive",children:B.group})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(s.Input,{id:"description",placeholder:"Enter a brief description",className:"resize-none",value:j,onChange:o=>E(o.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{htmlFor:"previewImage",children:"Preview Image (optional)"}),e.jsx(ne,{value:w,onChange:R})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[i&&Y&&e.jsx(te,{blockId:t,libBlockId:u,blockName:p,className:"mr-auto",close:c}),e.jsx(s.Button,{type:"button",variant:"outline",onClick:c,disabled:P,children:"Cancel"}),e.jsx(s.Button,{type:"submit",disabled:P||!A,children:P?"Saving...":i?"Update Block":"Save Block"})]})]})]})};exports.default=ae;