@chaibuilder/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +41 -0
  2. package/dist/AddBlocks-04c49399.js +258 -0
  3. package/dist/AddBlocks-c27c81fa.cjs +3 -0
  4. package/dist/BrandingOptions-055cf22a.js +157 -0
  5. package/dist/BrandingOptions-c25f6370.cjs +1 -0
  6. package/dist/CONTROLS-031e1de3.cjs +1 -0
  7. package/dist/CONTROLS-442caee5.js +6 -0
  8. package/dist/CanvasArea-97dfbb52.cjs +60 -0
  9. package/dist/CanvasArea-a7901131.js +1455 -0
  10. package/dist/Class-0801d193.cjs +1 -0
  11. package/dist/Class-e6b07b79.js +1138 -0
  12. package/dist/ImagesPanel-160aa664.cjs +1 -0
  13. package/dist/ImagesPanel-815d5e6f.js +27 -0
  14. package/dist/Layers-3aa6aae7.cjs +1 -0
  15. package/dist/Layers-6f1c162e.js +370 -0
  16. package/dist/MarkAsGlobalBlock-209ddfd5.js +73 -0
  17. package/dist/MarkAsGlobalBlock-536770e7.cjs +1 -0
  18. package/dist/Settings-2b1ff1a3.cjs +1 -0
  19. package/dist/Settings-b1afcefe.js +1845 -0
  20. package/dist/SidePanels-f48777bb.js +144 -0
  21. package/dist/SidePanels-f79dbace.cjs +1 -0
  22. package/dist/Topbar-64729901.js +105 -0
  23. package/dist/Topbar-bff765dc.cjs +1 -0
  24. package/dist/UnsplashImages-04fffeed.cjs +1 -0
  25. package/dist/UnsplashImages-315ce7a8.js +160 -0
  26. package/dist/UploadImages-43c16a2d.cjs +1 -0
  27. package/dist/UploadImages-f317eef0.js +107 -0
  28. package/dist/_commonjsHelpers-5a53b418.cjs +1 -0
  29. package/dist/_commonjsHelpers-d4512b9c.js +6 -0
  30. package/dist/accordion-0afd8143.cjs +1 -0
  31. package/dist/accordion-c0176dc5.js +42 -0
  32. package/dist/context-menu-e1c240ce.js +122 -0
  33. package/dist/context-menu-fec580f2.cjs +1 -0
  34. package/dist/core.cjs +1 -0
  35. package/dist/core.d.ts +353 -0
  36. package/dist/core.js +83 -0
  37. package/dist/dialog-170eaad9.cjs +1 -0
  38. package/dist/dialog-3d4e82ed.js +65 -0
  39. package/dist/dropdown-menu-a9b096f9.cjs +1 -0
  40. package/dist/dropdown-menu-d912a52e.js +223 -0
  41. package/dist/html-to-json-d8ac554d.cjs +1 -0
  42. package/dist/html-to-json-fecbbe16.js +178 -0
  43. package/dist/index-aea5c557.cjs +2 -0
  44. package/dist/index-cdd49c4c.js +2651 -0
  45. package/dist/jsx-runtime-5c3ac4f7.cjs +27 -0
  46. package/dist/jsx-runtime-944c88e2.js +631 -0
  47. package/dist/label-167415e5.cjs +1 -0
  48. package/dist/label-e770a087.js +10 -0
  49. package/dist/lib.cjs +1 -0
  50. package/dist/lib.d.ts +29 -0
  51. package/dist/lib.js +223 -0
  52. package/dist/link-43d13383.cjs +1 -0
  53. package/dist/link-8594fd8f.js +211 -0
  54. package/dist/popover-7cb9079b.cjs +1 -0
  55. package/dist/popover-f7addcf4.js +23 -0
  56. package/dist/render.cjs +2 -0
  57. package/dist/render.d.ts +49 -0
  58. package/dist/render.js +1171 -0
  59. package/dist/scroll-area-088530b9.cjs +1 -0
  60. package/dist/scroll-area-9f64a082.js +30 -0
  61. package/dist/select-0e32300c.cjs +1 -0
  62. package/dist/select-7fddd7c3.js +75 -0
  63. package/dist/separator-a597dba7.cjs +1 -0
  64. package/dist/separator-a80d065b.js +18 -0
  65. package/dist/style.css +6 -0
  66. package/dist/tabs-85caa1e8.js +46 -0
  67. package/dist/tabs-860e37aa.cjs +1 -0
  68. package/dist/textarea-0750bcd2.js +73 -0
  69. package/dist/textarea-a338ede6.cjs +1 -0
  70. package/dist/toggle-00c9d11e.js +30 -0
  71. package/dist/toggle-b90fed97.cjs +1 -0
  72. package/dist/ui.cjs +1 -0
  73. package/dist/ui.d.ts +471 -0
  74. package/dist/ui.js +442 -0
  75. package/dist/useBuilderProp-5e57d0c8.cjs +1 -0
  76. package/dist/useBuilderProp-81a14920.js +238 -0
  77. package/dist/utils-3c452dd0.cjs +1 -0
  78. package/dist/utils-ac68b2c8.js +6 -0
  79. package/dist/vite.svg +1 -0
  80. package/package.json +156 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("react"),s=require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");const x=l.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-04fffeed.cjs"))),i=l.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-43c16a2d.cjs"))),o=({isModalView:a=!1,onSelect:t=()=>{}})=>{const[r,n]=l.useState("unsplash");return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:a?"Select or upload images":"Images"})}),e.jsxRuntimeExports.jsxs(s.Tabs,{value:r,onValueChange:u=>n(u),className:"flex h-full w-full flex-col py-2",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"w-full",children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"unsplash",className:"w-1/2",children:"Unsplash"}),e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"upload",className:"w-1/2",children:"Upload"})]}),r==="unsplash"?e.jsxRuntimeExports.jsx(s.TabsContent,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:e.jsxRuntimeExports.jsx(x,{isModalView:a,onSelect:t})})}):e.jsxRuntimeExports.jsx(s.TabsContent,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:e.jsxRuntimeExports.jsx(i,{isModalView:a,onSelect:t})})})]})]})},c=o;exports.default=c;
@@ -0,0 +1,27 @@
1
+ import { j as s } from "./jsx-runtime-944c88e2.js";
2
+ import o, { useState as u, Suspense as n } from "react";
3
+ import { T as i, a as d, b as c, c as r } from "./tabs-85caa1e8.js";
4
+ import "@radix-ui/react-tabs";
5
+ import "./utils-ac68b2c8.js";
6
+ import "clsx";
7
+ import "tailwind-merge";
8
+ const f = o.lazy(() => import("./UnsplashImages-315ce7a8.js")), p = o.lazy(() => import("./UploadImages-f317eef0.js")), x = ({
9
+ isModalView: l = !1,
10
+ onSelect: a = () => {
11
+ }
12
+ }) => {
13
+ const [e, m] = u("unsplash");
14
+ return /* @__PURE__ */ s.jsxs("div", { className: "flex h-full flex-col", children: [
15
+ /* @__PURE__ */ s.jsx("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: /* @__PURE__ */ s.jsx("h1", { className: "px-1 font-semibold", children: l ? "Select or upload images" : "Images" }) }),
16
+ /* @__PURE__ */ s.jsxs(i, { value: e, onValueChange: (t) => m(t), className: "flex h-full w-full flex-col py-2", children: [
17
+ /* @__PURE__ */ s.jsxs(d, { className: "w-full", children: [
18
+ /* @__PURE__ */ s.jsx(c, { value: "unsplash", className: "w-1/2", children: "Unsplash" }),
19
+ /* @__PURE__ */ s.jsx(c, { value: "upload", className: "w-1/2", children: "Upload" })
20
+ ] }),
21
+ e === "unsplash" ? /* @__PURE__ */ s.jsx(r, { value: "unsplash", className: "flex h-full flex-col overflow-hidden", children: /* @__PURE__ */ s.jsx(n, { fallback: /* @__PURE__ */ s.jsx("div", { className: "h-64 w-full animate-pulse bg-gray-100" }), children: /* @__PURE__ */ s.jsx(f, { isModalView: l, onSelect: a }) }) }) : /* @__PURE__ */ s.jsx(r, { value: "upload", className: "flex h-full flex-col overflow-hidden", children: /* @__PURE__ */ s.jsx(n, { fallback: /* @__PURE__ */ s.jsx("div", { className: "h-64 w-full animate-pulse bg-gray-100" }), children: /* @__PURE__ */ s.jsx(p, { isModalView: l, onSelect: a }) }) })
22
+ ] })
23
+ ] });
24
+ }, T = x;
25
+ export {
26
+ T as default
27
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),_=require("react-i18next"),x=require("./index-aea5c557.cjs"),v=require("./utils-3c452dd0.cjs"),m=require("react"),P=require("./CONTROLS-031e1de3.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),S=require("./useBuilderProp-5e57d0c8.cjs"),H=require("./scroll-area-088530b9.cjs"),L=require("jotai");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("chaibuilder-blocks");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");const w=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"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function V(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 i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const F=s=>{let n="";return Object.keys(s).forEach(r=>{a.startsWith(s[r],P.STYLES_KEY)&&(n=s[r])}),n},z=s=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=s,{id:i,data:l}=s.node,d=s.depth*10,j=p=>{p.stopPropagation(),s.onToggle(s.node.id)},h=y.useDragOver(i,s.isOpen,s.onToggle),g=m.useMemo(()=>{const p=F(s.node.data);return V(p)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&s.onSelect(i)},onContextMenu:()=>s.onSelect(i),style:{paddingInlineStart:d},...h,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:j,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(w,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=s.node.data)==null?void 0:R._name)||s.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},G=s=>{var r;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(w,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},$=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}})},K=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-536770e7.cjs"))),Q=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},U=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Y=()=>{const[s]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},W=({id:s=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=S.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.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(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Y,{})]})},J=({children:s,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(K,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(W,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},X=()=>{const{addCoreBlock:s}=x.useAddBlock(),n=S.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return s({blocks:d},i===0?null:i,l)}return s(c,i===0?null:i,l)},[s])};function Z(s){return a.map(s,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const ee=()=>{const s=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=_.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),h=x.useExpandedIds(),g=X(),[,R]=L.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:f,dropTargetId:D,monitor:O}=E,A=Z(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:D,destinationIndex:k,relativeIndex:f}),R(!1))},T=a.map(s,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(s,{_parent:o._id})),data:o})),q=()=>{c([]),l([])},[{isOver:I},M]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:N}=B.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:()=>q(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",N?"bg-green-50/80":"bg-background"),children:[e.jsxRuntimeExports.jsx("div",{className:"mx-1 h-10 rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Tree view"})}),a.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 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(H.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:h,extraAcceptTypes:["CHAI_BLOCK"],tree:T,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(J,{id:o.id,children:e.jsxRuntimeExports.jsx(z,{onSelect:f=>{l([]),c([f])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx(G,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx($,{node:o,depth:E})})})]})})};exports.default=ee;
@@ -0,0 +1,370 @@
1
+ import { j as e } from "./jsx-runtime-944c88e2.js";
2
+ import { nth as k, startsWith as P, has as H, map as v, isUndefined as L, find as V, isEmpty as F, includes as z } from "lodash";
3
+ import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHorizontalIcon as Q, BorderAllIcon as q, BorderTopIcon as U, TableIcon as Y, DropdownMenuIcon as W, RadiobuttonIcon as J, InputIcon as X, ButtonIcon as B, CheckboxIcon as Z, GroupIcon as ee, SpaceBetweenVerticallyIcon as se, ColumnsIcon as te, RowsIcon as y, TextIcon as C, SketchLogoIcon as ne, DividerHorizontalIcon as oe, CodeIcon as re, CursorTextIcon as ce, VideoIcon as ae, Link1Icon as le, HeadingIcon as ie, ImageIcon as de, TriangleRightIcon as xe, GlobeIcon as ue, CopyIcon as me, ClipboardCopyIcon as pe, ScissorsIcon as ge, ClipboardIcon as je, TrashIcon as he, DoubleArrowDownIcon as fe, StackIcon as Ie } from "@radix-ui/react-icons";
4
+ import { useDrop as be, useDragLayer as ke } from "react-dnd";
5
+ import { useDragOver as Be, Tree as ye } from "@minoru/react-dnd-treeview";
6
+ import { useTranslation as Ce } from "react-i18next";
7
+ import { x as ve, N as we, h as g, l as Se, o as Te, m as Ne, n as De, q as Me, A as Oe, O as Re, y as Ee, g as Ae, i as _e, c as Pe, P as He, b as Le, Q as Ve } from "./index-cdd49c4c.js";
8
+ import { c as w } from "./utils-ac68b2c8.js";
9
+ import { useMemo as Fe, lazy as ze, useState as Ge, Suspense as $e, useCallback as S } from "react";
10
+ import { S as Ke } from "./CONTROLS-442caee5.js";
11
+ import { D as Qe, a as qe } from "./dialog-3d4e82ed.js";
12
+ import { C as Ue, a as Ye, b as We, c as d } from "./context-menu-e1c240ce.js";
13
+ import { u as T } from "./useBuilderProp-81a14920.js";
14
+ import { S as Je } from "./scroll-area-9f64a082.js";
15
+ import { useAtom as Xe } from "jotai";
16
+ import "i18next";
17
+ import "flagged";
18
+ import "react-hotkeys-hook";
19
+ import "flat-to-nested";
20
+ import "./Class-e6b07b79.js";
21
+ import "redux-undo";
22
+ import "@react-hookz/web";
23
+ import "chaibuilder-blocks";
24
+ import "clsx";
25
+ import "tailwind-merge";
26
+ import "@radix-ui/react-dialog";
27
+ import "@radix-ui/react-context-menu";
28
+ import "@radix-ui/react-slot";
29
+ import "class-variance-authority";
30
+ import "@radix-ui/react-tooltip";
31
+ import "@radix-ui/react-toast";
32
+ import "@radix-ui/react-scroll-area";
33
+ const N = (s) => {
34
+ switch (s.type) {
35
+ case "Image":
36
+ return /* @__PURE__ */ e.jsx(de, {});
37
+ case "Heading":
38
+ return /* @__PURE__ */ e.jsx(ie, {});
39
+ case "Text":
40
+ return /* @__PURE__ */ e.jsx(C, {});
41
+ case "Link":
42
+ return /* @__PURE__ */ e.jsx(le, {});
43
+ case "Video":
44
+ return /* @__PURE__ */ e.jsx(ae, {});
45
+ case "RichText":
46
+ return /* @__PURE__ */ e.jsx(ce, {});
47
+ case "Button":
48
+ return /* @__PURE__ */ e.jsx(B, {});
49
+ case "CustomHTML":
50
+ return /* @__PURE__ */ e.jsx(re, {});
51
+ case "Divider":
52
+ return /* @__PURE__ */ e.jsx(oe, {});
53
+ case "Icon":
54
+ return /* @__PURE__ */ e.jsx(ne, {});
55
+ case "List":
56
+ return /* @__PURE__ */ e.jsx(y, {});
57
+ case "Paragraph":
58
+ return /* @__PURE__ */ e.jsx(C, {});
59
+ case "Row":
60
+ return /* @__PURE__ */ e.jsx(y, {});
61
+ case "ListItem":
62
+ return /* @__PURE__ */ e.jsx(te, {});
63
+ case "LineBreak":
64
+ return /* @__PURE__ */ e.jsx(se, {});
65
+ case "Form":
66
+ return /* @__PURE__ */ e.jsx(ee, {});
67
+ case "Checkbox":
68
+ return /* @__PURE__ */ e.jsx(Z, {});
69
+ case "FormButton":
70
+ return /* @__PURE__ */ e.jsx(B, {});
71
+ case "Input":
72
+ case "TextArea":
73
+ return /* @__PURE__ */ e.jsx(X, {});
74
+ case "Radio":
75
+ return /* @__PURE__ */ e.jsx(J, {});
76
+ case "Select":
77
+ return /* @__PURE__ */ e.jsx(W, {});
78
+ case "Table":
79
+ return /* @__PURE__ */ e.jsx(Y, {});
80
+ case "TableHead":
81
+ return /* @__PURE__ */ e.jsx(U, {});
82
+ case "TableBody":
83
+ return /* @__PURE__ */ e.jsx(q, {});
84
+ case "TableRow":
85
+ return /* @__PURE__ */ e.jsx(Q, {});
86
+ case "TableCell":
87
+ return /* @__PURE__ */ e.jsx(K, {});
88
+ case "Box":
89
+ return /* @__PURE__ */ e.jsx($, {});
90
+ default:
91
+ return /* @__PURE__ */ e.jsx(G, {});
92
+ }
93
+ };
94
+ function Ze(s = "") {
95
+ const t = {
96
+ xs: "390px",
97
+ sm: "640px",
98
+ md: "768px",
99
+ lg: "1024px",
100
+ xl: "1366px",
101
+ "2xl": "1536px"
102
+ };
103
+ if (new RegExp(/\bsr-only\b/).test(s))
104
+ return "Sr Only";
105
+ if (new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))
106
+ return "Visible on mobile";
107
+ if (s.match(/(^| )hidden( |$)/g)) {
108
+ const c = new RegExp(
109
+ // checks if any of the display property is set for any higher media query
110
+ /\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/
111
+ ), a = s.match(c);
112
+ if (k(a, 1))
113
+ return `Visible >=${t[k(a, 1)]}`;
114
+ }
115
+ return "";
116
+ }
117
+ const es = (s) => {
118
+ let t = "";
119
+ return Object.keys(s).forEach((n) => {
120
+ P(s[n], Ke) && (t = s[n]);
121
+ }), t;
122
+ }, ss = (s) => {
123
+ var m;
124
+ const [, t] = ve(), [n] = we(), { isSelected: r } = s, { id: c, data: a } = s.node, l = s.depth * 10, x = (i) => {
125
+ i.stopPropagation(), s.onToggle(s.node.id);
126
+ }, j = Be(c, s.isOpen, s.onToggle), u = Fe(() => {
127
+ const i = es(s.node.data);
128
+ return Ze(i);
129
+ }, [s.node.data]);
130
+ return (
131
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
132
+ /* @__PURE__ */ e.jsx(
133
+ "div",
134
+ {
135
+ onMouseEnter: () => t(c),
136
+ className: w(
137
+ "group flex w-full items-center justify-between space-x-px py-px ",
138
+ r ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800"
139
+ ),
140
+ onClick: (i) => {
141
+ i.stopPropagation(), !n.includes(c) && s.onSelect(c);
142
+ },
143
+ onContextMenu: () => s.onSelect(c),
144
+ style: { paddingInlineStart: l },
145
+ ...j,
146
+ children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
147
+ /* @__PURE__ */ e.jsx(
148
+ "div",
149
+ {
150
+ 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" : ""}`,
151
+ children: s.node.droppable && /* @__PURE__ */ e.jsx("button", { onClick: x, type: "button", children: /* @__PURE__ */ e.jsx(xe, {}) })
152
+ }
153
+ ),
154
+ /* @__PURE__ */ e.jsxs("button", { type: "button", className: "flex items-center", children: [
155
+ /* @__PURE__ */ e.jsx("div", { className: "-mt-1 h-3 w-3", children: /* @__PURE__ */ e.jsx(N, { type: a == null ? void 0 : a._type }) }),
156
+ /* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: ((m = s.node.data) == null ? void 0 : m._name) || s.node.text }),
157
+ u ? /* @__PURE__ */ e.jsxs(
158
+ "span",
159
+ {
160
+ className: "ml-2 flex items-center text-[10px] italic " + (r ? "text-gray-200" : "text-gray-500"),
161
+ children: [
162
+ "(",
163
+ u,
164
+ ")"
165
+ ]
166
+ }
167
+ ) : null
168
+ ] })
169
+ ] })
170
+ }
171
+ )
172
+ );
173
+ }, ts = (s) => {
174
+ var n;
175
+ const { item: t } = s.monitorProps;
176
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700", children: [
177
+ /* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx(N, { type: (n = t == null ? void 0 : t.data) == null ? void 0 : n._type }) }),
178
+ /* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: t.text })
179
+ ] });
180
+ }, ns = (s) => {
181
+ const t = s.depth * 10 + 16;
182
+ return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: t } });
183
+ }, os = ze(() => import("./MarkAsGlobalBlock-209ddfd5.js")), rs = () => {
184
+ const [s] = g(), [, t] = Ne();
185
+ return /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: () => t(s), children: [
186
+ /* @__PURE__ */ e.jsx(ge, {}),
187
+ " Cut"
188
+ ] });
189
+ }, cs = () => {
190
+ const [s] = g(), [, t] = De();
191
+ return /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: () => t(s), children: [
192
+ /* @__PURE__ */ e.jsx(je, {}),
193
+ " Copy"
194
+ ] });
195
+ }, as = () => {
196
+ const [s] = g(), t = Me(), n = Oe();
197
+ return /* @__PURE__ */ e.jsxs(
198
+ d,
199
+ {
200
+ disabled: (n == null ? void 0 : n._type) === "Slot",
201
+ className: "flex items-center gap-x-4 text-xs",
202
+ onClick: () => t(s),
203
+ children: [
204
+ /* @__PURE__ */ e.jsx(he, {}),
205
+ " Remove"
206
+ ]
207
+ }
208
+ );
209
+ }, ls = ({
210
+ id: s = null,
211
+ openMarkAsGlobalModal: t
212
+ }) => {
213
+ const [n] = g(), r = Se(), { pasteBlocks: c, canPaste: a } = Te(), l = T("globalBlocksSupport", !1), x = S(() => {
214
+ r(n);
215
+ }, [n, r]);
216
+ return /* @__PURE__ */ e.jsxs(We, { className: "text-xs", children: [
217
+ l && /* @__PURE__ */ e.jsx(d, { className: "flex items-center gap-x-4 border-b text-xs", onClick: t, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-4", children: [
218
+ /* @__PURE__ */ e.jsx(ue, {}),
219
+ " Mark as global"
220
+ ] }) }),
221
+ /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: x, children: [
222
+ /* @__PURE__ */ e.jsx(me, {}),
223
+ " Duplicate"
224
+ ] }),
225
+ /* @__PURE__ */ e.jsx(rs, {}),
226
+ /* @__PURE__ */ e.jsx(cs, {}),
227
+ /* @__PURE__ */ e.jsxs(
228
+ d,
229
+ {
230
+ className: "flex items-center gap-x-4 text-xs",
231
+ onClick: () => c(s),
232
+ disabled: !a,
233
+ children: [
234
+ /* @__PURE__ */ e.jsx(pe, {}),
235
+ " Paste"
236
+ ]
237
+ }
238
+ ),
239
+ /* @__PURE__ */ e.jsx(as, {})
240
+ ] });
241
+ }, is = ({ children: s, id: t = null }) => {
242
+ const [n, r] = Ge(!1);
243
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
244
+ /* @__PURE__ */ e.jsx(Qe, { open: n, onOpenChange: r, children: n && /* @__PURE__ */ e.jsx(qe, { children: /* @__PURE__ */ e.jsx($e, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-96 w-full animate-pulse bg-gray-200" }), children: /* @__PURE__ */ e.jsx(os, { closeModal: () => r(!1), id: t }) }) }) }),
245
+ /* @__PURE__ */ e.jsxs(Ue, { children: [
246
+ /* @__PURE__ */ e.jsx(Ye, { children: s }),
247
+ /* @__PURE__ */ e.jsx(ls, { id: t, openMarkAsGlobalModal: () => r(!0) })
248
+ ] })
249
+ ] });
250
+ }, ds = () => {
251
+ const { addCoreBlock: s } = Re(), t = T("getExternalPredefinedBlock");
252
+ return S(
253
+ async (n) => {
254
+ const { block: r, dropTargetId: c, relativeIndex: a } = n;
255
+ if (H(r, "format")) {
256
+ const l = await t(r);
257
+ return s({ blocks: l }, c === 0 ? null : c, a);
258
+ }
259
+ return s(r, c === 0 ? null : c, a);
260
+ },
261
+ [s]
262
+ );
263
+ };
264
+ function xs(s) {
265
+ return v(s, (t) => {
266
+ const { data: n } = t;
267
+ return {
268
+ ...n,
269
+ _parent: t.parent === 0 ? null : t.parent
270
+ };
271
+ });
272
+ }
273
+ const $s = () => {
274
+ const s = Ee(), [t] = Ae(), [n, r, c] = g(), [, a] = _e(), { t: l } = Ce(), { createSnapshot: x } = Pe(), j = He(), u = ds(), [, m] = Xe(Le), i = async (o, p) => {
275
+ const { dragSource: f, destinationIndex: I, relativeIndex: b, dropTargetId: E, monitor: A } = p, _ = xs(o);
276
+ t(_), f ? x() : (await u({
277
+ block: A.getItem(),
278
+ dropTargetId: E,
279
+ destinationIndex: I,
280
+ relativeIndex: b
281
+ }), m(!1));
282
+ }, D = v(s, (o) => ({
283
+ id: o._id,
284
+ text: o._type,
285
+ parent: o._parent || 0,
286
+ droppable: !L(V(s, { _parent: o._id })),
287
+ data: o
288
+ })), M = () => {
289
+ r([]), a([]);
290
+ }, [{ isOver: h }, O] = be(() => ({
291
+ accept: ["CHAI_BLOCK"],
292
+ collect: (o) => ({
293
+ canDrop: o.canDrop(),
294
+ isOver: o.isOver()
295
+ }),
296
+ drop: (o) => {
297
+ (async () => (await u({
298
+ block: o,
299
+ dropTargetId: "",
300
+ destinationIndex: 0,
301
+ relativeIndex: 0
302
+ }), m(!1)))();
303
+ }
304
+ })), { isDragging: R } = ke((o) => ({
305
+ isDragging: o.isDragging()
306
+ }));
307
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
308
+ "div",
309
+ {
310
+ onClick: () => M(),
311
+ className: w(
312
+ "-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",
313
+ R ? "bg-green-50/80" : "bg-background"
314
+ ),
315
+ children: [
316
+ /* @__PURE__ */ e.jsx("div", { className: "mx-1 h-10 rounded-md bg-background/30 p-1", children: /* @__PURE__ */ e.jsx("h1", { className: "px-1 font-semibold", children: "Tree view" }) }),
317
+ F(s) ? /* @__PURE__ */ e.jsxs(
318
+ "div",
319
+ {
320
+ ref: O,
321
+ className: `mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h ? "bg-blue-200" : ""}`,
322
+ children: [
323
+ h ? /* @__PURE__ */ e.jsx(fe, { className: "mx-auto h-12 w-12 animate-bounce" }) : /* @__PURE__ */ e.jsx(Ie, { className: "mx-auto h-10 w-10" }),
324
+ /* @__PURE__ */ e.jsx("p", { className: "mt-2", children: l(h ? "drop_here_message" : "tree_view_no_blocks") })
325
+ ]
326
+ }
327
+ ) : /* @__PURE__ */ e.jsx(Je, { id: "layers-view", className: "no-scrollbar h-full overflow-y-auto p-1", children: /* @__PURE__ */ e.jsx(
328
+ ye,
329
+ {
330
+ initialOpen: j,
331
+ extraAcceptTypes: ["CHAI_BLOCK"],
332
+ tree: D,
333
+ rootId: 0,
334
+ render: (o, { depth: p, isOpen: f, onToggle: I }) => /* @__PURE__ */ e.jsx(is, { id: o.id, children: /* @__PURE__ */ e.jsx(
335
+ ss,
336
+ {
337
+ onSelect: (b) => {
338
+ a([]), r([b]);
339
+ },
340
+ isSelected: z(n, o.id),
341
+ node: o,
342
+ depth: p,
343
+ isOpen: f,
344
+ onToggle: I,
345
+ toggleIds: c
346
+ }
347
+ ) }),
348
+ dragPreviewRender: (o) => /* @__PURE__ */ e.jsx(ts, { monitorProps: o }),
349
+ onDrop: i,
350
+ classes: {
351
+ root: "h-full pt-2",
352
+ draggingSource: "opacity-30",
353
+ dropTarget: "bg-green-100",
354
+ placeholder: "relative"
355
+ },
356
+ sort: !1,
357
+ insertDroppableFirst: !1,
358
+ canDrop: Ve,
359
+ dropTargetOffset: 2,
360
+ enableAnimateExpand: !0,
361
+ placeholderRender: (o, { depth: p }) => /* @__PURE__ */ e.jsx(ns, { node: o, depth: p })
362
+ }
363
+ ) })
364
+ ]
365
+ }
366
+ ) });
367
+ };
368
+ export {
369
+ $s as default
370
+ };
@@ -0,0 +1,73 @@
1
+ import { j as l } from "./jsx-runtime-944c88e2.js";
2
+ import { GlobeIcon as m } from "@radix-ui/react-icons";
3
+ import { useState as n } from "react";
4
+ import { B as i } from "./useBuilderProp-81a14920.js";
5
+ import { U as c } from "./index-cdd49c4c.js";
6
+ import "react-i18next";
7
+ import { capitalize as p } from "lodash";
8
+ import "@radix-ui/react-slot";
9
+ import "class-variance-authority";
10
+ import "./utils-ac68b2c8.js";
11
+ import "clsx";
12
+ import "tailwind-merge";
13
+ import "@radix-ui/react-tooltip";
14
+ import "@radix-ui/react-toast";
15
+ import "jotai";
16
+ import "i18next";
17
+ import "flagged";
18
+ import "react-dnd";
19
+ import "@minoru/react-dnd-treeview";
20
+ import "react-hotkeys-hook";
21
+ import "flat-to-nested";
22
+ import "./Class-e6b07b79.js";
23
+ import "redux-undo";
24
+ import "@react-hookz/web";
25
+ import "chaibuilder-blocks";
26
+ import "./CONTROLS-442caee5.js";
27
+ const q = ({ id: a = null, closeModal: t }) => {
28
+ const s = c(), [e, o] = n("");
29
+ return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
30
+ /* @__PURE__ */ l.jsx("h1", { className: "text-lg font-bold", children: "Mark as Global" }),
31
+ /* @__PURE__ */ l.jsxs("div", { className: "py-2 text-sm", children: [
32
+ "Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",
33
+ /* @__PURE__ */ l.jsx("br", {}),
34
+ /* @__PURE__ */ l.jsxs("ul", { className: "mt-4 list-inside list-disc space-y-1", children: [
35
+ /* @__PURE__ */ l.jsxs("li", { children: [
36
+ "Global blocks are indicated with ",
37
+ /* @__PURE__ */ l.jsx(m, { className: "inline" }),
38
+ " icon in left sidebar"
39
+ ] }),
40
+ /* @__PURE__ */ l.jsx("li", { children: 'Global blocks are available under "Global" category' })
41
+ ] })
42
+ ] }),
43
+ /* @__PURE__ */ l.jsxs("div", { className: "my-4", children: [
44
+ /* @__PURE__ */ l.jsx("label", { className: "block text-sm font-medium text-gray-400", children: "Enter global block name" }),
45
+ /* @__PURE__ */ l.jsx(
46
+ "input",
47
+ {
48
+ placeholder: "Eg: Header, Footer ",
49
+ className: "mt-2 w-full",
50
+ value: e,
51
+ onChange: (r) => o(r.target.value)
52
+ }
53
+ )
54
+ ] }),
55
+ /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-end gap-x-4", children: [
56
+ /* @__PURE__ */ l.jsx(
57
+ i,
58
+ {
59
+ onClick: () => {
60
+ s(a, p(e)), t();
61
+ },
62
+ disabled: e.length <= 2,
63
+ variant: "default",
64
+ children: "Mark as Global"
65
+ }
66
+ ),
67
+ /* @__PURE__ */ l.jsx(i, { variant: "outline", onClick: t, children: "Cancel" })
68
+ ] })
69
+ ] });
70
+ };
71
+ export {
72
+ q as default
73
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),u=require("react"),t=require("./useBuilderProp-5e57d0c8.cjs"),c=require("./index-aea5c557.cjs");require("react-i18next");const x=require("lodash");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("chaibuilder-blocks");require("./CONTROLS-031e1de3.cjs");const m=({id:i=null,closeModal:s})=>{const l=c.useMarkAsGlobalBlock(),[r,a]=u.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(o.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:n=>a(n.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(t.Button,{onClick:()=>{l(i,x.capitalize(r)),s()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(t.Button,{variant:"outline",onClick:s,children:"Cancel"})]})]})};exports.default=m;