@chaibuilder/sdk 1.2.52 → 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.
- package/dist/{AddBlocks-GxEmM16E.js → AddBlocks-HeYXoex4.js} +2 -2
- package/dist/{AddBlocks-fozauzIV.cjs → AddBlocks-VHoZezjj.cjs} +1 -1
- package/dist/{CanvasArea-NRtblq5d.cjs → CanvasArea-137WY3Wx.cjs} +2 -2
- package/dist/{CanvasArea-rdY6SFYn.js → CanvasArea-CqILE5PR.js} +3 -3
- package/dist/{ChaiBuilderEditor-Pga_zJgw.cjs → ChaiBuilderEditor-aY8flOgX.cjs} +1 -1
- package/dist/{ChaiBuilderEditor-bNZZWYMh.js → ChaiBuilderEditor-tkzS851D.js} +2 -2
- package/dist/{CodeEditor-ye3IXW3i.cjs → CodeEditor-R2jKe97T.cjs} +1 -1
- package/dist/{CodeEditor-tqtgia3I.js → CodeEditor-kxV5RCpd.js} +1 -1
- package/dist/{CurrentPage-7NM90y76.js → CurrentPage-IrFGAb7n.js} +3 -3
- package/dist/{CurrentPage-sx7KVTmt.cjs → CurrentPage-PjrVzHXR.cjs} +1 -1
- package/dist/{ListTree-oRbeDNod.js → ListTree-0n_G8NJx.js} +1 -1
- package/dist/{ListTree-7Pz6H6eE.cjs → ListTree-C6oCXZDV.cjs} +1 -1
- package/dist/{PagesPanel-XiTUaiq_.js → PagesPanel-RYBf0Yct.js} +4 -4
- package/dist/{PagesPanel-Nr-908vy.cjs → PagesPanel-lIC3kYmS.cjs} +1 -1
- package/dist/{ProjectPanel-SuFYN60H.cjs → ProjectPanel-0Siyi5YS.cjs} +1 -1
- package/dist/{ProjectPanel-XfknsGkz.js → ProjectPanel-Zagx6l3Q.js} +4 -4
- package/dist/Settings-6QRVcl16.cjs +1 -0
- package/dist/{Settings-dJ72rwnH.js → Settings-RLDTFFf8.js} +797 -807
- package/dist/{SidePanels-t9oUA51J.js → SidePanels-ao969pMV.js} +2 -2
- package/dist/{SidePanels-5dnRAsJh.cjs → SidePanels-j1EFsBlK.cjs} +1 -1
- package/dist/{ThemeConfiguration-pcHbYiIP.js → ThemeConfiguration-S7yArRMp.js} +1 -1
- package/dist/{ThemeConfiguration-2Sbh29qi.cjs → ThemeConfiguration-q1471P7b.cjs} +1 -1
- package/dist/{Topbar-0DmS6VpB.js → Topbar-B8u0whpc.js} +1 -1
- package/dist/{Topbar-ID6Ipphd.cjs → Topbar-ogFKKDbx.cjs} +1 -1
- package/dist/{UILibrariesPanel-sXY6hozJ.cjs → UILibrariesPanel-cm9CFWxc.cjs} +1 -1
- package/dist/{UILibrariesPanel-G9J4KUsZ.js → UILibrariesPanel-tcfz2ELp.js} +1 -1
- package/dist/{UnsplashImages-HK4_1VVL.cjs → UnsplashImages-E2L3YDJI.cjs} +1 -1
- package/dist/{UnsplashImages-MeS5Cu7a.js → UnsplashImages-wWRifkCp.js} +1 -1
- package/dist/{UploadImages-AIKATqfP.js → UploadImages-lUvZhW_j.js} +1 -1
- package/dist/{UploadImages-LSnxByGV.cjs → UploadImages-s-eeaGiS.cjs} +1 -1
- package/dist/{add-page-modal-JkD45moJ.js → add-page-modal-04b4l2zu.js} +4 -4
- package/dist/{add-page-modal-krxKdX7-.cjs → add-page-modal-eroF20lO.cjs} +1 -1
- package/dist/{confirm-alert-NHxthdRK.js → confirm-alert-FX5030eR.js} +1 -1
- package/dist/{confirm-alert--QTC21Z2.cjs → confirm-alert-XuxEzG-V.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-8rjPEchH.js → delete-page-modal-1u9CyAIP.js} +3 -3
- package/dist/{delete-page-modal-BIe0kYNH.cjs → delete-page-modal-pgh7sdfg.cjs} +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{form-PQYPrD_Q.js → form-HRdEJjVq.js} +1 -1
- package/dist/{form-6OLp5uEG.cjs → form-Z4IRWj0o.cjs} +1 -1
- package/dist/{html-to-json-ofq1N3tB.js → html-to-json-OnIZDDXw.js} +63 -58
- package/dist/html-to-json-rauxDBi6.cjs +1 -0
- package/dist/{index-seU0_UZX.cjs → index-bt7EhwLh.cjs} +1 -1
- package/dist/{index-9_b2eou7.js → index-vfmO3y2d.js} +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +1 -1
- package/dist/{page-viewer-WwwMC1Kq.cjs → page-viewer-O960kM2x.cjs} +1 -1
- package/dist/{page-viewer-sKluQ_e1.js → page-viewer-dcb3u4OV.js} +4 -4
- package/dist/{project-general-setting-Lc2ByvTt.js → project-general-setting--sS34seu.js} +4 -4
- package/dist/{project-general-setting-pRO1ikDV.cjs → project-general-setting-lIvNs-Vq.cjs} +1 -1
- package/dist/{project-seo-setting-530_6o9S.js → project-seo-setting-8tc3I-0M.js} +2 -2
- package/dist/{project-seo-setting-BzSrXFVv.cjs → project-seo-setting-MIlAuqcc.cjs} +1 -1
- package/dist/{single-page-detail-_VP4zaCI.cjs → single-page-detail-0Z_hvd_j.cjs} +1 -1
- package/dist/{single-page-detail-qDxxtedN.js → single-page-detail-tP2pfgBp.js} +5 -5
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -3
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/dist/{useCanvasSettings-pURFQG4q.cjs → useCanvasSettings-R0h03UfD.cjs} +1 -1
- package/dist/{useCanvasSettings-5y2fSCpN.js → useCanvasSettings-rEZHbw3s.js} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +241 -195
- package/package.json +1 -1
- package/dist/Settings-22Hy7jUT.cjs +0 -1
- 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-
|
|
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-
|
|
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-
|
|
49
|
+
import "./html-to-json-OnIZDDXw.js";
|
|
50
50
|
import "himalaya";
|
|
51
|
-
const x = i.lazy(() => import("./add-page-modal-
|
|
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-
|
|
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-
|
|
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-
|
|
5
|
-
import { b as h, a as g } from "./index-
|
|
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-
|
|
49
|
+
import "./html-to-json-OnIZDDXw.js";
|
|
50
50
|
import "himalaya";
|
|
51
|
-
const N = m.lazy(() => import("./project-general-setting
|
|
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;
|