@chaibuilder/sdk 1.2.55 → 1.2.57

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 (94) hide show
  1. package/dist/{AddBlocks-HeYXoex4.js → AddBlocks-05ZH2Suu.js} +46 -50
  2. package/dist/AddBlocks-MH_fqSRf.cjs +1 -0
  3. package/dist/{CanvasArea-CqILE5PR.js → CanvasArea-8f_Ki3B7.js} +361 -361
  4. package/dist/CanvasArea-UisRL54b.cjs +56 -0
  5. package/dist/CodeEditor-vECReGwz.cjs +1 -0
  6. package/dist/{CodeEditor-kxV5RCpd.js → CodeEditor-zYBqhBv3.js} +33 -39
  7. package/dist/CurrentPage-7aEIhzQ0.cjs +1 -0
  8. package/dist/{CurrentPage-IrFGAb7n.js → CurrentPage-nzo4lszx.js} +26 -25
  9. package/dist/ListTree-A-097CZ-.cjs +1 -0
  10. package/dist/{ListTree-0n_G8NJx.js → ListTree-KUGhFsb_.js} +9 -13
  11. package/dist/PagesPanel-L1mI3y_6.cjs +1 -0
  12. package/dist/{PagesPanel-RYBf0Yct.js → PagesPanel-hleqqZBo.js} +20 -19
  13. package/dist/ProjectPanel-HTxa1kHv.cjs +1 -0
  14. package/dist/{ProjectPanel-Zagx6l3Q.js → ProjectPanel-RXEhYr0a.js} +25 -24
  15. package/dist/Settings-7EMwx6zL.cjs +1 -0
  16. package/dist/{Settings-RLDTFFf8.js → Settings-b1ZuIn4y.js} +404 -395
  17. package/dist/{SidePanels-ao969pMV.js → SidePanels-6hZeCR5Z.js} +89 -88
  18. package/dist/SidePanels-_6WlMWq_.cjs +1 -0
  19. package/dist/ThemeConfiguration-PvMN3j6h.cjs +1 -0
  20. package/dist/{ThemeConfiguration-S7yArRMp.js → ThemeConfiguration-ab7lbA2y.js} +18 -24
  21. package/dist/Topbar-WdGZIIZp.cjs +1 -0
  22. package/dist/{Topbar-B8u0whpc.js → Topbar-YfsC1DZ2.js} +39 -38
  23. package/dist/{UILibrariesPanel-tcfz2ELp.js → UILibrariesPanel-5QxxXYg2.js} +56 -61
  24. package/dist/UILibrariesPanel-r8nQzXQ-.cjs +1 -0
  25. package/dist/{UnsplashImages-wWRifkCp.js → UnsplashImages-alt_doTy.js} +42 -47
  26. package/dist/UnsplashImages-cah1BRL_.cjs +1 -0
  27. package/dist/UploadImages-5dRETWCo.cjs +1 -0
  28. package/dist/{UploadImages-lUvZhW_j.js → UploadImages-JqVL_aQd.js} +32 -38
  29. package/dist/{add-page-modal-04b4l2zu.js → add-page-modal-CtMwNEsW.js} +29 -28
  30. package/dist/add-page-modal-DA5P4pVu.cjs +1 -0
  31. package/dist/{confirm-alert-FX5030eR.js → confirm-alert-m85JJlQi.js} +15 -21
  32. package/dist/confirm-alert-rYsxlfR4.cjs +1 -0
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.js +44 -43
  35. package/dist/delete-page-modal-AvUZI9Tk.cjs +1 -0
  36. package/dist/{delete-page-modal-1u9CyAIP.js → delete-page-modal-TMpN1Dvm.js} +22 -21
  37. package/dist/email.cjs +1 -1
  38. package/dist/email.js +19 -19
  39. package/dist/form-G3PqS2Gc.cjs +1 -0
  40. package/dist/{form-HRdEJjVq.js → form-MSL4CDff.js} +3 -3
  41. package/dist/{html-to-json-OnIZDDXw.js → html-to-json-_01DXd-a.js} +37 -36
  42. package/dist/html-to-json-ndxaXRT8.cjs +1 -0
  43. package/dist/{index-vfmO3y2d.js → index--hN9ZQsP.js} +19 -19
  44. package/dist/index-0FIxW0gR.cjs +1 -0
  45. package/dist/{ChaiBuilderEditor-tkzS851D.js → index-IgLSTkN6.js} +14660 -17763
  46. package/dist/index-sspgZwTk.cjs +206 -0
  47. package/dist/index-uLn8W3eR.js +3145 -0
  48. package/dist/index-zaKhyTQ6.cjs +1 -0
  49. package/dist/lib.cjs +2 -2
  50. package/dist/lib.js +17 -16
  51. package/dist/page-viewer-2BMSxxfd.cjs +1 -0
  52. package/dist/{page-viewer-dcb3u4OV.js → page-viewer-D8nsi13f.js} +27 -26
  53. package/dist/project-general-setting--0hX9Otn.cjs +1 -0
  54. package/dist/{project-general-setting--sS34seu.js → project-general-setting-HGjTNFRx.js} +23 -22
  55. package/dist/{project-seo-setting-8tc3I-0M.js → project-seo-setting-3kFJ77jY.js} +20 -26
  56. package/dist/project-seo-setting-C3ilIIeM.cjs +1 -0
  57. package/dist/render.cjs +1 -1
  58. package/dist/render.js +104 -102
  59. package/dist/single-page-detail-7BpYAyMO.cjs +1 -0
  60. package/dist/{single-page-detail-tP2pfgBp.js → single-page-detail-eMnjt_Ih.js} +26 -25
  61. package/dist/studio.cjs +1 -1
  62. package/dist/studio.js +19 -18
  63. package/dist/ui.cjs +1 -1
  64. package/dist/ui.js +144 -150
  65. package/dist/web-blocks.cjs +1 -1
  66. package/dist/web-blocks.js +168 -111
  67. package/package.json +1 -1
  68. package/dist/AddBlocks-VHoZezjj.cjs +0 -1
  69. package/dist/CanvasArea-137WY3Wx.cjs +0 -56
  70. package/dist/ChaiBuilderEditor-aY8flOgX.cjs +0 -206
  71. package/dist/CodeEditor-R2jKe97T.cjs +0 -1
  72. package/dist/CurrentPage-PjrVzHXR.cjs +0 -1
  73. package/dist/ListTree-C6oCXZDV.cjs +0 -1
  74. package/dist/PagesPanel-lIC3kYmS.cjs +0 -1
  75. package/dist/ProjectPanel-0Siyi5YS.cjs +0 -1
  76. package/dist/Settings-6QRVcl16.cjs +0 -1
  77. package/dist/SidePanels-j1EFsBlK.cjs +0 -1
  78. package/dist/ThemeConfiguration-q1471P7b.cjs +0 -1
  79. package/dist/Topbar-ogFKKDbx.cjs +0 -1
  80. package/dist/UILibrariesPanel-cm9CFWxc.cjs +0 -1
  81. package/dist/UnsplashImages-E2L3YDJI.cjs +0 -1
  82. package/dist/UploadImages-s-eeaGiS.cjs +0 -1
  83. package/dist/add-page-modal-eroF20lO.cjs +0 -1
  84. package/dist/confirm-alert-XuxEzG-V.cjs +0 -1
  85. package/dist/delete-page-modal-pgh7sdfg.cjs +0 -1
  86. package/dist/form-Z4IRWj0o.cjs +0 -1
  87. package/dist/html-to-json-rauxDBi6.cjs +0 -1
  88. package/dist/index-bt7EhwLh.cjs +0 -1
  89. package/dist/page-viewer-O960kM2x.cjs +0 -1
  90. package/dist/project-general-setting-lIvNs-Vq.cjs +0 -1
  91. package/dist/project-seo-setting-MIlAuqcc.cjs +0 -1
  92. package/dist/single-page-detail-0Z_hvd_j.cjs +0 -1
  93. package/dist/useCanvasSettings-R0h03UfD.cjs +0 -1
  94. package/dist/useCanvasSettings-rEZHbw3s.js +0 -6
package/dist/email.js CHANGED
@@ -1,33 +1,25 @@
1
1
  import { j as i } from "./jsx-runtime-WbnYoNE9.js";
2
- import "./core.js";
2
+ import { C as p } from "./index-IgLSTkN6.js";
3
3
  import { MobileIcon as t } from "@radix-ui/react-icons";
4
- import { includes as p } from "lodash-es";
5
- import { C as e } from "./ChaiBuilderEditor-tkzS851D.js";
4
+ import { includes as e } from "lodash-es";
6
5
  import "./_commonjsHelpers-UyOWmZb0.js";
7
6
  import "react";
8
- import "react-i18next";
9
- import "clsx";
10
- import "react-dom";
11
- import "@radix-ui/react-scroll-area";
12
- import "@floating-ui/react-dom";
13
- import "jotai";
14
7
  import "i18next";
15
- import "flagged";
16
- import "./MODIFIERS-fd5XOmum.js";
17
- import "./Functions-7jnEwJyw.js";
18
- import "tailwind-merge";
19
- import "@chaibuilder/runtime";
20
- import "@react-hookz/web";
21
- import "tree-model";
22
- import "./utils-VpVqnC9m.js";
8
+ import "react-i18next";
9
+ import "./index-uLn8W3eR.js";
23
10
  import "@radix-ui/react-toggle";
24
11
  import "class-variance-authority";
12
+ import "./utils-VpVqnC9m.js";
13
+ import "./MODIFIERS-fd5XOmum.js";
14
+ import "clsx";
15
+ import "tailwind-merge";
25
16
  import "@radix-ui/react-switch";
26
17
  import "@radix-ui/react-slot";
27
18
  import "@radix-ui/react-accordion";
28
19
  import "@radix-ui/react-alert-dialog";
29
20
  import "@radix-ui/react-dialog";
30
21
  import "@radix-ui/react-label";
22
+ import "@radix-ui/react-scroll-area";
31
23
  import "@radix-ui/react-tabs";
32
24
  import "@radix-ui/react-tooltip";
33
25
  import "@radix-ui/react-popover";
@@ -40,7 +32,15 @@ import "@radix-ui/react-toast";
40
32
  import "cmdk";
41
33
  import "@radix-ui/react-context-menu";
42
34
  import "react-icons-picker";
35
+ import "react-dom";
43
36
  import "react-quill";
37
+ import "./Functions-7jnEwJyw.js";
38
+ import "@chaibuilder/runtime";
39
+ import "jotai";
40
+ import "@react-hookz/web";
41
+ import "tree-model";
42
+ import "@floating-ui/react-dom";
43
+ import "flagged";
44
44
  import "react-hotkeys-hook";
45
45
  import "lucide-react";
46
46
  import "./index-VBXQixVm.js";
@@ -62,12 +62,12 @@ const n = [
62
62
  ], ii = (o) => {
63
63
  const r = {
64
64
  ...o,
65
- filterChaiBlock: (m) => p(m.type, "Email/"),
65
+ filterChaiBlock: (m) => e(m.type, "Email/"),
66
66
  importHTMLSupport: !1,
67
67
  dataBindingSupport: !1,
68
68
  breakpoints: n
69
69
  };
70
- return /* @__PURE__ */ i.jsx(e, { ...r });
70
+ return /* @__PURE__ */ i.jsx(p, { ...r });
71
71
  };
72
72
  export {
73
73
  ii as ChaiBuilderEmail
@@ -0,0 +1 @@
1
+ "use strict";const f=require("./jsx-runtime-Z_BpKhVy.cjs"),y=require("@rjsf/core"),E=require("@rjsf/validator-ajv8"),i=require("lodash-es"),d=require("./index-0FIxW0gR.cjs"),h=(c,n="")=>{switch(c.type){case"singular":return c.uiSchema;case"model":const{properties:p}=c,u={};return Object.keys(p).forEach(r=>{const e=p[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${n}`:r;u[o]=h(e,n)}),u;case"list":const{itemProperties:m}=c,l={items:{}};return Object.keys(m).forEach(r=>{const e=m[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${n}`:r;l.items[o]=h(e,n)}),l;default:return{}}},x=(c,n="")=>{switch(c.type){case"singular":return c.schema;case"model":const{properties:p,title:u}=c,m={title:u,type:"object",properties:{}};return Object.keys(p).forEach(o=>{const t=p[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${n}`:o;m.properties[s]=x(t,n)}),m;case"list":const{itemProperties:l,title:r}=c,e={title:r,type:"array",items:{type:"object",properties:{}}};return Object.keys(l).forEach(o=>{const t=l[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${n}`:o;e.items.properties[s]=x(t,n),i.set(e.items,"title",i.get(t,"itemTitle",`${r} item`))}),e;default:return{}}},$=({title:c,properties:n={},formData:p,onChange:u,disabled:m=!1,activeLang:l=""})=>{const r={type:"object",properties:{}},e={};Object.keys(n).forEach(t=>{const s=n[t];if(i.includes(["slot","styles"],s.type))return;const a=i.get(s,"i18n",!1)?`${t}-${l}`:t;r.properties[a]=x(s,l),e[a]=h(s,l)});const o=({...t},s)=>{const a=s==null?void 0:s.replace("root.","").split("/").pop();if(!s||!a)return;const j=i.first(a.split("."));s&&j&&u({...t},j)};return f.jsxRuntimeExports.jsxs(f.jsxRuntimeExports.Fragment,{children:[c&&f.jsxRuntimeExports.jsx("h1",{className:"px-1 text-sm font-semibold underline",children:c}),f.jsxRuntimeExports.jsx("div",{className:"-mx-3",children:f.jsxRuntimeExports.jsx(y,{widgets:{richtext:d.RichTextEditorField,icon:d.IconPickerField,image:d.ImagePickerField},fields:{link:d.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:e,schema:r,formData:p,validator:E,onChange:o,disabled:m})})]})};exports.Form=$;
@@ -2,7 +2,7 @@ import { j as u } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import b from "@rjsf/core";
3
3
  import x from "@rjsf/validator-ajv8";
4
4
  import { includes as h, get as a, set as $, first as F } from "lodash-es";
5
- import { b0 as P, b1 as E, b2 as O, b3 as S } from "./ChaiBuilderEditor-tkzS851D.js";
5
+ import { bk as P, bl as E, bm as O, bn as S } from "./index-uLn8W3eR.js";
6
6
  const d = (i, l = "") => {
7
7
  switch (i.type) {
8
8
  case "singular":
@@ -66,7 +66,7 @@ const d = (i, l = "") => {
66
66
  default:
67
67
  return {};
68
68
  }
69
- }, C = ({
69
+ }, w = ({
70
70
  title: i,
71
71
  properties: l = {},
72
72
  formData: c,
@@ -121,5 +121,5 @@ const d = (i, l = "") => {
121
121
  ] });
122
122
  };
123
123
  export {
124
- C as F
124
+ w as F
125
125
  };
@@ -1,16 +1,17 @@
1
- import { stringify as m, parse as N } from "himalaya";
2
- import { g as k, c as L } from "./Functions-7jnEwJyw.js";
3
- import { isEmpty as g, includes as y, get as n, forEach as S, find as u, set as o, capitalize as $, flatMapDeep as A, filter as B, flatten as C } from "lodash-es";
1
+ import { stringify as y, parse as N } from "himalaya";
2
+ import { g as L, c as k } from "./Functions-7jnEwJyw.js";
3
+ import { isEmpty as m, includes as g, get as n, forEach as S, find as u, set as o, capitalize as $, flatMapDeep as A, filter as B, flatten as C } from "lodash-es";
4
4
  import { a as p } from "./MODIFIERS-fd5XOmum.js";
5
- const R = (t) => {
5
+ import { has as R, startsWith as E } from "lodash";
6
+ const M = (t) => {
6
7
  const e = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, a = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
7
8
  return e.test(t) || a.test(t);
8
- }, E = (t) => {
9
- if (g(t))
9
+ }, H = (t) => {
10
+ if (m(t))
10
11
  return t;
11
- const e = /<video[^>]+src=['"]([^'">]+)['"]/, a = /<iframe[^>]+src=['"]([^'">]+)['"]/, r = t.match(e), i = t.match(a), c = r ? r[1] : i ? i[1] : null, s = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, l = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
12
- return c && (s.test(c) || l.test(c)) ? c : t;
13
- }, b = "$name", M = {
12
+ const e = /<video[^>]+src=['"]([^'">]+)['"]/, a = /<iframe[^>]+src=['"]([^'">]+)['"]/, r = t.match(e), c = t.match(a), i = r ? r[1] : c ? c[1] : null, s = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, l = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
13
+ return i && (s.test(i) || l.test(i)) ? i : t;
14
+ }, b = "$name", I = {
14
15
  img: { alt: "alt", width: "width", height: "height", src: "image" },
15
16
  video: {
16
17
  src: "url",
@@ -43,22 +44,22 @@ const R = (t) => {
43
44
  multiple: "multiple",
44
45
  name: "fieldName"
45
46
  }
46
- }, H = (t, e) => t.children.length === 1 && y(["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link"], e._type), _ = (t) => t.map((e) => e.type === "text" ? n(e, "content", "") : g(e.children) ? "" : _(e.children)).join(""), h = (t) => t === null ? !0 : t, f = (t) => {
47
+ }, q = (t, e) => t.children.length === 1 && g(["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link"], e._type), _ = (t) => t.map((e) => e.type === "text" ? n(e, "content", "") : m(e.children) ? "" : _(e.children)).join(""), h = (t) => t === null ? "" : t, f = (t) => {
47
48
  if (t.tagName === "svg")
48
49
  return {};
49
- const e = {}, a = M[t.tagName] || {}, r = t.attributes;
50
- return S(r, ({ key: i, value: c }) => {
51
- if (i !== b)
52
- if (a[i]) {
53
- if (t.tagName === "img" && i === "src" && !c.startsWith("http")) {
50
+ const e = {}, a = I[t.tagName] || {}, r = t.attributes;
51
+ return S(r, ({ key: c, value: i }) => {
52
+ if (c !== b)
53
+ if (a[c]) {
54
+ if (t.tagName === "img" && c === "src" && !i.startsWith("http")) {
54
55
  const s = u(t.attributes, { key: "width" }), l = u(t.attributes, { key: "height" });
55
- s && l ? c = `https://via.placeholder.com/${s == null ? void 0 : s.value}x${l == null ? void 0 : l.value}` : c = "https://via.placeholder.com/150x150";
56
+ s && l ? i = `https://via.placeholder.com/${s == null ? void 0 : s.value}x${l == null ? void 0 : l.value}` : i = "https://via.placeholder.com/150x150";
56
57
  }
57
- o(e, a[i], h(c));
58
+ o(e, a[c], h(i));
58
59
  } else
59
- y(["style", "class", "srcset"], i) || o(e, `styles_attrs.${i}`, h(c));
60
+ g(["style", "class", "srcset"], c) || (R(e, "styles_attrs") || (e.styles_attrs = {}), E(c, "@") && (c = c.replace("@", "x-on:")), e.styles_attrs[`${c}`] = h(i));
60
61
  }), delete e.class, e;
61
- }, I = (t, e = "styles") => {
62
+ }, P = (t, e = "styles") => {
62
63
  if (!t.attributes)
63
64
  return { [e]: `${p},` };
64
65
  const a = u(t.attributes, { key: "class" });
@@ -67,7 +68,7 @@ const R = (t) => {
67
68
  return { [e]: `${p},${r}` };
68
69
  }
69
70
  return { [e]: `${p},` };
70
- }, q = (t) => {
71
+ }, U = (t) => {
71
72
  switch (t.tagName) {
72
73
  case "img":
73
74
  return { _type: "Image" };
@@ -148,17 +149,17 @@ const R = (t) => {
148
149
  };
149
150
  }
150
151
  }, d = (t, e = null) => A(t, (a) => {
151
- var c;
152
+ var i;
152
153
  if (a.type === "comment")
153
154
  return [];
154
- let r = { _id: k() };
155
+ let r = { _id: L() };
155
156
  if (e && (r._parent = e.block._id), a.type === "text")
156
- return g(n(a, "content", "")) ? [] : e && H(e.node, e.block) ? (o(e, "block.content", n(a, "content", "")), []) : { ...r, _type: "Text", content: n(a, "content", "") };
157
+ return m(n(a, "content", "")) ? [] : e && q(e.node, e.block) ? (o(e, "block.content", n(a, "content", "")), []) : { ...r, _type: "Text", content: n(a, "content", "") };
157
158
  if (r = {
158
159
  ...r,
159
- ...q(a),
160
+ ...U(a),
160
161
  ...f(a),
161
- ...I(a)
162
+ ...P(a)
162
163
  }, a.attributes) {
163
164
  const s = a.attributes.find((l) => l.key === b);
164
165
  s && (r._name = s.value);
@@ -167,25 +168,25 @@ const R = (t) => {
167
168
  const s = r.inputType || "text";
168
169
  s === "checkbox" ? o(r, "_type", "Checkbox") : s === "radio" && o(r, "_type", "Radio");
169
170
  } else if (a.tagName === "video" || a.tagName === "iframe") {
170
- const s = m([a]);
171
- return R(s) && (o(r, "_type", "Video"), o(r, "url", E(s)), o(r, "styles", `${p},absolute top-0 left-0 w-full h-full`), o(r, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), r.content = s, [r];
171
+ const s = y([a]);
172
+ return M(s) && (o(r, "_type", "Video"), o(r, "url", H(s)), o(r, "styles", `${p},absolute top-0 left-0 w-full h-full`), o(r, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), r.content = s, [r];
172
173
  } else if (a.tagName === "svg") {
173
174
  const s = u(a.attributes, { key: "height" }), l = u(a.attributes, { key: "width" }), v = n(s, "value") ? `[${n(s, "value")}px]` : "24px", T = n(l, "value") ? `[${n(l, "value")}px]` : "24px", x = n(u(a.attributes, { key: "class" }), "value", "w-full h-full");
174
- return r.styles = `${p}, ${L(`w-${T} h-${v}`, x)}`.trim(), a.attributes = B(a.attributes, (w) => !y(["style", "width", "height", "class"], w.key)), r.icon = m([a]), [r];
175
- } else if (a.tagName == "option" && e && ((c = e.block) == null ? void 0 : c._type) === "Select")
175
+ return r.styles = `${p}, ${k(`w-${T} h-${v}`, x)}`.trim(), a.attributes = B(a.attributes, (w) => !g(["style", "width", "height", "class"], w.key)), r.icon = y([a]), [r];
176
+ } else if (a.tagName == "option" && e && ((i = e.block) == null ? void 0 : i._type) === "Select")
176
177
  return e.block.options.push({
177
178
  label: _(a.children),
178
179
  ...f(a)
179
180
  }), [];
180
- const i = d(a.children, { block: r, node: a });
181
- return [r, ...i];
182
- }), P = (t) => {
181
+ const c = d(a.children, { block: r, node: a });
182
+ return [r, ...c];
183
+ }), z = (t) => {
183
184
  const e = t.match(/<body[^>]*>[\s\S]*?<\/body>/);
184
185
  return (e && e.length > 0 ? e[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : t).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
185
- }, D = (t) => {
186
- const e = N(P(t));
187
- return g(t) ? [] : C(d(e));
186
+ }, Z = (t) => {
187
+ const e = N(z(t));
188
+ return m(t) ? [] : C(d(e));
188
189
  };
189
190
  export {
190
- D as g
191
+ Z as g
191
192
  };
@@ -0,0 +1 @@
1
+ "use strict";const u=require("himalaya"),p=require("./Functions-N3yhPYKY.cjs"),r=require("lodash-es"),o=require("./MODIFIERS-mVmfEGgo.cjs"),g=require("lodash"),x=t=>{const e=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,s=/(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;return e.test(t)||s.test(t)},w=t=>{if(r.isEmpty(t))return t;const e=/<video[^>]+src=['"]([^'">]+)['"]/,s=/<iframe[^>]+src=['"]([^'">]+)['"]/,a=t.match(e),c=t.match(s),l=a?a[1]:c?c[1]:null,i=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,n=/(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;return l&&(i.test(l)||n.test(l))?l:t},h="$name",S={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"}},E=(t,e)=>t.children.length===1&&r.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link"],e._type),f=t=>t.map(e=>e.type==="text"?r.get(e,"content",""):r.isEmpty(e.children)?"":f(e.children)).join(""),y=t=>t===null?"":t,m=t=>{if(t.tagName==="svg")return{};const e={},s=S[t.tagName]||{},a=t.attributes;return r.forEach(a,({key:c,value:l})=>{if(c!==h)if(s[c]){if(t.tagName==="img"&&c==="src"&&!l.startsWith("http")){const i=r.find(t.attributes,{key:"width"}),n=r.find(t.attributes,{key:"height"});i&&n?l=`https://via.placeholder.com/${i==null?void 0:i.value}x${n==null?void 0:n.value}`:l="https://via.placeholder.com/150x150"}r.set(e,s[c],y(l))}else r.includes(["style","class","srcset"],c)||(g.has(e,"styles_attrs")||(e.styles_attrs={}),g.startsWith(c,"@")&&(c=c.replace("@","x-on:")),e.styles_attrs[`${c}`]=y(l))}),delete e.class,e},N=(t,e="styles")=>{if(!t.attributes)return{[e]:`${o.STYLES_KEY},`};const s=r.find(t.attributes,{key:"class"});if(s){const a=s.value;return{[e]:`${o.STYLES_KEY},${a}`}}return{[e]:`${o.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"canvas":return{_type:"Canvas"};case"video":case"iframe":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:const e=r.get(t,"children",[]).length>0?"Box":"EmptyBox";return{_type:e,tag:t.tagName,_name:e=="EmptyBox"||t.tagName==="div"?e:r.capitalize(t.tagName)}}},b=(t,e=null)=>r.flatMapDeep(t,s=>{var l;if(s.type==="comment")return[];let a={_id:p.generateUUID()};if(e&&(a._parent=e.block._id),s.type==="text")return r.isEmpty(r.get(s,"content",""))?[]:e&&E(e.node,e.block)?(r.set(e,"block.content",r.get(s,"content","")),[]):{...a,_type:"Text",content:r.get(s,"content","")};if(a={...a,...L(s),...m(s),...N(s)},s.attributes){const i=s.attributes.find(n=>n.key===h);i&&(a._name=i.value)}if(a._type==="Input"){const i=a.inputType||"text";i==="checkbox"?r.set(a,"_type","Checkbox"):i==="radio"&&r.set(a,"_type","Radio")}else if(s.tagName==="video"||s.tagName==="iframe"){const i=u.stringify([s]);return x(i)&&(r.set(a,"_type","Video"),r.set(a,"url",w(i)),r.set(a,"styles",`${o.STYLES_KEY},absolute top-0 left-0 w-full h-full`),r.set(a,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),a.content=i,[a]}else if(s.tagName==="svg"){const i=r.find(s.attributes,{key:"height"}),n=r.find(s.attributes,{key:"width"}),d=r.get(i,"value")?`[${r.get(i,"value")}px]`:"24px",_=r.get(n,"value")?`[${r.get(n,"value")}px]`:"24px",T=r.get(r.find(s.attributes,{key:"class"}),"value","w-full h-full");return a.styles=`${o.STYLES_KEY}, ${p.cn(`w-${_} h-${d}`,T)}`.trim(),s.attributes=r.filter(s.attributes,v=>!r.includes(["style","width","height","class"],v.key)),a.icon=u.stringify([s]),[a]}else if(s.tagName=="option"&&e&&((l=e.block)==null?void 0:l._type)==="Select")return e.block.options.push({label:f(s.children),...m(s)}),[];const c=b(s.children,{block:a,node:s});return[a,...c]}),k=t=>{const e=t.match(/<body[^>]*>[\s\S]*?<\/body>/);return(e&&e.length>0?e[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):t).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},$=t=>{const e=u.parse(k(t));return r.isEmpty(t)?[]:r.flatten(b(e))};exports.getBlocksFromHTML=$;
@@ -18,13 +18,13 @@ var c2 = (h, t, a, c) => ({
18
18
  import { j as r } from "./jsx-runtime-WbnYoNE9.js";
19
19
  import * as b from "react";
20
20
  import H0, { lazy as A2, useCallback as g2, useState as o2, Suspense as u0, useEffect as s0 } from "react";
21
- import "./core.js";
22
- import { FileTextIcon as p0, GearIcon as V0, EyeClosedIcon as f0, EyeOpenIcon as m0 } from "@radix-ui/react-icons";
23
- import { u as L0, B as Y2, A as x0, a as w0, b as B0, c as C0, d as O0, e as A0, f as S0, g as y0, h as b0, C as P0 } from "./ChaiBuilderEditor-tkzS851D.js";
21
+ import { C as p0 } from "./index-IgLSTkN6.js";
22
+ import { FileTextIcon as V0, GearIcon as f0, EyeClosedIcon as m0, EyeOpenIcon as L0 } from "@radix-ui/react-icons";
23
+ import { u as x0, B as Y2, A as w0, a as B0, b as C0, c as O0, d as A0, e as S0, f as y0, g as b0, h as P0 } from "./index-uLn8W3eR.js";
24
24
  import { toast as a1, Toaster as F0 } from "sonner";
25
25
  import { useTranslation as k0 } from "react-i18next";
26
26
  import { sortBy as R0, filter as D0, has as T0, set as E0, capitalize as N0, get as b2, omit as I0, size as P2 } from "lodash-es";
27
- import { g as W0 } from "./html-to-json-OnIZDDXw.js";
27
+ import { g as W0 } from "./html-to-json-_01DXd-a.js";
28
28
  import { Loader as U0, Loader2 as j0, LogOutIcon as Q0 } from "lucide-react";
29
29
  import { G as X2 } from "./index-VBXQixVm.js";
30
30
  var N1 = class {
@@ -1826,7 +1826,7 @@ const I = {
1826
1826
  }
1827
1827
  });
1828
1828
  }, A4 = () => {
1829
- const [h] = ["SAVED"], [t, a] = m1(), c = L0(), { t: i } = k0();
1829
+ const [h] = ["SAVED"], [t, a] = m1(), c = x0(), { t: i } = k0();
1830
1830
  return (v) => h !== "SAVED" ? (a1.error(i("You have unsaved changes. Please save before changing the page.")), !1) : t === v.uuid ? !1 : (c(), setTimeout(() => a(v.uuid), 100), !0);
1831
1831
  }, et = () => {
1832
1832
  const h = G(), t = A4(), a = R();
@@ -2016,19 +2016,19 @@ const D4 = () => {
2016
2016
  });
2017
2017
  }, I4 = ({ children: h }) => {
2018
2018
  const t = N4();
2019
- return /* @__PURE__ */ r.jsxs(x0, { children: [
2020
- /* @__PURE__ */ r.jsx(w0, { asChild: !0, children: h }),
2021
- /* @__PURE__ */ r.jsxs(B0, { children: [
2022
- /* @__PURE__ */ r.jsxs(C0, { children: [
2023
- /* @__PURE__ */ r.jsxs(O0, { children: [
2019
+ return /* @__PURE__ */ r.jsxs(w0, { children: [
2020
+ /* @__PURE__ */ r.jsx(B0, { asChild: !0, children: h }),
2021
+ /* @__PURE__ */ r.jsxs(C0, { children: [
2022
+ /* @__PURE__ */ r.jsxs(O0, { children: [
2023
+ /* @__PURE__ */ r.jsxs(A0, { children: [
2024
2024
  "Are you sure, you want to ",
2025
2025
  /* @__PURE__ */ r.jsx("span", { className: "text-red-500", children: "Sign Out" }),
2026
2026
  "?"
2027
2027
  ] }),
2028
- /* @__PURE__ */ r.jsx(A0, { children: "Kindly ensure that all your data is saved before proceeding with the sign-out process to prevent any potential loss of unsaved information" })
2028
+ /* @__PURE__ */ r.jsx(S0, { children: "Kindly ensure that all your data is saved before proceeding with the sign-out process to prevent any potential loss of unsaved information" })
2029
2029
  ] }),
2030
- /* @__PURE__ */ r.jsxs(S0, { children: [
2031
- /* @__PURE__ */ r.jsx(y0, { disabled: t.isPending, children: "Cancel" }),
2030
+ /* @__PURE__ */ r.jsxs(y0, { children: [
2031
+ /* @__PURE__ */ r.jsx(b0, { disabled: t.isPending, children: "Cancel" }),
2032
2032
  /* @__PURE__ */ r.jsxs(
2033
2033
  "button",
2034
2034
  {
@@ -2044,9 +2044,9 @@ const D4 = () => {
2044
2044
  ] })
2045
2045
  ] })
2046
2046
  ] });
2047
- }, W4 = () => /* @__PURE__ */ r.jsx(I4, { children: /* @__PURE__ */ r.jsx("button", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ r.jsx(Q0, { className: "w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300" }) }) }), U4 = A2(() => import("./PagesPanel-RYBf0Yct.js")), j4 = A2(() => import("./ProjectPanel-Zagx6l3Q.js")), Q4 = A2(() => import("./CurrentPage-IrFGAb7n.js")), K4 = () => /* @__PURE__ */ r.jsx("h2", { children: "Your Logo" }), G4 = () => {
2047
+ }, W4 = () => /* @__PURE__ */ r.jsx(I4, { children: /* @__PURE__ */ r.jsx("button", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ r.jsx(Q0, { className: "w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300" }) }) }), U4 = A2(() => import("./PagesPanel-hleqqZBo.js")), j4 = A2(() => import("./ProjectPanel-RXEhYr0a.js")), Q4 = A2(() => import("./CurrentPage-nzo4lszx.js")), K4 = () => /* @__PURE__ */ r.jsx("h2", { children: "Your Logo" }), G4 = () => {
2048
2048
  const { mutate: h } = y4();
2049
- return b0("editable", !0) ? /* @__PURE__ */ r.jsx(Y2, { onClick: h, className: "bg-blue-600 text-white", children: "Publish" }) : null;
2049
+ return P0("editable", !0) ? /* @__PURE__ */ r.jsx(Y2, { onClick: h, className: "bg-blue-600 text-white", children: "Publish" }) : null;
2050
2050
  }, q4 = (h) => {
2051
2051
  var f;
2052
2052
  const { data: t, isLoading: a } = z0(), { data: c, isLoading: i } = g0(), { data: v } = o0(), { mutate: n } = O4(), { mutate: g } = S4(), [s] = m1(), p = k4(), z = P4(), x = F4(), F = R(), H = g2(
@@ -2080,8 +2080,8 @@ const D4 = () => {
2080
2080
  },
2081
2081
  sideBarComponents: {
2082
2082
  top: [
2083
- { icon: p0, name: "pages", panel: U4 },
2084
- { icon: V0, name: "settings", panel: j4 },
2083
+ { icon: V0, name: "pages", panel: U4 },
2084
+ { icon: f0, name: "settings", panel: j4 },
2085
2085
  ...((f = h.sideBarComponents) == null ? void 0 : f.top) || []
2086
2086
  ],
2087
2087
  bottom: [W4]
@@ -2092,7 +2092,7 @@ const D4 = () => {
2092
2092
  getExternalPredefinedBlock: B,
2093
2093
  getPages: () => c
2094
2094
  };
2095
- return /* @__PURE__ */ r.jsx(P0, { ...O });
2095
+ return /* @__PURE__ */ r.jsx(p0, { ...O });
2096
2096
  }, _4 = ({ logo: h }) => {
2097
2097
  const [t, a] = o2(!1), [c, i] = o2(""), [v, n] = o2(""), { mutate: g, isPending: s } = T4(), p = (z) => {
2098
2098
  z.preventDefault(), g({ email: c, password: v });
@@ -2154,7 +2154,7 @@ const D4 = () => {
2154
2154
  type: "button",
2155
2155
  className: "absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",
2156
2156
  onClick: () => a(!t),
2157
- children: t ? /* @__PURE__ */ r.jsx(f0, {}) : /* @__PURE__ */ r.jsx(m0, {})
2157
+ children: t ? /* @__PURE__ */ r.jsx(m0, {}) : /* @__PURE__ */ r.jsx(L0, {})
2158
2158
  }
2159
2159
  )
2160
2160
  ] }) }),
@@ -0,0 +1 @@
1
+ "use strict";const r=require("./jsx-runtime-Z_BpKhVy.cjs"),R=require("react"),un=require("@radix-ui/react-toggle"),ce=require("class-variance-authority"),u=require("./utils-D_vtk3zK.cjs"),mn=require("@radix-ui/react-switch"),pn=require("@radix-ui/react-slot"),fn=require("@radix-ui/react-accordion"),Y=require("@radix-ui/react-icons"),xn=require("@radix-ui/react-alert-dialog"),gn=require("@radix-ui/react-dialog"),hn=require("@radix-ui/react-label"),bn=require("@radix-ui/react-scroll-area"),vn=require("@radix-ui/react-tabs"),yn=require("@radix-ui/react-tooltip"),jn=require("@radix-ui/react-popover"),kn=require("@radix-ui/react-menubar"),wn=require("@radix-ui/react-hover-card"),Rn=require("@radix-ui/react-select"),Cn=require("@radix-ui/react-dropdown-menu"),An=require("@radix-ui/react-separator"),Sn=require("@radix-ui/react-toast"),J=require("cmdk"),En=require("@radix-ui/react-context-menu"),jt=require("react-icons-picker"),Nn=require("react-dom"),l=require("lodash-es"),_n=require("react-quill"),ae=require("./Functions-N3yhPYKY.cjs"),Ae=require("@chaibuilder/runtime"),p=require("jotai"),X=require("./MODIFIERS-mVmfEGgo.cjs"),Bn=require("./_commonjsHelpers-wDK0ZLPo.cjs"),Pn=require("@react-hookz/web"),Tn=require("tree-model");require("react-i18next");function H(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const f=H(R),kt=H(un),Le=H(mn),le=H(fn),W=H(xn),I=H(gn),wt=H(hn),ie=H(bn),de=H(vn),fe=H(yn),he=H(jn),B=H(kn),Se=H(wn),q=H(Rn),D=H(Cn),Rt=H(An),Z=H(Sn),L=H(En);var $={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};let In=0;function ne(e,t){const s=`atom${++In}`,o={toString:()=>s};return typeof e=="function"?o.read=e:(o.init=e,o.read=n=>n(o),o.write=(n,a,i)=>a(o,typeof i=="function"?i(n(o)):i)),t&&(o.write=t),o}const Pe=e=>"init"in e,Te=e=>!!e.write,we=new WeakMap,Mn=(e,t)=>{we.set(e,t),e.catch(()=>{}).finally(()=>we.delete(e))},lt=(e,t)=>{const s=we.get(e);s&&(we.delete(e),s(t))},ct=(e,t)=>{e.status="fulfilled",e.value=t},dt=(e,t)=>{e.status="rejected",e.reason=t},Dn=e=>typeof(e==null?void 0:e.then)=="function",xe=(e,t)=>"v"in e&&"v"in t&&Object.is(e.v,t.v),ut=(e,t)=>"e"in e&&"e"in t&&Object.is(e.e,t.e),pe=e=>"v"in e&&e.v instanceof Promise,Ln=(e,t)=>"v"in e&&"v"in t&&e.v.orig&&e.v.orig===t.v.orig,ye=e=>{if("e"in e)throw e.e;return e.v},Ct=()=>{const e=new WeakMap,t=new WeakMap,s=new Map;let o,n,a;($?"production":void 0)!=="production"&&(o=new Set,n=new Set,a=new Set);const i=m=>e.get(m),d=(m,h)=>{($?"production":void 0)!=="production"&&Object.freeze(h);const y=e.get(m);if(e.set(m,h),s.has(m)||s.set(m,y),y&&pe(y)){const b="v"in h?h.v instanceof Promise?h.v:Promise.resolve(h.v):Promise.reject(h.e);lt(y.v,b)}},x=(m,h,y)=>{const b=new Map;let j=!1;y.forEach((v,A)=>{!v&&A===m&&(v=h),v?(b.set(A,v),h.d.get(A)!==v&&(j=!0)):($?"production":void 0)!=="production"&&console.warn("[Bug] atom state not found")}),(j||h.d.size!==b.size)&&(h.d=b)},c=(m,h,y)=>{const b=i(m),j={d:(b==null?void 0:b.d)||new Map,v:h};if(y&&x(m,j,y),b&&xe(b,j)&&b.d===j.d)return b;if(b&&pe(b)&&pe(j)&&Ln(b,j)){if(b.d===j.d)return b;j.v=b.v}return d(m,j),j},g=(m,h,y,b)=>{if(Dn(h)){let j;const v=new Promise((A,z)=>{let E=!1;h.then(T=>{if(!E){E=!0;const N=i(m),oe=c(m,v,y);ct(v,T),A(T),(N==null?void 0:N.d)!==oe.d&&U(m,oe,N==null?void 0:N.d)}},T=>{if(!E){E=!0;const N=i(m),oe=c(m,v,y);dt(v,T),z(T),(N==null?void 0:N.d)!==oe.d&&U(m,oe,N==null?void 0:N.d)}}),j=T=>{E||(E=!0,T.then(N=>ct(v,N),N=>dt(v,N)),A(T))}});return v.orig=h,v.status="pending",Mn(v,A=>{A&&j(A),b==null||b()}),c(m,v,y)}return c(m,h,y)},k=(m,h,y)=>{const b=i(m),j={d:(b==null?void 0:b.d)||new Map,e:h};return y&&x(m,j,y),b&&ut(b,j)&&b.d===j.d?b:(d(m,j),j)},C=m=>{const h=i(m);if(h&&(h.d.forEach((E,T)=>{T!==m&&!t.has(T)&&C(T)}),Array.from(h.d).every(([E,T])=>{const N=i(E);return E===m||N===T||N&&!pe(N)&&xe(N,T)})))return h;const y=new Map;let b=!0;const j=E=>{if(E===m){const N=i(E);if(N)return y.set(E,N),ye(N);if(Pe(E))return y.set(E,void 0),E.init;throw new Error("no atom init")}const T=C(E);return y.set(E,T),ye(T)};let v,A;const z={get signal(){return v||(v=new AbortController),v.signal},get setSelf(){return($?"production":void 0)!=="production"&&!Te(m)&&console.warn("setSelf function cannot be used with read-only atom"),!A&&Te(m)&&(A=(...E)=>{if(($?"production":void 0)!=="production"&&b&&console.warn("setSelf function cannot be called in sync"),!b)return M(m,...E)}),A}};try{const E=m.read(j,z);return g(m,E,y,()=>v==null?void 0:v.abort())}catch(E){return k(m,E,y)}finally{b=!1}},O=m=>ye(C(m)),w=m=>{let h=t.get(m);return h||(h=V(m)),h},S=(m,h)=>!h.l.size&&(!h.t.size||h.t.size===1&&h.t.has(m)),_=m=>{const h=t.get(m);h&&S(m,h)&&G(m)},F=m=>{const h=new Map,y=new WeakMap,b=v=>{const A=t.get(v);A==null||A.t.forEach(z=>{z!==v&&(h.set(z,(h.get(z)||new Set).add(v)),y.set(z,(y.get(z)||0)+1),b(z))})};b(m);const j=v=>{const A=t.get(v);A==null||A.t.forEach(z=>{var E;if(z!==v){let T=y.get(z);if(T&&y.set(z,--T),!T){let N=!!((E=h.get(z))!=null&&E.size);if(N){const oe=i(z),dn=C(z);N=!oe||!xe(oe,dn)}N||h.forEach(oe=>oe.delete(z))}j(z)}})};j(m)},P=(m,...h)=>{let y=!0;const b=A=>ye(C(A)),j=(A,...z)=>{let E;if(A===m){if(!Pe(A))throw new Error("atom not writable");const T=i(A),N=g(A,z[0]);(!T||!xe(T,N))&&F(A)}else E=P(A,...z);if(!y){const T=se();($?"production":void 0)!=="production"&&n.forEach(N=>N({type:"async-write",flushed:T}))}return E},v=m.write(b,j,...h);return y=!1,v},M=(m,...h)=>{const y=P(m,...h),b=se();return($?"production":void 0)!=="production"&&n.forEach(j=>j({type:"write",flushed:b})),y},V=(m,h)=>{const y={t:new Set(h&&[h]),l:new Set};if(t.set(m,y),($?"production":void 0)!=="production"&&a.add(m),C(m).d.forEach((b,j)=>{const v=t.get(j);v?v.t.add(m):j!==m&&V(j,m)}),C(m),Te(m)&&m.onMount){const b=m.onMount((...j)=>M(m,...j));b&&(y.u=b)}return y},G=m=>{var h;const y=(h=t.get(m))==null?void 0:h.u;y&&y(),t.delete(m),($?"production":void 0)!=="production"&&a.delete(m);const b=i(m);b?(pe(b)&&lt(b.v),b.d.forEach((j,v)=>{if(v!==m){const A=t.get(v);A&&(A.t.delete(m),S(v,A)&&G(v))}})):($?"production":void 0)!=="production"&&console.warn("[Bug] could not find atom state to unmount",m)},U=(m,h,y)=>{const b=new Set(h.d.keys());y==null||y.forEach((j,v)=>{if(b.has(v)){b.delete(v);return}const A=t.get(v);A&&(A.t.delete(m),S(v,A)&&G(v))}),b.forEach(j=>{const v=t.get(j);v?v.t.add(m):t.has(m)&&V(j,m)})},se=()=>{let m;for(($?"production":void 0)!=="production"&&(m=new Set);s.size;){const h=Array.from(s);s.clear(),h.forEach(([y,b])=>{const j=i(y);if(j){j.d!==(b==null?void 0:b.d)&&U(y,j,b==null?void 0:b.d);const v=t.get(y);v&&!(b&&!pe(b)&&(xe(b,j)||ut(b,j)))&&(v.l.forEach(A=>A()),($?"production":void 0)!=="production"&&m.add(y))}else($?"production":void 0)!=="production"&&console.warn("[Bug] no atom state to flush")})}if(($?"production":void 0)!=="production")return o.forEach(h=>h("state")),m},K=(m,h)=>{const y=w(m),b=se(),j=y.l;return j.add(h),($?"production":void 0)!=="production"&&(o.forEach(v=>v("sub")),n.forEach(v=>v({type:"sub",flushed:b}))),()=>{j.delete(h),_(m),($?"production":void 0)!=="production"&&(o.forEach(v=>v("unsub")),n.forEach(v=>v({type:"unsub"})))}};return($?"production":void 0)!=="production"?{get:O,set:M,sub:K,dev_subscribe_store:(m,h)=>h!==2?(console.warn("The current StoreListener revision is 2. The older ones are deprecated."),o.add(m),()=>{o.delete(m)}):(n.add(m),()=>{n.delete(m)}),dev_get_mounted_atoms:()=>a.values(),dev_get_atom_state:m=>e.get(m),dev_get_mounted:m=>t.get(m),dev_restore_atoms:m=>{for(const[y,b]of m)Pe(y)&&(g(y,b),F(y));const h=se();n.forEach(y=>y({type:"restore",flushed:h}))}}:{get:O,set:M,sub:K}};let Ie;const On=()=>(Ie||(Ie=Ct()),Ie);var zn={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Vn=R.createContext(void 0),Ue=e=>{const t=R.useContext(Vn);return(e==null?void 0:e.store)||t||On()};const Fn=e=>typeof(e==null?void 0:e.then)=="function",Un=R.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)});function At(e,t){const s=Ue(t),[[o,n,a],i]=R.useReducer(c=>{const g=s.get(e);return Object.is(c[0],g)&&c[1]===s&&c[2]===e?c:[g,s,e]},void 0,()=>[s.get(e),s,e]);let d=o;(n!==s||a!==e)&&(i(),d=s.get(e));const x=t==null?void 0:t.delay;return R.useEffect(()=>{const c=s.sub(e,()=>{if(typeof x=="number"){setTimeout(i,x);return}i()});return i(),c},[s,e,x]),R.useDebugValue(d),Fn(d)?Un(d):d}function St(e,t){const s=Ue(t);return R.useCallback((...n)=>{if((zn?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return s.set(e,...n)},[s,e])}function Et(e,t){return[At(e,t),St(e,t)]}var qe={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Nt=Symbol();const mt=(e,t,s)=>(t.has(s)?t:t.set(s,e())).get(s),qn=new WeakMap,Hn=(e,t,s)=>{const o=mt(()=>new WeakMap,qn,t);return mt(e,o,s)},$n={},pt=e=>!!e.write,Gn=e=>typeof e=="function";function Yn(e,t){return Hn(()=>{const s=new WeakMap,o=(i,d)=>{let x=s.get(i);if(x)return x;const c=d&&s.get(d),g=[],k=[];return i.forEach((C,O)=>{const w=t?t(C):O;k[O]=w;const S=c&&c.atomList[c.keyList.indexOf(w)];if(S){g[O]=S;return}const _=P=>{const M=P(n),V=P(e),U=o(V,M==null?void 0:M.arr).keyList.indexOf(w);if(U<0||U>=V.length){const se=i[o(i).keyList.indexOf(w)];if(se)return se;throw new Error("splitAtom: index out of bounds for read")}return V[U]},F=(P,M,V)=>{const G=P(n),U=P(e),K=o(U,G==null?void 0:G.arr).keyList.indexOf(w);if(K<0||K>=U.length)throw new Error("splitAtom: index out of bounds for write");const m=Gn(V)?V(U[K]):V;M(e,[...U.slice(0,K),m,...U.slice(K+1)])};g[O]=pt(e)?ne(_,F):ne(_)}),c&&c.keyList.length===k.length&&c.keyList.every((C,O)=>C===k[O])?x=c:x={arr:i,atomList:g,keyList:k},s.set(i,x),x},n=ne(i=>{const d=i(n),x=i(e);return o(x,d==null?void 0:d.arr)});(qe?"production":void 0)!=="production"&&(n.debugPrivate=!0),n.init=void 0;const a=pt(e)?ne(i=>i(n).atomList,(i,d,x)=>{switch(x.type){case"remove":{const c=i(a).indexOf(x.atom);if(c>=0){const g=i(e);d(e,[...g.slice(0,c),...g.slice(c+1)])}break}case"insert":{const c=x.before?i(a).indexOf(x.before):i(a).length;if(c>=0){const g=i(e);d(e,[...g.slice(0,c),x.value,...g.slice(c)])}break}case"move":{const c=i(a).indexOf(x.atom),g=x.before?i(a).indexOf(x.before):i(a).length;if(c>=0&&g>=0){const k=i(e);c<g?d(e,[...k.slice(0,c),...k.slice(c+1,g),k[c],...k.slice(g)]):d(e,[...k.slice(0,g),k[c],...k.slice(g,c),...k.slice(c+1)])}break}}}):ne(i=>i(n).atomList);return a},e,t||$n)}function Wn(e){const t=Symbol(),s=ne(t);(qe?"production":void 0)!=="production"&&(s.debugPrivate=!0);const o=ne((n,a)=>{const i=n(s);return i!==t?i:e(n,a)},(n,a,i)=>{if(i===Nt)a(s,t);else if(typeof i=="function"){const d=n(o);a(s,i(d))}else a(s,i)});return o}const Kn=e=>typeof(e==null?void 0:e.then)=="function";function Xn(e){let t,s;const o={getItem:(n,a)=>{var i,d;const x=g=>{if(g=g||"",t!==g){try{s=JSON.parse(g)}catch{return a}t=g}return s},c=(d=(i=e())==null?void 0:i.getItem(n))!=null?d:null;return Kn(c)?c.then(x):x(c)},setItem:(n,a)=>{var i;return(i=e())==null?void 0:i.setItem(n,JSON.stringify(a))},removeItem:n=>{var a;return(a=e())==null?void 0:a.removeItem(n)}};return typeof window<"u"&&typeof window.addEventListener=="function"&&(o.subscribe=(n,a,i)=>{if(!(e()instanceof window.Storage))return()=>{};const d=x=>{if(x.storageArea===e()&&x.key===n){let c;try{c=JSON.parse(x.newValue||"")}catch{c=i}a(c)}};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}}),o}const Jn=Xn(()=>typeof window<"u"?window.localStorage:void 0);function ue(e,t,s=Jn,o){const n=o==null?void 0:o.unstable_getOnInit,a=ne(n?s.getItem(e,t):t);return(qe?"production":void 0)!=="production"&&(a.debugPrivate=!0),a.onMount=d=>{n||d(s.getItem(e,t));let x;return s.subscribe&&(x=s.subscribe(e,d,t)),x},ne(d=>d(a),(d,x,c)=>{const g=typeof c=="function"?c(d(a)):c;return g===Nt?(x(a,t),s.removeItem(e)):g instanceof Promise?g.then(k=>(x(a,k),s.setItem(e,k))):(x(a,g),s.setItem(e,g))})}const He=p.atom(null);He.debugLabel="chaiBuilderPropsAtom";const _t=p.atom({});_t.debugLabel="chaiExternalDataAtom";const Zn=()=>!1,Qn=e=>{const t=e.replace(X.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}},Oe=l.memoize((e,t)=>{if(!e)return!0;const s=Ae.getBlockComponent(e);return s&&l.has(s,"canAcceptBlock")?s.canAcceptBlock(t):!1}),Ri=l.memoize((e,t)=>{const s=Ae.getBlockComponent(t);return s&&l.has(s,"canBeNested")?s.canBeNested(e):!0}),er=l.memoize(e=>{const t=Ae.getBlockComponent(e);return t&&l.has(t,"canDuplicate")?t.canDuplicate():!0}),tr=l.memoize(e=>{const t=Ae.getBlockComponent(e);return t&&l.has(t,"canDelete")?t.canDelete():!0});function Bt(e,t,s){const o=l.filter(e,a=>a._parent===t),n=[];for(let a=0;a<o.length;a++){const i=Tt(o[a]);if(Object.keys(i).length>0&&Object.keys(i).forEach(d=>{o[a][d]=`slot:${ae.generateUUID()}`}),l.filter(e,{_parent:o[a]._id}).length>0){const d=ae.generateUUID();n.push({...o[a],oldId:o[a]._id,_id:d,_parent:s}),n.push(l.flatten(Bt(e,o[a]._id,d)))}else n.push({...o[a],oldId:o[a]._id,_id:ae.generateUUID(),_parent:s})}return l.flatten(n)}function Pt(e){const t={};e.forEach(o=>{t[o._id]={...o,children:[]}});const s=[];return e.forEach(o=>{if(o._parent){const n=t[o._parent];n&&n.children.push(t[o._id])}else s.push(t[o._id])}),s}const Tt=e=>{const t={};return Object.keys(e).forEach(s=>{l.isString(e[s])&&e[s].startsWith("slot")&&(t[s]=e[s].replace("slot:",""))}),t},sr=(e,t,s=null)=>{let o=l.find(e,{_id:t});o={...o,oldId:o._id,_id:ae.generateUUID()},s&&(o={...o,_parent:s});const n=[o];l.filter(e,{_parent:t}).length>0&&n.push(l.flatten(Bt(e,t,o._id)));const a=l.flatten(n);return l.map(a,i=>{const d=i,x=Tt(d);return Object.keys(x).length>0&&Object.keys(x).forEach(c=>{const g=l.find(a,{oldId:x[c].replace("slot:","")});d[c]=`slot:${g._id}`}),l.omit(d,["global","oldId"])})};const ee=p.atom([]);ee.debugLabel="presentBlocksAtom";const It=p.atom(e=>{const t=e(ee);return Pt([...t])});It.debugLabel="treeDSBlocks";ee.debugLabel="presentBlocksAtom";const $e=Yn(ee);$e.debugLabel="pageBlocksAtomsAtom";const or=p.atom("");or.debugLabel="builderActivePageAtom";const nr=p.atom(-1);nr.debugLabel="destinationDropIndexAtom";const Mt=p.atom([]);Mt.debugLabel="buildingBlocksAtom";const rr=p.atom(e=>{const t=e(Mt);return l.filter(t,s=>l.has(s,"blockId"))});rr.debugLabel="globalBlocksAtom";const Ge=p.atom([]);Ge.debugLabel="selectedBlockIdsAtom";const Ye=p.atom(e=>{const t=e(ee),s=e(Ge);return l.map(l.filter(t,({_id:o})=>l.includes(s,o)),o=>({...o}))});Ye.debugLabel="selectedBlocksAtom";const Ee=p.atom(e=>{const t=e(Ye);if(t.length===0)return null;if(t.length===1)return t[0]});Ee.debugLabel="selectedBlockAtom";const ar=e=>l.get(e,"_parent",null),ir=p.atom(e=>{const t=e(Ye),s=l.map(t,ar);return l.filter(e(ee),o=>l.includes(s,o._id))});ir.debugLabel="selectedBlocksParentsAtom";const Dt=p.atom(()=>!1);Dt.debugLabel="selectedBlockFlexChildAtom";const Lt=p.atom(()=>!1);Lt.debugLabel="selectedBlockGridChildAtom";const We=p.atom("");We.debugLabel="styleStateAtom";const Ot=ue("styleBreakpoint","xs");Ot.debugLabel="styleBreakpointAtom";const lr=()=>({flexChild:p.useAtomValue(Dt),gridChild:p.useAtomValue(Lt)}),cr=()=>p.useAtomValue(Ee),Ci=p.atom(e=>{const t=e(Ee),s=e(ee);let o=t;const n=[t];do{const a=s.find(({_id:i})=>i===(o==null?void 0:o._parent));o=a,a&&n.push(a)}while(o!=null&&o._parent);return n});const be=()=>{const[e,t]=p.useAtom(Ge),s=R.useCallback(o=>{t(n=>l.includes(n,o)?l.without(n,o):[...n,o])},[t]);return[e,t,s]},ze=e=>{switch(e.type){case"singular":return e.uiSchema;case"model":const{properties:t}=e,s={};return Object.keys(t).forEach(a=>{const i=t[a];if(l.includes(["slot","styles"],i.type))return;const d=a;s[d]=ze(i)}),s;case"list":const{itemProperties:o}=e,n={items:{}};return Object.keys(o).forEach(a=>{const i=o[a];if(l.includes(["slot","styles"],i.type))return;const d=a;n.items[d]=ze(i)}),n;default:return{}}},Ve=e=>{switch(e.type){case"singular":return e.schema;case"model":const{properties:t,title:s}=e,o={title:s,type:"object",properties:{}};return Object.keys(t).forEach(d=>{const x=t[d];if(l.includes(["slot","styles"],x.type))return;const c=d;o.properties[c]=Ve(x)}),o;case"list":const{itemProperties:n,title:a}=e,i={title:a,type:"array",items:{type:"object",properties:{}}};return Object.keys(n).forEach(d=>{const x=n[d];if(l.includes(["slot","styles"],x.type))return;const c=d;i.items.properties[c]=Ve(x),l.set(i.items,"title",l.get(x,"itemTitle",`${a} item`))}),i;default:return{}}},zt=e=>{if(!e)return{};const t={};return Object.keys(e).forEach(s=>{t[s]=ur(e[s])}),t},dr=e=>{if(l.isEmpty(e.default))return[];const{itemProperties:t}=e;return l.map(e.default,s=>{const o={...s};return l.forIn(s,(n,a)=>{l.has(t,a)&&l.get(t[a],"i18n",!1)&&(o[a]=X.I18N_KEY)}),o})},ur=e=>{switch(e.type){case"styles":return e.default;case"slot":return`${X.SLOT_KEY}${ae.generateUUID()}`;case"singular":const{schema:t}=e;return l.get(t,"default","");case"model":return zt(e.properties);case"list":return dr(e);default:return""}};const mr=(e,t)=>{const s={};return l.set(s,e,t),s};var Ke={exports:{}},Ai=Ke.exports;(function(e){(function(){"use strict";function t(o,n,a){return o.splice(n,!a||1+a-n+(!(a<0^n>=0)&&(a<0||-1)*o.length)),o.length}let s=function(){let o=[],n=-1,a=0,i=!1,d;function x(c,g){return!c||typeof c[g]!="function"?this:(i=!0,c[g](),i=!1,this)}return{add:function(c){return i?this:(o.splice(n+1,o.length-n),o.push(c),a&&o.length>a&&t(o,0,-(a+1)),n=o.length-1,d&&d(),this)},setCallback:function(c){d=c},undo:function(){let c=o[n];if(!c)return this;const g=c.groupId;for(;c.groupId===g&&(x(c,"undo"),n-=1,c=o[n],!(!c||!c.groupId)););return d&&d(),this},redo:function(){let c=o[n+1];if(!c)return this;const g=c.groupId;for(;c.groupId===g&&(x(c,"redo"),n+=1,c=o[n+1],!(!c||!c.groupId)););return d&&d(),this},clear:function(){let c=o.length;o=[],n=-1,d&&c>0&&d()},hasUndo:function(){return n!==-1},hasRedo:function(){return n<o.length-1},getCommands:function(c){return c?o.filter(g=>g.groupId===c):o},getIndex:function(){return n},setLimit:function(c){a=c}}};e.exports?e.exports=s:window.UndoManager=s})()})(Ke);var pr=Ke.exports;const fr=Bn.getDefaultExportFromCjs(pr),xr=p.atom(X.BRANDING_OPTIONS_DEFAULTS),gr=p.atom(null),Xe=()=>{const[e,t]=p.useAtom(xr);return[l.isObject(e)?{...X.BRANDING_OPTIONS_DEFAULTS,...e}:X.BRANDING_OPTIONS_DEFAULTS,t]},hr=()=>p.useAtom(gr),br=p.atom(null),Vt=()=>({currentPage:p.useAtomValue(br)});function Ft(e){return Pt(e)}const Je=(e,t)=>l.flatten(e.map(s=>{if(s=t?{...s,_parent:t}:{...s},s.children){const o=[...s.children];return delete s.children,l.flatten([s,...Je(o,s._id)])}return s}));function Ze(e,t=!1){for(let s=0;s<e.length;s++){const o=e[s];o.global&&!t?e[s]={type:"GlobalBlock",blockId:o.blockId,_parent:l.get(o,"_parent",null),_id:o._id}:o.children&&o.children.length&&Ze(o.children)}}function Ut(e){let t=[],s=l.filter(e,{type:"GlobalBlock"});return s.length>0&&(s=l.map(s,qt),l.each(s,o=>{t=[...t,...vr(o)]})),t}function vr(e){let t=[];const s=l.get(l.first(e),"_parent",null);l.set(l.first(e),"_parent",null);const o=[flatToNestedInstance.convert(Ht(e))];Ze(o,!0);let n=Je(o,e[0]._id);return n=l.set(n,"0._parent",s),t=[...t,n,...Ut(n)],t}function qt(e){const t=l.find(Fe,{_id:e._id});if(!t)return[];const s=[t],o=l.filter(Fe,{_parent:e._id});return o.length?l.flatten([...s,...l.flatten(l.map(o,qt))]):l.flatten(s)}const Ht=e=>JSON.parse(JSON.stringify(e));let Fe=[];function yr(e){Fe=e;const t=Ft(Ht(e));Ze(t);const s=Je(t,null),o=Ut(s),n={};return l.each(o,a=>l.set(n,l.first(a).blockId,a)),[s,n]}const $t=()=>{const[e]=Xe(),{currentPage:t}=Vt(),[s]=me();return R.useCallback(()=>{const o=l.map(s,a=>l.omit(a,["expanded","order","title","siblings","tempClasses"])),[n=[]]=yr(o);return{currentPage:t,blocks:n}},[e,t,s])},Q=(e,t=void 0)=>{const s=p.useAtomValue(He);return l.get(s,e,t)},Qe=p.atom([]);Qe.debugLabel="dataProvidersAtom";const Gt=()=>p.useAtom(Qe),Ne=p.atom("SAVED");Ne.debugLabel="builderSaveStateAtom";const jr=()=>{const[e,t]=p.useAtom(Ne),s=Q("onSavePage",async c=>{}),o=Q("onSave",async c=>{}),n=Q("onSaveStateChange",l.noop),a=$t(),[i]=Gt(),[d]=Xe();return{savePage:Pn.useThrottledCallback(async()=>{t("SAVING"),n("SAVING");const c=a();return await s({blocks:c.blocks,providers:i}),await o({blocks:c.blocks,providers:i,brandingOptions:d,themeConfiguration:d}),setTimeout(()=>{t("SAVED"),n("SAVED")},100),!0},[a,t,d,o,n],3e3),saveState:e,setSaveState:t}},re=new fr;re.setLimit(50);const et=()=>{const[,e]=p.useAtom(Ne),t=Q("onSaveStateChange",l.noop);return R.useEffect(()=>(re.setCallback(()=>{e("UNSAVED"),t("UNSAVED")}),()=>{re.setCallback(l.noop)}),[]),{add:re.add,undo:re.undo,redo:re.redo,hasRedo:re.hasRedo,hasUndo:re.hasUndo,clear:re.clear}},tt=(e,t)=>{const s=[],o=l.filter(e,n=>l.includes(t,n._id)||l.includes(t,n._parent)?(s.push(n._id),!1):!0);return l.isEmpty(s)?o:tt(o,s)},kr=()=>{const[e]=me(),[t,s]=be(),{setNewBlocks:o}=te();return R.useCallback(n=>{var i;const a=((i=l.find(e,{_id:n[0]}))==null?void 0:i._parent)||null;o(tt(e,n)),setTimeout(()=>s(a?[a]:[]),200)},[e,s,t])};function wr(e,t,s,o){let n=e.filter(d=>!d._parent);s&&(n=e.filter(d=>d._parent===s));const a=o!==void 0?o:n.length;let i=e.length;for(let d=0,x=0;d<e.length;d++)if(e[d]._parent===s){if(x===a){i=d;break}x++}return!s&&o!==void 0&&o>=n.length&&(i=e.length),[...e.slice(0,i),...t,...e.slice(i)]}function Rr(e){let t=[];return e.walk(s=>(delete s.model.children,t.push(s.model),!0)),t}function ft(e,t){return e.first(s=>s.model._id===t)||null}function Cr(e,t,s,o){const n=ft(e,t),a=ft(e,s);if(n&&a){n.drop(),a.children||(a.model.children=[]);try{a.addChildAtIndex(n,o)}catch(i){return console.error("Error adding child to parent:",i),!1}return!0}return!1}function Ar(e,t,s,o){if(!t)return e;s=s||"root";const a=new Tn().parse({_id:"root",children:Ft(e)});if(Cr(a,t,s,o)){const i=Rr(a),d=i.find(x=>x._id===t);return d&&(d._parent=s==="root"?null:s),i.shift(),i}return e}const Sr=()=>{const[,e]=me();return{setNewBlocks:t=>{e(t)},addBlocks:(t,s,o)=>{e(n=>wr(n,t,s,o))},removeBlocks:t=>{e(s=>tt(s,t))},moveBlocks:(t,s,o)=>{e(n=>{let a=n;for(let i=0;i<t.length;i++)a=Ar(a,t[i],s,o);return a})},updateBlocksProps:t=>{e(s=>{const o=t.map(n=>n._id);return s.map(n=>{if(o.includes(n._id)){const a=l.find(t,{_id:n._id});return{...n,...l.omit(a,"_id")}}return n})})}}},me=()=>p.useAtom(ee),te=()=>{const{add:e}=et(),[t]=me(),{setNewBlocks:s,addBlocks:o,removeBlocks:n,moveBlocks:a,updateBlocksProps:i}=Sr();return{moveBlocks:(w,S,_)=>{const F=l.map(w,M=>{const G=t.find(K=>K._id===M)._parent||null,se=t.filter(K=>G?K._parent===G:!K._parent).map(K=>K._id).indexOf(M);return{_id:M,oldParent:G,oldPosition:se}}),P=F.find(({_id:M})=>M===w[0]);P&&P.oldParent===S&&P.oldPosition===_||(a(w,S,_),e({undo:()=>l.each(F,({_id:M,oldParent:V,oldPosition:G})=>{a([M],V,G)}),redo:()=>a(w,S,_)}))},addBlocks:(w,S,_)=>{o(w,S,_),e({undo:()=>n(l.map(w,"_id")),redo:()=>o(w,S,_)})},removeBlocks:w=>{var P;const S=(P=l.first(w))==null?void 0:P._parent,F=t.filter(M=>S?M._parent===S:!M._parent).indexOf(l.first(w));n(l.map(w,"_id")),e({undo:()=>o(w,S,F),redo:()=>n(l.map(w,"_id"))})},updateBlocks:(w,S,_)=>{let F=[];if(_)F=l.map(w,P=>({_id:P,..._}));else{const P=l.keys(S);F=l.map(w,M=>{const V=t.find(U=>U._id===M),G={_id:M};return l.each(P,U=>G[U]=V[U]),G})}i(l.map(w,P=>({_id:P,...S}))),e({undo:()=>i(F),redo:()=>i(l.map(w,P=>({_id:P,...S})))})},updateBlocksRuntime:(w,S)=>{i(l.map(w,_=>({_id:_,...S})))},setNewBlocks:w=>{s(w),e({undo:()=>s(t),redo:()=>s(w)})},updateMultipleBlocksProps:w=>{let S=[];S=l.map(w,_=>{const F=l.keys(_),P=t.find(V=>V._id===_._id),M={};return l.each(F,V=>M[V]=P[V]),M}),i(w),e({undo:()=>i(S),redo:()=>i(w)})}}},Er=()=>{const[e]=me(),[,t]=be(),{addBlocks:s}=te(),o=R.useCallback((a,i,d)=>{var C;for(let O=0;O<a.length;O++){const{_id:w}=a[O];a[O]._id=ae.generateUUID();const S=l.filter(a,{_parent:w});for(let _=0;_<S.length;_++)S[_]._parent=a[O]._id}const x=l.first(a);let c,g;return i&&(c=l.find(e,{_id:i}),a[0]._parent=i,g=i),!(c?Oe(c==null?void 0:c._type,x._type):!0)&&c&&(a[0]._parent=c._parent,g=c._parent),s(a,g,d),t([(C=l.first(a))==null?void 0:C._id]),l.first(a)},[e,t]);return{addCoreBlock:R.useCallback((a,i,d)=>{if(l.has(a,"blocks")){const _=a.blocks;return o(_,i,d)}const x=ae.generateUUID(),c=zt(a.props),g=[];l.forIn(c,(_,F)=>{if(l.startsWith(_,X.SLOT_KEY)){const P=_.replace(X.SLOT_KEY,"");g.push({_id:P,_type:"Slot",_parent:x,_name:a.props[F].name,_styles:a.props[F].styles,_emptyStyles:a.props[F].emptyStyles})}});const k={_type:a.type,_id:x,...c};let C,O;i&&(C=l.find(e,{_id:i}),k._parent=i,O=i),!Oe(C==null?void 0:C._type,k._type)&&C&&(k._parent=C._parent,O=C._parent);const S=[k,...g];return s(S,O,d),t([k._id]),k},[o,e,t]),addPredefinedBlock:o}},xt={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},gt=["xs","sm","md","lg","xl","2xl"];function Nr(e,t){if(t===null)return"baseClasses";const s=t.mq;if(s==="xs"||t.dark||t.mod!=="")return"classes";let o="baseClasses",n=gt.indexOf(s);for(;n>0;){const a=gt[n-1];if(l.find(e,{mq:a,property:t.property})){o="classes";break}n--}return o}const ht=[];function _r(e="",t="",s=[]){e=e.trim().replace(/ +/g,"");let o=l.filter(l.map(e.split(" "),u.constructClassObject),c=>!l.isNull(c)),n=l.filter(l.map(t.split(" "),u.constructClassObject),c=>!l.isNull(c));n=l.filter(n,c=>!l.includes(ht,c.property));const a=[],i=[];l.each(s,c=>{const g=u.constructClassObject(c),k=l.find(o,l.pick(g,["dark","mq","mod","property"]));if(k&&(o=l.filter(o,C=>C.fullCls!==(k==null?void 0:k.fullCls))),a.push(g),g.mq==="xs"&&!g.dark&&g.mod===""&&(n=l.filter(n,C=>C.property!==g.property)),Nr(o,g)==="baseClasses"&&!l.includes(ht,g.property)){const C=l.find(n,l.pick(g,["property"]));k&&(n=l.filter(n,O=>O.fullCls!==(C==null?void 0:C.fullCls))),i.push({...g,fullCls:g.cls,mq:"xs"})}});const d=l.map(l.sortBy([...o,...a],c=>xt[c.mq]),"fullCls").join(" ");return`${l.map(l.sortBy([...n,...i],c=>xt[c.mq]),"fullCls").join(" ").trim()},${d.trim()}`.trim().replace(/ +/g,"")}const ve=p.atom([]);ve.debugLabel="selectedStylingBlocksAtom";const Yt=()=>p.useAtom(ve),Br=e=>{const t=e.replace(X.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}},Pr=p.atom(null,(e,t,{blockIds:s,newClasses:o})=>{const n=l.filter(e($e),i=>s.includes(e(i)._id)),a=l.first(e(ve));return l.map(n,i=>{const d=e(i),x=l.get(d,a.prop,`${X.STYLES_KEY},`),{baseClasses:c,classes:g}=Br(x);return{ids:[d._id],props:{[a.prop]:`${X.STYLES_KEY}${_r(g,c,o)}`}}})}),Tr=()=>{const e=p.useSetAtom(Pr),{updateBlocks:t,updateBlocksRuntime:s}=te();return R.useCallback((o,n,a=!1)=>{const i=e({blockIds:o,newClasses:n});if(!a){s(o,i[0].props);return}t(o,i[0].props)},[e])},Wt=()=>p.useAtom(Ot),Kt=ue("canvasWidth",800),Xt=p.atom(e=>{const t=e(Kt);return ae.getBreakpointValue(t).toLowerCase()}),Ir=()=>{const[e,t]=p.useAtom(Kt),s=p.useAtomValue(Xt),[o,n]=Wt();return R.useEffect(()=>{o!=="xs"&&n(s)},[s,o,n]),[e,s,t]},Mr=ue("canvasZoom",100),Dr=()=>p.useAtom(Mr),Jt=p.atom([]),Zt=()=>{const[e,t]=p.useAtom(Jt),s=p.useSetAtom(st),o=R.useCallback(n=>{t(n),s([])},[t,s]);return[e,o]},st=p.atom([]),Lr=()=>{const[e,t]=p.useAtom(st),s=p.useSetAtom(Jt),o=R.useCallback(n=>{t(n),s([])},[t,s]);return[e,o]},Qt=ue("darkMode",!1),Or=()=>{const[e,t]=p.useAtom(Qt);return[e,t]},es=()=>{const[e]=me(),[,t]=be(),{addBlocks:s}=te();return R.useCallback((o,n=null)=>{const a=[];l.each(o,i=>{const d=e.find(C=>C._id===i);n||(n=d._parent);const g=l.filter(e,C=>l.isString(n)?C._parent===n:!d._parent).indexOf(d)+1,k=sr(e,i,n);s(k,n,g),a.push(l.get(k,"0._id",""))}),t(a)},[e,t])},zr=p.atom([]),Vr=()=>{const[e,t]=p.useAtom(zr),s=R.useCallback(o=>{t(n=>l.includes(n,o)?l.without(n,o):[...n,o])},[t]);return[e,t,s]},Fr=p.atom(""),ts=()=>p.useAtom(Fr),Ur=()=>{const e=p.useAtomValue(ee);return R.useCallback((t,s)=>{const o=l.map(e,n=>(l.includes(t,l.get(n,"_id"))&&l.set(n,"_parent",s),n));console.log("newBlocks",o)},[e])},qr=()=>{console.warn("usePasteBlocks is not implemented");const e=p.useAtomValue(st),[t,s]=Zt(),o=es(),n=Ur();return{canPaste:R.useMemo(()=>t.length>0||e.length>0,[e,t]),pasteBlocks:R.useCallback(i=>{l.isEmpty(e)?n(t,i):o(e,i),s(()=>[])},[t,e,o,n,s])}},Hr=p.atom(!1),$r=()=>{const[e,t]=p.useAtom(Hr);return[e,t]},Gr=p.atom(null,(e,t,{blockIds:s,fullClasses:o})=>{const n=l.first(e(ve)),a=l.filter(e($e),i=>s.includes(e(i)._id));return l.map(a,i=>{const d=e(i),x=o;let{classes:c,baseClasses:g}=Qn(l.get(d,n.prop,"styles:,"));return l.each(x,k=>{const C=k.replace(/[\[\]\/\\{}()*+?.^$|]/g,"\\$&"),O=new RegExp(`(^| )${C}($| )`,"g");c=c.replace(O," ").replace(/ +/g," ").trim();const w=l.first(k.split(":"));l.includes(["2xl","xl","lg","md","sm"],w)&&x.push(k.split(":").pop().trim())}),l.each(x,k=>{const C=new RegExp(`(^| )${k.replace("[","\\[").replace("]","\\]")}($| )`,"g");g=g.replace(C," ").replace(/ +/g," ").trim()}),{ids:[d._id],props:{[n.prop]:`${X.STYLES_KEY}${g},${c}`}}})}),Yr=()=>{const{updateBlocks:e}=te(),t=p.useSetAtom(Gr);return R.useCallback((s,o)=>{const n=t({blockIds:s,fullClasses:o});e(s,n[0].props)},[t])},ss=p.atom(e=>{const t=l.first(e(ve)),s=e(Ee);if(!t||t.blockId!==l.get(s,"_id",null))return[];const n=l.get(s,t.prop,`${X.STYLES_KEY},`).replace(X.STYLES_KEY,"").split(",").join(" ");return l.filter(l.map(n.trim().split(" "),u.constructClassObject),a=>!l.isNull(a))}),Wr=()=>p.useAtomValue(ss),bt={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},Kr=p.atom(e=>{const t=e(Xt),s=e(We),o=e(Qt),n=Xr(t);let a=l.filter(e(ss),{mod:s});return l.startsWith(s,"_")||(a=l.filter(a,i=>n.includes(i.mq))),a=a.sort((i,d)=>bt[i.mq]-bt[d.mq]),o||(a=l.filter(a,{dark:!1})),a}),Xr=e=>{let t=[];switch(e){case"xs":t=["xs"];break;case"sm":t=["xs","sm"];break;case"md":t=["xs","sm","md"];break;case"lg":t=["xs","sm","md","lg"];break;case"xl":t=["xs","sm","md","lg","xl"];break;case"2xl":t=["xs","sm","md","lg","xl","2xl"];break;default:t=["xs"];break}return t},Jr=()=>p.useAtomValue(Kr),Zr=()=>p.useAtom(We),Qr=()=>{const{updateBlocks:e}=te();return R.useCallback((t,s,o)=>{e(t,s,o)},[e])},ea=()=>{const{updateMultipleBlocksProps:e}=te();return R.useCallback(t=>{e(t)},[e])},ta=()=>{const{updateBlocksRuntime:e}=te();return R.useCallback(async(t,s,o=30)=>{const n=l.keys(l.omit(s,["_id"]));for(const a of n){const i=s[a];if(l.isString(i)){const d=l.chunk(i.split(""),12);let x="";e([t],{[a]:""});for(let c=0;c<d.length;c++)x+=d[c].join(""),e([t],{[a]:x}),await new Promise(g=>setTimeout(g,o))}}},[e])},sa=()=>{const{updateMultipleBlocksProps:e}=te(),t=ta();return R.useCallback(async s=>{for(const o of s)await t(o._id,o);e(s)},[e])},oa=()=>{const{updateBlocksRuntime:e}=te();return R.useCallback((t,s)=>{e(t,s)},[e])},os={name:"",props:{},modalProps:{},backdropClose:!0},na=p.atom(os),ra=()=>{const[e,t]=p.useAtom(na),s=R.useCallback((n,a={},i={})=>{t({name:n,props:a,modalProps:i})},[t]),o=R.useCallback((...n)=>{l.get(e,"props.onClose",()=>{})(...n),t(os)},[t,e]);return{activeModal:e,openModal:s,closeModal:o}},aa=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),p.useAtomValue(ee)),ns=p.atom(!1);ns.debugLabel="readOnlyModeAtom";const rs=p.atom("online");rs.debugLabel="networkModeAtom";const as=p.atom(!1);as.debugLabel="editLayerNameAtom";const ia=p.atom("");ia.debugLabel="activeLanguageAtom";const la=p.atom("");la.debugLabel="primaryLanguageAtom";const is=p.atom(null);is.debugLabel="canvasIframeAtom";const ls=p.atom("outline");ls.debugLabel="activePanelAtom";const cs=p.atom("");cs.debugLabel="showPredefinedBlockCategoryAtom";const ds=p.atom({undoCount:0,redoCount:0});ds.debugLabel="historyStatesAtom";const us=p.atom("");us.debugLabel="inlineEditingActiveAtom";const ms=p.atom(!1);ms.debugLabel="draggingFlagAtom";const ps=p.atom("");ps.debugLabel="draggedBlockIdAtom";const fs=p.atom(null);fs.debugLabel="treeRefAtom";const xs=p.atom({});xs.debugLabel="canvasSettingsAtom";const ot=p.atom(!1);ot.debugLabel="askAiActiveBlockAtom";const ca=p.atom(!1);ca.debugLabel="codeEditorOpenAtom";const da=ue("codeEditorHeight",500);da.debugLabel="codeEditorHeightAtom";const gs=p.atom([]);gs.debugLabel="xShowBlocksAtom";const ua=()=>p.useAtomValue(ns),ma=p.atom(""),pa=p.atom(null),fa=()=>p.useAtom(ma),xa=()=>p.useAtom(pa),ga=ue("selectedBreakpoints",["XS","MD","XL"]),ha=()=>{const[e,t]=p.useAtom(ga);return[e,t]},ba=()=>{const e=p.useSetAtom(ds),{clear:t}=et(),[,s]=be(),[,o]=ts(),[,n]=Yt(),[,a]=Et(ot);return()=>{s([]),n([]),o(""),t(),a(!1),e({undoCount:0,redoCount:0})}},va=()=>({data:Q("uiLibraries",[]),isLoading:!1}),ya=()=>{const[e,t]=R.useState(null),s=R.useCallback(async o=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(o),t(o),!0}catch(n){return console.warn("Copy failed",n),t(null),!1}},[]);return[e,s]},ja=p.atom(null),ka=()=>p.useAtom(ja),hs=ce.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),bs=f.forwardRef(({className:e,variant:t,size:s,...o},n)=>r.jsxRuntimeExports.jsx(kt.Root,{ref:n,className:u.cn(hs({variant:t,size:s,className:e})),...o}));bs.displayName=kt.Root.displayName;const vs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Le.Root,{className:u.cn("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus-visible:ring-slate-800 dark:focus-visible:ring-offset-slate-950 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",e),...t,ref:s,children:r.jsxRuntimeExports.jsx(Le.Thumb,{className:u.cn("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-slate-950")})}));vs.displayName=Le.Root.displayName;const _e=ce.cva("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ys=f.forwardRef(({className:e,variant:t,size:s,asChild:o=!1,...n},a)=>{const i=o?pn.Slot:"button";return r.jsxRuntimeExports.jsx(i,{className:u.cn(_e({variant:t,size:s,className:e})),ref:a,...n})});ys.displayName="Button";const wa=le.Root,js=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(le.Item,{ref:s,className:u.cn("border-b",e),...t}));js.displayName="AccordionItem";const ks=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsx(le.Header,{className:"flex",children:r.jsxRuntimeExports.jsxs(le.Trigger,{ref:o,className:u.cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...s,children:[t,s.hideArrow?null:r.jsxRuntimeExports.jsx(Y.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));ks.displayName=le.Trigger.displayName;const ws=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsx(le.Content,{ref:o,className:u.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...s,children:r.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:t})}));ws.displayName=le.Content.displayName;const Ra=ce.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Rs=f.forwardRef(({className:e,variant:t,...s},o)=>r.jsxRuntimeExports.jsx("div",{ref:o,role:"alert",className:u.cn(Ra({variant:t}),e),...s}));Rs.displayName="Alert";const Cs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("h5",{ref:s,className:u.cn("mb-1 font-medium leading-none tracking-tight",e),...t}));Cs.displayName="AlertTitle";const As=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("text-sm [&_p]:leading-relaxed",e),...t}));As.displayName="AlertDescription";const Ss=ce.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}}),Ca=({className:e,variant:t,...s})=>r.jsxRuntimeExports.jsx("div",{className:u.cn(Ss({variant:t}),e),...s}),Aa=W.Root,Sa=W.Trigger,Es=({className:e,...t})=>r.jsxRuntimeExports.jsx(W.Portal,{className:u.cn(e),...t});Es.displayName=W.Portal.displayName;const Ns=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Overlay,{className:u.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:s}));Ns.displayName=W.Overlay.displayName;const _s=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsxs(Es,{children:[r.jsxRuntimeExports.jsx(Ns,{}),r.jsxRuntimeExports.jsx(W.Content,{ref:s,className:u.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...t})]}));_s.displayName=W.Content.displayName;const Bs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});Bs.displayName="AlertDialogHeader";const Ps=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ps.displayName="AlertDialogFooter";const Ts=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Title,{ref:s,className:u.cn("text-lg font-semibold",e),...t}));Ts.displayName=W.Title.displayName;const Is=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Is.displayName=W.Description.displayName;const Ms=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Action,{ref:s,className:u.cn(_e(),e),...t}));Ms.displayName=W.Action.displayName;const Ds=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Cancel,{ref:s,className:u.cn(_e({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Ds.displayName=W.Cancel.displayName;const nt=I.Root,Ls=I.Trigger,Os=({className:e,...t})=>r.jsxRuntimeExports.jsx(I.Portal,{className:u.cn(e),...t});Os.displayName=I.Portal.displayName;const zs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Overlay,{ref:s,className:u.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));zs.displayName=I.Overlay.displayName;const Be=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(Os,{children:[r.jsxRuntimeExports.jsx(zs,{}),r.jsxRuntimeExports.jsxs(I.Content,{ref:o,className:u.cn("fixed left-[50%] top-[50%] z-[999] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...s,children:[t,r.jsxRuntimeExports.jsxs(I.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsxRuntimeExports.jsx(Y.Cross2Icon,{className:"h-4 w-4"}),r.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Be.displayName=I.Content.displayName;const Vs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Vs.displayName="DialogHeader";const Fs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Fs.displayName="DialogFooter";const Us=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Title,{ref:s,className:u.cn("text-lg font-semibold leading-none tracking-tight",e),...t}));Us.displayName=I.Title.displayName;const qs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));qs.displayName=I.Description.displayName;const Hs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Hs.displayName="Card";const $s=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("flex flex-col space-y-1.5 p-6",e),...t}));$s.displayName="CardHeader";const Gs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("h3",{ref:s,className:u.cn("font-semibold leading-none tracking-tight",e),...t}));Gs.displayName="CardTitle";const Ys=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("p",{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Ys.displayName="CardDescription";const Ws=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("p-6 pt-0",e),...t}));Ws.displayName="CardContent";const Ks=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn(" flex items-center p-6 pt-0",e),...t}));Ks.displayName="CardFooter";const Xs=f.forwardRef(({className:e,type:t,...s},o)=>r.jsxRuntimeExports.jsx("input",{type:t,className:u.cn("flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...s,autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}));Xs.displayName="Input";const Ea=ce.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Js=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(wt.Root,{ref:s,className:u.cn(Ea(),e),...t}));Js.displayName=wt.Root.displayName;const Zs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("textarea",{className:u.cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:s,...t,autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}));Zs.displayName="Textarea";const Qs=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(ie.Root,{ref:o,className:u.cn("relative overflow-hidden",e),...s,children:[r.jsxRuntimeExports.jsx(ie.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsxRuntimeExports.jsx(rt,{}),r.jsxRuntimeExports.jsx(ie.Corner,{})]}));Qs.displayName=ie.Root.displayName;const rt=f.forwardRef(({className:e,orientation:t="vertical",...s},o)=>r.jsxRuntimeExports.jsx(ie.ScrollAreaScrollbar,{ref:o,orientation:t,className:u.cn("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",e),...s,children:r.jsxRuntimeExports.jsx(ie.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));rt.displayName=ie.ScrollAreaScrollbar.displayName;const eo=de.Root,at=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(de.List,{ref:s,className:u.cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));at.displayName=de.List.displayName;const Re=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(de.Trigger,{ref:s,className:u.cn("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Re.displayName=de.Trigger.displayName;const Ce=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(de.Content,{ref:s,className:u.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Ce.displayName=de.Content.displayName;const Na=fe.Portal,_a=fe.Provider,Ba=fe.Root,Pa=fe.Trigger,to=f.forwardRef(({className:e,sideOffset:t=4,...s},o)=>r.jsxRuntimeExports.jsx(fe.Content,{ref:o,sideOffset:t,className:u.cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s}));to.displayName=fe.Content.displayName;const Ta=he.Root,Ia=he.Trigger,so=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...o},n)=>r.jsxRuntimeExports.jsx(he.Portal,{children:r.jsxRuntimeExports.jsx(he.Content,{ref:n,align:t,sideOffset:s,className:u.cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));so.displayName=he.Content.displayName;const Ma=B.Menu,Da=B.Group,La=B.Portal,Oa=B.Sub,za=B.RadioGroup,oo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.Root,{ref:s,className:u.cn("flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",e),...t}));oo.displayName=B.Root.displayName;const no=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.Trigger,{ref:s,className:u.cn("flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e),...t}));no.displayName=B.Trigger.displayName;const ro=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(B.SubTrigger,{ref:n,className:u.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...o,children:[s,r.jsxRuntimeExports.jsx(Y.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));ro.displayName=B.SubTrigger.displayName;const ao=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.SubContent,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));ao.displayName=B.SubContent.displayName;const io=f.forwardRef(({className:e,align:t="start",alignOffset:s=-4,sideOffset:o=8,...n},a)=>r.jsxRuntimeExports.jsx(B.Portal,{children:r.jsxRuntimeExports.jsx(B.Content,{ref:a,align:t,alignOffset:s,sideOffset:o,className:u.cn("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));io.displayName=B.Content.displayName;const lo=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(B.Item,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));lo.displayName=B.Item.displayName;const co=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(B.CheckboxItem,{ref:n,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...o,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(B.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.CheckIcon,{className:"h-4 w-4"})})}),t]}));co.displayName=B.CheckboxItem.displayName;const uo=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(B.RadioItem,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(B.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));uo.displayName=B.RadioItem.displayName;const mo=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(B.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));mo.displayName=B.Label.displayName;const po=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));po.displayName=B.Separator.displayName;const fo=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});fo.displayname="MenubarShortcut";const Va=Se.Root,Fa=Se.Trigger,xo=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...o},n)=>r.jsxRuntimeExports.jsx(Se.Content,{ref:n,align:t,sideOffset:s,className:u.cn("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o}));xo.displayName=Se.Content.displayName;const Ua=q.Root,qa=q.Group,Ha=q.Value,go=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(q.Trigger,{ref:o,className:u.cn("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...s,children:[t,r.jsxRuntimeExports.jsx(q.Icon,{asChild:!0,children:r.jsxRuntimeExports.jsx(Y.CaretSortIcon,{className:"h-4 w-4 opacity-50"})})]}));go.displayName=q.Trigger.displayName;const ho=f.forwardRef(({className:e,children:t,position:s="popper",...o},n)=>r.jsxRuntimeExports.jsx(q.Portal,{children:r.jsxRuntimeExports.jsx(q.Content,{ref:n,className:u.cn("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,...o,children:r.jsxRuntimeExports.jsx(q.Viewport,{className:u.cn("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));ho.displayName=q.Content.displayName;const bo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(q.Label,{ref:s,className:u.cn("px-2 py-1.5 text-sm font-semibold",e),...t}));bo.displayName=q.Label.displayName;const vo=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(q.Item,{ref:o,className:u.cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(q.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.CheckIcon,{className:"h-4 w-4"})})}),r.jsxRuntimeExports.jsx(q.ItemText,{children:t})]}));vo.displayName=q.Item.displayName;const yo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(q.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));yo.displayName=q.Separator.displayName;const $a=I.Root,Ga=I.Trigger,Ya=I.Close,jo=({className:e,...t})=>r.jsxRuntimeExports.jsx(I.Portal,{className:u.cn(e),...t});jo.displayName=I.Portal.displayName;const ko=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Overlay,{className:u.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:s}));ko.displayName=I.Overlay.displayName;const Wa=ce.cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),wo=f.forwardRef(({side:e="right",className:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(jo,{children:[r.jsxRuntimeExports.jsx(ko,{}),r.jsxRuntimeExports.jsxs(I.Content,{ref:n,className:u.cn(Wa({side:e}),t),...o,children:[s,r.jsxRuntimeExports.jsxs(I.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[r.jsxRuntimeExports.jsx(Y.Cross2Icon,{className:"h-4 w-4"}),r.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wo.displayName=I.Content.displayName;const Ro=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ro.displayName="SheetHeader";const Co=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Co.displayName="SheetFooter";const Ao=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Title,{ref:s,className:u.cn("text-lg font-semibold text-foreground",e),...t}));Ao.displayName=I.Title.displayName;const So=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));So.displayName=I.Description.displayName;const Ka=D.Root,Xa=D.Trigger,Ja=D.Group,Za=D.Portal,Qa=D.Sub,ei=D.RadioGroup,Eo=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(D.SubTrigger,{ref:n,className:u.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...o,children:[s,r.jsxRuntimeExports.jsx(Y.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));Eo.displayName=D.SubTrigger.displayName;const No=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(D.SubContent,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));No.displayName=D.SubContent.displayName;const _o=f.forwardRef(({className:e,sideOffset:t=4,...s},o)=>r.jsxRuntimeExports.jsx(D.Portal,{children:r.jsxRuntimeExports.jsx(D.Content,{ref:o,sideOffset:t,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));_o.displayName=D.Content.displayName;const Bo=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(D.Item,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));Bo.displayName=D.Item.displayName;const Po=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(D.CheckboxItem,{ref:n,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...o,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(D.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.CheckIcon,{className:"h-4 w-4"})})}),t]}));Po.displayName=D.CheckboxItem.displayName;const To=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(D.RadioItem,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(D.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));To.displayName=D.RadioItem.displayName;const Io=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(D.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));Io.displayName=D.Label.displayName;const Mo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(D.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));Mo.displayName=D.Separator.displayName;const Do=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest opacity-60",e),...t});Do.displayName="DropdownMenuShortcut";const Lo=f.forwardRef(({className:e,orientation:t="horizontal",decorative:s=!0,...o},n)=>r.jsxRuntimeExports.jsx(Rt.Root,{ref:n,decorative:s,orientation:t,className:u.cn("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));Lo.displayName=Rt.Root.displayName;const ti=1,si=1e6;let Me=0;function oi(){return Me=(Me+1)%Number.MAX_VALUE,Me.toString()}const De=new Map,vt=e=>{if(De.has(e))return;const t=setTimeout(()=>{De.delete(e),ge({type:"REMOVE_TOAST",toastId:e})},si);De.set(e,t)},Oo=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,ti)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(s=>s.id===t.toast.id?{...s,...t.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=t;return s?vt(s):e.toasts.forEach(o=>{vt(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(s=>s.id!==t.toastId)}}},je=[];let ke={toasts:[]};function ge(e){ke=Oo(ke,e),je.forEach(t=>{t(ke)})}function zo({...e}){const t=oi(),s=n=>ge({type:"UPDATE_TOAST",toast:{...n,id:t}}),o=()=>ge({type:"DISMISS_TOAST",toastId:t});return ge({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:n=>{n||o()}}}),{id:t,dismiss:o,update:s}}function Vo(){const[e,t]=f.useState(ke);return f.useEffect(()=>(je.push(t),()=>{const s=je.indexOf(t);s>-1&&je.splice(s,1)}),[e]),{...e,toast:zo,dismiss:s=>ge({type:"DISMISS_TOAST",toastId:s})}}const ni=Z.Provider,Fo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Z.Viewport,{ref:s,className:u.cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));Fo.displayName=Z.Viewport.displayName;const ri=ce.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Uo=f.forwardRef(({className:e,variant:t,...s},o)=>r.jsxRuntimeExports.jsx(Z.Root,{ref:o,className:u.cn(ri({variant:t}),e),...s}));Uo.displayName=Z.Root.displayName;const ai=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Z.Action,{ref:s,className:u.cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));ai.displayName=Z.Action.displayName;const qo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Z.Close,{ref:s,className:u.cn("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:r.jsxRuntimeExports.jsx(Y.Cross2Icon,{className:"h-4 w-4"})}));qo.displayName=Z.Close.displayName;const Ho=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Z.Title,{ref:s,className:u.cn("text-sm font-semibold [&+div]:text-xs",e),...t}));Ho.displayName=Z.Title.displayName;const $o=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Z.Description,{ref:s,className:u.cn("text-sm opacity-90",e),...t}));$o.displayName=Z.Description.displayName;function ii(){const{toasts:e}=Vo();return r.jsxRuntimeExports.jsxs(ni,{children:[e.map(({id:t,title:s,description:o,action:n,...a})=>r.jsxRuntimeExports.jsxs(Uo,{...a,children:[r.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[s&&r.jsxRuntimeExports.jsx(Ho,{children:s}),o&&r.jsxRuntimeExports.jsx($o,{children:o})]}),n,r.jsxRuntimeExports.jsx(qo,{})]},t)),r.jsxRuntimeExports.jsx(Fo,{})]})}const li=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("animate-pulse rounded-md bg-primary/10",e),...t}),it=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command,{ref:s,className:u.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));it.displayName=J.Command.displayName;const ci=({children:e,...t})=>r.jsxRuntimeExports.jsx(nt,{...t,children:r.jsxRuntimeExports.jsx(Be,{className:"overflow-hidden p-0",children:r.jsxRuntimeExports.jsx(it,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),Go=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsxRuntimeExports.jsx(Y.MagnifyingGlassIcon,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsxRuntimeExports.jsx(J.Command.Input,{ref:s,className:u.cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Go.displayName=J.Command.Input.displayName;const Yo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command.List,{ref:s,className:u.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Yo.displayName=J.Command.List.displayName;const Wo=f.forwardRef((e,t)=>r.jsxRuntimeExports.jsx(J.Command.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Wo.displayName=J.Command.Empty.displayName;const Ko=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command.Group,{ref:s,className:u.cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Ko.displayName=J.Command.Group.displayName;const Xo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command.Separator,{ref:s,className:u.cn("-mx-1 h-px bg-border",e),...t}));Xo.displayName=J.Command.Separator.displayName;const Jo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command.Item,{ref:s,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));Jo.displayName=J.Command.Item.displayName;const Zo=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Zo.displayName="CommandShortcut";const di=L.Root,ui=L.Trigger,mi=L.Group,pi=L.Portal,fi=L.Sub,xi=L.RadioGroup,Qo=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(L.SubTrigger,{ref:n,className:u.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...o,children:[s,r.jsxRuntimeExports.jsx(Y.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));Qo.displayName=L.SubTrigger.displayName;const en=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(L.SubContent,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));en.displayName=L.SubContent.displayName;const tn=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(L.Portal,{children:r.jsxRuntimeExports.jsx(L.Content,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})}));tn.displayName=L.Content.displayName;const sn=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(L.Item,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));sn.displayName=L.Item.displayName;const on=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(L.CheckboxItem,{ref:n,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...o,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(L.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.CheckIcon,{className:"h-4 w-4"})})}),t]}));on.displayName=L.CheckboxItem.displayName;const nn=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(L.RadioItem,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(L.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));nn.displayName=L.RadioItem.displayName;const rn=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(L.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...s}));rn.displayName=L.Label.displayName;const an=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(L.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-border",e),...t}));an.displayName=L.Separator.displayName;const ln=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});ln.displayName="ContextMenuShortcut";const gi=e=>{try{const t=document.getElementById("icon-picker-field"),s=document.createElement("div");Nn.render(r.jsxRuntimeExports.jsx(jt.IconPickerItem,{value:e}),s),t.appendChild(s),s.hidden=!0;let o=s.innerHTML;setTimeout(()=>t.removeChild(s),100);const a=new DOMParser().parseFromString(o,"image/svg+xml"),i=a.querySelector("svg");return i&&(i.removeAttribute("width"),i.removeAttribute("height")),new XMLSerializer().serializeToString(a)}catch(t){return console.error(t),""}},hi=({value:e,onChange:t})=>{const s=o=>{t("<svg />");const n=gi(o);t(n)};return r.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[r.jsxRuntimeExports.jsxs("div",{className:"group relative h-12 w-12",children:[r.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:e?e.replace("<svg",'<svg class="h-5 w-5"'):"<svg class='h-5 w-5' />"},className:"absolute left-1/2 top-1/2 z-0 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer bg-white"}),r.jsxRuntimeExports.jsx(jt,{value:e?"BiSolidGrid":null,onChange:s,pickButtonStyle:{position:"relative",height:"48px",width:"48px",border:"1px solid #BBBBBB",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",backgroundColor:"transparent",zIndex:1},searchInputStyle:{backgroundColor:"transparent",width:"100%",border:"1px solid #BBBBBB",margin:"0px 10px",padding:"10px"}})]}),r.jsxRuntimeExports.jsx("textarea",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",value:e,onChange:o=>t(o.target.value),className:"h-full w-full rounded-sm border border-foreground/20 px-2 py-1 text-xs shadow-sm focus:border-gray-500/80 focus:outline-none focus:ring-0",placeholder:"Choose icon or enter svg"})]})},bi=R.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-cah1BRL_.cjs"))),vi=R.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-5dRETWCo.cjs"))),cn=({isModalView:e=!1,onSelect:t=()=>{}})=>{const s=Q("uploadMediaCallback"),o=Q("unsplashAccessKey"),n=s===void 0,a=o===void 0,[i,d]=R.useState(a?"upload":n?"unsplash":"upload");return r.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[r.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:r.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:e&&n?"Unsplash images":e?"Select or upload images":"Images"})}),r.jsxRuntimeExports.jsxs(eo,{value:i,onValueChange:x=>d(x),className:"flex h-full w-full flex-col py-2",children:[!(n||a)&&r.jsxRuntimeExports.jsxs(at,{className:"w-full",children:[r.jsxRuntimeExports.jsx(Re,{value:"upload",className:"w-full",children:"Upload"}),r.jsxRuntimeExports.jsx(Re,{value:"unsplash",className:"w-full",children:"Unsplash"})]}),i==="unsplash"?r.jsxRuntimeExports.jsx(Ce,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:r.jsxRuntimeExports.jsx(R.Suspense,{fallback:r.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:r.jsxRuntimeExports.jsx(bi,{isModalView:e,onSelect:t})})}):r.jsxRuntimeExports.jsx(Ce,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:r.jsxRuntimeExports.jsx(R.Suspense,{fallback:r.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:r.jsxRuntimeExports.jsx(vi,{isModalView:e,onSelect:t})})})]})]})},yi=Object.freeze(Object.defineProperty({__proto__:null,default:cn},Symbol.toStringTag,{value:"Module"})),yt=({children:e,onSelect:t})=>{const[s,o]=R.useState(!1),n=(...a)=>{t.call(void 0,...a),o(!1)};return r.jsxRuntimeExports.jsxs(nt,{open:s,onOpenChange:a=>o(a),children:[r.jsxRuntimeExports.jsx(Ls,{asChild:!0,children:e}),r.jsxRuntimeExports.jsx(Be,{className:"flex h-3/4 max-w-5xl",children:r.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:r.jsxRuntimeExports.jsx(cn,{isModalView:!0,onSelect:n})})})]})},ji=({value:e,onChange:t,id:s,onBlur:o})=>{const n=Q("uploadMediaCallback"),a=Q("unsplashAccessKey"),i=n===void 0,d=a===void 0;return r.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[e?r.jsxRuntimeExports.jsx("img",{src:e,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):r.jsxRuntimeExports.jsx(yt,{onSelect:t,children:r.jsxRuntimeExports.jsx("div",{className:"h-20 w-20 cursor-pointer rounded-md border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px] hover:border-gray-400"})}),r.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[!(i&&d)&&r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(yt,{onSelect:t,children:r.jsxRuntimeExports.jsx("small",{className:"cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700",children:e||!l.isEmpty(e)?"Replace Image":"Choose Image"})}),r.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"})]}),r.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",type:"url",className:"text-xs",placeholder:"Enter image URL",value:e,onBlur:({target:{value:x}})=>o(s,x),onChange:x=>t(x.target.value)})]})]})},ki=({id:e,placeholder:t,value:s,onChange:o,onBlur:n})=>{const a={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},i=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:r.jsxRuntimeExports.jsx(_n,{id:e,value:s,onBlur:d=>n(e,d),onChange:d=>o(d),modules:a,formats:i,placeholder:t,className:"mt-1 rounded-md"})},wi=({schema:e,formData:t,onChange:s})=>{const[o,n]=R.useState([]),a=Q("getPages",()=>[]),{type:i="page",href:d="",target:x="self"}=t;return R.useEffect(()=>{(async()=>{const c=await a();n(c||[])})()},[]),r.jsxRuntimeExports.jsxs("div",{children:[r.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(e==null?void 0:e.title)??"Link"}),r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[r.jsxRuntimeExports.jsx("select",{name:"type",value:i,onChange:c=>s({...t,type:c.target.value}),children:[{const:"page",title:"Open Page"},{const:"url",title:"Open URL"},{const:"email",title:"Compose Email"},{const:"telephone",title:"Call Phone"},{const:"scroll",title:"Scroll to element"}].map(c=>r.jsxRuntimeExports.jsx("option",{value:c.const,children:c.title},c.const))}),i==="page"?r.jsxRuntimeExports.jsxs("select",{name:"href",value:d,onChange:c=>s({...t,href:c.target.value||"#"}),children:[r.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),l.map(o,c=>r.jsxRuntimeExports.jsx("option",{value:c.slug,children:c.name},c.uuid))]}):r.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",name:"href",type:"text",value:d,onChange:c=>s({...t,href:c.target.value||"#"}),placeholder:i==="page"||i==="url"?"Enter URL":i==="scroll"?"#ElementID":"Enter detail"}),(i==="page"||i==="url")&&r.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",type:"checkbox",defaultChecked:x==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>s({...t,target:x==="_blank"?"_self":"_blank"})}),r.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})};exports.Accordion=wa;exports.AccordionContent=ws;exports.AccordionItem=js;exports.AccordionTrigger=ks;exports.Alert=Rs;exports.AlertDescription=As;exports.AlertDialog=Aa;exports.AlertDialogAction=Ms;exports.AlertDialogCancel=Ds;exports.AlertDialogContent=_s;exports.AlertDialogDescription=Is;exports.AlertDialogFooter=Ps;exports.AlertDialogHeader=Bs;exports.AlertDialogTitle=Ts;exports.AlertDialogTrigger=Sa;exports.AlertTitle=Cs;exports.Badge=Ca;exports.Button=ys;exports.Card=Hs;exports.CardContent=Ws;exports.CardDescription=Ys;exports.CardFooter=Ks;exports.CardHeader=$s;exports.CardTitle=Gs;exports.Command=it;exports.CommandDialog=ci;exports.CommandEmpty=Wo;exports.CommandGroup=Ko;exports.CommandInput=Go;exports.CommandItem=Jo;exports.CommandList=Yo;exports.CommandSeparator=Xo;exports.CommandShortcut=Zo;exports.ContextMenu=di;exports.ContextMenuCheckboxItem=on;exports.ContextMenuContent=tn;exports.ContextMenuGroup=mi;exports.ContextMenuItem=sn;exports.ContextMenuLabel=rn;exports.ContextMenuPortal=pi;exports.ContextMenuRadioGroup=xi;exports.ContextMenuRadioItem=nn;exports.ContextMenuSeparator=an;exports.ContextMenuShortcut=ln;exports.ContextMenuSub=fi;exports.ContextMenuSubContent=en;exports.ContextMenuSubTrigger=Qo;exports.ContextMenuTrigger=ui;exports.Dialog=nt;exports.DialogContent=Be;exports.DialogDescription=qs;exports.DialogFooter=Fs;exports.DialogHeader=Vs;exports.DialogTitle=Us;exports.DialogTrigger=Ls;exports.DropdownMenu=Ka;exports.DropdownMenuCheckboxItem=Po;exports.DropdownMenuContent=_o;exports.DropdownMenuGroup=Ja;exports.DropdownMenuItem=Bo;exports.DropdownMenuLabel=Io;exports.DropdownMenuPortal=Za;exports.DropdownMenuRadioGroup=ei;exports.DropdownMenuRadioItem=To;exports.DropdownMenuSeparator=Mo;exports.DropdownMenuShortcut=Do;exports.DropdownMenuSub=Qa;exports.DropdownMenuSubContent=No;exports.DropdownMenuSubTrigger=Eo;exports.DropdownMenuTrigger=Xa;exports.HoverCard=Va;exports.HoverCardContent=xo;exports.HoverCardTrigger=Fa;exports.IconPickerField=hi;exports.ImagePickerField=ji;exports.ImagesPanel=yi;exports.Input=Xs;exports.Label=Js;exports.LinkField=wi;exports.Menubar=oo;exports.MenubarCheckboxItem=co;exports.MenubarContent=io;exports.MenubarGroup=Da;exports.MenubarItem=lo;exports.MenubarLabel=mo;exports.MenubarMenu=Ma;exports.MenubarPortal=La;exports.MenubarRadioGroup=za;exports.MenubarRadioItem=uo;exports.MenubarSeparator=po;exports.MenubarShortcut=fo;exports.MenubarSub=Oa;exports.MenubarSubContent=ao;exports.MenubarSubTrigger=ro;exports.MenubarTrigger=no;exports.Popover=Ta;exports.PopoverContent=so;exports.PopoverTrigger=Ia;exports.RichTextEditorField=ki;exports.ScrollArea=Qs;exports.ScrollBar=rt;exports.Select=Ua;exports.SelectContent=ho;exports.SelectGroup=qa;exports.SelectItem=vo;exports.SelectLabel=bo;exports.SelectSeparator=yo;exports.SelectTrigger=go;exports.SelectValue=Ha;exports.Separator=Lo;exports.Sheet=$a;exports.SheetClose=Ya;exports.SheetContent=wo;exports.SheetDescription=So;exports.SheetFooter=Co;exports.SheetHeader=Ro;exports.SheetTitle=Ao;exports.SheetTrigger=Ga;exports.Skeleton=li;exports.Switch=vs;exports.Tabs=eo;exports.TabsContent=Ce;exports.TabsList=at;exports.TabsTrigger=Re;exports.Textarea=Zs;exports.Toaster=ii;exports.Toggle=bs;exports.Tooltip=Ba;exports.TooltipContent=to;exports.TooltipPortal=Na;exports.TooltipProvider=_a;exports.TooltipTrigger=Pa;exports.activePanelAtom=ls;exports.aiAssistantActiveAtom=ot;exports.atom=ne;exports.atomWithDefault=Wn;exports.atomWithStorage=ue;exports.badgeVariants=Ss;exports.builderSaveStateAtom=Ne;exports.buttonVariants=_e;exports.canAcceptChildBlock=Oe;exports.canDeleteBlock=tr;exports.canDuplicateBlock=er;exports.canvasIframeAtom=is;exports.canvasSettingsAtom=xs;exports.chaiBuilderPropsAtom=He;exports.chaiExternalDataAtom=_t;exports.convertDotNotationToObject=mr;exports.createStore=Ct;exports.dataProvidersAtom=Qe;exports.draggedBlockIdAtom=ps;exports.draggingFlagAtom=ms;exports.editLayerNameAtom=as;exports.getBlockJSONFromSchemas=Ve;exports.getBlockJSONFromUISchemas=ze;exports.inlineEditingActiveAtom=us;exports.isDevelopment=Zn;exports.networkModeAtom=rs;exports.presentBlocksAtom=ee;exports.reducer=Oo;exports.showPredefinedBlockCategoryAtom=cs;exports.toast=zo;exports.toggleVariants=hs;exports.treeDSBlocks=It;exports.treeRefAtom=fs;exports.useActiveModal=ra;exports.useActivePanel=fa;exports.useAddBlock=Er;exports.useAddBlockParent=xa;exports.useAddClassesToBlocks=Tr;exports.useAllBlocks=aa;exports.useAtom=Et;exports.useAtomValue=At;exports.useBlocksContainer=hr;exports.useBlocksStore=me;exports.useBlocksStoreUndoableActions=te;exports.useBrandingOptions=Xe;exports.useBuilderProp=Q;exports.useBuilderReset=ba;exports.useCanvasWidth=Ir;exports.useCanvasZoom=Dr;exports.useCodeEditor=ka;exports.useCopyBlockIds=Lr;exports.useCopyToClipboard=ya;exports.useCurrentPage=Vt;exports.useCutBlockIds=Zt;exports.useDarkMode=Or;exports.useDuplicateBlocks=es;exports.useGetPageData=$t;exports.useHiddenBlockIds=Vr;exports.useHighlightBlockId=ts;exports.usePageDataProviders=Gt;exports.usePasteBlocks=qr;exports.usePreviewMode=$r;exports.useReadOnlyMode=ua;exports.useRemoveBlocks=kr;exports.useRemoveClassesFromBlocks=Yr;exports.useSavePage=jr;exports.useSelectedBlock=cr;exports.useSelectedBlockAllClasses=Wr;exports.useSelectedBlockCurrentClasses=Jr;exports.useSelectedBlockIds=be;exports.useSelectedBlocksDisplayChild=lr;exports.useSelectedBreakpoints=ha;exports.useSelectedStylingBlocks=Yt;exports.useSetAtom=St;exports.useStore=Ue;exports.useStreamMultipleBlocksProps=sa;exports.useStylingBreakpoint=Wt;exports.useStylingState=Zr;exports.useToast=Vo;exports.useUILibraryBlocks=va;exports.useUndoManager=et;exports.useUpdateBlocksProps=Qr;exports.useUpdateBlocksPropsRealtime=oa;exports.useUpdateMultipleBlocksProps=ea;exports.xShowBlocksAtom=gs;