@chaibuilder/sdk 2.2.3 → 2.2.4

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 (35) hide show
  1. package/dist/CodeEditor-B7r9YjDC.cjs +1 -0
  2. package/dist/CodeEditor-HKrlrH8b.js +71 -0
  3. package/dist/core.cjs +5 -5
  4. package/dist/core.d.ts +3 -4
  5. package/dist/core.js +4355 -4390
  6. package/dist/get-chai-builder-theme-ByeXCyGx.js +12 -0
  7. package/dist/get-chai-builder-theme-CeaKvOZ8.cjs +1 -0
  8. package/dist/mockServiceWorker.js +1 -1
  9. package/dist/plugin-C01tjI6V.cjs +22 -0
  10. package/dist/{chai-theme-helpers-CfZwxV6S.js → plugin-fnBB3TCm.js} +111 -99
  11. package/dist/render-chai-blocks-6SVNwoLW.js +201 -0
  12. package/dist/render-chai-blocks-Bvl2_fRE.cjs +1 -0
  13. package/dist/render.cjs +2 -2
  14. package/dist/render.js +38 -188
  15. package/dist/sooner-AJ7QkeLS.cjs +1 -0
  16. package/dist/sooner-DGhT8-JI.js +831 -0
  17. package/dist/tailwind.cjs +1 -1
  18. package/dist/tailwind.js +3 -2
  19. package/dist/ui.cjs +1 -1
  20. package/dist/ui.d.ts +37 -29
  21. package/dist/ui.js +232 -196
  22. package/dist/web-blocks.cjs +2 -2
  23. package/dist/web-blocks.js +1210 -1069
  24. package/package.json +3 -2
  25. package/dist/CodeEditor-CPR3N3wa.cjs +0 -1
  26. package/dist/CodeEditor-CuhsobXe.js +0 -65
  27. package/dist/chai-theme-helpers-utzv3TbX.cjs +0 -22
  28. package/dist/getSplitClasses-DodqA_KW.cjs +0 -1
  29. package/dist/getSplitClasses-DphwgQiE.js +0 -48
  30. package/dist/plugin-DW1HhfzA.js +0 -24
  31. package/dist/plugin-kqWzHDpF.cjs +0 -1
  32. package/dist/tooltip-BF2E5xPf.cjs +0 -1
  33. package/dist/tooltip-DGVZAvLU.js +0 -755
  34. /package/dist/{Functions-BGzDsf1z.js → common-functions-BGzDsf1z.js} +0 -0
  35. /package/dist/{Functions-BZmyleS1.cjs → common-functions-BZmyleS1.cjs} +0 -0
@@ -1,24 +1,24 @@
1
- import { registerChaiBlockSchema as m, StylesProp as p, registerChaiBlock as d } from "@chaibuilder/runtime";
2
- import { jsx as i, jsxs as b, Fragment as _ } from "react/jsx-runtime";
1
+ import { registerChaiBlockSchema as u, StylesProp as p, registerChaiBlock as d } from "@chaibuilder/runtime";
2
+ import { jsx as s, jsxs as f, Fragment as T } from "react/jsx-runtime";
3
+ import { c as L, g as C } from "./common-functions-BGzDsf1z.js";
3
4
  import * as h from "react";
4
- import { createElement as v } from "react";
5
- import { c as L, g as C } from "./Functions-BGzDsf1z.js";
6
- import { ButtonIcon as N, CodeIcon as T, HeadingIcon as A, TextIcon as R, CursorTextIcon as H, DividerHorizontalIcon as z, SketchLogoIcon as V, ImageIcon as j, Link1Icon as q, RowsIcon as F, ColumnsIcon as U, SpaceBetweenVerticallyIcon as D, VideoIcon as G, CopyIcon as O, CheckboxIcon as Y, InputIcon as M, LetterCaseToggleIcon as W, RadiobuttonIcon as X, DropdownMenuIcon as J } from "@radix-ui/react-icons";
7
- import { isEmpty as w, get as f, isNull as Q, omit as Z, pick as K, map as I } from "lodash-es";
8
- import { FileCode as ee, GlobeIcon as $, GroupIcon as te, Columns as oe, Rows as le } from "lucide-react";
9
- const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div", { className: L("pointer-events-none flex h-20 flex-col items-center justify-center p-2", e), children: /* @__PURE__ */ i("div", { className: "h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800", children: /* @__PURE__ */ i("div", { className: "flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700" }) }) }) : null, ne = (e) => {
10
- const { blockProps: t, inBuilder: o, backgroundImage: n, children: l, tag: r = "div", styles: s } = e;
11
- let a = l;
12
- l || (a = /* @__PURE__ */ i(x, { inBuilder: o }));
5
+ import { createElement as w } from "react";
6
+ import { ButtonIcon as N, CopyIcon as R, CodeIcon as H, DividerHorizontalIcon as A, CheckboxIcon as z, InputIcon as M, LetterCaseToggleIcon as V, RadiobuttonIcon as j, DropdownMenuIcon as q, HeadingIcon as F, TableIcon as D, BorderTopIcon as U, BorderAllIcon as G, ViewHorizontalIcon as O, DragHandleHorizontalIcon as Y, SketchLogoIcon as W, ImageIcon as X, Link1Icon as J, RowsIcon as Q, ColumnsIcon as Z, TextIcon as K, CursorTextIcon as ee, SpaceBetweenVerticallyIcon as te, VideoIcon as oe } from "@radix-ui/react-icons";
7
+ import { isEmpty as v, get as b, map as P, isNull as le, omit as re, pick as ne } from "lodash-es";
8
+ import { FileCode as ie, GroupIcon as se, GlobeIcon as $, Columns as ae, Rows as ce } from "lucide-react";
9
+ const x = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div", { className: L("pointer-events-none flex h-20 flex-col items-center justify-center p-2", e), children: /* @__PURE__ */ s("div", { className: "h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800", children: /* @__PURE__ */ s("div", { className: "flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700" }) }) }) : null, pe = (e) => {
10
+ const { blockProps: o, inBuilder: t, backgroundImage: l, children: r, tag: n = "div", styles: i } = e;
11
+ let a = r;
12
+ r || (a = /* @__PURE__ */ s(x, { inBuilder: t }));
13
13
  let c = {};
14
- return n && (c = { backgroundImage: `url(${n})` }), h.createElement(r, { ...t, ...s, style: c }, a);
15
- }, re = {
14
+ return l && (c = { backgroundImage: `url(${l})` }), h.createElement(n, { ...o, ...i, style: c }, a);
15
+ }, de = {
16
16
  type: "Box",
17
17
  description: "Similar to a div or section elements in HTML",
18
18
  label: "Box",
19
19
  category: "core",
20
20
  group: "basic",
21
- ...m({
21
+ ...u({
22
22
  properties: {
23
23
  styles: p(""),
24
24
  backgroundImage: {
@@ -54,36 +54,36 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
54
54
  }
55
55
  }),
56
56
  canAcceptBlock: () => !0
57
- }, ie = (e) => {
58
- const { blockProps: t, iconSize: o, icon: n, content: l, styles: r, children: s, iconPos: a, link: c, inBuilder: u } = e, k = n, g = s || /* @__PURE__ */ b(_, { children: [
59
- /* @__PURE__ */ i("span", { "data-ai-key": "content", children: l }),
60
- k && /* @__PURE__ */ i(
57
+ }, ue = (e) => {
58
+ const { blockProps: o, iconSize: t, icon: l, content: r, styles: n, children: i, iconPos: a, link: c, inBuilder: y } = e, k = l, g = i || /* @__PURE__ */ f(T, { children: [
59
+ /* @__PURE__ */ s("span", { "data-ai-key": "content", children: r }),
60
+ k && /* @__PURE__ */ s(
61
61
  "div",
62
62
  {
63
- style: { width: o + "px" },
63
+ style: { width: t + "px" },
64
64
  className: a + " " + (a === "order-first" ? "mr-2" : "ml-2") || "",
65
65
  dangerouslySetInnerHTML: { __html: k }
66
66
  }
67
67
  )
68
- ] }), y = v(
68
+ ] }), m = w(
69
69
  "button",
70
70
  {
71
- ...t,
72
- ...r,
71
+ ...o,
72
+ ...n,
73
73
  type: "button",
74
- "aria-label": l
74
+ "aria-label": r
75
75
  },
76
76
  g
77
77
  );
78
- return w(f(c, "href")) ? y : u ? /* @__PURE__ */ i("span", { children: y }) : /* @__PURE__ */ i("a", { "aria-label": l, href: f(c, "href") || "/", target: f(c, "target", "_self"), children: y });
79
- }, se = {
78
+ return v(b(c, "href")) ? m : y ? /* @__PURE__ */ s("span", { children: m }) : /* @__PURE__ */ s("a", { "aria-label": r, href: b(c, "href") || "/", target: b(c, "target", "_self"), children: m });
79
+ }, ye = {
80
80
  type: "Button",
81
81
  description: "similar to a button element in HTML",
82
82
  label: "Button",
83
83
  category: "core",
84
84
  icon: N,
85
85
  group: "basic",
86
- ...m({
86
+ ...u({
87
87
  properties: {
88
88
  styles: p("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),
89
89
  content: {
@@ -128,189 +128,92 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
128
128
  }),
129
129
  i18nProps: ["content"],
130
130
  aiProps: ["content"]
131
- }, ae = (e) => {
132
- const { blockProps: t, styles: o, htmlCode: n, inBuilder: l } = e;
133
- return l ? /* @__PURE__ */ b("div", { className: "relative", children: [
134
- l ? /* @__PURE__ */ i("div", { ...t, ...o, className: "absolute z-20 h-full w-full" }) : null,
135
- h.createElement("div", {
131
+ }, me = (e) => {
132
+ const { blockProps: o, iconSize: t, icon: l, content: r, styles: n } = e, i = l, a = /* @__PURE__ */ f(T, { children: [
133
+ /* @__PURE__ */ s("span", { "data-ai-key": "content", children: r }),
134
+ i && /* @__PURE__ */ s("div", { style: { width: t + "px" }, dangerouslySetInnerHTML: { __html: i } })
135
+ ] });
136
+ return w(
137
+ "button",
138
+ {
136
139
  ...o,
137
- dangerouslySetInnerHTML: { __html: n.replace(/<script.*?>.*?<\/script>/g, "") }
138
- })
139
- ] }) : h.createElement("div", {
140
- ...t,
141
- ...o,
142
- dangerouslySetInnerHTML: { __html: n }
143
- });
144
- }, ce = {
145
- type: "CustomHTML",
146
- description: "similar to a div or section elements in HTML",
147
- label: "Custom HTML",
148
- category: "core",
149
- icon: T,
150
- group: "advanced",
151
- ...m({
152
- properties: {
153
- styles: p(""),
154
- htmlCode: {
155
- type: "string",
156
- default: "<div><p>Enter your HTML code here...</p></div>",
157
- ui: { "ui:widget": "code" }
158
- }
159
- }
160
- })
161
- }, pe = (e) => {
162
- const { blockProps: t, styles: o, backgroundImage: n } = e;
163
- let l = {};
164
- return n && (l = { backgroundImage: `url(${n})` }), h.createElement("div", { ...t, ...o, style: l });
165
- }, ue = {
166
- type: "EmptyBox",
167
- description: "A box component with no children",
168
- label: "Empty Box",
140
+ ...n,
141
+ type: "button",
142
+ "aria-label": r
143
+ },
144
+ a
145
+ );
146
+ }, ge = {
147
+ type: "CopyButton",
148
+ description: "A copy button component",
149
+ label: "Copy Button",
169
150
  category: "core",
151
+ icon: R,
170
152
  group: "basic",
171
- ...m({
172
- properties: {
173
- styles: p(""),
174
- backgroundImage: {
175
- type: "string",
176
- title: "Background Image",
177
- default: "",
178
- ui: { "ui:widget": "image" }
179
- }
180
- }
181
- })
182
- }, de = (e) => {
183
- const { blockProps: t, styles: o, content: n, tag: l = "h1", children: r = null } = e;
184
- return r ? h.createElement(l, { ...o, ...t }, r) : h.createElement(l, {
185
- ...o,
186
- ...t,
187
- dangerouslySetInnerHTML: { __html: n }
188
- });
189
- }, me = {
190
- type: "Heading",
191
- description: "A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",
192
- label: "Heading",
193
- category: "core",
194
- icon: A,
195
- group: "typography",
196
- ...m({
153
+ ...u({
197
154
  properties: {
198
- tag: {
155
+ styles: p("p-2 rounded-md flex items-center"),
156
+ content: {
199
157
  type: "string",
200
- default: "h2",
201
- title: "Level",
202
- enum: ["h1", "h2", "h3", "h4", "h5", "h6"]
158
+ title: "Button label",
159
+ default: "Button"
203
160
  },
204
- styles: p("text-3xl"),
205
- content: {
161
+ icon: {
206
162
  type: "string",
207
- default: "Heading goes here",
208
- title: "Content",
209
- ui: { "ui:widget": "textarea" }
163
+ title: "Icon",
164
+ default: "<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-copy'><path d='M8 17L19 8M8 17V7a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v10'/></svg>",
165
+ ui: { "ui:widget": "icon" }
166
+ },
167
+ iconSize: {
168
+ type: "number",
169
+ title: "Icon size",
170
+ default: 20
210
171
  }
211
172
  }
212
173
  }),
213
- aiProps: ["content"],
214
174
  i18nProps: ["content"],
215
- canAcceptBlock: (e) => e === "Span" || e === "Text"
216
- }, ye = (e) => {
217
- const { blockProps: t, styles: o, content: n } = e;
218
- return Q(e.children) ? h.createElement("p", {
175
+ aiProps: ["content"]
176
+ }, be = (e) => {
177
+ const { blockProps: o, styles: t, htmlCode: l, inBuilder: r } = e;
178
+ return r ? /* @__PURE__ */ f("div", { className: "relative", children: [
179
+ r ? /* @__PURE__ */ s("div", { ...o, ...t, className: "absolute z-20 h-full w-full" }) : null,
180
+ h.createElement("div", {
181
+ ...t,
182
+ dangerouslySetInnerHTML: { __html: l.replace(/<script.*?>.*?<\/script>/g, "") }
183
+ })
184
+ ] }) : h.createElement("div", {
219
185
  ...o,
220
186
  ...t,
221
- dangerouslySetInnerHTML: { __html: n }
222
- }) : h.createElement("p", { ...o, ...t }, e.children);
223
- }, ge = {
224
- type: "Paragraph",
225
- description: "A paragraph component",
226
- label: "Paragraph",
227
- category: "core",
228
- icon: R,
229
- group: "typography",
230
- ...m({
231
- properties: {
232
- styles: p(""),
233
- content: {
234
- type: "string",
235
- title: "Content",
236
- default: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
237
- Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus
238
- nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,
239
- ui: { "ui:widget": "textarea", "ui:autosize": !0, "ui:rows": 5 }
240
- }
241
- }
242
- }),
243
- i18nProps: ["content"],
244
- aiProps: ["content"],
245
- canAcceptBlock: (e) => e === "Span" || e === "Link" || e === "Text"
246
- }, E = (e, ...t) => ({
247
- ...e,
248
- className: L(e.className, ...t)
249
- }), fe = (e) => {
250
- const { blockProps: t, content: o, styles: n } = e, l = E(
251
- n,
252
- "prose dark:prose-invert prose-p:m-0 prose-p:min-h-[1rem] prose-blockquote:m-2 prose-blockquote:ml-4 prose-ul:m-0 prose-ol:m-0 prose-li:m-0",
253
- "max-w-full"
254
- );
255
- return /* @__PURE__ */ i("div", { ...t, ...l, dangerouslySetInnerHTML: { __html: o } });
256
- }, be = {
257
- type: "RichText",
258
- description: "A rich text block",
259
- label: "Rich Text",
187
+ dangerouslySetInnerHTML: { __html: l }
188
+ });
189
+ }, fe = {
190
+ type: "CustomHTML",
191
+ description: "similar to a div or section elements in HTML",
192
+ label: "Custom HTML",
260
193
  category: "core",
261
194
  icon: H,
262
- group: "typography",
263
- ...m({
195
+ group: "advanced",
196
+ ...u({
264
197
  properties: {
265
198
  styles: p(""),
266
- content: {
199
+ htmlCode: {
267
200
  type: "string",
268
- title: "Content",
269
- default: "<p>This is a rich text block. You can add text, and other content here.</p>",
270
- ui: { "ui:widget": "richtext" }
201
+ default: "<div><p>Enter your HTML code here...</p></div>",
202
+ ui: { "ui:widget": "code" }
271
203
  }
272
204
  }
273
- }),
274
- aiProps: ["content"],
275
- i18nProps: ["content"]
205
+ })
276
206
  }, he = (e) => {
277
- const { blockProps: t, styles: o, content: n, children: l = null, tag: r } = e;
278
- return l ? h.createElement("span", { ...o, ...t }, l) : h.createElement(r || "span", {
279
- ...o,
280
- ...t,
281
- dangerouslySetInnerHTML: { __html: n || "" }
282
- });
207
+ const { scripts: o, inBuilder: t, blockProps: l } = e;
208
+ return t ? /* @__PURE__ */ s("div", { ...l, children: /* @__PURE__ */ s("div", { className: L("pointer-events-none flex flex-col items-center justify-center p-2", ""), children: /* @__PURE__ */ s("div", { className: "h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800", children: /* @__PURE__ */ s("p", { className: "text-left text-xs text-gray-400", children: "Scripts will be only executed in preview and live mode. Place your script at the bottom of the" }) }) }) }) : /* @__PURE__ */ s("div", { dangerouslySetInnerHTML: { __html: o } });
283
209
  }, ke = {
284
- type: "Span",
285
- description: "A span component",
286
- label: "Span",
287
- category: "core",
288
- group: "typography",
289
- ...m({
290
- properties: {
291
- styles: p(""),
292
- content: {
293
- type: "string",
294
- title: "Content",
295
- default: "",
296
- ui: { "ui:widget": "textarea", "ui:autosize": !0, "ui:rows": 3 }
297
- }
298
- }
299
- }),
300
- aiProps: ["content"],
301
- i18nProps: ["content"],
302
- canAcceptBlock: () => !0
303
- }, we = (e) => {
304
- const { scripts: t, inBuilder: o, blockProps: n } = e;
305
- return o ? /* @__PURE__ */ i("div", { ...n, children: /* @__PURE__ */ i("div", { className: L("pointer-events-none flex flex-col items-center justify-center p-2", ""), children: /* @__PURE__ */ i("div", { className: "h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800", children: /* @__PURE__ */ i("p", { className: "text-left text-xs text-gray-400", children: "Scripts will be only executed in preview and live mode. Place your script at the bottom of the" }) }) }) }) : /* @__PURE__ */ i("div", { dangerouslySetInnerHTML: { __html: t } });
306
- }, ve = {
307
210
  type: "CustomScript",
308
211
  description: "similar to a script element in HTML",
309
212
  label: "Custom Script",
310
213
  category: "core",
311
- icon: ee,
214
+ icon: ie,
312
215
  group: "advanced",
313
- ...m({
216
+ ...u({
314
217
  properties: {
315
218
  scripts: {
316
219
  type: "string",
@@ -321,576 +224,383 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
321
224
  }
322
225
  }
323
226
  })
324
- }, Ce = (e) => {
325
- const { blockProps: t, styles: o } = e;
326
- return v("hr", { ...o, ...t });
327
- }, xe = {
227
+ }, we = (e) => {
228
+ const { blockProps: o, styles: t } = e;
229
+ return w("hr", { ...t, ...o });
230
+ }, Ce = {
328
231
  type: "Divider",
329
232
  description: "A horizontal line component",
330
233
  label: "Divider",
331
234
  category: "core",
332
- icon: z,
235
+ icon: A,
333
236
  group: "basic",
334
- ...m({
237
+ ...u({
335
238
  properties: {
336
239
  styles: p("bg-gray-900 h-0.5 py-2 my-1")
337
240
  }
338
241
  })
339
- }, Le = (e) => {
340
- const { blockProps: t, inBuilder: o, children: n, globalBlock: l } = e;
341
- return o && !l ? /* @__PURE__ */ b(
342
- "div",
343
- {
344
- className: "flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",
345
- ...t,
346
- children: [
347
- /* @__PURE__ */ b("h1", { children: [
348
- "Global Block - ",
349
- l
350
- ] }),
351
- /* @__PURE__ */ i("p", { children: "Choose a block from the sidebar to add it to this page." })
352
- ]
353
- }
354
- ) : h.createElement("span", { ...t }, n);
355
- }, Pe = {
356
- type: "GlobalBlock",
357
- description: "A global block component",
358
- label: "Global Block",
359
- icon: $,
242
+ }, ve = (e) => {
243
+ const { blockProps: o, styles: t, backgroundImage: l } = e;
244
+ let r = {};
245
+ return l && (r = { backgroundImage: `url(${l})` }), h.createElement("div", { ...o, ...t, style: r });
246
+ }, xe = {
247
+ type: "EmptyBox",
248
+ description: "A box component with no children",
249
+ label: "Empty Box",
360
250
  category: "core",
361
251
  group: "basic",
362
- hidden: !0,
363
- ...m({
364
- properties: {
365
- globalBlock: {
366
- type: "string",
367
- title: "Global Block",
368
- default: "",
369
- ui: { "ui:widget": "hidden" }
370
- }
371
- }
372
- })
373
- }, Ie = (e) => {
374
- const { blockProps: t, icon: o, styles: n, width: l, inBuilder: r, height: s } = e, a = E(n, "");
375
- if (w(o))
376
- return /* @__PURE__ */ i(x, { inBuilder: r, className: "h-8 w-14" });
377
- const c = o.replace(/<svg /g, '<svg class="w-[inherit] h-[inherit]" ');
378
- return h.createElement("span", {
379
- ...t,
380
- ...a,
381
- style: {
382
- width: l ? `${l}px` : "auto",
383
- height: s ? `${s}px` : "auto"
384
- },
385
- dangerouslySetInnerHTML: { __html: c }
386
- });
387
- }, Se = {
388
- type: "Icon",
389
- label: "web_blocks.icon",
390
- category: "core",
391
- icon: V,
392
- group: "media",
393
- ...m({
252
+ ...u({
394
253
  properties: {
395
254
  styles: p(""),
396
- icon: {
255
+ backgroundImage: {
397
256
  type: "string",
398
- title: "Icon",
399
- default: '<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>',
400
- ui: { "ui:widget": "icon" }
401
- },
402
- width: {
403
- type: "number",
404
- default: 16,
405
- title: "Width"
406
- },
407
- height: {
408
- type: "number",
409
- default: 16,
410
- title: "Height"
257
+ title: "Background Image",
258
+ default: "",
259
+ ui: { "ui:widget": "image" }
411
260
  }
412
261
  }
413
262
  })
414
263
  }, Be = (e) => {
415
- const { blockProps: t, image: o, mobileImage: n, styles: l, alt: r, height: s, width: a, lazyLoading: c } = e;
416
- return w(o) ? /* @__PURE__ */ i(x, { className: "h-36" }) : /* @__PURE__ */ b("picture", { children: [
417
- n && /* @__PURE__ */ i("source", { srcSet: n, media: "(max-width: 480px)" }),
418
- /* @__PURE__ */ i(
419
- "img",
264
+ const { blockProps: o, fieldName: t, label: l, styles: r, inputStyles: n, required: i, checked: a, showLabel: c = !0 } = e, y = C();
265
+ return c ? /* @__PURE__ */ f("div", { ...r, ...o, children: [
266
+ /* @__PURE__ */ s(
267
+ "input",
420
268
  {
421
- ...t,
422
- ...l,
423
- src: o,
424
- alt: r,
425
- loading: c ? "lazy" : "eager",
426
- width: a,
427
- height: s
269
+ ...n,
270
+ name: t,
271
+ id: y,
272
+ type: "checkbox",
273
+ required: i,
274
+ defaultChecked: a
428
275
  }
429
- )
430
- ] });
431
- }, _e = {
432
- type: "Image",
433
- description: "A image component",
434
- label: "Image",
276
+ ),
277
+ l && /* @__PURE__ */ s("label", { htmlFor: y, children: l })
278
+ ] }) : /* @__PURE__ */ s(
279
+ "input",
280
+ {
281
+ id: y,
282
+ ...o,
283
+ ...n,
284
+ ...r,
285
+ type: "checkbox",
286
+ required: i,
287
+ name: t
288
+ }
289
+ );
290
+ }, Le = {
291
+ type: "Checkbox",
292
+ label: "web_blocks.checkbox",
435
293
  category: "core",
436
- icon: j,
437
- group: "media",
438
- ...m({
294
+ icon: z,
295
+ group: "form",
296
+ ...u({
439
297
  properties: {
440
- styles: p(""),
441
- image: {
298
+ styles: p("flex items-center gap-x-2"),
299
+ inputStyles: p(""),
300
+ fieldName: {
442
301
  type: "string",
443
- title: "Image",
444
- default: "https://fakeimg.pl/400x200?text=Choose&font=bebas",
445
- ui: { "ui:widget": "image" }
302
+ title: "Field Name",
303
+ default: "fieldName"
446
304
  },
447
- alt: {
305
+ label: {
448
306
  type: "string",
449
- title: "Alt text",
450
- default: "",
451
- ui: { "ui:placeholder": "Enter alt text" }
307
+ title: "Label",
308
+ default: "Label"
452
309
  },
453
- lazyLoading: {
310
+ checked: {
454
311
  type: "boolean",
455
- title: "Lazy Load",
456
- default: !0
457
- },
458
- width: {
459
- type: "number",
460
- title: "Width",
461
- default: "",
462
- ui: { "ui:placeholder": "Enter width" }
312
+ title: "Checked",
313
+ default: !1
463
314
  },
464
- height: {
465
- type: "number",
466
- title: "Height",
467
- default: "",
468
- ui: { "ui:placeholder": "Enter height" }
315
+ required: {
316
+ type: "boolean",
317
+ title: "Required",
318
+ default: !1
469
319
  },
470
- mobileImage: {
471
- type: "string",
472
- title: "Mobile Image",
473
- default: "",
474
- ui: { "ui:widget": "image" }
320
+ showLabel: {
321
+ type: "boolean",
322
+ title: "Show Label",
323
+ default: !0
475
324
  }
476
325
  }
477
326
  }),
478
- aiProps: ["alt"],
479
- i18nProps: ["alt"]
480
- }, Ne = (e) => {
481
- const { blockProps: t, link: o, children: n, styles: l, inBuilder: r, content: s } = e;
482
- let a = {};
483
- return !n && w(s) && (a = { minHeight: "50px", display: "flex", alignItems: "center", justifyContent: "center" }), r ? n ? /* @__PURE__ */ i("span", { ...t, style: a, ...l, children: n }) : v(
484
- "span",
485
- {
486
- ...t,
487
- ...l,
488
- style: a
489
- },
490
- s
491
- ) : n ? /* @__PURE__ */ i("a", { "aria-label": s, href: (o == null ? void 0 : o.href) || "#/", target: o == null ? void 0 : o.target, ...t, ...l, children: n }) : v(
492
- "a",
327
+ aiProps: ["label"],
328
+ i18nProps: ["label"]
329
+ }, Ie = (e) => {
330
+ const { children: o, blockProps: t, errorMessage: l, successMessage: r, action: n, styles: i, inBuilder: a } = e;
331
+ let c = o;
332
+ return o || (c = /* @__PURE__ */ s(x, { inBuilder: a })), /* @__PURE__ */ f(
333
+ "form",
493
334
  {
335
+ ...{
336
+ "x-data": "{}",
337
+ "x-on:submit.prevent": "post"
338
+ },
339
+ "data-error": l,
340
+ "data-success": r,
341
+ method: "post",
342
+ action: n,
494
343
  ...t,
495
- ...l,
496
- href: (o == null ? void 0 : o.href) || "#",
497
- target: (o == null ? void 0 : o.target) || "_self",
498
- "aria-label": s
499
- },
500
- s
344
+ ...i,
345
+ children: [
346
+ /* @__PURE__ */ s("div", { ...{
347
+ "x-html": "",
348
+ ":class": "{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"
349
+ } }),
350
+ c
351
+ ]
352
+ }
501
353
  );
502
- }, Me = {
503
- type: "Link",
504
- description: "A link component",
505
- label: "Link",
354
+ }, Pe = {
355
+ type: "Form",
356
+ label: "Form",
506
357
  category: "core",
507
- icon: q,
508
- group: "basic",
509
- ...m({
358
+ icon: se,
359
+ group: "form",
360
+ blocks: () => [
361
+ { _type: "Form", _id: "form", styles: "#styles:p-1 space-y-2," },
362
+ { _type: "Input", _id: "form_input", _parent: "form", styles: "#styles:," },
363
+ {
364
+ _type: "FormButton",
365
+ _id: "form_submit_btn",
366
+ _parent: "form",
367
+ styles: "#styles:bg-black text-white rounded px-3 py-1,"
368
+ }
369
+ ],
370
+ ...u({
510
371
  properties: {
511
372
  styles: p(""),
512
- content: {
373
+ action: {
513
374
  type: "string",
514
- default: "Link goes here",
515
- title: "Content"
375
+ title: "Submit URL",
376
+ default: "/api/form"
516
377
  },
517
- link: {
518
- type: "object",
519
- properties: {
520
- type: { type: "string" },
521
- href: { type: "string" },
522
- target: { type: "string" }
523
- },
524
- default: {
525
- type: "url",
526
- href: "",
527
- target: "_self"
528
- },
529
- ui: {
530
- "ui:field": "link"
531
- }
378
+ errorMessage: {
379
+ type: "string",
380
+ title: "Error Message",
381
+ default: "Something went wrong. Please try again",
382
+ ui: { "ui:widget": "richtext" }
383
+ },
384
+ successMessage: {
385
+ type: "string",
386
+ title: "Success Message",
387
+ default: "Thank you for your submission.",
388
+ ui: { "ui:widget": "richtext" }
532
389
  }
533
390
  }
534
391
  }),
535
- aiProps: ["content"],
536
- i18nProps: ["content"],
537
- canAcceptBlock: (e) => e !== "Link"
538
- }, $e = (e) => {
539
- const { blockProps: t, children: o, listType: n, styles: l, tag: r, inBuilder: s } = e, a = L(f(l, "className", ""), n);
540
- return !o && w(l == null ? void 0 : l.className) ? /* @__PURE__ */ i(x, { inBuilder: s }) : h.createElement(
541
- r || (n === "list-decimal" ? "ol" : "ul"),
542
- { ...t, ...l, className: a },
543
- o
392
+ i18nProps: ["errorMessage", "successMessage"],
393
+ aiProps: ["errorMessage", "successMessage"],
394
+ canAcceptBlock: () => !0
395
+ }, Se = (e) => {
396
+ const { blockProps: o, inBuilder: t, label: l, styles: r, inputStyles: n, icon: i, iconSize: a, iconPos: c } = e, y = C();
397
+ return /* @__PURE__ */ f(
398
+ "button",
399
+ {
400
+ id: y,
401
+ ...{
402
+ "x-bind:disabled": "formLoading"
403
+ },
404
+ ...n,
405
+ ...r,
406
+ ...o || {},
407
+ type: t ? "button" : "submit",
408
+ "aria-label": l,
409
+ children: [
410
+ l,
411
+ i && /* @__PURE__ */ s(
412
+ "div",
413
+ {
414
+ style: { width: a + "px" },
415
+ className: c + " " + (c === "order-first" ? "mr-2" : "ml-2") || "",
416
+ dangerouslySetInnerHTML: { __html: i }
417
+ }
418
+ )
419
+ ]
420
+ }
544
421
  );
545
- }, Ee = {
546
- type: "List",
547
- description: "A list component",
548
- label: "List",
549
- icon: F,
422
+ }, _e = {
423
+ type: "FormButton",
424
+ label: "Submit Button",
550
425
  category: "core",
551
- group: "basic",
552
- ...m({
426
+ icon: N,
427
+ group: "form",
428
+ ...u({
553
429
  properties: {
554
- styles: p(""),
555
- listType: {
430
+ styles: p(
431
+ "text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"
432
+ ),
433
+ inputStyles: p(""),
434
+ label: {
556
435
  type: "string",
557
- title: "List Type",
558
- default: "list-none",
559
- oneOf: [
560
- { enum: ["list-none"], title: "List None" },
561
- { enum: ["list-disc"], title: "Disc" },
562
- { enum: ["list-decimal"], title: "Decimal" }
563
- ]
436
+ title: "Label",
437
+ default: "Submit",
438
+ ai: !0,
439
+ i18n: !0
440
+ },
441
+ icon: {
442
+ type: "string",
443
+ title: "Icon",
444
+ default: "",
445
+ ui: { "ui:widget": "icon" }
446
+ },
447
+ iconSize: {
448
+ type: "number",
449
+ title: "Icon size",
450
+ default: 24
451
+ },
452
+ iconPos: {
453
+ type: "string",
454
+ title: "Icon Position",
455
+ default: "order-last",
456
+ enum: ["order-first", "order-last"]
564
457
  }
565
458
  }
566
459
  }),
567
- canAcceptBlock: (e) => e === "ListItem",
568
- blocks: [
569
- { _type: "List", _id: "a", listType: "list-none", styles: "#styles:," },
570
- {
571
- _type: "ListItem",
572
- _id: "b",
573
- _parent: "a",
574
- styles: "#styles:,",
575
- content: "Item 1"
576
- },
577
- {
578
- _type: "ListItem",
579
- _id: "c",
580
- _parent: "a",
581
- styles: "#styles:,",
582
- content: "Item 2"
583
- },
460
+ i18nProps: ["label"],
461
+ aiProps: ["label"]
462
+ }, Te = (e) => {
463
+ const {
464
+ blockProps: o,
465
+ fieldName: t,
466
+ label: l,
467
+ placeholder: r,
468
+ styles: n,
469
+ inputStyles: i,
470
+ showLabel: a,
471
+ required: c,
472
+ inputType: y,
473
+ autocomplete: k
474
+ } = e, g = C();
475
+ return a ? /* @__PURE__ */ f("div", { ...n, ...o, children: [
476
+ a && /* @__PURE__ */ s("label", { htmlFor: g, children: l }),
477
+ /* @__PURE__ */ s(
478
+ "input",
479
+ {
480
+ name: t,
481
+ ...i,
482
+ id: g,
483
+ type: y,
484
+ placeholder: r,
485
+ required: c,
486
+ autoComplete: k ? "on" : "off"
487
+ }
488
+ )
489
+ ] }) : /* @__PURE__ */ s(
490
+ "input",
584
491
  {
585
- _type: "ListItem",
586
- _id: "d",
587
- _parent: "a",
588
- styles: "#styles:,",
589
- content: "Item 3"
492
+ id: g,
493
+ name: t,
494
+ ...o,
495
+ ...i,
496
+ ...n,
497
+ type: y,
498
+ placeholder: r,
499
+ required: c,
500
+ autoComplete: k ? "on" : "off"
590
501
  }
591
- ]
592
- }, Te = (e) => {
593
- const { blockProps: t, content: o, styles: n, children: l, tag: r } = e;
594
- return l ? h.createElement(r || "li", { ...n, ...t }, l) : h.createElement(r || "li", {
595
- ...n,
596
- ...t,
597
- dangerouslySetInnerHTML: { __html: o }
598
- });
599
- }, Ae = {
600
- type: "ListItem",
601
- description: "A list item component",
602
- label: "List Item",
603
- icon: U,
502
+ );
503
+ }, Ne = {
504
+ type: "Input",
505
+ label: "web_blocks.input",
604
506
  category: "core",
605
- group: "basic",
606
- ...m({
507
+ icon: M,
508
+ group: "form",
509
+ ...u({
607
510
  properties: {
608
511
  styles: p(""),
609
- content: {
512
+ inputStyles: p("w-full p-1"),
513
+ fieldName: {
610
514
  type: "string",
611
- default: "List item",
612
- title: "Content",
613
- ui: {
614
- "ui:widget": "textarea"
615
- }
616
- }
617
- }
618
- }),
619
- i18nProps: ["content"],
620
- aiProps: ["content"],
621
- canAcceptBlock: (e) => e !== "ListItem",
622
- canBeNested: (e) => e === "List"
623
- }, Re = (e) => e.inBuilder || e.forceWrapper ? /* @__PURE__ */ i("span", { ...e.blockProps, children: e.content }) : `${e.content}`, He = {
624
- type: "Text",
625
- description: "A text component with no styling",
626
- label: "Text",
627
- hidden: !0,
628
- category: "core",
629
- group: "typography",
630
- icon: D,
631
- ...m({
632
- properties: {
633
- styles: p("text-black"),
634
- content: {
635
- title: "Content",
515
+ title: "Field Name",
516
+ default: "fieldName"
517
+ },
518
+ showLabel: {
519
+ type: "boolean",
520
+ title: "Show Label",
521
+ default: !0
522
+ },
523
+ label: {
636
524
  type: "string",
637
- default: ""
638
- }
639
- }
640
- }),
641
- aiProps: ["content"],
642
- i18nProps: ["content"]
643
- }, ze = {
644
- type: "object",
645
- title: "Controls",
646
- default: {
647
- autoplay: !0,
648
- controls: !1,
649
- loop: !0,
650
- muted: !0
651
- },
652
- properties: {
653
- autoplay: {
654
- type: "boolean",
655
- title: "Autoplay",
656
- default: !1
657
- },
658
- controls: {
659
- type: "boolean",
660
- title: "Show Controls",
661
- default: !0
662
- },
663
- loop: {
664
- type: "boolean",
665
- title: "Loop Video",
666
- default: !1
667
- },
668
- muted: {
669
- type: "boolean",
670
- title: "Muted",
671
- default: !1
672
- }
673
- }
674
- }, S = /^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/, B = /(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/, Ve = (e, t) => {
675
- const o = f(t, "autoplay", !1), n = f(t, "controls", !1), l = f(t, "loop", !1), r = o || f(t, "muted", !0);
676
- if (S.test(e)) {
677
- const s = e.match(S);
678
- if (s) {
679
- const a = s[4];
680
- let c = `https://www.youtube.com/embed/${a}`, u = o ? "autoplay=1" : "";
681
- return u += l ? `&loop=1&playlist=${a}` : "", u += r ? "&mute=1&muted=1" : "", u += n ? "&controls=1" : "&controls=0", `${c}?${u}`;
682
- }
683
- }
684
- if (B.test(e)) {
685
- const s = e.match(B);
686
- if (s) {
687
- const a = s[1];
688
- let c = "";
689
- return c += o ? "autoplay=1" : "", c += n ? "&controls=1" : "&controls=0", c += r ? "&muted=1" : "", c += l ? "&loop=1" : "", `https://player.vimeo.com/video/${a}?${c}`;
690
- }
691
- }
692
- return null;
693
- }, je = (e) => {
694
- const { url: t, blockProps: o, styles: n, controls: l, videoSource: r, inBuilder: s } = e, a = Ve(t, l);
695
- return /* @__PURE__ */ b("div", { ...Z(n, "className"), className: "relative w-full overflow-hidden", style: { paddingBottom: "56.25%" }, children: [
696
- !a && s ? /* @__PURE__ */ i("div", { className: "absolute flex h-full w-full items-center justify-center bg-gray-300 text-center", children: w(t) ? `Provided ${r} video link in settings Video URL.` : `Provided ${r} video link is invalid.` }) : /* @__PURE__ */ i("iframe", { width: "100%", src: a, ...K(n, "className") }),
697
- s && /* @__PURE__ */ i("div", { ...o, className: "absolute top-0 h-full w-full" })
698
- ] });
699
- }, qe = (e) => {
700
- const { url: t, styles: o, controls: n, sources: l, poster: r, blockProps: s } = e;
701
- let a = r;
702
- const c = [...f(l, "srcsets", []) || []];
703
- t && typeof t == "string" && c.push({ url: t, width: "9999" });
704
- const u = c.sort((g, y) => parseInt(g.width) - parseInt(y.width)).filter((g) => !w(g.url) && !w(g.width));
705
- u.length === 0 && !a && (a = "https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");
706
- const k = f(n, "autoplay", !1) || f(n, "muted", !0);
707
- return (a || !w(u)) && /* @__PURE__ */ i("div", { className: "relative w-full overflow-hidden", style: { paddingBottom: "56.25%" }, children: /* @__PURE__ */ v(
708
- "video",
709
- {
710
- ...o,
711
- ...s,
712
- key: JSON.stringify(u),
713
- controls: f(n, "controls", !1),
714
- autoPlay: f(n, "autoplay", !1),
715
- loop: f(n, "loop", !1),
716
- poster: a,
717
- ...k ? { muted: !0 } : {}
718
- },
719
- u.map((g) => {
720
- if (!g.url || g.url.length < 4 || isNaN(g.width)) return null;
721
- const y = `(max-width: ${g.width}px)`;
722
- return /* @__PURE__ */ i("source", { src: g.url, media: y, type: g.type }, g.url);
723
- }),
724
- "Your browser does not support the video tag."
725
- ) });
726
- }, Fe = (e) => {
727
- const { videoSource: t } = e;
728
- return t === "Custom" ? /* @__PURE__ */ i(qe, { ...e }) : t === "Youtube" || t === "Vimeo" ? /* @__PURE__ */ i(je, { ...e }) : /* @__PURE__ */ b("div", { children: [
729
- "Invalid video source : ",
730
- t
731
- ] });
732
- }, Ue = {
733
- type: "Video",
734
- label: "Video",
735
- category: "core",
736
- icon: G,
737
- group: "media",
738
- ...m({
739
- properties: {
740
- styles: p("absolute h-full w-full object-cover"),
741
- videoSource: {
525
+ title: "Label",
526
+ default: "Label",
527
+ ai: !0,
528
+ i18n: !0
529
+ },
530
+ placeholder: {
742
531
  type: "string",
743
- default: "Custom",
744
- enum: ["Custom", "Youtube", "Vimeo"],
745
- title: "Video source"
746
- }
747
- },
748
- allOf: [
749
- {
750
- if: {
751
- properties: {
752
- videoSource: { const: "Custom" }
753
- }
754
- },
755
- then: {
756
- properties: {
757
- url: {
758
- type: "string",
759
- title: "Video URL",
760
- default: ""
761
- },
762
- poster: {
763
- type: "string",
764
- title: "Poster URL",
765
- default: ""
766
- },
767
- sources: {
768
- type: "object",
769
- default: { srcsets: [] }
770
- },
771
- controls: { ...ze }
772
- }
773
- }
532
+ title: "Placeholder",
533
+ default: "Placeholder"
774
534
  },
775
- {
776
- if: {
777
- properties: {
778
- videoSource: { const: "Youtube" }
779
- }
780
- },
781
- then: {
782
- properties: {
783
- url: {
784
- type: "string",
785
- title: "Youtube Video URL",
786
- default: ""
787
- }
788
- }
789
- }
535
+ inputType: {
536
+ type: "string",
537
+ title: "Input Type",
538
+ default: "text",
539
+ enum: ["text", "email", "password", "number", "tel", "hidden", "range", "color", "date", "time"]
790
540
  },
791
- {
792
- if: {
793
- properties: {
794
- videoSource: { const: "Vimeo" }
795
- }
796
- },
797
- then: {
798
- properties: {
799
- url: {
800
- type: "string",
801
- title: "Vimeo Video URL",
802
- default: ""
803
- }
804
- }
805
- }
541
+ required: {
542
+ type: "boolean",
543
+ title: "Required",
544
+ default: !1
545
+ },
546
+ autocomplete: {
547
+ type: "boolean",
548
+ title: "Autocomplete",
549
+ default: !0
806
550
  }
807
- ],
808
- ui: {
809
- url: { "ui:placeholder": "Enter Video URL" },
810
- sources: { "ui:field": "sources" },
811
- poster: { "ui:placeholder": "Enter poster URL" }
812
551
  }
813
552
  }),
814
- i18nProps: ["url"]
815
- }, De = (e) => {
816
- const { blockProps: t, iconSize: o, icon: n, content: l, styles: r } = e, s = n, a = /* @__PURE__ */ b(_, { children: [
817
- /* @__PURE__ */ i("span", { "data-ai-key": "content", children: l }),
818
- s && /* @__PURE__ */ i("div", { style: { width: o + "px" }, dangerouslySetInnerHTML: { __html: s } })
819
- ] });
820
- return v(
821
- "button",
822
- {
823
- ...t,
824
- ...r,
825
- type: "button",
826
- "aria-label": l
827
- },
828
- a
829
- );
830
- }, Ge = {
831
- type: "CopyButton",
832
- description: "A copy button component",
833
- label: "Copy Button",
553
+ aiProps: ["label", "placeholder"],
554
+ i18nProps: ["label", "placeholder"]
555
+ }, Me = (e) => {
556
+ const { blockProps: o, content: t, styles: l, children: r } = e, n = { ...l, ...o };
557
+ return r ? h.createElement("label", n, r) : h.createElement("label", {
558
+ ...n,
559
+ dangerouslySetInnerHTML: { __html: t }
560
+ });
561
+ }, $e = {
562
+ type: "Label",
563
+ label: "Label",
834
564
  category: "core",
835
- icon: O,
836
- group: "basic",
837
- ...m({
565
+ icon: V,
566
+ group: "form",
567
+ ...u({
838
568
  properties: {
839
- styles: p("p-2 rounded-md flex items-center"),
569
+ styles: p(),
840
570
  content: {
841
571
  type: "string",
842
- title: "Button label",
843
- default: "Button"
844
- },
845
- icon: {
846
- type: "string",
847
- title: "Icon",
848
- default: "<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-copy'><path d='M8 17L19 8M8 17V7a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v10'/></svg>",
849
- ui: { "ui:widget": "icon" }
850
- },
851
- iconSize: {
852
- type: "number",
853
- title: "Icon size",
854
- default: 20
572
+ title: "Content",
573
+ default: ""
855
574
  }
856
575
  }
857
576
  }),
858
- i18nProps: ["content"],
859
- aiProps: ["content"]
860
- }, Oe = (e) => {
861
- const { blockProps: t, fieldName: o, label: n, styles: l, inputStyles: r, required: s, checked: a, showLabel: c = !0 } = e, u = C();
862
- return c ? /* @__PURE__ */ b("div", { ...l, ...t, children: [
863
- /* @__PURE__ */ i(
864
- "input",
865
- {
866
- ...r,
867
- name: o,
868
- id: u,
869
- type: "checkbox",
870
- required: s,
871
- defaultChecked: a
872
- }
873
- ),
874
- n && /* @__PURE__ */ i("label", { htmlFor: u, children: n })
875
- ] }) : /* @__PURE__ */ i(
577
+ aiProps: ["content"],
578
+ i18nProps: ["content"]
579
+ }, Ee = (e) => {
580
+ const { blockProps: o, fieldName: t, label: l, styles: r, inputStyles: n, required: i, checked: a, showLabel: c = !0 } = e, y = C();
581
+ return c ? /* @__PURE__ */ f("div", { ...r, ...o, children: [
582
+ /* @__PURE__ */ s("input", { ...n, name: t, id: y, type: "radio", required: i, defaultChecked: a }),
583
+ l && /* @__PURE__ */ s("label", { htmlFor: y, children: l })
584
+ ] }) : /* @__PURE__ */ s(
876
585
  "input",
877
586
  {
878
- id: u,
879
- ...t,
587
+ id: y,
588
+ ...o,
589
+ ...n,
880
590
  ...r,
881
- ...l,
882
- type: "checkbox",
883
- required: s,
884
- name: o
591
+ type: "radio",
592
+ required: i,
593
+ checked: a,
594
+ name: t
885
595
  }
886
596
  );
887
- }, Ye = {
888
- type: "Checkbox",
889
- label: "web_blocks.checkbox",
597
+ }, Re = {
598
+ type: "Radio",
599
+ label: "web_blocks.radio",
890
600
  category: "core",
891
- icon: Y,
601
+ icon: j,
892
602
  group: "form",
893
- ...m({
603
+ ...u({
894
604
  properties: {
895
605
  styles: p("flex items-center gap-x-2"),
896
606
  inputStyles: p(""),
@@ -923,332 +633,25 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
923
633
  }),
924
634
  aiProps: ["label"],
925
635
  i18nProps: ["label"]
926
- }, We = (e) => {
927
- const { children: t, blockProps: o, errorMessage: n, successMessage: l, action: r, styles: s, inBuilder: a } = e;
928
- let c = t;
929
- return t || (c = /* @__PURE__ */ i(x, { inBuilder: a })), /* @__PURE__ */ b(
930
- "form",
931
- {
932
- ...{
933
- "x-data": "{}",
934
- "x-on:submit.prevent": "post"
935
- },
936
- "data-error": n,
937
- "data-success": l,
938
- method: "post",
939
- action: r,
940
- ...o,
941
- ...s,
942
- children: [
943
- /* @__PURE__ */ i("div", { ...{
944
- "x-html": "",
945
- ":class": "{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"
946
- } }),
947
- c
948
- ]
949
- }
950
- );
951
- }, Xe = {
952
- type: "Form",
953
- label: "Form",
954
- category: "core",
955
- icon: te,
956
- group: "form",
957
- blocks: () => [
958
- { _type: "Form", _id: "form", styles: "#styles:p-1 space-y-2," },
959
- { _type: "Input", _id: "form_input", _parent: "form", styles: "#styles:," },
960
- {
961
- _type: "FormButton",
962
- _id: "form_submit_btn",
963
- _parent: "form",
964
- styles: "#styles:bg-black text-white rounded px-3 py-1,"
965
- }
966
- ],
967
- ...m({
968
- properties: {
969
- styles: p(""),
970
- action: {
971
- type: "string",
972
- title: "Submit URL",
973
- default: "/api/form"
974
- },
975
- errorMessage: {
976
- type: "string",
977
- title: "Error Message",
978
- default: "Something went wrong. Please try again",
979
- ui: { "ui:widget": "richtext" }
980
- },
981
- successMessage: {
982
- type: "string",
983
- title: "Success Message",
984
- default: "Thank you for your submission.",
985
- ui: { "ui:widget": "richtext" }
986
- }
987
- }
988
- }),
989
- i18nProps: ["errorMessage", "successMessage"],
990
- aiProps: ["errorMessage", "successMessage"],
991
- canAcceptBlock: () => !0
992
- }, Je = (e) => {
993
- const { blockProps: t, inBuilder: o, label: n, styles: l, inputStyles: r, icon: s, iconSize: a, iconPos: c } = e, u = C();
994
- return /* @__PURE__ */ b(
995
- "button",
996
- {
997
- id: u,
998
- ...{
999
- "x-bind:disabled": "formLoading"
1000
- },
1001
- ...r,
1002
- ...l,
1003
- ...t || {},
1004
- type: o ? "button" : "submit",
1005
- "aria-label": n,
1006
- children: [
1007
- n,
1008
- s && /* @__PURE__ */ i(
1009
- "div",
1010
- {
1011
- style: { width: a + "px" },
1012
- className: c + " " + (c === "order-first" ? "mr-2" : "ml-2") || "",
1013
- dangerouslySetInnerHTML: { __html: s }
1014
- }
1015
- )
1016
- ]
1017
- }
1018
- );
1019
- }, Qe = {
1020
- type: "FormButton",
1021
- label: "Submit Button",
1022
- category: "core",
1023
- icon: N,
1024
- group: "form",
1025
- ...m({
1026
- properties: {
1027
- styles: p(
1028
- "text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"
1029
- ),
1030
- inputStyles: p(""),
1031
- label: {
1032
- type: "string",
1033
- title: "Label",
1034
- default: "Submit",
1035
- ai: !0,
1036
- i18n: !0
1037
- },
1038
- icon: {
1039
- type: "string",
1040
- title: "Icon",
1041
- default: "",
1042
- ui: { "ui:widget": "icon" }
1043
- },
1044
- iconSize: {
1045
- type: "number",
1046
- title: "Icon size",
1047
- default: 24
1048
- },
1049
- iconPos: {
1050
- type: "string",
1051
- title: "Icon Position",
1052
- default: "order-last",
1053
- enum: ["order-first", "order-last"]
1054
- }
1055
- }
1056
- }),
1057
- i18nProps: ["label"],
1058
- aiProps: ["label"]
1059
- }, Ze = (e) => {
1060
- const {
1061
- blockProps: t,
1062
- fieldName: o,
1063
- label: n,
1064
- placeholder: l,
1065
- styles: r,
1066
- inputStyles: s,
1067
- showLabel: a,
1068
- required: c,
1069
- inputType: u,
1070
- autocomplete: k
1071
- } = e, g = C();
1072
- return a ? /* @__PURE__ */ b("div", { ...r, ...t, children: [
1073
- a && /* @__PURE__ */ i("label", { htmlFor: g, children: n }),
1074
- /* @__PURE__ */ i(
1075
- "input",
1076
- {
1077
- name: o,
1078
- ...s,
1079
- id: g,
1080
- type: u,
1081
- placeholder: l,
1082
- required: c,
1083
- autoComplete: k ? "on" : "off"
1084
- }
1085
- )
1086
- ] }) : /* @__PURE__ */ i(
1087
- "input",
1088
- {
1089
- id: g,
1090
- name: o,
1091
- ...t,
1092
- ...s,
1093
- ...r,
1094
- type: u,
1095
- placeholder: l,
1096
- required: c,
1097
- autoComplete: k ? "on" : "off"
1098
- }
1099
- );
1100
- }, Ke = {
1101
- type: "Input",
1102
- label: "web_blocks.input",
1103
- category: "core",
1104
- icon: M,
1105
- group: "form",
1106
- ...m({
1107
- properties: {
1108
- styles: p(""),
1109
- inputStyles: p("w-full p-1"),
1110
- fieldName: {
1111
- type: "string",
1112
- title: "Field Name",
1113
- default: "fieldName"
1114
- },
1115
- showLabel: {
1116
- type: "boolean",
1117
- title: "Show Label",
1118
- default: !0
1119
- },
1120
- label: {
1121
- type: "string",
1122
- title: "Label",
1123
- default: "Label",
1124
- ai: !0,
1125
- i18n: !0
1126
- },
1127
- placeholder: {
1128
- type: "string",
1129
- title: "Placeholder",
1130
- default: "Placeholder"
1131
- },
1132
- inputType: {
1133
- type: "string",
1134
- title: "Input Type",
1135
- default: "text",
1136
- enum: ["text", "email", "password", "number", "tel", "hidden", "range", "color", "date", "time"]
1137
- },
1138
- required: {
1139
- type: "boolean",
1140
- title: "Required",
1141
- default: !1
1142
- },
1143
- autocomplete: {
1144
- type: "boolean",
1145
- title: "Autocomplete",
1146
- default: !0
1147
- }
1148
- }
1149
- }),
1150
- aiProps: ["label", "placeholder"],
1151
- i18nProps: ["label", "placeholder"]
1152
- }, et = (e) => {
1153
- const { blockProps: t, content: o, styles: n, children: l } = e, r = { ...n, ...t };
1154
- return l ? h.createElement("label", r, l) : h.createElement("label", {
1155
- ...r,
1156
- dangerouslySetInnerHTML: { __html: o }
1157
- });
1158
- }, tt = {
1159
- type: "Label",
1160
- label: "Label",
1161
- category: "core",
1162
- icon: W,
1163
- group: "form",
1164
- ...m({
1165
- properties: {
1166
- styles: p(),
1167
- content: {
1168
- type: "string",
1169
- title: "Content",
1170
- default: ""
1171
- }
1172
- }
1173
- }),
1174
- aiProps: ["content"],
1175
- i18nProps: ["content"]
1176
- }, ot = (e) => {
1177
- const { blockProps: t, fieldName: o, label: n, styles: l, inputStyles: r, required: s, checked: a, showLabel: c = !0 } = e, u = C();
1178
- return c ? /* @__PURE__ */ b("div", { ...l, ...t, children: [
1179
- /* @__PURE__ */ i("input", { ...r, name: o, id: u, type: "radio", required: s, defaultChecked: a }),
1180
- n && /* @__PURE__ */ i("label", { htmlFor: u, children: n })
1181
- ] }) : /* @__PURE__ */ i(
1182
- "input",
1183
- {
1184
- id: u,
1185
- ...t,
1186
- ...r,
1187
- ...l,
1188
- type: "radio",
1189
- required: s,
1190
- checked: a,
1191
- name: o
1192
- }
1193
- );
1194
- }, lt = {
1195
- type: "Radio",
1196
- label: "web_blocks.radio",
1197
- category: "core",
1198
- icon: X,
1199
- group: "form",
1200
- ...m({
1201
- properties: {
1202
- styles: p("flex items-center gap-x-2"),
1203
- inputStyles: p(""),
1204
- fieldName: {
1205
- type: "string",
1206
- title: "Field Name",
1207
- default: "fieldName"
1208
- },
1209
- label: {
1210
- type: "string",
1211
- title: "Label",
1212
- default: "Label"
1213
- },
1214
- checked: {
1215
- type: "boolean",
1216
- title: "Checked",
1217
- default: !1
1218
- },
1219
- required: {
1220
- type: "boolean",
1221
- title: "Required",
1222
- default: !1
1223
- },
1224
- showLabel: {
1225
- type: "boolean",
1226
- title: "Show Label",
1227
- default: !0
1228
- }
1229
- }
1230
- }),
1231
- aiProps: ["label"],
1232
- i18nProps: ["label"]
1233
- }, nt = (e) => {
1234
- const { blockProps: t, fieldName: o, label: n, placeholder: l, styles: r, inputStyles: s, required: a, showLabel: c, _multiple: u, options: k } = e, g = C();
1235
- return c ? /* @__PURE__ */ b("div", { ...r, ...t, children: [
1236
- c && /* @__PURE__ */ i("label", { htmlFor: g, children: n }),
1237
- /* @__PURE__ */ b("select", { ...s, id: g, required: a, multiple: u, name: o, children: [
1238
- /* @__PURE__ */ i("option", { value: "", disabled: !0, selected: !0, hidden: !0, children: l }),
1239
- I(k, (y) => /* @__PURE__ */ i("option", { value: y == null ? void 0 : y.value, children: y == null ? void 0 : y.label }, y == null ? void 0 : y.value))
636
+ }, He = (e) => {
637
+ const { blockProps: o, fieldName: t, label: l, placeholder: r, styles: n, inputStyles: i, required: a, showLabel: c, _multiple: y, options: k } = e, g = C();
638
+ return c ? /* @__PURE__ */ f("div", { ...n, ...o, children: [
639
+ c && /* @__PURE__ */ s("label", { htmlFor: g, children: l }),
640
+ /* @__PURE__ */ f("select", { ...i, id: g, required: a, multiple: y, name: t, children: [
641
+ /* @__PURE__ */ s("option", { value: "", disabled: !0, selected: !0, hidden: !0, children: r }),
642
+ P(k, (m) => /* @__PURE__ */ s("option", { value: m == null ? void 0 : m.value, children: m == null ? void 0 : m.label }, m == null ? void 0 : m.value))
1240
643
  ] })
1241
- ] }) : /* @__PURE__ */ b("select", { id: g, ...r, ...t, required: a, multiple: u, name: o, children: [
1242
- /* @__PURE__ */ i("option", { value: "", disabled: !0, selected: !0, hidden: !0, children: l }),
1243
- I(k, (y) => /* @__PURE__ */ i("option", { value: y == null ? void 0 : y.value, children: y == null ? void 0 : y.label }, y == null ? void 0 : y.value))
644
+ ] }) : /* @__PURE__ */ f("select", { id: g, ...n, ...o, required: a, multiple: y, name: t, children: [
645
+ /* @__PURE__ */ s("option", { value: "", disabled: !0, selected: !0, hidden: !0, children: r }),
646
+ P(k, (m) => /* @__PURE__ */ s("option", { value: m == null ? void 0 : m.value, children: m == null ? void 0 : m.label }, m == null ? void 0 : m.value))
1244
647
  ] });
1245
- }, rt = {
648
+ }, Ae = {
1246
649
  type: "Select",
1247
650
  label: "web_blocks.select",
1248
651
  category: "core",
1249
- icon: J,
652
+ icon: q,
1250
653
  group: "form",
1251
- ...m({
654
+ ...u({
1252
655
  properties: {
1253
656
  styles: p(""),
1254
657
  inputStyles: p("w-full p-1"),
@@ -1306,41 +709,41 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
1306
709
  }),
1307
710
  aiProps: ["label", "placeholder"],
1308
711
  i18nProps: ["label", "placeholder"]
1309
- }, it = (e) => {
1310
- const { blockProps: t, fieldName: o, label: n, placeholder: l, styles: r, inputStyles: s, rows: a, showLabel: c, required: u } = e, k = C();
1311
- return c ? /* @__PURE__ */ b("div", { ...r, ...t, children: [
1312
- c && /* @__PURE__ */ i("label", { htmlFor: k, children: n }),
1313
- /* @__PURE__ */ i(
712
+ }, ze = (e) => {
713
+ const { blockProps: o, fieldName: t, label: l, placeholder: r, styles: n, inputStyles: i, rows: a, showLabel: c, required: y } = e, k = C();
714
+ return c ? /* @__PURE__ */ f("div", { ...n, ...o, children: [
715
+ c && /* @__PURE__ */ s("label", { htmlFor: k, children: l }),
716
+ /* @__PURE__ */ s(
1314
717
  "textarea",
1315
718
  {
1316
- name: o,
1317
- ...s,
719
+ name: t,
720
+ ...i,
1318
721
  id: k,
1319
- placeholder: l,
722
+ placeholder: r,
1320
723
  rows: a,
1321
- required: u
724
+ required: y
1322
725
  }
1323
726
  )
1324
- ] }) : /* @__PURE__ */ i(
727
+ ] }) : /* @__PURE__ */ s(
1325
728
  "textarea",
1326
729
  {
1327
730
  id: k,
1328
- name: o,
1329
- ...t,
1330
- ...s,
1331
- ...r,
1332
- placeholder: l,
731
+ name: t,
732
+ ...o,
733
+ ...i,
734
+ ...n,
735
+ placeholder: r,
1333
736
  rows: a,
1334
- required: u
737
+ required: y
1335
738
  }
1336
739
  );
1337
- }, st = {
740
+ }, Ve = {
1338
741
  type: "TextArea",
1339
742
  label: "web_blocks.textarea",
1340
743
  category: "core",
1341
744
  icon: M,
1342
745
  group: "form",
1343
- ...m({
746
+ ...u({
1344
747
  properties: {
1345
748
  fieldName: {
1346
749
  type: "string",
@@ -1362,58 +765,550 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
1362
765
  },
1363
766
  placeholder: {
1364
767
  type: "string",
1365
- title: "Placeholder",
1366
- default: "Placeholder"
1367
- },
1368
- rows: {
1369
- type: "number",
1370
- title: "Rows",
1371
- default: 3
1372
- },
1373
- required: {
1374
- type: "boolean",
1375
- title: "Required",
1376
- default: !1
768
+ title: "Placeholder",
769
+ default: "Placeholder"
770
+ },
771
+ rows: {
772
+ type: "number",
773
+ title: "Rows",
774
+ default: 3
775
+ },
776
+ required: {
777
+ type: "boolean",
778
+ title: "Required",
779
+ default: !1
780
+ }
781
+ }
782
+ }),
783
+ aiProps: ["label", "placeholder"],
784
+ i18nProps: ["label", "placeholder"]
785
+ }, je = (e) => {
786
+ const { blockProps: o, inBuilder: t, children: l, globalBlock: r } = e;
787
+ return t && !r ? /* @__PURE__ */ f(
788
+ "div",
789
+ {
790
+ className: "flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",
791
+ ...o,
792
+ children: [
793
+ /* @__PURE__ */ f("h1", { children: [
794
+ "Global Block - ",
795
+ r
796
+ ] }),
797
+ /* @__PURE__ */ s("p", { children: "Choose a block from the sidebar to add it to this page." })
798
+ ]
799
+ }
800
+ ) : h.createElement("span", { ...o }, l);
801
+ }, qe = {
802
+ type: "GlobalBlock",
803
+ description: "A global block component",
804
+ label: "Global Block",
805
+ icon: $,
806
+ category: "core",
807
+ group: "basic",
808
+ hidden: !0,
809
+ ...u({
810
+ properties: {
811
+ globalBlock: {
812
+ type: "string",
813
+ title: "Global Block",
814
+ default: "",
815
+ ui: { "ui:widget": "hidden" }
816
+ }
817
+ }
818
+ })
819
+ }, Fe = (e) => {
820
+ const { blockProps: o, styles: t, content: l, tag: r = "h1", children: n = null } = e;
821
+ return n ? h.createElement(r, { ...t, ...o }, n) : h.createElement(r, {
822
+ ...t,
823
+ ...o,
824
+ dangerouslySetInnerHTML: { __html: l }
825
+ });
826
+ }, De = {
827
+ type: "Heading",
828
+ description: "A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",
829
+ label: "Heading",
830
+ category: "core",
831
+ icon: F,
832
+ group: "typography",
833
+ ...u({
834
+ properties: {
835
+ tag: {
836
+ type: "string",
837
+ default: "h2",
838
+ title: "Level",
839
+ enum: ["h1", "h2", "h3", "h4", "h5", "h6"]
840
+ },
841
+ styles: p("text-3xl"),
842
+ content: {
843
+ type: "string",
844
+ default: "Heading goes here",
845
+ title: "Content",
846
+ ui: { "ui:widget": "textarea" }
847
+ }
848
+ }
849
+ }),
850
+ aiProps: ["content"],
851
+ i18nProps: ["content"],
852
+ canAcceptBlock: (e) => e === "Span" || e === "Text"
853
+ }, Ue = (e) => {
854
+ const { blockProps: o, styles: t } = e;
855
+ return w("br", { ...o, ...t });
856
+ }, Ge = {
857
+ type: "LineBreak",
858
+ label: "Line Break",
859
+ category: "core",
860
+ group: "basic",
861
+ hidden: !0,
862
+ ...u({
863
+ properties: {
864
+ styles: p("")
865
+ }
866
+ }),
867
+ canAcceptBlock: () => !0,
868
+ canDelete: () => !1,
869
+ canMove: () => !1,
870
+ canDuplicate: () => !1
871
+ }, Oe = (e) => {
872
+ const { blockProps: o, children: t, styles: l } = e;
873
+ return t ? w("table", { ...o, ...l }, t) : /* @__PURE__ */ s(x, {});
874
+ }, Ye = (e) => {
875
+ const { blockProps: o, children: t, styles: l } = e;
876
+ return t ? w("thead", { ...o, ...l }, t) : /* @__PURE__ */ s(x, {});
877
+ }, We = (e) => {
878
+ const { blockProps: o, children: t, styles: l } = e;
879
+ return t ? w("tbody", { ...o, ...l }, t) : /* @__PURE__ */ s(x, {});
880
+ }, Xe = (e) => {
881
+ const { blockProps: o, children: t, styles: l } = e;
882
+ return t ? w("tr", { ...o, ...l }, t) : /* @__PURE__ */ s(x, {});
883
+ }, Je = (e) => {
884
+ const { blockProps: o, children: t, content: l, styles: r } = e;
885
+ return !t && v(l) ? /* @__PURE__ */ s(x, {}) : t ? w("td", { ...o, ...r }, t) : w("td", {
886
+ ...o,
887
+ ...r,
888
+ dangerouslySetInnerHTML: { __html: l }
889
+ });
890
+ };
891
+ d(Oe, {
892
+ type: "Table",
893
+ label: "Table",
894
+ category: "core",
895
+ group: "table",
896
+ hidden: !0,
897
+ icon: D,
898
+ ...u({
899
+ properties: {
900
+ styles: p("")
901
+ }
902
+ }),
903
+ blocks: B("Table")
904
+ });
905
+ d(Ye, {
906
+ type: "TableHead",
907
+ label: "Table Head",
908
+ category: "core",
909
+ group: "table",
910
+ hidden: !0,
911
+ icon: U,
912
+ ...u({
913
+ properties: {
914
+ styles: p("")
915
+ }
916
+ }),
917
+ blocks: B("TableHead")
918
+ });
919
+ d(We, {
920
+ type: "TableBody",
921
+ label: "Table Body",
922
+ category: "core",
923
+ group: "table",
924
+ hidden: !0,
925
+ icon: G,
926
+ ...u({
927
+ properties: {
928
+ styles: p("")
929
+ }
930
+ }),
931
+ blocks: B("TableBody")
932
+ });
933
+ d(Xe, {
934
+ type: "TableRow",
935
+ label: "Table Row",
936
+ category: "core",
937
+ group: "table",
938
+ hidden: !0,
939
+ icon: O,
940
+ ...u({
941
+ properties: {
942
+ styles: p("")
943
+ }
944
+ }),
945
+ blocks: B("TableRow")
946
+ });
947
+ d(Je, {
948
+ type: "TableCell",
949
+ label: "Table Cell",
950
+ category: "core",
951
+ group: "table",
952
+ hidden: !0,
953
+ icon: Y,
954
+ ...u({
955
+ properties: {
956
+ styles: p(""),
957
+ content: {
958
+ type: "string",
959
+ default: "Heading goes here",
960
+ title: "Content",
961
+ ui: { "ui:widget": "textarea" }
962
+ }
963
+ }
964
+ }),
965
+ blocks: B("TableCell"),
966
+ i18nProps: ["content"],
967
+ aiProps: ["content"]
968
+ });
969
+ function B(e) {
970
+ const o = (n, i) => ({
971
+ _id: C(),
972
+ _parent: n,
973
+ _type: "TableCell",
974
+ styles: "#styles:,",
975
+ content: `${e === "TableHead" ? "Table Head" : "Table Cell " + i}`
976
+ }), t = (n) => {
977
+ const i = C(), a = {
978
+ _type: "TableRow",
979
+ _id: i,
980
+ styles: "#styles:,border-b"
981
+ };
982
+ return n && (a._parent = n), [a, o(i, "1"), o(i, "2"), o(i, "3")];
983
+ }, l = (n) => {
984
+ const i = C(), a = {
985
+ _id: i,
986
+ _type: "TableHead",
987
+ styles: "#styles:,font-medium"
988
+ };
989
+ return n && (a._parent = n), [a, ...t(i)];
990
+ }, r = (n) => {
991
+ const i = C(), a = {
992
+ _id: i,
993
+ _type: "TableBody",
994
+ styles: "#styles:,"
995
+ };
996
+ return n && (a._parent = n), [a, ...t(i), ...t(i)];
997
+ };
998
+ if (e === "Table") {
999
+ const n = C();
1000
+ return [
1001
+ {
1002
+ _id: n,
1003
+ _type: "Table",
1004
+ styles: "#styles:,w-full text-left text-gray-500 dark:text-gray-400"
1005
+ },
1006
+ ...l(n),
1007
+ ...r(n)
1008
+ ];
1009
+ }
1010
+ return e === "TableRow" ? t() : e === "TableHead" ? l() : e === "TableBody" ? r() : [];
1011
+ }
1012
+ const E = (e, ...o) => ({
1013
+ ...e,
1014
+ className: L(e.className, ...o)
1015
+ }), Qe = (e) => {
1016
+ const { blockProps: o, icon: t, styles: l, width: r, inBuilder: n, height: i } = e, a = E(l, "");
1017
+ if (v(t))
1018
+ return /* @__PURE__ */ s(x, { inBuilder: n, className: "h-8 w-14" });
1019
+ const c = t.replace(/<svg /g, '<svg class="w-[inherit] h-[inherit]" ');
1020
+ return h.createElement("span", {
1021
+ ...o,
1022
+ ...a,
1023
+ style: {
1024
+ width: r ? `${r}px` : "auto",
1025
+ height: i ? `${i}px` : "auto"
1026
+ },
1027
+ dangerouslySetInnerHTML: { __html: c }
1028
+ });
1029
+ }, Ze = {
1030
+ type: "Icon",
1031
+ label: "web_blocks.icon",
1032
+ category: "core",
1033
+ icon: W,
1034
+ group: "media",
1035
+ ...u({
1036
+ properties: {
1037
+ styles: p(""),
1038
+ icon: {
1039
+ type: "string",
1040
+ title: "Icon",
1041
+ default: '<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>',
1042
+ ui: { "ui:widget": "icon" }
1043
+ },
1044
+ width: {
1045
+ type: "number",
1046
+ default: 16,
1047
+ title: "Width"
1048
+ },
1049
+ height: {
1050
+ type: "number",
1051
+ default: 16,
1052
+ title: "Height"
1053
+ }
1054
+ }
1055
+ })
1056
+ }, Ke = (e) => {
1057
+ const { blockProps: o, image: t, mobileImage: l, styles: r, alt: n, height: i, width: a, lazyLoading: c } = e;
1058
+ return v(t) ? /* @__PURE__ */ s(x, { className: "h-36" }) : /* @__PURE__ */ f("picture", { children: [
1059
+ l && /* @__PURE__ */ s("source", { srcSet: l, media: "(max-width: 480px)" }),
1060
+ /* @__PURE__ */ s(
1061
+ "img",
1062
+ {
1063
+ ...o,
1064
+ ...r,
1065
+ src: t,
1066
+ alt: n,
1067
+ loading: c ? "lazy" : "eager",
1068
+ width: a,
1069
+ height: i
1070
+ }
1071
+ )
1072
+ ] });
1073
+ }, et = {
1074
+ type: "Image",
1075
+ description: "A image component",
1076
+ label: "Image",
1077
+ category: "core",
1078
+ icon: X,
1079
+ group: "media",
1080
+ ...u({
1081
+ properties: {
1082
+ styles: p(""),
1083
+ image: {
1084
+ type: "string",
1085
+ title: "Image",
1086
+ default: "https://fakeimg.pl/400x200?text=Choose&font=bebas",
1087
+ ui: { "ui:widget": "image" }
1088
+ },
1089
+ alt: {
1090
+ type: "string",
1091
+ title: "Alt text",
1092
+ default: "",
1093
+ ui: { "ui:placeholder": "Enter alt text" }
1094
+ },
1095
+ lazyLoading: {
1096
+ type: "boolean",
1097
+ title: "Lazy Load",
1098
+ default: !0
1099
+ },
1100
+ width: {
1101
+ type: "number",
1102
+ title: "Width",
1103
+ default: "",
1104
+ ui: { "ui:placeholder": "Enter width" }
1105
+ },
1106
+ height: {
1107
+ type: "number",
1108
+ title: "Height",
1109
+ default: "",
1110
+ ui: { "ui:placeholder": "Enter height" }
1111
+ },
1112
+ mobileImage: {
1113
+ type: "string",
1114
+ title: "Mobile Image",
1115
+ default: "",
1116
+ ui: { "ui:widget": "image" }
1117
+ }
1118
+ }
1119
+ }),
1120
+ aiProps: ["alt"],
1121
+ i18nProps: ["alt"]
1122
+ }, tt = (e) => {
1123
+ const { blockProps: o, link: t, children: l, styles: r, inBuilder: n, content: i } = e;
1124
+ let a = {};
1125
+ return !l && v(i) && (a = { minHeight: "50px", display: "flex", alignItems: "center", justifyContent: "center" }), n ? l ? /* @__PURE__ */ s("span", { ...o, style: a, ...r, children: l }) : w(
1126
+ "span",
1127
+ {
1128
+ ...o,
1129
+ ...r,
1130
+ style: a
1131
+ },
1132
+ i
1133
+ ) : l ? /* @__PURE__ */ s("a", { "aria-label": i, href: (t == null ? void 0 : t.href) || "#/", target: t == null ? void 0 : t.target, ...o, ...r, children: l }) : w(
1134
+ "a",
1135
+ {
1136
+ ...o,
1137
+ ...r,
1138
+ href: (t == null ? void 0 : t.href) || "#",
1139
+ target: (t == null ? void 0 : t.target) || "_self",
1140
+ "aria-label": i
1141
+ },
1142
+ i
1143
+ );
1144
+ }, ot = {
1145
+ type: "Link",
1146
+ description: "A link component",
1147
+ label: "Link",
1148
+ category: "core",
1149
+ icon: J,
1150
+ group: "basic",
1151
+ ...u({
1152
+ properties: {
1153
+ styles: p(""),
1154
+ content: {
1155
+ type: "string",
1156
+ default: "Link goes here",
1157
+ title: "Content"
1158
+ },
1159
+ link: {
1160
+ type: "object",
1161
+ properties: {
1162
+ type: { type: "string" },
1163
+ href: { type: "string" },
1164
+ target: { type: "string" }
1165
+ },
1166
+ default: {
1167
+ type: "url",
1168
+ href: "",
1169
+ target: "_self"
1170
+ },
1171
+ ui: {
1172
+ "ui:field": "link"
1173
+ }
1174
+ }
1175
+ }
1176
+ }),
1177
+ aiProps: ["content"],
1178
+ i18nProps: ["content"],
1179
+ canAcceptBlock: (e) => e !== "Link"
1180
+ }, lt = (e) => {
1181
+ const { blockProps: o, children: t, listType: l, styles: r, tag: n, inBuilder: i } = e, a = L(b(r, "className", ""), l);
1182
+ return !t && v(r == null ? void 0 : r.className) ? /* @__PURE__ */ s(x, { inBuilder: i }) : h.createElement(
1183
+ n || (l === "list-decimal" ? "ol" : "ul"),
1184
+ { ...o, ...r, className: a },
1185
+ t
1186
+ );
1187
+ }, rt = {
1188
+ type: "List",
1189
+ description: "A list component",
1190
+ label: "List",
1191
+ icon: Q,
1192
+ category: "core",
1193
+ group: "basic",
1194
+ ...u({
1195
+ properties: {
1196
+ styles: p(""),
1197
+ listType: {
1198
+ type: "string",
1199
+ title: "List Type",
1200
+ default: "list-none",
1201
+ oneOf: [
1202
+ { enum: ["list-none"], title: "List None" },
1203
+ { enum: ["list-disc"], title: "Disc" },
1204
+ { enum: ["list-decimal"], title: "Decimal" }
1205
+ ]
1206
+ }
1207
+ }
1208
+ }),
1209
+ canAcceptBlock: (e) => e === "ListItem",
1210
+ blocks: [
1211
+ { _type: "List", _id: "a", listType: "list-none", styles: "#styles:," },
1212
+ {
1213
+ _type: "ListItem",
1214
+ _id: "b",
1215
+ _parent: "a",
1216
+ styles: "#styles:,",
1217
+ content: "Item 1"
1218
+ },
1219
+ {
1220
+ _type: "ListItem",
1221
+ _id: "c",
1222
+ _parent: "a",
1223
+ styles: "#styles:,",
1224
+ content: "Item 2"
1225
+ },
1226
+ {
1227
+ _type: "ListItem",
1228
+ _id: "d",
1229
+ _parent: "a",
1230
+ styles: "#styles:,",
1231
+ content: "Item 3"
1232
+ }
1233
+ ]
1234
+ }, nt = (e) => {
1235
+ const { blockProps: o, content: t, styles: l, children: r, tag: n } = e;
1236
+ return r ? h.createElement(n || "li", { ...l, ...o }, r) : h.createElement(n || "li", {
1237
+ ...l,
1238
+ ...o,
1239
+ dangerouslySetInnerHTML: { __html: t }
1240
+ });
1241
+ }, it = {
1242
+ type: "ListItem",
1243
+ description: "A list item component",
1244
+ label: "List Item",
1245
+ icon: Z,
1246
+ category: "core",
1247
+ group: "basic",
1248
+ ...u({
1249
+ properties: {
1250
+ styles: p(""),
1251
+ content: {
1252
+ type: "string",
1253
+ default: "List item",
1254
+ title: "Content",
1255
+ ui: {
1256
+ "ui:widget": "textarea"
1257
+ }
1377
1258
  }
1378
1259
  }
1379
1260
  }),
1380
- aiProps: ["label", "placeholder"],
1381
- i18nProps: ["label", "placeholder"]
1382
- }, at = (e) => {
1383
- const { blockProps: t, styles: o } = e;
1384
- return v("br", { ...t, ...o });
1385
- }, ct = {
1386
- type: "LineBreak",
1387
- label: "Line Break",
1261
+ i18nProps: ["content"],
1262
+ aiProps: ["content"],
1263
+ canAcceptBlock: (e) => e !== "ListItem",
1264
+ canBeNested: (e) => e === "List"
1265
+ }, st = (e) => {
1266
+ const { blockProps: o, styles: t, content: l } = e;
1267
+ return le(e.children) ? h.createElement("p", {
1268
+ ...t,
1269
+ ...o,
1270
+ dangerouslySetInnerHTML: { __html: l }
1271
+ }) : h.createElement("p", { ...t, ...o }, e.children);
1272
+ }, at = {
1273
+ type: "Paragraph",
1274
+ description: "A paragraph component",
1275
+ label: "Paragraph",
1388
1276
  category: "core",
1389
- group: "basic",
1390
- hidden: !0,
1391
- ...m({
1277
+ icon: K,
1278
+ group: "typography",
1279
+ ...u({
1392
1280
  properties: {
1393
- styles: p("")
1281
+ styles: p(""),
1282
+ content: {
1283
+ type: "string",
1284
+ title: "Content",
1285
+ default: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
1286
+ Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus
1287
+ nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,
1288
+ ui: { "ui:widget": "textarea", "ui:autosize": !0, "ui:rows": 5 }
1289
+ }
1394
1290
  }
1395
1291
  }),
1396
- canAcceptBlock: () => !0,
1397
- canDelete: () => !1,
1398
- canMove: () => !1,
1399
- canDuplicate: () => !1
1400
- }, pt = (e) => {
1401
- const { blockProps: t, inBuilder: o, children: n, partialBlockId: l } = e;
1402
- return o && !l ? /* @__PURE__ */ b(
1292
+ i18nProps: ["content"],
1293
+ aiProps: ["content"],
1294
+ canAcceptBlock: (e) => e === "Span" || e === "Link" || e === "Text"
1295
+ }, ct = (e) => {
1296
+ const { blockProps: o, inBuilder: t, children: l, partialBlockId: r } = e;
1297
+ return t && !r ? /* @__PURE__ */ f(
1403
1298
  "div",
1404
1299
  {
1405
1300
  className: "flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",
1406
- ...t,
1301
+ ...o,
1407
1302
  children: [
1408
- /* @__PURE__ */ b("h1", { children: [
1303
+ /* @__PURE__ */ f("h1", { children: [
1409
1304
  "Partial Block - ",
1410
- l
1305
+ r
1411
1306
  ] }),
1412
- /* @__PURE__ */ i("p", { children: "Choose a block from the sidebar to add it to this page." })
1307
+ /* @__PURE__ */ s("p", { children: "Choose a block from the sidebar to add it to this page." })
1413
1308
  ]
1414
1309
  }
1415
- ) : h.createElement("span", { ...t }, n);
1416
- }, ut = {
1310
+ ) : h.createElement("span", { ...o }, l);
1311
+ }, pt = {
1417
1312
  type: "PartialBlock",
1418
1313
  description: "A partial block component",
1419
1314
  label: "Partial Block",
@@ -1421,7 +1316,7 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
1421
1316
  category: "core",
1422
1317
  group: "basic",
1423
1318
  hidden: !0,
1424
- ...m({
1319
+ ...u({
1425
1320
  properties: {
1426
1321
  partialBlockId: {
1427
1322
  type: "string",
@@ -1431,7 +1326,7 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
1431
1326
  }
1432
1327
  }
1433
1328
  })
1434
- }, P = {
1329
+ }, I = {
1435
1330
  SMALL: {
1436
1331
  1: "col-span-1",
1437
1332
  2: "col-span-2",
@@ -1475,25 +1370,25 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
1475
1370
  12: "lg:col-span-12"
1476
1371
  }
1477
1372
  }, dt = (e) => {
1478
- const { blockProps: t, children: o, styles: n, colSpan: l, tabletColSpan: r, desktopColSpan: s } = e, c = { className: [
1479
- f(n, "className", ""),
1480
- f(P, ["SMALL", isNaN(l) || !l ? 6 : l], ""),
1481
- r ? f(P, ["MEDIUM", r || l], "") : "",
1482
- s ? f(P, ["LARGE", r || l], "") : ""
1373
+ const { blockProps: o, children: t, styles: l, colSpan: r, tabletColSpan: n, desktopColSpan: i } = e, c = { className: [
1374
+ b(l, "className", ""),
1375
+ b(I, ["SMALL", isNaN(r) || !r ? 6 : r], ""),
1376
+ n ? b(I, ["MEDIUM", n || r], "") : "",
1377
+ i ? b(I, ["LARGE", n || r], "") : ""
1483
1378
  ].join(" ") };
1484
- return /* @__PURE__ */ i("div", { ...t, ...n, ...c, children: o || /* @__PURE__ */ i("div", { className: "h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900" }) });
1485
- }, mt = {
1379
+ return /* @__PURE__ */ s("div", { ...o, ...l, ...c, children: t || /* @__PURE__ */ s("div", { className: "h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900" }) });
1380
+ }, ut = {
1486
1381
  type: "Column",
1487
1382
  description: "A column component",
1488
1383
  label: "Column",
1489
1384
  group: "basic",
1490
1385
  category: "core",
1491
- icon: oe,
1386
+ icon: ae,
1492
1387
  wrapper: !0,
1493
1388
  canDelete: () => !0,
1494
1389
  canAcceptBlock: () => !0,
1495
1390
  canBeNested: (e) => e === "Row",
1496
- ...m({
1391
+ ...u({
1497
1392
  properties: {
1498
1393
  styles: p(""),
1499
1394
  colSpan: {
@@ -1519,14 +1414,14 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
1519
1414
  }
1520
1415
  })
1521
1416
  }, yt = (e) => {
1522
- const { blockProps: t, children: o, styles: n, gutter: l } = e, s = { className: [f(n, "className", ""), " grid grid-cols-12"].join() };
1523
- return typeof (n == null ? void 0 : n.style) == "object" ? n.style.gap = `${l}px` : s.style = { gap: `${l}px` }, /* @__PURE__ */ i("div", { ...t, ...n, ...s, children: o });
1524
- }, gt = {
1417
+ const { blockProps: o, children: t, styles: l, gutter: r } = e, i = { className: [b(l, "className", ""), " grid grid-cols-12"].join() };
1418
+ return typeof (l == null ? void 0 : l.style) == "object" ? l.style.gap = `${r}px` : i.style = { gap: `${r}px` }, /* @__PURE__ */ s("div", { ...o, ...l, ...i, children: t });
1419
+ }, mt = {
1525
1420
  type: "Row",
1526
1421
  description: "A row component",
1527
1422
  label: "Row",
1528
1423
  group: "basic",
1529
- icon: le,
1424
+ icon: ce,
1530
1425
  blocks: () => [
1531
1426
  { _type: "Row", _id: "row", styles: "#styles:,p-1" },
1532
1427
  { _type: "Column", id: "column", _parent: "row", styles: "#styles:," },
@@ -1535,7 +1430,7 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
1535
1430
  category: "core",
1536
1431
  wrapper: !0,
1537
1432
  canAcceptBlock: (e) => e === "Column",
1538
- ...m({
1433
+ ...u({
1539
1434
  properties: {
1540
1435
  styles: p(""),
1541
1436
  colCount: {
@@ -1552,9 +1447,255 @@ const x = ({ className: e = "", inBuilder: t }) => t ? /* @__PURE__ */ i("div",
1552
1447
  }
1553
1448
  }
1554
1449
  })
1555
- }, xt = () => {
1556
- d(ne, re), d(pe, ue), d(ie, se), d(de, me), d(ye, ge), d(he, ke), d(fe, be), d(Ne, Me), d($e, Ee), d(Te, Ae), d(Ie, Se), d(Be, _e), d(Fe, Ue), d(ae, ce), d(we, ve), d(Re, He), d(We, Xe), d(Je, Qe), d(Ze, Ke), d(Oe, Ye), d(ot, lt), d(nt, rt), d(it, st), d(et, tt), d(at, ct), d(Ce, xe), d(Le, Pe), d(pt, ut), d(yt, gt), d(dt, mt), d(De, Ge);
1450
+ }, gt = (e) => {
1451
+ const { blockProps: o, content: t, styles: l } = e, r = E(
1452
+ l,
1453
+ "prose dark:prose-invert prose-p:m-0 prose-p:min-h-[1rem] prose-blockquote:m-2 prose-blockquote:ml-4 prose-ul:m-0 prose-ol:m-0 prose-li:m-0",
1454
+ "max-w-full"
1455
+ );
1456
+ return /* @__PURE__ */ s("div", { ...o, ...r, dangerouslySetInnerHTML: { __html: t } });
1457
+ }, bt = {
1458
+ type: "RichText",
1459
+ description: "A rich text block",
1460
+ label: "Rich Text",
1461
+ category: "core",
1462
+ icon: ee,
1463
+ group: "typography",
1464
+ ...u({
1465
+ properties: {
1466
+ styles: p(""),
1467
+ content: {
1468
+ type: "string",
1469
+ title: "Content",
1470
+ default: "<p>This is a rich text block. You can add text, and other content here.</p>",
1471
+ ui: { "ui:widget": "richtext" }
1472
+ }
1473
+ }
1474
+ }),
1475
+ aiProps: ["content"],
1476
+ i18nProps: ["content"]
1477
+ }, ft = (e) => {
1478
+ const { blockProps: o, styles: t, content: l, children: r = null, tag: n } = e;
1479
+ return r ? h.createElement("span", { ...t, ...o }, r) : h.createElement(n || "span", {
1480
+ ...t,
1481
+ ...o,
1482
+ dangerouslySetInnerHTML: { __html: l || "" }
1483
+ });
1484
+ }, ht = {
1485
+ type: "Span",
1486
+ description: "A span component",
1487
+ label: "Span",
1488
+ category: "core",
1489
+ group: "typography",
1490
+ ...u({
1491
+ properties: {
1492
+ styles: p(""),
1493
+ content: {
1494
+ type: "string",
1495
+ title: "Content",
1496
+ default: "",
1497
+ ui: { "ui:widget": "textarea", "ui:autosize": !0, "ui:rows": 3 }
1498
+ }
1499
+ }
1500
+ }),
1501
+ aiProps: ["content"],
1502
+ i18nProps: ["content"],
1503
+ canAcceptBlock: () => !0
1504
+ }, kt = (e) => e.inBuilder || e.forceWrapper ? /* @__PURE__ */ s("span", { ...e.blockProps, children: e.content }) : `${e.content}`, wt = {
1505
+ type: "Text",
1506
+ description: "A text component with no styling",
1507
+ label: "Text",
1508
+ hidden: !0,
1509
+ category: "core",
1510
+ group: "typography",
1511
+ icon: te,
1512
+ ...u({
1513
+ properties: {
1514
+ styles: p("text-black"),
1515
+ content: {
1516
+ title: "Content",
1517
+ type: "string",
1518
+ default: ""
1519
+ }
1520
+ }
1521
+ }),
1522
+ aiProps: ["content"],
1523
+ i18nProps: ["content"]
1524
+ }, Ct = {
1525
+ type: "object",
1526
+ title: "Controls",
1527
+ default: {
1528
+ autoplay: !0,
1529
+ controls: !1,
1530
+ loop: !0,
1531
+ muted: !0
1532
+ },
1533
+ properties: {
1534
+ autoplay: {
1535
+ type: "boolean",
1536
+ title: "Autoplay",
1537
+ default: !1
1538
+ },
1539
+ controls: {
1540
+ type: "boolean",
1541
+ title: "Show Controls",
1542
+ default: !0
1543
+ },
1544
+ loop: {
1545
+ type: "boolean",
1546
+ title: "Loop Video",
1547
+ default: !1
1548
+ },
1549
+ muted: {
1550
+ type: "boolean",
1551
+ title: "Muted",
1552
+ default: !1
1553
+ }
1554
+ }
1555
+ }, S = /^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/, _ = /(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/, vt = (e, o) => {
1556
+ const t = b(o, "autoplay", !1), l = b(o, "controls", !1), r = b(o, "loop", !1), n = t || b(o, "muted", !0);
1557
+ if (S.test(e)) {
1558
+ const i = e.match(S);
1559
+ if (i) {
1560
+ const a = i[4];
1561
+ let c = `https://www.youtube.com/embed/${a}`, y = t ? "autoplay=1" : "";
1562
+ return y += r ? `&loop=1&playlist=${a}` : "", y += n ? "&mute=1&muted=1" : "", y += l ? "&controls=1" : "&controls=0", `${c}?${y}`;
1563
+ }
1564
+ }
1565
+ if (_.test(e)) {
1566
+ const i = e.match(_);
1567
+ if (i) {
1568
+ const a = i[1];
1569
+ let c = "";
1570
+ return c += t ? "autoplay=1" : "", c += l ? "&controls=1" : "&controls=0", c += n ? "&muted=1" : "", c += r ? "&loop=1" : "", `https://player.vimeo.com/video/${a}?${c}`;
1571
+ }
1572
+ }
1573
+ return null;
1574
+ }, xt = (e) => {
1575
+ const { url: o, blockProps: t, styles: l, controls: r, videoSource: n, inBuilder: i } = e, a = vt(o, r);
1576
+ return /* @__PURE__ */ f("div", { ...re(l, "className"), className: "relative w-full overflow-hidden", style: { paddingBottom: "56.25%" }, children: [
1577
+ !a && i ? /* @__PURE__ */ s("div", { className: "absolute flex h-full w-full items-center justify-center bg-gray-300 text-center", children: v(o) ? `Provided ${n} video link in settings Video URL.` : `Provided ${n} video link is invalid.` }) : /* @__PURE__ */ s("iframe", { width: "100%", src: a, ...ne(l, "className") }),
1578
+ i && /* @__PURE__ */ s("div", { ...t, className: "absolute top-0 h-full w-full" })
1579
+ ] });
1580
+ }, Bt = (e) => {
1581
+ const { url: o, styles: t, controls: l, sources: r, poster: n, blockProps: i } = e;
1582
+ let a = n;
1583
+ const c = [...b(r, "srcsets", []) || []];
1584
+ o && typeof o == "string" && c.push({ url: o, width: "9999" });
1585
+ const y = c.sort((g, m) => parseInt(g.width) - parseInt(m.width)).filter((g) => !v(g.url) && !v(g.width));
1586
+ y.length === 0 && !a && (a = "https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");
1587
+ const k = b(l, "autoplay", !1) || b(l, "muted", !0);
1588
+ return (a || !v(y)) && /* @__PURE__ */ s("div", { className: "relative w-full overflow-hidden", style: { paddingBottom: "56.25%" }, children: /* @__PURE__ */ w(
1589
+ "video",
1590
+ {
1591
+ ...t,
1592
+ ...i,
1593
+ key: JSON.stringify(y),
1594
+ controls: b(l, "controls", !1),
1595
+ autoPlay: b(l, "autoplay", !1),
1596
+ loop: b(l, "loop", !1),
1597
+ poster: a,
1598
+ ...k ? { muted: !0 } : {}
1599
+ },
1600
+ y.map((g) => {
1601
+ if (!g.url || g.url.length < 4 || isNaN(g.width)) return null;
1602
+ const m = `(max-width: ${g.width}px)`;
1603
+ return /* @__PURE__ */ s("source", { src: g.url, media: m, type: g.type }, g.url);
1604
+ }),
1605
+ "Your browser does not support the video tag."
1606
+ ) });
1607
+ }, Lt = (e) => {
1608
+ const { videoSource: o } = e;
1609
+ return o === "Custom" ? /* @__PURE__ */ s(Bt, { ...e }) : o === "Youtube" || o === "Vimeo" ? /* @__PURE__ */ s(xt, { ...e }) : /* @__PURE__ */ f("div", { children: [
1610
+ "Invalid video source : ",
1611
+ o
1612
+ ] });
1613
+ }, It = {
1614
+ type: "Video",
1615
+ label: "Video",
1616
+ category: "core",
1617
+ icon: oe,
1618
+ group: "media",
1619
+ ...u({
1620
+ properties: {
1621
+ styles: p("absolute h-full w-full object-cover"),
1622
+ videoSource: {
1623
+ type: "string",
1624
+ default: "Custom",
1625
+ enum: ["Custom", "Youtube", "Vimeo"],
1626
+ title: "Video source"
1627
+ }
1628
+ },
1629
+ allOf: [
1630
+ {
1631
+ if: {
1632
+ properties: {
1633
+ videoSource: { const: "Custom" }
1634
+ }
1635
+ },
1636
+ then: {
1637
+ properties: {
1638
+ url: {
1639
+ type: "string",
1640
+ title: "Video URL",
1641
+ default: ""
1642
+ },
1643
+ poster: {
1644
+ type: "string",
1645
+ title: "Poster URL",
1646
+ default: ""
1647
+ },
1648
+ sources: {
1649
+ type: "object",
1650
+ default: { srcsets: [] }
1651
+ },
1652
+ controls: { ...Ct }
1653
+ }
1654
+ }
1655
+ },
1656
+ {
1657
+ if: {
1658
+ properties: {
1659
+ videoSource: { const: "Youtube" }
1660
+ }
1661
+ },
1662
+ then: {
1663
+ properties: {
1664
+ url: {
1665
+ type: "string",
1666
+ title: "Youtube Video URL",
1667
+ default: ""
1668
+ }
1669
+ }
1670
+ }
1671
+ },
1672
+ {
1673
+ if: {
1674
+ properties: {
1675
+ videoSource: { const: "Vimeo" }
1676
+ }
1677
+ },
1678
+ then: {
1679
+ properties: {
1680
+ url: {
1681
+ type: "string",
1682
+ title: "Vimeo Video URL",
1683
+ default: ""
1684
+ }
1685
+ }
1686
+ }
1687
+ }
1688
+ ],
1689
+ ui: {
1690
+ url: { "ui:placeholder": "Enter Video URL" },
1691
+ sources: { "ui:field": "sources" },
1692
+ poster: { "ui:placeholder": "Enter poster URL" }
1693
+ }
1694
+ }),
1695
+ i18nProps: ["url"]
1696
+ }, Et = () => {
1697
+ d(pe, de), d(ve, xe), d(ue, ye), d(Fe, De), d(st, at), d(ft, ht), d(gt, bt), d(tt, ot), d(lt, rt), d(nt, it), d(Qe, Ze), d(Ke, et), d(Lt, It), d(be, fe), d(he, ke), d(kt, wt), d(Ie, Pe), d(Se, _e), d(Te, Ne), d(Be, Le), d(Ee, Re), d(He, Ae), d(ze, Ve), d(Me, $e), d(Ue, Ge), d(we, Ce), d(je, qe), d(ct, pt), d(yt, mt), d(dt, ut), d(me, ge);
1557
1698
  };
1558
1699
  export {
1559
- xt as loadWebBlocks
1700
+ Et as loadWebBlocks
1560
1701
  };