@chaibuilder/sdk 1.0.24 → 1.1.1
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-P3qHuE5J.cjs +1 -0
- package/dist/AddBlocks-imyQSCbI.js +230 -0
- package/dist/{BrandingOptions-2aNZT1u3.cjs → BrandingOptions-_2XBEPab.cjs} +1 -1
- package/dist/{BrandingOptions-GLVanp1T.js → BrandingOptions-tSNtQ1Kv.js} +1 -1
- package/dist/CanvasArea-JzBGfXSp.js +1412 -0
- package/dist/CanvasArea-rC2E_4eS.cjs +58 -0
- package/dist/{CurrentPage-fyWf5F84.js → CurrentPage-2Hqp8dwp.js} +2 -2
- package/dist/{CurrentPage-JJpZpFko.cjs → CurrentPage-v7RxefU-.cjs} +1 -1
- package/dist/Layers-1H-MUoKM.cjs +1 -0
- package/dist/{Layers-RGy6kyuR.js → Layers-K_1pMZK5.js} +119 -137
- package/dist/{MarkAsGlobalBlock-EsX3-clj.js → MarkAsGlobalBlock-aqik3ouc.js} +1 -1
- package/dist/{MarkAsGlobalBlock-1G5m_8t3.cjs → MarkAsGlobalBlock-p_wvHkQZ.cjs} +1 -1
- package/dist/{PagesPanel-J8uYp1Tp.cjs → PagesPanel-Qt66yy3K.cjs} +1 -1
- package/dist/{PagesPanel-LjiXL4rp.js → PagesPanel-uMZT46fo.js} +3 -3
- package/dist/{ProjectPanel-IXVY1LJ_.cjs → ProjectPanel-g92sgZ-g.cjs} +1 -1
- package/dist/{ProjectPanel-F435j6T2.js → ProjectPanel-nhhdOgSP.js} +3 -3
- package/dist/Settings-IcmgBZm9.cjs +1 -0
- package/dist/{Settings-b3lEaQ7w.js → Settings-pYbQsClt.js} +483 -475
- package/dist/{SidePanels-MnI_uhIo.js → SidePanels-9AjWdvVI.js} +62 -55
- package/dist/{SidePanels-1Ooc-KTb.cjs → SidePanels-CBkl8HgT.cjs} +1 -1
- package/dist/{Topbar-1ClabAix.js → Topbar-Jc74a6oE.js} +1 -1
- package/dist/{Topbar-e0hKiAm_.cjs → Topbar-ZjAs5fDc.cjs} +1 -1
- package/dist/{UnsplashImages-UejSDiRk.js → UnsplashImages-_PxEYx5c.js} +1 -1
- package/dist/{UnsplashImages-OJ5u1mVM.cjs → UnsplashImages-nXceZLmd.cjs} +1 -1
- package/dist/{UploadImages-2SqVkr1u.cjs → UploadImages-tcQb5NZu.cjs} +1 -1
- package/dist/{UploadImages-xBJTMBKX.js → UploadImages-zzSgKmP9.js} +10 -10
- package/dist/{add-page-modal-SdyjVxRW.js → add-page-modal-Ny4uAvWB.js} +3 -3
- package/dist/{add-page-modal-rkF5RqMj.cjs → add-page-modal-eahhWw2b.cjs} +1 -1
- package/dist/{confirm-alert-TCwoZBC3.js → confirm-alert-2JxcNf3T.js} +1 -1
- package/dist/{confirm-alert-uk39UILT.cjs → confirm-alert-mzlwOW9w.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +2 -2
- package/dist/{delete-page-modal-PKSlPOAB.cjs → delete-page-modal-07nDpZpj.cjs} +1 -1
- package/dist/{delete-page-modal-pjChqG0d.js → delete-page-modal-4qrgJQ0x.js} +2 -2
- package/dist/{form-aIN_qzKQ.js → form-TQ7vwDYO.js} +1 -1
- package/dist/{form-N6Izl5Ni.cjs → form-bSW-Pkw9.cjs} +1 -1
- package/dist/{index-aPk1Fuat.js → index-ORFlyrBx.js} +536 -534
- package/dist/{index-LL32f5q7.cjs → index-Ua5E0Syv.cjs} +11 -11
- package/dist/{index-0ZqKzbSx.js → index-aDqFUJ8v.js} +165 -160
- package/dist/index-zkc4SQCu.cjs +1 -0
- package/dist/{page-viewer-SMOg1l3b.js → page-viewer-1Eb7ypob.js} +3 -3
- package/dist/{page-viewer-wrYXvC-7.cjs → page-viewer-X8h3FMwb.cjs} +1 -1
- package/dist/{project-general-setting-wDjCo89M.cjs → project-general-setting-I4z0C7PE.cjs} +1 -1
- package/dist/{project-general-setting-CcnnvnwD.js → project-general-setting-TCl_JNdl.js} +3 -3
- package/dist/{project-seo-setting-RJMYUQxR.cjs → project-seo-setting-cERASO9j.cjs} +1 -1
- package/dist/{project-seo-setting-CPtrvtsw.js → project-seo-setting-k0HlefUD.js} +2 -2
- package/dist/{single-page-detail-7NRw-CLc.js → single-page-detail-W5sW6771.js} +4 -4
- package/dist/{single-page-detail-gnpyWcy7.cjs → single-page-detail-sdTzXA5i.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 +57 -57
- package/dist/useAddBlockByDrop-DPV32UHP.cjs +1 -0
- package/dist/useAddBlockByDrop-UA_Iw_4l.js +20 -0
- package/package.json +2 -2
- package/dist/AddBlocks-F05ZiQnz.cjs +0 -3
- package/dist/AddBlocks-kmAje7cV.js +0 -270
- package/dist/CanvasArea-AHGpIP2x.cjs +0 -56
- package/dist/CanvasArea-gJ_UifbO.js +0 -1349
- package/dist/Layers-YtfF6ty5.cjs +0 -1
- package/dist/Settings-xwTkQuKA.cjs +0 -1
- package/dist/index-4h4Ti2E4.cjs +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";var We=Object.defineProperty;var $e=(t,e,n)=>e in t?We(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var U=(t,e,n)=>($e(t,typeof e!="symbol"?e+"":e,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),p=require("lodash"),P=require("@radix-ui/react-icons"),o=require("./index-zkc4SQCu.cjs"),He=require("react-i18next"),W=require("jotai"),fe=require("react-dom"),X=require("./MODIFIERS-WFzDQfiT.cjs"),J=require("./index-Ua5E0Syv.cjs"),Ue=require("react-quill"),ze=require("./useAddBlockByDrop-DPV32UHP.cjs"),Ye=require("flagged"),Ke=require("@floating-ui/dom"),xe=require("@floating-ui/react-dom"),Ve=require("react-dnd"),Xe=require("@react-hookz/web"),Je=require("@bobthered/tailwindcss-palette-generator"),Ze=require("react-wrap-balancer"),Ge=require("tailwind-merge"),Qe=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("@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 et=()=>{const{undoCount:t,redoCount:e,undo:n,redo:a}=o.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Button,{disabled:!t,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(P.ResetIcon,{})}),s.jsxRuntimeExports.jsx(o.Button,{disabled:!e,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(P.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function tt(){const[t,e]=o.useDarkMode(),{t:n}=He.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(o.Switch,{id:"dark-mode-switch",checked:t,onCheckedChange:()=>{e(!t)},className:`${t?"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:[s.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),s.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${t?"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 he=({landscape:t=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:t?"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"}})]}),ge=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(P.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(P.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(he,{}),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(he,{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(P.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(P.DesktopIcon,{}),width:1920}],nt=({title:t,content:e,currentBreakpoint:n,breakpoint:a,width:d,icon:r,onClick:l})=>s.jsxRuntimeExports.jsxs(o.HoverCard,{children:[s.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(o.Button,{onClick:()=>l(d),size:"sm",variant:a===n?"secondary":"ghost",children:r})}),s.jsxRuntimeExports.jsx(o.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:t}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:e})]})})})]}),st=()=>{const[,t,e]=o.useCanvasWidth(),[n,a]=o.useSelectedBreakpoints(),d=r=>{n.includes(r)?n.length>2&&a(n.filter(l=>l!==r)):a(l=>[...l,r])};return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[p.map(ge.filter(r=>p.includes(n,p.toUpper(r.breakpoint))),r=>m.createElement(nt,{...r,onClick:e,key:r.breakpoint,currentBreakpoint:t})),s.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(P.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:"Breakpoints"}),s.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),p.map(ge,r=>s.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:r.breakpoint==="xs",onCheckedChange:()=>d(p.toUpper(r.breakpoint)),checked:p.includes(n,p.toUpper(r.breakpoint)),children:r.title},r.breakpoint))]})]})]})},rt=()=>{const[t]=o.useSetAllBlocks(),{createSnapshot:e}=o.useCanvasHistory(),[,n]=o.useSelectedBlockIds(),[,a]=o.useSelectedStylingBlocks(),d=m.useCallback(()=>{t([]),n([]),a([]),e()},[t,e]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(o.AlertDialog,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(o.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(P.EraserIcon,{})," Clear"]})}),s.jsxRuntimeExports.jsxs(o.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(o.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTitle,{children:"Clear whole canvas?"}),s.jsxRuntimeExports.jsx(o.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),s.jsxRuntimeExports.jsxs(o.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogCancel,{children:"Cancel"}),s.jsxRuntimeExports.jsx(o.AlertDialogAction,{onClick:d,children:"Yes"})]})]})]})})},ot=()=>{const t=o.useFeatureSupport("darkMode",!1),[e]=o.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:[t?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(tt,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(st,{}),s.jsxRuntimeExports.jsx(o.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(P.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[p.round(e,0),"%"]})]}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(et,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(rt,{})]})]})},it=`<!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
|
+
.dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
|
|
28
|
+
.dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
|
|
29
|
+
a{ pointer-events: none !important; }
|
|
30
|
+
[contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
|
|
31
|
+
[contenteditable="true"] {
|
|
32
|
+
outline: none;
|
|
33
|
+
box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
|
|
34
|
+
-webkit-user-select: text;
|
|
35
|
+
-moz-user-select: text;
|
|
36
|
+
user-select: text;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
39
|
+
<style id="hidden-blocks"></style>
|
|
40
|
+
<style id="selected-block"></style>
|
|
41
|
+
<style id="selected-styling-block"></style>
|
|
42
|
+
<style id="highlighted-block"></style>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body class="font-body antialiased h-full">
|
|
46
|
+
<div class="frame-root"></div>
|
|
47
|
+
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
48
|
+
</body>
|
|
49
|
+
</html>`,at=t=>{const[e]=o.useCanvasWidth(),[,n]=o.useCanvasZoom(),[a,d]=m.useState({}),r=m.useCallback(()=>{const{width:l,height:c}=t;if(l<e){const h=parseFloat((l/e).toString());let f={};c&&(f={height:c+2*c*(1-h)}),d({transform:`scale(${h})`,transformOrigin:"top left",...f,maxWidth:"none"}),n(h*100)}else d({}),n(100)},[e,t,n]);return m.useEffect(()=>{r()},[e,t,n,r]),a};var G={exports:{}};/*
|
|
50
|
+
object-assign
|
|
51
|
+
(c) Sindre Sorhus
|
|
52
|
+
@license MIT
|
|
53
|
+
*/var ne,me;function lt(){if(me)return ne;me=1;var t=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function a(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function d(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var l={},c=0;c<10;c++)l["_"+String.fromCharCode(c)]=c;var h=Object.getOwnPropertyNames(l).map(function(g){return l[g]});if(h.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(g){f[g]=g}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ne=d()?Object.assign:function(r,l){for(var c,h=a(r),f,g=1;g<arguments.length;g++){c=Object(arguments[g]);for(var x in c)e.call(c,x)&&(h[x]=c[x]);if(t){f=t(c);for(var b=0;b<f.length;b++)n.call(c,f[b])&&(h[f[b]]=c[f[b]])}}return h},ne}var se,ye;function de(){if(ye)return se;ye=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return se=t,se}var re,ve;function we(){return ve||(ve=1,re=Function.call.bind(Object.prototype.hasOwnProperty)),re}var oe,je;function ct(){if(je)return oe;je=1;var t=function(){};if(process.env.NODE_ENV!=="production"){var e=de(),n={},a=we();t=function(r){var l="Warning: "+r;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}}}function d(r,l,c,h,f){if(process.env.NODE_ENV!=="production"){for(var g in r)if(a(r,g)){var x;try{if(typeof r[g]!="function"){var b=Error((h||"React class")+": "+c+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw b.name="Invariant Violation",b}x=r[g](l,g,h,c,null,e)}catch(M){x=M}if(x&&!(x instanceof Error)&&t((h||"React class")+": type specification of "+c+" `"+g+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof x+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),x instanceof Error&&!(x.message in n)){n[x.message]=!0;var w=f?f():"";t("Failed "+c+" type: "+x.message+(w??""))}}}}return d.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},oe=d,oe}var ie,be;function dt(){if(be)return ie;be=1;var t=J.reactIsExports,e=lt(),n=de(),a=we(),d=ct(),r=function(){};process.env.NODE_ENV!=="production"&&(r=function(c){var h="Warning: "+c;typeof console<"u"&&console.error(h);try{throw new Error(h)}catch{}});function l(){return null}return ie=function(c,h){var f=typeof Symbol=="function"&&Symbol.iterator,g="@@iterator";function x(i){var u=i&&(f&&i[f]||i[g]);if(typeof u=="function")return u}var b="<<anonymous>>",w={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:z(),arrayOf:_,element:ee(),elementType:te(),instanceOf:A,node:Pe(),objectOf:F,oneOf:N,oneOfType:qe,shape:Me,exact:Le};function M(i,u){return i===u?i!==0||1/i===1/u:i!==i&&u!==u}function S(i,u){this.message=i,this.data=u&&typeof u=="object"?u:{},this.stack=""}S.prototype=Error.prototype;function D(i){if(process.env.NODE_ENV!=="production")var u={},R=0;function E(C,j,k,T,I,B,L){if(T=T||b,B=B||k,L!==n){if(h){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 Y=T+":"+k;!u[Y]&&R<3&&(r("You are manually calling a React.PropTypes validation function for the `"+B+"` 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."),u[Y]=!0,R++)}}return j[k]==null?C?j[k]===null?new S("The "+I+" `"+B+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new S("The "+I+" `"+B+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:i(j,k,T,I,B)}var y=E.bind(null,!1);return y.isRequired=E.bind(null,!0),y}function v(i){function u(R,E,y,C,j,k){var T=R[E],I=$(T);if(I!==i){var B=V(T);return new S("Invalid "+C+" `"+j+"` of type "+("`"+B+"` supplied to `"+y+"`, expected ")+("`"+i+"`."),{expectedType:i})}return null}return D(u)}function z(){return D(l)}function _(i){function u(R,E,y,C,j){if(typeof i!="function")return new S("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside arrayOf.");var k=R[E];if(!Array.isArray(k)){var T=$(k);return new S("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an array."))}for(var I=0;I<k.length;I++){var B=i(k,I,y,C,j+"["+I+"]",n);if(B instanceof Error)return B}return null}return D(u)}function ee(){function i(u,R,E,y,C){var j=u[R];if(!c(j)){var k=$(j);return new S("Invalid "+y+" `"+C+"` of type "+("`"+k+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return D(i)}function te(){function i(u,R,E,y,C){var j=u[R];if(!t.isValidElementType(j)){var k=$(j);return new S("Invalid "+y+" `"+C+"` of type "+("`"+k+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return D(i)}function A(i){function u(R,E,y,C,j){if(!(R[E]instanceof i)){var k=i.name||b,T=Fe(R[E]);return new S("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected ")+("instance of `"+k+"`."))}return null}return D(u)}function N(i){if(!Array.isArray(i))return process.env.NODE_ENV!=="production"&&(arguments.length>1?r("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])."):r("Invalid argument supplied to oneOf, expected an array.")),l;function u(R,E,y,C,j){for(var k=R[E],T=0;T<i.length;T++)if(M(k,i[T]))return null;var I=JSON.stringify(i,function(L,O){var Y=V(O);return Y==="symbol"?String(O):O});return new S("Invalid "+C+" `"+j+"` of value `"+String(k)+"` "+("supplied to `"+y+"`, expected one of "+I+"."))}return D(u)}function F(i){function u(R,E,y,C,j){if(typeof i!="function")return new S("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside objectOf.");var k=R[E],T=$(k);if(T!=="object")return new S("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an object."));for(var I in k)if(a(k,I)){var B=i(k,I,y,C,j+"."+I,n);if(B instanceof Error)return B}return null}return D(u)}function qe(i){if(!Array.isArray(i))return process.env.NODE_ENV!=="production"&&r("Invalid argument supplied to oneOfType, expected an instance of array."),l;for(var u=0;u<i.length;u++){var R=i[u];if(typeof R!="function")return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Ne(R)+" at index "+u+"."),l}function E(y,C,j,k,T){for(var I=[],B=0;B<i.length;B++){var L=i[B],O=L(y,C,j,k,T,n);if(O==null)return null;O.data&&a(O.data,"expectedType")&&I.push(O.data.expectedType)}var Y=I.length>0?", expected one of type ["+I.join(", ")+"]":"";return new S("Invalid "+k+" `"+T+"` supplied to "+("`"+j+"`"+Y+"."))}return D(E)}function Pe(){function i(u,R,E,y,C){return Z(u[R])?null:new S("Invalid "+y+" `"+C+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return D(i)}function pe(i,u,R,E,y){return new S((i||"React class")+": "+u+" type `"+R+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+y+"`.")}function Me(i){function u(R,E,y,C,j){var k=R[E],T=$(k);if(T!=="object")return new S("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));for(var I in i){var B=i[I];if(typeof B!="function")return pe(y,C,j,I,V(B));var L=B(k,I,y,C,j+"."+I,n);if(L)return L}return null}return D(u)}function Le(i){function u(R,E,y,C,j){var k=R[E],T=$(k);if(T!=="object")return new S("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));var I=e({},R[E],i);for(var B in I){var L=i[B];if(a(i,B)&&typeof L!="function")return pe(y,C,j,B,V(L));if(!L)return new S("Invalid "+C+" `"+j+"` key `"+B+"` supplied to `"+y+"`.\nBad object: "+JSON.stringify(R[E],null," ")+`
|
|
54
|
+
Valid keys: `+JSON.stringify(Object.keys(i),null," "));var O=L(k,B,y,C,j+"."+B,n);if(O)return O}return null}return D(u)}function Z(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(Z);if(i===null||c(i))return!0;var u=x(i);if(u){var R=u.call(i),E;if(u!==i.entries){for(;!(E=R.next()).done;)if(!Z(E.value))return!1}else for(;!(E=R.next()).done;){var y=E.value;if(y&&!Z(y[1]))return!1}}else return!1;return!0;default:return!1}}function _e(i,u){return i==="symbol"?!0:u?u["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&u instanceof Symbol:!1}function $(i){var u=typeof i;return Array.isArray(i)?"array":i instanceof RegExp?"object":_e(u,i)?"symbol":u}function V(i){if(typeof i>"u"||i===null)return""+i;var u=$(i);if(u==="object"){if(i instanceof Date)return"date";if(i instanceof RegExp)return"regexp"}return u}function Ne(i){var u=V(i);switch(u){case"array":case"object":return"an "+u;case"boolean":case"date":case"regexp":return"a "+u;default:return u}}function Fe(i){return!i.constructor||!i.constructor.name?b:i.constructor.name}return w.checkPropTypes=d,w.resetWarningCache=d.resetWarningCache,w.PropTypes=w,w},ie}var ae,Ee;function ut(){if(Ee)return ae;Ee=1;var t=de();function e(){}function n(){}return n.resetWarningCache=e,ae=function(){function a(l,c,h,f,g,x){if(x!==t){var b=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 b.name="Invariant Violation",b}}a.isRequired=a;function d(){return a}var r={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:d,element:a,elementType:a,instanceOf:d,node:a,objectOf:d,oneOf:d,oneOfType:d,shape:d,exact:d,checkPropTypes:n,resetWarningCache:e};return r.PropTypes=r,r},ae}var $t=G.exports;if(process.env.NODE_ENV!=="production"){var pt=J.reactIsExports,ft=!0;G.exports=dt()(pt.isElement,ft)}else G.exports=ut()();var xt=G.exports;const q=X.getDefaultExportFromCjs(xt);let Se,Ce;typeof document<"u"&&(Se=document);typeof window<"u"&&(Ce=window);const Te=m.createContext({document:Se,window:Ce}),Q=()=>m.useContext(Te),{Provider:ht,Consumer:Ht}=Te;class Be extends m.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return m.Children.only(this.props.children)}}U(Be,"propTypes",{children:q.element.isRequired,contentDidMount:q.func.isRequired,contentDidUpdate:q.func.isRequired});class le extends m.Component{constructor(n,a){super(n,a);U(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:a}=this.props;typeof a=="function"?a(n):a&&(a.current=n)});U(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});U(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=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,d=this.props.contentDidUpdate,r=n.defaultView||n.parentView,l=s.jsxRuntimeExports.jsx(Be,{contentDidMount:a,contentDidUpdate:d,children:s.jsxRuntimeExports.jsx(ht,{value:{document:n,window:r},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),c=this.getMountTarget();return[fe.createPortal(this.props.head,this.getDoc().head),fe.createPortal(l,c)]}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()})}}U(le,"propTypes",{style:q.object,head:q.node,initialContent:q.string,mountTarget:q.string,contentDidMount:q.func,contentDidUpdate:q.func,children:q.oneOfType([q.element,q.arrayOf(q.element)])}),U(le,"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 gt=m.forwardRef((t,e)=>s.jsxRuntimeExports.jsx(le,{...t,forwardedRef:e}));let H=null,K=[],Ie=null;function De(t){const e=window.getComputedStyle(t),n=parseInt(e.paddingLeft,10),a=parseInt(e.paddingTop,10),d=parseInt(e.paddingRight,10),r=parseInt(e.paddingBottom,10);return{paddingLeft:n,paddingTop:a,paddingRight:d,paddingBottom:r}}const ke=(t,e,n)=>{if(!H)return;const a=t.getBoundingClientRect(),d=H==null?void 0:H.getElementById("placeholder"),{paddingLeft:r,paddingTop:l,paddingRight:c,paddingBottom:h}=De(t);d.style.width=e==="vertical"?a.width-r-c+"px":"2px",d.style.height=e==="vertical"?"5px":a.height-l-h+"px",d.style.display="block";const f=K.reduce((g,x)=>Math.abs(x-n)<Math.abs(g-n)?x:g);Ie=K.indexOf(f),d.style.top=t.offsetTop+(e==="vertical"?f:0)+"px",d.style.left=t.offsetLeft+(e==="horizontal"?f:0)+"px"},mt=t=>{const e=Ae(t),n=t.getBoundingClientRect(),a=Array.from(t.children);a.filter(l=>l.getAttribute("data-dnd")!=="ignore");const{paddingLeft:d,paddingTop:r}=De(t);K=[e==="vertical"?d:r],K=[...K,...a.map(l=>{const c=l.getBoundingClientRect();return e==="vertical"?c.top-n.top+c.height:c.left-n.left+c.width})]};function Ae(t){const e=window.getComputedStyle(t).display,n=e==="block"?"vertical":"horizontal";return e==="flex"&&t.style.flexDirection==="column"?"vertical":n}const yt=p.throttle(t=>{const e=t.target,n=Ae(e);if(n==="vertical"){const a=t.clientY-e.offsetTop;ke(e,n,a)}else{const a=t.clientX-e.offsetLeft;ke(e,n,a)}},200),vt=t=>{t.preventDefault(),t.stopPropagation(),yt(t)};function Re(){const t=H==null?void 0:H.getElementById("placeholder");t.style.display="none"}const jt=()=>{const{document:t}=Q(),[e,n]=W.useAtom(o.draggingFlagAtom),a=ze.useAddBlockByDrop(),d=Ye.useFeature("dnd");return H=t,{isDragging:e,"data-dnd":"branch",onDragOver:d?vt:p.noop,onDrop:d?r=>{const l=JSON.parse(r.dataTransfer.getData("text/plain"));let c=r.target.getAttribute("data-block-id");c===null&&(c=r.target.parentElement.getAttribute("data-block-id")),a({block:l,dropTargetId:c||null,relativeIndex:Ie}),n(!1),setTimeout(()=>Re(),300)}:p.noop,onDragEnter:d?r=>{const l=r;l.stopPropagation(),l.preventDefault(),K=[];const c=l.target;mt(c),c.classList.add("outline","outline-blue-500","outline-4","-outline-offset-4"),n(!0)}:p.noop,onDragLeave:d?r=>{const l=r;l.stopPropagation(),l.preventDefault(),l.target.classList.remove("outline","outline-blue-500","outline-4","-outline-offset-4")}:p.noop,onMouseOut:d?()=>{n(!1),Re()}:p.noop}};function ue(t){return t.getAttribute("data-block-id")?t:t.closest("[data-block-id]")}function bt(t){t.container.innerHTML="",t.container.parentNode.removeChild(t.container);var e=document.querySelector(".ql-toolbar");e&&e.parentNode.removeChild(e),t=null}const Et=()=>{const t=["Heading","Paragraph","Text","Link","Span","Button"],e=o.useUpdateBlocksProps(),[,n]=o.useSelectedBlockIds(),[,a]=o.useHighlightBlockId(),[d,r]=W.useAtom(o.inlineEditingActiveAtom);return l=>{var b;if(d)return;const c=ue(l.target),h=c.getAttribute("data-block-type");if(!h||!t.includes(h))return;const f=c.cloneNode(!0);c.style.display="none",Array.from(f.attributes).forEach(w=>{w.name!=="class"&&f.removeAttribute(w.name)}),h==="Text"&&(f.style.display="inline-block"),c.parentNode.insertBefore(f,c.nextSibling);const g=new Ue.Quill(f,{placeholder:"Type here..."});function x(){const w=g.getText(0,g.getLength());e([c.getAttribute("data-block-id")],{content:w}),c.removeAttribute("style"),f.removeEventListener("blur",x,!0),bt(g),r(""),a("")}f.addEventListener("blur",x,!0),g.focus(),(b=f.querySelector(".ql-clipboard"))==null||b.remove(),n([]),r(c.getAttribute("data-block-id"))}},kt=()=>{const[,t]=o.useSelectedStylingBlocks(),[,e]=o.useSelectedBlockIds(),[n]=W.useAtom(o.inlineEditingActiveAtom);return a=>{if(n)return;a.stopPropagation();const d=ue(a.target);if(d.getAttribute("data-block-parent")){const r=d.getAttribute("data-style-prop"),l=d.getAttribute("data-style-id"),c=d.getAttribute("data-block-parent");t([{id:l,prop:r,blockId:c}]),e([c])}else d.getAttribute("data-block-id")&&e([d.getAttribute("data-block-id")])}},Rt=p.throttle((t,e)=>{const n=ue(t.target);n.getAttribute("data-style-id")&&e(n.getAttribute("data-style-id"))},100),wt=()=>{const[,t]=o.useHighlightBlockId(),[e]=W.useAtom(o.inlineEditingActiveAtom);return n=>{e||Rt(n,t)}},St=({children:t})=>{const{document:e}=Q(),[n]=o.useSelectedBlockIds(),[a,d]=o.useSelectedStylingBlocks();m.useEffect(()=>{setTimeout(()=>{if(!p.isEmpty(a))return;const f=Oe(e,p.first(n));if(f){const g=f.getAttribute("data-style-prop");if(g){const x=f.getAttribute("data-style-id"),b=f.getAttribute("data-block-parent");d([{id:x,prop:g,blockId:b}])}}},100)},[e,n,d,a]);const r=Et(),l=kt(),c=wt(),h=jt();return s.jsxRuntimeExports.jsx("div",{id:"canvas",onClick:l,onDoubleClick:r,onMouseMove:c,...p.omit(h,"isDragging"),className:"relative h-screen max-w-full "+(h.isDragging?"dragging":""),children:t})},Oe=(t,e)=>t.querySelector(`[data-block-id="${e}"]`),Ct=()=>{const{window:t}=Q(),[e,n]=o.useSelectedBlockIds(),[,a]=o.useSelectedStylingBlocks(),{undo:d,redo:r}=o.useCanvasHistory(),l=o.useDuplicateBlocks(),[,c]=o.useCutBlockIds(),[,h]=o.useCopyBlockIds(),{pasteBlocks:f}=o.usePasteBlocks(),[,g]=o.usePreviewMode(),x=o.useRemoveBlocks(),{savePage:b}=o.useSavePage(),[w]=W.useAtom(o.inlineEditingActiveAtom),[,M]=W.useAtom(o.editLayerNameAtom),S=D=>{D.key==="Enter"&&(D.preventDefault(),e.length===1&&M(p.first(e)))};return m.useEffect(()=>{const D=v=>{if(v.key==="Escape"){n([]),a([]);return}if(S(v),!w&&(v.key==="Delete"||v.key==="Backspace")&&(v.preventDefault(),x(e)),v.ctrlKey||v.metaKey){if(["z","y","d","x","c","p","s","v"].includes(v.key)){if(w&&["x","z","v"].includes(v.key))return!0;v.preventDefault()}v.key==="s"&&(v.stopPropagation(),v.preventDefault(),b()),v.key==="z"&&d(),v.key==="y"&&r(),v.key==="d"&&l(e),v.key==="x"&&c(e),v.key==="c"&&h(e),v.key==="v"&&e.length>0&&f(e[0])}};return t.removeEventListener("keydown",D),t.addEventListener("keydown",D),()=>{t.removeEventListener("keydown",D)}},[e,n,d,x,g,r,l,c,h,f,w,b,t]),null},Tt=({block:t,label:e})=>{const[,n]=Ve.useDrag(()=>({type:"CANVAS_BLOCK",item:t}));return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",ref:n,onDragStart:()=>{console.log("drag start")},children:[s.jsxRuntimeExports.jsx(P.DragHandleDots2Icon,{}),e]})},Bt=({selectedBlockElement:t,block:e})=>{const n=o.useRemoveBlocks(),a=o.useDuplicateBlocks(),[,d]=o.useSelectedBlockIds(),[,r]=o.useSelectedStylingBlocks(),{floatingStyles:l,refs:c,update:h}=xe.useFloating({placement:"top-start",middleware:[xe.shift(),Ke.flip()],elements:{reference:t}});Xe.useResizeObserver(t,()=>h(),t!==null);const f=p.get(e,"_parent",null),g=p.isEmpty(p.get(e,"_name",""))?p.get(e,"_type",""):p.get(e,"_name","");return!t||!e?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:c.setFloating,style:l,onClick:x=>{x.stopPropagation(),x.preventDefault()},onKeyDown:x=>x.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(Tt,{label:g,block:e}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[f&&s.jsxRuntimeExports.jsx(P.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{r([]),d([f])}}),o.canDuplicateBlock(p.get(e,"_type",""))?s.jsxRuntimeExports.jsx(P.CopyIcon,{className:"hover:scale-105 ",onClick:()=>a([e==null?void 0:e._id])}):null,o.canDeleteBlock(p.get(e,"_type",""))?s.jsxRuntimeExports.jsx(P.TrashIcon,{className:"hover:scale-105 ",onClick:()=>n([e==null?void 0:e._id])}):null]})]})},It=({model:t})=>{const[e]=o.useBrandingOptions(),[n]=o.useSelectedBlockIds(),[a]=o.useDarkMode(),[d]=o.useHighlightBlockId(),[r]=o.useSelectedStylingBlocks(),{document:l,window:c}=Q(),[h]=m.useState(l==null?void 0:l.getElementById("highlighted-block")),[f]=m.useState(l==null?void 0:l.getElementById("selected-block")),[g]=m.useState(l==null?void 0:l.getElementById("selected-styling-block"));m.useEffect(()=>{a?l==null||l.documentElement.classList.add("dark"):l==null||l.documentElement.classList.remove("dark")},[a,l]);const x=p.get(e,"headingFont","DM Sans"),b=p.get(e,"bodyFont","DM Sans");return m.useEffect(()=>{const w=p.get(e,"primaryColor","#000"),M=p.get(e,"secondaryColor","#FFF"),S=Je.tailwindcssPaletteGenerator({colors:[w,M],names:["primary","secondary"]});S.primary.DEFAULT=w,S.secondary.DEFAULT=M;const D=p.get(e,"roundedCorners","0");!c||!c.tailwind||(c.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[x],body:[b]},extend:{borderRadius:{global:`${D||"0"}px`},colors:S}},plugins:[c.tailwind.plugin.withOptions(({prefix:v="ui"}={})=>({addVariant:z})=>{for(const _ of["open","checked","selected","active","disabled"])z(`${v}-${_}`,[`&[data-headlessui-state~="${_}"]`,`:where([data-headlessui-state~="${_}"]) &`]),z(`${v}-not-${_}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${_}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${_}"])) &:not([data-headlessui-state])`])})]})},[e,c,x,b]),m.useEffect(()=>{f&&(f.textContent=`${p.map(n,w=>`[data-block-id="${w}"]`).join(",")}{
|
|
55
|
+
outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
56
|
+
}`)},[n,f]),m.useEffect(()=>{h&&(h.textContent=d?`[data-style-id="${d}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[d,n,h]),m.useEffect(()=>{g&&(g.textContent=`${p.map(r,({id:w})=>`[data-style-id="${w}"]`).join(",")}{
|
|
57
|
+
outline: 1px solid orange !important; outline-offset: -1px;
|
|
58
|
+
}`)},[r,g]),m.useEffect(()=>{if(t==="section")return;const w=p.get(e,"bodyTextLightColor","#64748b"),M=p.get(e,"bodyTextDarkColor","#94a3b8"),S=p.get(e,"bodyBgLightColor","#FFFFFF"),D=p.get(e,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${w}] bg-[${S}] dark:text-[${M}] dark:bg-[${D}]`},[e,l,t]),t==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[x&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${x.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),b&&x!==b&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${b.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),x&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${x}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},Dt=t=>{const e={};return Object.keys(t).forEach(n=>{p.isString(t[n])&&t[n].startsWith(X.SLOT_KEY)&&(e[n]=t[n].replace(X.SLOT_KEY,"").split(","))}),e},At=p.memoize(t=>{const e=t.replace(X.STYLES_KEY,"").split(",");return Ge.twMerge(e[0],e[1])});function Ot(t,e){return p.get(t,`${e}_attrs`,{})}function qt(t){const e={};return Object.keys(t).forEach(n=>{if(p.isString(t[n])&&t[n].startsWith(X.STYLES_KEY)){const a=At(t[n]);e[n]={className:a,"data-style-prop":n,"data-block-parent":t._id,"data-style-id":`${n}-${t._id}`,...Ot(t,n)}}}),e}function Pt(t,e){const n=p.get(t,"_bindings",{});return p.isEmpty(n)?{...t}:(p.each(n,(a,d)=>{p.isString(a)&&p.get(e,a,null)&&(t[d]=p.get(e,a,null))}),t)}function ce({blocks:t}){const e=o.useAllBlocks(),n=m.useCallback(r=>qt(r),[]),[a]=J.useChaiExternalData(),[d]=o.useAtom(o.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(t.map((r,l)=>{if(d===r._id)return null;const c=Dt(r),h={};p.isEmpty(c)||Object.keys(c).forEach(b=>{h[b]=m.Children.toArray(c[b].map(w=>s.jsxRuntimeExports.jsx(ce,{blocks:[p.find(e,{_id:w})]})))});const f=p.filter(e,{_parent:r._id});h.children=f.length?s.jsxRuntimeExports.jsx(ce,{blocks:f}):null;const g=Qe.getBlockComponent(r._type),x=p.get(g,"component",null);return p.isNull(x)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${r==null?void 0:r._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(x,{blockProps:{"data-block-id":r._id,"data-block-type":r._type,"data-dnd":o.canAddChildBlock(r._type)?"branch":"leaf"},inBuilder:!0,index:l,...Pt(r,a),...n(r),...h})})}))})}const Mt=()=>{const t=o.useAllBlocks();return s.jsxRuntimeExports.jsx(Ze.Provider,{children:p.isEmpty(t)?null:s.jsxRuntimeExports.jsx(J.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(ce,{blocks:p.filter(t,e=>p.isEmpty(e._parent))})})})},Lt=(t,e)=>t.querySelector(`[data-style-id="${e}"]`),_t=()=>{const[t]=W.useAtom(o.networkModeAtom),[e]=o.usePreviewMode(),[n]=o.useCanvasWidth(),[,a]=o.useSelectedBlockIds(),d=o.useSelectedBlock(),[,r]=o.useHighlightBlockId(),l=m.useRef(null),c=m.useRef(null),[h,f]=m.useState({width:0,height:0}),g=at(h),[x,b]=m.useState(0),[w,M]=m.useState([]),[,S]=m.useState([]),[,D]=W.useAtom(o.canvasIframeAtom),[v,z]=o.useSelectedStylingBlocks(),_=o.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:A,clientHeight:N}=c.current;f({width:A,height:N}),x===0&&b(A)},[c,n,x]);const ee=(A,N=0)=>{const{top:F}=A.getBoundingClientRect();return F+N>=0&&F-N<=window.innerHeight};m.useEffect(()=>{var A,N;if(d&&d.type!=="Multiple"&&l.current){const F=Oe(l.current.contentDocument,d._id);F&&(ee(F)||(N=(A=l.current)==null?void 0:A.contentWindow)==null||N.scrollTo({top:F.offsetTop,behavior:"smooth"}),M([F]))}},[d]),m.useEffect(()=>{if(!p.isEmpty(v)&&l.current){const A=Lt(l.current.contentDocument,p.first(v).id);S(A?[A]:[null])}else S([null])},[v]);const te=m.useMemo(()=>{let A=it;return t==="offline"&&(A=A.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),A=A.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),A=A.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),A},[t]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),z([])},onMouseLeave:()=>setTimeout(()=>r(""),300),className:"relative mx-auto h-full w-full",style:x>0&&!p.isEmpty(g)?{width:e?"100%":x}:{},ref:c,children:s.jsxRuntimeExports.jsxs(gt,{contentDidMount:()=>D(l.current),ref:l,id:"canvas-iframe",style:{width:`${n}px`,...g},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:te,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(Bt,{block:d,selectedBlockElement:p.first(w)}),s.jsxRuntimeExports.jsx(It,{model:"page"}),s.jsxRuntimeExports.jsx(St,{children:_?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),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-P3qHuE5J.cjs"))),Ft=()=>{const[t,e]=W.useAtom(o.addBlocksModalAtom);return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(ot,{}),s.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:[s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(J.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(_t,{})})}),t?s.jsxRuntimeExports.jsx("div",{onClick:()=>e(!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;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-NV737rRe.js";
|
|
2
|
-
import { ag as x, au as h, av as f, aw as j, ax as y, ay as v } from "./index-
|
|
2
|
+
import { ag as x, au as h, av as f, aw as j, ax as y, ay as v } from "./index-ORFlyrBx.js";
|
|
3
3
|
import { sortBy as P, 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-
|
|
6
|
+
import { b as k, a as B, d as E, e as I } from "./index-aDqFUJ8v.js";
|
|
7
7
|
import { BriefcaseIcon as L } from "lucide-react";
|
|
8
8
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
9
9
|
import "@radix-ui/react-toggle";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-zkc4SQCu.cjs"),i=require("lodash"),h=require("sonner"),l=require("react"),o=require("./index-Ua5E0Syv.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;
|
|
@@ -0,0 +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"),q=require("react-dnd"),f=require("@minoru/react-dnd-treeview"),M=require("react-i18next"),r=require("./index-zkc4SQCu.cjs"),N=require("lucide-react");require("./lib.cjs");const g=require("react"),O=require("./MODIFIERS-WFzDQfiT.cjs"),B=require("./utils-It2K33fU.cjs"),A=require("./index-Ua5E0Syv.cjs"),_=require("jotai"),P=require("./useAddBlockByDrop-DPV32UHP.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 y=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(N.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function H(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 L=s=>{let n="";return Object.keys(s).forEach(o=>{u.startsWith(s[o],O.STYLES_KEY)&&(n=s[o])}),n},F=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=f.useDragOver(c,s.isOpen,s.onToggle),p=g.useMemo(()=>{const a=L(s.node.data);return H(a)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:B.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(y,{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]})]})})},V=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(y,{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})]})},z=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}})},G=g.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-p_wvHkQZ.cjs"))),$=()=>{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"]})},K=()=>{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"]})},Q=()=>{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"]})},U=({id:s=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),d=r.useBuilderProp("globalBlocksSupport",!1),m=g.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($,{}),e.jsxRuntimeExports.jsx(K,{}),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(Q,{})]})},Y=({children:s,id:n=null})=>{const[o,i]=g.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(g.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(G,{closeModal:()=>i(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(U,{id:n,openMarkAsGlobalModal:()=>i(!0)})]})]})};function W(s){return u.map(s,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const J=()=>{const s=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,i,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:d}=M.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=A.useExpandedIds(),p=P.useAddBlockByDrop(),[,j]=_.useAtom(r.addBlocksModalAtom),a=async(x,R)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:D}=R,T=W(x);n(T),h?m():(await p({block:D.getItem(),dropTargetId:k,relativeIndex:b}),j(!1))},C=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})),v=()=>{i([]),l([])},[{isOver:I},S]=q.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:w}=q.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>v(),className:B.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",w?"bg-green-50/80":"bg-background"),children:u.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:S,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(f.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:C,rootId:0,render:(x,{depth:R,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(Y,{id:x.id,children:e.jsxRuntimeExports.jsx(F,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:R,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx(V,{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:R})=>e.jsxRuntimeExports.jsx(z,{node:x,depth:R})})})})})};exports.default=J;
|