@chaibuilder/sdk 1.2.61 → 1.2.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +1 -1
  2. package/dist/AddBlocks-Wja5xsTO.cjs +1 -0
  3. package/dist/{AddBlocks-L-3Io1jR.js → AddBlocks-ucNQHhx7.js} +18 -18
  4. package/dist/CanvasArea-1lUzUorh.js +975 -0
  5. package/dist/CanvasArea-dsxnMndK.cjs +60 -0
  6. package/dist/{CodeEditor-cY6z8D4N.js → CodeEditor-LeNocbY6.js} +1 -1
  7. package/dist/{CodeEditor-NuzOGqRn.cjs → CodeEditor-kk0bmQ3P.cjs} +1 -1
  8. package/dist/{CurrentPage-hoe1khi5.js → CurrentPage-huy7O-ih.js} +3 -3
  9. package/dist/{CurrentPage-_K-CIG12.cjs → CurrentPage-oPzQ-MY2.cjs} +1 -1
  10. package/dist/{ListTree-yoltG7gq.js → ListTree-5T-2KuBE.js} +1 -1
  11. package/dist/{ListTree-8jpTvI-s.cjs → ListTree-Fwl6Dtgc.cjs} +1 -1
  12. package/dist/{PagesPanel-ITbSJK04.cjs → PagesPanel-85U4O4ex.cjs} +1 -1
  13. package/dist/{PagesPanel-72BMvQe1.js → PagesPanel-IT7AmWMs.js} +4 -4
  14. package/dist/{ProjectPanel-2k7uFIr3.cjs → ProjectPanel-NiOqTkub.cjs} +1 -1
  15. package/dist/{ProjectPanel-Z5SIPEUd.js → ProjectPanel-hhxqbHEX.js} +4 -4
  16. package/dist/{Settings-ye3f6PLl.cjs → Settings-NqIs7PLQ.cjs} +1 -1
  17. package/dist/{Settings-vEsUk_p5.js → Settings-UO9zB4rm.js} +2 -2
  18. package/dist/{SidePanels-DPh7uRVD.js → SidePanels-2ZXeWnl7.js} +3 -3
  19. package/dist/{SidePanels-o_ItFCvJ.cjs → SidePanels-n5WUkXLw.cjs} +1 -1
  20. package/dist/{ThemeConfiguration-03I3INEI.cjs → ThemeConfiguration-UNRnCxnU.cjs} +1 -1
  21. package/dist/{ThemeConfiguration-e_4e_ZcS.js → ThemeConfiguration-VSQaQn9_.js} +4 -4
  22. package/dist/{Topbar-9ZZq8_wR.js → Topbar-Tkn___pR.js} +2 -2
  23. package/dist/{Topbar-z4-2S39X.cjs → Topbar-m48Xdj0O.cjs} +1 -1
  24. package/dist/UILibrariesPanel-0NMxbnSZ.js +215 -0
  25. package/dist/UILibrariesPanel-9V4REpxW.cjs +1 -0
  26. package/dist/{UnsplashImages-Y0TGxNbH.js → UnsplashImages-LU3fiooG.js} +1 -1
  27. package/dist/{UnsplashImages-5JbDig-S.cjs → UnsplashImages-fm761J9M.cjs} +1 -1
  28. package/dist/{UploadImages-f6wPPJxc.cjs → UploadImages-2_SIuRI7.cjs} +1 -1
  29. package/dist/{UploadImages-Dh35M55S.js → UploadImages-MjYi7gfH.js} +1 -1
  30. package/dist/{add-page-modal-j-TpEdWv.cjs → add-page-modal-QdlPDeMk.cjs} +1 -1
  31. package/dist/{add-page-modal-vQn_hxH5.js → add-page-modal-TWTjEGxY.js} +4 -4
  32. package/dist/{atoms-a0H_593V.cjs → atoms-KQpaDRnF.cjs} +1 -1
  33. package/dist/{atoms-ZOWyNoiC.js → atoms-Oomqut88.js} +2 -2
  34. package/dist/{confirm-alert-pGxJwZ2Q.js → confirm-alert-RNzVJyhU.js} +1 -1
  35. package/dist/{confirm-alert-C3wsf6lk.cjs → confirm-alert-gFBHhF1C.cjs} +1 -1
  36. package/dist/core.cjs +1 -1
  37. package/dist/core.js +2 -2
  38. package/dist/{delete-page-modal-PJR01Hk4.cjs → delete-page-modal-B5W3a1ZW.cjs} +1 -1
  39. package/dist/{delete-page-modal-IcqtlUoA.js → delete-page-modal-sUlXQ02P.js} +3 -3
  40. package/dist/email.cjs +1 -1
  41. package/dist/email.js +2 -2
  42. package/dist/{form-pya-o19L.js → form-c4b4A8Ap.js} +1 -1
  43. package/dist/{form-D9cWMUJ4.cjs → form-lqNXs-pv.cjs} +1 -1
  44. package/dist/{index-zP6-6HxK.js → index-0M3H1dVb.js} +3 -3
  45. package/dist/{index-TzLilp-0.js → index-SyrshOUV.js} +399 -402
  46. package/dist/{index-hHmusBAU.cjs → index-TKS5_SlD.cjs} +1 -1
  47. package/dist/{index-1OAjmTyp.js → index-WN67ca4z.js} +2 -2
  48. package/dist/{index-hdfBoPkh.cjs → index-afblGXKA.cjs} +2 -2
  49. package/dist/index-upb0eDoG.cjs +1 -0
  50. package/dist/lib.cjs +2 -2
  51. package/dist/lib.js +97 -146
  52. package/dist/{page-viewer-Y7vK77bu.js → page-viewer-qb3ot43w.js} +4 -4
  53. package/dist/{page-viewer-9PK_DG5o.cjs → page-viewer-v4K0Wkhx.cjs} +1 -1
  54. package/dist/plugin-2hf9pCRy.cjs +1 -0
  55. package/dist/plugin-wDnsBVPp.js +54 -0
  56. package/dist/{project-general-setting-z943m0_C.js → project-general-setting-LfoijnjK.js} +4 -4
  57. package/dist/{project-general-setting-7epnyvtg.cjs → project-general-setting-Q7hgQy5G.cjs} +1 -1
  58. package/dist/{project-seo-setting-rjrO9KDR.cjs → project-seo-setting-rjVkahzj.cjs} +1 -1
  59. package/dist/{project-seo-setting-PXJe5SSV.js → project-seo-setting-ztis1_yw.js} +2 -2
  60. package/dist/{single-page-detail-My6c05Vt.js → single-page-detail-Neoai4eq.js} +11 -11
  61. package/dist/{single-page-detail-lnU7gxgk.cjs → single-page-detail-tR7Qp9T4.cjs} +1 -1
  62. package/dist/studio.cjs +1 -1
  63. package/dist/studio.js +3 -3
  64. package/dist/ui.cjs +1 -1
  65. package/dist/ui.js +44 -44
  66. package/dist/web-blocks.cjs +1 -1
  67. package/dist/web-blocks.js +1 -1
  68. package/package.json +1 -1
  69. package/dist/AddBlocks-BtMNa99n.cjs +0 -1
  70. package/dist/CanvasArea-SgKI8O-Y.cjs +0 -59
  71. package/dist/CanvasArea-xq30AEQD.js +0 -978
  72. package/dist/UILibrariesPanel-LGbh-IZP.cjs +0 -1
  73. package/dist/UILibrariesPanel-PP4QDQRZ.js +0 -216
  74. package/dist/index-cH1CfTbV.cjs +0 -1
@@ -0,0 +1,60 @@
1
+ "use strict";var re=Object.defineProperty;var le=(e,t,s)=>t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var D=(e,t,s)=>(le(e,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-Z_BpKhVy.cjs"),x=require("react"),a=require("lodash-es"),R=require("@radix-ui/react-icons"),o=require("./index-upb0eDoG.cjs"),L=require("./index-afblGXKA.cjs"),U=require("react-i18next"),k=require("jotai"),ae=require("lucide-react"),V=require("react-dom"),v=require("prop-types"),ce=require("react-quill"),q=require("./atoms-KQpaDRnF.cjs"),de=require("@floating-ui/dom"),G=require("@floating-ui/react-dom"),ue=require("@react-hookz/web"),pe=require("flagged"),xe=require("@tailwindcss/typography"),me=require("@tailwindcss/forms"),ge=require("@tailwindcss/aspect-ratio"),he=require("tailwindcss-palette-generator"),fe=require("./plugin-2hf9pCRy.cjs"),je=require("tailwind-merge"),F=require("./MODIFIERS-mVmfEGgo.cjs"),Ee=require("@chaibuilder/runtime"),X=require("lodash"),ye=require("react-wrap-balancer"),ke=require("re-resizable");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("clsx");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-scroll-area");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("./Functions-N3yhPYKY.cjs");require("tree-model");require("i18next");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");const be=()=>{const{hasUndo:e,hasRedo:t,undo:s,redo:i}=o.useUndoManager();return n.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[n.jsxRuntimeExports.jsx(o.Button,{disabled:!e(),size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:n.jsxRuntimeExports.jsx(R.ResetIcon,{})}),n.jsxRuntimeExports.jsx(o.Button,{disabled:!t(),onClick:i,size:"sm",className:"rounded-full",variant:"ghost",children:n.jsxRuntimeExports.jsx(R.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function ve(){const[e,t]=o.useDarkMode();return n.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[n.jsxRuntimeExports.jsx(R.SunIcon,{className:"size-4 shrink-0"}),n.jsxRuntimeExports.jsx(o.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"} 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:n.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"} 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`})}),n.jsxRuntimeExports.jsx(L.FaMoon,{className:"size-4 ml-3 shrink-0"})]})}const Z=({landscape:e=!1})=>n.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[n.jsxRuntimeExports.jsx("g",{strokeWidth:0}),n.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),n.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"}})]}),Re=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:n.jsxRuntimeExports.jsx(R.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:n.jsxRuntimeExports.jsx(R.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:n.jsxRuntimeExports.jsx(Z,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:n.jsxRuntimeExports.jsx(Z,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:n.jsxRuntimeExports.jsx(R.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:n.jsxRuntimeExports.jsx(R.DesktopIcon,{}),width:1920}],Q=({title:e,content:t,currentBreakpoint:s,breakpoint:i,width:d,icon:u,onClick:c})=>{const{t:r}=U.useTranslation();return n.jsxRuntimeExports.jsxs(o.HoverCard,{children:[n.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsx(o.Button,{onClick:()=>c(d),size:"sm",variant:i===s?"secondary":"ghost",children:u})}),n.jsxRuntimeExports.jsx(o.HoverCardContent,{className:"w-52 border-border",children:n.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:n.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[n.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:r(e)}),n.jsxRuntimeExports.jsx("p",{className:"text-xs",children:r(t)})]})})})]})},we=()=>{const[,e,t]=o.useCanvasWidth(),[s,i]=o.useSelectedBreakpoints(),{t:d}=U.useTranslation(),u=o.useBuilderProp("breakpoints",Re),c=r=>{s.includes(r)?s.length>2&&i(s.filter(l=>l!==r)):i(l=>[...l,r])};return u.length<4?n.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:a.map(u,r=>x.createElement(Q,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:e}))}):n.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[a.map(u.filter(r=>a.includes(s,a.toUpper(r.breakpoint))),r=>x.createElement(Q,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:e})),n.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[n.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:n.jsxRuntimeExports.jsx(R.DotsVerticalIcon,{className:"scale-90 transform"})})}),n.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[n.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:d("Breakpoints")}),n.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),a.map(u,r=>n.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:r.breakpoint==="xs",onCheckedChange:()=>c(a.toUpper(r.breakpoint)),checked:a.includes(s,a.toUpper(r.breakpoint)),children:d(r.title)},r.breakpoint))]})]})]})},Se=()=>{const{t:e}=U.useTranslation(),{setNewBlocks:t}=o.useBlocksStoreUndoableActions(),[,s]=o.useSelectedBlockIds(),[,i]=o.useSelectedStylingBlocks(),d=x.useCallback(()=>{t([]),s([]),i([])},[t]);return n.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:n.jsxRuntimeExports.jsxs(o.AlertDialog,{children:[n.jsxRuntimeExports.jsx(o.AlertDialogTrigger,{asChild:!0,children:n.jsxRuntimeExports.jsxs(o.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[n.jsxRuntimeExports.jsx(R.EraserIcon,{})," ",e("clear")]})}),n.jsxRuntimeExports.jsxs(o.AlertDialogContent,{className:"border-border",children:[n.jsxRuntimeExports.jsxs(o.AlertDialogHeader,{children:[n.jsxRuntimeExports.jsx(o.AlertDialogTitle,{children:e("clear_canvas_title")}),n.jsxRuntimeExports.jsx(o.AlertDialogDescription,{children:e("clear_canvas_description")})]}),n.jsxRuntimeExports.jsxs(o.AlertDialogFooter,{children:[n.jsxRuntimeExports.jsx(o.AlertDialogCancel,{children:e("cancel")}),n.jsxRuntimeExports.jsx(o.AlertDialogAction,{onClick:d,children:e("yes")})]})]})]})})},Ce=()=>{const[e,t]=k.useAtom(o.aiAssistantActiveAtom);return o.useBuilderProp("askAiCallBack",null)?n.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsxRuntimeExports.jsxs(o.Label,{htmlFor:"ai-assistant",className:"flex items-center gap-x-1 text-sm text-yellow-600",children:[n.jsxRuntimeExports.jsx(ae.SparklesIcon,{className:"w-4"}),"AI Assistant"]}),n.jsxRuntimeExports.jsx(o.Switch,{className:"scale-90",checked:e,onCheckedChange:i=>{t(i)},id:"ai-assitantt"})]}):null},Ae=()=>{const e=o.useBuilderProp("darkMode",!0),[t]=o.useCanvasZoom();return n.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[n.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[n.jsxRuntimeExports.jsx(we,{}),n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),e?n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(ve,{}),n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,n.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:[n.jsxRuntimeExports.jsx(R.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",n.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[a.round(t,0),"%"]})]}),n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsx(be,{})]}),n.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[n.jsxRuntimeExports.jsx(Se,{}),n.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),n.jsxRuntimeExports.jsx(Ce,{})]})]})},Be=`<!doctype html>
2
+ <html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
7
+ <style>
8
+ html { height: 100%; overflow:auto; }
9
+ body { height: 100%; }
10
+ .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
11
+ .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
12
+ body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
13
+ -moz-user-select: none;-ms-user-select: none; user-select: none; }
14
+ html{
15
+ -ms-overflow-style: none; /* IE and Edge */
16
+ scrollbar-width: none; /* Firefox */
17
+ }
18
+ /** IMPORTANT: Make fields content editable in SAFARI */
19
+ [contenteditable] {-webkit-user-select: text;user-select: text;}
20
+
21
+ html::-webkit-scrollbar { width: 0 !important }
22
+ .aspect-auto{aspect-ratio: auto;}
23
+ .aspect-square{aspect-ratio: 1/1;}
24
+ .aspect-video{aspect-ratio: 16/9;}
25
+ .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
26
+ .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
27
+ a{ pointer-events: none !important; }
28
+ [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
29
+ [contenteditable="true"] {
30
+ outline: none;
31
+ box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
32
+ -webkit-user-select: text;
33
+ -moz-user-select: text;
34
+ user-select: text;
35
+ }
36
+ .frame-root .frame-content { height: 100%; }
37
+ [data-drop="yes"] { outline: 2px dashed orange !important; outline-offset: -2px }
38
+ [data-dnd="yes"] { pointer-events: auto !important}
39
+ [data-dnd="no"] { pointer-events: none !important; }
40
+ [data-dnd-dragged="yes"] { opacity: 0.6; pointer-events: none; }
41
+ [data-dnd-dragged="no"] { opacity: 1; pointer-events: auto !important; }
42
+ [force-show] { display: block !important; }
43
+ </style>
44
+ <style id="hidden-blocks"></style>
45
+ <style id="selected-block"></style>
46
+ <style id="selected-styling-block"></style>
47
+ <style id="highlighted-block"></style>
48
+ <style id="dragged-block"></style>
49
+ <style id="drop-target-block"></style>
50
+
51
+ </head>
52
+ <body class="font-body antialiased h-full">
53
+ <div class="frame-root h-full"></div>
54
+ <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
55
+ </body>
56
+ </html>`,Ie=e=>{const[t]=o.useCanvasWidth(),[,s]=o.useCanvasZoom(),[i,d]=x.useState({}),u=x.useCallback(()=>{const{width:c,height:r}=e;if(c<t){const l=parseFloat((c/t).toFixed(2).toString());let g={};const p=r*l;r&&(g={height:100+(r-p)/p*100+"%"}),d({position:"relative",top:0,transform:`scale(${l})`,transformOrigin:"top left",...g,maxWidth:"none"}),s(l*100)}else d({}),s(100)},[t,e,s]);return x.useEffect(()=>{u()},[t,e,s,u]),i};let te,se;typeof document<"u"&&(te=document);typeof window<"u"&&(se=window);const ne=x.createContext({document:te,window:se}),H=()=>x.useContext(ne),{Provider:_e,Consumer:at}=ne;class oe extends x.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return x.Children.only(this.props.children)}}D(oe,"propTypes",{children:v.element.isRequired,contentDidMount:v.func.isRequired,contentDidUpdate:v.func.isRequired});class z extends x.Component{constructor(s,i){super(s,i);D(this,"setRef",s=>{this.nodeRef.current=s;const{forwardedRef:i}=this.props;typeof i=="function"?i(s):i&&(i.current=s)});D(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});D(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=x.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 s=this.getDoc();return this.props.mountTarget?s.querySelector(this.props.mountTarget):s.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const s=this.getDoc();if(!s)return null;const i=this.props.contentDidMount,d=this.props.contentDidUpdate,u=s.defaultView||s.parentView,c=n.jsxRuntimeExports.jsx(oe,{contentDidMount:i,contentDidUpdate:d,children:n.jsxRuntimeExports.jsx(_e,{value:{document:s,window:u},children:n.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),r=this.getMountTarget();return[V.createPortal(this.props.head,this.getDoc().head),V.createPortal(c,r)]}render(){const s={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete s.head,delete s.initialContent,delete s.mountTarget,delete s.contentDidMount,delete s.contentDidUpdate,delete s.forwardedRef,n.jsxRuntimeExports.jsx("iframe",{...s,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}D(z,"propTypes",{style:v.object,head:v.node,initialContent:v.string,mountTarget:v.string,className:v.string,contentDidMount:v.func,contentDidUpdate:v.func,children:v.oneOfType([v.element,v.arrayOf(v.element)])}),D(z,"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 De=x.forwardRef((e,t)=>n.jsxRuntimeExports.jsx(z,{...e,forwardedRef:t}));function K(e){const t=window.getComputedStyle(e),s=t.display;if(s==="flex"||s==="inline-flex"){const i=t.flexDirection;return i==="column"||i==="column-reverse"?"vertical":"horizontal"}else if(s==="grid"){const i=t.gridAutoFlow,d=t.gridTemplateRows,u=t.gridTemplateColumns;return i.includes("column")||d.split(" ").length>u.split(" ").length?"vertical":"horizontal"}else if(s==="block"||s==="inline-block")return"vertical";return"horizontal"}let y=null,A=[],J=null,O=null;const ee=(e,t,s)=>{if(!y||!e)return;const i=y==null?void 0:y.getElementById("placeholder"),d=A.map(([l])=>l),u=d.reduce((l,g)=>Math.abs(g-s)<Math.abs(l-s)?g:l,0),c=d.indexOf(u);if(!A[c])return;const r=A[c];i.style.width=t==="vertical"?r[2]+"px":"2px",i.style.height=t==="vertical"?"2px":r[2]+"px",i.style.display="block",t==="vertical"?(i.style.top=r[0]+"px",i.style.left=r[1]+"px"):(i.style.top=r[1]+"px",i.style.left=r[0]+"px")};function Te(e,t){let s=0,i=1/0;return t.forEach((d,u)=>{const c=Math.abs(d[0]-e);c<i&&(i=c,s=u)}),s}const Me=e=>{const s=K(e)==="horizontal";A=[],Array.from(e.children).forEach((i,d)=>{if(i.classList.contains("pointer-events-none"))return;const u=s?i.offsetLeft:i.offsetTop,c=s?[i.offsetTop,i.clientHeight]:[i.offsetLeft,i.clientWidth];if(A.push([u,c[0],c[1]]),d===e.children.length-1){const r=s?i.offsetLeft+i.clientWidth:i.offsetTop+i.clientHeight;A.push([r,c[0],c[1]])}})},qe=a.throttle(e=>{var d;const t=e.target,s=K(t),i=(d=y==null?void 0:y.defaultView)==null?void 0:d.scrollY;s==="vertical"?ee(t,s,e.clientY+i):ee(t,s,e.clientX)},0);function $(){const e=y==null?void 0:y.getElementById("placeholder");e.style.display="none",Ne("pointer-none"),Le()}function Ne(e){(y==null?void 0:y.querySelectorAll(`.${e}`)).forEach(s=>{s.classList.remove(e)})}function Le(){const e=y==null?void 0:y.querySelector('[data-drop="yes"]');e&&e.removeAttribute("data-drop")}const Fe=()=>{const{document:e}=H(),[t,s]=k.useAtom(o.draggingFlagAtom),{addCoreBlock:i}=o.useAddBlock(),[,d]=o.useHighlightBlockId(),[,u]=o.useSelectedBlockIds(),{moveBlocks:c}=o.useBlocksStoreUndoableActions(),[r,l]=k.useAtom(q.draggedBlockAtom),[,g]=k.useAtom(q.dropTargetBlockIdAtom),p=()=>{$(),s(!1),u([r._id]),l(null),g(null),A=[]};return y=e,{isDragging:t,onDragOver:h=>{h.preventDefault(),h.stopPropagation(),qe(h)},onDrop:h=>{var I;const m=J,b=K(m)==="vertical"?h.clientY+((I=y==null?void 0:y.defaultView)==null?void 0:I.scrollY):h.clientX;O=Te(b,A);const f=r,w=m.getAttribute("data-block-id");if(!a.has(f,"_id")){i(f,w==="canvas"?null:w,O),setTimeout(p,300);return}let S=m.getAttribute("data-block-id");S===null&&(S=h.target.parentElement.getAttribute("data-block-id")),c([f._id],S==="canvas"?null:S,O),p(),setTimeout($,300)},onDragEnter:h=>{const m=h,j=m.target;J=j;const b=j.getAttribute("data-block-id");g(b),m.stopPropagation(),m.preventDefault(),A=[],Me(j),s(!0),d(""),u([])},onDragLeave:h=>{h.target.getAttribute("data-block-id")==="canvas"&&(g(null),s(!1),$(),A=[])}}};function Y(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function He(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Pe=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=o.useUpdateBlocksProps(),[,s]=o.useHighlightBlockId(),[i,d]=k.useAtom(o.inlineEditingActiveAtom);return u=>{var h;if(i)return;const c=Y(u.target),r=c.getAttribute("data-block-type");if(!r||!e.includes(r))return;const l=c.cloneNode(!0);c.style.display="none",Array.from(l.attributes).forEach(m=>{m.name!=="class"&&l.removeAttribute(m.name)}),r==="Text"&&(l.style.display="inline-block"),c.parentNode.insertBefore(l,c.nextSibling);const g=new ce.Quill(l,{placeholder:"Type here..."});function p(){const m=g.getText(0,g.getLength());t([c.getAttribute("data-block-id")],{content:m}),c.removeAttribute("style"),l.removeEventListener("blur",p,!0),He(g),d(""),s("")}l.addEventListener("blur",p,!0),l.addEventListener("keydown",m=>{(m.key==="Enter"||m.key==="Escape")&&p()}),g.focus(),(h=l.querySelector(".ql-clipboard"))==null||h.remove(),d(c.getAttribute("data-block-id"))}},Oe=()=>{const[,e]=o.useSelectedStylingBlocks(),[t,s]=o.useSelectedBlockIds(),[,i]=o.useHighlightBlockId(),[d]=k.useAtom(o.inlineEditingActiveAtom),[u]=k.useAtom(o.treeRefAtom);return c=>{if(d)return;c.stopPropagation();const r=Y(c.target);if(r!=null&&r.getAttribute("data-block-id")&&(r==null?void 0:r.getAttribute("data-block-id"))==="container"){s([]),e([]),i("");return}if(r!=null&&r.getAttribute("data-block-parent")){const l=r.getAttribute("data-style-prop"),g=r.getAttribute("data-style-id"),p=r.getAttribute("data-block-parent");t.includes(p)||u==null||u.closeAll(),e([{id:g,prop:l,blockId:p}]),s([p])}else if(r!=null&&r.getAttribute("data-block-id")){let l=r.getAttribute("data-block-id");t.includes(l)||u==null||u.closeAll(),e([]),s([l])}i("")}},$e=a.throttle((e,t)=>{const s=Y(e.target);s!=null&&s.getAttribute("data-style-id")&&t(s.getAttribute("data-style-id"))},100),ze=()=>{const[,e]=o.useHighlightBlockId(),[t]=k.useAtom(o.inlineEditingActiveAtom);return s=>{t||$e(s,e)}},We=({children:e})=>{const{document:t}=H(),[s]=o.useSelectedBlockIds(),[i,d]=o.useSelectedStylingBlocks();x.useEffect(()=>{setTimeout(()=>{if(!a.isEmpty(i))return;const g=ie(t,a.first(s));if(g){const p=g.getAttribute("data-style-prop");if(p){const h=g.getAttribute("data-style-id"),m=g.getAttribute("data-block-parent");d([{id:h,prop:p,blockId:m}])}}},100)},[t,s,d,i]);const u=Pe(),c=Oe(),r=ze(),l=Fe();return n.jsxRuntimeExports.jsx("div",{"data-block-id":"canvas",id:"canvas",onClick:c,onDoubleClick:u,onMouseMove:r,...a.omit(l,"isDragging"),className:"relative mb-5 h-full max-w-full px-1 "+(l.isDragging?"dragging":""),children:e})},ie=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ue=()=>{const{document:e}=H();return L.useKeyEventWatcher(e),null},Ke=({block:e,label:t})=>{const[,s]=o.useSelectedBlockIds(),[,i]=o.useHighlightBlockId(),[,d]=k.useAtom(q.draggedBlockAtom),u=pe.useFeature("dnd");return n.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-default items-center space-x-1 px-1",draggable:u?"true":"false",onDragStart:c=>{c.dataTransfer.setData("text/plain",JSON.stringify(a.pick(e,["_id","_type","_name"]))),d(e),setTimeout(()=>{s([]),i(null)},200)},children:[n.jsxRuntimeExports.jsx(R.DragHandleDots2Icon,{}),t]})},Ye=({selectedBlockElement:e,block:t})=>{const s=o.useRemoveBlocks(),i=o.useDuplicateBlocks(),[,d]=o.useSelectedBlockIds(),[,u]=o.useHighlightBlockId(),[,c]=o.useSelectedStylingBlocks(),[r]=k.useAtom(o.inlineEditingActiveAtom),{floatingStyles:l,refs:g,update:p}=G.useFloating({placement:"top-start",middleware:[G.shift(),de.flip()],elements:{reference:e}});ue.useResizeObserver(e,()=>p(),e!==null);const h=a.get(t,"_parent",null),m=a.isEmpty(a.get(t,"_name",""))?a.get(t,"_type",""):a.get(t,"_name","");return!e||!t||r?null:n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:n.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:g.setFloating,style:l,onClick:j=>{j.stopPropagation(),j.preventDefault()},onMouseEnter:j=>{j.stopPropagation(),u(null)},onKeyDown:j=>j.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[n.jsxRuntimeExports.jsx(Ke,{label:m,block:t}),n.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[h&&n.jsxRuntimeExports.jsx(R.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{c([]),d([h])}}),o.canDuplicateBlock(a.get(t,"_type",""))?n.jsxRuntimeExports.jsx(R.CopyIcon,{className:"hover:scale-105",onClick:()=>i([t==null?void 0:t._id])}):null,o.canDeleteBlock(a.get(t,"_type",""))?n.jsxRuntimeExports.jsx(R.TrashIcon,{className:"hover:scale-105",onClick:()=>s([t==null?void 0:t._id])}):null]})]})})},Ve=({model:e})=>{const[t]=o.useBrandingOptions(),[s]=o.useSelectedBlockIds(),[i]=o.useDarkMode(),[d]=o.useHighlightBlockId(),[u]=o.useSelectedStylingBlocks(),[c]=k.useAtom(q.draggedBlockAtom),[r]=k.useAtom(q.dropTargetBlockIdAtom),{document:l,window:g}=H(),[p]=x.useState(l==null?void 0:l.getElementById("highlighted-block")),[h]=x.useState(l==null?void 0:l.getElementById("selected-block")),[m]=x.useState(l==null?void 0:l.getElementById("selected-styling-block")),[j]=x.useState(l==null?void 0:l.getElementById("dragged-block"));x.useEffect(()=>{i?l==null||l.documentElement.classList.add("dark"):l==null||l.documentElement.classList.remove("dark")},[i,l]);const b=a.get(t,"headingFont","DM Sans"),f=a.get(t,"bodyFont","DM Sans");return x.useEffect(()=>{const w=a.get(t,"primaryColor","#000"),S=a.get(t,"secondaryColor","#FFF"),I=a.get(t,"bodyBgLightColor","#fff"),_=a.get(t,"bodyBgDarkColor","#000"),T=a.get(t,"bodyTextDarkColor","#000"),N=a.get(t,"bodyTextLightColor","#fff"),P=he([{color:w,name:"primary"},{color:S,name:"secondary"}]),E={"bg-light":I,"bg-dark":_,"text-dark":T,"text-light":N},C=a.get(t,"roundedCorners","0");!g||!g.tailwind||(g.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},fontFamily:{heading:[b],body:[f]},borderRadius:{DEFAULT:`${C||"0"}px`},colors:{...E,...P}}},plugins:[xe,me,ge,fe.plugin(function({addBase:B,theme:M}){B({"h1,h2,h3,h4,h5,h6":{fontFamily:M("fontFamily.heading")},body:{fontFamily:M("fontFamily.body"),color:M("colors.text-light"),backgroundColor:M("colors.bg-light")},".dark body":{color:M("colors.text-dark"),backgroundColor:M("colors.bg-dark")}})})]})},[t,g,b,f]),x.useEffect(()=>{h&&(h.textContent=`${a.map(s,w=>`[data-block-id="${w}"]`).join(",")}{
57
+ outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
58
+ }`)},[s,h]),x.useEffect(()=>{j.textContent=c?`[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}`:""},[c,j]),x.useEffect(()=>{p&&(p.textContent=d?`[data-style-id="${d}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[d,s,p]),x.useEffect(()=>{m&&(m.textContent=`${a.map(u,({id:w})=>`[data-style-id="${w}"]`).join(",")}{
59
+ outline: 1px solid #42a1fc !important; outline-offset: -1px;
60
+ }`)},[u,m]),x.useEffect(()=>{l.querySelector("#drop-target-block").innerHTML=r?`[data-block-id="${r}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}`:""},[r]),n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:(b||f)&&n.jsxRuntimeExports.jsx("link",{rel:"stylesheet",href:`https://fonts.googleapis.com/css2?family=${b?`${b.replace(/ /g,"+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900`:""}${b&&f&&b!==f?"&":""}${f&&f!==b?`family=${f.replace(/ /g,"+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900`:""}&display=swap`})})},Ge=()=>k.useAtom(o.canvasSettingsAtom),Xe=(e,t)=>{const s=["xs","sm","md","lg","xl","2xl"],i=s.indexOf(t),d=e.split(" ");let u=new Array(s.length).fill(!1);for(const c of d){let[r,l]=c.split(":");l||(l=r,r="xs");const g=s.indexOf(r);if(g<=i){const p=["block","flex","inline","inline-block","inline-flex","grid","table"],h=["hidden"];if(p.includes(l))for(let m=g;m<s.length;m++)u[m]=!0;else if(h.includes(l))for(let m=g;m<s.length;m++)u[m]=!1}}return u[i]},Ze=e=>{const t={};return Object.keys(e).forEach(s=>{a.isString(e[s])&&e[s].startsWith(F.SLOT_KEY)&&(t[s]=e[s].replace(F.SLOT_KEY,"").split(","))}),t},Qe=a.memoize(e=>{const t=e.replace(F.STYLES_KEY,"").split(",");return je.twMerge(t[0],t[1])});function Je(e,t){return a.get(e,`${t}_attrs`,{})}function et(e,t){const s={};return Object.keys(e).forEach(i=>{if(a.isString(e[i])&&e[i].startsWith(F.STYLES_KEY)){const d=Qe(e[i]),u=Je(e,i);s[i]={className:d,"data-style-prop":i,"data-block-parent":e._id,"data-style-id":`${i}-${e._id}`,...u};const c=a.has(u,"x-show")||a.has(u,"x-if");c&&(s.__isHidden=c&&!Xe(d,t))}}),s}function tt(e,t){const s=a.get(e,"_bindings",{});return a.isEmpty(s)?{...e}:(a.each(s,(i,d)=>{a.isString(i)&&a.get(t,i,null)&&(e[d]=a.get(t,i,null))}),e)}function W({blocks:e}){const[t]=o.useBlocksStore(),[s]=k.useAtom(o.xShowBlocksAtom),[i]=k.useAtom(q.draggedBlockAtom),[,d]=o.useCanvasWidth(),[u]=Ge(),c=x.useCallback(p=>et(p,d),[d]),[r]=L.useChaiExternalData(),[l]=k.useAtom(o.inlineEditingActiveAtom),g=x.useCallback(p=>p.reduce((h,m)=>{const j=a.get(u,m,{});return{...h,...j}},{}),[u,t]);return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:x.Children.toArray(e.map((p,h)=>{if(l===p._id)return null;const m=Ze(p),j={};a.isEmpty(m)||Object.keys(m).forEach(T=>{j[T]=x.Children.toArray(m[T].map(N=>n.jsxRuntimeExports.jsx(W,{blocks:[a.find(t,{_id:N})]})))});const b=a.filter(t,{_parent:p._id});j.children=b.length?n.jsxRuntimeExports.jsx(W,{blocks:b}):null;const f=Ee.getBlockComponent(p._type),w=a.get(f,"builderComponent",a.get(f,"component",null));if(a.isNull(w))return n.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${p==null?void 0:p._type} not registered -->`});const S=a.has(f,"getBlockStateFrom")?f==null?void 0:f.getBlockStateFrom(p,t):[],I=g(S),_=c(p);return a.get(_,"__isHidden",!1)&&!X.includes(s,p._id)?null:n.jsxRuntimeExports.jsx(x.Suspense,{children:x.createElement(w,{blockProps:{...X.includes(s,p._id)?{"force-show":""}:{},"data-block-id":p._id,"data-block-type":p._type,...i?{"data-dnd":o.canAcceptChildBlock(p._type,i==null?void 0:i._type)?"yes":"no"}:{}},index:h,...tt(p,r),...a.omit(_,["__isHidden"]),...j,inBuilder:!0,blockState:I})})}))})}const st=()=>{const[e]=o.useBlocksStore(),t=a.isEmpty(e)?null:n.jsxRuntimeExports.jsx(L.BlocksExternalDataProvider,{children:n.jsxRuntimeExports.jsx(W,{blocks:a.filter(e,s=>a.isEmpty(s._parent))})});return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:t})},nt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),ot=()=>{const[e]=k.useAtom(o.networkModeAtom),[t]=o.usePreviewMode(),[s]=o.useCanvasWidth(),[,i]=o.useSelectedBlockIds(),d=o.useSelectedBlock(),[,u]=o.useHighlightBlockId(),c=x.useRef(null),r=x.useRef(null),[l,g]=x.useState({width:0,height:0}),p=Ie(l),[h,m]=x.useState(0),[j,b]=x.useState([]),[,f]=x.useState([]),[,w]=k.useAtom(o.canvasIframeAtom),[S,I]=o.useSelectedStylingBlocks(),_=o.useBuilderProp("loading",!1),T=o.useBuilderProp("htmlDir","ltr");x.useEffect(()=>{const{clientWidth:E,clientHeight:C}=r.current;g({width:E,height:C}),h===0&&m(E)},[r,s,h]);const N=(E,C=0)=>{const{top:B}=E.getBoundingClientRect();return B+C>=0&&B-C<=window.innerHeight};x.useEffect(()=>{var E,C;if(d&&d.type!=="Multiple"&&c.current){const B=ie(c.current.contentDocument,d._id);B&&(N(B)||(C=(E=c.current)==null?void 0:E.contentWindow)==null||C.scrollTo({top:B.offsetTop,behavior:"smooth"}),b([B]))}},[d]),x.useEffect(()=>{if(!a.isEmpty(S)&&c.current){const E=nt(c.current.contentDocument,a.first(S).id);f(E?[E]:[null])}else f([null])},[S]);const P=x.useMemo(()=>{let E=Be;return E=E.replace("__HTML_DIR__",T),e==="offline"&&(E=E.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),E=E.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),E=E.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),E},[e]);return n.jsxRuntimeExports.jsx("div",{onClick:()=>{i([]),I([])},onMouseLeave:()=>setTimeout(()=>u(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:h>0&&!a.isEmpty(p)?{width:t?"100%":h}:{},ref:r,children:n.jsxRuntimeExports.jsxs(De,{contentDidMount:()=>w(c.current),ref:c,id:"canvas-iframe",style:{width:`${s}px`,...p},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:P,children:[n.jsxRuntimeExports.jsx(Ue,{}),n.jsxRuntimeExports.jsx(Ye,{block:d,selectedBlockElement:a.first(j)}),n.jsxRuntimeExports.jsx(Ve,{model:"page"}),n.jsxRuntimeExports.jsx(ye.Provider,{children:n.jsxRuntimeExports.jsx(We,{children:_?n.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:n.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):n.jsxRuntimeExports.jsx(st,{})})}),n.jsxRuntimeExports.jsx("br",{}),n.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},it=x.lazy(()=>Promise.resolve().then(()=>require("./CodeEditor-kk0bmQ3P.cjs"))),rt=()=>{const[e]=o.useCodeEditor();return n.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[n.jsxRuntimeExports.jsx(Ae,{}),n.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden bg-gray-100/40 px-2",children:[n.jsxRuntimeExports.jsx(x.Suspense,{fallback:n.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:n.jsxRuntimeExports.jsx(L.ErrorBoundary,{children:n.jsxRuntimeExports.jsx(ot,{})})}),e?n.jsxRuntimeExports.jsx(x.Suspense,{fallback:n.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:n.jsxRuntimeExports.jsx(ke.Resizable,{enable:{top:!0,bottom:!1},className:"max-h-[400px] min-h-[200px]",children:n.jsxRuntimeExports.jsx(it,{})})}):null]})]})};exports.default=rt;
@@ -1,6 +1,6 @@
1
1
  import { j as t } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import k from "@monaco-editor/react";
3
- import { $ as C, r as j, am as v, an as g, B as y } from "./index-TzLilp-0.js";
3
+ import { $ as C, r as j, am as v, an as g, B as y } from "./index-SyrshOUV.js";
4
4
  import { useTranslation as N } from "react-i18next";
5
5
  import { useState as a, useCallback as T, useEffect as E } from "react";
6
6
  import { Cross2Icon as w } from "@radix-ui/react-icons";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),b=require("@monaco-editor/react"),i=require("./index-cH1CfTbV.cjs"),k=require("react-i18next"),n=require("react"),C=require("@radix-ui/react-icons"),E=require("@react-hookz/web");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");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-scroll-area");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-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("tree-model");const a=u=>{const s=document.createElement("div");return s.innerHTML=u,s.innerHTML};function R(){const{t:u}=k.useTranslation(),[s,d]=n.useState(!1),[l,x]=n.useState(""),[r,o]=i.useCodeEditor(),[c]=i.useSelectedBlockIds(),q=i.useUpdateBlocksProps(),m=i.useUpdateBlocksPropsRealtime(),p=E.useThrottledCallback(t=>{const h=a(t);m([r.blockId],{[r.blockProp]:h})},[],300),j=n.useCallback(()=>{if(s){const t=a(l);q([r.blockId],{[r.blockProp]:t})}},[s,l]);n.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),o(null))},[c]);const f=()=>{o(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsxRuntimeExports.jsx("button",{onClick:f,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:u("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:u("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>o(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(C.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(b,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{d(!0),x(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),b=require("@monaco-editor/react"),i=require("./index-upb0eDoG.cjs"),k=require("react-i18next"),n=require("react"),C=require("@radix-ui/react-icons"),E=require("@react-hookz/web");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");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-scroll-area");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-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("tree-model");const a=u=>{const s=document.createElement("div");return s.innerHTML=u,s.innerHTML};function R(){const{t:u}=k.useTranslation(),[s,d]=n.useState(!1),[l,x]=n.useState(""),[r,o]=i.useCodeEditor(),[c]=i.useSelectedBlockIds(),q=i.useUpdateBlocksProps(),m=i.useUpdateBlocksPropsRealtime(),p=E.useThrottledCallback(t=>{const h=a(t);m([r.blockId],{[r.blockProp]:h})},[],300),j=n.useCallback(()=>{if(s){const t=a(l);q([r.blockId],{[r.blockProp]:t})}},[s,l]);n.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),o(null))},[c]);const f=()=>{o(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsxRuntimeExports.jsx("button",{onClick:f,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:u("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:u("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>o(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(C.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(b,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{d(!0),x(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=R;
@@ -1,9 +1,9 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import { Q as h, az as f, aA as j, aB as y, aC as v, aD as P } from "./index-TzLilp-0.js";
2
+ import { Q as h, az as f, aA as j, aB as y, aC as v, aD as P } from "./index-SyrshOUV.js";
3
3
  import { sortBy as C, filter as b, get as w, isEmpty as m, find as n, capitalize as N, map as S } from "lodash-es";
4
4
  import { toast as k } from "sonner";
5
5
  import { useEffect as p } from "react";
6
- import { a as B, u as E, c as T, d as z } from "./index-zP6-6HxK.js";
6
+ import { a as B, u as E, c as T, d as z } from "./index-0M3H1dVb.js";
7
7
  import { BriefcaseIcon as A } from "lucide-react";
8
8
  import { useTranslation as D } from "react-i18next";
9
9
  import "./_commonjsHelpers-UyOWmZb0.js";
@@ -40,7 +40,7 @@ import "@chaibuilder/runtime";
40
40
  import "jotai";
41
41
  import "@react-hookz/web";
42
42
  import "tree-model";
43
- import "./index-1OAjmTyp.js";
43
+ import "./index-WN67ca4z.js";
44
44
  import "i18next";
45
45
  import "@floating-ui/react-dom";
46
46
  import "flagged";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./index-cH1CfTbV.cjs"),i=require("lodash-es"),j=require("sonner"),l=require("react"),o=require("./index-hHmusBAU.cjs"),p=require("lucide-react"),f=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");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-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("./index-hdfBoPkh.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");require("./html-to-json-ndxaXRT8.cjs");require("himalaya");require("lodash");const E=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{saveState:d}=s.useSavePage(),m=o.useChangePage(),{t:q}=f.useTranslation(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const g=r=>{if(d!=="SAVED")j.toast.error(q("You have unsaved changes. Please save before changing the page."));else{const h=i.find(c,{uuid:r});m(h)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 py-1 pr-0 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(p.BriefcaseIcon,{className:"mr-2 h-4 w-4"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./index-upb0eDoG.cjs"),i=require("lodash-es"),j=require("sonner"),l=require("react"),o=require("./index-TKS5_SlD.cjs"),p=require("lucide-react"),f=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");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-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("./index-afblGXKA.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");require("./html-to-json-ndxaXRT8.cjs");require("himalaya");require("lodash");const E=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{saveState:d}=s.useSavePage(),m=o.useChangePage(),{t:q}=f.useTranslation(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const g=r=>{if(d!=="SAVED")j.toast.error(q("You have unsaved changes. Please save before changing the page."));else{const h=i.find(c,{uuid:r});m(h)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 py-1 pr-0 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(p.BriefcaseIcon,{className:"mr-2 h-4 w-4"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=E;
@@ -3,7 +3,7 @@ import React__default, { memo, useMemo, useCallback, useEffect, useRef } from "r
3
3
  import { useAtom } from "jotai";
4
4
  import { useDebouncedCallback } from "@react-hookz/web";
5
5
  import { Tree } from "react-arborist";
6
- import { D as useBlocksStore, r as useSelectedBlockIds, s as useRemoveBlocks, ai as useSelectedBlock, bB as ContextMenuItem, b1 as canDeleteBlock, t as useDuplicateBlocks, bC as ContextMenuContent, b0 as canDuplicateBlock, bD as ContextMenu, bE as ContextMenuTrigger, h as useBuilderProp, b6 as canvasIframeAtom, b4 as canAcceptChildBlock, aF as Tooltip, aG as TooltipTrigger, aH as TooltipContent, bF as treeDSBlocks, am as useUpdateBlocksProps, at as useSelectedStylingBlocks, aW as useBlocksStoreUndoableActions, a$ as treeRefAtom } from "./index-TzLilp-0.js";
6
+ import { D as useBlocksStore, r as useSelectedBlockIds, s as useRemoveBlocks, ai as useSelectedBlock, bA as ContextMenuItem, b0 as canDeleteBlock, t as useDuplicateBlocks, bB as ContextMenuContent, a$ as canDuplicateBlock, bC as ContextMenu, bD as ContextMenuTrigger, h as useBuilderProp, b5 as canvasIframeAtom, b3 as canAcceptChildBlock, aF as Tooltip, aG as TooltipTrigger, aH as TooltipContent, bE as treeDSBlocks, am as useUpdateBlocksProps, at as useSelectedStylingBlocks, aW as useBlocksStoreUndoableActions, a_ as treeRefAtom } from "./index-SyrshOUV.js";
7
7
  import { c as cn } from "./Functions-7jnEwJyw.js";
8
8
  import { BoxModelIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, DropdownMenuIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, RowsIcon, TextIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, TrashIcon, CopyIcon, TriangleRightIcon } from "@radix-ui/react-icons";
9
9
  import { DatabaseIcon } from "lucide-react";