@chaibuilder/sdk 0.1.0 → 0.1.2

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 (49) hide show
  1. package/dist/AddBlocks-b5f37f2f.js +258 -0
  2. package/dist/AddBlocks-e23baf9a.cjs +3 -0
  3. package/dist/BrandingOptions-3d1bd24a.cjs +1 -0
  4. package/dist/{BrandingOptions-055cf22a.js → BrandingOptions-cfd1b740.js} +2 -2
  5. package/dist/{CanvasArea-a7901131.js → CanvasArea-a065a586.js} +3 -3
  6. package/dist/{CanvasArea-97dfbb52.cjs → CanvasArea-c4554d61.cjs} +10 -10
  7. package/dist/{ImagesPanel-160aa664.cjs → ImagesPanel-cc136c92.cjs} +1 -1
  8. package/dist/{ImagesPanel-815d5e6f.js → ImagesPanel-eccf9a56.js} +1 -1
  9. package/dist/Layers-f002ba1a.cjs +1 -0
  10. package/dist/{Layers-6f1c162e.js → Layers-f935e07b.js} +3 -3
  11. package/dist/MarkAsGlobalBlock-5f435dd5.cjs +1 -0
  12. package/dist/{MarkAsGlobalBlock-209ddfd5.js → MarkAsGlobalBlock-613bfdab.js} +2 -2
  13. package/dist/Settings-05b9b5fe.cjs +1 -0
  14. package/dist/{Settings-b1afcefe.js → Settings-a19fbb69.js} +4 -4
  15. package/dist/{SidePanels-f48777bb.js → SidePanels-67ebbcb4.js} +20 -18
  16. package/dist/SidePanels-af222189.cjs +1 -0
  17. package/dist/Topbar-e92351cc.cjs +1 -0
  18. package/dist/{Topbar-64729901.js → Topbar-fcb01371.js} +2 -2
  19. package/dist/{UnsplashImages-04fffeed.cjs → UnsplashImages-cca34e45.cjs} +1 -1
  20. package/dist/{UnsplashImages-315ce7a8.js → UnsplashImages-fda2f29a.js} +2 -2
  21. package/dist/{UploadImages-f317eef0.js → UploadImages-1839950f.js} +36 -32
  22. package/dist/UploadImages-d398bc93.cjs +1 -0
  23. package/dist/core.cjs +1 -1
  24. package/dist/core.js +2 -2
  25. package/dist/{html-to-json-fecbbe16.js → html-to-json-7510f587.js} +46 -46
  26. package/dist/html-to-json-7eba915f.cjs +1 -0
  27. package/dist/index-73cf645f.cjs +2 -0
  28. package/dist/{index-cdd49c4c.js → index-7e212fbc.js} +12 -6
  29. package/dist/lib.cjs +1 -1
  30. package/dist/lib.js +1 -1
  31. package/dist/link-1ee70bca.cjs +1 -0
  32. package/dist/{link-8594fd8f.js → link-e406254f.js} +27 -27
  33. package/dist/render.cjs +2 -2
  34. package/dist/render.js +1 -1
  35. package/dist/ui.cjs +1 -1
  36. package/dist/ui.js +2 -2
  37. package/package.json +2 -2
  38. package/dist/AddBlocks-04c49399.js +0 -258
  39. package/dist/AddBlocks-c27c81fa.cjs +0 -3
  40. package/dist/BrandingOptions-c25f6370.cjs +0 -1
  41. package/dist/Layers-3aa6aae7.cjs +0 -1
  42. package/dist/MarkAsGlobalBlock-536770e7.cjs +0 -1
  43. package/dist/Settings-2b1ff1a3.cjs +0 -1
  44. package/dist/SidePanels-f79dbace.cjs +0 -1
  45. package/dist/Topbar-bff765dc.cjs +0 -1
  46. package/dist/UploadImages-43c16a2d.cjs +0 -1
  47. package/dist/html-to-json-d8ac554d.cjs +0 -1
  48. package/dist/index-aea5c557.cjs +0 -2
  49. package/dist/link-43d13383.cjs +0 -1
@@ -1,258 +0,0 @@
1
- import { j as e } from "./jsx-runtime-944c88e2.js";
2
- import y, { createElement as z, useState as g, useMemo as D, useCallback as G, useEffect as U, Suspense as K } from "react";
3
- import { has as H, first as f, filter as j, values as C, groupBy as v, mergeWith as q, isArray as L, get as V, map as B, isEmpty as N, find as W, uniq as $, includes as A, reject as P } from "lodash";
4
- import { useAtom as x } from "jotai";
5
- import { A as J, a as Q, b as X, c as Y } from "./accordion-c0176dc5.js";
6
- import { S as Z } from "./scroll-area-9f64a082.js";
7
- import { T as ee, a as se, b as T } from "./tabs-85caa1e8.js";
8
- import { d as re, e as oe, f as te, u as le, B as ae, S as ce } from "./useBuilderProp-81a14920.js";
9
- import { useDrag as M, DragPreviewImage as E } from "react-dnd";
10
- import { BoxIcon as ne, ExclamationTriangleIcon as ie, Cross1Icon as de } from "@radix-ui/react-icons";
11
- import { O as I, h as w, a as S, b as k, R as me, S as ue, T as pe, y as xe } from "./index-cdd49c4c.js";
12
- import "react-i18next";
13
- import { syncBlocksWithDefaults as R, useChaiBlocks as O } from "chaibuilder-blocks";
14
- import { Loader as he } from "lucide-react";
15
- import { c as fe } from "./utils-ac68b2c8.js";
16
- import { C as ge, c as be, e as je, f as ye, g as we, T as ke, d as Te, A as Ce, a as ve } from "./textarea-0750bcd2.js";
17
- import { L as Be } from "./label-e770a087.js";
18
- import { g as Ne } from "./html-to-json-fecbbe16.js";
19
- import "@radix-ui/react-accordion";
20
- import "@radix-ui/react-scroll-area";
21
- import "@radix-ui/react-tabs";
22
- import "@radix-ui/react-slot";
23
- import "class-variance-authority";
24
- import "@radix-ui/react-tooltip";
25
- import "@radix-ui/react-toast";
26
- import "i18next";
27
- import "flagged";
28
- import "@minoru/react-dnd-treeview";
29
- import "react-hotkeys-hook";
30
- import "flat-to-nested";
31
- import "./Class-e6b07b79.js";
32
- import "redux-undo";
33
- import "@react-hookz/web";
34
- import "./CONTROLS-442caee5.js";
35
- import "clsx";
36
- import "tailwind-merge";
37
- import "@radix-ui/react-label";
38
- import "himalaya";
39
- const Ae = ({ block: s }) => {
40
- const { type: r, icon: t, label: c } = s, { addCoreBlock: d, addPredefinedBlock: m } = I(), [u] = w(), [, n] = x(S), [, l] = x(k), h = () => {
41
- H(s, "blocks") ? m(R(s.blocks), f(u)) : d(s, f(u)), l(!1), n("layers");
42
- }, [, p, a] = M(() => ({
43
- type: "CHAI_BLOCK",
44
- item: s
45
- }));
46
- return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
47
- /* @__PURE__ */ e.jsx(
48
- E,
49
- {
50
- connect: a,
51
- src: "https://placehold.co/100x30/000000/FFF?text=" + (c || r).replace(/ /g, "+")
52
- }
53
- ),
54
- /* @__PURE__ */ e.jsxs(re, { children: [
55
- /* @__PURE__ */ e.jsx(oe, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
56
- "button",
57
- {
58
- onClick: h,
59
- type: "button",
60
- ref: p,
61
- className: "cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",
62
- children: [
63
- z(t || ne, { className: "w-4 h-4 mx-auto" }),
64
- /* @__PURE__ */ e.jsx("p", { className: "truncate text-xs", children: c || r })
65
- ]
66
- }
67
- ) }),
68
- /* @__PURE__ */ e.jsx(te, { children: /* @__PURE__ */ e.jsx("p", { children: c || r }) })
69
- ] })
70
- ] });
71
- }, Ie = ({ block: s, closePopover: r }) => {
72
- var a;
73
- const [t, c] = g(!1), d = le("getExternalPredefinedBlock"), { addCoreBlock: m, addPredefinedBlock: u } = I(), [n] = w(), [, l, h] = M(
74
- () => ({
75
- type: "CHAI_BLOCK",
76
- item: s
77
- }),
78
- [s]
79
- ), p = G(
80
- async (b) => {
81
- if (b.stopPropagation(), H(s, "component")) {
82
- m(s, f(n)), r();
83
- return;
84
- }
85
- c(!0);
86
- const o = await d(s);
87
- N(o) || u(R(o), f(n)), r();
88
- },
89
- [s]
90
- );
91
- return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
92
- /* @__PURE__ */ e.jsx(
93
- E,
94
- {
95
- connect: h,
96
- src: "https://placehold.co/100x30/000000/FFF?text=" + ((a = s.name || s.label) == null ? void 0 : a.replace(" ", "+"))
97
- }
98
- ),
99
- /* @__PURE__ */ e.jsxs(
100
- "div",
101
- {
102
- ref: l,
103
- onClick: t ? () => {
104
- } : p,
105
- className: "relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",
106
- children: [
107
- t && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70", children: [
108
- /* @__PURE__ */ e.jsx(he, { className: "animate-spin", size: 15, color: "white" }),
109
- " ",
110
- /* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
111
- ] }),
112
- s.preview ? /* @__PURE__ */ e.jsx("img", { src: s.preview, className: "min-h-[50px] w-full rounded-md border border-gray-300", alt: s.name }) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: s.name }) })
113
- ]
114
- }
115
- )
116
- ] });
117
- }, Le = () => {
118
- const { data: s, isLoading: r } = me(), t = O(), c = j(C(t), { category: "custom" }), d = v(c, "group"), m = v(s, "group"), [u, n] = g(null), l = D(() => q(d, m, (o, i) => {
119
- if (L(o) && L(i))
120
- return [...o, ...i];
121
- }), [d, m]), [, h] = x(k), [p, a] = g("Navbar"), b = V(l, p, []);
122
- return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full overflow-hidden py-2", children: [
123
- /* @__PURE__ */ e.jsx("ul", { className: "sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2", children: r ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
124
- /* @__PURE__ */ e.jsx("li", { className: "h-8 w-full animate-pulse bg-gray-200" }),
125
- /* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
126
- /* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
127
- /* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
128
- /* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" }),
129
- /* @__PURE__ */ e.jsx("li", { className: "mt-2 h-8 w-full animate-pulse bg-gray-200" })
130
- ] }) : y.Children.toArray(
131
- B(l, (o, i) => /* @__PURE__ */ e.jsx(
132
- "li",
133
- {
134
- onMouseOut: () => {
135
- clearTimeout(u), n(null);
136
- },
137
- onMouseEnter: () => {
138
- const _ = setTimeout(() => {
139
- a(i);
140
- }, 300);
141
- n(_);
142
- },
143
- onClick: () => a(i),
144
- className: fe(
145
- "-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",
146
- p === i ? "bg-blue-500 text-white" : " text-gray-700 hover:bg-foreground/10"
147
- ),
148
- children: i
149
- }
150
- ))
151
- ) }),
152
- /* @__PURE__ */ e.jsx("div", { className: "h-full w-full space-y-2 overflow-y-auto px-8", children: y.Children.toArray(
153
- b.map((o) => /* @__PURE__ */ e.jsx(Ie, { block: o, closePopover: () => h(!1) }))
154
- ) })
155
- ] });
156
- }, Pe = () => {
157
- const [s, r] = g(""), { addPredefinedBlock: t } = I(), [c] = w(), [, d] = x(ue), [, m] = x(S), [, u] = x(k), n = () => {
158
- const l = Ne(s);
159
- t([...l], f(c) || null), r(""), d(!1), m("layers"), u(!1);
160
- };
161
- return /* @__PURE__ */ e.jsxs(ge, { className: "border-border/0 p-0 shadow-none", children: [
162
- /* @__PURE__ */ e.jsxs(be, { className: "p-3", children: [
163
- /* @__PURE__ */ e.jsx(je, { children: "Import HTML" }),
164
- /* @__PURE__ */ e.jsx(ye, { children: "Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported." })
165
- ] }),
166
- /* @__PURE__ */ e.jsx(we, { className: "space-y-2 px-3 py-0", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
167
- /* @__PURE__ */ e.jsx(Be, { htmlFor: "current", className: "text-sm", children: "Enter HTML Code:" }),
168
- /* @__PURE__ */ e.jsx(
169
- ke,
170
- {
171
- autoFocus: !0,
172
- tabIndex: 1,
173
- ref: (l) => l && l.focus(),
174
- defaultValue: s,
175
- onChange: (l) => r(l.target.value),
176
- rows: 12,
177
- placeholder: `<div>
178
- <h1>Enter code here</h1>
179
- </div>`,
180
- className: "resize-none overflow-x-auto whitespace-pre font-mono font-normal"
181
- }
182
- )
183
- ] }) }),
184
- /* @__PURE__ */ e.jsxs(Te, { className: "flex flex-col justify-end p-3", children: [
185
- /* @__PURE__ */ e.jsx(ae, { disabled: s.trim() === "", onClick: () => n(), size: "sm", className: "w-full", children: "Import" }),
186
- /* @__PURE__ */ e.jsxs(Ce, { variant: "default", className: "mt-2 p-1 text-blue-400", children: [
187
- /* @__PURE__ */ e.jsx(ie, { className: "h-4 w-4" }),
188
- /* @__PURE__ */ e.jsx(ve, { className: "text-sm leading-4", children: "Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page." })
189
- ] })
190
- ] })
191
- ] });
192
- }, Fe = Pe, F = ["ListItem", "TableHead", "TableBody", "TableRow", "TableCell", "Column"], He = (s, r) => {
193
- if (!s)
194
- return !A(F, r);
195
- const t = s._type;
196
- return t === "List" ? r === "ListItem" : t === "Table" ? r === "TableHead" || r === "TableBody" : t === "TableHead" || t === "TableBody" ? r === "TableRow" : t === "TableRow" ? r === "TableCell" : t === "Row" ? r === "Column" : !A(F, r);
197
- }, bs = () => {
198
- const [s, r] = g("core"), [t, c] = g("basic"), d = O(), [, m] = x(pe), [, u] = x(k), [n] = w(), l = xe(), h = W(l, { _id: f(n) }), p = v(
199
- j(d, (o) => He(h, o.type)),
200
- "category"
201
- ), a = $(B(p.core, "group"));
202
- U(() => {
203
- !A(a, t) && !N(a) && !N(t) && c(f(a));
204
- }, [a, t]);
205
- const b = (o) => c((i) => i === o ? "" : o);
206
- return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
207
- /* @__PURE__ */ e.jsxs("div", { className: "mb-2 flex justify-between rounded-md bg-background/30 p-1", children: [
208
- /* @__PURE__ */ e.jsxs("h1", { className: "flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row", children: [
209
- "Add block",
210
- /* @__PURE__ */ e.jsx("span", { className: "p-0 text-xs font-light leading-3 opacity-80 xl:pl-1", children: s === "html" ? "(Enter or paste your own HTML code)" : "(Drag & drop into tree view or click to add)" })
211
- ] }),
212
- /* @__PURE__ */ e.jsxs(
213
- "button",
214
- {
215
- onClick: () => u(!1),
216
- className: "flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",
217
- children: [
218
- /* @__PURE__ */ e.jsx(de, { width: 12 }),
219
- " Close"
220
- ]
221
- }
222
- )
223
- ] }),
224
- /* @__PURE__ */ e.jsx(
225
- ee,
226
- {
227
- onValueChange: (o) => {
228
- m(""), r(o);
229
- },
230
- value: s,
231
- className: "h-max",
232
- children: /* @__PURE__ */ e.jsxs(se, { className: "grid w-full grid-cols-3", children: [
233
- /* @__PURE__ */ e.jsx(T, { value: "core", children: "Core" }),
234
- /* @__PURE__ */ e.jsx(T, { value: "ui-blocks", children: "UI Blocks" }),
235
- /* @__PURE__ */ e.jsx(T, { value: "html", children: "Import" })
236
- ] })
237
- }
238
- ),
239
- s === "core" && /* @__PURE__ */ e.jsx(Z, { className: "-mx-1.5 h-full", children: /* @__PURE__ */ e.jsx(J, { type: "single", value: t, className: "w-full px-3", children: y.Children.toArray(
240
- B(
241
- a,
242
- (o) => P(j(C(p.core), { group: o }), {
243
- hidden: !0
244
- }).length ? /* @__PURE__ */ e.jsxs(Q, { value: o, className: "border-border", children: [
245
- /* @__PURE__ */ e.jsx(X, { onClick: () => b(o), className: "py-2 capitalize", children: o }),
246
- /* @__PURE__ */ e.jsx(Y, { children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 gap-2", children: y.Children.toArray(
247
- P(j(C(p.core), { group: o }), { hidden: !0 }).map((i) => /* @__PURE__ */ e.jsx(Ae, { block: i }))
248
- ) }) })
249
- ] }) : null
250
- )
251
- ) }) }),
252
- s === "ui-blocks" && /* @__PURE__ */ e.jsx(K, { fallback: /* @__PURE__ */ e.jsx(ce, { className: "h-32 w-full" }), children: /* @__PURE__ */ e.jsx(Le, {}) }),
253
- s === "html" && /* @__PURE__ */ e.jsx(Fe, {})
254
- ] });
255
- };
256
- export {
257
- bs as default
258
- };
@@ -1,3 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("react"),s=require("lodash"),g=require("jotai"),k=require("./accordion-0afd8143.cjs"),C=require("./scroll-area-088530b9.cjs"),y=require("./tabs-860e37aa.cjs"),E=require("./useBuilderProp-5e57d0c8.cjs"),B=require("react-dnd"),v=require("@radix-ui/react-icons"),i=require("./index-aea5c557.cjs");require("react-i18next");const w=require("chaibuilder-blocks"),N=require("lucide-react"),q=require("./utils-3c452dd0.cjs"),f=require("./textarea-a338ede6.cjs"),I=require("./label-167415e5.cjs"),P=require("./html-to-json-d8ac554d.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("./CONTROLS-031e1de3.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-label");require("himalaya");const L=({block:t})=>{const{type:r,icon:l,label:d}=t,{addCoreBlock:m,addPredefinedBlock:p}=i.useAddBlock(),[j]=i.useSelectedBlockIds(),[,u]=g.useAtom(i.activePanelAtom),[,n]=g.useAtom(i.addBlocksModalAtom),b=()=>{s.has(t,"blocks")?p(w.syncBlocksWithDefaults(t.blocks),s.first(j)):m(t,s.first(j)),n(!1),u("layers")},[,h,c]=B.useDrag(()=>({type:"CHAI_BLOCK",item:t}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B.DragPreviewImage,{connect:c,src:"https://placehold.co/100x30/000000/FFF?text="+(d||r).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(E.Tooltip,{children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:b,type:"button",ref:h,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[a.createElement(l||v.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:d||r})]})}),e.jsxRuntimeExports.jsx(E.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:d||r})})]})]})},S=({block:t,closePopover:r})=>{var c;const[l,d]=a.useState(!1),m=E.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:p,addPredefinedBlock:j}=i.useAddBlock(),[u]=i.useSelectedBlockIds(),[,n,b]=B.useDrag(()=>({type:"CHAI_BLOCK",item:t}),[t]),h=a.useCallback(async R=>{if(R.stopPropagation(),s.has(t,"component")){p(t,s.first(u)),r();return}d(!0);const o=await m(t);s.isEmpty(o)||j(w.syncBlocksWithDefaults(o),s.first(u)),r()},[t]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B.DragPreviewImage,{connect:b,src:"https://placehold.co/100x30/000000/FFF?text="+((c=t.name||t.label)==null?void 0:c.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:n,onClick:l?()=>{}:h,className:"relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(N.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:t.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:t.name})})]})]})},M=()=>{const{data:t,isLoading:r}=i.useUILibraryBlocks(),l=w.useChaiBlocks(),d=s.filter(s.values(l),{category:"custom"}),m=s.groupBy(d,"group"),p=s.groupBy(t,"group"),[j,u]=a.useState(null),n=a.useMemo(()=>s.mergeWith(m,p,(o,x)=>{if(s.isArray(o)&&s.isArray(x))return[...o,...x]}),[m,p]),[,b]=g.useAtom(i.addBlocksModalAtom),[h,c]=a.useState("Navbar"),R=s.get(n,h,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("ul",{className:"sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2",children:r?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("li",{className:"h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"})]}):a.Children.toArray(s.map(n,(o,x)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(j),u(null)},onMouseEnter:()=>{const A=setTimeout(()=>{c(x)},300);u(A)},onClick:()=>c(x),className:q.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",h===x?"bg-blue-500 text-white":" text-gray-700 hover:bg-foreground/10"),children:x})))}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-8",children:a.Children.toArray(R.map(o=>e.jsxRuntimeExports.jsx(S,{block:o,closePopover:()=>b(!1)})))})]})},F=()=>{const[t,r]=a.useState(""),{addPredefinedBlock:l}=i.useAddBlock(),[d]=i.useSelectedBlockIds(),[,m]=g.useAtom(i.addBlockOffCanvasAtom),[,p]=g.useAtom(i.activePanelAtom),[,j]=g.useAtom(i.addBlocksModalAtom),u=()=>{const n=P.getBlocksFromHTML(t);l([...n],s.first(d)||null),r(""),m(!1),p("layers"),j(!1)};return e.jsxRuntimeExports.jsxs(f.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(f.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(f.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(f.CardDescription,{children:"Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported."})]}),e.jsxRuntimeExports.jsx(f.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(I.Label,{htmlFor:"current",className:"text-sm",children:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(f.Textarea,{autoFocus:!0,tabIndex:1,ref:n=>n&&n.focus(),defaultValue:t,onChange:n=>r(n.target.value),rows:12,placeholder:`<div>
2
- <h1>Enter code here</h1>
3
- </div>`,className:"resize-none overflow-x-auto whitespace-pre font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(f.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(E.Button,{disabled:t.trim()==="",onClick:()=>u(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(f.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(v.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(f.AlertTitle,{className:"text-sm leading-4",children:"Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})]})]})]})},H=F,T=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],D=(t,r)=>{if(!t)return!s.includes(T,r);const l=t._type;return l==="List"?r==="ListItem":l==="Table"?r==="TableHead"||r==="TableBody":l==="TableHead"||l==="TableBody"?r==="TableRow":l==="TableRow"?r==="TableCell":l==="Row"?r==="Column":!s.includes(T,r)},O=()=>{const[t,r]=a.useState("core"),[l,d]=a.useState("basic"),m=w.useChaiBlocks(),[,p]=g.useAtom(i.showPredefinedBlockCategoryAtom),[,j]=g.useAtom(i.addBlocksModalAtom),[u]=i.useSelectedBlockIds(),n=i.useAllBlocks(),b=s.find(n,{_id:s.first(u)}),h=s.groupBy(s.filter(m,o=>D(b,o.type)),"category"),c=s.uniq(s.map(h.core,"group"));a.useEffect(()=>{!s.includes(c,l)&&!s.isEmpty(c)&&!s.isEmpty(l)&&d(s.first(c))},[c,l]);const R=o=>d(x=>x===o?"":o);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsxs("h1",{className:"flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row",children:["Add block",e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:t==="html"?"(Enter or paste your own HTML code)":"(Drag & drop into tree view or click to add)"})]}),e.jsxRuntimeExports.jsxs("button",{onClick:()=>j(!1),className:"flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",children:[e.jsxRuntimeExports.jsx(v.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(y.Tabs,{onValueChange:o=>{p(""),r(o)},value:t,className:"h-max",children:e.jsxRuntimeExports.jsxs(y.TabsList,{className:"grid w-full grid-cols-3",children:[e.jsxRuntimeExports.jsx(y.TabsTrigger,{value:"core",children:"Core"}),e.jsxRuntimeExports.jsx(y.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}),e.jsxRuntimeExports.jsx(y.TabsTrigger,{value:"html",children:"Import"})]})}),t==="core"&&e.jsxRuntimeExports.jsx(C.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(k.Accordion,{type:"single",value:l,className:"w-full px-3",children:a.Children.toArray(s.map(c,o=>s.reject(s.filter(s.values(h.core),{group:o}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(k.AccordionItem,{value:o,className:"border-border",children:[e.jsxRuntimeExports.jsx(k.AccordionTrigger,{onClick:()=>R(o),className:"py-2 capitalize",children:o}),e.jsxRuntimeExports.jsx(k.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:a.Children.toArray(s.reject(s.filter(s.values(h.core),{group:o}),{hidden:!0}).map(x=>e.jsxRuntimeExports.jsx(L,{block:x})))})})]}):null))})}),t==="ui-blocks"&&e.jsxRuntimeExports.jsx(a.Suspense,{fallback:e.jsxRuntimeExports.jsx(E.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(M,{})}),t==="html"&&e.jsxRuntimeExports.jsx(H,{})]})};exports.default=O;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-5c3ac4f7.cjs"),C=require("react"),q=require("@rjsf/validator-ajv8"),B=require("@rjsf/core"),_=require("./index-aea5c557.cjs");require("react-i18next");const j=require("./useBuilderProp-5e57d0c8.cjs"),e=require("chaibuilder-blocks");require("i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("jotai");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("./CONTROLS-031e1de3.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");function R(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(a,i,r.get?r:{enumerable:!0,get:()=>t[i]})}}return a.default=t,Object.freeze(a)}const c=R(C),v=[{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"}],P=()=>{const t=j.useBuilderProp("onSaveBrandingOptions",async()=>{}),[a,i]=_.useBrandingOptions(),r=c.useRef(a);c.useEffect(()=>()=>t(r.current),[r]);const p=({formData:l},u)=>{u&&(i(l),r.current=l)},{_bodyFont:g,_headingFont:b,_primaryColor:f,_bodyTextDarkColor:m,_bodyTextLightColor:y,_bodyBgDarkColor:x,_secondaryColor:h,_bodyBgLightColor:S,_roundedCorners:O}=a,s={_headingFont:e.SelectOption({title:"Heading font",default:b,options:v}),_bodyFont:e.SelectOption({title:"Body font",default:g,options:v}),_roundedCorners:e.Numeric({title:"Rounded Corner",default:parseInt(O||5,10)}),_primaryColor:e.Color({title:"Primary",default:f}),_secondaryColor:e.Color({title:"Secondary",default:h}),_bodyBgLightColor:e.Color({title:"Body Background (Light)",default:S}),_bodyBgDarkColor:e.Color({title:"Body Background (Dark)",default:x}),_bodyTextLightColor:e.Color({title:"Body Text (Light)",default:m}),_bodyTextDarkColor:e.Color({title:"Body Text (Dark)",default:y})},n={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const u=s[l];return n.properties||(n.properties={}),n.properties[l]=u.schema,d[l]=u.uiSchema,!0}),o.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[o.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:o.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),o.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:o.jsxRuntimeExports.jsx(B,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:n,formData:a,validator:q,onChange:p})})]})};exports.default=P;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),_=require("react-i18next"),x=require("./index-aea5c557.cjs"),v=require("./utils-3c452dd0.cjs"),m=require("react"),P=require("./CONTROLS-031e1de3.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),S=require("./useBuilderProp-5e57d0c8.cjs"),H=require("./scroll-area-088530b9.cjs"),L=require("jotai");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("chaibuilder-blocks");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");const w=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function V(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const F=s=>{let n="";return Object.keys(s).forEach(r=>{a.startsWith(s[r],P.STYLES_KEY)&&(n=s[r])}),n},z=s=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=s,{id:i,data:l}=s.node,d=s.depth*10,j=p=>{p.stopPropagation(),s.onToggle(s.node.id)},h=y.useDragOver(i,s.isOpen,s.onToggle),g=m.useMemo(()=>{const p=F(s.node.data);return V(p)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&s.onSelect(i)},onContextMenu:()=>s.onSelect(i),style:{paddingInlineStart:d},...h,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(w,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=s.node.data)==null?void 0:R._name)||s.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},G=s=>{var r;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(w,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},$=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},K=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-536770e7.cjs"))),Q=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},U=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Y=()=>{const[s]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},W=({id:s=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=S.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Y,{})]})},J=({children:s,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(K,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(W,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},X=()=>{const{addCoreBlock:s}=x.useAddBlock(),n=S.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return s({blocks:d},i===0?null:i,l)}return s(c,i===0?null:i,l)},[s])};function Z(s){return a.map(s,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const ee=()=>{const s=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=_.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),h=x.useExpandedIds(),g=X(),[,R]=L.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:f,dropTargetId:D,monitor:O}=E,A=Z(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:D,destinationIndex:k,relativeIndex:f}),R(!1))},T=a.map(s,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(s,{_parent:o._id})),data:o})),q=()=>{c([]),l([])},[{isOver:I},M]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:N}=B.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:()=>q(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",N?"bg-green-50/80":"bg-background"),children:[e.jsxRuntimeExports.jsx("div",{className:"mx-1 h-10 rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Tree view"})}),a.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(H.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:h,extraAcceptTypes:["CHAI_BLOCK"],tree:T,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(J,{id:o.id,children:e.jsxRuntimeExports.jsx(z,{onSelect:f=>{l([]),c([f])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx(G,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx($,{node:o,depth:E})})})]})})};exports.default=ee;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),u=require("react"),t=require("./useBuilderProp-5e57d0c8.cjs"),c=require("./index-aea5c557.cjs");require("react-i18next");const x=require("lodash");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("chaibuilder-blocks");require("./CONTROLS-031e1de3.cjs");const m=({id:i=null,closeModal:s})=>{const l=c.useMarkAsGlobalBlock(),[r,a]=u.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(o.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:n=>a(n.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(t.Button,{onClick:()=>{l(i,x.capitalize(r)),s()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(t.Button,{variant:"outline",onClick:s,children:"Cancel"})]})]})};exports.default=m;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),d=require("react"),_=require("@react-hookz/web"),r=require("lodash"),Q=require("react-i18next"),o=require("@radix-ui/react-icons"),M=require("./tabs-860e37aa.cjs"),ne=require("@rjsf/core"),le=require("@rjsf/validator-ajv8"),f=require("./index-aea5c557.cjs"),W=require("./link-43d13383.cjs"),ie=require("chaibuilder-blocks"),ae=require("jotai"),ue=require("react-autosuggest"),pe=require("fuse.js"),D=require("./Class-0801d193.cjs"),w=require("./useBuilderProp-5e57d0c8.cjs"),U=require("./label-167415e5.cjs"),de=require("./CONTROLS-031e1de3.cjs"),$=require("./accordion-0afd8143.cjs"),ce=require("./scroll-area-088530b9.cjs"),E=require("./select-0e32300c.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("react-icons-picker");require("react-dom");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("./ImagesPanel-160aa664.cjs");require("react-quill");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-label");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-select");function xe(s){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(l,t,n.get?n:{enumerable:!0,get:()=>s[t]})}}return l.default=s,Object.freeze(l)}const X=xe(d);function me(){const s=f.useSelectedBlock(),{createSnapshot:l}=f.useCanvasHistory(),t=f.useUpdateBlocksPropsRealtime(),[n]=f.useActiveLanguage(),i=ie.getBlockComponent(s._type),u=r.get(i,"props",{}),c={type:"object",properties:{_name:{title:"Name",type:"string",default:r.get(s,"_name",s._type)}}},p={};Object.keys(u).forEach(m=>{const j=u[m];if(r.includes(["slot","styles"],j.type))return;const b=r.get(j,"i18n",!1)?`${m}-${n}`:m;c.properties[b]=f.getBlockJSONFromSchemas(j,n),p[b]=f.getBlockJSONFromUISchemas(j,n)});const a={...s},h=({formData:m},j)=>{if(j){const b=j.replace("root.","");t([s._id],{[b]:r.get(m,b)})}},g=()=>{l()};return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(ne,{widgets:{richtext:W.RTEField,icon:W.IconPickerField,image:W.ImagePickerField},fields:{link:W.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!0,uiSchema:p,onBlur:g,schema:c,formData:a,validator:le,onChange:h}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const G=new pe(D.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function ge(){var N;const[s]=f.useSelectedStylingBlocks(),l=f.useSelectedBlock(),t=f.useAddClassesToBlocks(),n=f.useRemoveClassesFromBlocks(),[i]=f.useSelectedBlockIds(),[u,c]=d.useState(""),p=(N=r.first(s))==null?void 0:N.prop,a=r.reject((r.get(l,p,"").replace(de.STYLES_KEY,"").split(",").pop()||"").split(" "),r.isEmpty),h=()=>{const C=u.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");t(i,C,!0),c("")},[g,m]=d.useState([]),j=({value:C})=>{const B=C.trim().toLowerCase(),I=B.match(/.+:/g);let k=[];if(I&&I.length>0){const[H]=I,L=B.replace(H,"");k=G.search(L).map(x=>({...x,item:{...x.item,name:H+x.item.name}}))}else k=G.search(B);m(r.map(k,"item"))},b=()=>{m([])},y=C=>C.name,R=C=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:C.name}),V={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:u,onKeyDown:C=>{C.key==="Enter"&&u.trim()!==""&&h()},onChange:(C,{newValue:B})=>c(B),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"};return e.jsxRuntimeExports.jsxs("div",{className:`no-scrollbar flex ${g.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-5 overflow-y-auto bg-gray-100 px-px`,children:[e.jsxRuntimeExports.jsx(U.Label,{className:"mt-2",children:"Add Tailwind classes"}),e.jsxRuntimeExports.jsxs("div",{className:"relative -mt-4 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(ue,{suggestions:g,onSuggestionsFetchRequested:j,onSuggestionsClearRequested:b,getSuggestionValue:y,renderSuggestion:R,inputProps:V,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"bg-gray-700 ",suggestionsContainerOpen:"absolute bg-gray-100 z-50 max-h-[230px] overflow-y-auto w-full border border-gray-600 rounded-md"}})}),e.jsxRuntimeExports.jsx(w.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:h,disabled:u.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(o.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[r.isEmpty(a)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-10 w-full items-center justify-center text-center text-sm text-gray-400",children:"No class added"}),X.Children.toArray(a.map(C=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",children:[C,e.jsxRuntimeExports.jsx(o.Cross2Icon,{onClick:()=>n(i,[C]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},C)))]})]})}const T=["px","%","em","rem","ch","vh","vw"],he={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:T,property:"flexBasis"},{type:"range",label:"Order",property:"order"},{type:"dropdown",label:"Flex",property:"flexGrowShrink"},{type:"dropdown",label:"Grow",property:"flexGrow"},{type:"dropdown",label:"Shrink",property:"flexShrink"}]},ye={heading:"Grid Child",items:[{type:"range",label:"Col Span",property:"gridColSpan"},{type:"range",label:"Col Start",property:"gridColStart"},{type:"range",label:"Col End",property:"gridColEnd"},{type:"range",label:"Row Span",property:"gridRowSpan"},{type:"range",label:"Row Start",property:"gridRowStart"},{type:"range",label:"Row End",property:"gridRowEnd"},{type:"range",label:"Order",property:"order"}]},be=[{heading:"Display",items:[{type:"dropdown",label:"Display",property:"display",units:T},{styleType:"accordion",heading:"Flex options",items:[{type:"dropdown",label:"Direction",property:"flexDirection"},{type:"dropdown",label:"Wrap",property:"flexWrap"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"Grid options",items:[{type:"range",label:"Columns",property:"gridColumns"},{type:"range",label:"Rows",property:"gridRows"},{type:"dropdown",label:"Auto Flow",property:"gridAutoFlow"},{type:"dropdown",label:"Auto Cols",property:"gridAutoColumns"},{type:"dropdown",label:"Auto Rows",property:"gridAutoRows"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",units:["px","rem"],options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"Visibility & Opacity",items:[{type:"dropdown",label:"Visibility",property:"visibility",units:T},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...T,"auto"],options:[{key:"margin",label:"All"},{key:"marginX",label:"Left-Right"},{key:"marginY",label:"Top-Bottom"},{key:"marginTop",label:"Top"},{key:"marginRight",label:"Right"},{key:"marginBottom",label:"Bottom"},{key:"marginLeft",label:"Left"}]},{styleType:"multiple",label:"Padding",options:[{key:"padding",label:"All"},{key:"paddingX",label:"Left-Right"},{key:"paddingY",label:"Top-Bottom"},{key:"paddingTop",label:"Top"},{key:"paddingRight",label:"Right"},{key:"paddingBottom",label:"Bottom"},{key:"paddingLeft",label:"Left"}]},{styleType:"multiple",label:"Space Between",options:[{key:"spaceX",label:"Left-Right"},{key:"spaceY",label:"Top-Bottom"}]}]},{heading:"Size",items:[{type:"arbitrary",label:"Width",units:T.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:T.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:T.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:T.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:T.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:T.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"Object options & aspect ratio",items:[{type:"dropdown",label:"Aspect",property:"aspectRatio"},{type:"dropdown",label:"Fit",property:"objectFit"},{type:"dropdown",label:"Position",property:"objectPosition"}]}]},{heading:"Position",items:[{type:"icons",label:"Position",property:"position"},{styleType:"accordion",heading:"Position options",items:[{styleType:"multiple",label:"Direction",options:[{key:"top",label:"Top"},{key:"right",label:"Right"},{key:"bottom",label:"Bottom"},{key:"left",label:"Left"}]},{styleType:"multiple",label:"Inset",options:[{key:"inset",label:"All"},{key:"insetX",label:"Left Right"},{key:"insetY",label:"Top Bottom"}]},{type:"arbitrary",label:"Z-Chai",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"Float & Clear",items:[{type:"icons",label:"Float",property:"float"},{type:"dropdown",label:"Clear",property:"clear"}]},{styleType:"accordion",heading:"Overflow & Overscroll",items:[{styleType:"multiple",type:"dropdown",label:"Overflow",options:[{key:"overflow",label:"All"},{key:"overflowX",label:"Left-Right"},{key:"overflowY",label:"Top-Bottom"}]},{styleType:"multiple",type:"dropdown",label:"Overscroll",options:[{key:"overscroll",label:"All"},{key:"overscrollX",label:"Left-Right"},{key:"overscrollY",label:"Top-Bottom"}]}]}]},{heading:"Typography",items:[{type:"dropdown",property:"fontFamily",label:"Font"},{type:"arbitrary",property:"fontSize",label:"Size",units:T},{type:"arbitrary",property:"lineHeight",label:"Height",units:T.concat("-")},{type:"range",property:"fontWeight",label:"Weight"},{type:"color",property:"textColor",label:"Color"},{styleType:"accordion",heading:"Alignments",items:[{type:"dropdown",property:"textAlign",label:"Align"},{type:"dropdown",property:"verticalAlign",label:"V. Align"}]},{styleType:"accordion",heading:"Spacing, decoration & more",items:[{type:"dropdown",property:"letterSpacing",label:"Spacing"},{type:"dropdown",property:"textDecoration",label:"Decoration"},{type:"range",property:"textDecorationThickness",label:"Thickness"},{type:"dropdown",property:"textTransform",label:"Transform"}]},{styleType:"accordion",heading:"White space & breaks",items:[{type:"dropdown",property:"whitespace",label:"Whitespace"},{type:"dropdown",property:"wordBreak",label:"Wordbreak"}]}]},{heading:"Background",items:[{type:"color",label:"Bg. Color",property:"backgroundColor"},{styleType:"accordion",heading:"Position, Size & more",items:[{type:"dropdown",label:"Attachment",property:"backgroundAttachment"},{type:"dropdown",label:"Clipping",property:"backgroundClip"},{type:"dropdown",label:"Origin",property:"backgroundOrigin"},{type:"dropdown",label:"Position",property:"backgroundPosition"},{type:"dropdown",label:"Repeat",property:"backgroundRepeat"},{type:"dropdown",label:"Size",property:"backgroundSize"}]},{type:"dropdown",label:"Gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"Gradient colors",items:[{type:"color",label:"From",property:"fromColor"},{type:"color",label:"Via",property:"viaColor"},{type:"color",label:"To",property:"toColor"}]}]},{heading:"Border & Outline",items:[{styleType:"multiple",type:"dropdown",label:"Width",options:[{key:"border",label:"All"},{key:"borderX",label:"Left Right"},{key:"borderY",label:"Top bottom"},{key:"borderTop",label:"Top"},{key:"borderRight",label:"Right"},{key:"borderBottom",label:"Bottom"},{key:"borderLeft",label:"Left"}]},{styleType:"multiple",type:"dropdown",label:"Corners",options:[{key:"borderRadius",label:"All"},{key:"borderRadiusTop",label:"Top"},{key:"borderRadiusRight",label:"Right"},{key:"borderRadiusBottom",label:"Bottom"},{key:"borderRadiusLeft",label:"Left"},{key:"borderRadiusTopLeft",label:"Top Left"},{key:"borderRadiusTopRight",label:"Top right"},{key:"borderRadiusBottomRight",label:"Bottom right"},{key:"borderRadiusBottomLeft",label:"Bottom left"}]},{type:"color",label:"Color",property:"borderColor"},{type:"dropdown",label:"Style",property:"borderStyle"},{styleType:"accordion",heading:"Divide options",items:[{styleType:"multiple",type:"range",label:"Width",options:[{key:"divideXWidth",label:"Left Right"},{key:"divideYWidth",label:"Top Bottom"}]},{type:"color",label:"Color",property:"divideColor"},{type:"dropdown",label:"Style",property:"divideStyle"}]},{styleType:"accordion",heading:"Outline styling",items:[{type:"range",label:"Width",property:"outlineWidth"},{type:"range",label:"Offset",property:"outlineOffset"},{type:"dropdown",label:"Style",property:"outlineStyle"}]},{styleType:"accordion",heading:"Ring options",items:[{type:"range",label:"Width",property:"ringWidth"},{type:"color",label:"Color",property:"ringColor"},{type:"range",label:"Offset",property:"ringOffsetWidth"},{type:"color",label:"Off. color",property:"ringOffsetColor"}]}]},{heading:"Effect & Animation",items:[{type:"range",label:"Shadow",property:"boxShadow"},{type:"color",label:"Color",property:"boxShadowColor"},{type:"dropdown",label:"Cursor",property:"cursor"},{styleType:"accordion",heading:"Blend & Cursor",items:[{type:"dropdown",label:"Mix Blend",property:"mixBlendMode"},{type:"dropdown",label:"Bg. Blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"Transform",items:[{type:"dropdown",label:"Origin",property:"transformOrigin"},{styleType:"multiple",label:"Scale",units:["-"],options:[{key:"scale",label:"All"},{key:"scaleX",label:"Left-Right"},{key:"scaleY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Skew",units:["deg"],options:[{key:"skewX",label:"Left-Right"},{key:"skewY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Translate",negative:!0,options:[{key:"translateX",label:"Left-Right"},{key:"translateY",label:"Top-Bottom"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"Rotate",property:"rotate"}]},{styleType:"accordion",heading:"Animation",items:[{type:"dropdown",label:"Animation",property:"animation"},{type:"dropdown",label:"Transition",property:"transition"},{type:"dropdown",label:"Easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"Duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"Delay",property:"delay"}]}]},{heading:"Classes",items:[{component:ge}]}],ee={"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:o.EyeOpenIcon,invisible:o.EyeClosedIcon,hidden:o.EyeClosedIcon,gap:o.BorderAllIcon,gapX:o.WidthIcon,gapY:o.HeightIcon,spaceX:o.WidthIcon,spaceY:o.HeightIcon,overscroll:o.BorderAllIcon,overscrollX:o.WidthIcon,overscrollY:o.HeightIcon,overflow:o.BorderAllIcon,overflowX:o.WidthIcon,overflowY:o.HeightIcon,top:o.ArrowUpIcon,right:o.ArrowRightIcon,bottom:o.ArrowDownIcon,left:o.ArrowLeftIcon,inset:o.BorderAllIcon,insetX:o.WidthIcon,insetY:o.HeightIcon,border:o.BorderAllIcon,borderX:o.WidthIcon,borderY:o.HeightIcon,borderTop:o.ArrowUpIcon,borderRight:o.ArrowRightIcon,borderBottom:o.ArrowDownIcon,borderLeft:o.ArrowLeftIcon,borderRadius:o.BorderAllIcon,borderRadiusX:o.WidthIcon,borderRadiusY:o.HeightIcon,borderRadiusTop:o.ArrowUpIcon,borderRadiusRight:o.ArrowRightIcon,borderRadiusBottom:o.ArrowDownIcon,borderRadiusLeft:o.ArrowLeftIcon,borderRadiusTopLeft:o.ArrowTopLeftIcon,borderRadiusTopRight:o.ArrowTopRightIcon,borderRadiusBottomRight:o.ArrowBottomRightIcon,borderRadiusBottomLeft:o.ArrowBottomLeftIcon,divideXWidth:o.WidthIcon,divideYWidth:o.HeightIcon,scale:o.BorderAllIcon,scaleX:o.WidthIcon,scaleY:o.HeightIcon,skewX:o.WidthIcon,skewY:o.HeightIcon,translateX:o.WidthIcon,translateY:o.HeightIcon,padding:o.BorderAllIcon,paddingX:o.WidthIcon,paddingY:o.HeightIcon,paddingTop:o.ArrowUpIcon,paddingRight:o.ArrowRightIcon,paddingBottom:o.ArrowDownIcon,paddingLeft:o.ArrowLeftIcon,margin:o.BorderAllIcon,marginX:o.WidthIcon,marginY:o.HeightIcon,marginTop:o.ArrowUpIcon,marginRight:o.ArrowRightIcon,marginBottom:o.ArrowDownIcon,marginLeft:o.ArrowLeftIcon,textLeft:o.AlignLeftIcon,textCenter:o.AlignCenterHorizontallyIcon,textRight:o.AlignRightIcon,textJustify:o.StretchHorizontallyIcon,italic:o.FontItalicIcon,underline:o.UnderlineIcon,overline:o.OverlineIcon,uppercase:o.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":o.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:o.Cross1Icon},q=d.createContext({canReset:!1,canChange:!0}),fe=({children:s,canReset:l=!1,canChange:t=!0})=>e.jsxRuntimeExports.jsx(q.Provider,{value:{canReset:l,canChange:t},children:s}),te=({label:s,property:l,onChange:t})=>{const n=d.useMemo(()=>r.get(D.CLASSES_LIST,`${l}.classes`,[""]),[l]),i=P(l),u=d.useMemo(()=>r.get(i,"cls",""),[i]),{canChange:c}=d.useContext(q),p=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded ":"grow",children:p?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(W.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:u}),e.jsxRuntimeExports.jsxs(w.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.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(o.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(Z,{rounded:s,onChange:a=>t(a,l),selected:u,options:n,disabled:!c})})};function Z({selected:s,onChange:l,rounded:t=!1,options:n,disabled:i=!1}){const u=s.replace(/.*:/g,"").trim(),{undo:c,redo:p}=f.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!n.length||i,className:`${t?"rounded-md border border-border":"border-0"} w-full disable:bg-gray-500 h-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:a=>l(a.target.value),onKeyDown:a=>{a.ctrlKey&&(a.key==="z"&&c(),a.key==="y"&&p())},value:u,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),d.Children.toArray(n.map(a=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:a,children:a})))]})}const je=({property:s,onChange:l})=>{const{canReset:t,canChange:n}=d.useContext(q),i=P(s),u=d.useMemo(()=>r.get(i,"cls",""),[i]),c=d.useMemo(()=>r.get(D.CLASSES_LIST,`${s}.classes`,[""]),[s]),p=c.indexOf(u)>-1?c.indexOf(u):0,a=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:a?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:u}):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:!n&&(!t||p-1<0),onClick:()=>l(r.nth(c,p-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(o.MinusIcon,{className:!n&&(!t||p-1<0)?"text-gray-500":"text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(te,{label:!1,property:s,onChange:l})}),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:!n&&(!t||p+1>=c.length),onClick:()=>l(r.nth(c,p+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(o.PlusIcon,{className:!n&&(!t||p+1>=c.length)?"text-gray-500":"text-white/60"})})})]})})},ve=({property:s,onChange:l})=>{const t=d.useMemo(()=>r.get(D.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:n}=d.useContext(q),i=P(s),u=d.useMemo(()=>r.get(i,"cls",""),[i]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:r.map(t,c=>e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!n,onClick:()=>l(c,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${u===c?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:d.createElement(r.get(ee,c,o.BoxIcon))})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:r.startCase(r.toLower(c))})]}))})},Re={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},we=({property:s,onChange:l})=>{const t=P(s),n=d.useMemo(()=>r.get(t,"cls",""),[t]),{canChange:i}=d.useContext(q),[u,c]=d.useState([]),[p,a]=d.useState({color:"",shade:""}),h=n.split("-"),g=r.get(h,"1",""),m=r.get(h,"2",""),j=d.useCallback(y=>{["current","inherit","transparent","black","white"].includes(y)?(c([]),a({color:y})):(c(["50","100","200","300","400","500","600","700","800","900"]),a(R=>({...R,color:y,shade:R.shade?R.shade:"500"})))},[c,a]);d.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(g))return c([]);c(["50","100","200","300","400","500","600","700","800","900"])},[g]);const b=d.useCallback(y=>{a({color:g,shade:y})},[g]);return d.useEffect(()=>{a({color:"",shade:""})},[t]),d.useEffect(()=>{const R=`${r.get(Re,s,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;R.match(new RegExp(r.get(D.CLASSES_LIST,`${s}.regExp`,"")))&&l(R,s)},[p,l,s]),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(Z,{disabled:!i,rounded:!0,selected:g,onChange:j,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(Z,{rounded:!0,selected:m,disabled:!g||!i,onChange:b,options:u})})]})},K=(s,l)=>{s=s.toLowerCase();let t=s.trim().replace(/ |\+/g,"");if((t==="auto"||t==="none")&&l.includes(t))return{value:"",unit:t};const n=l.length?new RegExp(l.join("|"),"g"):/XXXXXX/g;t=t.replace(n,"");const i=s.match(n),u=i&&i.length>1,c=!r.isEmpty(t)&&Number.isNaN(Number(t));return u||c?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:t,unit:i?i[0]:""}},Ce=s=>{const l=s.startsWith("-")?"-":"",t=s.split("-").pop();if(["auto","none"].includes(t))return{value:"",unit:t};if(t==="px")return{value:"1",unit:"px"};if(t==="screen")return{value:"100",unit:s.indexOf("w-")!==-1?"vw":"vh"};if(t==="full")return{value:"100",unit:"%"};if(r.includes(s,"skew-"))return{value:`${l}${t}`,unit:"deg"};if(r.includes(s,"rotate-"))return{value:`${l}${t}`,unit:"deg"};if(r.includes(s,"opacity-"))return{value:`${t/100}`,unit:"-"};if(r.includes(s,"duration-")||r.includes(s,"delay-"))return{value:`${t}`,unit:"ms"};if(r.includes(s,"translate-")&&!t.includes("/"))return{value:`${l}${`${t/4}`}`,unit:"rem"};if(r.includes(s,"scale-"))return{value:`${l}${`${t/100}`}`,unit:"-"};if(r.startsWith(s,"border")){const n=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(n)return{value:n[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(r.startsWith(s,"max-w-")){if(s==="max-w-screen-sm")return{value:"640",unit:"px"};if(s==="max-w-screen-md")return{value:"768",unit:"px"};if(s==="max-w-screen-lg")return{value:"1024",unit:"px"};if(s==="max-w-screen-xl")return{value:"1280",unit:"px"};if(s==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(t==="xs")return{value:"320",unit:"px"};if(t==="sm")return{value:"384",unit:"px"};if(t==="md")return{value:"448",unit:"px"};if(t==="lg")return{value:"512",unit:"px"};if(t==="xl")return{value:"576",unit:"px"};if(t==="2xl")return{value:"672",unit:"px"};if(t==="3xl")return{value:"768",unit:"px"};if(t==="4xl")return{value:"896",unit:"px"};if(t==="5xl")return{value:"1024",unit:"px"};if(t==="6xl")return{value:"1152",unit:"px"};if(t==="7xl")return{value:"1280",unit:"px"};if(t==="prose")return{value:"65",unit:"ch"}}if(r.startsWith(s,"text-")){if(t==="xs")return{value:"12",unit:"px"};if(t==="sm")return{value:"14",unit:"px"};if(t==="base")return{value:"16",unit:"px"};if(t==="lg")return{value:"18",unit:"px"};if(t==="xl")return{value:"20",unit:"px"};if(t==="2xl")return{value:"24",unit:"px"};if(t==="3xl")return{value:"30",unit:"px"};if(t==="4xl")return{value:"36",unit:"px"};if(t==="5xl")return{value:"48",unit:"px"};if(t==="6xl")return{value:"60",unit:"px"};if(t==="7xl")return{value:"72",unit:"px"};if(t==="8xl")return{value:"96",unit:"px"};if(t==="9xl")return{value:"128",unit:"px"}}if(r.startsWith(s,"leading-")){if(t==="none")return{value:"1",unit:"-"};if(t==="tight")return{value:"1.25",unit:"-"};if(t==="snug")return{value:"1.375",unit:"-"};if(t==="normal")return{value:"1.5",unit:"-"};if(t==="relaxed")return{value:"1.625",unit:"-"};if(t==="loose")return{value:"2",unit:"-"}}if(r.startsWith(s,"tracking-")){if(t==="tighter")return{value:"-0.05",unit:"em"};if(t==="tight")return{value:"-0.025",unit:"em"};if(t==="normal")return{value:"0",unit:"em"};if(t==="wide")return{value:"0.025",unit:"em"};if(t==="wider")return{value:"0.05",unit:"em"};if(t==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(t))return{value:s,unit:"class"};if(t.includes("/")){const[n,i]=r.map(t.split("/"),u=>parseInt(u,10));return{value:l+(n/i*100).toFixed(2).replace(".00",""),unit:"%"}}return r.isNumber(parseFloat(t))?{value:`${l+parseFloat(t)*4}`,unit:"px"}:{value:t,unit:"class"}},Ee=s=>{if(r.isEmpty(s))return{value:"",unit:""};const l=s.match(/\[.*\]/g);if(l===null)return ke(s);const t=r.get(l,"0","").replace(/\[|\]/g,""),n=s.startsWith("-")?"-":"",i=r.first(t.match(/\d+.\d+|\d+/g));return{value:`${n}${i}`,unit:t.replace(i,"")}},ke=s=>r.isEmpty(s)?{value:"",unit:""}:Ce(s),re=d.createContext({setDragData:()=>{}}),Se=({unit:s,currentValue:l,onDrag:t,onDragEnd:n,onDragStart:i,negative:u,cssProperty:c})=>{const{setDragData:p}=d.useContext(re);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:a=>{const h={onDrag:t,onDragEnd:n,dragging:!0,dragStartY:a.pageY,dragStartValue:`${l}`,dragUnit:s,negative:u,cssProperty:c};i(h),p(h)},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(o.RowSpacingIcon,{})})},Te=({onSelect:s,current:l,units:t})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:t.map(n=>e.jsxRuntimeExports.jsx(w.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:l===n?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),s(n)},children:n},n))}),Ne=s=>{const[l,t]=d.useState(!1),[n,i]=d.useState(""),{currentClass:u,onChange:c,classPrefix:p,cssProperty:a,units:h,negative:g}=s,[m,j]=d.useState(a!=null&&a.toLowerCase().includes("width")?"%":h[0]),[b,y]=d.useState(!1),[R,V]=d.useState(""),[N,C]=d.useState(!1),[B,I]=d.useState(!1);d.useEffect(()=>{const{value:x,unit:v}=Ee(u);if(v===""){i(x),j(a!=null&&a.toLowerCase().includes("width")?"%":h[0]);return}j(v),i(v==="class"||r.isEmpty(x)?"":x)},[u,a,h]);const k=_.useThrottledCallback(x=>{c(x)},[c],200),H=_.useThrottledCallback(x=>{c(x,!1)},[c],200),L=d.useCallback((x=!1)=>{const v=K(`${n}`,h);if(r.get(v,"error",!1)){y(!0);return}const S=r.get(v,"unit")!==""?r.get(v,"unit"):m;if(S==="auto"||S==="none"){k(`${p}${S}`);return}if(r.get(v,"value")==="")return;const O=`${r.get(v,"value","").startsWith("-")?"-":""}${p}[${r.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;x?H(O):k(O)},[k,H,n,m,p,h]),F=d.useCallback(x=>{const v=K(`${n}`,h);if(r.get(v,"error",!1)){y(!0);return}if(x==="auto"||x==="none"){k(`${p}${x}`);return}if(r.get(v,"value")==="")return;const S=r.get(v,"unit")!==""?r.get(v,"unit"):x,O=`${r.get(v,"value","").startsWith("-")?"-":""}${p}[${r.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;k(O)},[k,n,p,h]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:m==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:u}),e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.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(o.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${N?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(m)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:m==="class",onKeyPress:x=>{x.key==="Enter"&&L()},onKeyDown:x=>{if(x.keyCode!==38&&x.keyCode!==40)return;x.preventDefault(),I(!0);const v=r.parseInt(x.target.value);let S=r.isNaN(v)?0:v;x.keyCode===38&&(S+=1),x.keyCode===40&&(S-=1);const A=`${S}`,oe=`${A.startsWith("-")?"-":""}${p}[${A.replace("-","")}${m==="-"?"":m}]`;H(oe)},onKeyUp:x=>{B&&(x.preventDefault(),I(!1))},onBlur:()=>L(),onChange:x=>{y(!1),i(x.target.value)},onClick:x=>{var v;(v=x==null?void 0:x.target)==null||v.select(),t(!1)},value:N?R:n,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(w.Tooltip,{open:l,delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>t(!l),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 ${h.length===1?"px-2 font-semibold":""}`,children:m}),h.length>1?e.jsxRuntimeExports.jsx(o.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(w.TooltipPortal,{children:e.jsxRuntimeExports.jsx(w.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Te,{units:h,current:m,onSelect:x=>{t(!1),j(x),F(x)}})})})]})]}),["none","auto"].indexOf(m)!==-1||N?null:e.jsxRuntimeExports.jsx(Se,{onDragStart:()=>C(!0),onDragEnd:x=>{if(V(()=>""),C(!1),r.isEmpty(x))return;const v=`${x}`,A=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${m==="-"?"":m}]`;k(A)},onDrag:x=>{if(r.isEmpty(x))return;V(x);const v=`${x}`,A=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${m==="-"?"":m}]`;H(A)},currentValue:n,unit:m,negative:g,cssProperty:a})]})})})},P=s=>{const l=f.useSelectedBlockCurrentClasses();return r.findLast(l,{property:s})},Ie=(s,l)=>{const t={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return t[r.get(s,"mq","xs")]<=t[l]},He={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-"},J={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Be=s=>`${s.toUpperCase()} ${J[s]?`(${J[s]} & up)`:""}`,z=s=>{const{type:l="icons",label:t,property:n,onEmitChange:i=()=>{},units:u,negative:c=!1}=s,[p]=f.useDarkMode(),[a]=f.useStylingState(),[,h]=f.useCanvasWidth(),g=P(n),m=f.useAddClassesToBlocks(),j=f.useRemoveClassesFromBlocks(),[b]=f.useSelectedBlockIds(),y=d.useMemo(()=>r.get(g,"fullCls",""),[g]),R=d.useCallback((k,H=!0)=>{const L={dark:p,mq:h,mod:a,cls:k,property:n,fullCls:""};(p||a!=="")&&(L.mq="xs");const F=D.generateFullClsName(L);m(b,[F],H)},[b,p,h,a,n,m]),V=d.useCallback(()=>{j(b,[y])},[b,y,j]),N=d.useMemo(()=>Ie(g,h),[g,h]);d.useEffect(()=>{i(N,g)},[N,i,g]);const[,,C]=f.useCanvasWidth(),B=d.useCallback(k=>{C({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[k])},[C]),I=r.get(g,"dark",null)===p&&r.get(g,"mod",null)===a&&r.get(g,"mq",null)===h;return e.jsxRuntimeExports.jsx(fe,{canChange:N,canReset:g&&I,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] ${g&&!I?"text-foreground":""}`,children:t})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[l==="arbitrary"?e.jsxRuntimeExports.jsx(Ne,{currentClass:r.get(g,"cls",""),classPrefix:r.get(He,n,""),units:u||[],onChange:R,negative:c,cssProperty:n}):null,l==="icons"&&e.jsxRuntimeExports.jsx(ve,{property:n,onChange:R}),l==="range"&&e.jsxRuntimeExports.jsx(je,{property:n,onChange:R}),l==="color"&&e.jsxRuntimeExports.jsx(we,{property:n,onChange:R}),l==="dropdown"&&e.jsxRuntimeExports.jsx(te,{label:t,property:n,onChange:R})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${y?"visible":"invisible"}`,children:I?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>V(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(o.TrashIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):N&&g?e.jsxRuntimeExports.jsxs(w.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.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(o.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(w.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:[Be(r.get(g,"mq")),p&&!g.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>B(r.get(g,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",r.get(g,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Ve=["px","%","em","rem","ch","vh","vw"],se=({label:s,options:l,borderB:t=!1,borderT:n=!1,type:i="arbitrary",units:u=Ve,negative:c=!1})=>{const[p,a]=d.useState(l[0].key),h=f.useSelectedBlockCurrentClasses(),g=d.useCallback(m=>r.map(h,"property").includes(m),[h]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${t?"border-b":""} ${n?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:s}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:d.Children.toArray(l.map(({label:m,key:j})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>a(j),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${j===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[d.createElement("div",{className:g(j)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),d.createElement(r.get(ee,j,o.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:r.startCase(r.toLower(m))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(z,{type:i,units:[...u],label:"",property:p,negative:c})})]})},Ae=({heading:s,items:l})=>{const t=f.useSelectedBlockCurrentClasses(),n=d.useMemo(()=>{const i=p=>r.flatten(p.map(a=>a.styleType==="multiple"?r.map(a.options,"key"):a.property)),u=r.flatten(l.map(p=>p.styleType==="accordion"?i(p.items):p.styleType==="multiple"?r.map(p.options,"key"):p.property)),c=r.map(t,"property");return r.intersection(u,c).length>0},[t,l]);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,n?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${n?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:l.map(i=>i.styleType==="multiple"?e.jsxRuntimeExports.jsx(se,{...i},i.label):e.jsxRuntimeExports.jsx(z,{...i},i.label))})]})},Le=d.createContext({}),Y=({section:s})=>{const l=f.useSelectedBlockCurrentClasses(),t=d.useCallback((u=[])=>{const c={};for(let a=0;a<l.length;a++)c[l[a].property]=l[a].cls;let p=!0;for(const a in u)if(!r.has(c,a)||c[a]!==u[a]){p=!1;break}return p},[l]),n=d.useMemo(()=>{if(l.length>0&&s.heading==="Classes")return!0;const u=a=>r.flatten(a.map(h=>h.styleType==="multiple"?r.flatten(r.map(h.options,"key")):h.property)),c=r.flatten(s.items.map(a=>a.styleType==="accordion"?u(a.items):a.styleType==="multiple"?r.flatten(r.map(a.options,"key")):a.property)),p=r.map(l,"property");return r.intersection(c,p).length>0},[l,s.heading,s.items]),i=d.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Le.Provider,{value:i,children:e.jsxRuntimeExports.jsxs($.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx($.AccordionTrigger,{className:"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 ${n?"bg-blue-500":"bg-gray-300"}`}),s.heading]})}),e.jsxRuntimeExports.jsx($.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:d.Children.toArray(s.items.map(u=>r.has(u,"component")?d.createElement(u.component,{key:u.label}):r.has(u,"styleType")?u.styleType==="multiple"?e.jsxRuntimeExports.jsx(se,{...u},u.label):u.styleType==="accordion"&&t(u==null?void 0:u.conditions)?e.jsxRuntimeExports.jsx(Ae,{...u},u.label):null:e.jsxRuntimeExports.jsx(z,{...u},u.label)))})]})})},$e=({item:s,index:l,canDelete:t,onChange:n,onRemove:i})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${t?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:u=>n(u,l),value:s.key,placeholder:"Key",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1.5",children:[e.jsxRuntimeExports.jsx("input",{name:"value",onChange:u=>r.isEmpty(s.key)?{}:n(u,l),value:s.value,placeholder:"Value",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsx(o.TrashIcon,{onClick:i,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),Me=({section:s})=>{var j;const{setSyncState:l}=f.useSavePage(),t=f.useSelectedBlock(),[n,i]=d.useState([]),[u]=f.useSelectedStylingBlocks(),c=f.useUpdateBlocksPropsRealtime(),p=`${r.get(u,"0.prop")}_attrs`;X.useEffect(()=>{const b=r.map(r.get(t,p),(y,R)=>({key:R,value:y}));r.isEmpty(b)?i([]):i(b)},[r.get(t,p)]);const a=()=>i([...n,{key:"",value:""}]),h=b=>{const y=r.filter(n,(R,V)=>b!==V);m(y)},g=(b,y)=>{const R=[...n];R[y][b.target.name]=b.target.value,m(R)},m=X.useCallback((b=[])=>{const y={};r.forEach(b,R=>{r.isEmpty(R.key)||r.set(y,R.key,R.value)}),c([r.get(t,"_id")],{[p]:y}),l("UNSAVED")},[t,l,c,p]);return e.jsxRuntimeExports.jsxs($.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx($.AccordionTrigger,{className:"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 ${r.isEmpty(r.get(t,p))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx($.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsxs(U.Label,{className:"mt-2 flex w-full items-center justify-between",children:["Add Custom attributes",e.jsxRuntimeExports.jsxs("div",{className:`flex h-6 w-max items-center justify-center gap-x-0.5 rounded-full border p-1 px-2 text-xs ${!r.isEmpty(n)&&r.isEmpty((j=r.last(n))==null?void 0:j.key)?"cursor-not-allowed border-gray-400 text-gray-400":"cursor-pointer border-blue-400 text-blue-400 hover:bg-blue-400 hover:text-white"}`,onClick:()=>{var b;!r.isEmpty(n)&&r.isEmpty((b=r.last(n))==null?void 0:b.key)||a()},children:[e.jsxRuntimeExports.jsx(o.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[r.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),X.Children.toArray(r.map(n,(b,y)=>{const R=n.length>0&&y<n.length-1;return e.jsxRuntimeExports.jsx($e,{item:b,index:y,canDelete:R,onChange:g,onRemove:()=>h(y)})}))]})]})})]})};function De(){const[s,l]=f.useStylingState(),{flexChild:t,gridChild:n}=f.useSelectedBlocksDisplayChild(),[,i]=ae.useAtom(f.advanceStylingOpenAtom),{t:u}=Q.useTranslation(),[c]=f.useSelectedStylingBlocks();return r.isEmpty(c)?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(o.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:u("no_styling_block_selected")}),e.jsxRuntimeExports.jsxs("p",{className:"text-xs ",children:["Hint: Styling allowed blocks are highlighted with"," ",e.jsxRuntimeExports.jsx("span",{className:"border border-orange-500 p-px",children:"orange"})," border"]})]})}):e.jsxRuntimeExports.jsxs("div",{onClick:()=>i(!1),className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-x-4 space-y-3 border-b border-border px-4 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-1.5",children:[e.jsxRuntimeExports.jsx(U.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(E.Select,{defaultValue:s,onValueChange:p=>l(p),children:[e.jsxRuntimeExports.jsx(E.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(E.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(E.SelectContent,{children:[e.jsxRuntimeExports.jsx(E.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(ce.ScrollArea,{className:"no-scrollbar -mx-1 h-full overflow-x-hidden",children:[e.jsxRuntimeExports.jsxs($.Accordion,{type:"multiple",className:"h-full w-full",children:[t&&e.jsxRuntimeExports.jsx(Y,{section:he}),n?e.jsxRuntimeExports.jsx(Y,{section:ye}):null,be.map(p=>e.jsxRuntimeExports.jsx(Y,{section:p},p.heading)),e.jsxRuntimeExports.jsx(Me,{section:{heading:"Attributes"}})]}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})}const Oe={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},We=()=>{const s=f.useSelectedBlock(),{t:l}=Q.useTranslation(),[t,n]=d.useState(""),[i,u]=d.useState({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),c=_.useThrottledCallback(a=>{const h=!r.get(i,"negative",!1),g=r.get(i,"cssProperty","");let m=parseFloat(i.dragStartValue);m=r.isNaN(m)?0:m;let j=Oe[i.dragUnit];(r.startsWith(g,"scale")||g==="opacity")&&(j=10);let y=(i.dragStartY-a.pageY)/j+m;h&&y<0&&(y=0),g==="opacity"&&y>1&&(y=1),i.onDrag(`${y}`),n(`${y}`)},[i],50),p=d.useCallback(()=>{setTimeout(()=>i.onDragEnd(`${t}`),100),u({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[i,t,u]);return r.isNull(s)?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(o.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:l("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsxs(re.Provider,{value:{setDragData:u},children:[i.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:c,onMouseUp:()=>{p()},className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10 "}):null,e.jsxRuntimeExports.jsxs(M.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(M.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(M.TabsTrigger,{value:"settings",children:"Settings"}),e.jsxRuntimeExports.jsx(M.TabsTrigger,{value:"styling",children:"Styling"})]}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"settings",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(me,{})}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"styling",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(De,{})})]})]})};exports.default=We;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),s=require("react"),m=require("jotai"),d=require("lodash"),i=require("./useBuilderProp-5e57d0c8.cjs"),j=require("./index-aea5c557.cjs");require("react-i18next");const g=require("./utils-3c452dd0.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("chaibuilder-blocks");require("./CONTROLS-031e1de3.cjs");require("clsx");require("tailwind-merge");const p=s.lazy(()=>Promise.resolve().then(()=>require("./Layers-3aa6aae7.cjs"))),y=s.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-c25f6370.cjs"))),q=s.lazy(()=>Promise.resolve().then(()=>require("./ImagesPanel-160aa664.cjs")));let h=null;const N=()=>{const u=i.useBuilderProp("sideBarComponents.top",[]),f=i.useBuilderProp("sideBarComponents.bottom",[]),[r,b]=m.useAtom(j.activePanelAtom),[E,x]=s.useState(r),[n,v]=s.useState(null),c={layers:p,"branding-options":y,images:q};d.each(u,({name:t,panel:a})=>{c[t]=a});const l=t=>{clearTimeout(h),r!=="layers"&&t==="layers"?h=setTimeout(()=>x("layers"),500):x(t),b(t)},[,R]=m.useAtom(j.addBlocksModalAtom);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[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:[e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>R(!0),size:"sm",variant:r==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(o.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>l("layers"),size:"sm",variant:r==="layers"?"default":"outline",children:e.jsxRuntimeExports.jsx(o.StackIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>l("branding-options"),size:"sm",variant:r==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(o.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),s.Children.toArray(u.map(({name:t,icon:a})=>e.jsxRuntimeExports.jsx(s.Suspense,{fallback:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>l(t),size:"sm",className:"w-10",variant:r===t?"default":"outline",children:e.jsxRuntimeExports.jsx(a,{})})})))]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center space-y-2",children:s.Children.toArray(f.map(t=>e.jsxRuntimeExports.jsx(s.Suspense,{fallback:e.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(t,{})})))})]}),e.jsxRuntimeExports.jsx("div",{onClick:()=>{l("layers")},className:"absolute inset-0 right-0 z-50 w-screen bg-black/20"+(r==="layers"?" hidden":"")}),e.jsxRuntimeExports.jsx("div",{className:`fixed left-14 z-[50] h-full w-96 border-r bg-background duration-500 ease-in-out ${r!=="layers"?"translate-x-0":"-translate-x-full"}`,children:e.jsxRuntimeExports.jsx(s.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:g.cn("relative h-full max-h-[93%] bg-background p-1",r==="layers"?"":"z-[100]"),onMouseEnter:()=>{n&&clearTimeout(n)},onMouseLeave:()=>{const t=setTimeout(()=>{n&&(l("layers"),clearTimeout(n))},1e3);v(t)},children:s.createElement(d.get(c,E,()=>e.jsxRuntimeExports.jsx("div",{})))})})}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(s.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:s.createElement(p)})})]})};exports.default=N;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),o=require("@radix-ui/react-icons"),s=require("./select-0e32300c.cjs"),r=require("./useBuilderProp-5e57d0c8.cjs"),u=require("./separator-a597dba7.cjs"),a=require("./toggle-b90fed97.cjs"),c=require("./index-aea5c557.cjs"),p=require("react-i18next");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("lodash");require("@radix-ui/react-separator");require("@radix-ui/react-toggle");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./Class-0801d193.cjs");require("redux-undo");require("@react-hookz/web");require("chaibuilder-blocks");require("./CONTROLS-031e1de3.cjs");const m=()=>r.useBuilderProp("languages",["en"]),j=()=>m().length===1?null:e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(s.Select,{children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-[150px] border-0",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.FontFamilyIcon,{className:"h-4 w-4"})," English(US)"]})})}),e.jsxRuntimeExports.jsx(s.SelectContent,{children:e.jsxRuntimeExports.jsxs(s.SelectGroup,{children:[e.jsxRuntimeExports.jsx(s.SelectLabel,{children:"Fruits"}),e.jsxRuntimeExports.jsx(s.SelectItem,{value:"apple",children:"Apple"}),e.jsxRuntimeExports.jsx(s.SelectItem,{value:"banana",children:"Banana"}),e.jsxRuntimeExports.jsx(s.SelectItem,{value:"blueberry",children:"Blueberry"}),e.jsxRuntimeExports.jsx(s.SelectItem,{value:"grapes",children:"Grapes"}),e.jsxRuntimeExports.jsx(s.SelectItem,{value:"pineapple",children:"Pineapple"})]})})]})}),d=()=>{const{savePage:x,syncState:t}=c.useSavePage(),{t:l}=p.useTranslation(),n=i.useMemo(()=>{switch(t){case"SAVING":return"animate-pulse bg-gray-500 text-gray-900";case"SAVED":return"bg-green-500 text-white hover:bg-green-600 hover:text-white";default:return"bg-gray-200 text-gray-500 hover:bg-gray-100"}},[t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs(r.Tooltip,{children:[e.jsxRuntimeExports.jsx(r.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(a.Toggle,{onClick:()=>x(),className:`flex h-auto w-20 items-center gap-x-1 rounded-full p-1 px-2 ${n}`,size:"sm",variant:"outline",children:[e.jsxRuntimeExports.jsx("svg",{fill:"currentColor",width:"16",height:"16",viewBox:"0 0 0.32 0.32",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M.274.086a.02.02 0 0 1 0 .028l-.12.12a.02.02 0 0 1-.028 0l-.06-.06A.02.02 0 0 1 .094.146L.14.192.246.086a.02.02 0 0 1 .028 0Z"})}),t==="SAVING"?"Saving...":t==="SAVED"?l("Saved"):"Save"]})}),e.jsxRuntimeExports.jsx(r.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t==="SAVING"?"Saving...":t==="SAVED"?"Saved":"Save changes"})})]})})},h=()=>{const x=r.useBuilderProp("topBarComponents.left",[]),t=r.useBuilderProp("topBarComponents.center",[]),l=r.useBuilderProp("topBarComponents.right",[]);return e.jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 font-bold",children:i.Children.toArray(x.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2",children:i.Children.toArray(t.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxRuntimeExports.jsx(j,{}),e.jsxRuntimeExports.jsx(u.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(d,{}),i.Children.toArray(l.map(n=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(n,{})})))]})]})};exports.default=h;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),t=require("react"),a=require("lodash"),m=require("@radix-ui/react-icons"),E=require("jotai"),q=require("./scroll-area-088530b9.cjs");require("react-i18next");const b=require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-scroll-area");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");const I=E.atom([]),w=({isModalView:r,onSelect:u})=>{const R=b.useBuilderProp("uploadMediaCallback",()=>""),x=b.useBuilderProp("fetchMediaCallback",()=>[]),[l,n]=E.useAtom(I),[o,p]=t.useState(!1),[j,f]=t.useState(!1),[c,d]=t.useState(),[h,v]=t.useState("");t.useEffect(()=>{(async()=>{f(!0);const s=await x();n(s||[]),f(!1)})()},[x,n]);const y=s=>{var i,g;s&&((g=(i=s==null?void 0:s.target)==null?void 0:i.files)==null?void 0:g.length)>0&&d(s.target.files[0])},N=async()=>{p(!0);try{const s=await R(c),i=await x();n(i),u(s),d(void 0)}catch(s){n([]),v((s==null?void 0:s.message)||"Something went wrong.")}p(!1)};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[c?e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center rounded-md border bg-slate-50 p-2 px-1",children:[e.jsxRuntimeExports.jsx("img",{src:URL.createObjectURL(c),alt:"",className:"h-auto w-full max-w-sm rounded-md"}),h&&e.jsxRuntimeExports.jsx("div",{className:"w-full pt-2 text-center text-sm text-red-500",children:h}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-center gap-2 pt-2",children:[e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:N,disabled:o,className:"flex items-center rounded-full bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 hover:text-white",children:[o?e.jsxRuntimeExports.jsx(m.GearIcon,{className:"animate-spin"}):e.jsxRuntimeExports.jsx(m.UploadIcon,{className:"animate-bounce"}),"  ",o?"Uploading...":"Upload"]}),!o&&e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center rounded-full border border-gray-300 px-3 py-1 text-sm hover:bg-gray-200",onClick:()=>d(void 0),children:[e.jsxRuntimeExports.jsx(m.Cross1Icon,{}),"  Cancel"]})]})]}):e.jsxRuntimeExports.jsxs("label",{htmlFor:r?"upload-in-modal":"upload-in-panel",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex w-full cursor-pointer flex-col items-center justify-center rounded-md border border-dashed border-blue-900 bg-gray-200 py-8 hover:bg-blue-50",children:[e.jsxRuntimeExports.jsx("div",{className:"text-3xl",children:"+"}),e.jsxRuntimeExports.jsx("div",{children:"Click to choose file"})]}),e.jsxRuntimeExports.jsx("input",{type:"file",id:r?"upload-in-modal":"upload-in-panel",hidden:!0,onChange:y})]}),e.jsxRuntimeExports.jsxs(q.ScrollArea,{className:`-mx-2 flex h-full flex-col pb-8 pt-2 ${r?"px-2":""} pt-2`,children:[a.isEmpty(l)&&j&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"animate-pulse font-medium",children:"Fetching..."})}),a.isEmpty(l)&&!j&&e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:e.jsxRuntimeExports.jsx("div",{className:"font-medium",children:"No Images"})}),r?e.jsxRuntimeExports.jsx("div",{className:"h-full columns-5 py-2",children:a.map(l,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"my-1 flex",onClick:()=>u(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto flex-1 cursor-pointer rounded-md transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))}):a.map(l,s=>e.jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,className:"px-2 py-1",onClick:()=>u(s.url),children:e.jsxRuntimeExports.jsx("div",{className:"relative overflow-hidden rounded-md bg-cover bg-no-repeat",children:e.jsxRuntimeExports.jsx("img",{className:"h-auto w-full cursor-pointer transition duration-300 ease-in-out hover:scale-105",alt:s.name,src:s.url})})},s.id))]})]})};exports.default=w;
@@ -1 +0,0 @@
1
- "use strict";const o=require("himalaya"),b=require("./Class-0801d193.cjs"),e=require("lodash"),T=require("./utils-3c452dd0.cjs"),u=require("./CONTROLS-031e1de3.cjs"),v={img:{alt:"_alt",width:"_width",height:"_height",src:"_image"},video:{src:"_url",autoplay:"_controls.autoPlay",muted:"_controls.muted",loop:"_controls.loop",controls:"_controls.widgets"},a:{href:"_link.href",target:"_link.target",type:""},input:{placeholder:"_placeholder",required:"_required",type:"_inputType",name:"_fieldName"},textarea:{placeholder:"_placeholder",required:"_required",type:"_inputType",name:"_fieldName"},select:{placeholder:"_placeholder",required:"_required",multiple:"_multiple",name:"_fieldName"}},N=(t,r)=>t.children.length===1&&e.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link"],r._type),g=t=>t.map(r=>r.type==="text"?e.get(r,"content",""):e.isEmpty(r.children)?"":g(r.children)).join(""),p=t=>t===null?!0:t,_=t=>{const r={},s=v[t.tagName]||{},a=t.attributes;return e.forEach(a,({key:l,value:c})=>{if(s[l]){if(t.tagName==="img"&&l==="src"&&!c.startsWith("http")){const i=e.find(t.attributes,{key:"width"}),n=e.find(t.attributes,{key:"height"});i&&n?c=`https://via.placeholder.com/${i==null?void 0:i.value}x${n==null?void 0:n.value}`:c="https://via.placeholder.com/150x150"}e.set(r,s[l],p(c))}else e.includes(["style","class","srcset"],l)||e.set(r,`_styles_attrs.${l}`,p(c))}),delete r.class,r},k=(t,r="_styles")=>{if(!t.attributes)return{[r]:`${u.STYLES_KEY},`};const s=e.find(t.attributes,{key:"class"});if(s){const a=s.value;return{[r]:`${u.STYLES_KEY},${a}`}}return{[r]:`${u.STYLES_KEY},`}},L=t=>{switch(t.tagName){case"img":return{_type:"Image"};case"input":return{_type:"Input",_showLabel:!1};case"hr":return{_type:"Divider"};case"br":return{_type:"LineBreak"};case"textarea":return{_type:"TextArea",_showLabel:!1};case"audio":return{_type:"Audio"};case"iframe":return{_type:"Iframe"};case"canvas":return{_type:"Canvas"};case"video":return{_type:"CustomHTML"};case"svg":return{_type:"Icon"};case"select":return{_type:"Select",_options:[]};case"option":return{_type:"Option"};case"ul":case"ol":case"dl":return{_type:"List",_tag:t.tagName,_listType:t.tagName==="ol"?"list-decimal":"list-none"};case"li":case"dt":return{_type:"ListItem",_tag:t.tagName};case"span":case"figcaption":case"legend":return{_type:"Span",_tag:t.tagName};case"p":return{_type:"Paragraph",_content:""};case"a":return{_type:"Link"};case"form":return{_type:"Form"};case"label":return{_type:"Label"};case"button":return{_type:"Button"};case"code":return{_type:"Code"};case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return{_type:"Heading",_tag:t.tagName};case"table":return{_type:"Table"};case"tr":return{_type:"TableRow"};case"td":case"th":return{_type:"TableCell",_tag:t.tagName};case"thead":return{_type:"TableHead"};case"tbody":return{_type:"TableBody"};case"tfoot":return{_type:"TableFooter"};default:return{_tag:t.tagName,_type:"Box",_name:t.tagName==="div"?"Box":e.capitalize(t.tagName)}}},y=(t,r=null)=>e.flatMapDeep(t,s=>{var c;if(s.type==="comment")return[];let a={_id:b.generateUUID()};if(r&&(a._parent=r.block._id),s.type==="text")return e.isEmpty(e.get(s,"content",""))?[]:r&&N(r.node,r.block)?(e.set(r,"block._content",e.get(s,"content","")),[]):{...a,_type:"Text",_content:e.get(s,"content","")};if(a={...a,...L(s),..._(s),...k(s)},a._type==="Input"){const i=a._inputType||"text";i==="checkbox"?e.set(a,"_type","Checkbox"):i==="radio"&&e.set(a,"_type","Radio")}else{if(s.tagName==="video")return a._content=o.stringify([s]),[a];if(s.tagName==="svg"){const i=e.find(s.attributes,{key:"height"}),n=e.find(s.attributes,{key:"width"}),h=e.get(i,"value")?`[${e.get(i,"value")}px]`:"full",m=e.get(n,"value")?`[${e.get(n,"value")}px]`:"full",f=e.get(e.find(s.attributes,{key:"class"}),"value");return a._styles=`${u.STYLES_KEY}, ${T.cn(`w-${m} h-${h}`,f)}`.trim(),s.attributes=e.filter(s.attributes,d=>!e.includes(["style","width","height","class"],d.key)),a._icon=o.stringify([s]),e.set(a,"_styles_attrs",e.omit(e.get(a,"_styles_attrs")||{},["height","width","style","class"])),[a]}else if(s.tagName=="option"&&r&&((c=r.block)==null?void 0:c._type)==="Select")return r.block._options.push({label:g(s.children),..._(s)}),[]}const l=y(s.children,{block:a,node:s});return[a,...l]}),S=t=>{const r=t.match(/<body[^>]*>[\s\S]*?<\/body>/);return(r&&r.length>0?r[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):t).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},x=t=>{const r=o.parse(S(t));return e.isEmpty(t)?[]:e.flatten(y(r))};exports.getBlocksFromHTML=x;