@chaibuilder/sdk 1.2.38 → 1.2.39
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-2_dpKDpp.js +144 -0
- package/dist/AddBlocks-p4Hrxjdf.cjs +1 -0
- package/dist/{CanvasArea-WJYJtUFt.js → CanvasArea-iN0LxF74.js} +183 -184
- package/dist/{CanvasArea-MuuWWyW0.cjs → CanvasArea-sbec3R-f.cjs} +5 -5
- package/dist/{ChaiBuilderEditor-vzyVasJe.js → ChaiBuilderEditor-JnZFji5_.js} +8191 -8073
- package/dist/{ChaiBuilderEditor-PLQ8Sq34.cjs → ChaiBuilderEditor-qxbkVVLu.cjs} +49 -49
- package/dist/{CurrentPage-j6xVMVFH.js → CurrentPage-Lr3ztuMx.js} +9 -10
- package/dist/CurrentPage-m7_GkZ8a.cjs +1 -0
- package/dist/ListTree-piETqoz9.cjs +1 -0
- package/dist/{ListTree-1oWz6vwo.js → ListTree-uJFhqUk9.js} +1 -2
- package/dist/{PagesPanel-PKnqTla9.js → PagesPanel-R8FWg5Xg.js} +4 -5
- package/dist/PagesPanel-lShO3SmJ.cjs +1 -0
- package/dist/{ProjectPanel-hx21JHK8.js → ProjectPanel-2dX4bM5q.js} +5 -6
- package/dist/ProjectPanel-_4546hym.cjs +1 -0
- package/dist/{Settings-3omes6Yj.js → Settings-J785mqWv.js} +4 -5
- package/dist/Settings-e2AZkjqY.cjs +1 -0
- package/dist/SidePanels-Vfw9Ir6p.cjs +1 -0
- package/dist/{SidePanels-vNc0pvVt.js → SidePanels-cN9er64h.js} +165 -146
- package/dist/{BrandingOptions-z7hXgff2.js → ThemeConfiguration-m_jkR2zi.js} +42 -41
- package/dist/ThemeConfiguration-nler1cz3.cjs +1 -0
- package/dist/Topbar-DmIPkF8D.cjs +1 -0
- package/dist/{Topbar-c3HIPa_q.js → Topbar-gaBycI3a.js} +3 -4
- package/dist/UILibrariesPanel-Igx0R4zc.js +138 -0
- package/dist/UILibrariesPanel-N144UO0E.cjs +1 -0
- package/dist/{UnsplashImages-IQo081nF.js → UnsplashImages-6HmGnetM.js} +3 -4
- package/dist/UnsplashImages-mC2ewX9D.cjs +1 -0
- package/dist/UploadImages-fo9ufcCE.cjs +1 -0
- package/dist/{UploadImages-BAy3wsRT.js → UploadImages-qRW8zhKj.js} +3 -4
- package/dist/{add-page-modal-WWRdRyDM.js → add-page-modal-0OuVNgx3.js} +16 -17
- package/dist/add-page-modal-mP9aTfG9.cjs +1 -0
- package/dist/{confirm-alert-LvvLsCWh.cjs → confirm-alert-3cDnni4v.cjs} +1 -1
- package/dist/{confirm-alert-h4RiwjkJ.js → confirm-alert-Mv-Iofef.js} +3 -4
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -0
- package/dist/core.js +44 -45
- package/dist/{delete-page-modal-XymJxo7r.js → delete-page-modal-BVz9nreM.js} +4 -5
- package/dist/delete-page-modal-PTwcrTET.cjs +1 -0
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +3 -0
- package/dist/email.js +3 -4
- package/dist/{form-P0nEC3WH.js → form-e8l4xtI9.js} +1 -1
- package/dist/{form-I4uC5vkq.cjs → form-o7e6NNTk.cjs} +1 -1
- package/dist/{index-mVQVs_cP.cjs → index--XTVdy1h.cjs} +1 -1
- package/dist/{index-SP6aKHPH.js → index-CdnwVCXv.js} +2 -2
- package/dist/{page-viewer-OSlqdbEV.js → page-viewer-OopsJHBE.js} +5 -6
- package/dist/page-viewer-cjvx3lg7.cjs +1 -0
- package/dist/{project-general-setting-JR9L7fMQ.cjs → project-general-setting-3sdmeYrS.cjs} +1 -1
- package/dist/{project-general-setting-LXfl5i5Z.js → project-general-setting-n8KKf8qD.js} +5 -6
- package/dist/{project-seo-setting-cVDCPjBD.cjs → project-seo-setting-E554FQ3V.cjs} +1 -1
- package/dist/{project-seo-setting-lyzUUxe2.js → project-seo-setting-pu3qUSE0.js} +4 -5
- package/dist/single-page-detail-KdxEu4WS.cjs +1 -0
- package/dist/{single-page-detail-GeG-SXWn.js → single-page-detail-hcTkta3X.js} +6 -7
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +3 -0
- package/dist/studio.js +3 -4
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +138 -139
- package/dist/{useCanvasSettings-_EzUaA9P.js → useCanvasSettings-6lwRwexD.js} +1 -1
- package/dist/{useCanvasSettings-bP_V0UR2.cjs → useCanvasSettings-oERGzYXb.cjs} +1 -1
- package/package.json +2 -2
- package/dist/AddBlocks-G9pjsIyq.cjs +0 -1
- package/dist/AddBlocks-dljjAE5r.js +0 -210
- package/dist/BrandingOptions-N7iDaMgM.cjs +0 -1
- package/dist/CurrentPage-LaeYQ-Ke.cjs +0 -1
- package/dist/ListTree-_7e5p_e3.cjs +0 -1
- package/dist/PagesPanel-BsELxMie.cjs +0 -1
- package/dist/ProjectPanel-1aAFwguw.cjs +0 -1
- package/dist/Settings-tYjuuUgX.cjs +0 -1
- package/dist/SidePanels-7WG6SXw0.cjs +0 -1
- package/dist/Topbar-1zU6Ljsn.cjs +0 -1
- package/dist/UnsplashImages-zCQkmow-.cjs +0 -1
- package/dist/UploadImages-6K3GdM-b.cjs +0 -1
- package/dist/add-page-modal-8FJnOckX.cjs +0 -1
- package/dist/delete-page-modal-IRX0oKZJ.cjs +0 -1
- package/dist/page-viewer-fonOyiuT.cjs +0 -1
- package/dist/single-page-detail-LL8m0Va7.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ne=Object.defineProperty;var oe=(o,s,e)=>s in o?ne(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;var C=(o,s,e)=>(oe(o,typeof s!="symbol"?s+"":s,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),h=require("react"),a=require("lodash-es"),E=require("@radix-ui/react-icons"),i=require("./ChaiBuilderEditor-qxbkVVLu.cjs"),M=require("react-i18next"),b=require("jotai"),re=require("lucide-react"),F=require("react-dom"),k=require("prop-types"),ie=require("react-quill"),W=require("flagged"),le=require("@floating-ui/dom"),H=require("@floating-ui/react-dom"),ce=require("@react-hookz/web"),ae=require("@tailwindcss/typography"),de=require("@tailwindcss/forms"),ue=require("@tailwindcss/aspect-ratio"),pe=require("tailwindcss-palette-generator"),he=require("react-wrap-balancer"),xe=require("tailwind-merge"),_=require("./STRINGS-gPz7CUOk.cjs"),me=require("@chaibuilder/runtime"),ge=require("./useCanvasSettings-oERGzYXb.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("i18next");require("./Functions-N3yhPYKY.cjs");require("./MODIFIERS-YPHRtwrM.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-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-hotkeys-hook");const fe=()=>{const{hasUndo:o,hasRedo:s,undo:e,redo:t}=i.useUndoManager();return r.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[r.jsxRuntimeExports.jsx(i.Button,{disabled:!o(),size:"sm",onClick:e,className:"rounded-full",variant:"ghost",children:r.jsxRuntimeExports.jsx(E.ResetIcon,{})}),r.jsxRuntimeExports.jsx(i.Button,{disabled:!s(),onClick:t,size:"sm",className:"rounded-full",variant:"ghost",children:r.jsxRuntimeExports.jsx(E.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function ve(){const[o,s]=i.useDarkMode(),{t:e}=M.useTranslation();return r.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[r.jsxRuntimeExports.jsx(i.Label,{htmlFor:"dark-mode-switch",children:e("dark_mode")}),r.jsxRuntimeExports.jsxs(i.Switch,{id:"dark-mode-switch",checked:o,onCheckedChange:()=>{s(!o)},className:`${o?"bg-violet-600":"bg-violet-300"}
|
|
2
2
|
relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[r.jsxRuntimeExports.jsx("span",{className:"sr-only",children:e("use_setting")}),r.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${o?"translate-x-5":"translate-x-0"}
|
|
3
|
-
pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const O=({landscape:o=!1})=>r.jsxRuntimeExports.jsxs("svg",{className:o?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[r.jsxRuntimeExports.jsx("g",{strokeWidth:0}),r.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),r.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),
|
|
4
|
-
<html lang="en" class="scroll-smooth h-full overflow-y-auto">
|
|
3
|
+
pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const O=({landscape:o=!1})=>r.jsxRuntimeExports.jsxs("svg",{className:o?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[r.jsxRuntimeExports.jsx("g",{strokeWidth:0}),r.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),r.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),je=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:r.jsxRuntimeExports.jsx(E.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:r.jsxRuntimeExports.jsx(E.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:r.jsxRuntimeExports.jsx(O,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:r.jsxRuntimeExports.jsx(O,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:r.jsxRuntimeExports.jsx(E.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:r.jsxRuntimeExports.jsx(E.DesktopIcon,{}),width:1920}],U=({title:o,content:s,currentBreakpoint:e,breakpoint:t,width:n,icon:p,onClick:c})=>{const{t:l}=M.useTranslation();return r.jsxRuntimeExports.jsxs(i.HoverCard,{children:[r.jsxRuntimeExports.jsx(i.HoverCardTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsx(i.Button,{onClick:()=>c(n),size:"sm",variant:t===e?"secondary":"ghost",children:p})}),r.jsxRuntimeExports.jsx(i.HoverCardContent,{className:"w-52 border-border",children:r.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:r.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[r.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:l(o)}),r.jsxRuntimeExports.jsx("p",{className:"text-xs",children:l(s)})]})})})]})},$e=()=>{const[,o,s]=i.useCanvasWidth(),[e,t]=i.useSelectedBreakpoints(),{t:n}=M.useTranslation(),p=i.useBuilderProp("breakpoints",je),c=l=>{e.includes(l)?e.length>2&&t(e.filter(d=>d!==l)):t(d=>[...d,l])};return p.length<4?r.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:a.map(p,l=>h.createElement(U,{...l,onClick:s,key:l.breakpoint,currentBreakpoint:o}))}):r.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[a.map(p.filter(l=>a.includes(e,a.toUpper(l.breakpoint))),l=>h.createElement(U,{...l,onClick:s,key:l.breakpoint,currentBreakpoint:o})),r.jsxRuntimeExports.jsxs(i.DropdownMenu,{children:[r.jsxRuntimeExports.jsx(i.DropdownMenuTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:r.jsxRuntimeExports.jsx(E.DotsVerticalIcon,{className:"scale-90 transform"})})}),r.jsxRuntimeExports.jsxs(i.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[r.jsxRuntimeExports.jsx(i.DropdownMenuLabel,{children:n("Breakpoints")}),r.jsxRuntimeExports.jsx(i.DropdownMenuSeparator,{}),a.map(p,l=>r.jsxRuntimeExports.jsx(i.DropdownMenuCheckboxItem,{disabled:l.breakpoint==="xs",onCheckedChange:()=>c(a.toUpper(l.breakpoint)),checked:a.includes(e,a.toUpper(l.breakpoint)),children:n(l.title)},l.breakpoint))]})]})]})},ye=()=>{const{t:o}=M.useTranslation(),{setNewBlocks:s}=i.useBlocksStoreUndoableActions(),[,e]=i.useSelectedBlockIds(),[,t]=i.useSelectedStylingBlocks(),n=h.useCallback(()=>{s([]),e([]),t([])},[s]);return r.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:r.jsxRuntimeExports.jsxs(i.AlertDialog,{children:[r.jsxRuntimeExports.jsx(i.AlertDialogTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsxs(i.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[r.jsxRuntimeExports.jsx(E.EraserIcon,{})," ",o("clear")]})}),r.jsxRuntimeExports.jsxs(i.AlertDialogContent,{className:"border-border",children:[r.jsxRuntimeExports.jsxs(i.AlertDialogHeader,{children:[r.jsxRuntimeExports.jsx(i.AlertDialogTitle,{children:o("clear_canvas_title")}),r.jsxRuntimeExports.jsx(i.AlertDialogDescription,{children:o("clear_canvas_description")})]}),r.jsxRuntimeExports.jsxs(i.AlertDialogFooter,{children:[r.jsxRuntimeExports.jsx(i.AlertDialogCancel,{children:o("cancel")}),r.jsxRuntimeExports.jsx(i.AlertDialogAction,{onClick:n,children:o("yes")})]})]})]})})},be=()=>{const[o,s]=b.useAtom(i.aiAssistantActiveAtom);return i.useBuilderProp("askAiCallBack",null)?r.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxRuntimeExports.jsxs(i.Label,{htmlFor:"ai-assistant",className:"flex items-center gap-x-1 text-sm text-yellow-600",children:[r.jsxRuntimeExports.jsx(re.SparklesIcon,{className:"w-4"}),"AI Assistant"]}),r.jsxRuntimeExports.jsx(i.Switch,{className:"scale-90",checked:o,onCheckedChange:t=>{s(t)},id:"ai-assitantt"})]}):null},ke=()=>{const o=i.useBuilderProp("darkMode",!1),[s]=i.useCanvasZoom();return r.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[r.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[o?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(ve,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"})]}):null,r.jsxRuntimeExports.jsx($e,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsxs("div",{className:"flex w-12 cursor-not-allowed items-center justify-center gap-x-1 space-x-0 font-medium text-gray-400",children:[r.jsxRuntimeExports.jsx(E.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",r.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[a.round(s,0),"%"]})]}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(fe,{})]}),r.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[r.jsxRuntimeExports.jsx(ye,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(be,{})]})]})},Ee=`<!doctype html>
|
|
4
|
+
<html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
<div class="frame-root h-full"></div>
|
|
49
49
|
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
50
50
|
</body>
|
|
51
|
-
</html>`,Ee=o=>{const[s]=i.useCanvasWidth(),[,e]=i.useCanvasZoom(),[t,n]=h.useState({}),p=h.useCallback(()=>{const{width:c,height:l}=o;if(c<s){const d=parseFloat((c/s).toFixed(2).toString());let u={};const x=l*d;l&&(u={height:100+(l-x)/x*100+"%"}),n({position:"relative",top:0,transform:`scale(${d})`,transformOrigin:"top left",...u,maxWidth:"none"}),e(d*100)}else n({}),e(100)},[s,o,e]);return h.useEffect(()=>{p()},[s,o,e,p]),t};let K,Y;typeof document<"u"&&(K=document);typeof window<"u"&&(Y=window);const Z=h.createContext({document:K,window:Y}),M=()=>h.useContext(Z),{Provider:Re,Consumer:et}=Z;class Q extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}C(Q,"propTypes",{children:k.element.isRequired,contentDidMount:k.func.isRequired,contentDidUpdate:k.func.isRequired});class q extends h.Component{constructor(e,t){super(e,t);C(this,"setRef",e=>{this.nodeRef.current=e;const{forwardedRef:t}=this.props;typeof t=="function"?t(e):t&&(t.current=e)});C(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});C(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=h.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const e=this.getDoc();return this.props.mountTarget?e.querySelector(this.props.mountTarget):e.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const e=this.getDoc();if(!e)return null;const t=this.props.contentDidMount,n=this.props.contentDidUpdate,p=e.defaultView||e.parentView,c=r.jsxRuntimeExports.jsx(Q,{contentDidMount:t,contentDidUpdate:n,children:r.jsxRuntimeExports.jsx(Re,{value:{document:e,window:p},children:r.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),l=this.getMountTarget();return[F.createPortal(this.props.head,this.getDoc().head),F.createPortal(c,l)]}render(){const e={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete e.head,delete e.initialContent,delete e.mountTarget,delete e.contentDidMount,delete e.contentDidUpdate,delete e.forwardedRef,r.jsxRuntimeExports.jsx("iframe",{...e,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}C(q,"propTypes",{style:k.object,head:k.node,initialContent:k.string,mountTarget:k.string,contentDidMount:k.func,contentDidUpdate:k.func,children:k.oneOfType([k.element,k.arrayOf(k.element)])}),C(q,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const we=h.forwardRef((o,s)=>r.jsxRuntimeExports.jsx(q,{...o,forwardedRef:s})),Se=()=>{const{addCoreBlock:o}=i.useAddBlock(),s=i.useBuilderProp("getExternalPredefinedBlock",a.noop);return h.useCallback(async e=>{const{block:t,dropTargetId:n,relativeIndex:p}=e;if(a.has(t,"format")){const c=await s(t);return o({blocks:c},n===0?null:n,p)}return o(t,n===0?null:n,p)},[o])};let w=null,D=[],A=null,J=null;function Be(o){const s=window.getComputedStyle(o),e=parseInt(s.paddingLeft,10),t=parseInt(s.paddingTop,10),n=parseInt(s.paddingRight,10),p=parseInt(s.paddingBottom,10);return{paddingLeft:e,paddingTop:t,paddingRight:n,paddingBottom:p}}const z=(o,s,e)=>{if(!w)return;const t=o.getBoundingClientRect(),n=w==null?void 0:w.getElementById("placeholder"),{paddingLeft:p,paddingTop:c,paddingRight:l,paddingBottom:d}=Be(o);n.style.width=s==="vertical"?t.width-p-l+"px":"2px",n.style.height=s==="vertical"?"2px":t.height-c-d+"px",n.style.display="block";const u=D.reduce((x,f)=>Math.abs(f-e)<Math.abs(x-e)?f:x);J=D.indexOf(u),s==="vertical"?(n.style.top=o.offsetTop+u+"px",n.style.left=o.offsetLeft+p+"px"):(n.style.top=o.offsetTop+c+"px",n.style.left=o.offsetLeft+u+"px")},Ce=o=>{const s=G(o),e=window.getComputedStyle(o),t=s==="horizontal",n=parseInt(e.paddingLeft),p=parseInt(e.paddingTop);let c=t?n:p;D=[c],Array.from(o.children).forEach(l=>{const d=window.getComputedStyle(l),u=parseInt(t?d.marginLeft+d.marginRight:d.marginTop+d.marginBottom),x=t?l.offsetWidth:l.offsetHeight;D.push(c+x+u),c+=x+u})};function G(o){const s=window.getComputedStyle(o).display,e=window.getComputedStyle(o).flexDirection;if(s==="flex")return e==="column"||e==="column-reverse"?"vertical":"horizontal";if(s==="grid"){const t=window.getComputedStyle(o).gridTemplateRows,n=window.getComputedStyle(o).gridTemplateColumns;if(t.includes("auto"))return"vertical";if(n.includes("auto"))return"horizontal"}return s==="block"?"vertical":"horizontal"}const Ie=a.throttle(o=>{const s=o.target,e=G(s);if(e==="vertical"){const t=o.clientY-s.offsetTop;z(s,e,t)}else{const t=o.clientX-s.offsetLeft;z(s,e,t)}},200),Ae=o=>{o.preventDefault(),o.stopPropagation(),Ie(o)};function T(){const o=w==null?void 0:w.getElementById("placeholder");o.style.display="none"}const De=()=>{const{document:o}=M(),[s,e]=b.useAtom(i.draggingFlagAtom),t=Se(),n=W.useFeature("dnd"),[,p]=i.useHighlightBlockId(),[,c]=i.useSelectedBlockIds();return w=o,{isDragging:s,"data-dnd":"branch",onDragOver:n?Ae:a.noop,onDrop:n?l=>{A==null||A.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const d=JSON.parse(l.dataTransfer.getData("text/plain"));let u=l.target.getAttribute("data-block-id");u===null&&(u=l.target.parentElement.getAttribute("data-block-id")),t({block:d,dropTargetId:u||null,relativeIndex:J}),e(!1),T(),setTimeout(()=>{T()},300)}:a.noop,onDragEnter:n?l=>{const d=l;A=d.target,d.stopPropagation(),d.preventDefault(),D=[];const u=d.target;Ce(u),u.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),e(!0),p(""),c([])}:a.noop,onDragLeave:n?l=>{const d=l;A=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:a.noop,onMouseOut:n?()=>{e(!1),T()}:a.noop}};function P(o){return o.getAttribute("data-block-id")?o:o.closest("[data-block-id]")}function _e(o){o.container.innerHTML="",o.container.parentNode.removeChild(o.container);var s=document.querySelector(".ql-toolbar");s&&s.parentNode.removeChild(s),o=null}const Ne=()=>{const o=["Heading","Paragraph","Text","Link","Span","Button"],s=i.useUpdateBlocksProps(),[,e]=i.useHighlightBlockId(),[t,n]=b.useAtom(i.inlineEditingActiveAtom);return p=>{var f;if(t)return;const c=P(p.target),l=c.getAttribute("data-block-type");if(!l||!o.includes(l))return;const d=c.cloneNode(!0);c.style.display="none",Array.from(d.attributes).forEach(g=>{g.name!=="class"&&d.removeAttribute(g.name)}),l==="Text"&&(d.style.display="inline-block"),c.parentNode.insertBefore(d,c.nextSibling);const u=new re.Quill(d,{placeholder:"Type here..."});function x(){const g=u.getText(0,u.getLength());s([c.getAttribute("data-block-id")],{content:g}),c.removeAttribute("style"),d.removeEventListener("blur",x,!0),_e(u),n(""),e("")}d.addEventListener("blur",x,!0),d.addEventListener("keydown",g=>{(g.key==="Enter"||g.key==="Escape")&&x()}),u.focus(),(f=d.querySelector(".ql-clipboard"))==null||f.remove(),n(c.getAttribute("data-block-id"))}},Me=()=>{const[,o]=i.useSelectedStylingBlocks(),[,s]=i.useSelectedBlockIds(),[,e]=i.useHighlightBlockId(),[t]=b.useAtom(i.inlineEditingActiveAtom),[n]=b.useAtom(i.treeRefAtom);return p=>{if(t)return;n.closeAll(),p.stopPropagation();const c=P(p.target);if(c!=null&&c.getAttribute("data-block-id")&&(c==null?void 0:c.getAttribute("data-block-id"))==="container"){s([]),o([]),e("");return}if(c!=null&&c.getAttribute("data-block-parent")){const l=c.getAttribute("data-style-prop"),d=c.getAttribute("data-style-id"),u=c.getAttribute("data-block-parent");o([{id:d,prop:l,blockId:u}]),s([u])}else c!=null&&c.getAttribute("data-block-id")&&s([c.getAttribute("data-block-id")]);e("")}},Te=a.throttle((o,s)=>{const e=P(o.target);e!=null&&e.getAttribute("data-style-id")&&s(e.getAttribute("data-style-id"))},100),qe=()=>{const[,o]=i.useHighlightBlockId(),[s]=b.useAtom(i.inlineEditingActiveAtom);return e=>{s||Te(e,o)}},Le=({children:o})=>{const{document:s}=M(),[e]=i.useSelectedBlockIds(),[t,n]=i.useSelectedStylingBlocks();h.useEffect(()=>{setTimeout(()=>{if(!a.isEmpty(t))return;const u=X(s,a.first(e));if(u){const x=u.getAttribute("data-style-prop");if(x){const f=u.getAttribute("data-style-id"),g=u.getAttribute("data-block-parent");n([{id:f,prop:x,blockId:g}])}}},100)},[s,e,n,t]);const p=Ne(),c=Me(),l=qe(),d=De();return r.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:c,onDoubleClick:p,onMouseMove:l,...a.omit(d,"isDragging"),className:"relative mb-5 h-full max-w-full "+(d.isDragging?"dragging":""),children:o})},X=(o,s)=>o.querySelector(`[data-block-id="${s}"]`),Pe=()=>{const{window:o}=M(),[s,e]=i.useSelectedBlockIds(),[t]=i.useBlocksStore(),[,n]=i.useSelectedStylingBlocks(),{undo:p,redo:c}=i.useUndoManager(),l=i.useDuplicateBlocks(),[,d]=i.usePreviewMode(),u=i.useRemoveBlocks(),{savePage:x}=i.useSavePage(),[f]=b.useAtom(i.inlineEditingActiveAtom),[,g]=b.useAtom(i.editLayerNameAtom),$=v=>{v.key==="Enter"&&(v.preventDefault(),s.length===1&&g(a.first(s)))},R=v=>{const m=t.find(y=>y._id===v);return m?m._parent:null};return h.useEffect(()=>{const v=m=>{if(m.key==="Escape"){e([]),n([]);return}if($(m),!f&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),u(s)),m.ctrlKey||m.metaKey){if(m.key==="ArrowUp"){m.preventDefault();const y=s.length>0?R(s[0]):null;y&&e([y])}if(["z","y","d","x","c","p","s","v"].includes(m.key)){if(f&&["x","z","v"].includes(m.key))return!0;m.preventDefault()}m.key==="s"&&(m.stopPropagation(),m.preventDefault(),x()),m.key==="z"&&p(),m.key==="y"&&c(),m.key==="d"&&l(s)}};return o.removeEventListener("keydown",v),o.addEventListener("keydown",v),()=>{o.removeEventListener("keydown",v)}},[s,e,p,u,d,c,l,f,x,o]),null},Fe=({block:o,label:s})=>{const[,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[,n]=b.useAtom(i.draggedBlockIdAtom),p=W.useFeature("dnd");return r.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:p?"true":"false",onDragStart:c=>{c.dataTransfer.setData("text/plain",JSON.stringify(a.pick(o,["_id","_type"]))),n(o._id),setTimeout(()=>{e([]),t(null)},200)},children:[r.jsxRuntimeExports.jsx(E.DragHandleDots2Icon,{}),s]})},He=({selectedBlockElement:o,block:s})=>{const e=i.useRemoveBlocks(),t=i.useDuplicateBlocks(),[,n]=i.useSelectedBlockIds(),[,p]=i.useSelectedStylingBlocks(),[c]=b.useAtom(i.inlineEditingActiveAtom),{floatingStyles:l,refs:d,update:u}=H.useFloating({placement:"top-start",middleware:[H.shift(),ie.flip()],elements:{reference:o}});le.useResizeObserver(o,()=>u(),o!==null);const x=a.get(s,"_parent",null),f=a.isEmpty(a.get(s,"_name",""))?a.get(s,"_type",""):a.get(s,"_name","");return!o||!s||c?null:r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:r.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:d.setFloating,style:l,onClick:g=>{g.stopPropagation(),g.preventDefault()},onKeyDown:g=>g.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[r.jsxRuntimeExports.jsx(Fe,{label:f,block:s}),r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[x&&r.jsxRuntimeExports.jsx(E.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{p([]),n([x])}}),i.canDuplicateBlock(a.get(s,"_type",""))?r.jsxRuntimeExports.jsx(E.CopyIcon,{className:"hover:scale-105",onClick:()=>t([s==null?void 0:s._id])}):null,i.canDeleteBlock(a.get(s,"_type",""))?r.jsxRuntimeExports.jsx(E.TrashIcon,{className:"hover:scale-105",onClick:()=>e([s==null?void 0:s._id])}):null]})]})})},Oe=({addVariant:o,e:s})=>{o("hs-dropdown-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open > .${s(`hs-dropdown-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open .hs-dropdown-toggle .${s(`hs-dropdown-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open > .hs-dropdown-menu > .${s(`hs-dropdown-open${t}${n}`)}`)}]),o("hs-removing",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-removing.${s(`hs-removing${t}${n}`)}`)}),o("hs-tooltip-shown",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-tooltip.show .${s(`hs-tooltip-shown${t}${n}`)}`)}),o("hs-accordion-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active.${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-toggle .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-toggle.${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${s(`hs-accordion-active${t}${n}`)}`)}]),o("hs-accordion-selected",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion .selected.${s(`hs-accordion-selected${t}${n}`)}`)}),o("hs-collapse-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse.open .${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse.open.${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse-toggle.open .${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse-toggle.open.${s(`hs-collapse-open${t}${n}`)}`)}]),o("hs-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`[data-hs-tab].active.${s(`hs-tab-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`[data-hs-tab].active .${s(`hs-tab-active${t}${n}`)}`)}]),o("hs-overlay-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.open.${s(`hs-overlay-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.open .${s(`hs-overlay-open${t}${n}`)}`)}]),o("hs-overlay-layout-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-body-open.${s(`hs-overlay-layout-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-body-open .${s(`hs-overlay-layout-open${t}${n}`)}`)}]),o("hs-overlay-backdrop-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-backdrop.${s(`hs-overlay-backdrop-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-backdrop .${s(`hs-overlay-backdrop-open${t}${n}`)}`)}]),o("hs-scrollspy-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-scrollspy-active${t}${n}`)}`)}),o("hs-carousel-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-carousel-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-carousel-active${t}${n}`)}`)}]),o("hs-carousel-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-carousel${t}disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-carousel${t}disabled${t}${n}`)}`)}]),o("hs-selected",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected.${s(`hs-selected${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected .${s(`hs-selected${t}${n}`)}`)}]),o("hs-select-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-select-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-select-disabled${t}${n}`)}`)}]),o("hs-select-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-select-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-select-active${t}${n}`)}`)}]),o("hs-input-number-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-input-number-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-input-number-disabled${t}${n}`)}`)}]),o("hs-pin-input-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-pin-input-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-pin-input-active${t}${n}`)}`)}]),o("hs-select-opened",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.opened.${s(`hs-select-opened${t}${n}`)}`)}]),o("hs-password-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-password-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-password-active${t}${n}`)}`)}]),o("hs-stepper-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-stepper-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-stepper-active${t}${n}`)}`)}]),o("hs-stepper-success",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success.${s(`hs-stepper-success${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success .${s(`hs-stepper-success${t}${n}`)}`)}]),o("hs-stepper-completed",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.completed.${s(`hs-stepper-completed${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.completed .${s(`hs-stepper-completed${t}${n}`)}`)}]),o("hs-stepper-error",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error.${s(`hs-stepper-error${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error .${s(`hs-stepper-error${t}${n}`)}`)}]),o("hs-stepper-processed",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.processed.${s(`hs-stepper-processed${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.processed .${s(`hs-stepper-processed${t}${n}`)}`)}]),o("hs-stepper-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-stepper-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-stepper-disabled${t}${n}`)}`)}]),o("hs-stepper-skipped",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.skipped.${s(`hs-stepper-skipped${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.skipped .${s(`hs-stepper-skipped${t}${n}`)}`)}]),o("hs-strong-password",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.passed.${s(`hs-strong-password${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.passed .${s(`hs-strong-password${t}${n}`)}`)}]),o("hs-strong-password-accepted",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.accepted.${s(`hs-strong-password-accepted${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.accepted .${s(`hs-strong-password-accepted${t}${n}`)}`)}]),o("hs-strong-password-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-strong-password-active${t}${n}`)}`)}]),o("hs-combo-box-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-combo-box-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-combo-box-active${t}${n}`)}`)}]),o("hs-combo-box-selected",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected .${s(`hs-combo-box-selected${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected.${s(`hs-combo-box-selected${t}${n}`)}`)}]),o("hs-combo-box-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-combo-box-tab-active${t}${n}`)}`)}]),o("hs-apexcharts-tooltip-dark",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.dark.${s(`hs-apexcharts-tooltip-dark${t}${n}`)}`)}]),o("hs-success",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success .${s(`hs-success${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success.${s(`hs-success${t}${n}`)}`)}]),o("hs-error",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error .${s(`hs-error${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error.${s(`hs-error${t}${n}`)}`)}]),o("hs-default-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.default .${s(`hs-default-mode-active${t}${n}`)}`)}),o("hs-dark-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.dark .${s(`hs-dark-mode-active${t}${n}`)}`)}),o("hs-auto-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.auto .${s(`hs-auto-mode-active${t}${n}`)}`)})},Ue=({model:o})=>{const[s]=i.useBrandingOptions(),[e]=i.useSelectedBlockIds(),[t]=i.useDarkMode(),[n]=i.useHighlightBlockId(),[p]=i.useSelectedStylingBlocks(),[c]=b.useAtom(i.draggedBlockIdAtom),{document:l,window:d}=M(),[u]=h.useState(l==null?void 0:l.getElementById("highlighted-block")),[x]=h.useState(l==null?void 0:l.getElementById("selected-block")),[f]=h.useState(l==null?void 0:l.getElementById("selected-styling-block")),[g]=h.useState(l==null?void 0:l.getElementById("dragged-block"));h.useEffect(()=>{t?l==null||l.documentElement.classList.add("dark"):l==null||l.documentElement.classList.remove("dark")},[t,l]);const $=a.get(s,"headingFont","DM Sans"),R=a.get(s,"bodyFont","DM Sans");return h.useEffect(()=>{const v=a.get(s,"primaryColor","#000"),m=a.get(s,"secondaryColor","#FFF"),y=ue([{color:v,name:"primary"},{color:m,name:"secondary"}]),I=a.get(s,"roundedCorners","0");!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{extend:{fontFamily:{heading:[$],body:[R]},borderRadius:{global:`${I||"0"}px`},colors:y}},plugins:[ce,ae,de,d.tailwind.plugin.withOptions(()=>Oe)]})},[s,d,$,R]),h.useEffect(()=>{x&&(x.textContent=`${a.map(e,v=>`[data-block-id="${v}"]`).join(",")}{
|
|
51
|
+
</html>`,Re=o=>{const[s]=i.useCanvasWidth(),[,e]=i.useCanvasZoom(),[t,n]=h.useState({}),p=h.useCallback(()=>{const{width:c,height:l}=o;if(c<s){const d=parseFloat((c/s).toFixed(2).toString());let u={};const x=l*d;l&&(u={height:100+(l-x)/x*100+"%"}),n({position:"relative",top:0,transform:`scale(${d})`,transformOrigin:"top left",...u,maxWidth:"none"}),e(d*100)}else n({}),e(100)},[s,o,e]);return h.useEffect(()=>{p()},[s,o,e,p]),t};let K,Y;typeof document<"u"&&(K=document);typeof window<"u"&&(Y=window);const Z=h.createContext({document:K,window:Y}),N=()=>h.useContext(Z),{Provider:we,Consumer:tt}=Z;class Q extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}C(Q,"propTypes",{children:k.element.isRequired,contentDidMount:k.func.isRequired,contentDidUpdate:k.func.isRequired});class q extends h.Component{constructor(e,t){super(e,t);C(this,"setRef",e=>{this.nodeRef.current=e;const{forwardedRef:t}=this.props;typeof t=="function"?t(e):t&&(t.current=e)});C(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});C(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=h.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const e=this.getDoc();return this.props.mountTarget?e.querySelector(this.props.mountTarget):e.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const e=this.getDoc();if(!e)return null;const t=this.props.contentDidMount,n=this.props.contentDidUpdate,p=e.defaultView||e.parentView,c=r.jsxRuntimeExports.jsx(Q,{contentDidMount:t,contentDidUpdate:n,children:r.jsxRuntimeExports.jsx(we,{value:{document:e,window:p},children:r.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),l=this.getMountTarget();return[F.createPortal(this.props.head,this.getDoc().head),F.createPortal(c,l)]}render(){const e={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete e.head,delete e.initialContent,delete e.mountTarget,delete e.contentDidMount,delete e.contentDidUpdate,delete e.forwardedRef,r.jsxRuntimeExports.jsx("iframe",{...e,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}C(q,"propTypes",{style:k.object,head:k.node,initialContent:k.string,mountTarget:k.string,contentDidMount:k.func,contentDidUpdate:k.func,children:k.oneOfType([k.element,k.arrayOf(k.element)])}),C(q,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const Se=h.forwardRef((o,s)=>r.jsxRuntimeExports.jsx(q,{...o,forwardedRef:s})),Be=()=>{const{addCoreBlock:o}=i.useAddBlock(),s=i.useBuilderProp("getExternalPredefinedBlock",a.noop);return h.useCallback(async e=>{const{block:t,dropTargetId:n,relativeIndex:p}=e;if(a.has(t,"format")){const c=await s(t);return o({blocks:c},n===0?null:n,p)}return o(t,n===0?null:n,p)},[o])};let w=null,D=[],A=null,J=null;function Ce(o){const s=window.getComputedStyle(o),e=parseInt(s.paddingLeft,10),t=parseInt(s.paddingTop,10),n=parseInt(s.paddingRight,10),p=parseInt(s.paddingBottom,10);return{paddingLeft:e,paddingTop:t,paddingRight:n,paddingBottom:p}}const z=(o,s,e)=>{if(!w)return;const t=o.getBoundingClientRect(),n=w==null?void 0:w.getElementById("placeholder"),{paddingLeft:p,paddingTop:c,paddingRight:l,paddingBottom:d}=Ce(o);n.style.width=s==="vertical"?t.width-p-l+"px":"2px",n.style.height=s==="vertical"?"2px":t.height-c-d+"px",n.style.display="block";const u=D.reduce((x,f)=>Math.abs(f-e)<Math.abs(x-e)?f:x);J=D.indexOf(u),s==="vertical"?(n.style.top=o.offsetTop+u+"px",n.style.left=o.offsetLeft+p+"px"):(n.style.top=o.offsetTop+c+"px",n.style.left=o.offsetLeft+u+"px")},Ie=o=>{const s=G(o),e=window.getComputedStyle(o),t=s==="horizontal",n=parseInt(e.paddingLeft),p=parseInt(e.paddingTop);let c=t?n:p;D=[c],Array.from(o.children).forEach(l=>{const d=window.getComputedStyle(l),u=parseInt(t?d.marginLeft+d.marginRight:d.marginTop+d.marginBottom),x=t?l.offsetWidth:l.offsetHeight;D.push(c+x+u),c+=x+u})};function G(o){const s=window.getComputedStyle(o).display,e=window.getComputedStyle(o).flexDirection;if(s==="flex")return e==="column"||e==="column-reverse"?"vertical":"horizontal";if(s==="grid"){const t=window.getComputedStyle(o).gridTemplateRows,n=window.getComputedStyle(o).gridTemplateColumns;if(t.includes("auto"))return"vertical";if(n.includes("auto"))return"horizontal"}return s==="block"?"vertical":"horizontal"}const Ae=a.throttle(o=>{const s=o.target,e=G(s);if(e==="vertical"){const t=o.clientY-s.offsetTop;z(s,e,t)}else{const t=o.clientX-s.offsetLeft;z(s,e,t)}},200),De=o=>{o.preventDefault(),o.stopPropagation(),Ae(o)};function T(){const o=w==null?void 0:w.getElementById("placeholder");o.style.display="none"}const _e=()=>{const{document:o}=N(),[s,e]=b.useAtom(i.draggingFlagAtom),t=Be(),n=W.useFeature("dnd"),[,p]=i.useHighlightBlockId(),[,c]=i.useSelectedBlockIds();return w=o,{isDragging:s,"data-dnd":"branch",onDragOver:n?De:a.noop,onDrop:n?l=>{A==null||A.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const d=JSON.parse(l.dataTransfer.getData("text/plain"));let u=l.target.getAttribute("data-block-id");u===null&&(u=l.target.parentElement.getAttribute("data-block-id")),t({block:d,dropTargetId:u||null,relativeIndex:J}),e(!1),T(),setTimeout(()=>{T()},300)}:a.noop,onDragEnter:n?l=>{const d=l;A=d.target,d.stopPropagation(),d.preventDefault(),D=[];const u=d.target;Ie(u),u.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),e(!0),p(""),c([])}:a.noop,onDragLeave:n?l=>{const d=l;A=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:a.noop,onMouseOut:n?()=>{e(!1),T()}:a.noop}};function P(o){return o.getAttribute("data-block-id")?o:o.closest("[data-block-id]")}function Me(o){o.container.innerHTML="",o.container.parentNode.removeChild(o.container);var s=document.querySelector(".ql-toolbar");s&&s.parentNode.removeChild(s),o=null}const Ne=()=>{const o=["Heading","Paragraph","Text","Link","Span","Button"],s=i.useUpdateBlocksProps(),[,e]=i.useHighlightBlockId(),[t,n]=b.useAtom(i.inlineEditingActiveAtom);return p=>{var f;if(t)return;const c=P(p.target),l=c.getAttribute("data-block-type");if(!l||!o.includes(l))return;const d=c.cloneNode(!0);c.style.display="none",Array.from(d.attributes).forEach(g=>{g.name!=="class"&&d.removeAttribute(g.name)}),l==="Text"&&(d.style.display="inline-block"),c.parentNode.insertBefore(d,c.nextSibling);const u=new ie.Quill(d,{placeholder:"Type here..."});function x(){const g=u.getText(0,u.getLength());s([c.getAttribute("data-block-id")],{content:g}),c.removeAttribute("style"),d.removeEventListener("blur",x,!0),Me(u),n(""),e("")}d.addEventListener("blur",x,!0),d.addEventListener("keydown",g=>{(g.key==="Enter"||g.key==="Escape")&&x()}),u.focus(),(f=d.querySelector(".ql-clipboard"))==null||f.remove(),n(c.getAttribute("data-block-id"))}},Te=()=>{const[,o]=i.useSelectedStylingBlocks(),[,s]=i.useSelectedBlockIds(),[,e]=i.useHighlightBlockId(),[t]=b.useAtom(i.inlineEditingActiveAtom),[n]=b.useAtom(i.treeRefAtom);return p=>{if(t)return;n.closeAll(),p.stopPropagation();const c=P(p.target);if(c!=null&&c.getAttribute("data-block-id")&&(c==null?void 0:c.getAttribute("data-block-id"))==="container"){s([]),o([]),e("");return}if(c!=null&&c.getAttribute("data-block-parent")){const l=c.getAttribute("data-style-prop"),d=c.getAttribute("data-style-id"),u=c.getAttribute("data-block-parent");o([{id:d,prop:l,blockId:u}]),s([u])}else c!=null&&c.getAttribute("data-block-id")&&s([c.getAttribute("data-block-id")]);e("")}},qe=a.throttle((o,s)=>{const e=P(o.target);e!=null&&e.getAttribute("data-style-id")&&s(e.getAttribute("data-style-id"))},100),Le=()=>{const[,o]=i.useHighlightBlockId(),[s]=b.useAtom(i.inlineEditingActiveAtom);return e=>{s||qe(e,o)}},Pe=({children:o})=>{const{document:s}=N(),[e]=i.useSelectedBlockIds(),[t,n]=i.useSelectedStylingBlocks();h.useEffect(()=>{setTimeout(()=>{if(!a.isEmpty(t))return;const u=X(s,a.first(e));if(u){const x=u.getAttribute("data-style-prop");if(x){const f=u.getAttribute("data-style-id"),g=u.getAttribute("data-block-parent");n([{id:f,prop:x,blockId:g}])}}},100)},[s,e,n,t]);const p=Ne(),c=Te(),l=Le(),d=_e();return r.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:c,onDoubleClick:p,onMouseMove:l,...a.omit(d,"isDragging"),className:"relative mb-5 h-full max-w-full "+(d.isDragging?"dragging":""),children:o})},X=(o,s)=>o.querySelector(`[data-block-id="${s}"]`),Fe=()=>{const{window:o}=N(),[s,e]=i.useSelectedBlockIds(),[t]=i.useBlocksStore(),[,n]=i.useSelectedStylingBlocks(),{undo:p,redo:c}=i.useUndoManager(),l=i.useDuplicateBlocks(),[,d]=i.usePreviewMode(),u=i.useRemoveBlocks(),{savePage:x}=i.useSavePage(),[f]=b.useAtom(i.inlineEditingActiveAtom),[,g]=b.useAtom(i.editLayerNameAtom),$=v=>{v.key==="Enter"&&(v.preventDefault(),s.length===1&&g(a.first(s)))},R=v=>{const m=t.find(y=>y._id===v);return m?m._parent:null};return h.useEffect(()=>{const v=m=>{if(m.key==="Escape"){e([]),n([]);return}if($(m),!f&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),u(s)),m.ctrlKey||m.metaKey){if(m.key==="ArrowUp"){m.preventDefault();const y=s.length>0?R(s[0]):null;y&&e([y])}if(["z","y","d","x","c","p","s","v"].includes(m.key)){if(f&&["x","z","v"].includes(m.key))return!0;m.preventDefault()}m.key==="s"&&(m.stopPropagation(),m.preventDefault(),x()),m.key==="z"&&p(),m.key==="y"&&c(),m.key==="d"&&l(s)}};return o.removeEventListener("keydown",v),o.addEventListener("keydown",v),()=>{o.removeEventListener("keydown",v)}},[s,e,p,u,d,c,l,f,x,o]),null},He=({block:o,label:s})=>{const[,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[,n]=b.useAtom(i.draggedBlockIdAtom),p=W.useFeature("dnd");return r.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:p?"true":"false",onDragStart:c=>{c.dataTransfer.setData("text/plain",JSON.stringify(a.pick(o,["_id","_type"]))),n(o._id),setTimeout(()=>{e([]),t(null)},200)},children:[r.jsxRuntimeExports.jsx(E.DragHandleDots2Icon,{}),s]})},Oe=({selectedBlockElement:o,block:s})=>{const e=i.useRemoveBlocks(),t=i.useDuplicateBlocks(),[,n]=i.useSelectedBlockIds(),[,p]=i.useSelectedStylingBlocks(),[c]=b.useAtom(i.inlineEditingActiveAtom),{floatingStyles:l,refs:d,update:u}=H.useFloating({placement:"top-start",middleware:[H.shift(),le.flip()],elements:{reference:o}});ce.useResizeObserver(o,()=>u(),o!==null);const x=a.get(s,"_parent",null),f=a.isEmpty(a.get(s,"_name",""))?a.get(s,"_type",""):a.get(s,"_name","");return!o||!s||c?null:r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:r.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:d.setFloating,style:l,onClick:g=>{g.stopPropagation(),g.preventDefault()},onKeyDown:g=>g.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[r.jsxRuntimeExports.jsx(He,{label:f,block:s}),r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[x&&r.jsxRuntimeExports.jsx(E.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{p([]),n([x])}}),i.canDuplicateBlock(a.get(s,"_type",""))?r.jsxRuntimeExports.jsx(E.CopyIcon,{className:"hover:scale-105",onClick:()=>t([s==null?void 0:s._id])}):null,i.canDeleteBlock(a.get(s,"_type",""))?r.jsxRuntimeExports.jsx(E.TrashIcon,{className:"hover:scale-105",onClick:()=>e([s==null?void 0:s._id])}):null]})]})})},Ue=({addVariant:o,e:s})=>{o("hs-dropdown-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open > .${s(`hs-dropdown-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open .hs-dropdown-toggle .${s(`hs-dropdown-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open > .hs-dropdown-menu > .${s(`hs-dropdown-open${t}${n}`)}`)}]),o("hs-removing",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-removing.${s(`hs-removing${t}${n}`)}`)}),o("hs-tooltip-shown",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-tooltip.show .${s(`hs-tooltip-shown${t}${n}`)}`)}),o("hs-accordion-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active.${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-toggle .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-toggle.${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${s(`hs-accordion-active${t}${n}`)}`)}]),o("hs-accordion-selected",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion .selected.${s(`hs-accordion-selected${t}${n}`)}`)}),o("hs-collapse-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse.open .${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse.open.${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse-toggle.open .${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse-toggle.open.${s(`hs-collapse-open${t}${n}`)}`)}]),o("hs-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`[data-hs-tab].active.${s(`hs-tab-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`[data-hs-tab].active .${s(`hs-tab-active${t}${n}`)}`)}]),o("hs-overlay-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.open.${s(`hs-overlay-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.open .${s(`hs-overlay-open${t}${n}`)}`)}]),o("hs-overlay-layout-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-body-open.${s(`hs-overlay-layout-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-body-open .${s(`hs-overlay-layout-open${t}${n}`)}`)}]),o("hs-overlay-backdrop-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-backdrop.${s(`hs-overlay-backdrop-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-backdrop .${s(`hs-overlay-backdrop-open${t}${n}`)}`)}]),o("hs-scrollspy-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-scrollspy-active${t}${n}`)}`)}),o("hs-carousel-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-carousel-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-carousel-active${t}${n}`)}`)}]),o("hs-carousel-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-carousel${t}disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-carousel${t}disabled${t}${n}`)}`)}]),o("hs-selected",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected.${s(`hs-selected${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected .${s(`hs-selected${t}${n}`)}`)}]),o("hs-select-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-select-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-select-disabled${t}${n}`)}`)}]),o("hs-select-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-select-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-select-active${t}${n}`)}`)}]),o("hs-input-number-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-input-number-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-input-number-disabled${t}${n}`)}`)}]),o("hs-pin-input-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-pin-input-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-pin-input-active${t}${n}`)}`)}]),o("hs-select-opened",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.opened.${s(`hs-select-opened${t}${n}`)}`)}]),o("hs-password-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-password-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-password-active${t}${n}`)}`)}]),o("hs-stepper-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-stepper-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-stepper-active${t}${n}`)}`)}]),o("hs-stepper-success",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success.${s(`hs-stepper-success${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success .${s(`hs-stepper-success${t}${n}`)}`)}]),o("hs-stepper-completed",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.completed.${s(`hs-stepper-completed${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.completed .${s(`hs-stepper-completed${t}${n}`)}`)}]),o("hs-stepper-error",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error.${s(`hs-stepper-error${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error .${s(`hs-stepper-error${t}${n}`)}`)}]),o("hs-stepper-processed",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.processed.${s(`hs-stepper-processed${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.processed .${s(`hs-stepper-processed${t}${n}`)}`)}]),o("hs-stepper-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-stepper-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-stepper-disabled${t}${n}`)}`)}]),o("hs-stepper-skipped",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.skipped.${s(`hs-stepper-skipped${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.skipped .${s(`hs-stepper-skipped${t}${n}`)}`)}]),o("hs-strong-password",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.passed.${s(`hs-strong-password${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.passed .${s(`hs-strong-password${t}${n}`)}`)}]),o("hs-strong-password-accepted",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.accepted.${s(`hs-strong-password-accepted${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.accepted .${s(`hs-strong-password-accepted${t}${n}`)}`)}]),o("hs-strong-password-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-strong-password-active${t}${n}`)}`)}]),o("hs-combo-box-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-combo-box-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-combo-box-active${t}${n}`)}`)}]),o("hs-combo-box-selected",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected .${s(`hs-combo-box-selected${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected.${s(`hs-combo-box-selected${t}${n}`)}`)}]),o("hs-combo-box-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-combo-box-tab-active${t}${n}`)}`)}]),o("hs-apexcharts-tooltip-dark",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.dark.${s(`hs-apexcharts-tooltip-dark${t}${n}`)}`)}]),o("hs-success",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success .${s(`hs-success${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success.${s(`hs-success${t}${n}`)}`)}]),o("hs-error",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error .${s(`hs-error${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error.${s(`hs-error${t}${n}`)}`)}]),o("hs-default-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.default .${s(`hs-default-mode-active${t}${n}`)}`)}),o("hs-dark-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.dark .${s(`hs-dark-mode-active${t}${n}`)}`)}),o("hs-auto-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.auto .${s(`hs-auto-mode-active${t}${n}`)}`)})},ze=({model:o})=>{const[s]=i.useBrandingOptions(),[e]=i.useSelectedBlockIds(),[t]=i.useDarkMode(),[n]=i.useHighlightBlockId(),[p]=i.useSelectedStylingBlocks(),[c]=b.useAtom(i.draggedBlockIdAtom),{document:l,window:d}=N(),[u]=h.useState(l==null?void 0:l.getElementById("highlighted-block")),[x]=h.useState(l==null?void 0:l.getElementById("selected-block")),[f]=h.useState(l==null?void 0:l.getElementById("selected-styling-block")),[g]=h.useState(l==null?void 0:l.getElementById("dragged-block"));h.useEffect(()=>{t?l==null||l.documentElement.classList.add("dark"):l==null||l.documentElement.classList.remove("dark")},[t,l]);const $=a.get(s,"headingFont","DM Sans"),R=a.get(s,"bodyFont","DM Sans");return h.useEffect(()=>{const v=a.get(s,"primaryColor","#000"),m=a.get(s,"secondaryColor","#FFF"),y=pe([{color:v,name:"primary"},{color:m,name:"secondary"}]),I=a.get(s,"roundedCorners","0");!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{extend:{fontFamily:{heading:[$],body:[R]},borderRadius:{global:`${I||"0"}px`},colors:y}},plugins:[ae,de,ue,d.tailwind.plugin.withOptions(()=>Ue)]})},[s,d,$,R]),h.useEffect(()=>{x&&(x.textContent=`${a.map(e,v=>`[data-block-id="${v}"]`).join(",")}{
|
|
52
52
|
outline: 1px solid ${e.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
53
53
|
}`)},[e,x]),h.useEffect(()=>{if(!c){g.textContent="";return}g.textContent=`[data-block-id="${c}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[c]),h.useEffect(()=>{u&&(u.textContent=n?`[data-style-id="${n}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[n,e,u]),h.useEffect(()=>{f&&(f.textContent=`${a.map(p,({id:v})=>`[data-style-id="${v}"]`).join(",")}{
|
|
54
54
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
55
|
-
}`)},[p,f]),h.useEffect(()=>{const v=a.get(s,"bodyTextLightColor","#64748b"),m=a.get(s,"bodyTextDarkColor","#94a3b8"),y=a.get(s,"bodyBgLightColor","#FFFFFF"),I=a.get(s,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${v}] bg-[${y}] dark:text-[${m}] dark:bg-[${I}]`},[s,l,o]),o==="page"?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[$&&r.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${$.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),R&&$!==R&&r.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${R.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),$&&r.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${$}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},
|
|
55
|
+
}`)},[p,f]),h.useEffect(()=>{const v=a.get(s,"bodyTextLightColor","#64748b"),m=a.get(s,"bodyTextDarkColor","#94a3b8"),y=a.get(s,"bodyBgLightColor","#FFFFFF"),I=a.get(s,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${v}] bg-[${y}] dark:text-[${m}] dark:bg-[${I}]`},[s,l,o]),o==="page"?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[$&&r.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${$.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),R&&$!==R&&r.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${R.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),$&&r.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${$}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},We=o=>{const s={};return Object.keys(o).forEach(e=>{a.isString(o[e])&&o[e].startsWith(_.SLOT_KEY)&&(s[e]=o[e].replace(_.SLOT_KEY,"").split(","))}),s},Ke=a.memoize(o=>{const s=o.replace(_.STYLES_KEY,"").split(",");return xe.twMerge(s[0],s[1])});function Ye(o,s){return a.get(o,`${s}_attrs`,{})}function Ze(o){const s={};return Object.keys(o).forEach(e=>{if(a.isString(o[e])&&o[e].startsWith(_.STYLES_KEY)){const t=Ke(o[e]);s[e]={className:t,"data-style-prop":e,"data-block-parent":o._id,"data-style-id":`${e}-${o._id}`,...Ye(o,e)}}}),s}function Qe(o,s){const e=a.get(o,"_bindings",{});return a.isEmpty(e)?{...o}:(a.each(e,(t,n)=>{a.isString(t)&&a.get(s,t,null)&&(o[n]=a.get(s,t,null))}),o)}function L({blocks:o}){const[s]=i.useBlocksStore(),[e]=ge.useCanvasSettings(),t=h.useCallback(l=>Ze(l),[]),[n]=i.useChaiExternalData(),[p]=b.useAtom(i.inlineEditingActiveAtom),c=h.useCallback(l=>l.reduce((d,u)=>{const x=a.get(e,u,{});return{...d,...x}},{}),[e,s]);return r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:h.Children.toArray(o.map((l,d)=>{if(p===l._id)return null;const u=We(l),x={};a.isEmpty(u)||Object.keys(u).forEach(m=>{x[m]=h.Children.toArray(u[m].map(y=>r.jsxRuntimeExports.jsx(L,{blocks:[a.find(s,{_id:y})]})))});const f=a.filter(s,{_parent:l._id});x.children=f.length?r.jsxRuntimeExports.jsx(L,{blocks:f}):null;const g=me.getBlockComponent(l._type),$=a.get(g,"builderComponent",a.get(g,"component",null));if(a.isNull($))return r.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${l==null?void 0:l._type} not registered -->`});const R=a.has(g,"getBlockStateFrom")?g==null?void 0:g.getBlockStateFrom(l,s):[],v=c(R);return r.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement($,{blockProps:{"data-block-id":l._id,"data-block-type":l._type,"data-dnd":a.has(g,"canAcceptBlock")?"branch":"leaf"},index:d,...Qe(l,n),...t(l),...x,inBuilder:!0,blockState:v})})}))})}const Je=()=>{const[o]=i.useBlocksStore(),s=a.isEmpty(o)?null:r.jsxRuntimeExports.jsx(i.BlocksExternalDataProvider,{children:r.jsxRuntimeExports.jsx(L,{blocks:a.filter(o,e=>a.isEmpty(e._parent))})});return r.jsxRuntimeExports.jsx(he.Provider,{children:s})},Ge=(o,s)=>o.querySelector(`[data-style-id="${s}"]`),Xe=()=>{const[o]=b.useAtom(i.networkModeAtom),[s]=i.usePreviewMode(),[e]=i.useCanvasWidth(),[,t]=i.useSelectedBlockIds(),n=i.useSelectedBlock(),[,p]=i.useHighlightBlockId(),c=h.useRef(null),l=h.useRef(null),[d,u]=h.useState({width:0,height:0}),x=Re(d),[f,g]=h.useState(0),[$,R]=h.useState([]),[,v]=h.useState([]),[,m]=b.useAtom(i.canvasIframeAtom),[y,I]=i.useSelectedStylingBlocks(),V=i.useBuilderProp("loading",!1),ee=i.useBuilderProp("htmlDir","ltr");h.useEffect(()=>{const{clientWidth:j,clientHeight:S}=l.current;u({width:j,height:S}),f===0&&g(j)},[l,e,f]);const te=(j,S=0)=>{const{top:B}=j.getBoundingClientRect();return B+S>=0&&B-S<=window.innerHeight};h.useEffect(()=>{var j,S;if(n&&n.type!=="Multiple"&&c.current){const B=X(c.current.contentDocument,n._id);B&&(te(B)||(S=(j=c.current)==null?void 0:j.contentWindow)==null||S.scrollTo({top:B.offsetTop,behavior:"smooth"}),R([B]))}},[n]),h.useEffect(()=>{if(!a.isEmpty(y)&&c.current){const j=Ge(c.current.contentDocument,a.first(y).id);v(j?[j]:[null])}else v([null])},[y]);const se=h.useMemo(()=>{let j=Ee;return j=j.replace("__HTML_DIR__",ee),o==="offline"&&(j=j.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),j=j.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),j=j.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),j},[o]);return r.jsxRuntimeExports.jsx("div",{onClick:()=>{t([]),I([])},onMouseLeave:()=>setTimeout(()=>p(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:f>0&&!a.isEmpty(x)?{width:s?"100%":f}:{},ref:l,children:r.jsxRuntimeExports.jsxs(Se,{contentDidMount:()=>m(c.current),ref:c,id:"canvas-iframe",style:{width:`${e}px`,...x},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:se,children:[r.jsxRuntimeExports.jsx(Fe,{}),r.jsxRuntimeExports.jsx(Oe,{block:n,selectedBlockElement:a.first($)}),r.jsxRuntimeExports.jsx(ze,{model:"page"}),r.jsxRuntimeExports.jsx(Pe,{children:V?r.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"})}):r.jsxRuntimeExports.jsx(Je,{})}),r.jsxRuntimeExports.jsx("br",{}),r.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},Ve=()=>r.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[r.jsxRuntimeExports.jsx(ke,{}),r.jsxRuntimeExports.jsx("div",{className:"relative h-full overflow-hidden bg-slate-800/90 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px] px-2",children:r.jsxRuntimeExports.jsx(h.Suspense,{fallback:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"}),children:r.jsxRuntimeExports.jsx(i.ErrorBoundary,{children:r.jsxRuntimeExports.jsx(Xe,{})})})})]});exports.default=Ve;
|