@chaibuilder/pages 0.16.13 → 0.16.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/{2AITGKQY-D1mM4eEh.js → 2AITGKQY-2rt9M99C.js} +5 -5
  2. package/dist/{2AITGKQY-AK2WgbeT.cjs → 2AITGKQY-Cs6RBSPQ.cjs} +1 -1
  3. package/dist/{NCMVHL6D-DItDf9IY.cjs → NCMVHL6D-CsC6nsSQ.cjs} +1 -1
  4. package/dist/{NCMVHL6D-BeRsWdGV.js → NCMVHL6D-vUfYKc6i.js} +2 -2
  5. package/dist/{ZDWCUMSJ-COSBY-at.cjs → ZDWCUMSJ-B2OZjsr6.cjs} +1 -1
  6. package/dist/{ZDWCUMSJ-D6caRaY7.js → ZDWCUMSJ-CzEWKlEU.js} +1 -1
  7. package/dist/active-in-another-tab-B0N5S-Bh.js +34 -0
  8. package/dist/active-in-another-tab-BK3cZf-x.cjs +1 -0
  9. package/dist/{add-new-language-page-CQcFi0Tp.cjs → add-new-language-page-Dt1j-8Zg.cjs} +1 -1
  10. package/dist/{add-new-language-page-nnaUe-qk.js → add-new-language-page-YlqcCdlK.js} +20 -20
  11. package/dist/{add-new-page-DxObnvo_.cjs → add-new-page-DqhQUQBz.cjs} +1 -1
  12. package/dist/{add-new-page-Ba1fq6LH.js → add-new-page-aYomeid4.js} +1 -1
  13. package/dist/ai-panel-content-C6cH9rrC.js +123 -0
  14. package/dist/ai-panel-content-MOZmNIKP.cjs +1 -0
  15. package/dist/ai-panel-default-lang-BZHkFsox.js +317 -0
  16. package/dist/ai-panel-default-lang-DOk_Q0IO.cjs +3 -0
  17. package/dist/{ai-panel-other-lang-B4euTuod.js → ai-panel-other-lang-D2A46FTg.js} +10 -9
  18. package/dist/ai-panel-other-lang-qHrdvAMa.cjs +1 -0
  19. package/dist/ai-prompt-input-BZSjjNJd.cjs +1 -0
  20. package/dist/ai-prompt-input-C6gDvvLQ.js +1071 -0
  21. package/dist/{ai-translation-prompt-Ip7w2_Ey.cjs → ai-translation-prompt-BqXo2CLp.cjs} +1 -1
  22. package/dist/{ai-translation-prompt-CVuPbgXw.js → ai-translation-prompt-DTR0wbGt.js} +1 -1
  23. package/dist/continue-editing-in-this-client-C3T6Jzhi.cjs +1 -0
  24. package/dist/continue-editing-in-this-client-D2S1yCOM.js +24 -0
  25. package/dist/delete-page-BF1k60U2.js +70 -0
  26. package/dist/delete-page-x0DWKzsR.cjs +1 -0
  27. package/dist/{digital-asset-manager-CIMo79Di.cjs → digital-asset-manager-BmlFt2T_.cjs} +1 -1
  28. package/dist/{digital-asset-manager-SAFNO_mx.js → digital-asset-manager-C8udwDBW.js} +1 -1
  29. package/dist/{duplicate-page-CXK2HcxD.cjs → duplicate-page-Dt_QZkTk.cjs} +1 -1
  30. package/dist/{duplicate-page-5SwLvmkX.js → duplicate-page-u_6vUVo1.js} +7 -7
  31. package/dist/{dynamic-page-selector-Crd3y4Hk.cjs → dynamic-page-selector-Cgs_Y_Kl.cjs} +1 -1
  32. package/dist/{dynamic-page-selector-DfcuTqRN.js → dynamic-page-selector-DxBHmglP.js} +1 -1
  33. package/dist/index-BeWL6Sj6.cjs +5 -0
  34. package/dist/index-DI2Rwk5v.js +4820 -0
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.d.ts +1 -34
  37. package/dist/index.js +21 -22
  38. package/dist/{json-diff-viewer-D34kDA_c.cjs → json-diff-viewer-D2g0Yab2.cjs} +1 -1
  39. package/dist/{json-diff-viewer-CDwpbuag.js → json-diff-viewer-QdUwk7yF.js} +6 -6
  40. package/dist/{lang-panel-CUIeO5bb.js → lang-panel-B8OD0GiA.js} +24 -24
  41. package/dist/{lang-panel-CaFrYllL.cjs → lang-panel-M2Zb01lF.cjs} +1 -1
  42. package/dist/{mark-as-template-D0dLQaIB.js → mark-as-template-CJ1mlxYT.js} +7 -7
  43. package/dist/{mark-as-template-v182tmN6.cjs → mark-as-template-DONU52b1.cjs} +1 -1
  44. package/dist/{no-language-page-content-Bk4fEx_p.cjs → no-language-page-content-DD9Ok2Ku.cjs} +1 -1
  45. package/dist/{no-language-page-content-ByRFD_qA.js → no-language-page-content-Dtm37LTJ.js} +1 -1
  46. package/dist/no-language-page-dialog-D3dvenZ7.cjs +1 -0
  47. package/dist/no-language-page-dialog-Dj_z2_hF.js +10 -0
  48. package/dist/{page-creator-Bh0IUGR3.js → page-creator-DIMFISo4.js} +52 -52
  49. package/dist/{page-creator-BnvaGZVI.cjs → page-creator-DTC66ujU.cjs} +1 -1
  50. package/dist/page-lock-CI6BYvF_.cjs +1 -0
  51. package/dist/page-lock-DUlNr3os.js +30 -0
  52. package/dist/page-locked-dialog-BKwULMV7.js +133 -0
  53. package/dist/page-locked-dialog-DorIbva0.cjs +1 -0
  54. package/dist/page-manager-new-lNVrLOJp.cjs +1 -0
  55. package/dist/page-manager-new-znvqI9_L.js +354 -0
  56. package/dist/{page-manager-search-and-filter-BETHSa3y.js → page-manager-search-and-filter-C-_w7N27.js} +1 -1
  57. package/dist/{page-manager-search-and-filter-hyUIHOD_.cjs → page-manager-search-and-filter-pe0q0qnZ.cjs} +1 -1
  58. package/dist/{page-revisions-content-BCMjvZRZ.cjs → page-revisions-content-Caaj5TEI.cjs} +1 -1
  59. package/dist/{page-revisions-content-VWthKL7O.js → page-revisions-content-CyLjyxNU.js} +16 -16
  60. package/dist/pages.css +1 -1
  61. package/dist/publish-pages-content-Bih1W9C4.js +178 -0
  62. package/dist/publish-pages-content-D5beVcQI.cjs +1 -0
  63. package/dist/{save-to-lib-YYBxY7MV.js → save-to-lib-BwpkJcT2.js} +1 -1
  64. package/dist/{save-to-lib-CtGpDkC6.cjs → save-to-lib-DPAERsi4.cjs} +1 -1
  65. package/dist/{selected-block-display-DdW-DWF1.js → selected-block-display-GXSf3y2s.js} +1 -1
  66. package/dist/{selected-block-display-BEbuJn0l.cjs → selected-block-display-s99Y91qI.cjs} +1 -1
  67. package/dist/{seo-panel-CqJDhbj-.js → seo-panel-BurZA566.js} +61 -61
  68. package/dist/{seo-panel-B9P7fXjo.cjs → seo-panel-BxUfalVy.cjs} +1 -1
  69. package/dist/server.cjs +1 -1
  70. package/dist/server.js +39 -39
  71. package/dist/{shared-json-ld-CyxmC9y5.cjs → shared-json-ld-BYAdrPeC.cjs} +1 -1
  72. package/dist/{shared-json-ld-DxEPILj_.js → shared-json-ld-DHWdJvQd.js} +39 -39
  73. package/dist/{slug-input-RNiSrU3p.cjs → slug-input-CR2B1kDJ.cjs} +1 -1
  74. package/dist/{slug-input-j5z5ZQn9.js → slug-input-Z_ny7bgX.js} +1 -1
  75. package/dist/take-over-request-CnEpToCM.cjs +1 -0
  76. package/dist/take-over-request-DF2JsIes.js +63 -0
  77. package/dist/{theme-panel-footer-DD2yalfG.js → theme-panel-footer-5mxFeEua.js} +4 -4
  78. package/dist/{theme-panel-footer-CCsiDIVl.cjs → theme-panel-footer-C2CjHoBu.cjs} +1 -1
  79. package/dist/{unmark-as-template-DXjLbqOM.cjs → unmark-as-template-Dn90g1eh.cjs} +1 -1
  80. package/dist/{unmark-as-template-B2hKhAHn.js → unmark-as-template-JRRUYTOY.js} +1 -1
  81. package/dist/{unpublish-page-BdJScWMX.cjs → unpublish-page-C3C_rTRd.cjs} +1 -1
  82. package/dist/{unpublish-page-BvB1PGSz.js → unpublish-page-FZ8rbi7u.js} +9 -9
  83. package/dist/{web-preview-CwVpkcwU.js → web-preview-CGBKG162.js} +1 -1
  84. package/dist/{web-preview-BI4jd0O7.cjs → web-preview-NdxC92Fk.cjs} +1 -1
  85. package/package.json +3 -3
  86. package/dist/ai-panel-content-B2AgBWqo.cjs +0 -1
  87. package/dist/ai-panel-content-M1UnzG_f.js +0 -54
  88. package/dist/ai-panel-default-lang-CHOFEwmV.js +0 -313
  89. package/dist/ai-panel-default-lang-sy6vkQJh.cjs +0 -3
  90. package/dist/ai-panel-other-lang-BwjSDD3L.cjs +0 -1
  91. package/dist/ai-prompt-input-B_NRADBT.js +0 -988
  92. package/dist/ai-prompt-input-DcyVXcLG.cjs +0 -1
  93. package/dist/delete-page-CbY8q5M3.cjs +0 -1
  94. package/dist/delete-page-SX9X35nA.js +0 -40
  95. package/dist/index-Bz7smSC0.cjs +0 -5
  96. package/dist/index-EnM7J19_.js +0 -4960
  97. package/dist/page-lock-request-C2b1kqyA.cjs +0 -1
  98. package/dist/page-lock-request-CaNqxfD6.js +0 -75
  99. package/dist/page-locked-by-dialog--WLDdkw9.js +0 -68
  100. package/dist/page-locked-by-dialog-90ElC8aG.cjs +0 -1
  101. package/dist/page-manager-new-Bo4-zwfW.js +0 -354
  102. package/dist/page-manager-new-SNRQn7Az.cjs +0 -1
  103. package/dist/publish-pages-content-6N7aEcM1.js +0 -178
  104. package/dist/publish-pages-content-CaBwfekc.cjs +0 -1
@@ -1,178 +0,0 @@
1
- import { jsxs as n, jsx as t, Fragment as H } from "react/jsx-runtime";
2
- import { LanguageSelector as z } from "./page-manager-search-and-filter-BETHSa3y.js";
3
- import { al as R, am as _, A as L, au as $, f as K, h as Q, aj as J, T as A, t as V } from "./index-EnM7J19_.js";
4
- import { useQuery as W } from "@tanstack/react-query";
5
- import { DialogContent as X, DialogHeader as Y, DialogTitle as Z, DialogDescription as ee, DialogFooter as te, Button as F } from "@chaibuilder/sdk/ui";
6
- import { find as G, filter as a, map as y, includes as P, orderBy as b, isEmpty as se, first as le, uniq as U, concat as ne } from "lodash-es";
7
- import { Lock as ae, GlobeIcon as re, File as ce, Edit as oe } from "lucide-react";
8
- import { useState as j, useCallback as ie, useMemo as g, useEffect as O } from "react";
9
- const de = () => {
10
- const s = R(), d = _();
11
- return W({
12
- queryKey: [L.GET_CHANGES],
13
- queryFn: async () => d(s, { action: L.GET_CHANGES })
14
- });
15
- }, ue = ({ page: s, selectedPages: d, handleCheckboxChange: N, getPageType: h, hasSlug: o, currentOwnerId: u }) => {
16
- const { data: i } = J(u), r = i == null ? void 0 : i.name;
17
- return /* @__PURE__ */ n("tr", { className: "group relative border-b last:border-b-0 hover:bg-gray-50", children: [
18
- /* @__PURE__ */ n(
19
- "td",
20
- {
21
- scope: "row",
22
- className: `flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${r ? "opacity-50" : ""}`,
23
- children: [
24
- r ? /* @__PURE__ */ t(ae, { className: "h-4 w-4 fill-red-200 text-red-500" }) : /* @__PURE__ */ t(
25
- "input",
26
- {
27
- checked: P(d, s == null ? void 0 : s.id),
28
- onClick: (x) => {
29
- x.stopPropagation(), N(s == null ? void 0 : s.id);
30
- },
31
- type: "checkbox",
32
- className: "cursor-pointer rounded focus:outline-none focus:ring-0"
33
- }
34
- ),
35
- " ",
36
- o(s.pageType) ? /* @__PURE__ */ t(ce, { className: "h-4 w-4" }) : /* @__PURE__ */ t(re, { className: "h-4 w-4" }),
37
- /* @__PURE__ */ t(A, { content: s.name, side: "top", showTooltip: s.name.length > 25, children: /* @__PURE__ */ t("span", { className: "max-w-[200px] truncate font-medium text-black", children: s.name }) }),
38
- s.slug && /* @__PURE__ */ t(A, { content: s.slug, side: "top", showTooltip: s.slug.length > 25, children: /* @__PURE__ */ t("span", { className: "max-w-[200px] truncate font-mono text-xs text-muted-foreground", children: s.slug }) })
39
- ]
40
- }
41
- ),
42
- /* @__PURE__ */ t("td", { className: "px-2", children: h(s == null ? void 0 : s.pageType) }),
43
- /* @__PURE__ */ t("td", { className: "px-4 text-right", children: le(s.changes) || "" }),
44
- /* @__PURE__ */ t(H, { children: r && /* @__PURE__ */ n("button", { className: "absolute right-0 top-0 flex h-full items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100", children: [
45
- /* @__PURE__ */ t(oe, { size: 12, className: "stroke-[3]" }),
46
- " ",
47
- /* @__PURE__ */ t("span", { className: "font-medium", children: r }),
48
- " is editing this page"
49
- ] }) })
50
- ] }, s == null ? void 0 : s.id);
51
- }, ke = ({
52
- onClose: s = () => {
53
- },
54
- isPending: d,
55
- publishPage: N
56
- }) => {
57
- const [h] = $(), [o, u] = j([]), i = K(), [r, x] = j(i), { data: k, isFetching: C } = de(), { data: m } = Q(), w = ie((e) => {
58
- var l;
59
- return (l = G(m, { key: e })) == null ? void 0 : l.hasSlug;
60
- }, [m]), f = g(
61
- () => a(m, (e) => !w(e.key)).map((e) => e.key),
62
- [w, m]
63
- ), v = U(y(k, "lang")).filter(Boolean), c = g(
64
- () => a(k, (e) => e.pageType === "theme" ? !1 : r === i ? e.lang === r || e.lang === "" : e.lang === r),
65
- [k, r, i]
66
- ), T = g(
67
- () => a(c, (e) => !f.includes(e.pageType)),
68
- [c, f]
69
- ), S = g(
70
- () => a(c, (e) => f.includes(e.pageType)),
71
- [c, f]
72
- );
73
- O(() => {
74
- const e = y(a(c, { online: !0 }), "id");
75
- u(e);
76
- }, [c]), O(() => {
77
- const e = Object.keys(h);
78
- u((l) => a(l, (p) => !P(e, p)));
79
- }, [h]);
80
- const E = o.length === (c == null ? void 0 : c.length), B = (e) => {
81
- u((l) => P(l, e) ? a(l, (p) => p !== e) : ne(l, e));
82
- }, D = () => {
83
- u(E ? [] : y(c, "id"));
84
- }, I = () => {
85
- N(
86
- { ids: U(o) },
87
- {
88
- onSuccess: () => {
89
- s(), V("CENTER_CENTER"), x(i);
90
- }
91
- }
92
- );
93
- }, M = (e) => {
94
- if (e === "theme") return "Theme";
95
- const l = G(m, { key: e });
96
- return l ? l == null ? void 0 : l.name : e;
97
- }, q = g(() => {
98
- const e = [
99
- { label: "Updated", top: "pt-2" },
100
- ...b(a(T, { online: !0 }), "pageType"),
101
- ...b(a(S, { online: !0 }), "pageType")
102
- ].filter((p) => p.pageType !== "theme"), l = [
103
- { label: "Offline", top: "pt-6" },
104
- ...b(a(T, { online: !1 }), "pageType"),
105
- ...b(a(S, { online: !1 }), "pageType")
106
- ];
107
- return [...e, ...l];
108
- }, [T, S]);
109
- return /* @__PURE__ */ n(X, { className: "flex max-h-[80%] max-w-4xl flex-col", children: [
110
- /* @__PURE__ */ n(Y, { children: [
111
- /* @__PURE__ */ t(Z, { children: "Publish changes" }),
112
- /* @__PURE__ */ t(ee, { className: "text-xs", children: "Select the pages you want to publish. Click publish when you're done." })
113
- ] }),
114
- v.length > 0 && /* @__PURE__ */ t("div", { className: "my-[2px] mt-0", children: /* @__PURE__ */ t(
115
- z,
116
- {
117
- languages: [i, ...v],
118
- selectedLanguage: r,
119
- setSelectedLanguage: x
120
- }
121
- ) }),
122
- /* @__PURE__ */ t("div", { className: "no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto", children: C ? /* @__PURE__ */ n("div", { className: "space-y-2 px-1", children: [
123
- /* @__PURE__ */ t("div", { className: "mt-2 h-6 w-full animate-pulse rounded bg-gray-200" }),
124
- /* @__PURE__ */ t("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
125
- /* @__PURE__ */ t("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
126
- /* @__PURE__ */ t("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
127
- ] }) : /* @__PURE__ */ n("table", { className: "w-full text-left text-xs text-gray-500 dark:text-gray-400 rtl:text-right", children: [
128
- /* @__PURE__ */ t("thead", { className: "sticky top-0 z-10 border-b bg-gray-50 text-gray-700 dark:bg-gray-700 dark:text-gray-400", children: /* @__PURE__ */ n("tr", { children: [
129
- /* @__PURE__ */ n("th", { scope: "col", className: "w-[1 50px] flex items-center gap-x-2 px-6 py-3", children: [
130
- /* @__PURE__ */ t(
131
- "input",
132
- {
133
- checked: E,
134
- onClick: (e) => {
135
- e.stopPropagation(), D();
136
- },
137
- type: "checkbox",
138
- className: "mt-1 cursor-pointer rounded focus:outline-none focus:ring-0"
139
- }
140
- ),
141
- "Name"
142
- ] }),
143
- /* @__PURE__ */ t("th", { scope: "col", className: "w-[150px] px-2 py-3", children: "Type" }),
144
- /* @__PURE__ */ t("th", { scope: "col", className: "w-[150px] px-4 py-3 text-right", children: "Status" })
145
- ] }) }),
146
- /* @__PURE__ */ t("tbody", { children: y(
147
- q,
148
- (e) => e.label ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ n("td", { colSpan: 3, className: `relative px-6 py-2 text-xs font-medium text-gray-800 ${e.top}`, children: [
149
- /* @__PURE__ */ t("div", { className: "absolute inset-0 left-6 flex items-center", children: /* @__PURE__ */ t("div", { className: "order-gray-300 w-full" }) }),
150
- /* @__PURE__ */ t("div", { className: "relative flex justify-start", children: /* @__PURE__ */ t("span", { className: "bg-gray-50 pr-2", children: e.label }) })
151
- ] }) }, "separator") : /* @__PURE__ */ t(
152
- ue,
153
- {
154
- page: e,
155
- selectedPages: o,
156
- handleCheckboxChange: B,
157
- getPageType: M,
158
- hasSlug: w,
159
- currentOwnerId: h[(e == null ? void 0 : e.primaryPage) || (e == null ? void 0 : e.id)]
160
- }
161
- )
162
- ) })
163
- ] }) }),
164
- /* @__PURE__ */ n(te, { className: "mt-10 flex items-center justify-center", children: [
165
- o.length > 0 && /* @__PURE__ */ n("span", { className: "text-center text-sm text-muted-foreground", children: [
166
- o.length,
167
- " Page",
168
- o.length !== 1 ? "s" : "",
169
- " Selected"
170
- ] }),
171
- /* @__PURE__ */ t(F, { disabled: d, variant: "outline", onClick: s, children: "Cancel" }),
172
- /* @__PURE__ */ t(F, { disabled: d || C || se(o), onClick: I, children: d ? "Publishing..." : "Publish Selected" })
173
- ] })
174
- ] });
175
- };
176
- export {
177
- ke as default
178
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),B=require("./page-manager-search-and-filter-hyUIHOD_.cjs"),r=require("./index-Bz7smSC0.cjs"),L=require("@tanstack/react-query"),h=require("@chaibuilder/sdk/ui"),t=require("lodash-es"),j=require("lucide-react"),i=require("react"),F=()=>{const l=r.useApiUrl(),u=r.useFetch();return L.useQuery({queryKey:[r.ACTIONS.GET_CHANGES],queryFn:async()=>u(l,{action:r.ACTIONS.GET_CHANGES})})},O=({page:l,selectedPages:u,handleCheckboxChange:b,getPageType:m,hasSlug:o,currentOwnerId:x})=>{const{data:d}=r.useChaiUserInfo(x),a=d==null?void 0:d.name;return e.jsxs("tr",{className:"group relative border-b last:border-b-0 hover:bg-gray-50",children:[e.jsxs("td",{scope:"row",className:`flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${a?"opacity-50":""}`,children:[a?e.jsx(j.Lock,{className:"h-4 w-4 fill-red-200 text-red-500"}):e.jsx("input",{checked:t.includes(u,l==null?void 0:l.id),onClick:p=>{p.stopPropagation(),b(l==null?void 0:l.id)},type:"checkbox",className:"cursor-pointer rounded focus:outline-none focus:ring-0"})," ",o(l.pageType)?e.jsx(j.File,{className:"h-4 w-4"}):e.jsx(j.GlobeIcon,{className:"h-4 w-4"}),e.jsx(r.Tooltip,{content:l.name,side:"top",showTooltip:l.name.length>25,children:e.jsx("span",{className:"max-w-[200px] truncate font-medium text-black",children:l.name})}),l.slug&&e.jsx(r.Tooltip,{content:l.slug,side:"top",showTooltip:l.slug.length>25,children:e.jsx("span",{className:"max-w-[200px] truncate font-mono text-xs text-muted-foreground",children:l.slug})})]}),e.jsx("td",{className:"px-2",children:m(l==null?void 0:l.pageType)}),e.jsx("td",{className:"px-4 text-right",children:t.first(l.changes)||""}),e.jsx(e.Fragment,{children:a&&e.jsxs("button",{className:"absolute right-0 top-0 flex h-full items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100",children:[e.jsx(j.Edit,{size:12,className:"stroke-[3]"})," ",e.jsx("span",{className:"font-medium",children:a})," is editing this page"]})})]},l==null?void 0:l.id)},G=({onClose:l=()=>{},isPending:u,publishPage:b})=>{const[m]=r.usePageUserMapping(),[o,x]=i.useState([]),d=r.useFallbackLang(),[a,p]=i.useState(d),{data:N,isFetching:T}=F(),{data:g}=r.usePageTypes(),k=i.useCallback(s=>{var n;return(n=t.find(g,{key:s}))==null?void 0:n.hasSlug},[g]),y=i.useMemo(()=>t.filter(g,s=>!k(s.key)).map(s=>s.key),[k,g]),P=t.uniq(t.map(N,"lang")).filter(Boolean),c=i.useMemo(()=>t.filter(N,s=>s.pageType==="theme"?!1:a===d?s.lang===a||s.lang==="":s.lang===a),[N,a,d]),w=i.useMemo(()=>t.filter(c,s=>!y.includes(s.pageType)),[c,y]),S=i.useMemo(()=>t.filter(c,s=>y.includes(s.pageType)),[c,y]);i.useEffect(()=>{const s=t.map(t.filter(c,{online:!0}),"id");x(s)},[c]),i.useEffect(()=>{const s=Object.keys(m);x(n=>t.filter(n,f=>!t.includes(s,f)))},[m]);const C=o.length===(c==null?void 0:c.length),v=s=>{x(n=>t.includes(n,s)?t.filter(n,f=>f!==s):t.concat(n,s))},E=()=>{x(C?[]:t.map(c,"id"))},q=()=>{b({ids:t.uniq(o)},{onSuccess:()=>{l(),r.throwConfetti("CENTER_CENTER"),p(d)}})},M=s=>{if(s==="theme")return"Theme";const n=t.find(g,{key:s});return n?n==null?void 0:n.name:s},A=i.useMemo(()=>{const s=[{label:"Updated",top:"pt-2"},...t.orderBy(t.filter(w,{online:!0}),"pageType"),...t.orderBy(t.filter(S,{online:!0}),"pageType")].filter(f=>f.pageType!=="theme"),n=[{label:"Offline",top:"pt-6"},...t.orderBy(t.filter(w,{online:!1}),"pageType"),...t.orderBy(t.filter(S,{online:!1}),"pageType")];return[...s,...n]},[w,S]);return e.jsxs(h.DialogContent,{className:"flex max-h-[80%] max-w-4xl flex-col",children:[e.jsxs(h.DialogHeader,{children:[e.jsx(h.DialogTitle,{children:"Publish changes"}),e.jsx(h.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),P.length>0&&e.jsx("div",{className:"my-[2px] mt-0",children:e.jsx(B.LanguageSelector,{languages:[d,...P],selectedLanguage:a,setSelectedLanguage:p})}),e.jsx("div",{className:"no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto",children:T?e.jsxs("div",{className:"space-y-2 px-1",children:[e.jsx("div",{className:"mt-2 h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"})]}):e.jsxs("table",{className:"w-full text-left text-xs text-gray-500 dark:text-gray-400 rtl:text-right",children:[e.jsx("thead",{className:"sticky top-0 z-10 border-b bg-gray-50 text-gray-700 dark:bg-gray-700 dark:text-gray-400",children:e.jsxs("tr",{children:[e.jsxs("th",{scope:"col",className:"w-[1 50px] flex items-center gap-x-2 px-6 py-3",children:[e.jsx("input",{checked:C,onClick:s=>{s.stopPropagation(),E()},type:"checkbox",className:"mt-1 cursor-pointer rounded focus:outline-none focus:ring-0"}),"Name"]}),e.jsx("th",{scope:"col",className:"w-[150px] px-2 py-3",children:"Type"}),e.jsx("th",{scope:"col",className:"w-[150px] px-4 py-3 text-right",children:"Status"})]})}),e.jsx("tbody",{children:t.map(A,s=>s.label?e.jsx("tr",{children:e.jsxs("td",{colSpan:3,className:`relative px-6 py-2 text-xs font-medium text-gray-800 ${s.top}`,children:[e.jsx("div",{className:"absolute inset-0 left-6 flex items-center",children:e.jsx("div",{className:"order-gray-300 w-full"})}),e.jsx("div",{className:"relative flex justify-start",children:e.jsx("span",{className:"bg-gray-50 pr-2",children:s.label})})]})},"separator"):e.jsx(O,{page:s,selectedPages:o,handleCheckboxChange:v,getPageType:M,hasSlug:k,currentOwnerId:m[(s==null?void 0:s.primaryPage)||(s==null?void 0:s.id)]}))})]})}),e.jsxs(h.DialogFooter,{className:"mt-10 flex items-center justify-center",children:[o.length>0&&e.jsxs("span",{className:"text-center text-sm text-muted-foreground",children:[o.length," Page",o.length!==1?"s":""," Selected"]}),e.jsx(h.Button,{disabled:u,variant:"outline",onClick:l,children:"Cancel"}),e.jsx(h.Button,{disabled:u||T||t.isEmpty(o),onClick:q,children:u?"Publishing...":"Publish Selected"})]})]})};exports.default=G;