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

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 (156) hide show
  1. package/README.md +35 -52
  2. package/dist/{2SSKDMRQ-CjvuNdPo.cjs → 2SSKDMRQ-BSYe_xPq.cjs} +1 -1
  3. package/dist/{2SSKDMRQ-Dvf9zadl.js → 2SSKDMRQ-Dv-C_YAA.js} +3 -3
  4. package/dist/{AP7HFJJL-DYFttFoI.cjs → AP7HFJJL-BJolKJBt.cjs} +1 -1
  5. package/dist/{AP7HFJJL-q4dJdyFs.js → AP7HFJJL-DhdVstVC.js} +1 -1
  6. package/dist/{IconPicker-Bf163F7t.js → IconPicker-BBkl0T8b.js} +13 -13
  7. package/dist/{IconPicker-JWhYq2Gp.cjs → IconPicker-C0WWlb8t.cjs} +1 -1
  8. package/dist/{WDYDFRGG-O9GIrtX0.js → WDYDFRGG-CJs2MxSq.js} +4 -4
  9. package/dist/{WDYDFRGG-BEksfGMC.cjs → WDYDFRGG-DRt6Zg7Q.cjs} +1 -1
  10. package/dist/{actions-registery-BHbZHkE3.cjs → actions-registery-CLL3KrNv.cjs} +2 -2
  11. package/dist/{actions-registery-gJb_wq2F.js → actions-registery-CrGIlqUX.js} +88 -88
  12. package/dist/actions.cjs +1 -1
  13. package/dist/actions.js +2 -2
  14. package/dist/{add-new-language-page-BfUp5Ua2.cjs → add-new-language-page-ByMSfRcN.cjs} +1 -1
  15. package/dist/{add-new-language-page-CRR93tLq.js → add-new-language-page-DtVoDNfI.js} +35 -35
  16. package/dist/{add-new-page-B8NGK6WS.cjs → add-new-page-CnuChfJz.cjs} +1 -1
  17. package/dist/add-new-page-DanzzvYo.js +31 -0
  18. package/dist/{ai-panel-default-lang-BXYQye3N.js → ai-panel-default-lang-BaPz2d_6.js} +35 -35
  19. package/dist/{ai-panel-default-lang-VhgmHFoQ.cjs → ai-panel-default-lang-CoIQSz_Y.cjs} +2 -2
  20. package/dist/{ai-panel-other-lang-DaCf-cq4.js → ai-panel-other-lang--i-5z4e2.js} +22 -22
  21. package/dist/{ai-panel-other-lang-Ds0EXeUC.cjs → ai-panel-other-lang-ChlMVodg.cjs} +1 -1
  22. package/dist/{ai-prompt-input-7iWk72w5.js → ai-prompt-input-BQi0VDJC.js} +77 -77
  23. package/dist/{ai-prompt-input-nZ5_Dm7X.cjs → ai-prompt-input-BT5426AB.cjs} +1 -1
  24. package/dist/{ai-translation-prompt-1OUs1P7n.js → ai-translation-prompt-BN78s33t.js} +8 -8
  25. package/dist/{ai-translation-prompt-B16cK-1Q.cjs → ai-translation-prompt-BQPaekp3.cjs} +1 -1
  26. package/dist/{apply-binding-CBSjMYSk.cjs → apply-binding-Cjh1kqMO.cjs} +1 -1
  27. package/dist/{apply-binding-vAuN-TGV.js → apply-binding-v_W4uR3U.js} +28 -28
  28. package/dist/{plugin-BSjgGgwo.js → chai-theme-helpers-BEf2rwE4.js} +83 -83
  29. package/dist/chai-theme-helpers-q3nwoNht.cjs +22 -0
  30. package/dist/{change-password-modal-D5eXjiYq.cjs → change-password-modal-DHUrrKw7.cjs} +1 -1
  31. package/dist/{change-password-modal-CdvJR1Ln.js → change-password-modal-pEp-nMNb.js} +30 -30
  32. package/dist/{code-display-DdWcOQ_i.js → code-display-BaLKScgW.js} +5 -5
  33. package/dist/{code-display-BR-gij5j.cjs → code-display-i7jb2kmw.cjs} +1 -1
  34. package/dist/{code-editor-CyLjDiEp.js → code-editor-CRoniyP0.js} +12 -12
  35. package/dist/{code-editor-SWbfFj1E.cjs → code-editor-gwFRjQ2_.cjs} +1 -1
  36. package/dist/core.cjs +1 -1
  37. package/dist/core.d.ts +0 -5
  38. package/dist/core.js +49 -49
  39. package/dist/{css-import-modal-Be47CBJn.js → css-import-modal-B3qxX9Iv.js} +14 -14
  40. package/dist/{css-import-modal-Bdwgd05S.cjs → css-import-modal-nAB5FSwn.cjs} +2 -2
  41. package/dist/{delete-page-C99K2qzS.js → delete-page-DbawNFf7.js} +13 -13
  42. package/dist/{delete-page-DLohaU-U.cjs → delete-page-YP1HEAoD.cjs} +1 -1
  43. package/dist/{digital-asset-manager-BZMb6sC7.js → digital-asset-manager-DTD5mf24.js} +388 -357
  44. package/dist/digital-asset-manager-kJnuMqpw.cjs +1 -0
  45. package/dist/{duplicate-page-D5Gtvqdv.cjs → duplicate-page-CxqW_EO7.cjs} +1 -1
  46. package/dist/{duplicate-page-CDc2X0eW.js → duplicate-page-DnRb1y6K.js} +19 -19
  47. package/dist/{dynamic-page-selector-DZHhX008.cjs → dynamic-page-selector-2EqJhUrB.cjs} +1 -1
  48. package/dist/{dynamic-page-selector-DvNBXo6o.js → dynamic-page-selector-D6VLDIN9.js} +17 -17
  49. package/dist/{get-chai-builder-tailwind-config-7CxFxEYL.cjs → get-chai-builder-tailwind-config-DNp8Vhme.cjs} +1 -1
  50. package/dist/{get-chai-builder-tailwind-config-DC4sDOYK.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +3 -3
  51. package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-DLpviqPJ.js} +1 -1
  52. package/dist/get-chai-builder-theme-Du4ARJlw.cjs +1 -0
  53. package/dist/{image-editor-DwhTYkVR.cjs → image-editor-BQcOGsli.cjs} +1 -1
  54. package/dist/{image-editor-BBvvi9Vm.js → image-editor-CMf731xL.js} +15 -15
  55. package/dist/index-BYrRPW_c.cjs +5 -0
  56. package/dist/index-D-r_K4yA.cjs +160 -0
  57. package/dist/{index-OuHV9Ann.js → index-DPV6NiJ-.js} +5894 -6049
  58. package/dist/index-DqzFD1CG.js +4861 -0
  59. package/dist/{mark-as-template-CP_F9ZQ4.js → mark-as-template-D7jqSCXw.js} +28 -28
  60. package/dist/{mark-as-template-B9yLcasI.cjs → mark-as-template-DyB56HzI.cjs} +1 -1
  61. package/dist/{nested-path-selector-content-DmtCI3q9.js → nested-path-selector-content-dwSikrsV.js} +2 -2
  62. package/dist/{nested-path-selector-content-aTdu-o0e.cjs → nested-path-selector-content-g9_Tq_sR.cjs} +1 -1
  63. package/dist/no-language-page-content-BRITuyfN.js +43 -0
  64. package/dist/{no-language-page-content-C-MCdPXt.cjs → no-language-page-content-ZvMNVY-Y.cjs} +1 -1
  65. package/dist/{no-language-page-dialog-D4QIAHnE.cjs → no-language-page-dialog-Cndq8xRP.cjs} +1 -1
  66. package/dist/no-language-page-dialog-D7L9nVb9.js +10 -0
  67. package/dist/page-creator-BAIbU14q.js +652 -0
  68. package/dist/page-creator-qL3-M8g3.cjs +1 -0
  69. package/dist/{page-manager-new-ah6QYar2.cjs → page-manager-new-By3eGO3i.cjs} +1 -1
  70. package/dist/{page-manager-new-ttsrxdW9.js → page-manager-new-YRG89y4f.js} +63 -63
  71. package/dist/page-manager-search-and-filter-BbdgOU9V.cjs +1 -0
  72. package/dist/page-manager-search-and-filter-Cllju4CV.js +184 -0
  73. package/dist/pages.cjs +1 -1
  74. package/dist/pages.d.ts +0 -15
  75. package/dist/pages.js +20 -21
  76. package/dist/{publish-pages-content-KZVMHT6V.js → publish-pages-content-CG5LBUnY.js} +48 -48
  77. package/dist/{publish-pages-content-BrajJUcP.cjs → publish-pages-content-DxMiBxNU.cjs} +1 -1
  78. package/dist/{register-chai-top-bar-DyW9GPzV.cjs → register-chai-top-bar-CCssW5dL.cjs} +1 -1
  79. package/dist/{register-chai-top-bar-D6GjnauV.js → register-chai-top-bar-DWmJ2efT.js} +11 -11
  80. package/dist/render.cjs +1 -1
  81. package/dist/render.js +54 -54
  82. package/dist/{rte-widget-modal-CiTwsXTr.cjs → rte-widget-modal-CsTqFJc_.cjs} +1 -1
  83. package/dist/{rte-widget-modal-IU8JzPuZ.js → rte-widget-modal-DoeTMRtX.js} +2 -2
  84. package/dist/runtime-client.cjs +1 -1
  85. package/dist/runtime-client.js +1 -1
  86. package/dist/runtime.cjs +1 -1
  87. package/dist/runtime.js +1 -1
  88. package/dist/sdk.css +1 -1
  89. package/dist/{selected-block-display-CidmQ-wz.js → selected-block-display-Ck1kkNEi.js} +17 -28
  90. package/dist/{selected-block-display-CAFEOrLV.cjs → selected-block-display-DSow6N4b.cjs} +1 -1
  91. package/dist/seo-panel---mYZmLD.js +559 -0
  92. package/dist/seo-panel-mfX63fua.cjs +1 -0
  93. package/dist/{shared-json-ld-uvMmwCYp.js → shared-json-ld-B3I_RLE2.js} +46 -46
  94. package/dist/{shared-json-ld-CMH-eRUq.cjs → shared-json-ld-CGgwUOlW.cjs} +1 -1
  95. package/dist/{slug-input-DLWTMTsO.js → slug-input-DQ4t3-Tt.js} +5 -5
  96. package/dist/{slug-input-CiHC5l3r.cjs → slug-input-DaNbl597.cjs} +1 -1
  97. package/dist/supabase-actions.cjs +1 -1
  98. package/dist/supabase-actions.js +2 -2
  99. package/dist/types.d.ts +0 -96
  100. package/dist/{unmark-as-template-F7TdgWjI.cjs → unmark-as-template-CZ65AE4v.cjs} +1 -1
  101. package/dist/{unmark-as-template-C5ovsEBP.js → unmark-as-template-DvmoTbVu.js} +11 -11
  102. package/dist/unpublish-page-3--vO5b0.js +28 -0
  103. package/dist/{unpublish-page-CUr8Xub6.cjs → unpublish-page-B46TiWlU.cjs} +1 -1
  104. package/dist/{unpublished-partials-modal-BhNAub_z.js → unpublished-partials-modal-DVMz3q83.js} +18 -15
  105. package/dist/{unpublished-partials-modal-Cv5R9-hi.cjs → unpublished-partials-modal-U5lKBOSR.cjs} +1 -1
  106. package/dist/utils.cjs +1 -1
  107. package/dist/utils.js +2 -2
  108. package/dist/web-blocks.cjs +1 -1
  109. package/dist/web-blocks.js +2 -2
  110. package/dist/{web-preview-D9pXonAv.js → web-preview-D5o5XQo0.js} +2 -2
  111. package/dist/{web-preview-CuMYekVJ.cjs → web-preview-Da3RhcjQ.cjs} +1 -1
  112. package/package.json +1 -1
  113. package/dist/active-in-another-tab-B4Ur0JP7.js +0 -35
  114. package/dist/active-in-another-tab-BPdx4lWh.cjs +0 -1
  115. package/dist/add-new-page-Ppy5-y5j.js +0 -31
  116. package/dist/continue-editing-in-this-client-BrSvK-Ay.js +0 -25
  117. package/dist/continue-editing-in-this-client-Cmi-GkYZ.cjs +0 -1
  118. package/dist/design-token-usage-D1lWCJ3L.js +0 -114
  119. package/dist/design-token-usage-eY2wQ0l3.cjs +0 -1
  120. package/dist/digital-asset-manager-Z5aJxkq0.cjs +0 -1
  121. package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
  122. package/dist/image-compression-DPFITwOL.js +0 -37
  123. package/dist/image-compression-UaU7Bwqe.cjs +0 -1
  124. package/dist/index-BVwFJWDq.cjs +0 -5
  125. package/dist/index-DCJDQs1a.cjs +0 -160
  126. package/dist/index-LBTm1Jmk.js +0 -5199
  127. package/dist/json-diff-viewer-Cb1CmRqP.cjs +0 -8
  128. package/dist/json-diff-viewer-DG6qMOBS.js +0 -261
  129. package/dist/lang-panel-B3USOxGq.js +0 -216
  130. package/dist/lang-panel-DxoJ0v4y.cjs +0 -1
  131. package/dist/manage-design-tokens-6YGIctip.js +0 -446
  132. package/dist/manage-design-tokens-modal-BSSCXH8Y.cjs +0 -1
  133. package/dist/manage-design-tokens-modal-CzsnN49F.js +0 -161
  134. package/dist/manage-design-tokens-udLBvkHA.cjs +0 -1
  135. package/dist/no-language-page-content-D8t5dfgh.js +0 -43
  136. package/dist/no-language-page-dialog-C_fHI2zI.js +0 -10
  137. package/dist/page-creator-Cz_ah-qE.cjs +0 -1
  138. package/dist/page-creator-DKEkuGCO.js +0 -796
  139. package/dist/page-lock-CwZKJ4IE.js +0 -30
  140. package/dist/page-lock-DdCvtA-I.cjs +0 -1
  141. package/dist/page-locked-dialog-CrTDBoC4.cjs +0 -1
  142. package/dist/page-locked-dialog-DqLlooUz.js +0 -136
  143. package/dist/page-manager-search-and-filter-D7AupT6_.cjs +0 -1
  144. package/dist/page-manager-search-and-filter-bsqZ6wnI.js +0 -210
  145. package/dist/page-revisions-content-B6hsIla7.cjs +0 -1
  146. package/dist/page-revisions-content-C5O8_Fms.js +0 -459
  147. package/dist/plugin-DHpuZZXz.cjs +0 -22
  148. package/dist/save-to-lib-DMnv7ENo.js +0 -429
  149. package/dist/save-to-lib-Dc700Aop.cjs +0 -1
  150. package/dist/seo-panel-Br8gxDxu.js +0 -789
  151. package/dist/seo-panel-CMY-adM-.cjs +0 -2
  152. package/dist/take-over-request-IRLgF1dG.cjs +0 -1
  153. package/dist/take-over-request-KdR1_h_K.js +0 -64
  154. package/dist/translation-warning-modal-CLZ9tC1F.cjs +0 -1
  155. package/dist/translation-warning-modal-CzNt6LDO.js +0 -27
  156. package/dist/unpublish-page-0fR1o0b7.js +0 -28
@@ -0,0 +1,559 @@
1
+ import { jsx as s, jsxs as a } from "react/jsx-runtime";
2
+ import { find as fe, get as r, isEqual as Z } from "lodash-es";
3
+ import { useMemo as pe, useRef as Q, useState as C, useEffect as W } from "react";
4
+ import { useTranslation as ye } from "react-i18next";
5
+ import { toast as D } from "sonner";
6
+ import { B as R, D as xe, E as ve, z as j } from "./register-chai-top-bar-DWmJ2efT.js";
7
+ import { d as te, D as Ne, e as we, f as Se, g as De, o as Oe, n as be, Y as Le, Z as Ie, _ as Te, $ as H, p, T as X } from "./index-DPV6NiJ-.js";
8
+ import { g as Ee, L as ee, aq as Fe, ar as Ce, as as je, d as ke, at as Re, au as Je, av as T, aw as Pe, ax as se } from "./index-DqzFD1CG.js";
9
+ import { g as $ } from "./get-seo-defaults-9zHebckY.js";
10
+ const Ue = () => {
11
+ const { selectedLang: t } = te(), { data: w, isFetching: m } = Ee();
12
+ return { data: pe(() => fe(w, { lang: t || "" }) || {}, [w, t]), isFetching: m };
13
+ }, Ve = ({
14
+ isOpen: t,
15
+ onClose: w,
16
+ onSave: m,
17
+ onDiscard: c,
18
+ isSaving: o = !1,
19
+ fromLanguage: O,
20
+ toLanguage: N
21
+ }) => {
22
+ const E = ee[O] || O, g = ee[N] || N;
23
+ return /* @__PURE__ */ s(Ne, { open: t, onOpenChange: w, children: /* @__PURE__ */ a(we, { className: "sm:max-w-[425px]", children: [
24
+ /* @__PURE__ */ a(Se, { children: [
25
+ /* @__PURE__ */ s(De, { children: "Unsaved SEO Changes" }),
26
+ /* @__PURE__ */ a(Oe, { children: [
27
+ 'You have unsaved changes in the SEO for "',
28
+ E,
29
+ '" version. Do you want to save these changes before switching to "',
30
+ g,
31
+ '" version?'
32
+ ] })
33
+ ] }),
34
+ /* @__PURE__ */ a("div", { className: "flex justify-end gap-3 pt-4", children: [
35
+ /* @__PURE__ */ s(R, { variant: "outline", onClick: c, disabled: o, children: "Discard Changes" }),
36
+ /* @__PURE__ */ s(R, { onClick: m, disabled: o, children: o ? "Saving..." : "Save & Switch" })
37
+ ] })
38
+ ] }) });
39
+ }, Ge = (t) => {
40
+ if (!t) return !0;
41
+ try {
42
+ return JSON.parse(t), !0;
43
+ } catch {
44
+ return !1;
45
+ }
46
+ }, Ae = (t, w) => {
47
+ const m = t.selectionStart || 0, c = t.selectionEnd || 0, o = t.value, O = o.substring(0, m), N = o.substring(c), E = `{{${w}}}`, g = O + "" + E + N, G = m + 0 + // Account for space before if added
48
+ E.length;
49
+ return {
50
+ value: g,
51
+ newCursorPos: G
52
+ };
53
+ }, Be = () => {
54
+ const { t } = ye(), [, w] = be(), { data: m } = Fe(), { data: c } = Ce(), { data: o, isFetching: O } = Ue(), N = o == null ? void 0 : o.seo, E = Q(null), [g, G] = C("seo"), J = m == null ? void 0 : m.id, ae = m == null ? void 0 : m.pageType, b = je(ae), { selectedLang: q, fallbackLang: ne } = te(), d = q || ne, [z, P] = C(!1), [le, Y] = C(!1), [oe, U] = C(!1), [y, V] = C(null), [l, x] = C({
55
+ keyword: "",
56
+ title: "",
57
+ description: "",
58
+ cononicalUrl: "",
59
+ noIndex: !1,
60
+ noFollow: "",
61
+ ogTitle: "",
62
+ ogDescription: "",
63
+ ogImage: "",
64
+ ogImageId: "",
65
+ searchTitle: "",
66
+ searchDescription: "",
67
+ jsonLD: "{}",
68
+ metaOther: "{}",
69
+ ...N
70
+ }), F = Q({}), { mutate: ie, isPending: A } = ke(), h = A || z || le, { hasPermission: re } = Le(), n = re(Re.EDIT_SEO), [ce] = Je(), de = r(ce, "flags.resetSeoToDefault", !1), _ = !q || l.jsonLD !== "{}";
71
+ W(() => {
72
+ if (!O && N && J) {
73
+ const e = {
74
+ keyword: "",
75
+ title: "",
76
+ description: "",
77
+ cononicalUrl: "",
78
+ noIndex: !1,
79
+ noFollow: "",
80
+ ogTitle: "",
81
+ ogDescription: "",
82
+ ogImage: "",
83
+ ogImageId: "",
84
+ searchTitle: "",
85
+ searchDescription: "",
86
+ jsonLD: "",
87
+ metaOther: "",
88
+ ...N
89
+ };
90
+ x(e), F.current[d] = e;
91
+ }
92
+ }, [O, N, d, J]), W(() => {
93
+ const e = (i) => {
94
+ const { fromLang: v, toLang: k, switchHandler: u } = i.detail, B = F.current[d];
95
+ (B ? !Z(B, l) : !1) ? (V({ fromLang: v, toLang: k, switchHandler: u }), U(!0)) : u();
96
+ };
97
+ return window.addEventListener("seo-language-switch-check", e), () => {
98
+ window.removeEventListener("seo-language-switch-check", e);
99
+ };
100
+ }, [J, l, d]);
101
+ const me = async () => {
102
+ if (!(!b || !d))
103
+ try {
104
+ P(!0);
105
+ const e = $(b, d), i = {
106
+ ...l,
107
+ keyword: r(e, "seo.keyword", ""),
108
+ title: r(e, "seo.title", ""),
109
+ description: r(e, "seo.description", ""),
110
+ cononicalUrl: r(e, "seo.canonicalUrl", ""),
111
+ noIndex: r(e, "seo.noIndex", !1),
112
+ noFollow: r(e, "seo.noFollow", !1),
113
+ ogTitle: r(e, "seo.ogTitle", ""),
114
+ ogDescription: r(e, "seo.ogDescription", "")
115
+ // Keep jsonLD as is
116
+ };
117
+ x(i), D.success(t("SEO fields reset to defaults"));
118
+ } catch (e) {
119
+ D.error(t("Failed to reset SEO fields")), console.error("Reset SEO error:", e);
120
+ } finally {
121
+ P(!1);
122
+ }
123
+ }, he = async () => {
124
+ if (!(!b || !d))
125
+ try {
126
+ Y(!0);
127
+ const e = $(b, d), i = {
128
+ ...l,
129
+ jsonLD: r(e, "seo.jsonLD", "")
130
+ };
131
+ x(i), D.success(t("JSON-LD reset to default"));
132
+ } catch (e) {
133
+ D.error(t("Failed to reset JSON-LD")), console.error("Reset JSON-LD error:", e);
134
+ } finally {
135
+ Y(!1);
136
+ }
137
+ }, ge = async () => {
138
+ if (!(!b || !d))
139
+ try {
140
+ P(!0);
141
+ const e = $(b, d), i = {
142
+ ...l,
143
+ ogTitle: r(e, "seo.ogTitle", ""),
144
+ ogDescription: r(e, "seo.ogDescription", ""),
145
+ ogImage: r(e, "seo.ogImage", ""),
146
+ ogImageId: r(e, "seo.ogImageId", ""),
147
+ metaOther: r(e, "seo.metaOther", "{}")
148
+ };
149
+ x(i), D.success(t("Meta Tag fields reset to defaults"));
150
+ } catch (e) {
151
+ D.error(t("Failed to reset Meta Tag fields")), console.error("Reset Meta Tag error:", e);
152
+ } finally {
153
+ P(!1);
154
+ }
155
+ }, K = async () => {
156
+ ie(
157
+ { id: o == null ? void 0 : o.id, seo: l, primaryPage: J },
158
+ {
159
+ onSuccess: () => {
160
+ console.log("SEO & JSON-LD updated successfully", l), F.current[d] = l, D.success("SEO & JSON-LD updated successfully");
161
+ }
162
+ }
163
+ );
164
+ }, S = (e, i) => {
165
+ const v = document.getElementById(i);
166
+ if (v) {
167
+ const { value: k, newCursorPos: u } = Ae(v, e);
168
+ E.current = {
169
+ id: i,
170
+ position: u
171
+ }, v.tagName.toLowerCase() === "input" ? (v.value = k, x((I) => ({
172
+ ...I,
173
+ [v.name]: k
174
+ })), v.focus(), v.setSelectionRange(u, u), [0, 10, 50, 100, 200].forEach((I) => {
175
+ setTimeout(() => {
176
+ const M = document.getElementById(i);
177
+ M && (M.focus(), M.setSelectionRange(u, u));
178
+ }, I);
179
+ })) : (x((L) => ({
180
+ ...L,
181
+ [v.name]: k
182
+ })), requestAnimationFrame(() => {
183
+ const L = document.getElementById(i);
184
+ L && (L.focus(), L.setSelectionRange(u, u), setTimeout(() => {
185
+ const I = document.getElementById(i);
186
+ I && (I.focus(), I.setSelectionRange(u, u));
187
+ }, 50));
188
+ }));
189
+ }
190
+ }, f = (e) => {
191
+ const i = {
192
+ ...l,
193
+ [e.target.name]: e.target.name === "noIndex" || e.target.name === "noFollow" ? e.target.checked : e.target.value
194
+ };
195
+ x(i);
196
+ }, ue = () => {
197
+ const e = r(m, "seo.jsonLD", "{}");
198
+ if ((e == null ? void 0 : e.trim()) === "{}") {
199
+ D.error("Default page JSON-LD is empty");
200
+ return;
201
+ }
202
+ f({ target: { name: "jsonLD", value: e } });
203
+ };
204
+ return /* @__PURE__ */ a("div", { className: "relative flex h-full flex-col", "data-panel-id": "seo", children: [
205
+ !n && /* @__PURE__ */ s("div", { className: "absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm", children: /* @__PURE__ */ s(xe, { variant: "default", className: "w-[80%] max-w-md text-xs", children: /* @__PURE__ */ s(ve, { children: t("You don't have permission to edit SEO settings. Contact your administrator for access.") }) }) }),
206
+ /* @__PURE__ */ a("div", { className: "no-scrollbar flex-grow overflow-y-auto px-2 pb-20", children: [
207
+ /* @__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: /* @__PURE__ */ a("span", { children: [
208
+ /* @__PURE__ */ s("div", { className: "font-medium", children: o == null ? void 0 : o.name }),
209
+ /* @__PURE__ */ s("span", { className: "font-mono text-xs leading-tight text-gray-500", children: o == null ? void 0 : o.slug })
210
+ ] }) }),
211
+ /* @__PURE__ */ s("form", { className: "space-y-8", children: /* @__PURE__ */ a(Ie, { value: g, onValueChange: G, className: "w-full", children: [
212
+ /* @__PURE__ */ a(Te, { className: "mb-4 grid w-full grid-cols-3", children: [
213
+ /* @__PURE__ */ s(H, { value: "seo", children: t("SEO") }),
214
+ /* @__PURE__ */ s(H, { value: "opengraph", children: t("Meta Tags") }),
215
+ /* @__PURE__ */ s(H, { value: "jsonld", children: t("JSON-LD") })
216
+ ] }),
217
+ /* @__PURE__ */ s("div", { className: g === "seo" ? "" : "sr-only", children: /* @__PURE__ */ a("div", { className: "space-y-4", children: [
218
+ /* @__PURE__ */ a("div", { className: "space-y-1", children: [
219
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
220
+ /* @__PURE__ */ s(p, { className: "text-xs", htmlFor: "keyword", children: t("Keyword") }),
221
+ n && /* @__PURE__ */ s(
222
+ T,
223
+ {
224
+ dataType: "value",
225
+ data: c ?? {},
226
+ onSelect: (e) => S(e, "keyword")
227
+ }
228
+ )
229
+ ] }),
230
+ /* @__PURE__ */ s(
231
+ j,
232
+ {
233
+ type: "text",
234
+ id: "keyword",
235
+ name: "keyword",
236
+ value: l.keyword,
237
+ onChange: f,
238
+ disabled: h || !n,
239
+ placeholder: t("Enter keyword"),
240
+ readOnly: !n
241
+ }
242
+ )
243
+ ] }),
244
+ /* @__PURE__ */ a("div", { className: "space-y-1", children: [
245
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
246
+ /* @__PURE__ */ s(p, { className: "text-xs", htmlFor: "title", children: t("SEO Title") }),
247
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-end gap-2", children: n && /* @__PURE__ */ s(
248
+ T,
249
+ {
250
+ dataType: "value",
251
+ data: c ?? {},
252
+ onSelect: (e) => S(e, "title")
253
+ }
254
+ ) })
255
+ ] }),
256
+ /* @__PURE__ */ s(
257
+ j,
258
+ {
259
+ type: "text",
260
+ id: "title",
261
+ name: "title",
262
+ value: l.title,
263
+ onChange: f,
264
+ disabled: h || !n,
265
+ placeholder: t("Enter SEO title"),
266
+ readOnly: !n
267
+ }
268
+ )
269
+ ] }),
270
+ /* @__PURE__ */ a("div", { className: "space-y-1", children: [
271
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
272
+ /* @__PURE__ */ s(p, { className: "text-xs", htmlFor: "description", children: t("SEO Description") }),
273
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: n && /* @__PURE__ */ s(
274
+ T,
275
+ {
276
+ data: c ?? {},
277
+ onSelect: (e) => S(e, "description")
278
+ }
279
+ ) })
280
+ ] }),
281
+ /* @__PURE__ */ s(
282
+ X,
283
+ {
284
+ id: "description",
285
+ name: "description",
286
+ rows: 5,
287
+ value: l.description,
288
+ onChange: f,
289
+ disabled: h || !n,
290
+ placeholder: t("Enter SEO description"),
291
+ readOnly: !n
292
+ }
293
+ )
294
+ ] }),
295
+ /* @__PURE__ */ a("div", { className: "space-y-1", children: [
296
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
297
+ /* @__PURE__ */ s(p, { className: "text-xs", htmlFor: "title", children: t("Canonical URL") }),
298
+ n && /* @__PURE__ */ s(
299
+ T,
300
+ {
301
+ dataType: "value",
302
+ data: c ?? {},
303
+ onSelect: (e) => S(e, "canonicalUrl")
304
+ }
305
+ )
306
+ ] }),
307
+ /* @__PURE__ */ s(
308
+ j,
309
+ {
310
+ type: "text",
311
+ id: "canonicalUrl",
312
+ name: "canonicalUrl",
313
+ value: l.canonicalUrl,
314
+ onChange: f,
315
+ disabled: h || !n,
316
+ placeholder: t("Enter Canonical URL"),
317
+ readOnly: !n
318
+ }
319
+ )
320
+ ] }),
321
+ /* @__PURE__ */ a("div", { className: "", children: [
322
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-x-2", children: [
323
+ /* @__PURE__ */ s(
324
+ j,
325
+ {
326
+ type: "checkbox",
327
+ id: "noIndex",
328
+ name: "noIndex",
329
+ checked: l.noIndex,
330
+ onChange: f,
331
+ disabled: h || !n,
332
+ className: "h-4 w-4"
333
+ }
334
+ ),
335
+ /* @__PURE__ */ s(p, { className: "pb-1 text-xs", htmlFor: "noIndex", children: t("No Index") })
336
+ ] }),
337
+ /* @__PURE__ */ s("p", { className: "mt-0 text-[10px] font-light leading-4 text-gray-400", children: t("Check this if you don't want search engines to index this page.") })
338
+ ] }),
339
+ /* @__PURE__ */ a("div", { className: "", children: [
340
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-x-2", children: [
341
+ /* @__PURE__ */ s(
342
+ j,
343
+ {
344
+ type: "checkbox",
345
+ id: "noFollow",
346
+ name: "noFollow",
347
+ checked: l.noFollow,
348
+ onChange: f,
349
+ disabled: h || !n,
350
+ className: "h-4 w-4"
351
+ }
352
+ ),
353
+ /* @__PURE__ */ s(p, { className: "pb-1 text-xs", htmlFor: "noIndex", children: t("No Follow") })
354
+ ] }),
355
+ /* @__PURE__ */ s("p", { className: "text-[10px] font-light leading-4 text-gray-400", children: t("Check this if you don't want search engines to follow links on this page.") })
356
+ ] })
357
+ ] }) }),
358
+ /* @__PURE__ */ s("div", { className: g === "opengraph" ? "" : "sr-only", children: /* @__PURE__ */ s("div", { className: "space-y-4", children: /* @__PURE__ */ a("div", { children: [
359
+ /* @__PURE__ */ s("h3", { className: "mb-4 font-semibold text-slate-700", children: t("Open Graph") }),
360
+ /* @__PURE__ */ a("div", { className: "space-y-4", children: [
361
+ /* @__PURE__ */ a("div", { className: "space-y-1", children: [
362
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
363
+ /* @__PURE__ */ s(p, { className: "text-xs", htmlFor: "ogTitle", children: t("OG Title") }),
364
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: n && /* @__PURE__ */ s(
365
+ T,
366
+ {
367
+ dataType: "value",
368
+ data: c ?? {},
369
+ onSelect: (e) => S(e, "ogTitle")
370
+ }
371
+ ) })
372
+ ] }),
373
+ /* @__PURE__ */ s(
374
+ j,
375
+ {
376
+ type: "text",
377
+ id: "ogTitle",
378
+ name: "ogTitle",
379
+ value: l.ogTitle,
380
+ onChange: f,
381
+ disabled: h || !n,
382
+ placeholder: t("Enter OG title"),
383
+ readOnly: !n
384
+ }
385
+ )
386
+ ] }),
387
+ /* @__PURE__ */ a("div", { className: "space-y-1", children: [
388
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
389
+ /* @__PURE__ */ s(p, { className: "text-xs", htmlFor: "ogDescription", children: t("OG Description") }),
390
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: n && /* @__PURE__ */ s(
391
+ T,
392
+ {
393
+ dataType: "value",
394
+ data: c ?? {},
395
+ onSelect: (e) => S(e, "ogDescription")
396
+ }
397
+ ) })
398
+ ] }),
399
+ /* @__PURE__ */ s(
400
+ X,
401
+ {
402
+ id: "ogDescription",
403
+ name: "ogDescription",
404
+ rows: 5,
405
+ value: l.ogDescription,
406
+ onChange: f,
407
+ disabled: h || !n,
408
+ placeholder: t("Enter OG description"),
409
+ readOnly: !n
410
+ }
411
+ )
412
+ ] }),
413
+ /* @__PURE__ */ a("div", { className: "space-y-1", children: [
414
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
415
+ /* @__PURE__ */ s(p, { className: "text-xs", htmlFor: "ogImage", children: t("OG Image") }),
416
+ n && /* @__PURE__ */ s(
417
+ T,
418
+ {
419
+ dataType: "value",
420
+ data: c ?? {},
421
+ onSelect: (e) => {
422
+ x({
423
+ ...l,
424
+ ogImage: `{{${e}}}`,
425
+ ogImageId: ""
426
+ });
427
+ }
428
+ }
429
+ )
430
+ ] }),
431
+ /* @__PURE__ */ s(
432
+ Pe,
433
+ {
434
+ assetId: l.ogImageId,
435
+ assetUrl: l.ogImage,
436
+ onChange: (e) => {
437
+ x({
438
+ ...l,
439
+ ogImage: e.url,
440
+ ogImageId: e.id
441
+ });
442
+ },
443
+ disabled: h || !n,
444
+ placeholder: t("Select OG image"),
445
+ className: "mb-2"
446
+ }
447
+ )
448
+ ] }),
449
+ /* @__PURE__ */ a("div", { className: "space-y-1", children: [
450
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ s(p, { className: "text-xs", htmlFor: "metaOther", children: t("Meta Tags") }) }),
451
+ /* @__PURE__ */ s(
452
+ se,
453
+ {
454
+ id: "metaOther",
455
+ value: l.metaOther,
456
+ onChange: (e) => {
457
+ f({
458
+ target: { name: "metaOther", value: e }
459
+ });
460
+ },
461
+ placeholder: t("Enter Meta Tags JSON"),
462
+ disabled: h || !n,
463
+ readOnly: !n,
464
+ pageData: c || {},
465
+ rows: 8,
466
+ handleFieldInsert: S
467
+ }
468
+ )
469
+ ] })
470
+ ] })
471
+ ] }) }) }),
472
+ /* @__PURE__ */ s("div", { className: g === "jsonld" ? "" : "sr-only", children: /* @__PURE__ */ s("div", { className: "space-y-4", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: [
473
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
474
+ /* @__PURE__ */ s(p, { className: "text-xs", htmlFor: "jsonLD", children: t("JSON-LD") }),
475
+ _ && /* @__PURE__ */ s("div", { className: "flex items-center gap-2" })
476
+ ] }),
477
+ /* @__PURE__ */ s("div", { className: "hidden", children: JSON.stringify(c) }),
478
+ /* @__PURE__ */ s(
479
+ se,
480
+ {
481
+ id: "jsonLD",
482
+ value: l.jsonLD,
483
+ onChange: (e) => {
484
+ f({ target: { name: "jsonLD", value: e } });
485
+ },
486
+ placeholder: t("Enter JSON-LD"),
487
+ disabled: h || !n,
488
+ readOnly: !n,
489
+ pageData: c || {},
490
+ rows: 12,
491
+ handleFieldInsert: S,
492
+ hasJsonLdForSelectedLang: _,
493
+ copyJsonLDFromDefaultPage: ue
494
+ }
495
+ )
496
+ ] }) }) })
497
+ ] }) })
498
+ ] }),
499
+ n && /* @__PURE__ */ a("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: [
500
+ de ? /* @__PURE__ */ s(
501
+ R,
502
+ {
503
+ type: "button",
504
+ variant: "ghost",
505
+ size: "sm",
506
+ onClick: () => {
507
+ g === "jsonld" ? he() : g === "opengraph" ? ge() : me();
508
+ },
509
+ disabled: h || !n || !b,
510
+ children: t(z ? "Resetting..." : `Reset to ${g === "jsonld" ? "Default JSON-LD" : g === "opengraph" ? "Default Open Graph" : "Default SEO"}`)
511
+ }
512
+ ) : /* @__PURE__ */ s("div", {}),
513
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-4", children: [
514
+ /* @__PURE__ */ s(
515
+ R,
516
+ {
517
+ onClick: K,
518
+ disabled: !Ge(l == null ? void 0 : l.jsonLD) || (F.current[d] ? Z(F.current[d], l) : !1) || h || !n,
519
+ children: t(A ? "Saving..." : "Save")
520
+ }
521
+ ),
522
+ /* @__PURE__ */ s(
523
+ R,
524
+ {
525
+ variant: "link",
526
+ className: "text-gray-500 hover:text-gray-700",
527
+ onClick: () => w("outline"),
528
+ children: t("Cancel")
529
+ }
530
+ )
531
+ ] })
532
+ ] }),
533
+ /* @__PURE__ */ s(
534
+ Ve,
535
+ {
536
+ isOpen: oe,
537
+ onClose: () => {
538
+ U(!1), V(null);
539
+ },
540
+ onSave: async () => {
541
+ y && (await K(), y.switchHandler(), U(!1), V(null));
542
+ },
543
+ onDiscard: () => {
544
+ if (y) {
545
+ const e = F.current[d];
546
+ e && x(e), y.switchHandler(), U(!1), V(null);
547
+ }
548
+ },
549
+ isSaving: A,
550
+ fromLanguage: (y == null ? void 0 : y.fromLang) || d,
551
+ toLanguage: (y == null ? void 0 : y.toLang) || ""
552
+ }
553
+ )
554
+ ] });
555
+ };
556
+ Be.displayName = "SeoPanel";
557
+ export {
558
+ Be as default
559
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("lodash-es"),j=require("react"),oe=require("react-i18next"),b=require("sonner"),m=require("./register-chai-top-bar-CCssW5dL.cjs"),l=require("./index-D-r_K4yA.cjs"),c=require("./index-BYrRPW_c.cjs"),A=require("./get-seo-defaults-Cw7vFt-B.cjs"),ie=()=>{const{selectedLang:t}=l.useLanguages(),{data:w,isFetching:u}=c.useLanguagePages();return{data:j.useMemo(()=>i.find(w,{lang:t||""})||{},[w,t]),isFetching:u}},ce=({isOpen:t,onClose:w,onSave:u,onDiscard:d,isSaving:o=!1,fromLanguage:L,toLanguage:S})=>{const E=c.LANGUAGES[L]||L,x=c.LANGUAGES[S]||S;return e.jsx(l.Dialog,{open:t,onOpenChange:w,children:e.jsxs(l.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(l.DialogHeader,{children:[e.jsx(l.DialogTitle,{children:"Unsaved SEO Changes"}),e.jsxs(l.DialogDescription,{children:['You have unsaved changes in the SEO for "',E,'" version. Do you want to save these changes before switching to "',x,'" version?']})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(m.Button,{variant:"outline",onClick:d,disabled:o,children:"Discard Changes"}),e.jsx(m.Button,{onClick:u,disabled:o,children:o?"Saving...":"Save & Switch"})]})]})})},re=t=>{if(!t)return!0;try{return JSON.parse(t),!0}catch{return!1}},de=(t,w)=>{const u=t.selectionStart||0,d=t.selectionEnd||0,o=t.value,L=o.substring(0,u),S=o.substring(d),E=`{{${w}}}`,x=L+""+E+S,U=u+0+E.length;return{value:x,newCursorPos:U}},Y=()=>{const{t}=oe.useTranslation(),[,w]=l.useSidebarActivePanel(),{data:u}=c.usePrimaryPage(),{data:d}=c.useBuilderPageData(),{data:o,isFetching:L}=ie(),S=o==null?void 0:o.seo,E=j.useRef(null),[x,U]=j.useState("seo"),k=u==null?void 0:u.id,_=u==null?void 0:u.pageType,O=c.usePageType(_),{selectedLang:B,fallbackLang:K}=l.useLanguages(),g=B||K,[M,P]=j.useState(!1),[Q,H]=j.useState(!1),[W,R]=j.useState(!1),[y,J]=j.useState(null),[n,N]=j.useState({keyword:"",title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",ogImageId:"",searchTitle:"",searchDescription:"",jsonLD:"{}",metaOther:"{}",...S}),C=j.useRef({}),{mutate:X,isPending:G}=c.useUpdatePage(),h=G||M||Q,{hasPermission:Z}=l.usePermissions(),a=Z(c.PAGES_PERMISSIONS.EDIT_SEO),[ee]=c.usePagesProps(),se=i.get(ee,"flags.resetSeoToDefault",!1),$=!B||n.jsonLD!=="{}";j.useEffect(()=>{if(!L&&S&&k){const s={keyword:"",title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",ogImageId:"",searchTitle:"",searchDescription:"",jsonLD:"",metaOther:"",...S};N(s),C.current[g]=s}},[L,S,g,k]),j.useEffect(()=>{const s=r=>{const{fromLang:v,toLang:F,switchHandler:p}=r.detail,V=C.current[g];(V?!i.isEqual(V,n):!1)?(J({fromLang:v,toLang:F,switchHandler:p}),R(!0)):p()};return window.addEventListener("seo-language-switch-check",s),()=>{window.removeEventListener("seo-language-switch-check",s)}},[k,n,g]);const te=async()=>{if(!(!O||!g))try{P(!0);const s=A.getSeoDefaults(O,g),r={...n,keyword:i.get(s,"seo.keyword",""),title:i.get(s,"seo.title",""),description:i.get(s,"seo.description",""),cononicalUrl:i.get(s,"seo.canonicalUrl",""),noIndex:i.get(s,"seo.noIndex",!1),noFollow:i.get(s,"seo.noFollow",!1),ogTitle:i.get(s,"seo.ogTitle",""),ogDescription:i.get(s,"seo.ogDescription","")};N(r),b.toast.success(t("SEO fields reset to defaults"))}catch(s){b.toast.error(t("Failed to reset SEO fields")),console.error("Reset SEO error:",s)}finally{P(!1)}},ae=async()=>{if(!(!O||!g))try{H(!0);const s=A.getSeoDefaults(O,g),r={...n,jsonLD:i.get(s,"seo.jsonLD","")};N(r),b.toast.success(t("JSON-LD reset to default"))}catch(s){b.toast.error(t("Failed to reset JSON-LD")),console.error("Reset JSON-LD error:",s)}finally{H(!1)}},ne=async()=>{if(!(!O||!g))try{P(!0);const s=A.getSeoDefaults(O,g),r={...n,ogTitle:i.get(s,"seo.ogTitle",""),ogDescription:i.get(s,"seo.ogDescription",""),ogImage:i.get(s,"seo.ogImage",""),ogImageId:i.get(s,"seo.ogImageId",""),metaOther:i.get(s,"seo.metaOther","{}")};N(r),b.toast.success(t("Meta Tag fields reset to defaults"))}catch(s){b.toast.error(t("Failed to reset Meta Tag fields")),console.error("Reset Meta Tag error:",s)}finally{P(!1)}},z=async()=>{X({id:o==null?void 0:o.id,seo:n,primaryPage:k},{onSuccess:()=>{console.log("SEO & JSON-LD updated successfully",n),C.current[g]=n,b.toast.success("SEO & JSON-LD updated successfully")}})},D=(s,r)=>{const v=document.getElementById(r);if(v){const{value:F,newCursorPos:p}=de(v,s);E.current={id:r,position:p},v.tagName.toLowerCase()==="input"?(v.value=F,N(T=>({...T,[v.name]:F})),v.focus(),v.setSelectionRange(p,p),[0,10,50,100,200].forEach(T=>{setTimeout(()=>{const q=document.getElementById(r);q&&(q.focus(),q.setSelectionRange(p,p))},T)})):(N(I=>({...I,[v.name]:F})),requestAnimationFrame(()=>{const I=document.getElementById(r);I&&(I.focus(),I.setSelectionRange(p,p),setTimeout(()=>{const T=document.getElementById(r);T&&(T.focus(),T.setSelectionRange(p,p))},50))}))}},f=s=>{const r={...n,[s.target.name]:s.target.name==="noIndex"||s.target.name==="noFollow"?s.target.checked:s.target.value};N(r)},le=()=>{const s=i.get(u,"seo.jsonLD","{}");if((s==null?void 0:s.trim())==="{}"){b.toast.error("Default page JSON-LD is empty");return}f({target:{name:"jsonLD",value:s}})};return e.jsxs("div",{className:"relative flex h-full flex-col","data-panel-id":"seo",children:[!a&&e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm",children:e.jsx(m.Alert,{variant:"default",className:"w-[80%] max-w-md text-xs",children:e.jsx(m.AlertDescription,{children:t("You don't have permission to edit SEO settings. Contact your administrator for access.")})})}),e.jsxs("div",{className:"no-scrollbar flex-grow overflow-y-auto px-2 pb-20",children:[e.jsx("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:e.jsxs("span",{children:[e.jsx("div",{className:"font-medium",children:o==null?void 0:o.name}),e.jsx("span",{className:"font-mono text-xs leading-tight text-gray-500",children:o==null?void 0:o.slug})]})}),e.jsx("form",{className:"space-y-8",children:e.jsxs(l.Tabs,{value:x,onValueChange:U,className:"w-full",children:[e.jsxs(l.TabsList,{className:"mb-4 grid w-full grid-cols-3",children:[e.jsx(l.TabsTrigger,{value:"seo",children:t("SEO")}),e.jsx(l.TabsTrigger,{value:"opengraph",children:t("Meta Tags")}),e.jsx(l.TabsTrigger,{value:"jsonld",children:t("JSON-LD")})]}),e.jsx("div",{className:x==="seo"?"":"sr-only",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(l.Label,{className:"text-xs",htmlFor:"keyword",children:t("Keyword")}),a&&e.jsx(c.NestedPathSelector,{dataType:"value",data:d??{},onSelect:s=>D(s,"keyword")})]}),e.jsx(m.Input,{type:"text",id:"keyword",name:"keyword",value:n.keyword,onChange:f,disabled:h||!a,placeholder:t("Enter keyword"),readOnly:!a})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(l.Label,{className:"text-xs",htmlFor:"title",children:t("SEO Title")}),e.jsx("div",{className:"flex items-center justify-end gap-2",children:a&&e.jsx(c.NestedPathSelector,{dataType:"value",data:d??{},onSelect:s=>D(s,"title")})})]}),e.jsx(m.Input,{type:"text",id:"title",name:"title",value:n.title,onChange:f,disabled:h||!a,placeholder:t("Enter SEO title"),readOnly:!a})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(l.Label,{className:"text-xs",htmlFor:"description",children:t("SEO Description")}),e.jsx("div",{className:"flex items-center gap-2",children:a&&e.jsx(c.NestedPathSelector,{data:d??{},onSelect:s=>D(s,"description")})})]}),e.jsx(l.Textarea,{id:"description",name:"description",rows:5,value:n.description,onChange:f,disabled:h||!a,placeholder:t("Enter SEO description"),readOnly:!a})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(l.Label,{className:"text-xs",htmlFor:"title",children:t("Canonical URL")}),a&&e.jsx(c.NestedPathSelector,{dataType:"value",data:d??{},onSelect:s=>D(s,"canonicalUrl")})]}),e.jsx(m.Input,{type:"text",id:"canonicalUrl",name:"canonicalUrl",value:n.canonicalUrl,onChange:f,disabled:h||!a,placeholder:t("Enter Canonical URL"),readOnly:!a})]}),e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(m.Input,{type:"checkbox",id:"noIndex",name:"noIndex",checked:n.noIndex,onChange:f,disabled:h||!a,className:"h-4 w-4"}),e.jsx(l.Label,{className:"pb-1 text-xs",htmlFor:"noIndex",children:t("No Index")})]}),e.jsx("p",{className:"mt-0 text-[10px] font-light leading-4 text-gray-400",children:t("Check this if you don't want search engines to index this page.")})]}),e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(m.Input,{type:"checkbox",id:"noFollow",name:"noFollow",checked:n.noFollow,onChange:f,disabled:h||!a,className:"h-4 w-4"}),e.jsx(l.Label,{className:"pb-1 text-xs",htmlFor:"noIndex",children:t("No Follow")})]}),e.jsx("p",{className:"text-[10px] font-light leading-4 text-gray-400",children:t("Check this if you don't want search engines to follow links on this page.")})]})]})}),e.jsx("div",{className:x==="opengraph"?"":"sr-only",children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"mb-4 font-semibold text-slate-700",children:t("Open Graph")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(l.Label,{className:"text-xs",htmlFor:"ogTitle",children:t("OG Title")}),e.jsx("div",{className:"flex items-center gap-2",children:a&&e.jsx(c.NestedPathSelector,{dataType:"value",data:d??{},onSelect:s=>D(s,"ogTitle")})})]}),e.jsx(m.Input,{type:"text",id:"ogTitle",name:"ogTitle",value:n.ogTitle,onChange:f,disabled:h||!a,placeholder:t("Enter OG title"),readOnly:!a})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(l.Label,{className:"text-xs",htmlFor:"ogDescription",children:t("OG Description")}),e.jsx("div",{className:"flex items-center gap-2",children:a&&e.jsx(c.NestedPathSelector,{dataType:"value",data:d??{},onSelect:s=>D(s,"ogDescription")})})]}),e.jsx(l.Textarea,{id:"ogDescription",name:"ogDescription",rows:5,value:n.ogDescription,onChange:f,disabled:h||!a,placeholder:t("Enter OG description"),readOnly:!a})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(l.Label,{className:"text-xs",htmlFor:"ogImage",children:t("OG Image")}),a&&e.jsx(c.NestedPathSelector,{dataType:"value",data:d??{},onSelect:s=>{N({...n,ogImage:`{{${s}}}`,ogImageId:""})}})]}),e.jsx(c.ImagePicker,{assetId:n.ogImageId,assetUrl:n.ogImage,onChange:s=>{N({...n,ogImage:s.url,ogImageId:s.id})},disabled:h||!a,placeholder:t("Select OG image"),className:"mb-2"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(l.Label,{className:"text-xs",htmlFor:"metaOther",children:t("Meta Tags")})}),e.jsx(c.SmartJsonInput,{id:"metaOther",value:n.metaOther,onChange:s=>{f({target:{name:"metaOther",value:s}})},placeholder:t("Enter Meta Tags JSON"),disabled:h||!a,readOnly:!a,pageData:d||{},rows:8,handleFieldInsert:D})]})]})]})})}),e.jsx("div",{className:x==="jsonld"?"":"sr-only",children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(l.Label,{className:"text-xs",htmlFor:"jsonLD",children:t("JSON-LD")}),$&&e.jsx("div",{className:"flex items-center gap-2"})]}),e.jsx("div",{className:"hidden",children:JSON.stringify(d)}),e.jsx(c.SmartJsonInput,{id:"jsonLD",value:n.jsonLD,onChange:s=>{f({target:{name:"jsonLD",value:s}})},placeholder:t("Enter JSON-LD"),disabled:h||!a,readOnly:!a,pageData:d||{},rows:12,handleFieldInsert:D,hasJsonLdForSelectedLang:$,copyJsonLDFromDefaultPage:le})]})})})]})})]}),a&&e.jsxs("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:[se?e.jsx(m.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>{x==="jsonld"?ae():x==="opengraph"?ne():te()},disabled:h||!a||!O,children:t(M?"Resetting...":`Reset to ${x==="jsonld"?"Default JSON-LD":x==="opengraph"?"Default Open Graph":"Default SEO"}`)}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(m.Button,{onClick:z,disabled:!re(n==null?void 0:n.jsonLD)||(C.current[g]?i.isEqual(C.current[g],n):!1)||h||!a,children:t(G?"Saving...":"Save")}),e.jsx(m.Button,{variant:"link",className:"text-gray-500 hover:text-gray-700",onClick:()=>w("outline"),children:t("Cancel")})]})]}),e.jsx(ce,{isOpen:W,onClose:()=>{R(!1),J(null)},onSave:async()=>{y&&(await z(),y.switchHandler(),R(!1),J(null))},onDiscard:()=>{if(y){const s=C.current[g];s&&N(s),y.switchHandler(),R(!1),J(null)}},isSaving:G,fromLanguage:(y==null?void 0:y.fromLang)||g,toLanguage:(y==null?void 0:y.toLang)||""})]})};Y.displayName="SeoPanel";exports.default=Y;