@chaibuilder/sdk 1.2.53 → 1.2.55

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 (65) hide show
  1. package/dist/{AddBlocks-kJNH96eQ.js → AddBlocks-HeYXoex4.js} +2 -2
  2. package/dist/{AddBlocks-7OJEZC2D.cjs → AddBlocks-VHoZezjj.cjs} +1 -1
  3. package/dist/{CanvasArea-nWHWl6zD.cjs → CanvasArea-137WY3Wx.cjs} +2 -2
  4. package/dist/{CanvasArea-ZxrQurg_.js → CanvasArea-CqILE5PR.js} +3 -3
  5. package/dist/{ChaiBuilderEditor-Rqlg194T.cjs → ChaiBuilderEditor-aY8flOgX.cjs} +1 -1
  6. package/dist/{ChaiBuilderEditor-4xhn_QlL.js → ChaiBuilderEditor-tkzS851D.js} +2 -2
  7. package/dist/{CodeEditor-C6p5CZfl.cjs → CodeEditor-R2jKe97T.cjs} +1 -1
  8. package/dist/{CodeEditor-vTWgHJei.js → CodeEditor-kxV5RCpd.js} +1 -1
  9. package/dist/{CurrentPage-KPr8MnO0.js → CurrentPage-IrFGAb7n.js} +3 -3
  10. package/dist/{CurrentPage-bfY5xyr7.cjs → CurrentPage-PjrVzHXR.cjs} +1 -1
  11. package/dist/{ListTree-5s7iNbKT.js → ListTree-0n_G8NJx.js} +1 -1
  12. package/dist/{ListTree-4J0SUudU.cjs → ListTree-C6oCXZDV.cjs} +1 -1
  13. package/dist/{PagesPanel-aZBPSLS7.js → PagesPanel-RYBf0Yct.js} +4 -4
  14. package/dist/{PagesPanel-re4w2009.cjs → PagesPanel-lIC3kYmS.cjs} +1 -1
  15. package/dist/{ProjectPanel-uo19SCtW.cjs → ProjectPanel-0Siyi5YS.cjs} +1 -1
  16. package/dist/{ProjectPanel-bWZtA_mw.js → ProjectPanel-Zagx6l3Q.js} +4 -4
  17. package/dist/Settings-6QRVcl16.cjs +1 -0
  18. package/dist/{Settings-SK2ONoi0.js → Settings-RLDTFFf8.js} +13 -13
  19. package/dist/{SidePanels-ezU-hGki.js → SidePanels-ao969pMV.js} +2 -2
  20. package/dist/{SidePanels-YAKKqxIi.cjs → SidePanels-j1EFsBlK.cjs} +1 -1
  21. package/dist/{ThemeConfiguration-q5rLYmXB.js → ThemeConfiguration-S7yArRMp.js} +1 -1
  22. package/dist/{ThemeConfiguration-qUXsJBBZ.cjs → ThemeConfiguration-q1471P7b.cjs} +1 -1
  23. package/dist/{Topbar-YhJ6xVs-.js → Topbar-B8u0whpc.js} +1 -1
  24. package/dist/{Topbar-9mJ6dJn-.cjs → Topbar-ogFKKDbx.cjs} +1 -1
  25. package/dist/{UILibrariesPanel-uNt8spPr.cjs → UILibrariesPanel-cm9CFWxc.cjs} +1 -1
  26. package/dist/{UILibrariesPanel-N7acP7aA.js → UILibrariesPanel-tcfz2ELp.js} +1 -1
  27. package/dist/{UnsplashImages-5IlwWgRv.cjs → UnsplashImages-E2L3YDJI.cjs} +1 -1
  28. package/dist/{UnsplashImages-iY__3dsJ.js → UnsplashImages-wWRifkCp.js} +1 -1
  29. package/dist/{UploadImages-KHk-jx9-.js → UploadImages-lUvZhW_j.js} +1 -1
  30. package/dist/{UploadImages-UjtFHUqM.cjs → UploadImages-s-eeaGiS.cjs} +1 -1
  31. package/dist/{add-page-modal-HmfsbbCH.js → add-page-modal-04b4l2zu.js} +4 -4
  32. package/dist/{add-page-modal-8GuYgZa-.cjs → add-page-modal-eroF20lO.cjs} +1 -1
  33. package/dist/{confirm-alert-AoUx_ZEf.js → confirm-alert-FX5030eR.js} +1 -1
  34. package/dist/{confirm-alert-qdryZAvd.cjs → confirm-alert-XuxEzG-V.cjs} +1 -1
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.js +1 -1
  37. package/dist/{delete-page-modal-KCPx8Ako.js → delete-page-modal-1u9CyAIP.js} +3 -3
  38. package/dist/{delete-page-modal-8qEY88SK.cjs → delete-page-modal-pgh7sdfg.cjs} +1 -1
  39. package/dist/email.cjs +1 -1
  40. package/dist/email.js +1 -1
  41. package/dist/{form-LHHE25z8.js → form-HRdEJjVq.js} +1 -1
  42. package/dist/{form-zHGQEmOp.cjs → form-Z4IRWj0o.cjs} +1 -1
  43. package/dist/{html-to-json-ofq1N3tB.js → html-to-json-OnIZDDXw.js} +63 -58
  44. package/dist/html-to-json-rauxDBi6.cjs +1 -0
  45. package/dist/{index-swYRuZtl.cjs → index-bt7EhwLh.cjs} +1 -1
  46. package/dist/{index-tGVTszX2.js → index-vfmO3y2d.js} +3 -3
  47. package/dist/lib.cjs +1 -1
  48. package/dist/lib.js +1 -1
  49. package/dist/{page-viewer-t9AFrRlP.cjs → page-viewer-O960kM2x.cjs} +1 -1
  50. package/dist/{page-viewer-P5yNaWy1.js → page-viewer-dcb3u4OV.js} +4 -4
  51. package/dist/{project-general-setting-Qm8odisi.js → project-general-setting--sS34seu.js} +4 -4
  52. package/dist/{project-general-setting-Ojhf6Nl6.cjs → project-general-setting-lIvNs-Vq.cjs} +1 -1
  53. package/dist/{project-seo-setting-j8EdSO40.js → project-seo-setting-8tc3I-0M.js} +2 -2
  54. package/dist/{project-seo-setting-4E1mqV3j.cjs → project-seo-setting-MIlAuqcc.cjs} +1 -1
  55. package/dist/{single-page-detail-bv-XFGOD.cjs → single-page-detail-0Z_hvd_j.cjs} +1 -1
  56. package/dist/{single-page-detail-mQfFVaou.js → single-page-detail-tP2pfgBp.js} +5 -5
  57. package/dist/studio.cjs +1 -1
  58. package/dist/studio.js +3 -3
  59. package/dist/ui.cjs +1 -1
  60. package/dist/ui.js +1 -1
  61. package/dist/{useCanvasSettings-4WtrDzCu.cjs → useCanvasSettings-R0h03UfD.cjs} +1 -1
  62. package/dist/{useCanvasSettings-Rvn5rRB8.js → useCanvasSettings-rEZHbw3s.js} +1 -1
  63. package/package.json +1 -1
  64. package/dist/Settings-AcK9rEs3.cjs +0 -1
  65. package/dist/html-to-json-9uiQ2Dp2.cjs +0 -1
@@ -1,10 +1,10 @@
1
1
  import { j as t } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import i, { Suspense as s } from "react";
3
3
  import { sortBy as a, filter as d, get as n } from "lodash-es";
4
- import { u as l, a as c } from "./index-tGVTszX2.js";
4
+ import { u as l, a as c } from "./index-vfmO3y2d.js";
5
5
  import "./_commonjsHelpers-UyOWmZb0.js";
6
6
  import "./core.js";
7
- import "./ChaiBuilderEditor-4xhn_QlL.js";
7
+ import "./ChaiBuilderEditor-tkzS851D.js";
8
8
  import "clsx";
9
9
  import "react-dom";
10
10
  import "@radix-ui/react-scroll-area";
@@ -46,9 +46,9 @@ import "react-hotkeys-hook";
46
46
  import "lucide-react";
47
47
  import "./index-VBXQixVm.js";
48
48
  import "sonner";
49
- import "./html-to-json-ofq1N3tB.js";
49
+ import "./html-to-json-OnIZDDXw.js";
50
50
  import "himalaya";
51
- const x = i.lazy(() => import("./add-page-modal-HmfsbbCH.js")), u = i.lazy(() => import("./page-viewer-P5yNaWy1.js")), lt = () => {
51
+ const x = i.lazy(() => import("./add-page-modal-04b4l2zu.js")), u = i.lazy(() => import("./page-viewer-dcb3u4OV.js")), lt = () => {
52
52
  const { data: o = [], isLoading: m } = l(), { data: r } = c(), p = a(d(o, { type: "STATIC" }), (e) => n(e, "uuid") === (r == null ? void 0 : r.homepage) ? 0 : 1);
53
53
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
54
54
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),i=require("lodash-es"),s=require("./index-swYRuZtl.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./core.cjs");require("./ChaiBuilderEditor-Rqlg194T.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.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-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");require("sonner");require("./html-to-json-9uiQ2Dp2.cjs");require("himalaya");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-8GuYgZa-.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-t9AFrRlP.cjs"))),d=()=>{const{data:t=[],isLoading:q}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(t,{type:"STATIC"}),o=>i.get(o,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(x,{isLoading:q,pages:n})})]})};exports.default=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),i=require("lodash-es"),s=require("./index-bt7EhwLh.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./core.cjs");require("./ChaiBuilderEditor-aY8flOgX.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.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-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");require("sonner");require("./html-to-json-rauxDBi6.cjs");require("himalaya");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-eroF20lO.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-O960kM2x.cjs"))),d=()=>{const{data:t=[],isLoading:q}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(t,{type:"STATIC"}),o=>i.get(o,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(x,{isLoading:q,pages:n})})]})};exports.default=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),x=require("lodash-es"),s=require("./ChaiBuilderEditor-Rqlg194T.cjs"),a=require("./index-swYRuZtl.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.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-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");require("./core.cjs");require("sonner");require("./html-to-json-9uiQ2Dp2.cjs");require("himalaya");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-Ojhf6Nl6.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-4E1mqV3j.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function q(){const t=a.useUpdateProject(),{data:n}=a.useProject(),[i,o]=r.useState(l(n||{})),u=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(n,u.current)||t.mutate(u.current,{onSuccess:()=>o(u.current)})},[u]),r.useEffect(()=>{u.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{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:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:o})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(m,{_projectData:i,seany:o})})})]})]})})]})}exports.default=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),x=require("lodash-es"),s=require("./ChaiBuilderEditor-aY8flOgX.cjs"),a=require("./index-bt7EhwLh.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.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-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");require("./core.cjs");require("sonner");require("./html-to-json-rauxDBi6.cjs");require("himalaya");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-lIvNs-Vq.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-MIlAuqcc.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function q(){const t=a.useUpdateProject(),{data:n}=a.useProject(),[i,o]=r.useState(l(n||{})),u=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(n,u.current)||t.mutate(u.current,{onSuccess:()=>o(u.current)})},[u]),r.useEffect(()=>{u.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{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:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:o})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(m,{_projectData:i,seany:o})})})]})]})})]})}exports.default=q;
@@ -1,8 +1,8 @@
1
1
  import { j as t } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import m, { useRef as x, useEffect as a, Suspense as p } from "react";
3
3
  import { isEqual as b, isEmpty as j } from "lodash-es";
4
- import { b6 as f, b7 as n, b8 as l, b9 as c } from "./ChaiBuilderEditor-4xhn_QlL.js";
5
- import { b as h, a as g } from "./index-tGVTszX2.js";
4
+ import { b6 as f, b7 as n, b8 as l, b9 as c } from "./ChaiBuilderEditor-tkzS851D.js";
5
+ import { b as h, a as g } from "./index-vfmO3y2d.js";
6
6
  import "./_commonjsHelpers-UyOWmZb0.js";
7
7
  import "clsx";
8
8
  import "react-dom";
@@ -46,9 +46,9 @@ import "lucide-react";
46
46
  import "./index-VBXQixVm.js";
47
47
  import "./core.js";
48
48
  import "sonner";
49
- import "./html-to-json-ofq1N3tB.js";
49
+ import "./html-to-json-OnIZDDXw.js";
50
50
  import "himalaya";
51
- const N = m.lazy(() => import("./project-general-setting-Qm8odisi.js")), S = m.lazy(() => import("./project-seo-setting-j8EdSO40.js")), d = /* @__PURE__ */ t.jsx("div", { className: "px-3", children: /* @__PURE__ */ t.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (e) => e && j(e.seoData) ? {
51
+ const N = m.lazy(() => import("./project-general-setting--sS34seu.js")), S = m.lazy(() => import("./project-seo-setting-8tc3I-0M.js")), d = /* @__PURE__ */ t.jsx("div", { className: "px-3", children: /* @__PURE__ */ t.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (e) => e && j(e.seoData) ? {
52
52
  ...e,
53
53
  seoData: { title: "", description: "", image: "" }
54
54
  } : e;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),c=require("react"),z=require("@react-hookz/web"),t=require("lodash-es"),H=require("react-i18next"),g=require("@radix-ui/react-icons"),o=require("./ChaiBuilderEditor-aY8flOgX.cjs"),P=require("lucide-react"),$=require("@chaibuilder/runtime"),W=require("./index-gi1LIOCw.cjs"),pe=require("@rjsf/core"),ue=require("@rjsf/validator-ajv8"),de=require("./useCanvasSettings-R0h03UfD.cjs"),ce=require("react-autosuggest"),xe=require("fuse.js"),M=require("./utils-D_vtk3zK.cjs"),me=require("./MODIFIERS-mVmfEGgo.cjs"),F=require("lodash");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("tree-model");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-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");function ge(r){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(a,s,l.get?l:{enumerable:!0,get:()=>r[s]})}}return a.default=r,Object.freeze(a)}const q=ge(c);function ye(r){const a=[],s={};function l(i,p){t.forEach(p,(d,m)=>{const n=i?`${i}.${m}`:m,x=t.isArray(d)?"list":typeof d;a.push(n),s[n]=x==="string"?"text":x==="object"?"model":x,x==="object"&&!t.isArray(d)&&l(n,d)})}return l("",t.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:a,pathsType:s}}const Y=({data:r,fullView:a})=>{if(!r)return null;const s=typeof r;return a?typeof r=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(o.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(W.JsonView,{data:r,shouldExpandNode:W.allExpanded,style:{...W.defaultStyles,container:"max-h-[40vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]}):e.jsxRuntimeExports.jsxs("div",{className:"max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),r]}):e.jsxRuntimeExports.jsx("div",{className:"w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50",children:t.truncate(s==="object"?JSON.stringify(r):r,{length:40})})},G=({type:r,value:a="",setValue:s,data:l,onChange:i,dataType:p,appliedBindings:d})=>{const{paths:m,pathsType:n}=ye(l),x=r==="PROP"?$.getBlockComponent(l==null?void 0:l._type):{},y=r==="PROP",[u,f]=c.useState(!1),b=c.useMemo(()=>r==="PROP"?m.filter(h=>!t.includes(d,h)&&t.get(x,`props.${t.first(t.split(h,"."))}.binding`)):m.filter(h=>p===t.get(n,h,"")),[r,m,d,p,x]);return c.useEffect(()=>{a&&i(a)},[a,r]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:t.startCase(t.toLower(r))}),e.jsxRuntimeExports.jsxs(o.Popover,{open:u,onOpenChange:f,children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(a)?"w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white":"min-w-[350px] items-center justify-between"}`,children:a?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[y&&e.jsxRuntimeExports.jsx("span",{className:"mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(p)}),a]}),e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(r))]})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{className:"z-[999] min-w-[300px] p-0",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(o.Command,{children:[e.jsxRuntimeExports.jsx(o.CommandInput,{placeholder:`Choose ${t.toLower(r)}...`}),e.jsxRuntimeExports.jsxs(o.CommandList,{children:[e.jsxRuntimeExports.jsx(o.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(o.CommandGroup,{children:t.map(b,h=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:h,className:`cursor-pointer ${y?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:R=>{s(t.find(b,C=>C===R)||null),f(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(P.Check,{className:`h-4 w-4 text-green-500 ${a===h?"":"opacity-0"}`}),h]}),y?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(t.get(n,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(Y,{data:t.get(l,h)})})]},h))})]})]})})]})]}),!y&&!t.isEmpty(a)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(Y,{data:t.get(l,a,""),fullView:!0})})]})},he=({appliedBindings:r=[],onAddBinding:a,editMode:s,item:l})=>{const[i,p]=c.useState(s?l.key:""),[d,m]=c.useState(s?l.value:""),n=o.useSelectedBlock(),[x]=o.useChaiExternalData(),y=c.useCallback((b,h)=>{if(t.isEmpty(b))return"";{const R=t.get(h==="PROP"?n:x,b,"");if(t.isArray(R))return"list";const C=typeof R;return C==="string"?"text":C==="object"?"model":C}},[n,x]),[u,f]=c.useState(s?y(l.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DialogHeader,{children:[e.jsxRuntimeExports.jsx(o.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx(o.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col gap-1",children:[e.jsxRuntimeExports.jsx(G,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:i,setValue:p,onChange:b=>{const h=y(b,"PROP");p(b),u!==h&&m(""),f(h)},data:n,dataType:u,appliedBindings:r}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(G,{type:"PATH",isDisabled:t.isEmpty(i),placeholder:"Enter data path",value:d,setValue:m,onChange:b=>{const h=y(b,"PATH");m(u===h?b:"")},data:x,dataType:u,appliedBindings:r})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(i)&&t.isEmpty(d),onClick:()=>a({key:i,value:d}),children:"Save"})})]})},se=({disabled:r,children:a,onAddBinding:s,appliedBindings:l,editMode:i=!0,item:p={}})=>{const[d,m]=c.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{disabled:r,asChild:!0,onClick:()=>m(!0),children:a}),d&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(he,{item:p,editMode:i,appliedBindings:l,onAddBinding:n=>{s(n),m(!1)}})})]})},be=({item:r,onAddBinding:a,onRemove:s,selectedBlock:l,dataProvider:i,appliedBindings:p})=>{const[d,m]=c.useState("string"),n=(x,y)=>{if(t.isEmpty(x))return"";{const u=t.get(y==="PROP"?l:i,x,"");if(t.isArray(u))return"list";const f=typeof u;return f==="string"?"text":f==="object"?"model":f}};return c.useEffect(()=>m(()=>n(r.key,"PROP")),[r.key]),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col rounded-md border border-gray-200 p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm font-normal text-gray-500",children:r.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:r.value}),e.jsxRuntimeExports.jsx(Y,{data:t.get(i,r.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(se,{editMode:!0,onAddBinding:a,appliedBindings:p,item:r,children:e.jsxRuntimeExports.jsx(P.EditIcon,{className:"mt-1 h-6 w-6 cursor-pointer rounded border border-blue-400 p-1 text-blue-400 duration-200 hover:scale-105 hover:bg-blue-400 hover:text-white"})}),e.jsxRuntimeExports.jsx(P.TrashIcon,{onClick:()=>s(),className:"mt-1 h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 duration-200 hover:scale-105 hover:bg-red-400 hover:text-white"})]}),!t.isEmpty(d)&&!t.isEmpty(r.key)&&e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-1 mt-px flex h-4 items-center rounded-full px-2 text-[10px] font-medium text-purple-600",children:t.startCase(d)})]})},fe=({bindingData:r,onChange:a})=>{const s=o.useSelectedBlock(),[l]=o.useChaiExternalData(),i=$.getChaiDataProviders(),[p,d]=c.useState(t.map(r,(u,f)=>({key:f,value:u})));c.useEffect(()=>{d(t.map(r,(u,f)=>({key:f,value:u})))},[s==null?void 0:s._id,r]);const m=c.useMemo(()=>{if(t.isEmpty(l))return!0;if(t.isEmpty(p))return!1;const u=t.last(p);return t.isEmpty(u==null?void 0:u.key)||t.isEmpty(u==null?void 0:u.value)},[l,p]),n=u=>{const f=t.filter(p,b=>b.key!==u.key);d([...f,u]),y([...f,u])},x=u=>{const f=t.filter(p,(b,h)=>u!==h);y([...f])},y=c.useCallback((u=[])=>{if(d(u),t.isEmpty(u)){a({});return}const f={};t.forEach(u,b=>{!t.isEmpty(b==null?void 0:b.key)&&!t.isEmpty(b==null?void 0:b.value)&&t.set(f,b.key,b.value)}),a(f)},[a]);return t.isEmpty(i)?e.jsxRuntimeExports.jsx("div",{className:"flex w-full items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 text-xs text-gray-500",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(p,(u,f)=>e.jsxRuntimeExports.jsx(be,{item:u,onAddBinding:n,onRemove:()=>x(f),selectedBlock:s,dataProvider:l,appliedBindings:t.map(p,"key")},u.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{disabled:t.isEmpty(l),className:"w-full",children:e.jsxRuntimeExports.jsx(se,{disabled:m,appliedBindings:t.map(p,"key"),onAddBinding:n,children:e.jsxRuntimeExports.jsx("span",{className:`w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${m?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(l)?e.jsxRuntimeExports.jsx("small",{className:"text-[9.5px] text-gray-500",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),m&&e.jsxRuntimeExports.jsx(o.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(l)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},je=()=>e.jsxRuntimeExports.jsx("div",{className:"text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100",children:"Data binding is set for this field"}),ve=({id:r,placeholder:a})=>{const{t:s}=H.useTranslation(),[,l]=o.useCodeEditor(),i=o.useSelectedBlock();if(typeof window>"u")return null;const p=r.replace("root.",""),d=t.get(i,p,""),m=()=>{const n=i==null?void 0:i._id;l({blockId:n,blockProp:p,placeholder:a,initialCode:t.get(i,p,d)})};return e.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex flex-col gap-y-1",children:[e.jsxRuntimeExports.jsx("button",{onClick:m,className:"text-pretty w-[90%] max-w-full cursor-default truncate rounded border bg-white p-2 text-left text-[10px]",children:d.trim().length>0?d.substring(0,46):a||"Eg: <script>console.log('Hello, world!');<\/script>"}),e.jsxRuntimeExports.jsx(o.Button,{onClick:m,size:"sm",variant:"outline",className:"w-fit",children:s("Open code editor")})]})},Z=c.memo(({id:r,properties:a,formData:s,onChange:l})=>{const[i,p]=c.useState(s),d={type:"object",properties:{}},m={};Object.keys(a).forEach(x=>{const y=a[x];if(t.includes(["slot","styles"],y.type))return;const u=x;d.properties[u]=o.getBlockJSONFromSchemas(y),m[u]=o.getBlockJSONFromUISchemas(y)}),c.useEffect(()=>{p(s)},[r]);const n=z.useThrottledCallback(async({formData:x},y)=>{l({formData:x},y)},[l],1e3);return e.jsxRuntimeExports.jsx(pe,{widgets:{binding:je,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField,code:ve},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:ue,uiSchema:m,schema:d,formData:i,onChange:({formData:x},y)=>{y&&(p(x),n({formData:x},y))}})}),Re=()=>{const[r,a]=de.useCanvasSettings(),s=o.useSelectedBlockCanvasSetting(),l=(d,m)=>{a(n=>({...n,[d]:m}))};if(t.isEmpty(s))return null;const{block:i,settings:p}=s;return e.jsxRuntimeExports.jsxs("div",{className:"text-xs hover:no-underline",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 px-4 py-2",children:[s.block._type," settings"]}),e.jsxRuntimeExports.jsx("div",{className:"bg-white pb-2",children:e.jsxRuntimeExports.jsx(Z,{id:i==null?void 0:i._id,onChange:({formData:d})=>l(i._id,d),formData:t.get(r,i._id,{}),properties:p})})]})};function Ee(){const r=o.useSelectedBlock(),a=o.useUpdateBlocksPropsRealtime(),s=o.useUpdateBlocksProps(),l=$.getBlockComponent(r._type),i={...r},[p,d]=c.useState(i),m=o.useBuilderProp("dataBindingSupport",!1),n=({formData:b},h,R)=>{if(h&&(p==null?void 0:p._id)===r._id){const C=h.replace("root.","");s([r._id],{[C]:t.get(b,C)},R)}},x=c.useCallback(t.debounce(({formData:b},h,R)=>{n({formData:b},h,R),d(b)},1500),[r==null?void 0:r._id]),y=({formData:b},h)=>{if(h){const R=h.replace("root.","");a([r._id],o.convertDotNotationToObject(R,t.get(b,R.split(".")))),x({formData:b},h,{[R]:t.get(p,R)})}},u=t.keys(t.get(i,"_bindings",{})),f=c.useMemo(()=>{const b=t.cloneDeep(t.get(l,"props",{}));return m&&t.each(u,h=>delete b[h]),b},[l,u,m]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(Re,{}),m?e.jsxRuntimeExports.jsxs(o.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"px-4 pt-4",children:e.jsxRuntimeExports.jsx(fe,{bindingData:t.get(r,"_bindings",{}),onChange:b=>{n({formData:{_bindings:b}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(o.AccordionContent,{className:"pt-4",children:[t.isEmpty(u)?null:e.jsxRuntimeExports.jsxs("div",{className:"mx-4 mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(u,t.capitalize).join(", ")})," ",u.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(Z,{id:r==null?void 0:r._id,onChange:y,formData:i,properties:f})]})]})]}):e.jsxRuntimeExports.jsx(Z,{id:r==null?void 0:r._id,onChange:y,formData:i,properties:f})]})}const we=({blockId:r})=>{const{t:a}=H.useTranslation(),{askAi:s,loading:l,error:i}=o.useAskAi(),[p,d]=c.useState(""),m=c.useRef(null);c.useEffect(()=>{var x;(x=m.current)==null||x.focus()},[]);const n=()=>{i||d("")};return e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsx("h2",{className:"mb-1 text-sm font-semibold leading-none tracking-tight",children:a("Ask AI")}),e.jsxRuntimeExports.jsx(o.Textarea,{ref:m,value:p,onChange:x=>d(x.target.value),placeholder:a("Ask AI to edit styles"),className:"w-full border border-gray-400 focus:border-0",rows:3,onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),s("styles",r,p,n))}}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 my-2",children:[l?null:e.jsxRuntimeExports.jsx(o.Button,{disabled:p.trim().length<5||l,onClick:()=>s("styles",r,p,n),variant:"default",className:"w-fit",size:"sm",children:l?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P.Loader,{className:"w-5 h-5 animate-spin"}),a("Generating... Please wait")]}):a("Edit with AI")}),l?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxRuntimeExports.jsxs(o.Skeleton,{className:"flex items-center w-full px-4 py-1 pl-2 space-x-1",children:[e.jsxRuntimeExports.jsx(o.FaSpinner,{className:"w-4 h-4 text-gray-500 animate-spin"}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:a("Generating... Please wait")})]}),e.jsxRuntimeExports.jsx(o.Button,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:a("Stop")})]}):null]}),e.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:i&&e.jsxRuntimeExports.jsx("p",{className:"p-1 text-xs text-red-500 break-words bg-red-100 border border-red-500 rounded",children:i.message})})]})},J=new xe(M.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function re(){var k;const{t:r}=H.useTranslation(),[a]=o.useSelectedStylingBlocks(),s=o.useSelectedBlock(),l=o.useAddClassesToBlocks(),i=o.useRemoveClassesFromBlocks(),[p]=o.useSelectedBlockIds(),d=o.useBuilderProp("askAiCallBack",null),[m,n]=c.useState(""),{toast:x}=o.useToast(),y=(k=t.first(a))==null?void 0:k.prop,u=t.reject((t.get(s,y,"").replace(me.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),f=()=>{const w=m.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");l(p,w,!0),n("")},[b,h]=c.useState([]),R=({value:w})=>{const T=w.trim().toLowerCase(),D=T.match(/.+:/g);let j=[];if(D&&D.length>0){const[v]=D,S=T.replace(v,"");j=J.search(S).map(A=>({...A,item:{...A.item,name:v+A.item.name}}))}else j=J.search(T);return h(t.map(j,"item"))},C=()=>{h([])},I=w=>w.name,_=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),V={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:r("Enter classes separated by space"),value:m,onKeyDown:w=>{w.key==="Enter"&&m.trim()!==""&&f()},onChange:(w,{newValue:T})=>n(T),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"},E=()=>{if(navigator.clipboard===void 0){x({title:"Clipboard not supported",description:"Please use Chrome, Firefox or Safari",variant:"destructive"});return}navigator.clipboard.writeText(u.join(" ")),x({title:"Copied",description:"Classes copied to clipboard"})};return e.jsxRuntimeExports.jsxs("div",{className:`flex ${b.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto border-b-2 bg-gray-100 pb-4`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("span",{children:r("Classes")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(g.CopyIcon,{onClick:E,className:"cursor-pointer"})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:r("Copy classes to clipboard")})})]})]}),d?e.jsxRuntimeExports.jsxs(o.Popover,{children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{children:e.jsxRuntimeExports.jsxs(o.Button,{variant:"default",className:"h-6 w-fit",size:"sm",children:[e.jsxRuntimeExports.jsx(P.SparklesIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2",children:r("Ask AI")})]})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"left",className:"p-2",children:e.jsxRuntimeExports.jsx(we,{blockId:s==null?void 0:s._id})})]}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex items-center gap-x-3",children:[e.jsxRuntimeExports.jsx("div",{className:"relative flex w-full items-center gap-x-3",children:e.jsxRuntimeExports.jsx(ce,{suggestions:b,onSuggestionsFetchRequested:R,onSuggestionsClearRequested:C,getSuggestionValue:I,renderSuggestion:_,inputProps:V,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"!bg-gray-300 ",suggestionsContainerOpen:"absolute bg-gray-100 z-50 max-h-[230px] overflow-y-auto w-full border border-gray-600 rounded-md"}})}),e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:f,disabled:m.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(g.PlusIcon,{})})]}),e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-wrap gap-2 overflow-x-hidden",children:q.Children.toArray(u.map(w=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-gray-300 bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300",children:[w,e.jsxRuntimeExports.jsx(g.Cross2Icon,{onClick:()=>i(p,[w]),className:"invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))})]})}const Ce=c.memo(function({preloadedAttributes:a=[],onAttributesChange:s}){const[l,i]=c.useState([]),[p,d]=c.useState(""),[m,n]=c.useState(""),[x,y]=c.useState(null),[u,f]=c.useState(""),b=c.useRef(null),h=c.useRef(null);c.useEffect(()=>{b.current&&b.current.focus()},[l]),c.useEffect(()=>{i(a)},[a]);const R=()=>{if(p.startsWith("@")){f("Attribute keys cannot start with '@'");return}if(p){const E=[...l,{key:p,value:m}];s(E),i(l),d(""),n(""),f("")}},C=E=>{const k=l.filter((w,T)=>T!==E);s(k),i(k)},I=E=>{y(E),d(l[E].key),n(l[E].value)},_=()=>{if(p.startsWith("@")){f("Attribute keys cannot start with '@'");return}if(x!==null&&p){const E=[...l];E[x]={key:p,value:m},s(E),i(E),y(null),d(""),n(""),f("")}},V=E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),x!==null?_():R())};return e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsxs("form",{onSubmit:E=>{E.preventDefault(),x!==null?_():R()},className:"space-y-3",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"attrKey",className:"text-xs",children:"Key"}),e.jsxRuntimeExports.jsx(o.Input,{id:"attrKey",ref:b,value:p,onChange:E=>d(E.target.value),placeholder:"Key",className:"h-8 text-sm"})]}),e.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"attrValue",className:"text-xs",children:"Value"}),e.jsxRuntimeExports.jsx(o.Textarea,{id:"attrValue",rows:2,ref:h,value:m,onChange:E=>n(E.target.value),onKeyDown:V,placeholder:"Value",className:"bg-background text-sm"})]})]}),e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"h-8 w-full text-sm",children:x!==null?"Save":"Add"}),u&&e.jsxRuntimeExports.jsx("p",{className:"text-xs text-red-500",children:u})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-4 space-y-1 overflow-y-auto",children:l.map((E,k)=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded bg-muted p-1.5 text-sm",children:[e.jsxRuntimeExports.jsxs("div",{className:"mr-2 flex flex-col",children:[e.jsxRuntimeExports.jsx("span",{className:"truncate font-semibold",children:E.key}),e.jsxRuntimeExports.jsx("span",{className:"text-wrap max-w-[200px] text-muted-foreground",children:E.value})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex-shrink-0",children:[e.jsxRuntimeExports.jsxs(o.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>I(k),children:[e.jsxRuntimeExports.jsx(P.Edit2,{className:"h-3 w-3"}),e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Edit attribute"})]}),e.jsxRuntimeExports.jsxs(o.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>C(k),children:[e.jsxRuntimeExports.jsx(P.X,{className:"h-3 w-3"}),e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Remove attribute"})]})]})]},k))})]})}),ke=q.memo(()=>{const r=o.useSelectedBlock(),[a,s]=c.useState([]),[l]=o.useSelectedStylingBlocks(),i=o.useUpdateBlocksPropsRealtime(),p=o.useUpdateBlocksProps(),d=`${t.get(l,"0.prop")}_attrs`;q.useEffect(()=>{const n=t.map(t.get(r,d),(x,y)=>({key:y,value:x}));t.isEmpty(n)?s([]):s(n)},[t.get(r,d)]);const m=q.useCallback((n=[])=>{const x={};t.forEach(n,y=>{t.isEmpty(y.key)||t.set(x,y.key,y.value)}),p([t.get(r,"_id")],{[d]:x})},[r,i,d]);return e.jsxRuntimeExports.jsx("div",{className:"mb-20 flex min-h-max flex-col gap-y-2 overflow-y-auto",children:e.jsxRuntimeExports.jsx("div",{className:"flex flex-col",children:e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(Ce,{preloadedAttributes:a,onAttributesChange:m})})})})}),N=["px","%","em","rem","ch","vh","vw"],Ne={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:N,property:"flexBasis"},{type:"range",label:"flex.order",property:"order"},{type:"dropdown",label:"flex.flex",property:"flexGrowShrink"},{type:"dropdown",label:"flex.grow",property:"flexGrow"},{type:"dropdown",label:"flex.shrink",property:"flexShrink"}]},Se={heading:"grid.heading",items:[{type:"range",label:"grid.col_span",property:"gridColSpan"},{type:"range",label:"grid.col_start",property:"gridColStart"},{type:"range",label:"grid.col_end",property:"gridColEnd"},{type:"range",label:"grid.row_span",property:"gridRowSpan"},{type:"range",label:"grid.row_start",property:"gridRowStart"},{type:"range",label:"grid.row_end",property:"gridRowEnd"},{type:"range",label:"grid.order",property:"order"}]},Te=[{heading:"Styles",items:[{component:re},{type:"arbitrary",label:"layout.width",units:N.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:N.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...N,"auto"],options:[{key:"margin",label:"layout.margin_all"},{key:"marginX",label:"layout.margin_lr"},{key:"marginY",label:"layout.margin_tb"},{key:"marginTop",label:"layout.margin_top"},{key:"marginRight",label:"layout.margin_right"},{key:"marginBottom",label:"layout.margin_bottom"},{key:"marginLeft",label:"layout.margin_left"}]},{styleType:"multiple",label:"layout.padding",options:[{key:"padding",label:"layout.padding_all"},{key:"paddingX",label:"layout.padding_lr"},{key:"paddingY",label:"layout.padding_tb"},{key:"paddingTop",label:"layout.padding_top"},{key:"paddingRight",label:"layout.padding_right"},{key:"paddingBottom",label:"layout.padding_bottom"},{key:"paddingLeft",label:"layout.padding_left"}]},{styleType:"accordion",heading:"Typography",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:N},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:N.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"}]},{styleType:"accordion",heading:"Background",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{type:"dropdown",label:"background.attachment",property:"backgroundAttachment"},{type:"dropdown",label:"background.clipping",property:"backgroundClip"},{type:"dropdown",label:"background.origin",property:"backgroundOrigin"},{type:"dropdown",label:"background.position",property:"backgroundPosition"},{type:"dropdown",label:"background.repeat",property:"backgroundRepeat"},{type:"dropdown",label:"background.size",property:"backgroundSize"}]}]},{heading:"Attributes",items:[{component:ke}]}],Ge=[{heading:"layout.heading",items:[{type:"arbitrary",label:"layout.width",units:N.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:N.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...N,"auto"],options:[{key:"margin",label:"layout.margin_all"},{key:"marginX",label:"layout.margin_lr"},{key:"marginY",label:"layout.margin_tb"},{key:"marginTop",label:"layout.margin_top"},{key:"marginRight",label:"layout.margin_right"},{key:"marginBottom",label:"layout.margin_bottom"},{key:"marginLeft",label:"layout.margin_left"}]},{styleType:"multiple",label:"layout.padding",options:[{key:"padding",label:"layout.padding_all"},{key:"paddingX",label:"layout.padding_lr"},{key:"paddingY",label:"layout.padding_tb"},{key:"paddingTop",label:"layout.padding_top"},{key:"paddingRight",label:"layout.padding_right"},{key:"paddingBottom",label:"layout.padding_bottom"},{key:"paddingLeft",label:"layout.padding_left"}]},{styleType:"multiple",label:"layout.space_bt",options:[{key:"spaceX",label:"layout.space_lr"},{key:"spaceY",label:"layout.space_tb"}]}]},{heading:"size.heading",items:[{styleType:"accordion",heading:"size.min_width_height",items:[{type:"arbitrary",label:"size.min_width",units:N.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"size.min_height",units:N.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"size.max_width_height",items:[{type:"arbitrary",label:"size.max_width",units:N.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"size.max_height",units:N.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"size.object_options_aspect_ratio",items:[{type:"dropdown",label:"size.aspect",property:"aspectRatio"},{type:"dropdown",label:"size.fit",property:"objectFit"},{type:"dropdown",label:"size.position",property:"objectPosition"}]}]},{heading:"display.heading",items:[{type:"dropdown",label:"display.display",property:"display",units:N},{styleType:"accordion",heading:"display.flex_options",items:[{type:"dropdown",label:"display.flex_direction",property:"flexDirection"},{type:"dropdown",label:"display.flex_wrap",property:"flexWrap"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"display.grid_options",items:[{type:"range",label:"display.grid_columns",property:"gridColumns"},{type:"range",label:"display.grid_rows",property:"gridRows"},{type:"dropdown",label:"display.grid_auto_flow",property:"gridAutoFlow"},{type:"dropdown",label:"display.grid_auto_cols",property:"gridAutoColumns"},{type:"dropdown",label:"display.grid_auto_rows",property:"gridAutoRows"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",units:["px","rem"],options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"display.visibility_opacity",items:[{type:"dropdown",label:"display.visibility",property:"visibility",units:N},{type:"arbitrary",label:"display.opacity",property:"opacity",units:["-"]}]}]},{heading:"position.heading",items:[{type:"icons",label:"position.position",property:"position"},{styleType:"accordion",heading:"position.options",items:[{styleType:"multiple",label:"position.direction",options:[{key:"top",label:"position.top"},{key:"right",label:"position.right"},{key:"bottom",label:"position.bottom"},{key:"left",label:"position.left"}]},{styleType:"multiple",label:"position.inset",options:[{key:"inset",label:"position.all"},{key:"insetX",label:"position.lr"},{key:"insetY",label:"position.tb"}]},{type:"arbitrary",label:"position.z_index",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"position.float_clear",items:[{type:"icons",label:"position.float",property:"float"},{type:"dropdown",label:"position.clear",property:"clear"}]},{styleType:"accordion",heading:"position.overflow_overscroll",items:[{styleType:"multiple",type:"dropdown",label:"position.overflow",options:[{key:"overflow",label:"position.all"},{key:"overflowX",label:"position.lr"},{key:"overflowY",label:"position.tb"}]},{styleType:"multiple",type:"dropdown",label:"position.overscroll",options:[{key:"overscroll",label:"position.all"},{key:"overscrollX",label:"position.lr"},{key:"overscrollY",label:"position.tb"}]}]}]},{heading:"typography.heading",items:[{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:N},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:N.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"},{styleType:"accordion",heading:"typography.alignments",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"verticalAlign",label:"typography.valign"}]},{styleType:"accordion",heading:"typography.spacing_decoration_more",items:[{type:"dropdown",property:"letterSpacing",label:"typography.spacing"},{type:"dropdown",property:"textDecoration",label:"typography.decoration"},{type:"range",property:"textDecorationThickness",label:"typography.thickness"},{type:"dropdown",property:"textTransform",label:"typography.transform"}]},{styleType:"accordion",heading:"typography.whitespace_breaks",items:[{type:"dropdown",property:"whitespace",label:"typography.whitespace"},{type:"dropdown",property:"wordbreak",label:"typography.wordbreak"}]}]},{heading:"background.heading",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{styleType:"accordion",heading:"background.position_size_more",items:[{type:"dropdown",label:"background.attachment",property:"backgroundAttachment"},{type:"dropdown",label:"background.clipping",property:"backgroundClip"},{type:"dropdown",label:"background.origin",property:"backgroundOrigin"},{type:"dropdown",label:"background.position",property:"backgroundPosition"},{type:"dropdown",label:"background.repeat",property:"backgroundRepeat"},{type:"dropdown",label:"background.size",property:"backgroundSize"}]},{type:"dropdown",label:"background.gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"background.gradient_colors",items:[{type:"color",label:"background.from_color",property:"fromColor"},{type:"color",label:"background.via_color",property:"viaColor"},{type:"color",label:"background.to_color",property:"toColor"}]}]},{heading:"border.heading",items:[{styleType:"multiple",type:"dropdown",label:"border.width",options:[{key:"border",label:"border.all"},{key:"borderX",label:"border.lr"},{key:"borderY",label:"border.tb"},{key:"borderTop",label:"border.top"},{key:"borderRight",label:"border.right"},{key:"borderBottom",label:"border.bottom"},{key:"borderLeft",label:"border.left"}]},{styleType:"multiple",type:"dropdown",label:"border.corners",options:[{key:"borderRadius",label:"border.all"},{key:"borderRadiusTop",label:"border.top"},{key:"borderRadiusRight",label:"border.right"},{key:"borderRadiusBottom",label:"border.bottom"},{key:"borderRadiusLeft",label:"border.left"},{key:"borderRadiusTopLeft",label:"border.top_left"},{key:"borderRadiusTopRight",label:"border.top_right"},{key:"borderRadiusBottomRight",label:"border.bottom_right"},{key:"borderRadiusBottomLeft",label:"border.bottom_left"}]},{type:"color",label:"border.color",property:"borderColor"},{type:"dropdown",label:"border.style",property:"borderStyle"},{styleType:"accordion",heading:"border.divide_options",items:[{styleType:"multiple",type:"range",label:"border.width",options:[{key:"divideXWidth",label:"border.lr"},{key:"divideYWidth",label:"border.tb"}]},{type:"color",label:"border.divide_color",property:"divideColor"},{type:"dropdown",label:"border.divide_style",property:"divideStyle"}]},{styleType:"accordion",heading:"border.outline_styling",items:[{type:"range",label:"border.outline_width",property:"outlineWidth"},{type:"range",label:"border.outline_offset",property:"outlineOffset"},{type:"dropdown",label:"border.outline_style",property:"outlineStyle"}]},{styleType:"accordion",heading:"border.ring_options",items:[{type:"range",label:"border.ring_width",property:"ringWidth"},{type:"color",label:"border.ring_color",property:"ringColor"},{type:"range",label:"border.ring_offset_width",property:"ringOffsetWidth"},{type:"color",label:"border.ring_offset_color",property:"ringOffsetColor"}]}]},{heading:"effect.heading",items:[{type:"range",label:"effect.shadow",property:"boxShadow"},{type:"color",label:"effect.color",property:"boxShadowColor"},{type:"dropdown",label:"effect.cursor",property:"cursor"},{styleType:"accordion",heading:"effect.blend_cursor",items:[{type:"dropdown",label:"effect.mix_blend",property:"mixBlendMode"},{type:"dropdown",label:"effect.bg_blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"effect.transform",items:[{type:"dropdown",label:"effect.origin",property:"transformOrigin"},{styleType:"multiple",label:"effect.scale",units:["-"],options:[{key:"scale",label:"effect.all"},{key:"scaleX",label:"effect.lr"},{key:"scaleY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.skew",units:["deg"],options:[{key:"skewX",label:"effect.lr"},{key:"skewY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.translate",negative:!0,options:[{key:"translateX",label:"effect.lr"},{key:"translateY",label:"effect.tb"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"effect.rotate",property:"rotate"}]},{styleType:"accordion",heading:"effect.animation",items:[{type:"dropdown",label:"effect.animation",property:"animation"},{type:"dropdown",label:"effect.transition",property:"transition"},{type:"dropdown",label:"effect.easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"effect.duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"effect.delay",property:"delay"}]}]},{heading:"classes.heading",items:[{component:re}]}],oe={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:g.EyeOpenIcon,invisible:g.EyeClosedIcon,hidden:g.EyeClosedIcon,gap:g.BorderAllIcon,gapX:g.WidthIcon,gapY:g.HeightIcon,spaceX:g.WidthIcon,spaceY:g.HeightIcon,overscroll:g.BorderAllIcon,overscrollX:g.WidthIcon,overscrollY:g.HeightIcon,overflow:g.BorderAllIcon,overflowX:g.WidthIcon,overflowY:g.HeightIcon,top:g.ArrowUpIcon,right:g.ArrowRightIcon,bottom:g.ArrowDownIcon,left:g.ArrowLeftIcon,inset:g.BorderAllIcon,insetX:g.WidthIcon,insetY:g.HeightIcon,border:g.BorderAllIcon,borderX:g.WidthIcon,borderY:g.HeightIcon,borderTop:g.ArrowUpIcon,borderRight:g.ArrowRightIcon,borderBottom:g.ArrowDownIcon,borderLeft:g.ArrowLeftIcon,borderRadius:g.BorderAllIcon,borderRadiusX:g.WidthIcon,borderRadiusY:g.HeightIcon,borderRadiusTop:g.ArrowUpIcon,borderRadiusRight:g.ArrowRightIcon,borderRadiusBottom:g.ArrowDownIcon,borderRadiusLeft:g.ArrowLeftIcon,borderRadiusTopLeft:g.ArrowTopLeftIcon,borderRadiusTopRight:g.ArrowTopRightIcon,borderRadiusBottomRight:g.ArrowBottomRightIcon,borderRadiusBottomLeft:g.ArrowBottomLeftIcon,divideXWidth:g.WidthIcon,divideYWidth:g.HeightIcon,scale:g.BorderAllIcon,scaleX:g.WidthIcon,scaleY:g.HeightIcon,skewX:g.WidthIcon,skewY:g.HeightIcon,translateX:g.WidthIcon,translateY:g.HeightIcon,padding:g.BorderAllIcon,paddingX:g.WidthIcon,paddingY:g.HeightIcon,paddingTop:g.ArrowUpIcon,paddingRight:g.ArrowRightIcon,paddingBottom:g.ArrowDownIcon,paddingLeft:g.ArrowLeftIcon,margin:g.BorderAllIcon,marginX:g.WidthIcon,marginY:g.HeightIcon,marginTop:g.ArrowUpIcon,marginRight:g.ArrowRightIcon,marginBottom:g.ArrowDownIcon,marginLeft:g.ArrowLeftIcon,textLeft:g.AlignLeftIcon,textCenter:g.AlignCenterHorizontallyIcon,textRight:g.AlignRightIcon,textJustify:g.StretchHorizontallyIcon,italic:g.FontItalicIcon,underline:g.UnderlineIcon,overline:g.OverlineIcon,uppercase:g.LetterCaseUppercaseIcon,block:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":g.Cross2Icon,fixed:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",fill:"currentColor"})]}),static:g.Cross1Icon},L=c.createContext({canReset:!1,canChange:!0}),_e=({children:r,canReset:a=!1,canChange:s=!0})=>e.jsxRuntimeExports.jsx(L.Provider,{value:{canReset:a,canChange:s},children:r}),ne=({label:r,property:a,onChange:s})=>{const l=c.useMemo(()=>t.get(M.CLASSES_LIST,`${a}.classes`,[""]),[a]),i=O(a),p=c.useMemo(()=>t.get(i,"cls",""),[i]),{canChange:d}=c.useContext(L),m=/\[.*\]/g.test(p);return e.jsxRuntimeExports.jsx("div",{className:r?"w-full rounded":"grow",children:m?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:p}),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(g.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(U,{rounded:r,onChange:n=>s(n,a),selected:p,options:l,disabled:!d})})};function U({selected:r,onChange:a,rounded:s=!1,options:l,disabled:i=!1}){const p=r.replace(/.*:/g,"").trim(),{undo:d,redo:m}=o.useUndoManager();return e.jsxRuntimeExports.jsxs("select",{disabled:!l.length||i,className:`${s?"rounded-md border border-border":"border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:n=>a(n.target.value),onKeyDown:n=>{n.ctrlKey&&(n.key==="z"&&d(),n.key==="y"&&m())},value:p,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),c.Children.toArray(l.map(n=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:n,children:n})))]})}const Ie=({property:r,onChange:a})=>{const{canReset:s,canChange:l}=c.useContext(L),i=O(r),p=c.useMemo(()=>t.get(i,"cls",""),[i]),d=c.useMemo(()=>t.get(M.CLASSES_LIST,`${r}.classes`,[""]),[r]),m=d.indexOf(p)>-1?d.indexOf(p):0,n=/\[.*\]/g.test(p);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:n?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:p}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!s||m-1<0),onClick:()=>a(t.nth(d,m-1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(g.MinusIcon,{className:!l&&(!s||m-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(ne,{label:!1,property:r,onChange:a})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!l&&(!s||m+1>=d.length),onClick:()=>a(t.nth(d,m+1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(g.PlusIcon,{className:!l&&(!s||m+1>=d.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Be=({property:r,onChange:a})=>{const s=c.useMemo(()=>t.get(M.CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:l}=c.useContext(L),i=O(r),p=c.useMemo(()=>t.get(i,"cls",""),[i]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(s,d=>e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!l,onClick:()=>a(d,r),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${p===d?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:c.createElement(t.get(oe,d,g.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(d))})]}))})},Ae={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},He=({property:r,onChange:a})=>{const s=O(r),l=c.useMemo(()=>t.get(s,"cls",""),[s]),{canChange:i}=c.useContext(L),[p,d]=c.useState([]),[m,n]=c.useState({color:"",shade:""}),x=l.split("-"),y=t.get(x,"1",""),u=t.get(x,"2",""),f=c.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(d([]),n({color:h})):(d(["50","100","200","300","400","500","600","700","800","900"]),n(R=>({...R,color:h,shade:R.shade?R.shade:"500"})))},[d,n]);c.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(y))return d([]);d(["50","100","200","300","400","500","600","700","800","900"])},[y]);const b=c.useCallback(h=>{n({color:y,shade:h})},[y]);return c.useEffect(()=>{n({color:"",shade:""})},[s]),c.useEffect(()=>{const R=`${t.get(Ae,r,"")}-${m.color}${m.shade?`-${m.shade}`:""}`;R.match(new RegExp(t.get(M.CLASSES_LIST,`${r}.regExp`,"")))&&a(R,r)},[m,a,r]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:e.jsxRuntimeExports.jsx(U,{disabled:!i,rounded:!0,selected:y,onChange:f,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(U,{rounded:!0,selected:u,disabled:!y||!i,onChange:b,options:p})})]})},Q=(r,a)=>{r=r.toLowerCase();let s=r.trim().replace(/ |\+/g,"");if((s==="auto"||s==="none")&&a.includes(s))return{value:"",unit:s};const l=a.length?new RegExp(a.join("|"),"g"):/XXXXXX/g;s=s.replace(l,"");const i=r.match(l),p=i&&i.length>1,d=!t.isEmpty(s)&&Number.isNaN(Number(s));return p||d?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:s,unit:i?i[0]:""}};const Ve=r=>{const a=r.startsWith("-")?"-":"",s=r.split("-").pop();if(["auto","none"].includes(s))return{value:"",unit:s};if(s==="px")return{value:"1",unit:"px"};if(s==="screen")return{value:"100",unit:r.indexOf("w-")!==-1?"vw":"vh"};if(s==="full")return{value:"100",unit:"%"};if(t.includes(r,"skew-"))return{value:`${a}${s}`,unit:"deg"};if(t.includes(r,"rotate-"))return{value:`${a}${s}`,unit:"deg"};if(t.includes(r,"opacity-"))return{value:`${s/100}`,unit:"-"};if(t.includes(r,"duration-")||t.includes(r,"delay-"))return{value:`${s}`,unit:"ms"};if(t.includes(r,"translate-")&&!s.includes("/"))return{value:`${a}${`${s/4}`}`,unit:"rem"};if(t.includes(r,"scale-"))return{value:`${a}${`${s/100}`}`,unit:"-"};if(t.startsWith(r,"border")){const l=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(l)return{value:l[0].split("-").pop(),unit:"px"};if(r.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(r,"max-w-")){if(r==="max-w-screen-sm")return{value:"640",unit:"px"};if(r==="max-w-screen-md")return{value:"768",unit:"px"};if(r==="max-w-screen-lg")return{value:"1024",unit:"px"};if(r==="max-w-screen-xl")return{value:"1280",unit:"px"};if(r==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(s==="xs")return{value:"320",unit:"px"};if(s==="sm")return{value:"384",unit:"px"};if(s==="md")return{value:"448",unit:"px"};if(s==="lg")return{value:"512",unit:"px"};if(s==="xl")return{value:"576",unit:"px"};if(s==="2xl")return{value:"672",unit:"px"};if(s==="3xl")return{value:"768",unit:"px"};if(s==="4xl")return{value:"896",unit:"px"};if(s==="5xl")return{value:"1024",unit:"px"};if(s==="6xl")return{value:"1152",unit:"px"};if(s==="7xl")return{value:"1280",unit:"px"};if(s==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(r,"text-")){if(s==="xs")return{value:"12",unit:"px"};if(s==="sm")return{value:"14",unit:"px"};if(s==="base")return{value:"16",unit:"px"};if(s==="lg")return{value:"18",unit:"px"};if(s==="xl")return{value:"20",unit:"px"};if(s==="2xl")return{value:"24",unit:"px"};if(s==="3xl")return{value:"30",unit:"px"};if(s==="4xl")return{value:"36",unit:"px"};if(s==="5xl")return{value:"48",unit:"px"};if(s==="6xl")return{value:"60",unit:"px"};if(s==="7xl")return{value:"72",unit:"px"};if(s==="8xl")return{value:"96",unit:"px"};if(s==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(r,"leading-")){if(s==="none")return{value:"1",unit:"-"};if(s==="tight")return{value:"1.25",unit:"-"};if(s==="snug")return{value:"1.375",unit:"-"};if(s==="normal")return{value:"1.5",unit:"-"};if(s==="relaxed")return{value:"1.625",unit:"-"};if(s==="loose")return{value:"2",unit:"-"}}if(t.startsWith(r,"tracking-")){if(s==="tighter")return{value:"-0.05",unit:"em"};if(s==="tight")return{value:"-0.025",unit:"em"};if(s==="normal")return{value:"0",unit:"em"};if(s==="wide")return{value:"0.025",unit:"em"};if(s==="wider")return{value:"0.05",unit:"em"};if(s==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(s))return{value:r,unit:"class"};if(s.includes("/")){const[l,i]=t.map(s.split("/"),p=>parseInt(p,10));return{value:a+(l/i*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(s))?{value:`${a+parseFloat(s)*4}`,unit:"px"}:{value:s,unit:"class"}};const De=r=>{if(t.isEmpty(r))return{value:"",unit:""};const a=r.match(/\[.*\]/g);if(a===null)return Pe(r);const s=t.get(a,"0","").replace(/\[|\]/g,""),l=r.startsWith("-")?"-":"",i=t.first(s.match(/\d+.\d+|\d+/g));return{value:`${l}${i}`,unit:s.replace(i,"")}},Pe=r=>t.isEmpty(r)?{value:"",unit:""}:Ve(r),ie=c.createContext({setDragData:()=>{}}),Me=({unit:r,currentValue:a,onDrag:s,onDragEnd:l,onDragStart:i,negative:p,cssProperty:d})=>{const{setDragData:m}=c.useContext(ie);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:n=>{const x={onDrag:s,onDragEnd:l,dragging:!0,dragStartY:n.pageY,dragStartValue:`${a}`,dragUnit:r,negative:p,cssProperty:d};i(x),m(x)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:e.jsxRuntimeExports.jsx(g.RowSpacingIcon,{})})},$e=({onSelect:r,current:a,units:s})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:s.map(l=>e.jsxRuntimeExports.jsx(o.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:a===l?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),r(l)},children:l},l))}),ee=50,Le=r=>{const[a,s]=c.useState(!1),[l,i]=c.useState(""),{currentClass:p,onChange:d,classPrefix:m,cssProperty:n,units:x,negative:y}=r,[u,f]=c.useState(n!=null&&n.toLowerCase().includes("width")?"%":x[0]),[b,h]=c.useState(!1),[R,C]=c.useState(""),[I,_]=c.useState(!1),[V,E]=c.useState(!1);c.useEffect(()=>{const{value:j,unit:v}=De(p);if(v===""){i(j),f(n!=null&&n.toLowerCase().includes("width")?"%":t.first(x));return}f(v),i(v==="class"||t.isEmpty(j)?"":j)},[p,n,x]);const k=z.useThrottledCallback(j=>d(j),[d],ee),w=z.useThrottledCallback(j=>d(j,!1),[d],ee),T=c.useCallback((j=!1)=>{const v=Q(`${l}`,x);if(t.get(v,"error",!1)){h(!0);return}const S=t.get(v,"unit")!==""?t.get(v,"unit"):u;if(S==="auto"||S==="none"){k(`${m}${S}`);return}if(t.get(v,"value")==="")return;const A=`${t.get(v,"value","").startsWith("-")?"-":""}${m}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;j?w(A):k(A)},[k,w,l,u,m,x]),D=c.useCallback(j=>{const v=Q(`${l}`,x);if(t.get(v,"error",!1)){h(!0);return}if(j==="auto"||j==="none"){k(`${m}${j}`);return}if(t.get(v,"value")==="")return;const S=t.get(v,"unit")!==""?t.get(v,"unit"):j,A=`${t.get(v,"value","").startsWith("-")?"-":""}${m}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;k(A)},[k,l,m,x]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:u==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:p}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(g.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${I?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(u)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:u==="class",onKeyPress:j=>{j.key==="Enter"&&T()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),E(!0);const v=t.parseInt(j.target.value);let S=t.isNaN(v)?0:v;j.keyCode===38&&(S+=1),j.keyCode===40&&(S-=1);const B=`${S}`,ae=`${B.startsWith("-")?"-":""}${m}[${B.replace("-","")}${u==="-"?"":u}]`;w(ae)},onKeyUp:j=>{V&&(j.preventDefault(),E(!1))},onBlur:()=>T(),onChange:j=>{h(!1),i(j.target.value)},onClick:j=>{var v;(v=j==null?void 0:j.target)==null||v.select(),s(!1)},value:I?R:l,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",b?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{open:a,delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>s(!a),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${x.length===1?"px-2 font-semibold":""}`,children:u}),x.length>1?e.jsxRuntimeExports.jsx(g.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(o.TooltipPortal,{children:e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx($e,{units:x,current:u,onSelect:j=>{s(!1),f(j),D(j)}})})})]})]}),["none","auto"].indexOf(u)!==-1||I?null:e.jsxRuntimeExports.jsx(Me,{onDragStart:()=>_(!0),onDragEnd:j=>{if(C(()=>""),_(!1),t.isEmpty(j))return;const v=`${j}`,B=`${v.startsWith("-")?"-":""}${m}[${v.replace("-","")}${u==="-"?"":u}]`;k(B)},onDrag:j=>{if(t.isEmpty(j))return;C(j);const v=`${j}`,B=`${v.startsWith("-")?"-":""}${m}[${v.replace("-","")}${u==="-"?"":u}]`;w(B)},currentValue:l,unit:u,negative:y,cssProperty:n})]})})})},O=r=>{const a=o.useSelectedBlockCurrentClasses();return t.findLast(a,{property:r})},Oe=(r,a)=>{const s={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return s[t.get(r,"mq","xs")]<=s[a]},qe={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},te={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},ze=r=>`${r.toUpperCase()} ${te[r]?`(${te[r]} & up)`:""}`,K=r=>{const{t:a}=H.useTranslation(),{type:s="icons",label:l,property:i,onEmitChange:p=()=>{},units:d,negative:m=!1}=r,[n]=o.useDarkMode(),[x]=o.useStylingState(),[,y]=o.useCanvasWidth(),u=O(i),f=o.useAddClassesToBlocks(),b=o.useRemoveClassesFromBlocks(),[h]=o.useSelectedBlockIds(),R=c.useMemo(()=>t.get(u,"fullCls",""),[u]),C=c.useCallback((w,T=!0)=>{const D={dark:n,mq:y,mod:x,cls:w,property:i,fullCls:""};(n||x!=="")&&(D.mq="xs");const j=M.generateFullClsName(D);f(h,[j],T)},[h,n,y,x,i,f]),I=c.useCallback(()=>{b(h,[R])},[h,R,b]),_=c.useMemo(()=>Oe(u,y),[u,y]);c.useEffect(()=>{p(_,u)},[_,p,u]);const[,,V]=o.useCanvasWidth(),E=c.useCallback(w=>{V({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[w])},[V]),k=t.get(u,"dark",null)===n&&t.get(u,"mod",null)===x&&t.get(u,"mq",null)===y;return e.jsxRuntimeExports.jsx(_e,{canChange:_,canReset:u&&k,children:e.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:e.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${u&&!k?"text-foreground":""}`,children:a(l)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[s==="arbitrary"?e.jsxRuntimeExports.jsx(Le,{currentClass:t.get(u,"cls",""),classPrefix:t.get(qe,i,""),units:d||[],onChange:C,negative:m,cssProperty:i}):null,s==="icons"&&e.jsxRuntimeExports.jsx(Be,{property:i,onChange:C}),s==="range"&&e.jsxRuntimeExports.jsx(Ie,{property:i,onChange:C}),s==="color"&&e.jsxRuntimeExports.jsx(He,{property:i,onChange:C}),s==="dropdown"&&e.jsxRuntimeExports.jsx(ne,{label:l,property:i,onChange:C})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${R?"visible":"invisible"}`,children:k?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>I(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(g.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):_&&u?e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(g.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("div",{className:"text-right",children:e.jsxRuntimeExports.jsxs("div",{children:["Current style is set at  ",e.jsxRuntimeExports.jsxs("span",{className:"font-bold",children:[ze(t.get(u,"mq")),n&&!u.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>E(t.get(u,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(u,"mq").toUpperCase()]})]})})})]}):null})]})]})})},We=["px","%","em","rem","ch","vh","vw"],le=({label:r,options:a,borderB:s=!1,borderT:l=!1,type:i="arbitrary",units:p=We,negative:d=!1})=>{const{t:m}=H.useTranslation(),[n,x]=c.useState(a[0].key),y=o.useSelectedBlockCurrentClasses(),u=c.useCallback(f=>t.map(y,"property").includes(f),[y]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${s?"border-b":""} ${l?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[r&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:m(r)}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:c.Children.toArray(a.map(({label:f,key:b})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>x(b),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${b===n?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[c.createElement("div",{className:u(b)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),c.createElement(t.get(oe,b,g.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(f))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(K,{type:i,units:[...p],label:"",property:n,negative:d})})]})},Fe=({heading:r,items:a})=>{const{t:s}=H.useTranslation(),l=o.useSelectedBlockCurrentClasses(),i=c.useMemo(()=>{const p=n=>t.flatten(n.map(x=>x.styleType==="multiple"?t.map(x.options,"key"):x.property)),d=t.flatten(a.map(n=>n.styleType==="accordion"?p(n.items):n.styleType==="multiple"?t.map(n.options,"key"):n.property)),m=t.map(l,"property");return t.intersection(d,m).length>0},[l,a]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[s(r),i?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:a.map(p=>p.styleType==="multiple"?e.jsxRuntimeExports.jsx(le,{...p},p.label):e.jsxRuntimeExports.jsx(K,{...p},p.label))})]})},Xe=c.createContext({}),X=({section:r})=>{const{t:a}=H.useTranslation(),s=o.useSelectedBlockCurrentClasses(),l=o.useSelectedBlock(),i=c.useCallback((n=[])=>{const x={};for(let u=0;u<s.length;u++)x[s[u].property]=s[u].cls;let y=!0;for(const u in n)if(!t.has(x,u)||x[u]!==n[u]){y=!1;break}return y},[s]),p=c.useMemo(()=>({}),[]),[d]=o.useSelectedStylingBlocks(),m=c.useMemo(()=>{const n=`${F.get(d,"0.prop")}_attrs`;return!F.isEmpty(F.get(l,n,{}))},[d]);return e.jsxRuntimeExports.jsx(Xe.Provider,{value:p,children:e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"border-b border-gray-300 bg-gray-200 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[r.heading==="Attributes"&&m?e.jsxRuntimeExports.jsx("span",{className:"mr-2 inline-block h-[8px] w-[8px] rounded-full bg-blue-600"}):null,e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-2",children:a(r.heading)})]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:c.Children.toArray(r.items.map(n=>t.has(n,"component")?c.createElement(n.component,{key:n.label}):t.has(n,"styleType")?n.styleType==="multiple"?e.jsxRuntimeExports.jsx(le,{...n},n.label):n.styleType==="accordion"&&i(n==null?void 0:n.conditions)?e.jsxRuntimeExports.jsx(Fe,{...n},n.label):null:e.jsxRuntimeExports.jsx(K,{...n},n.label)))})]})})},Ye=()=>{const r=o.useSelectedBlock(),[a]=o.useSelectedStylingBlocks(),{t:s}=H.useTranslation(),l=$.useGlobalStylingPresets(),i=o.useAddClassesToBlocks(),p=$.getBlockComponent(r._type),d=t.get(t.first(a),"prop"),m=t.get(p.props,`${d}.presets`,{});if(t.isEmpty(l)&&(!t.has(p,"props")||t.isEmpty(m)))return null;const n=x=>{const y=x.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");i([r._id],y,!0)};return e.jsxRuntimeExports.jsx("div",{className:"h-10",children:e.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"px-4",children:e.jsxRuntimeExports.jsxs(o.Button,{variant:"default",className:"w-full",size:"sm",children:[s("Apply Presets"),e.jsxRuntimeExports.jsx(g.CaretDownIcon,{})]})})}),e.jsxRuntimeExports.jsx(o.DropdownMenuContent,{className:"max-h-80 w-56",children:e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar h-full",children:[t.isEmpty(m)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DropdownMenuLabel,{children:[p.type," ",s("presets")]}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(m).map(x=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>n(m[x]),children:[t.capitalize(t.startCase(s(x))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:s("apply")})]}))})]}),t.isEmpty(l)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:s("Global presets")}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(l).map(x=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>n(l[x]),children:[t.capitalize(t.startCase(s(x))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:s("apply")})]}))})]})]})})]})})};function Ze(){const{flexChild:r,gridChild:a}=o.useSelectedBlocksDisplayChild(),[s]=o.useSelectedStylingBlocks();return t.isEmpty(s)?null:e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx(Ye,{}),e.jsxRuntimeExports.jsxs(o.Accordion,{defaultValue:["Styles"],type:"multiple",className:"w-full",children:[r&&e.jsxRuntimeExports.jsx(X,{section:Ne}),a?e.jsxRuntimeExports.jsx(X,{section:Se}):null,Te.map(l=>e.jsxRuntimeExports.jsx(X,{section:l},l.heading))]})]})}const Ue={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},Ke=()=>{const r=o.useSelectedBlock(),{t:a}=H.useTranslation(),[s,l]=c.useState(""),[i,p]=c.useState({onDrag:n=>n,onDragEnd:n=>n,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),d=z.useThrottledCallback(n=>{const x=!t.get(i,"negative",!1),y=t.get(i,"cssProperty","");let u=parseFloat(i.dragStartValue);u=t.isNaN(u)?0:u;let f=Ue[i.dragUnit];(t.startsWith(y,"scale")||y==="opacity")&&(f=10);let h=(i.dragStartY-n.pageY)/f+u;x&&h<0&&(h=0),y==="opacity"&&h>1&&(h=1),i.onDrag(`${h}`),l(`${h}`)},[i],50),m=c.useCallback(()=>{setTimeout(()=>i.onDragEnd(`${s}`),100),p({onDrag:n=>n,onDragEnd:n=>n,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[i,s,p]);return t.isNull(r)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(g.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:a("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(o.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(ie.Provider,{value:{setDragData:p},children:[i.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:d,onMouseUp:()=>m(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar max-h-full flex-1 overflow-x-hidden overflow-y-hidden bg-gray-100 pb-5",children:[e.jsxRuntimeExports.jsx(Ee,{}),e.jsxRuntimeExports.jsx(Ze,{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{})]})]})})};exports.default=Ke;
@@ -5,13 +5,13 @@ import { useThrottledCallback as ce } from "@react-hookz/web";
5
5
  import { forEach as ke, isArray as pe, omit as vt, truncate as wt, includes as z, get as g, first as oe, split as jt, startCase as Y, toLower as re, isEmpty as b, map as T, find as Ct, last as kt, filter as Re, set as We, debounce as Nt, keys as he, cloneDeep as _t, each as St, capitalize as me, reject as Tt, nth as Ve, startsWith as q, isNumber as Rt, parseInt as Vt, isNaN as Ue, findLast as Ht, flatten as He, intersection as Dt, has as de, isNull as Bt } from "lodash-es";
6
6
  import { useTranslation as F } from "react-i18next";
7
7
  import { CopyIcon as It, PlusIcon as Ke, Cross2Icon as Ge, EyeOpenIcon as At, EyeClosedIcon as De, BorderAllIcon as O, WidthIcon as H, HeightIcon as D, ArrowUpIcon as J, ArrowRightIcon as Q, ArrowDownIcon as ee, ArrowLeftIcon as te, ArrowTopLeftIcon as Pt, ArrowTopRightIcon as $t, ArrowBottomRightIcon as Et, ArrowBottomLeftIcon as Mt, AlignLeftIcon as Lt, AlignCenterHorizontallyIcon as Ot, AlignRightIcon as zt, StretchHorizontallyIcon as Yt, FontItalicIcon as Ft, UnderlineIcon as Xt, OverlineIcon as Zt, LetterCaseUppercaseIcon as Wt, Cross1Icon as Ut, InfoCircledIcon as Ne, MinusIcon as Kt, BoxIcon as qe, RowSpacingIcon as Gt, TriangleDownIcon as qt, CrossCircledIcon as Jt, CaretDownIcon as Qt, MixerHorizontalIcon as er } from "@radix-ui/react-icons";
8
- import { a2 as Je, aQ as Qe, aR as et, B as P, aS as tt, aT as tr, aU as rr, aV as sr, aW as or, aX as lr, aY as ar, M as X, aL as rt, $ as nr, a0 as ir, a1 as dr, aZ as cr, Z as pr, ab as ur, _ as gr, ac as U, ad as K, ae as G, i as xr, a_ as yr, a$ as hr, b0 as mr, b1 as br, b2 as fr, b3 as vr, b4 as wr, R as st, Q as ot, h as lt, b5 as jr, b6 as at, b7 as be, b8 as fe, b9 as ve, ba as Cr, bb as nt, ah as kr, bc as Nr, Y as le, o as _e, I as it, L as dt, bd as _r, aD as Be, be as ct, k as Sr, bf as Tr, J as ue, w as Rr, P as Vr, p as Ie, av as Hr, aw as Dr, ax as Br, bg as pt, ay as Ae, az as Pe, bh as $e, bi as Ee, bj as Me, S as Ir } from "./ChaiBuilderEditor-4xhn_QlL.js";
8
+ import { a2 as Je, aQ as Qe, aR as et, B as P, aS as tt, aT as tr, aU as rr, aV as sr, aW as or, aX as lr, aY as ar, M as X, aL as rt, $ as nr, a0 as ir, a1 as dr, aZ as cr, Z as pr, ab as ur, _ as gr, ac as U, ad as K, ae as G, i as xr, a_ as yr, a$ as hr, b0 as mr, b1 as br, b2 as fr, b3 as vr, b4 as wr, R as st, Q as ot, h as lt, b5 as jr, b6 as at, b7 as be, b8 as fe, b9 as ve, ba as Cr, bb as nt, ah as kr, bc as Nr, Y as le, o as _e, I as it, L as dt, bd as _r, aD as Be, be as ct, k as Sr, bf as Tr, J as ue, w as Rr, P as Vr, p as Ie, av as Hr, aw as Dr, ax as Br, bg as pt, ay as Ae, az as Pe, bh as $e, bi as Ee, bj as Me, S as Ir } from "./ChaiBuilderEditor-tkzS851D.js";
9
9
  import { Check as Ar, EditIcon as Pr, TrashIcon as $r, Loader as Er, SparklesIcon as Mr, Edit2 as Lr, X as Or } from "lucide-react";
10
10
  import { getBlockComponent as Se, getChaiDataProviders as zr, useGlobalStylingPresets as Yr } from "@chaibuilder/runtime";
11
11
  import { J as Fr, a as Xr, d as Zr } from "./index-e0c8PmRQ.js";
12
12
  import Wr from "@rjsf/core";
13
13
  import Ur from "@rjsf/validator-ajv8";
14
- import { u as Kr } from "./useCanvasSettings-Rvn5rRB8.js";
14
+ import { u as Kr } from "./useCanvasSettings-rEZHbw3s.js";
15
15
  import Gr from "react-autosuggest";
16
16
  import qr from "fuse.js";
17
17
  import { A as Jr, C as ge, g as Qr } from "./utils-VpVqnC9m.js";
@@ -341,24 +341,24 @@ const we = ({ data: r, fullView: a }) => {
341
341
  p && /* @__PURE__ */ e.jsx(G, { sideOffset: -55, className: "text-[11px]", children: b(l) ? "No data provider has been set up for this page." : "Complete last added data binding to add more" })
342
342
  ] })
343
343
  ] });
344
- }, as = () => /* @__PURE__ */ e.jsx("div", { className: "text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100", children: "Data binding is set for this field" }), ns = ({ id: r, placeholder: a, value: t }) => {
345
- const { t: l } = F(), [, o] = xr(), n = X();
344
+ }, as = () => /* @__PURE__ */ e.jsx("div", { className: "text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100", children: "Data binding is set for this field" }), ns = ({ id: r, placeholder: a }) => {
345
+ const { t } = F(), [, l] = xr(), o = X();
346
346
  if (typeof window > "u")
347
347
  return null;
348
- const d = () => {
349
- const p = n == null ? void 0 : n._id, s = r.replace("root.", "");
350
- o({ blockId: p, blockProp: s, placeholder: a, initialCode: t });
348
+ const n = r.replace("root.", ""), d = g(o, n, ""), p = () => {
349
+ const s = o == null ? void 0 : o._id;
350
+ l({ blockId: s, blockProp: n, placeholder: a, initialCode: g(o, n, d) });
351
351
  };
352
352
  return /* @__PURE__ */ e.jsxs("div", { className: "mt-2 flex flex-col gap-y-1", children: [
353
353
  /* @__PURE__ */ e.jsx(
354
354
  "button",
355
355
  {
356
- onClick: d,
356
+ onClick: p,
357
357
  className: "text-pretty w-[90%] max-w-full cursor-default truncate rounded border bg-white p-2 text-left text-[10px]",
358
- children: t.trim().length > 0 ? t.substring(0, 46) : a || "Eg: <script>console.log('Hello, world!');<\/script>"
358
+ children: d.trim().length > 0 ? d.substring(0, 46) : a || "Eg: <script>console.log('Hello, world!');<\/script>"
359
359
  }
360
360
  ),
361
- /* @__PURE__ */ e.jsx(P, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: l("Open code editor") })
361
+ /* @__PURE__ */ e.jsx(P, { onClick: p, size: "sm", variant: "outline", className: "w-fit", children: t("Open code editor") })
362
362
  ] });
363
363
  }, je = ft(({ id: r, properties: a, formData: t, onChange: l }) => {
364
364
  const [o, n] = j(t), d = { type: "object", properties: {} }, p = {};
@@ -697,7 +697,7 @@ const ps = $.memo(function({ preloadedAttributes: a = [], onAttributesChange: t
697
697
  h("Attribute keys cannot start with '@'");
698
698
  return;
699
699
  }
700
- if (n && p) {
700
+ if (n) {
701
701
  const w = [...l, { key: n, value: p }];
702
702
  t(w), o(l), d(""), s(""), h("");
703
703
  }
@@ -711,7 +711,7 @@ const ps = $.memo(function({ preloadedAttributes: a = [], onAttributesChange: t
711
711
  h("Attribute keys cannot start with '@'");
712
712
  return;
713
713
  }
714
- if (c !== null && n && p) {
714
+ if (c !== null && n) {
715
715
  const w = [...l];
716
716
  w[c] = { key: n, value: p }, t(w), o(w), u(null), d(""), s(""), h("");
717
717
  }
@@ -764,7 +764,7 @@ const ps = $.memo(function({ preloadedAttributes: a = [], onAttributesChange: t
764
764
  ]
765
765
  }
766
766
  ),
767
- /* @__PURE__ */ e.jsx("div", { className: "mt-4 max-h-60 space-y-1 overflow-y-auto", children: l.map((w, N) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
767
+ /* @__PURE__ */ e.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: l.map((w, N) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
768
768
  /* @__PURE__ */ e.jsxs("div", { className: "mr-2 flex flex-col", children: [
769
769
  /* @__PURE__ */ e.jsx("span", { className: "truncate font-semibold", children: w.key }),
770
770
  /* @__PURE__ */ e.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: w.value })
@@ -3,7 +3,7 @@ import { KeyboardIcon as R, PlusIcon as S, Component2Icon as J } from "@radix-ui
3
3
  import f, { useState as h, useEffect as Z, useMemo as W, memo as Y, lazy as j, Suspense as y } from "react";
4
4
  import { useAtom as M } from "jotai";
5
5
  import { filter as N, map as K, isNull as $, find as q, isEmpty as G, values as Q, each as X, get as ee } from "lodash-es";
6
- import { Z as O, _ as H, $ as U, a0 as F, a1 as se, a2 as re, A as ae, a as ie, b as te, c as le, d as oe, e as ne, f as ce, g as de, a3 as me, a4 as xe, a5 as he, a6 as ue, a7 as pe, a8 as fe, a9 as je, aa as B, ab as ve, ac as ge, ad as be, ae as ye, af as E, h as w, ag as Ne, B as x, ah as z, ai as we, aj as ke, ak as L, al as I } from "./ChaiBuilderEditor-4xhn_QlL.js";
6
+ import { Z as O, _ as H, $ as U, a0 as F, a1 as se, a2 as re, A as ae, a as ie, b as te, c as le, d as oe, e as ne, f as ce, g as de, a3 as me, a4 as xe, a5 as he, a6 as ue, a7 as pe, a8 as fe, a9 as je, aa as B, ab as ve, ac as ge, ad as be, ae as ye, af as E, h as w, ag as Ne, B as x, ah as z, ai as we, aj as ke, ak as L, al as I } from "./ChaiBuilderEditor-tkzS851D.js";
7
7
  import { ListTreeIcon as A, PaletteIcon as Ce, DatabaseIcon as De } from "lucide-react";
8
8
  import { getChaiDataProviders as Te, useChaiBlocks as _e } from "@chaibuilder/runtime";
9
9
  import { useTranslation as v } from "react-i18next";
@@ -230,7 +230,7 @@ const ze = () => {
230
230
  ] }) })
231
231
  ] })
232
232
  ] });
233
- }), Ie = j(() => import("./AddBlocks-kJNH96eQ.js")), P = j(() => import("./ListTree-5s7iNbKT.js")), Ve = j(() => import("./ThemeConfiguration-q5rLYmXB.js")), Me = j(() => import("./ChaiBuilderEditor-4xhn_QlL.js").then((s) => s.cs)), Oe = j(() => import("./UILibrariesPanel-N7acP7aA.js"));
233
+ }), Ie = j(() => import("./AddBlocks-HeYXoex4.js")), P = j(() => import("./ListTree-0n_G8NJx.js")), Ve = j(() => import("./ThemeConfiguration-S7yArRMp.js")), Me = j(() => import("./ChaiBuilderEditor-tkzS851D.js").then((s) => s.cs)), Oe = j(() => import("./UILibrariesPanel-tcfz2ELp.js"));
234
234
  let V = null;
235
235
  const Bs = () => {
236
236
  const s = w("sideBarComponents.top", []), l = w("sideBarComponents.bottom", []), [i, t] = M(Ne), [u, d] = h(i), [c, k] = h(null), { t: p } = v(), C = w("uiLibraries", []), g = _e(), D = Q(g).find((a) => a.category === "custom") !== void 0, T = C.length > 0 || D, b = {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),R=require("@radix-ui/react-icons"),i=require("react"),D=require("jotai"),c=require("lodash-es"),s=require("./ChaiBuilderEditor-Rqlg194T.cjs"),E=require("lucide-react"),S=require("@chaibuilder/runtime"),v=require("react-i18next"),T=require("./index-gi1LIOCw.cjs"),a=require("./MODIFIERS-mVmfEGgo.cjs"),P=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.cjs");require("tailwind-merge");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-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");const I=({provider:t,onClose:x})=>{const{t:o}=v.useTranslation(),[l,p]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(d=>p(d))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:m=>m?"":x(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[o("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(s.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(T.JsonView,{data:l,shouldExpandNode:T.allExpanded,style:{...T.defaultStyles,container:"max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]})}):null};function _({children:t,name:x,onRemove:o}){const{t:l}=v.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:l("remove_provider_confirmation").replace("{name}",x)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:l("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:l("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:l("remove")})]})]})]})}const K=()=>{const{t}=v.useTranslation(),x=i.useMemo(()=>S.getChaiDataProviders(),[]),[o,l]=s.usePageDataProviders(),[,p]=D.useAtom(s.builderSaveStateAtom),[m,d]=i.useState(c.filter(x,r=>c.map(o,"providerKey").includes(r.providerKey))),[b,h]=i.useState(""),[N,f]=i.useState(null),y=c.filter(x.map(r=>c.map(m,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!c.isNull(r)),w=r=>{const j=c.find(x,{providerKey:r});d(n=>[...n,j]),l(n=>[...n,{providerKey:j.providerKey,args:{}}]),h(""),p("UNSAVED")},g=r=>{d(j=>c.filter(j,n=>n.providerKey!==r.providerKey)),l(j=>c.filter(j,n=>n.providerKey!==r.providerKey)),p("UNSAVED")},u=r=>f(r);return c.isEmpty(x)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 p-4 text-xs text-gray-500",children:[t("no_data_providers"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:t("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"mb-1.5 text-xs text-gray-500",children:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:b,onValueChange:r=>w(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),y.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${m.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:m.map(r=>e.jsxRuntimeExports.jsxs("div",{className:"w-full rounded-lg border bg-card text-card-foreground shadow-sm","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>u(r),className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(_,{onRemove:()=>g(r),name:r.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(I,{onClose:()=>f(null),provider:N})]})]})},L=i.memo(()=>{const{t}=v.useTranslation(),x={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return e.jsxRuntimeExports.jsxs(s.Dialog,{children:[e.jsxRuntimeExports.jsx(s.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{children:e.jsxRuntimeExports.jsx("div",{className:"flex w-10 items-center justify-center",children:e.jsxRuntimeExports.jsx(R.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(s.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(s.DialogHeader,{children:e.jsxRuntimeExports.jsx(s.DialogTitle,{children:t("Keyboard shortcuts")})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[e.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-gray-200",children:Object.keys(x).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(x[l])})]},l))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(o[l])})]},l))})]})})]})]})}),B=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-7OJEZC2D.cjs"))),k=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-4J0SUudU.cjs"))),A=i.lazy(()=>Promise.resolve().then(()=>require("./ThemeConfiguration-qUXsJBBZ.cjs"))),O=i.lazy(()=>Promise.resolve().then(()=>require("./ChaiBuilderEditor-Rqlg194T.cjs")).then(t=>t.ImagesPanel)),U=i.lazy(()=>Promise.resolve().then(()=>require("./UILibrariesPanel-uNt8spPr.cjs")));let C=null;const z=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),x=s.useBuilderProp("sideBarComponents.bottom",[]),[o,l]=D.useAtom(s.activePanelAtom),[p,m]=i.useState(o),[d,b]=i.useState(null),{t:h}=v.useTranslation(),N=s.useBuilderProp("uiLibraries",[]),f=S.useChaiBlocks(),y=c.values(f).find(n=>n.category==="custom")!==void 0,w=N.length>0||y,g={"add-blocks":B,[a.OUTLINE_KEY]:k,"theme-configuration":A,images:O,"ui-libraries":U};c.each(t,({name:n,panel:q})=>{g[n]=q});const u=n=>{clearTimeout(C),o!==a.OUTLINE_KEY&&n===a.OUTLINE_KEY?C=setTimeout(()=>l(a.OUTLINE_KEY),500):m(n),l(n)},r=s.useBuilderProp("dataBindingSupport",!1);function j(){const n=setTimeout(()=>{d&&(u(a.OUTLINE_KEY),clearTimeout(d))},500);b(n)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:j,onClick:()=>u(a.OUTLINE_KEY),className:"fixed inset-0 z-[50] bg-black/20"}):null,e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[w?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-gray-200 p-1",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("ui-libraries"),size:"sm",variant:o==="ui-libraries"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.Component2Icon,{className:"text-xl"})})]}):e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u(a.OUTLINE_KEY),size:"sm",variant:o===a.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("theme-configuration"),size:"sm",variant:o==="theme-configuration"?"default":"outline",children:e.jsxRuntimeExports.jsx(E.PaletteIcon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:n,icon:q})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u(n),size:"sm",className:"w-10",variant:o===n?"default":"outline",children:e.jsxRuntimeExports.jsx(q,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(L,{}),i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]}),o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{className:"absolute left-14 z-[50] h-[100vh] w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:P.cn("relative z-[100] h-full max-h-full overflow-y-auto overflow-x-hidden border-r bg-background p-1 shadow-md"),onMouseEnter:()=>{d&&clearTimeout(d)},children:i.createElement(c.get(g,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}):null,e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:r?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:a.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:a.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(E.DatabaseIcon,{className:"mr-2 w-3"}),h("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:a.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(k)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(K,{})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"sticky top-0 -m-1 flex h-fit items-center justify-center border-b bg-gray-100 py-2 pb-[9px] text-sm",children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2",children:i.createElement(k)})]})})})]})};exports.default=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),R=require("@radix-ui/react-icons"),i=require("react"),D=require("jotai"),c=require("lodash-es"),s=require("./ChaiBuilderEditor-aY8flOgX.cjs"),E=require("lucide-react"),S=require("@chaibuilder/runtime"),v=require("react-i18next"),T=require("./index-gi1LIOCw.cjs"),a=require("./MODIFIERS-mVmfEGgo.cjs"),P=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.cjs");require("tailwind-merge");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-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");const I=({provider:t,onClose:x})=>{const{t:o}=v.useTranslation(),[l,p]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(d=>p(d))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:m=>m?"":x(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[o("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(s.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(T.JsonView,{data:l,shouldExpandNode:T.allExpanded,style:{...T.defaultStyles,container:"max-h-[80vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]})}):null};function _({children:t,name:x,onRemove:o}){const{t:l}=v.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:l("remove_provider_confirmation").replace("{name}",x)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:l("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:l("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:l("remove")})]})]})]})}const K=()=>{const{t}=v.useTranslation(),x=i.useMemo(()=>S.getChaiDataProviders(),[]),[o,l]=s.usePageDataProviders(),[,p]=D.useAtom(s.builderSaveStateAtom),[m,d]=i.useState(c.filter(x,r=>c.map(o,"providerKey").includes(r.providerKey))),[b,h]=i.useState(""),[N,f]=i.useState(null),y=c.filter(x.map(r=>c.map(m,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!c.isNull(r)),w=r=>{const j=c.find(x,{providerKey:r});d(n=>[...n,j]),l(n=>[...n,{providerKey:j.providerKey,args:{}}]),h(""),p("UNSAVED")},g=r=>{d(j=>c.filter(j,n=>n.providerKey!==r.providerKey)),l(j=>c.filter(j,n=>n.providerKey!==r.providerKey)),p("UNSAVED")},u=r=>f(r);return c.isEmpty(x)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 p-4 text-xs text-gray-500",children:[t("no_data_providers"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:t("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"mb-1.5 text-xs text-gray-500",children:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:b,onValueChange:r=>w(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),y.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${m.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:m.map(r=>e.jsxRuntimeExports.jsxs("div",{className:"w-full rounded-lg border bg-card text-card-foreground shadow-sm","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>u(r),className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(_,{onRemove:()=>g(r),name:r.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(I,{onClose:()=>f(null),provider:N})]})]})},L=i.memo(()=>{const{t}=v.useTranslation(),x={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return e.jsxRuntimeExports.jsxs(s.Dialog,{children:[e.jsxRuntimeExports.jsx(s.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{children:e.jsxRuntimeExports.jsx("div",{className:"flex w-10 items-center justify-center",children:e.jsxRuntimeExports.jsx(R.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(s.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(s.DialogHeader,{children:e.jsxRuntimeExports.jsx(s.DialogTitle,{children:t("Keyboard shortcuts")})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[e.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-gray-200",children:Object.keys(x).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(x[l])})]},l))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(l=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(l)}),e.jsxRuntimeExports.jsx("div",{children:t(o[l])})]},l))})]})})]})]})}),B=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-VHoZezjj.cjs"))),k=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-C6oCXZDV.cjs"))),A=i.lazy(()=>Promise.resolve().then(()=>require("./ThemeConfiguration-q1471P7b.cjs"))),O=i.lazy(()=>Promise.resolve().then(()=>require("./ChaiBuilderEditor-aY8flOgX.cjs")).then(t=>t.ImagesPanel)),U=i.lazy(()=>Promise.resolve().then(()=>require("./UILibrariesPanel-cm9CFWxc.cjs")));let C=null;const z=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),x=s.useBuilderProp("sideBarComponents.bottom",[]),[o,l]=D.useAtom(s.activePanelAtom),[p,m]=i.useState(o),[d,b]=i.useState(null),{t:h}=v.useTranslation(),N=s.useBuilderProp("uiLibraries",[]),f=S.useChaiBlocks(),y=c.values(f).find(n=>n.category==="custom")!==void 0,w=N.length>0||y,g={"add-blocks":B,[a.OUTLINE_KEY]:k,"theme-configuration":A,images:O,"ui-libraries":U};c.each(t,({name:n,panel:q})=>{g[n]=q});const u=n=>{clearTimeout(C),o!==a.OUTLINE_KEY&&n===a.OUTLINE_KEY?C=setTimeout(()=>l(a.OUTLINE_KEY),500):m(n),l(n)},r=s.useBuilderProp("dataBindingSupport",!1);function j(){const n=setTimeout(()=>{d&&(u(a.OUTLINE_KEY),clearTimeout(d))},500);b(n)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:j,onClick:()=>u(a.OUTLINE_KEY),className:"fixed inset-0 z-[50] bg-black/20"}):null,e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[w?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-gray-200 p-1",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("ui-libraries"),size:"sm",variant:o==="ui-libraries"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.Component2Icon,{className:"text-xl"})})]}):e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("add-blocks"),size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(R.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u(a.OUTLINE_KEY),size:"sm",variant:o===a.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u("theme-configuration"),size:"sm",variant:o==="theme-configuration"?"default":"outline",children:e.jsxRuntimeExports.jsx(E.PaletteIcon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:n,icon:q})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>u(n),size:"sm",className:"w-10",variant:o===n?"default":"outline",children:e.jsxRuntimeExports.jsx(q,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(L,{}),i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]}),o!==a.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{className:"absolute left-14 z-[50] h-[100vh] w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:P.cn("relative z-[100] h-full max-h-full overflow-y-auto overflow-x-hidden border-r bg-background p-1 shadow-md"),onMouseEnter:()=>{d&&clearTimeout(d)},children:i.createElement(c.get(g,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}):null,e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:r?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:a.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:a.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(E.DatabaseIcon,{className:"mr-2 w-3"}),h("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:a.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(k)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(K,{})})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"sticky top-0 -m-1 flex h-fit items-center justify-center border-b bg-gray-100 py-2 pb-[9px] text-sm",children:[e.jsxRuntimeExports.jsx(E.ListTreeIcon,{className:"mr-2 h-3"})," ",h("Outline")]}),e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden pt-2",children:i.createElement(k)})]})})})]})};exports.default=z;
@@ -2,7 +2,7 @@ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import * as c from "react";
3
3
  import j from "@rjsf/validator-ajv8";
4
4
  import k from "@rjsf/core";
5
- import { h as T, G as w, by as D } from "./ChaiBuilderEditor-4xhn_QlL.js";
5
+ import { h as T, G as w, by as D } from "./ChaiBuilderEditor-tkzS851D.js";
6
6
  import { f, y as P, s as a } from "./controls-yjgoZzB6.js";
7
7
  import { debounce as R, noop as M, isEqual as F } from "lodash-es";
8
8
  import { useTranslation as L } from "react-i18next";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),N=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./ChaiBuilderEditor-Rqlg194T.cjs"),r=require("./controls-rRZhz0vu.cjs"),m=require("lodash-es"),k=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.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-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");function P(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=P(B),T=({value:t,onChange:e,id:i,onBlur:l})=>{const n=m.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},f=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"},{title:"Bebas Neue",value:"Bebas Neue"},{title:"Manrope",value:"Manrope"}],D=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",m.noop),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=x.useRef(e),{t:v}=k.useTranslation();x.useEffect(()=>()=>{m.isEqual(e,n.current)||t(n.current)},[]);const u=({formData:o},d)=>{d&&(i(o),n.current=o)},{bodyFont:g,headingFont:b,primaryColor:h,bodyTextDarkColor:y,bodyTextLightColor:C,bodyBgDarkColor:S,secondaryColor:j,bodyBgLightColor:O,roundedCorners:R}=e;let s={headingFont:r.f({title:"Heading font",default:b,options:f}),bodyFont:r.f({title:"Body font",default:g,options:f}),roundedCorners:r.y({title:"Rounded Corner",default:parseInt(R||5,10)}),primaryColor:r.s({title:"Primary",default:h}),secondaryColor:r.s({title:"Secondary",default:j})};l||(s={...s,bodyBgLightColor:r.s({title:"Background",default:O}),bodyTextLightColor:r.s({title:"Text color",default:y}),bodyBgDarkColor:r.s({title:"Background (Dark mode)",default:S}),bodyTextDarkColor:r.s({title:"Text color(Dark mode)",default:C})});const c={type:"object",properties:{}},q={};return Object.keys(s).forEach(o=>{const d=s[o];return c.properties||(c.properties={}),c.properties[o]=d.schema,q[o]=d.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-60 select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:v("Theme Configuration")})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:T},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:q,schema:c,formData:e,validator:N,onChange:u})})]})};exports.default=D;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./jsx-runtime-Z_BpKhVy.cjs"),B=require("react"),N=require("@rjsf/validator-ajv8"),E=require("@rjsf/core"),p=require("./ChaiBuilderEditor-aY8flOgX.cjs"),r=require("./controls-rRZhz0vu.cjs"),m=require("lodash-es"),k=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.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-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");function P(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const l=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const x=P(B),T=({value:t,onChange:e,id:i,onBlur:l})=>{const n=m.debounce(e,200),v=u=>n(u.target.value);return a.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:a.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:a.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:t,onBlur:({target:{value:u}})=>l(i,u),onChange:v})})})},f=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"},{title:"Bebas Neue",value:"Bebas Neue"},{title:"Manrope",value:"Manrope"}],D=()=>{const t=p.useBuilderProp("onSaveBrandingOptions",m.noop),[e,i]=p.useBrandingOptions(),[l]=p.useBlocksContainer(),n=x.useRef(e),{t:v}=k.useTranslation();x.useEffect(()=>()=>{m.isEqual(e,n.current)||t(n.current)},[]);const u=({formData:o},d)=>{d&&(i(o),n.current=o)},{bodyFont:g,headingFont:b,primaryColor:h,bodyTextDarkColor:y,bodyTextLightColor:C,bodyBgDarkColor:S,secondaryColor:j,bodyBgLightColor:O,roundedCorners:R}=e;let s={headingFont:r.f({title:"Heading font",default:b,options:f}),bodyFont:r.f({title:"Body font",default:g,options:f}),roundedCorners:r.y({title:"Rounded Corner",default:parseInt(R||5,10)}),primaryColor:r.s({title:"Primary",default:h}),secondaryColor:r.s({title:"Secondary",default:j})};l||(s={...s,bodyBgLightColor:r.s({title:"Background",default:O}),bodyTextLightColor:r.s({title:"Text color",default:y}),bodyBgDarkColor:r.s({title:"Background (Dark mode)",default:S}),bodyTextDarkColor:r.s({title:"Text color(Dark mode)",default:C})});const c={type:"object",properties:{}},q={};return Object.keys(s).forEach(o=>{const d=s[o];return c.properties||(c.properties={}),c.properties[o]=d.schema,q[o]=d.uiSchema,!0}),a.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-60 select-none flex-col",children:[a.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:a.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:v("Theme Configuration")})}),a.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:a.jsxRuntimeExports.jsx(E,{widgets:{color:T},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:q,schema:c,formData:e,validator:N,onChange:u})})]})};exports.default=D;
@@ -1,7 +1,7 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import o, { useMemo as h, Suspense as c } from "react";
3
3
  import { FontFamilyIcon as j, EyeOpenIcon as g } from "@radix-ui/react-icons";
4
- import { h as r, a6 as f, a7 as v, a8 as b, a9 as N, am as S, an as w, aa as l, V as y, B as p, ao as C, F as B, ah as m, ap as A } from "./ChaiBuilderEditor-4xhn_QlL.js";
4
+ import { h as r, a6 as f, a7 as v, a8 as b, a9 as N, am as S, an as w, aa as l, V as y, B as p, ao as C, F as B, ah as m, ap as A } from "./ChaiBuilderEditor-tkzS851D.js";
5
5
  import { useTranslation as x } from "react-i18next";
6
6
  import "./_commonjsHelpers-UyOWmZb0.js";
7
7
  import "clsx";