@chaibuilder/sdk 1.0.14 → 1.0.16

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 (168) hide show
  1. package/dist/{AddBlocks-H7BZYHUC.js → AddBlocks-eoo1CzaK.js} +114 -111
  2. package/dist/AddBlocks-jU0NwP_s.cjs +3 -0
  3. package/dist/{BrandingOptions-PAgY-kvj.js → BrandingOptions-ZfGlHDQN.js} +57 -41
  4. package/dist/BrandingOptions-qLROZ5_E.cjs +1 -0
  5. package/dist/CanvasArea-970i3vfn.cjs +46 -0
  6. package/dist/{CanvasArea-zn2ox-5h.js → CanvasArea-tngPDKeT.js} +517 -519
  7. package/dist/Class-RZuPYbUS.cjs +1 -0
  8. package/dist/{Class-l7qYbuoN.js → Class-nQk08vqd.js} +204 -124
  9. package/dist/{CurrentPage-6Jp4xAWK.js → CurrentPage-CMfaRNdW.js} +58 -40
  10. package/dist/CurrentPage-ChffzjTI.cjs +1 -0
  11. package/dist/Layers-GkcHf9zi.cjs +1 -0
  12. package/dist/{Layers-WkZ48AUm.js → Layers-uB7ROW-2.js} +158 -141
  13. package/dist/MarkAsGlobalBlock-lYL8cO9x.cjs +1 -0
  14. package/dist/MarkAsGlobalBlock-ySc-D4SB.js +84 -0
  15. package/dist/PagesPanel-DVZ90k1Y.js +70 -0
  16. package/dist/PagesPanel-ZhyfEOgv.cjs +1 -0
  17. package/dist/ProjectPanel-8oW-gW5l.cjs +1 -0
  18. package/dist/ProjectPanel-WCQDwngA.js +91 -0
  19. package/dist/{Settings-fH8fZKpm.js → Settings-7Km8_Iba.js} +411 -408
  20. package/dist/Settings-CLiAR8FT.cjs +1 -0
  21. package/dist/SidePanels-D7Jota-n.cjs +1 -0
  22. package/dist/{SidePanels-w8ZHKJaR.js → SidePanels-_2og328o.js} +106 -88
  23. package/dist/{Topbar-hm1D_5sb.js → Topbar-lX9OMPwj.js} +47 -45
  24. package/dist/Topbar-qi5ab8rR.cjs +1 -0
  25. package/dist/UnsplashImages-a2r7b3kB.cjs +1 -0
  26. package/dist/{UnsplashImages-gPcBLjgB.js → UnsplashImages-u_QTABzi.js} +56 -44
  27. package/dist/{UploadImages-_ZyUU66E.js → UploadImages-gV5xDHIu.js} +55 -34
  28. package/dist/UploadImages-jLQgLujd.cjs +1 -0
  29. package/dist/add-page-modal-OBghcP4h.cjs +1 -0
  30. package/dist/add-page-modal-PsNV4j42.js +110 -0
  31. package/dist/confirm-alert-ZQ-sxX0X.js +58 -0
  32. package/dist/confirm-alert-z74-fGOT.cjs +1 -0
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.js +99 -124
  35. package/dist/delete-page-modal-5QqRuat8.js +89 -0
  36. package/dist/delete-page-modal-niJTfDhl.cjs +1 -0
  37. package/dist/form-Osm1AmO5.cjs +1 -0
  38. package/dist/{form-dVpOAyRl.js → form-zZJyZuNH.js} +12 -12
  39. package/dist/index-2EHcmZqL.js +2947 -0
  40. package/dist/index-3_eUgIcu.cjs +206 -0
  41. package/dist/index-X20Fx8GF.js +40872 -0
  42. package/dist/index-aGgHTZqR.cjs +9 -0
  43. package/dist/index-c8zW_D2V.cjs +1 -0
  44. package/dist/index-fwo4wa7u.cjs +1 -0
  45. package/dist/index-gmZcUXyn.js +25 -0
  46. package/dist/index-yWvUd-lf.js +1189 -0
  47. package/dist/{jsx-runtime-JYMCiFoE.cjs → jsx-runtime-WKRPbKtm.cjs} +7 -7
  48. package/dist/{jsx-runtime-Sp0orL4X.js → jsx-runtime-qAwJ85SY.js} +109 -106
  49. package/dist/lib.cjs +2 -1
  50. package/dist/lib.js +1333 -71
  51. package/dist/{page-viewer-Y4YiaZ_m.js → page-viewer-_Sx79O1c.js} +62 -44
  52. package/dist/page-viewer-vgt_sF5B.cjs +1 -0
  53. package/dist/{project-general-setting-U4S_KlhU.js → project-general-setting-d4UJ9Xsf.js} +46 -36
  54. package/dist/project-general-setting-isR_XMTY.cjs +1 -0
  55. package/dist/project-seo-setting-FpCjw-1j.js +89 -0
  56. package/dist/project-seo-setting-tUM5Jqki.cjs +1 -0
  57. package/dist/render.cjs +1 -1
  58. package/dist/render.js +23 -19
  59. package/dist/server.cjs +1 -1
  60. package/dist/server.js +1 -1
  61. package/dist/{single-page-detail-pAxCy_Pe.js → single-page-detail-Ajzk6Hdb.js} +90 -80
  62. package/dist/single-page-detail-nAykBmpV.cjs +1 -0
  63. package/dist/studio.cjs +1 -1
  64. package/dist/studio.js +45 -25
  65. package/dist/ui.cjs +1 -1
  66. package/dist/ui.js +156 -357
  67. package/package.json +1 -1
  68. package/dist/AddBlocks-7ACJv8LW.cjs +0 -3
  69. package/dist/BrandingOptions-5j-XszLM.cjs +0 -1
  70. package/dist/CanvasArea-Dnm-yeus.cjs +0 -46
  71. package/dist/ChaiBuilderEditor-BoE-sArB.cjs +0 -163
  72. package/dist/ChaiBuilderEditor-hEuUONQ3.js +0 -27094
  73. package/dist/Class-_uCzl5v1.cjs +0 -1
  74. package/dist/CurrentPage-YMpqOqx7.cjs +0 -1
  75. package/dist/ImagesPanel-6us7hiLN.cjs +0 -1
  76. package/dist/ImagesPanel-oaHOD-Ex.js +0 -27
  77. package/dist/Layers-EzOZdWvd.cjs +0 -1
  78. package/dist/MODIFIERS-DsEzQ3aH.js +0 -73
  79. package/dist/MODIFIERS-Fx6WAZcw.cjs +0 -1
  80. package/dist/MarkAsGlobalBlock-0HubcRkY.js +0 -77
  81. package/dist/MarkAsGlobalBlock-HmeIyLCP.cjs +0 -1
  82. package/dist/PagesPanel-6JuwBLFQ.js +0 -50
  83. package/dist/PagesPanel-zJq8p1ja.cjs +0 -1
  84. package/dist/ProjectPanel-Zml2F8b9.cjs +0 -1
  85. package/dist/ProjectPanel-cu2QSDW9.js +0 -73
  86. package/dist/Settings-lc9PfnmG.cjs +0 -1
  87. package/dist/SidePanels-VH72zFE2.cjs +0 -1
  88. package/dist/Topbar-vQPo9xSY.cjs +0 -1
  89. package/dist/UnsplashImages-BoBBSi1a.cjs +0 -1
  90. package/dist/UploadImages-T6kW0s3G.cjs +0 -1
  91. package/dist/accordion-oPUeqPCZ.js +0 -42
  92. package/dist/accordion-ynvFtV_p.cjs +0 -1
  93. package/dist/add-page-modal--qZSwJuB.cjs +0 -1
  94. package/dist/add-page-modal-bj7qbZuK.js +0 -99
  95. package/dist/alert-dialog-GNfnpqFB.js +0 -64
  96. package/dist/alert-dialog-Mv0-wAvS.cjs +0 -1
  97. package/dist/command-ThdTuUxt.cjs +0 -1
  98. package/dist/command-VHca6CcN.js +0 -97
  99. package/dist/confirm-alert-8EHe0OOd.cjs +0 -1
  100. package/dist/confirm-alert-b0e_BLhF.js +0 -36
  101. package/dist/context-menu-8dC9uGXj.js +0 -122
  102. package/dist/context-menu-IgLbIuth.cjs +0 -1
  103. package/dist/controls-Ni5kEzLz.js +0 -103
  104. package/dist/controls-W97-POR_.cjs +0 -1
  105. package/dist/controls-enQY7NI8.js +0 -118
  106. package/dist/controls-xUKa23ic.cjs +0 -1
  107. package/dist/delete-page-modal-2LuDLEiP.cjs +0 -1
  108. package/dist/delete-page-modal-cnrR8tWH.js +0 -69
  109. package/dist/dialog-S_QbL1iq.cjs +0 -1
  110. package/dist/dialog-jrw9DF1f.js +0 -65
  111. package/dist/dropdown-menu-S03K_fNs.js +0 -164
  112. package/dist/dropdown-menu-sMXR59cB.cjs +0 -1
  113. package/dist/form-nRAvKPQj.cjs +0 -1
  114. package/dist/functions-nNTuSTsR.js +0 -1106
  115. package/dist/functions-pcUZhFJM.js +0 -12
  116. package/dist/functions-sCuB7nvZ.cjs +0 -2
  117. package/dist/functions-uw7QP2kT.cjs +0 -1
  118. package/dist/html-to-json-P6GpbcQX.cjs +0 -1
  119. package/dist/html-to-json-pdHQfRkN.js +0 -178
  120. package/dist/index-HAue58ea.cjs +0 -1
  121. package/dist/index-T4_wfKl5.js +0 -2256
  122. package/dist/index-X9ZgD09V.cjs +0 -1
  123. package/dist/index-ehKdBRUK.js +0 -18
  124. package/dist/label-KaP7MRrs.js +0 -10
  125. package/dist/label-tFm8HZdb.cjs +0 -1
  126. package/dist/link-6o6n2Tnd.js +0 -204
  127. package/dist/link-ece8dZGH.cjs +0 -1
  128. package/dist/page-viewer-IARz6OSp.cjs +0 -1
  129. package/dist/popover-a84pbVhQ.js +0 -23
  130. package/dist/popover-fKjgcRUx.cjs +0 -1
  131. package/dist/project-general-setting-eSl3t-VH.cjs +0 -1
  132. package/dist/project-seo-setting-Ga9v_ECU.js +0 -67
  133. package/dist/project-seo-setting-rankm1z3.cjs +0 -1
  134. package/dist/scroll-area-FiHvy-TZ.cjs +0 -1
  135. package/dist/scroll-area-ewXbxc3n.js +0 -30
  136. package/dist/select-7bjg-rr9.cjs +0 -1
  137. package/dist/select-POGdEDHT.js +0 -75
  138. package/dist/separator-3Civ-6hb.cjs +0 -1
  139. package/dist/separator-SctTn0Qi.js +0 -18
  140. package/dist/single-page-detail-yPgnu2AI.cjs +0 -1
  141. package/dist/skeleton-CU_FIbg3.js +0 -239
  142. package/dist/skeleton-JHP9zwL2.cjs +0 -1
  143. package/dist/tabs-Gb9v5dVb.js +0 -46
  144. package/dist/tabs-iWeaaVrg.cjs +0 -1
  145. package/dist/textarea-1kZEh7ki.cjs +0 -1
  146. package/dist/textarea-b2QvVhrK.js +0 -73
  147. package/dist/toggle-ASJRAaGP.js +0 -30
  148. package/dist/toggle-ehNIPmme.cjs +0 -1
  149. package/dist/useAddBlock-WJc3OgG8.js +0 -86
  150. package/dist/useAddBlock-dCKRFPRU.cjs +0 -1
  151. package/dist/useAllBlocks-6hvuNuyw.cjs +0 -1
  152. package/dist/useAllBlocks-PQKYvs-e.js +0 -20
  153. package/dist/useChaiExternalData-4K9WxANa.js +0 -6
  154. package/dist/useChaiExternalData-DkyBJ81C.cjs +0 -1
  155. package/dist/useDarkMode-ZKCO_gkt.js +0 -23
  156. package/dist/useDarkMode-dV6FM6l-.cjs +0 -1
  157. package/dist/useFeatureSupport-OLwNgEZb.js +0 -16
  158. package/dist/useFeatureSupport-c9IgPW2t.cjs +0 -1
  159. package/dist/useHiddenBlocks-3MsGOJ1s.js +0 -15
  160. package/dist/useHiddenBlocks-oJuQDmTy.cjs +0 -1
  161. package/dist/useLanguage-NKKKaxVM.cjs +0 -1
  162. package/dist/useLanguage-gVC5rxO5.js +0 -216
  163. package/dist/useMarkAsGlobalBlock-X73Vny8u.js +0 -25
  164. package/dist/useMarkAsGlobalBlock-ebBVGHg4.cjs +0 -1
  165. package/dist/useUiLibraries-4hPOi8DI.js +0 -12
  166. package/dist/useUiLibraries-9FhQCpKo.cjs +0 -1
  167. package/dist/utils-dze1SGvB.js +0 -6
  168. package/dist/utils-qK_SjzzV.cjs +0 -1
@@ -0,0 +1,46 @@
1
+ "use strict";var Ae=Object.defineProperty;var Pe=(n,t,s)=>t in n?Ae(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var U=(n,t,s)=>(Pe(n,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WKRPbKtm.cjs"),h=require("react"),x=require("lodash"),M=require("@radix-ui/react-icons"),i=require("./index-c8zW_D2V.cjs"),je=require("react-i18next"),Y=require("jotai"),ue=require("react-dom"),K=require("./Class-RZuPYbUS.cjs"),V=require("./index-3_eUgIcu.cjs"),Me=require("@floating-ui/dom"),de=require("@floating-ui/react-dom"),_e=require("react-dnd"),Ne=require("@react-hookz/web"),Le=require("@bobthered/tailwindcss-palette-generator"),We=require("react-wrap-balancer"),$e=require("tailwind-merge"),Fe=require("./index-fwo4wa7u.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-quill");require("flat-to-nested");require("redux-undo");require("clsx");require("i18next");require("./index-aGgHTZqR.cjs");require("./lib.cjs");require("himalaya");require("@mhsdesign/jit-browser-tailwindcss");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("react-textarea-autosize");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("lucide-react");const Ue=()=>{const{undoCount:n,redoCount:t,undo:s,redo:c}=i.useCanvasHistory();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(i.Button,{disabled:!n,size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(M.ResetIcon,{})}),e.jsxRuntimeExports.jsx(i.Button,{disabled:!t,onClick:c,size:"sm",className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(M.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function He(){const[n,t]=i.useDarkMode(),{t:s}=je.useTranslation();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(i.Label,{htmlFor:"dark-mode-switch",children:s("dark_mode")}),e.jsxRuntimeExports.jsxs(i.Switch,{id:"dark-mode-switch",checked:n,onCheckedChange:()=>{t(!n)},className:`${n?"bg-violet-600":"bg-violet-300"}
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:[e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),e.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${n?"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 pe=({landscape:n=!1})=>e.jsxRuntimeExports.jsxs("svg",{className:n?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[e.jsxRuntimeExports.jsx("g",{strokeWidth:0}),e.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),e.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"}})]}),fe=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(M.MobileIcon,{}),width:400},{title:"Mobile landscape (SM)",content:"Styles set here are applied at 640px and up unless edited at higher breakpoint",breakpoint:"sm",icon:e.jsxRuntimeExports.jsx(M.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:e.jsxRuntimeExports.jsx(pe,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:e.jsxRuntimeExports.jsx(pe,{landscape:!0}),width:1024},{title:"Desktop (XL)",content:"Styles set here are applied at 1280px and up unless edited at higher breakpoint",breakpoint:"xl",icon:e.jsxRuntimeExports.jsx(M.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:e.jsxRuntimeExports.jsx(M.DesktopIcon,{}),width:1920}],ze=({title:n,content:t,currentBreakpoint:s,breakpoint:c,width:u,icon:o,onClick:a})=>e.jsxRuntimeExports.jsxs(i.HoverCard,{children:[e.jsxRuntimeExports.jsx(i.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>a(u),size:"sm",variant:c===s?"secondary":"ghost",children:o})}),e.jsxRuntimeExports.jsx(i.HoverCardContent,{className:"w-52 border-border",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:n}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),Ye=()=>{const[,n,t]=i.useCanvasWidth(),[s,c]=i.useSelectedBreakpoints(),u=o=>{s.includes(o)?s.length>2&&c(s.filter(a=>a!==o)):c(a=>[...a,o])};return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[x.map(fe.filter(o=>x.includes(s,x.toUpper(o.breakpoint))),o=>h.createElement(ze,{...o,onClick:t,key:o.breakpoint,currentBreakpoint:n})),e.jsxRuntimeExports.jsxs(i.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(i.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:e.jsxRuntimeExports.jsx(M.DotsVerticalIcon,{className:"scale-90 transform"})})}),e.jsxRuntimeExports.jsxs(i.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[e.jsxRuntimeExports.jsx(i.DropdownMenuLabel,{children:"Breakpoints"}),e.jsxRuntimeExports.jsx(i.DropdownMenuSeparator,{}),x.map(fe,o=>e.jsxRuntimeExports.jsx(i.DropdownMenuCheckboxItem,{disabled:o.breakpoint==="xs",onCheckedChange:()=>u(x.toUpper(o.breakpoint)),checked:x.includes(s,x.toUpper(o.breakpoint)),children:o.title},o.breakpoint))]})]})]})},Ke=()=>{const[n]=i.useSetAllBlocks(),{createSnapshot:t}=i.useCanvasHistory(),[,s]=i.useSelectedBlockIds(),[,c]=i.useSelectedStylingBlocks(),u=h.useCallback(()=>{n([]),s([]),c([]),t()},[n,t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(i.AlertDialog,{children:[e.jsxRuntimeExports.jsx(i.AlertDialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(i.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[e.jsxRuntimeExports.jsx(M.EraserIcon,{})," Clear"]})}),e.jsxRuntimeExports.jsxs(i.AlertDialogContent,{className:"border-border",children:[e.jsxRuntimeExports.jsxs(i.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(i.AlertDialogTitle,{children:"Clear whole canvas?"}),e.jsxRuntimeExports.jsx(i.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),e.jsxRuntimeExports.jsxs(i.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(i.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(i.AlertDialogAction,{onClick:u,children:"Yes"})]})]})]})})},Ve=()=>{const n=i.useFeatureSupport("darkMode",!1),[t]=i.useCanvasZoom();return e.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[n?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(He,{}),e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"})]}):null,e.jsxRuntimeExports.jsx(Ye,{}),e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[e.jsxRuntimeExports.jsx(M.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",e.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[x.round(t,0),"%"]})]}),e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(Ue,{})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[e.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(Ke,{})]})]})},Xe=`<!doctype html>
4
+ <html class="scroll-smooth h-full overflow-y-auto">
5
+ <head>
6
+ <meta charset="UTF-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <script src="https://old.chaibuilder.com/offline/tailwind.cdn.js"><\/script>
9
+ <style>
10
+ html { height: 100%; overflow:auto; }
11
+ body { height: 100%; }
12
+ .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
13
+ .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
14
+ body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
15
+ -moz-user-select: none;-ms-user-select: none; user-select: none; }
16
+ html{
17
+ -ms-overflow-style: none; /* IE and Edge */
18
+ scrollbar-width: none; /* Firefox */
19
+ }
20
+ /** IMPORTANT: Make fields content editable in SAFARI */
21
+ [contenteditable] {-webkit-user-select: text;user-select: text;}
22
+
23
+ html::-webkit-scrollbar { width: 0 !important }
24
+ .aspect-auto{aspect-ratio: auto;}
25
+ .aspect-square{aspect-ratio: 1/1;}
26
+ .aspect-video{aspect-ratio: 16/9;}
27
+ a{ pointer-events: none !important; }
28
+ </style>
29
+ <style id="hidden-blocks"></style>
30
+ <style id="selected-block"></style>
31
+ <style id="selected-styling-block"></style>
32
+ <style id="highlighted-block"></style>
33
+ </head>
34
+ <body class="font-body antialiased h-full">
35
+ <div class="frame-root"></div>
36
+ </body>
37
+ </html>`,Ze=n=>{const[t]=i.useCanvasWidth(),[,s]=i.useCanvasZoom(),[c,u]=h.useState({}),o=h.useCallback(()=>{const{width:a,height:f}=n;if(a<t){const j=parseFloat((a/t).toString());let R={};f&&(R={height:f+2*f*(1-j)}),u({transform:`scale(${j})`,transformOrigin:"top left",...R,maxWidth:"none"}),s(j*100)}else u({}),s(100)},[t,n,s]);return h.useEffect(()=>{o()},[t,n,s,o]),c};var Z={exports:{}};/*
38
+ object-assign
39
+ (c) Sindre Sorhus
40
+ @license MIT
41
+ */var Q,xe;function Ge(){if(xe)return Q;xe=1;var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function c(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function u(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var a={},f=0;f<10;f++)a["_"+String.fromCharCode(f)]=f;var j=Object.getOwnPropertyNames(a).map(function(p){return a[p]});if(j.join("")!=="0123456789")return!1;var R={};return"abcdefghijklmnopqrst".split("").forEach(function(p){R[p]=p}),Object.keys(Object.assign({},R)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Q=u()?Object.assign:function(o,a){for(var f,j=c(o),R,p=1;p<arguments.length;p++){f=Object(arguments[p]);for(var d in f)t.call(f,d)&&(j[d]=f[d]);if(n){R=n(f);for(var g=0;g<R.length;g++)s.call(f,R[g])&&(j[R[g]]=f[R[g]])}}return j},Q}var ee,he;function ae(){if(he)return ee;he=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ee=n,ee}var te,me;function Ee(){return me||(me=1,te=Function.call.bind(Object.prototype.hasOwnProperty)),te}var ne,ye;function Je(){if(ye)return ne;ye=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var t=ae(),s={},c=Ee();n=function(o){var a="Warning: "+o;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}}}function u(o,a,f,j,R){if(process.env.NODE_ENV!=="production"){for(var p in o)if(c(o,p)){var d;try{if(typeof o[p]!="function"){var g=Error((j||"React class")+": "+f+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}d=o[p](a,p,j,f,null,t)}catch(O){d=O}if(d&&!(d instanceof Error)&&n((j||"React class")+": type specification of "+f+" `"+p+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in s)){s[d.message]=!0;var S=R?R():"";n("Failed "+f+" type: "+d.message+(S??""))}}}}return u.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(s={})},ne=u,ne}var se,ge;function Qe(){if(ge)return se;ge=1;var n=V.reactIsExports,t=Ge(),s=ae(),c=Ee(),u=Je(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(f){var j="Warning: "+f;typeof console<"u"&&console.error(j);try{throw new Error(j)}catch{}});function a(){return null}return se=function(f,j){var R=typeof Symbol=="function"&&Symbol.iterator,p="@@iterator";function d(r){var l=r&&(R&&r[R]||r[p]);if(typeof l=="function")return l}var g="<<anonymous>>",S={array:m("array"),bigint:m("bigint"),bool:m("boolean"),func:m("function"),number:m("number"),object:m("object"),string:m("string"),symbol:m("symbol"),any:$(),arrayOf:N,element:G(),elementType:J(),instanceOf:q,node:Te(),objectOf:W,oneOf:L,oneOfType:Ce,shape:Ie,exact:Be};function O(r,l){return r===l?r!==0||1/r===1/l:r!==r&&l!==l}function w(r,l){this.message=r,this.data=l&&typeof l=="object"?l:{},this.stack=""}w.prototype=Error.prototype;function B(r){if(process.env.NODE_ENV!=="production")var l={},k=0;function E(C,v,b,T,D,I,_){if(T=T||g,I=I||b,_!==s){if(j){var A=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw A.name="Invariant Violation",A}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var H=T+":"+b;!l[H]&&k<3&&(o("You are manually calling a React.PropTypes validation function for the `"+I+"` prop on `"+T+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),l[H]=!0,k++)}}return v[b]==null?C?v[b]===null?new w("The "+D+" `"+I+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new w("The "+D+" `"+I+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:r(v,b,T,D,I)}var y=E.bind(null,!1);return y.isRequired=E.bind(null,!0),y}function m(r){function l(k,E,y,C,v,b){var T=k[E],D=F(T);if(D!==r){var I=z(T);return new w("Invalid "+C+" `"+v+"` of type "+("`"+I+"` supplied to `"+y+"`, expected ")+("`"+r+"`."),{expectedType:r})}return null}return B(l)}function $(){return B(a)}function N(r){function l(k,E,y,C,v){if(typeof r!="function")return new w("Property `"+v+"` of component `"+y+"` has invalid PropType notation inside arrayOf.");var b=k[E];if(!Array.isArray(b)){var T=F(b);return new w("Invalid "+C+" `"+v+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an array."))}for(var D=0;D<b.length;D++){var I=r(b,D,y,C,v+"["+D+"]",s);if(I instanceof Error)return I}return null}return B(l)}function G(){function r(l,k,E,y,C){var v=l[k];if(!f(v)){var b=F(v);return new w("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return B(r)}function J(){function r(l,k,E,y,C){var v=l[k];if(!n.isValidElementType(v)){var b=F(v);return new w("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return B(r)}function q(r){function l(k,E,y,C,v){if(!(k[E]instanceof r)){var b=r.name||g,T=qe(k[E]);return new w("Invalid "+C+" `"+v+"` of type "+("`"+T+"` supplied to `"+y+"`, expected ")+("instance of `"+b+"`."))}return null}return B(l)}function L(r){if(!Array.isArray(r))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),a;function l(k,E,y,C,v){for(var b=k[E],T=0;T<r.length;T++)if(O(b,r[T]))return null;var D=JSON.stringify(r,function(_,A){var H=z(A);return H==="symbol"?String(A):A});return new w("Invalid "+C+" `"+v+"` of value `"+String(b)+"` "+("supplied to `"+y+"`, expected one of "+D+"."))}return B(l)}function W(r){function l(k,E,y,C,v){if(typeof r!="function")return new w("Property `"+v+"` of component `"+y+"` has invalid PropType notation inside objectOf.");var b=k[E],T=F(b);if(T!=="object")return new w("Invalid "+C+" `"+v+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an object."));for(var D in b)if(c(b,D)){var I=r(b,D,y,C,v+"."+D,s);if(I instanceof Error)return I}return null}return B(l)}function Ce(r){if(!Array.isArray(r))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var l=0;l<r.length;l++){var k=r[l];if(typeof k!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Oe(k)+" at index "+l+"."),a}function E(y,C,v,b,T){for(var D=[],I=0;I<r.length;I++){var _=r[I],A=_(y,C,v,b,T,s);if(A==null)return null;A.data&&c(A.data,"expectedType")&&D.push(A.data.expectedType)}var H=D.length>0?", expected one of type ["+D.join(", ")+"]":"";return new w("Invalid "+b+" `"+T+"` supplied to "+("`"+v+"`"+H+"."))}return B(E)}function Te(){function r(l,k,E,y,C){return X(l[k])?null:new w("Invalid "+y+" `"+C+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return B(r)}function le(r,l,k,E,y){return new w((r||"React class")+": "+l+" type `"+k+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+y+"`.")}function Ie(r){function l(k,E,y,C,v){var b=k[E],T=F(b);if(T!=="object")return new w("Invalid "+C+" `"+v+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));for(var D in r){var I=r[D];if(typeof I!="function")return le(y,C,v,D,z(I));var _=I(b,D,y,C,v+"."+D,s);if(_)return _}return null}return B(l)}function Be(r){function l(k,E,y,C,v){var b=k[E],T=F(b);if(T!=="object")return new w("Invalid "+C+" `"+v+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));var D=t({},k[E],r);for(var I in D){var _=r[I];if(c(r,I)&&typeof _!="function")return le(y,C,v,I,z(_));if(!_)return new w("Invalid "+C+" `"+v+"` key `"+I+"` supplied to `"+y+"`.\nBad object: "+JSON.stringify(k[E],null," ")+`
42
+ Valid keys: `+JSON.stringify(Object.keys(r),null," "));var A=_(b,I,y,C,v+"."+I,s);if(A)return A}return null}return B(l)}function X(r){switch(typeof r){case"number":case"string":case"undefined":return!0;case"boolean":return!r;case"object":if(Array.isArray(r))return r.every(X);if(r===null||f(r))return!0;var l=d(r);if(l){var k=l.call(r),E;if(l!==r.entries){for(;!(E=k.next()).done;)if(!X(E.value))return!1}else for(;!(E=k.next()).done;){var y=E.value;if(y&&!X(y[1]))return!1}}else return!1;return!0;default:return!1}}function De(r,l){return r==="symbol"?!0:l?l["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&l instanceof Symbol:!1}function F(r){var l=typeof r;return Array.isArray(r)?"array":r instanceof RegExp?"object":De(l,r)?"symbol":l}function z(r){if(typeof r>"u"||r===null)return""+r;var l=F(r);if(l==="object"){if(r instanceof Date)return"date";if(r instanceof RegExp)return"regexp"}return l}function Oe(r){var l=z(r);switch(l){case"array":case"object":return"an "+l;case"boolean":case"date":case"regexp":return"a "+l;default:return l}}function qe(r){return!r.constructor||!r.constructor.name?g:r.constructor.name}return S.checkPropTypes=u,S.resetWarningCache=u.resetWarningCache,S.PropTypes=S,S},se}var re,ve;function et(){if(ve)return re;ve=1;var n=ae();function t(){}function s(){}return s.resetWarningCache=t,re=function(){function c(a,f,j,R,p,d){if(d!==n){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}c.isRequired=c;function u(){return c}var o={array:c,bigint:c,bool:c,func:c,number:c,object:c,string:c,symbol:c,any:c,arrayOf:u,element:c,elementType:c,instanceOf:u,node:c,objectOf:u,oneOf:u,oneOfType:u,shape:u,exact:u,checkPropTypes:s,resetWarningCache:t};return o.PropTypes=o,o},re}var Rt=Z.exports;if(process.env.NODE_ENV!=="production"){var tt=V.reactIsExports,nt=!0;Z.exports=Qe()(tt.isElement,nt)}else Z.exports=et()();var st=Z.exports;const P=K.getDefaultExportFromCjs(st);let be,Re;typeof document<"u"&&(be=document);typeof window<"u"&&(Re=window);const ke=h.createContext({document:be,window:Re}),ce=()=>h.useContext(ke),{Provider:rt,Consumer:kt}=ke;class we extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}U(we,"propTypes",{children:P.element.isRequired,contentDidMount:P.func.isRequired,contentDidUpdate:P.func.isRequired});class ie extends h.Component{constructor(s,c){super(s,c);U(this,"setRef",s=>{this.nodeRef.current=s;const{forwardedRef:c}=this.props;typeof c=="function"?c(s):c&&(c.current=s)});U(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});U(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 s=this.getDoc();return this.props.mountTarget?s.querySelector(this.props.mountTarget):s.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const s=this.getDoc();if(!s)return null;const c=this.props.contentDidMount,u=this.props.contentDidUpdate,o=s.defaultView||s.parentView,a=e.jsxRuntimeExports.jsx(we,{contentDidMount:c,contentDidUpdate:u,children:e.jsxRuntimeExports.jsx(rt,{value:{document:s,window:o},children:e.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),f=this.getMountTarget();return[ue.createPortal(this.props.head,this.getDoc().head),ue.createPortal(a,f)]}render(){const s={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete s.head,delete s.initialContent,delete s.mountTarget,delete s.contentDidMount,delete s.contentDidUpdate,delete s.forwardedRef,e.jsxRuntimeExports.jsx("iframe",{...s,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}U(ie,"propTypes",{style:P.object,head:P.node,initialContent:P.string,mountTarget:P.string,contentDidMount:P.func,contentDidUpdate:P.func,children:P.oneOfType([P.element,P.arrayOf(P.element)])}),U(ie,"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 it=h.forwardRef((n,t)=>e.jsxRuntimeExports.jsx(ie,{...n,forwardedRef:t})),ot=({children:n})=>{const{document:t}=ce(),[s]=i.useSelectedBlockIds(),[c,u]=i.useSelectedStylingBlocks();return h.useEffect(()=>{setTimeout(()=>{if(!x.isEmpty(c))return;const o=Se(t,x.first(s));if(o){const a=o.getAttribute("data-style-prop");if(a){const f=o.getAttribute("data-style-id"),j=o.getAttribute("data-block-parent");u([{id:f,prop:a,blockId:j}])}}},100)},[t,s,u,c]),e.jsxRuntimeExports.jsx("div",{id:"canvas",className:"relative h-screen max-w-full outline-2",children:n})},Se=(n,t)=>n.querySelector(`[data-block-id="${t}"]`),at=()=>{const{window:n}=ce(),[t,s]=i.useSelectedBlockIds(),[,c]=i.useSelectedStylingBlocks(),{undo:u,redo:o}=i.useCanvasHistory(),a=i.useDuplicateBlocks(),[,f]=i.useCutBlockIds(),[,j]=i.useCopyBlockIds(),{pasteBlocks:R}=i.usePasteBlocks(),[,p]=i.usePreviewMode(),d=i.useRemoveBlocks(),{savePage:g}=i.useSavePage(),[S]=Y.useAtom(i.inlineEditingActiveAtom),[,O]=Y.useAtom(i.editLayerNameAtom),w=B=>{B.key==="Enter"&&(B.preventDefault(),t.length===1&&O(x.first(t)))};return h.useEffect(()=>{const B=m=>{if(m.key==="Escape"){s([]),c([]);return}if(w(m),!S&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),d(t)),m.ctrlKey||m.metaKey){if(["z","y","d","x","c","p","s","v"].includes(m.key)){if(S&&["x","z","v"].includes(m.key))return!0;m.preventDefault()}m.key==="s"&&(m.stopPropagation(),m.preventDefault(),g()),m.key==="z"&&u(),m.key==="y"&&o(),m.key==="d"&&a(t),m.key==="x"&&f(t),m.key==="c"&&j(t),m.key==="v"&&t.length>0&&R(t[0])}};return n.removeEventListener("keydown",B),n.addEventListener("keydown",B),()=>{n.removeEventListener("keydown",B)}},[t,s,u,d,p,o,a,f,j,R,S,g,n]),null},ct=({block:n,label:t})=>{const[,s]=_e.useDrag(()=>({type:"CANVAS_BLOCK",item:n}));return e.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",ref:s,onDragStart:()=>{console.log("drag start")},children:[e.jsxRuntimeExports.jsx(M.DragHandleDots2Icon,{}),t]})},lt=({selectedBlockElement:n,block:t})=>{const s=i.useRemoveBlocks(),c=i.useDuplicateBlocks(),[,u]=i.useSelectedBlockIds(),[,o]=i.useSelectedStylingBlocks(),{floatingStyles:a,refs:f,update:j}=de.useFloating({placement:"top-start",middleware:[de.shift(),Me.flip()],elements:{reference:n}});Ne.useResizeObserver(n,()=>j(),n!==null);const R=x.get(t,"_parent",null),p=x.isEmpty(x.get(t,"_name",""))?x.get(t,"_type",""):x.get(t,"_name","");return!n||!t?null:e.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:f.setFloating,style:a,onClick:d=>{d.stopPropagation(),d.preventDefault()},onKeyDown:d=>d.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[e.jsxRuntimeExports.jsx(ct,{label:p,block:t}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[R&&e.jsxRuntimeExports.jsx(M.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{o([]),u([R])}}),i.canDuplicateBlock(x.get(t,"_type",""))?e.jsxRuntimeExports.jsx(M.CopyIcon,{className:"hover:scale-105 ",onClick:()=>c([t==null?void 0:t._id])}):null,i.canDeleteBlock(x.get(t,"_type",""))?e.jsxRuntimeExports.jsx(M.TrashIcon,{className:"hover:scale-105 ",onClick:()=>s([t==null?void 0:t._id])}):null]})]})},ut=({model:n})=>{const[t]=i.useBrandingOptions(),[s]=i.useSelectedBlockIds(),[c]=i.useDarkMode(),[u]=i.useHighlightBlockId(),[o]=i.useSelectedStylingBlocks(),{document:a,window:f}=ce(),[j]=h.useState(a==null?void 0:a.getElementById("highlighted-block")),[R]=h.useState(a==null?void 0:a.getElementById("selected-block")),[p]=h.useState(a==null?void 0:a.getElementById("selected-styling-block"));h.useEffect(()=>{c?a==null||a.documentElement.classList.add("dark"):a==null||a.documentElement.classList.remove("dark")},[c,a]);const d=x.get(t,"headingFont","DM Sans"),g=x.get(t,"bodyFont","DM Sans");return h.useEffect(()=>{const S=x.get(t,"primaryColor","#000"),O=x.get(t,"secondaryColor","#FFF"),w=Le.tailwindcssPaletteGenerator({colors:[S,O],names:["primary","secondary"]});w.primary.DEFAULT=S,w.secondary.DEFAULT=O;const B=x.get(t,"roundedCorners","0");!f||!f.tailwind||(f.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[d],body:[g]},extend:{borderRadius:{global:`${B||"0"}px`},colors:w}},plugins:[f.tailwind.plugin.withOptions(({prefix:m="ui"}={})=>({addVariant:$})=>{for(const N of["open","checked","selected","active","disabled"])$(`${m}-${N}`,[`&[data-headlessui-state~="${N}"]`,`:where([data-headlessui-state~="${N}"]) &`]),$(`${m}-not-${N}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${N}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${N}"])) &:not([data-headlessui-state])`])})]})},[t,f,d,g]),h.useEffect(()=>{R&&(R.textContent=`${x.map(s,S=>`[data-block-id="${S}"]`).join(",")}{
43
+ outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
44
+ }`)},[s,R]),h.useEffect(()=>{j&&(j.textContent=u?`[data-style-id="${u}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[u,s,j]),h.useEffect(()=>{p&&(p.textContent=`${x.map(o,({id:S})=>`[data-style-id="${S}"]`).join(",")}{
45
+ outline: 1px solid orange !important; outline-offset: -1px;
46
+ }`)},[o,p]),h.useEffect(()=>{if(n==="section")return;const S=x.get(t,"bodyTextLightColor","#64748b"),O=x.get(t,"bodyTextDarkColor","#94a3b8"),w=x.get(t,"bodyBgLightColor","#FFFFFF"),B=x.get(t,"bodyBgDarkColor","#0f172a");a.body.className=`font-body antialiased text-[${S}] bg-[${w}] dark:text-[${O}] dark:bg-[${B}]`},[t,a,n]),n==="page"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d&&e.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${d.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),g&&d!==g&&e.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${g.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),d&&e.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${d}",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},dt=()=>{const{t:n}=je.useTranslation();return e.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:e.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:n("canvas_empty")})})},pt=n=>{const t={};return Object.keys(n).forEach(s=>{x.isString(n[s])&&n[s].startsWith(K.SLOT_KEY)&&(t[s]=n[s].replace(K.SLOT_KEY,"").split(","))}),t},ft=x.memoize(n=>{const t=n.replace(K.STYLES_KEY,"").split(",");return $e.twMerge(t[0],t[1])});function xt(n,t){return x.get(n,`${t}_attrs`,{})}function ht(n,t,s,c){const u={};return Object.keys(n).forEach(o=>{if(x.isString(n[o])&&n[o].startsWith(K.STYLES_KEY)){const a=ft(n[o]);u[o]={className:a,"data-style-prop":o,"data-block-parent":n._id,"data-style-id":`${o}-${n._id}`,onMouseEnter:t,onMouseLeave:s,onClick:c,...xt(n,o)}}}),u}function mt(n,t){const s=x.get(n,"_bindings",{});return x.isEmpty(s)?{...n}:(x.each(s,(c,u)=>{x.isString(c)&&x.get(t,c,null)&&(n[u]=x.get(t,c,null))}),n)}function oe({blocks:n}){const t=i.useAllBlocks(),[,s]=i.useHighlightBlockId(),[,c]=i.useSelectedStylingBlocks(),[,u]=i.useSelectedBlockIds(),o=h.useCallback(p=>{var g;const d=(g=p.currentTarget)==null?void 0:g.getAttribute("data-style-id");s(d||""),p.stopPropagation()},[s]),a=h.useCallback(p=>{s(""),p.stopPropagation()},[s]),f=h.useCallback(p=>{p.stopPropagation();const d=p.currentTarget;if(d.getAttribute("data-block-parent")){const g=d.getAttribute("data-style-prop"),S=d.getAttribute("data-style-id"),O=d.getAttribute("data-block-parent");c([{id:S,prop:g,blockId:O}]),u([O])}else if(d.getAttribute("data-block-id")&&(u([d.getAttribute("data-block-id")]),d.getAttribute("data-block-parent"))){const g=d.getAttribute("data-style-prop"),S=d.getAttribute("data-style-id"),O=d.getAttribute("data-block-parent");c([{id:S,prop:g,blockId:O}])}},[c,u]),j=h.useCallback(p=>ht(p,o,a,f),[f,o,a]),[R]=V.useChaiExternalData();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:h.Children.toArray(n.map((p,d)=>{const g=pt(p),S={};x.isEmpty(g)||Object.keys(g).forEach(m=>{S[m]=h.Children.toArray(g[m].map($=>e.jsxRuntimeExports.jsx(oe,{blocks:[x.find(t,{_id:$})]})))});const O=x.filter(t,{_parent:p._id});S.children=O.length?e.jsxRuntimeExports.jsx(oe,{blocks:O}):null;const w=Fe.h(p._type),B=x.get(w,"component",null);return x.isNull(B)?e.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${p==null?void 0:p._type} not registered -->`}):e.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(B,{blockProps:{onClick:f,"data-block-id":p._id,"data-block-type":p._type},inBuilder:!0,index:d,...mt(p,R),...j(p),...S})})}))})}const yt=()=>{const n=i.useAllBlocks();return e.jsxRuntimeExports.jsx(We.Provider,{children:x.isEmpty(n)?e.jsxRuntimeExports.jsx(dt,{}):e.jsxRuntimeExports.jsx(V.BlocksExternalDataProvider,{children:e.jsxRuntimeExports.jsx(oe,{blocks:x.filter(n,t=>x.isEmpty(t._parent))})})})},gt=(n,t)=>n.querySelector(`[data-style-id="${t}"]`),vt=()=>{const[n]=Y.useAtom(i.networkModeAtom),[t]=i.usePreviewMode(),[s]=i.useCanvasWidth(),[,c]=i.useSelectedBlockIds(),u=i.useSelectedBlock(),[,o]=i.useHighlightBlockId(),a=h.useRef(null),f=h.useRef(null),[j,R]=h.useState({width:0,height:0}),p=Ze(j),[d,g]=h.useState(0),[S,O]=h.useState([]),[,w]=h.useState([]),[,B]=Y.useAtom(i.canvasIframeAtom),[m,$]=i.useSelectedStylingBlocks(),N=i.useBuilderProp("loadingCanvas",!1);h.useEffect(()=>{const{clientWidth:q,clientHeight:L}=f.current;R({width:q,height:L}),d===0&&g(q)},[f,s,d]);const G=(q,L=0)=>{const{top:W}=q.getBoundingClientRect();return W+L>=0&&W-L<=window.innerHeight};h.useEffect(()=>{var q,L;if(u&&u.type!=="Multiple"&&a.current){const W=Se(a.current.contentDocument,u._id);W&&(G(W)||(L=(q=a.current)==null?void 0:q.contentWindow)==null||L.scrollTo({top:W.offsetTop,behavior:"smooth"}),O([W]))}},[u]),h.useEffect(()=>{if(!x.isEmpty(m)&&a.current){const q=gt(a.current.contentDocument,x.first(m).id);w(q?[q]:[null])}else w([null])},[m]);const J=h.useMemo(()=>{let q=Xe;return n==="offline"&&(q=q.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),q=q.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),q=q.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),q},[n]);return e.jsxRuntimeExports.jsx("div",{onClick:()=>{c([]),$([])},onMouseLeave:()=>setTimeout(()=>o(""),300),className:"relative mx-auto h-full w-full",style:d>0&&!x.isEmpty(p)?{width:t?"100%":d}:{},ref:f,children:e.jsxRuntimeExports.jsxs(it,{contentDidMount:()=>B(a.current),ref:a,id:"canvas-iframe",style:{width:`${s}px`,...p},className:"relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",initialContent:J,children:[e.jsxRuntimeExports.jsx(at,{}),e.jsxRuntimeExports.jsx(lt,{block:u,selectedBlockElement:x.first(S)}),e.jsxRuntimeExports.jsx(ut,{model:"page"}),e.jsxRuntimeExports.jsxs(ot,{children:[N?e.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"})}):e.jsxRuntimeExports.jsx(yt,{}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},jt=h.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-jU0NwP_s.cjs"))),Et=()=>{const[n,t]=Y.useAtom(i.addBlocksModalAtom);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxRuntimeExports.jsx(Ve,{}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/80 px-2 bg-[linear-gradient(to_right,#EEE_0.5px,transparent_0.5px),linear-gradient(to_bottom,#EEE_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[e.jsxRuntimeExports.jsx(h.Suspense,{fallback:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"}),children:e.jsxRuntimeExports.jsx(V.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(vt,{})})}),n?e.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:e.jsxRuntimeExports.jsx("div",{onClick:s=>s.stopPropagation(),className:"mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",children:e.jsxRuntimeExports.jsx(jt,{})})}):null]})]})};exports.default=Et;