@chaibuilder/pages 0.17.6 → 0.18.1

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 (88) hide show
  1. package/dist/{2AITGKQY-CW6frR_j.cjs → 2AITGKQY-DF8OTjKn.cjs} +1 -1
  2. package/dist/{2AITGKQY-DQFtfYAc.js → 2AITGKQY-fS5AFjG9.js} +2 -2
  3. package/dist/{NCMVHL6D-URUKohh5.cjs → NCMVHL6D-D_9C6D8g.cjs} +1 -1
  4. package/dist/{NCMVHL6D-DjkLlYvC.js → NCMVHL6D-Dg5ySLf6.js} +2 -2
  5. package/dist/{ZDWCUMSJ-BF7bF60j.js → ZDWCUMSJ-BUuCDSC3.js} +1 -1
  6. package/dist/{ZDWCUMSJ-BufXbZ_h.cjs → ZDWCUMSJ-wMRfmXYb.cjs} +1 -1
  7. package/dist/{active-in-another-tab-CLSHrmaH.js → active-in-another-tab-D-xpQrr_.js} +1 -1
  8. package/dist/{active-in-another-tab-CLhzUxeR.cjs → active-in-another-tab-DLtQHsZe.cjs} +1 -1
  9. package/dist/{add-new-language-page-DEvWaLIe.js → add-new-language-page-6B1VAoI4.js} +2 -2
  10. package/dist/{add-new-language-page-xOwbmNJj.cjs → add-new-language-page-Depov_zF.cjs} +1 -1
  11. package/dist/{add-new-page-B0OggHcf.cjs → add-new-page-C8OBL7bg.cjs} +1 -1
  12. package/dist/{add-new-page-BNq_DIdw.js → add-new-page-tFiCCldO.js} +1 -1
  13. package/dist/ai-panel-content-D5brnpaF.cjs +1 -0
  14. package/dist/{ai-panel-content-ClRm3rSN.js → ai-panel-content-LAJ1G2c_.js} +26 -19
  15. package/dist/{ai-panel-default-lang-Bs_Nu8Yz.js → ai-panel-default-lang-BZOwc0ER.js} +3 -3
  16. package/dist/{ai-panel-default-lang-DmSW0N9S.cjs → ai-panel-default-lang-Bovj-wnP.cjs} +2 -2
  17. package/dist/{ai-panel-other-lang-B36IELRv.cjs → ai-panel-other-lang-BLOSoY1y.cjs} +1 -1
  18. package/dist/{ai-panel-other-lang-BYP_eD9z.js → ai-panel-other-lang-Bq4Y6Ycp.js} +3 -3
  19. package/dist/{ai-prompt-input-i9ZufZMi.js → ai-prompt-input-2wmQNmDm.js} +1 -1
  20. package/dist/{ai-prompt-input-DBlSqHCo.cjs → ai-prompt-input-UgJnusYy.cjs} +1 -1
  21. package/dist/{ai-translation-prompt-CnNrf57B.js → ai-translation-prompt-Bj-CjrQM.js} +1 -1
  22. package/dist/{ai-translation-prompt-DKN6hrUF.cjs → ai-translation-prompt-ByPlV_Ft.cjs} +1 -1
  23. package/dist/{continue-editing-in-this-client-XtL9c2a2.js → continue-editing-in-this-client-BkBaYzK8.js} +1 -1
  24. package/dist/{continue-editing-in-this-client-ChVlHB-G.cjs → continue-editing-in-this-client-DTsSzFac.cjs} +1 -1
  25. package/dist/{delete-page-JsuCy3_9.js → delete-page-BBmM-A0h.js} +1 -1
  26. package/dist/{delete-page-CGeb5OY9.cjs → delete-page-Bz0WfFIr.cjs} +1 -1
  27. package/dist/{digital-asset-manager-Dr_rmq-s.js → digital-asset-manager-B9q68gsa.js} +1 -1
  28. package/dist/{digital-asset-manager-CeuTVT2m.cjs → digital-asset-manager-BaqwiA9T.cjs} +1 -1
  29. package/dist/{duplicate-page-WQGy0j2w.cjs → duplicate-page-DAc9ZjR0.cjs} +1 -1
  30. package/dist/{duplicate-page-CbPlxaWw.js → duplicate-page-FHWK3iKz.js} +2 -2
  31. package/dist/{dynamic-page-selector-Bxc0QbN-.cjs → dynamic-page-selector-C1v0r46n.cjs} +1 -1
  32. package/dist/{dynamic-page-selector-Cl1ui3R0.js → dynamic-page-selector-Co3Q9p7l.js} +1 -1
  33. package/dist/index-BfYRG8H9.cjs +5 -0
  34. package/dist/{index-BoQkDiU0.js → index-iCKpBUN9.js} +130 -130
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.js +1 -1
  37. package/dist/{json-diff-viewer-C9Vtz001.js → json-diff-viewer-Dw3zaurB.js} +1 -1
  38. package/dist/{json-diff-viewer-mAynlJ-t.cjs → json-diff-viewer-Z1GTmj8J.cjs} +1 -1
  39. package/dist/{lang-panel-_j4w2xyy.cjs → lang-panel-DaYCFPdT.cjs} +1 -1
  40. package/dist/{lang-panel-Bbw7pLzm.js → lang-panel-DlqwCSo_.js} +2 -2
  41. package/dist/{mark-as-template-eaGMb1z4.js → mark-as-template-CGwS-ih8.js} +1 -1
  42. package/dist/{mark-as-template-Iecl3b9-.cjs → mark-as-template-nG3dSI5x.cjs} +1 -1
  43. package/dist/{no-language-page-content-BENe6zri.js → no-language-page-content-D3-li16O.js} +1 -1
  44. package/dist/{no-language-page-content-BNElMNrF.cjs → no-language-page-content-DDTLd2lT.cjs} +1 -1
  45. package/dist/{no-language-page-dialog-CUBp8DfX.cjs → no-language-page-dialog-BbykgSYo.cjs} +1 -1
  46. package/dist/{no-language-page-dialog-B-9DnVeV.js → no-language-page-dialog-C03CVsV2.js} +2 -2
  47. package/dist/{page-creator-ltZp2cvK.cjs → page-creator-DJvOkcpE.cjs} +1 -1
  48. package/dist/{page-creator-BA9amyHE.js → page-creator-SkEX57cN.js} +2 -2
  49. package/dist/{page-lock-Uz94JnNt.cjs → page-lock-BLPvGNfY.cjs} +1 -1
  50. package/dist/{page-lock-5Q89NXKg.js → page-lock-CXzGU8zl.js} +2 -2
  51. package/dist/{page-locked-dialog-BrFlnF1_.js → page-locked-dialog-BXIE5LDL.js} +1 -1
  52. package/dist/{page-locked-dialog-CQ01l5GQ.cjs → page-locked-dialog-C4wjHWAn.cjs} +1 -1
  53. package/dist/{page-manager-new-WhmwJZLE.cjs → page-manager-new-B8sSsJbv.cjs} +1 -1
  54. package/dist/{page-manager-new-VsciHCAM.js → page-manager-new-DeyFJPmi.js} +2 -2
  55. package/dist/{page-manager-search-and-filter-C25h2oZm.cjs → page-manager-search-and-filter-8xpUoXHE.cjs} +1 -1
  56. package/dist/{page-manager-search-and-filter-JQpL82Sl.js → page-manager-search-and-filter-BWSZW24w.js} +1 -1
  57. package/dist/page-revisions-content-BAmvjMJp.cjs +1 -0
  58. package/dist/{page-revisions-content-BJXW36z8.js → page-revisions-content-BtLrcFfJ.js} +73 -65
  59. package/dist/pages.css +1 -1
  60. package/dist/{publish-pages-content-DD9OlPYp.js → publish-pages-content-L7Oa-2Az.js} +2 -2
  61. package/dist/{publish-pages-content-CJX7kSdV.cjs → publish-pages-content-U-vW7ofx.cjs} +1 -1
  62. package/dist/{save-to-lib-CooOVEaQ.js → save-to-lib-BHrQ3z_j.js} +1 -1
  63. package/dist/{save-to-lib-D1wVNYQs.cjs → save-to-lib-C8j3AAhp.cjs} +1 -1
  64. package/dist/{selected-block-display-DxwMm0qr.js → selected-block-display-BJDfGS9W.js} +1 -1
  65. package/dist/{selected-block-display-gP43mf34.cjs → selected-block-display-i812XPEj.cjs} +1 -1
  66. package/dist/{seo-panel-BZQVr7WN.cjs → seo-panel-BSHZV5lB.cjs} +1 -1
  67. package/dist/{seo-panel-g_OuoWp9.js → seo-panel-aNUIzjJ2.js} +1 -1
  68. package/dist/server.cjs +2 -2
  69. package/dist/server.d.ts +1 -0
  70. package/dist/server.js +23 -13
  71. package/dist/{shared-json-ld-jbhoi-Qv.cjs → shared-json-ld-BGJqkieF.cjs} +1 -1
  72. package/dist/{shared-json-ld-DKwpR514.js → shared-json-ld-DL7-3W57.js} +1 -1
  73. package/dist/{slug-input-Dc5XAgQc.js → slug-input-aWfRiTqb.js} +1 -1
  74. package/dist/{slug-input-DAq9MT_P.cjs → slug-input-kkYSSYld.cjs} +1 -1
  75. package/dist/{take-over-request-BOGWNLpM.cjs → take-over-request-DMycskKu.cjs} +1 -1
  76. package/dist/{take-over-request-Byq9LiOV.js → take-over-request-Mbmm9Yk8.js} +1 -1
  77. package/dist/{theme-panel-footer-B8mn0xAf.js → theme-panel-footer-B-RX3AbU.js} +1 -1
  78. package/dist/{theme-panel-footer-NFR6yf6k.cjs → theme-panel-footer-Do2XzSdP.cjs} +1 -1
  79. package/dist/{unmark-as-template-CIBRCR59.cjs → unmark-as-template-CSgnr64d.cjs} +1 -1
  80. package/dist/{unmark-as-template-BSjPZ86x.js → unmark-as-template-CqQSRoJ8.js} +1 -1
  81. package/dist/{unpublish-page-Cr9AlIFG.js → unpublish-page-COTuNBKf.js} +1 -1
  82. package/dist/{unpublish-page-CmUXigiU.cjs → unpublish-page-QbX5s30w.cjs} +1 -1
  83. package/dist/{web-preview-DK51eK9e.js → web-preview-1LMXa1c5.js} +1 -1
  84. package/dist/{web-preview-mGavSw4r.cjs → web-preview-C1rD-_AD.cjs} +1 -1
  85. package/package.json +4 -4
  86. package/dist/ai-panel-content-NdOClQP-.cjs +0 -1
  87. package/dist/index-DheBvIvo.cjs +0 -5
  88. package/dist/page-revisions-content-ynSnkxGq.cjs +0 -1
@@ -1,11 +1,11 @@
1
1
  import { jsxs as n, Fragment as p, jsx as e } from "react/jsx-runtime";
2
- import { aq as C, ar as A, A as b, aw as q, az as le, ao as I, ax as R, ay as w } from "./index-BoQkDiU0.js";
2
+ import { aq as C, ar as A, A as b, aw as q, az as le, ao as I, ax as R, ay as w } from "./index-iCKpBUN9.js";
3
3
  import { useQuery as re, useQueryClient as O, useMutation as G } from "@tanstack/react-query";
4
4
  import { useLanguages as ie, useSavePage as de } from "@chaibuilder/sdk";
5
- import { SheetHeader as ce, SheetTitle as oe, ScrollArea as ue, Skeleton as y, Button as g, DropdownMenu as me, DropdownMenuTrigger as he, DropdownMenuContent as fe, DropdownMenuItem as U, DropdownMenuSeparator as pe, Dialog as j, DialogContent as L, DialogHeader as z, DialogTitle as P, DialogDescription as $, DialogFooter as H } from "@chaibuilder/sdk/ui";
5
+ import { SheetHeader as ce, SheetTitle as oe, ScrollArea as ue, Skeleton as y, Button as g, DropdownMenu as me, DropdownMenuTrigger as he, DropdownMenuContent as fe, DropdownMenuItem as U, DropdownMenuSeparator as pe, Dialog as j, DialogContent as L, DialogHeader as z, DialogTitle as $, DialogDescription as H, DialogFooter as J } from "@chaibuilder/sdk/ui";
6
6
  import { format as D, formatDistanceToNow as xe } from "date-fns";
7
7
  import { isEmpty as ge } from "lodash-es";
8
- import { FileJson as Ne, MoreHorizontal as be, Undo2 as J, Trash as Q, CloudOff as ye, Rocket as ve, Save as we, X as De } from "lucide-react";
8
+ import { FileJson as Ne, MoreHorizontal as be, Undo2 as P, Trash as Q, CloudOff as ye, Rocket as ve, Save as we, X as De } from "lucide-react";
9
9
  import * as v from "react";
10
10
  import { useEffect as F, lazy as Se, useState as Ee, Suspense as Re } from "react";
11
11
  function Ce(t) {
@@ -36,9 +36,13 @@ const Ae = () => {
36
36
  }, Ie = () => {
37
37
  const t = C(), s = A(), a = O();
38
38
  return G({
39
- mutationFn: async ({ revisionId: i, discardCurrent: l }) => await s(t, {
39
+ mutationFn: async ({
40
+ revisionId: i,
41
+ discardCurrent: r,
42
+ pageId: d
43
+ }) => await s(t, {
40
44
  action: b.RESTORE_PAGE_REVISION,
41
- data: { revisionId: i, discardCurrent: l }
45
+ data: { revisionId: i, discardCurrent: r, ...d && { pageId: d } }
42
46
  }),
43
47
  onSuccess: () => {
44
48
  a.invalidateQueries({
@@ -46,7 +50,7 @@ const Ae = () => {
46
50
  });
47
51
  }
48
52
  });
49
- }, Oe = Se(() => import("./json-diff-viewer-C9Vtz001.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ n("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
+ }, Oe = Se(() => import("./json-diff-viewer-Dw3zaurB.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ n("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: [
50
54
  /* @__PURE__ */ n("span", { className: "relative flex h-2 w-2", children: [
51
55
  /* @__PURE__ */ e("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75" }),
52
56
  /* @__PURE__ */ e("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-amber-500" })
@@ -66,22 +70,22 @@ const Ae = () => {
66
70
  /* @__PURE__ */ e("span", { className: "text-[11px] leading-tight", children: "Unsaved changes" })
67
71
  ] }) : /* @__PURE__ */ e("span", { className: "rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600", children: t });
68
72
  function ke({ compare: t, setCompare: s }) {
69
- const { data: a } = q(), { saveState: i } = de(), [l] = le();
73
+ const { data: a } = q(), { saveState: i } = de(), [r] = le();
70
74
  if (!a) return null;
71
- const d = !!t.find((o) => {
72
- var r;
73
- return (r = o == null ? void 0 : o.uid) == null ? void 0 : r.startsWith("draft:");
74
- }), u = t.length >= 2 && !d, m = i === "UNSAVED";
75
+ const d = !!t.find((u) => {
76
+ var l;
77
+ return (l = u == null ? void 0 : u.uid) == null ? void 0 : l.startsWith("draft:");
78
+ }), o = t.length >= 2 && !d, m = i === "UNSAVED";
75
79
  return /* @__PURE__ */ n("div", { className: "relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50", children: [
76
80
  /* @__PURE__ */ n("div", { className: "flex-1 space-y-1", children: [
77
81
  /* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-1 text-sm font-medium leading-none", children: [
78
82
  /* @__PURE__ */ e(N, { tag: "draft" }),
79
83
  /* @__PURE__ */ e("span", { className: "text-xs font-bold", children: "Currently editing" })
80
84
  ] }) }),
81
- /* @__PURE__ */ e("div", { className: "flex items-center pl-2 text-[11px] text-muted-foreground", children: !ge(l.lastSaved) && /* @__PURE__ */ n("span", { children: [
85
+ /* @__PURE__ */ e("div", { className: "flex items-center pl-2 text-[11px] text-muted-foreground", children: !ge(r.lastSaved) && /* @__PURE__ */ n("span", { children: [
82
86
  "Last updated",
83
87
  " ",
84
- xe(new Date(l.lastSaved), {
88
+ xe(new Date(r.lastSaved), {
85
89
  addSuffix: !0
86
90
  })
87
91
  ] }) }),
@@ -91,9 +95,9 @@ function ke({ compare: t, setCompare: s }) {
91
95
  K,
92
96
  {
93
97
  checked: d,
94
- disabled: u,
98
+ disabled: o,
95
99
  onChange: () => {
96
- s(d ? t.filter((o) => o.uid !== `draft:${a == null ? void 0 : a.id}`) : [
100
+ s(d ? t.filter((u) => u.uid !== `draft:${a == null ? void 0 : a.id}`) : [
97
101
  ...t,
98
102
  { uid: `draft:${a == null ? void 0 : a.id}`, label: "draft", item: { createdAt: Date.now() } }
99
103
  ]);
@@ -117,22 +121,22 @@ function V({
117
121
  isLatest: s,
118
122
  onRestore: a,
119
123
  onDelete: i,
120
- revisionNumber: l,
124
+ revisionNumber: r,
121
125
  compare: d,
122
- setCompare: u,
126
+ setCompare: o,
123
127
  pageId: m
124
128
  }) {
125
- const { data: o } = I(t.currentEditor), r = (o == null ? void 0 : o.name) || "Unknown", f = !!d.find((h) => {
129
+ const { data: u } = I(t.currentEditor), l = (u == null ? void 0 : u.name) || "Unknown", f = !!d.find((h) => {
126
130
  var x;
127
131
  return s ? (x = h == null ? void 0 : h.uid) == null ? void 0 : x.startsWith("live") : (h == null ? void 0 : h.uid) === t.uid;
128
132
  }), S = d.length >= 2 && !f;
129
133
  return /* @__PURE__ */ n("div", { className: "relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50", children: [
130
134
  /* @__PURE__ */ n("div", { className: "flex-1 space-y-3", children: [
131
135
  /* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ n("p", { className: "flex items-center gap-1 text-xs leading-none", children: [
132
- /* @__PURE__ */ e(N, { tag: s ? "live" : `#${l}` }),
136
+ /* @__PURE__ */ e(N, { tag: s ? "live" : `#${r}` }),
133
137
  t.type === "published" ? "Published" : "Draft",
134
138
  " by ",
135
- /* @__PURE__ */ e("span", { className: "text-xs font-bold", children: r })
139
+ /* @__PURE__ */ e("span", { className: "text-xs font-bold", children: l })
136
140
  ] }) }),
137
141
  /* @__PURE__ */ n("div", { className: "flex items-center gap-x-3", children: [
138
142
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: t.type === "published" ? /* @__PURE__ */ e(N, { tag: "published" }) : /* @__PURE__ */ e(N, { tag: "draft" }) }),
@@ -146,12 +150,12 @@ function V({
146
150
  checked: f,
147
151
  disabled: S,
148
152
  onChange: () => {
149
- u(
153
+ o(
150
154
  f ? d.filter((h) => s ? h.uid !== `live:${m}` : h.uid !== t.uid) : [
151
155
  ...d,
152
156
  {
153
157
  uid: s ? `live:${m}` : t.uid,
154
- label: s ? "live" : `#${l}`,
158
+ label: s ? "live" : `#${r}`,
155
159
  item: t
156
160
  }
157
161
  ].sort((h, x) => new Date(h.item.createdAt).getTime() - new Date(x.item.createdAt).getTime())
@@ -162,16 +166,16 @@ function V({
162
166
  ] });
163
167
  }
164
168
  function Te({ compare: t, setCompare: s, pageId: a }) {
165
- const [i, l] = Ee(!1), [d, u] = t;
169
+ const [i, r] = Ee(!1), [d, o] = t;
166
170
  if (t.length === 0) return null;
167
- const m = ({ tab: o }) => /* @__PURE__ */ n("span", { className: "flex items-center justify-between rounded border border-blue-100 p-1 font-medium", children: [
168
- /* @__PURE__ */ e(N, { tag: o.label }),
171
+ const m = ({ tab: u }) => /* @__PURE__ */ n("span", { className: "flex items-center justify-between rounded border border-blue-100 p-1 font-medium", children: [
172
+ /* @__PURE__ */ e(N, { tag: u.label }),
169
173
  /* @__PURE__ */ e(
170
174
  "button",
171
175
  {
172
176
  className: "z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",
173
177
  style: { lineHeight: 1 },
174
- onClick: () => s(t.filter((r) => r.uid !== o.uid)),
178
+ onClick: () => s(t.filter((l) => l.uid !== u.uid)),
175
179
  "aria-label": "Remove selection 1",
176
180
  children: /* @__PURE__ */ e(De, { className: "h-3 w-3" })
177
181
  }
@@ -182,7 +186,7 @@ function Te({ compare: t, setCompare: s, pageId: a }) {
182
186
  /* @__PURE__ */ e("span", { className: "font-medium leading-tight text-gray-600", children: "Compare" }),
183
187
  d && /* @__PURE__ */ e(m, { tab: d }),
184
188
  /* @__PURE__ */ e("span", { className: "font-medium leading-tight text-gray-600", children: "with" }),
185
- u ? /* @__PURE__ */ e(m, { tab: u }) : /* @__PURE__ */ e("span", { className: "rounded border px-1 text-xs text-muted-foreground", children: "Choose another" })
189
+ o ? /* @__PURE__ */ e(m, { tab: o }) : /* @__PURE__ */ e("span", { className: "rounded border px-1 text-xs text-muted-foreground", children: "Choose another" })
186
190
  ] }),
187
191
  /* @__PURE__ */ n("div", { className: "flex items-center justify-end gap-2 pb-0.5 pt-2", children: [
188
192
  /* @__PURE__ */ e(
@@ -201,7 +205,7 @@ function Te({ compare: t, setCompare: s, pageId: a }) {
201
205
  size: "sm",
202
206
  className: "h-6 gap-1 rounded px-2 text-xs leading-none",
203
207
  variant: "default",
204
- onClick: () => l(!0),
208
+ onClick: () => r(!0),
205
209
  disabled: t.length < 2,
206
210
  children: [
207
211
  /* @__PURE__ */ e(Ne, { className: "h-2.5 w-2.5" }),
@@ -214,7 +218,7 @@ function Te({ compare: t, setCompare: s, pageId: a }) {
214
218
  Re,
215
219
  {
216
220
  fallback: /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ e("span", { className: "text-sm", children: "Loading diff viewer..." }) }),
217
- children: /* @__PURE__ */ e(Oe, { open: i, onOpenChange: l, compare: t })
221
+ children: /* @__PURE__ */ e(Oe, { open: i, onOpenChange: r, compare: t })
218
222
  }
219
223
  )
220
224
  ] });
@@ -242,7 +246,7 @@ function _e({ revision: t, onRestore: s, onDelete: a }) {
242
246
  ] }) }),
243
247
  /* @__PURE__ */ n(fe, { align: "end", className: "text-xs", children: [
244
248
  /* @__PURE__ */ e(R, { permission: w.RESTORE_REVISION, children: /* @__PURE__ */ n(U, { onClick: s, className: "cursor-pointer text-sm", children: [
245
- /* @__PURE__ */ e(J, { className: "mr-2 h-4 w-4" }),
249
+ /* @__PURE__ */ e(P, { className: "mr-2 h-4 w-4" }),
246
250
  /* @__PURE__ */ e("span", { children: "Restore this version" })
247
251
  ] }) }),
248
252
  /* @__PURE__ */ e(R, { permission: w.DELETE_REVISION, children: t.uid !== "current" && /* @__PURE__ */ n(p, { children: [
@@ -260,43 +264,43 @@ function Ue({
260
264
  onOpenChange: s,
261
265
  revision: a,
262
266
  onRestore: i,
263
- isRestoring: l
267
+ isRestoring: r
264
268
  }) {
265
- const { data: d } = I((a == null ? void 0 : a.currentEditor) || ""), u = (d == null ? void 0 : d.name) || "Unknown";
269
+ const { data: d } = I((a == null ? void 0 : a.currentEditor) || ""), o = (d == null ? void 0 : d.name) || "Unknown";
266
270
  return a ? /* @__PURE__ */ e(
267
271
  j,
268
272
  {
269
273
  open: t,
270
274
  onOpenChange: (m) => {
271
- l || s(m);
275
+ r || s(m);
272
276
  },
273
277
  children: /* @__PURE__ */ n(L, { className: "sm:max-w-md", children: [
274
278
  /* @__PURE__ */ n(z, { children: [
275
- /* @__PURE__ */ e(P, { children: "Restore Revision" }),
276
- /* @__PURE__ */ n($, { children: [
279
+ /* @__PURE__ */ e($, { children: "Restore Revision" }),
280
+ /* @__PURE__ */ n(H, { children: [
277
281
  "You are about to restore to revision ",
278
282
  a.uid.substring(0, 8),
279
283
  " from",
280
284
  " ",
281
285
  D(a.createdAt, "MMM d, yyyy 'at' h:mm a"),
282
286
  " by ",
283
- u
287
+ o
284
288
  ] })
285
289
  ] }),
286
290
  /* @__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?" }) }),
287
- /* @__PURE__ */ n(H, { className: "flex flex-col gap-2 sm:flex-row", children: [
288
- /* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => i(!1), disabled: l, children: l ? /* @__PURE__ */ n(p, { children: [
291
+ /* @__PURE__ */ n(J, { className: "flex flex-col gap-2 sm:flex-row", children: [
292
+ /* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => i(!1), disabled: r, children: r ? /* @__PURE__ */ n(p, { children: [
289
293
  /* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
290
294
  "Saving as draft..."
291
295
  ] }) : /* @__PURE__ */ n(p, { children: [
292
296
  /* @__PURE__ */ e(ye, { className: "mr-2 h-4 w-4" }),
293
297
  "Save as draft"
294
298
  ] }) }),
295
- /* @__PURE__ */ e(g, { variant: "default", className: "sm:flex-1", onClick: () => i(!0), disabled: l, children: l ? /* @__PURE__ */ n(p, { children: [
299
+ /* @__PURE__ */ e(g, { variant: "default", className: "sm:flex-1", onClick: () => i(!0), disabled: r, children: r ? /* @__PURE__ */ n(p, { children: [
296
300
  /* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
297
301
  "Discarding current..."
298
302
  ] }) : /* @__PURE__ */ n(p, { children: [
299
- /* @__PURE__ */ e(J, { className: "mr-2 h-4 w-4" }),
303
+ /* @__PURE__ */ e(P, { className: "mr-2 h-4 w-4" }),
300
304
  "Discard current"
301
305
  ] }) })
302
306
  ] })
@@ -309,33 +313,33 @@ function Fe({
309
313
  onOpenChange: s,
310
314
  revision: a,
311
315
  onDelete: i,
312
- isDeleting: l
316
+ isDeleting: r
313
317
  }) {
314
- const { data: d } = I((a == null ? void 0 : a.currentEditor) || ""), u = (d == null ? void 0 : d.name) || "Unknown";
318
+ const { data: d } = I((a == null ? void 0 : a.currentEditor) || ""), o = (d == null ? void 0 : d.name) || "Unknown";
315
319
  return a ? /* @__PURE__ */ e(
316
320
  j,
317
321
  {
318
322
  open: t,
319
323
  onOpenChange: (m) => {
320
- l || s(m);
324
+ r || s(m);
321
325
  },
322
326
  children: /* @__PURE__ */ n(L, { className: "sm:max-w-md", children: [
323
327
  /* @__PURE__ */ n(z, { children: [
324
- /* @__PURE__ */ e(P, { children: "Delete Revision" }),
325
- /* @__PURE__ */ n($, { children: [
328
+ /* @__PURE__ */ e($, { children: "Delete Revision" }),
329
+ /* @__PURE__ */ n(H, { children: [
326
330
  "You are about to delete revision ",
327
331
  a.uid.substring(0, 8),
328
332
  " from",
329
333
  " ",
330
334
  D(a.createdAt, "MMM d, yyyy 'at' h:mm a"),
331
335
  " by ",
332
- u
336
+ o
333
337
  ] })
334
338
  ] }),
335
339
  /* @__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?" }) }),
336
- /* @__PURE__ */ n(H, { className: "flex flex-col gap-2 sm:flex-row", children: [
337
- /* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => s(!1), disabled: l, children: "Cancel" }),
338
- /* @__PURE__ */ e(g, { variant: "destructive", className: "sm:flex-1", onClick: i, disabled: l, children: l ? /* @__PURE__ */ n(p, { children: [
340
+ /* @__PURE__ */ n(J, { className: "flex flex-col gap-2 sm:flex-row", children: [
341
+ /* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => s(!1), disabled: r, children: "Cancel" }),
342
+ /* @__PURE__ */ e(g, { variant: "destructive", className: "sm:flex-1", onClick: i, disabled: r, children: r ? /* @__PURE__ */ n(p, { children: [
339
343
  /* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
340
344
  "Deleting..."
341
345
  ] }) : /* @__PURE__ */ n(p, { children: [
@@ -347,25 +351,29 @@ function Fe({
347
351
  }
348
352
  ) : null;
349
353
  }
350
- function Je({ isOpen: t }) {
354
+ function Pe({ isOpen: t }) {
351
355
  var T, _;
352
- const [s, a] = v.useState([]), [i, l] = v.useState(null), [d, u] = v.useState(!1), [m, o] = v.useState(!1), { data: r } = q(), { data: f, isFetching: S, error: h, refetch: x } = Ce(r == null ? void 0 : r.id), { mutate: W, isPending: Y } = Ae(), { mutate: B, isPending: X } = Ie(), Z = O(), { selectedLang: ee, fallbackLang: te } = ie(), ne = ee || te;
353
- F(() => a([]), [r == null ? void 0 : r.id]);
356
+ const [s, a] = v.useState([]), [i, r] = v.useState(null), [d, o] = v.useState(!1), [m, u] = v.useState(!1), { data: l } = q(), { data: f, isFetching: S, error: h, refetch: x } = Ce(l == null ? void 0 : l.id), { mutate: W, isPending: Y } = Ae(), { mutate: B, isPending: X } = Ie(), Z = O(), { selectedLang: ee, fallbackLang: te } = ie(), ne = ee || te;
357
+ F(() => a([]), [l == null ? void 0 : l.id]);
354
358
  const ae = (c) => {
355
359
  i && B(
356
- { revisionId: i.uid, discardCurrent: c },
360
+ {
361
+ revisionId: i.uid,
362
+ discardCurrent: c,
363
+ ...i.uid === "current" && (l == null ? void 0 : l.id) && { pageId: l.id }
364
+ },
357
365
  {
358
366
  onSuccess: () => {
359
- u(!1), l(null), Z.invalidateQueries({
367
+ o(!1), r(null), Z.invalidateQueries({
360
368
  queryKey: [b.GET_DRAFT_PAGE]
361
369
  });
362
370
  }
363
371
  }
364
372
  );
365
373
  }, k = (c) => {
366
- l(c), u(!0);
374
+ r(c), o(!0);
367
375
  }, M = (c) => {
368
- l(c), o(!0);
376
+ r(c), u(!0);
369
377
  }, se = () => {
370
378
  i && W(i.uid, {
371
379
  /**
@@ -373,7 +381,7 @@ function Je({ isOpen: t }) {
373
381
  * delete dialog and resets the selected revision to null.
374
382
  */
375
383
  onSuccess: () => {
376
- o(!1), l(null);
384
+ u(!1), r(null);
377
385
  }
378
386
  });
379
387
  };
@@ -382,18 +390,18 @@ function Je({ isOpen: t }) {
382
390
  }, [t, x]), /* @__PURE__ */ n(p, { children: [
383
391
  /* @__PURE__ */ n(ce, { children: [
384
392
  /* @__PURE__ */ e(oe, { children: "Revision History" }),
385
- (r == null ? void 0 : r.createdAt) && /* @__PURE__ */ n("p", { className: "mt-1 text-xs text-muted-foreground", children: [
393
+ (l == null ? void 0 : l.createdAt) && /* @__PURE__ */ n("p", { className: "mt-1 text-xs text-muted-foreground", children: [
386
394
  "Page created on ",
387
- D(new Date(r.createdAt), "MMM d, yyyy 'at' h:mm a")
395
+ D(new Date(l.createdAt), "MMM d, yyyy 'at' h:mm a")
388
396
  ] })
389
397
  ] }),
390
398
  S ? /* @__PURE__ */ e(Me, {}) : h ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "Failed to load revisions. Please try again." }) : /* @__PURE__ */ n("div", { className: "mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2", children: [
391
- /* @__PURE__ */ e(Te, { lang: ne, compare: s, setCompare: a, pageId: r == null ? void 0 : r.id }),
399
+ /* @__PURE__ */ e(Te, { lang: ne, compare: s, setCompare: a, pageId: l == null ? void 0 : l.id }),
392
400
  /* @__PURE__ */ e(ke, { compare: s, setCompare: a }),
393
401
  (T = f == null ? void 0 : f.filter((c) => c.uid === "current")) == null ? void 0 : T.map((c, E) => /* @__PURE__ */ e(
394
402
  V,
395
403
  {
396
- pageId: r == null ? void 0 : r.id,
404
+ pageId: l == null ? void 0 : l.id,
397
405
  revision: c,
398
406
  isLatest: !0,
399
407
  onRestore: () => k(c),
@@ -407,7 +415,7 @@ function Je({ isOpen: t }) {
407
415
  /* @__PURE__ */ e(ue, { className: "min-h-0 flex-1", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: (_ = f == null ? void 0 : f.filter((c) => c.uid !== "current")) == null ? void 0 : _.map((c, E) => /* @__PURE__ */ e(
408
416
  V,
409
417
  {
410
- pageId: r == null ? void 0 : r.id,
418
+ pageId: l == null ? void 0 : l.id,
411
419
  revision: c,
412
420
  isLatest: c.uid === "current",
413
421
  onRestore: () => k(c),
@@ -423,7 +431,7 @@ function Je({ isOpen: t }) {
423
431
  Ue,
424
432
  {
425
433
  open: d,
426
- onOpenChange: u,
434
+ onOpenChange: o,
427
435
  revision: i,
428
436
  onRestore: ae,
429
437
  isRestoring: X
@@ -433,7 +441,7 @@ function Je({ isOpen: t }) {
433
441
  Fe,
434
442
  {
435
443
  open: m,
436
- onOpenChange: o,
444
+ onOpenChange: u,
437
445
  revision: i,
438
446
  onDelete: se,
439
447
  isDeleting: Y
@@ -442,5 +450,5 @@ function Je({ isOpen: t }) {
442
450
  ] });
443
451
  }
444
452
  export {
445
- Je as default
453
+ Pe as default
446
454
  };