@chaibuilder/pages 0.13.4 → 0.14.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 (78) hide show
  1. package/dist/{2AITGKQY-Dx_Cte-P.js → 2AITGKQY-Cti4x7QE.js} +5 -5
  2. package/dist/{2AITGKQY-DpAgk_u8.cjs → 2AITGKQY-PHs1xUsz.cjs} +1 -1
  3. package/dist/{NCMVHL6D-B6lv7Umq.cjs → NCMVHL6D-BChQ0wDN.cjs} +1 -1
  4. package/dist/{NCMVHL6D-CT2qHOTS.js → NCMVHL6D-fAWarBw8.js} +4 -4
  5. package/dist/{ZDWCUMSJ-C1vrgsti.cjs → ZDWCUMSJ-CwWfQqyn.cjs} +1 -1
  6. package/dist/{ZDWCUMSJ-W9xywtZH.js → ZDWCUMSJ-DRWuu_nE.js} +1 -1
  7. package/dist/add-new-language-page-CcBqDtYv.js +390 -0
  8. package/dist/add-new-language-page-Dt9DWunK.cjs +1 -0
  9. package/dist/add-new-page-BN3z9rSq.cjs +1 -0
  10. package/dist/add-new-page-CTUiEKzv.js +30 -0
  11. package/dist/confetti.module-BuUnQuWk.cjs +2 -0
  12. package/dist/confetti.module-DCmCkDyV.js +409 -0
  13. package/dist/delete-page-8MnGZ_mz.js +38 -0
  14. package/dist/delete-page-jELwTpGY.cjs +1 -0
  15. package/dist/digital-asset-manager-BJhwyEdT.js +976 -0
  16. package/dist/digital-asset-manager-ZyQJP6AO.cjs +1 -0
  17. package/dist/duplicate-page-BGYZLkco.js +120 -0
  18. package/dist/duplicate-page-BRjKFpBP.cjs +1 -0
  19. package/dist/dynamic-page-selector-CR-ZpSJ8.cjs +1 -0
  20. package/dist/dynamic-page-selector-CrbujoYg.js +86 -0
  21. package/dist/get-seo-defaults-9zHebckY.js +65 -0
  22. package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
  23. package/dist/image-compression-DZ9WMmyn.cjs +1 -0
  24. package/dist/image-compression-DsZ1oqpb.js +37 -0
  25. package/dist/index-Byi6-4u1.js +5164 -0
  26. package/dist/index-DSUpSpeI.cjs +5 -0
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.d.ts +4 -22
  29. package/dist/index.js +18 -19
  30. package/dist/json-diff-viewer-DKlC7yl6.cjs +8 -0
  31. package/dist/json-diff-viewer-De2bStRw.js +258 -0
  32. package/dist/lang-panel-B3bC1gKq.cjs +1 -0
  33. package/dist/lang-panel-G7RoMOP7.js +218 -0
  34. package/dist/mark-as-template-B1TpGPms.js +146 -0
  35. package/dist/mark-as-template-OgR8I38n.cjs +1 -0
  36. package/dist/nested-path-selector-content-D_iF9Sm3.cjs +1 -0
  37. package/dist/nested-path-selector-content-DvIL_EoN.js +87 -0
  38. package/dist/no-language-page-content-CqH4FMNy.js +35 -0
  39. package/dist/no-language-page-content-iZo2ztXp.cjs +1 -0
  40. package/dist/page-creator-Chnj3W4j.js +796 -0
  41. package/dist/page-creator-DUXzx-zg.cjs +1 -0
  42. package/dist/page-lock-request-D3gmV8Yq.cjs +1 -0
  43. package/dist/page-lock-request-Dc-JkLEZ.js +64 -0
  44. package/dist/page-locked-by-dialog-B9pGi6zb.cjs +1 -0
  45. package/dist/page-locked-by-dialog-DC8UKy9e.js +63 -0
  46. package/dist/page-manager-new-CFtYUNbS.cjs +1 -0
  47. package/dist/page-manager-new-DYYWpxWy.js +354 -0
  48. package/dist/page-manager-search-and-filter-B4xo9IJO.js +197 -0
  49. package/dist/page-manager-search-and-filter-DT9V9AoS.cjs +1 -0
  50. package/dist/page-revisions-content-BjIECUPY.cjs +1 -0
  51. package/dist/page-revisions-content-KJGhm9Pl.js +446 -0
  52. package/dist/publish-pages-content-BWLQZGjd.js +178 -0
  53. package/dist/publish-pages-content-CTduLNtg.cjs +1 -0
  54. package/dist/save-to-lib-B07GbG4I.js +476 -0
  55. package/dist/save-to-lib-CsrSeusU.cjs +1 -0
  56. package/dist/seo-panel-B20DCgo0.js +667 -0
  57. package/dist/seo-panel-QphuqXT2.cjs +1 -0
  58. package/dist/shared-json-ld-C_vIO-Qk.cjs +1 -0
  59. package/dist/shared-json-ld-CkOQRUEw.js +337 -0
  60. package/dist/slug-input-71BuN79c.cjs +1 -0
  61. package/dist/slug-input-rAe3mMkd.js +87 -0
  62. package/dist/theme-panel-footer-DFUfCqKP.js +25 -0
  63. package/dist/theme-panel-footer-DHRs6ag2.cjs +1 -0
  64. package/dist/translation-warning-modal-DalBhNQy.js +26 -0
  65. package/dist/translation-warning-modal-Kctu12rQ.cjs +1 -0
  66. package/dist/unmark-as-template-Cx0CqrpM.cjs +1 -0
  67. package/dist/unmark-as-template-_VyWoVNk.js +38 -0
  68. package/dist/unpublish-page-CuSJRr5c.js +26 -0
  69. package/dist/unpublish-page-D3NM8b3u.cjs +1 -0
  70. package/dist/use-page-expand-manager-MjYZ3CDZ.cjs +1 -0
  71. package/dist/use-page-expand-manager-_msrWd0a.js +85 -0
  72. package/dist/web-preview-BL-vsgoa.js +73 -0
  73. package/dist/web-preview-CI3Vz7Yp.cjs +1 -0
  74. package/package.json +1 -1
  75. package/dist/index-C4j31Yhz.js +0 -11471
  76. package/dist/index-DnjETHks.cjs +0 -6
  77. package/dist/page-revisions-content-Gx-Qf_91.cjs +0 -8
  78. package/dist/page-revisions-content-_-Nd4U11.js +0 -712
@@ -0,0 +1,667 @@
1
+ import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
+ import { g as ye, al as ve, ak as xe, A as Ne, L as Z, am as we, aC as Se, aD as De, d as be, aw as Oe, aE as Le, aF as Ce, aG as E, aH as Ie, aI as ee } from "./index-Byi6-4u1.js";
3
+ import { useLanguages as z, useTranslation as ke, useSidebarActivePanel as Ee, usePermissions as Te } from "@chaibuilder/sdk";
4
+ import { find as Fe, get as h, isEqual as te, isEmpty as je } from "lodash-es";
5
+ import { useMemo as Re, useRef as ae, useState as j, useEffect as se } from "react";
6
+ import { Button as P, Dialog as Ae, DialogContent as Pe, DialogHeader as Je, DialogTitle as Ve, DialogDescription as Ue, Alert as Ge, AlertDescription as Me, Tabs as Be, TabsList as $e, TabsTrigger as q, Label as N, Input as R, Textarea as ne } from "@chaibuilder/sdk/ui";
7
+ import { toast as O } from "sonner";
8
+ import { useMutation as He } from "@tanstack/react-query";
9
+ import { Loader as qe, Wand2Icon as _e } from "lucide-react";
10
+ import { g as _ } from "./get-seo-defaults-9zHebckY.js";
11
+ const ze = () => {
12
+ const { selectedLang: a } = z(), { data: u, isFetching: c } = ye();
13
+ return { data: Re(() => Fe(u, { lang: a || "" }) || {}, [u, a]), isFetching: c };
14
+ }, Ye = () => {
15
+ var p;
16
+ const u = (p = document.getElementById("canvas-iframe").contentDocument) == null ? void 0 : p.body.innerHTML;
17
+ if (!u) return null;
18
+ const i = new DOMParser().parseFromString(u, "text/html");
19
+ i.querySelectorAll("style, script, link, svg, [data-block-type='PartialBlock']").forEach((d) => d.remove()), i.querySelectorAll("*").forEach((d) => {
20
+ Array.from(d.attributes).forEach((m) => d.removeAttribute(m.name));
21
+ });
22
+ const r = i.querySelectorAll("h1, h2, h3, h4, h5, h6, p");
23
+ return Array.from(r).map((d) => `<${d.tagName.toLowerCase()}>${d.innerHTML}</${d.tagName.toLowerCase()}>`).join(" ").replace(/<p>Partial block. Double click to edit.<\/p>/, "");
24
+ }, A = ({
25
+ keyword: a,
26
+ onComplete: u,
27
+ field: c
28
+ }) => {
29
+ const i = ve(), r = xe(), { selectedLang: x, fallbackLang: p } = z(), { mutate: d, isPending: m } = He({
30
+ mutationFn: async () => {
31
+ const b = Ye();
32
+ return await i(r, {
33
+ action: Ne.GENERATE_SEO_FIELD,
34
+ data: {
35
+ pageContext: "",
36
+ dynamic: !1,
37
+ field: c,
38
+ lang: x || p,
39
+ pageContent: b,
40
+ keyword: a
41
+ }
42
+ });
43
+ },
44
+ onSuccess: (b) => {
45
+ u({ fieldValue: b.field });
46
+ },
47
+ onError: (b) => {
48
+ u({ fieldValue: null, error: b.message });
49
+ }
50
+ });
51
+ return /* @__PURE__ */ e(
52
+ P,
53
+ {
54
+ disabled: m,
55
+ type: "button",
56
+ className: "h-5 w-5",
57
+ variant: "ghost",
58
+ size: "sm",
59
+ onClick: () => d(),
60
+ children: m ? /* @__PURE__ */ e(qe, { className: "h-3 w-3 animate-spin text-yellow-500" }) : /* @__PURE__ */ e(_e, { className: "text-yellow-500" })
61
+ }
62
+ );
63
+ }, Ke = ({
64
+ isOpen: a,
65
+ onClose: u,
66
+ onSave: c,
67
+ onDiscard: i,
68
+ isSaving: r = !1,
69
+ fromLanguage: x,
70
+ toLanguage: p
71
+ }) => {
72
+ const d = Z[x] || x, m = Z[p] || p;
73
+ return /* @__PURE__ */ e(Ae, { open: a, onOpenChange: u, children: /* @__PURE__ */ s(Pe, { className: "sm:max-w-[425px]", children: [
74
+ /* @__PURE__ */ s(Je, { children: [
75
+ /* @__PURE__ */ e(Ve, { children: "Unsaved SEO Changes" }),
76
+ /* @__PURE__ */ s(Ue, { children: [
77
+ 'You have unsaved changes in the SEO for "',
78
+ d,
79
+ '" version. Do you want to save these changes before switching to "',
80
+ m,
81
+ '" version?'
82
+ ] })
83
+ ] }),
84
+ /* @__PURE__ */ s("div", { className: "flex justify-end gap-3 pt-4", children: [
85
+ /* @__PURE__ */ e(P, { variant: "outline", onClick: i, disabled: r, children: "Discard Changes" }),
86
+ /* @__PURE__ */ e(P, { onClick: c, disabled: r, children: r ? "Saving..." : "Save & Switch" })
87
+ ] })
88
+ ] }) });
89
+ }, We = (a) => {
90
+ if (!a) return !0;
91
+ try {
92
+ return JSON.parse(a), !0;
93
+ } catch {
94
+ return !1;
95
+ }
96
+ }, Qe = (a, u) => {
97
+ const c = a.selectionStart || 0, i = a.selectionEnd || 0, r = a.value, x = r.substring(0, c), p = r.substring(i), d = `{{${u}}}`, m = x + "" + d + p, b = c + 0 + // Account for space before if added
98
+ d.length;
99
+ return {
100
+ value: m,
101
+ newCursorPos: b
102
+ };
103
+ }, Xe = () => {
104
+ const { t: a } = ke(), [, u] = Ee(), { data: c } = we(), { data: i } = Se(), { data: r, isFetching: x } = ze(), p = r == null ? void 0 : r.seo, d = ae(null), [m, b] = j("seo"), J = c == null ? void 0 : c.id, oe = c == null ? void 0 : c.pageType, C = De(oe), { selectedLang: Y, fallbackLang: le } = z(), g = Y || le, [K, U] = j(!1), [re, W] = j(!1), [ie, G] = j(!1), [w, M] = j(null), [n, S] = j({
105
+ keyword: "",
106
+ title: "",
107
+ description: "",
108
+ cononicalUrl: "",
109
+ noIndex: !1,
110
+ noFollow: "",
111
+ ogTitle: "",
112
+ ogDescription: "",
113
+ ogImage: "",
114
+ ogImageId: "",
115
+ searchTitle: "",
116
+ searchDescription: "",
117
+ jsonLD: "{}",
118
+ metaOther: "{}",
119
+ ...p
120
+ }), T = ae({}), { mutate: ce, isPending: B } = be(), f = B || K || re, { hasPermission: de } = Te(), o = de(Oe.EDIT_SEO), [me] = Le(), he = h(me, "features.canResetSeoToDefault", !1), Q = !Y || n.jsonLD !== "{}";
121
+ se(() => {
122
+ if (!x && p && J) {
123
+ const t = {
124
+ keyword: "",
125
+ title: "",
126
+ description: "",
127
+ cononicalUrl: "",
128
+ noIndex: !1,
129
+ noFollow: "",
130
+ ogTitle: "",
131
+ ogDescription: "",
132
+ ogImage: "",
133
+ ogImageId: "",
134
+ searchTitle: "",
135
+ searchDescription: "",
136
+ jsonLD: "",
137
+ metaOther: "",
138
+ ...p
139
+ };
140
+ S(t), T.current[g] = t;
141
+ }
142
+ }, [x, p, g, J]), se(() => {
143
+ const t = (l) => {
144
+ const { fromLang: D, toLang: V, switchHandler: v } = l.detail, $ = T.current[g];
145
+ ($ ? !te($, n) : !1) ? (M({ fromLang: D, toLang: V, switchHandler: v }), G(!0)) : v();
146
+ };
147
+ return window.addEventListener("seo-language-switch-check", t), () => {
148
+ window.removeEventListener("seo-language-switch-check", t);
149
+ };
150
+ }, [J, n, g]);
151
+ const ge = async () => {
152
+ if (!(!C || !g))
153
+ try {
154
+ U(!0);
155
+ const t = _(C, g), l = {
156
+ ...n,
157
+ keyword: h(t, "seo.keyword", ""),
158
+ title: h(t, "seo.title", ""),
159
+ description: h(t, "seo.description", ""),
160
+ cononicalUrl: h(t, "seo.canonicalUrl", ""),
161
+ noIndex: h(t, "seo.noIndex", !1),
162
+ noFollow: h(t, "seo.noFollow", !1),
163
+ ogTitle: h(t, "seo.ogTitle", ""),
164
+ ogDescription: h(t, "seo.ogDescription", "")
165
+ // Keep jsonLD as is
166
+ };
167
+ S(l), O.success(a("SEO fields reset to defaults"));
168
+ } catch (t) {
169
+ O.error(a("Failed to reset SEO fields")), console.error("Reset SEO error:", t);
170
+ } finally {
171
+ U(!1);
172
+ }
173
+ }, ue = async () => {
174
+ if (!(!C || !g))
175
+ try {
176
+ W(!0);
177
+ const t = _(C, g), l = {
178
+ ...n,
179
+ jsonLD: h(t, "seo.jsonLD", "")
180
+ };
181
+ S(l), O.success(a("JSON-LD reset to default"));
182
+ } catch (t) {
183
+ O.error(a("Failed to reset JSON-LD")), console.error("Reset JSON-LD error:", t);
184
+ } finally {
185
+ W(!1);
186
+ }
187
+ }, pe = async () => {
188
+ if (!(!C || !g))
189
+ try {
190
+ U(!0);
191
+ const t = _(C, g), l = {
192
+ ...n,
193
+ ogTitle: h(t, "seo.ogTitle", ""),
194
+ ogDescription: h(t, "seo.ogDescription", ""),
195
+ ogImage: h(t, "seo.ogImage", ""),
196
+ ogImageId: h(t, "seo.ogImageId", ""),
197
+ metaOther: h(t, "seo.metaOther", "{}")
198
+ };
199
+ S(l), O.success(a("Meta Tag fields reset to defaults"));
200
+ } catch (t) {
201
+ O.error(a("Failed to reset Meta Tag fields")), console.error("Reset Meta Tag error:", t);
202
+ } finally {
203
+ U(!1);
204
+ }
205
+ }, X = async () => {
206
+ ce(
207
+ { id: r == null ? void 0 : r.id, seo: n, primaryPage: J },
208
+ {
209
+ onSuccess: () => {
210
+ console.log("SEO & JSON-LD updated successfully", n), T.current[g] = n, O.success("SEO & JSON-LD updated successfully");
211
+ }
212
+ }
213
+ );
214
+ }, L = (t, l) => {
215
+ const D = document.getElementById(l);
216
+ if (D) {
217
+ const { value: V, newCursorPos: v } = Qe(D, t);
218
+ d.current = {
219
+ id: l,
220
+ position: v
221
+ }, D.tagName.toLowerCase() === "input" ? (D.value = V, S((k) => ({
222
+ ...k,
223
+ [D.name]: V
224
+ })), D.focus(), D.setSelectionRange(v, v), [0, 10, 50, 100, 200].forEach((k) => {
225
+ setTimeout(() => {
226
+ const H = document.getElementById(l);
227
+ H && (H.focus(), H.setSelectionRange(v, v));
228
+ }, k);
229
+ })) : (S((I) => ({
230
+ ...I,
231
+ [D.name]: V
232
+ })), requestAnimationFrame(() => {
233
+ const I = document.getElementById(l);
234
+ I && (I.focus(), I.setSelectionRange(v, v), setTimeout(() => {
235
+ const k = document.getElementById(l);
236
+ k && (k.focus(), k.setSelectionRange(v, v));
237
+ }, 50));
238
+ }));
239
+ }
240
+ }, y = (t) => {
241
+ const l = {
242
+ ...n,
243
+ [t.target.name]: t.target.name === "noIndex" || t.target.name === "noFollow" ? t.target.checked : t.target.value
244
+ };
245
+ S(l);
246
+ }, F = (t) => (l) => {
247
+ je(l.fieldValue) || y({
248
+ target: {
249
+ name: t,
250
+ value: typeof l.fieldValue == "string" ? l.fieldValue.replace(/^"(.*)"$/, "$1") : l.fieldValue
251
+ }
252
+ }), l.error && O.error(
253
+ /* @__PURE__ */ s("div", { children: [
254
+ /* @__PURE__ */ e("h2", { children: "Failed to generate:" }),
255
+ /* @__PURE__ */ e("p", { children: l.error })
256
+ ] })
257
+ );
258
+ }, fe = () => {
259
+ const t = h(c, "seo.jsonLD", "{}");
260
+ if ((t == null ? void 0 : t.trim()) === "{}") {
261
+ O.error("Default page JSON-LD is empty");
262
+ return;
263
+ }
264
+ y({ target: { name: "jsonLD", value: t } });
265
+ };
266
+ return /* @__PURE__ */ s("div", { className: "relative flex h-full flex-col", "data-panel-id": "seo", children: [
267
+ !o && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm", children: /* @__PURE__ */ e(Ge, { variant: "default", className: "w-[80%] max-w-md text-xs", children: /* @__PURE__ */ e(Me, { children: a("You don't have permission to edit SEO settings. Contact your administrator for access.") }) }) }),
268
+ /* @__PURE__ */ s("div", { className: "no-scrollbar flex-grow overflow-y-auto px-2 pb-20", children: [
269
+ /* @__PURE__ */ s("div", { className: "mb-4 flex w-full items-center justify-between rounded-md bg-gray-100 px-2 py-1 text-left text-sm", children: [
270
+ /* @__PURE__ */ s("span", { children: [
271
+ /* @__PURE__ */ e("div", { className: "font-medium", children: r == null ? void 0 : r.name }),
272
+ /* @__PURE__ */ e("span", { className: "font-mono text-xs leading-tight text-gray-500", children: r == null ? void 0 : r.slug })
273
+ ] }),
274
+ /* @__PURE__ */ e(Ce, { variant: "outline", showAdd: !1 })
275
+ ] }),
276
+ /* @__PURE__ */ e("form", { className: "space-y-8", children: /* @__PURE__ */ s(Be, { value: m, onValueChange: b, className: "w-full", children: [
277
+ /* @__PURE__ */ s($e, { className: "mb-4 grid w-full grid-cols-3", children: [
278
+ /* @__PURE__ */ e(q, { value: "seo", children: a("SEO") }),
279
+ /* @__PURE__ */ e(q, { value: "opengraph", children: a("Meta Tags") }),
280
+ /* @__PURE__ */ e(q, { value: "jsonld", children: a("JSON-LD") })
281
+ ] }),
282
+ /* @__PURE__ */ e("div", { className: m === "seo" ? "" : "sr-only", children: /* @__PURE__ */ s("div", { className: "space-y-4", children: [
283
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: [
284
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
285
+ /* @__PURE__ */ e(N, { className: "text-xs", htmlFor: "keyword", children: a("Keyword") }),
286
+ o && /* @__PURE__ */ e(
287
+ E,
288
+ {
289
+ dataType: "value",
290
+ data: i ?? {},
291
+ onSelect: (t) => L(t, "keyword")
292
+ }
293
+ )
294
+ ] }),
295
+ /* @__PURE__ */ e(
296
+ R,
297
+ {
298
+ type: "text",
299
+ id: "keyword",
300
+ name: "keyword",
301
+ value: n.keyword,
302
+ onChange: y,
303
+ disabled: f || !o,
304
+ placeholder: a("Enter keyword"),
305
+ readOnly: !o
306
+ }
307
+ )
308
+ ] }),
309
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: [
310
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
311
+ /* @__PURE__ */ e(N, { className: "text-xs", htmlFor: "title", children: a("SEO Title") }),
312
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: [
313
+ /* @__PURE__ */ e(A, { keyword: n.keyword, onComplete: F("title"), field: "title" }),
314
+ o && /* @__PURE__ */ e(
315
+ E,
316
+ {
317
+ dataType: "value",
318
+ data: i ?? {},
319
+ onSelect: (t) => L(t, "title")
320
+ }
321
+ )
322
+ ] })
323
+ ] }),
324
+ /* @__PURE__ */ e(
325
+ R,
326
+ {
327
+ type: "text",
328
+ id: "title",
329
+ name: "title",
330
+ value: n.title,
331
+ onChange: y,
332
+ disabled: f || !o,
333
+ placeholder: a("Enter SEO title"),
334
+ readOnly: !o
335
+ }
336
+ )
337
+ ] }),
338
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: [
339
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
340
+ /* @__PURE__ */ e(N, { className: "text-xs", htmlFor: "description", children: a("SEO Description") }),
341
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
342
+ /* @__PURE__ */ e(
343
+ A,
344
+ {
345
+ keyword: n.keyword,
346
+ onComplete: F("description"),
347
+ field: "description"
348
+ }
349
+ ),
350
+ o && /* @__PURE__ */ e(
351
+ E,
352
+ {
353
+ data: i ?? {},
354
+ onSelect: (t) => L(t, "description")
355
+ }
356
+ )
357
+ ] })
358
+ ] }),
359
+ /* @__PURE__ */ e(
360
+ ne,
361
+ {
362
+ id: "description",
363
+ name: "description",
364
+ rows: 5,
365
+ value: n.description,
366
+ onChange: y,
367
+ disabled: f || !o,
368
+ placeholder: a("Enter SEO description"),
369
+ readOnly: !o
370
+ }
371
+ )
372
+ ] }),
373
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: [
374
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
375
+ /* @__PURE__ */ e(N, { className: "text-xs", htmlFor: "title", children: a("Canonical URL") }),
376
+ o && /* @__PURE__ */ e(
377
+ E,
378
+ {
379
+ dataType: "value",
380
+ data: i ?? {},
381
+ onSelect: (t) => L(t, "canonicalUrl")
382
+ }
383
+ )
384
+ ] }),
385
+ /* @__PURE__ */ e(
386
+ R,
387
+ {
388
+ type: "text",
389
+ id: "canonicalUrl",
390
+ name: "canonicalUrl",
391
+ value: n.canonicalUrl,
392
+ onChange: y,
393
+ disabled: f || !o,
394
+ placeholder: a("Enter Canonical URL"),
395
+ readOnly: !o
396
+ }
397
+ )
398
+ ] }),
399
+ /* @__PURE__ */ s("div", { className: "", children: [
400
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-x-2", children: [
401
+ /* @__PURE__ */ e(
402
+ R,
403
+ {
404
+ type: "checkbox",
405
+ id: "noIndex",
406
+ name: "noIndex",
407
+ checked: n.noIndex,
408
+ onChange: y,
409
+ disabled: f || !o,
410
+ className: "h-4 w-4"
411
+ }
412
+ ),
413
+ /* @__PURE__ */ e(N, { className: "pb-1 text-xs", htmlFor: "noIndex", children: a("No Index") })
414
+ ] }),
415
+ /* @__PURE__ */ e("p", { className: "mt-0 text-[10px] font-light leading-4 text-gray-400", children: a("Check this if you don't want search engines to index this page.") })
416
+ ] }),
417
+ /* @__PURE__ */ s("div", { className: "", children: [
418
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-x-2", children: [
419
+ /* @__PURE__ */ e(
420
+ R,
421
+ {
422
+ type: "checkbox",
423
+ id: "noFollow",
424
+ name: "noFollow",
425
+ checked: n.noFollow,
426
+ onChange: y,
427
+ disabled: f || !o,
428
+ className: "h-4 w-4"
429
+ }
430
+ ),
431
+ /* @__PURE__ */ e(N, { className: "pb-1 text-xs", htmlFor: "noIndex", children: a("No Follow") })
432
+ ] }),
433
+ /* @__PURE__ */ e("p", { className: "text-[10px] font-light leading-4 text-gray-400", children: a("Check this if you don't want search engines to follow links on this page.") })
434
+ ] })
435
+ ] }) }),
436
+ /* @__PURE__ */ e("div", { className: m === "opengraph" ? "" : "sr-only", children: /* @__PURE__ */ e("div", { className: "space-y-4", children: /* @__PURE__ */ s("div", { children: [
437
+ /* @__PURE__ */ e("h3", { className: "mb-4 font-semibold text-slate-700", children: a("Open Graph") }),
438
+ /* @__PURE__ */ s("div", { className: "space-y-4", children: [
439
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: [
440
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
441
+ /* @__PURE__ */ e(N, { className: "text-xs", htmlFor: "ogTitle", children: a("OG Title") }),
442
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
443
+ /* @__PURE__ */ e(
444
+ A,
445
+ {
446
+ keyword: n.keyword,
447
+ onComplete: F("ogTitle"),
448
+ field: "ogTitle"
449
+ }
450
+ ),
451
+ o && /* @__PURE__ */ e(
452
+ E,
453
+ {
454
+ dataType: "value",
455
+ data: i ?? {},
456
+ onSelect: (t) => L(t, "ogTitle")
457
+ }
458
+ )
459
+ ] })
460
+ ] }),
461
+ /* @__PURE__ */ e(
462
+ R,
463
+ {
464
+ type: "text",
465
+ id: "ogTitle",
466
+ name: "ogTitle",
467
+ value: n.ogTitle,
468
+ onChange: y,
469
+ disabled: f || !o,
470
+ placeholder: a("Enter OG title"),
471
+ readOnly: !o
472
+ }
473
+ )
474
+ ] }),
475
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: [
476
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
477
+ /* @__PURE__ */ e(N, { className: "text-xs", htmlFor: "ogDescription", children: a("OG Description") }),
478
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
479
+ /* @__PURE__ */ e(
480
+ A,
481
+ {
482
+ keyword: n.keyword,
483
+ onComplete: F("ogDescription"),
484
+ field: "ogDescription"
485
+ }
486
+ ),
487
+ o && /* @__PURE__ */ e(
488
+ E,
489
+ {
490
+ dataType: "value",
491
+ data: i ?? {},
492
+ onSelect: (t) => L(t, "ogDescription")
493
+ }
494
+ )
495
+ ] })
496
+ ] }),
497
+ /* @__PURE__ */ e(
498
+ ne,
499
+ {
500
+ id: "ogDescription",
501
+ name: "ogDescription",
502
+ rows: 5,
503
+ value: n.ogDescription,
504
+ onChange: y,
505
+ disabled: f || !o,
506
+ placeholder: a("Enter OG description"),
507
+ readOnly: !o
508
+ }
509
+ )
510
+ ] }),
511
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: [
512
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
513
+ /* @__PURE__ */ e(N, { className: "text-xs", htmlFor: "ogImage", children: a("OG Image") }),
514
+ o && /* @__PURE__ */ e(
515
+ E,
516
+ {
517
+ dataType: "value",
518
+ data: i ?? {},
519
+ onSelect: (t) => {
520
+ S({
521
+ ...n,
522
+ ogImage: `{{${t}}}`,
523
+ ogImageId: ""
524
+ });
525
+ }
526
+ }
527
+ )
528
+ ] }),
529
+ /* @__PURE__ */ e(
530
+ Ie,
531
+ {
532
+ assetId: n.ogImageId,
533
+ assetUrl: n.ogImage,
534
+ onChange: (t) => {
535
+ S({
536
+ ...n,
537
+ ogImage: t.url,
538
+ ogImageId: t.id
539
+ });
540
+ },
541
+ disabled: f || !o,
542
+ placeholder: a("Select OG image"),
543
+ className: "mb-2"
544
+ }
545
+ )
546
+ ] }),
547
+ /* @__PURE__ */ s("div", { className: "space-y-1", children: [
548
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
549
+ /* @__PURE__ */ e(N, { className: "text-xs", htmlFor: "metaOther", children: a("Meta Tags") }),
550
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(
551
+ A,
552
+ {
553
+ keyword: n.keyword,
554
+ onComplete: F("metaOther"),
555
+ field: "metaOther"
556
+ }
557
+ ) })
558
+ ] }),
559
+ /* @__PURE__ */ e(
560
+ ee,
561
+ {
562
+ id: "metaOther",
563
+ value: n.metaOther,
564
+ onChange: (t) => {
565
+ y({
566
+ target: { name: "metaOther", value: t }
567
+ });
568
+ },
569
+ placeholder: a("Enter Meta Tags JSON"),
570
+ disabled: f || !o,
571
+ readOnly: !o,
572
+ pageData: i || {},
573
+ rows: 8,
574
+ handleFieldInsert: L
575
+ }
576
+ )
577
+ ] })
578
+ ] })
579
+ ] }) }) }),
580
+ /* @__PURE__ */ e("div", { className: m === "jsonld" ? "" : "sr-only", children: /* @__PURE__ */ e("div", { className: "space-y-4", children: /* @__PURE__ */ s("div", { className: "space-y-1", children: [
581
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
582
+ /* @__PURE__ */ e(N, { className: "text-xs", htmlFor: "jsonLD", children: a("JSON-LD") }),
583
+ Q && /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(A, { keyword: n.keyword, onComplete: F("jsonLD"), field: "jsonLD" }) })
584
+ ] }),
585
+ /* @__PURE__ */ e("div", { className: "hidden", children: JSON.stringify(i) }),
586
+ /* @__PURE__ */ e(
587
+ ee,
588
+ {
589
+ id: "jsonLD",
590
+ value: n.jsonLD,
591
+ onChange: (t) => {
592
+ y({ target: { name: "jsonLD", value: t } });
593
+ },
594
+ placeholder: a("Enter JSON-LD"),
595
+ disabled: f || !o,
596
+ readOnly: !o,
597
+ pageData: i || {},
598
+ rows: 12,
599
+ handleFieldInsert: L,
600
+ hasJsonLdForSelectedLang: Q,
601
+ copyJsonLDFromDefaultPage: fe
602
+ }
603
+ )
604
+ ] }) }) })
605
+ ] }) })
606
+ ] }),
607
+ o && /* @__PURE__ */ s("div", { className: "fixed bottom-0 left-0 right-0 flex w-full flex-shrink-0 items-center justify-between border-t bg-background p-4", children: [
608
+ he ? /* @__PURE__ */ e(
609
+ P,
610
+ {
611
+ type: "button",
612
+ variant: "ghost",
613
+ size: "sm",
614
+ onClick: () => {
615
+ m === "jsonld" ? ue() : m === "opengraph" ? pe() : ge();
616
+ },
617
+ disabled: f || !o || !C,
618
+ children: a(K ? "Resetting..." : `Reset to ${m === "jsonld" ? "Default JSON-LD" : m === "opengraph" ? "Default Open Graph" : "Default SEO"}`)
619
+ }
620
+ ) : /* @__PURE__ */ e("div", {}),
621
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-4", children: [
622
+ /* @__PURE__ */ e(
623
+ P,
624
+ {
625
+ onClick: X,
626
+ disabled: !We(n == null ? void 0 : n.jsonLD) || (T.current[g] ? te(T.current[g], n) : !1) || f || !o,
627
+ children: a(B ? "Saving..." : "Save")
628
+ }
629
+ ),
630
+ /* @__PURE__ */ e(
631
+ P,
632
+ {
633
+ variant: "link",
634
+ className: "text-gray-500 hover:text-gray-700",
635
+ onClick: () => u("outline"),
636
+ children: a("Cancel")
637
+ }
638
+ )
639
+ ] })
640
+ ] }),
641
+ /* @__PURE__ */ e(
642
+ Ke,
643
+ {
644
+ isOpen: ie,
645
+ onClose: () => {
646
+ G(!1), M(null);
647
+ },
648
+ onSave: async () => {
649
+ w && (await X(), w.switchHandler(), G(!1), M(null));
650
+ },
651
+ onDiscard: () => {
652
+ if (w) {
653
+ const t = T.current[g];
654
+ t && S(t), w.switchHandler(), G(!1), M(null);
655
+ }
656
+ },
657
+ isSaving: B,
658
+ fromLanguage: (w == null ? void 0 : w.fromLang) || g,
659
+ toLanguage: (w == null ? void 0 : w.toLang) || ""
660
+ }
661
+ )
662
+ ] });
663
+ };
664
+ Xe.displayName = "SeoPanel";
665
+ export {
666
+ Xe as default
667
+ };