@chaibuilder/sdk 1.1.9 → 1.1.10

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 (56) hide show
  1. package/dist/{AddBlocks-VR2XGlgQ.js → AddBlocks-Rd2EpNMr.js} +1 -1
  2. package/dist/{AddBlocks-Et_v-kdv.cjs → AddBlocks-YS5XlqpG.cjs} +1 -1
  3. package/dist/{BrandingOptions-SXbo_LEP.js → BrandingOptions-OVjd8R6I.js} +1 -1
  4. package/dist/{BrandingOptions-bZn4TXCB.cjs → BrandingOptions-rTaSfm0M.cjs} +1 -1
  5. package/dist/{CanvasArea-xBMxzh_r.cjs → CanvasArea-_eT3OREW.cjs} +3 -3
  6. package/dist/{CanvasArea-h4l0r7Ql.js → CanvasArea-zAT94LPr.js} +5 -5
  7. package/dist/{CurrentPage-YGM6tLCg.cjs → CurrentPage-J3WuljO3.cjs} +1 -1
  8. package/dist/{CurrentPage-2YpnE3z7.js → CurrentPage-awyWzrD1.js} +2 -2
  9. package/dist/{Layers-Twu9zS3g.js → Layers-Iu48BWko.js} +4 -4
  10. package/dist/{Layers-HZApEk-h.cjs → Layers-SkyPSf1R.cjs} +1 -1
  11. package/dist/{MarkAsGlobalBlock-QTujTxNj.js → MarkAsGlobalBlock--GjBOKA4.js} +1 -1
  12. package/dist/{MarkAsGlobalBlock-u8N_7PBX.cjs → MarkAsGlobalBlock-GV1kflbN.cjs} +1 -1
  13. package/dist/{PagesPanel-iRgy80Z4.js → PagesPanel-FiGBY1m8.js} +3 -3
  14. package/dist/{PagesPanel-W68J0fFD.cjs → PagesPanel-dzL5sq6p.cjs} +1 -1
  15. package/dist/{ProjectPanel-bl_zr1Zy.js → ProjectPanel-c5QlZgrp.js} +3 -3
  16. package/dist/{ProjectPanel-agiWUiVb.cjs → ProjectPanel-uOP0fGfw.cjs} +1 -1
  17. package/dist/{Settings-qw8xQXnk.js → Settings-FuvoLEbx.js} +2 -2
  18. package/dist/{Settings-veyss6AT.cjs → Settings-QxjYc9wt.cjs} +1 -1
  19. package/dist/{SidePanels-8tNhVPvi.js → SidePanels-2FjCLw9X.js} +3 -3
  20. package/dist/{SidePanels-BrItHT9y.cjs → SidePanels-9tKSnDxd.cjs} +1 -1
  21. package/dist/{Topbar-21E00R1y.cjs → Topbar-P3sqe-wG.cjs} +1 -1
  22. package/dist/{Topbar-pbqGE6Xy.js → Topbar-qloDpVn7.js} +1 -1
  23. package/dist/{UnsplashImages-J2kiowyR.cjs → UnsplashImages-8p0Vu9j_.cjs} +1 -1
  24. package/dist/{UnsplashImages-qm48rQ85.js → UnsplashImages-aVlfl8Rj.js} +1 -1
  25. package/dist/{UploadImages-0hJF9pBC.js → UploadImages-7xgCWSqx.js} +1 -1
  26. package/dist/{UploadImages-Hvetk6zO.cjs → UploadImages-PjW68B7L.cjs} +1 -1
  27. package/dist/{add-page-modal-U7Vh5_3P.cjs → add-page-modal-1ied5RTu.cjs} +1 -1
  28. package/dist/{add-page-modal-R2AAoK3R.js → add-page-modal-o4WyfyUe.js} +3 -3
  29. package/dist/{confirm-alert-wEcYtKUU.js → confirm-alert-OQrR9mLj.js} +1 -1
  30. package/dist/{confirm-alert-5io1ceQF.cjs → confirm-alert-Wvv7pPyF.cjs} +1 -1
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.js +2 -2
  33. package/dist/{delete-page-modal-6ogwTW2k.cjs → delete-page-modal-fKBafNSA.cjs} +1 -1
  34. package/dist/{delete-page-modal-69BK9Amt.js → delete-page-modal-pWTbYmMV.js} +2 -2
  35. package/dist/{form-uP2ot_6S.cjs → form-1HQKf4Lc.cjs} +1 -1
  36. package/dist/{form-_0bVd6F-.js → form-W_17vJvn.js} +1 -1
  37. package/dist/{index-wmzVWtmw.js → index-D15K4BZT.js} +2 -2
  38. package/dist/index-MIe2pKhn.cjs +1 -0
  39. package/dist/{index-ebo_5bTI.js → index-RYlMCgpN.js} +3 -3
  40. package/dist/{index-qLYDvpSi.cjs → index-kVugkp77.cjs} +2 -2
  41. package/dist/{page-viewer-L4MKYffF.js → page-viewer-CijLLu6R.js} +3 -3
  42. package/dist/{page-viewer-t7cGqLNI.cjs → page-viewer-_mpbB5Lr.cjs} +1 -1
  43. package/dist/{project-general-setting-sfh80XRT.cjs → project-general-setting-gwcHJ-ow.cjs} +1 -1
  44. package/dist/{project-general-setting-ixBlo6KH.js → project-general-setting-rHyDn0aW.js} +3 -3
  45. package/dist/{project-seo-setting-iJW4zDZz.js → project-seo-setting-bW4cNODi.js} +2 -2
  46. package/dist/{project-seo-setting-pOIFrso5.cjs → project-seo-setting-uEYqfVt6.cjs} +1 -1
  47. package/dist/{single-page-detail-OwDaEcUN.js → single-page-detail-UUVe4WYc.js} +4 -4
  48. package/dist/{single-page-detail-4KlhF5AH.cjs → single-page-detail-aNLmbldV.cjs} +1 -1
  49. package/dist/studio.cjs +1 -1
  50. package/dist/studio.js +2 -2
  51. package/dist/ui.cjs +1 -1
  52. package/dist/ui.js +1 -1
  53. package/dist/{useAddBlockByDrop-3RSPGnwT.cjs → useAddBlockByDrop-8i3iNtPF.cjs} +1 -1
  54. package/dist/{useAddBlockByDrop-Vcz4iQCH.js → useAddBlockByDrop-wiagwec5.js} +1 -1
  55. package/package.json +2 -2
  56. package/dist/index-uu0QwUDN.cjs +0 -1
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-NV737rRe.js";
2
2
  import B, { createElement as z, useState as g, useCallback as q, useMemo as V, useEffect as U, Suspense as W } from "react";
3
3
  import { has as D, first as h, omit as J, isEmpty as j, filter as y, values as k, groupBy as T, mergeWith as K, isArray as P, keys as Q, get as X, map as N, includes as A, find as H, uniq as Y, reject as E } from "lodash";
4
4
  import { useAtom as f } from "jotai";
5
- import { O as I, j as v, _ as Z, av as R, aw as S, aD as $, aE as ee, aG as se, i as te, a8 as _, aq as re, ar as oe, as as le, at as ae, au as F, bp as ce, bq as ie, br as ne, bs as de, bt as me, aI as pe, bu as ue, bv as xe, B as he, bw as fe, bx as be, by as ge, ae as je, ax as ye, ay as ke, az as w, bo as Be, bh as ve, bi as Ce, bj as we, bk as Te, S as Ne } from "./index-wmzVWtmw.js";
5
+ import { O as I, j as v, _ as Z, av as R, aw as S, aD as $, aE as ee, aG as se, i as te, a8 as _, aq as re, ar as oe, as as le, at as ae, au as F, bp as ce, bq as ie, br as ne, bs as de, bt as me, aI as pe, bu as ue, bv as xe, B as he, bw as fe, bx as be, by as ge, ae as je, ax as ye, ay as ke, az as w, bo as Be, bh as ve, bi as Ce, bj as we, bk as Te, S as Ne } from "./index-D15K4BZT.js";
6
6
  import { BoxIcon as Ae } from "@radix-ui/react-icons";
7
7
  import { syncBlocksWithDefaults as G, useChaiBlocks as O } from "@chaibuilder/runtime";
8
8
  import { useFeature as Ie } from "flagged";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),a=require("react"),t=require("lodash"),g=require("jotai"),s=require("./index-uu0QwUDN.cjs"),q=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),v=require("flagged"),T=require("lucide-react"),B=require("react-dnd"),A=require("./lib.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("react-i18next");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");const C=({block:r})=>{const{type:o,icon:l,label:d}=r,{addCoreBlock:x,addPredefinedBlock:m}=s.useAddBlock(),[j,p]=s.useSelectedBlockIds(),[,n]=s.useHighlightBlockId(),[,f]=g.useAtom(s.activePanelAtom),[,c]=g.useAtom(s.addBlocksModalAtom),i=()=>{t.has(r,"blocks")?m(b.syncBlocksWithDefaults(r.blocks),t.first(j)):x(r,t.first(j)),c(!1),f("layers")},h=v.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:i,type:"button",onDragStart:E=>{E.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{p([]),n(null),c(!1),f("layers")},200)},draggable:h?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(h?"cursor-grab":"cursor-pointer"),children:[a.createElement(l||q.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:d||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:d||o})})]})})},w=({block:r,closePopover:o})=>{var i;const[l,d]=a.useState(!1),x=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:j}=s.useAddBlock(),[p]=s.useSelectedBlockIds(),[,n,f]=B.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),c=a.useCallback(async h=>{if(h.stopPropagation(),t.has(r,"component")){m(r,t.first(p)),o();return}d(!0);const E=await x(r);t.isEmpty(E)||j(b.syncBlocksWithDefaults(E),t.first(p)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B.DragPreviewImage,{connect:f,src:"https://placehold.co/100x30/000000/FFF?text="+((i=r.name||r.label)==null?void 0:i.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:n,onClick:l?()=>{}:c,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:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(T.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})})]})]})},N=()=>{const{data:r}=s.useUILibraryBlocks(),o=b.useChaiBlocks(),l=t.filter(t.values(o),{category:"custom"}),d=t.groupBy(l,"group"),x=t.groupBy(r,"group"),m=a.useMemo(()=>t.mergeWith(d,x,(c,i)=>{if(t.isArray(c)&&t.isArray(i))return[...c,...i]}),[d,x]),[,j]=g.useAtom(s.addBlocksModalAtom),[p,n]=a.useState(t.first(t.keys(m))||""),f=t.get(m,p,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:p,onValueChange:c=>n(c),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"}),a.Children.toArray(t.map(m,(c,i)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:i,children:i},i)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:a.Children.toArray(f.map(c=>e.jsxRuntimeExports.jsx(w,{block:c,closePopover:()=>j(!1)})))})]})},S=()=>{const[r,o]=a.useState(""),{addPredefinedBlock:l}=s.useAddBlock(),[d]=s.useSelectedBlockIds(),[,x]=g.useAtom(s.addBlockOffCanvasAtom),[,m]=g.useAtom(s.activePanelAtom),[,j]=g.useAtom(s.addBlocksModalAtom),p=()=>{const n=A.getBlocksFromHTML(r);l([...n],t.first(d)||null),o(""),x(!1),m("layers"),j(!1)};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:"Use HTML snippets from Tailwind CSS component libraries etc. or just copy paste your own HTML code."})}),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:"Tailwind HTML snippet:"}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:n=>n&&n.focus(),defaultValue:r,onChange:n=>o(n.target.value),rows:12,placeholder:"Enter your code snippet here...",className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:r.trim()==="",onClick:()=>p(),size:"sm",className:"w-full",children:"Import HTML"}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:"NOTE: Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})})]})]})},k=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],I=(r,o)=>{if(!r)return!t.includes(k,o);const l=r._type;return l==="List"?o==="ListItem":l==="Table"?o==="TableHead"||o==="TableBody":l==="TableHead"||l==="TableBody"?o==="TableRow":l==="TableRow"?o==="TableCell":l==="Row"?o==="Column":!t.includes(k,o)},L=()=>{const[r,o]=a.useState("core"),[l,d]=a.useState("basic"),x=b.useChaiBlocks(),[,m]=g.useAtom(s.showPredefinedBlockCategoryAtom),[j]=s.useSelectedBlockIds(),p=s.useAllBlocks(),n=t.find(p,{_id:t.first(j)}),{data:f,isLoading:c}=s.useUILibraryBlocks(),i=t.groupBy(t.filter(x,u=>I(n,u.type)),"category"),h=t.uniq(t.map(i.core,"group"));a.useEffect(()=>{!t.includes(h,l)&&!t.isEmpty(h)&&!t.isEmpty(l)&&d(t.first(h))},[h,l]);const E=u=>d(R=>R===u?"":u),y=!c&&!t.isEmpty(f)||t.find(t.values(x),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full 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:"Add block"}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r==="html"?"(Enter or paste TailwindCSS HTML snippet)":"(Click to add block to page)"})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:u=>{m(""),o(u)},value:r,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(y?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:"Core"}),y?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:"Custom Blocks"}):null,e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:"Import "})]})}),r==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:l,className:"w-full px-3",children:a.Children.toArray(t.map(h,u=>t.reject(t.filter(t.values(i.core),{group:u}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:u,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>E(u),className:"py-2 capitalize",children:u}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:a.Children.toArray(t.reject(t.filter(t.values(i.core),{group:u}),{hidden:!0}).map(R=>e.jsxRuntimeExports.jsx(C,{block:R})))})})]}):null))})}),r==="ui-blocks"&&e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(N,{})}),r==="html"&&e.jsxRuntimeExports.jsx(S,{})]})};exports.default=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),a=require("react"),t=require("lodash"),g=require("jotai"),s=require("./index-MIe2pKhn.cjs"),q=require("@radix-ui/react-icons"),b=require("@chaibuilder/runtime"),v=require("flagged"),T=require("lucide-react"),B=require("react-dnd"),A=require("./lib.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("react-i18next");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");const C=({block:r})=>{const{type:o,icon:l,label:d}=r,{addCoreBlock:x,addPredefinedBlock:m}=s.useAddBlock(),[j,p]=s.useSelectedBlockIds(),[,n]=s.useHighlightBlockId(),[,f]=g.useAtom(s.activePanelAtom),[,c]=g.useAtom(s.addBlocksModalAtom),i=()=>{t.has(r,"blocks")?m(b.syncBlocksWithDefaults(r.blocks),t.first(j)):x(r,t.first(j)),c(!1),f("layers")},h=v.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:i,type:"button",onDragStart:E=>{E.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),setTimeout(()=>{p([]),n(null),c(!1),f("layers")},200)},draggable:h?"true":"false",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(h?"cursor-grab":"cursor-pointer"),children:[a.createElement(l||q.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:d||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:d||o})})]})})},w=({block:r,closePopover:o})=>{var i;const[l,d]=a.useState(!1),x=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:j}=s.useAddBlock(),[p]=s.useSelectedBlockIds(),[,n,f]=B.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),c=a.useCallback(async h=>{if(h.stopPropagation(),t.has(r,"component")){m(r,t.first(p)),o();return}d(!0);const E=await x(r);t.isEmpty(E)||j(b.syncBlocksWithDefaults(E),t.first(p)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B.DragPreviewImage,{connect:f,src:"https://placehold.co/100x30/000000/FFF?text="+((i=r.name||r.label)==null?void 0:i.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:n,onClick:l?()=>{}:c,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:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(T.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})})]})]})},N=()=>{const{data:r}=s.useUILibraryBlocks(),o=b.useChaiBlocks(),l=t.filter(t.values(o),{category:"custom"}),d=t.groupBy(l,"group"),x=t.groupBy(r,"group"),m=a.useMemo(()=>t.mergeWith(d,x,(c,i)=>{if(t.isArray(c)&&t.isArray(i))return[...c,...i]}),[d,x]),[,j]=g.useAtom(s.addBlocksModalAtom),[p,n]=a.useState(t.first(t.keys(m))||""),f=t.get(m,p,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("div",{className:"p-3 sticky top-0 flex w-full items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{value:p,onValueChange:c=>n(c),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"}),a.Children.toArray(t.map(m,(c,i)=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:i,children:i},i)))]})]})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-2",children:a.Children.toArray(f.map(c=>e.jsxRuntimeExports.jsx(w,{block:c,closePopover:()=>j(!1)})))})]})},S=()=>{const[r,o]=a.useState(""),{addPredefinedBlock:l}=s.useAddBlock(),[d]=s.useSelectedBlockIds(),[,x]=g.useAtom(s.addBlockOffCanvasAtom),[,m]=g.useAtom(s.activePanelAtom),[,j]=g.useAtom(s.addBlocksModalAtom),p=()=>{const n=A.getBlocksFromHTML(r);l([...n],t.first(d)||null),o(""),x(!1),m("layers"),j(!1)};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:"Use HTML snippets from Tailwind CSS component libraries etc. or just copy paste your own HTML code."})}),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:"Tailwind HTML snippet:"}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:n=>n&&n.focus(),defaultValue:r,onChange:n=>o(n.target.value),rows:12,placeholder:"Enter your code snippet here...",className:"resize-none bg-gray-100 overflow-x-auto whitespace-pre text-xs font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:r.trim()==="",onClick:()=>p(),size:"sm",className:"w-full",children:"Import HTML"}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 p-1 border-none text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:"NOTE: Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})})]})]})},k=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],I=(r,o)=>{if(!r)return!t.includes(k,o);const l=r._type;return l==="List"?o==="ListItem":l==="Table"?o==="TableHead"||o==="TableBody":l==="TableHead"||l==="TableBody"?o==="TableRow":l==="TableRow"?o==="TableCell":l==="Row"?o==="Column":!t.includes(k,o)},L=()=>{const[r,o]=a.useState("core"),[l,d]=a.useState("basic"),x=b.useChaiBlocks(),[,m]=g.useAtom(s.showPredefinedBlockCategoryAtom),[j]=s.useSelectedBlockIds(),p=s.useAllBlocks(),n=t.find(p,{_id:t.first(j)}),{data:f,isLoading:c}=s.useUILibraryBlocks(),i=t.groupBy(t.filter(x,u=>I(n,u.type)),"category"),h=t.uniq(t.map(i.core,"group"));a.useEffect(()=>{!t.includes(h,l)&&!t.isEmpty(h)&&!t.isEmpty(l)&&d(t.first(h))},[h,l]);const E=u=>d(R=>R===u?"":u),y=!c&&!t.isEmpty(f)||t.find(t.values(x),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full 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:"Add block"}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r==="html"?"(Enter or paste TailwindCSS HTML snippet)":"(Click to add block to page)"})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:u=>{m(""),o(u)},value:r,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(y?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:"Core"}),y?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:"Custom Blocks"}):null,e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:"Import "})]})}),r==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:l,className:"w-full px-3",children:a.Children.toArray(t.map(h,u=>t.reject(t.filter(t.values(i.core),{group:u}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:u,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>E(u),className:"py-2 capitalize",children:u}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:a.Children.toArray(t.reject(t.filter(t.values(i.core),{group:u}),{hidden:!0}).map(R=>e.jsxRuntimeExports.jsx(C,{block:R})))})})]}):null))})}),r==="ui-blocks"&&e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(N,{})}),r==="html"&&e.jsxRuntimeExports.jsx(S,{})]})};exports.default=L;
@@ -2,7 +2,7 @@ import { j as t } from "./jsx-runtime-NV737rRe.js";
2
2
  import * as c from "react";
3
3
  import O from "@rjsf/validator-ajv8";
4
4
  import N from "@rjsf/core";
5
- import { i as j, x as k } from "./index-wmzVWtmw.js";
5
+ import { i as j, x as k } from "./index-D15K4BZT.js";
6
6
  import { f as g, c as D, y as a } from "./controls-G0puEH71.js";
7
7
  import { debounce as P, isEqual as R } from "lodash";
8
8
  import "./MODIFIERS-MLfpKQY1.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-WUGKV8jN.cjs"),j=require("react"),B=require("@rjsf/validator-ajv8"),R=require("@rjsf/core"),g=require("./index-uu0QwUDN.cjs"),r=require("./controls-aHZq-q4b.cjs"),m=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=N(j),E=({value:t,onChange:e,id:i,onBlur:a})=>{const d=m.debounce(e,200),c=n=>d(n.target.value);return l.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:l.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:l.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:n}})=>a(i,n),onChange:c})})})},f=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=g.useBuilderProp("onSaveBrandingOptions",async()=>{}),[e,i]=g.useBrandingOptions(),a=x.useRef(e);x.useEffect(()=>()=>{m.isEqual(e,a.current)||t(a.current)},[]);const d=({formData:o},s)=>{s&&(i(o),a.current=o)},{bodyFont:c,headingFont:n,primaryColor:y,bodyTextDarkColor:q,bodyTextLightColor:b,bodyBgDarkColor:h,secondaryColor:S,bodyBgLightColor:C,roundedCorners:O}=e,v={headingFont:r.f({title:"Heading font",default:n,options:f}),bodyFont:r.f({title:"Body font",default:c,options:f}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(O||5,10)}),primaryColor:r.y({title:"Primary",default:y}),secondaryColor:r.y({title:"Secondary",default:S}),bodyBgLightColor:r.y({title:"Body Background (Light)",default:C}),bodyBgDarkColor:r.y({title:"Body Background (Dark)",default:h}),bodyTextLightColor:r.y({title:"Body Text (Light)",default:q}),bodyTextDarkColor:r.y({title:"Body Text (Dark)",default:b})},u={type:"object",properties:{}},p={};return Object.keys(v).forEach(o=>{const s=v[o];return u.properties||(u.properties={}),u.properties[o]=s.schema,p[o]=s.uiSchema,!0}),l.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[l.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:l.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),l.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:l.jsxRuntimeExports.jsx(R,{widgets:{color:E},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:p,schema:u,formData:e,validator:B,onChange:d})})]})};exports.default=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-WUGKV8jN.cjs"),j=require("react"),B=require("@rjsf/validator-ajv8"),R=require("@rjsf/core"),g=require("./index-MIe2pKhn.cjs"),r=require("./controls-aHZq-q4b.cjs"),m=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");function N(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=N(j),E=({value:t,onChange:e,id:i,onBlur:a})=>{const d=m.debounce(e,200),c=n=>d(n.target.value);return l.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:l.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:l.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:n}})=>a(i,n),onChange:c})})})},f=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],P=()=>{const t=g.useBuilderProp("onSaveBrandingOptions",async()=>{}),[e,i]=g.useBrandingOptions(),a=x.useRef(e);x.useEffect(()=>()=>{m.isEqual(e,a.current)||t(a.current)},[]);const d=({formData:o},s)=>{s&&(i(o),a.current=o)},{bodyFont:c,headingFont:n,primaryColor:y,bodyTextDarkColor:q,bodyTextLightColor:b,bodyBgDarkColor:h,secondaryColor:S,bodyBgLightColor:C,roundedCorners:O}=e,v={headingFont:r.f({title:"Heading font",default:n,options:f}),bodyFont:r.f({title:"Body font",default:c,options:f}),roundedCorners:r.c({title:"Rounded Corner",default:parseInt(O||5,10)}),primaryColor:r.y({title:"Primary",default:y}),secondaryColor:r.y({title:"Secondary",default:S}),bodyBgLightColor:r.y({title:"Body Background (Light)",default:C}),bodyBgDarkColor:r.y({title:"Body Background (Dark)",default:h}),bodyTextLightColor:r.y({title:"Body Text (Light)",default:q}),bodyTextDarkColor:r.y({title:"Body Text (Dark)",default:b})},u={type:"object",properties:{}},p={};return Object.keys(v).forEach(o=>{const s=v[o];return u.properties||(u.properties={}),u.properties[o]=s.schema,p[o]=s.uiSchema,!0}),l.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[l.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:l.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),l.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:l.jsxRuntimeExports.jsx(R,{widgets:{color:E},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:p,schema:u,formData:e,validator:B,onChange:d})})]})};exports.default=P;
@@ -1,4 +1,4 @@
1
- "use strict";var We=Object.defineProperty;var $e=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),x=require("lodash"),L=require("@radix-ui/react-icons"),r=require("./index-uu0QwUDN.cjs"),Ue=require("react-i18next"),H=require("jotai"),he=require("react-dom"),Z=require("./MODIFIERS-WFzDQfiT.cjs"),Q=require("./index-qLYDvpSi.cjs"),ze=require("react-quill"),Ye=require("./useAddBlockByDrop-3RSPGnwT.cjs"),Se=require("flagged"),Ke=require("@floating-ui/dom"),ge=require("@floating-ui/react-dom"),Je=require("@react-hookz/web"),Xe=require("@bobthered/tailwindcss-palette-generator"),Ve=require("react-wrap-balancer"),Ze=require("tailwind-merge"),Ge=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("flat-to-nested");require("redux-undo");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const Qe=()=>{const{undoCount:e,redoCount:t,undo:n,redo:a}=r.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{})}),s.jsxRuntimeExports.jsx(r.Button,{disabled:!t,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function et(){const[e,t]=r.useDarkMode(),{t:n}=Ue.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(r.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
1
+ "use strict";var We=Object.defineProperty;var $e=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),x=require("lodash"),L=require("@radix-ui/react-icons"),r=require("./index-MIe2pKhn.cjs"),Ue=require("react-i18next"),H=require("jotai"),he=require("react-dom"),Z=require("./MODIFIERS-WFzDQfiT.cjs"),Q=require("./index-kVugkp77.cjs"),ze=require("react-quill"),Ye=require("./useAddBlockByDrop-8i3iNtPF.cjs"),Se=require("flagged"),Ke=require("@floating-ui/dom"),ge=require("@floating-ui/react-dom"),Je=require("@react-hookz/web"),Xe=require("@bobthered/tailwindcss-palette-generator"),Ve=require("react-wrap-balancer"),Ze=require("tailwind-merge"),Ge=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("flat-to-nested");require("redux-undo");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const Qe=()=>{const{undoCount:e,redoCount:t,undo:n,redo:a}=r.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{})}),s.jsxRuntimeExports.jsx(r.Button,{disabled:!t,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(L.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function et(){const[e,t]=r.useDarkMode(),{t:n}=Ue.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(r.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"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:[s.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),s.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
3
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 me=({landscape:e=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.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"}})]}),ye=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(L.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:s.jsxRuntimeExports.jsx(L.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(me,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(me,{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:s.jsxRuntimeExports.jsx(L.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(L.DesktopIcon,{}),width:1920}],tt=({title:e,content:t,currentBreakpoint:n,breakpoint:a,width:c,icon:i,onClick:u})=>s.jsxRuntimeExports.jsxs(r.HoverCard,{children:[s.jsxRuntimeExports.jsx(r.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(r.Button,{onClick:()=>u(c),size:"sm",variant:a===n?"secondary":"ghost",children:i})}),s.jsxRuntimeExports.jsx(r.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:e}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),nt=()=>{const[,e,t]=r.useCanvasWidth(),[n,a]=r.useSelectedBreakpoints(),c=i=>{n.includes(i)?n.length>2&&a(n.filter(u=>u!==i)):a(u=>[...u,i])};return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[x.map(ye.filter(i=>x.includes(n,x.toUpper(i.breakpoint))),i=>m.createElement(tt,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(r.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(r.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(L.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(r.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(r.DropdownMenuLabel,{children:"Breakpoints"}),s.jsxRuntimeExports.jsx(r.DropdownMenuSeparator,{}),x.map(ye,i=>s.jsxRuntimeExports.jsx(r.DropdownMenuCheckboxItem,{disabled:i.breakpoint==="xs",onCheckedChange:()=>c(x.toUpper(i.breakpoint)),checked:x.includes(n,x.toUpper(i.breakpoint)),children:i.title},i.breakpoint))]})]})]})},st=()=>{const[e]=r.useSetAllBlocks(),{createSnapshot:t}=r.useCanvasHistory(),[,n]=r.useSelectedBlockIds(),[,a]=r.useSelectedStylingBlocks(),c=m.useCallback(()=>{e([]),n([]),a([]),t()},[e,t]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(r.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(L.EraserIcon,{})," Clear"]})}),s.jsxRuntimeExports.jsxs(r.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(r.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTitle,{children:"Clear whole canvas?"}),s.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),s.jsxRuntimeExports.jsxs(r.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogCancel,{children:"Cancel"}),s.jsxRuntimeExports.jsx(r.AlertDialogAction,{onClick:c,children:"Yes"})]})]})]})})},rt=()=>{const e=r.useFeatureSupport("darkMode",!1),[t]=r.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(et,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(nt,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[s.jsxRuntimeExports.jsx(L.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[x.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(Qe,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(st,{})]})]})},ot=`<!doctype html>
4
4
  <html class="scroll-smooth h-full overflow-y-auto">
@@ -52,8 +52,8 @@ object-assign
52
52
  (c) Sindre Sorhus
53
53
  @license MIT
54
54
  */var se,ve;function at(){if(ve)return se;ve=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function a(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function c(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var u={},o=0;o<10;o++)u["_"+String.fromCharCode(o)]=o;var p=Object.getOwnPropertyNames(u).map(function(h){return u[h]});if(p.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(h){d[h]=h}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return se=c()?Object.assign:function(i,u){for(var o,p=a(i),d,h=1;h<arguments.length;h++){o=Object(arguments[h]);for(var g in o)t.call(o,g)&&(p[g]=o[g]);if(e){d=e(o);for(var w=0;w<d.length;w++)n.call(o,d[w])&&(p[d[w]]=o[d[w]])}}return p},se}var re,je;function pe(){if(je)return re;je=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return re=e,re}var oe,be;function Ce(){return be||(be=1,oe=Function.call.bind(Object.prototype.hasOwnProperty)),oe}var ie,Ee;function lt(){if(Ee)return ie;Ee=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=pe(),n={},a=Ce();e=function(i){var u="Warning: "+i;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}}}function c(i,u,o,p,d){if(process.env.NODE_ENV!=="production"){for(var h in i)if(a(i,h)){var g;try{if(typeof i[h]!="function"){var w=Error((p||"React class")+": "+o+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw w.name="Invariant Violation",w}g=i[h](u,h,p,o,null,t)}catch(P){g=P}if(g&&!(g instanceof Error)&&e((p||"React class")+": type specification of "+o+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof g+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),g instanceof Error&&!(g.message in n)){n[g.message]=!0;var I=d?d():"";e("Failed "+o+" type: "+g.message+(I??""))}}}}return c.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ie=c,ie}var ae,ke;function ct(){if(ke)return ae;ke=1;var e=Q.reactIsExports,t=at(),n=pe(),a=Ce(),c=lt(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(o){var p="Warning: "+o;typeof console<"u"&&console.error(p);try{throw new Error(p)}catch{}});function u(){return null}return ae=function(o,p){var d=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function g(l){var f=l&&(d&&l[d]||l[h]);if(typeof f=="function")return f}var w="<<anonymous>>",I={array:D("array"),bigint:D("bigint"),bool:D("boolean"),func:D("function"),number:D("number"),object:D("object"),string:D("string"),symbol:D("symbol"),any:q(),arrayOf:R,element:F(),elementType:W(),instanceOf:O,node:Me(),objectOf:U,oneOf:$,oneOfType:Pe,shape:_e,exact:Le};function P(l,f){return l===f?l!==0||1/l===1/f:l!==l&&f!==f}function E(l,f){this.message=l,this.data=f&&typeof f=="object"?f:{},this.stack=""}E.prototype=Error.prototype;function A(l){if(process.env.NODE_ENV!=="production")var f={},k=0;function j(S,v,b,C,B,T,N){if(C=C||w,T=T||b,N!==n){if(p){var M=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 M.name="Invariant Violation",M}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var J=C+":"+b;!f[J]&&k<3&&(i("You are manually calling a React.PropTypes validation function for the `"+T+"` prop on `"+C+"`. 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."),f[J]=!0,k++)}}return v[b]==null?S?v[b]===null?new E("The "+B+" `"+T+"` is marked as required "+("in `"+C+"`, but its value is `null`.")):new E("The "+B+" `"+T+"` is marked as required in "+("`"+C+"`, but its value is `undefined`.")):null:l(v,b,C,B,T)}var y=j.bind(null,!1);return y.isRequired=j.bind(null,!0),y}function D(l){function f(k,j,y,S,v,b){var C=k[j],B=z(C);if(B!==l){var T=X(C);return new E("Invalid "+S+" `"+v+"` of type "+("`"+T+"` supplied to `"+y+"`, expected ")+("`"+l+"`."),{expectedType:l})}return null}return A(f)}function q(){return A(u)}function R(l){function f(k,j,y,S,v){if(typeof l!="function")return new E("Property `"+v+"` of component `"+y+"` has invalid PropType notation inside arrayOf.");var b=k[j];if(!Array.isArray(b)){var C=z(b);return new E("Invalid "+S+" `"+v+"` of type "+("`"+C+"` supplied to `"+y+"`, expected an array."))}for(var B=0;B<b.length;B++){var T=l(b,B,y,S,v+"["+B+"]",n);if(T instanceof Error)return T}return null}return A(f)}function F(){function l(f,k,j,y,S){var v=f[k];if(!o(v)){var b=z(v);return new E("Invalid "+y+" `"+S+"` of type "+("`"+b+"` supplied to `"+j+"`, expected a single ReactElement."))}return null}return A(l)}function W(){function l(f,k,j,y,S){var v=f[k];if(!e.isValidElementType(v)){var b=z(v);return new E("Invalid "+y+" `"+S+"` of type "+("`"+b+"` supplied to `"+j+"`, expected a single ReactElement type."))}return null}return A(l)}function O(l){function f(k,j,y,S,v){if(!(k[j]instanceof l)){var b=l.name||w,C=He(k[j]);return new E("Invalid "+S+" `"+v+"` of type "+("`"+C+"` supplied to `"+y+"`, expected ")+("instance of `"+b+"`."))}return null}return A(f)}function $(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("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])."):i("Invalid argument supplied to oneOf, expected an array.")),u;function f(k,j,y,S,v){for(var b=k[j],C=0;C<l.length;C++)if(P(b,l[C]))return null;var B=JSON.stringify(l,function(N,M){var J=X(M);return J==="symbol"?String(M):M});return new E("Invalid "+S+" `"+v+"` of value `"+String(b)+"` "+("supplied to `"+y+"`, expected one of "+B+"."))}return A(f)}function U(l){function f(k,j,y,S,v){if(typeof l!="function")return new E("Property `"+v+"` of component `"+y+"` has invalid PropType notation inside objectOf.");var b=k[j],C=z(b);if(C!=="object")return new E("Invalid "+S+" `"+v+"` of type "+("`"+C+"` supplied to `"+y+"`, expected an object."));for(var B in b)if(a(b,B)){var T=l(b,B,y,S,v+"."+B,n);if(T instanceof Error)return T}return null}return A(f)}function Pe(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),u;for(var f=0;f<l.length;f++){var k=l[f];if(typeof k!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Fe(k)+" at index "+f+"."),u}function j(y,S,v,b,C){for(var B=[],T=0;T<l.length;T++){var N=l[T],M=N(y,S,v,b,C,n);if(M==null)return null;M.data&&a(M.data,"expectedType")&&B.push(M.data.expectedType)}var J=B.length>0?", expected one of type ["+B.join(", ")+"]":"";return new E("Invalid "+b+" `"+C+"` supplied to "+("`"+v+"`"+J+"."))}return A(j)}function Me(){function l(f,k,j,y,S){return ee(f[k])?null:new E("Invalid "+y+" `"+S+"` supplied to "+("`"+j+"`, expected a ReactNode."))}return A(l)}function xe(l,f,k,j,y){return new E((l||"React class")+": "+f+" type `"+k+"."+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+y+"`.")}function _e(l){function f(k,j,y,S,v){var b=k[j],C=z(b);if(C!=="object")return new E("Invalid "+S+" `"+v+"` of type `"+C+"` "+("supplied to `"+y+"`, expected `object`."));for(var B in l){var T=l[B];if(typeof T!="function")return xe(y,S,v,B,X(T));var N=T(b,B,y,S,v+"."+B,n);if(N)return N}return null}return A(f)}function Le(l){function f(k,j,y,S,v){var b=k[j],C=z(b);if(C!=="object")return new E("Invalid "+S+" `"+v+"` of type `"+C+"` "+("supplied to `"+y+"`, expected `object`."));var B=t({},k[j],l);for(var T in B){var N=l[T];if(a(l,T)&&typeof N!="function")return xe(y,S,v,T,X(N));if(!N)return new E("Invalid "+S+" `"+v+"` key `"+T+"` supplied to `"+y+"`.\nBad object: "+JSON.stringify(k[j],null," ")+`
55
- Valid keys: `+JSON.stringify(Object.keys(l),null," "));var M=N(b,T,y,S,v+"."+T,n);if(M)return M}return null}return A(f)}function ee(l){switch(typeof l){case"number":case"string":case"undefined":return!0;case"boolean":return!l;case"object":if(Array.isArray(l))return l.every(ee);if(l===null||o(l))return!0;var f=g(l);if(f){var k=f.call(l),j;if(f!==l.entries){for(;!(j=k.next()).done;)if(!ee(j.value))return!1}else for(;!(j=k.next()).done;){var y=j.value;if(y&&!ee(y[1]))return!1}}else return!1;return!0;default:return!1}}function Ne(l,f){return l==="symbol"?!0:f?f["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&f instanceof Symbol:!1}function z(l){var f=typeof l;return Array.isArray(l)?"array":l instanceof RegExp?"object":Ne(f,l)?"symbol":f}function X(l){if(typeof l>"u"||l===null)return""+l;var f=z(l);if(f==="object"){if(l instanceof Date)return"date";if(l instanceof RegExp)return"regexp"}return f}function Fe(l){var f=X(l);switch(f){case"array":case"object":return"an "+f;case"boolean":case"date":case"regexp":return"a "+f;default:return f}}function He(l){return!l.constructor||!l.constructor.name?w:l.constructor.name}return I.checkPropTypes=c,I.resetWarningCache=c.resetWarningCache,I.PropTypes=I,I},ae}var le,we;function dt(){if(we)return le;we=1;var e=pe();function t(){}function n(){}return n.resetWarningCache=t,le=function(){function a(u,o,p,d,h,g){if(g!==e){var w=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 w.name="Invariant Violation",w}}a.isRequired=a;function c(){return a}var i={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:c,element:a,elementType:a,instanceOf:c,node:a,objectOf:c,oneOf:c,oneOfType:c,shape:c,exact:c,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},le}var Wt=te.exports;if(process.env.NODE_ENV!=="production"){var ut=Q.reactIsExports,pt=!0;te.exports=ct()(ut.isElement,pt)}else te.exports=dt()();var ft=te.exports;const _=Z.getDefaultExportFromCjs(ft);let Te,Ie;typeof document<"u"&&(Te=document);typeof window<"u"&&(Ie=window);const Be=m.createContext({document:Te,window:Ie}),ne=()=>m.useContext(Be),{Provider:xt,Consumer:$t}=Be;class Ae extends m.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return m.Children.only(this.props.children)}}K(Ae,"propTypes",{children:_.element.isRequired,contentDidMount:_.func.isRequired,contentDidUpdate:_.func.isRequired});class de extends m.Component{constructor(n,a){super(n,a);K(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:a}=this.props;typeof a=="function"?a(n):a&&(a.current=n)});K(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});K(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=m.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 n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const a=this.props.contentDidMount,c=this.props.contentDidUpdate,i=n.defaultView||n.parentView,u=s.jsxRuntimeExports.jsx(Ae,{contentDidMount:a,contentDidUpdate:c,children:s.jsxRuntimeExports.jsx(xt,{value:{document:n,window:i},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),o=this.getMountTarget();return[he.createPortal(this.props.head,this.getDoc().head),he.createPortal(u,o)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}K(de,"propTypes",{style:_.object,head:_.node,initialContent:_.string,mountTarget:_.string,contentDidMount:_.func,contentDidUpdate:_.func,children:_.oneOfType([_.element,_.arrayOf(_.element)])}),K(de,"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 ht=m.forwardRef((e,t)=>s.jsxRuntimeExports.jsx(de,{...e,forwardedRef:t}));let Y=null,G=[],V=null,De=null;function gt(e){const t=window.getComputedStyle(e),n=parseInt(t.paddingLeft,10),a=parseInt(t.paddingTop,10),c=parseInt(t.paddingRight,10),i=parseInt(t.paddingBottom,10);return{paddingLeft:n,paddingTop:a,paddingRight:c,paddingBottom:i}}const Re=(e,t,n)=>{if(!Y)return;const a=e.getBoundingClientRect(),c=Y==null?void 0:Y.getElementById("placeholder"),{paddingLeft:i,paddingTop:u,paddingRight:o,paddingBottom:p}=gt(e);c.style.width=t==="vertical"?a.width-i-o+"px":"2px",c.style.height=t==="vertical"?"2px":a.height-u-p+"px",c.style.display="block";const d=G.reduce((h,g)=>Math.abs(g-n)<Math.abs(h-n)?g:h);De=G.indexOf(d),t==="vertical"?(c.style.top=e.offsetTop+d+"px",c.style.left=e.offsetLeft+i+"px"):(c.style.top=e.offsetTop+u+"px",c.style.left=e.offsetLeft+d+"px")},mt=e=>{const t=Oe(e),n=window.getComputedStyle(e),a=t==="horizontal",c=parseInt(n.paddingLeft),i=parseInt(n.paddingTop);let u=a?c:i;G=[u],Array.from(e.children).forEach(o=>{const p=window.getComputedStyle(o),d=parseInt(a?p.marginLeft+p.marginRight:p.marginTop+p.marginBottom),h=a?o.offsetWidth:o.offsetHeight;G.push(u+h+d),u+=h+d})};function Oe(e){const t=window.getComputedStyle(e).display,n=window.getComputedStyle(e).flexDirection;if(t==="flex")return n==="column"||n==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const a=window.getComputedStyle(e).gridTemplateRows,c=window.getComputedStyle(e).gridTemplateColumns;if(a.includes("auto"))return"vertical";if(c.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const yt=x.throttle(e=>{const t=e.target,n=Oe(t);if(n==="vertical"){const a=e.clientY-t.offsetTop;Re(t,n,a)}else{const a=e.clientX-t.offsetLeft;Re(t,n,a)}},200),vt=e=>{e.preventDefault(),e.stopPropagation(),yt(e)};function ce(){const e=Y==null?void 0:Y.getElementById("placeholder");e.style.display="none"}const jt=()=>{const{document:e}=ne(),[t,n]=H.useAtom(r.draggingFlagAtom),a=Ye.useAddBlockByDrop(),c=Se.useFeature("dnd"),[,i]=r.useHighlightBlockId(),[,u]=r.useSelectedBlockIds();return Y=e,{isDragging:t,"data-dnd":"branch",onDragOver:c?vt:x.noop,onDrop:c?o=>{V==null||V.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const p=JSON.parse(o.dataTransfer.getData("text/plain"));let d=o.target.getAttribute("data-block-id");d===null&&(d=o.target.parentElement.getAttribute("data-block-id")),a({block:p,dropTargetId:d||null,relativeIndex:De}),n(!1),ce(),setTimeout(()=>{ce()},300)}:x.noop,onDragEnter:c?o=>{const p=o;V=p.target,p.stopPropagation(),p.preventDefault(),G=[];const d=p.target;mt(d),d.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),n(!0),i(""),u([])}:x.noop,onDragLeave:c?o=>{const p=o;V=null,p.stopPropagation(),p.preventDefault(),p.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:x.noop,onMouseOut:c?()=>{n(!1),ce()}:x.noop}};function fe(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function bt(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Et=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=r.useUpdateBlocksProps(),[,n]=r.useSelectedBlockIds(),[,a]=r.useHighlightBlockId(),[c,i]=H.useAtom(r.inlineEditingActiveAtom);return u=>{var w;if(c)return;const o=fe(u.target),p=o.getAttribute("data-block-type");if(!p||!e.includes(p))return;const d=o.cloneNode(!0);o.style.display="none",Array.from(d.attributes).forEach(I=>{I.name!=="class"&&d.removeAttribute(I.name)}),p==="Text"&&(d.style.display="inline-block"),o.parentNode.insertBefore(d,o.nextSibling);const h=new ze.Quill(d,{placeholder:"Type here..."});function g(){const I=h.getText(0,h.getLength());t([o.getAttribute("data-block-id")],{content:I}),o.removeAttribute("style"),d.removeEventListener("blur",g,!0),bt(h),i(""),a("")}d.addEventListener("blur",g,!0),h.focus(),(w=d.querySelector(".ql-clipboard"))==null||w.remove(),n([]),i(o.getAttribute("data-block-id"))}},kt=()=>{const[,e]=r.useSelectedStylingBlocks(),[,t]=r.useSelectedBlockIds(),[n]=H.useAtom(r.inlineEditingActiveAtom);return a=>{if(n)return;a.stopPropagation();const c=fe(a.target);if(c!=null&&c.getAttribute("data-block-parent")){const i=c.getAttribute("data-style-prop"),u=c.getAttribute("data-style-id"),o=c.getAttribute("data-block-parent");e([{id:u,prop:i,blockId:o}]),t([o])}else c!=null&&c.getAttribute("data-block-id")&&t([c.getAttribute("data-block-id")])}},wt=x.throttle((e,t)=>{const n=fe(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),Rt=()=>{const[,e]=r.useHighlightBlockId(),[t]=H.useAtom(r.inlineEditingActiveAtom);return n=>{t||wt(n,e)}},St=({children:e})=>{const{document:t}=ne(),[n]=r.useSelectedBlockIds(),[a,c]=r.useSelectedStylingBlocks();m.useEffect(()=>{setTimeout(()=>{if(!x.isEmpty(a))return;const d=qe(t,x.first(n));if(d){const h=d.getAttribute("data-style-prop");if(h){const g=d.getAttribute("data-style-id"),w=d.getAttribute("data-block-parent");c([{id:g,prop:h,blockId:w}])}}},100)},[t,n,c,a]);const i=Et(),u=kt(),o=Rt(),p=jt();return s.jsxRuntimeExports.jsx("div",{id:"canvas",onClick:u,onDoubleClick:i,onMouseMove:o,...x.omit(p,"isDragging"),className:"relative mb-5 max-w-full "+(p.isDragging?"dragging":""),children:e})},qe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ct=()=>{const{window:e}=ne(),[t,n]=r.useSelectedBlockIds(),a=r.useAllBlocks(),[,c]=r.useSelectedStylingBlocks(),{undo:i,redo:u}=r.useCanvasHistory(),o=r.useDuplicateBlocks(),[,p]=r.useCutBlockIds(),[,d]=r.useCopyBlockIds(),{pasteBlocks:h}=r.usePasteBlocks(),[,g]=r.usePreviewMode(),w=r.useRemoveBlocks(),{savePage:I}=r.useSavePage(),[P]=H.useAtom(r.inlineEditingActiveAtom),[,E]=H.useAtom(r.editLayerNameAtom),A=q=>{q.key==="Enter"&&(q.preventDefault(),t.length===1&&E(x.first(t)))},D=q=>{const R=a.find(F=>F._id===q);return R?R._parent:null};return m.useEffect(()=>{const q=R=>{if(R.key==="Escape"){n([]),c([]);return}if(A(R),!P&&(R.key==="Delete"||R.key==="Backspace")&&(R.preventDefault(),w(t)),R.ctrlKey||R.metaKey){if(R.key==="ArrowUp"){R.preventDefault();const F=t.length>0?D(t[0]):null;F&&n([F])}if(["z","y","d","x","c","p","s","v"].includes(R.key)){if(P&&["x","z","v"].includes(R.key))return!0;R.preventDefault()}R.key==="s"&&(R.stopPropagation(),R.preventDefault(),I()),R.key==="z"&&i(),R.key==="y"&&u(),R.key==="d"&&o(t),R.key==="x"&&p(t),R.key==="c"&&d(t),R.key==="v"&&t.length>0&&h(t[0])}};return e.removeEventListener("keydown",q),e.addEventListener("keydown",q),()=>{e.removeEventListener("keydown",q)}},[t,n,i,w,g,u,o,p,d,h,P,I,e]),null},Tt=({block:e,label:t})=>{const[,n]=r.useSelectedBlockIds(),[,a]=r.useHighlightBlockId(),[,c]=H.useAtom(r.draggedBlockIdAtom),i=Se.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:i?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(x.pick(e,["_id","_type"]))),c(e._id),setTimeout(()=>{n([]),a(null)},200)},children:[s.jsxRuntimeExports.jsx(L.DragHandleDots2Icon,{}),t]})},It=({selectedBlockElement:e,block:t})=>{const n=r.useRemoveBlocks(),a=r.useDuplicateBlocks(),[,c]=r.useSelectedBlockIds(),[,i]=r.useSelectedStylingBlocks(),{floatingStyles:u,refs:o,update:p}=ge.useFloating({placement:"top-start",middleware:[ge.shift(),Ke.flip()],elements:{reference:e}});Je.useResizeObserver(e,()=>p(),e!==null);const d=x.get(t,"_parent",null),h=x.isEmpty(x.get(t,"_name",""))?x.get(t,"_type",""):x.get(t,"_name","");return!e||!t?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:o.setFloating,style:u,onClick:g=>{g.stopPropagation(),g.preventDefault()},onKeyDown:g=>g.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(Tt,{label:h,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[d&&s.jsxRuntimeExports.jsx(L.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{i([]),c([d])}}),r.canDuplicateBlock(x.get(t,"_type",""))?s.jsxRuntimeExports.jsx(L.CopyIcon,{className:"hover:scale-105 ",onClick:()=>a([t==null?void 0:t._id])}):null,r.canDeleteBlock(x.get(t,"_type",""))?s.jsxRuntimeExports.jsx(L.TrashIcon,{className:"hover:scale-105 ",onClick:()=>n([t==null?void 0:t._id])}):null]})]})},Bt=({model:e})=>{const[t]=r.useBrandingOptions(),[n]=r.useSelectedBlockIds(),[a]=r.useDarkMode(),[c]=r.useHighlightBlockId(),[i]=r.useSelectedStylingBlocks(),[u]=H.useAtom(r.draggedBlockIdAtom),{document:o,window:p}=ne(),[d]=m.useState(o==null?void 0:o.getElementById("highlighted-block")),[h]=m.useState(o==null?void 0:o.getElementById("selected-block")),[g]=m.useState(o==null?void 0:o.getElementById("selected-styling-block")),[w]=m.useState(o==null?void 0:o.getElementById("dragged-block"));m.useEffect(()=>{a?o==null||o.documentElement.classList.add("dark"):o==null||o.documentElement.classList.remove("dark")},[a,o]);const I=x.get(t,"headingFont","DM Sans"),P=x.get(t,"bodyFont","DM Sans");return m.useEffect(()=>{const E=x.get(t,"primaryColor","#000"),A=x.get(t,"secondaryColor","#FFF"),D=Xe.tailwindcssPaletteGenerator({colors:[E,A],names:["primary","secondary"]});D.primary.DEFAULT=E,D.secondary.DEFAULT=A;const q=x.get(t,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[I],body:[P]},extend:{borderRadius:{global:`${q||"0"}px`},colors:D}},plugins:[p.tailwind.plugin.withOptions(({prefix:R="ui"}={})=>({addVariant:F})=>{for(const W of["open","checked","selected","active","disabled"])F(`${R}-${W}`,[`&[data-headlessui-state~="${W}"]`,`:where([data-headlessui-state~="${W}"]) &`]),F(`${R}-not-${W}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${W}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${W}"])) &:not([data-headlessui-state])`])})]})},[t,p,I,P]),m.useEffect(()=>{h&&(h.textContent=`${x.map(n,E=>`[data-block-id="${E}"]`).join(",")}{
55
+ Valid keys: `+JSON.stringify(Object.keys(l),null," "));var M=N(b,T,y,S,v+"."+T,n);if(M)return M}return null}return A(f)}function ee(l){switch(typeof l){case"number":case"string":case"undefined":return!0;case"boolean":return!l;case"object":if(Array.isArray(l))return l.every(ee);if(l===null||o(l))return!0;var f=g(l);if(f){var k=f.call(l),j;if(f!==l.entries){for(;!(j=k.next()).done;)if(!ee(j.value))return!1}else for(;!(j=k.next()).done;){var y=j.value;if(y&&!ee(y[1]))return!1}}else return!1;return!0;default:return!1}}function Ne(l,f){return l==="symbol"?!0:f?f["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&f instanceof Symbol:!1}function z(l){var f=typeof l;return Array.isArray(l)?"array":l instanceof RegExp?"object":Ne(f,l)?"symbol":f}function X(l){if(typeof l>"u"||l===null)return""+l;var f=z(l);if(f==="object"){if(l instanceof Date)return"date";if(l instanceof RegExp)return"regexp"}return f}function Fe(l){var f=X(l);switch(f){case"array":case"object":return"an "+f;case"boolean":case"date":case"regexp":return"a "+f;default:return f}}function He(l){return!l.constructor||!l.constructor.name?w:l.constructor.name}return I.checkPropTypes=c,I.resetWarningCache=c.resetWarningCache,I.PropTypes=I,I},ae}var le,we;function dt(){if(we)return le;we=1;var e=pe();function t(){}function n(){}return n.resetWarningCache=t,le=function(){function a(u,o,p,d,h,g){if(g!==e){var w=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 w.name="Invariant Violation",w}}a.isRequired=a;function c(){return a}var i={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:c,element:a,elementType:a,instanceOf:c,node:a,objectOf:c,oneOf:c,oneOfType:c,shape:c,exact:c,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},le}var Wt=te.exports;if(process.env.NODE_ENV!=="production"){var ut=Q.reactIsExports,pt=!0;te.exports=ct()(ut.isElement,pt)}else te.exports=dt()();var ft=te.exports;const _=Z.getDefaultExportFromCjs(ft);let Te,Ie;typeof document<"u"&&(Te=document);typeof window<"u"&&(Ie=window);const Be=m.createContext({document:Te,window:Ie}),ne=()=>m.useContext(Be),{Provider:xt,Consumer:$t}=Be;class Ae extends m.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return m.Children.only(this.props.children)}}K(Ae,"propTypes",{children:_.element.isRequired,contentDidMount:_.func.isRequired,contentDidUpdate:_.func.isRequired});class de extends m.Component{constructor(n,a){super(n,a);K(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:a}=this.props;typeof a=="function"?a(n):a&&(a.current=n)});K(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});K(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=m.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 n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const a=this.props.contentDidMount,c=this.props.contentDidUpdate,i=n.defaultView||n.parentView,u=s.jsxRuntimeExports.jsx(Ae,{contentDidMount:a,contentDidUpdate:c,children:s.jsxRuntimeExports.jsx(xt,{value:{document:n,window:i},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),o=this.getMountTarget();return[he.createPortal(this.props.head,this.getDoc().head),he.createPortal(u,o)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}K(de,"propTypes",{style:_.object,head:_.node,initialContent:_.string,mountTarget:_.string,contentDidMount:_.func,contentDidUpdate:_.func,children:_.oneOfType([_.element,_.arrayOf(_.element)])}),K(de,"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 ht=m.forwardRef((e,t)=>s.jsxRuntimeExports.jsx(de,{...e,forwardedRef:t}));let Y=null,G=[],V=null,De=null;function gt(e){const t=window.getComputedStyle(e),n=parseInt(t.paddingLeft,10),a=parseInt(t.paddingTop,10),c=parseInt(t.paddingRight,10),i=parseInt(t.paddingBottom,10);return{paddingLeft:n,paddingTop:a,paddingRight:c,paddingBottom:i}}const Re=(e,t,n)=>{if(!Y)return;const a=e.getBoundingClientRect(),c=Y==null?void 0:Y.getElementById("placeholder"),{paddingLeft:i,paddingTop:u,paddingRight:o,paddingBottom:p}=gt(e);c.style.width=t==="vertical"?a.width-i-o+"px":"2px",c.style.height=t==="vertical"?"2px":a.height-u-p+"px",c.style.display="block";const d=G.reduce((h,g)=>Math.abs(g-n)<Math.abs(h-n)?g:h);De=G.indexOf(d),t==="vertical"?(c.style.top=e.offsetTop+d+"px",c.style.left=e.offsetLeft+i+"px"):(c.style.top=e.offsetTop+u+"px",c.style.left=e.offsetLeft+d+"px")},mt=e=>{const t=Oe(e),n=window.getComputedStyle(e),a=t==="horizontal",c=parseInt(n.paddingLeft),i=parseInt(n.paddingTop);let u=a?c:i;G=[u],Array.from(e.children).forEach(o=>{const p=window.getComputedStyle(o),d=parseInt(a?p.marginLeft+p.marginRight:p.marginTop+p.marginBottom),h=a?o.offsetWidth:o.offsetHeight;G.push(u+h+d),u+=h+d})};function Oe(e){const t=window.getComputedStyle(e).display,n=window.getComputedStyle(e).flexDirection;if(t==="flex")return n==="column"||n==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const a=window.getComputedStyle(e).gridTemplateRows,c=window.getComputedStyle(e).gridTemplateColumns;if(a.includes("auto"))return"vertical";if(c.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const yt=x.throttle(e=>{const t=e.target,n=Oe(t);if(n==="vertical"){const a=e.clientY-t.offsetTop;Re(t,n,a)}else{const a=e.clientX-t.offsetLeft;Re(t,n,a)}},200),vt=e=>{e.preventDefault(),e.stopPropagation(),yt(e)};function ce(){const e=Y==null?void 0:Y.getElementById("placeholder");e.style.display="none"}const jt=()=>{const{document:e}=ne(),[t,n]=H.useAtom(r.draggingFlagAtom),a=Ye.useAddBlockByDrop(),c=Se.useFeature("dnd"),[,i]=r.useHighlightBlockId(),[,u]=r.useSelectedBlockIds();return Y=e,{isDragging:t,"data-dnd":"branch",onDragOver:c?vt:x.noop,onDrop:c?o=>{V==null||V.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const p=JSON.parse(o.dataTransfer.getData("text/plain"));let d=o.target.getAttribute("data-block-id");d===null&&(d=o.target.parentElement.getAttribute("data-block-id")),a({block:p,dropTargetId:d||null,relativeIndex:De}),n(!1),ce(),setTimeout(()=>{ce()},300)}:x.noop,onDragEnter:c?o=>{const p=o;V=p.target,p.stopPropagation(),p.preventDefault(),G=[];const d=p.target;mt(d),d.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),n(!0),i(""),u([])}:x.noop,onDragLeave:c?o=>{const p=o;V=null,p.stopPropagation(),p.preventDefault(),p.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:x.noop,onMouseOut:c?()=>{n(!1),ce()}:x.noop}};function fe(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function bt(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Et=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=r.useUpdateBlocksProps(),[,n]=r.useSelectedBlockIds(),[,a]=r.useHighlightBlockId(),[c,i]=H.useAtom(r.inlineEditingActiveAtom);return u=>{var w;if(c)return;const o=fe(u.target),p=o.getAttribute("data-block-type");if(!p||!e.includes(p))return;const d=o.cloneNode(!0);o.style.display="none",Array.from(d.attributes).forEach(I=>{I.name!=="class"&&d.removeAttribute(I.name)}),p==="Text"&&(d.style.display="inline-block"),o.parentNode.insertBefore(d,o.nextSibling);const h=new ze.Quill(d,{placeholder:"Type here..."});function g(){const I=h.getText(0,h.getLength());t([o.getAttribute("data-block-id")],{content:I}),o.removeAttribute("style"),d.removeEventListener("blur",g,!0),bt(h),i(""),a("")}d.addEventListener("blur",g,!0),h.focus(),(w=d.querySelector(".ql-clipboard"))==null||w.remove(),n([]),i(o.getAttribute("data-block-id"))}},kt=()=>{const[,e]=r.useSelectedStylingBlocks(),[,t]=r.useSelectedBlockIds(),[n]=H.useAtom(r.inlineEditingActiveAtom);return a=>{if(n)return;a.stopPropagation();const c=fe(a.target);if(c!=null&&c.getAttribute("data-block-parent")){const i=c.getAttribute("data-style-prop"),u=c.getAttribute("data-style-id"),o=c.getAttribute("data-block-parent");e([{id:u,prop:i,blockId:o}]),t([o])}else c!=null&&c.getAttribute("data-block-id")&&t([c.getAttribute("data-block-id")])}},wt=x.throttle((e,t)=>{const n=fe(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),Rt=()=>{const[,e]=r.useHighlightBlockId(),[t]=H.useAtom(r.inlineEditingActiveAtom);return n=>{t||wt(n,e)}},St=({children:e})=>{const{document:t}=ne(),[n]=r.useSelectedBlockIds(),[a,c]=r.useSelectedStylingBlocks();m.useEffect(()=>{setTimeout(()=>{if(!x.isEmpty(a))return;const d=qe(t,x.first(n));if(d){const h=d.getAttribute("data-style-prop");if(h){const g=d.getAttribute("data-style-id"),w=d.getAttribute("data-block-parent");c([{id:g,prop:h,blockId:w}])}}},100)},[t,n,c,a]);const i=Et(),u=kt(),o=Rt(),p=jt();return s.jsxRuntimeExports.jsx("div",{id:"canvas",onClick:u,onDoubleClick:i,onMouseMove:o,...x.omit(p,"isDragging"),className:"relative mb-5 max-w-full "+(p.isDragging?"dragging":""),children:e})},qe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ct=()=>{const{window:e}=ne(),[t,n]=r.useSelectedBlockIds(),a=r.useAllBlocks(),[,c]=r.useSelectedStylingBlocks(),{undo:i,redo:u}=r.useCanvasHistory(),o=r.useDuplicateBlocks(),[,p]=r.useCutBlockIds(),[,d]=r.useCopyBlockIds(),{pasteBlocks:h}=r.usePasteBlocks(),[,g]=r.usePreviewMode(),w=r.useRemoveBlocks(),{savePage:I}=r.useSavePage(),[P]=H.useAtom(r.inlineEditingActiveAtom),[,E]=H.useAtom(r.editLayerNameAtom),A=q=>{q.key==="Enter"&&(q.preventDefault(),t.length===1&&E(x.first(t)))},D=q=>{const R=a.find(F=>F._id===q);return R?R._parent:null};return m.useEffect(()=>{const q=R=>{if(R.key==="Escape"){n([]),c([]);return}if(A(R),!P&&(R.key==="Delete"||R.key==="Backspace")&&(R.preventDefault(),w(t)),R.ctrlKey||R.metaKey){if(R.key==="ArrowUp"){R.preventDefault();const F=t.length>0?D(t[0]):null;F&&n([F])}if(["z","y","d","x","c","p","s","v"].includes(R.key)){if(P&&["x","z","v"].includes(R.key))return!0;R.preventDefault()}R.key==="s"&&(R.stopPropagation(),R.preventDefault(),I()),R.key==="z"&&i(),R.key==="y"&&u(),R.key==="d"&&o(t),R.key==="x"&&p(t),R.key==="c"&&d(t),R.key==="v"&&t.length>0&&h(t[0])}};return e.removeEventListener("keydown",q),e.addEventListener("keydown",q),()=>{e.removeEventListener("keydown",q)}},[t,n,i,w,g,u,o,p,d,h,P,I,e]),null},Tt=({block:e,label:t})=>{const[,n]=r.useSelectedBlockIds(),[,a]=r.useHighlightBlockId(),[,c]=H.useAtom(r.draggedBlockIdAtom),i=Se.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:i?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(x.pick(e,["_id","_type"]))),c(e._id),setTimeout(()=>{n([]),a(null)},200)},children:[s.jsxRuntimeExports.jsx(L.DragHandleDots2Icon,{}),t]})},It=({selectedBlockElement:e,block:t})=>{const n=r.useRemoveBlocks(),a=r.useDuplicateBlocks(),[,c]=r.useSelectedBlockIds(),[,i]=r.useSelectedStylingBlocks(),{floatingStyles:u,refs:o,update:p}=ge.useFloating({placement:"top-start",middleware:[ge.shift(),Ke.flip()],elements:{reference:e}});Je.useResizeObserver(e,()=>p(),e!==null);const d=x.get(t,"_parent",null),h=x.isEmpty(x.get(t,"_name",""))?x.get(t,"_type",""):x.get(t,"_name","");return!e||!t?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:o.setFloating,style:u,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:[s.jsxRuntimeExports.jsx(Tt,{label:h,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[d&&s.jsxRuntimeExports.jsx(L.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{i([]),c([d])}}),r.canDuplicateBlock(x.get(t,"_type",""))?s.jsxRuntimeExports.jsx(L.CopyIcon,{className:"hover:scale-105 ",onClick:()=>a([t==null?void 0:t._id])}):null,r.canDeleteBlock(x.get(t,"_type",""))?s.jsxRuntimeExports.jsx(L.TrashIcon,{className:"hover:scale-105 ",onClick:()=>n([t==null?void 0:t._id])}):null]})]})},Bt=({model:e})=>{const[t]=r.useBrandingOptions(),[n]=r.useSelectedBlockIds(),[a]=r.useDarkMode(),[c]=r.useHighlightBlockId(),[i]=r.useSelectedStylingBlocks(),[u]=H.useAtom(r.draggedBlockIdAtom),{document:o,window:p}=ne(),[d]=m.useState(o==null?void 0:o.getElementById("highlighted-block")),[h]=m.useState(o==null?void 0:o.getElementById("selected-block")),[g]=m.useState(o==null?void 0:o.getElementById("selected-styling-block")),[w]=m.useState(o==null?void 0:o.getElementById("dragged-block"));m.useEffect(()=>{a?o==null||o.documentElement.classList.add("dark"):o==null||o.documentElement.classList.remove("dark")},[a,o]);const I=x.get(t,"headingFont","DM Sans"),P=x.get(t,"bodyFont","DM Sans");return m.useEffect(()=>{const E=x.get(t,"primaryColor","#000"),A=x.get(t,"secondaryColor","#FFF"),D=Xe.tailwindcssPaletteGenerator({colors:[E,A],names:["primary","secondary"]});D.primary.DEFAULT=E,D.secondary.DEFAULT=A;const q=x.get(t,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[I],body:[P]},extend:{borderRadius:{global:`${q||"0"}px`},colors:D}},plugins:[p.tailwind.plugin.withOptions(({prefix:R="ui"}={})=>({addVariant:F})=>{for(const W of["open","checked","selected","active","disabled"])F(`${R}-${W}`,[`&[data-headlessui-state~="${W}"]`,`:where([data-headlessui-state~="${W}"]) &`]),F(`${R}-not-${W}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${W}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${W}"])) &:not([data-headlessui-state])`])})]})},[t,p,I,P]),m.useEffect(()=>{h&&(h.textContent=`${x.map(n,E=>`[data-block-id="${E}"]`).join(",")}{
56
56
  outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
57
57
  }`)},[n,h]),m.useEffect(()=>{if(!u){w.textContent="";return}w.textContent=`[data-block-id="${u}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[u]),m.useEffect(()=>{d&&(d.textContent=c?`[data-style-id="${c}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[c,n,d]),m.useEffect(()=>{g&&(g.textContent=`${x.map(i,({id:E})=>`[data-style-id="${E}"]`).join(",")}{
58
58
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
59
- }`)},[i,g]),m.useEffect(()=>{const E=x.get(t,"bodyTextLightColor","#64748b"),A=x.get(t,"bodyTextDarkColor","#94a3b8"),D=x.get(t,"bodyBgLightColor","#FFFFFF"),q=x.get(t,"bodyBgDarkColor","#0f172a");o.body.className=`font-body antialiased text-[${E}] bg-[${D}] dark:text-[${A}] dark:bg-[${q}]`},[t,o,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[I&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${I.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),P&&I!==P&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${P.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),I&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${I}",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},At=e=>{const t={};return Object.keys(e).forEach(n=>{x.isString(e[n])&&e[n].startsWith(Z.SLOT_KEY)&&(t[n]=e[n].replace(Z.SLOT_KEY,"").split(","))}),t},Dt=x.memoize(e=>{const t=e.replace(Z.STYLES_KEY,"").split(",");return Ze.twMerge(t[0],t[1])});function Ot(e,t){return x.get(e,`${t}_attrs`,{})}function qt(e){const t={};return Object.keys(e).forEach(n=>{if(x.isString(e[n])&&e[n].startsWith(Z.STYLES_KEY)){const a=Dt(e[n]);t[n]={className:a,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,...Ot(e,n)}}}),t}function Pt(e,t){const n=x.get(e,"_bindings",{});return x.isEmpty(n)?{...e}:(x.each(n,(a,c)=>{x.isString(a)&&x.get(t,a,null)&&(e[c]=x.get(t,a,null))}),e)}function ue({blocks:e}){const t=r.useAllBlocks(),n=m.useCallback(i=>qt(i),[]),[a]=Q.useChaiExternalData(),[c]=r.useAtom(r.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(e.map((i,u)=>{if(c===i._id)return null;const o=At(i),p={};x.isEmpty(o)||Object.keys(o).forEach(w=>{p[w]=m.Children.toArray(o[w].map(I=>s.jsxRuntimeExports.jsx(ue,{blocks:[x.find(t,{_id:I})]})))});const d=x.filter(t,{_parent:i._id});p.children=d.length?s.jsxRuntimeExports.jsx(ue,{blocks:d}):null;const h=Ge.getBlockComponent(i._type),g=x.get(h,"component",null);return x.isNull(g)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${i==null?void 0:i._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(g,{blockProps:{"data-block-id":i._id,"data-block-type":i._type,"data-dnd":r.canAddChildBlock(i._type)?"branch":"leaf"},inBuilder:!0,index:u,...Pt(i,a),...n(i),...p})})}))})}const Mt=()=>{const e=r.useAllBlocks();return s.jsxRuntimeExports.jsx(Ve.Provider,{children:x.isEmpty(e)?null:s.jsxRuntimeExports.jsx(Q.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(ue,{blocks:x.filter(e,t=>x.isEmpty(t._parent))})})})},_t=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Lt=()=>{const[e]=H.useAtom(r.networkModeAtom),[t]=r.usePreviewMode(),[n]=r.useCanvasWidth(),[,a]=r.useSelectedBlockIds(),c=r.useSelectedBlock(),[,i]=r.useHighlightBlockId(),u=m.useRef(null),o=m.useRef(null),[p,d]=m.useState({width:0,height:0}),h=it(p),[g,w]=m.useState(0),[I,P]=m.useState([]),[,E]=m.useState([]),[,A]=H.useAtom(r.canvasIframeAtom),[D,q]=r.useSelectedStylingBlocks(),R=r.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:O,clientHeight:$}=o.current;d({width:O,height:$}),g===0&&w(O)},[o,n,g]);const F=(O,$=0)=>{const{top:U}=O.getBoundingClientRect();return U+$>=0&&U-$<=window.innerHeight};m.useEffect(()=>{var O,$;if(c&&c.type!=="Multiple"&&u.current){const U=qe(u.current.contentDocument,c._id);U&&(F(U)||($=(O=u.current)==null?void 0:O.contentWindow)==null||$.scrollTo({top:U.offsetTop,behavior:"smooth"}),P([U]))}},[c]),m.useEffect(()=>{if(!x.isEmpty(D)&&u.current){const O=_t(u.current.contentDocument,x.first(D).id);E(O?[O]:[null])}else E([null])},[D]);const W=m.useMemo(()=>{let O=ot;return e==="offline"&&(O=O.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),O=O.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),O=O.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),O},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),q([])},onMouseLeave:()=>setTimeout(()=>i(""),300),className:"relative mx-auto overflow-hidden h-full w-full",style:g>0&&!x.isEmpty(h)?{width:t?"100%":g}:{},ref:o,children:s.jsxRuntimeExports.jsxs(ht,{contentDidMount:()=>A(u.current),ref:u,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content max-h-full h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:W,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(It,{block:c,selectedBlockElement:x.first(I)}),s.jsxRuntimeExports.jsx(Bt,{model:"page"}),s.jsxRuntimeExports.jsx(St,{children:R?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"})]})})},Nt=m.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-Et_v-kdv.cjs"))),Ft=()=>{const[e,t]=H.useAtom(r.addBlocksModalAtom);return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(rt,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative h-full overflow-hidden bg-slate-800/90 px-2 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]",children:[s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(Q.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(Lt,{})})}),e?s.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:s.jsxRuntimeExports.jsx("div",{onClick:n=>n.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:s.jsxRuntimeExports.jsx(Nt,{})})}):null]})]})};exports.default=Ft;
59
+ }`)},[i,g]),m.useEffect(()=>{const E=x.get(t,"bodyTextLightColor","#64748b"),A=x.get(t,"bodyTextDarkColor","#94a3b8"),D=x.get(t,"bodyBgLightColor","#FFFFFF"),q=x.get(t,"bodyBgDarkColor","#0f172a");o.body.className=`font-body antialiased text-[${E}] bg-[${D}] dark:text-[${A}] dark:bg-[${q}]`},[t,o,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[I&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${I.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),P&&I!==P&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${P.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),I&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${I}",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},At=e=>{const t={};return Object.keys(e).forEach(n=>{x.isString(e[n])&&e[n].startsWith(Z.SLOT_KEY)&&(t[n]=e[n].replace(Z.SLOT_KEY,"").split(","))}),t},Dt=x.memoize(e=>{const t=e.replace(Z.STYLES_KEY,"").split(",");return Ze.twMerge(t[0],t[1])});function Ot(e,t){return x.get(e,`${t}_attrs`,{})}function qt(e){const t={};return Object.keys(e).forEach(n=>{if(x.isString(e[n])&&e[n].startsWith(Z.STYLES_KEY)){const a=Dt(e[n]);t[n]={className:a,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,...Ot(e,n)}}}),t}function Pt(e,t){const n=x.get(e,"_bindings",{});return x.isEmpty(n)?{...e}:(x.each(n,(a,c)=>{x.isString(a)&&x.get(t,a,null)&&(e[c]=x.get(t,a,null))}),e)}function ue({blocks:e}){const t=r.useAllBlocks(),n=m.useCallback(i=>qt(i),[]),[a]=Q.useChaiExternalData(),[c]=r.useAtom(r.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(e.map((i,u)=>{if(c===i._id)return null;const o=At(i),p={};x.isEmpty(o)||Object.keys(o).forEach(w=>{p[w]=m.Children.toArray(o[w].map(I=>s.jsxRuntimeExports.jsx(ue,{blocks:[x.find(t,{_id:I})]})))});const d=x.filter(t,{_parent:i._id});p.children=d.length?s.jsxRuntimeExports.jsx(ue,{blocks:d}):null;const h=Ge.getBlockComponent(i._type),g=x.get(h,"component",null);return x.isNull(g)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${i==null?void 0:i._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(g,{blockProps:{"data-block-id":i._id,"data-block-type":i._type,"data-dnd":r.canAddChildBlock(i._type)?"branch":"leaf"},inBuilder:!0,index:u,...Pt(i,a),...n(i),...p})})}))})}const Mt=()=>{const e=r.useAllBlocks();return s.jsxRuntimeExports.jsx(Ve.Provider,{children:x.isEmpty(e)?null:s.jsxRuntimeExports.jsx(Q.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(ue,{blocks:x.filter(e,t=>x.isEmpty(t._parent))})})})},_t=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Lt=()=>{const[e]=H.useAtom(r.networkModeAtom),[t]=r.usePreviewMode(),[n]=r.useCanvasWidth(),[,a]=r.useSelectedBlockIds(),c=r.useSelectedBlock(),[,i]=r.useHighlightBlockId(),u=m.useRef(null),o=m.useRef(null),[p,d]=m.useState({width:0,height:0}),h=it(p),[g,w]=m.useState(0),[I,P]=m.useState([]),[,E]=m.useState([]),[,A]=H.useAtom(r.canvasIframeAtom),[D,q]=r.useSelectedStylingBlocks(),R=r.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:O,clientHeight:$}=o.current;d({width:O,height:$}),g===0&&w(O)},[o,n,g]);const F=(O,$=0)=>{const{top:U}=O.getBoundingClientRect();return U+$>=0&&U-$<=window.innerHeight};m.useEffect(()=>{var O,$;if(c&&c.type!=="Multiple"&&u.current){const U=qe(u.current.contentDocument,c._id);U&&(F(U)||($=(O=u.current)==null?void 0:O.contentWindow)==null||$.scrollTo({top:U.offsetTop,behavior:"smooth"}),P([U]))}},[c]),m.useEffect(()=>{if(!x.isEmpty(D)&&u.current){const O=_t(u.current.contentDocument,x.first(D).id);E(O?[O]:[null])}else E([null])},[D]);const W=m.useMemo(()=>{let O=ot;return e==="offline"&&(O=O.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),O=O.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),O=O.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),O},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),q([])},onMouseLeave:()=>setTimeout(()=>i(""),300),className:"relative mx-auto overflow-hidden h-full w-full",style:g>0&&!x.isEmpty(h)?{width:t?"100%":g}:{},ref:o,children:s.jsxRuntimeExports.jsxs(ht,{contentDidMount:()=>A(u.current),ref:u,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content max-h-full h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:W,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(It,{block:c,selectedBlockElement:x.first(I)}),s.jsxRuntimeExports.jsx(Bt,{model:"page"}),s.jsxRuntimeExports.jsx(St,{children:R?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"})]})})},Nt=m.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-YS5XlqpG.cjs"))),Ft=()=>{const[e,t]=H.useAtom(r.addBlocksModalAtom);return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(rt,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative h-full overflow-hidden bg-slate-800/90 px-2 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]",children:[s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(Q.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(Lt,{})})}),e?s.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:s.jsxRuntimeExports.jsx("div",{onClick:n=>n.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:s.jsxRuntimeExports.jsx(Nt,{})})}):null]})]})};exports.default=Ft;
@@ -5,14 +5,14 @@ import { j as r } from "./jsx-runtime-NV737rRe.js";
5
5
  import X, { createElement as wt, useCallback as we, useState as U, useEffect as _, Component as Ue, Children as kt, Suspense as ze, useRef as De, useMemo as jt, lazy as Ct } from "react";
6
6
  import { map as ie, includes as Be, toUpper as ue, round as Tt, throttle as Ye, noop as ee, isEmpty as K, first as ae, omit as St, pick as It, get as O, isString as ke, memoize as Et, each as Dt, find as Bt, filter as Ke, isNull as Ot } from "lodash";
7
7
  import { ResetIcon as Oe, MobileIcon as Ae, LaptopIcon as At, DesktopIcon as Pt, DotsVerticalIcon as Rt, EraserIcon as Mt, ZoomInIcon as _t, DragHandleDots2Icon as Lt, ArrowUpIcon as Nt, CopyIcon as $t, TrashIcon as Ft } from "@radix-ui/react-icons";
8
- import { p as je, B as le, W as Je, aI as Wt, aJ as Ht, aK as qt, aL as Ut, aM as zt, R as Ce, ai as Yt, aN as Kt, aO as Jt, aP as Xt, aQ as Vt, aR as Zt, aS as Gt, w as Qt, j as W, aj as V, D as en, E as tn, F as nn, G as rn, H as sn, I as on, J as an, K as ln, ap as cn, L as dn, U as Xe, aH as oe, aT as un, _ as G, ab as pn, aU as re, ae as Te, m as Ve, n as fn, k as hn, o as gn, h as Ze, l as Ge, ag as mn, aV as yn, aW as Qe, aX as vn, aY as xn, x as bn, a as wn, aZ as kn, a_ as jn, a6 as Cn, a$ as Tn, i as Sn, S as et, aw as In } from "./index-wmzVWtmw.js";
8
+ import { p as je, B as le, W as Je, aI as Wt, aJ as Ht, aK as qt, aL as Ut, aM as zt, R as Ce, ai as Yt, aN as Kt, aO as Jt, aP as Xt, aQ as Vt, aR as Zt, aS as Gt, w as Qt, j as W, aj as V, D as en, E as tn, F as nn, G as rn, H as sn, I as on, J as an, K as ln, ap as cn, L as dn, U as Xe, aH as oe, aT as un, _ as G, ab as pn, aU as re, ae as Te, m as Ve, n as fn, k as hn, o as gn, h as Ze, l as Ge, ag as mn, aV as yn, aW as Qe, aX as vn, aY as xn, x as bn, a as wn, aZ as kn, a_ as jn, a6 as Cn, a$ as Tn, i as Sn, S as et, aw as In } from "./index-D15K4BZT.js";
9
9
  import { useTranslation as En } from "react-i18next";
10
10
  import { useAtom as $ } from "jotai";
11
11
  import Pe from "react-dom";
12
12
  import { g as Dn, S as Re, a as tt } from "./MODIFIERS-MLfpKQY1.js";
13
- import { r as nt, u as Bn, B as On, E as An } from "./index-ebo_5bTI.js";
13
+ import { r as nt, u as Bn, B as On, E as An } from "./index-RYlMCgpN.js";
14
14
  import { Quill as Pn } from "react-quill";
15
- import { u as Rn } from "./useAddBlockByDrop-Vcz4iQCH.js";
15
+ import { u as Rn } from "./useAddBlockByDrop-wiagwec5.js";
16
16
  import { useFeature as rt } from "flagged";
17
17
  import { flip as Mn } from "@floating-ui/dom";
18
18
  import { useFloating as _n, shift as Ln } from "@floating-ui/react-dom";
@@ -1158,7 +1158,7 @@ const pr = () => {
1158
1158
  h.stopPropagation(), h.preventDefault();
1159
1159
  },
1160
1160
  onKeyDown: (h) => h.stopPropagation(),
1161
- className: "z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
1161
+ className: "z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
1162
1162
  children: [
1163
1163
  /* @__PURE__ */ r.jsx(vr, { label: f, block: t }),
1164
1164
  /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2 px-1 ", children: [
@@ -1406,7 +1406,7 @@ const Sr = () => {
1406
1406
  )
1407
1407
  }
1408
1408
  );
1409
- }, Dr = Ct(() => import("./AddBlocks-VR2XGlgQ.js")), Fs = () => {
1409
+ }, Dr = Ct(() => import("./AddBlocks-Rd2EpNMr.js")), Fs = () => {
1410
1410
  const [e, t] = $(In);
1411
1411
  return /* @__PURE__ */ r.jsxs("div", { className: "flex h-full w-full flex-col", children: [
1412
1412
  /* @__PURE__ */ r.jsx(Jn, {}),
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-uu0QwUDN.cjs"),i=require("lodash"),h=require("sonner"),l=require("react"),o=require("./index-qLYDvpSi.cjs"),j=require("lucide-react");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");const p=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:q}=s.useSavePage(),d=o.useChangePage(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const m=r=>{if(q!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});d(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:m,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-MIe2pKhn.cjs"),i=require("lodash"),h=require("sonner"),l=require("react"),o=require("./index-kVugkp77.cjs"),j=require("lucide-react");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");const p=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:q}=s.useSavePage(),d=o.useChangePage(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const m=r=>{if(q!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});d(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:m,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
@@ -1,9 +1,9 @@
1
1
  import { j as e } from "./jsx-runtime-NV737rRe.js";
2
- import { ag as x, aq as h, ar as f, as as j, at as y, au as P } from "./index-wmzVWtmw.js";
2
+ import { ag as x, aq as h, ar as f, as as j, at as y, au as P } from "./index-D15K4BZT.js";
3
3
  import { sortBy as v, filter as b, get as w, isEmpty as s, find as n, capitalize as C, map as N } from "lodash";
4
4
  import { toast as S } from "sonner";
5
5
  import { useEffect as p } from "react";
6
- import { b as k, a as B, d as E, e as I } from "./index-ebo_5bTI.js";
6
+ import { b as k, a as B, d as E, e as I } from "./index-RYlMCgpN.js";
7
7
  import { BriefcaseIcon as L } from "lucide-react";
8
8
  import "./MODIFIERS-MLfpKQY1.js";
9
9
  import "@radix-ui/react-toggle";
@@ -4,15 +4,15 @@ import { BoxModelIcon as z, BoxIcon as V, DragHandleHorizontalIcon as F, ViewHor
4
4
  import { useDrop as he, useDragLayer as be } from "react-dnd";
5
5
  import { useDragOver as fe, Tree as Ie } from "@minoru/react-dnd-treeview";
6
6
  import { useTranslation as ke } from "react-i18next";
7
- import { _ as ye, Z as Be, j as g, n as Ce, bz as i, k as ve, l as we, a6 as Se, m as De, o as Te, i as Ne, bA as Me, ak as Oe, al as Re, bB as _e, bC as Ae, ae as Ee, w as He, aj as Pe, p as Le, aw as ze, bo as Ve, bD as Fe } from "./index-wmzVWtmw.js";
7
+ import { _ as ye, Z as Be, j as g, n as Ce, bz as i, k as ve, l as we, a6 as Se, m as De, o as Te, i as Ne, bA as Me, ak as Oe, al as Re, bB as _e, bC as Ae, ae as Ee, w as He, aj as Pe, p as Le, aw as ze, bo as Ve, bD as Fe } from "./index-D15K4BZT.js";
8
8
  import { DatabaseIcon as Ge } from "lucide-react";
9
9
  import "./lib.js";
10
10
  import { useMemo as $e, lazy as Ke, useCallback as Qe, useState as Ue, Suspense as Ye } from "react";
11
11
  import { a as qe } from "./MODIFIERS-MLfpKQY1.js";
12
12
  import { c as S } from "./utils-PPBbw5bk.js";
13
- import { f as We } from "./index-ebo_5bTI.js";
13
+ import { f as We } from "./index-RYlMCgpN.js";
14
14
  import { useAtom as Ze } from "jotai";
15
- import { u as Je } from "./useAddBlockByDrop-Vcz4iQCH.js";
15
+ import { u as Je } from "./useAddBlockByDrop-wiagwec5.js";
16
16
  import "@radix-ui/react-toggle";
17
17
  import "class-variance-authority";
18
18
  import "@radix-ui/react-switch";
@@ -209,7 +209,7 @@ const et = (t) => {
209
209
  }, ot = (t) => {
210
210
  const s = t.depth * 10 + 16;
211
211
  return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: s } });
212
- }, nt = Ke(() => import("./MarkAsGlobalBlock-QTujTxNj.js")), rt = () => {
212
+ }, nt = Ke(() => import("./MarkAsGlobalBlock--GjBOKA4.js")), rt = () => {
213
213
  const [t] = g(), [, s] = Ce();
214
214
  return /* @__PURE__ */ e.jsxs(i, { className: "flex items-center gap-x-4 text-xs", onClick: () => s(t), children: [
215
215
  /* @__PURE__ */ e.jsx(ie, {}),
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("lodash"),t=require("@radix-ui/react-icons"),f=require("react-dnd"),B=require("@minoru/react-dnd-treeview"),N=require("react-i18next"),r=require("./index-uu0QwUDN.cjs"),O=require("lucide-react");require("./lib.cjs");const R=require("react"),A=require("./MODIFIERS-WFzDQfiT.cjs"),y=require("./utils-It2K33fU.cjs"),_=require("./index-qLYDvpSi.cjs"),P=require("jotai"),H=require("./useAddBlockByDrop-3RSPGnwT.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("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");const C=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(O.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function L(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(c);if(u.nth(l,1))return`Visible >=${n[u.nth(l,1)]}`}return""}const F=s=>{let n="";return Object.keys(s).forEach(o=>{u.startsWith(s[o],A.STYLES_KEY)&&(n=s[o])}),n},V=s=>{var j;const[,n]=r.useHighlightBlockId(),[o]=r.useHiddenBlockIds(),{isSelected:i}=s,{id:c,data:l}=s.node,d=s.depth*10,m=a=>{a.stopPropagation(),s.onToggle(s.node.id)},E=B.useDragOver(c,s.isOpen,s.onToggle),p=R.useMemo(()=>{const a=F(s.node.data);return L(a)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:y.cn("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:a=>{a.stopPropagation(),!o.includes(c)&&s.onSelect(c)},onContextMenu:()=>s.onSelect(c),style:{paddingInlineStart:d},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:m,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(C,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((j=s.node.data)==null?void 0:j._name)||s.node.text}),p?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",p,")"]}):null]})]})})},z=s=>{var o;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(C,{type:(o=n==null?void 0:n.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},G=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},$=R.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-u8N_7PBX.cjs"))),K=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCutBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},Q=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},U=()=>{const[s]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),o=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},Y=({id:s=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),d=r.useBuilderProp("globalBlocksSupport",!1),m=R.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(r.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(U,{})]})},W=({children:s,id:n=null})=>{const[o,i]=R.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(r.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(r.DialogContent,{children:e.jsxRuntimeExports.jsx(R.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx($,{closeModal:()=>i(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(Y,{id:n,openMarkAsGlobalModal:()=>i(!0)})]})]})};function J(s){return u.map(s,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const X=()=>{const s=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,i,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:d}=N.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=_.useExpandedIds(),p=H.useAddBlockByDrop(),[,j]=P.useAtom(r.addBlocksModalAtom),a=async(x,g)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:q}=g;if(h){m();const T=J(x);n(T);const M=q.getItem();i([M.id])}else await p({block:q.getItem(),dropTargetId:k,relativeIndex:b}),j(!1)},v=u.map(s,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(s,{_parent:x._id})),data:x})),S=()=>{i([]),l([])},[{isOver:I},w]=f.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await p({block:x,dropTargetId:"",relativeIndex:0}),j(!1)))()}})),{isDragging:D}=f.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>S(),className:y.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:u.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:w,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(B.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:v,rootId:0,render:(x,{depth:g,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(W,{id:x.id,children:e.jsxRuntimeExports.jsx(V,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:g,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx(z,{monitorProps:x}),onDrop:a,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:g})=>e.jsxRuntimeExports.jsx(G,{node:x,depth:g})})})})})};exports.default=X;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("lodash"),t=require("@radix-ui/react-icons"),f=require("react-dnd"),B=require("@minoru/react-dnd-treeview"),N=require("react-i18next"),r=require("./index-MIe2pKhn.cjs"),O=require("lucide-react");require("./lib.cjs");const R=require("react"),A=require("./MODIFIERS-WFzDQfiT.cjs"),y=require("./utils-It2K33fU.cjs"),_=require("./index-kVugkp77.cjs"),P=require("jotai"),H=require("./useAddBlockByDrop-8i3iNtPF.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("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");const C=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(O.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function L(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(c);if(u.nth(l,1))return`Visible >=${n[u.nth(l,1)]}`}return""}const F=s=>{let n="";return Object.keys(s).forEach(o=>{u.startsWith(s[o],A.STYLES_KEY)&&(n=s[o])}),n},V=s=>{var j;const[,n]=r.useHighlightBlockId(),[o]=r.useHiddenBlockIds(),{isSelected:i}=s,{id:c,data:l}=s.node,d=s.depth*10,m=a=>{a.stopPropagation(),s.onToggle(s.node.id)},E=B.useDragOver(c,s.isOpen,s.onToggle),p=R.useMemo(()=>{const a=F(s.node.data);return L(a)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:y.cn("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:a=>{a.stopPropagation(),!o.includes(c)&&s.onSelect(c)},onContextMenu:()=>s.onSelect(c),style:{paddingInlineStart:d},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:m,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(C,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((j=s.node.data)==null?void 0:j._name)||s.node.text}),p?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",p,")"]}):null]})]})})},z=s=>{var o;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(C,{type:(o=n==null?void 0:n.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},G=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},$=R.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-GV1kflbN.cjs"))),K=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCutBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},Q=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},U=()=>{const[s]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),o=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},Y=({id:s=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),d=r.useBuilderProp("globalBlocksSupport",!1),m=R.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(r.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(U,{})]})},W=({children:s,id:n=null})=>{const[o,i]=R.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(r.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(r.DialogContent,{children:e.jsxRuntimeExports.jsx(R.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx($,{closeModal:()=>i(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(Y,{id:n,openMarkAsGlobalModal:()=>i(!0)})]})]})};function J(s){return u.map(s,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const X=()=>{const s=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,i,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:d}=N.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=_.useExpandedIds(),p=H.useAddBlockByDrop(),[,j]=P.useAtom(r.addBlocksModalAtom),a=async(x,g)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:q}=g;if(h){m();const T=J(x);n(T);const M=q.getItem();i([M.id])}else await p({block:q.getItem(),dropTargetId:k,relativeIndex:b}),j(!1)},v=u.map(s,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(s,{_parent:x._id})),data:x})),S=()=>{i([]),l([])},[{isOver:I},w]=f.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await p({block:x,dropTargetId:"",relativeIndex:0}),j(!1)))()}})),{isDragging:D}=f.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>S(),className:y.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:u.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:w,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(B.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:v,rootId:0,render:(x,{depth:g,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(W,{id:x.id,children:e.jsxRuntimeExports.jsx(V,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:g,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx(z,{monitorProps:x}),onDrop:a,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:g})=>e.jsxRuntimeExports.jsx(G,{node:x,depth:g})})})})})};exports.default=X;
@@ -1,7 +1,7 @@
1
1
  import { j as t } from "./jsx-runtime-NV737rRe.js";
2
2
  import { GlobeIcon as m } from "@radix-ui/react-icons";
3
3
  import { useState as n } from "react";
4
- import { $ as p, B as o } from "./index-wmzVWtmw.js";
4
+ import { $ as p, B as o } from "./index-D15K4BZT.js";
5
5
  import { capitalize as c } from "lodash";
6
6
  import "./MODIFIERS-MLfpKQY1.js";
7
7
  import "@radix-ui/react-toggle";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("@radix-ui/react-icons"),o=require("react"),s=require("./index-uu0QwUDN.cjs"),c=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");const x=({id:t=null,closeModal:i})=>{const l=s.useMarkAsGlobalBlock(),[r,u]=o.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(n.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:a=>u(a.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{l(t,c.capitalize(r)),i()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(s.Button,{variant:"outline",onClick:i,children:"Cancel"})]})]})};exports.default=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("@radix-ui/react-icons"),o=require("react"),s=require("./index-MIe2pKhn.cjs"),c=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");const x=({id:t=null,closeModal:i})=>{const l=s.useMarkAsGlobalBlock(),[r,u]=o.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(n.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:a=>u(a.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{l(t,c.capitalize(r)),i()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(s.Button,{variant:"outline",onClick:i,children:"Cancel"})]})]})};exports.default=x;
@@ -1,11 +1,11 @@
1
1
  import { j as t } from "./jsx-runtime-NV737rRe.js";
2
2
  import i, { Suspense as s } from "react";
3
3
  import { sortBy as a, filter as d, get as n } from "lodash";
4
- import { a as l, b as c } from "./index-ebo_5bTI.js";
4
+ import { a as l, b as c } from "./index-RYlMCgpN.js";
5
5
  import "./MODIFIERS-MLfpKQY1.js";
6
6
  import "i18next";
7
7
  import "react-i18next";
8
- import "./index-wmzVWtmw.js";
8
+ import "./index-D15K4BZT.js";
9
9
  import "@radix-ui/react-toggle";
10
10
  import "class-variance-authority";
11
11
  import "./utils-PPBbw5bk.js";
@@ -56,7 +56,7 @@ import "./tailwind-config-d1VL1lzE.js";
56
56
  import "react-hotkeys-hook";
57
57
  import "sonner";
58
58
  import "lucide-react";
59
- const x = i.lazy(() => import("./add-page-modal-R2AAoK3R.js")), g = i.lazy(() => import("./page-viewer-L4MKYffF.js")), bt = () => {
59
+ const x = i.lazy(() => import("./add-page-modal-o4WyfyUe.js")), g = i.lazy(() => import("./page-viewer-CijLLu6R.js")), bt = () => {
60
60
  const { data: o = [], isLoading: m } = l(), { data: r } = c(), p = a(d(o, { type: "STATIC" }), (e) => n(e, "uuid") === (r == null ? void 0 : r.homepage) ? 0 : 1);
61
61
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
62
62
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("react"),i=require("lodash"),s=require("./index-qLYDvpSi.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("i18next");require("react-i18next");require("./index-uu0QwUDN.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-U7Vh5_3P.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-t7cGqLNI.cjs"))),d=()=>{const{data:q=[],isLoading:t}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(q,{type:"STATIC"}),o=>i.get(o,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(x,{isLoading:t,pages:n})})]})};exports.default=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("react"),i=require("lodash"),s=require("./index-kVugkp77.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("i18next");require("react-i18next");require("./index-MIe2pKhn.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-1ied5RTu.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-_mpbB5Lr.cjs"))),d=()=>{const{data:q=[],isLoading:t}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(q,{type:"STATIC"}),o=>i.get(o,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(x,{isLoading:t,pages:n})})]})};exports.default=d;
@@ -1,8 +1,8 @@
1
1
  import { j as t } from "./jsx-runtime-NV737rRe.js";
2
2
  import m, { useRef as x, useEffect as a, Suspense as p } from "react";
3
3
  import { isEqual as b, isEmpty as j } from "lodash";
4
- import { bh as h, bi as n, bj as l, bk as c } from "./index-wmzVWtmw.js";
5
- import { c as f, b as g } from "./index-ebo_5bTI.js";
4
+ import { bh as h, bi as n, bj as l, bk as c } from "./index-D15K4BZT.js";
5
+ import { c as f, b as g } from "./index-RYlMCgpN.js";
6
6
  import "./MODIFIERS-MLfpKQY1.js";
7
7
  import "@radix-ui/react-toggle";
8
8
  import "class-variance-authority";
@@ -56,7 +56,7 @@ import "./tailwind-config-d1VL1lzE.js";
56
56
  import "react-hotkeys-hook";
57
57
  import "sonner";
58
58
  import "lucide-react";
59
- const N = m.lazy(() => import("./project-general-setting-ixBlo6KH.js")), S = m.lazy(() => import("./project-seo-setting-iJW4zDZz.js")), d = /* @__PURE__ */ t.jsx("div", { className: "px-3", children: /* @__PURE__ */ t.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (r) => r && j(r.seoData) ? {
59
+ const N = m.lazy(() => import("./project-general-setting-rHyDn0aW.js")), S = m.lazy(() => import("./project-seo-setting-bW4cNODi.js")), d = /* @__PURE__ */ t.jsx("div", { className: "px-3", children: /* @__PURE__ */ t.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (r) => r && j(r.seoData) ? {
60
60
  ...r,
61
61
  seoData: { title: "", description: "", image: "" }
62
62
  } : r;