@chaibuilder/sdk 1.2.29 → 1.2.31

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 (64) hide show
  1. package/dist/{AddBlocks-YJPdSqcY.cjs → AddBlocks-UxJOFB9M.cjs} +1 -1
  2. package/dist/{AddBlocks-0sW6gkCO.js → AddBlocks-u1FkSHNj.js} +19 -19
  3. package/dist/{BrandingOptions--vgnQvD1.js → BrandingOptions-A3_c_sd7.js} +1 -1
  4. package/dist/{CanvasArea-41QoxuLf.cjs → CanvasArea-AP2VxTme.cjs} +4 -4
  5. package/dist/{CanvasArea-aii0PyU-.js → CanvasArea-AgZG60eK.js} +68 -68
  6. package/dist/{CurrentPage-2W1pdAOG.cjs → CurrentPage-lBwqlXua.cjs} +1 -1
  7. package/dist/{CurrentPage-06Iacwyp.js → CurrentPage-urEDcMfR.js} +4 -4
  8. package/dist/{ListTree-DnA8gj-7.js → ListTree-c9Z0kWbN.js} +1 -1
  9. package/dist/{PagesPanel-_1CDTUdE.js → PagesPanel-C3yfpE0O.js} +5 -5
  10. package/dist/{PagesPanel-PBFzPSNY.cjs → PagesPanel-QAb3JjVO.cjs} +1 -1
  11. package/dist/{ProjectPanel-pUMeIiUW.js → ProjectPanel--8xzmpgT.js} +5 -5
  12. package/dist/{ProjectPanel-755bbzEQ.cjs → ProjectPanel-DJHfHFni.cjs} +1 -1
  13. package/dist/Settings-alHeC0FS.cjs +1 -0
  14. package/dist/{Settings-dnO-s6x0.js → Settings-oMxnykls.js} +560 -532
  15. package/dist/{SidePanels-VxSXXkt_.js → SidePanels-TuKVMKxP.js} +3 -3
  16. package/dist/{SidePanels-Gq2LdVuY.cjs → SidePanels-znlH133C.cjs} +1 -1
  17. package/dist/{Topbar-5zbOSGF6.js → Topbar-VCFW9uNI.js} +1 -1
  18. package/dist/{UnsplashImages-4WAWgA4s.js → UnsplashImages-N9h0avWO.js} +1 -1
  19. package/dist/{UploadImages-PONIHtn6.js → UploadImages-e70AeNGX.js} +1 -1
  20. package/dist/{add-page-modal-jWcp0w-S.cjs → add-page-modal-PhWtC-ZY.cjs} +1 -1
  21. package/dist/{add-page-modal-4VrFvgEm.js → add-page-modal-Q3c1EOw1.js} +5 -5
  22. package/dist/{confirm-alert-j7b88hsW.js → confirm-alert-EDOFRmH8.js} +1 -1
  23. package/dist/core.cjs +1 -1
  24. package/dist/core.js +2 -2
  25. package/dist/defaultTheme-9e2np_iI.cjs +1 -0
  26. package/dist/{defaultTheme-D8B4-wHO.js → defaultTheme-ocvEtKQ3.js} +14 -5
  27. package/dist/{delete-page-modal--xHHdRAq.js → delete-page-modal-9B7603s-.js} +4 -4
  28. package/dist/{delete-page-modal-p6b0upz4.cjs → delete-page-modal-eh0Afqbu.cjs} +1 -1
  29. package/dist/email.cjs +1 -1
  30. package/dist/email.js +2 -2
  31. package/dist/{form-_GJb9YcB.js → form-yw3Uuk6v.js} +1 -1
  32. package/dist/html-to-json-Xhu27KFD.cjs +1 -0
  33. package/dist/{html-to-json-LJyJsnmZ.js → html-to-json-ZV4QjSww.js} +53 -52
  34. package/dist/{index-KArv7pNz.cjs → index-B1EMostm.cjs} +1 -1
  35. package/dist/{index-0QJwevON.js → index-FVtnWx9d.js} +2 -2
  36. package/dist/{index-UHaqEdws.js → index-HiiWSXkE.js} +9 -9
  37. package/dist/{index-Eb5zyh2F.js → index-TXu6kBv9.js} +4 -4
  38. package/dist/{index-mlMvwv2b.cjs → index-tFX6mX_R.cjs} +1 -1
  39. package/dist/lib.cjs +3 -3
  40. package/dist/lib.d.ts +2 -0
  41. package/dist/lib.js +83 -81
  42. package/dist/{page-viewer-00Xx4u8e.js → page-viewer-3UIfb9p1.js} +5 -5
  43. package/dist/{page-viewer-SZNm7b1n.cjs → page-viewer-wVQGkDJd.cjs} +1 -1
  44. package/dist/{project-general-setting-asDxlmhZ.js → project-general-setting-8vqXfr75.js} +5 -5
  45. package/dist/{project-general-setting-C_pHNuZE.cjs → project-general-setting-LrABWutT.cjs} +1 -1
  46. package/dist/{project-seo-setting-DuAaDfDR.js → project-seo-setting-x3peNgla.js} +2 -2
  47. package/dist/render.cjs +1 -1
  48. package/dist/render.d.ts +2 -0
  49. package/dist/render.js +76 -74
  50. package/dist/{single-page-detail-oqj6zsLU.cjs → single-page-detail-76C_iDiS.cjs} +1 -1
  51. package/dist/{single-page-detail-UNxXvhl4.js → single-page-detail-py5_WxGu.js} +12 -12
  52. package/dist/studio.cjs +1 -1
  53. package/dist/studio.js +4 -4
  54. package/dist/tailwind.cjs +1 -1
  55. package/dist/tailwind.d.ts +37 -0
  56. package/dist/tailwind.js +102 -11
  57. package/dist/ui.js +7 -7
  58. package/dist/{useCanvasSettings-R6br4J9i.js → useCanvasSettings-unTQUdlP.js} +1 -1
  59. package/dist/web-blocks.cjs +4 -4
  60. package/dist/web-blocks.js +232 -216
  61. package/package.json +2 -2
  62. package/dist/Settings-G9Xtqr7n.cjs +0 -1
  63. package/dist/defaultTheme-7VqqhOcp.cjs +0 -1
  64. package/dist/html-to-json-vP1ESB_e.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),t=require("lodash-es"),y=require("jotai"),v=require("react-i18next"),s=require("./index-12HbDLon.cjs"),B=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),q=require("flagged"),R=require("./STRINGS-gPz7CUOk.cjs"),N=require("lucide-react"),C=require("./html-to-json-vP1ESB_e.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-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("himalaya");const T=({block:r})=>{const{type:i,icon:u,label:c}=r,{addCoreBlock:m,addPredefinedBlock:d}=s.useAddBlock(),[x,o]=s.useSelectedBlockIds(),[,j]=s.useHighlightBlockId(),[,p]=y.useAtom(s.activePanelAtom),l=()=>{if(t.has(r,"blocks")){const h=t.isFunction(r.blocks)?r.blocks():r.blocks;d(b.syncBlocksWithDefaults(h),t.first(x))}else m(r,t.first(x));p(R.OUTLINE_KEY)},a=q.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:l,type:"button",onDragStart:h=>{h.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{o([]),j(null),p(R.OUTLINE_KEY)},200)},draggable:a?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(a?"cursor-grab":"cursor-pointer"),children:[n.createElement(u||B.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:c||i})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||i})})]})})},A=({block:r,closePopover:i})=>{const[u,c]=n.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock",t.noop()),{addCoreBlock:d,addPredefinedBlock:x}=s.useAddBlock(),[o]=s.useSelectedBlockIds(),j=n.useCallback(async p=>{if(p.stopPropagation(),t.has(r,"component")){d(r,t.first(o)),i();return}c(!0);const l=await m(r);t.isEmpty(l)||x(b.syncBlocksWithDefaults(l),t.first(o)),i()},[r]);return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:u?()=>{}:j,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[u&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(N.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})})},w=()=>{const{data:r}=s.useUILibraryBlocks(),i=b.useChaiBlocks(),u=t.filter(t.values(i),{category:"custom"}),c=t.groupBy(u,"group"),m=t.groupBy(r,"group"),d=n.useMemo(()=>t.mergeWith(c,m,(l,a)=>{if(t.isArray(l)&&t.isArray(a))return[...l,...a]}),[c,m]),[x,o]=n.useState(t.first(t.keys(d))||""),[,j]=y.useAtom(s.activePanelAtom),p=t.get(d,x,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex w-full items-center p-3",children:e.jsxRuntimeExports.jsxs(s.Select,{value:x,onValueChange:l=>o(l),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),n.Children.toArray(t.map(d,(l,a)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:a,children:a},a)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:n.Children.toArray(p.map(l=>e.jsxRuntimeExports.jsx(A,{block:l,closePopover:()=>j(R.OUTLINE_KEY)})))})]})},S=()=>{const{t:r}=v.useTranslation(),[i,u]=n.useState(""),{addPredefinedBlock:c}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,d]=y.useAtom(s.activePanelAtom),x=()=>{const o=C.getBlocksFromHTML(i);c([...o],t.first(m)||null),u(""),d(R.OUTLINE_KEY)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:o=>o&&o.focus(),onChange:o=>u(o.target.value),rows:12,value:i,placeholder:r("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:i.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 border-none p-1 text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},_=()=>{const{t:r}=v.useTranslation(),[i,u]=n.useState("core"),[c,m]=n.useState("basic"),d=b.useChaiBlocks(),[,x]=y.useAtom(s.showPredefinedBlockCategoryAtom),o=s.useBuilderProp("importHTMLSupport",!0),j=s.useBuilderProp("filterChaiBlock",()=>!0),{data:p,isLoading:l}=s.useUILibraryBlocks(),a=t.filter(d,j),h=t.groupBy(a,"category"),g=t.uniq(t.map(h.core,"group"));n.useEffect(()=>{!t.includes(g,c)&&!t.isEmpty(g)&&!t.isEmpty(c)&&m(t.first(g))},[g,c]);const E=!l&&!t.isEmpty(p)||t.find(t.values(a),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-72 flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(i==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:f=>{x(""),u(f)},value:i,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(E&&o?"grid-cols-3":E&&!o||!E&&o?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("Blocks")}),E?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("ui_library")}):null,o?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),i==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:n.Children.toArray(t.map(g,f=>t.reject(t.filter(t.values(h.core),{group:f}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:f,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:f,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:f}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:n.Children.toArray(t.reject(t.filter(t.values(h.core),{group:f}),{hidden:!0}).map(k=>e.jsxRuntimeExports.jsx(T,{block:k})))})})]})}):null))})}),i==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(w,{})}),i==="html"&&o?e.jsxRuntimeExports.jsx(S,{}):null]})};exports.default=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),n=require("react"),t=require("lodash-es"),y=require("jotai"),v=require("react-i18next"),s=require("./index-12HbDLon.cjs"),B=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),q=require("flagged"),R=require("./STRINGS-gPz7CUOk.cjs"),N=require("lucide-react"),C=require("./html-to-json-Xhu27KFD.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-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("himalaya");const T=({block:r})=>{const{type:i,icon:u,label:c}=r,{addCoreBlock:m,addPredefinedBlock:d}=s.useAddBlock(),[x,o]=s.useSelectedBlockIds(),[,j]=s.useHighlightBlockId(),[,p]=y.useAtom(s.activePanelAtom),l=()=>{if(t.has(r,"blocks")){const h=t.isFunction(r.blocks)?r.blocks():r.blocks;d(b.syncBlocksWithDefaults(h),t.first(x))}else m(r,t.first(x));p(R.OUTLINE_KEY)},a=q.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:l,type:"button",onDragStart:h=>{h.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{o([]),j(null),p(R.OUTLINE_KEY)},200)},draggable:a?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(a?"cursor-grab":"cursor-pointer"),children:[n.createElement(u||B.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:c||i})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||i})})]})})},A=({block:r,closePopover:i})=>{const[u,c]=n.useState(!1),m=s.useBuilderProp("getExternalPredefinedBlock",t.noop()),{addCoreBlock:d,addPredefinedBlock:x}=s.useAddBlock(),[o]=s.useSelectedBlockIds(),j=n.useCallback(async p=>{if(p.stopPropagation(),t.has(r,"component")){d(r,t.first(o)),i();return}c(!0);const l=await m(r);t.isEmpty(l)||x(b.syncBlocksWithDefaults(l),t.first(o)),i()},[r]);return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:u?()=>{}:j,className:"relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[u&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(N.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?e.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:r.label}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:r.label})})]})})},w=()=>{const{data:r}=s.useUILibraryBlocks(),i=b.useChaiBlocks(),u=t.filter(t.values(i),{category:"custom"}),c=t.groupBy(u,"group"),m=t.groupBy(r,"group"),d=n.useMemo(()=>t.mergeWith(c,m,(l,a)=>{if(t.isArray(l)&&t.isArray(a))return[...l,...a]}),[c,m]),[x,o]=n.useState(t.first(t.keys(d))||""),[,j]=y.useAtom(s.activePanelAtom),p=t.get(d,x,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex w-full items-center p-3",children:e.jsxRuntimeExports.jsxs(s.Select,{value:x,onValueChange:l=>o(l),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Select a provider"})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:"Choose"}),n.Children.toArray(t.map(d,(l,a)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:a,children:a},a)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:n.Children.toArray(p.map(l=>e.jsxRuntimeExports.jsx(A,{block:l,closePopover:()=>j(R.OUTLINE_KEY)})))})]})},S=()=>{const{t:r}=v.useTranslation(),[i,u]=n.useState(""),{addPredefinedBlock:c}=s.useAddBlock(),[m]=s.useSelectedBlockIds(),[,d]=y.useAtom(s.activePanelAtom),x=()=>{const o=C.getBlocksFromHTML(i);c([...o],t.first(m)||null),u(""),d(R.OUTLINE_KEY)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:o=>o&&o.focus(),onChange:o=>u(o.target.value),rows:12,value:i,placeholder:r("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:i.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 border-none p-1 text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},_=()=>{const{t:r}=v.useTranslation(),[i,u]=n.useState("core"),[c,m]=n.useState("basic"),d=b.useChaiBlocks(),[,x]=y.useAtom(s.showPredefinedBlockCategoryAtom),o=s.useBuilderProp("importHTMLSupport",!0),j=s.useBuilderProp("filterChaiBlock",()=>!0),{data:p,isLoading:l}=s.useUILibraryBlocks(),a=t.filter(d,j),h=t.groupBy(a,"category"),g=t.uniq(t.map(h.core,"group"));n.useEffect(()=>{!t.includes(g,c)&&!t.isEmpty(g)&&!t.isEmpty(c)&&m(t.first(g))},[g,c]);const E=!l&&!t.isEmpty(p)||t.find(t.values(a),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-72 flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(i==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:f=>{x(""),u(f)},value:i,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(E&&o?"grid-cols-3":E&&!o||!E&&o?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("Blocks")}),E?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:r("ui_library")}):null,o?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),i==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:n.Children.toArray(t.map(g,f=>t.reject(t.filter(t.values(h.core),{group:f}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:f,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:f,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:f}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:n.Children.toArray(t.reject(t.filter(t.values(h.core),{group:f}),{hidden:!0}).map(k=>e.jsxRuntimeExports.jsx(T,{block:k})))})})]})}):null))})}),i==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(w,{})}),i==="html"&&o?e.jsxRuntimeExports.jsx(S,{}):null]})};exports.default=_;
@@ -3,13 +3,13 @@ import y, { createElement as D, useState as g, useCallback as O, useMemo as U, u
3
3
  import { has as F, isFunction as W, first as h, omit as Y, noop as J, isEmpty as b, filter as v, values as k, groupBy as w, mergeWith as K, isArray as L, keys as Q, get as X, map as A, uniq as Z, includes as $, find as ee, reject as I } from "lodash-es";
4
4
  import { useAtom as N } from "jotai";
5
5
  import { useTranslation as H } from "react-i18next";
6
- import { L as _, r as S, Y as se, at as P, ap as te, aq as re, ar as oe, h as T, a3 as G, aj as le, ak as ae, al as ce, am as ie, an as E, bo as ne, bp as de, bq as me, br as pe, aB as ue, bs as xe, bt as he, B as fe, bu as ge, bv as je, bw as be, au as ve, av as ke, aw as C, bh as ye, bb as Be, bc as Ne, bd as Ce, be as we, S as Ae } from "./index-UHaqEdws.js";
6
+ import { L as _, r as S, Y as se, at as P, ap as te, aq as re, ar as oe, h as T, a3 as G, aj as le, ak as ae, al as ie, am as ce, an as E, bo as ne, bp as de, bq as me, br as pe, aB as ue, bs as xe, bt as he, B as fe, bu as ge, bv as je, bw as be, au as ve, av as ke, aw as C, bi as ye, bb as Be, bc as Ne, bd as Ce, be as we, S as Ae } from "./index-HiiWSXkE.js";
7
7
  import { BoxIcon as Te } from "@radix-ui/react-icons";
8
8
  import { syncBlocksWithDefaults as M, useChaiBlocks as q } from "@chaibuilder/runtime";
9
9
  import { useFeature as _e } from "flagged";
10
10
  import { O as B } from "./STRINGS--j49GZJP.js";
11
11
  import { Loader as Se } from "lucide-react";
12
- import { g as Pe } from "./html-to-json-LJyJsnmZ.js";
12
+ import { g as Pe } from "./html-to-json-ZV4QjSww.js";
13
13
  import "./_commonjsHelpers-UyOWmZb0.js";
14
14
  import "./Functions-7jnEwJyw.js";
15
15
  import "clsx";
@@ -42,10 +42,10 @@ import "react-dom";
42
42
  import "react-quill";
43
43
  import "himalaya";
44
44
  const Le = ({ block: s }) => {
45
- const { type: r, icon: c, label: l } = s, { addCoreBlock: d, addPredefinedBlock: i } = _(), [n, t] = S(), [, p] = se(), [, m] = N(P), o = () => {
45
+ const { type: r, icon: i, label: l } = s, { addCoreBlock: d, addPredefinedBlock: c } = _(), [n, t] = S(), [, p] = se(), [, m] = N(P), o = () => {
46
46
  if (F(s, "blocks")) {
47
47
  const u = W(s.blocks) ? s.blocks() : s.blocks;
48
- i(M(u), h(n));
48
+ c(M(u), h(n));
49
49
  } else
50
50
  d(s, h(n));
51
51
  m(B);
@@ -64,7 +64,7 @@ const Le = ({ block: s }) => {
64
64
  draggable: a ? "true" : "false",
65
65
  className: "space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 " + (a ? "cursor-grab" : "cursor-pointer"),
66
66
  children: [
67
- D(c || Te, { className: "w-4 h-4 mx-auto" }),
67
+ D(i || Te, { className: "w-4 h-4 mx-auto" }),
68
68
  /* @__PURE__ */ e.jsx("p", { className: "text-xs", children: l || r })
69
69
  ]
70
70
  }
@@ -72,10 +72,10 @@ const Le = ({ block: s }) => {
72
72
  /* @__PURE__ */ e.jsx(oe, { children: /* @__PURE__ */ e.jsx("p", { children: l || r }) })
73
73
  ] }) });
74
74
  }, Ie = ({ block: s, closePopover: r }) => {
75
- const [c, l] = g(!1), d = T("getExternalPredefinedBlock", J()), { addCoreBlock: i, addPredefinedBlock: n } = _(), [t] = S(), p = O(
75
+ const [i, l] = g(!1), d = T("getExternalPredefinedBlock", J()), { addCoreBlock: c, addPredefinedBlock: n } = _(), [t] = S(), p = O(
76
76
  async (m) => {
77
77
  if (m.stopPropagation(), F(s, "component")) {
78
- i(s, h(t)), r();
78
+ c(s, h(t)), r();
79
79
  return;
80
80
  }
81
81
  l(!0);
@@ -87,11 +87,11 @@ const Le = ({ block: s }) => {
87
87
  return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
88
88
  "div",
89
89
  {
90
- onClick: c ? () => {
90
+ onClick: i ? () => {
91
91
  } : p,
92
92
  className: "relative cursor-pointer overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
93
93
  children: [
94
- c && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
94
+ i && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
95
95
  /* @__PURE__ */ e.jsx(Se, { className: "animate-spin", size: 15, color: "white" }),
96
96
  " ",
97
97
  /* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
@@ -108,17 +108,17 @@ const Le = ({ block: s }) => {
108
108
  }
109
109
  ) });
110
110
  }, Ee = () => {
111
- const { data: s } = G(), r = q(), c = v(k(r), { category: "custom" }), l = w(c, "group"), d = w(s, "group"), i = U(() => K(l, d, (o, a) => {
111
+ const { data: s } = G(), r = q(), i = v(k(r), { category: "custom" }), l = w(i, "group"), d = w(s, "group"), c = U(() => K(l, d, (o, a) => {
112
112
  if (L(o) && L(a))
113
113
  return [...o, ...a];
114
- }), [l, d]), [n, t] = g(h(Q(i)) || ""), [, p] = N(P), m = X(i, n, []);
114
+ }), [l, d]), [n, t] = g(h(Q(c)) || ""), [, p] = N(P), m = X(c, n, []);
115
115
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden py-2", children: [
116
116
  /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex w-full items-center p-3", children: /* @__PURE__ */ e.jsxs(le, { value: n, onValueChange: (o) => t(o), children: [
117
- /* @__PURE__ */ e.jsx(ae, { className: "w-full", children: /* @__PURE__ */ e.jsx(ce, { placeholder: "Select a provider" }) }),
118
- /* @__PURE__ */ e.jsxs(ie, { children: [
117
+ /* @__PURE__ */ e.jsx(ae, { className: "w-full", children: /* @__PURE__ */ e.jsx(ie, { placeholder: "Select a provider" }) }),
118
+ /* @__PURE__ */ e.jsxs(ce, { children: [
119
119
  /* @__PURE__ */ e.jsx(E, { value: "", children: "Choose" }),
120
120
  y.Children.toArray(
121
- A(i, (o, a) => /* @__PURE__ */ e.jsx(E, { value: a, children: a }, a))
121
+ A(c, (o, a) => /* @__PURE__ */ e.jsx(E, { value: a, children: a }, a))
122
122
  )
123
123
  ] })
124
124
  ] }) }),
@@ -127,9 +127,9 @@ const Le = ({ block: s }) => {
127
127
  ) })
128
128
  ] });
129
129
  }, Fe = () => {
130
- const { t: s } = H(), [r, c] = g(""), { addPredefinedBlock: l } = _(), [d] = S(), [, i] = N(P), n = () => {
130
+ const { t: s } = H(), [r, i] = g(""), { addPredefinedBlock: l } = _(), [d] = S(), [, c] = N(P), n = () => {
131
131
  const t = Pe(r);
132
- l([...t], h(d) || null), c(""), i(B);
132
+ l([...t], h(d) || null), i(""), c(B);
133
133
  };
134
134
  return /* @__PURE__ */ e.jsxs(ne, { className: "border-border/0 p-0 shadow-none", children: [
135
135
  /* @__PURE__ */ e.jsx(de, { className: "p-3", children: /* @__PURE__ */ e.jsx(me, { children: s("html_snippet_description") }) }),
@@ -141,7 +141,7 @@ const Le = ({ block: s }) => {
141
141
  autoFocus: !0,
142
142
  tabIndex: 1,
143
143
  ref: (t) => t && t.focus(),
144
- onChange: (t) => c(t.target.value),
144
+ onChange: (t) => i(t.target.value),
145
145
  rows: 12,
146
146
  value: r,
147
147
  placeholder: s("enter_code_snippet"),
@@ -155,7 +155,7 @@ const Le = ({ block: s }) => {
155
155
  ] })
156
156
  ] });
157
157
  }, Cs = () => {
158
- const { t: s } = H(), [r, c] = g("core"), [l, d] = g("basic"), i = q(), [, n] = N(be), t = T("importHTMLSupport", !0), p = T("filterChaiBlock", () => !0), { data: m, isLoading: o } = G(), a = v(i, p), u = w(a, "category"), f = Z(A(u.core, "group"));
158
+ const { t: s } = H(), [r, i] = g("core"), [l, d] = g("basic"), c = q(), [, n] = N(be), t = T("importHTMLSupport", !0), p = T("filterChaiBlock", () => !0), { data: m, isLoading: o } = G(), a = v(c, p), u = w(a, "category"), f = Z(A(u.core, "group"));
159
159
  V(() => {
160
160
  !$(f, l) && !b(f) && !b(l) && d(h(f));
161
161
  }, [f, l]);
@@ -169,7 +169,7 @@ const Le = ({ block: s }) => {
169
169
  ve,
170
170
  {
171
171
  onValueChange: (x) => {
172
- n(""), c(x);
172
+ n(""), i(x);
173
173
  },
174
174
  value: r,
175
175
  className: "h-max",
@@ -2,7 +2,7 @@ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import * as c from "react";
3
3
  import N from "@rjsf/validator-ajv8";
4
4
  import j from "@rjsf/core";
5
- import { h as k, F as D, bD as w } from "./index-UHaqEdws.js";
5
+ import { h as k, F as D, bD as w } from "./index-HiiWSXkE.js";
6
6
  import { s as f, c as P, f as a } from "./controls-OfJWSEqC.js";
7
7
  import { debounce as R, noop as F, isEqual as L } from "lodash-es";
8
8
  import "./_commonjsHelpers-UyOWmZb0.js";
@@ -1,6 +1,6 @@
1
- "use strict";var ne=Object.defineProperty;var oe=(o,n,e)=>n in o?ne(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e;var C=(o,n,e)=>(oe(o,typeof n!="symbol"?n+"":n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),h=require("react"),a=require("lodash-es"),k=require("@radix-ui/react-icons"),i=require("./index-12HbDLon.cjs"),T=require("react-i18next"),E=require("jotai"),H=require("react-dom"),b=require("prop-types"),re=require("react-quill"),K=require("flagged"),ie=require("@floating-ui/dom"),O=require("@floating-ui/react-dom"),le=require("@react-hookz/web"),ce=require("@bobthered/tailwindcss-palette-generator"),ae=require("@tailwindcss/typography"),de=require("@tailwindcss/forms"),ue=require("@tailwindcss/aspect-ratio"),pe=require("react-wrap-balancer"),he=require("tailwind-merge"),_=require("./STRINGS-gPz7CUOk.cjs"),xe=require("@chaibuilder/runtime"),P=require("./index-mlMvwv2b.cjs"),me=require("./useCanvasSettings-MR0Glu1b.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-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("i18next");require("react-hotkeys-hook");const ge=()=>{const{hasUndo:o,hasRedo:n,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(k.ResetIcon,{})}),r.jsxRuntimeExports.jsx(i.Button,{disabled:!n(),onClick:t,size:"sm",className:"rounded-full",variant:"ghost",children:r.jsxRuntimeExports.jsx(k.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function fe(){const[o,n]=i.useDarkMode(),{t:e}=T.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:()=>{n(!o)},className:`${o?"bg-violet-600":"bg-violet-300"}
1
+ "use strict";var ne=Object.defineProperty;var oe=(o,n,e)=>n in o?ne(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e;var C=(o,n,e)=>(oe(o,typeof n!="symbol"?n+"":n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),h=require("react"),a=require("lodash-es"),k=require("@radix-ui/react-icons"),i=require("./index-12HbDLon.cjs"),M=require("react-i18next"),E=require("jotai"),H=require("react-dom"),b=require("prop-types"),re=require("react-quill"),K=require("flagged"),ie=require("@floating-ui/dom"),O=require("@floating-ui/react-dom"),le=require("@react-hookz/web"),ce=require("tailwindcss-palette-generator"),ae=require("@tailwindcss/typography"),de=require("@tailwindcss/forms"),ue=require("@tailwindcss/aspect-ratio"),pe=require("react-wrap-balancer"),he=require("tailwind-merge"),_=require("./STRINGS-gPz7CUOk.cjs"),xe=require("@chaibuilder/runtime"),P=require("./index-tFX6mX_R.cjs"),me=require("./useCanvasSettings-MR0Glu1b.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-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("i18next");require("react-hotkeys-hook");const ge=()=>{const{hasUndo:o,hasRedo:n,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(k.ResetIcon,{})}),r.jsxRuntimeExports.jsx(i.Button,{disabled:!n(),onClick:t,size:"sm",className:"rounded-full",variant:"ghost",children:r.jsxRuntimeExports.jsx(k.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function fe(){const[o,n]=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:()=>{n(!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 U=({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"}})]}),ve=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:r.jsxRuntimeExports.jsx(k.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:r.jsxRuntimeExports.jsx(k.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:r.jsxRuntimeExports.jsx(U,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:r.jsxRuntimeExports.jsx(U,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:r.jsxRuntimeExports.jsx(k.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:r.jsxRuntimeExports.jsx(k.DesktopIcon,{}),width:1920}],z=({title:o,content:n,currentBreakpoint:e,breakpoint:t,width:s,icon:p,onClick:c})=>{const{t:l}=T.useTranslation();return r.jsxRuntimeExports.jsxs(i.HoverCard,{children:[r.jsxRuntimeExports.jsx(i.HoverCardTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsx(i.Button,{onClick:()=>c(s),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(n)})]})})})]})},$e=()=>{const[,o,n]=i.useCanvasWidth(),[e,t]=i.useSelectedBreakpoints(),{t:s}=T.useTranslation(),p=i.useBuilderProp("breakpoints",ve),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(z,{...l,onClick:n,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(z,{...l,onClick:n,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(k.DotsVerticalIcon,{className:"scale-90 transform"})})}),r.jsxRuntimeExports.jsxs(i.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[r.jsxRuntimeExports.jsx(i.DropdownMenuLabel,{children:s("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:s(l.title)},l.breakpoint))]})]})]})},je=()=>{const{t:o}=T.useTranslation(),{setNewBlocks:n}=i.useBlocksStoreUndoableActions(),[,e]=i.useSelectedBlockIds(),[,t]=i.useSelectedStylingBlocks(),s=h.useCallback(()=>{n([]),e([]),t([])},[n]);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(k.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:s,children:o("yes")})]})]})]})})},ye=()=>{const o=i.useBuilderProp("darkMode",!1),[n]=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(fe,{}),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 items-center justify-center gap-x-1 space-x-0 font-medium",children:[r.jsxRuntimeExports.jsx(k.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",r.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[a.round(n,0),"%"]})]}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(ge,{})]}),r.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(je,{})]})]})},be=`<!doctype html>
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 U=({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"}})]}),ve=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:r.jsxRuntimeExports.jsx(k.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:r.jsxRuntimeExports.jsx(k.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:r.jsxRuntimeExports.jsx(U,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:r.jsxRuntimeExports.jsx(U,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:r.jsxRuntimeExports.jsx(k.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:r.jsxRuntimeExports.jsx(k.DesktopIcon,{}),width:1920}],z=({title:o,content:n,currentBreakpoint:e,breakpoint:t,width:s,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(s),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(n)})]})})})]})},$e=()=>{const[,o,n]=i.useCanvasWidth(),[e,t]=i.useSelectedBreakpoints(),{t:s}=M.useTranslation(),p=i.useBuilderProp("breakpoints",ve),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(z,{...l,onClick:n,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(z,{...l,onClick:n,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(k.DotsVerticalIcon,{className:"scale-90 transform"})})}),r.jsxRuntimeExports.jsxs(i.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[r.jsxRuntimeExports.jsx(i.DropdownMenuLabel,{children:s("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:s(l.title)},l.breakpoint))]})]})]})},je=()=>{const{t:o}=M.useTranslation(),{setNewBlocks:n}=i.useBlocksStoreUndoableActions(),[,e]=i.useSelectedBlockIds(),[,t]=i.useSelectedStylingBlocks(),s=h.useCallback(()=>{n([]),e([]),t([])},[n]);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(k.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:s,children:o("yes")})]})]})]})})},ye=()=>{const o=i.useBuilderProp("darkMode",!1),[n]=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(fe,{}),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 items-center justify-center gap-x-1 space-x-0 font-medium",children:[r.jsxRuntimeExports.jsx(k.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",r.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[a.round(n,0),"%"]})]}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(ge,{})]}),r.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(je,{})]})]})},be=`<!doctype html>
4
4
  <html class="scroll-smooth h-full overflow-y-auto">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -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>`,ke=o=>{const[n]=i.useCanvasWidth(),[,e]=i.useCanvasZoom(),[t,s]=h.useState({}),p=h.useCallback(()=>{const{width:c,height:l}=o;if(c<n){const d=parseFloat((c/n).toFixed(2).toString());let u={};const x=l*d;l&&(u={height:100+(l-x)/x*100+"%"}),s({position:"relative",top:0,transform:`scale(${d})`,transformOrigin:"top left",...u,maxWidth:"none"}),e(d*100)}else s({}),e(100)},[n,o,e]);return h.useEffect(()=>{p()},[n,o,e,p]),t};let Y,Z;typeof document<"u"&&(Y=document);typeof window<"u"&&(Z=window);const G=h.createContext({document:Y,window:Z}),M=()=>h.useContext(G),{Provider:Ee,Consumer:Ve}=G;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:b.element.isRequired,contentDidMount:b.func.isRequired,contentDidUpdate:b.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,s=this.props.contentDidUpdate,p=e.defaultView||e.parentView,c=r.jsxRuntimeExports.jsx(Q,{contentDidMount:t,contentDidUpdate:s,children:r.jsxRuntimeExports.jsx(Ee,{value:{document:e,window:p},children:r.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),l=this.getMountTarget();return[H.createPortal(this.props.head,this.getDoc().head),H.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:b.object,head:b.node,initialContent:b.string,mountTarget:b.string,contentDidMount:b.func,contentDidUpdate:b.func,children:b.oneOfType([b.element,b.arrayOf(b.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,n)=>r.jsxRuntimeExports.jsx(q,{...o,forwardedRef:n})),Re=()=>{const{addCoreBlock:o}=i.useAddBlock(),n=i.useBuilderProp("getExternalPredefinedBlock",a.noop);return h.useCallback(async e=>{const{block:t,dropTargetId:s,relativeIndex:p}=e;if(a.has(t,"format")){const c=await n(t);return o({blocks:c},s===0?null:s,p)}return o(t,s===0?null:s,p)},[o])};let R=null,A=[],D=null,J=null;function Se(o){const n=window.getComputedStyle(o),e=parseInt(n.paddingLeft,10),t=parseInt(n.paddingTop,10),s=parseInt(n.paddingRight,10),p=parseInt(n.paddingBottom,10);return{paddingLeft:e,paddingTop:t,paddingRight:s,paddingBottom:p}}const W=(o,n,e)=>{if(!R)return;const t=o.getBoundingClientRect(),s=R==null?void 0:R.getElementById("placeholder"),{paddingLeft:p,paddingTop:c,paddingRight:l,paddingBottom:d}=Se(o);s.style.width=n==="vertical"?t.width-p-l+"px":"2px",s.style.height=n==="vertical"?"2px":t.height-c-d+"px",s.style.display="block";const u=A.reduce((x,f)=>Math.abs(f-e)<Math.abs(x-e)?f:x);J=A.indexOf(u),n==="vertical"?(s.style.top=o.offsetTop+u+"px",s.style.left=o.offsetLeft+p+"px"):(s.style.top=o.offsetTop+c+"px",s.style.left=o.offsetLeft+u+"px")},Be=o=>{const n=X(o),e=window.getComputedStyle(o),t=n==="horizontal",s=parseInt(e.paddingLeft),p=parseInt(e.paddingTop);let c=t?s:p;A=[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;A.push(c+x+u),c+=x+u})};function X(o){const n=window.getComputedStyle(o).display,e=window.getComputedStyle(o).flexDirection;if(n==="flex")return e==="column"||e==="column-reverse"?"vertical":"horizontal";if(n==="grid"){const t=window.getComputedStyle(o).gridTemplateRows,s=window.getComputedStyle(o).gridTemplateColumns;if(t.includes("auto"))return"vertical";if(s.includes("auto"))return"horizontal"}return n==="block"?"vertical":"horizontal"}const Ce=a.throttle(o=>{const n=o.target,e=X(n);if(e==="vertical"){const t=o.clientY-n.offsetTop;W(n,e,t)}else{const t=o.clientX-n.offsetLeft;W(n,e,t)}},200),Ie=o=>{o.preventDefault(),o.stopPropagation(),Ce(o)};function N(){const o=R==null?void 0:R.getElementById("placeholder");o.style.display="none"}const De=()=>{const{document:o}=M(),[n,e]=E.useAtom(i.draggingFlagAtom),t=Re(),s=K.useFeature("dnd"),[,p]=i.useHighlightBlockId(),[,c]=i.useSelectedBlockIds();return R=o,{isDragging:n,"data-dnd":"branch",onDragOver:s?Ie:a.noop,onDrop:s?l=>{D==null||D.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),N(),setTimeout(()=>{N()},300)}:a.noop,onDragEnter:s?l=>{const d=l;D=d.target,d.stopPropagation(),d.preventDefault(),A=[];const u=d.target;Be(u),u.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),e(!0),p(""),c([])}:a.noop,onDragLeave:s?l=>{const d=l;D=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:a.noop,onMouseOut:s?()=>{e(!1),N()}:a.noop}};function F(o){return o.getAttribute("data-block-id")?o:o.closest("[data-block-id]")}function Ae(o){o.container.innerHTML="",o.container.parentNode.removeChild(o.container);var n=document.querySelector(".ql-toolbar");n&&n.parentNode.removeChild(n),o=null}const _e=()=>{const o=["Heading","Paragraph","Text","Link","Span","Button"],n=i.useUpdateBlocksProps(),[,e]=i.useHighlightBlockId(),[t,s]=E.useAtom(i.inlineEditingActiveAtom);return p=>{var f;if(t)return;const c=F(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());n([c.getAttribute("data-block-id")],{content:g}),c.removeAttribute("style"),d.removeEventListener("blur",x,!0),Ae(u),s(""),e("")}d.addEventListener("blur",x,!0),u.focus(),(f=d.querySelector(".ql-clipboard"))==null||f.remove(),s(c.getAttribute("data-block-id"))}},Te=()=>{const[,o]=i.useSelectedStylingBlocks(),[,n]=i.useSelectedBlockIds(),[,e]=i.useHighlightBlockId(),[t]=E.useAtom(i.inlineEditingActiveAtom),[s]=E.useAtom(i.treeRefAtom);return p=>{if(t)return;s.closeAll(),p.stopPropagation();const c=F(p.target);if(c!=null&&c.getAttribute("data-block-id")&&(c==null?void 0:c.getAttribute("data-block-id"))==="container"){n([]),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}]),n([u])}else c!=null&&c.getAttribute("data-block-id")&&n([c.getAttribute("data-block-id")]);e("")}},Me=a.throttle((o,n)=>{const e=F(o.target);e!=null&&e.getAttribute("data-style-id")&&n(e.getAttribute("data-style-id"))},100),Ne=()=>{const[,o]=i.useHighlightBlockId(),[n]=E.useAtom(i.inlineEditingActiveAtom);return e=>{n||Me(e,o)}},qe=({children:o})=>{const{document:n}=M(),[e]=i.useSelectedBlockIds(),[t,s]=i.useSelectedStylingBlocks();h.useEffect(()=>{setTimeout(()=>{if(!a.isEmpty(t))return;const u=V(n,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");s([{id:f,prop:x,blockId:g}])}}},100)},[n,e,s,t]);const p=_e(),c=Te(),l=Ne(),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})},V=(o,n)=>o.querySelector(`[data-block-id="${n}"]`),Le=()=>{const{window:o}=M(),[n,e]=i.useSelectedBlockIds(),[t]=i.useBlocksStore(),[,s]=i.useSelectedStylingBlocks(),{undo:p,redo:c}=i.useUndoManager(),l=i.useDuplicateBlocks(),[,d]=i.usePreviewMode(),u=i.useRemoveBlocks(),{savePage:x}=i.useSavePage(),[f]=E.useAtom(i.inlineEditingActiveAtom),[,g]=E.useAtom(i.editLayerNameAtom),y=v=>{v.key==="Enter"&&(v.preventDefault(),n.length===1&&g(a.first(n)))},w=v=>{const m=t.find(j=>j._id===v);return m?m._parent:null};return h.useEffect(()=>{const v=m=>{if(m.key==="Escape"){e([]),s([]);return}if(y(m),!f&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),u(n)),m.ctrlKey||m.metaKey){if(m.key==="ArrowUp"){m.preventDefault();const j=n.length>0?w(n[0]):null;j&&e([j])}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(n)}};return o.removeEventListener("keydown",v),o.addEventListener("keydown",v),()=>{o.removeEventListener("keydown",v)}},[n,e,p,u,d,c,l,f,x,o]),null},Pe=({block:o,label:n})=>{const[,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[,s]=E.useAtom(i.draggedBlockIdAtom),p=K.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"]))),s(o._id),setTimeout(()=>{e([]),t(null)},200)},children:[r.jsxRuntimeExports.jsx(k.DragHandleDots2Icon,{}),n]})},Fe=({selectedBlockElement:o,block:n})=>{const e=i.useRemoveBlocks(),t=i.useDuplicateBlocks(),[,s]=i.useSelectedBlockIds(),[,p]=i.useSelectedStylingBlocks(),[c]=E.useAtom(i.inlineEditingActiveAtom),{floatingStyles:l,refs:d,update:u}=O.useFloating({placement:"top-start",middleware:[O.shift(),ie.flip()],elements:{reference:o}});le.useResizeObserver(o,()=>u(),o!==null);const x=a.get(n,"_parent",null),f=a.isEmpty(a.get(n,"_name",""))?a.get(n,"_type",""):a.get(n,"_name","");return!o||!n||c?null: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(Pe,{label:f,block:n}),r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[x&&r.jsxRuntimeExports.jsx(k.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{p([]),s([x])}}),i.canDuplicateBlock(a.get(n,"_type",""))?r.jsxRuntimeExports.jsx(k.CopyIcon,{className:"hover:scale-105",onClick:()=>t([n==null?void 0:n._id])}):null,i.canDeleteBlock(a.get(n,"_type",""))?r.jsxRuntimeExports.jsx(k.TrashIcon,{className:"hover:scale-105",onClick:()=>e([n==null?void 0:n._id])}):null]})]})},He=({addVariant:o,e:n})=>{o("hs-dropdown-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open > .${n(`hs-dropdown-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open .hs-dropdown-toggle .${n(`hs-dropdown-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open > .hs-dropdown-menu > .${n(`hs-dropdown-open${t}${s}`)}`)}]),o("hs-removing",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-removing.${n(`hs-removing${t}${s}`)}`)}),o("hs-tooltip-shown",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-tooltip.show .${n(`hs-tooltip-shown${t}${s}`)}`)}),o("hs-accordion-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active.${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-toggle .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-toggle.${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${n(`hs-accordion-active${t}${s}`)}`)}]),o("hs-accordion-selected",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion .selected.${n(`hs-accordion-selected${t}${s}`)}`)}),o("hs-collapse-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse.open .${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse.open.${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse-toggle.open .${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse-toggle.open.${n(`hs-collapse-open${t}${s}`)}`)}]),o("hs-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`[data-hs-tab].active.${n(`hs-tab-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`[data-hs-tab].active .${n(`hs-tab-active${t}${s}`)}`)}]),o("hs-overlay-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.open.${n(`hs-overlay-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.open .${n(`hs-overlay-open${t}${s}`)}`)}]),o("hs-overlay-layout-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-body-open.${n(`hs-overlay-layout-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-body-open .${n(`hs-overlay-layout-open${t}${s}`)}`)}]),o("hs-overlay-backdrop-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-backdrop.${n(`hs-overlay-backdrop-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-backdrop .${n(`hs-overlay-backdrop-open${t}${s}`)}`)}]),o("hs-scrollspy-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-scrollspy-active${t}${s}`)}`)}),o("hs-carousel-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-carousel-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-carousel-active${t}${s}`)}`)}]),o("hs-carousel-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-carousel${t}disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-carousel${t}disabled${t}${s}`)}`)}]),o("hs-selected",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected.${n(`hs-selected${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected .${n(`hs-selected${t}${s}`)}`)}]),o("hs-select-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-select-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-select-disabled${t}${s}`)}`)}]),o("hs-select-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-select-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-select-active${t}${s}`)}`)}]),o("hs-input-number-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-input-number-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-input-number-disabled${t}${s}`)}`)}]),o("hs-pin-input-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-pin-input-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-pin-input-active${t}${s}`)}`)}]),o("hs-select-opened",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.opened.${n(`hs-select-opened${t}${s}`)}`)}]),o("hs-password-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-password-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-password-active${t}${s}`)}`)}]),o("hs-stepper-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-stepper-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-stepper-active${t}${s}`)}`)}]),o("hs-stepper-success",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success.${n(`hs-stepper-success${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success .${n(`hs-stepper-success${t}${s}`)}`)}]),o("hs-stepper-completed",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.completed.${n(`hs-stepper-completed${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.completed .${n(`hs-stepper-completed${t}${s}`)}`)}]),o("hs-stepper-error",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error.${n(`hs-stepper-error${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error .${n(`hs-stepper-error${t}${s}`)}`)}]),o("hs-stepper-processed",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.processed.${n(`hs-stepper-processed${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.processed .${n(`hs-stepper-processed${t}${s}`)}`)}]),o("hs-stepper-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-stepper-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-stepper-disabled${t}${s}`)}`)}]),o("hs-stepper-skipped",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.skipped.${n(`hs-stepper-skipped${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.skipped .${n(`hs-stepper-skipped${t}${s}`)}`)}]),o("hs-strong-password",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.passed.${n(`hs-strong-password${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.passed .${n(`hs-strong-password${t}${s}`)}`)}]),o("hs-strong-password-accepted",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.accepted.${n(`hs-strong-password-accepted${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.accepted .${n(`hs-strong-password-accepted${t}${s}`)}`)}]),o("hs-strong-password-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-strong-password-active${t}${s}`)}`)}]),o("hs-combo-box-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-combo-box-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-combo-box-active${t}${s}`)}`)}]),o("hs-combo-box-selected",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected .${n(`hs-combo-box-selected${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected.${n(`hs-combo-box-selected${t}${s}`)}`)}]),o("hs-combo-box-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-combo-box-tab-active${t}${s}`)}`)}]),o("hs-apexcharts-tooltip-dark",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.dark.${n(`hs-apexcharts-tooltip-dark${t}${s}`)}`)}]),o("hs-success",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success .${n(`hs-success${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success.${n(`hs-success${t}${s}`)}`)}]),o("hs-error",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error .${n(`hs-error${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error.${n(`hs-error${t}${s}`)}`)}]),o("hs-default-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.default .${n(`hs-default-mode-active${t}${s}`)}`)}),o("hs-dark-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.dark .${n(`hs-dark-mode-active${t}${s}`)}`)}),o("hs-auto-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.auto .${n(`hs-auto-mode-active${t}${s}`)}`)})},Oe=({model:o})=>{const[n]=i.useBrandingOptions(),[e]=i.useSelectedBlockIds(),[t]=i.useDarkMode(),[s]=i.useHighlightBlockId(),[p]=i.useSelectedStylingBlocks(),[c]=E.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 y=a.get(n,"headingFont","DM Sans"),w=a.get(n,"bodyFont","DM Sans");return h.useEffect(()=>{const v=a.get(n,"primaryColor","#000"),m=a.get(n,"secondaryColor","#FFF"),j=ce.tailwindcssPaletteGenerator({colors:[v,m],names:["primary","secondary"]});j.primary.DEFAULT=v,j.secondary.DEFAULT=m;const I=a.get(n,"roundedCorners","0");!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[y],body:[w]},extend:{borderRadius:{global:`${I||"0"}px`},colors:j}},plugins:[ae,de,ue,d.tailwind.plugin.withOptions(()=>He)]})},[n,d,y,w]),h.useEffect(()=>{x&&(x.textContent=`${a.map(e,v=>`[data-block-id="${v}"]`).join(",")}{
51
+ </html>`,ke=o=>{const[n]=i.useCanvasWidth(),[,e]=i.useCanvasZoom(),[t,s]=h.useState({}),p=h.useCallback(()=>{const{width:c,height:l}=o;if(c<n){const d=parseFloat((c/n).toFixed(2).toString());let u={};const x=l*d;l&&(u={height:100+(l-x)/x*100+"%"}),s({position:"relative",top:0,transform:`scale(${d})`,transformOrigin:"top left",...u,maxWidth:"none"}),e(d*100)}else s({}),e(100)},[n,o,e]);return h.useEffect(()=>{p()},[n,o,e,p]),t};let Y,Z;typeof document<"u"&&(Y=document);typeof window<"u"&&(Z=window);const Q=h.createContext({document:Y,window:Z}),T=()=>h.useContext(Q),{Provider:Ee,Consumer:Ve}=Q;class J extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}C(J,"propTypes",{children:b.element.isRequired,contentDidMount:b.func.isRequired,contentDidUpdate:b.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,s=this.props.contentDidUpdate,p=e.defaultView||e.parentView,c=r.jsxRuntimeExports.jsx(J,{contentDidMount:t,contentDidUpdate:s,children:r.jsxRuntimeExports.jsx(Ee,{value:{document:e,window:p},children:r.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),l=this.getMountTarget();return[H.createPortal(this.props.head,this.getDoc().head),H.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:b.object,head:b.node,initialContent:b.string,mountTarget:b.string,contentDidMount:b.func,contentDidUpdate:b.func,children:b.oneOfType([b.element,b.arrayOf(b.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 Re=h.forwardRef((o,n)=>r.jsxRuntimeExports.jsx(q,{...o,forwardedRef:n})),we=()=>{const{addCoreBlock:o}=i.useAddBlock(),n=i.useBuilderProp("getExternalPredefinedBlock",a.noop);return h.useCallback(async e=>{const{block:t,dropTargetId:s,relativeIndex:p}=e;if(a.has(t,"format")){const c=await n(t);return o({blocks:c},s===0?null:s,p)}return o(t,s===0?null:s,p)},[o])};let w=null,A=[],D=null,G=null;function Se(o){const n=window.getComputedStyle(o),e=parseInt(n.paddingLeft,10),t=parseInt(n.paddingTop,10),s=parseInt(n.paddingRight,10),p=parseInt(n.paddingBottom,10);return{paddingLeft:e,paddingTop:t,paddingRight:s,paddingBottom:p}}const W=(o,n,e)=>{if(!w)return;const t=o.getBoundingClientRect(),s=w==null?void 0:w.getElementById("placeholder"),{paddingLeft:p,paddingTop:c,paddingRight:l,paddingBottom:d}=Se(o);s.style.width=n==="vertical"?t.width-p-l+"px":"2px",s.style.height=n==="vertical"?"2px":t.height-c-d+"px",s.style.display="block";const u=A.reduce((x,f)=>Math.abs(f-e)<Math.abs(x-e)?f:x);G=A.indexOf(u),n==="vertical"?(s.style.top=o.offsetTop+u+"px",s.style.left=o.offsetLeft+p+"px"):(s.style.top=o.offsetTop+c+"px",s.style.left=o.offsetLeft+u+"px")},Be=o=>{const n=X(o),e=window.getComputedStyle(o),t=n==="horizontal",s=parseInt(e.paddingLeft),p=parseInt(e.paddingTop);let c=t?s:p;A=[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;A.push(c+x+u),c+=x+u})};function X(o){const n=window.getComputedStyle(o).display,e=window.getComputedStyle(o).flexDirection;if(n==="flex")return e==="column"||e==="column-reverse"?"vertical":"horizontal";if(n==="grid"){const t=window.getComputedStyle(o).gridTemplateRows,s=window.getComputedStyle(o).gridTemplateColumns;if(t.includes("auto"))return"vertical";if(s.includes("auto"))return"horizontal"}return n==="block"?"vertical":"horizontal"}const Ce=a.throttle(o=>{const n=o.target,e=X(n);if(e==="vertical"){const t=o.clientY-n.offsetTop;W(n,e,t)}else{const t=o.clientX-n.offsetLeft;W(n,e,t)}},200),Ie=o=>{o.preventDefault(),o.stopPropagation(),Ce(o)};function N(){const o=w==null?void 0:w.getElementById("placeholder");o.style.display="none"}const De=()=>{const{document:o}=T(),[n,e]=E.useAtom(i.draggingFlagAtom),t=we(),s=K.useFeature("dnd"),[,p]=i.useHighlightBlockId(),[,c]=i.useSelectedBlockIds();return w=o,{isDragging:n,"data-dnd":"branch",onDragOver:s?Ie:a.noop,onDrop:s?l=>{D==null||D.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:G}),e(!1),N(),setTimeout(()=>{N()},300)}:a.noop,onDragEnter:s?l=>{const d=l;D=d.target,d.stopPropagation(),d.preventDefault(),A=[];const u=d.target;Be(u),u.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),e(!0),p(""),c([])}:a.noop,onDragLeave:s?l=>{const d=l;D=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:a.noop,onMouseOut:s?()=>{e(!1),N()}:a.noop}};function F(o){return o.getAttribute("data-block-id")?o:o.closest("[data-block-id]")}function Ae(o){o.container.innerHTML="",o.container.parentNode.removeChild(o.container);var n=document.querySelector(".ql-toolbar");n&&n.parentNode.removeChild(n),o=null}const _e=()=>{const o=["Heading","Paragraph","Text","Link","Span","Button"],n=i.useUpdateBlocksProps(),[,e]=i.useHighlightBlockId(),[t,s]=E.useAtom(i.inlineEditingActiveAtom);return p=>{var f;if(t)return;const c=F(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());n([c.getAttribute("data-block-id")],{content:g}),c.removeAttribute("style"),d.removeEventListener("blur",x,!0),Ae(u),s(""),e("")}d.addEventListener("blur",x,!0),u.focus(),(f=d.querySelector(".ql-clipboard"))==null||f.remove(),s(c.getAttribute("data-block-id"))}},Me=()=>{const[,o]=i.useSelectedStylingBlocks(),[,n]=i.useSelectedBlockIds(),[,e]=i.useHighlightBlockId(),[t]=E.useAtom(i.inlineEditingActiveAtom),[s]=E.useAtom(i.treeRefAtom);return p=>{if(t)return;s.closeAll(),p.stopPropagation();const c=F(p.target);if(c!=null&&c.getAttribute("data-block-id")&&(c==null?void 0:c.getAttribute("data-block-id"))==="container"){n([]),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}]),n([u])}else c!=null&&c.getAttribute("data-block-id")&&n([c.getAttribute("data-block-id")]);e("")}},Te=a.throttle((o,n)=>{const e=F(o.target);e!=null&&e.getAttribute("data-style-id")&&n(e.getAttribute("data-style-id"))},100),Ne=()=>{const[,o]=i.useHighlightBlockId(),[n]=E.useAtom(i.inlineEditingActiveAtom);return e=>{n||Te(e,o)}},qe=({children:o})=>{const{document:n}=T(),[e]=i.useSelectedBlockIds(),[t,s]=i.useSelectedStylingBlocks();h.useEffect(()=>{setTimeout(()=>{if(!a.isEmpty(t))return;const u=V(n,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");s([{id:f,prop:x,blockId:g}])}}},100)},[n,e,s,t]);const p=_e(),c=Me(),l=Ne(),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})},V=(o,n)=>o.querySelector(`[data-block-id="${n}"]`),Le=()=>{const{window:o}=T(),[n,e]=i.useSelectedBlockIds(),[t]=i.useBlocksStore(),[,s]=i.useSelectedStylingBlocks(),{undo:p,redo:c}=i.useUndoManager(),l=i.useDuplicateBlocks(),[,d]=i.usePreviewMode(),u=i.useRemoveBlocks(),{savePage:x}=i.useSavePage(),[f]=E.useAtom(i.inlineEditingActiveAtom),[,g]=E.useAtom(i.editLayerNameAtom),j=v=>{v.key==="Enter"&&(v.preventDefault(),n.length===1&&g(a.first(n)))},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([]),s([]);return}if(j(m),!f&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),u(n)),m.ctrlKey||m.metaKey){if(m.key==="ArrowUp"){m.preventDefault();const y=n.length>0?R(n[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(n)}};return o.removeEventListener("keydown",v),o.addEventListener("keydown",v),()=>{o.removeEventListener("keydown",v)}},[n,e,p,u,d,c,l,f,x,o]),null},Pe=({block:o,label:n})=>{const[,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[,s]=E.useAtom(i.draggedBlockIdAtom),p=K.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"]))),s(o._id),setTimeout(()=>{e([]),t(null)},200)},children:[r.jsxRuntimeExports.jsx(k.DragHandleDots2Icon,{}),n]})},Fe=({selectedBlockElement:o,block:n})=>{const e=i.useRemoveBlocks(),t=i.useDuplicateBlocks(),[,s]=i.useSelectedBlockIds(),[,p]=i.useSelectedStylingBlocks(),[c]=E.useAtom(i.inlineEditingActiveAtom),{floatingStyles:l,refs:d,update:u}=O.useFloating({placement:"top-start",middleware:[O.shift(),ie.flip()],elements:{reference:o}});le.useResizeObserver(o,()=>u(),o!==null);const x=a.get(n,"_parent",null),f=a.isEmpty(a.get(n,"_name",""))?a.get(n,"_type",""):a.get(n,"_name","");return!o||!n||c?null: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(Pe,{label:f,block:n}),r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[x&&r.jsxRuntimeExports.jsx(k.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{p([]),s([x])}}),i.canDuplicateBlock(a.get(n,"_type",""))?r.jsxRuntimeExports.jsx(k.CopyIcon,{className:"hover:scale-105",onClick:()=>t([n==null?void 0:n._id])}):null,i.canDeleteBlock(a.get(n,"_type",""))?r.jsxRuntimeExports.jsx(k.TrashIcon,{className:"hover:scale-105",onClick:()=>e([n==null?void 0:n._id])}):null]})]})},He=({addVariant:o,e:n})=>{o("hs-dropdown-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open > .${n(`hs-dropdown-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open .hs-dropdown-toggle .${n(`hs-dropdown-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open > .hs-dropdown-menu > .${n(`hs-dropdown-open${t}${s}`)}`)}]),o("hs-removing",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-removing.${n(`hs-removing${t}${s}`)}`)}),o("hs-tooltip-shown",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-tooltip.show .${n(`hs-tooltip-shown${t}${s}`)}`)}),o("hs-accordion-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active.${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-toggle .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-toggle.${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${n(`hs-accordion-active${t}${s}`)}`)}]),o("hs-accordion-selected",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion .selected.${n(`hs-accordion-selected${t}${s}`)}`)}),o("hs-collapse-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse.open .${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse.open.${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse-toggle.open .${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse-toggle.open.${n(`hs-collapse-open${t}${s}`)}`)}]),o("hs-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`[data-hs-tab].active.${n(`hs-tab-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`[data-hs-tab].active .${n(`hs-tab-active${t}${s}`)}`)}]),o("hs-overlay-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.open.${n(`hs-overlay-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.open .${n(`hs-overlay-open${t}${s}`)}`)}]),o("hs-overlay-layout-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-body-open.${n(`hs-overlay-layout-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-body-open .${n(`hs-overlay-layout-open${t}${s}`)}`)}]),o("hs-overlay-backdrop-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-backdrop.${n(`hs-overlay-backdrop-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-backdrop .${n(`hs-overlay-backdrop-open${t}${s}`)}`)}]),o("hs-scrollspy-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-scrollspy-active${t}${s}`)}`)}),o("hs-carousel-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-carousel-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-carousel-active${t}${s}`)}`)}]),o("hs-carousel-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-carousel${t}disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-carousel${t}disabled${t}${s}`)}`)}]),o("hs-selected",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected.${n(`hs-selected${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected .${n(`hs-selected${t}${s}`)}`)}]),o("hs-select-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-select-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-select-disabled${t}${s}`)}`)}]),o("hs-select-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-select-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-select-active${t}${s}`)}`)}]),o("hs-input-number-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-input-number-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-input-number-disabled${t}${s}`)}`)}]),o("hs-pin-input-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-pin-input-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-pin-input-active${t}${s}`)}`)}]),o("hs-select-opened",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.opened.${n(`hs-select-opened${t}${s}`)}`)}]),o("hs-password-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-password-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-password-active${t}${s}`)}`)}]),o("hs-stepper-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-stepper-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-stepper-active${t}${s}`)}`)}]),o("hs-stepper-success",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success.${n(`hs-stepper-success${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success .${n(`hs-stepper-success${t}${s}`)}`)}]),o("hs-stepper-completed",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.completed.${n(`hs-stepper-completed${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.completed .${n(`hs-stepper-completed${t}${s}`)}`)}]),o("hs-stepper-error",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error.${n(`hs-stepper-error${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error .${n(`hs-stepper-error${t}${s}`)}`)}]),o("hs-stepper-processed",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.processed.${n(`hs-stepper-processed${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.processed .${n(`hs-stepper-processed${t}${s}`)}`)}]),o("hs-stepper-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-stepper-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-stepper-disabled${t}${s}`)}`)}]),o("hs-stepper-skipped",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.skipped.${n(`hs-stepper-skipped${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.skipped .${n(`hs-stepper-skipped${t}${s}`)}`)}]),o("hs-strong-password",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.passed.${n(`hs-strong-password${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.passed .${n(`hs-strong-password${t}${s}`)}`)}]),o("hs-strong-password-accepted",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.accepted.${n(`hs-strong-password-accepted${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.accepted .${n(`hs-strong-password-accepted${t}${s}`)}`)}]),o("hs-strong-password-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-strong-password-active${t}${s}`)}`)}]),o("hs-combo-box-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-combo-box-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-combo-box-active${t}${s}`)}`)}]),o("hs-combo-box-selected",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected .${n(`hs-combo-box-selected${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected.${n(`hs-combo-box-selected${t}${s}`)}`)}]),o("hs-combo-box-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-combo-box-tab-active${t}${s}`)}`)}]),o("hs-apexcharts-tooltip-dark",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.dark.${n(`hs-apexcharts-tooltip-dark${t}${s}`)}`)}]),o("hs-success",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success .${n(`hs-success${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success.${n(`hs-success${t}${s}`)}`)}]),o("hs-error",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error .${n(`hs-error${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error.${n(`hs-error${t}${s}`)}`)}]),o("hs-default-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.default .${n(`hs-default-mode-active${t}${s}`)}`)}),o("hs-dark-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.dark .${n(`hs-dark-mode-active${t}${s}`)}`)}),o("hs-auto-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.auto .${n(`hs-auto-mode-active${t}${s}`)}`)})},Oe=({model:o})=>{const[n]=i.useBrandingOptions(),[e]=i.useSelectedBlockIds(),[t]=i.useDarkMode(),[s]=i.useHighlightBlockId(),[p]=i.useSelectedStylingBlocks(),[c]=E.useAtom(i.draggedBlockIdAtom),{document:l,window:d}=T(),[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 j=a.get(n,"headingFont","DM Sans"),R=a.get(n,"bodyFont","DM Sans");return h.useEffect(()=>{if(!d||!d.tailwind)return;const v=a.get(n,"primaryColor","#000"),m=a.get(n,"secondaryColor","#FFF"),y=ce([{color:v,name:"primary"},{color:m,name:"secondary"}]),I=a.get(n,"roundedCorners","0");d.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[j],body:[R]},extend:{borderRadius:{global:`${I||"0"}px`},colors:y}},plugins:[ae,de,ue,d.tailwind.plugin.withOptions(()=>He)]}},[n,d,j,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=s?`[data-style-id="${s}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[s,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(n,"bodyTextLightColor","#64748b"),m=a.get(n,"bodyTextDarkColor","#94a3b8"),j=a.get(n,"bodyBgLightColor","#FFFFFF"),I=a.get(n,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${v}] bg-[${j}] dark:text-[${m}] dark:bg-[${I}]`},[n,l,o]),o==="page"?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[y&&r.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${y.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),w&&y!==w&&r.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${w.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),y&&r.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${y}",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},Ue=o=>{const n={};return Object.keys(o).forEach(e=>{a.isString(o[e])&&o[e].startsWith(_.SLOT_KEY)&&(n[e]=o[e].replace(_.SLOT_KEY,"").split(","))}),n},ze=a.memoize(o=>{const n=o.replace(_.STYLES_KEY,"").split(",");return he.twMerge(n[0],n[1])});function We(o,n){return a.get(o,`${n}_attrs`,{})}function Ke(o){const n={};return Object.keys(o).forEach(e=>{if(a.isString(o[e])&&o[e].startsWith(_.STYLES_KEY)){const t=ze(o[e]);n[e]={className:t,"data-style-prop":e,"data-block-parent":o._id,"data-style-id":`${e}-${o._id}`,...We(o,e)}}}),n}function Ye(o,n){const e=a.get(o,"_bindings",{});return a.isEmpty(e)?{...o}:(a.each(e,(t,s)=>{a.isString(t)&&a.get(n,t,null)&&(o[s]=a.get(n,t,null))}),o)}function L({blocks:o}){const[n]=i.useBlocksStore(),[e]=me.useCanvasSettings(),t=h.useCallback(l=>Ke(l),[]),[s]=P.useChaiExternalData(),[p]=E.useAtom(i.inlineEditingActiveAtom),c=h.useCallback(l=>l.reduce((d,u)=>{const x=a.get(e,u,{});return{...d,...x}},{}),[e,n]);return r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:h.Children.toArray(o.map((l,d)=>{if(p===l._id)return null;const u=Ue(l),x={};a.isEmpty(u)||Object.keys(u).forEach(m=>{x[m]=h.Children.toArray(u[m].map(j=>r.jsxRuntimeExports.jsx(L,{blocks:[a.find(n,{_id:j})]})))});const f=a.filter(n,{_parent:l._id});x.children=f.length?r.jsxRuntimeExports.jsx(L,{blocks:f}):null;const g=xe.getBlockComponent(l._type),y=a.get(g,"builderComponent",a.get(g,"component",null));if(a.isNull(y))return r.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${l==null?void 0:l._type} not registered -->`});const w=a.has(g,"getBlockStateFrom")?g==null?void 0:g.getBlockStateFrom(l,n):[],v=c(w);return r.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(y,{blockProps:{"data-block-id":l._id,"data-block-type":l._type,"data-dnd":a.has(g,"canAcceptBlock")?"branch":"leaf"},index:d,...Ye(l,s),...t(l),...x,inBuilder:!0,blockState:v})})}))})}const Ze=()=>{const[o]=i.useBlocksStore(),n=a.isEmpty(o)?null:r.jsxRuntimeExports.jsx(P.BlocksExternalDataProvider,{children:r.jsxRuntimeExports.jsx(L,{blocks:a.filter(o,e=>a.isEmpty(e._parent))})});return r.jsxRuntimeExports.jsx(pe.Provider,{children:n})},Ge=(o,n)=>o.querySelector(`[data-style-id="${n}"]`),Qe=()=>{const[o]=E.useAtom(i.networkModeAtom),[n]=i.usePreviewMode(),[e]=i.useCanvasWidth(),[,t]=i.useSelectedBlockIds(),s=i.useSelectedBlock(),[,p]=i.useHighlightBlockId(),c=h.useRef(null),l=h.useRef(null),[d,u]=h.useState({width:0,height:0}),x=ke(d),[f,g]=h.useState(0),[y,w]=h.useState([]),[,v]=h.useState([]),[,m]=E.useAtom(i.canvasIframeAtom),[j,I]=i.useSelectedStylingBlocks(),ee=i.useBuilderProp("loading",!1);h.useEffect(()=>{const{clientWidth:$,clientHeight:S}=l.current;u({width:$,height:S}),f===0&&g($)},[l,e,f]);const te=($,S=0)=>{const{top:B}=$.getBoundingClientRect();return B+S>=0&&B-S<=window.innerHeight};h.useEffect(()=>{var $,S;if(s&&s.type!=="Multiple"&&c.current){const B=V(c.current.contentDocument,s._id);B&&(te(B)||(S=($=c.current)==null?void 0:$.contentWindow)==null||S.scrollTo({top:B.offsetTop,behavior:"smooth"}),w([B]))}},[s]),h.useEffect(()=>{if(!a.isEmpty(j)&&c.current){const $=Ge(c.current.contentDocument,a.first(j).id);v($?[$]:[null])}else v([null])},[j]);const se=h.useMemo(()=>{let $=be;return o==="offline"&&($=$.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),$=$.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),$=$.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),$},[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:n?"100%":f}:{},ref:l,children:r.jsxRuntimeExports.jsxs(we,{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(Le,{}),r.jsxRuntimeExports.jsx(Fe,{block:s,selectedBlockElement:a.first(y)}),r.jsxRuntimeExports.jsx(Oe,{model:"page"}),r.jsxRuntimeExports.jsx(qe,{children:ee?r.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"})}):r.jsxRuntimeExports.jsx(Ze,{})}),r.jsxRuntimeExports.jsx("br",{}),r.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},Je=()=>r.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[r.jsxRuntimeExports.jsx(ye,{}),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(P.ErrorBoundary,{children:r.jsxRuntimeExports.jsx(Qe,{})})})})]});exports.default=Je;
55
+ }`)},[p,f]),h.useEffect(()=>{const v=a.get(n,"bodyTextLightColor","#64748b"),m=a.get(n,"bodyTextDarkColor","#94a3b8"),y=a.get(n,"bodyBgLightColor","#FFFFFF"),I=a.get(n,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${v}] bg-[${y}] dark:text-[${m}] dark:bg-[${I}]`},[n,l,o]),o==="page"?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[j&&r.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${j.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),R&&j!==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"}),j&&r.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${j}",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},Ue=o=>{const n={};return Object.keys(o).forEach(e=>{a.isString(o[e])&&o[e].startsWith(_.SLOT_KEY)&&(n[e]=o[e].replace(_.SLOT_KEY,"").split(","))}),n},ze=a.memoize(o=>{const n=o.replace(_.STYLES_KEY,"").split(",");return he.twMerge(n[0],n[1])});function We(o,n){return a.get(o,`${n}_attrs`,{})}function Ke(o){const n={};return Object.keys(o).forEach(e=>{if(a.isString(o[e])&&o[e].startsWith(_.STYLES_KEY)){const t=ze(o[e]);n[e]={className:t,"data-style-prop":e,"data-block-parent":o._id,"data-style-id":`${e}-${o._id}`,...We(o,e)}}}),n}function Ye(o,n){const e=a.get(o,"_bindings",{});return a.isEmpty(e)?{...o}:(a.each(e,(t,s)=>{a.isString(t)&&a.get(n,t,null)&&(o[s]=a.get(n,t,null))}),o)}function L({blocks:o}){const[n]=i.useBlocksStore(),[e]=me.useCanvasSettings(),t=h.useCallback(l=>Ke(l),[]),[s]=P.useChaiExternalData(),[p]=E.useAtom(i.inlineEditingActiveAtom),c=h.useCallback(l=>l.reduce((d,u)=>{const x=a.get(e,u,{});return{...d,...x}},{}),[e,n]);return r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:h.Children.toArray(o.map((l,d)=>{if(p===l._id)return null;const u=Ue(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(n,{_id:y})]})))});const f=a.filter(n,{_parent:l._id});x.children=f.length?r.jsxRuntimeExports.jsx(L,{blocks:f}):null;const g=xe.getBlockComponent(l._type),j=a.get(g,"builderComponent",a.get(g,"component",null));if(a.isNull(j))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,n):[],v=c(R);return r.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(j,{blockProps:{"data-block-id":l._id,"data-block-type":l._type,"data-dnd":a.has(g,"canAcceptBlock")?"branch":"leaf"},index:d,...Ye(l,s),...t(l),...x,inBuilder:!0,blockState:v})})}))})}const Ze=()=>{const[o]=i.useBlocksStore(),n=a.isEmpty(o)?null:r.jsxRuntimeExports.jsx(P.BlocksExternalDataProvider,{children:r.jsxRuntimeExports.jsx(L,{blocks:a.filter(o,e=>a.isEmpty(e._parent))})});return r.jsxRuntimeExports.jsx(pe.Provider,{children:n})},Qe=(o,n)=>o.querySelector(`[data-style-id="${n}"]`),Je=()=>{const[o]=E.useAtom(i.networkModeAtom),[n]=i.usePreviewMode(),[e]=i.useCanvasWidth(),[,t]=i.useSelectedBlockIds(),s=i.useSelectedBlock(),[,p]=i.useHighlightBlockId(),c=h.useRef(null),l=h.useRef(null),[d,u]=h.useState({width:0,height:0}),x=ke(d),[f,g]=h.useState(0),[j,R]=h.useState([]),[,v]=h.useState([]),[,m]=E.useAtom(i.canvasIframeAtom),[y,I]=i.useSelectedStylingBlocks(),ee=i.useBuilderProp("loading",!1);h.useEffect(()=>{const{clientWidth:$,clientHeight:S}=l.current;u({width:$,height:S}),f===0&&g($)},[l,e,f]);const te=($,S=0)=>{const{top:B}=$.getBoundingClientRect();return B+S>=0&&B-S<=window.innerHeight};h.useEffect(()=>{var $,S;if(s&&s.type!=="Multiple"&&c.current){const B=V(c.current.contentDocument,s._id);B&&(te(B)||(S=($=c.current)==null?void 0:$.contentWindow)==null||S.scrollTo({top:B.offsetTop,behavior:"smooth"}),R([B]))}},[s]),h.useEffect(()=>{if(!a.isEmpty(y)&&c.current){const $=Qe(c.current.contentDocument,a.first(y).id);v($?[$]:[null])}else v([null])},[y]);const se=h.useMemo(()=>{let $=be;return o==="offline"&&($=$.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),$=$.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),$=$.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),$},[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:n?"100%":f}:{},ref:l,children:r.jsxRuntimeExports.jsxs(Re,{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(Le,{}),r.jsxRuntimeExports.jsx(Fe,{block:s,selectedBlockElement:a.first(j)}),r.jsxRuntimeExports.jsx(Oe,{model:"page"}),r.jsxRuntimeExports.jsx(qe,{children:ee?r.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"})}):r.jsxRuntimeExports.jsx(Ze,{})}),r.jsxRuntimeExports.jsx("br",{}),r.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},Ge=()=>r.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[r.jsxRuntimeExports.jsx(ye,{}),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(P.ErrorBoundary,{children:r.jsxRuntimeExports.jsx(Je,{})})})})]});exports.default=Ge;