@chaibuilder/sdk 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AddBlocks-RHuwwfe5.cjs → AddBlocks-F05ZiQnz.cjs} +1 -1
- package/dist/{AddBlocks-Izn_rxXD.js → AddBlocks-kmAje7cV.js} +1 -1
- package/dist/{BrandingOptions-Fyo8qs4o.cjs → BrandingOptions-2aNZT1u3.cjs} +1 -1
- package/dist/{BrandingOptions-orZyDGiL.js → BrandingOptions-GLVanp1T.js} +1 -1
- package/dist/CanvasArea-AHGpIP2x.cjs +56 -0
- package/dist/CanvasArea-gJ_UifbO.js +1349 -0
- package/dist/{CurrentPage-lIithDJy.cjs → CurrentPage-JJpZpFko.cjs} +1 -1
- package/dist/{CurrentPage-70sBzc2_.js → CurrentPage-fyWf5F84.js} +2 -2
- package/dist/{Layers-W0N2zfnf.js → Layers-RGy6kyuR.js} +3 -3
- package/dist/{Layers-YMtavzUG.cjs → Layers-YtfF6ty5.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-EOsABFjY.cjs → MarkAsGlobalBlock-1G5m_8t3.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-FPCQmRIh.js → MarkAsGlobalBlock-EsX3-clj.js} +1 -1
- package/dist/{PagesPanel-i-MQEmm_.cjs → PagesPanel-J8uYp1Tp.cjs} +1 -1
- package/dist/{PagesPanel-RbHN6lvQ.js → PagesPanel-LjiXL4rp.js} +3 -3
- package/dist/{ProjectPanel-CzwuyR0N.js → ProjectPanel-F435j6T2.js} +3 -3
- package/dist/{ProjectPanel-0BGx-hP-.cjs → ProjectPanel-IXVY1LJ_.cjs} +1 -1
- package/dist/{Settings-lxTrbI-C.js → Settings-b3lEaQ7w.js} +301 -308
- package/dist/Settings-xwTkQuKA.cjs +1 -0
- package/dist/{SidePanels-pUOJTYfr.cjs → SidePanels-1Ooc-KTb.cjs} +1 -1
- package/dist/{SidePanels-g4M6oTs-.js → SidePanels-MnI_uhIo.js} +3 -3
- package/dist/{Topbar-KqZt4TEY.js → Topbar-1ClabAix.js} +1 -1
- package/dist/{Topbar-kHffytzr.cjs → Topbar-e0hKiAm_.cjs} +1 -1
- package/dist/{UnsplashImages-y7I_7_W7.cjs → UnsplashImages-OJ5u1mVM.cjs} +1 -1
- package/dist/{UnsplashImages-Ua7ksJ8c.js → UnsplashImages-UejSDiRk.js} +1 -1
- package/dist/{UploadImages-RzEm0Stb.cjs → UploadImages-2SqVkr1u.cjs} +1 -1
- package/dist/{UploadImages-YP_J6erG.js → UploadImages-xBJTMBKX.js} +1 -1
- package/dist/{add-page-modal-btGWaXyq.js → add-page-modal-SdyjVxRW.js} +3 -3
- package/dist/{add-page-modal-ekFis5D8.cjs → add-page-modal-rkF5RqMj.cjs} +1 -1
- package/dist/{confirm-alert-Py2WqZhJ.js → confirm-alert-TCwoZBC3.js} +1 -1
- package/dist/{confirm-alert-mAhT8vln.cjs → confirm-alert-uk39UILT.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -3
- package/dist/core.js +2 -2
- package/dist/{delete-page-modal-QzleoJG2.cjs → delete-page-modal-PKSlPOAB.cjs} +1 -1
- package/dist/{delete-page-modal-Rq4ThQpu.js → delete-page-modal-pjChqG0d.js} +2 -2
- package/dist/{form-kAjrBaV-.cjs → form-N6Izl5Ni.cjs} +1 -1
- package/dist/{form-Lm3bupAq.js → form-aIN_qzKQ.js} +1 -1
- package/dist/{index-WPlT_Q87.js → index-0ZqKzbSx.js} +3 -3
- package/dist/index-4h4Ti2E4.cjs +1 -0
- package/dist/{index-fvoD_laH.cjs → index-LL32f5q7.cjs} +2 -2
- package/dist/{index-Vx4ctSV6.js → index-aPk1Fuat.js} +42 -31
- package/dist/{page-viewer-_wGsV2_o.js → page-viewer-SMOg1l3b.js} +3 -3
- package/dist/{page-viewer-AlOCzh1b.cjs → page-viewer-wrYXvC-7.cjs} +1 -1
- package/dist/{project-general-setting-B8uuHccU.js → project-general-setting-CcnnvnwD.js} +3 -3
- package/dist/{project-general-setting-XnNyOpXO.cjs → project-general-setting-wDjCo89M.cjs} +1 -1
- package/dist/{project-seo-setting-Zg2Z-Frr.js → project-seo-setting-CPtrvtsw.js} +2 -2
- package/dist/{project-seo-setting-QJBATF59.cjs → project-seo-setting-RJMYUQxR.cjs} +1 -1
- package/dist/{single-page-detail-HXpxgQnU.js → single-page-detail-7NRw-CLc.js} +4 -4
- package/dist/{single-page-detail-MWh30E_-.cjs → single-page-detail-gnpyWcy7.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/package.json +3 -3
- package/dist/CanvasArea-C30uJLef.js +0 -1298
- package/dist/CanvasArea-IM2K8bud.cjs +0 -46
- package/dist/Settings-mTWkKG82.cjs +0 -1
- package/dist/index-W5drgyWI.cjs +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("react"),t=require("lodash"),g=require("jotai"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("react"),t=require("lodash"),g=require("jotai"),s=require("./index-4h4Ti2E4.cjs"),y=require("react-dnd"),w=require("@radix-ui/react-icons"),k=require("@chaibuilder/runtime"),q=require("lucide-react"),A=require("./lib.cjs"),T=require("./utils-It2K33fU.cjs");require("./MODIFIERS-WFzDQfiT.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("@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");require("clsx");require("tailwind-merge");const C=({block:r})=>{const{type:o,icon:l,label:c}=r,{addCoreBlock:d,addPredefinedBlock:m}=s.useAddBlock(),[p]=s.useSelectedBlockIds(),[,x]=g.useAtom(s.activePanelAtom),[,i]=g.useAtom(s.addBlocksModalAtom),E=()=>{t.has(r,"blocks")?m(k.syncBlocksWithDefaults(r.blocks),t.first(p)):d(r,t.first(p)),i(!1),x("layers")},[,f,j]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||o).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:E,type:"button",ref:f,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[n.createElement(l||w.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||o})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||o})})]})]})},N=({block:r,closePopover:o})=>{var j;const[l,c]=n.useState(!1),d=s.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=s.useAddBlock(),[x]=s.useSelectedBlockIds(),[,i,E]=y.useDrag(()=>({type:"CHAI_BLOCK",item:r}),[r]),f=n.useCallback(async b=>{if(b.stopPropagation(),t.has(r,"component")){m(r,t.first(x)),o();return}c(!0);const a=await d(r);t.isEmpty(a)||p(k.syncBlocksWithDefaults(a),t.first(x)),o()},[r]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(y.DragPreviewImage,{connect:E,src:"https://placehold.co/100x30/000000/FFF?text="+((j=r.name||r.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:l?()=>{}:f,className:"relative cursor-grab 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(q.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.name}):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.name})})]})]})},I=()=>{const{data:r,isLoading:o}=s.useUILibraryBlocks(),l=k.useChaiBlocks(),c=t.filter(t.values(l),{category:"custom"}),d=t.groupBy(c,"group"),m=t.groupBy(r,"group"),[p,x]=n.useState(null),i=n.useMemo(()=>t.mergeWith(d,m,(a,h)=>{if(t.isArray(a)&&t.isArray(h))return[...a,...h]}),[d,m]),[,E]=g.useAtom(s.addBlocksModalAtom),[f,j]=n.useState("Navbar"),b=t.get(i,f,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("ul",{className:"sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2",children:o?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("li",{className:"h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"})]}):n.Children.toArray(t.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),x(null)},onMouseEnter:()=>{const R=setTimeout(()=>{j(h)},300);x(R)},onClick:()=>j(h),className:T.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",f===h?"bg-blue-500 text-white":" text-gray-700 hover:bg-foreground/10"),children:h})))}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-8",children:n.Children.toArray(b.map(a=>e.jsxRuntimeExports.jsx(N,{block:a,closePopover:()=>E(!1)})))})]})},L=()=>{const[r,o]=n.useState(""),{addPredefinedBlock:l}=s.useAddBlock(),[c]=s.useSelectedBlockIds(),[,d]=g.useAtom(s.addBlockOffCanvasAtom),[,m]=g.useAtom(s.activePanelAtom),[,p]=g.useAtom(s.addBlocksModalAtom),x=()=>{const i=A.getBlocksFromHTML(r);l([...i],t.first(c)||null),o(""),d(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(s.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(s.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(s.CardDescription,{children:"Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported."})]}),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:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:r,onChange:i=>o(i.target.value),rows:12,placeholder:`<div>
|
|
2
2
|
<h1>Enter code here</h1>
|
|
3
3
|
</div>`,className:"resize-none overflow-x-auto whitespace-pre 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:()=>x(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(s.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(w.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-sm leading-4",children:"Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})]})]})]})},v=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],P=(r,o)=>{if(!r)return!t.includes(v,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(v,o)},S=()=>{const[r,o]=n.useState("core"),[l,c]=n.useState("basic"),d=k.useChaiBlocks(),[,m]=g.useAtom(s.showPredefinedBlockCategoryAtom),[,p]=g.useAtom(s.addBlocksModalAtom),[x]=s.useSelectedBlockIds(),i=s.useAllBlocks(),E=t.find(i,{_id:t.first(x)}),{data:f,isLoading:j}=s.useUILibraryBlocks(),b=t.groupBy(t.filter(d,u=>P(E,u.type)),"category"),a=t.uniq(t.map(b.core,"group"));n.useEffect(()=>{!t.includes(a,l)&&!t.isEmpty(a)&&!t.isEmpty(l)&&c(t.first(a))},[a,l]);const h=u=>c(B=>B===u?"":u),R=!j&&!t.isEmpty(f)||t.find(t.values(d),{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 justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsxs("h1",{className:"flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row",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 your own HTML code)":"(Drag & drop into tree view or click to add)"})]}),e.jsxRuntimeExports.jsxs("button",{onClick:()=>p(!1),className:"flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",children:[e.jsxRuntimeExports.jsx(w.Cross1Icon,{width:12})," Close"]})]}),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 "+(R?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:"Core"}),R?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"ui-blocks",children:"UI 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:n.Children.toArray(t.map(a,u=>t.reject(t.filter(t.values(b.core),{group:u}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:u,className:"border-border",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{onClick:()=>h(u),className:"py-2 capitalize",children:u}),e.jsxRuntimeExports.jsx(s.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(t.reject(t.filter(t.values(b.core),{group:u}),{hidden:!0}).map(B=>e.jsxRuntimeExports.jsx(C,{block:B})))})})]}):null))})}),r==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(I,{})}),r==="html"&&e.jsxRuntimeExports.jsx(L,{})]})};exports.default=S;
|
|
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
|
2
2
|
import v, { createElement as K, useState as j, useCallback as q, useMemo as V, useEffect as W, Suspense as J } from "react";
|
|
3
3
|
import { has as z, first as g, isEmpty as w, filter as k, values as B, groupBy as I, mergeWith as Q, isArray as H, get as X, map as L, includes as P, find as E, uniq as Y, reject as M } from "lodash";
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
|
-
import { O as F, j as C, az as D, aA as N, aH as Z, aI as $, aK as ee, i as se, a8 as O, bv as re, bw as te, bx as oe, by as le, bz as ae, bA as ie, aM as ce, bB as ne, bC as de, B as me, bD as pe, bE as ue, bF as xe, ae as he, aB as fe, aC as be, aD as A, bp as ge, bi as je, bj as ye, bk as we, bl as ke, S as Be } from "./index-
|
|
5
|
+
import { O as F, j as C, az as D, aA as N, aH as Z, aI as $, aK as ee, i as se, a8 as O, bv as re, bw as te, bx as oe, by as le, bz as ae, bA as ie, aM as ce, bB as ne, bC as de, B as me, bD as pe, bE as ue, bF as xe, ae as he, aB as fe, aC as be, aD as A, bp as ge, bi as je, bj as ye, bk as we, bl as ke, S as Be } from "./index-aPk1Fuat.js";
|
|
6
6
|
import { useDrag as R, DragPreviewImage as _ } from "react-dnd";
|
|
7
7
|
import { BoxIcon as ve, ExclamationTriangleIcon as Ce, Cross1Icon as Ne } from "@radix-ui/react-icons";
|
|
8
8
|
import { syncBlocksWithDefaults as G, useChaiBlocks as U } from "@chaibuilder/runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-WUGKV8jN.cjs"),C=require("react"),B=require("@rjsf/validator-ajv8"),j=require("@rjsf/core"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-WUGKV8jN.cjs"),C=require("react"),B=require("@rjsf/validator-ajv8"),j=require("@rjsf/core"),c=require("./index-4h4Ti2E4.cjs"),e=require("./controls-aHZq-q4b.cjs"),R=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 P(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}return t.default=r,Object.freeze(t)}const v=P(C),p=[{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"}],k=()=>{const r=c.useBuilderProp("onSaveBrandingOptions",async()=>{}),[t,i]=c.useBrandingOptions(),a=v.useRef(t);v.useEffect(()=>()=>{R.isEqual(t,a.current)||r(a.current)},[]);const y=({formData:l},n)=>{n&&(i(l),a.current=l)},{bodyFont:f,headingFont:g,primaryColor:q,bodyTextDarkColor:b,bodyTextLightColor:m,bodyBgDarkColor:x,secondaryColor:h,bodyBgLightColor:S,roundedCorners:O}=t,s={headingFont:e.f({title:"Heading font",default:g,options:p}),bodyFont:e.f({title:"Body font",default:f,options:p}),roundedCorners:e.c({title:"Rounded Corner",default:parseInt(O||5,10)}),primaryColor:e.y({title:"Primary",default:q}),secondaryColor:e.y({title:"Secondary",default:h}),bodyBgLightColor:e.y({title:"Body Background (Light)",default:S}),bodyBgDarkColor:e.y({title:"Body Background (Dark)",default:x}),bodyTextLightColor:e.y({title:"Body Text (Light)",default:b}),bodyTextDarkColor:e.y({title:"Body Text (Dark)",default:m})},u={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const n=s[l];return u.properties||(u.properties={}),u.properties[l]=n.schema,d[l]=n.uiSchema,!0}),o.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[o.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:o.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),o.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:o.jsxRuntimeExports.jsx(j,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:u,formData:t,validator:B,onChange:y})})]})};exports.default=k;
|
|
@@ -2,7 +2,7 @@ import { j as i } from "./jsx-runtime-NV737rRe.js";
|
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import O from "@rjsf/validator-ajv8";
|
|
4
4
|
import k from "@rjsf/core";
|
|
5
|
-
import { i as D, x as N } from "./index-
|
|
5
|
+
import { i as D, x as N } from "./index-aPk1Fuat.js";
|
|
6
6
|
import { f as p, c as P, y as e } from "./controls-G0puEH71.js";
|
|
7
7
|
import { isEqual as R } from "lodash";
|
|
8
8
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";var Pe=Object.defineProperty;var Me=(n,t,s)=>t in n?Pe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var $=(n,t,s)=>(Me(n,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),g=require("react"),f=require("lodash"),M=require("@radix-ui/react-icons"),r=require("./index-4h4Ti2E4.cjs"),je=require("react-i18next"),H=require("jotai"),ue=require("react-dom"),K=require("./MODIFIERS-WFzDQfiT.cjs"),V=require("./index-LL32f5q7.cjs"),_e=require("react-quill"),Le=require("@floating-ui/dom"),de=require("@floating-ui/react-dom"),Ne=require("react-dnd"),We=require("@react-hookz/web"),Fe=require("@bobthered/tailwindcss-palette-generator"),$e=require("react-wrap-balancer"),He=require("tailwind-merge"),Ue=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("flagged");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 ze=()=>{const{undoCount:n,redoCount:t,undo:s,redo:o}=r.useCanvasHistory();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(r.Button,{disabled:!n,size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(M.ResetIcon,{})}),e.jsxRuntimeExports.jsx(r.Button,{disabled:!t,onClick:o,size:"sm",className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(M.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function Ye(){const[n,t]=r.useDarkMode(),{t:s}=je.useTranslation();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(r.Label,{htmlFor:"dark-mode-switch",children:s("dark_mode")}),e.jsxRuntimeExports.jsxs(r.Switch,{id:"dark-mode-switch",checked:n,onCheckedChange:()=>{t(!n)},className:`${n?"bg-violet-600":"bg-violet-300"}
|
|
2
|
+
relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),e.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${n?"translate-x-5":"translate-x-0"}
|
|
3
|
+
pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const pe=({landscape:n=!1})=>e.jsxRuntimeExports.jsxs("svg",{className:n?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[e.jsxRuntimeExports.jsx("g",{strokeWidth:0}),e.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),e.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),fe=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(M.MobileIcon,{}),width:400},{title:"Mobile landscape (SM)",content:"Styles set here are applied at 640px and up unless edited at higher breakpoint",breakpoint:"sm",icon:e.jsxRuntimeExports.jsx(M.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:e.jsxRuntimeExports.jsx(pe,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:e.jsxRuntimeExports.jsx(pe,{landscape:!0}),width:1024},{title:"Desktop (XL)",content:"Styles set here are applied at 1280px and up unless edited at higher breakpoint",breakpoint:"xl",icon:e.jsxRuntimeExports.jsx(M.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:e.jsxRuntimeExports.jsx(M.DesktopIcon,{}),width:1920}],Ke=({title:n,content:t,currentBreakpoint:s,breakpoint:o,width:c,icon:a,onClick:l})=>e.jsxRuntimeExports.jsxs(r.HoverCard,{children:[e.jsxRuntimeExports.jsx(r.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(r.Button,{onClick:()=>l(c),size:"sm",variant:o===s?"secondary":"ghost",children:a})}),e.jsxRuntimeExports.jsx(r.HoverCardContent,{className:"w-52 border-border",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:n}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),Ve=()=>{const[,n,t]=r.useCanvasWidth(),[s,o]=r.useSelectedBreakpoints(),c=a=>{s.includes(a)?s.length>2&&o(s.filter(l=>l!==a)):o(l=>[...l,a])};return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[f.map(fe.filter(a=>f.includes(s,f.toUpper(a.breakpoint))),a=>g.createElement(Ke,{...a,onClick:t,key:a.breakpoint,currentBreakpoint:n})),e.jsxRuntimeExports.jsxs(r.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(r.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:e.jsxRuntimeExports.jsx(M.DotsVerticalIcon,{className:"scale-90 transform"})})}),e.jsxRuntimeExports.jsxs(r.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[e.jsxRuntimeExports.jsx(r.DropdownMenuLabel,{children:"Breakpoints"}),e.jsxRuntimeExports.jsx(r.DropdownMenuSeparator,{}),f.map(fe,a=>e.jsxRuntimeExports.jsx(r.DropdownMenuCheckboxItem,{disabled:a.breakpoint==="xs",onCheckedChange:()=>c(f.toUpper(a.breakpoint)),checked:f.includes(s,f.toUpper(a.breakpoint)),children:a.title},a.breakpoint))]})]})]})},Xe=()=>{const[n]=r.useSetAllBlocks(),{createSnapshot:t}=r.useCanvasHistory(),[,s]=r.useSelectedBlockIds(),[,o]=r.useSelectedStylingBlocks(),c=g.useCallback(()=>{n([]),s([]),o([]),t()},[n,t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(r.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[e.jsxRuntimeExports.jsx(M.EraserIcon,{})," Clear"]})}),e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{className:"border-border",children:[e.jsxRuntimeExports.jsxs(r.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTitle,{children:"Clear whole canvas?"}),e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),e.jsxRuntimeExports.jsxs(r.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx(r.AlertDialogAction,{onClick:c,children:"Yes"})]})]})]})})},Ze=()=>{const n=r.useFeatureSupport("darkMode",!1),[t]=r.useCanvasZoom();return e.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[n?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Ye,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"})]}):null,e.jsxRuntimeExports.jsx(Ve,{}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[e.jsxRuntimeExports.jsx(M.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",e.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[f.round(t,0),"%"]})]}),e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(ze,{})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[e.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(Xe,{})]})]})},Ge=`<!doctype html>
|
|
4
|
+
<html class="scroll-smooth h-full overflow-y-auto">
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset="UTF-8">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
|
+
<script src="https://old.chaibuilder.com/offline/tailwind.cdn.js"><\/script>
|
|
9
|
+
<style>
|
|
10
|
+
html { height: 100%; overflow:auto; }
|
|
11
|
+
body { height: 100%; }
|
|
12
|
+
.air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
|
|
13
|
+
.air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
|
|
14
|
+
body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
|
|
15
|
+
-moz-user-select: none;-ms-user-select: none; user-select: none; }
|
|
16
|
+
html{
|
|
17
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
18
|
+
scrollbar-width: none; /* Firefox */
|
|
19
|
+
}
|
|
20
|
+
/** IMPORTANT: Make fields content editable in SAFARI */
|
|
21
|
+
[contenteditable] {-webkit-user-select: text;user-select: text;}
|
|
22
|
+
|
|
23
|
+
html::-webkit-scrollbar { width: 0 !important }
|
|
24
|
+
.aspect-auto{aspect-ratio: auto;}
|
|
25
|
+
.aspect-square{aspect-ratio: 1/1;}
|
|
26
|
+
.aspect-video{aspect-ratio: 16/9;}
|
|
27
|
+
a{ pointer-events: none !important; }
|
|
28
|
+
[contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
|
|
29
|
+
[contenteditable="true"] {
|
|
30
|
+
outline: none;
|
|
31
|
+
box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
|
|
32
|
+
-webkit-user-select: text;
|
|
33
|
+
-moz-user-select: text;
|
|
34
|
+
user-select: text;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
<style id="hidden-blocks"></style>
|
|
38
|
+
<style id="selected-block"></style>
|
|
39
|
+
<style id="selected-styling-block"></style>
|
|
40
|
+
<style id="highlighted-block"></style>
|
|
41
|
+
|
|
42
|
+
</head>
|
|
43
|
+
<body class="font-body antialiased h-full">
|
|
44
|
+
<div class="frame-root"></div>
|
|
45
|
+
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
46
|
+
</body>
|
|
47
|
+
</html>`,Je=n=>{const[t]=r.useCanvasWidth(),[,s]=r.useCanvasZoom(),[o,c]=g.useState({}),a=g.useCallback(()=>{const{width:l,height:u}=n;if(l<t){const p=parseFloat((l/t).toString());let x={};u&&(x={height:u+2*u*(1-p)}),c({transform:`scale(${p})`,transformOrigin:"top left",...x,maxWidth:"none"}),s(p*100)}else c({}),s(100)},[t,n,s]);return g.useEffect(()=>{a()},[t,n,s,a]),o};var Z={exports:{}};/*
|
|
48
|
+
object-assign
|
|
49
|
+
(c) Sindre Sorhus
|
|
50
|
+
@license MIT
|
|
51
|
+
*/var Q,xe;function Qe(){if(xe)return Q;xe=1;var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function c(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var l={},u=0;u<10;u++)l["_"+String.fromCharCode(u)]=u;var p=Object.getOwnPropertyNames(l).map(function(h){return l[h]});if(p.join("")!=="0123456789")return!1;var x={};return"abcdefghijklmnopqrst".split("").forEach(function(h){x[h]=h}),Object.keys(Object.assign({},x)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Q=c()?Object.assign:function(a,l){for(var u,p=o(a),x,h=1;h<arguments.length;h++){u=Object(arguments[h]);for(var m in u)t.call(u,m)&&(p[m]=u[m]);if(n){x=n(u);for(var w=0;w<x.length;w++)s.call(u,x[w])&&(p[x[w]]=u[x[w]])}}return p},Q}var ee,he;function ae(){if(he)return ee;he=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ee=n,ee}var te,me;function Ee(){return me||(me=1,te=Function.call.bind(Object.prototype.hasOwnProperty)),te}var ne,ge;function et(){if(ge)return ne;ge=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var t=ae(),s={},o=Ee();n=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}}}function c(a,l,u,p,x){if(process.env.NODE_ENV!=="production"){for(var h in a)if(o(a,h)){var m;try{if(typeof a[h]!="function"){var w=Error((p||"React class")+": "+u+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw w.name="Invariant Violation",w}m=a[h](l,h,p,u,null,t)}catch(q){m=q}if(m&&!(m instanceof Error)&&n((p||"React class")+": type specification of "+u+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in s)){s[m.message]=!0;var S=x?x():"";n("Failed "+u+" type: "+m.message+(S??""))}}}}return c.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(s={})},ne=c,ne}var se,ye;function tt(){if(ye)return se;ye=1;var n=V.reactIsExports,t=Qe(),s=ae(),o=Ee(),c=et(),a=function(){};process.env.NODE_ENV!=="production"&&(a=function(u){var p="Warning: "+u;typeof console<"u"&&console.error(p);try{throw new Error(p)}catch{}});function l(){return null}return se=function(u,p){var x=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function m(i){var d=i&&(x&&i[x]||i[h]);if(typeof d=="function")return d}var w="<<anonymous>>",S={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:U(),arrayOf:L,element:G(),elementType:J(),instanceOf:D,node:Ie(),objectOf:W,oneOf:N,oneOfType:Te,shape:Be,exact:Ae};function q(i,d){return i===d?i!==0||1/i===1/d:i!==i&&d!==d}function k(i,d){this.message=i,this.data=d&&typeof d=="object"?d:{},this.stack=""}k.prototype=Error.prototype;function B(i){if(process.env.NODE_ENV!=="production")var d={},R=0;function E(C,j,b,T,A,I,_){if(T=T||w,I=I||b,_!==s){if(p){var O=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 O.name="Invariant Violation",O}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var z=T+":"+b;!d[z]&&R<3&&(a("You are manually calling a React.PropTypes validation function for the `"+I+"` prop on `"+T+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),d[z]=!0,R++)}}return j[b]==null?C?j[b]===null?new k("The "+A+" `"+I+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new k("The "+A+" `"+I+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:i(j,b,T,A,I)}var y=E.bind(null,!1);return y.isRequired=E.bind(null,!0),y}function v(i){function d(R,E,y,C,j,b){var T=R[E],A=F(T);if(A!==i){var I=Y(T);return new k("Invalid "+C+" `"+j+"` of type "+("`"+I+"` supplied to `"+y+"`, expected ")+("`"+i+"`."),{expectedType:i})}return null}return B(d)}function U(){return B(l)}function L(i){function d(R,E,y,C,j){if(typeof i!="function")return new k("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside arrayOf.");var b=R[E];if(!Array.isArray(b)){var T=F(b);return new k("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an array."))}for(var A=0;A<b.length;A++){var I=i(b,A,y,C,j+"["+A+"]",s);if(I instanceof Error)return I}return null}return B(d)}function G(){function i(d,R,E,y,C){var j=d[R];if(!u(j)){var b=F(j);return new k("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return B(i)}function J(){function i(d,R,E,y,C){var j=d[R];if(!n.isValidElementType(j)){var b=F(j);return new k("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return B(i)}function D(i){function d(R,E,y,C,j){if(!(R[E]instanceof i)){var b=i.name||w,T=Oe(R[E]);return new k("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected ")+("instance of `"+b+"`."))}return null}return B(d)}function N(i){if(!Array.isArray(i))return process.env.NODE_ENV!=="production"&&(arguments.length>1?a("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])."):a("Invalid argument supplied to oneOf, expected an array.")),l;function d(R,E,y,C,j){for(var b=R[E],T=0;T<i.length;T++)if(q(b,i[T]))return null;var A=JSON.stringify(i,function(_,O){var z=Y(O);return z==="symbol"?String(O):O});return new k("Invalid "+C+" `"+j+"` of value `"+String(b)+"` "+("supplied to `"+y+"`, expected one of "+A+"."))}return B(d)}function W(i){function d(R,E,y,C,j){if(typeof i!="function")return new k("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside objectOf.");var b=R[E],T=F(b);if(T!=="object")return new k("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an object."));for(var A in b)if(o(b,A)){var I=i(b,A,y,C,j+"."+A,s);if(I instanceof Error)return I}return null}return B(d)}function Te(i){if(!Array.isArray(i))return process.env.NODE_ENV!=="production"&&a("Invalid argument supplied to oneOfType, expected an instance of array."),l;for(var d=0;d<i.length;d++){var R=i[d];if(typeof R!="function")return a("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+qe(R)+" at index "+d+"."),l}function E(y,C,j,b,T){for(var A=[],I=0;I<i.length;I++){var _=i[I],O=_(y,C,j,b,T,s);if(O==null)return null;O.data&&o(O.data,"expectedType")&&A.push(O.data.expectedType)}var z=A.length>0?", expected one of type ["+A.join(", ")+"]":"";return new k("Invalid "+b+" `"+T+"` supplied to "+("`"+j+"`"+z+"."))}return B(E)}function Ie(){function i(d,R,E,y,C){return X(d[R])?null:new k("Invalid "+y+" `"+C+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return B(i)}function le(i,d,R,E,y){return new k((i||"React class")+": "+d+" type `"+R+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+y+"`.")}function Be(i){function d(R,E,y,C,j){var b=R[E],T=F(b);if(T!=="object")return new k("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));for(var A in i){var I=i[A];if(typeof I!="function")return le(y,C,j,A,Y(I));var _=I(b,A,y,C,j+"."+A,s);if(_)return _}return null}return B(d)}function Ae(i){function d(R,E,y,C,j){var b=R[E],T=F(b);if(T!=="object")return new k("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));var A=t({},R[E],i);for(var I in A){var _=i[I];if(o(i,I)&&typeof _!="function")return le(y,C,j,I,Y(_));if(!_)return new k("Invalid "+C+" `"+j+"` key `"+I+"` supplied to `"+y+"`.\nBad object: "+JSON.stringify(R[E],null," ")+`
|
|
52
|
+
Valid keys: `+JSON.stringify(Object.keys(i),null," "));var O=_(b,I,y,C,j+"."+I,s);if(O)return O}return null}return B(d)}function X(i){switch(typeof i){case"number":case"string":case"undefined":return!0;case"boolean":return!i;case"object":if(Array.isArray(i))return i.every(X);if(i===null||u(i))return!0;var d=m(i);if(d){var R=d.call(i),E;if(d!==i.entries){for(;!(E=R.next()).done;)if(!X(E.value))return!1}else for(;!(E=R.next()).done;){var y=E.value;if(y&&!X(y[1]))return!1}}else return!1;return!0;default:return!1}}function De(i,d){return i==="symbol"?!0:d?d["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&d instanceof Symbol:!1}function F(i){var d=typeof i;return Array.isArray(i)?"array":i instanceof RegExp?"object":De(d,i)?"symbol":d}function Y(i){if(typeof i>"u"||i===null)return""+i;var d=F(i);if(d==="object"){if(i instanceof Date)return"date";if(i instanceof RegExp)return"regexp"}return d}function qe(i){var d=Y(i);switch(d){case"array":case"object":return"an "+d;case"boolean":case"date":case"regexp":return"a "+d;default:return d}}function Oe(i){return!i.constructor||!i.constructor.name?w:i.constructor.name}return S.checkPropTypes=c,S.resetWarningCache=c.resetWarningCache,S.PropTypes=S,S},se}var re,ve;function nt(){if(ve)return re;ve=1;var n=ae();function t(){}function s(){}return s.resetWarningCache=t,re=function(){function o(l,u,p,x,h,m){if(m!==n){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}}o.isRequired=o;function c(){return o}var a={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:c,element:o,elementType:o,instanceOf:c,node:o,objectOf:c,oneOf:c,oneOfType:c,shape:c,exact:c,checkPropTypes:s,resetWarningCache:t};return a.PropTypes=a,a},re}var Tt=Z.exports;if(process.env.NODE_ENV!=="production"){var st=V.reactIsExports,rt=!0;Z.exports=tt()(st.isElement,rt)}else Z.exports=nt()();var it=Z.exports;const P=K.getDefaultExportFromCjs(it);let be,ke;typeof document<"u"&&(be=document);typeof window<"u"&&(ke=window);const Re=g.createContext({document:be,window:ke}),ce=()=>g.useContext(Re),{Provider:ot,Consumer:It}=Re;class we extends g.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return g.Children.only(this.props.children)}}$(we,"propTypes",{children:P.element.isRequired,contentDidMount:P.func.isRequired,contentDidUpdate:P.func.isRequired});class ie extends g.Component{constructor(s,o){super(s,o);$(this,"setRef",s=>{this.nodeRef.current=s;const{forwardedRef:o}=this.props;typeof o=="function"?o(s):o&&(o.current=s)});$(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});$(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=g.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const s=this.getDoc();return this.props.mountTarget?s.querySelector(this.props.mountTarget):s.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const s=this.getDoc();if(!s)return null;const o=this.props.contentDidMount,c=this.props.contentDidUpdate,a=s.defaultView||s.parentView,l=e.jsxRuntimeExports.jsx(we,{contentDidMount:o,contentDidUpdate:c,children:e.jsxRuntimeExports.jsx(ot,{value:{document:s,window:a},children:e.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),u=this.getMountTarget();return[ue.createPortal(this.props.head,this.getDoc().head),ue.createPortal(l,u)]}render(){const s={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete s.head,delete s.initialContent,delete s.mountTarget,delete s.contentDidMount,delete s.contentDidUpdate,delete s.forwardedRef,e.jsxRuntimeExports.jsx("iframe",{...s,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}$(ie,"propTypes",{style:P.object,head:P.node,initialContent:P.string,mountTarget:P.string,contentDidMount:P.func,contentDidUpdate:P.func,children:P.oneOfType([P.element,P.arrayOf(P.element)])}),$(ie,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const at=g.forwardRef((n,t)=>e.jsxRuntimeExports.jsx(ie,{...n,forwardedRef:t}));function Se(n){return n.getAttribute("data-block-id")?n:n.closest("[data-block-id]")}function ct(n){n.container.innerHTML="",n.container.parentNode.removeChild(n.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),n=null}const lt=()=>{const n=["Heading","Paragraph","Text","Link","Span","Button"],t=r.useUpdateBlocksProps(),[,s]=r.useSelectedBlockIds(),[,o]=r.useHighlightBlockId(),[c,a]=H.useAtom(r.inlineEditingActiveAtom);return l=>{var w;if(c)return;const u=Se(l.target),p=u.getAttribute("data-block-type");if(!p||!n.includes(p))return;a(u.getAttribute("data-block-id"));const x=u.cloneNode(!0);u.style.display="none",Array.from(x.attributes).forEach(S=>{S.name!=="class"&&x.removeAttribute(S.name)}),u.parentNode.insertBefore(x,u.nextSibling);const h=new _e.Quill(x);function m(){const S=h.getText(0,h.getLength());t([u.getAttribute("data-block-id")],{content:S}),u.removeAttribute("style"),x.removeEventListener("blur",m,!0),ct(h),a(""),o("")}x.addEventListener("blur",m,!0),h.focus(),(w=x.querySelector(".ql-clipboard"))==null||w.remove(),s([])}},ut=()=>{const[,n]=r.useSelectedStylingBlocks(),[,t]=r.useSelectedBlockIds(),[s]=H.useAtom(r.inlineEditingActiveAtom);return o=>{if(s)return;o.stopPropagation();const c=Se(o.target);if(c.getAttribute("data-block-parent")){const a=c.getAttribute("data-style-prop"),l=c.getAttribute("data-style-id"),u=c.getAttribute("data-block-parent");n([{id:l,prop:a,blockId:u}]),t([u])}else c.getAttribute("data-block-id")&&t([c.getAttribute("data-block-id")])}},dt=({children:n})=>{const{document:t}=ce(),[s]=r.useSelectedBlockIds(),[o,c]=r.useSelectedStylingBlocks();g.useEffect(()=>{setTimeout(()=>{if(!f.isEmpty(o))return;const u=Ce(t,f.first(s));if(u){const p=u.getAttribute("data-style-prop");if(p){const x=u.getAttribute("data-style-id"),h=u.getAttribute("data-block-parent");c([{id:x,prop:p,blockId:h}])}}},100)},[t,s,c,o]);const a=lt(),l=ut();return e.jsxRuntimeExports.jsx("div",{id:"canvas",onClick:l,onDoubleClick:a,className:"relative h-screen max-w-full",children:n})},Ce=(n,t)=>n.querySelector(`[data-block-id="${t}"]`),pt=()=>{const{window:n}=ce(),[t,s]=r.useSelectedBlockIds(),[,o]=r.useSelectedStylingBlocks(),{undo:c,redo:a}=r.useCanvasHistory(),l=r.useDuplicateBlocks(),[,u]=r.useCutBlockIds(),[,p]=r.useCopyBlockIds(),{pasteBlocks:x}=r.usePasteBlocks(),[,h]=r.usePreviewMode(),m=r.useRemoveBlocks(),{savePage:w}=r.useSavePage(),[S]=H.useAtom(r.inlineEditingActiveAtom),[,q]=H.useAtom(r.editLayerNameAtom),k=B=>{B.key==="Enter"&&(B.preventDefault(),t.length===1&&q(f.first(t)))};return g.useEffect(()=>{const B=v=>{if(v.key==="Escape"){s([]),o([]);return}if(k(v),!S&&(v.key==="Delete"||v.key==="Backspace")&&(v.preventDefault(),m(t)),v.ctrlKey||v.metaKey){if(["z","y","d","x","c","p","s","v"].includes(v.key)){if(S&&["x","z","v"].includes(v.key))return!0;v.preventDefault()}v.key==="s"&&(v.stopPropagation(),v.preventDefault(),w()),v.key==="z"&&c(),v.key==="y"&&a(),v.key==="d"&&l(t),v.key==="x"&&u(t),v.key==="c"&&p(t),v.key==="v"&&t.length>0&&x(t[0])}};return n.removeEventListener("keydown",B),n.addEventListener("keydown",B),()=>{n.removeEventListener("keydown",B)}},[t,s,c,m,h,a,l,u,p,x,S,w,n]),null},ft=({block:n,label:t})=>{const[,s]=Ne.useDrag(()=>({type:"CANVAS_BLOCK",item:n}));return e.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",ref:s,onDragStart:()=>{console.log("drag start")},children:[e.jsxRuntimeExports.jsx(M.DragHandleDots2Icon,{}),t]})},xt=({selectedBlockElement:n,block:t})=>{const s=r.useRemoveBlocks(),o=r.useDuplicateBlocks(),[,c]=r.useSelectedBlockIds(),[,a]=r.useSelectedStylingBlocks(),{floatingStyles:l,refs:u,update:p}=de.useFloating({placement:"top-start",middleware:[de.shift(),Le.flip()],elements:{reference:n}});We.useResizeObserver(n,()=>p(),n!==null);const x=f.get(t,"_parent",null),h=f.isEmpty(f.get(t,"_name",""))?f.get(t,"_type",""):f.get(t,"_name","");return!n||!t?null:e.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:u.setFloating,style:l,onClick:m=>{m.stopPropagation(),m.preventDefault()},onKeyDown:m=>m.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[e.jsxRuntimeExports.jsx(ft,{label:h,block:t}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[x&&e.jsxRuntimeExports.jsx(M.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{a([]),c([x])}}),r.canDuplicateBlock(f.get(t,"_type",""))?e.jsxRuntimeExports.jsx(M.CopyIcon,{className:"hover:scale-105 ",onClick:()=>o([t==null?void 0:t._id])}):null,r.canDeleteBlock(f.get(t,"_type",""))?e.jsxRuntimeExports.jsx(M.TrashIcon,{className:"hover:scale-105 ",onClick:()=>s([t==null?void 0:t._id])}):null]})]})},ht=({model:n})=>{const[t]=r.useBrandingOptions(),[s]=r.useSelectedBlockIds(),[o]=r.useDarkMode(),[c]=r.useHighlightBlockId(),[a]=r.useSelectedStylingBlocks(),{document:l,window:u}=ce(),[p]=g.useState(l==null?void 0:l.getElementById("highlighted-block")),[x]=g.useState(l==null?void 0:l.getElementById("selected-block")),[h]=g.useState(l==null?void 0:l.getElementById("selected-styling-block"));g.useEffect(()=>{o?l==null||l.documentElement.classList.add("dark"):l==null||l.documentElement.classList.remove("dark")},[o,l]);const m=f.get(t,"headingFont","DM Sans"),w=f.get(t,"bodyFont","DM Sans");return g.useEffect(()=>{const S=f.get(t,"primaryColor","#000"),q=f.get(t,"secondaryColor","#FFF"),k=Fe.tailwindcssPaletteGenerator({colors:[S,q],names:["primary","secondary"]});k.primary.DEFAULT=S,k.secondary.DEFAULT=q;const B=f.get(t,"roundedCorners","0");!u||!u.tailwind||(u.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[m],body:[w]},extend:{borderRadius:{global:`${B||"0"}px`},colors:k}},plugins:[u.tailwind.plugin.withOptions(({prefix:v="ui"}={})=>({addVariant:U})=>{for(const L of["open","checked","selected","active","disabled"])U(`${v}-${L}`,[`&[data-headlessui-state~="${L}"]`,`:where([data-headlessui-state~="${L}"]) &`]),U(`${v}-not-${L}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${L}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${L}"])) &:not([data-headlessui-state])`])})]})},[t,u,m,w]),g.useEffect(()=>{x&&(x.textContent=`${f.map(s,S=>`[data-block-id="${S}"]`).join(",")}{
|
|
53
|
+
outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
54
|
+
}`)},[s,x]),g.useEffect(()=>{p&&(p.textContent=c?`[data-style-id="${c}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[c,s,p]),g.useEffect(()=>{h&&(h.textContent=`${f.map(a,({id:S})=>`[data-style-id="${S}"]`).join(",")}{
|
|
55
|
+
outline: 1px solid orange !important; outline-offset: -1px;
|
|
56
|
+
}`)},[a,h]),g.useEffect(()=>{if(n==="section")return;const S=f.get(t,"bodyTextLightColor","#64748b"),q=f.get(t,"bodyTextDarkColor","#94a3b8"),k=f.get(t,"bodyBgLightColor","#FFFFFF"),B=f.get(t,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${S}] bg-[${k}] dark:text-[${q}] dark:bg-[${B}]`},[t,l,n]),n==="page"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[m&&e.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${m.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),w&&m!==w&&e.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${w.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),m&&e.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${m}",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},mt=()=>{const{t:n}=je.useTranslation();return e.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:e.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:n("canvas_empty")})})},gt=n=>{const t={};return Object.keys(n).forEach(s=>{f.isString(n[s])&&n[s].startsWith(K.SLOT_KEY)&&(t[s]=n[s].replace(K.SLOT_KEY,"").split(","))}),t},yt=f.memoize(n=>{const t=n.replace(K.STYLES_KEY,"").split(",");return He.twMerge(t[0],t[1])});function vt(n,t){return f.get(n,`${t}_attrs`,{})}function jt(n,t,s){const o={};return Object.keys(n).forEach(c=>{if(f.isString(n[c])&&n[c].startsWith(K.STYLES_KEY)){const a=yt(n[c]);o[c]={className:a,"data-style-prop":c,"data-block-parent":n._id,"data-style-id":`${c}-${n._id}`,onMouseEnter:t,onMouseLeave:s,...vt(n,c)}}}),o}function Et(n,t){const s=f.get(n,"_bindings",{});return f.isEmpty(s)?{...n}:(f.each(s,(o,c)=>{f.isString(o)&&f.get(t,o,null)&&(n[c]=f.get(t,o,null))}),n)}function oe({blocks:n}){const t=r.useAllBlocks(),[,s]=r.useHighlightBlockId(),[o]=r.useAtom(r.inlineEditingActiveAtom),c=g.useCallback(p=>{var h;if(o)return;const x=(h=p.currentTarget)==null?void 0:h.getAttribute("data-style-id");s(x||""),p.stopPropagation()},[s,o]),a=g.useCallback(p=>{o||(s(""),p.stopPropagation())},[s,o]),l=g.useCallback(p=>jt(p,c,a),[c,a]),[u]=V.useChaiExternalData();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:g.Children.toArray(n.map((p,x)=>{const h=gt(p),m={};f.isEmpty(h)||Object.keys(h).forEach(k=>{m[k]=g.Children.toArray(h[k].map(B=>e.jsxRuntimeExports.jsx(oe,{blocks:[f.find(t,{_id:B})]})))});const w=f.filter(t,{_parent:p._id});m.children=w.length?e.jsxRuntimeExports.jsx(oe,{blocks:w}):null;const S=Ue.getBlockComponent(p._type),q=f.get(S,"component",null);return f.isNull(q)?e.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${p==null?void 0:p._type} not registered -->`}):e.jsxRuntimeExports.jsx(g.Suspense,{children:g.createElement(q,{blockProps:{"data-block-id":p._id,"data-block-type":p._type},inBuilder:!0,index:x,...Et(p,u),...l(p),...m})})}))})}const bt=()=>{const n=r.useAllBlocks();return e.jsxRuntimeExports.jsx($e.Provider,{children:f.isEmpty(n)?e.jsxRuntimeExports.jsx(mt,{}):e.jsxRuntimeExports.jsx(V.BlocksExternalDataProvider,{children:e.jsxRuntimeExports.jsx(oe,{blocks:f.filter(n,t=>f.isEmpty(t._parent))})})})},kt=(n,t)=>n.querySelector(`[data-style-id="${t}"]`),Rt=()=>{const[n]=H.useAtom(r.networkModeAtom),[t]=r.usePreviewMode(),[s]=r.useCanvasWidth(),[,o]=r.useSelectedBlockIds(),c=r.useSelectedBlock(),[,a]=r.useHighlightBlockId(),l=g.useRef(null),u=g.useRef(null),[p,x]=g.useState({width:0,height:0}),h=Je(p),[m,w]=g.useState(0),[S,q]=g.useState([]),[,k]=g.useState([]),[,B]=H.useAtom(r.canvasIframeAtom),[v,U]=r.useSelectedStylingBlocks(),L=r.useBuilderProp("loadingCanvas",!1);g.useEffect(()=>{const{clientWidth:D,clientHeight:N}=u.current;x({width:D,height:N}),m===0&&w(D)},[u,s,m]);const G=(D,N=0)=>{const{top:W}=D.getBoundingClientRect();return W+N>=0&&W-N<=window.innerHeight};g.useEffect(()=>{var D,N;if(c&&c.type!=="Multiple"&&l.current){const W=Ce(l.current.contentDocument,c._id);W&&(G(W)||(N=(D=l.current)==null?void 0:D.contentWindow)==null||N.scrollTo({top:W.offsetTop,behavior:"smooth"}),q([W]))}},[c]),g.useEffect(()=>{if(!f.isEmpty(v)&&l.current){const D=kt(l.current.contentDocument,f.first(v).id);k(D?[D]:[null])}else k([null])},[v]);const J=g.useMemo(()=>{let D=Ge;return n==="offline"&&(D=D.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),D=D.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),D=D.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),D},[n]);return e.jsxRuntimeExports.jsx("div",{onClick:()=>{o([]),U([])},onMouseLeave:()=>setTimeout(()=>a(""),300),className:"relative mx-auto h-full w-full",style:m>0&&!f.isEmpty(h)?{width:t?"100%":m}:{},ref:u,children:e.jsxRuntimeExports.jsxs(at,{contentDidMount:()=>B(l.current),ref:l,id:"canvas-iframe",style:{width:`${s}px`,...h},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:J,children:[e.jsxRuntimeExports.jsx(pt,{}),e.jsxRuntimeExports.jsx(xt,{block:c,selectedBlockElement:f.first(S)}),e.jsxRuntimeExports.jsx(ht,{model:"page"}),e.jsxRuntimeExports.jsxs(dt,{children:[L?e.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"})}):e.jsxRuntimeExports.jsx(bt,{}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},wt=g.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-F05ZiQnz.cjs"))),St=()=>{const[n,t]=H.useAtom(r.addBlocksModalAtom);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxRuntimeExports.jsx(Ze,{}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 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:[e.jsxRuntimeExports.jsx(g.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"}),children:e.jsxRuntimeExports.jsx(V.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(Rt,{})})}),n?e.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:e.jsxRuntimeExports.jsx("div",{onClick:s=>s.stopPropagation(),className:"mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",children:e.jsxRuntimeExports.jsx(wt,{})})}):null]})]})};exports.default=St;
|