@chaibuilder/sdk 1.2.50 → 1.2.51
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.
- package/dist/{AddBlocks-IX7HKzSe.js → AddBlocks-LyEjf6h0.js} +2 -2
- package/dist/{AddBlocks-zwZ63DdP.cjs → AddBlocks-hOFqmmXZ.cjs} +1 -1
- package/dist/{CanvasArea-URgoG1jc.cjs → CanvasArea-luy5nUGR.cjs} +2 -2
- package/dist/{CanvasArea-ehmBje_E.js → CanvasArea-mhINqS0c.js} +3 -3
- package/dist/{ChaiBuilderEditor-ZRHqW7Gd.cjs → ChaiBuilderEditor-H173PF4T.cjs} +1 -1
- package/dist/{ChaiBuilderEditor-3xIN-AP_.js → ChaiBuilderEditor-KEwDa8Bl.js} +7 -15
- package/dist/{CodeEditor-0F7Dz3AB.js → CodeEditor-XaHQMfpT.js} +2 -2
- package/dist/{CodeEditor-1vu-qNgT.cjs → CodeEditor-jh9xwRXT.cjs} +1 -1
- package/dist/{CurrentPage-HOPNdQZ-.cjs → CurrentPage-RUx7wvBt.cjs} +1 -1
- package/dist/{CurrentPage-qhBjm7th.js → CurrentPage-UzajS1xZ.js} +3 -3
- package/dist/{ListTree-sTwXvXST.js → ListTree-BWBPjCzR.js} +1 -1
- package/dist/{ListTree-DkbFFDXB.cjs → ListTree-S6pMJlmj.cjs} +1 -1
- package/dist/{PagesPanel-kdl4A0IN.cjs → PagesPanel-LBW-4mVM.cjs} +1 -1
- package/dist/{PagesPanel-5iVsbDP1.js → PagesPanel-p-h6o26u.js} +4 -4
- package/dist/{ProjectPanel-mXPBI-TU.cjs → ProjectPanel-PQv2uVj2.cjs} +1 -1
- package/dist/{ProjectPanel-c8oTzhQd.js → ProjectPanel-o0OWWnYQ.js} +4 -4
- package/dist/Settings-DclX-cDC.cjs +1 -0
- package/dist/{Settings-0uSGoECC.js → Settings-zm-cF9rZ.js} +6 -6
- package/dist/{SidePanels-kKram02Q.cjs → SidePanels-0w036NaZ.cjs} +1 -1
- package/dist/{SidePanels-YLWdBer9.js → SidePanels-TOHaLWC6.js} +2 -2
- package/dist/{ThemeConfiguration-8W1CM4tW.cjs → ThemeConfiguration-MBuJmbDn.cjs} +1 -1
- package/dist/{ThemeConfiguration-AAGFJieC.js → ThemeConfiguration-wJA_aBly.js} +1 -1
- package/dist/{Topbar-nX9Muoem.js → Topbar-Rh7dWuJD.js} +1 -1
- package/dist/{Topbar-CLNUPx7K.cjs → Topbar-u5HAh7Mg.cjs} +1 -1
- package/dist/{UILibrariesPanel-fKn2nlgI.js → UILibrariesPanel-3-cWabRt.js} +1 -1
- package/dist/{UILibrariesPanel-cp0Mkaq_.cjs → UILibrariesPanel-xOys8g8A.cjs} +1 -1
- package/dist/{UnsplashImages-56HoW_ZA.cjs → UnsplashImages-Kymq8i6b.cjs} +1 -1
- package/dist/{UnsplashImages-zTZa3LjG.js → UnsplashImages-dhU2-pHY.js} +1 -1
- package/dist/{UploadImages-okNGjkXb.cjs → UploadImages-WpaiIEbj.cjs} +1 -1
- package/dist/{UploadImages-SnfaTrlz.js → UploadImages-dr_gpAea.js} +1 -1
- package/dist/{add-page-modal-Y2RY3x01.cjs → add-page-modal-vmUMNu7F.cjs} +1 -1
- package/dist/{add-page-modal-uDoO0zws.js → add-page-modal-zwq1hL_o.js} +4 -4
- package/dist/{confirm-alert-9XiVxCc0.js → confirm-alert-73tjkqtD.js} +1 -1
- package/dist/{confirm-alert-aD7AMK_6.cjs → confirm-alert-fK62IiTF.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-7sfoFf9r.js → delete-page-modal-DPNxHWfi.js} +3 -3
- package/dist/{delete-page-modal-ieJ367JA.cjs → delete-page-modal-G_aMq7K4.cjs} +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{form-KWYHDVIf.cjs → form-YMuxx9Ju.cjs} +1 -1
- package/dist/{form-PQSmqcIl.js → form-_tKI6ugY.js} +1 -1
- package/dist/html-to-json-9uiQ2Dp2.cjs +1 -0
- package/dist/html-to-json-ofq1N3tB.js +186 -0
- package/dist/{index-VOrp9ZpX.cjs → index-9gfJqJ6E.cjs} +1 -1
- package/dist/{index-i2kgLkjC.js → index-vpfLlP7N.js} +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +1 -1
- package/dist/{page-viewer-qkwZJ6e-.js → page-viewer-UZMtWQDj.js} +4 -4
- package/dist/{page-viewer-aoro5JxT.cjs → page-viewer-WQgFhgp5.cjs} +1 -1
- package/dist/{project-general-setting-arXitV5_.cjs → project-general-setting-Yh4fQsQH.cjs} +1 -1
- package/dist/{project-general-setting-3gkaXq1F.js → project-general-setting-Zz7qcIW7.js} +4 -4
- package/dist/{project-seo-setting-kjtUt-er.cjs → project-seo-setting-_gNPOTsp.cjs} +1 -1
- package/dist/{project-seo-setting-X8pykTmc.js → project-seo-setting-wFOVAoC2.js} +2 -2
- package/dist/{single-page-detail-ZXZX6Xmw.js → single-page-detail-1Vveonuh.js} +5 -5
- package/dist/{single-page-detail-UsWG0gfh.cjs → single-page-detail-EMxzuAe1.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -3
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/dist/{useCodeEditor-yl5V3Hte.js → useCodeEditor-2KOfsFsx.js} +1 -1
- package/dist/{useCodeEditor-CtjbxWLf.cjs → useCodeEditor-gE1NWoNH.cjs} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +4 -4
- package/package.json +1 -1
- package/dist/Settings-3kBSStO6.cjs +0 -1
- package/dist/html-to-json-GJ6RioQf.js +0 -221
- package/dist/html-to-json-O1OpqICe.cjs +0 -1
package/dist/web-blocks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("lodash-es"),n=require("./jsx-runtime-Z_BpKhVy.cjs"),b=require("react"),t=require("./controls-rRZhz0vu.cjs"),v=require("@chaibuilder/runtime"),x=require("./empty-slot-Sy930lX6.cjs"),d=require("@radix-ui/react-icons"),p=require("./Functions-N3yhPYKY.cjs"),D=require("./index-ecnGWzh9.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");function G(c){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const l in c)if(l!=="default"){const s=Object.getOwnPropertyDescriptor(c,l);Object.defineProperty(e,l,s.get?s:{enumerable:!0,get:()=>c[l]})}}return e.default=c,Object.freeze(e)}const h=G(b),k=h.memo(c=>{const{blockProps:e,inBuilder:l,backgroundImage:s,children:r,tag:a="div",styles:o}=c;let i=r;r||(i=n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:l}));let M={};return s&&(M={backgroundImage:`url(${s})`}),h.createElement(a,{...e,...o,style:M},i)});v.registerChaiBlock(k,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:t.o({default:""}),tag:t.f({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:t.v({title:"Background Image"})},canAcceptBlock:()=>!0});const j=h.memo(c=>{const{blockProps:e,styles:l}=c;return h.createElement("div",{...e,...l})});v.registerChaiBlock(j,{type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",props:{styles:t.o({default:""})},canAcceptBlock:()=>!1});const E=c=>{const{blockProps:e,styles:l,content:s,level:r="h1",children:a=null}=c;return a?h.createElement(r,{...l,...e},a):h.createElement(r,{...l,...e,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})};v.registerChaiBlock(E,{type:"Heading",label:"Heading",category:"core",icon:d.HeadingIcon,group:"typography",props:{level:t.f({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:t.o({default:"text-3xl"}),content:t.r({title:"Content",default:"Heading goes here"})},canAcceptBlock:c=>c==="Span"||c==="Text"});const S=c=>{const{blockProps:e,styles:l,content:s}=c;return u.isNull(c.children)?h.createElement("p",{...l,...e,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):h.createElement("p",{...l,...e},c.children)};v.registerChaiBlock(S,{type:"Paragraph",label:"Paragraph",category:"core",icon:d.TextIcon,group:"typography",props:{styles:t.o({default:""}),content:t.r({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:c=>c==="Span"||c==="Link"});const R=c=>{const{blockProps:e,styles:l,content:s,children:r=null,tag:a}=c;return r?h.createElement("span",{...l,...e},r):h.createElement(a||"span",{...l,...e,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s}})};v.registerChaiBlock(R,{type:"Span",label:"Span",category:"core",group:"typography",props:{styles:t.o({default:""}),content:t.r({title:"Content",default:""})},canAcceptBlock:()=>!0});const C=c=>{const{blockProps:e,content:l,styles:s}=c;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...e,...s,dangerouslySetInnerHTML:{__html:l}})})};v.registerChaiBlock(C,{type:"RichText",label:"Rich Text",category:"core",icon:d.CursorTextIcon,group:"typography",props:{styles:t.o({default:""}),content:t.b({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const T=c=>{const{blockProps:e,iconSize:l,icon:s,content:r,iconPos:a,styles:o,children:i}=c,M=s,z=i||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:r}),M&&n.jsxRuntimeExports.jsx("div",{style:{width:l+"px"},className:a+" "+(a==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:M}})]});return h.createElement("button",{...e,...o,type:"button"},z)};v.registerChaiBlock(T,{type:"Button",label:"Button",category:"core",icon:d.ButtonIcon,group:"basic",props:{content:t.g({title:"Label",default:"Button"}),styles:t.o({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:t.T({title:"Icon",default:""}),iconSize:t.y({title:"Icon Size",default:24}),iconPos:t.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const L=c=>{const{blockProps:e,link:l,children:s,styles:r,inBuilder:a,content:o}=c;return!s&&u.isEmpty(r==null?void 0:r.className)&&u.isEmpty(o)?n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:a}):a?s?n.jsxRuntimeExports.jsx("span",{...e,...r,children:s}):h.createElement("span",{...e,...r,dangerouslySetInnerHTML:{__html:o}}):s?n.jsxRuntimeExports.jsx("a",{href:l.href||"#/",target:l.target,...e,...r,children:s}):h.createElement("a",{...e,...r,"data-ai-key":"content",href:l.href||"#",target:l.target||"_self",dangerouslySetInnerHTML:{__html:o}})};v.registerChaiBlock(L,{type:"Link",label:"Link",category:"core",icon:d.Link1Icon,group:"basic",props:{styles:t.o({default:""}),content:t.g({title:"Content",default:""}),link:t.q({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:c=>c!=="Link"});const _=c=>{const{blockProps:e,children:l,listType:s,styles:r,tag:a,inBuilder:o}=c,i=p.cn(u.get(r,"className",""),s);return!l&&u.isEmpty(r==null?void 0:r.className)?n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:o}):h.createElement(a||(s==="list-decimal"?"ol":"ul"),{...e,...r,className:i},l)};v.registerChaiBlock(_,{type:"List",label:"List",icon:d.RowsIcon,category:"core",group:"basic",props:{styles:t.o({default:""}),listType:t.f({title:"List type",default:"list-none",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:c=>c==="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"}]});const P=c=>{const{blockProps:e,content:l,styles:s,children:r,tag:a}=c;return r?h.createElement(a||"li",{...s,...e},r):h.createElement(a||"li",{...s,...e,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:l}})};v.registerChaiBlock(P,{type:"ListItem",label:"List Item",icon:d.ColumnsIcon,category:"core",group:"basic",props:{styles:t.o({default:""}),content:t.r({title:"Content",default:"List item"})},canAcceptBlock:c=>c!=="ListItem",canBeNested:c=>c==="List"});const N=(c,...e)=>({...c,className:p.cn(c.className,...e)}),H=c=>{const{blockProps:e,icon:l,styles:s,width:r,inBuilder:a,height:o}=c,i=N(s,p.cn(r?`w-[${r}px]`:"",o?`h-[${o}px]`:""));if(u.isEmpty(l))return n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:a,className:"h-8 w-14"});const M=l.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return h.createElement("span",{...e,...i,dangerouslySetInnerHTML:{__html:M}})};v.registerChaiBlock(H,{type:"Icon",label:"Icon",category:"core",icon:d.SketchLogoIcon,group:"media",props:{styles:t.o({default:"text-black"}),icon:t.T({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>'}),width:t.y({title:"Width",default:""}),height:t.y({title:"Height",default:""})}});const A=c=>{const{blockProps:e,image:l,styles:s,alt:r,height:a,width:o}=c;return u.isEmpty(l)?n.jsxRuntimeExports.jsx(x.EmptySlot,{className:"h-36"}):h.createElement("img",{...e,...s,src:l,alt:r,loading:"lazy",height:a,width:o})};v.registerChaiBlock(A,{type:"Image",label:"Image",category:"core",icon:d.ImageIcon,group:"media",props:{styles:t.o({default:""}),image:t.v({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:t.g({title:"Alt",default:""}),width:t.g({title:"Width",default:""}),height:t.g({title:"Height",default:""})}});const q=c=>{var o;const{blockProps:e,inBuilder:l,styles:s,children:r}=c;let a=null;return!r&&l&&(a=n.jsxRuntimeExports.jsx("div",{className:p.cn("flex flex-col items-center justify-center",(o=c.emptyStyles)==null?void 0:o.className),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:n.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",c.name]})})})),h.createElement("div",{...s,...e,droppable:"yes"},r||a)};v.registerChaiBlock(q,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:t.o({default:""}),emptyStyles:t.o({default:""})},canAcceptBlock:()=>!0});const y=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,I=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,w=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,U=c=>{if(y.test(c)){const e=c.match(y);return e?`https://www.youtube.com/embed/${e[4]}`:c}if(I.test(c)){const e=c.match(I);return e?`https://player.vimeo.com/video/${e[3]}`:c}if(w.test(c)){const e=c.match(w);return e?`https://www.dailymotion.com/embed/video/${e[4]}`:c}return null},F=h.memo(c=>{const{blockProps:e,inBuilder:l,styles:s,url:r,controls:a}=c,o=u.get(a,"autoPlay",!1),i=u.get(a,"controls",!1),M=o||u.get(a,"muted",!0),z=u.get(a,"loop",!1);if(u.isEmpty(r))return n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:l,className:"h-36"});let f=U(r),g=null;if(f){if(!u.isEmpty(f)){const m=[];m.push(`autoplay=${o?1:0}`),m.push(`controls=${a?1:0}`),m.push(`mute=${M?1:0}&muted=${M?1:0}`),m.push(`loop=${z?1:0}`),f=`${f}?${m.join("&")}`}g=h.createElement("iframe",{...e,className:"absolute inset-0 w-full h-full",src:f,allow:l?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=h.createElement("video",{...e,className:"absolute inset-0 w-full h-full",src:r,controls:i,muted:M,autoPlay:l?!1:o,loop:z});return n.jsxRuntimeExports.jsx("div",{...u.pick(s,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[l?n.jsxRuntimeExports.jsx("div",{...e,...u.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});v.registerChaiBlock(F,{type:"Video",label:"Video",category:"core",icon:d.VideoIcon,group:"media",props:{styles:t.o({default:""}),url:t.g({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:t.h({title:"Controls",properties:{autoPlay:t.c({title:"Autoplay",default:!0}),controls:t.c({title:"Show controls",default:!1}),loop:t.c({title:"Loop",default:!1}),muted:t.c({title:"Muted",default:!0})}})}});const O=h.memo(c=>{const{blockProps:e,styles:l,htmlCode:s,inBuilder:r}=c,a=s.replace(/<script.*?>.*?<\/script>/g,"");return n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?n.jsxRuntimeExports.jsx("div",{...e,...l,className:"absolute z-20 h-full w-full"}):null,h.createElement("div",{...l,dangerouslySetInnerHTML:{__html:r?a:s}})]})});v.registerChaiBlock(O,{type:"CustomHTML",label:"Custom HTML",category:"core",icon:d.CodeIcon,group:"advanced",props:{styles:t.o({default:""}),htmlCode:t.u({title:"HTML Code",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})},canAcceptBlock:()=>!1});function $(c){return D.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"}}]})(c)}const V=h.memo(c=>{const{script:e,inBuilder:l,blockProps:s}=c;return l?n.jsxRuntimeExports.jsx("div",{...s,children:n.jsxRuntimeExports.jsx(x.EmptySlot,{})}):n.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:e}})});v.registerChaiBlock(V,{type:"CustomScript",label:"Custom Script",category:"core",icon:$,group:"advanced",props:{script:t.u({title:"Script",default:"",placeholder:"<script>console.log('Hello, world!');<\/script>"})},canAcceptBlock:()=>!1});const J=c=>{const{blockProps:e,styles:l}=c;return h.createElement("hr",{...l,...e})};v.registerChaiBlock(J,{type:"Divider",label:"Divider",category:"core",icon:d.DividerHorizontalIcon,group:"basic",props:{styles:t.o({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const W=c=>c.inBuilder||c.forceWrapper?n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...c.blockProps,children:c.content}):`${c.content}`;v.registerChaiBlock(W,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:d.SpaceBetweenVerticallyIcon,props:{content:t.r({title:"Content",defaultValue:""})}});const Y=c=>{const{blockProps:e,backgroundImage:l,children:s,styles:r}=c;let a={};return l&&(a={backgroundImage:`url(${l})`}),h.createElement("div",{...e,...r,style:a},s)};v.registerChaiBlock(Y,{type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:t.o({default:"font-body antialiased"}),backgroundImage:t.v({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const K=c=>{const{blockProps:e,styles:l}=c;return h.createElement("br",{...e,...l})};v.registerChaiBlock(K,{type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:d.SpaceBetweenVerticallyIcon,props:{styles:t.o({default:""})}});const B=c=>{const e=(a,o)=>({_id:p.generateUUID(),_parent:a,_type:"TableCell",styles:"#styles:,",content:`${c==="TableHead"?"Table Head":"Table Cell "+o}`}),l=a=>{const o=p.generateUUID(),i={_type:"TableRow",_id:o,styles:"#styles:,border-b"};return a&&(i._parent=a),[i,e(o,"1"),e(o,"2"),e(o,"3")]},s=a=>{const o=p.generateUUID(),i={_id:o,_type:"TableHead",styles:"#styles:,font-medium"};return a&&(i._parent=a),[i,...l(o)]},r=a=>{const o=p.generateUUID(),i={_id:o,_type:"TableBody",styles:"#styles:,"};return a&&(i._parent=a),[i,...l(o),...l(o)]};if(c==="Table"){const a=p.generateUUID();return[{_id:a,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...s(a),...r(a)]}return c==="TableRow"?l():c==="TableHead"?s():c==="TableBody"?r():[]},X=c=>{const{blockProps:e,children:l,styles:s}=c;return l?h.createElement("table",{...e,...s},l):n.jsxRuntimeExports.jsx(x.EmptySlot,{})};v.registerChaiBlock(X,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:d.TableIcon,props:{styles:t.o({default:""})},blocks:B("Table")});const Z=c=>{const{blockProps:e,children:l,styles:s}=c;return l?h.createElement("thead",{...e,...s},l):n.jsxRuntimeExports.jsx(x.EmptySlot,{})};v.registerChaiBlock(Z,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:d.BorderTopIcon,props:{styles:t.o({default:""})},blocks:B("TableHead")});const Q=c=>{const{blockProps:e,children:l,styles:s}=c;return l?h.createElement("tbody",{...e,...s},l):n.jsxRuntimeExports.jsx(x.EmptySlot,{})};v.registerChaiBlock(Q,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:d.BorderAllIcon,props:{styles:t.o({default:""})},blocks:B("TableBody")});const c0=c=>{const{blockProps:e,children:l,styles:s}=c;return l?h.createElement("tr",{...e,...s},l):n.jsxRuntimeExports.jsx(x.EmptySlot,{})};v.registerChaiBlock(c0,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:d.ViewHorizontalIcon,props:{styles:t.o({default:"w-full"})},blocks:B("TableRow")});const t0=c=>{const{blockProps:e,children:l,content:s,styles:r}=c;return!l&&u.isEmpty(s)?n.jsxRuntimeExports.jsx(x.EmptySlot,{}):l?h.createElement("td",{...e,...r},l):h.createElement("td",{...e,...r,dangerouslySetInnerHTML:{__html:s}})};v.registerChaiBlock(t0,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:d.DragHandleHorizontalIcon,props:{styles:t.o({default:""}),content:t.b({title:"Content",default:"Table cell item",ai:{html:!0}})}});const l0=c=>{const{blockProps:e,errorMessage:l,name:s,_type:r,successMessage:a,action:o,styles:i,children:M}=c;let z=M;M||(z=n.jsxRuntimeExports.jsx(x.EmptySlot,{}));const f={"x-data":"useForm","x-on:submit.prevent":"post"},g={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return n.jsxRuntimeExports.jsxs("form",{...f,"data-error":l,"data-success":a,method:"post",action:o,...e,...i,children:[n.jsxRuntimeExports.jsx("div",{...g}),n.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:s||r}),z]})};v.registerChaiBlock(l0,{type:"Form",label:"Form",category:"core",icon:d.GroupIcon,group:"form",hidden:!0,props:{styles:t.o({default:""}),action:t.g({title:"Submit URL",default:"/api/form/submit"}),errorMessage:t.b({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:t.b({title:"Success Message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0});const e0=c=>{const{blockProps:e,content:l,styles:s,children:r}=c,a={...s,...e};return r?h.createElement("label",a,r):h.createElement("label",{...a,dangerouslySetInnerHTML:{__html:l}})};v.registerChaiBlock(e0,{type:"Label",label:"Label",category:"core",icon:d.LetterCaseToggleIcon,group:"form",hidden:!0,props:{styles:t.o({default:""}),content:t.g({title:"Content",default:"Label",ai:{html:!1}})}});const s0=c=>{const{blockProps:e,inBuilder:l,label:s,styles:r,inputStyles:a,icon:o,iconPos:i}=c,M=p.generateUUID(),z={"x-bind:disabled":"formLoading"};return n.jsxRuntimeExports.jsxs("button",{id:M,...z,...a,...r,...e||{},type:l?"button":"submit",children:[s,o&&n.jsxRuntimeExports.jsx("span",{className:i,dangerouslySetInnerHTML:{__html:o}})]})};v.registerChaiBlock(s0,{type:"FormButton",label:"Submit Button",category:"core",icon:d.ButtonIcon,group:"form",hidden:!0,props:{label:t.g({title:"Label",default:"Submit"}),styles:t.o({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:t.T({title:"Icon",default:""}),iconPos:t.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const a0=c=>{const{blockProps:e,fieldName:l,label:s,styles:r,inputStyles:a,required:o,checked:i,showLabel:M=!0}=c,z=p.generateUUID();return M?n.jsxRuntimeExports.jsxs("div",{...r,...e,children:[n.jsxRuntimeExports.jsx("input",{...a,name:l,id:z,type:"checkbox",required:o,defaultChecked:i}),s&&s!=="Label"&&n.jsxRuntimeExports.jsx("label",{htmlFor:z,children:s})]}):n.jsxRuntimeExports.jsx("input",{id:z,...e,...a,...r,type:"checkbox",required:o,name:l})};v.registerChaiBlock(a0,{type:"Checkbox",label:"Checkbox",category:"core",icon:d.CheckboxIcon,group:"form",hidden:!0,props:{fieldName:t.g({title:"Field Name",default:"checkbox"}),styles:t.o({default:"flex items-center gap-x-2"}),label:t.g({title:"Label",default:"Label"}),checked:t.c({title:"Checked",default:!1}),required:t.c({title:"Required",default:!1})}});const r0=c=>{const{blockProps:e,label:l,placeholder:s,styles:r,inputStyles:a,showLabel:o,required:i,inputType:M="text",inBuilder:z,fieldName:f}=c,g=p.generateUUID();return!o||M==="submit"?(M==="submit"&&(e.value=l),n.jsxRuntimeExports.jsx("input",{id:g,name:f,readOnly:z,...e,...a,...r,type:M,placeholder:s,required:i})):n.jsxRuntimeExports.jsxs("div",{...r,...e,children:[o&&n.jsxRuntimeExports.jsx("label",{htmlFor:g,children:l}),n.jsxRuntimeExports.jsx("input",{name:f,readOnly:z,...a,id:g,type:M,placeholder:s,required:i})]})};v.registerChaiBlock(r0,{type:"Input",label:"Input",category:"core",icon:d.InputIcon,group:"form",hidden:!0,props:{styles:t.o({default:""}),fieldName:t.g({title:"Field Name",default:"input"}),inputType:t.f({title:"Type",options:u.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],c=>({value:c,title:c})),default:"text"}),value:t.g({title:"Value",default:""}),showLabel:t.c({title:"Show label",default:!0}),inputStyles:t.o({default:"w-full p-1"}),label:t.g({title:"Label",default:"Label"}),placeholder:t.g({title:"Placeholder",default:"Placeholder"}),required:t.c({title:"Required",default:!1})}});const n0=c=>{const{blockProps:e,fieldName:l,label:s,styles:r,inputStyles:a,checked:o,required:i,showLabel:M=!0}=c,z=p.generateUUID();return M?n.jsxRuntimeExports.jsxs("div",{...r,...e,children:[n.jsxRuntimeExports.jsx("input",{...a,name:l,id:z,type:"radio",required:i,defaultChecked:o}),s&&n.jsxRuntimeExports.jsx("label",{htmlFor:z,children:s})]}):n.jsxRuntimeExports.jsx("input",{id:z,...e,...a,...r,type:"radio",required:i,checked:o,name:l})};v.registerChaiBlock(n0,{type:"Radio",label:"Radio",category:"core",icon:d.RadiobuttonIcon,group:"form",hidden:!0,props:{styles:t.o({default:"flex items-center w-max gap-x-2"}),fieldName:t.g({title:"Field Name",default:"radio"}),label:t.g({title:"Label",default:"Label"}),checked:t.c({title:"Checked",default:!1}),required:t.c({title:"Required",default:!1})}});const o0=c=>{const{blockProps:e,fieldName:l,label:s,placeholder:r,styles:a,inputStyles:o,required:i,showLabel:M,_multiple:z=!1}=c,f=p.generateUUID();return M?n.jsxRuntimeExports.jsxs("div",{...a,children:[M&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:s}),n.jsxRuntimeExports.jsxs("select",{...o,id:f,required:i,multiple:z,name:l,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),u.map(c.options,g=>n.jsxRuntimeExports.jsx("option",{selected:u.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})]}):n.jsxRuntimeExports.jsxs("select",{id:f,...a,...e,required:i,multiple:z,name:l,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),u.map(c.options,g=>n.jsxRuntimeExports.jsx("option",{selected:u.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})};v.registerChaiBlock(o0,{type:"Select",label:"Select",category:"core",icon:d.DropdownMenuIcon,group:"form",hidden:!0,props:{styles:t.o({default:""}),fieldName:t.g({title:"Field Name",default:"select"}),showLabel:t.c({title:"Show label",default:!0}),inputStyles:t.o({default:"w-full p-1"}),label:t.g({title:"Label",default:"Label"}),placeholder:t.g({title:"Placeholder",default:"Placeholder"}),required:t.c({title:"Required",default:!1}),_multiple:t.c({title:"Multiple Choice",default:!1}),options:t.S({title:"Options",itemProperties:{label:t.g({title:"Label",default:""}),value:t.g({title:"Value",default:""})}})}});const i0=c=>{const{blockProps:e,fieldName:l,label:s,placeholder:r,styles:a,inputStyles:o,_rows:i,showLabel:M}=c,z=p.generateUUID();return M?n.jsxRuntimeExports.jsxs("div",{...a,...e,children:[M&&n.jsxRuntimeExports.jsx("label",{htmlFor:z,children:s}),n.jsxRuntimeExports.jsx("textarea",{name:l,...o,id:z,placeholder:r,rows:i})]}):n.jsxRuntimeExports.jsx("textarea",{id:z,name:l,...e,...o,...a,placeholder:r,rows:i})};v.registerChaiBlock(i0,{type:"TextArea",label:"TextArea",category:"core",icon:d.InputIcon,group:"form",hidden:!0,props:{fieldName:t.g({title:"Field Name",default:"textarea"}),showLabel:t.c({title:"Show label",default:!0}),styles:t.o({default:""}),inputStyles:t.o({default:"w-full p-1"}),label:t.g({title:"Label",default:"Label"}),placeholder:t.g({title:"Placeholder",default:"Placeholder"}),_rows:t.y({title:"Rows",default:3})}});const h0=u.noop;exports.loadWebBlocks=h0;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("lodash-es"),n=require("./jsx-runtime-Z_BpKhVy.cjs"),b=require("react"),l=require("./controls-rRZhz0vu.cjs"),v=require("@chaibuilder/runtime"),x=require("./empty-slot-Sy930lX6.cjs"),d=require("@radix-ui/react-icons"),p=require("./Functions-N3yhPYKY.cjs"),D=require("./index-ecnGWzh9.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");function G(c){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return e.default=c,Object.freeze(e)}const h=G(b),k=h.memo(c=>{const{blockProps:e,inBuilder:t,backgroundImage:s,children:r,tag:a="div",styles:o}=c;let i=r;r||(i=n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:t}));let M={};return s&&(M={backgroundImage:`url(${s})`}),h.createElement(a,{...e,...o,style:M},i)});v.registerChaiBlock(k,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:l.o({default:""}),tag:l.f({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:l.v({title:"Background Image"})},canAcceptBlock:()=>!0});const j=h.memo(c=>{const{blockProps:e,styles:t}=c;return h.createElement("div",{...e,...t})});v.registerChaiBlock(j,{type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",props:{styles:l.o({default:""})},canAcceptBlock:()=>!1});const E=c=>{const{blockProps:e,styles:t,content:s,level:r="h1",children:a=null}=c;return a?h.createElement(r,{...t,...e},a):h.createElement(r,{...t,...e,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})};v.registerChaiBlock(E,{type:"Heading",label:"Heading",category:"core",icon:d.HeadingIcon,group:"typography",props:{level:l.f({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:l.o({default:"text-3xl"}),content:l.r({title:"Content",default:"Heading goes here"})},canAcceptBlock:c=>c==="Span"||c==="Text"});const S=c=>{const{blockProps:e,styles:t,content:s}=c;return u.isNull(c.children)?h.createElement("p",{...t,...e,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):h.createElement("p",{...t,...e},c.children)};v.registerChaiBlock(S,{type:"Paragraph",label:"Paragraph",category:"core",icon:d.TextIcon,group:"typography",props:{styles:l.o({default:""}),content:l.r({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:c=>c==="Span"||c==="Link"});const R=c=>{const{blockProps:e,styles:t,content:s,children:r=null,tag:a}=c;return r?h.createElement("span",{...t,...e},r):h.createElement(a||"span",{...t,...e,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s}})};v.registerChaiBlock(R,{type:"Span",label:"Span",category:"core",group:"typography",props:{styles:l.o({default:""}),content:l.r({title:"Content",default:""})},canAcceptBlock:()=>!0});const C=c=>{const{blockProps:e,content:t,styles:s}=c;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...e,...s,dangerouslySetInnerHTML:{__html:t}})})};v.registerChaiBlock(C,{type:"RichText",label:"Rich Text",category:"core",icon:d.CursorTextIcon,group:"typography",props:{styles:l.o({default:""}),content:l.b({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const T=c=>{const{blockProps:e,iconSize:t,icon:s,content:r,iconPos:a,styles:o,children:i}=c,M=s,z=i||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:r}),M&&n.jsxRuntimeExports.jsx("div",{style:{width:t+"px"},className:a+" "+(a==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:M}})]});return h.createElement("button",{...e,...o,type:"button"},z)};v.registerChaiBlock(T,{type:"Button",label:"Button",category:"core",icon:d.ButtonIcon,group:"basic",props:{content:l.g({title:"Label",default:"Button"}),styles:l.o({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:l.T({title:"Icon",default:""}),iconSize:l.y({title:"Icon Size",default:24}),iconPos:l.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const L=c=>{const{blockProps:e,link:t,children:s,styles:r,inBuilder:a,content:o}=c;return!s&&u.isEmpty(r==null?void 0:r.className)&&u.isEmpty(o)?n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:a}):a?s?n.jsxRuntimeExports.jsx("span",{...e,...r,children:s}):h.createElement("span",{...e,...r,dangerouslySetInnerHTML:{__html:o}}):s?n.jsxRuntimeExports.jsx("a",{href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...e,...r,children:s}):h.createElement("a",{...e,...r,"data-ai-key":"content",href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self",dangerouslySetInnerHTML:{__html:o}})};v.registerChaiBlock(L,{type:"Link",label:"Link",category:"core",icon:d.Link1Icon,group:"basic",props:{styles:l.o({default:""}),content:l.g({title:"Content",default:""}),link:l.q({title:"Link",default:{type:"page",target:"_self",href:"#"}})},canAcceptBlock:c=>c!=="Link"});const _=c=>{const{blockProps:e,children:t,listType:s,styles:r,tag:a,inBuilder:o}=c,i=p.cn(u.get(r,"className",""),s);return!t&&u.isEmpty(r==null?void 0:r.className)?n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:o}):h.createElement(a||(s==="list-decimal"?"ol":"ul"),{...e,...r,className:i},t)};v.registerChaiBlock(_,{type:"List",label:"List",icon:d.RowsIcon,category:"core",group:"basic",props:{styles:l.o({default:""}),listType:l.f({title:"List type",default:"list-none",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:c=>c==="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"}]});const P=c=>{const{blockProps:e,content:t,styles:s,children:r,tag:a}=c;return r?h.createElement(a||"li",{...s,...e},r):h.createElement(a||"li",{...s,...e,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:t}})};v.registerChaiBlock(P,{type:"ListItem",label:"List Item",icon:d.ColumnsIcon,category:"core",group:"basic",props:{styles:l.o({default:""}),content:l.r({title:"Content",default:"List item"})},canAcceptBlock:c=>c!=="ListItem",canBeNested:c=>c==="List"});const N=(c,...e)=>({...c,className:p.cn(c.className,...e)}),H=c=>{const{blockProps:e,icon:t,styles:s,width:r,inBuilder:a,height:o}=c,i=N(s,p.cn(r?`w-[${r}px]`:"",o?`h-[${o}px]`:""));if(u.isEmpty(t))return n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:a,className:"h-8 w-14"});const M=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return h.createElement("span",{...e,...i,dangerouslySetInnerHTML:{__html:M}})};v.registerChaiBlock(H,{type:"Icon",label:"Icon",category:"core",icon:d.SketchLogoIcon,group:"media",props:{styles:l.o({default:"text-black"}),icon:l.T({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>'}),width:l.y({title:"Width",default:""}),height:l.y({title:"Height",default:""})}});const A=c=>{const{blockProps:e,image:t,styles:s,alt:r,height:a,width:o}=c;return u.isEmpty(t)?n.jsxRuntimeExports.jsx(x.EmptySlot,{className:"h-36"}):h.createElement("img",{...e,...s,src:t,alt:r,loading:"lazy",height:a,width:o})};v.registerChaiBlock(A,{type:"Image",label:"Image",category:"core",icon:d.ImageIcon,group:"media",props:{styles:l.o({default:""}),image:l.v({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:l.g({title:"Alt",default:""}),width:l.g({title:"Width",default:""}),height:l.g({title:"Height",default:""})}});const q=c=>{var o;const{blockProps:e,inBuilder:t,styles:s,children:r}=c;let a=null;return!r&&t&&(a=n.jsxRuntimeExports.jsx("div",{className:p.cn("flex flex-col items-center justify-center",(o=c.emptyStyles)==null?void 0:o.className),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:n.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",c.name]})})})),h.createElement("div",{...s,...e,droppable:"yes"},r||a)};v.registerChaiBlock(q,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:l.o({default:""}),emptyStyles:l.o({default:""})},canAcceptBlock:()=>!0});const y=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,I=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,w=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,U=c=>{if(y.test(c)){const e=c.match(y);return e?`https://www.youtube.com/embed/${e[4]}`:c}if(I.test(c)){const e=c.match(I);return e?`https://player.vimeo.com/video/${e[3]}`:c}if(w.test(c)){const e=c.match(w);return e?`https://www.dailymotion.com/embed/video/${e[4]}`:c}return null},F=h.memo(c=>{const{blockProps:e,inBuilder:t,styles:s,url:r,controls:a}=c,o=u.get(a,"autoPlay",!1),i=u.get(a,"controls",!1),M=o||u.get(a,"muted",!0),z=u.get(a,"loop",!1);if(u.isEmpty(r))return n.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:t,className:"h-36"});let f=U(r),g=null;if(f){if(!u.isEmpty(f)){const m=[];m.push(`autoplay=${o?1:0}`),m.push(`controls=${a?1:0}`),m.push(`mute=${M?1:0}&muted=${M?1:0}`),m.push(`loop=${z?1:0}`),f=`${f}?${m.join("&")}`}g=h.createElement("iframe",{...e,className:"absolute inset-0 w-full h-full",src:f,allow:t?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=h.createElement("video",{...e,className:"absolute inset-0 w-full h-full",src:r,controls:i,muted:M,autoPlay:t?!1:o,loop:z});return n.jsxRuntimeExports.jsx("div",{...u.pick(s,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[t?n.jsxRuntimeExports.jsx("div",{...e,...u.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});v.registerChaiBlock(F,{type:"Video",label:"Video",category:"core",icon:d.VideoIcon,group:"media",props:{styles:l.o({default:""}),url:l.g({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:l.h({title:"Controls",properties:{autoPlay:l.c({title:"Autoplay",default:!0}),controls:l.c({title:"Show controls",default:!1}),loop:l.c({title:"Loop",default:!1}),muted:l.c({title:"Muted",default:!0})}})}});const O=h.memo(c=>{const{blockProps:e,styles:t,htmlCode:s,inBuilder:r}=c,a=s.replace(/<script.*?>.*?<\/script>/g,"");return n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?n.jsxRuntimeExports.jsx("div",{...e,...t,className:"absolute z-20 h-full w-full"}):null,h.createElement("div",{...t,dangerouslySetInnerHTML:{__html:r?a:s}})]})});v.registerChaiBlock(O,{type:"CustomHTML",label:"Custom HTML",category:"core",icon:d.CodeIcon,group:"advanced",props:{styles:l.o({default:""}),htmlCode:l.u({title:"HTML Code",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})},canAcceptBlock:()=>!1});function $(c){return D.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"}}]})(c)}const V=h.memo(c=>{const{script:e,inBuilder:t,blockProps:s}=c;return t?n.jsxRuntimeExports.jsx("div",{...s,children:n.jsxRuntimeExports.jsx(x.EmptySlot,{})}):n.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:e}})});v.registerChaiBlock(V,{type:"CustomScript",label:"Custom Script",category:"core",icon:$,group:"advanced",props:{script:l.u({title:"Script",default:"",placeholder:"<script>console.log('Hello, world!');<\/script>"})},canAcceptBlock:()=>!1});const J=c=>{const{blockProps:e,styles:t}=c;return h.createElement("hr",{...t,...e})};v.registerChaiBlock(J,{type:"Divider",label:"Divider",category:"core",icon:d.DividerHorizontalIcon,group:"basic",props:{styles:l.o({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const W=c=>c.inBuilder||c.forceWrapper?n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...c.blockProps,children:c.content}):`${c.content}`;v.registerChaiBlock(W,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:d.SpaceBetweenVerticallyIcon,props:{content:l.r({title:"Content",defaultValue:""})}});const Y=c=>{const{blockProps:e,backgroundImage:t,children:s,styles:r}=c;let a={};return t&&(a={backgroundImage:`url(${t})`}),h.createElement("div",{...e,...r,style:a},s)};v.registerChaiBlock(Y,{type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:l.o({default:"font-body antialiased"}),backgroundImage:l.v({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const K=c=>{const{blockProps:e,styles:t}=c;return h.createElement("br",{...e,...t})};v.registerChaiBlock(K,{type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:d.SpaceBetweenVerticallyIcon,props:{styles:l.o({default:""})}});const B=c=>{const e=(a,o)=>({_id:p.generateUUID(),_parent:a,_type:"TableCell",styles:"#styles:,",content:`${c==="TableHead"?"Table Head":"Table Cell "+o}`}),t=a=>{const o=p.generateUUID(),i={_type:"TableRow",_id:o,styles:"#styles:,border-b"};return a&&(i._parent=a),[i,e(o,"1"),e(o,"2"),e(o,"3")]},s=a=>{const o=p.generateUUID(),i={_id:o,_type:"TableHead",styles:"#styles:,font-medium"};return a&&(i._parent=a),[i,...t(o)]},r=a=>{const o=p.generateUUID(),i={_id:o,_type:"TableBody",styles:"#styles:,"};return a&&(i._parent=a),[i,...t(o),...t(o)]};if(c==="Table"){const a=p.generateUUID();return[{_id:a,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...s(a),...r(a)]}return c==="TableRow"?t():c==="TableHead"?s():c==="TableBody"?r():[]},X=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("table",{...e,...s},t):n.jsxRuntimeExports.jsx(x.EmptySlot,{})};v.registerChaiBlock(X,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:d.TableIcon,props:{styles:l.o({default:""})},blocks:B("Table")});const Z=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("thead",{...e,...s},t):n.jsxRuntimeExports.jsx(x.EmptySlot,{})};v.registerChaiBlock(Z,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:d.BorderTopIcon,props:{styles:l.o({default:""})},blocks:B("TableHead")});const Q=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("tbody",{...e,...s},t):n.jsxRuntimeExports.jsx(x.EmptySlot,{})};v.registerChaiBlock(Q,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:d.BorderAllIcon,props:{styles:l.o({default:""})},blocks:B("TableBody")});const c0=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("tr",{...e,...s},t):n.jsxRuntimeExports.jsx(x.EmptySlot,{})};v.registerChaiBlock(c0,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:d.ViewHorizontalIcon,props:{styles:l.o({default:"w-full"})},blocks:B("TableRow")});const t0=c=>{const{blockProps:e,children:t,content:s,styles:r}=c;return!t&&u.isEmpty(s)?n.jsxRuntimeExports.jsx(x.EmptySlot,{}):t?h.createElement("td",{...e,...r},t):h.createElement("td",{...e,...r,dangerouslySetInnerHTML:{__html:s}})};v.registerChaiBlock(t0,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:d.DragHandleHorizontalIcon,props:{styles:l.o({default:""}),content:l.b({title:"Content",default:"Table cell item",ai:{html:!0}})}});const l0=c=>{const{blockProps:e,errorMessage:t,name:s,_type:r,successMessage:a,action:o,styles:i,children:M}=c;let z=M;M||(z=n.jsxRuntimeExports.jsx(x.EmptySlot,{}));const f={"x-data":"useForm","x-on:submit.prevent":"post"},g={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return n.jsxRuntimeExports.jsxs("form",{...f,"data-error":t,"data-success":a,method:"post",action:o,...e,...i,children:[n.jsxRuntimeExports.jsx("div",{...g}),n.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:s||r}),z]})};v.registerChaiBlock(l0,{type:"Form",label:"Form",category:"core",icon:d.GroupIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),action:l.g({title:"Submit URL",default:"/api/form/submit"}),errorMessage:l.b({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:l.b({title:"Success Message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0});const e0=c=>{const{blockProps:e,content:t,styles:s,children:r}=c,a={...s,...e};return r?h.createElement("label",a,r):h.createElement("label",{...a,dangerouslySetInnerHTML:{__html:t}})};v.registerChaiBlock(e0,{type:"Label",label:"Label",category:"core",icon:d.LetterCaseToggleIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),content:l.g({title:"Content",default:"Label",ai:{html:!1}})}});const s0=c=>{const{blockProps:e,inBuilder:t,label:s,styles:r,inputStyles:a,icon:o,iconPos:i}=c,M=p.generateUUID(),z={"x-bind:disabled":"formLoading"};return n.jsxRuntimeExports.jsxs("button",{id:M,...z,...a,...r,...e||{},type:t?"button":"submit",children:[s,o&&n.jsxRuntimeExports.jsx("span",{className:i,dangerouslySetInnerHTML:{__html:o}})]})};v.registerChaiBlock(s0,{type:"FormButton",label:"Submit Button",category:"core",icon:d.ButtonIcon,group:"form",hidden:!0,props:{label:l.g({title:"Label",default:"Submit"}),styles:l.o({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:l.T({title:"Icon",default:""}),iconPos:l.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const a0=c=>{const{blockProps:e,fieldName:t,label:s,styles:r,inputStyles:a,required:o,checked:i,showLabel:M=!0}=c,z=p.generateUUID();return M?n.jsxRuntimeExports.jsxs("div",{...r,...e,children:[n.jsxRuntimeExports.jsx("input",{...a,name:t,id:z,type:"checkbox",required:o,defaultChecked:i}),s&&s!=="Label"&&n.jsxRuntimeExports.jsx("label",{htmlFor:z,children:s})]}):n.jsxRuntimeExports.jsx("input",{id:z,...e,...a,...r,type:"checkbox",required:o,name:t})};v.registerChaiBlock(a0,{type:"Checkbox",label:"Checkbox",category:"core",icon:d.CheckboxIcon,group:"form",hidden:!0,props:{fieldName:l.g({title:"Field Name",default:"checkbox"}),styles:l.o({default:"flex items-center gap-x-2"}),label:l.g({title:"Label",default:"Label"}),checked:l.c({title:"Checked",default:!1}),required:l.c({title:"Required",default:!1})}});const r0=c=>{const{blockProps:e,label:t,placeholder:s,styles:r,inputStyles:a,showLabel:o,required:i,inputType:M="text",inBuilder:z,fieldName:f}=c,g=p.generateUUID();return!o||M==="submit"?(M==="submit"&&(e.value=t),n.jsxRuntimeExports.jsx("input",{id:g,name:f,readOnly:z,...e,...a,...r,type:M,placeholder:s,required:i})):n.jsxRuntimeExports.jsxs("div",{...r,...e,children:[o&&n.jsxRuntimeExports.jsx("label",{htmlFor:g,children:t}),n.jsxRuntimeExports.jsx("input",{name:f,readOnly:z,...a,id:g,type:M,placeholder:s,required:i})]})};v.registerChaiBlock(r0,{type:"Input",label:"Input",category:"core",icon:d.InputIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),fieldName:l.g({title:"Field Name",default:"input"}),inputType:l.f({title:"Type",options:u.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],c=>({value:c,title:c})),default:"text"}),value:l.g({title:"Value",default:""}),showLabel:l.c({title:"Show label",default:!0}),inputStyles:l.o({default:"w-full p-1"}),label:l.g({title:"Label",default:"Label"}),placeholder:l.g({title:"Placeholder",default:"Placeholder"}),required:l.c({title:"Required",default:!1})}});const n0=c=>{const{blockProps:e,fieldName:t,label:s,styles:r,inputStyles:a,checked:o,required:i,showLabel:M=!0}=c,z=p.generateUUID();return M?n.jsxRuntimeExports.jsxs("div",{...r,...e,children:[n.jsxRuntimeExports.jsx("input",{...a,name:t,id:z,type:"radio",required:i,defaultChecked:o}),s&&n.jsxRuntimeExports.jsx("label",{htmlFor:z,children:s})]}):n.jsxRuntimeExports.jsx("input",{id:z,...e,...a,...r,type:"radio",required:i,checked:o,name:t})};v.registerChaiBlock(n0,{type:"Radio",label:"Radio",category:"core",icon:d.RadiobuttonIcon,group:"form",hidden:!0,props:{styles:l.o({default:"flex items-center w-max gap-x-2"}),fieldName:l.g({title:"Field Name",default:"radio"}),label:l.g({title:"Label",default:"Label"}),checked:l.c({title:"Checked",default:!1}),required:l.c({title:"Required",default:!1})}});const o0=c=>{const{blockProps:e,fieldName:t,label:s,placeholder:r,styles:a,inputStyles:o,required:i,showLabel:M,_multiple:z=!1}=c,f=p.generateUUID();return M?n.jsxRuntimeExports.jsxs("div",{...a,children:[M&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:s}),n.jsxRuntimeExports.jsxs("select",{...o,id:f,required:i,multiple:z,name:t,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),u.map(c.options,g=>n.jsxRuntimeExports.jsx("option",{selected:u.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})]}):n.jsxRuntimeExports.jsxs("select",{id:f,...a,...e,required:i,multiple:z,name:t,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),u.map(c.options,g=>n.jsxRuntimeExports.jsx("option",{selected:u.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})};v.registerChaiBlock(o0,{type:"Select",label:"Select",category:"core",icon:d.DropdownMenuIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),fieldName:l.g({title:"Field Name",default:"select"}),showLabel:l.c({title:"Show label",default:!0}),inputStyles:l.o({default:"w-full p-1"}),label:l.g({title:"Label",default:"Label"}),placeholder:l.g({title:"Placeholder",default:"Placeholder"}),required:l.c({title:"Required",default:!1}),_multiple:l.c({title:"Multiple Choice",default:!1}),options:l.S({title:"Options",itemProperties:{label:l.g({title:"Label",default:""}),value:l.g({title:"Value",default:""})}})}});const i0=c=>{const{blockProps:e,fieldName:t,label:s,placeholder:r,styles:a,inputStyles:o,_rows:i,showLabel:M}=c,z=p.generateUUID();return M?n.jsxRuntimeExports.jsxs("div",{...a,...e,children:[M&&n.jsxRuntimeExports.jsx("label",{htmlFor:z,children:s}),n.jsxRuntimeExports.jsx("textarea",{name:t,...o,id:z,placeholder:r,rows:i})]}):n.jsxRuntimeExports.jsx("textarea",{id:z,name:t,...e,...o,...a,placeholder:r,rows:i})};v.registerChaiBlock(i0,{type:"TextArea",label:"TextArea",category:"core",icon:d.InputIcon,group:"form",hidden:!0,props:{fieldName:l.g({title:"Field Name",default:"textarea"}),showLabel:l.c({title:"Show label",default:!0}),styles:l.o({default:""}),inputStyles:l.o({default:"w-full p-1"}),label:l.g({title:"Label",default:"Label"}),placeholder:l.g({title:"Placeholder",default:"Placeholder"}),_rows:l.y({title:"Rows",default:3})}});const h0=u.noop;exports.loadWebBlocks=h0;
|
package/dist/web-blocks.js
CHANGED
|
@@ -225,12 +225,12 @@ const B0 = (c) => {
|
|
|
225
225
|
...l,
|
|
226
226
|
...a,
|
|
227
227
|
dangerouslySetInnerHTML: { __html: i }
|
|
228
|
-
}) : e ? /* @__PURE__ */ r.jsx("a", { href: t.href || "#/", target: t.target, ...l, ...a, children: e }) : o.createElement("a", {
|
|
228
|
+
}) : e ? /* @__PURE__ */ r.jsx("a", { href: (t == null ? void 0 : t.href) || "#/", target: t == null ? void 0 : t.target, ...l, ...a, children: e }) : o.createElement("a", {
|
|
229
229
|
...l,
|
|
230
230
|
...a,
|
|
231
231
|
"data-ai-key": "content",
|
|
232
|
-
href: t.href || "#",
|
|
233
|
-
target: t.target || "_self",
|
|
232
|
+
href: (t == null ? void 0 : t.href) || "#",
|
|
233
|
+
target: (t == null ? void 0 : t.target) || "_self",
|
|
234
234
|
dangerouslySetInnerHTML: { __html: i }
|
|
235
235
|
});
|
|
236
236
|
};
|
|
@@ -245,7 +245,7 @@ h(B0, {
|
|
|
245
245
|
content: d({ title: "Content", default: "" }),
|
|
246
246
|
link: $({
|
|
247
247
|
title: "Link",
|
|
248
|
-
default: { type: "page", target: "_self", href: "" }
|
|
248
|
+
default: { type: "page", target: "_self", href: "#" }
|
|
249
249
|
})
|
|
250
250
|
},
|
|
251
251
|
canAcceptBlock: (c) => c !== "Link"
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),m=require("react"),z=require("@react-hookz/web"),t=require("lodash-es"),T=require("react-i18next"),c=require("@radix-ui/react-icons"),o=require("./ChaiBuilderEditor-ZRHqW7Gd.cjs"),P=require("lucide-react"),$=require("@chaibuilder/runtime"),W=require("./index-gi1LIOCw.cjs"),pe=require("@rjsf/core"),de=require("@rjsf/validator-ajv8"),te=require("./useCodeEditor-CtjbxWLf.cjs"),ue=require("react-autosuggest"),ce=require("fuse.js"),M=require("./utils-D_vtk3zK.cjs"),xe=require("./MODIFIERS-mVmfEGgo.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("tree-model");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("./index-ecnGWzh9.cjs");function me(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(i,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}return i.default=r,Object.freeze(i)}const q=me(m);function ge(r){const i=[],s={};function a(l,n){t.forEach(n,(u,x)=>{const p=l?`${l}.${x}`:x,g=t.isArray(u)?"list":typeof u;i.push(p),s[p]=g==="string"?"text":g==="object"?"model":g,g==="object"&&!t.isArray(u)&&a(p,u)})}return a("",t.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:i,pathsType:s}}const Y=({data:r,fullView:i})=>{if(!r)return null;const s=typeof r;return i?typeof r=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(o.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(W.JsonView,{data:r,shouldExpandNode:W.allExpanded,style:{...W.defaultStyles,container:"max-h-[40vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]}):e.jsxRuntimeExports.jsxs("div",{className:"max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),r]}):e.jsxRuntimeExports.jsx("div",{className:"w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50",children:t.truncate(s==="object"?JSON.stringify(r):r,{length:40})})},G=({type:r,value:i="",setValue:s,data:a,onChange:l,dataType:n,appliedBindings:u})=>{const{paths:x,pathsType:p}=ge(a),g=r==="PROP"?$.getBlockComponent(a==null?void 0:a._type):{},f=r==="PROP",[d,y]=m.useState(!1),b=m.useMemo(()=>r==="PROP"?x.filter(h=>!t.includes(u,h)&&t.get(g,`props.${t.first(t.split(h,"."))}.binding`)):x.filter(h=>n===t.get(p,h,"")),[r,x,u,n,g]);return m.useEffect(()=>{i&&l(i)},[i,r]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:t.startCase(t.toLower(r))}),e.jsxRuntimeExports.jsxs(o.Popover,{open:d,onOpenChange:y,children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(i)?"w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white":"min-w-[350px] items-center justify-between"}`,children:i?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[f&&e.jsxRuntimeExports.jsx("span",{className:"mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(n)}),i]}),e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(r))]})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{className:"z-[999] min-w-[300px] p-0",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(o.Command,{children:[e.jsxRuntimeExports.jsx(o.CommandInput,{placeholder:`Choose ${t.toLower(r)}...`}),e.jsxRuntimeExports.jsxs(o.CommandList,{children:[e.jsxRuntimeExports.jsx(o.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(o.CommandGroup,{children:t.map(b,h=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:h,className:`cursor-pointer ${f?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:R=>{s(t.find(b,w=>w===R)||null),y(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(P.Check,{className:`h-4 w-4 text-green-500 ${i===h?"":"opacity-0"}`}),h]}),f?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(t.get(p,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(Y,{data:t.get(a,h)})})]},h))})]})]})})]})]}),!f&&!t.isEmpty(i)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(Y,{data:t.get(a,i,""),fullView:!0})})]})},ye=({appliedBindings:r=[],onAddBinding:i,editMode:s,item:a})=>{const[l,n]=m.useState(s?a.key:""),[u,x]=m.useState(s?a.value:""),p=o.useSelectedBlock(),[g]=o.useChaiExternalData(),f=m.useCallback((b,h)=>{if(t.isEmpty(b))return"";{const R=t.get(h==="PROP"?p:g,b,"");if(t.isArray(R))return"list";const w=typeof R;return w==="string"?"text":w==="object"?"model":w}},[p,g]),[d,y]=m.useState(s?f(a.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DialogHeader,{children:[e.jsxRuntimeExports.jsx(o.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx(o.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col gap-1",children:[e.jsxRuntimeExports.jsx(G,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:l,setValue:n,onChange:b=>{const h=f(b,"PROP");n(b),d!==h&&x(""),y(h)},data:p,dataType:d,appliedBindings:r}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(G,{type:"PATH",isDisabled:t.isEmpty(l),placeholder:"Enter data path",value:u,setValue:x,onChange:b=>{const h=f(b,"PATH");x(d===h?b:"")},data:g,dataType:d,appliedBindings:r})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(l)&&t.isEmpty(u),onClick:()=>i({key:l,value:u}),children:"Save"})})]})},se=({disabled:r,children:i,onAddBinding:s,appliedBindings:a,editMode:l=!0,item:n={}})=>{const[u,x]=m.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{disabled:r,asChild:!0,onClick:()=>x(!0),children:i}),u&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(ye,{item:n,editMode:l,appliedBindings:a,onAddBinding:p=>{s(p),x(!1)}})})]})},he=({item:r,onAddBinding:i,onRemove:s,selectedBlock:a,dataProvider:l,appliedBindings:n})=>{const[u,x]=m.useState("string"),p=(g,f)=>{if(t.isEmpty(g))return"";{const d=t.get(f==="PROP"?a:l,g,"");if(t.isArray(d))return"list";const y=typeof d;return y==="string"?"text":y==="object"?"model":y}};return m.useEffect(()=>x(()=>p(r.key,"PROP")),[r.key]),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col rounded-md border border-gray-200 p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm font-normal text-gray-500",children:r.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:r.value}),e.jsxRuntimeExports.jsx(Y,{data:t.get(l,r.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(se,{editMode:!0,onAddBinding:i,appliedBindings:n,item:r,children:e.jsxRuntimeExports.jsx(P.EditIcon,{className:"mt-1 h-6 w-6 cursor-pointer rounded border border-blue-400 p-1 text-blue-400 duration-200 hover:scale-105 hover:bg-blue-400 hover:text-white"})}),e.jsxRuntimeExports.jsx(P.TrashIcon,{onClick:()=>s(),className:"mt-1 h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 duration-200 hover:scale-105 hover:bg-red-400 hover:text-white"})]}),!t.isEmpty(u)&&!t.isEmpty(r.key)&&e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-1 mt-px flex h-4 items-center rounded-full px-2 text-[10px] font-medium text-purple-600",children:t.startCase(u)})]})},be=({bindingData:r,onChange:i})=>{const s=o.useSelectedBlock(),[a]=o.useChaiExternalData(),l=$.getChaiDataProviders(),[n,u]=m.useState(t.map(r,(d,y)=>({key:y,value:d})));m.useEffect(()=>{u(t.map(r,(d,y)=>({key:y,value:d})))},[s==null?void 0:s._id,r]);const x=m.useMemo(()=>{if(t.isEmpty(a))return!0;if(t.isEmpty(n))return!1;const d=t.last(n);return t.isEmpty(d==null?void 0:d.key)||t.isEmpty(d==null?void 0:d.value)},[a,n]),p=d=>{const y=t.filter(n,b=>b.key!==d.key);u([...y,d]),f([...y,d])},g=d=>{const y=t.filter(n,(b,h)=>d!==h);f([...y])},f=m.useCallback((d=[])=>{if(u(d),t.isEmpty(d)){i({});return}const y={};t.forEach(d,b=>{!t.isEmpty(b==null?void 0:b.key)&&!t.isEmpty(b==null?void 0:b.value)&&t.set(y,b.key,b.value)}),i(y)},[i]);return t.isEmpty(l)?e.jsxRuntimeExports.jsx("div",{className:"flex w-full items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 text-xs text-gray-500",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(n,(d,y)=>e.jsxRuntimeExports.jsx(he,{item:d,onAddBinding:p,onRemove:()=>g(y),selectedBlock:s,dataProvider:a,appliedBindings:t.map(n,"key")},d.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{disabled:t.isEmpty(a),className:"w-full",children:e.jsxRuntimeExports.jsx(se,{disabled:x,appliedBindings:t.map(n,"key"),onAddBinding:p,children:e.jsxRuntimeExports.jsx("span",{className:`w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${x?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(a)?e.jsxRuntimeExports.jsx("small",{className:"text-[9.5px] text-gray-500",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),x&&e.jsxRuntimeExports.jsx(o.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(a)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},fe=()=>e.jsxRuntimeExports.jsx("div",{className:"text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100",children:"Data binding is set for this field"}),je=({id:r,placeholder:i,value:s})=>{const{t:a}=T.useTranslation(),[,l]=te.useCodeEditor(),n=o.useSelectedBlock();if(typeof window>"u")return null;const u=()=>{const x=n==null?void 0:n._id,p=r.replace("root.","");l({blockId:x,blockProp:p,placeholder:i,initialCode:s})};return e.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex flex-col gap-y-1",children:[e.jsxRuntimeExports.jsx("button",{onClick:u,className:"text-pretty w-[90%] max-w-full cursor-default truncate rounded border bg-white p-2 text-left text-[10px]",children:s.trim().length>0?s.substring(0,46):i||"Eg: <script>console.log('Hello, world!');<\/script>"}),e.jsxRuntimeExports.jsx(o.Button,{onClick:u,size:"sm",variant:"outline",className:"w-fit",children:a("Open code editor")})]})},X=m.memo(({id:r,properties:i,formData:s,onChange:a})=>{const[l,n]=m.useState(s),u={type:"object",properties:{}},x={};Object.keys(i).forEach(g=>{const f=i[g];if(t.includes(["slot","styles"],f.type))return;const d=g;u.properties[d]=o.getBlockJSONFromSchemas(f),x[d]=o.getBlockJSONFromUISchemas(f)}),m.useEffect(()=>{n(s)},[r]);const p=z.useThrottledCallback(async({formData:g},f)=>{a({formData:g},f)},[a],1e3);return e.jsxRuntimeExports.jsx(pe,{widgets:{binding:fe,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField,code:je},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:de,uiSchema:x,schema:u,formData:l,onChange:({formData:g},f)=>{f&&(n(g),p({formData:g},f))}})}),ve=()=>{const[r,i]=te.useCanvasSettings(),s=o.useSelectedBlockCanvasSetting(),a=(u,x)=>{i(p=>({...p,[u]:x}))};if(t.isEmpty(s))return null;const{block:l,settings:n}=s;return e.jsxRuntimeExports.jsxs("div",{className:"text-xs hover:no-underline",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 px-4 py-2",children:[s.block._type," settings"]}),e.jsxRuntimeExports.jsx("div",{className:"bg-white pb-2",children:e.jsxRuntimeExports.jsx(X,{id:l==null?void 0:l._id,onChange:({formData:u})=>a(l._id,u),formData:t.get(r,l._id,{}),properties:n})})]})};function Re(){const r=o.useSelectedBlock(),i=o.useUpdateBlocksPropsRealtime(),s=o.useUpdateBlocksProps(),a=$.getBlockComponent(r._type),l={...r},[n,u]=m.useState(l),x=o.useBuilderProp("dataBindingSupport",!1),p=({formData:b},h,R)=>{if(h&&(n==null?void 0:n._id)===r._id){const w=h.replace("root.","");s([r._id],{[w]:t.get(b,w)},R)}},g=m.useCallback(t.debounce(({formData:b},h,R)=>{p({formData:b},h,R),u(b)},1500),[r==null?void 0:r._id]),f=({formData:b},h)=>{if(h){const R=h.replace("root.","");i([r._id],o.convertDotNotationToObject(R,t.get(b,R.split(".")))),g({formData:b},h,{[R]:t.get(n,R)})}},d=t.keys(t.get(l,"_bindings",{})),y=m.useMemo(()=>{const b=t.cloneDeep(t.get(a,"props",{}));return x&&t.each(d,h=>delete b[h]),b},[a,d,x]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(ve,{}),x?e.jsxRuntimeExports.jsxs(o.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"px-4 pt-4",children:e.jsxRuntimeExports.jsx(be,{bindingData:t.get(r,"_bindings",{}),onChange:b=>{p({formData:{_bindings:b}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(o.AccordionContent,{className:"pt-4",children:[t.isEmpty(d)?null:e.jsxRuntimeExports.jsxs("div",{className:"mx-4 mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(d,t.capitalize).join(", ")})," ",d.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(X,{id:r==null?void 0:r._id,onChange:f,formData:l,properties:y})]})]})]}):e.jsxRuntimeExports.jsx(X,{id:r==null?void 0:r._id,onChange:f,formData:l,properties:y})]})}const Ee=({blockId:r})=>{const{t:i}=T.useTranslation(),{askAi:s,loading:a,error:l}=o.useAskAi(),[n,u]=m.useState(""),x=m.useRef(null);m.useEffect(()=>{var g;(g=x.current)==null||g.focus()},[]);const p=()=>{l||u("")};return e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsx("h2",{className:"mb-1 text-sm font-semibold leading-none tracking-tight",children:i("Ask AI")}),e.jsxRuntimeExports.jsx(o.Textarea,{ref:x,value:n,onChange:g=>u(g.target.value),placeholder:i("Ask AI to edit styles"),className:"w-full border border-gray-400 focus:border-0",rows:3,onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),s("styles",r,n,p))}}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 my-2",children:[a?null:e.jsxRuntimeExports.jsx(o.Button,{disabled:n.trim().length<5||a,onClick:()=>s("styles",r,n,p),variant:"default",className:"w-fit",size:"sm",children:a?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P.Loader,{className:"w-5 h-5 animate-spin"}),i("Generating... Please wait")]}):i("Edit with AI")}),a?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxRuntimeExports.jsxs(o.Skeleton,{className:"flex items-center w-full px-4 py-1 pl-2 space-x-1",children:[e.jsxRuntimeExports.jsx(o.FaSpinner,{className:"w-4 h-4 text-gray-500 animate-spin"}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:i("Generating... Please wait")})]}),e.jsxRuntimeExports.jsx(o.Button,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:i("Stop")})]}):null]}),e.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:l&&e.jsxRuntimeExports.jsx("p",{className:"p-1 text-xs text-red-500 break-words bg-red-100 border border-red-500 rounded",children:l.message})})]})},K=new ce(M.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function re(){var N;const{t:r}=T.useTranslation(),[i]=o.useSelectedStylingBlocks(),s=o.useSelectedBlock(),a=o.useAddClassesToBlocks(),l=o.useRemoveClassesFromBlocks(),[n]=o.useSelectedBlockIds(),u=o.useBuilderProp("askAiCallBack",null),[x,p]=m.useState(""),{toast:g}=o.useToast(),f=(N=t.first(i))==null?void 0:N.prop,d=t.reject((t.get(s,f,"").replace(xe.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),y=()=>{const E=x.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");a(n,E,!0),p("")},[b,h]=m.useState([]),R=({value:E})=>{const S=E.trim().toLowerCase(),H=S.match(/.+:/g);let j=[];if(H&&H.length>0){const[v]=H,k=S.replace(v,"");j=K.search(k).map(B=>({...B,item:{...B.item,name:v+B.item.name}}))}else j=K.search(S);return h(t.map(j,"item"))},w=()=>{h([])},A=E=>E.name,_=E=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:E.name}),D={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:r("Enter classes separated by space"),value:x,onKeyDown:E=>{E.key==="Enter"&&x.trim()!==""&&y()},onChange:(E,{newValue:S})=>p(S),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"},V=()=>{if(navigator.clipboard===void 0){g({title:"Clipboard not supported",description:"Please use Chrome, Firefox or Safari",variant:"destructive"});return}navigator.clipboard.writeText(d.join(" ")),g({title:"Copied",description:"Classes copied to clipboard"})};return e.jsxRuntimeExports.jsxs("div",{className:`flex ${b.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto border-b-2 bg-gray-100 pb-4`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("span",{children:r("Classes")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(c.CopyIcon,{onClick:V,className:"cursor-pointer"})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:r("Copy classes to clipboard")})})]})]}),u?e.jsxRuntimeExports.jsxs(o.Popover,{children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{children:e.jsxRuntimeExports.jsxs(o.Button,{variant:"default",className:"h-6 w-fit",size:"sm",children:[e.jsxRuntimeExports.jsx(P.SparklesIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2",children:r("Ask AI")})]})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"left",className:"p-2",children:e.jsxRuntimeExports.jsx(Ee,{blockId:s==null?void 0:s._id})})]}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex items-center gap-x-3",children:[e.jsxRuntimeExports.jsx("div",{className:"relative flex w-full items-center gap-x-3",children:e.jsxRuntimeExports.jsx(ue,{suggestions:b,onSuggestionsFetchRequested:R,onSuggestionsClearRequested:w,getSuggestionValue:A,renderSuggestion:_,inputProps:D,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"!bg-gray-300 ",suggestionsContainerOpen:"absolute bg-gray-100 z-50 max-h-[230px] overflow-y-auto w-full border border-gray-600 rounded-md"}})}),e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:y,disabled:x.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(c.PlusIcon,{})})]}),e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-wrap gap-2 overflow-x-hidden",children:q.Children.toArray(d.map(E=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-gray-300 bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300",children:[E,e.jsxRuntimeExports.jsx(c.Cross2Icon,{onClick:()=>l(n,[E]),className:"invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},E)))})]})}const we=({onAdd:r})=>{const{t:i}=T.useTranslation(),[s,a]=m.useState({key:"",value:""}),l=()=>{t.isEmpty(s.key)||(r({...s,key:s.key}),a({key:"",value:""}))};return e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 border-gray-200",children:[e.jsxRuntimeExports.jsx(o.Input,{name:"key",className:"h-6",onChange:n=>a({...s,key:n.target.value}),value:s.key,placeholder:i("Name"),autoComplete:"off",autoCapitalize:"off",onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),t.isEmpty(s.key)||l())}}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-1.5",children:e.jsxRuntimeExports.jsx(o.Input,{className:"h-6",name:"value",onChange:n=>a({...s,value:n.target.value}),value:s.value,placeholder:i("Value"),autoComplete:"off",autoCapitalize:"off",onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),t.isEmpty(s.key)||l())}})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsxs(o.Button,{disabled:t.isEmpty(s.key),onClick:l,size:"sm",className:"flex items-center",children:[e.jsxRuntimeExports.jsxs("span",{children:[i("Add")," "]}),e.jsxRuntimeExports.jsx(c.PlusIcon,{})]}),t.isEmpty(s.key)?null:e.jsxRuntimeExports.jsx(o.Button,{variant:"ghost",onClick:()=>a({key:"",value:""}),children:i("Cancel")})]})]})},Ce=()=>{const r=o.useSelectedBlock(),[i,s]=m.useState([]),[a]=o.useSelectedStylingBlocks(),l=o.useUpdateBlocksPropsRealtime(),n=o.useUpdateBlocksProps(),{t:u}=T.useTranslation(),{toast:x}=o.useToast(),p=`${t.get(a,"0.prop")}_attrs`;q.useEffect(()=>{const y=t.map(t.get(r,p),(b,h)=>({key:h,value:b}));t.isEmpty(y)?s([]):s(y)},[t.get(r,p)]);const g=y=>{const b=t.filter(i,(h,R)=>y!==R);d(b)},f=y=>{const b=t.find(i,{key:y.key});if(b&&(b.value.startsWith("dnd-")||b.value.startsWith("#dnd-"))){x({title:u("Cannot add predefined attribute"),variant:"destructive",description:u(`"(${y.key})" cannot be added as it is a predefined attribute for this block`)});return}const h=[...i,y];d(h)},d=q.useCallback((y=[])=>{const b={};t.forEach(y,h=>{t.isEmpty(h.key)||t.set(b,h.key,h.value)}),n([t.get(r,"_id")],{[p]:b})},[r,l,p]);return e.jsxRuntimeExports.jsx("div",{className:"mb-20 flex min-h-max flex-col gap-y-2 overflow-y-auto",children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("ul",{className:"overflow-hidden rounded-md bg-gray-100 text-xs text-gray-700",children:[t.isEmpty(i)?e.jsxRuntimeExports.jsx("li",{className:"flex h-4 items-center justify-center",children:e.jsxRuntimeExports.jsx("p",{children:u("No attributes added")})}):null,q.Children.toArray(t.map(i,y=>e.jsxRuntimeExports.jsxs("li",{className:"group flex w-full max-w-full items-center justify-between",children:[e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:1e3,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{className:"max-w-[230px] cursor-default truncate px-1 hover:bg-gray-200",children:[y.key,y.value.trim()?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[" ",e.jsxRuntimeExports.jsx("span",{className:"font-bold text-orange-500",children:"="})," ",y.value.trim()]}):null]})}),e.jsxRuntimeExports.jsxs(o.TooltipContent,{className:"max-w-[200px]",children:[e.jsxRuntimeExports.jsxs("div",{children:[u("Name"),": ",y.key]}),e.jsxRuntimeExports.jsxs("div",{children:[u("Value"),": ",y.value]})]})]}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{disabled:t.startsWith(y.value,"dnd-"),className:"invisible group-hover:visible",onClick:()=>g(i.indexOf(y)),children:e.jsxRuntimeExports.jsx(P.DeleteIcon,{className:"w-4 text-gray-500"})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"max-w-[200px]",children:t.startsWith(y.value,"dnd-")?u("Predefined attribute. Cannot be deleted"):u("Remove attribute")})]})]})))]})}),e.jsxRuntimeExports.jsx("div",{className:"py-2"}),e.jsxRuntimeExports.jsx(we,{onAdd:y=>f(y)})]})})},C=["px","%","em","rem","ch","vh","vw"],ke={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:C,property:"flexBasis"},{type:"range",label:"flex.order",property:"order"},{type:"dropdown",label:"flex.flex",property:"flexGrowShrink"},{type:"dropdown",label:"flex.grow",property:"flexGrow"},{type:"dropdown",label:"flex.shrink",property:"flexShrink"}]},Ne={heading:"grid.heading",items:[{type:"range",label:"grid.col_span",property:"gridColSpan"},{type:"range",label:"grid.col_start",property:"gridColStart"},{type:"range",label:"grid.col_end",property:"gridColEnd"},{type:"range",label:"grid.row_span",property:"gridRowSpan"},{type:"range",label:"grid.row_start",property:"gridRowStart"},{type:"range",label:"grid.row_end",property:"gridRowEnd"},{type:"range",label:"grid.order",property:"order"}]},Se=[{heading:"Styles",items:[{component:re},{type:"arbitrary",label:"layout.width",units:C.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:C.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...C,"auto"],options:[{key:"margin",label:"layout.margin_all"},{key:"marginX",label:"layout.margin_lr"},{key:"marginY",label:"layout.margin_tb"},{key:"marginTop",label:"layout.margin_top"},{key:"marginRight",label:"layout.margin_right"},{key:"marginBottom",label:"layout.margin_bottom"},{key:"marginLeft",label:"layout.margin_left"}]},{styleType:"multiple",label:"layout.padding",options:[{key:"padding",label:"layout.padding_all"},{key:"paddingX",label:"layout.padding_lr"},{key:"paddingY",label:"layout.padding_tb"},{key:"paddingTop",label:"layout.padding_top"},{key:"paddingRight",label:"layout.padding_right"},{key:"paddingBottom",label:"layout.padding_bottom"},{key:"paddingLeft",label:"layout.padding_left"}]},{styleType:"accordion",heading:"Typography",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:C},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:C.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"}]},{styleType:"accordion",heading:"Background",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{type:"dropdown",label:"background.attachment",property:"backgroundAttachment"},{type:"dropdown",label:"background.clipping",property:"backgroundClip"},{type:"dropdown",label:"background.origin",property:"backgroundOrigin"},{type:"dropdown",label:"background.position",property:"backgroundPosition"},{type:"dropdown",label:"background.repeat",property:"backgroundRepeat"},{type:"dropdown",label:"background.size",property:"backgroundSize"}]}]},{heading:"Attributes",items:[{component:Ce}]}],Ge=[{heading:"layout.heading",items:[{type:"arbitrary",label:"layout.width",units:C.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:C.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...C,"auto"],options:[{key:"margin",label:"layout.margin_all"},{key:"marginX",label:"layout.margin_lr"},{key:"marginY",label:"layout.margin_tb"},{key:"marginTop",label:"layout.margin_top"},{key:"marginRight",label:"layout.margin_right"},{key:"marginBottom",label:"layout.margin_bottom"},{key:"marginLeft",label:"layout.margin_left"}]},{styleType:"multiple",label:"layout.padding",options:[{key:"padding",label:"layout.padding_all"},{key:"paddingX",label:"layout.padding_lr"},{key:"paddingY",label:"layout.padding_tb"},{key:"paddingTop",label:"layout.padding_top"},{key:"paddingRight",label:"layout.padding_right"},{key:"paddingBottom",label:"layout.padding_bottom"},{key:"paddingLeft",label:"layout.padding_left"}]},{styleType:"multiple",label:"layout.space_bt",options:[{key:"spaceX",label:"layout.space_lr"},{key:"spaceY",label:"layout.space_tb"}]}]},{heading:"size.heading",items:[{styleType:"accordion",heading:"size.min_width_height",items:[{type:"arbitrary",label:"size.min_width",units:C.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"size.min_height",units:C.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"size.max_width_height",items:[{type:"arbitrary",label:"size.max_width",units:C.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"size.max_height",units:C.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"size.object_options_aspect_ratio",items:[{type:"dropdown",label:"size.aspect",property:"aspectRatio"},{type:"dropdown",label:"size.fit",property:"objectFit"},{type:"dropdown",label:"size.position",property:"objectPosition"}]}]},{heading:"display.heading",items:[{type:"dropdown",label:"display.display",property:"display",units:C},{styleType:"accordion",heading:"display.flex_options",items:[{type:"dropdown",label:"display.flex_direction",property:"flexDirection"},{type:"dropdown",label:"display.flex_wrap",property:"flexWrap"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"display.grid_options",items:[{type:"range",label:"display.grid_columns",property:"gridColumns"},{type:"range",label:"display.grid_rows",property:"gridRows"},{type:"dropdown",label:"display.grid_auto_flow",property:"gridAutoFlow"},{type:"dropdown",label:"display.grid_auto_cols",property:"gridAutoColumns"},{type:"dropdown",label:"display.grid_auto_rows",property:"gridAutoRows"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",units:["px","rem"],options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"display.visibility_opacity",items:[{type:"dropdown",label:"display.visibility",property:"visibility",units:C},{type:"arbitrary",label:"display.opacity",property:"opacity",units:["-"]}]}]},{heading:"position.heading",items:[{type:"icons",label:"position.position",property:"position"},{styleType:"accordion",heading:"position.options",items:[{styleType:"multiple",label:"position.direction",options:[{key:"top",label:"position.top"},{key:"right",label:"position.right"},{key:"bottom",label:"position.bottom"},{key:"left",label:"position.left"}]},{styleType:"multiple",label:"position.inset",options:[{key:"inset",label:"position.all"},{key:"insetX",label:"position.lr"},{key:"insetY",label:"position.tb"}]},{type:"arbitrary",label:"position.z_index",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"position.float_clear",items:[{type:"icons",label:"position.float",property:"float"},{type:"dropdown",label:"position.clear",property:"clear"}]},{styleType:"accordion",heading:"position.overflow_overscroll",items:[{styleType:"multiple",type:"dropdown",label:"position.overflow",options:[{key:"overflow",label:"position.all"},{key:"overflowX",label:"position.lr"},{key:"overflowY",label:"position.tb"}]},{styleType:"multiple",type:"dropdown",label:"position.overscroll",options:[{key:"overscroll",label:"position.all"},{key:"overscrollX",label:"position.lr"},{key:"overscrollY",label:"position.tb"}]}]}]},{heading:"typography.heading",items:[{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:C},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:C.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"},{styleType:"accordion",heading:"typography.alignments",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"verticalAlign",label:"typography.valign"}]},{styleType:"accordion",heading:"typography.spacing_decoration_more",items:[{type:"dropdown",property:"letterSpacing",label:"typography.spacing"},{type:"dropdown",property:"textDecoration",label:"typography.decoration"},{type:"range",property:"textDecorationThickness",label:"typography.thickness"},{type:"dropdown",property:"textTransform",label:"typography.transform"}]},{styleType:"accordion",heading:"typography.whitespace_breaks",items:[{type:"dropdown",property:"whitespace",label:"typography.whitespace"},{type:"dropdown",property:"wordbreak",label:"typography.wordbreak"}]}]},{heading:"background.heading",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{styleType:"accordion",heading:"background.position_size_more",items:[{type:"dropdown",label:"background.attachment",property:"backgroundAttachment"},{type:"dropdown",label:"background.clipping",property:"backgroundClip"},{type:"dropdown",label:"background.origin",property:"backgroundOrigin"},{type:"dropdown",label:"background.position",property:"backgroundPosition"},{type:"dropdown",label:"background.repeat",property:"backgroundRepeat"},{type:"dropdown",label:"background.size",property:"backgroundSize"}]},{type:"dropdown",label:"background.gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"background.gradient_colors",items:[{type:"color",label:"background.from_color",property:"fromColor"},{type:"color",label:"background.via_color",property:"viaColor"},{type:"color",label:"background.to_color",property:"toColor"}]}]},{heading:"border.heading",items:[{styleType:"multiple",type:"dropdown",label:"border.width",options:[{key:"border",label:"border.all"},{key:"borderX",label:"border.lr"},{key:"borderY",label:"border.tb"},{key:"borderTop",label:"border.top"},{key:"borderRight",label:"border.right"},{key:"borderBottom",label:"border.bottom"},{key:"borderLeft",label:"border.left"}]},{styleType:"multiple",type:"dropdown",label:"border.corners",options:[{key:"borderRadius",label:"border.all"},{key:"borderRadiusTop",label:"border.top"},{key:"borderRadiusRight",label:"border.right"},{key:"borderRadiusBottom",label:"border.bottom"},{key:"borderRadiusLeft",label:"border.left"},{key:"borderRadiusTopLeft",label:"border.top_left"},{key:"borderRadiusTopRight",label:"border.top_right"},{key:"borderRadiusBottomRight",label:"border.bottom_right"},{key:"borderRadiusBottomLeft",label:"border.bottom_left"}]},{type:"color",label:"border.color",property:"borderColor"},{type:"dropdown",label:"border.style",property:"borderStyle"},{styleType:"accordion",heading:"border.divide_options",items:[{styleType:"multiple",type:"range",label:"border.width",options:[{key:"divideXWidth",label:"border.lr"},{key:"divideYWidth",label:"border.tb"}]},{type:"color",label:"border.divide_color",property:"divideColor"},{type:"dropdown",label:"border.divide_style",property:"divideStyle"}]},{styleType:"accordion",heading:"border.outline_styling",items:[{type:"range",label:"border.outline_width",property:"outlineWidth"},{type:"range",label:"border.outline_offset",property:"outlineOffset"},{type:"dropdown",label:"border.outline_style",property:"outlineStyle"}]},{styleType:"accordion",heading:"border.ring_options",items:[{type:"range",label:"border.ring_width",property:"ringWidth"},{type:"color",label:"border.ring_color",property:"ringColor"},{type:"range",label:"border.ring_offset_width",property:"ringOffsetWidth"},{type:"color",label:"border.ring_offset_color",property:"ringOffsetColor"}]}]},{heading:"effect.heading",items:[{type:"range",label:"effect.shadow",property:"boxShadow"},{type:"color",label:"effect.color",property:"boxShadowColor"},{type:"dropdown",label:"effect.cursor",property:"cursor"},{styleType:"accordion",heading:"effect.blend_cursor",items:[{type:"dropdown",label:"effect.mix_blend",property:"mixBlendMode"},{type:"dropdown",label:"effect.bg_blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"effect.transform",items:[{type:"dropdown",label:"effect.origin",property:"transformOrigin"},{styleType:"multiple",label:"effect.scale",units:["-"],options:[{key:"scale",label:"effect.all"},{key:"scaleX",label:"effect.lr"},{key:"scaleY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.skew",units:["deg"],options:[{key:"skewX",label:"effect.lr"},{key:"skewY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.translate",negative:!0,options:[{key:"translateX",label:"effect.lr"},{key:"translateY",label:"effect.tb"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"effect.rotate",property:"rotate"}]},{styleType:"accordion",heading:"effect.animation",items:[{type:"dropdown",label:"effect.animation",property:"animation"},{type:"dropdown",label:"effect.transition",property:"transition"},{type:"dropdown",label:"effect.easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"effect.duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"effect.delay",property:"delay"}]}]},{heading:"classes.heading",items:[{component:re}]}],oe={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:c.EyeOpenIcon,invisible:c.EyeClosedIcon,hidden:c.EyeClosedIcon,gap:c.BorderAllIcon,gapX:c.WidthIcon,gapY:c.HeightIcon,spaceX:c.WidthIcon,spaceY:c.HeightIcon,overscroll:c.BorderAllIcon,overscrollX:c.WidthIcon,overscrollY:c.HeightIcon,overflow:c.BorderAllIcon,overflowX:c.WidthIcon,overflowY:c.HeightIcon,top:c.ArrowUpIcon,right:c.ArrowRightIcon,bottom:c.ArrowDownIcon,left:c.ArrowLeftIcon,inset:c.BorderAllIcon,insetX:c.WidthIcon,insetY:c.HeightIcon,border:c.BorderAllIcon,borderX:c.WidthIcon,borderY:c.HeightIcon,borderTop:c.ArrowUpIcon,borderRight:c.ArrowRightIcon,borderBottom:c.ArrowDownIcon,borderLeft:c.ArrowLeftIcon,borderRadius:c.BorderAllIcon,borderRadiusX:c.WidthIcon,borderRadiusY:c.HeightIcon,borderRadiusTop:c.ArrowUpIcon,borderRadiusRight:c.ArrowRightIcon,borderRadiusBottom:c.ArrowDownIcon,borderRadiusLeft:c.ArrowLeftIcon,borderRadiusTopLeft:c.ArrowTopLeftIcon,borderRadiusTopRight:c.ArrowTopRightIcon,borderRadiusBottomRight:c.ArrowBottomRightIcon,borderRadiusBottomLeft:c.ArrowBottomLeftIcon,divideXWidth:c.WidthIcon,divideYWidth:c.HeightIcon,scale:c.BorderAllIcon,scaleX:c.WidthIcon,scaleY:c.HeightIcon,skewX:c.WidthIcon,skewY:c.HeightIcon,translateX:c.WidthIcon,translateY:c.HeightIcon,padding:c.BorderAllIcon,paddingX:c.WidthIcon,paddingY:c.HeightIcon,paddingTop:c.ArrowUpIcon,paddingRight:c.ArrowRightIcon,paddingBottom:c.ArrowDownIcon,paddingLeft:c.ArrowLeftIcon,margin:c.BorderAllIcon,marginX:c.WidthIcon,marginY:c.HeightIcon,marginTop:c.ArrowUpIcon,marginRight:c.ArrowRightIcon,marginBottom:c.ArrowDownIcon,marginLeft:c.ArrowLeftIcon,textLeft:c.AlignLeftIcon,textCenter:c.AlignCenterHorizontallyIcon,textRight:c.AlignRightIcon,textJustify:c.StretchHorizontallyIcon,italic:c.FontItalicIcon,underline:c.UnderlineIcon,overline:c.OverlineIcon,uppercase:c.LetterCaseUppercaseIcon,block:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":c.Cross2Icon,fixed:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",fill:"currentColor"})]}),static:c.Cross1Icon},L=m.createContext({canReset:!1,canChange:!0}),Te=({children:r,canReset:i=!1,canChange:s=!0})=>e.jsxRuntimeExports.jsx(L.Provider,{value:{canReset:i,canChange:s},children:r}),ne=({label:r,property:i,onChange:s})=>{const a=m.useMemo(()=>t.get(M.CLASSES_LIST,`${i}.classes`,[""]),[i]),l=O(i),n=m.useMemo(()=>t.get(l,"cls",""),[l]),{canChange:u}=m.useContext(L),x=/\[.*\]/g.test(n);return e.jsxRuntimeExports.jsx("div",{className:r?"w-full rounded":"grow",children:x?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:n}),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(c.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(Z,{rounded:r,onChange:p=>s(p,i),selected:n,options:a,disabled:!u})})};function Z({selected:r,onChange:i,rounded:s=!1,options:a,disabled:l=!1}){const n=r.replace(/.*:/g,"").trim(),{undo:u,redo:x}=o.useUndoManager();return e.jsxRuntimeExports.jsxs("select",{disabled:!a.length||l,className:`${s?"rounded-md border border-border":"border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:p=>i(p.target.value),onKeyDown:p=>{p.ctrlKey&&(p.key==="z"&&u(),p.key==="y"&&x())},value:n,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),m.Children.toArray(a.map(p=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:p,children:p})))]})}const _e=({property:r,onChange:i})=>{const{canReset:s,canChange:a}=m.useContext(L),l=O(r),n=m.useMemo(()=>t.get(l,"cls",""),[l]),u=m.useMemo(()=>t.get(M.CLASSES_LIST,`${r}.classes`,[""]),[r]),x=u.indexOf(n)>-1?u.indexOf(n):0,p=/\[.*\]/g.test(n);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:p?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:n}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!a&&(!s||x-1<0),onClick:()=>i(t.nth(u,x-1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(c.MinusIcon,{className:!a&&(!s||x-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(ne,{label:!1,property:r,onChange:i})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!a&&(!s||x+1>=u.length),onClick:()=>i(t.nth(u,x+1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(c.PlusIcon,{className:!a&&(!s||x+1>=u.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Ie=({property:r,onChange:i})=>{const s=m.useMemo(()=>t.get(M.CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:a}=m.useContext(L),l=O(r),n=m.useMemo(()=>t.get(l,"cls",""),[l]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(s,u=>e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!a,onClick:()=>i(u,r),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${n===u?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:m.createElement(t.get(oe,u,c.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(u))})]}))})},Be={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},He=({property:r,onChange:i})=>{const s=O(r),a=m.useMemo(()=>t.get(s,"cls",""),[s]),{canChange:l}=m.useContext(L),[n,u]=m.useState([]),[x,p]=m.useState({color:"",shade:""}),g=a.split("-"),f=t.get(g,"1",""),d=t.get(g,"2",""),y=m.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(u([]),p({color:h})):(u(["50","100","200","300","400","500","600","700","800","900"]),p(R=>({...R,color:h,shade:R.shade?R.shade:"500"})))},[u,p]);m.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(f))return u([]);u(["50","100","200","300","400","500","600","700","800","900"])},[f]);const b=m.useCallback(h=>{p({color:f,shade:h})},[f]);return m.useEffect(()=>{p({color:"",shade:""})},[s]),m.useEffect(()=>{const R=`${t.get(Be,r,"")}-${x.color}${x.shade?`-${x.shade}`:""}`;R.match(new RegExp(t.get(M.CLASSES_LIST,`${r}.regExp`,"")))&&i(R,r)},[x,i,r]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:e.jsxRuntimeExports.jsx(Z,{disabled:!l,rounded:!0,selected:f,onChange:y,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(Z,{rounded:!0,selected:d,disabled:!f||!l,onChange:b,options:n})})]})},J=(r,i)=>{r=r.toLowerCase();let s=r.trim().replace(/ |\+/g,"");if((s==="auto"||s==="none")&&i.includes(s))return{value:"",unit:s};const a=i.length?new RegExp(i.join("|"),"g"):/XXXXXX/g;s=s.replace(a,"");const l=r.match(a),n=l&&l.length>1,u=!t.isEmpty(s)&&Number.isNaN(Number(s));return n||u?{error:"Invalid value"}:l&&(l[0]==="auto"||l[0]==="none")?{value:l[0],unit:""}:{value:s,unit:l?l[0]:""}};const Ae=r=>{const i=r.startsWith("-")?"-":"",s=r.split("-").pop();if(["auto","none"].includes(s))return{value:"",unit:s};if(s==="px")return{value:"1",unit:"px"};if(s==="screen")return{value:"100",unit:r.indexOf("w-")!==-1?"vw":"vh"};if(s==="full")return{value:"100",unit:"%"};if(t.includes(r,"skew-"))return{value:`${i}${s}`,unit:"deg"};if(t.includes(r,"rotate-"))return{value:`${i}${s}`,unit:"deg"};if(t.includes(r,"opacity-"))return{value:`${s/100}`,unit:"-"};if(t.includes(r,"duration-")||t.includes(r,"delay-"))return{value:`${s}`,unit:"ms"};if(t.includes(r,"translate-")&&!s.includes("/"))return{value:`${i}${`${s/4}`}`,unit:"rem"};if(t.includes(r,"scale-"))return{value:`${i}${`${s/100}`}`,unit:"-"};if(t.startsWith(r,"border")){const a=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(a)return{value:a[0].split("-").pop(),unit:"px"};if(r.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(r,"max-w-")){if(r==="max-w-screen-sm")return{value:"640",unit:"px"};if(r==="max-w-screen-md")return{value:"768",unit:"px"};if(r==="max-w-screen-lg")return{value:"1024",unit:"px"};if(r==="max-w-screen-xl")return{value:"1280",unit:"px"};if(r==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(s==="xs")return{value:"320",unit:"px"};if(s==="sm")return{value:"384",unit:"px"};if(s==="md")return{value:"448",unit:"px"};if(s==="lg")return{value:"512",unit:"px"};if(s==="xl")return{value:"576",unit:"px"};if(s==="2xl")return{value:"672",unit:"px"};if(s==="3xl")return{value:"768",unit:"px"};if(s==="4xl")return{value:"896",unit:"px"};if(s==="5xl")return{value:"1024",unit:"px"};if(s==="6xl")return{value:"1152",unit:"px"};if(s==="7xl")return{value:"1280",unit:"px"};if(s==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(r,"text-")){if(s==="xs")return{value:"12",unit:"px"};if(s==="sm")return{value:"14",unit:"px"};if(s==="base")return{value:"16",unit:"px"};if(s==="lg")return{value:"18",unit:"px"};if(s==="xl")return{value:"20",unit:"px"};if(s==="2xl")return{value:"24",unit:"px"};if(s==="3xl")return{value:"30",unit:"px"};if(s==="4xl")return{value:"36",unit:"px"};if(s==="5xl")return{value:"48",unit:"px"};if(s==="6xl")return{value:"60",unit:"px"};if(s==="7xl")return{value:"72",unit:"px"};if(s==="8xl")return{value:"96",unit:"px"};if(s==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(r,"leading-")){if(s==="none")return{value:"1",unit:"-"};if(s==="tight")return{value:"1.25",unit:"-"};if(s==="snug")return{value:"1.375",unit:"-"};if(s==="normal")return{value:"1.5",unit:"-"};if(s==="relaxed")return{value:"1.625",unit:"-"};if(s==="loose")return{value:"2",unit:"-"}}if(t.startsWith(r,"tracking-")){if(s==="tighter")return{value:"-0.05",unit:"em"};if(s==="tight")return{value:"-0.025",unit:"em"};if(s==="normal")return{value:"0",unit:"em"};if(s==="wide")return{value:"0.025",unit:"em"};if(s==="wider")return{value:"0.05",unit:"em"};if(s==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(s))return{value:r,unit:"class"};if(s.includes("/")){const[a,l]=t.map(s.split("/"),n=>parseInt(n,10));return{value:i+(a/l*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(s))?{value:`${i+parseFloat(s)*4}`,unit:"px"}:{value:s,unit:"class"}};const De=r=>{if(t.isEmpty(r))return{value:"",unit:""};const i=r.match(/\[.*\]/g);if(i===null)return Ve(r);const s=t.get(i,"0","").replace(/\[|\]/g,""),a=r.startsWith("-")?"-":"",l=t.first(s.match(/\d+.\d+|\d+/g));return{value:`${a}${l}`,unit:s.replace(l,"")}},Ve=r=>t.isEmpty(r)?{value:"",unit:""}:Ae(r),ie=m.createContext({setDragData:()=>{}}),Pe=({unit:r,currentValue:i,onDrag:s,onDragEnd:a,onDragStart:l,negative:n,cssProperty:u})=>{const{setDragData:x}=m.useContext(ie);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:p=>{const g={onDrag:s,onDragEnd:a,dragging:!0,dragStartY:p.pageY,dragStartValue:`${i}`,dragUnit:r,negative:n,cssProperty:u};l(g),x(g)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:e.jsxRuntimeExports.jsx(c.RowSpacingIcon,{})})},Me=({onSelect:r,current:i,units:s})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:s.map(a=>e.jsxRuntimeExports.jsx(o.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:i===a?"primary":void 0,size:"sm",onClick:l=>{l.stopPropagation(),r(a)},children:a},a))}),Q=50,$e=r=>{const[i,s]=m.useState(!1),[a,l]=m.useState(""),{currentClass:n,onChange:u,classPrefix:x,cssProperty:p,units:g,negative:f}=r,[d,y]=m.useState(p!=null&&p.toLowerCase().includes("width")?"%":g[0]),[b,h]=m.useState(!1),[R,w]=m.useState(""),[A,_]=m.useState(!1),[D,V]=m.useState(!1);m.useEffect(()=>{const{value:j,unit:v}=De(n);if(v===""){l(j),y(p!=null&&p.toLowerCase().includes("width")?"%":t.first(g));return}y(v),l(v==="class"||t.isEmpty(j)?"":j)},[n,p,g]);const N=z.useThrottledCallback(j=>u(j),[u],Q),E=z.useThrottledCallback(j=>u(j,!1),[u],Q),S=m.useCallback((j=!1)=>{const v=J(`${a}`,g);if(t.get(v,"error",!1)){h(!0);return}const k=t.get(v,"unit")!==""?t.get(v,"unit"):d;if(k==="auto"||k==="none"){N(`${x}${k}`);return}if(t.get(v,"value")==="")return;const B=`${t.get(v,"value","").startsWith("-")?"-":""}${x}[${t.get(v,"value","").replace("-","")}${k==="-"?"":k}]`;j?E(B):N(B)},[N,E,a,d,x,g]),H=m.useCallback(j=>{const v=J(`${a}`,g);if(t.get(v,"error",!1)){h(!0);return}if(j==="auto"||j==="none"){N(`${x}${j}`);return}if(t.get(v,"value")==="")return;const k=t.get(v,"unit")!==""?t.get(v,"unit"):j,B=`${t.get(v,"value","").startsWith("-")?"-":""}${x}[${t.get(v,"value","").replace("-","")}${k==="-"?"":k}]`;N(B)},[N,a,x,g]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:d==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:n}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(c.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${A?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(d)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:d==="class",onKeyPress:j=>{j.key==="Enter"&&S()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),V(!0);const v=t.parseInt(j.target.value);let k=t.isNaN(v)?0:v;j.keyCode===38&&(k+=1),j.keyCode===40&&(k-=1);const I=`${k}`,ae=`${I.startsWith("-")?"-":""}${x}[${I.replace("-","")}${d==="-"?"":d}]`;E(ae)},onKeyUp:j=>{D&&(j.preventDefault(),V(!1))},onBlur:()=>S(),onChange:j=>{h(!1),l(j.target.value)},onClick:j=>{var v;(v=j==null?void 0:j.target)==null||v.select(),s(!1)},value:A?R:a,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",b?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{open:i,delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>s(!i),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${g.length===1?"px-2 font-semibold":""}`,children:d}),g.length>1?e.jsxRuntimeExports.jsx(c.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(o.TooltipPortal,{children:e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Me,{units:g,current:d,onSelect:j=>{s(!1),y(j),H(j)}})})})]})]}),["none","auto"].indexOf(d)!==-1||A?null:e.jsxRuntimeExports.jsx(Pe,{onDragStart:()=>_(!0),onDragEnd:j=>{if(w(()=>""),_(!1),t.isEmpty(j))return;const v=`${j}`,I=`${v.startsWith("-")?"-":""}${x}[${v.replace("-","")}${d==="-"?"":d}]`;N(I)},onDrag:j=>{if(t.isEmpty(j))return;w(j);const v=`${j}`,I=`${v.startsWith("-")?"-":""}${x}[${v.replace("-","")}${d==="-"?"":d}]`;E(I)},currentValue:a,unit:d,negative:f,cssProperty:p})]})})})},O=r=>{const i=o.useSelectedBlockCurrentClasses();return t.findLast(i,{property:r})},Le=(r,i)=>{const s={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return s[t.get(r,"mq","xs")]<=s[i]},Oe={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},ee={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},qe=r=>`${r.toUpperCase()} ${ee[r]?`(${ee[r]} & up)`:""}`,U=r=>{const{t:i}=T.useTranslation(),{type:s="icons",label:a,property:l,onEmitChange:n=()=>{},units:u,negative:x=!1}=r,[p]=o.useDarkMode(),[g]=o.useStylingState(),[,f]=o.useCanvasWidth(),d=O(l),y=o.useAddClassesToBlocks(),b=o.useRemoveClassesFromBlocks(),[h]=o.useSelectedBlockIds(),R=m.useMemo(()=>t.get(d,"fullCls",""),[d]),w=m.useCallback((E,S=!0)=>{const H={dark:p,mq:f,mod:g,cls:E,property:l,fullCls:""};(p||g!=="")&&(H.mq="xs");const j=M.generateFullClsName(H);y(h,[j],S)},[h,p,f,g,l,y]),A=m.useCallback(()=>{b(h,[R])},[h,R,b]),_=m.useMemo(()=>Le(d,f),[d,f]);m.useEffect(()=>{n(_,d)},[_,n,d]);const[,,D]=o.useCanvasWidth(),V=m.useCallback(E=>{D({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[E])},[D]),N=t.get(d,"dark",null)===p&&t.get(d,"mod",null)===g&&t.get(d,"mq",null)===f;return e.jsxRuntimeExports.jsx(Te,{canChange:_,canReset:d&&N,children:e.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:e.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${d&&!N?"text-foreground":""}`,children:i(a)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[s==="arbitrary"?e.jsxRuntimeExports.jsx($e,{currentClass:t.get(d,"cls",""),classPrefix:t.get(Oe,l,""),units:u||[],onChange:w,negative:x,cssProperty:l}):null,s==="icons"&&e.jsxRuntimeExports.jsx(Ie,{property:l,onChange:w}),s==="range"&&e.jsxRuntimeExports.jsx(_e,{property:l,onChange:w}),s==="color"&&e.jsxRuntimeExports.jsx(He,{property:l,onChange:w}),s==="dropdown"&&e.jsxRuntimeExports.jsx(ne,{label:a,property:l,onChange:w})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${R?"visible":"invisible"}`,children:N?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>A(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(c.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):_&&d?e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(c.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("div",{className:"text-right",children:e.jsxRuntimeExports.jsxs("div",{children:["Current style is set at ",e.jsxRuntimeExports.jsxs("span",{className:"font-bold",children:[qe(t.get(d,"mq")),p&&!d.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>V(t.get(d,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(d,"mq").toUpperCase()]})]})})})]}):null})]})]})})},ze=["px","%","em","rem","ch","vh","vw"],le=({label:r,options:i,borderB:s=!1,borderT:a=!1,type:l="arbitrary",units:n=ze,negative:u=!1})=>{const{t:x}=T.useTranslation(),[p,g]=m.useState(i[0].key),f=o.useSelectedBlockCurrentClasses(),d=m.useCallback(y=>t.map(f,"property").includes(y),[f]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${s?"border-b":""} ${a?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[r&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:x(r)}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:m.Children.toArray(i.map(({label:y,key:b})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>g(b),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${b===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[m.createElement("div",{className:d(b)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),m.createElement(t.get(oe,b,c.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(y))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(U,{type:l,units:[...n],label:"",property:p,negative:u})})]})},We=({heading:r,items:i})=>{const{t:s}=T.useTranslation(),a=o.useSelectedBlockCurrentClasses(),l=m.useMemo(()=>{const n=p=>t.flatten(p.map(g=>g.styleType==="multiple"?t.map(g.options,"key"):g.property)),u=t.flatten(i.map(p=>p.styleType==="accordion"?n(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),x=t.map(a,"property");return t.intersection(u,x).length>0},[a,i]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[s(r),l?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${l?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:i.map(n=>n.styleType==="multiple"?e.jsxRuntimeExports.jsx(le,{...n},n.label):e.jsxRuntimeExports.jsx(U,{...n},n.label))})]})},Fe=m.createContext({}),F=({section:r})=>{const{t:i}=T.useTranslation(),s=o.useSelectedBlockCurrentClasses(),a=m.useCallback((n=[])=>{const u={};for(let p=0;p<s.length;p++)u[s[p].property]=s[p].cls;let x=!0;for(const p in n)if(!t.has(u,p)||u[p]!==n[p]){x=!1;break}return x},[s]),l=m.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Fe.Provider,{value:l,children:e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-200 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-2",children:i(r.heading)})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:m.Children.toArray(r.items.map(n=>t.has(n,"component")?m.createElement(n.component,{key:n.label}):t.has(n,"styleType")?n.styleType==="multiple"?e.jsxRuntimeExports.jsx(le,{...n},n.label):n.styleType==="accordion"&&a(n==null?void 0:n.conditions)?e.jsxRuntimeExports.jsx(We,{...n},n.label):null:e.jsxRuntimeExports.jsx(U,{...n},n.label)))})]})})},Ye=()=>{const r=o.useSelectedBlock(),[i]=o.useSelectedStylingBlocks(),{t:s}=T.useTranslation(),a=$.useGlobalStylingPresets(),l=o.useAddClassesToBlocks(),n=$.getBlockComponent(r._type),u=t.get(t.first(i),"prop"),x=t.get(n.props,`${u}.presets`,{});if(t.isEmpty(a)&&(!t.has(n,"props")||t.isEmpty(x)))return null;const p=g=>{const f=g.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");l([r._id],f,!0)};return e.jsxRuntimeExports.jsx("div",{className:"h-10",children:e.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"px-4",children:e.jsxRuntimeExports.jsxs(o.Button,{variant:"default",className:"w-full",size:"sm",children:[s("Apply Presets"),e.jsxRuntimeExports.jsx(c.CaretDownIcon,{})]})})}),e.jsxRuntimeExports.jsx(o.DropdownMenuContent,{className:"max-h-80 w-56",children:e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar h-full",children:[t.isEmpty(x)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DropdownMenuLabel,{children:[n.type," ",s("presets")]}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(x).map(g=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>p(x[g]),children:[t.capitalize(t.startCase(s(g))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:s("apply")})]}))})]}),t.isEmpty(a)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:s("Global presets")}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(a).map(g=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>p(a[g]),children:[t.capitalize(t.startCase(s(g))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:s("apply")})]}))})]})]})})]})})};function Xe(){const{flexChild:r,gridChild:i}=o.useSelectedBlocksDisplayChild(),[s]=o.useSelectedStylingBlocks();return t.isEmpty(s)?null:e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx(Ye,{}),e.jsxRuntimeExports.jsxs(o.Accordion,{defaultValue:["Styles"],type:"multiple",className:"w-full",children:[r&&e.jsxRuntimeExports.jsx(F,{section:ke}),i?e.jsxRuntimeExports.jsx(F,{section:Ne}):null,Se.map(a=>e.jsxRuntimeExports.jsx(F,{section:a},a.heading))]})]})}const Ze={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},Ue=()=>{const r=o.useSelectedBlock(),{t:i}=T.useTranslation(),[s,a]=m.useState(""),[l,n]=m.useState({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),u=z.useThrottledCallback(p=>{const g=!t.get(l,"negative",!1),f=t.get(l,"cssProperty","");let d=parseFloat(l.dragStartValue);d=t.isNaN(d)?0:d;let y=Ze[l.dragUnit];(t.startsWith(f,"scale")||f==="opacity")&&(y=10);let h=(l.dragStartY-p.pageY)/y+d;g&&h<0&&(h=0),f==="opacity"&&h>1&&(h=1),l.onDrag(`${h}`),a(`${h}`)},[l],50),x=m.useCallback(()=>{setTimeout(()=>l.onDragEnd(`${s}`),100),n({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[l,s,n]);return t.isNull(r)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(c.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:i("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(o.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(ie.Provider,{value:{setDragData:n},children:[l.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:u,onMouseUp:()=>x(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar max-h-full flex-1 overflow-x-hidden overflow-y-hidden bg-gray-100 pb-5",children:[e.jsxRuntimeExports.jsx(Re,{}),e.jsxRuntimeExports.jsx(Xe,{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{})]})]})})};exports.default=Ue;
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { stringify as b, parse as x } from "himalaya";
|
|
2
|
-
import { g as w, c as N } from "./Functions-7jnEwJyw.js";
|
|
3
|
-
import { isEmpty as m, includes as f, get as n, forEach as A, find as p, set as u, capitalize as C, flatMapDeep as L, filter as S, flatten as $ } from "lodash-es";
|
|
4
|
-
import { a as y } from "./MODIFIERS-fd5XOmum.js";
|
|
5
|
-
const B = (t) => {
|
|
6
|
-
const s = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, e = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
|
|
7
|
-
return s.test(t) || e.test(t);
|
|
8
|
-
}, R = (t) => {
|
|
9
|
-
if (m(t))
|
|
10
|
-
return t;
|
|
11
|
-
const s = /<video[^>]+src=['"]([^'">]+)['"]/, e = /<iframe[^>]+src=['"]([^'">]+)['"]/, a = t.match(s), i = t.match(e), c = a ? a[1] : i ? i[1] : null, r = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, l = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
|
|
12
|
-
return c && (r.test(c) || l.test(c)) ? c : t;
|
|
13
|
-
}, H = {
|
|
14
|
-
img: { alt: "alt", width: "width", height: "height", src: "image" },
|
|
15
|
-
video: {
|
|
16
|
-
src: "url",
|
|
17
|
-
autoplay: "controls.autoPlay",
|
|
18
|
-
muted: "controls.muted",
|
|
19
|
-
loop: "controls.loop",
|
|
20
|
-
controls: "controls.widgets"
|
|
21
|
-
},
|
|
22
|
-
a: {
|
|
23
|
-
href: "link.href",
|
|
24
|
-
target: "link.target",
|
|
25
|
-
type: ""
|
|
26
|
-
// @TODO: Detect here what to url, email, phone, elementId
|
|
27
|
-
},
|
|
28
|
-
input: {
|
|
29
|
-
placeholder: "placeholder",
|
|
30
|
-
required: "required",
|
|
31
|
-
type: "inputType",
|
|
32
|
-
name: "fieldName"
|
|
33
|
-
},
|
|
34
|
-
textarea: {
|
|
35
|
-
placeholder: "placeholder",
|
|
36
|
-
required: "required",
|
|
37
|
-
type: "inputType",
|
|
38
|
-
name: "fieldName"
|
|
39
|
-
},
|
|
40
|
-
select: {
|
|
41
|
-
placeholder: "placeholder",
|
|
42
|
-
required: "required",
|
|
43
|
-
multiple: "multiple",
|
|
44
|
-
name: "fieldName"
|
|
45
|
-
}
|
|
46
|
-
}, I = (t, s) => t.children.length === 1 && f(["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link"], s._type), v = (t) => t.map((s) => s.type === "text" ? n(s, "content", "") : m(s.children) ? "" : v(s.children)).join(""), d = (t) => t === null ? !0 : t, _ = (t) => {
|
|
47
|
-
if (t.tagName === "svg")
|
|
48
|
-
return {};
|
|
49
|
-
const s = {}, e = H[t.tagName] || {}, a = t.attributes;
|
|
50
|
-
return A(a, ({ key: i, value: c }) => {
|
|
51
|
-
if (e[i]) {
|
|
52
|
-
if (t.tagName === "img" && i === "src" && !c.startsWith("http")) {
|
|
53
|
-
const r = p(t.attributes, { key: "width" }), l = p(t.attributes, { key: "height" });
|
|
54
|
-
r && l ? c = `https://via.placeholder.com/${r == null ? void 0 : r.value}x${l == null ? void 0 : l.value}` : c = "https://via.placeholder.com/150x150";
|
|
55
|
-
}
|
|
56
|
-
u(s, e[i], d(c));
|
|
57
|
-
} else
|
|
58
|
-
f(["style", "class", "srcset"], i) || u(s, `styles_attrs.${i}`, d(c));
|
|
59
|
-
}), delete s.class, s;
|
|
60
|
-
}, M = (t, s = "styles") => {
|
|
61
|
-
if (!t.attributes)
|
|
62
|
-
return { [s]: `${y},` };
|
|
63
|
-
const e = p(t.attributes, { key: "class" });
|
|
64
|
-
if (e) {
|
|
65
|
-
const a = e.value;
|
|
66
|
-
return { [s]: `${y},${a}` };
|
|
67
|
-
}
|
|
68
|
-
return { [s]: `${y},` };
|
|
69
|
-
}, E = (t) => {
|
|
70
|
-
const s = {
|
|
71
|
-
"hs-collapse-toggle": "CollapseToggle",
|
|
72
|
-
"hs-collapse": "Collapse",
|
|
73
|
-
"hs-accordion-group": "AccordionGroup",
|
|
74
|
-
"hs-accordion": "Accordion",
|
|
75
|
-
"hs-accordion-toggle": "AccordionToggle",
|
|
76
|
-
"hs-accordion-content": "AccordionContent"
|
|
77
|
-
}, e = {
|
|
78
|
-
Accordion: "active",
|
|
79
|
-
CollapseToggle: "open"
|
|
80
|
-
}, a = p(t.attributes, { key: "class" });
|
|
81
|
-
if (a) {
|
|
82
|
-
const r = a.value.split(" ");
|
|
83
|
-
for (const l of r)
|
|
84
|
-
if (s[l]) {
|
|
85
|
-
const g = s[l], h = a.value.replace(l, "");
|
|
86
|
-
return t.attributes = t.attributes.map((o) => o.key === "class" ? { ...o, value: h } : o), e[g] && (t.attributes = t.attributes.map(
|
|
87
|
-
(o) => o.key === "class" ? { ...o, value: o.value.replace(e[g], "") } : o
|
|
88
|
-
)), g;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const i = {};
|
|
92
|
-
for (const r in i)
|
|
93
|
-
if (t.attributes.some((l) => l.key === r))
|
|
94
|
-
return i[r];
|
|
95
|
-
const c = p(t.attributes, { key: "role" });
|
|
96
|
-
if (c) {
|
|
97
|
-
const r = `role="${c.value}"`;
|
|
98
|
-
if (i[r])
|
|
99
|
-
return i[r];
|
|
100
|
-
}
|
|
101
|
-
}, q = (t) => {
|
|
102
|
-
const s = E(t);
|
|
103
|
-
if (s)
|
|
104
|
-
return { _type: s };
|
|
105
|
-
switch (t.tagName) {
|
|
106
|
-
case "img":
|
|
107
|
-
return { _type: "Image" };
|
|
108
|
-
case "input":
|
|
109
|
-
return { _type: "Input", showLabel: !1 };
|
|
110
|
-
case "hr":
|
|
111
|
-
return { _type: "Divider" };
|
|
112
|
-
case "br":
|
|
113
|
-
return { _type: "LineBreak" };
|
|
114
|
-
case "textarea":
|
|
115
|
-
return { _type: "TextArea", showLabel: !1 };
|
|
116
|
-
case "audio":
|
|
117
|
-
return { _type: "Audio" };
|
|
118
|
-
case "canvas":
|
|
119
|
-
return { _type: "Canvas" };
|
|
120
|
-
case "video":
|
|
121
|
-
case "iframe":
|
|
122
|
-
return { _type: "CustomHTML" };
|
|
123
|
-
case "svg":
|
|
124
|
-
return { _type: "Icon" };
|
|
125
|
-
case "select":
|
|
126
|
-
return { _type: "Select", options: [] };
|
|
127
|
-
case "option":
|
|
128
|
-
return { _type: "Option" };
|
|
129
|
-
case "ul":
|
|
130
|
-
case "ol":
|
|
131
|
-
case "dl":
|
|
132
|
-
return {
|
|
133
|
-
_type: "List",
|
|
134
|
-
tag: t.tagName,
|
|
135
|
-
_listType: t.tagName === "ol" ? "list-decimal" : "list-none"
|
|
136
|
-
};
|
|
137
|
-
case "li":
|
|
138
|
-
case "dt":
|
|
139
|
-
return { _type: "ListItem", tag: t.tagName };
|
|
140
|
-
case "span":
|
|
141
|
-
case "figcaption":
|
|
142
|
-
case "legend":
|
|
143
|
-
return { _type: "Span", tag: t.tagName };
|
|
144
|
-
case "p":
|
|
145
|
-
return { _type: "Paragraph", content: "" };
|
|
146
|
-
case "a":
|
|
147
|
-
return { _type: "Link" };
|
|
148
|
-
case "form":
|
|
149
|
-
return { _type: "Form" };
|
|
150
|
-
case "label":
|
|
151
|
-
return { _type: "Label" };
|
|
152
|
-
case "button":
|
|
153
|
-
return { _type: "Button" };
|
|
154
|
-
case "code":
|
|
155
|
-
return { _type: "Code" };
|
|
156
|
-
case "h1":
|
|
157
|
-
case "h2":
|
|
158
|
-
case "h3":
|
|
159
|
-
case "h4":
|
|
160
|
-
case "h5":
|
|
161
|
-
case "h6":
|
|
162
|
-
return { _type: "Heading", tag: t.tagName };
|
|
163
|
-
case "table":
|
|
164
|
-
return { _type: "Table" };
|
|
165
|
-
case "tr":
|
|
166
|
-
return { _type: "TableRow" };
|
|
167
|
-
case "td":
|
|
168
|
-
case "th":
|
|
169
|
-
return { _type: "TableCell", tag: t.tagName };
|
|
170
|
-
case "thead":
|
|
171
|
-
return { _type: "TableHead" };
|
|
172
|
-
case "tbody":
|
|
173
|
-
return { _type: "TableBody" };
|
|
174
|
-
case "tfoot":
|
|
175
|
-
return { _type: "TableFooter" };
|
|
176
|
-
default:
|
|
177
|
-
const e = n(t, "children", []).length > 0 ? "Box" : "EmptyBox";
|
|
178
|
-
return {
|
|
179
|
-
_type: e,
|
|
180
|
-
tag: t.tagName,
|
|
181
|
-
_name: e == "EmptyBox" || t.tagName === "div" ? e : C(t.tagName)
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
}, T = (t, s = null) => L(t, (e) => {
|
|
185
|
-
var c;
|
|
186
|
-
if (e.type === "comment")
|
|
187
|
-
return [];
|
|
188
|
-
let a = { _id: w() };
|
|
189
|
-
if (s && (a._parent = s.block._id), e.type === "text")
|
|
190
|
-
return m(n(e, "content", "")) ? [] : s && I(s.node, s.block) ? (u(s, "block.content", n(e, "content", "")), []) : { ...a, _type: "Text", content: n(e, "content", "") };
|
|
191
|
-
if (a = {
|
|
192
|
-
...a,
|
|
193
|
-
...q(e),
|
|
194
|
-
..._(e),
|
|
195
|
-
...M(e)
|
|
196
|
-
}, a._type === "Input") {
|
|
197
|
-
const r = a.inputType || "text";
|
|
198
|
-
r === "checkbox" ? u(a, "_type", "Checkbox") : r === "radio" && u(a, "_type", "Radio");
|
|
199
|
-
} else if (e.tagName === "video" || e.tagName === "iframe") {
|
|
200
|
-
const r = b([e]);
|
|
201
|
-
return B(r) && (u(a, "_type", "Video"), u(a, "url", R(r)), u(a, "styles", `${y},absolute top-0 left-0 w-full h-full`), u(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = r, [a];
|
|
202
|
-
} else if (e.tagName === "svg") {
|
|
203
|
-
const r = p(e.attributes, { key: "height" }), l = p(e.attributes, { key: "width" }), g = n(r, "value") ? `[${n(r, "value")}px]` : "24px", h = n(l, "value") ? `[${n(l, "value")}px]` : "24px", o = n(p(e.attributes, { key: "class" }), "value", "w-full h-full");
|
|
204
|
-
return a.styles = `${y}, ${N(`w-${h} h-${g}`, o)}`.trim(), e.attributes = S(e.attributes, (k) => !f(["style", "width", "height", "class"], k.key)), a.icon = b([e]), [a];
|
|
205
|
-
} else if (e.tagName == "option" && s && ((c = s.block) == null ? void 0 : c._type) === "Select")
|
|
206
|
-
return s.block.options.push({
|
|
207
|
-
label: v(e.children),
|
|
208
|
-
..._(e)
|
|
209
|
-
}), [];
|
|
210
|
-
const i = T(e.children, { block: a, node: e });
|
|
211
|
-
return [a, ...i];
|
|
212
|
-
}), P = (t) => {
|
|
213
|
-
const s = t.match(/<body[^>]*>[\s\S]*?<\/body>/);
|
|
214
|
-
return (s && s.length > 0 ? s[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : t).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
|
|
215
|
-
}, D = (t) => {
|
|
216
|
-
const s = x(P(t));
|
|
217
|
-
return m(t) ? [] : $(T(s));
|
|
218
|
-
};
|
|
219
|
-
export {
|
|
220
|
-
D as g
|
|
221
|
-
};
|