@chaibuilder/sdk 4.0.0-beta.47 → 4.0.0-beta.49

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 (122) hide show
  1. package/dist/{2SSKDMRQ-CVHl6i14.cjs → 2SSKDMRQ-CjvuNdPo.cjs} +1 -1
  2. package/dist/{2SSKDMRQ-D9rlRpnI.js → 2SSKDMRQ-Dvf9zadl.js} +2 -2
  3. package/dist/{AP7HFJJL-D18sv0Wh.cjs → AP7HFJJL-DYFttFoI.cjs} +1 -1
  4. package/dist/{AP7HFJJL-CBrphwP9.js → AP7HFJJL-q4dJdyFs.js} +1 -1
  5. package/dist/{IconPicker-CSewv0kY.js → IconPicker-Bf163F7t.js} +1 -1
  6. package/dist/{IconPicker-CxEGCcVZ.cjs → IconPicker-JWhYq2Gp.cjs} +1 -1
  7. package/dist/{WDYDFRGG-C0G8c0hR.cjs → WDYDFRGG-BEksfGMC.cjs} +1 -1
  8. package/dist/{WDYDFRGG-BCmjXFs0.js → WDYDFRGG-O9GIrtX0.js} +2 -2
  9. package/dist/{actions-registery-BQ31lpix.cjs → actions-registery-BHbZHkE3.cjs} +11 -3
  10. package/dist/{actions-registery-B1VeX52Y.js → actions-registery-gJb_wq2F.js} +25 -13
  11. package/dist/actions.cjs +1 -1
  12. package/dist/actions.d.ts +10 -3
  13. package/dist/actions.js +6 -4
  14. package/dist/{active-in-another-tab-BhbPijx9.js → active-in-another-tab-B4Ur0JP7.js} +2 -2
  15. package/dist/{active-in-another-tab-CMmhCRma.cjs → active-in-another-tab-BPdx4lWh.cjs} +1 -1
  16. package/dist/{add-new-language-page-ChQgjFwb.cjs → add-new-language-page-BfUp5Ua2.cjs} +1 -1
  17. package/dist/{add-new-language-page-C0sayTSF.js → add-new-language-page-CRR93tLq.js} +3 -3
  18. package/dist/{add-new-page-DLf5Tfb7.cjs → add-new-page-B8NGK6WS.cjs} +1 -1
  19. package/dist/{add-new-page-DLKzuaNM.js → add-new-page-Ppy5-y5j.js} +2 -2
  20. package/dist/ai-panel-default-lang-BXYQye3N.js +333 -0
  21. package/dist/ai-panel-default-lang-VhgmHFoQ.cjs +3 -0
  22. package/dist/ai-panel-other-lang-DaCf-cq4.js +148 -0
  23. package/dist/ai-panel-other-lang-Ds0EXeUC.cjs +1 -0
  24. package/dist/{ai-prompt-input-DNb1FKXQ.js → ai-prompt-input-7iWk72w5.js} +253 -258
  25. package/dist/ai-prompt-input-nZ5_Dm7X.cjs +1 -0
  26. package/dist/{ai-translation-prompt-B2MfzTjb.js → ai-translation-prompt-1OUs1P7n.js} +1 -1
  27. package/dist/{ai-translation-prompt-CL3yk8K1.cjs → ai-translation-prompt-B16cK-1Q.cjs} +1 -1
  28. package/dist/{change-password-modal-CbMifP62.js → change-password-modal-CdvJR1Ln.js} +10 -10
  29. package/dist/{change-password-modal-D_NFPZxI.cjs → change-password-modal-D5eXjiYq.cjs} +1 -1
  30. package/dist/{code-editor-53rOkfhX.js → code-editor-CyLjDiEp.js} +1 -1
  31. package/dist/{code-editor-CCsljULB.cjs → code-editor-SWbfFj1E.cjs} +1 -1
  32. package/dist/{continue-editing-in-this-client-hB4O3CHJ.js → continue-editing-in-this-client-BrSvK-Ay.js} +2 -2
  33. package/dist/{continue-editing-in-this-client-3QLL7tQH.cjs → continue-editing-in-this-client-Cmi-GkYZ.cjs} +1 -1
  34. package/dist/core.cjs +1 -1
  35. package/dist/core.js +1 -1
  36. package/dist/{css-import-modal-Bmi3LrEJ.cjs → css-import-modal-Bdwgd05S.cjs} +1 -1
  37. package/dist/{css-import-modal-DCivkVh2.js → css-import-modal-Be47CBJn.js} +1 -1
  38. package/dist/{delete-page-BW2NxLZu.js → delete-page-C99K2qzS.js} +15 -15
  39. package/dist/{delete-page-CxVfKrBz.cjs → delete-page-DLohaU-U.cjs} +1 -1
  40. package/dist/{design-token-usage-WTVjf9c-.js → design-token-usage-D1lWCJ3L.js} +1 -1
  41. package/dist/{design-token-usage-5jsa9ojN.cjs → design-token-usage-eY2wQ0l3.cjs} +1 -1
  42. package/dist/{digital-asset-manager-dNK-BYdI.js → digital-asset-manager-BZMb6sC7.js} +3 -3
  43. package/dist/{digital-asset-manager-DlFCWUP4.cjs → digital-asset-manager-Z5aJxkq0.cjs} +1 -1
  44. package/dist/{duplicate-page-BbB2anQO.js → duplicate-page-CDc2X0eW.js} +12 -12
  45. package/dist/{duplicate-page-0o6G-oY_.cjs → duplicate-page-D5Gtvqdv.cjs} +1 -1
  46. package/dist/{dynamic-page-selector-Ds3MqxTF.cjs → dynamic-page-selector-DZHhX008.cjs} +1 -1
  47. package/dist/{dynamic-page-selector-rFO8457w.js → dynamic-page-selector-DvNBXo6o.js} +2 -2
  48. package/dist/{image-editor-BnVkes6Q.js → image-editor-BBvvi9Vm.js} +1 -1
  49. package/dist/{image-editor-DqItmbk1.cjs → image-editor-DwhTYkVR.cjs} +1 -1
  50. package/dist/index-BVwFJWDq.cjs +5 -0
  51. package/dist/{index-DTNHTRZu.cjs → index-DCJDQs1a.cjs} +8 -8
  52. package/dist/{index-BYjniKhj.js → index-LBTm1Jmk.js} +838 -806
  53. package/dist/{index-B7HAfx-2.js → index-OuHV9Ann.js} +16 -9
  54. package/dist/{json-diff-viewer-B4rnFiN_.cjs → json-diff-viewer-Cb1CmRqP.cjs} +1 -1
  55. package/dist/{json-diff-viewer-CKlyO9eW.js → json-diff-viewer-DG6qMOBS.js} +6 -6
  56. package/dist/{lang-panel-YT96E5Xj.js → lang-panel-B3USOxGq.js} +9 -9
  57. package/dist/{lang-panel-DiVz4Cay.cjs → lang-panel-DxoJ0v4y.cjs} +1 -1
  58. package/dist/{manage-design-tokens-LwImeKaK.js → manage-design-tokens-6YGIctip.js} +2 -2
  59. package/dist/{manage-design-tokens-modal-BEElCTcN.cjs → manage-design-tokens-modal-BSSCXH8Y.cjs} +1 -1
  60. package/dist/{manage-design-tokens-modal-DFVcoyra.js → manage-design-tokens-modal-CzsnN49F.js} +2 -2
  61. package/dist/{manage-design-tokens-BwrIc6dS.cjs → manage-design-tokens-udLBvkHA.cjs} +1 -1
  62. package/dist/{mark-as-template-DtDkh6jB.cjs → mark-as-template-B9yLcasI.cjs} +1 -1
  63. package/dist/{mark-as-template-D2Hpz0IE.js → mark-as-template-CP_F9ZQ4.js} +2 -2
  64. package/dist/{models-D0RH2u4C.cjs → models-CQaC3EBW.cjs} +1 -1
  65. package/dist/{models-BCu-p_QK.js → models-DZ9C6CvE.js} +4 -5
  66. package/dist/{nested-path-selector-content-TqjBbNys.js → nested-path-selector-content-DmtCI3q9.js} +1 -1
  67. package/dist/{nested-path-selector-content-CJfN8Hhw.cjs → nested-path-selector-content-aTdu-o0e.cjs} +1 -1
  68. package/dist/{no-language-page-content-CcD-fgMa.cjs → no-language-page-content-C-MCdPXt.cjs} +1 -1
  69. package/dist/{no-language-page-content-Ce3wniZT.js → no-language-page-content-D8t5dfgh.js} +2 -2
  70. package/dist/{no-language-page-dialog-CU1zXsYv.js → no-language-page-dialog-C_fHI2zI.js} +2 -2
  71. package/dist/{no-language-page-dialog-B7fhPdob.cjs → no-language-page-dialog-D4QIAHnE.cjs} +1 -1
  72. package/dist/{page-creator-C7XEqUx_.cjs → page-creator-Cz_ah-qE.cjs} +1 -1
  73. package/dist/{page-creator-wg3uymVG.js → page-creator-DKEkuGCO.js} +33 -33
  74. package/dist/{page-lock-BuVma3e5.js → page-lock-CwZKJ4IE.js} +2 -2
  75. package/dist/{page-lock-CINb2air.cjs → page-lock-DdCvtA-I.cjs} +1 -1
  76. package/dist/{page-locked-dialog-s-3ROcy0.cjs → page-locked-dialog-CrTDBoC4.cjs} +1 -1
  77. package/dist/{page-locked-dialog-C7_1gjO5.js → page-locked-dialog-DqLlooUz.js} +11 -11
  78. package/dist/{page-manager-new-CKWSLVrb.cjs → page-manager-new-ah6QYar2.cjs} +1 -1
  79. package/dist/{page-manager-new-zlobCGqL.js → page-manager-new-ttsrxdW9.js} +42 -42
  80. package/dist/{page-manager-search-and-filter-BaOsl_5u.cjs → page-manager-search-and-filter-D7AupT6_.cjs} +1 -1
  81. package/dist/{page-manager-search-and-filter-BU_iNmHy.js → page-manager-search-and-filter-bsqZ6wnI.js} +2 -2
  82. package/dist/{page-revisions-content-BmaNPNoS.cjs → page-revisions-content-B6hsIla7.cjs} +1 -1
  83. package/dist/{page-revisions-content-D6l_d2jW.js → page-revisions-content-C5O8_Fms.js} +16 -16
  84. package/dist/pages.cjs +1 -1
  85. package/dist/pages.d.ts +66 -1
  86. package/dist/pages.js +19 -19
  87. package/dist/{publish-pages-content-2LG6JOrm.cjs → publish-pages-content-BrajJUcP.cjs} +1 -1
  88. package/dist/{publish-pages-content-CQteRtBA.js → publish-pages-content-KZVMHT6V.js} +32 -32
  89. package/dist/{rte-widget-modal-KzT2hLFt.cjs → rte-widget-modal-CiTwsXTr.cjs} +1 -1
  90. package/dist/{rte-widget-modal-CFk0Izg5.js → rte-widget-modal-IU8JzPuZ.js} +1 -1
  91. package/dist/{save-to-lib-D1V3bNZX.js → save-to-lib-DMnv7ENo.js} +50 -50
  92. package/dist/{save-to-lib-D82Vrekv.cjs → save-to-lib-Dc700Aop.cjs} +1 -1
  93. package/dist/{selected-block-display-BHx9N14K.cjs → selected-block-display-CAFEOrLV.cjs} +1 -1
  94. package/dist/{selected-block-display-BbUH5RaW.js → selected-block-display-CidmQ-wz.js} +2 -2
  95. package/dist/{seo-panel-CyBmGg6k.js → seo-panel-Br8gxDxu.js} +148 -158
  96. package/dist/{seo-panel-CPsjZLtL.cjs → seo-panel-CMY-adM-.cjs} +2 -2
  97. package/dist/{shared-json-ld-DyU9wqrE.cjs → shared-json-ld-CMH-eRUq.cjs} +1 -1
  98. package/dist/{shared-json-ld-SGykyppC.js → shared-json-ld-uvMmwCYp.js} +26 -26
  99. package/dist/{slug-input-BzpnOdXG.cjs → slug-input-CiHC5l3r.cjs} +1 -1
  100. package/dist/{slug-input-DpMI4nEB.js → slug-input-DLWTMTsO.js} +1 -1
  101. package/dist/supabase-actions.cjs +1 -1
  102. package/dist/supabase-actions.js +1 -1
  103. package/dist/{take-over-request-wTVLAotu.cjs → take-over-request-IRLgF1dG.cjs} +1 -1
  104. package/dist/{take-over-request-D97Fg-xB.js → take-over-request-KdR1_h_K.js} +5 -5
  105. package/dist/{translation-warning-modal-Xk6oYGFS.cjs → translation-warning-modal-CLZ9tC1F.cjs} +1 -1
  106. package/dist/{translation-warning-modal-Du-CnfyH.js → translation-warning-modal-CzNt6LDO.js} +1 -1
  107. package/dist/types.d.ts +6 -0
  108. package/dist/{unmark-as-template-BHk2F0ck.js → unmark-as-template-C5ovsEBP.js} +2 -2
  109. package/dist/{unmark-as-template-BRnMhh7n.cjs → unmark-as-template-F7TdgWjI.cjs} +1 -1
  110. package/dist/{unpublish-page-BOEjCHLB.js → unpublish-page-0fR1o0b7.js} +8 -8
  111. package/dist/{unpublish-page-Bu75lH33.cjs → unpublish-page-CUr8Xub6.cjs} +1 -1
  112. package/dist/{unpublished-partials-modal-C0_0qNvV.js → unpublished-partials-modal-BhNAub_z.js} +1 -1
  113. package/dist/{unpublished-partials-modal-BS_GddEG.cjs → unpublished-partials-modal-Cv5R9-hi.cjs} +1 -1
  114. package/dist/{web-preview-DcOhTGup.cjs → web-preview-CuMYekVJ.cjs} +1 -1
  115. package/dist/{web-preview-C3bbIF6T.js → web-preview-D9pXonAv.js} +1 -1
  116. package/package.json +1 -1
  117. package/dist/ai-panel-default-lang-DsGjoITc.cjs +0 -3
  118. package/dist/ai-panel-default-lang-Dy_4L5pH.js +0 -317
  119. package/dist/ai-panel-other-lang-1RYtb71B.js +0 -132
  120. package/dist/ai-panel-other-lang-CL3coL7Z.cjs +0 -1
  121. package/dist/ai-prompt-input-BhTL_-mT.cjs +0 -1
  122. package/dist/index-BeGLwvqs.cjs +0 -5
@@ -1,12 +1,12 @@
1
- import { jsxs as y, Fragment as q, jsx as t } from "react/jsx-runtime";
2
- import { d as ie } from "./index-B7HAfx-2.js";
3
- import { ay as be, az as ge, am as ke, i as de, T as D, aP as ve, L as Ne, k as Se, e as Le, c as Ce, as as Ae, aQ as Ee, aR as $e } from "./index-BYjniKhj.js";
1
+ import { jsxs as w, Fragment as q, jsx as t } from "react/jsx-runtime";
2
+ import { d as ie } from "./index-OuHV9Ann.js";
3
+ import { aA as be, aB as ge, ao as ke, i as de, T as D, aR as ve, L as Ne, k as Se, e as Le, c as Ce, au as Ae, aS as Ee, aT as $e } from "./index-LBTm1Jmk.js";
4
4
  import { u as J } from "./use-page-expand-manager-Cf4MUEJw.js";
5
5
  import { compact as ue, filter as F, isEmpty as k, uniqBy as Te, keyBy as me, mapValues as Me, startCase as Ue, toLower as T, includes as _, get as R, find as W, map as Ie } from "lodash-es";
6
- import { atom as ze, useAtom as Fe, useSetAtom as Be } from "jotai";
6
+ import { atom as Be, useAtom as Fe, useSetAtom as ze } from "jotai";
7
7
  import { ExternalLink as Oe, Pencil as je, MoreHorizontal as Ge, Lock as De, Plus as Re, ChevronRight as We, StarsIcon as He, Hash as _e, File as he } from "lucide-react";
8
- import { useRef as qe, useEffect as $, useMemo as H, useState as N, useCallback as le, startTransition as Qe, Suspense as E, lazy as M } from "react";
9
- import { useTranslation as Ve } from "react-i18next";
8
+ import { useRef as qe, useEffect as $, useMemo as H, useState as N, useCallback as le, startTransition as Ve, Suspense as E, lazy as M } from "react";
9
+ import { useTranslation as Qe } from "react-i18next";
10
10
  import { B as Xe } from "./register-chai-top-bar-D6GjnauV.js";
11
11
  const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
12
12
  F(e, (a) => {
@@ -57,7 +57,7 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
57
57
  const m = ce(i, s), l = Ye(e, m);
58
58
  i = Te([...m, ...l], "id");
59
59
  }
60
- const o = fe(Je(i)), f = Y(o, s, n), w = F(f, (m) => n(m.pageType)).sort(
60
+ const o = fe(Je(i)), f = Y(o, s, n), y = F(f, (m) => n(m.pageType)).sort(
61
61
  (m, l) => (m.name || "").localeCompare(l.name || "")
62
62
  ), c = F(f, (m) => !n(m.pageType));
63
63
  let x = [];
@@ -74,8 +74,8 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
74
74
  );
75
75
  } else
76
76
  x = c.sort((m, l) => (m.name || "").localeCompare(l.name || ""));
77
- return [...w, ...x];
78
- }, Ze = ze({
77
+ return [...y, ...x];
78
+ }, Ze = Be({
79
79
  pageId: null,
80
80
  position: { x: 0, y: 0 }
81
81
  }), et = ({ pageId: e, children: s }) => {
@@ -87,11 +87,11 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
87
87
  }, [o, n]);
88
88
  const f = (c) => {
89
89
  c.preventDefault(), c.stopPropagation(), n({ pageId: e, position: { x: c.clientX, y: c.clientY } });
90
- }, w = () => {
90
+ }, y = () => {
91
91
  const c = `${window.location.pathname}?page=${e}`;
92
92
  window.open(c, "_blank"), n({ pageId: null, position: { x: 0, y: 0 } });
93
93
  };
94
- return /* @__PURE__ */ y(q, { children: [
94
+ return /* @__PURE__ */ w(q, { children: [
95
95
  /* @__PURE__ */ t("span", { onContextMenu: f, children: s }),
96
96
  o && /* @__PURE__ */ t(
97
97
  "div",
@@ -99,11 +99,11 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
99
99
  ref: i,
100
100
  className: "fixed z-[9999] max-w-[160px] rounded-md border border-gray-200 bg-white",
101
101
  style: { top: a.position.y, left: a.position.x },
102
- children: /* @__PURE__ */ t("div", { className: "", children: /* @__PURE__ */ y(
102
+ children: /* @__PURE__ */ t("div", { className: "", children: /* @__PURE__ */ w(
103
103
  Xe,
104
104
  {
105
105
  variant: "ghost",
106
- onClick: w,
106
+ onClick: y,
107
107
  className: "w-full px-2.5 py-1 text-start text-sm text-gray-700 hover:bg-gray-100",
108
108
  children: [
109
109
  /* @__PURE__ */ t(Oe, { className: "h-4 w-4" }),
@@ -149,12 +149,12 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
149
149
  selectedLanguage: o,
150
150
  showUntranslatedPages: f
151
151
  }) => {
152
- const w = be(), { pageToUser: c } = ge(), x = R(c, [e == null ? void 0 : e.id, "userId"]), { data: m } = ke(x), l = m && w !== x ? m == null ? void 0 : m.name : null, p = de(), v = a === e.id, P = H(() => W(s, { key: e.pageType }), [s, e.pageType]);
152
+ const y = be(), { pageToUser: c } = ge(), x = R(c, [e == null ? void 0 : e.id, "userId"]), { data: m } = ke(x), l = m && y !== x ? m == null ? void 0 : m.name : null, p = de(), v = a === e.id, P = H(() => W(s, { key: e.pageType }), [s, e.pageType]);
153
153
  let d = R(i, e == null ? void 0 : e.id);
154
154
  d = R(d, "lang") === o ? d : null;
155
155
  const L = o === p || !!d, U = (d == null ? void 0 : d.name) || (e == null ? void 0 : e.name) || "No name";
156
156
  let g = (d == null ? void 0 : d.slug) || (e == null ? void 0 : e.slug) || "";
157
- const B = g + (e != null && e.dynamic ? `/${P == null ? void 0 : P.dynamicSlug}` : "") + (e != null && e.dynamicSlugCustom ? `${e.dynamicSlugCustom}` : "");
157
+ const z = g + (e != null && e.dynamic ? `/${P == null ? void 0 : P.dynamicSlug}` : "") + (e != null && e.dynamicSlugCustom ? `${e.dynamicSlugCustom}` : "");
158
158
  if (g.startsWith("/") && !f) {
159
159
  const h = g.split("/").pop();
160
160
  g = g.endsWith(h) && e.dynamic ? "" : `/${h}`;
@@ -170,8 +170,8 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
170
170
  return !1;
171
171
  return !0;
172
172
  }, [d, e]);
173
- return /* @__PURE__ */ y("div", { className: "group relative", children: [
174
- /* @__PURE__ */ t(et, { pageId: e.id, children: /* @__PURE__ */ y(
173
+ return /* @__PURE__ */ w("div", { className: "group relative", children: [
174
+ /* @__PURE__ */ t(et, { pageId: e.id, children: /* @__PURE__ */ w(
175
175
  "div",
176
176
  {
177
177
  onClick: () => !e.isPartialGroup && L && n("select", e == null ? void 0 : e.id),
@@ -181,9 +181,9 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
181
181
  !e.isPartialGroup && /* @__PURE__ */ t(st, { isOnline: d ? d.online : e.online }),
182
182
  !e.isPartialGroup && /* @__PURE__ */ t(nt, { page: e, pageType: P }),
183
183
  /* @__PURE__ */ t(D, { content: U, side: "top", showTooltip: U.length > 35, children: /* @__PURE__ */ t("span", { className: "max-w-[40%] truncate font-medium text-black", children: U }) }),
184
- (g || e.dynamic) && /* @__PURE__ */ t(D, { content: B, side: "top", showTooltip: !0, children: /* @__PURE__ */ y("span", { className: "max-w-[40%] truncate font-mono text-xs text-muted-foreground", children: [
184
+ (g || e.dynamic) && /* @__PURE__ */ t(D, { content: z, side: "top", showTooltip: !0, children: /* @__PURE__ */ w("span", { className: "max-w-[40%] truncate font-mono text-xs text-muted-foreground", children: [
185
185
  g,
186
- e.dynamic && (P == null ? void 0 : P.dynamicSlug) && /* @__PURE__ */ y("span", { className: "text-xs text-gray-500", children: [
186
+ e.dynamic && (P == null ? void 0 : P.dynamicSlug) && /* @__PURE__ */ w("span", { className: "text-xs text-gray-500", children: [
187
187
  "/",
188
188
  P == null ? void 0 : P.dynamicSlug,
189
189
  e.dynamicSlugCustom
@@ -201,14 +201,14 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
201
201
  setDeletePage: (h) => n("delete", d || h),
202
202
  children: /* @__PURE__ */ t("div", { className: "m-0 cursor-pointer rounded border border-transparent p-0.5 duration-100 hover:border-gray-400 hover:bg-white", children: /* @__PURE__ */ t(Ge, { className: "h-4 w-4", onClick: (h) => h.stopPropagation() }) })
203
203
  }
204
- ) }) : l ? /* @__PURE__ */ y("span", { className: "duration absolute right-1.5 top-1/2 flex -translate-y-1/2 items-center gap-x-1 text-xs text-red-500", children: [
204
+ ) }) : l ? /* @__PURE__ */ w("span", { className: "duration absolute right-1.5 top-1/2 flex -translate-y-1/2 items-center gap-x-1 text-xs text-red-500", children: [
205
205
  /* @__PURE__ */ t(De, { className: "h-3 w-3 fill-red-200 text-red-500" }),
206
206
  /* @__PURE__ */ t(D, { content: `${l} is editing this page`, children: /* @__PURE__ */ t("span", { className: "font-bold", children: l }) })
207
207
  ] }) : null
208
208
  ]
209
209
  }
210
210
  ) }),
211
- /* @__PURE__ */ t(q, { children: !L && !e.isPartialGroup && !l && /* @__PURE__ */ y(
211
+ /* @__PURE__ */ t(q, { children: !L && !e.isPartialGroup && !l && /* @__PURE__ */ w(
212
212
  "button",
213
213
  {
214
214
  onClick: (h) => {
@@ -218,7 +218,7 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
218
218
  children: [
219
219
  /* @__PURE__ */ t(Re, { size: 12, className: "stroke-[3]" }),
220
220
  " ",
221
- /* @__PURE__ */ y("span", { className: "text-[10px]", children: [
221
+ /* @__PURE__ */ w("span", { className: "text-[10px]", children: [
222
222
  "Add ",
223
223
  R(Ne, o),
224
224
  " Page"
@@ -235,10 +235,10 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
235
235
  onClickAction: i,
236
236
  languagePages: o,
237
237
  selectedLanguage: f,
238
- showUntranslatedPages: w
238
+ showUntranslatedPages: y
239
239
  }) => {
240
240
  const { expandedPages: c } = J();
241
- return /* @__PURE__ */ t("div", { className: "space-y-0.5", style: { paddingLeft: `${s * 10}px` }, children: e.map((x) => /* @__PURE__ */ y(q, { children: [
241
+ return /* @__PURE__ */ t("div", { className: "space-y-0.5", style: { paddingLeft: `${s * 10}px` }, children: e.map((x) => /* @__PURE__ */ w(q, { children: [
242
242
  /* @__PURE__ */ t(
243
243
  at,
244
244
  {
@@ -248,7 +248,7 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
248
248
  onClickAction: i,
249
249
  languagePages: o,
250
250
  selectedLanguage: f,
251
- showUntranslatedPages: w
251
+ showUntranslatedPages: y
252
252
  }
253
253
  ),
254
254
  x.children && x.children.length > 0 && (c == null ? void 0 : c.includes(x.id)) && /* @__PURE__ */ t(
@@ -261,12 +261,12 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
261
261
  onClickAction: i,
262
262
  languagePages: o,
263
263
  selectedLanguage: f,
264
- showUntranslatedPages: w
264
+ showUntranslatedPages: y
265
265
  }
266
266
  )
267
267
  ] }, x.id)) });
268
- }, rt = M(() => import("./page-manager-search-and-filter-BU_iNmHy.js")), ot = M(() => import("./add-new-page-DLKzuaNM.js")), it = M(() => import("./delete-page-BW2NxLZu.js")), lt = M(() => import("./duplicate-page-BbB2anQO.js")), ct = M(() => import("./mark-as-template-D2Hpz0IE.js")), dt = M(() => import("./unmark-as-template-BHk2F0ck.js")), ut = M(() => import("./unpublish-page-BOEjCHLB.js")), kt = ({ close: e }) => {
269
- const { t: s } = Ve(), { languages: a, setSelectedLang: n } = ie(), { data: i } = Se(), { data: o, isFetching: f } = Le(), [w, c] = Ce(), { updateForSelectedPage: x, expandPagesOnSearch: m } = J(null), l = de(), p = w.get("page"), [v, P] = N(""), [d, L] = N(null), [U, g] = N(null), [B, O] = N(null), [j, h] = N(null), [A, Q] = N(""), [K, Z] = N(null), [ee, te] = N(null), [b, V] = N(l), [pe, ye] = N(!1), ne = Be(Ae), G = pe && b !== l, { data: I, isFetching: we } = Ee(b), se = le(
268
+ }, rt = M(() => import("./page-manager-search-and-filter-bsqZ6wnI.js")), ot = M(() => import("./add-new-page-Ppy5-y5j.js")), it = M(() => import("./delete-page-C99K2qzS.js")), lt = M(() => import("./duplicate-page-CDc2X0eW.js")), ct = M(() => import("./mark-as-template-CP_F9ZQ4.js")), dt = M(() => import("./unmark-as-template-C5ovsEBP.js")), ut = M(() => import("./unpublish-page-0fR1o0b7.js")), kt = ({ close: e }) => {
269
+ const { t: s } = Qe(), { languages: a, setSelectedLang: n } = ie(), { data: i } = Se(), { data: o, isFetching: f } = Le(), [y, c] = Ce(), { updateForSelectedPage: x, expandPagesOnSearch: m } = J(null), l = de(), p = y.get("page"), [v, P] = N(""), [d, L] = N(null), [U, g] = N(null), [z, O] = N(null), [j, h] = N(null), [A, V] = N(""), [K, Z] = N(null), [ee, te] = N(null), [b, Q] = N(l), [pe, we] = N(!1), ne = ze(Ae), G = pe && b !== l, { data: I, isFetching: ye } = Ee(b), se = le(
270
270
  (u) => {
271
271
  var r;
272
272
  return (r = W(i, { key: u })) == null ? void 0 : r.hasSlug;
@@ -276,23 +276,23 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
276
276
  $(() => {
277
277
  n(l);
278
278
  }, [l, n]), $(() => {
279
- const u = w.get("lang");
279
+ const u = y.get("lang");
280
280
  if (u) {
281
- const r = a, C = a[0] ?? l, z = r.includes(u);
282
- Qe(() => {
283
- z && b !== u ? V(u) : !z && b !== C && V(C);
281
+ const r = a, C = a[0] ?? l, B = r.includes(u);
282
+ Ve(() => {
283
+ B && b !== u ? Q(u) : !B && b !== C && Q(C);
284
284
  });
285
285
  }
286
286
  }, []), $(() => {
287
287
  if (!k(A)) return;
288
288
  const u = sessionStorage.getItem("pageTypeFilter") || "all";
289
- !k(i) && u && (W(i, { key: u }) ? Q(u) : Q("all"));
289
+ !k(i) && u && (W(i, { key: u }) ? V(u) : V("all"));
290
290
  }, [i, A]), $(() => {
291
291
  if (p && !f && !W(o, { id: p })) {
292
- const r = new URLSearchParams(w.toString());
292
+ const r = new URLSearchParams(y.toString());
293
293
  if (r.delete("page"), [...r.keys()].length > 0) {
294
294
  if (typeof window < "u" && window.history && window.location) {
295
- const C = r.toString(), z = window.location.hash || "", oe = window.location.pathname, Pe = C ? `${oe}?${C}${z}` : `${oe}${z}`;
295
+ const C = r.toString(), B = window.location.hash || "", oe = window.location.pathname, Pe = C ? `${oe}?${C}${B}` : `${oe}${B}`;
296
296
  window.history.replaceState(window.history.state, "", Pe);
297
297
  }
298
298
  c(r);
@@ -351,8 +351,8 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
351
351
  break;
352
352
  }
353
353
  };
354
- return /* @__PURE__ */ y(q, { children: [
355
- /* @__PURE__ */ y("div", { className: "flex h-full flex-col justify-between", children: [
354
+ return /* @__PURE__ */ w(q, { children: [
355
+ /* @__PURE__ */ w("div", { className: "flex h-full flex-col justify-between", children: [
356
356
  /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(
357
357
  rt,
358
358
  {
@@ -361,15 +361,15 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
361
361
  setSearch: P,
362
362
  languages: [l, ...a],
363
363
  selectedLanguage: b,
364
- setSelectedLanguage: V,
364
+ setSelectedLanguage: Q,
365
365
  selectedPageType: A,
366
- setSelectedPageType: Q,
366
+ setSelectedPageType: V,
367
367
  onAddPage: (u) => re("add", u),
368
368
  showUntranslatedPages: G,
369
- setShowUntranslatedPages: ye
369
+ setShowUntranslatedPages: we
370
370
  }
371
371
  ) }),
372
- /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto px-4 pb-6 pt-2", children: f || we ? /* @__PURE__ */ t("div", { className: "space-y-2", children: Ie([...Array(15).keys()], (u) => /* @__PURE__ */ t("div", { className: "h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200" }, u)) }) : k(S) ? /* @__PURE__ */ y("div", { className: "flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500", children: [
372
+ /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto px-4 pb-6 pt-2", children: f || ye ? /* @__PURE__ */ t("div", { className: "space-y-2", children: Ie([...Array(15).keys()], (u) => /* @__PURE__ */ t("div", { className: "h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200" }, u)) }) : k(S) ? /* @__PURE__ */ w("div", { className: "flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500", children: [
373
373
  /* @__PURE__ */ t(he, { className: "h-6 w-6 stroke-[1]" }),
374
374
  s("Empty List!"),
375
375
  /* @__PURE__ */ t("span", { className: "font-light", children: s("Add new page to start") })
@@ -397,7 +397,7 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
397
397
  }
398
398
  ) }),
399
399
  d && /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(it, { page: d, onClose: () => L(null) }) }),
400
- B && /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(ut, { page: B, onClose: () => O(null) }) }),
400
+ z && /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(ut, { page: z, onClose: () => O(null) }) }),
401
401
  j && /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(ct, { page: j, onClose: () => h(null) }) }),
402
402
  ee && /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(dt, { page: ee, onClose: () => te(null) }) }),
403
403
  K && /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t(lt, { page: K, onClose: () => Z(null), closePanel: e }) })
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-DTNHTRZu.cjs"),v=require("./index-BeGLwvqs.cjs"),w=require("./use-page-expand-manager-B6XTvk0E.cjs"),S=require("@tanstack/react-query"),s=require("lodash-es"),x=require("lucide-react"),b=require("react"),j=require("react-i18next"),k=({selectedPageType:l,setSelectedPageType:a})=>{const{t:o}=j.useTranslation(),[r,i]=b.useState(""),{data:c}=v.usePageTypes(),m=b.useMemo(()=>c.some(t=>!["page","global"].includes(s.get(t,"key",""))),[c]);if(b.useEffect(()=>{!m&&l!=="all"&&a("all")},[m,l,a]),!m)return null;const u=t=>{if(!r)return!0;const d=r.toLowerCase(),g=f=>String(s.get(t,f,"")).toLowerCase().includes(d);return g("name")||g("key")},p=c.find(t=>t.key===l);return e.jsxs(n.Select,{onValueChange:a,value:l,children:[e.jsx(n.SelectTrigger,{className:`${l==="all"?"bg-gray-100/30 hover:bg-gray-100":"gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-1.5",children:[e.jsx("span",{className:"max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight",children:(p==null?void 0:p.name)||o("All")}),e.jsx(x.ListFilter,{className:`${l!=="all"?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`})]})}),e.jsxs(n.SelectContent,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white pb-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{strokeWidth:2,className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx(h.Input,{placeholder:o("Search page types..."),className:"h-8 w-full rounded border pl-8 text-xs shadow-none",value:r,onChange:t=>i(t.target.value),onKeyDown:t=>t.stopPropagation()})]})}),e.jsx(n.SelectItem,{value:"all",children:o("All")}),!s.isEmpty(s.filter(c,t=>t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:o("Pages")}),s.map([...s.filter(c,t=>t.hasSlug&&u(t))].sort((t,d)=>s.get(t,"name","").localeCompare(s.get(d,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),!s.isEmpty(s.filter(c,t=>!t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:o("Partials")}),s.map([...s.filter(c,t=>!t.hasSlug&&u(t))].sort((t,d)=>s.get(t,"name","").localeCompare(s.get(d,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),s.isEmpty(s.filter(c,u))&&e.jsx("div",{className:"px-3 py-2 text-center text-sm text-gray-500",children:o("No matching page types found")})]})]})},T=({search:l,setSearch:a})=>{const{t:o}=j.useTranslation();return e.jsxs("div",{className:"relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5",children:[e.jsx("label",{htmlFor:"page-search-input",className:"sr-only",children:o("Search Pages")}),e.jsx(x.Search,{className:`${l?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground`,"aria-hidden":"true"}),e.jsx(h.Input,{id:"page-search-input",placeholder:o("Search pages"),value:l,onChange:r=>a(r.target.value),className:"border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",autoComplete:"off",autoFocus:!0})]})},E=({pages:l})=>{const{t:a}=j.useTranslation(),{expandAll:o,collapseAll:r,expandedPages:i}=w.usePageExpandManager(null);return e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"outline",size:"icon",onClick:()=>o(l),className:"rounded p-1 text-gray-500",children:e.jsx(x.ChevronsUpDown,{})})}),e.jsx(n.TooltipContent,{children:a("Expand All")})]}),e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{disabled:i.length===0,variant:"outline",size:"icon",onClick:()=>r(),className:"rounded p-1 text-gray-500",children:e.jsx(x.ChevronsDownUp,{})})}),e.jsx(n.TooltipContent,{children:a("Collapse All")})]})]})},C=({languages:l,selectedLanguage:a,setSelectedLanguage:o})=>{const r=v.useFallbackLang();return e.jsx("div",{className:"scrollbar-hide flex gap-1 overflow-x-auto pb-1",children:l.map(i=>e.jsxs(h.Button,{variant:a===i?"default":"outline",size:"sm",className:`h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${a===i?"bg-black text-white hover:bg-black":"text-gray-500"}`,onClick:()=>o(i.toLowerCase()),children:[i===r&&e.jsx(x.Star,{size:4,className:`p-0.5 ${a===r?"fill-white":"fill-black"}`}),v.LANGUAGES[i]||""]},i))})},y=()=>{const{t:l}=j.useTranslation(),a=S.useQueryClient();return e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{size:"sm",variant:"ghost",onClick:()=>a.invalidateQueries({queryKey:[v.ACTIONS.GET_WEBSITE_PAGES]}),className:"mt-1 h-6 w-6",children:e.jsx(x.RefreshCw,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:l("Refresh pages list")})]})},q=({pages:l,search:a,setSearch:o,languages:r,onAddPage:i,selectedLanguage:c,setSelectedLanguage:m,selectedPageType:u,setSelectedPageType:p,showUntranslatedPages:t,setShowUntranslatedPages:d})=>{const{t:g}=j.useTranslation(),f=r.length>1;return e.jsxs("div",{className:"space-y-3 border-b border-b-gray-200 px-4 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(k,{selectedPageType:u,setSelectedPageType:p}),e.jsx(T,{search:a,setSearch:o}),e.jsx(E,{pages:l}),e.jsxs(h.Button,{variant:"default",onClick:i,className:"rounded px-3 font-normal",children:[e.jsx(x.Plus,{strokeWidth:2,className:"stroke-white stroke-[3]"}),e.jsx("span",{className:"font-normal text-white",children:g("Add Page")})]}),!f&&e.jsx(y,{})]}),f?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(C,{languages:r,selectedLanguage:c,setSelectedLanguage:N=>{m(N),d(t&&(r==null?void 0:r[0])!==c)}}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[(r==null?void 0:r[0])!==c&&e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"ghost",onClick:()=>d(!t),className:"h-6 rounded px-3 py-1 text-xs font-normal",children:t?e.jsx(x.FilterXIcon,{}):e.jsx(x.Filter,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:g("Toggle Untranslated Pages")})]}),e.jsx(y,{})]})]}):e.jsx("div",{className:"flex items-center justify-between gap-2"})]})};exports.LanguageSelector=C;exports.default=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-DCJDQs1a.cjs"),v=require("./index-BVwFJWDq.cjs"),w=require("./use-page-expand-manager-B6XTvk0E.cjs"),S=require("@tanstack/react-query"),s=require("lodash-es"),x=require("lucide-react"),b=require("react"),j=require("react-i18next"),k=({selectedPageType:l,setSelectedPageType:a})=>{const{t:o}=j.useTranslation(),[r,i]=b.useState(""),{data:c}=v.usePageTypes(),m=b.useMemo(()=>c.some(t=>!["page","global"].includes(s.get(t,"key",""))),[c]);if(b.useEffect(()=>{!m&&l!=="all"&&a("all")},[m,l,a]),!m)return null;const u=t=>{if(!r)return!0;const d=r.toLowerCase(),g=f=>String(s.get(t,f,"")).toLowerCase().includes(d);return g("name")||g("key")},p=c.find(t=>t.key===l);return e.jsxs(n.Select,{onValueChange:a,value:l,children:[e.jsx(n.SelectTrigger,{className:`${l==="all"?"bg-gray-100/30 hover:bg-gray-100":"gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-1.5",children:[e.jsx("span",{className:"max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight",children:(p==null?void 0:p.name)||o("All")}),e.jsx(x.ListFilter,{className:`${l!=="all"?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`})]})}),e.jsxs(n.SelectContent,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white pb-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(x.Search,{strokeWidth:2,className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx(h.Input,{placeholder:o("Search page types..."),className:"h-8 w-full rounded border pl-8 text-xs shadow-none",value:r,onChange:t=>i(t.target.value),onKeyDown:t=>t.stopPropagation()})]})}),e.jsx(n.SelectItem,{value:"all",children:o("All")}),!s.isEmpty(s.filter(c,t=>t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:o("Pages")}),s.map([...s.filter(c,t=>t.hasSlug&&u(t))].sort((t,d)=>s.get(t,"name","").localeCompare(s.get(d,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),!s.isEmpty(s.filter(c,t=>!t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:o("Partials")}),s.map([...s.filter(c,t=>!t.hasSlug&&u(t))].sort((t,d)=>s.get(t,"name","").localeCompare(s.get(d,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),s.isEmpty(s.filter(c,u))&&e.jsx("div",{className:"px-3 py-2 text-center text-sm text-gray-500",children:o("No matching page types found")})]})]})},T=({search:l,setSearch:a})=>{const{t:o}=j.useTranslation();return e.jsxs("div",{className:"relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5",children:[e.jsx("label",{htmlFor:"page-search-input",className:"sr-only",children:o("Search Pages")}),e.jsx(x.Search,{className:`${l?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground`,"aria-hidden":"true"}),e.jsx(h.Input,{id:"page-search-input",placeholder:o("Search pages"),value:l,onChange:r=>a(r.target.value),className:"border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",autoComplete:"off",autoFocus:!0})]})},E=({pages:l})=>{const{t:a}=j.useTranslation(),{expandAll:o,collapseAll:r,expandedPages:i}=w.usePageExpandManager(null);return e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"outline",size:"icon",onClick:()=>o(l),className:"rounded p-1 text-gray-500",children:e.jsx(x.ChevronsUpDown,{})})}),e.jsx(n.TooltipContent,{children:a("Expand All")})]}),e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{disabled:i.length===0,variant:"outline",size:"icon",onClick:()=>r(),className:"rounded p-1 text-gray-500",children:e.jsx(x.ChevronsDownUp,{})})}),e.jsx(n.TooltipContent,{children:a("Collapse All")})]})]})},C=({languages:l,selectedLanguage:a,setSelectedLanguage:o})=>{const r=v.useFallbackLang();return e.jsx("div",{className:"scrollbar-hide flex gap-1 overflow-x-auto pb-1",children:l.map(i=>e.jsxs(h.Button,{variant:a===i?"default":"outline",size:"sm",className:`h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${a===i?"bg-black text-white hover:bg-black":"text-gray-500"}`,onClick:()=>o(i.toLowerCase()),children:[i===r&&e.jsx(x.Star,{size:4,className:`p-0.5 ${a===r?"fill-white":"fill-black"}`}),v.LANGUAGES[i]||""]},i))})},y=()=>{const{t:l}=j.useTranslation(),a=S.useQueryClient();return e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{size:"sm",variant:"ghost",onClick:()=>a.invalidateQueries({queryKey:[v.ACTIONS.GET_WEBSITE_PAGES]}),className:"mt-1 h-6 w-6",children:e.jsx(x.RefreshCw,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:l("Refresh pages list")})]})},q=({pages:l,search:a,setSearch:o,languages:r,onAddPage:i,selectedLanguage:c,setSelectedLanguage:m,selectedPageType:u,setSelectedPageType:p,showUntranslatedPages:t,setShowUntranslatedPages:d})=>{const{t:g}=j.useTranslation(),f=r.length>1;return e.jsxs("div",{className:"space-y-3 border-b border-b-gray-200 px-4 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(k,{selectedPageType:u,setSelectedPageType:p}),e.jsx(T,{search:a,setSearch:o}),e.jsx(E,{pages:l}),e.jsxs(h.Button,{variant:"default",onClick:i,className:"rounded px-3 font-normal",children:[e.jsx(x.Plus,{strokeWidth:2,className:"stroke-white stroke-[3]"}),e.jsx("span",{className:"font-normal text-white",children:g("Add Page")})]}),!f&&e.jsx(y,{})]}),f?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(C,{languages:r,selectedLanguage:c,setSelectedLanguage:N=>{m(N),d(t&&(r==null?void 0:r[0])!==c)}}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[(r==null?void 0:r[0])!==c&&e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"ghost",onClick:()=>d(!t),className:"h-6 rounded px-3 py-1 text-xs font-normal",children:t?e.jsx(x.FilterXIcon,{}):e.jsx(x.Filter,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:g("Toggle Untranslated Pages")})]}),e.jsx(y,{})]})]}):e.jsx("div",{className:"flex items-center justify-between gap-2"})]})};exports.LanguageSelector=C;exports.default=q;
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as a, Fragment as k } from "react/jsx-runtime";
2
2
  import { B as m, z as E } from "./register-chai-top-bar-D6GjnauV.js";
3
- import { z as b, A as y, E as N, S as L, F as I, G as P, H as w } from "./index-B7HAfx-2.js";
4
- import { i as j, L as G, k as $, A as M } from "./index-BYjniKhj.js";
3
+ import { z as b, A as y, E as N, S as L, F as I, G as P, H as w } from "./index-OuHV9Ann.js";
4
+ import { i as j, L as G, k as $, A as M } from "./index-LBTm1Jmk.js";
5
5
  import { u as B } from "./use-page-expand-manager-Cf4MUEJw.js";
6
6
  import { useQueryClient as D } from "@tanstack/react-query";
7
7
  import { get as c, isEmpty as C, filter as f, map as S } from "lodash-es";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DyW9GPzV.cjs"),i=require("./index-DTNHTRZu.cjs"),c=require("./index-BeGLwvqs.cjs"),y=require("@tanstack/react-query"),S=require("date-fns"),B=require("lodash-es"),f=require("lucide-react"),g=require("react");function L(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const w=L(g);function Q(s){const n=c.useApiUrl(),t=c.useFetch();return y.useQuery({queryKey:[c.ACTIONS.GET_PAGE_REVISIONS,s],queryFn:async()=>await t(n,{action:c.ACTIONS.GET_PAGE_REVISIONS,data:{pageId:s}}),enabled:!!s,refetchOnMount:!0})}const z=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async r=>await n(s,{action:c.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async({revisionId:r,discardCurrent:l,pageId:d})=>await n(s,{action:c.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:r,discardCurrent:l,...d&&{pageId:d}}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=g.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-B4rnFiN_.cjs"))),b=({tag:s})=>s==="draft"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Draft"})]}):s==="live"?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Live"})]}):s==="published"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600",children:[e.jsx(f.Rocket,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Published"})]}):s==="unsaved"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-xs text-red-600",children:[e.jsx(f.Save,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Unsaved changes"})]}):e.jsx("span",{className:"rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600",children:s});function J({compare:s,setCompare:n}){const{data:t}=c.usePrimaryPage(),{saveState:r}=i.useSavePage(),[l]=c.usePageEditInfo();if(!t)return null;const d=!!s.find(x=>{var a;return(a=x==null?void 0:x.uid)==null?void 0:a.startsWith("draft:")}),u=s.length>=2&&!d,m=r==="UNSAVED";return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-1 text-sm font-medium leading-none",children:[e.jsx(b,{tag:"draft"}),e.jsx("span",{className:"text-xs font-bold",children:"Currently editing"})]})}),e.jsx("div",{className:"flex items-center pl-2 text-[11px] text-muted-foreground",children:!B.isEmpty(l.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",S.formatDistanceToNow(new Date(l.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(b,{tag:"unsaved"}):null})]}),e.jsx(O,{checked:d,disabled:u,onChange:()=>{n(d?s.filter(x=>x.uid!==`draft:${t==null?void 0:t.id}`):[...s,{uid:`draft:${t==null?void 0:t.id}`,label:"draft",item:{createdAt:Date.now()}}])}})]})}function K(){return e.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((s,n)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(i.Skeleton,{className:"h-4 w-3/4"}),e.jsx(i.Skeleton,{className:"h-3 w-1/2"}),e.jsx(i.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(i.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function I({revision:s,isLatest:n,onRestore:t,onDelete:r,revisionNumber:l,compare:d,setCompare:u,pageId:m}){const{data:x}=c.useChaiUserInfo(s.currentEditor),a=(x==null?void 0:x.name)||"Unknown",p=!!d.find(h=>{var j;return n?(j=h==null?void 0:h.uid)==null?void 0:j.startsWith("live"):(h==null?void 0:h.uid)===s.uid}),D=d.length>=2&&!p;return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"flex items-center gap-1 text-xs leading-none",children:[e.jsx(b,{tag:n?"live":`#${l}`}),s.type==="published"?"Published":"Draft"," by ",e.jsx("span",{className:"text-xs font-bold",children:a})]})}),e.jsxs("div",{className:"flex items-center gap-x-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:s.type==="published"?e.jsx(b,{tag:"published"}):e.jsx(b,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:S.format(s.createdAt,"MMM d, yyyy, h:mm a")})})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(c.PermissionChecker,{permissions:[c.PAGES_PERMISSIONS.RESTORE_REVISION,c.PAGES_PERMISSIONS.DELETE_REVISION],children:e.jsx(Y,{revision:s,onRestore:t,onDelete:r})})}),e.jsx(O,{checked:p,disabled:D,onChange:()=>{u(p?d.filter(h=>n?h.uid!==`live:${m}`:h.uid!==s.uid):[...d,{uid:n?`live:${m}`:s.uid,label:n?"live":`#${l}`,item:s}].sort((h,j)=>new Date(h.item.createdAt).getTime()-new Date(j.item.createdAt).getTime()))}})]})}function A({tab:s,onRemove:n}){return e.jsxs("span",{className:"flex items-center justify-between rounded border border-blue-100 p-1 font-medium",children:[e.jsx(b,{tag:s.label}),e.jsx("button",{className:"z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",style:{lineHeight:1},onClick:()=>n(s.uid),"aria-label":"Remove selection",children:e.jsx(f.X,{className:"h-3 w-3"})})]})}function W({compare:s,setCompare:n,pageId:t}){const[r,l]=g.useState(!1),[d,u]=s;if(s.length===0)return null;const m=x=>n(s.filter(a=>a.uid!==x));return e.jsxs("div",{className:"mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-xs",children:[e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"Compare"}),d&&e.jsx(A,{tab:d,onRemove:m}),e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"with"}),u?e.jsx(A,{tab:u,onRemove:m}):e.jsx("span",{className:"rounded border px-1 text-xs text-muted-foreground",children:"Choose another"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pb-0.5 pt-2",children:[e.jsx(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none text-gray-500",variant:"outline",onClick:()=>n([]),children:e.jsx("span",{children:" Clear"})}),e.jsxs(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none",variant:"default",onClick:()=>l(!0),disabled:s.length<2,children:[e.jsx(f.FileJson,{className:"h-2.5 w-2.5"}),e.jsx("span",{className:"pt-0.5",children:"Show JSON Diff"})]})]}),r&&(s==null?void 0:s.length)>1&&t&&e.jsx(g.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx("span",{className:"text-sm",children:"Loading diff viewer..."})}),children:e.jsx($,{open:r,onOpenChange:l,compare:s})})]})}function O({checked:s,disabled:n,onChange:t,label:r="Compare"}){return e.jsx("div",{className:"absolute bottom-2 right-2",children:e.jsxs("label",{className:`flex cursor-pointer items-center gap-x-1 text-[11px] ${n?"opacity-50":""}`,children:[e.jsx("input",{type:"checkbox",className:"h-3 w-3 cursor-pointer rounded focus:ring-0 focus:ring-offset-0",checked:s,disabled:n,onChange:t}),e.jsx("span",{className:"select-none leading-tight",children:r})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(i.DropdownMenu,{children:[e.jsx(i.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(N.Button,{variant:"ghost",size:"icon",className:"h-5 w-5",children:[e.jsx(f.MoreHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More options"})]})}),e.jsxs(i.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(i.DropdownMenuItem,{onClick:n,className:"cursor-pointer text-sm",children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Restore this version"})]})}),e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.DELETE_REVISION,children:s.uid!=="current"&&e.jsxs(e.Fragment,{children:[e.jsx(i.DropdownMenuSeparator,{}),e.jsxs(i.DropdownMenuItem,{onClick:t,className:"cursor-pointer text-destructive",children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Delete this version"})]})]})})]})]})}function X({open:s,onOpenChange:n,revision:t,onRestore:r,isRestoring:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Restore Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"How would you like to handle your current edits?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>r(!1),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Saving as draft..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.CloudOff,{className:"mr-2 h-4 w-4"}),"Save as draft"]})}),e.jsx(N.Button,{variant:"default",className:"sm:flex-1",onClick:()=>r(!0),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Discarding current..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),"Discard current"]})})]})]})}):null}function Z({open:s,onOpenChange:n,revision:t,onDelete:r,isDeleting:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Delete Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This action cannot be undone. Are you sure you want to proceed?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:l,children:"Cancel"}),e.jsx(N.Button,{variant:"destructive",className:"sm:flex-1",onClick:r,disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Deleting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),"Delete Revision"]})})]})]})}):null}function ee({isOpen:s}){var R;const[n,t]=w.useState([]),[r,l]=w.useState(null),[d,u]=w.useState(!1),[m,x]=w.useState(!1),{data:a}=c.usePrimaryPage(),{data:p,isFetching:D,error:h,refetch:j}=Q(a==null?void 0:a.id),{mutate:T,isPending:M}=z(),{mutate:k,isPending:F}=H(),_=y.useQueryClient(),{selectedLang:P,fallbackLang:q}=i.useLanguages(),U=P||q;g.useEffect(()=>{g.startTransition(()=>t([]))},[a==null?void 0:a.id]);const G=o=>{r&&k({revisionId:r.uid,discardCurrent:o,...r.uid==="current"&&(a==null?void 0:a.id)&&{pageId:a.id}},{onSuccess:()=>{u(!1),l(null),_.invalidateQueries({queryKey:[c.ACTIONS.GET_DRAFT_PAGE]})}})},C=o=>{l(o),u(!0)},E=o=>{l(o),x(!0)},V=()=>{r&&T(r.uid,{onSuccess:()=>{x(!1),l(null)}})};return g.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(i.SheetHeader,{children:[e.jsx(i.SheetTitle,{children:"Revision History"}),(a==null?void 0:a.createdAt)&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Page created on ",S.format(new Date(a.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),D?e.jsx(K,{}):h?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"Failed to load revisions. Please try again."}):e.jsxs("div",{className:"mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2",children:[e.jsx(W,{lang:U,compare:n,setCompare:t,pageId:a==null?void 0:a.id}),e.jsx(J,{compare:n,setCompare:t}),(R=p==null?void 0:p.filter(o=>o.uid==="current"))==null?void 0:R.map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:!0,onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v,compare:n,setCompare:t},o.uid)),e.jsx(i.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:[...p??[]].filter(o=>o.uid!=="current").sort((o,v)=>new Date(v.createdAt).getTime()-new Date(o.createdAt).getTime()).map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:o.uid==="current",onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:d,onOpenChange:u,revision:r,onRestore:G,isRestoring:F}),e.jsx(Z,{open:m,onOpenChange:x,revision:r,onDelete:V,isDeleting:M})]})}exports.default=ee;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DyW9GPzV.cjs"),i=require("./index-DCJDQs1a.cjs"),c=require("./index-BVwFJWDq.cjs"),y=require("@tanstack/react-query"),S=require("date-fns"),B=require("lodash-es"),f=require("lucide-react"),g=require("react");function L(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const w=L(g);function Q(s){const n=c.useApiUrl(),t=c.useFetch();return y.useQuery({queryKey:[c.ACTIONS.GET_PAGE_REVISIONS,s],queryFn:async()=>await t(n,{action:c.ACTIONS.GET_PAGE_REVISIONS,data:{pageId:s}}),enabled:!!s,refetchOnMount:!0})}const z=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async r=>await n(s,{action:c.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async({revisionId:r,discardCurrent:l,pageId:d})=>await n(s,{action:c.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:r,discardCurrent:l,...d&&{pageId:d}}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=g.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-Cb1CmRqP.cjs"))),b=({tag:s})=>s==="draft"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Draft"})]}):s==="live"?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Live"})]}):s==="published"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600",children:[e.jsx(f.Rocket,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Published"})]}):s==="unsaved"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-xs text-red-600",children:[e.jsx(f.Save,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Unsaved changes"})]}):e.jsx("span",{className:"rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600",children:s});function J({compare:s,setCompare:n}){const{data:t}=c.usePrimaryPage(),{saveState:r}=i.useSavePage(),[l]=c.usePageEditInfo();if(!t)return null;const d=!!s.find(x=>{var a;return(a=x==null?void 0:x.uid)==null?void 0:a.startsWith("draft:")}),u=s.length>=2&&!d,m=r==="UNSAVED";return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-1 text-sm font-medium leading-none",children:[e.jsx(b,{tag:"draft"}),e.jsx("span",{className:"text-xs font-bold",children:"Currently editing"})]})}),e.jsx("div",{className:"flex items-center pl-2 text-[11px] text-muted-foreground",children:!B.isEmpty(l.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",S.formatDistanceToNow(new Date(l.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(b,{tag:"unsaved"}):null})]}),e.jsx(O,{checked:d,disabled:u,onChange:()=>{n(d?s.filter(x=>x.uid!==`draft:${t==null?void 0:t.id}`):[...s,{uid:`draft:${t==null?void 0:t.id}`,label:"draft",item:{createdAt:Date.now()}}])}})]})}function K(){return e.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((s,n)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(i.Skeleton,{className:"h-4 w-3/4"}),e.jsx(i.Skeleton,{className:"h-3 w-1/2"}),e.jsx(i.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(i.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function I({revision:s,isLatest:n,onRestore:t,onDelete:r,revisionNumber:l,compare:d,setCompare:u,pageId:m}){const{data:x}=c.useChaiUserInfo(s.currentEditor),a=(x==null?void 0:x.name)||"Unknown",p=!!d.find(h=>{var j;return n?(j=h==null?void 0:h.uid)==null?void 0:j.startsWith("live"):(h==null?void 0:h.uid)===s.uid}),D=d.length>=2&&!p;return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"flex items-center gap-1 text-xs leading-none",children:[e.jsx(b,{tag:n?"live":`#${l}`}),s.type==="published"?"Published":"Draft"," by ",e.jsx("span",{className:"text-xs font-bold",children:a})]})}),e.jsxs("div",{className:"flex items-center gap-x-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:s.type==="published"?e.jsx(b,{tag:"published"}):e.jsx(b,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:S.format(s.createdAt,"MMM d, yyyy, h:mm a")})})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(c.PermissionChecker,{permissions:[c.PAGES_PERMISSIONS.RESTORE_REVISION,c.PAGES_PERMISSIONS.DELETE_REVISION],children:e.jsx(Y,{revision:s,onRestore:t,onDelete:r})})}),e.jsx(O,{checked:p,disabled:D,onChange:()=>{u(p?d.filter(h=>n?h.uid!==`live:${m}`:h.uid!==s.uid):[...d,{uid:n?`live:${m}`:s.uid,label:n?"live":`#${l}`,item:s}].sort((h,j)=>new Date(h.item.createdAt).getTime()-new Date(j.item.createdAt).getTime()))}})]})}function A({tab:s,onRemove:n}){return e.jsxs("span",{className:"flex items-center justify-between rounded border border-blue-100 p-1 font-medium",children:[e.jsx(b,{tag:s.label}),e.jsx("button",{className:"z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",style:{lineHeight:1},onClick:()=>n(s.uid),"aria-label":"Remove selection",children:e.jsx(f.X,{className:"h-3 w-3"})})]})}function W({compare:s,setCompare:n,pageId:t}){const[r,l]=g.useState(!1),[d,u]=s;if(s.length===0)return null;const m=x=>n(s.filter(a=>a.uid!==x));return e.jsxs("div",{className:"mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-xs",children:[e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"Compare"}),d&&e.jsx(A,{tab:d,onRemove:m}),e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"with"}),u?e.jsx(A,{tab:u,onRemove:m}):e.jsx("span",{className:"rounded border px-1 text-xs text-muted-foreground",children:"Choose another"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pb-0.5 pt-2",children:[e.jsx(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none text-gray-500",variant:"outline",onClick:()=>n([]),children:e.jsx("span",{children:" Clear"})}),e.jsxs(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none",variant:"default",onClick:()=>l(!0),disabled:s.length<2,children:[e.jsx(f.FileJson,{className:"h-2.5 w-2.5"}),e.jsx("span",{className:"pt-0.5",children:"Show JSON Diff"})]})]}),r&&(s==null?void 0:s.length)>1&&t&&e.jsx(g.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx("span",{className:"text-sm",children:"Loading diff viewer..."})}),children:e.jsx($,{open:r,onOpenChange:l,compare:s})})]})}function O({checked:s,disabled:n,onChange:t,label:r="Compare"}){return e.jsx("div",{className:"absolute bottom-2 right-2",children:e.jsxs("label",{className:`flex cursor-pointer items-center gap-x-1 text-[11px] ${n?"opacity-50":""}`,children:[e.jsx("input",{type:"checkbox",className:"h-3 w-3 cursor-pointer rounded focus:ring-0 focus:ring-offset-0",checked:s,disabled:n,onChange:t}),e.jsx("span",{className:"select-none leading-tight",children:r})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(i.DropdownMenu,{children:[e.jsx(i.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(N.Button,{variant:"ghost",size:"icon",className:"h-5 w-5",children:[e.jsx(f.MoreHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More options"})]})}),e.jsxs(i.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(i.DropdownMenuItem,{onClick:n,className:"cursor-pointer text-sm",children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Restore this version"})]})}),e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.DELETE_REVISION,children:s.uid!=="current"&&e.jsxs(e.Fragment,{children:[e.jsx(i.DropdownMenuSeparator,{}),e.jsxs(i.DropdownMenuItem,{onClick:t,className:"cursor-pointer text-destructive",children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Delete this version"})]})]})})]})]})}function X({open:s,onOpenChange:n,revision:t,onRestore:r,isRestoring:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Restore Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"How would you like to handle your current edits?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>r(!1),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Saving as draft..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.CloudOff,{className:"mr-2 h-4 w-4"}),"Save as draft"]})}),e.jsx(N.Button,{variant:"default",className:"sm:flex-1",onClick:()=>r(!0),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Discarding current..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),"Discard current"]})})]})]})}):null}function Z({open:s,onOpenChange:n,revision:t,onDelete:r,isDeleting:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Delete Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This action cannot be undone. Are you sure you want to proceed?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:l,children:"Cancel"}),e.jsx(N.Button,{variant:"destructive",className:"sm:flex-1",onClick:r,disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Deleting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),"Delete Revision"]})})]})]})}):null}function ee({isOpen:s}){var R;const[n,t]=w.useState([]),[r,l]=w.useState(null),[d,u]=w.useState(!1),[m,x]=w.useState(!1),{data:a}=c.usePrimaryPage(),{data:p,isFetching:D,error:h,refetch:j}=Q(a==null?void 0:a.id),{mutate:T,isPending:M}=z(),{mutate:k,isPending:F}=H(),_=y.useQueryClient(),{selectedLang:P,fallbackLang:q}=i.useLanguages(),U=P||q;g.useEffect(()=>{g.startTransition(()=>t([]))},[a==null?void 0:a.id]);const G=o=>{r&&k({revisionId:r.uid,discardCurrent:o,...r.uid==="current"&&(a==null?void 0:a.id)&&{pageId:a.id}},{onSuccess:()=>{u(!1),l(null),_.invalidateQueries({queryKey:[c.ACTIONS.GET_DRAFT_PAGE]})}})},C=o=>{l(o),u(!0)},E=o=>{l(o),x(!0)},V=()=>{r&&T(r.uid,{onSuccess:()=>{x(!1),l(null)}})};return g.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(i.SheetHeader,{children:[e.jsx(i.SheetTitle,{children:"Revision History"}),(a==null?void 0:a.createdAt)&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Page created on ",S.format(new Date(a.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),D?e.jsx(K,{}):h?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"Failed to load revisions. Please try again."}):e.jsxs("div",{className:"mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2",children:[e.jsx(W,{lang:U,compare:n,setCompare:t,pageId:a==null?void 0:a.id}),e.jsx(J,{compare:n,setCompare:t}),(R=p==null?void 0:p.filter(o=>o.uid==="current"))==null?void 0:R.map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:!0,onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v,compare:n,setCompare:t},o.uid)),e.jsx(i.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:[...p??[]].filter(o=>o.uid!=="current").sort((o,v)=>new Date(v.createdAt).getTime()-new Date(o.createdAt).getTime()).map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:o.uid==="current",onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:d,onOpenChange:u,revision:r,onRestore:G,isRestoring:F}),e.jsx(Z,{open:m,onOpenChange:x,revision:r,onDelete:V,isDeleting:M})]})}exports.default=ee;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as a, Fragment as p, jsx as e } from "react/jsx-runtime";
2
2
  import { B as g } from "./register-chai-top-bar-D6GjnauV.js";
3
- import { d as le, ag as re, ah as ie, a7 as de, ai as v, I as ce, D as j, e as q, f as G, g as L, o as $, q as z, v as oe, w as ue, x as me, y as _, aj as he } from "./index-B7HAfx-2.js";
4
- import { ao as C, ap as A, A as y, at as H, ax as fe, am as I, au as E, av as D } from "./index-BYjniKhj.js";
3
+ import { d as le, ag as re, ah as ie, a7 as de, ai as v, I as ce, D as V, e as j, f as G, g as L, o as z, q as $, v as oe, w as ue, x as me, y as _, aj as he } from "./index-OuHV9Ann.js";
4
+ import { aq as C, ar as A, A as y, av as H, az as fe, ao as I, aw as E, ax as D } from "./index-LBTm1Jmk.js";
5
5
  import { useQuery as pe, useQueryClient as O, useMutation as P } from "@tanstack/react-query";
6
6
  import { format as S, formatDistanceToNow as xe } from "date-fns";
7
7
  import { isEmpty as ge } from "lodash-es";
@@ -50,7 +50,7 @@ const Ie = () => {
50
50
  });
51
51
  }
52
52
  });
53
- }, Te = Ce(() => import("./json-diff-viewer-CKlyO9eW.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600", children: [
53
+ }, Te = Ce(() => import("./json-diff-viewer-DG6qMOBS.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600", children: [
54
54
  /* @__PURE__ */ a("span", { className: "relative flex h-2 w-2", children: [
55
55
  /* @__PURE__ */ e("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75" }),
56
56
  /* @__PURE__ */ e("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-amber-500" })
@@ -165,7 +165,7 @@ function F({
165
165
  )
166
166
  ] });
167
167
  }
168
- function V({ tab: t, onRemove: s }) {
168
+ function q({ tab: t, onRemove: s }) {
169
169
  return /* @__PURE__ */ a("span", { className: "flex items-center justify-between rounded border border-blue-100 p-1 font-medium", children: [
170
170
  /* @__PURE__ */ e(N, { tag: t.label }),
171
171
  /* @__PURE__ */ e(
@@ -187,9 +187,9 @@ function _e({ compare: t, setCompare: s, pageId: n }) {
187
187
  return /* @__PURE__ */ a("div", { className: "mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm", children: [
188
188
  /* @__PURE__ */ a("div", { className: "flex items-center gap-x-2 text-xs", children: [
189
189
  /* @__PURE__ */ e("span", { className: "font-medium leading-tight text-gray-600", children: "Compare" }),
190
- d && /* @__PURE__ */ e(V, { tab: d, onRemove: m }),
190
+ d && /* @__PURE__ */ e(q, { tab: d, onRemove: m }),
191
191
  /* @__PURE__ */ e("span", { className: "font-medium leading-tight text-gray-600", children: "with" }),
192
- o ? /* @__PURE__ */ e(V, { tab: o, onRemove: m }) : /* @__PURE__ */ e("span", { className: "rounded border px-1 text-xs text-muted-foreground", children: "Choose another" })
192
+ o ? /* @__PURE__ */ e(q, { tab: o, onRemove: m }) : /* @__PURE__ */ e("span", { className: "rounded border px-1 text-xs text-muted-foreground", children: "Choose another" })
193
193
  ] }),
194
194
  /* @__PURE__ */ a("div", { className: "flex items-center justify-end gap-2 pb-0.5 pt-2", children: [
195
195
  /* @__PURE__ */ e(
@@ -271,16 +271,16 @@ function Fe({
271
271
  }) {
272
272
  const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""), o = (d == null ? void 0 : d.name) || "Unknown";
273
273
  return n ? /* @__PURE__ */ e(
274
- j,
274
+ V,
275
275
  {
276
276
  open: t,
277
277
  onOpenChange: (m) => {
278
278
  r || s(m);
279
279
  },
280
- children: /* @__PURE__ */ a(q, { className: "sm:max-w-md", children: [
280
+ children: /* @__PURE__ */ a(j, { className: "sm:max-w-md", children: [
281
281
  /* @__PURE__ */ a(G, { children: [
282
282
  /* @__PURE__ */ e(L, { children: "Restore Revision" }),
283
- /* @__PURE__ */ a($, { children: [
283
+ /* @__PURE__ */ a(z, { children: [
284
284
  "You are about to restore to revision ",
285
285
  n.uid.substring(0, 8),
286
286
  " from",
@@ -291,7 +291,7 @@ function Fe({
291
291
  ] })
292
292
  ] }),
293
293
  /* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "How would you like to handle your current edits?" }) }),
294
- /* @__PURE__ */ a(z, { className: "flex flex-col gap-2 sm:flex-row", children: [
294
+ /* @__PURE__ */ a($, { className: "flex flex-col gap-2 sm:flex-row", children: [
295
295
  /* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => i(!1), disabled: r, children: r ? /* @__PURE__ */ a(p, { children: [
296
296
  /* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
297
297
  "Saving as draft..."
@@ -311,7 +311,7 @@ function Fe({
311
311
  }
312
312
  ) : null;
313
313
  }
314
- function Ve({
314
+ function qe({
315
315
  open: t,
316
316
  onOpenChange: s,
317
317
  revision: n,
@@ -320,16 +320,16 @@ function Ve({
320
320
  }) {
321
321
  const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""), o = (d == null ? void 0 : d.name) || "Unknown";
322
322
  return n ? /* @__PURE__ */ e(
323
- j,
323
+ V,
324
324
  {
325
325
  open: t,
326
326
  onOpenChange: (m) => {
327
327
  r || s(m);
328
328
  },
329
- children: /* @__PURE__ */ a(q, { className: "sm:max-w-md", children: [
329
+ children: /* @__PURE__ */ a(j, { className: "sm:max-w-md", children: [
330
330
  /* @__PURE__ */ a(G, { children: [
331
331
  /* @__PURE__ */ e(L, { children: "Delete Revision" }),
332
- /* @__PURE__ */ a($, { children: [
332
+ /* @__PURE__ */ a(z, { children: [
333
333
  "You are about to delete revision ",
334
334
  n.uid.substring(0, 8),
335
335
  " from",
@@ -340,7 +340,7 @@ function Ve({
340
340
  ] })
341
341
  ] }),
342
342
  /* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "This action cannot be undone. Are you sure you want to proceed?" }) }),
343
- /* @__PURE__ */ a(z, { className: "flex flex-col gap-2 sm:flex-row", children: [
343
+ /* @__PURE__ */ a($, { className: "flex flex-col gap-2 sm:flex-row", children: [
344
344
  /* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => s(!1), disabled: r, children: "Cancel" }),
345
345
  /* @__PURE__ */ e(g, { variant: "destructive", className: "sm:flex-1", onClick: i, disabled: r, children: r ? /* @__PURE__ */ a(p, { children: [
346
346
  /* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
@@ -443,7 +443,7 @@ function Qe({ isOpen: t }) {
443
443
  }
444
444
  ),
445
445
  /* @__PURE__ */ e(
446
- Ve,
446
+ qe,
447
447
  {
448
448
  open: m,
449
449
  onOpenChange: u,
package/dist/pages.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BeGLwvqs.cjs");exports.ChaiAiPanel=e.AiPanelContent;exports.ChaiJsonInput=e.SmartJsonInput;exports.ChaiWebsiteBuilder=e.ChaiWebsiteBuilder;exports.ImagePicker=e.ImagePicker;exports.LanguageSwitcher=e.LanguageSwitcher;exports.NestedPathSelector=e.NestedPathSelector;exports.PermissionChecker=e.PermissionChecker;exports.SupabaseRealtimeAdapter=e.SupabaseRealtimeAdapter;exports.createRealtimeAdapter=e.createRealtimeAdapter;exports.useActivePage=e.useCurrentActivePage;exports.useApiUrl=e.useApiUrl;exports.useBuilderFetch=e.useBuilderFetch;exports.useBuilderPageData=e.useBuilderPageData;exports.useChaiAuth=e.useChaiAuth;exports.useChaiPrimaryPage=e.usePrimaryPage;exports.useChaiUserInfo=e.useChaiUserInfo;exports.useClearAll=e.useClearAll;exports.useFallbackLang=e.useFallbackLang;exports.useFetch=e.useFetch;exports.useGotoPage=e.useGotoPage;exports.useLanguagePages=e.useLanguagePages;exports.usePageAllData=e.usePageAllData;exports.usePageTypes=e.usePageTypes;exports.useRealtimeAdapter=e.useRealtimeAdapter;exports.useReloadPage=e.useReloadPage;exports.useUpdateActivePageMetadata=e.useUpdateActivePageMetadata;exports.useUserPermissions=e.useCheckUserAccess;exports.useWebsitePages=e.useWebsitePrimaryPages;exports.useWebsiteSetting=e.useWebsiteSetting;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BVwFJWDq.cjs");exports.ChaiAiPanel=e.AiPanelContent;exports.ChaiJsonInput=e.SmartJsonInput;exports.ChaiWebsiteBuilder=e.ChaiWebsiteBuilder;exports.ImagePicker=e.ImagePicker;exports.LanguageSwitcher=e.LanguageSwitcher;exports.NestedPathSelector=e.NestedPathSelector;exports.PermissionChecker=e.PermissionChecker;exports.SupabaseRealtimeAdapter=e.SupabaseRealtimeAdapter;exports.createRealtimeAdapter=e.createRealtimeAdapter;exports.useActivePage=e.useCurrentActivePage;exports.useApiUrl=e.useApiUrl;exports.useBuilderFetch=e.useBuilderFetch;exports.useBuilderPageData=e.useBuilderPageData;exports.useChaiAuth=e.useChaiAuth;exports.useChaiPrimaryPage=e.usePrimaryPage;exports.useChaiUserInfo=e.useChaiUserInfo;exports.useClearAll=e.useClearAll;exports.useFallbackLang=e.useFallbackLang;exports.useFetch=e.useFetch;exports.useGotoPage=e.useGotoPage;exports.useLanguagePages=e.useLanguagePages;exports.usePageAllData=e.usePageAllData;exports.usePageTypes=e.usePageTypes;exports.useRealtimeAdapter=e.useRealtimeAdapter;exports.useReloadPage=e.useReloadPage;exports.useUpdateActivePageMetadata=e.useUpdateActivePageMetadata;exports.useUserPermissions=e.useCheckUserAccess;exports.useWebsitePages=e.useWebsitePrimaryPages;exports.useWebsiteSetting=e.useWebsiteSetting;
package/dist/pages.d.ts CHANGED
@@ -5,7 +5,72 @@ import { RealtimeClient } from '@supabase/supabase-js';
5
5
  import { UseMutationResult } from '@tanstack/react-query';
6
6
  import { UseQueryResult } from '@tanstack/react-query';
7
7
 
8
- export declare const ChaiAiPanel: () => JSX.Element;
8
+ declare type AICompleteCallback = {
9
+ success: boolean;
10
+ content?: string;
11
+ error?: Error | string;
12
+ model: string;
13
+ timestamp: number;
14
+ };
15
+
16
+ declare type AICompletionEvent = {
17
+ type: "completion";
18
+ content: string;
19
+ model: string;
20
+ timestamp: number;
21
+ };
22
+
23
+ declare type AIContext = {
24
+ site?: Record<string, any>;
25
+ page?: Record<string, any>;
26
+ };
27
+
28
+ declare type AIErrorCallback = {
29
+ error: Error | string;
30
+ model: string;
31
+ timestamp: number;
32
+ };
33
+
34
+ declare type AIErrorEvent = {
35
+ type: "error";
36
+ error: Error | string;
37
+ model?: string;
38
+ timestamp: number;
39
+ };
40
+
41
+ declare type AIEvent = AICompletionEvent | AIErrorEvent | AIStreamStartEvent;
42
+
43
+ declare type AIModel = {
44
+ id: string;
45
+ name: string;
46
+ provider: string;
47
+ description: string;
48
+ multiplier: number;
49
+ };
50
+
51
+ declare type AIStreamStartEvent = {
52
+ type: "stream_start";
53
+ model: string;
54
+ timestamp: number;
55
+ };
56
+
57
+ declare type AISuccessCallback = {
58
+ content: string;
59
+ model: string;
60
+ timestamp: number;
61
+ };
62
+
63
+ export declare const ChaiAiPanel: ({ models, onAIEvent, onSuccess, onError, onComplete, context, ...rest }: ChaiAiPanelProps) => JSX.Element;
64
+
65
+ export declare interface ChaiAiPanelProps {
66
+ models?: AIModel[];
67
+ onAIEvent?: (event: AIEvent) => void;
68
+ onSuccess?: (data: AISuccessCallback) => void;
69
+ onError?: (data: AIErrorCallback) => void;
70
+ onComplete?: (data: AICompleteCallback) => void;
71
+ context?: AIContext;
72
+ [key: string]: any;
73
+ }
9
74
 
10
75
  declare type ChaiAskAiResponse = {
11
76
  blocks?: Array<{
package/dist/pages.js CHANGED
@@ -1,32 +1,32 @@
1
- import { aZ as s, aD as t, aS as u, aO as i, aM as r, aN as g, au as l, b3 as P, b2 as h, aT as o, ao as c, b1 as d, aJ as n, a$ as p, at as A, am as b, aU as m, i as C, ap as S, aV as U, j as k, aW as R, k as W, a_ as B, aX as D, aY as F, b0 as I, e as L, h as f } from "./index-BYjniKhj.js";
1
+ import { a$ as s, aF as t, aU as i, aQ as u, aO as r, aP as g, aw as l, b5 as P, b4 as h, aV as b, aq as o, b3 as c, aL as d, b1 as n, av as A, ao as p, aW as m, i as C, ar as U, aX as k, j as F, aY as L, k as R, b0 as S, aZ as W, a_ as v, b2 as B, e as I, h as f } from "./index-LBTm1Jmk.js";
2
2
  export {
3
3
  s as ChaiAiPanel,
4
4
  t as ChaiJsonInput,
5
- u as ChaiWebsiteBuilder,
6
- i as ImagePicker,
5
+ i as ChaiWebsiteBuilder,
6
+ u as ImagePicker,
7
7
  r as LanguageSwitcher,
8
8
  g as NestedPathSelector,
9
9
  l as PermissionChecker,
10
10
  P as SupabaseRealtimeAdapter,
11
11
  h as createRealtimeAdapter,
12
- o as useActivePage,
13
- c as useApiUrl,
14
- d as useBuilderFetch,
15
- n as useBuilderPageData,
16
- p as useChaiAuth,
12
+ b as useActivePage,
13
+ o as useApiUrl,
14
+ c as useBuilderFetch,
15
+ d as useBuilderPageData,
16
+ n as useChaiAuth,
17
17
  A as useChaiPrimaryPage,
18
- b as useChaiUserInfo,
18
+ p as useChaiUserInfo,
19
19
  m as useClearAll,
20
20
  C as useFallbackLang,
21
- S as useFetch,
22
- U as useGotoPage,
23
- k as useLanguagePages,
24
- R as usePageAllData,
25
- W as usePageTypes,
26
- B as useRealtimeAdapter,
27
- D as useReloadPage,
28
- F as useUpdateActivePageMetadata,
29
- I as useUserPermissions,
30
- L as useWebsitePages,
21
+ U as useFetch,
22
+ k as useGotoPage,
23
+ F as useLanguagePages,
24
+ L as usePageAllData,
25
+ R as usePageTypes,
26
+ S as useRealtimeAdapter,
27
+ W as useReloadPage,
28
+ v as useUpdateActivePageMetadata,
29
+ B as useUserPermissions,
30
+ I as useWebsitePages,
31
31
  f as useWebsiteSetting
32
32
  };