@chaibuilder/sdk 0.1.14 → 0.1.16

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 (40) hide show
  1. package/dist/{AddBlocks-96508222.cjs → AddBlocks-59a68fc9.cjs} +1 -1
  2. package/dist/{AddBlocks-7fdc4ba0.js → AddBlocks-6f4db22d.js} +1 -1
  3. package/dist/{BrandingOptions-09398734.cjs → BrandingOptions-8e7a159f.cjs} +1 -1
  4. package/dist/{BrandingOptions-7e8e661f.js → BrandingOptions-d6351932.js} +1 -1
  5. package/dist/{CanvasArea-99a4b011.cjs → CanvasArea-08537c6e.cjs} +9 -9
  6. package/dist/{CanvasArea-b80579e7.js → CanvasArea-a585620d.js} +52 -52
  7. package/dist/CurrentPage-cbbfdbf4.cjs +1 -0
  8. package/dist/{CurrentPage-55e3bf07.js → CurrentPage-e8f8ff05.js} +19 -17
  9. package/dist/{Layers-67b08af7.cjs → Layers-636e0bc6.cjs} +1 -1
  10. package/dist/{Layers-b634232b.js → Layers-6fc21e86.js} +2 -2
  11. package/dist/{MarkAsGlobalBlock-4c2bb9a5.cjs → MarkAsGlobalBlock-23dd24b9.cjs} +1 -1
  12. package/dist/{MarkAsGlobalBlock-0fc014d9.js → MarkAsGlobalBlock-cf7e8b31.js} +1 -1
  13. package/dist/{PagesPanel-9d4ce1e5.js → PagesPanel-7db807df.js} +2 -2
  14. package/dist/{PagesPanel-2f2862cf.cjs → PagesPanel-bf13d0a5.cjs} +1 -1
  15. package/dist/{ProjectPanel-c5f18814.js → ProjectPanel-a7c78e1f.js} +2 -2
  16. package/dist/{ProjectPanel-baeff63d.cjs → ProjectPanel-d98d3585.cjs} +1 -1
  17. package/dist/{Settings-a86df093.cjs → Settings-1b76c006.cjs} +1 -1
  18. package/dist/{Settings-b40d4aa7.js → Settings-1e6e0534.js} +1 -1
  19. package/dist/{SidePanels-d3d73146.cjs → SidePanels-55124e18.cjs} +1 -1
  20. package/dist/{SidePanels-ddda8d47.js → SidePanels-af4f2c45.js} +2 -2
  21. package/dist/{Topbar-3ba3b532.js → Topbar-4f1aca98.js} +1 -1
  22. package/dist/{Topbar-1fe796aa.cjs → Topbar-5df341d7.cjs} +1 -1
  23. package/dist/{add-page-modal-230c11e1.cjs → add-page-modal-b685709e.cjs} +1 -1
  24. package/dist/{add-page-modal-7d461e83.js → add-page-modal-d4f5ba20.js} +1 -1
  25. package/dist/core.cjs +1 -1
  26. package/dist/core.js +1 -1
  27. package/dist/{delete-page-modal-2ab39d8b.js → delete-page-modal-00d5fbab.js} +1 -1
  28. package/dist/{delete-page-modal-2423cf66.cjs → delete-page-modal-bbd3ffa2.cjs} +1 -1
  29. package/dist/{index-2d6e8480.js → index-8a7a37ce.js} +4 -4
  30. package/dist/{index-0712a005.cjs → index-bf44bc93.cjs} +2 -2
  31. package/dist/{page-viewer-5356aac2.js → page-viewer-c494031b.js} +2 -2
  32. package/dist/{page-viewer-2613effe.cjs → page-viewer-f0a54a92.cjs} +1 -1
  33. package/dist/{project-general-setting-dc8d6a84.cjs → project-general-setting-a3e99d1e.cjs} +1 -1
  34. package/dist/{project-general-setting-77aab031.js → project-general-setting-fca12629.js} +1 -1
  35. package/dist/render.cjs +1 -1
  36. package/dist/render.js +2 -2
  37. package/dist/{single-page-detail-56a0f23c.cjs → single-page-detail-84c67e67.cjs} +1 -1
  38. package/dist/{single-page-detail-1a999837.js → single-page-detail-ff7fceb1.js} +2 -2
  39. package/package.json +1 -1
  40. package/dist/CurrentPage-d8093bd5.cjs +0 -1
@@ -1,13 +1,13 @@
1
- var yt = Object.defineProperty;
2
- var vt = (e, r, n) => r in e ? yt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
3
- var V = (e, r, n) => (vt(e, typeof r != "symbol" ? r + "" : r, n), n);
1
+ var vt = Object.defineProperty;
2
+ var gt = (e, r, n) => r in e ? vt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
3
+ var V = (e, r, n) => (gt(e, typeof r != "symbol" ? r + "" : r, n), n);
4
4
  import { j as t } from "./jsx-runtime-944c88e2.js";
5
- import G, { createElement as gt, useCallback as Q, useState as H, useEffect as F, Component as Xe, Children as xt, useRef as Oe, useMemo as bt, lazy as wt, Suspense as Et } from "react";
6
- import { map as ie, includes as Me, toUpper as ye, round as St, isEmpty as ee, first as ce, get as $, memoize as Tt, find as jt, filter as Ze, isString as Je } from "lodash";
5
+ import G, { createElement as xt, useCallback as Q, useState as H, useEffect as F, Component as Xe, Children as bt, Suspense as Ze, useRef as Oe, useMemo as wt, lazy as Et } from "react";
6
+ import { map as ie, includes as Me, toUpper as ye, round as St, isEmpty as ee, first as ce, get as $, memoize as Tt, find as jt, filter as Je, isString as Qe } from "lodash";
7
7
  import { ResetIcon as De, DotsVerticalIcon as Ct, MobileIcon as Be, LaptopIcon as kt, DesktopIcon as Rt, EraserIcon as At, ZoomInIcon as _t, ArrowUpIcon as Pt, CopyIcon as It, TrashIcon as Ot, DragHandleDots2Icon as Mt } from "@radix-ui/react-icons";
8
- import { B as le, u as Qe, S as et } from "./useBuilderProp-81a14920.js";
9
- import { c as ke, d as tt, e as Re, f as Dt, g as Bt, h as X, i as Z, j as $t, k as rt, l as nt, m as Nt, n as Lt, o as Ft, p as ot, q as st, u as Wt, r as qt, s as Ut, t as Yt, v as zt, w as Ht, x as Ae, y as at, z as Kt, A as Vt, B as Gt, b as Xt, E as Zt } from "./index-2d6e8480.js";
10
- import { useTranslation as it } from "react-i18next";
8
+ import { B as le, u as et, S as tt } from "./useBuilderProp-81a14920.js";
9
+ import { c as ke, d as rt, e as Re, f as Dt, g as Bt, h as X, i as Z, j as $t, k as nt, l as ot, m as Nt, n as Lt, o as Ft, p as st, q as at, u as Wt, r as qt, s as Ut, t as Yt, v as zt, w as Ht, x as Ae, y as it, z as Kt, A as Vt, B as Gt, b as Xt, E as Zt } from "./index-8a7a37ce.js";
10
+ import { useTranslation as ct } from "react-i18next";
11
11
  import { S as se } from "./separator-a80d065b.js";
12
12
  import { S as Jt, D as Qt, c as er, d as tr, h as rr, i as nr, f as or, H as sr, a as ar, b as ir } from "./dropdown-menu-ae3ed09b.js";
13
13
  import { L as cr } from "./label-e770a087.js";
@@ -20,7 +20,7 @@ import { useResizeObserver as Er } from "@react-hookz/web";
20
20
  import { tailwindcssPaletteGenerator as Sr } from "@bobthered/tailwindcss-palette-generator";
21
21
  import { Provider as Tr } from "react-wrap-balancer";
22
22
  import { twMerge as jr } from "tailwind-merge";
23
- import { S as ct, a as $e } from "./MODIFIERS-c2e02614.js";
23
+ import { S as lt, a as $e } from "./MODIFIERS-c2e02614.js";
24
24
  import { getBlockComponent as Cr } from "@chaibuilder/blocks";
25
25
  import Ne from "react-dom";
26
26
  import { g as kr } from "./_commonjsHelpers-d4512b9c.js";
@@ -54,7 +54,7 @@ const Rr = () => {
54
54
  ] });
55
55
  };
56
56
  function Ar() {
57
- const [e, r] = tt(), { t: n } = it();
57
+ const [e, r] = rt(), { t: n } = ct();
58
58
  return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center", children: [
59
59
  /* @__PURE__ */ t.jsx(cr, { htmlFor: "dark-mode-switch", children: n("dark_mode") }),
60
60
  /* @__PURE__ */ t.jsxs(
@@ -177,7 +177,7 @@ const Le = ({ landscape: e = !1 }) => /* @__PURE__ */ t.jsxs(
177
177
  return /* @__PURE__ */ t.jsxs("div", { className: "flex items-center rounded-md", children: [
178
178
  ie(
179
179
  Fe.filter((s) => Me(n, ye(s.breakpoint))),
180
- (s) => /* @__PURE__ */ gt(_r, { ...s, onClick: r, key: s.breakpoint, currentBreakpoint: e })
180
+ (s) => /* @__PURE__ */ xt(_r, { ...s, onClick: r, key: s.breakpoint, currentBreakpoint: e })
181
181
  ),
182
182
  /* @__PURE__ */ t.jsxs(Qt, { children: [
183
183
  /* @__PURE__ */ t.jsx(er, { asChild: !0, children: /* @__PURE__ */ t.jsx("span", { className: "cursor-pointer px-2.5 hover:opacity-80", children: /* @__PURE__ */ t.jsx(Ct, { className: "scale-90 transform" }) }) }),
@@ -218,7 +218,7 @@ const Le = ({ landscape: e = !1 }) => /* @__PURE__ */ t.jsxs(
218
218
  ] })
219
219
  ] }) });
220
220
  }, Or = () => {
221
- const e = $t("darkMode", !1), [r] = rt();
221
+ const e = $t("darkMode", !1), [r] = nt();
222
222
  return /* @__PURE__ */ t.jsxs("div", { className: "flex h-10 items-center justify-between border-b bg-background/70 px-2", children: [
223
223
  /* @__PURE__ */ t.jsxs("div", { className: "flex h-full space-x-2", children: [
224
224
  e ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
@@ -284,7 +284,7 @@ const Le = ({ landscape: e = !1 }) => /* @__PURE__ */ t.jsxs(
284
284
  <div class="frame-root"></div>
285
285
  </body>
286
286
  </html>`, Dr = (e) => {
287
- const [r] = Re(), [, n] = rt(), [i, d] = H({}), s = Q(() => {
287
+ const [r] = Re(), [, n] = nt(), [i, d] = H({}), s = Q(() => {
288
288
  const { width: a, height: f } = e;
289
289
  if (a < r) {
290
290
  const y = parseFloat((a / r).toString());
@@ -471,7 +471,7 @@ function $r() {
471
471
  }()), P;
472
472
  }
473
473
  var Ue;
474
- function lt() {
474
+ function dt() {
475
475
  return Ue || (Ue = 1, process.env.NODE_ENV === "production" ? ae.exports = Br() : ae.exports = $r()), ae.exports;
476
476
  }
477
477
  /*
@@ -535,7 +535,7 @@ function _e() {
535
535
  return xe = e, xe;
536
536
  }
537
537
  var be, He;
538
- function dt() {
538
+ function ut() {
539
539
  return He || (He = 1, be = Function.call.bind(Object.prototype.hasOwnProperty)), be;
540
540
  }
541
541
  var we, Ke;
@@ -546,7 +546,7 @@ function Lr() {
546
546
  var e = function() {
547
547
  };
548
548
  if (process.env.NODE_ENV !== "production") {
549
- var r = _e(), n = {}, i = dt();
549
+ var r = _e(), n = {}, i = ut();
550
550
  e = function(s) {
551
551
  var a = "Warning: " + s;
552
552
  typeof console < "u" && console.error(a);
@@ -593,7 +593,7 @@ function Fr() {
593
593
  if (Ve)
594
594
  return Ee;
595
595
  Ve = 1;
596
- var e = lt(), r = Nr(), n = _e(), i = dt(), d = Lr(), s = function() {
596
+ var e = dt(), r = Nr(), n = _e(), i = ut(), d = Lr(), s = function() {
597
597
  };
598
598
  process.env.NODE_ENV !== "production" && (s = function(f) {
599
599
  var y = "Warning: " + f;
@@ -960,17 +960,17 @@ function Wr() {
960
960
  }, Se;
961
961
  }
962
962
  if (process.env.NODE_ENV !== "production") {
963
- var qr = lt(), Ur = !0;
963
+ var qr = dt(), Ur = !0;
964
964
  Te.exports = Fr()(qr.isElement, Ur);
965
965
  } else
966
966
  Te.exports = Wr()();
967
967
  var Yr = Te.exports;
968
968
  const L = /* @__PURE__ */ kr(Yr);
969
- let ut, ft;
970
- typeof document < "u" && (ut = document);
971
- typeof window < "u" && (ft = window);
972
- const pt = G.createContext({ document: ut, window: ft }), Pe = () => G.useContext(pt), { Provider: zr, Consumer: eo } = pt;
973
- class ht extends Xe {
969
+ let ft, pt;
970
+ typeof document < "u" && (ft = document);
971
+ typeof window < "u" && (pt = window);
972
+ const ht = G.createContext({ document: ft, window: pt }), Pe = () => G.useContext(ht), { Provider: zr, Consumer: eo } = ht;
973
+ class mt extends Xe {
974
974
  componentDidMount() {
975
975
  this.props.contentDidMount();
976
976
  }
@@ -978,10 +978,10 @@ class ht extends Xe {
978
978
  this.props.contentDidUpdate();
979
979
  }
980
980
  render() {
981
- return xt.only(this.props.children);
981
+ return bt.only(this.props.children);
982
982
  }
983
983
  }
984
- V(ht, "propTypes", {
984
+ V(mt, "propTypes", {
985
985
  children: L.element.isRequired,
986
986
  contentDidMount: L.func.isRequired,
987
987
  contentDidUpdate: L.func.isRequired
@@ -1023,7 +1023,7 @@ class je extends Xe {
1023
1023
  const n = this.getDoc();
1024
1024
  if (!n)
1025
1025
  return null;
1026
- const i = this.props.contentDidMount, d = this.props.contentDidUpdate, s = n.defaultView || n.parentView, a = /* @__PURE__ */ t.jsx(ht, { contentDidMount: i, contentDidUpdate: d, children: /* @__PURE__ */ t.jsx(zr, { value: { document: n, window: s }, children: /* @__PURE__ */ t.jsx("div", { className: "frame-content", children: this.props.children }) }) }), f = this.getMountTarget();
1026
+ const i = this.props.contentDidMount, d = this.props.contentDidUpdate, s = n.defaultView || n.parentView, a = /* @__PURE__ */ t.jsx(mt, { contentDidMount: i, contentDidUpdate: d, children: /* @__PURE__ */ t.jsx(zr, { value: { document: n, window: s }, children: /* @__PURE__ */ t.jsx("div", { className: "frame-content", children: this.props.children }) }) }), f = this.getMountTarget();
1027
1027
  return [Ne.createPortal(this.props.head, this.getDoc().head), Ne.createPortal(a, f)];
1028
1028
  }
1029
1029
  render() {
@@ -1066,7 +1066,7 @@ const Hr = G.forwardRef((e, r) => /* @__PURE__ */ t.jsx(je, { ...e, forwardedRef
1066
1066
  setTimeout(() => {
1067
1067
  if (!ee(i))
1068
1068
  return;
1069
- const s = mt(r, ce(n));
1069
+ const s = yt(r, ce(n));
1070
1070
  if (s) {
1071
1071
  const a = s.getAttribute("data-style-prop");
1072
1072
  if (a) {
@@ -1076,8 +1076,8 @@ const Hr = G.forwardRef((e, r) => /* @__PURE__ */ t.jsx(je, { ...e, forwardedRef
1076
1076
  }
1077
1077
  }, 100);
1078
1078
  }, [r, n, d, i]), /* @__PURE__ */ t.jsx("div", { id: "canvas", className: "relative h-screen max-w-full outline-2", children: e });
1079
- }, mt = (e, r) => e.querySelector(`[data-block-id="${r}"]`), Vr = () => {
1080
- const { window: e } = Pe(), [r, n] = X(), [, i] = Z(), { undo: d, redo: s } = ke(), a = nt(), [, f] = Nt(), [, y] = Lt(), { pasteBlocks: p } = Ft(), [, m] = ot(), h = st(), { savePage: b } = Wt(), [v] = te(qt), [, O] = te(Ut), E = (C) => {
1079
+ }, yt = (e, r) => e.querySelector(`[data-block-id="${r}"]`), Vr = () => {
1080
+ const { window: e } = Pe(), [r, n] = X(), [, i] = Z(), { undo: d, redo: s } = ke(), a = ot(), [, f] = Nt(), [, y] = Lt(), { pasteBlocks: p } = Ft(), [, m] = st(), h = at(), { savePage: b } = Wt(), [v] = te(qt), [, O] = te(Ut), E = (C) => {
1081
1081
  C.key === "Enter" && (C.preventDefault(), r.length === 1 && O(ce(r)));
1082
1082
  };
1083
1083
  return F(() => {
@@ -1136,7 +1136,7 @@ const Hr = G.forwardRef((e, r) => /* @__PURE__ */ t.jsx(je, { ...e, forwardedRef
1136
1136
  selectedBlockElement: e,
1137
1137
  block: r
1138
1138
  }) => {
1139
- const n = st(), i = nt(), [, d] = X(), [, s] = Z(), { floatingStyles: a, refs: f, update: y } = xr({
1139
+ const n = at(), i = ot(), [, d] = X(), [, s] = Z(), { floatingStyles: a, refs: f, update: y } = xr({
1140
1140
  placement: "top-start",
1141
1141
  middleware: [br(), gr()],
1142
1142
  elements: {
@@ -1176,7 +1176,7 @@ const Hr = G.forwardRef((e, r) => /* @__PURE__ */ t.jsx(je, { ...e, forwardedRef
1176
1176
  }
1177
1177
  );
1178
1178
  }, Zr = ({ model: e }) => {
1179
- const [r] = Ht(), [n] = X(), [i] = tt(), [d] = Ae(), [s] = Z(), { document: a, window: f } = Pe(), [y] = H(a == null ? void 0 : a.getElementById("highlighted-block")), [p] = H(
1179
+ const [r] = Ht(), [n] = X(), [i] = rt(), [d] = Ae(), [s] = Z(), { document: a, window: f } = Pe(), [y] = H(a == null ? void 0 : a.getElementById("highlighted-block")), [p] = H(
1180
1180
  a == null ? void 0 : a.getElementById("selected-block")
1181
1181
  ), [m] = H(
1182
1182
  a == null ? void 0 : a.getElementById("selected-styling-block")
@@ -1265,15 +1265,15 @@ const Hr = G.forwardRef((e, r) => /* @__PURE__ */ t.jsx(je, { ...e, forwardedRef
1265
1265
  h && /* @__PURE__ */ t.jsx("style", { children: `h1,h2,h3,h4,h5,h6{font-family: "${h}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}` })
1266
1266
  ] }) : null;
1267
1267
  }, Jr = () => {
1268
- const { t: e } = it();
1268
+ const { t: e } = ct();
1269
1269
  return /* @__PURE__ */ t.jsx("div", { className: "my-auto py-24 text-center text-gray-600 dark:text-white", children: /* @__PURE__ */ t.jsx("h1", { className: "mb-10 text-4xl ", children: e("canvas_empty") }) });
1270
1270
  }, Qr = (e) => {
1271
1271
  const r = {};
1272
1272
  return Object.keys(e).forEach((n) => {
1273
- Je(e[n]) && e[n].startsWith($e) && (r[n] = e[n].replace($e, "").split(","));
1273
+ Qe(e[n]) && e[n].startsWith($e) && (r[n] = e[n].replace($e, "").split(","));
1274
1274
  }), r;
1275
1275
  }, en = Tt((e) => {
1276
- const r = e.replace(ct, "").split(",");
1276
+ const r = e.replace(lt, "").split(",");
1277
1277
  return jr(r[0], r[1]);
1278
1278
  });
1279
1279
  function tn(e, r) {
@@ -1282,7 +1282,7 @@ function tn(e, r) {
1282
1282
  function rn(e, r, n, i) {
1283
1283
  const d = {};
1284
1284
  return Object.keys(e).forEach((s) => {
1285
- if (Je(e[s]) && e[s].startsWith(ct)) {
1285
+ if (Qe(e[s]) && e[s].startsWith(lt)) {
1286
1286
  const a = en(e[s]);
1287
1287
  d[s] = {
1288
1288
  className: a,
@@ -1298,7 +1298,7 @@ function rn(e, r, n, i) {
1298
1298
  }), d;
1299
1299
  }
1300
1300
  function Ce({ blocks: e }) {
1301
- const r = at(), [, n] = Ae(), [, i] = Z(), [, d] = X(), s = Q(
1301
+ const r = it(), [, n] = Ae(), [, i] = Z(), [, d] = X(), s = Q(
1302
1302
  (p) => {
1303
1303
  var h;
1304
1304
  const m = (h = p.currentTarget) == null ? void 0 : h.getAttribute("data-style-id");
@@ -1325,7 +1325,7 @@ function Ce({ blocks: e }) {
1325
1325
  [i, d]
1326
1326
  ), y = Q(
1327
1327
  (p) => rn(p, s, a, f),
1328
- [s, a]
1328
+ [f, s, a]
1329
1329
  );
1330
1330
  return /* @__PURE__ */ t.jsx(t.Fragment, { children: G.Children.toArray(
1331
1331
  e.map((p, m) => {
@@ -1335,29 +1335,29 @@ function Ce({ blocks: e }) {
1335
1335
  h[C].map((g) => /* @__PURE__ */ t.jsx(Ce, { blocks: [jt(r, { _id: g })] }))
1336
1336
  );
1337
1337
  });
1338
- const v = Ze(r, { _parent: p._id });
1338
+ const v = Je(r, { _parent: p._id });
1339
1339
  b.children = v.length ? /* @__PURE__ */ t.jsx(Ce, { blocks: v }) : null;
1340
- const O = Cr(p._type), E = (O == null ? void 0 : O.component) || null;
1341
- return G.createElement(E, {
1340
+ const O = Cr(p._type), E = $(O, "builderComponent", O == null ? void 0 : O.component) || null;
1341
+ return /* @__PURE__ */ t.jsx(Ze, { children: G.createElement(E, {
1342
1342
  blockProps: {
1343
1343
  onClick: f,
1344
1344
  "data-block-id": p._id,
1345
1345
  "data-block-type": p._type
1346
1346
  },
1347
+ inBuilder: !0,
1347
1348
  ...p,
1348
1349
  index: m,
1349
1350
  ...y(p),
1350
- ...b,
1351
- inBuilder: !0
1352
- });
1351
+ ...b
1352
+ }) });
1353
1353
  })
1354
1354
  ) });
1355
1355
  }
1356
1356
  const nn = () => {
1357
- const e = at();
1358
- return /* @__PURE__ */ t.jsx(Tr, { children: e.length ? /* @__PURE__ */ t.jsx(Ce, { blocks: Ze(e, (r) => ee(r._parent)) }) : /* @__PURE__ */ t.jsx(Jr, {}) });
1357
+ const e = it();
1358
+ return /* @__PURE__ */ t.jsx(Tr, { children: e.length ? /* @__PURE__ */ t.jsx(Ce, { blocks: Je(e, (r) => ee(r._parent)) }) : /* @__PURE__ */ t.jsx(Jr, {}) });
1359
1359
  }, on = (e, r) => e.querySelector(`[data-style-id="${r}"]`), sn = () => {
1360
- const [e] = te(Kt), [r] = ot(), [n] = Re(), [, i] = X(), d = Vt(), [, s] = Ae(), a = Oe(null), f = Oe(null), [y, p] = H({ width: 0, height: 0 }), m = Dr(y), [h, b] = H(0), [v, O] = H([]), [, E] = H([]), [, C] = te(Gt), [g, U] = Z(), M = Qe("loadingCanvas", !1);
1360
+ const [e] = te(Kt), [r] = st(), [n] = Re(), [, i] = X(), d = Vt(), [, s] = Ae(), a = Oe(null), f = Oe(null), [y, p] = H({ width: 0, height: 0 }), m = Dr(y), [h, b] = H(0), [v, O] = H([]), [, E] = H([]), [, C] = te(Gt), [g, U] = Z(), M = et("loadingCanvas", !1);
1361
1361
  F(() => {
1362
1362
  const { clientWidth: D, clientHeight: W } = f.current;
1363
1363
  p({ width: D, height: W }), h === 0 && b(D);
@@ -1369,7 +1369,7 @@ const nn = () => {
1369
1369
  F(() => {
1370
1370
  var D, W;
1371
1371
  if (d && d.type !== "Multiple" && a.current) {
1372
- const q = mt(a.current.contentDocument, d._id);
1372
+ const q = yt(a.current.contentDocument, d._id);
1373
1373
  q && (B(q) || (W = (D = a.current) == null ? void 0 : D.contentWindow) == null || W.scrollTo({ top: q.offsetTop, behavior: "smooth" }), O([q]));
1374
1374
  }
1375
1375
  }, [d]), F(() => {
@@ -1382,7 +1382,7 @@ const nn = () => {
1382
1382
  } else
1383
1383
  E([null]);
1384
1384
  }, [g]);
1385
- const l = bt(() => {
1385
+ const l = wt(() => {
1386
1386
  let D = Mr;
1387
1387
  return e === "offline" && (D = D.replace(
1388
1388
  "https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio",
@@ -1419,7 +1419,7 @@ const nn = () => {
1419
1419
  ),
1420
1420
  /* @__PURE__ */ t.jsx(Zr, { model: "page" }),
1421
1421
  /* @__PURE__ */ t.jsxs(Kr, { children: [
1422
- M ? /* @__PURE__ */ t.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ t.jsx(et, { className: "h-full" }) }) : /* @__PURE__ */ t.jsx(nn, {}),
1422
+ M ? /* @__PURE__ */ t.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ t.jsx(tt, { className: "h-full" }) }) : /* @__PURE__ */ t.jsx(nn, {}),
1423
1423
  /* @__PURE__ */ t.jsx("div", { className: "h-60" })
1424
1424
  ] })
1425
1425
  ]
@@ -1427,15 +1427,15 @@ const nn = () => {
1427
1427
  )
1428
1428
  }
1429
1429
  );
1430
- }, an = wt(() => import("./AddBlocks-7fdc4ba0.js")), to = () => {
1431
- const e = Qe("mode", ve.STATIC), [r, n] = te(Xt), i = {
1430
+ }, an = Et(() => import("./AddBlocks-6f4db22d.js")), to = () => {
1431
+ const e = et("mode", ve.STATIC), [r, n] = te(Xt), i = {
1432
1432
  [ve.STATIC]: /* @__PURE__ */ t.jsx(sn, {}),
1433
1433
  [ve.FRAMEWORK]: null
1434
1434
  }[e];
1435
1435
  return /* @__PURE__ */ t.jsxs("div", { className: "flex h-full w-full flex-col", children: [
1436
1436
  /* @__PURE__ */ t.jsx(Or, {}),
1437
1437
  /* @__PURE__ */ t.jsxs("div", { className: "relative flex-1 overflow-hidden bg-slate-800/20 bg-[linear-gradient(to_right,#EEE_0.5px,transparent_0.5px),linear-gradient(to_bottom,#EEE_0.5px,transparent_0.5px)] bg-[size:12px_12px]", children: [
1438
- /* @__PURE__ */ t.jsx(Et, { fallback: /* @__PURE__ */ t.jsx(et, { className: "h-full" }), children: /* @__PURE__ */ t.jsx(Zt, { children: i }) }),
1438
+ /* @__PURE__ */ t.jsx(Ze, { fallback: /* @__PURE__ */ t.jsx(tt, { className: "h-full" }), children: /* @__PURE__ */ t.jsx(Zt, { children: i }) }),
1439
1439
  r ? /* @__PURE__ */ t.jsx(
1440
1440
  "div",
1441
1441
  {
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("./select-0e32300c.cjs"),t=require("lodash"),j=require("sonner"),l=require("react"),n=require("./index-bf44bc93.cjs");require("react-i18next");const q=require("lucide-react");require("@radix-ui/react-icons");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");const p=()=>{const{data:s}=n.useProject(),{data:u,isLoading:x}=n.usePages(),{syncState:d}=n.useSavePage(),m=n.useChangePage(),[a,o]=n.useCurrentPage(),c=t.sortBy(t.filter(u,{type:"STATIC"}),r=>t.get(r,"uuid")===(s==null?void 0:s.homepage)?0:1);l.useEffect(()=>{!t.isEmpty(u)&&s.homepage&&!t.find(u,{uuid:a})&&o(s.homepage)},[a,u,s,o]),l.useEffect(()=>()=>o(null),[o]);const g=r=>{if(d!=="SAVED")j.toast.error("You have unsaved changes. Please save before changing the page.");else{const h=t.find(c,{uuid:r});m(h)}};return x||t.isEmpty(a)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(q.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),t.capitalize(s.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(i.Select,{value:a||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(i.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(i.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(i.SelectContent,{children:t.map(c,r=>e.jsxRuntimeExports.jsx(i.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
@@ -1,9 +1,9 @@
1
1
  import { j as e } from "./jsx-runtime-944c88e2.js";
2
- import { S as u, c as p, b as g, d as x, f as h } from "./select-7fddd7c3.js";
3
- import { sortBy as f, filter as j, get as y, isEmpty as P, capitalize as v, map as b, find as S } from "lodash";
4
- import { toast as w } from "sonner";
5
- import { useEffect as C } from "react";
6
- import { O as N, N as k, u as B, Q as E, R as I } from "./index-2d6e8480.js";
2
+ import { S as x, c as h, b as f, d as j, f as y } from "./select-7fddd7c3.js";
3
+ import { sortBy as P, filter as v, get as b, isEmpty as n, find as m, capitalize as S, map as w } from "lodash";
4
+ import { toast as C } from "sonner";
5
+ import { useEffect as l } from "react";
6
+ import { O as N, N as k, u as B, Q as E, R as I } from "./index-8a7a37ce.js";
7
7
  import "react-i18next";
8
8
  import { BriefcaseIcon as L } from "lucide-react";
9
9
  import "@radix-ui/react-icons";
@@ -30,17 +30,19 @@ import "redux-undo";
30
30
  import "@react-hookz/web";
31
31
  import "@chaibuilder/blocks";
32
32
  const le = () => {
33
- const { data: t } = N(), { data: o, isLoading: n } = k(), { syncState: m } = B(), l = E(), [a, s] = I(), i = f(j(o, { type: "STATIC" }), (r) => y(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
34
- C(() => () => s(null), [s]);
35
- const c = (r) => {
36
- if (m !== "SAVED")
37
- w.error("You have unsaved changes. Please save before changing the page.");
33
+ const { data: t } = N(), { data: a, isLoading: c } = k(), { syncState: d } = B(), u = E(), [s, i] = I(), o = P(v(a, { type: "STATIC" }), (r) => b(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
34
+ l(() => {
35
+ !n(a) && t.homepage && !m(a, { uuid: s }) && i(t.homepage);
36
+ }, [s, a, t, i]), l(() => () => i(null), [i]);
37
+ const p = (r) => {
38
+ if (d !== "SAVED")
39
+ C.error("You have unsaved changes. Please save before changing the page.");
38
40
  else {
39
- const d = S(i, { uuid: r });
40
- l(d);
41
+ const g = m(o, { uuid: r });
42
+ u(g);
41
43
  }
42
44
  };
43
- return n || P(a) ? null : /* @__PURE__ */ e.jsx(
45
+ return c || n(s) ? null : /* @__PURE__ */ e.jsx(
44
46
  "nav",
45
47
  {
46
48
  className: "flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800",
@@ -48,7 +50,7 @@ const le = () => {
48
50
  children: /* @__PURE__ */ e.jsxs("ol", { className: "inline-flex items-center space-x-1 md:space-x-3", children: [
49
51
  /* @__PURE__ */ e.jsx("li", { className: "inline-flex items-center", children: /* @__PURE__ */ e.jsxs("div", { className: "inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400", children: [
50
52
  /* @__PURE__ */ e.jsx(L, { className: "w-4 h-4 mr-2" }),
51
- v(t.name)
53
+ S(t.name)
52
54
  ] }) }),
53
55
  /* @__PURE__ */ e.jsx("li", { "aria-current": "page", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
54
56
  /* @__PURE__ */ e.jsx(
@@ -71,9 +73,9 @@ const le = () => {
71
73
  )
72
74
  }
73
75
  ),
74
- /* @__PURE__ */ e.jsxs(u, { value: a || "", onValueChange: c, children: [
75
- /* @__PURE__ */ e.jsx(p, { className: "h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400", children: /* @__PURE__ */ e.jsx(g, { placeholder: "Page" }) }),
76
- /* @__PURE__ */ e.jsx(x, { children: b(i, (r) => /* @__PURE__ */ e.jsx(h, { value: r.uuid, children: r == null ? void 0 : r.name }, r.uuid)) })
76
+ /* @__PURE__ */ e.jsxs(x, { value: s || "", onValueChange: p, children: [
77
+ /* @__PURE__ */ e.jsx(h, { className: "h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400", children: /* @__PURE__ */ e.jsx(f, { placeholder: "Page" }) }),
78
+ /* @__PURE__ */ e.jsx(j, { children: w(o, (r) => /* @__PURE__ */ e.jsx(y, { value: r.uuid, children: r == null ? void 0 : r.name }, r.uuid)) })
77
79
  ] })
78
80
  ] }) })
79
81
  ] })
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),_=require("react-i18next"),x=require("./index-0712a005.cjs"),v=require("./utils-3c452dd0.cjs"),m=require("react"),P=require("./MODIFIERS-70fef873.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),S=require("./useBuilderProp-5e57d0c8.cjs"),H=require("./scroll-area-088530b9.cjs"),L=require("jotai");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");const w=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function F(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const V=s=>{let n="";return Object.keys(s).forEach(r=>{a.startsWith(s[r],P.STYLES_KEY)&&(n=s[r])}),n},z=s=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=s,{id:i,data:l}=s.node,d=s.depth*10,j=p=>{p.stopPropagation(),s.onToggle(s.node.id)},I=y.useDragOver(i,s.isOpen,s.onToggle),g=m.useMemo(()=>{const p=V(s.node.data);return F(p)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&s.onSelect(i)},onContextMenu:()=>s.onSelect(i),style:{paddingInlineStart:d},...I,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(w,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=s.node.data)==null?void 0:R._name)||s.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},G=s=>{var r;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(w,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},$=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},K=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-4c2bb9a5.cjs"))),Q=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},U=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Y=()=>{const[s]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},W=({id:s=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=S.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Y,{})]})},J=({children:s,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(K,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(W,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},X=()=>{const{addCoreBlock:s}=x.useAddBlock(),n=S.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return s({blocks:d},i===0?null:i,l)}return s(c,i===0?null:i,l)},[s])};function Z(s){return a.map(s,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const ee=()=>{const s=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=_.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),I=x.useExpandedIds(),g=X(),[,R]=L.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:f,dropTargetId:N,monitor:O}=E,A=Z(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:N,destinationIndex:k,relativeIndex:f}),R(!1))},q=a.map(s,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(s,{_parent:o._id})),data:o})),T=()=>{c([]),l([])},[{isOver:h},M]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:D}=B.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:()=>T(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:[e.jsxRuntimeExports.jsx("div",{className:"mx-1 h-10 rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Tree view"})}),a.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(H.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:I,extraAcceptTypes:["CHAI_BLOCK"],tree:q,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(J,{id:o.id,children:e.jsxRuntimeExports.jsx(z,{onSelect:f=>{l([]),c([f])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx(G,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx($,{node:o,depth:E})})})]})})};exports.default=ee;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),_=require("react-i18next"),x=require("./index-bf44bc93.cjs"),v=require("./utils-3c452dd0.cjs"),m=require("react"),P=require("./MODIFIERS-70fef873.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),S=require("./useBuilderProp-5e57d0c8.cjs"),H=require("./scroll-area-088530b9.cjs"),L=require("jotai");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");const w=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function F(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const V=s=>{let n="";return Object.keys(s).forEach(r=>{a.startsWith(s[r],P.STYLES_KEY)&&(n=s[r])}),n},z=s=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=s,{id:i,data:l}=s.node,d=s.depth*10,j=p=>{p.stopPropagation(),s.onToggle(s.node.id)},I=y.useDragOver(i,s.isOpen,s.onToggle),g=m.useMemo(()=>{const p=V(s.node.data);return F(p)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&s.onSelect(i)},onContextMenu:()=>s.onSelect(i),style:{paddingInlineStart:d},...I,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(w,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=s.node.data)==null?void 0:R._name)||s.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},G=s=>{var r;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(w,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},$=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},K=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-23dd24b9.cjs"))),Q=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},U=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Y=()=>{const[s]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},W=({id:s=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=S.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Y,{})]})},J=({children:s,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(K,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(W,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},X=()=>{const{addCoreBlock:s}=x.useAddBlock(),n=S.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return s({blocks:d},i===0?null:i,l)}return s(c,i===0?null:i,l)},[s])};function Z(s){return a.map(s,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const ee=()=>{const s=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=_.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),I=x.useExpandedIds(),g=X(),[,R]=L.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:f,dropTargetId:N,monitor:O}=E,A=Z(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:N,destinationIndex:k,relativeIndex:f}),R(!1))},q=a.map(s,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(s,{_parent:o._id})),data:o})),T=()=>{c([]),l([])},[{isOver:h},M]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:D}=B.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:()=>T(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:[e.jsxRuntimeExports.jsx("div",{className:"mx-1 h-10 rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Tree view"})}),a.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(H.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:I,extraAcceptTypes:["CHAI_BLOCK"],tree:q,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(J,{id:o.id,children:e.jsxRuntimeExports.jsx(z,{onSelect:f=>{l([]),c([f])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx(G,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx($,{node:o,depth:E})})})]})})};exports.default=ee;
@@ -4,7 +4,7 @@ import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHor
4
4
  import { useDrop as be, useDragLayer as ke } from "react-dnd";
5
5
  import { useDragOver as Be, Tree as ye } from "@minoru/react-dnd-treeview";
6
6
  import { useTranslation as Ce } from "react-i18next";
7
- import { x as ve, S as we, h as g, l as Se, o as Te, m as Ne, n as De, q as Me, A as Oe, T as Re, y as Ee, g as Ae, i as _e, c as He, U as Pe, b as Le, V as Ve } from "./index-2d6e8480.js";
7
+ import { x as ve, S as we, h as g, l as Se, o as Te, m as Ne, n as De, q as Me, A as Oe, T as Re, y as Ee, g as Ae, i as _e, c as He, U as Pe, b as Le, V as Ve } from "./index-8a7a37ce.js";
8
8
  import { c as w } from "./utils-ac68b2c8.js";
9
9
  import { useMemo as Fe, lazy as ze, useState as Ge, Suspense as $e, useCallback as S } from "react";
10
10
  import { S as Ke } from "./MODIFIERS-c2e02614.js";
@@ -183,7 +183,7 @@ const es = (s) => {
183
183
  }, ns = (s) => {
184
184
  const t = s.depth * 10 + 16;
185
185
  return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: t } });
186
- }, os = ze(() => import("./MarkAsGlobalBlock-0fc014d9.js")), rs = () => {
186
+ }, os = ze(() => import("./MarkAsGlobalBlock-cf7e8b31.js")), rs = () => {
187
187
  const [s] = g(), [, t] = Ne();
188
188
  return /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: () => t(s), children: [
189
189
  /* @__PURE__ */ e.jsx(ge, {}),
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),u=require("react"),i=require("./useBuilderProp-5e57d0c8.cjs"),c=require("./index-0712a005.cjs");require("react-i18next");const x=require("lodash");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const m=({id:t=null,closeModal:s})=>{const l=c.useMarkAsGlobalBlock(),[r,a]=u.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(o.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:n=>a(n.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>{l(t,x.capitalize(r)),s()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(i.Button,{variant:"outline",onClick:s,children:"Cancel"})]})]})};exports.default=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),u=require("react"),i=require("./useBuilderProp-5e57d0c8.cjs"),c=require("./index-bf44bc93.cjs");require("react-i18next");const x=require("lodash");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const m=({id:t=null,closeModal:s})=>{const l=c.useMarkAsGlobalBlock(),[r,a]=u.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(o.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:n=>a(n.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>{l(t,x.capitalize(r)),s()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(i.Button,{variant:"outline",onClick:s,children:"Cancel"})]})]})};exports.default=m;
@@ -2,7 +2,7 @@ import { j as l } from "./jsx-runtime-944c88e2.js";
2
2
  import { GlobeIcon as m } from "@radix-ui/react-icons";
3
3
  import { useState as n } from "react";
4
4
  import { B as i } from "./useBuilderProp-81a14920.js";
5
- import { _ as c } from "./index-2d6e8480.js";
5
+ import { _ as c } from "./index-8a7a37ce.js";
6
6
  import "react-i18next";
7
7
  import { capitalize as p } from "lodash";
8
8
  import "@radix-ui/react-slot";
@@ -1,7 +1,7 @@
1
1
  import { j as t } from "./jsx-runtime-944c88e2.js";
2
2
  import e, { Suspense as p } from "react";
3
3
  import { sortBy as a, filter as d, get as n } from "lodash";
4
- import { N as l, O as c } from "./index-2d6e8480.js";
4
+ import { N as l, O as c } from "./index-8a7a37ce.js";
5
5
  import "i18next";
6
6
  import "react-i18next";
7
7
  import "flagged";
@@ -27,7 +27,7 @@ import "@react-hookz/web";
27
27
  import "@chaibuilder/blocks";
28
28
  import "lucide-react";
29
29
  import "sonner";
30
- const x = e.lazy(() => import("./add-page-modal-7d461e83.js")), g = e.lazy(() => import("./page-viewer-5356aac2.js")), H = () => {
30
+ const x = e.lazy(() => import("./add-page-modal-d4f5ba20.js")), g = e.lazy(() => import("./page-viewer-c494031b.js")), H = () => {
31
31
  const { data: i = [], isLoading: o } = l(), { data: r } = c(), m = a(d(i, { type: "STATIC" }), (s) => n(s, "uuid") === (r == null ? void 0 : r.homepage) ? 0 : 1);
32
32
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
33
33
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),s=require("lodash"),t=require("./index-0712a005.cjs");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const x=i.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-230c11e1.cjs"))),q=i.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-2613effe.cjs"))),c=()=>{const{data:u=[],isLoading:n}=t.usePages(),{data:r}=t.useProject(),o=s.sortBy(s.filter(u,{type:"STATIC"}),a=>s.get(a,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(x,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(q,{isLoading:n,pages:o})})]})};exports.default=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),s=require("lodash"),t=require("./index-bf44bc93.cjs");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const x=i.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-b685709e.cjs"))),q=i.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-f0a54a92.cjs"))),c=()=>{const{data:u=[],isLoading:n}=t.usePages(),{data:r}=t.useProject(),o=s.sortBy(s.filter(u,{type:"STATIC"}),a=>s.get(a,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(x,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(q,{isLoading:n,pages:o})})]})};exports.default=c;
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-944c88e2.js";
2
2
  import i, { useRef as x, useEffect as m, Suspense as n } from "react";
3
3
  import { isEqual as j, isEmpty as b } from "lodash";
4
4
  import { A as f, a as l, b as c, c as d } from "./accordion-c0176dc5.js";
5
- import { P as h, O as g } from "./index-2d6e8480.js";
5
+ import { P as h, O as g } from "./index-8a7a37ce.js";
6
6
  import "@radix-ui/react-accordion";
7
7
  import "@radix-ui/react-icons";
8
8
  import "./utils-ac68b2c8.js";
@@ -29,7 +29,7 @@ import "@react-hookz/web";
29
29
  import "@chaibuilder/blocks";
30
30
  import "lucide-react";
31
31
  import "sonner";
32
- const N = i.lazy(() => import("./project-general-setting-77aab031.js")), S = i.lazy(() => import("./project-seo-setting-e9587467.js")), p = /* @__PURE__ */ e.jsx("div", { className: "px-3", children: /* @__PURE__ */ e.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (t) => t && b(t.seoData) ? {
32
+ const N = i.lazy(() => import("./project-general-setting-fca12629.js")), S = i.lazy(() => import("./project-seo-setting-e9587467.js")), p = /* @__PURE__ */ e.jsx("div", { className: "px-3", children: /* @__PURE__ */ e.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (t) => t && b(t.seoData) ? {
33
33
  ...t,
34
34
  seoData: { title: "", description: "", image: "" }
35
35
  } : t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),r=require("react"),x=require("lodash"),s=require("./accordion-0afd8143.cjs"),a=require("./index-0712a005.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-dc8d6a84.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-3f645a02.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function j(){const t=a.useUpdateProject(),{data:o}=a.useProject(),[i,u]=r.useState(l(o||{})),n=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(o,n.current)||t.mutate(n.current,{onSuccess:()=>u(n.current)})},[n]),r.useEffect(()=>{n.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:u})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(m,{_projectData:i,seany:u})})})]})]})})]})}exports.default=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),r=require("react"),x=require("lodash"),s=require("./accordion-0afd8143.cjs"),a=require("./index-bf44bc93.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-a3e99d1e.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-3f645a02.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function j(){const t=a.useUpdateProject(),{data:o}=a.useProject(),[i,u]=r.useState(l(o||{})),n=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(o,n.current)||t.mutate(n.current,{onSuccess:()=>u(n.current)})},[n]),r.useEffect(()=>{n.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:u})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(m,{_projectData:i,seany:u})})})]})]})})]})}exports.default=j;