@chaibuilder/sdk 2.0.0-beta.80 → 2.0.0-beta.82

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 (41) hide show
  1. package/dist/ChaiThemeFn-DcE5RdLQ.cjs +236 -0
  2. package/dist/ChaiThemeFn-DzirXKjI.js +237 -0
  3. package/dist/CodeEditor-C8_JzwHn.cjs +81 -0
  4. package/dist/CodeEditor-DdIk_PEV.js +81 -0
  5. package/dist/Topbar-62QmCKWL.cjs +18 -0
  6. package/dist/Topbar-Cqt0j3Yt.js +18 -0
  7. package/dist/context-menu-DHla8ofZ.js +893 -0
  8. package/dist/context-menu-DawHUIXd.cjs +923 -0
  9. package/dist/core.cjs +11709 -5
  10. package/dist/core.js +6845 -3957
  11. package/dist/getSplitClasses-BuALfSLX.js +54 -0
  12. package/dist/getSplitClasses-mbQmvwI3.cjs +53 -0
  13. package/dist/iconBase-BSrIcOaG.cjs +146 -0
  14. package/dist/iconBase-CWgVxu0A.js +147 -0
  15. package/dist/plugin-BcTnEZwx.cjs +26 -0
  16. package/dist/plugin-DGEKY3uC.js +27 -0
  17. package/dist/render.cjs +247 -2
  18. package/dist/render.js +205 -150
  19. package/dist/runtime.cjs +9 -1
  20. package/dist/sdk.css +1336 -1
  21. package/dist/tailwind.cjs +78 -1
  22. package/dist/tailwind.js +21 -19
  23. package/dist/ui.cjs +378 -1
  24. package/dist/ui.js +254 -244
  25. package/dist/web-blocks.cjs +1679 -2
  26. package/dist/web-blocks.js +747 -518
  27. package/package.json +1 -1
  28. package/dist/ChaiThemeFn-Cort9tch.js +0 -201
  29. package/dist/ChaiThemeFn-DQu-2Eh9.cjs +0 -13
  30. package/dist/CodeEditor-B2x4yruH.cjs +0 -1
  31. package/dist/CodeEditor-VcQsGvTM.js +0 -65
  32. package/dist/Topbar-BQsjWb-A.js +0 -16
  33. package/dist/Topbar-DEw_kBMz.cjs +0 -1
  34. package/dist/context-menu-C4lLV8gP.cjs +0 -1
  35. package/dist/context-menu-D5ViOi6K.js +0 -831
  36. package/dist/getSplitClasses-DodqA_KW.cjs +0 -1
  37. package/dist/getSplitClasses-DphwgQiE.js +0 -48
  38. package/dist/iconBase-Cn2BsTrq.cjs +0 -1
  39. package/dist/iconBase-DHfFLkem.js +0 -124
  40. package/dist/plugin-2xcljWGM.cjs +0 -1
  41. package/dist/plugin-kUMxtQR5.js +0 -24
@@ -1,3 +1,1680 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@chaibuilder/runtime"),i=require("react/jsx-runtime"),k=require("react"),b=require("./iconBase-Cn2BsTrq.cjs"),y=require("@radix-ui/react-icons"),g=require("lodash-es"),B=require("lucide-react");function v(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const h=v(k),C=({className:e="",inBuilder:l})=>l?i.jsx("div",{className:b.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsx("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,_=e=>{const{blockProps:l,inBuilder:t,backgroundImage:s,children:r,tag:n="div",styles:a}=e;let c=r;r||(c=i.jsx(C,{inBuilder:t}));let p={};return s&&(p={backgroundImage:`url(${s})`}),h.createElement(n,{...l,...a,style:p},c)},j={type:"Box",label:"Box",category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0},N=e=>{const{blockProps:l,iconSize:t,icon:s,content:r,styles:n,children:a,iconPos:c,link:p,inBuilder:d}=e,m=s,f=a||i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:r}),m&&i.jsx("div",{style:{width:t+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:m}})]}),u=k.createElement("button",{...l,...n,type:"button","aria-label":r},f);return g.isEmpty(g.get(p,"href"))?u:d?i.jsx("span",{children:u}):i.jsx("a",{"aria-label":r,href:g.get(p,"href")||"/",target:g.get(p,"target","_self"),children:u})},E={type:"Button",label:"Button",category:"core",icon:y.ButtonIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:16},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),i18nProps:["content"],aiProps:["content"]},M=e=>{const{blockProps:l,styles:t,htmlCode:s,inBuilder:r}=e;return r?i.jsxs("div",{className:"relative",children:[r?i.jsx("div",{...l,...t,className:"absolute z-20 h-full w-full"}):null,h.createElement("div",{...t,dangerouslySetInnerHTML:{__html:s.replace(/<script.*?>.*?<\/script>/g,"")}})]}):h.createElement("div",{...l,...t,dangerouslySetInnerHTML:{__html:s}})},T={type:"CustomHTML",label:"web_blocks.custom_html",category:"core",icon:y.CodeIcon,group:"advanced",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}})},$=e=>{const{blockProps:l,styles:t,backgroundImage:s}=e;let r={};return s&&(r={backgroundImage:`url(${s})`}),h.createElement("div",{...l,...t,style:r})},R={type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},A=e=>{const{blockProps:l,styles:t,content:s,tag:r="h1",children:n=null}=e;return n?h.createElement(r,{...t,...l},n):h.createElement(r,{...t,...l,dangerouslySetInnerHTML:{__html:s}})},z={type:"Heading",label:"web_blocks.heading",category:"core",icon:y.HeadingIcon,group:"typography",...o.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:o.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Text"},H=e=>{const{blockProps:l,styles:t,content:s}=e;return g.isNull(e.children)?h.createElement("p",{...t,...l,dangerouslySetInnerHTML:{__html:s}}):h.createElement("p",{...t,...l},e.children)},D={type:"Paragraph",label:"Paragraph",category:"core",icon:y.TextIcon,group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const runtime = require("@chaibuilder/runtime");
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const React = require("react");
6
+ const iconBase = require("./iconBase-BSrIcOaG.cjs");
7
+ const reactIcons = require("@radix-ui/react-icons");
8
+ const lodashEs = require("lodash-es");
9
+ const lucideReact = require("lucide-react");
10
+ function _interopNamespaceDefault(e) {
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
12
+ if (e) {
13
+ for (const k in e) {
14
+ if (k !== "default") {
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: () => e[k]
19
+ });
20
+ }
21
+ }
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
27
+ const EmptySlot = ({ className = "", inBuilder }) => {
28
+ if (!inBuilder) return null;
29
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: iconBase.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800", children: /* @__PURE__ */ jsxRuntime.jsx("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" }) }) });
30
+ };
31
+ const Component$3 = (props) => {
32
+ const { blockProps, inBuilder, backgroundImage, children, tag = "div", styles } = props;
33
+ let nestedChildren = children;
34
+ if (!children) {
35
+ nestedChildren = /* @__PURE__ */ jsxRuntime.jsx(EmptySlot, { inBuilder });
36
+ }
37
+ let cssStyles = {};
38
+ if (backgroundImage) {
39
+ cssStyles = { backgroundImage: `url(${backgroundImage})` };
40
+ }
41
+ return React__namespace.createElement(tag, { ...blockProps, ...styles, style: cssStyles }, nestedChildren);
42
+ };
43
+ const Config$s = {
44
+ type: "Box",
45
+ label: "Box",
46
+ category: "core",
47
+ group: "basic",
48
+ ...runtime.registerChaiBlockSchema({
49
+ properties: {
50
+ styles: runtime.StylesProp(""),
51
+ backgroundImage: {
52
+ type: "string",
53
+ default: "",
54
+ title: "Background Image",
55
+ ui: { "ui:widget": "image" }
56
+ },
57
+ tag: {
58
+ type: "string",
59
+ default: "div",
60
+ title: "Tag",
61
+ oneOf: [
62
+ { const: "div", title: "div" },
63
+ { const: "header", title: "header" },
64
+ { const: "footer", title: "footer" },
65
+ { const: "section", title: "section" },
66
+ { const: "article", title: "article" },
67
+ { const: "aside", title: "aside" },
68
+ { const: "main", title: "main" },
69
+ { const: "nav", title: "nav" },
70
+ { const: "figure", title: "figure" },
71
+ { const: "details", title: "details" },
72
+ { const: "summary", title: "summary" },
73
+ { const: "dialog", title: "dialog" },
74
+ { const: "strike", title: "strike" },
75
+ { const: "caption", title: "caption" },
76
+ { const: "legend", title: "legend" },
77
+ { const: "figcaption", title: "figcaption" },
78
+ { const: "mark", title: "mark" }
79
+ ]
80
+ }
81
+ }
82
+ }),
83
+ canAcceptBlock: () => true
84
+ };
85
+ const Component$2 = (props) => {
86
+ const { blockProps, iconSize, icon, content, styles, children, iconPos, link, inBuilder } = props;
87
+ const _icon = icon;
88
+ const child = children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
89
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-ai-key": "content", children: content }),
90
+ _icon && /* @__PURE__ */ jsxRuntime.jsx(
91
+ "div",
92
+ {
93
+ style: { width: iconSize + "px" },
94
+ className: iconPos + " " + (iconPos === "order-first" ? "mr-2" : "ml-2") || "",
95
+ dangerouslySetInnerHTML: { __html: _icon }
96
+ }
97
+ )
98
+ ] });
99
+ const button = React.createElement(
100
+ "button",
101
+ {
102
+ ...blockProps,
103
+ ...styles,
104
+ type: "button",
105
+ "aria-label": content
106
+ },
107
+ child
108
+ );
109
+ if (!lodashEs.isEmpty(lodashEs.get(link, "href"))) {
110
+ if (inBuilder) {
111
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { children: button });
112
+ } else {
113
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { "aria-label": content, href: lodashEs.get(link, "href") || "/", target: lodashEs.get(link, "target", "_self"), children: button });
114
+ }
115
+ }
116
+ return button;
117
+ };
118
+ const Config$r = {
119
+ type: "Button",
120
+ label: "Button",
121
+ category: "core",
122
+ icon: reactIcons.ButtonIcon,
123
+ group: "basic",
124
+ ...runtime.registerChaiBlockSchema({
125
+ properties: {
126
+ styles: runtime.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),
127
+ content: {
128
+ type: "string",
129
+ title: "Button label",
130
+ default: "Button"
131
+ },
132
+ icon: {
133
+ type: "string",
134
+ title: "Icon",
135
+ default: "",
136
+ ui: { "ui:widget": "icon" }
137
+ },
138
+ iconSize: {
139
+ type: "number",
140
+ title: "Icon size",
141
+ default: 16
142
+ },
143
+ iconPos: {
144
+ type: "string",
145
+ title: "Icon position",
146
+ default: "order-last",
147
+ enum: ["order-first", "order-last"]
148
+ },
149
+ link: {
150
+ type: "object",
151
+ properties: {
152
+ type: { type: "string" },
153
+ href: { type: "string" },
154
+ target: { type: "string" }
155
+ },
156
+ default: {
157
+ type: "url",
158
+ href: "",
159
+ target: "_self"
160
+ },
161
+ ui: {
162
+ "ui:field": "link"
163
+ }
164
+ }
165
+ }
166
+ }),
167
+ i18nProps: ["content"],
168
+ aiProps: ["content"]
169
+ };
170
+ const CustomHTMLBlock = (props) => {
171
+ const { blockProps, styles, htmlCode, inBuilder } = props;
172
+ return inBuilder ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
173
+ inBuilder ? /* @__PURE__ */ jsxRuntime.jsx("div", { ...blockProps, ...styles, className: "absolute z-20 h-full w-full" }) : null,
174
+ React__namespace.createElement("div", {
175
+ ...styles,
176
+ dangerouslySetInnerHTML: { __html: htmlCode.replace(/<script.*?>.*?<\/script>/g, "") }
177
+ })
178
+ ] }) : React__namespace.createElement("div", {
179
+ ...blockProps,
180
+ ...styles,
181
+ dangerouslySetInnerHTML: { __html: htmlCode }
182
+ });
183
+ };
184
+ const Config$q = {
185
+ type: "CustomHTML",
186
+ label: "web_blocks.custom_html",
187
+ category: "core",
188
+ icon: reactIcons.CodeIcon,
189
+ group: "advanced",
190
+ ...runtime.registerChaiBlockSchema({
191
+ properties: {
192
+ styles: runtime.StylesProp(""),
193
+ htmlCode: {
194
+ type: "string",
195
+ default: "<div><p>Enter your HTML code here...</p></div>",
196
+ ui: { "ui:widget": "code" }
197
+ }
198
+ }
199
+ })
200
+ };
201
+ const EmptyBox = (props) => {
202
+ const { blockProps, styles, backgroundImage } = props;
203
+ let cssStyles = {};
204
+ if (backgroundImage) {
205
+ cssStyles = { backgroundImage: `url(${backgroundImage})` };
206
+ }
207
+ return React__namespace.createElement("div", { ...blockProps, ...styles, style: cssStyles });
208
+ };
209
+ const Config$p = {
210
+ type: "EmptyBox",
211
+ label: "Empty Box",
212
+ category: "core",
213
+ group: "basic",
214
+ ...runtime.registerChaiBlockSchema({
215
+ properties: {
216
+ styles: runtime.StylesProp(""),
217
+ backgroundImage: {
218
+ type: "string",
219
+ title: "Background Image",
220
+ default: "",
221
+ ui: { "ui:widget": "image" }
222
+ }
223
+ }
224
+ })
225
+ };
226
+ const HeadingBlock = (props) => {
227
+ const { blockProps, styles, content, tag = "h1", children = null } = props;
228
+ if (children) return React__namespace.createElement(tag, { ...styles, ...blockProps }, children);
229
+ return React__namespace.createElement(tag, {
230
+ ...styles,
231
+ ...blockProps,
232
+ dangerouslySetInnerHTML: { __html: content }
233
+ });
234
+ };
235
+ const Config$o = {
236
+ type: "Heading",
237
+ label: "web_blocks.heading",
238
+ category: "core",
239
+ icon: reactIcons.HeadingIcon,
240
+ group: "typography",
241
+ ...runtime.registerChaiBlockSchema({
242
+ properties: {
243
+ tag: {
244
+ type: "string",
245
+ default: "h2",
246
+ title: "Level",
247
+ enum: ["h1", "h2", "h3", "h4", "h5", "h6"]
248
+ },
249
+ styles: runtime.StylesProp("text-3xl"),
250
+ content: {
251
+ type: "string",
252
+ default: "Heading goes here",
253
+ title: "Content",
254
+ ui: { "ui:widget": "textarea" }
255
+ }
256
+ }
257
+ }),
258
+ aiProps: ["content"],
259
+ i18nProps: ["content"],
260
+ canAcceptBlock: (type) => type === "Span" || type === "Text"
261
+ };
262
+ const ParagraphBlock = (props) => {
263
+ const { blockProps, styles, content } = props;
264
+ if (!lodashEs.isNull(props.children)) return React__namespace.createElement("p", { ...styles, ...blockProps }, props.children);
265
+ return React__namespace.createElement("p", {
266
+ ...styles,
267
+ ...blockProps,
268
+ dangerouslySetInnerHTML: { __html: content }
269
+ });
270
+ };
271
+ const Config$n = {
272
+ type: "Paragraph",
273
+ label: "Paragraph",
274
+ category: "core",
275
+ icon: reactIcons.TextIcon,
276
+ group: "typography",
277
+ ...runtime.registerChaiBlockSchema({
278
+ properties: {
279
+ styles: runtime.StylesProp(""),
280
+ content: {
281
+ type: "string",
282
+ title: "Content",
283
+ default: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
2
284
  Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus
3
- nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},w=(e,...l)=>({...e,className:b.cn(e.className,...l)}),q=e=>{const{blockProps:l,content:t,styles:s}=e,r=w(s,"prose","max-w-full");return i.jsx("div",{...l,...r,dangerouslySetInnerHTML:{__html:t}})},U={type:"RichText",label:"Rich Text",category:"core",icon:y.CursorTextIcon,group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>",ui:{"ui:widget":"richtext"}}}}),aiProps:["content"],i18nProps:["content"]},F=e=>{const{blockProps:l,styles:t,content:s,children:r=null,tag:n}=e;return r?h.createElement("span",{...t,...l},r):h.createElement(n||"span",{...t,...l,dangerouslySetInnerHTML:{__html:s||""}})},O={type:"Span",label:"Span",category:"core",group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0};function G(e){return b.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(e)}const V=e=>{const{scripts:l,inBuilder:t,blockProps:s}=e;return t?i.jsx("div",{...s,children:i.jsx("div",{className:b.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsx("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"})})})}):i.jsx("div",{dangerouslySetInnerHTML:{__html:l}})},W={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:G,group:"advanced",...o.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},X=e=>{const{blockProps:l,styles:t}=e;return k.createElement("hr",{...t,...l})},Y={type:"Divider",label:"web_blocks.divider",category:"core",icon:y.DividerHorizontalIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},Z=e=>{const{blockProps:l,inBuilder:t,children:s,globalBlock:r}=e;return t&&!r?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...l,children:[i.jsxs("h1",{children:["Global Block - ",r]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):h.createElement("span",{...l},s)},J={type:"GlobalBlock",label:"Global Block",icon:B.GlobeIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},K=e=>{const{blockProps:l,icon:t,styles:s,width:r,inBuilder:n,height:a}=e,c=w(s,"");if(g.isEmpty(t))return i.jsx(C,{inBuilder:n,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return h.createElement("span",{...l,...c,style:{width:r?`${r}px`:"auto",height:a?`${a}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},Q={type:"Icon",label:"web_blocks.icon",category:"core",icon:y.SketchLogoIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),icon:{type:"string",title:"Icon",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>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},ee=e=>{const{blockProps:l,image:t,mobileImage:s,styles:r,alt:n,height:a,width:c,lazyLoading:p}=e;return g.isEmpty(t)?i.jsx(C,{className:"h-36"}):i.jsxs("picture",{children:[s&&i.jsx("source",{srcSet:s,media:"(max-width: 480px)"}),i.jsx("img",{...l,...r,src:t,alt:n,loading:p?"lazy":"eager",width:c,height:a})]})},te={type:"Image",label:"Image",category:"core",icon:y.ImageIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),image:{type:"string",title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas",ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}}}}),aiProps:["alt"],i18nProps:["alt"]},le=e=>{const{blockProps:l,children:t,styles:s,inBuilder:r,content:n,href:a}=e,{hrefType:c,autoplay:p,maxWidth:d,backdropColor:m,galleryName:f}=e,u=w(s,"cb-lightbox vbox-item");if(!t&&g.isEmpty(s==null?void 0:s.className)&&g.isEmpty(n))return i.jsx(C,{inBuilder:r});if(r)return t?i.jsx("span",{...l,...u,children:t}):k.createElement("span",{...l,...u,dangerouslySetInnerHTML:{__html:n}});const x={};return c!=="image"&&(x["data-vbtype"]=c),p&&(x["data-autoplay"]="true"),d&&(x["data-maxwidth"]=d+"px"),m&&(x["data-overlay"]=m),f&&(x["data-gall"]=f),t?i.jsx("a",{"aria-label":n,...x,href:a||"#/",...l,...u,children:t}):k.createElement("a",{...l,...u,...x,href:a||"#",dangerouslySetInnerHTML:{__html:n},"aria-label":n})},oe={type:"LightBoxLink",label:"Lightbox Link",category:"core",icon:y.ImageIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"Link text or drop blocks inside"},hrefType:{type:"string",title:"Type",default:"image",enum:["image","video","iframe","inline","ajax"],enumNames:["Image","Video","Iframe","Inline","Ajax"]},href:{type:"string",title:"Href",default:""},autoplay:{type:"boolean",title:"Autoplay (Video only)",default:!1},maxWidth:{type:"number",title:"Max Width",default:""},backdropColor:{type:"string",title:"Backdrop Color",default:""},galleryName:{type:"string",title:"Gallery Name",default:""}},dependencies:{autoplay:["hrefType","video"]}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="Link"&&e!=="LightBoxLink"},re=e=>{const{blockProps:l,link:t,children:s,styles:r,inBuilder:n,content:a}=e;let c={};return!s&&g.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?s?i.jsx("span",{...l,style:c,...r,children:s}):k.createElement("span",{...l,...r,style:c},a):s?i.jsx("a",{"aria-label":a,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...l,...r,children:s}):k.createElement("a",{...l,...r,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":a},a)},se={type:"Link",label:"Link",category:"core",icon:y.Link1Icon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e!=="Link"},ie=e=>{const{blockProps:l,children:t,listType:s,styles:r,tag:n,inBuilder:a}=e,c=b.cn(g.get(r,"className",""),s);return!t&&g.isEmpty(r==null?void 0:r.className)?i.jsx(C,{inBuilder:a}):h.createElement(n||(s==="list-decimal"?"ol":"ul"),{...l,...r,className:c},t)},ne={type:"List",label:"web_blocks.list",icon:y.RowsIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),listType:{type:"string",title:"List Type",default:"list-none",oneOf:[{enum:["list-none"],title:"List None"},{enum:["list-disc"],title:"Disc"},{enum:["list-decimal"],title:"Decimal"}]}}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},ae=e=>{const{blockProps:l,content:t,styles:s,children:r,tag:n}=e;return r?h.createElement(n||"li",{...s,...l},r):h.createElement(n||"li",{...s,...l,dangerouslySetInnerHTML:{__html:t}})},ce={type:"ListItem",label:"List Item",icon:y.ColumnsIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"},pe=e=>e.inBuilder||e.forceWrapper?i.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,ue={type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:y.SpaceBetweenVerticallyIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-black"),content:{type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},P=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,I=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,L=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,de=e=>{if(P.test(e)){const l=e.match(P);return l?`https://www.youtube.com/embed/${l[4]}`:e}if(I.test(e)){const l=e.match(I);return l?`https://player.vimeo.com/video/${l[3]}`:e}if(L.test(e)){const l=e.match(L);return l?`https://www.dailymotion.com/embed/video/${l[4]}`:e}return null},ge=h.memo(e=>{const{blockProps:l,inBuilder:t,styles:s,url:r,controls:n}=e,a=g.get(n,"autoPlay",!1),c=g.get(n,"controls",!1),p=a||g.get(n,"muted",!0),d=g.get(n,"loop",!1);if(g.isEmpty(r))return i.jsx(C,{inBuilder:t,className:"h-36"});let m=de(r),f=null;if(m){if(!g.isEmpty(m)){const u=[];u.push(`autoplay=${a?1:0}`),u.push(`controls=${n?1:0}`),u.push(`mute=${p?1:0}&muted=${p?1:0}`),u.push(`loop=${d?1:0}`),m=`${m}?${u.join("&")}`}f=h.createElement("iframe",{...l,className:"absolute inset-0 w-full h-full",src:m,allow:t?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else f=h.createElement("video",{...l,className:"absolute inset-0 w-full h-full",src:r,controls:c,muted:p,autoPlay:t?!1:a,loop:d});return i.jsx("div",{...g.pick(s,["className"]),children:i.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[t?i.jsx("div",{...l,...g.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,f]})})}),me={type:"Video",label:"Video",category:"core",icon:y.VideoIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),url:{type:"string",title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"},controls:{type:"object",title:"Controls",default:{autoplay:!1,controls:!0,loop:!1,muted:!1},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}}}}),i18nProps:["url"]},ye=e=>{const{blockProps:l,fieldName:t,label:s,styles:r,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,d=b.generateUUID();return p?i.jsxs("div",{...r,...l,children:[i.jsx("input",{...n,name:t,id:d,type:"checkbox",required:a,defaultChecked:c}),s&&i.jsx("label",{htmlFor:d,children:s})]}):i.jsx("input",{id:d,...l,...n,...r,type:"checkbox",required:a,name:t})},he={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:y.CheckboxIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},fe=e=>{const{children:l,blockProps:t,errorMessage:s,successMessage:r,action:n,styles:a,inBuilder:c}=e;let p=l;l||(p=i.jsx(C,{inBuilder:c}));const d={"x-data":"{}","x-on:submit.prevent":"post"},m={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxs("form",{...d,"data-error":s,"data-success":r,method:"post",action:n,...t,...a,children:[i.jsx("div",{...m}),p]})},be={type:"Form",label:"Form",category:"core",icon:B.GroupIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form/submit"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},ke=e=>{const{blockProps:l,inBuilder:t,label:s,styles:r,inputStyles:n,icon:a,iconSize:c,iconPos:p}=e,d=b.generateUUID(),m={"x-bind:disabled":"formLoading"};return i.jsxs("button",{id:d,...m,...n,...r,...l||{},type:t?"button":"submit","aria-label":s,children:[s,a&&i.jsx("div",{style:{width:c+"px"},className:p+" "+(p==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},xe={type:"FormButton",label:"Submit Button",category:"core",icon:y.ButtonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),inputStyles:o.StylesProp(""),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},Ce=e=>{const{blockProps:l,fieldName:t,label:s,placeholder:r,styles:n,inputStyles:a,showLabel:c,required:p,inputType:d}=e,m=b.generateUUID();return c?i.jsxs("div",{...n,...l,children:[c&&i.jsx("label",{htmlFor:m,children:s}),i.jsx("input",{name:t,...a,id:m,type:d,placeholder:r,required:p})]}):i.jsx("input",{id:m,name:t,...l,...a,...n,type:d,placeholder:r,required:p})},Be={type:"Input",label:"web_blocks.input",category:"core",icon:y.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},inputType:{type:"string",title:"Input Type",default:"text",enum:["text","email","password","number","tel","file","hidden","range","submit","color","date","time"]}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Se=e=>{const{blockProps:l,content:t,styles:s,children:r}=e,n={...s,...l};return r?h.createElement("label",n,r):h.createElement("label",{...n,dangerouslySetInnerHTML:{__html:t}})},we={type:"Label",label:"Label",category:"core",icon:y.LetterCaseToggleIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},Pe=e=>{const{blockProps:l,fieldName:t,label:s,styles:r,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,d=b.generateUUID();return p?i.jsxs("div",{...r,...l,children:[i.jsx("input",{...n,name:t,id:d,type:"radio",required:a,defaultChecked:c}),s&&i.jsx("label",{htmlFor:d,children:s})]}):i.jsx("input",{id:d,...l,...n,...r,type:"radio",required:a,checked:c,name:t})},Ie={type:"Radio",label:"web_blocks.radio",category:"core",icon:y.RadiobuttonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},Le=e=>{const{blockProps:l,fieldName:t,label:s,placeholder:r,styles:n,inputStyles:a,required:c,showLabel:p,_multiple:d,options:m}=e,f=b.generateUUID();return p?i.jsxs("div",{...n,...l,children:[p&&i.jsx("label",{htmlFor:f,children:s}),i.jsxs("select",{...a,id:f,required:c,multiple:d,name:t,children:[i.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),g.map(m,u=>i.jsx("option",{value:u==null?void 0:u.value,children:u==null?void 0:u.label},u==null?void 0:u.value))]})]}):i.jsxs("select",{id:f,...n,...l,required:c,multiple:d,name:t,children:[i.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),g.map(m,u=>i.jsx("option",{value:u==null?void 0:u.value,children:u==null?void 0:u.label},u==null?void 0:u.value))]})},ve={type:"Select",label:"web_blocks.select",category:"core",icon:y.DropdownMenuIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},_e=e=>{const{blockProps:l,fieldName:t,label:s,placeholder:r,styles:n,inputStyles:a,_rows:c,showLabel:p}=e,d=b.generateUUID();return p?i.jsxs("div",{...n,...l,children:[p&&i.jsx("label",{htmlFor:d,children:s}),i.jsx("textarea",{name:t,...a,id:d,placeholder:r,rows:c})]}):i.jsx("textarea",{id:d,name:t,...l,...a,...n,placeholder:r,rows:c})},je={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:y.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},_rows:{type:"number",title:"Rows",default:3}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Ne=e=>{const{blockProps:l,styles:t}=e;return k.createElement("br",{...l,...t})},Ee={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},S={SMALL:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12"},MEDIUM:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12"},LARGE:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12"}},Me=e=>{const{blockProps:l,children:t,styles:s,colSpan:r,tabletColSpan:n,desktopColSpan:a}=e,p={className:[g.get(s,"className",""),g.get(S,["SMALL",isNaN(r)||!r?6:r],""),n?g.get(S,["MEDIUM",n||r],""):"",a?g.get(S,["LARGE",n||r],""):""].join(" ")};return i.jsx("div",{...l,...s,...p,children:t||i.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},Te={type:"Column",label:"Column",group:"basic",category:"core",icon:B.Columns,wrapper:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),colSpan:{type:"number",title:"Column Span",default:6,enum:[1,2,3,4,5,6,7,8,9,10,11,12]},tabletColSpan:{type:"number",title:"Column Span (Tablet)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]},desktopColSpan:{type:"number",title:"Column Span (Desktop)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]}}})},$e=e=>{const{blockProps:l,children:t,styles:s,gutter:r}=e,a={className:[g.get(s,"className","")," grid grid-cols-12"].join()};return typeof(s==null?void 0:s.style)=="object"?s.style.gap=`${r}px`:a.style={gap:`${r}px`},i.jsx("div",{...l,...s,...a,children:t})},Re={type:"Row",label:"Row",group:"basic",icon:B.Rows,blocks:()=>[{_type:"Row",_id:"row",styles:"#styles:,p-1"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"}],category:"core",wrapper:!0,canAcceptBlock:e=>e==="Column",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},Ae=()=>{o.registerChaiBlock(_,j),o.registerChaiBlock($,R),o.registerChaiBlock(N,E),o.registerChaiBlock(A,z),o.registerChaiBlock(H,D),o.registerChaiBlock(F,O),o.registerChaiBlock(q,U),o.registerChaiBlock(re,se),o.registerChaiBlock(le,oe),o.registerChaiBlock(ie,ne),o.registerChaiBlock(ae,ce),o.registerChaiBlock(K,Q),o.registerChaiBlock(ee,te),o.registerChaiBlock(ge,me),o.registerChaiBlock(M,T),o.registerChaiBlock(V,W),o.registerChaiBlock(pe,ue),o.registerChaiBlock(fe,be),o.registerChaiBlock(ke,xe),o.registerChaiBlock(Ce,Be),o.registerChaiBlock(ye,he),o.registerChaiBlock(Pe,Ie),o.registerChaiBlock(Le,ve),o.registerChaiBlock(_e,je),o.registerChaiBlock(Se,we),o.registerChaiBlock(Ne,Ee),o.registerChaiBlock(X,Y),o.registerChaiBlock(Z,J),o.registerChaiBlock($e,Re),o.registerChaiBlock(Me,Te)};exports.loadWebBlocks=Ae;
285
+ nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,
286
+ ui: { "ui:widget": "textarea", "ui:autosize": true, "ui:rows": 5 }
287
+ }
288
+ }
289
+ }),
290
+ i18nProps: ["content"],
291
+ aiProps: ["content"],
292
+ canAcceptBlock: (type) => type === "Span" || type === "Link" || type === "Text"
293
+ };
294
+ const addForcedClasses = (styles, ...classes) => {
295
+ return {
296
+ ...styles,
297
+ className: iconBase.cn(styles.className, ...classes)
298
+ };
299
+ };
300
+ const RichTextBlock = (props) => {
301
+ const { blockProps, content, styles } = props;
302
+ const forcedStyles = addForcedClasses(styles, "prose", "max-w-full");
303
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...blockProps, ...forcedStyles, dangerouslySetInnerHTML: { __html: content } });
304
+ };
305
+ const Config$m = {
306
+ type: "RichText",
307
+ label: "Rich Text",
308
+ category: "core",
309
+ icon: reactIcons.CursorTextIcon,
310
+ group: "typography",
311
+ ...runtime.registerChaiBlockSchema({
312
+ properties: {
313
+ styles: runtime.StylesProp(""),
314
+ content: {
315
+ type: "string",
316
+ title: "Content",
317
+ default: "<p>This is a rich text block. You can add text, and other content here.</p>",
318
+ ui: { "ui:widget": "richtext" }
319
+ }
320
+ }
321
+ }),
322
+ aiProps: ["content"],
323
+ i18nProps: ["content"]
324
+ };
325
+ const SpanBlock = (props) => {
326
+ const { blockProps, styles, content, children = null, tag } = props;
327
+ if (children) return React__namespace.createElement("span", { ...styles, ...blockProps }, children);
328
+ return React__namespace.createElement(tag || "span", {
329
+ ...styles,
330
+ ...blockProps,
331
+ dangerouslySetInnerHTML: { __html: content || "" }
332
+ });
333
+ };
334
+ const Config$l = {
335
+ type: "Span",
336
+ label: "Span",
337
+ category: "core",
338
+ group: "typography",
339
+ ...runtime.registerChaiBlockSchema({
340
+ properties: {
341
+ styles: runtime.StylesProp(""),
342
+ content: {
343
+ type: "string",
344
+ title: "Content",
345
+ default: "",
346
+ ui: { "ui:widget": "textarea", "ui:autosize": true, "ui:rows": 3 }
347
+ }
348
+ }
349
+ }),
350
+ aiProps: ["content"],
351
+ i18nProps: ["content"],
352
+ canAcceptBlock: () => true
353
+ };
354
+ function DiJavascript(props) {
355
+ return iconBase.GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 32 32" }, "child": [{ "tag": "path", "attr": { "d": "M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z" }, "child": [] }] })(props);
356
+ }
357
+ const CustomScript = (props) => {
358
+ const { scripts, inBuilder, blockProps } = props;
359
+ if (inBuilder)
360
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...blockProps, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: iconBase.cn("pointer-events-none flex flex-col items-center justify-center p-2", ""), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800", children: /* @__PURE__ */ jsxRuntime.jsx("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" }) }) }) });
361
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: scripts } });
362
+ };
363
+ const Config$k = {
364
+ type: "CustomScript",
365
+ label: "web_blocks.custom_script",
366
+ category: "core",
367
+ icon: DiJavascript,
368
+ group: "advanced",
369
+ ...runtime.registerChaiBlockSchema({
370
+ properties: {
371
+ scripts: {
372
+ type: "string",
373
+ title: "Script",
374
+ default: "",
375
+ format: "code",
376
+ placeholder: "<script>console.log('Hello, world!');<\/script>"
377
+ }
378
+ }
379
+ })
380
+ };
381
+ const DividerBlock = (props) => {
382
+ const { blockProps, styles } = props;
383
+ return React.createElement("hr", { ...styles, ...blockProps });
384
+ };
385
+ const Config$j = {
386
+ type: "Divider",
387
+ label: "web_blocks.divider",
388
+ category: "core",
389
+ icon: reactIcons.DividerHorizontalIcon,
390
+ group: "basic",
391
+ ...runtime.registerChaiBlockSchema({
392
+ properties: {
393
+ styles: runtime.StylesProp("bg-gray-900 h-0.5 py-2 my-1")
394
+ }
395
+ })
396
+ };
397
+ const Component$1 = (props) => {
398
+ const { blockProps, inBuilder, children, globalBlock } = props;
399
+ if (inBuilder && !globalBlock) {
400
+ return /* @__PURE__ */ jsxRuntime.jsxs(
401
+ "div",
402
+ {
403
+ className: "flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",
404
+ ...blockProps,
405
+ children: [
406
+ /* @__PURE__ */ jsxRuntime.jsxs("h1", { children: [
407
+ "Global Block - ",
408
+ globalBlock
409
+ ] }),
410
+ /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Choose a block from the sidebar to add it to this page." })
411
+ ]
412
+ }
413
+ );
414
+ }
415
+ return React__namespace.createElement("span", { ...blockProps }, children);
416
+ };
417
+ const Config$i = {
418
+ type: "GlobalBlock",
419
+ label: "Global Block",
420
+ icon: lucideReact.GlobeIcon,
421
+ category: "core",
422
+ group: "basic",
423
+ ...runtime.registerChaiBlockSchema({
424
+ properties: {
425
+ globalBlock: {
426
+ type: "string",
427
+ title: "Global Block",
428
+ default: "",
429
+ ui: { "ui:widget": "hidden" }
430
+ }
431
+ }
432
+ })
433
+ };
434
+ const IconBlock = (props) => {
435
+ const { blockProps, icon, styles, width, inBuilder, height } = props;
436
+ const iStyles = addForcedClasses(styles, "");
437
+ if (lodashEs.isEmpty(icon)) {
438
+ return /* @__PURE__ */ jsxRuntime.jsx(EmptySlot, { inBuilder, className: "h-8 w-14" });
439
+ }
440
+ const svg = icon.replace(/<svg /g, '<svg class="w-[inherit] h-[inherit]" ');
441
+ return React__namespace.createElement("span", {
442
+ ...blockProps,
443
+ ...iStyles,
444
+ style: {
445
+ width: width ? `${width}px` : "auto",
446
+ height: height ? `${height}px` : "auto"
447
+ },
448
+ dangerouslySetInnerHTML: { __html: svg }
449
+ });
450
+ };
451
+ const Config$h = {
452
+ type: "Icon",
453
+ label: "web_blocks.icon",
454
+ category: "core",
455
+ icon: reactIcons.SketchLogoIcon,
456
+ group: "media",
457
+ ...runtime.registerChaiBlockSchema({
458
+ properties: {
459
+ styles: runtime.StylesProp(""),
460
+ icon: {
461
+ type: "string",
462
+ title: "Icon",
463
+ 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>`,
464
+ ui: { "ui:widget": "icon" }
465
+ },
466
+ width: {
467
+ type: "number",
468
+ default: 16,
469
+ title: "Width"
470
+ },
471
+ height: {
472
+ type: "number",
473
+ default: 16,
474
+ title: "Height"
475
+ }
476
+ }
477
+ })
478
+ };
479
+ const ImageBlock = (props) => {
480
+ const { blockProps, image, mobileImage, styles, alt, height, width, lazyLoading } = props;
481
+ if (lodashEs.isEmpty(image)) return /* @__PURE__ */ jsxRuntime.jsx(EmptySlot, { className: "h-36" });
482
+ return /* @__PURE__ */ jsxRuntime.jsxs("picture", { children: [
483
+ mobileImage && /* @__PURE__ */ jsxRuntime.jsx("source", { srcSet: mobileImage, media: "(max-width: 480px)" }),
484
+ /* @__PURE__ */ jsxRuntime.jsx(
485
+ "img",
486
+ {
487
+ ...blockProps,
488
+ ...styles,
489
+ src: image,
490
+ alt,
491
+ loading: lazyLoading ? "lazy" : "eager",
492
+ width,
493
+ height
494
+ }
495
+ )
496
+ ] });
497
+ };
498
+ const Config$g = {
499
+ type: "Image",
500
+ label: "Image",
501
+ category: "core",
502
+ icon: reactIcons.ImageIcon,
503
+ group: "media",
504
+ ...runtime.registerChaiBlockSchema({
505
+ properties: {
506
+ styles: runtime.StylesProp(""),
507
+ image: {
508
+ type: "string",
509
+ title: "Image",
510
+ default: "https://fakeimg.pl/400x200?text=Choose&font=bebas",
511
+ ui: { "ui:widget": "image" }
512
+ },
513
+ alt: {
514
+ type: "string",
515
+ title: "Alt text",
516
+ default: "",
517
+ ui: { "ui:placeholder": "Enter alt text" }
518
+ },
519
+ lazyLoading: {
520
+ type: "boolean",
521
+ title: "Lazy Load",
522
+ default: true
523
+ },
524
+ width: {
525
+ type: "number",
526
+ title: "Width",
527
+ default: "",
528
+ ui: { "ui:placeholder": "Enter width" }
529
+ },
530
+ height: {
531
+ type: "number",
532
+ title: "Height",
533
+ default: "",
534
+ ui: { "ui:placeholder": "Enter height" }
535
+ },
536
+ mobileImage: {
537
+ type: "string",
538
+ title: "Mobile Image",
539
+ default: "",
540
+ ui: { "ui:widget": "image" }
541
+ }
542
+ }
543
+ }),
544
+ aiProps: ["alt"],
545
+ i18nProps: ["alt"]
546
+ };
547
+ const LightBoxLinkBlock = (props) => {
548
+ const { blockProps, children, styles, inBuilder, content, href } = props;
549
+ const { hrefType, autoplay, maxWidth, backdropColor, galleryName } = props;
550
+ const forcedStyles = addForcedClasses(styles, "cb-lightbox vbox-item");
551
+ if (!children && lodashEs.isEmpty(styles == null ? void 0 : styles.className) && lodashEs.isEmpty(content)) {
552
+ return /* @__PURE__ */ jsxRuntime.jsx(EmptySlot, { inBuilder });
553
+ }
554
+ if (inBuilder) {
555
+ if (children) {
556
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { ...blockProps, ...forcedStyles, children });
557
+ } else {
558
+ return React.createElement("span", {
559
+ ...blockProps,
560
+ ...forcedStyles,
561
+ dangerouslySetInnerHTML: { __html: content }
562
+ });
563
+ }
564
+ }
565
+ const lightBoxAttrs = {};
566
+ if (hrefType !== "image") lightBoxAttrs["data-vbtype"] = hrefType;
567
+ if (autoplay) lightBoxAttrs["data-autoplay"] = "true";
568
+ if (maxWidth) lightBoxAttrs["data-maxwidth"] = maxWidth + "px";
569
+ if (backdropColor) lightBoxAttrs["data-overlay"] = backdropColor;
570
+ if (galleryName) lightBoxAttrs["data-gall"] = galleryName;
571
+ if (children) {
572
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { "aria-label": content, ...lightBoxAttrs, href: href || "#/", ...blockProps, ...forcedStyles, children });
573
+ }
574
+ return React.createElement("a", {
575
+ ...blockProps,
576
+ ...forcedStyles,
577
+ ...lightBoxAttrs,
578
+ href: href || "#",
579
+ dangerouslySetInnerHTML: { __html: content },
580
+ "aria-label": content
581
+ });
582
+ };
583
+ const Config$f = {
584
+ type: "LightBoxLink",
585
+ label: "Lightbox Link",
586
+ category: "core",
587
+ icon: reactIcons.ImageIcon,
588
+ group: "basic",
589
+ ...runtime.registerChaiBlockSchema({
590
+ properties: {
591
+ styles: runtime.StylesProp(""),
592
+ content: {
593
+ type: "string",
594
+ title: "Content",
595
+ default: "Link text or drop blocks inside"
596
+ },
597
+ hrefType: {
598
+ type: "string",
599
+ title: "Type",
600
+ default: "image",
601
+ enum: ["image", "video", "iframe", "inline", "ajax"],
602
+ enumNames: ["Image", "Video", "Iframe", "Inline", "Ajax"]
603
+ },
604
+ href: {
605
+ type: "string",
606
+ title: "Href",
607
+ default: ""
608
+ },
609
+ autoplay: {
610
+ type: "boolean",
611
+ title: "Autoplay (Video only)",
612
+ default: false
613
+ },
614
+ maxWidth: {
615
+ type: "number",
616
+ title: "Max Width",
617
+ default: ""
618
+ },
619
+ backdropColor: {
620
+ type: "string",
621
+ title: "Backdrop Color",
622
+ default: ""
623
+ },
624
+ galleryName: {
625
+ type: "string",
626
+ title: "Gallery Name",
627
+ default: ""
628
+ }
629
+ },
630
+ dependencies: {
631
+ autoplay: ["hrefType", "video"]
632
+ }
633
+ }),
634
+ i18nProps: ["content"],
635
+ aiProps: ["content"],
636
+ canAcceptBlock: (type) => type !== "Link" && type !== "LightBoxLink"
637
+ };
638
+ const LinkBlock = (props) => {
639
+ const { blockProps, link, children, styles, inBuilder, content } = props;
640
+ let emptyStyles = {};
641
+ if (!children && lodashEs.isEmpty(content)) {
642
+ emptyStyles = { minHeight: "50px", display: "flex", alignItems: "center", justifyContent: "center" };
643
+ }
644
+ if (inBuilder) {
645
+ if (children) {
646
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { ...blockProps, style: emptyStyles, ...styles, children });
647
+ } else {
648
+ return React.createElement(
649
+ "span",
650
+ {
651
+ ...blockProps,
652
+ ...styles,
653
+ style: emptyStyles
654
+ },
655
+ content
656
+ );
657
+ }
658
+ }
659
+ if (children) {
660
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { "aria-label": content, href: (link == null ? void 0 : link.href) || "#/", target: link == null ? void 0 : link.target, ...blockProps, ...styles, children });
661
+ }
662
+ return React.createElement(
663
+ "a",
664
+ {
665
+ ...blockProps,
666
+ ...styles,
667
+ href: (link == null ? void 0 : link.href) || "#",
668
+ target: (link == null ? void 0 : link.target) || "_self",
669
+ "aria-label": content
670
+ },
671
+ content
672
+ );
673
+ };
674
+ const Config$e = {
675
+ type: "Link",
676
+ label: "Link",
677
+ category: "core",
678
+ icon: reactIcons.Link1Icon,
679
+ group: "basic",
680
+ ...runtime.registerChaiBlockSchema({
681
+ properties: {
682
+ styles: runtime.StylesProp(""),
683
+ content: {
684
+ type: "string",
685
+ default: "Link goes here",
686
+ title: "Content"
687
+ },
688
+ link: {
689
+ type: "object",
690
+ properties: {
691
+ type: { type: "string" },
692
+ href: { type: "string" },
693
+ target: { type: "string" }
694
+ },
695
+ default: {
696
+ type: "url",
697
+ href: "",
698
+ target: "_self"
699
+ },
700
+ ui: {
701
+ "ui:field": "link"
702
+ }
703
+ }
704
+ }
705
+ }),
706
+ aiProps: ["content"],
707
+ i18nProps: ["content"],
708
+ canAcceptBlock: (type) => type !== "Link"
709
+ };
710
+ const ListBlock = (props) => {
711
+ const { blockProps, children, listType, styles, tag, inBuilder } = props;
712
+ const className = iconBase.cn(lodashEs.get(styles, "className", ""), listType);
713
+ if (!children && lodashEs.isEmpty(styles == null ? void 0 : styles.className)) {
714
+ return /* @__PURE__ */ jsxRuntime.jsx(EmptySlot, { inBuilder });
715
+ }
716
+ return React__namespace.createElement(
717
+ tag ? tag : listType === "list-decimal" ? "ol" : "ul",
718
+ { ...blockProps, ...styles, className },
719
+ children
720
+ );
721
+ };
722
+ const Config$d = {
723
+ type: "List",
724
+ label: "web_blocks.list",
725
+ icon: reactIcons.RowsIcon,
726
+ category: "core",
727
+ group: "basic",
728
+ ...runtime.registerChaiBlockSchema({
729
+ properties: {
730
+ styles: runtime.StylesProp(""),
731
+ listType: {
732
+ type: "string",
733
+ title: "List Type",
734
+ default: "list-none",
735
+ oneOf: [
736
+ { enum: ["list-none"], title: "List None" },
737
+ { enum: ["list-disc"], title: "Disc" },
738
+ { enum: ["list-decimal"], title: "Decimal" }
739
+ ]
740
+ }
741
+ }
742
+ }),
743
+ canAcceptBlock: (blockType) => blockType === "ListItem",
744
+ blocks: [
745
+ { _type: "List", _id: "a", listType: "list-none", styles: "#styles:," },
746
+ {
747
+ _type: "ListItem",
748
+ _id: "b",
749
+ _parent: "a",
750
+ styles: "#styles:,",
751
+ content: "Item 1"
752
+ },
753
+ {
754
+ _type: "ListItem",
755
+ _id: "c",
756
+ _parent: "a",
757
+ styles: "#styles:,",
758
+ content: "Item 2"
759
+ },
760
+ {
761
+ _type: "ListItem",
762
+ _id: "d",
763
+ _parent: "a",
764
+ styles: "#styles:,",
765
+ content: "Item 3"
766
+ }
767
+ ]
768
+ };
769
+ const ListItemBlock = (props) => {
770
+ const { blockProps, content, styles, children, tag } = props;
771
+ if (!children) {
772
+ return React__namespace.createElement(tag || "li", {
773
+ ...styles,
774
+ ...blockProps,
775
+ dangerouslySetInnerHTML: { __html: content }
776
+ });
777
+ }
778
+ return React__namespace.createElement(tag || "li", { ...styles, ...blockProps }, children);
779
+ };
780
+ const Config$c = {
781
+ type: "ListItem",
782
+ label: "List Item",
783
+ icon: reactIcons.ColumnsIcon,
784
+ category: "core",
785
+ group: "basic",
786
+ ...runtime.registerChaiBlockSchema({
787
+ properties: {
788
+ styles: runtime.StylesProp(""),
789
+ content: {
790
+ type: "string",
791
+ default: "List item",
792
+ title: "Content",
793
+ ui: {
794
+ "ui:widget": "textarea"
795
+ }
796
+ }
797
+ }
798
+ }),
799
+ i18nProps: ["content"],
800
+ aiProps: ["content"],
801
+ canAcceptBlock: (type) => type !== "ListItem",
802
+ canBeNested: (type) => type === "List"
803
+ };
804
+ const RawTextBlock = (props) => {
805
+ if (props.inBuilder || props.forceWrapper) {
806
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { ...props.blockProps, children: props.content });
807
+ }
808
+ return `${props.content}`;
809
+ };
810
+ const Config$b = {
811
+ type: "Text",
812
+ label: "Text",
813
+ hidden: true,
814
+ category: "core",
815
+ group: "typography",
816
+ icon: reactIcons.SpaceBetweenVerticallyIcon,
817
+ ...runtime.registerChaiBlockSchema({
818
+ properties: {
819
+ styles: runtime.StylesProp("text-black"),
820
+ content: {
821
+ type: "string",
822
+ default: ""
823
+ }
824
+ }
825
+ }),
826
+ aiProps: ["content"],
827
+ i18nProps: ["content"]
828
+ };
829
+ const YOUTUBE_REGEX = /^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/;
830
+ const VIMEO_REGEX = /^(https?:\/\/)?(www\.)?player.vimeo\.com/;
831
+ const DAILYMOTION_REGEX = /^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/;
832
+ const getEmbedURL = (url) => {
833
+ if (YOUTUBE_REGEX.test(url)) {
834
+ const match = url.match(YOUTUBE_REGEX);
835
+ if (match) {
836
+ const videoId = match[4];
837
+ return `https://www.youtube.com/embed/${videoId}`;
838
+ }
839
+ return url;
840
+ }
841
+ if (VIMEO_REGEX.test(url)) {
842
+ const match = url.match(VIMEO_REGEX);
843
+ if (match) {
844
+ const videoId = match[3];
845
+ return `https://player.vimeo.com/video/${videoId}`;
846
+ }
847
+ return url;
848
+ }
849
+ if (DAILYMOTION_REGEX.test(url)) {
850
+ const match = url.match(DAILYMOTION_REGEX);
851
+ if (match) {
852
+ const videoId = match[4];
853
+ return `https://www.dailymotion.com/embed/video/${videoId}`;
854
+ }
855
+ return url;
856
+ }
857
+ return null;
858
+ };
859
+ const VideoBlock = React__namespace.memo((props) => {
860
+ const { blockProps, inBuilder, styles, url, controls } = props;
861
+ const autoplay = lodashEs.get(controls, "autoPlay", false);
862
+ const _controls = lodashEs.get(controls, "controls", false);
863
+ const muted = autoplay || lodashEs.get(controls, "muted", true);
864
+ const loop = lodashEs.get(controls, "loop", false);
865
+ if (lodashEs.isEmpty(url)) return /* @__PURE__ */ jsxRuntime.jsx(EmptySlot, { inBuilder, className: "h-36" });
866
+ let embedURL = getEmbedURL(url);
867
+ let videoElement = null;
868
+ if (embedURL) {
869
+ if (!lodashEs.isEmpty(embedURL)) {
870
+ const iframeControls = [];
871
+ iframeControls.push(`autoplay=${autoplay ? 1 : 0}`);
872
+ iframeControls.push(`controls=${controls ? 1 : 0}`);
873
+ iframeControls.push(`mute=${muted ? 1 : 0}&muted=${muted ? 1 : 0}`);
874
+ iframeControls.push(`loop=${loop ? 1 : 0}`);
875
+ embedURL = `${embedURL}?${iframeControls.join("&")}`;
876
+ }
877
+ videoElement = React__namespace.createElement("iframe", {
878
+ ...blockProps,
879
+ className: "absolute inset-0 w-full h-full",
880
+ src: embedURL,
881
+ allow: inBuilder ? "" : "autoplay *; fullscreen *",
882
+ allowFullScreen: true,
883
+ frameBorder: 0
884
+ });
885
+ } else {
886
+ videoElement = React__namespace.createElement("video", {
887
+ ...blockProps,
888
+ className: "absolute inset-0 w-full h-full",
889
+ src: url,
890
+ controls: _controls,
891
+ muted,
892
+ autoPlay: inBuilder ? false : autoplay,
893
+ loop
894
+ });
895
+ }
896
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...lodashEs.pick(styles, ["className"]), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full overflow-hidden", style: { paddingBottom: "56.25%" }, children: [
897
+ inBuilder ? /* @__PURE__ */ jsxRuntime.jsx("div", { ...blockProps, ...lodashEs.omit(styles, ["className"]), className: "absolute inset-0 z-20 h-full w-full" }) : null,
898
+ videoElement
899
+ ] }) });
900
+ });
901
+ const Config$a = {
902
+ type: "Video",
903
+ label: "Video",
904
+ category: "core",
905
+ icon: reactIcons.VideoIcon,
906
+ group: "media",
907
+ ...runtime.registerChaiBlockSchema({
908
+ properties: {
909
+ styles: runtime.StylesProp(""),
910
+ url: {
911
+ type: "string",
912
+ title: "Video URL",
913
+ default: "https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"
914
+ },
915
+ controls: {
916
+ type: "object",
917
+ title: "Controls",
918
+ default: {
919
+ autoplay: false,
920
+ controls: true,
921
+ loop: false,
922
+ muted: false
923
+ },
924
+ properties: {
925
+ autoplay: {
926
+ type: "boolean",
927
+ title: "Autoplay",
928
+ default: false
929
+ },
930
+ controls: {
931
+ type: "boolean",
932
+ title: "Show Controls",
933
+ default: true
934
+ },
935
+ loop: {
936
+ type: "boolean",
937
+ title: "Loop Video",
938
+ default: false
939
+ },
940
+ muted: {
941
+ type: "boolean",
942
+ title: "Muted",
943
+ default: false
944
+ }
945
+ }
946
+ }
947
+ }
948
+ }),
949
+ i18nProps: ["url"]
950
+ };
951
+ const CheckboxBlock = (props) => {
952
+ const { blockProps, fieldName, label, styles, inputStyles, required, checked, showLabel = true } = props;
953
+ const fieldId = iconBase.generateUUID();
954
+ if (!showLabel)
955
+ return /* @__PURE__ */ jsxRuntime.jsx(
956
+ "input",
957
+ {
958
+ id: fieldId,
959
+ ...blockProps,
960
+ ...inputStyles,
961
+ ...styles,
962
+ type: "checkbox",
963
+ required,
964
+ name: fieldName
965
+ }
966
+ );
967
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...styles, ...blockProps, children: [
968
+ /* @__PURE__ */ jsxRuntime.jsx(
969
+ "input",
970
+ {
971
+ ...inputStyles,
972
+ name: fieldName,
973
+ id: fieldId,
974
+ type: "checkbox",
975
+ required,
976
+ defaultChecked: checked
977
+ }
978
+ ),
979
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: fieldId, children: label })
980
+ ] });
981
+ };
982
+ const Config$9 = {
983
+ type: "Checkbox",
984
+ label: "web_blocks.checkbox",
985
+ category: "core",
986
+ icon: reactIcons.CheckboxIcon,
987
+ group: "form",
988
+ ...runtime.registerChaiBlockSchema({
989
+ properties: {
990
+ styles: runtime.StylesProp("flex items-center gap-x-2"),
991
+ inputStyles: runtime.StylesProp(""),
992
+ fieldName: {
993
+ type: "string",
994
+ title: "Field Name",
995
+ default: "fieldName"
996
+ },
997
+ label: {
998
+ type: "string",
999
+ title: "Label",
1000
+ default: "Label"
1001
+ },
1002
+ checked: {
1003
+ type: "boolean",
1004
+ title: "Checked",
1005
+ default: false
1006
+ },
1007
+ required: {
1008
+ type: "boolean",
1009
+ title: "Required",
1010
+ default: false
1011
+ },
1012
+ showLabel: {
1013
+ type: "boolean",
1014
+ title: "Show Label",
1015
+ default: true
1016
+ }
1017
+ }
1018
+ }),
1019
+ aiProps: ["label"],
1020
+ i18nProps: ["label"]
1021
+ };
1022
+ const FormBlock = (props) => {
1023
+ const { children, blockProps, errorMessage, successMessage, action, styles, inBuilder } = props;
1024
+ let nestedChildren = children;
1025
+ if (!children) {
1026
+ nestedChildren = /* @__PURE__ */ jsxRuntime.jsx(EmptySlot, { inBuilder });
1027
+ }
1028
+ const alpineAttrs = {
1029
+ "x-data": "{}",
1030
+ "x-on:submit.prevent": "post"
1031
+ };
1032
+ const formResponseAttr = {
1033
+ "x-html": "",
1034
+ ":class": "{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"
1035
+ };
1036
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1037
+ "form",
1038
+ {
1039
+ ...alpineAttrs,
1040
+ "data-error": errorMessage,
1041
+ "data-success": successMessage,
1042
+ method: "post",
1043
+ action,
1044
+ ...blockProps,
1045
+ ...styles,
1046
+ children: [
1047
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ...formResponseAttr }),
1048
+ nestedChildren
1049
+ ]
1050
+ }
1051
+ );
1052
+ };
1053
+ const Config$8 = {
1054
+ type: "Form",
1055
+ label: "Form",
1056
+ category: "core",
1057
+ icon: lucideReact.GroupIcon,
1058
+ group: "form",
1059
+ blocks: () => [
1060
+ { _type: "Form", _id: "form", styles: "#styles:p-1 space-y-2," },
1061
+ { _type: "Input", _id: "form_input", _parent: "form", styles: "#styles:," },
1062
+ {
1063
+ _type: "FormButton",
1064
+ _id: "form_submit_btn",
1065
+ _parent: "form",
1066
+ styles: "#styles:bg-black text-white rounded px-3 py-1,"
1067
+ }
1068
+ ],
1069
+ ...runtime.registerChaiBlockSchema({
1070
+ properties: {
1071
+ styles: runtime.StylesProp(""),
1072
+ action: {
1073
+ type: "string",
1074
+ title: "Submit URL",
1075
+ default: "/api/form/submit"
1076
+ },
1077
+ errorMessage: {
1078
+ type: "string",
1079
+ title: "Error Message",
1080
+ default: "Something went wrong. Please try again",
1081
+ ui: { "ui:widget": "richtext" }
1082
+ },
1083
+ successMessage: {
1084
+ type: "string",
1085
+ title: "Success Message",
1086
+ default: "Thank you for your submission.",
1087
+ ui: { "ui:widget": "richtext" }
1088
+ }
1089
+ }
1090
+ }),
1091
+ i18nProps: ["errorMessage", "successMessage"],
1092
+ aiProps: ["errorMessage", "successMessage"],
1093
+ canAcceptBlock: () => true
1094
+ };
1095
+ const FormButtonBlock = (props) => {
1096
+ const { blockProps, inBuilder, label, styles, inputStyles, icon, iconSize, iconPos } = props;
1097
+ const fieldId = iconBase.generateUUID();
1098
+ const attrs = {
1099
+ "x-bind:disabled": "formLoading"
1100
+ };
1101
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1102
+ "button",
1103
+ {
1104
+ id: fieldId,
1105
+ ...attrs,
1106
+ ...inputStyles,
1107
+ ...styles,
1108
+ ...blockProps || {},
1109
+ type: inBuilder ? "button" : "submit",
1110
+ "aria-label": label,
1111
+ children: [
1112
+ label,
1113
+ icon && /* @__PURE__ */ jsxRuntime.jsx(
1114
+ "div",
1115
+ {
1116
+ style: { width: iconSize + "px" },
1117
+ className: iconPos + " " + (iconPos === "order-first" ? "mr-2" : "ml-2") || "",
1118
+ dangerouslySetInnerHTML: { __html: icon }
1119
+ }
1120
+ )
1121
+ ]
1122
+ }
1123
+ );
1124
+ };
1125
+ const Config$7 = {
1126
+ type: "FormButton",
1127
+ label: "Submit Button",
1128
+ category: "core",
1129
+ icon: reactIcons.ButtonIcon,
1130
+ group: "form",
1131
+ ...runtime.registerChaiBlockSchema({
1132
+ properties: {
1133
+ styles: runtime.StylesProp(
1134
+ "text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"
1135
+ ),
1136
+ inputStyles: runtime.StylesProp(""),
1137
+ label: {
1138
+ type: "string",
1139
+ title: "Label",
1140
+ default: "Submit",
1141
+ ai: true,
1142
+ i18n: true
1143
+ },
1144
+ icon: {
1145
+ type: "string",
1146
+ title: "Icon",
1147
+ default: "",
1148
+ ui: { "ui:widget": "icon" }
1149
+ },
1150
+ iconSize: {
1151
+ type: "number",
1152
+ title: "Icon size",
1153
+ default: 24
1154
+ },
1155
+ iconPos: {
1156
+ type: "string",
1157
+ title: "Icon Position",
1158
+ default: "order-last",
1159
+ enum: ["order-first", "order-last"]
1160
+ }
1161
+ }
1162
+ }),
1163
+ i18nProps: ["label"],
1164
+ aiProps: ["label"]
1165
+ };
1166
+ const InputBlock = (props) => {
1167
+ const { blockProps, fieldName, label, placeholder, styles, inputStyles, showLabel, required, inputType } = props;
1168
+ const fieldId = iconBase.generateUUID();
1169
+ if (!showLabel) {
1170
+ return /* @__PURE__ */ jsxRuntime.jsx(
1171
+ "input",
1172
+ {
1173
+ id: fieldId,
1174
+ name: fieldName,
1175
+ ...blockProps,
1176
+ ...inputStyles,
1177
+ ...styles,
1178
+ type: inputType,
1179
+ placeholder,
1180
+ required
1181
+ }
1182
+ );
1183
+ }
1184
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...styles, ...blockProps, children: [
1185
+ showLabel && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: fieldId, children: label }),
1186
+ /* @__PURE__ */ jsxRuntime.jsx(
1187
+ "input",
1188
+ {
1189
+ name: fieldName,
1190
+ ...inputStyles,
1191
+ id: fieldId,
1192
+ type: inputType,
1193
+ placeholder,
1194
+ required
1195
+ }
1196
+ )
1197
+ ] });
1198
+ };
1199
+ const Config$6 = {
1200
+ type: "Input",
1201
+ label: "web_blocks.input",
1202
+ category: "core",
1203
+ icon: reactIcons.InputIcon,
1204
+ group: "form",
1205
+ ...runtime.registerChaiBlockSchema({
1206
+ properties: {
1207
+ styles: runtime.StylesProp(""),
1208
+ inputStyles: runtime.StylesProp("w-full p-1"),
1209
+ fieldName: {
1210
+ type: "string",
1211
+ title: "Field Name",
1212
+ default: "fieldName"
1213
+ },
1214
+ showLabel: {
1215
+ type: "boolean",
1216
+ title: "Show Label",
1217
+ default: true
1218
+ },
1219
+ label: {
1220
+ type: "string",
1221
+ title: "Label",
1222
+ default: "Label",
1223
+ ai: true,
1224
+ i18n: true
1225
+ },
1226
+ placeholder: {
1227
+ type: "string",
1228
+ title: "Placeholder",
1229
+ default: "Placeholder"
1230
+ },
1231
+ required: {
1232
+ type: "boolean",
1233
+ title: "Required",
1234
+ default: false
1235
+ },
1236
+ inputType: {
1237
+ type: "string",
1238
+ title: "Input Type",
1239
+ default: "text",
1240
+ enum: [
1241
+ "text",
1242
+ "email",
1243
+ "password",
1244
+ "number",
1245
+ "tel",
1246
+ "file",
1247
+ "hidden",
1248
+ "range",
1249
+ "submit",
1250
+ "color",
1251
+ "date",
1252
+ "time"
1253
+ ]
1254
+ }
1255
+ }
1256
+ }),
1257
+ aiProps: ["label", "placeholder"],
1258
+ i18nProps: ["label", "placeholder"]
1259
+ };
1260
+ const LabelBlock = (props) => {
1261
+ const { blockProps, content, styles, children } = props;
1262
+ const labelProps = { ...styles, ...blockProps };
1263
+ if (children) return React__namespace.createElement("label", labelProps, children);
1264
+ return React__namespace.createElement("label", {
1265
+ ...labelProps,
1266
+ dangerouslySetInnerHTML: { __html: content }
1267
+ });
1268
+ };
1269
+ const Config$5 = {
1270
+ type: "Label",
1271
+ label: "Label",
1272
+ category: "core",
1273
+ icon: reactIcons.LetterCaseToggleIcon,
1274
+ group: "form",
1275
+ ...runtime.registerChaiBlockSchema({
1276
+ properties: {
1277
+ styles: runtime.StylesProp(),
1278
+ content: {
1279
+ type: "string",
1280
+ title: "Content",
1281
+ default: ""
1282
+ }
1283
+ }
1284
+ }),
1285
+ aiProps: ["content"],
1286
+ i18nProps: ["content"]
1287
+ };
1288
+ const RadioBlock = (props) => {
1289
+ const { blockProps, fieldName, label, styles, inputStyles, required, checked, showLabel = true } = props;
1290
+ const fieldId = iconBase.generateUUID();
1291
+ if (!showLabel)
1292
+ return /* @__PURE__ */ jsxRuntime.jsx(
1293
+ "input",
1294
+ {
1295
+ id: fieldId,
1296
+ ...blockProps,
1297
+ ...inputStyles,
1298
+ ...styles,
1299
+ type: "radio",
1300
+ required,
1301
+ checked,
1302
+ name: fieldName
1303
+ }
1304
+ );
1305
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...styles, ...blockProps, children: [
1306
+ /* @__PURE__ */ jsxRuntime.jsx("input", { ...inputStyles, name: fieldName, id: fieldId, type: "radio", required, defaultChecked: checked }),
1307
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: fieldId, children: label })
1308
+ ] });
1309
+ };
1310
+ const Config$4 = {
1311
+ type: "Radio",
1312
+ label: "web_blocks.radio",
1313
+ category: "core",
1314
+ icon: reactIcons.RadiobuttonIcon,
1315
+ group: "form",
1316
+ ...runtime.registerChaiBlockSchema({
1317
+ properties: {
1318
+ styles: runtime.StylesProp("flex items-center gap-x-2"),
1319
+ inputStyles: runtime.StylesProp(""),
1320
+ fieldName: {
1321
+ type: "string",
1322
+ title: "Field Name",
1323
+ default: "fieldName"
1324
+ },
1325
+ label: {
1326
+ type: "string",
1327
+ title: "Label",
1328
+ default: "Label"
1329
+ },
1330
+ checked: {
1331
+ type: "boolean",
1332
+ title: "Checked",
1333
+ default: false
1334
+ },
1335
+ required: {
1336
+ type: "boolean",
1337
+ title: "Required",
1338
+ default: false
1339
+ },
1340
+ showLabel: {
1341
+ type: "boolean",
1342
+ title: "Show Label",
1343
+ default: true
1344
+ }
1345
+ }
1346
+ }),
1347
+ aiProps: ["label"],
1348
+ i18nProps: ["label"]
1349
+ };
1350
+ const SelectBlock = (props) => {
1351
+ const { blockProps, fieldName, label, placeholder, styles, inputStyles, required, showLabel, _multiple, options } = props;
1352
+ const fieldId = iconBase.generateUUID();
1353
+ if (!showLabel) {
1354
+ return /* @__PURE__ */ jsxRuntime.jsxs("select", { id: fieldId, ...styles, ...blockProps, required, multiple: _multiple, name: fieldName, children: [
1355
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, selected: true, hidden: true, children: placeholder }),
1356
+ lodashEs.map(options, (option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option == null ? void 0 : option.value, children: option == null ? void 0 : option.label }, option == null ? void 0 : option.value))
1357
+ ] });
1358
+ }
1359
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...styles, ...blockProps, children: [
1360
+ showLabel && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: fieldId, children: label }),
1361
+ /* @__PURE__ */ jsxRuntime.jsxs("select", { ...inputStyles, id: fieldId, required, multiple: _multiple, name: fieldName, children: [
1362
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, selected: true, hidden: true, children: placeholder }),
1363
+ lodashEs.map(options, (option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option == null ? void 0 : option.value, children: option == null ? void 0 : option.label }, option == null ? void 0 : option.value))
1364
+ ] })
1365
+ ] });
1366
+ };
1367
+ const Config$3 = {
1368
+ type: "Select",
1369
+ label: "web_blocks.select",
1370
+ category: "core",
1371
+ icon: reactIcons.DropdownMenuIcon,
1372
+ group: "form",
1373
+ ...runtime.registerChaiBlockSchema({
1374
+ properties: {
1375
+ styles: runtime.StylesProp(""),
1376
+ inputStyles: runtime.StylesProp("w-full p-1"),
1377
+ fieldName: {
1378
+ type: "string",
1379
+ title: "Field Name",
1380
+ default: "fieldName"
1381
+ },
1382
+ showLabel: {
1383
+ type: "boolean",
1384
+ title: "Show Label",
1385
+ default: true
1386
+ },
1387
+ label: {
1388
+ type: "string",
1389
+ title: "Label",
1390
+ default: "Label"
1391
+ },
1392
+ placeholder: {
1393
+ type: "string",
1394
+ title: "Placeholder",
1395
+ default: "Placeholder"
1396
+ },
1397
+ required: {
1398
+ type: "boolean",
1399
+ title: "Required",
1400
+ default: false
1401
+ },
1402
+ _multiple: {
1403
+ type: "boolean",
1404
+ title: "Multiple",
1405
+ default: false
1406
+ },
1407
+ options: {
1408
+ title: "Options",
1409
+ type: "array",
1410
+ default: [],
1411
+ items: {
1412
+ type: "object",
1413
+ properties: {
1414
+ label: {
1415
+ type: "string",
1416
+ title: "Label",
1417
+ default: ""
1418
+ },
1419
+ value: {
1420
+ type: "string",
1421
+ title: "Value",
1422
+ default: ""
1423
+ }
1424
+ }
1425
+ }
1426
+ }
1427
+ }
1428
+ }),
1429
+ aiProps: ["label", "placeholder"],
1430
+ i18nProps: ["label", "placeholder"]
1431
+ };
1432
+ const TextAreaBlock = (props) => {
1433
+ const { blockProps, fieldName, label, placeholder, styles, inputStyles, _rows, showLabel } = props;
1434
+ const fieldId = iconBase.generateUUID();
1435
+ if (!showLabel) {
1436
+ return /* @__PURE__ */ jsxRuntime.jsx(
1437
+ "textarea",
1438
+ {
1439
+ id: fieldId,
1440
+ name: fieldName,
1441
+ ...blockProps,
1442
+ ...inputStyles,
1443
+ ...styles,
1444
+ placeholder,
1445
+ rows: _rows
1446
+ }
1447
+ );
1448
+ }
1449
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...styles, ...blockProps, children: [
1450
+ showLabel && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: fieldId, children: label }),
1451
+ /* @__PURE__ */ jsxRuntime.jsx("textarea", { name: fieldName, ...inputStyles, id: fieldId, placeholder, rows: _rows })
1452
+ ] });
1453
+ };
1454
+ const Config$2 = {
1455
+ type: "TextArea",
1456
+ label: "web_blocks.textarea",
1457
+ category: "core",
1458
+ icon: reactIcons.InputIcon,
1459
+ group: "form",
1460
+ ...runtime.registerChaiBlockSchema({
1461
+ properties: {
1462
+ fieldName: {
1463
+ type: "string",
1464
+ title: "Field Name",
1465
+ default: "fieldName"
1466
+ },
1467
+ styles: runtime.StylesProp(""),
1468
+ inputStyles: runtime.StylesProp("w-full p-1"),
1469
+ showLabel: {
1470
+ type: "boolean",
1471
+ title: "Show Label",
1472
+ default: true
1473
+ },
1474
+ label: {
1475
+ type: "string",
1476
+ title: "Label",
1477
+ default: "Label",
1478
+ ui: { "ui:widget": "textarea", "ui:autosize": true, "ui:rows": 3 }
1479
+ },
1480
+ placeholder: {
1481
+ type: "string",
1482
+ title: "Placeholder",
1483
+ default: "Placeholder"
1484
+ },
1485
+ _rows: {
1486
+ type: "number",
1487
+ title: "Rows",
1488
+ default: 3
1489
+ }
1490
+ }
1491
+ }),
1492
+ aiProps: ["label", "placeholder"],
1493
+ i18nProps: ["label", "placeholder"]
1494
+ };
1495
+ const LineBreakBlock = (props) => {
1496
+ const { blockProps, styles } = props;
1497
+ return React.createElement("br", { ...blockProps, ...styles });
1498
+ };
1499
+ const Config$1 = {
1500
+ type: "LineBreak",
1501
+ label: "Line Break",
1502
+ category: "core",
1503
+ group: "basic",
1504
+ hidden: true,
1505
+ ...runtime.registerChaiBlockSchema({
1506
+ properties: {
1507
+ styles: runtime.StylesProp("")
1508
+ }
1509
+ }),
1510
+ canAcceptBlock: () => true,
1511
+ canDelete: () => false,
1512
+ canMove: () => false,
1513
+ canDuplicate: () => false
1514
+ };
1515
+ const NUMBER_TO_COL_SPAN = {
1516
+ SMALL: {
1517
+ 1: "col-span-1",
1518
+ 2: "col-span-2",
1519
+ 3: "col-span-3",
1520
+ 4: "col-span-4",
1521
+ 5: "col-span-5",
1522
+ 6: "col-span-6",
1523
+ 7: "col-span-7",
1524
+ 8: "col-span-8",
1525
+ 9: "col-span-9",
1526
+ 10: "col-span-10",
1527
+ 11: "col-span-11",
1528
+ 12: "col-span-12"
1529
+ },
1530
+ MEDIUM: {
1531
+ 1: "md:col-span-1",
1532
+ 2: "md:col-span-2",
1533
+ 3: "md:col-span-3",
1534
+ 4: "md:col-span-4",
1535
+ 5: "md:col-span-5",
1536
+ 6: "md:col-span-6",
1537
+ 7: "md:col-span-7",
1538
+ 8: "md:col-span-8",
1539
+ 9: "md:col-span-9",
1540
+ 10: "md:col-span-10",
1541
+ 11: "md:col-span-11",
1542
+ 12: "md:col-span-12"
1543
+ },
1544
+ LARGE: {
1545
+ 1: "lg:col-span-1",
1546
+ 2: "lg:col-span-2",
1547
+ 3: "lg:col-span-3",
1548
+ 4: "lg:col-span-4",
1549
+ 5: "lg:col-span-5",
1550
+ 6: "lg:col-span-6",
1551
+ 7: "lg:col-span-7",
1552
+ 8: "lg:col-span-8",
1553
+ 9: "lg:col-span-9",
1554
+ 10: "lg:col-span-10",
1555
+ 11: "lg:col-span-11",
1556
+ 12: "lg:col-span-12"
1557
+ }
1558
+ };
1559
+ const Column = (props) => {
1560
+ const { blockProps, children, styles, colSpan, tabletColSpan, desktopColSpan } = props;
1561
+ const className = [
1562
+ lodashEs.get(styles, "className", ""),
1563
+ lodashEs.get(NUMBER_TO_COL_SPAN, ["SMALL", isNaN(colSpan) || !colSpan ? 6 : colSpan], ""),
1564
+ tabletColSpan ? lodashEs.get(NUMBER_TO_COL_SPAN, ["MEDIUM", tabletColSpan || colSpan], "") : "",
1565
+ desktopColSpan ? lodashEs.get(NUMBER_TO_COL_SPAN, ["LARGE", tabletColSpan || colSpan], "") : ""
1566
+ ];
1567
+ const _styles = { className: className.join(" ") };
1568
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...blockProps, ...styles, ..._styles, children: children || /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900" }) });
1569
+ };
1570
+ const ColumnConfig = {
1571
+ type: "Column",
1572
+ label: "Column",
1573
+ group: "basic",
1574
+ category: "core",
1575
+ icon: lucideReact.Columns,
1576
+ wrapper: true,
1577
+ canDelete: () => true,
1578
+ canAcceptBlock: () => true,
1579
+ canBeNested: (type) => type === "Row",
1580
+ ...runtime.registerChaiBlockSchema({
1581
+ properties: {
1582
+ styles: runtime.StylesProp(""),
1583
+ colSpan: {
1584
+ type: "number",
1585
+ title: "Column Span",
1586
+ default: 6,
1587
+ enum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
1588
+ },
1589
+ tabletColSpan: {
1590
+ type: "number",
1591
+ title: "Column Span (Tablet)",
1592
+ default: null,
1593
+ enumNames: ["Default", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
1594
+ enum: [null, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
1595
+ },
1596
+ desktopColSpan: {
1597
+ type: "number",
1598
+ title: "Column Span (Desktop)",
1599
+ default: null,
1600
+ enumNames: ["Default", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
1601
+ enum: [null, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
1602
+ }
1603
+ }
1604
+ })
1605
+ };
1606
+ const Component = (props) => {
1607
+ const { blockProps, children, styles, gutter } = props;
1608
+ const className = [lodashEs.get(styles, "className", ""), " grid grid-cols-12"];
1609
+ const _styles = { className: className.join() };
1610
+ if (typeof (styles == null ? void 0 : styles.style) === "object") {
1611
+ styles.style.gap = `${gutter}px`;
1612
+ } else {
1613
+ _styles.style = { gap: `${gutter}px` };
1614
+ }
1615
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...blockProps, ...styles, ..._styles, children });
1616
+ };
1617
+ const Config = {
1618
+ type: "Row",
1619
+ label: "Row",
1620
+ group: "basic",
1621
+ icon: lucideReact.Rows,
1622
+ blocks: () => [
1623
+ { _type: "Row", _id: "row", styles: "#styles:,p-1" },
1624
+ { _type: "Column", id: "column", _parent: "row", styles: "#styles:," },
1625
+ { _type: "Column", id: "column", _parent: "row", styles: "#styles:," }
1626
+ ],
1627
+ category: "core",
1628
+ wrapper: true,
1629
+ canAcceptBlock: (childType) => childType === "Column",
1630
+ ...runtime.registerChaiBlockSchema({
1631
+ properties: {
1632
+ styles: runtime.StylesProp(""),
1633
+ colCount: {
1634
+ type: "number",
1635
+ default: 2,
1636
+ minimum: 0,
1637
+ ui: { "ui:widget": "colCount" }
1638
+ },
1639
+ gutter: {
1640
+ type: "number",
1641
+ title: "Gutter (in px)",
1642
+ default: 16,
1643
+ minimum: 0
1644
+ }
1645
+ }
1646
+ })
1647
+ };
1648
+ const loadWebBlocks = () => {
1649
+ runtime.registerChaiBlock(Component$3, Config$s);
1650
+ runtime.registerChaiBlock(EmptyBox, Config$p);
1651
+ runtime.registerChaiBlock(Component$2, Config$r);
1652
+ runtime.registerChaiBlock(HeadingBlock, Config$o);
1653
+ runtime.registerChaiBlock(ParagraphBlock, Config$n);
1654
+ runtime.registerChaiBlock(SpanBlock, Config$l);
1655
+ runtime.registerChaiBlock(RichTextBlock, Config$m);
1656
+ runtime.registerChaiBlock(LinkBlock, Config$e);
1657
+ runtime.registerChaiBlock(LightBoxLinkBlock, Config$f);
1658
+ runtime.registerChaiBlock(ListBlock, Config$d);
1659
+ runtime.registerChaiBlock(ListItemBlock, Config$c);
1660
+ runtime.registerChaiBlock(IconBlock, Config$h);
1661
+ runtime.registerChaiBlock(ImageBlock, Config$g);
1662
+ runtime.registerChaiBlock(VideoBlock, Config$a);
1663
+ runtime.registerChaiBlock(CustomHTMLBlock, Config$q);
1664
+ runtime.registerChaiBlock(CustomScript, Config$k);
1665
+ runtime.registerChaiBlock(RawTextBlock, Config$b);
1666
+ runtime.registerChaiBlock(FormBlock, Config$8);
1667
+ runtime.registerChaiBlock(FormButtonBlock, Config$7);
1668
+ runtime.registerChaiBlock(InputBlock, Config$6);
1669
+ runtime.registerChaiBlock(CheckboxBlock, Config$9);
1670
+ runtime.registerChaiBlock(RadioBlock, Config$4);
1671
+ runtime.registerChaiBlock(SelectBlock, Config$3);
1672
+ runtime.registerChaiBlock(TextAreaBlock, Config$2);
1673
+ runtime.registerChaiBlock(LabelBlock, Config$5);
1674
+ runtime.registerChaiBlock(LineBreakBlock, Config$1);
1675
+ runtime.registerChaiBlock(DividerBlock, Config$j);
1676
+ runtime.registerChaiBlock(Component$1, Config$i);
1677
+ runtime.registerChaiBlock(Component, Config);
1678
+ runtime.registerChaiBlock(Column, ColumnConfig);
1679
+ };
1680
+ exports.loadWebBlocks = loadWebBlocks;