@chaibuilder/pages 0.4.13 → 0.4.15

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.
@@ -6,7 +6,7 @@ var B = (e, t, n) => (Ds(e, t, "read from private field"), n ? n.call(e) : t.get
6
6
  import { jsx as r, jsxs as u, Fragment as Ne } from "react/jsx-runtime";
7
7
  import { has as Oe, get as le, isEmpty as ye, reverse as Ma, sortBy as Fa, each as qa, find as Ee, set as ja, startsWith as Bt, isEqual as is, map as je, toLower as Rt, trim as Ha, filter as Ie, startCase as kt, groupBy as Ka, compact as Nn, includes as qt, concat as Js, endsWith as er, orderBy as mn, first as Va, uniq as za, debounce as $a, pick as tr, keys as Wa, pickBy as Ya, isArray as Qa, noop as Xa, isFunction as Za, cloneDeep as Ja, isString as Gs } from "lodash-es";
8
8
  import * as ge from "react";
9
- import nr, { useCallback as xe, useMemo as $, useState as P, useEffect as Ae, useRef as dt, Suspense as ei, lazy as ti } from "react";
9
+ import nr, { useCallback as xe, useMemo as W, useState as P, useEffect as Ae, useRef as dt, Suspense as ei, lazy as ti } from "react";
10
10
  import { useAtom as Dn, atom as ls } from "jotai";
11
11
  import { useQueryClient as Te, useQuery as Pe, useMutation as _e, onlineManager as sr, QueryClient as ni, QueryClientProvider as si } from "@tanstack/react-query";
12
12
  import { toast as J } from "sonner";
@@ -252,7 +252,7 @@ const He = {
252
252
  DELETE_ASSET: "DELETE_ASSET",
253
253
  UPDATE_ASSET: "UPDATE_ASSET",
254
254
  GET_ASSETS: "GET_ASSETS"
255
- }, W = "chaibuilder";
255
+ }, z = "chaibuilder";
256
256
  let pl = 0;
257
257
  function Fs(e, t) {
258
258
  const n = `atom${++pl}`, s = {
@@ -390,7 +390,7 @@ const Rr = "__logged_in_user", Al = Nl(
390
390
  if (i.ok) {
391
391
  const l = await i.json();
392
392
  Oe(l, "id") && Oe(l, "email") && Oe(l, "accessToken") && Oe(l, "refreshToken") ? (t(l), a.invalidateQueries({
393
- queryKey: [W],
393
+ queryKey: [z],
394
394
  refetchType: "all"
395
395
  })) : n();
396
396
  } else
@@ -417,7 +417,7 @@ if (import.meta.vitest) {
417
417
  });
418
418
  }
419
419
  const Ju = () => {
420
- const { user: e } = nt(), t = st("onSessionExpired"), n = $(
420
+ const { user: e } = nt(), t = st("onSessionExpired"), n = W(
421
421
  () => e == null ? void 0 : e.accessToken,
422
422
  [e == null ? void 0 : e.accessToken]
423
423
  );
@@ -449,7 +449,7 @@ const Ju = () => {
449
449
  [n, t]
450
450
  );
451
451
  }, X = () => {
452
- const { user: e } = nt(), t = $(
452
+ const { user: e } = nt(), t = W(
453
453
  () => e == null ? void 0 : e.accessToken,
454
454
  [e == null ? void 0 : e.accessToken]
455
455
  ), { refetch: n } = Ur();
@@ -480,7 +480,7 @@ const Ju = () => {
480
480
  mutationFn: async (s) => n(e, { action: I.RELEASE_LOCK, data: s }),
481
481
  onSuccess: () => {
482
482
  t.invalidateQueries({
483
- queryKey: [W, I.GET_DRAFT_PAGE]
483
+ queryKey: [z, I.GET_DRAFT_PAGE]
484
484
  });
485
485
  }
486
486
  });
@@ -494,7 +494,7 @@ const Ju = () => {
494
494
  onSuccess: (s, a) => {
495
495
  var i;
496
496
  t.invalidateQueries({
497
- queryKey: [W, I.GET_WEBSITE_DRAFT_SETTINGS]
497
+ queryKey: [z, I.GET_WEBSITE_DRAFT_SETTINGS]
498
498
  }), (i = a == null ? void 0 : a.settings) != null && i.theme || J.success("Website settings updated successfully.");
499
499
  },
500
500
  onError: (s) => {
@@ -509,7 +509,7 @@ const Ju = () => {
509
509
  mutationFn: async (s) => n(e, { action: I.UPDATE_WEBSITE_DATA, data: s }),
510
510
  onSuccess: () => {
511
511
  t.invalidateQueries({
512
- queryKey: [W, I.GET_WEBSITE_DATA]
512
+ queryKey: [z, I.GET_WEBSITE_DATA]
513
513
  }), J.success("Website data updated successfully.");
514
514
  },
515
515
  onError: (s) => {
@@ -539,14 +539,14 @@ const Tl = ls({}), Mr = () => Dn(Tl), Cl = () => {
539
539
  }, [t, s, n]);
540
540
  }, st = (e, t) => {
541
541
  const [n] = Mr();
542
- return $(
542
+ return W(
543
543
  () => le(n, e, t),
544
544
  [n, e, t]
545
545
  );
546
546
  }, ee = () => st("apiUrl", "/chai/api"), Rn = () => st("usersApiUrl", "/chai/users"), ed = () => st("assetsApiUrl", "/chai/assets"), cn = () => {
547
547
  const e = ee(), [t] = Ue(), n = t.get("page"), s = X();
548
548
  return Pe({
549
- queryKey: [W, I.GET_LANGUAGE_PAGES, n],
549
+ queryKey: [z, I.GET_LANGUAGE_PAGES, n],
550
550
  initialData: [],
551
551
  queryFn: async () => {
552
552
  if (!n) return null;
@@ -573,7 +573,7 @@ const Tl = ls({}), Mr = () => Dn(Tl), Cl = () => {
573
573
  })
574
574
  });
575
575
  }, Fr = (e) => {
576
- const { fallbackLang: t } = ht(), { data: n } = un(), { data: s, isFetching: a } = cn(), i = $(() => {
576
+ const { fallbackLang: t } = ht(), { data: n } = un(), { data: s, isFetching: a } = cn(), i = W(() => {
577
577
  const l = { [t]: !0 };
578
578
  return qa(le(n, "languages"), (o) => {
579
579
  const c = Ee(s, { lang: o });
@@ -583,33 +583,34 @@ const Tl = ls({}), Mr = () => Dn(Tl), Cl = () => {
583
583
  return a || ye(e) || e && i[e];
584
584
  }, ws = () => {
585
585
  const e = Te(), { data: t } = Pe({
586
- queryKey: ["chaibuilder", I.AI_CONTEXT],
586
+ queryKey: [z, I.AI_CONTEXT],
587
587
  initialData: "",
588
- queryFn: () => ""
588
+ queryFn: () => "",
589
+ staleTime: 0
589
590
  });
590
591
  return { setAiContext: xe(
591
592
  (s) => {
592
- e.setQueryData([I.AI_CONTEXT], s);
593
+ e.setQueryData([z, I.AI_CONTEXT], s);
593
594
  },
594
595
  [e]
595
596
  ), aiContext: t };
596
597
  }, Un = () => {
597
598
  const e = X(), t = ee();
598
599
  return Pe({
599
- queryKey: [W, I.GET_WEBSITE_PAGES],
600
+ queryKey: [z, I.GET_WEBSITE_PAGES],
600
601
  staleTime: 1e3 * 60 * 5,
601
602
  queryFn: async () => e(t, { action: I.GET_WEBSITE_PAGES }) || []
602
603
  });
603
604
  }, Pl = ls({ lastSaved: void 0 }), Ss = () => Dn(Pl), Be = () => {
604
605
  const [e] = Ue(), t = e.get("page"), { data: n, isFetching: s } = Un();
605
- return { data: $(
606
+ return { data: W(
606
607
  () => Ee(n, { id: t }) || {},
607
608
  [n, t]
608
609
  ), isFetching: s };
609
610
  }, dn = (e) => {
610
611
  const t = Rn(), n = X();
611
612
  return Pe({
612
- queryKey: [W, "chaiUserInfo", e],
613
+ queryKey: [z, "chaiUserInfo", e],
613
614
  queryFn: async () => await n(t, {
614
615
  action: I.GET_CHAI_USER,
615
616
  data: { userId: e }
@@ -618,7 +619,7 @@ const Tl = ls({}), Mr = () => Dn(Tl), Cl = () => {
618
619
  });
619
620
  }, _l = ls(void 0), hn = () => {
620
621
  const [e] = Ue(), t = e.get("page"), { user: n } = nt(), [s, a] = Dn(_l);
621
- return $(() => ({
622
+ return W(() => ({
622
623
  isLocked: t && (n == null ? void 0 : n.id) !== s,
623
624
  currentEditor: s,
624
625
  setCurrentEditor: (i) => a(i)
@@ -626,7 +627,7 @@ const Tl = ls({}), Mr = () => Dn(Tl), Cl = () => {
626
627
  }, qr = () => {
627
628
  const [e] = Ue(), t = e.get("page"), n = ee(), { setAiContext: s } = ws(), { setCurrentEditor: a } = hn(), [, i] = Ss(), l = X();
628
629
  return Pe({
629
- queryKey: [W, I.GET_DRAFT_PAGE, t],
630
+ queryKey: [z, I.GET_DRAFT_PAGE, t],
630
631
  staleTime: 1 / 0,
631
632
  gcTime: 1 / 0,
632
633
  queryFn: async () => {
@@ -647,7 +648,7 @@ const Tl = ls({}), Mr = () => Dn(Tl), Cl = () => {
647
648
  }) => {
648
649
  const n = ee(), s = X();
649
650
  return Pe({
650
- queryKey: [W, I.GET_BUILDER_PAGE_DATA, e, t],
651
+ queryKey: [z, I.GET_BUILDER_PAGE_DATA, e, t],
651
652
  initialData: {},
652
653
  queryFn: async () => s(n, {
653
654
  action: I.GET_BUILDER_PAGE_DATA,
@@ -791,7 +792,7 @@ const kl = () => {
791
792
  }, Gl = (e) => {
792
793
  const t = ee(), n = X();
793
794
  return Pe({
794
- queryKey: [W, "uiBlockDetails", e],
795
+ queryKey: [z, "uiBlockDetails", e],
795
796
  enabled: !!e,
796
797
  // Only run query if blockId is provided
797
798
  queryFn: async () => {
@@ -940,7 +941,7 @@ const kl = () => {
940
941
  isLoading: a,
941
942
  error: i
942
943
  } = Pe({
943
- queryKey: [W, "library-groups"],
944
+ queryKey: [z, "library-groups"],
944
945
  queryFn: async () => {
945
946
  try {
946
947
  return await t(e, {
@@ -962,7 +963,7 @@ const kl = () => {
962
963
  },
963
964
  onSuccess: () => {
964
965
  n.invalidateQueries({
965
- queryKey: [W, "library-groups"]
966
+ queryKey: [z, "library-groups"]
966
967
  }), J.success("Group created successfully");
967
968
  },
968
969
  onError: (c) => {
@@ -1007,7 +1008,7 @@ const kl = () => {
1007
1008
  { id: "stats", name: "Stats" },
1008
1009
  { id: "team", name: "Team" },
1009
1010
  { id: "timeline", name: "Timeline" }
1010
- ]), f = $(
1011
+ ]), f = W(
1011
1012
  () => [
1012
1013
  ...o,
1013
1014
  ...c.filter(
@@ -1200,9 +1201,9 @@ const kl = () => {
1200
1201
  EDIT_MEDIA: "edit_media",
1201
1202
  DELETE_MEDIA: "delete_media"
1202
1203
  }, jl = (e) => {
1203
- const { blocks: t, close: n, blockId: s } = e, { getPartailBlocks: a } = ai(), i = t.find((N) => N._id === s), l = i == null ? void 0 : i._libBlockId, o = !!l, c = $(() => t.some(
1204
+ const { blocks: t, close: n, blockId: s } = e, { getPartailBlocks: a } = ai(), i = t.find((N) => N._id === s), l = i == null ? void 0 : i._libBlockId, o = !!l, c = W(() => t.some(
1204
1205
  (N) => N._type === "PartialBlock" || N._type === "GlobalBlock"
1205
- ), [t]), d = $(() => {
1206
+ ), [t]), d = W(() => {
1206
1207
  let N = [];
1207
1208
  for (const L of t)
1208
1209
  if (L._type === "PartialBlock" || L._type === "GlobalBlock") {
@@ -1229,14 +1230,14 @@ const kl = () => {
1229
1230
  const K = () => {
1230
1231
  const N = {};
1231
1232
  return f.trim() ? f.length < 2 && (N.name = "Name must be at least 2 characters") : N.name = "Name is required", y || (N.group = "Group is required"), S(N), Object.keys(N).length === 0 && !c;
1232
- }, { resetLibrary: pe } = ii({ id: "" }), z = Dl(
1233
+ }, { resetLibrary: pe } = ii({ id: "" }), $ = Dl(
1233
1234
  (N) => {
1234
1235
  o || M([s], { _libBlockId: N.id }), J.success(`Block ${o ? "updated" : "saved"} successfully`), pe(N.library), n();
1235
1236
  }
1236
1237
  ), g = async (N) => {
1237
1238
  if (N.preventDefault(), !K()) return;
1238
1239
  const L = d.map((U) => (Oe(U, "_libBlockId") && delete U._libBlockId, U));
1239
- z.mutate({
1240
+ $.mutate({
1240
1241
  name: f.trim(),
1241
1242
  group: y,
1242
1243
  blocks: L,
@@ -1246,7 +1247,7 @@ const kl = () => {
1246
1247
  // Include id if in edit mode
1247
1248
  ...o ? { id: l } : {}
1248
1249
  });
1249
- }, m = z.isPending;
1250
+ }, m = $.isPending;
1250
1251
  return k || Z ? /* @__PURE__ */ r("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ r("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }) }) : te ? /* @__PURE__ */ u("div", { className: "p-6 space-y-4", children: [
1251
1252
  /* @__PURE__ */ r("div", { className: "text-destructive font-medium", children: "Block Not Found" }),
1252
1253
  /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground", children: "This block could not be found on the server. It may have been deleted." }),
@@ -1393,13 +1394,13 @@ const kl = () => {
1393
1394
  }, De = () => {
1394
1395
  const e = ee(), t = X();
1395
1396
  return Pe({
1396
- queryKey: [W, I.GET_PAGE_TYPES],
1397
+ queryKey: [z, I.GET_PAGE_TYPES],
1397
1398
  initialData: [],
1398
1399
  queryFn: async () => t(e, { action: I.GET_PAGE_TYPES })
1399
1400
  });
1400
1401
  }, Kl = (e) => {
1401
1402
  const { data: t } = De();
1402
- return $(
1403
+ return W(
1403
1404
  () => t == null ? void 0 : t.find((n) => n.key === e),
1404
1405
  [t, e]
1405
1406
  );
@@ -1431,12 +1432,12 @@ const kl = () => {
1431
1432
  var o;
1432
1433
  i && (i != null && i.primaryPage) ? t.invalidateQueries({
1433
1434
  queryKey: [
1434
- W,
1435
+ z,
1435
1436
  I.GET_LANGUAGE_PAGES,
1436
1437
  i == null ? void 0 : i.primaryPage
1437
1438
  ]
1438
1439
  }) : t.invalidateQueries({
1439
- queryKey: [W, I.GET_WEBSITE_PAGES]
1440
+ queryKey: [z, I.GET_WEBSITE_PAGES]
1440
1441
  });
1441
1442
  const l = i.template ? `Page created from "${i.template.name}" template` : i.hasSlug === !1 ? "New " + ((o = Ee(s, { key: i.pageType })) == null ? void 0 : o.name) + " added successfully" : "New page added successfully";
1442
1443
  J.success(l);
@@ -1461,12 +1462,12 @@ const kl = () => {
1461
1462
  onSuccess: (a, i) => {
1462
1463
  i && (i != null && i.primaryPage || i != null && i.seo) ? t.invalidateQueries({
1463
1464
  queryKey: [
1464
- W,
1465
+ z,
1465
1466
  I.GET_LANGUAGE_PAGES,
1466
1467
  i == null ? void 0 : i.primaryPage
1467
1468
  ]
1468
1469
  }) : t.invalidateQueries({
1469
- queryKey: [W, I.GET_WEBSITE_PAGES]
1470
+ queryKey: [z, I.GET_WEBSITE_PAGES]
1470
1471
  });
1471
1472
  },
1472
1473
  onError: (a, i) => {
@@ -1495,12 +1496,12 @@ const kl = () => {
1495
1496
  }
1496
1497
  i && (i != null && i.primaryPage) ? t.invalidateQueries({
1497
1498
  queryKey: [
1498
- W,
1499
+ z,
1499
1500
  I.GET_LANGUAGE_PAGES,
1500
1501
  i == null ? void 0 : i.primaryPage
1501
1502
  ]
1502
1503
  }) : t.invalidateQueries({
1503
- queryKey: [W, I.GET_WEBSITE_PAGES]
1504
+ queryKey: [z, I.GET_WEBSITE_PAGES]
1504
1505
  });
1505
1506
  },
1506
1507
  onError: (a, i) => {
@@ -1523,12 +1524,12 @@ const kl = () => {
1523
1524
  onSuccess: (a, i) => {
1524
1525
  i && (i != null && i.primaryPage) ? t.invalidateQueries({
1525
1526
  queryKey: [
1526
- W,
1527
+ z,
1527
1528
  I.GET_LANGUAGE_PAGES,
1528
1529
  i == null ? void 0 : i.primaryPage
1529
1530
  ]
1530
1531
  }) : t.invalidateQueries({
1531
- queryKey: [W, I.GET_WEBSITE_PAGES]
1532
+ queryKey: [z, I.GET_WEBSITE_PAGES]
1532
1533
  });
1533
1534
  const l = Ee(s, { key: i.pageType });
1534
1535
  J.success(
@@ -1554,11 +1555,11 @@ const kl = () => {
1554
1555
  }),
1555
1556
  onSuccess: () => {
1556
1557
  n.invalidateQueries({
1557
- queryKey: [W, I.GET_CHANGES]
1558
+ queryKey: [z, I.GET_CHANGES]
1558
1559
  }), n.invalidateQueries({
1559
- queryKey: [W, I.GET_WEBSITE_PAGES]
1560
+ queryKey: [z, I.GET_WEBSITE_PAGES]
1560
1561
  }), n.invalidateQueries({
1561
- queryKey: [W, I.GET_LANGUAGE_PAGES, s == null ? void 0 : s.id]
1562
+ queryKey: [z, I.GET_LANGUAGE_PAGES, s == null ? void 0 : s.id]
1562
1563
  });
1563
1564
  },
1564
1565
  onError: () => {
@@ -1583,7 +1584,7 @@ const kl = () => {
1583
1584
  },
1584
1585
  onSuccess: () => {
1585
1586
  n.invalidateQueries({
1586
- queryKey: [W, I.GET_WEBSITE_PAGES]
1587
+ queryKey: [z, I.GET_WEBSITE_PAGES]
1587
1588
  }), J.success("Page marked as template successfully.");
1588
1589
  },
1589
1590
  onError: () => {
@@ -1599,7 +1600,7 @@ const kl = () => {
1599
1600
  }),
1600
1601
  onSuccess: () => {
1601
1602
  n.invalidateQueries({
1602
- queryKey: [W, I.GET_WEBSITE_PAGES]
1603
+ queryKey: [z, I.GET_WEBSITE_PAGES]
1603
1604
  }), J.success("Page unmarked as template successfully.");
1604
1605
  },
1605
1606
  onError: () => {
@@ -1615,9 +1616,9 @@ const kl = () => {
1615
1616
  }),
1616
1617
  onSuccess: (s, { primaryPage: a }) => {
1617
1618
  J.success(q.SLUG_CHANGE_SUCCESS), a ? n.invalidateQueries({
1618
- queryKey: [W, I.GET_LANGUAGE_PAGES, a]
1619
+ queryKey: [z, I.GET_LANGUAGE_PAGES, a]
1619
1620
  }) : n.invalidateQueries({
1620
- queryKey: [W, I.GET_WEBSITE_PAGES]
1621
+ queryKey: [z, I.GET_WEBSITE_PAGES]
1621
1622
  });
1622
1623
  },
1623
1624
  onError: () => {
@@ -2006,7 +2007,7 @@ var xs = {};
2006
2007
  matrix: N
2007
2008
  };
2008
2009
  }
2009
- function z(g) {
2010
+ function $(g) {
2010
2011
  var m, N = 1, L = "#000000", U = '"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';
2011
2012
  typeof g == "string" ? m = g : (m = g.text, N = "scalar" in g ? g.scalar : N, U = "fontFamily" in g ? g.fontFamily : U, L = "color" in g ? g.color : L);
2012
2013
  var j = 10 * N, V = "" + j + "px " + U, R = new OffscreenCanvas(j, j), b = R.getContext("2d");
@@ -2025,7 +2026,7 @@ var xs = {};
2025
2026
  return fe().apply(this, arguments);
2026
2027
  }, n.exports.reset = function() {
2027
2028
  fe().reset();
2028
- }, n.exports.create = me, n.exports.shapeFromPath = pe, n.exports.shapeFromText = z;
2029
+ }, n.exports.create = me, n.exports.shapeFromPath = pe, n.exports.shapeFromText = $;
2029
2030
  })(/* @__PURE__ */ function() {
2030
2031
  return typeof window < "u" ? window : typeof self < "u" ? self : this || {};
2031
2032
  }(), xs, !1);
@@ -2248,7 +2249,7 @@ const Me = ({
2248
2249
  onClose: t,
2249
2250
  languages: n
2250
2251
  }) => {
2251
- const { data: s } = Be(), { data: a } = De(), [i, l] = P(e.name || ""), [o, c] = P(e.edit ? e.lang : ""), [d, f] = P(e.edit ? e.slug : ""), { mutate: h, isPending: y } = Hr(), { mutate: v, isPending: p } = Ns(), A = $(
2252
+ const { data: s } = Be(), { data: a } = De(), [i, l] = P(e.name || ""), [o, c] = P(e.edit ? e.lang : ""), [d, f] = P(e.edit ? e.slug : ""), { mutate: h, isPending: y } = Hr(), { mutate: v, isPending: p } = Ns(), A = W(
2252
2253
  () => a == null ? void 0 : a.find(
2253
2254
  (S) => S.key === e.pageType
2254
2255
  ),
@@ -2543,7 +2544,7 @@ function so({
2543
2544
  className: s = "w-full rounded-md border border-gray-300 px-3 py-2",
2544
2545
  id: a = "parentPage"
2545
2546
  }) {
2546
- const i = $(() => !e || e.length === 0 ? [] : e.filter((f) => !ye(f.slug)).filter((f) => f.slug !== "/").sort((f, h) => f.slug.localeCompare(h.slug)), [e]), l = (d) => Math.max(0, (d.match(/\//g) || []).length - 1), o = (d) => "    ".repeat(d), c = (d) => {
2547
+ const i = W(() => !e || e.length === 0 ? [] : e.filter((f) => !ye(f.slug)).filter((f) => f.slug !== "/").sort((f, h) => f.slug.localeCompare(h.slug)), [e]), l = (d) => Math.max(0, (d.match(/\//g) || []).length - 1), o = (d) => "    ".repeat(d), c = (d) => {
2547
2548
  if (d === "/") return "/";
2548
2549
  const f = d.split("/").filter(Boolean);
2549
2550
  return f.length <= 1 ? `/${f[0] || ""}` : `/${f[f.length - 1]}`;
@@ -2653,13 +2654,13 @@ const ao = ({
2653
2654
  }, io = () => {
2654
2655
  const e = ee(), t = X();
2655
2656
  return Pe({
2656
- queryKey: [W, I.GET_LIBRARIES],
2657
+ queryKey: [z, I.GET_LIBRARIES],
2657
2658
  queryFn: async () => await t(e, { action: I.GET_LIBRARIES }) || []
2658
2659
  });
2659
2660
  }, lo = (e) => {
2660
2661
  const t = ee(), n = X();
2661
2662
  return Pe({
2662
- queryKey: [W, I.GET_TEMPLATES_BY_TYPE, e],
2663
+ queryKey: [z, I.GET_TEMPLATES_BY_TYPE, e],
2663
2664
  enabled: !!e,
2664
2665
  queryFn: async () => {
2665
2666
  const s = await n(t, {
@@ -2670,14 +2671,14 @@ const ao = ({
2670
2671
  }
2671
2672
  });
2672
2673
  }, oo = (e) => {
2673
- const { data: t = [], isLoading: n } = lo(e), { data: s = [], isLoading: a } = io(), i = $(() => n || a ? [] : t.map((o) => {
2674
+ const { data: t = [], isLoading: n } = lo(e), { data: s = [], isLoading: a } = io(), i = W(() => n || a ? [] : t.map((o) => {
2674
2675
  const c = Ee(s, { id: o.library });
2675
2676
  return {
2676
2677
  ...o,
2677
2678
  libraryName: (c == null ? void 0 : c.type) !== "shared" ? "Site Library" : (c == null ? void 0 : c.name) + " Library",
2678
2679
  libraryType: c == null ? void 0 : c.type
2679
2680
  };
2680
- }), [t, s, n, a]), l = $(() => Ka(i, "libraryName"), [i]);
2681
+ }), [t, s, n, a]), l = W(() => Ka(i, "libraryName"), [i]);
2681
2682
  return {
2682
2683
  data: i,
2683
2684
  groupedData: l,
@@ -2702,7 +2703,7 @@ function co({
2702
2703
  var V, R;
2703
2704
  const a = zr(), i = !!(e != null && e.id), { data: l } = Un(), { mutate: o, isPending: c } = Hr(), { mutate: d, isPending: f } = Ns(), [h, y] = P(null), [v, p] = P(
2704
2705
  (e == null ? void 0 : e.pageType) ?? "page"
2705
- ), { hasPermission: A } = Dt(), E = A(he.CHANGE_PAGE_TYPE), [x, D] = P(!1), [S, w] = P(""), _ = $(() => {
2706
+ ), { hasPermission: A } = Dt(), E = A(he.CHANGE_PAGE_TYPE), [x, D] = P(!1), [S, w] = P(""), _ = W(() => {
2706
2707
  const b = t.find(
2707
2708
  (H) => H.key === v
2708
2709
  );
@@ -2713,7 +2714,7 @@ function co({
2713
2714
  (e == null ? void 0 : e.dynamic) ?? !1
2714
2715
  ), [M, ne] = P(
2715
2716
  O ? "" : ((e == null ? void 0 : e.slug) ?? "").split("/").pop() || ""
2716
- ), [me, Z] = P(""), { data: fe, isLoading: K } = oo(v), pe = c || f, z = t.find(
2717
+ ), [me, Z] = P(""), { data: fe, isLoading: K } = oo(v), pe = c || f, $ = t.find(
2717
2718
  (b) => b.key === v
2718
2719
  ), g = (b) => {
2719
2720
  if (i && v !== b) {
@@ -2748,9 +2749,9 @@ function co({
2748
2749
  y("Slug must be empty when using dynamic slug");
2749
2750
  return;
2750
2751
  }
2751
- if (!(z != null && z.hasSlug)) {
2752
+ if (!($ != null && $.hasSlug)) {
2752
2753
  const H = {
2753
- pageType: z == null ? void 0 : z.key,
2754
+ pageType: $ == null ? void 0 : $.key,
2754
2755
  name: te,
2755
2756
  slug: "",
2756
2757
  hasSlug: !1
@@ -2760,7 +2761,7 @@ function co({
2760
2761
  { id: e == null ? void 0 : e.id, name: te },
2761
2762
  {
2762
2763
  onSuccess: () => {
2763
- J.success((z == null ? void 0 : z.name) + " updated successfully"), n();
2764
+ J.success(($ == null ? void 0 : $.name) + " updated successfully"), n();
2764
2765
  }
2765
2766
  }
2766
2767
  );
@@ -2838,7 +2839,7 @@ function co({
2838
2839
  });
2839
2840
  }
2840
2841
  };
2841
- return z != null && z.hasSlug ? /* @__PURE__ */ u("form", { onSubmit: j, className: "w-full max-w-md mx-auto space-y-4", children: [
2842
+ return $ != null && $.hasSlug ? /* @__PURE__ */ u("form", { onSubmit: j, className: "w-full max-w-md mx-auto space-y-4", children: [
2842
2843
  /* @__PURE__ */ u("div", { className: "space-y-0.5", children: [
2843
2844
  /* @__PURE__ */ r(re, { htmlFor: "pageType", className: "text-sm", children: "Type" }),
2844
2845
  /* @__PURE__ */ r(
@@ -2879,7 +2880,7 @@ function co({
2879
2880
  ] })
2880
2881
  ] })
2881
2882
  ] }),
2882
- !i && (z == null ? void 0 : z.hasSlug) && fe.length > 0 && /* @__PURE__ */ u("div", { className: "space-y-1", children: [
2883
+ !i && ($ == null ? void 0 : $.hasSlug) && fe.length > 0 && /* @__PURE__ */ u("div", { className: "space-y-1", children: [
2883
2884
  /* @__PURE__ */ r(re, { className: "text-sm mb-1 block", children: "Template" }),
2884
2885
  /* @__PURE__ */ r(
2885
2886
  ao,
@@ -2912,7 +2913,7 @@ function co({
2912
2913
  }
2913
2914
  )
2914
2915
  ] }),
2915
- (z == null ? void 0 : z.dynamicSegments) && k && k !== "none" && /* @__PURE__ */ u("div", { className: "space-y-2", children: [
2916
+ ($ == null ? void 0 : $.dynamicSegments) && k && k !== "none" && /* @__PURE__ */ u("div", { className: "space-y-2", children: [
2916
2917
  /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: [
2917
2918
  /* @__PURE__ */ r(
2918
2919
  "input",
@@ -2928,10 +2929,10 @@ function co({
2928
2929
  ] }),
2929
2930
  O && /* @__PURE__ */ u("div", { className: "text-sm text-gray-500", children: [
2930
2931
  "Pages will use pattern: ",
2931
- z == null ? void 0 : z.dynamicSlug
2932
+ $ == null ? void 0 : $.dynamicSlug
2932
2933
  ] })
2933
2934
  ] }),
2934
- (!(z != null && z.dynamicSegments) || !O) && /* @__PURE__ */ u("div", { className: "space-y-0.5", children: [
2935
+ (!($ != null && $.dynamicSegments) || !O) && /* @__PURE__ */ u("div", { className: "space-y-0.5", children: [
2935
2936
  /* @__PURE__ */ r(re, { htmlFor: "slug", className: "text-sm", children: "Slug" }),
2936
2937
  /* @__PURE__ */ r(
2937
2938
  ro,
@@ -3002,7 +3003,7 @@ function co({
3002
3003
  }
3003
3004
  )
3004
3005
  ] }),
3005
- /* @__PURE__ */ r(C, { disabled: pe, type: "submit", className: "w-full", children: i ? pe ? "Updating..." : "Update " + (z == null ? void 0 : z.name) : pe ? "Creating..." : "Create " + (z == null ? void 0 : z.name) })
3006
+ /* @__PURE__ */ r(C, { disabled: pe, type: "submit", className: "w-full", children: i ? pe ? "Updating..." : "Update " + ($ == null ? void 0 : $.name) : pe ? "Creating..." : "Create " + ($ == null ? void 0 : $.name) })
3006
3007
  ]
3007
3008
  }
3008
3009
  );
@@ -3246,10 +3247,10 @@ const uo = ({
3246
3247
  setMarkAsTemplate: o,
3247
3248
  setUnmarkAsTemplate: c
3248
3249
  }) => {
3249
- const d = zr(), { data: f } = De(), { hasPermission: h } = Dt(), y = $(
3250
+ const d = zr(), { data: f } = De(), { hasPermission: h } = Dt(), y = W(
3250
3251
  () => Ee(f, { key: t.pageType }),
3251
3252
  [f, t.pageType]
3252
- ), v = le(t, "slug", "").replace(e, "") || "/", p = !h(he.EDIT_PAGE) && !h(he.DELETE_PAGE) && !h(he.UNPUBLISH_PAGE), A = $(() => !!t.isTemplate, [t.isTemplate]), E = $(
3253
+ ), v = le(t, "slug", "").replace(e, "") || "/", p = !h(he.EDIT_PAGE) && !h(he.DELETE_PAGE) && !h(he.UNPUBLISH_PAGE), A = W(() => !!t.isTemplate, [t.isTemplate]), E = W(
3253
3254
  () => !!(y != null && y.hasSlug),
3254
3255
  [y == null ? void 0 : y.hasSlug]
3255
3256
  );
@@ -3404,7 +3405,7 @@ const uo = ({
3404
3405
  T && (T != null && T.pageType) ? t((M) => [...M, T == null ? void 0 : T.pageType]) : (window.history.replaceState(null, "", "/"), w(new URLSearchParams({})), window.dispatchEvent(new PopStateEvent("popstate")));
3405
3406
  }
3406
3407
  }, [p, _, A, w]);
3407
- const O = $(() => {
3408
+ const O = W(() => {
3408
3409
  const T = Nn(
3409
3410
  Ie(p, (K) => ye(n) ? !0 : qt(Rt(K == null ? void 0 : K.name), Rt(n)) || qt(Rt(K == null ? void 0 : K.slug), Rt(n)))
3410
3411
  );
@@ -3422,7 +3423,7 @@ const uo = ({
3422
3423
  } else
3423
3424
  me.push(K);
3424
3425
  }), ne.sort((K, pe) => K.name.localeCompare(pe.name)), ne.forEach((K) => {
3425
- K.children.sort((pe, z) => pe.name.localeCompare(z.name));
3426
+ K.children.sort((pe, $) => pe.name.localeCompare($.name));
3426
3427
  });
3427
3428
  const Z = Ie(
3428
3429
  me,
@@ -3627,7 +3628,7 @@ const uo = ({
3627
3628
  const p = new URLSearchParams(window.location.search), A = p.get("lang");
3628
3629
  A && (t.includes(A) ? s(A) : (p.delete("lang"), i(p), s("")));
3629
3630
  }, [t, i, s]);
3630
- const [l, o] = P(null), { data: c } = Be(), { data: d } = un(), { data: f, isFetching: h } = cn(), y = $(() => {
3631
+ const [l, o] = P(null), { data: c } = Be(), { data: d } = un(), { data: f, isFetching: h } = cn(), y = W(() => {
3631
3632
  const p = Nn(
3632
3633
  je(le(d, "languages"), (A) => {
3633
3634
  const E = Ee(f, { lang: A });
@@ -3734,7 +3735,7 @@ function Eo() {
3734
3735
  function bo(e) {
3735
3736
  const t = ee(), n = X();
3736
3737
  return Pe({
3737
- queryKey: [W, "revisions", e],
3738
+ queryKey: [z, "revisions", e],
3738
3739
  queryFn: async () => await n(t, {
3739
3740
  action: I.GET_PAGE_REVISIONS,
3740
3741
  data: { pageId: e }
@@ -3753,7 +3754,7 @@ const wo = () => {
3753
3754
  }),
3754
3755
  onSuccess: () => {
3755
3756
  n.invalidateQueries({
3756
- queryKey: [W, "revisions"]
3757
+ queryKey: [z, "revisions"]
3757
3758
  });
3758
3759
  }
3759
3760
  });
@@ -3769,7 +3770,7 @@ const wo = () => {
3769
3770
  }),
3770
3771
  onSuccess: () => {
3771
3772
  n.invalidateQueries({
3772
- queryKey: [W, "revisions"]
3773
+ queryKey: [z, "revisions"]
3773
3774
  });
3774
3775
  }
3775
3776
  });
@@ -3809,7 +3810,7 @@ function Ao() {
3809
3810
  {
3810
3811
  onSuccess: () => {
3811
3812
  i(!1), s(null), x.invalidateQueries({
3812
- queryKey: [W, I.GET_DRAFT_PAGE]
3813
+ queryKey: [z, I.GET_DRAFT_PAGE]
3813
3814
  });
3814
3815
  }
3815
3816
  }
@@ -4115,7 +4116,7 @@ function _o({
4115
4116
  const Io = () => {
4116
4117
  const e = ee(), t = X();
4117
4118
  return Pe({
4118
- queryKey: [W, I.GET_CHANGES],
4119
+ queryKey: [z, I.GET_CHANGES],
4119
4120
  queryFn: async () => t(e, { action: I.GET_CHANGES })
4120
4121
  });
4121
4122
  }, ko = ({ currentEditor: e }) => {
@@ -4132,18 +4133,18 @@ function Lo({
4132
4133
  return (_ = Ee(l, { key: w })) == null ? void 0 : _.hasSlug;
4133
4134
  },
4134
4135
  [l]
4135
- ), c = $(
4136
+ ), c = W(
4136
4137
  () => Ie(l, (w) => !o(w.key)).map(
4137
4138
  (w) => w.key
4138
4139
  ),
4139
4140
  [o, l]
4140
- ), d = $(
4141
+ ), d = W(
4141
4142
  () => Ie(a, (w) => !c.includes(w.pageType)),
4142
4143
  [a, c]
4143
- ), f = $(
4144
+ ), f = W(
4144
4145
  () => Ie(a, (w) => c.includes(w.pageType)),
4145
4146
  [a, c]
4146
- ), h = $(
4147
+ ), h = W(
4147
4148
  () => Ee(a, { pageType: "theme", id: "THEME" }),
4148
4149
  [a]
4149
4150
  ), { mutate: y, isPending: v } = As();
@@ -4170,7 +4171,7 @@ function Lo({
4170
4171
  if (w === "theme") return "Theme";
4171
4172
  const _ = Ee(l, { key: w });
4172
4173
  return _ ? _ == null ? void 0 : _.name : w;
4173
- }, S = $(() => {
4174
+ }, S = W(() => {
4174
4175
  const w = [
4175
4176
  { label: "Updated", top: "pt-2" },
4176
4177
  ...mn(Ie(d, { online: !0 }), "pageType"),
@@ -4341,7 +4342,7 @@ function $r({
4341
4342
  ] }) });
4342
4343
  }
4343
4344
  const Ro = () => {
4344
- const { selectedLang: e } = ht(), t = st("getPreviewUrl", async (f) => f), [n, s] = P(""), { data: a, isFetching: i } = Be(), { data: l } = cn(), { data: o } = De(), c = $(
4345
+ const { selectedLang: e } = ht(), t = st("getPreviewUrl", async (f) => f), [n, s] = P(""), { data: a, isFetching: i } = Be(), { data: l } = cn(), { data: o } = De(), c = W(
4345
4346
  () => {
4346
4347
  var f;
4347
4348
  return (f = l == null ? void 0 : l.find((h) => (h == null ? void 0 : h.lang) === e)) == null ? void 0 : f.slug;
@@ -4398,10 +4399,10 @@ const Ro = () => {
4398
4399
  Ae(() => {
4399
4400
  a === "SAVED" && t(!1);
4400
4401
  }, [a]);
4401
- const l = $(() => {
4402
+ const l = W(() => {
4402
4403
  if (a === "SAVED" || a === "UNSAVED") return a;
4403
4404
  if (a === "SAVING") return e ? a : "SAVED";
4404
- }, [e, a]), { buttonIcon: o, buttonClass: c, tooltipContent: d } = $(() => {
4405
+ }, [e, a]), { buttonIcon: o, buttonClass: c, tooltipContent: d } = W(() => {
4405
4406
  switch (l) {
4406
4407
  case "UNSAVED":
4407
4408
  return {
@@ -4438,7 +4439,7 @@ const Ro = () => {
4438
4439
  }
4439
4440
  );
4440
4441
  }, Bo = () => {
4441
- const [e, t] = P(!1), [n, s] = P(!1), [a, i] = P(null), { data: l } = Be(), { mutate: o, isPending: c } = As(), [d] = ui(), { buttonText: f, buttonClassName: h, isPublished: y } = $(() => {
4442
+ const [e, t] = P(!1), [n, s] = P(!1), [a, i] = P(null), { data: l } = Be(), { mutate: o, isPending: c } = As(), [d] = ui(), { buttonText: f, buttonClassName: h, isPublished: y } = W(() => {
4442
4443
  const p = l && (l == null ? void 0 : l.online);
4443
4444
  return {
4444
4445
  buttonClassName: p ? "hover:bg-green-600 bg-green-500" : "",
@@ -4626,7 +4627,7 @@ const jo = () => /* @__PURE__ */ u("div", { className: "flex px-2 h-full items-c
4626
4627
  return n;
4627
4628
  }), Vo = (e) => {
4628
4629
  const t = ml();
4629
- return $(() => {
4630
+ return W(() => {
4630
4631
  if (!e || ye(e)) return { blocks: [] };
4631
4632
  const n = Ie(
4632
4633
  e,
@@ -4637,7 +4638,7 @@ const jo = () => /* @__PURE__ */ u("div", { className: "flex px-2 h-full items-c
4637
4638
  }, zo = () => {
4638
4639
  const e = ee(), t = X();
4639
4640
  return Pe({
4640
- queryKey: [W, "uiLibraries"],
4641
+ queryKey: [z, "uiLibraries"],
4641
4642
  initialData: [],
4642
4643
  queryFn: async () => (await t(e, { action: "GET_LIBRARIES" })).map((s) => ({
4643
4644
  ...s
@@ -4646,7 +4647,7 @@ const jo = () => /* @__PURE__ */ u("div", { className: "flex px-2 h-full items-c
4646
4647
  }, $o = () => {
4647
4648
  const e = Rn(), t = X(), { user: n } = nt(), s = n == null ? void 0 : n.id;
4648
4649
  return Pe({
4649
- queryKey: [W, "permissions", s],
4650
+ queryKey: [z, "permissions", s],
4650
4651
  queryFn: () => t(e, {
4651
4652
  action: I.GET_ROLE_AND_PERMISSIONS,
4652
4653
  data: { userId: s }
@@ -4871,7 +4872,7 @@ const jo = () => /* @__PURE__ */ u("div", { className: "flex px-2 h-full items-c
4871
4872
  ] }) });
4872
4873
  };
4873
4874
  let Wn = Qo;
4874
- const Xo = () => $(() => Wn, [Wn]), td = (e) => {
4875
+ const Xo = () => W(() => Wn, [Wn]), td = (e) => {
4875
4876
  Wn = e;
4876
4877
  }, Zo = () => {
4877
4878
  const e = Xo();
@@ -4982,7 +4983,7 @@ function Je({
4982
4983
  }
4983
4984
  const tc = () => {
4984
4985
  const { selectedLang: e } = ht(), { data: t, isFetching: n } = cn();
4985
- return { data: $(() => Ee(t, { lang: e || "" }) || {}, [t, e]), isFetching: n };
4986
+ return { data: W(() => Ee(t, { lang: e || "" }) || {}, [t, e]), isFetching: n };
4986
4987
  }, nc = (e, t) => {
4987
4988
  const n = e.selectionStart || 0, s = e.selectionEnd || 0, a = e.value, i = a.substring(0, n), l = a.substring(s);
4988
4989
  let o = !1;
@@ -7517,7 +7518,7 @@ var Ad = (e, t = !1) => {
7517
7518
  const t = da(() => {
7518
7519
  const n = this, [s] = B(this, vt), [a] = B(this, Et), [i] = B(this, bt), [l] = B(this, wt), [o] = B(this, pt);
7519
7520
  let c;
7520
- return B(this, St) ? c = B(this, St) : (c = ca(() => import("./HO4MOOFI-CAG7BWJu.js")), ie(this, St, c)), Ia(B(this, Xt), B(this, yt)), la(c, oa({
7521
+ return B(this, St) ? c = B(this, St) : (c = ca(() => import("./HO4MOOFI-DX91G8Wf.js")), ie(this, St, c)), Ia(B(this, Xt), B(this, yt)), la(c, oa({
7521
7522
  get queryFlavor() {
7522
7523
  return B(n, Yt);
7523
7524
  },
@@ -7611,7 +7612,7 @@ var Ad = (e, t = !1) => {
7611
7612
  const t = da(() => {
7612
7613
  const n = this, [s] = B(this, xt), [a] = B(this, Tt), [i] = B(this, Ct), [l] = B(this, Pt), [o] = B(this, Nt), [c] = B(this, _t);
7613
7614
  let d;
7614
- return B(this, It) ? d = B(this, It) : (d = ca(() => import("./HUY7CZI3-BiyRQa11.js")), ie(this, It, d)), Ia(B(this, nn), B(this, At)), la(d, oa({
7615
+ return B(this, It) ? d = B(this, It) : (d = ca(() => import("./HUY7CZI3-CLVqsadH.js")), ie(this, It, d)), Ia(B(this, nn), B(this, At)), la(d, oa({
7615
7616
  get queryFlavor() {
7616
7617
  return B(n, en);
7617
7618
  },
@@ -7729,7 +7730,7 @@ var Ru = process.env.NODE_ENV !== "development" ? function() {
7729
7730
  } : Du;
7730
7731
  process.env.NODE_ENV;
7731
7732
  const Uu = ti(
7732
- () => import("./digital-asset-manager-C_IzloX5.js")
7733
+ () => import("./digital-asset-manager-C0rwn9hn.js")
7733
7734
  );
7734
7735
  gl();
7735
7736
  ac();
@@ -7743,7 +7744,7 @@ const Ou = (e) => {
7743
7744
  role: "",
7744
7745
  permissions: null
7745
7746
  }
7746
- } = $o(), { data: o } = zo(), { data: c, isFetching: d } = qr(), { blocks: f } = Vo(c), { data: h } = un(), { data: y } = De(), { mutateAsync: v } = Br(), p = Ho(), { getUILibraryBlock: A, getUILibraryBlocks: E, onSave: x } = Wo(), { getPartialBlocks: D, getPartialBlockBlocks: S } = Yo(), { aiContext: w, setAiContext: _ } = ws(), { mutateAsync: k } = Vl(), [oe, te] = P(!1), G = $(
7747
+ } = $o(), { data: o } = zo(), { data: c, isFetching: d } = qr(), { blocks: f } = Vo(c), { data: h } = un(), { data: y } = De(), { mutateAsync: v } = Br(), p = Ho(), { getUILibraryBlock: A, getUILibraryBlocks: E, onSave: x } = Wo(), { getPartialBlocks: D, getPartialBlockBlocks: S } = Yo(), { aiContext: w, setAiContext: _ } = ws(), { mutateAsync: k } = Vl(), [oe, te] = P(!1), G = W(
7747
7748
  () => (h == null ? void 0 : h.fallbackLang) || "en",
7748
7749
  [h]
7749
7750
  ), { data: O } = jr({
@@ -7756,13 +7757,13 @@ const Ou = (e) => {
7756
7757
  };
7757
7758
  return window.addEventListener("visibilitychange", Z), () => window.removeEventListener("visibilitychange", Z);
7758
7759
  }, []), t.current = f;
7759
- const T = $(() => {
7760
+ const T = W(() => {
7760
7761
  const Z = {};
7761
7762
  return l && (Z.permissions = le(l, "permissions", null), Z.role = le(l, "role", "user")), Z;
7762
- }, [l]), M = $(() => o, [o]), ne = xe(
7763
+ }, [l]), M = W(() => o, [o]), ne = xe(
7763
7764
  async (Z, fe) => await k({ pageType: Z, query: fe }),
7764
7765
  [k]
7765
- ), me = $(
7766
+ ), me = W(
7766
7767
  () => le(h, "theme", {}) || {},
7767
7768
  [h]
7768
7769
  );
@@ -7848,7 +7849,7 @@ const Ou = (e) => {
7848
7849
  /* @__PURE__ */ r(Ru, {})
7849
7850
  ] }) : /* @__PURE__ */ r("div", {});
7850
7851
  }, Id = () => {
7851
- const { user: e } = nt(), t = $(
7852
+ const { user: e } = nt(), t = W(
7852
7853
  () => e == null ? void 0 : e.accessToken,
7853
7854
  [e == null ? void 0 : e.accessToken]
7854
7855
  ), { refetch: n } = Ur();
@@ -7912,7 +7913,7 @@ export {
7912
7913
  ed as W,
7913
7914
  X,
7914
7915
  I as Y,
7915
- W as Z,
7916
+ z as Z,
7916
7917
  _d as _,
7917
7918
  la as a,
7918
7919
  Me as a0,