@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
@@ -1,796 +0,0 @@
1
- import { jsx as s, jsxs as a, Fragment as We } from "react/jsx-runtime";
2
- import { z as Y, h as ye, B as W } from "./register-chai-top-bar-D6GjnauV.js";
3
- import { j as os, p as z, X as ee, Y as se, P as le, C as ae, k as ne, l as G, m as I, ax as cs, d as us } from "./index-OuHV9Ann.js";
4
- import { useState as y, useRef as ms, useEffect as ze, useMemo as B, startTransition as Oe } from "react";
5
- import { r as te, S as hs, c as Be } from "./slug-input-DLWTMTsO.js";
6
- import { isEmpty as Ie, startCase as de, filter as ps, find as ge, groupBy as ds, pick as fs, set as P } from "lodash-es";
7
- import { ChevronDown as re, Search as ie, Check as R } from "lucide-react";
8
- import { aq as Re, ar as Ue, A as oe, k as gs, as as ys, e as vs, f as Ns, g as Ss, ax as bs, L as xs } from "./index-LBTm1Jmk.js";
9
- import { useQuery as qe } from "@tanstack/react-query";
10
- import { toast as E } from "sonner";
11
- import { g as $e } from "./get-seo-defaults-9zHebckY.js";
12
- function ws({
13
- value: l,
14
- onChange: o,
15
- placeholder: v = "Enter custom slug part",
16
- dynamicPattern: p,
17
- onValidationChange: i
18
- }) {
19
- const [g, u] = y(null), m = ms(null), [f, C] = y(p + l);
20
- ze(() => {
21
- C(p + l);
22
- }, [l, p]);
23
- const F = (S) => {
24
- const b = S.target.value;
25
- if (!b.startsWith(p)) {
26
- const O = b.replace(p, ""), U = p + O;
27
- C(U), o(O);
28
- return;
29
- }
30
- const t = b.substring(p.length).replace(/\//g, "").replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-_.]/g, "-").replace(/-+/g, "-").replace(/^-+/, "").toLowerCase(), n = (t.match(/\./g) || []).length, d = n <= 1;
31
- n > 1 ? u("Invalid slug. Only one dot (.) is allowed in the slug") : u(null), i && i(d);
32
- const N = p + t;
33
- C(N), o(t);
34
- }, x = () => {
35
- if (m.current) {
36
- const S = m.current;
37
- setTimeout(() => {
38
- const b = p.length;
39
- S.setSelectionRange(b, b);
40
- }, 0);
41
- }
42
- }, $ = (S) => {
43
- const b = S.currentTarget;
44
- (b.selectionStart || 0) <= p.length && setTimeout(() => {
45
- const t = p.length;
46
- b.setSelectionRange(t, t);
47
- }, 0);
48
- };
49
- return /* @__PURE__ */ s("div", { children: /* @__PURE__ */ a("div", { className: "relative", children: [
50
- /* @__PURE__ */ a("p", { className: "mb-2 text-xs text-gray-500", children: [
51
- `${p}`,
52
- " is a dynamic segment of slug"
53
- ] }),
54
- /* @__PURE__ */ s(
55
- Y,
56
- {
57
- ref: m,
58
- value: f,
59
- onChange: F,
60
- onFocus: x,
61
- onClick: $,
62
- placeholder: v,
63
- className: g ? "border-red-500" : ""
64
- }
65
- ),
66
- g && /* @__PURE__ */ s("div", { className: "mt-1 text-xs text-red-500", children: g })
67
- ] }) });
68
- }
69
- const ce = ({ children: l, onWheel: o, ...v }) => /* @__PURE__ */ s(os, { ...v, onWheel: (i) => {
70
- try {
71
- i.preventDefault();
72
- const g = i.currentTarget;
73
- g.scrollTop += i.deltaY;
74
- } catch {
75
- i.preventDefault();
76
- }
77
- o && o(i);
78
- }, children: l }), fe = (...l) => l.filter(Boolean).join(" ");
79
- function Cs({
80
- pages: l,
81
- selectedParentId: o,
82
- onChange: v,
83
- className: p,
84
- id: i = "parentPage",
85
- currentPage: g
86
- }) {
87
- const [u, m] = y(!1), [f, C] = y(""), F = ye("enable-add-page-dropdown");
88
- F || (p = "w-full rounded-md border border-gray-300 px-3 py-2");
89
- const x = B(() => !l || l.length === 0 ? [] : l.filter((d) => !Ie(d.slug)).filter((d) => d.slug !== "/").sort((d, N) => d.slug.localeCompare(N.slug)), [l]), $ = B(() => {
90
- if (!f.trim()) return x;
91
- const n = f.toLowerCase();
92
- return x.filter(
93
- (d) => d.name.toLowerCase().includes(n) || d.slug.toLowerCase().includes(n)
94
- );
95
- }, [x, f]), S = (n) => Math.max(0, (n.match(/\//g) || []).length - 1), b = (n) => "    ".repeat(n), h = (n) => {
96
- if (n === "/") return "/";
97
- const d = n.split("/").filter(Boolean);
98
- if (d.length <= 1) {
99
- const N = d[0] || "";
100
- return `/${te(N)}`;
101
- }
102
- return `/${te(d[d.length - 1])}`;
103
- }, t = () => {
104
- if (!o || o === "none") return "None";
105
- const n = x.find((d) => d.id === o);
106
- return n ? `${n.name} (${h(n.slug)})` : "None";
107
- };
108
- return /* @__PURE__ */ a("div", { className: "space-y-0.5", children: [
109
- /* @__PURE__ */ s(z, { htmlFor: i, className: "text-sm", children: "Parent" }),
110
- F ? /* @__PURE__ */ a(ee, { open: u, onOpenChange: m, children: [
111
- /* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */ a(
112
- W,
113
- {
114
- id: i,
115
- variant: "outline",
116
- role: "combobox",
117
- className: fe("w-full justify-between", p),
118
- "data-testid": "parent-page-selector",
119
- children: [
120
- t(),
121
- /* @__PURE__ */ s(re, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
122
- ]
123
- }
124
- ) }),
125
- /* @__PURE__ */ s(le, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ a(ae, { shouldFilter: !1, children: [
126
- /* @__PURE__ */ s("div", { className: "relative border-none py-2", children: /* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */ a("div", { className: "relative", children: [
127
- /* @__PURE__ */ s(ie, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
128
- /* @__PURE__ */ s(
129
- Y,
130
- {
131
- placeholder: "Search pages...",
132
- className: "h-8 pl-8 text-xs",
133
- value: f,
134
- onChange: (n) => C(n.target.value)
135
- }
136
- )
137
- ] }) }) }),
138
- /* @__PURE__ */ a(ce, { className: "max-h-[300px] overflow-y-auto", children: [
139
- /* @__PURE__ */ s(ne, { children: "No pages found." }),
140
- /* @__PURE__ */ a(G, { children: [
141
- /* @__PURE__ */ a(
142
- I,
143
- {
144
- value: "none",
145
- onSelect: () => {
146
- v(""), m(!1), C("");
147
- },
148
- className: "flex cursor-pointer items-center justify-between",
149
- children: [
150
- /* @__PURE__ */ s("span", { children: "None" }),
151
- /* @__PURE__ */ s(R, { className: fe("mr-2 h-4 w-4", o ? "opacity-0" : "opacity-100") })
152
- ]
153
- }
154
- ),
155
- $.map((n) => {
156
- const d = b(S(n.slug)), N = h(n.slug), O = /* @__PURE__ */ a("span", { className: "flex items-center text-sm", children: [
157
- d,
158
- n.name,
159
- /* @__PURE__ */ a("span", { className: "text-xs text-gray-500", children: [
160
- " (",
161
- N,
162
- ")"
163
- ] })
164
- ] });
165
- return /* @__PURE__ */ a(
166
- I,
167
- {
168
- value: n.id,
169
- onSelect: () => {
170
- v(n.id), m(!1), C("");
171
- },
172
- className: "flex cursor-pointer items-center justify-between whitespace-pre-wrap",
173
- children: [
174
- /* @__PURE__ */ s("span", { children: O }),
175
- /* @__PURE__ */ s(
176
- R,
177
- {
178
- className: fe(
179
- "mr-2 h-4 w-4 shrink-0",
180
- o === n.id ? "opacity-100" : "opacity-0"
181
- )
182
- }
183
- )
184
- ]
185
- },
186
- n.id
187
- );
188
- })
189
- ] })
190
- ] })
191
- ] }) })
192
- ] }) : /* @__PURE__ */ a(
193
- "select",
194
- {
195
- id: i,
196
- value: o || "none",
197
- onChange: (n) => v(n.target.value),
198
- className: p,
199
- "data-testid": "parent-page-selector",
200
- children: [
201
- /* @__PURE__ */ s("option", { value: "none", children: "None" }),
202
- x.map((n) => {
203
- const d = S(n.slug), N = d > 0 ? b(d) : "", O = h(n.slug);
204
- return (g == null ? void 0 : g.id) === n.id || n.slug.startsWith(((g == null ? void 0 : g.slug) || "") + "/") ? null : /* @__PURE__ */ a("option", { value: n.id, children: [
205
- N,
206
- n.name,
207
- " (",
208
- O,
209
- ")"
210
- ] }, n.id);
211
- })
212
- ]
213
- }
214
- )
215
- ] });
216
- }
217
- const ks = (...l) => l.filter(Boolean).join(" "), Ls = ({
218
- templates: l,
219
- selectedTemplateId: o,
220
- onSelectTemplate: v,
221
- isLoading: p = !1
222
- }) => {
223
- const [i, g] = y(""), [u, m] = y(!1), [f, C] = y(""), F = ye("enable-add-page-dropdown");
224
- if (ze(() => {
225
- if (o) {
226
- const h = l.find((t) => t.id === o);
227
- Oe(() => g((h == null ? void 0 : h.preview) || ""));
228
- } else
229
- Oe(() => g(""));
230
- }, [o, l]), p)
231
- return /* @__PURE__ */ s("div", { className: "flex h-fit items-center justify-center text-sm text-gray-500", children: "Loading templates..." });
232
- if (l.length === 0)
233
- return null;
234
- const x = {};
235
- l.forEach((h) => {
236
- const t = h.libraryName;
237
- x[t] || (x[t] = []), x[t].push(h);
238
- });
239
- const $ = Object.entries(x).reduce(
240
- (h, [t, n]) => {
241
- const d = n.filter(
242
- (N) => N.name.toLowerCase().includes(f.toLowerCase()) || t.toLowerCase().includes(f.toLowerCase())
243
- );
244
- return d.length > 0 && (h[t] = d), h;
245
- },
246
- {}
247
- ), S = l.find((h) => h.id === o), b = S ? de(S.name) : "No Template";
248
- return /* @__PURE__ */ a("div", { className: "space-y-4", children: [
249
- F ? /* @__PURE__ */ a(ee, { open: u, onOpenChange: m, children: [
250
- /* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */ a(W, { variant: "outline", role: "combobox", className: "w-full justify-between", children: [
251
- b,
252
- /* @__PURE__ */ s(re, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
253
- ] }) }),
254
- /* @__PURE__ */ s(le, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ a(ae, { shouldFilter: !1, children: [
255
- /* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */ a("div", { className: "relative", children: [
256
- /* @__PURE__ */ s(ie, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
257
- /* @__PURE__ */ s(
258
- Y,
259
- {
260
- placeholder: "Search templates...",
261
- className: "h-8 pl-8 text-xs",
262
- value: f,
263
- onChange: (h) => C(h.target.value)
264
- }
265
- )
266
- ] }) }),
267
- /* @__PURE__ */ a(ce, { className: "max-h-[300px] overflow-y-auto", children: [
268
- /* @__PURE__ */ s(ne, { children: "No templates found." }),
269
- Object.entries($).map(([h, t]) => /* @__PURE__ */ s(G, { heading: h, children: t.map((n) => /* @__PURE__ */ a(
270
- I,
271
- {
272
- value: n.id,
273
- onSelect: () => {
274
- v(n.id), m(!1), C("");
275
- },
276
- className: "flex cursor-pointer items-center justify-between",
277
- children: [
278
- de(n.name),
279
- /* @__PURE__ */ s(
280
- R,
281
- {
282
- className: ks(
283
- "mr-2 h-4 w-4",
284
- o === n.id ? "opacity-100" : "opacity-0"
285
- )
286
- }
287
- )
288
- ]
289
- },
290
- n.id
291
- )) }, h))
292
- ] })
293
- ] }) })
294
- ] }) : /* @__PURE__ */ a(
295
- "select",
296
- {
297
- className: "w-full rounded-md border border-gray-300 px-3 py-2",
298
- value: o,
299
- onChange: (h) => v(h.target.value),
300
- children: [
301
- /* @__PURE__ */ s("option", { value: "", children: "No Template" }),
302
- Object.entries(x).map(([h, t]) => /* @__PURE__ */ s("optgroup", { label: h, children: t.map((n) => /* @__PURE__ */ s("option", { value: n.id, children: de(n.name) }, n.id)) }, h))
303
- ]
304
- }
305
- ),
306
- i && /* @__PURE__ */ a("div", { className: "mt-3 overflow-hidden rounded border", children: [
307
- /* @__PURE__ */ s("div", { className: "max-h-[200px] overflow-auto", children: /* @__PURE__ */ s("img", { src: i, alt: "Template Preview", className: "w-full object-contain" }) }),
308
- /* @__PURE__ */ s("div", { className: "border-t bg-gray-50 p-2 text-xs text-gray-500", children: "Template preview" })
309
- ] })
310
- ] });
311
- }, Ts = () => {
312
- const l = Re(), o = Ue();
313
- return qe({
314
- queryKey: [oe.GET_LIBRARIES],
315
- staleTime: "static",
316
- queryFn: async () => await o(l, { action: oe.GET_LIBRARIES }) || []
317
- });
318
- }, js = (l) => {
319
- const o = Re(), v = Ue();
320
- return qe({
321
- queryKey: [oe.GET_TEMPLATES_BY_TYPE, l],
322
- staleTime: "static",
323
- enabled: !!l,
324
- queryFn: async () => {
325
- const p = await v(o, {
326
- action: oe.GET_TEMPLATES_BY_TYPE,
327
- data: { pageType: l }
328
- });
329
- return (l ? ps(p, { pageType: l }) : p) || [];
330
- }
331
- });
332
- }, Ds = (l) => {
333
- const { data: o = [], isLoading: v } = js(l), { data: p = [], isLoading: i } = Ts(), g = B(() => v || i ? [] : o.map((m) => {
334
- const f = ge(p, { id: m.library });
335
- return {
336
- ...m,
337
- libraryName: (f == null ? void 0 : f.type) !== "shared" ? "Site Library" : (f == null ? void 0 : f.name) + " Library",
338
- libraryType: f == null ? void 0 : f.type
339
- };
340
- }), [o, p, v, i]), u = B(() => ds(g, "libraryName"), [g]);
341
- return {
342
- data: g,
343
- groupedData: u,
344
- isLoading: v || i
345
- };
346
- }, V = (...l) => l.filter(Boolean).join(" ");
347
- function _s({ addEditPage: l, close: o, closePanel: v }) {
348
- var Ae, Fe;
349
- const { data: p } = gs(), i = B(() => p ?? [], [p]), g = ys(), u = !!(l != null && l.id), { data: m } = vs(), { mutate: f, isPending: C } = Ns(), { mutate: F, isPending: x } = Ss(), [$, S] = y(null), [b, h] = y(!0), [t, n] = y((l == null ? void 0 : l.pageType) ?? "page"), { hasPermission: d } = cs(), N = d(bs.CHANGE_PAGE_TYPE), [O, U] = y(!1), [_e, Ve] = y(""), { selectedLang: Ge, fallbackLang: Ye } = us(), ve = Ge || Ye, [M, X] = y(""), [Ne, H] = y(!1), Se = B(() => {
350
- const e = i.find((c) => c.key === t);
351
- return (e == null ? void 0 : e.hasSlug) === !1;
352
- }, [t, i]), [k, Me] = y((l == null ? void 0 : l.parent) ?? ""), [q, be] = y((l == null ? void 0 : l.name) ?? ""), [T, xe] = y((l == null ? void 0 : l.dynamic) ?? !1), [j, K] = y(T ? "" : ((l == null ? void 0 : l.slug) ?? "").split("/").pop() || ""), [we, Ce] = y((l == null ? void 0 : l.dynamicSlugCustom) ?? ""), [ke, Qe] = y(!0), [He, ue] = y(!1), [me, Ke] = y(""), { data: Le, isLoading: Xe } = Ds(t), Q = C || x, Te = ye("enable-add-page-dropdown"), he = B(() => !u || !(l != null && l.id) || !m ? null : m.find((e) => e.id === l.id), [u, l == null ? void 0 : l.id, m]), Ze = (he == null ? void 0 : he.online) || !1, Je = B(() => !u || !(l != null && l.id) || !m ? !1 : m.some((e) => e.parent === l.id), [u, l == null ? void 0 : l.id, m]), r = i.find((e) => e.key === t), _ = (e) => {
353
- if (u && t !== e) {
354
- Ve(e), U(!0), X(""), H(!1);
355
- return;
356
- }
357
- n(e), X(""), H(!1);
358
- }, je = () => {
359
- n(_e), U(!1), xe(!1);
360
- }, Pe = (e) => {
361
- xe(e), e ? K("") : Ce("");
362
- }, Ee = (e) => {
363
- if (Me(e), e && e !== "none") {
364
- const c = m == null ? void 0 : m.find((w) => w.id === e), D = (c == null ? void 0 : c.slug) || "";
365
- if (j.startsWith(D)) {
366
- const w = j.slice(D.length).replace(/^\/+/, "");
367
- K(w);
368
- } else
369
- K(j.replace(/^\/+/, ""));
370
- } else
371
- K(j ? `${j}` : "");
372
- }, es = (e) => {
373
- Ke(e);
374
- }, ss = () => q.trim() ? T && !Ie(j) ? (S("Slug must be empty when using dynamic slug"), !1) : T && !ke ? (S("Dynamic slug is invalid"), !1) : !0 : (E.error("Name is required"), !1), ls = () => {
375
- const e = {
376
- pageType: r == null ? void 0 : r.key,
377
- name: q,
378
- slug: "",
379
- hasSlug: !1
380
- };
381
- u ? F(
382
- { id: l == null ? void 0 : l.id, name: q },
383
- {
384
- onSuccess: () => {
385
- E.success((r == null ? void 0 : r.name) + " updated successfully"), o();
386
- }
387
- }
388
- ) : f(e, {
389
- onSuccess: (c) => {
390
- o(), g(c.page.id, v);
391
- }
392
- });
393
- }, as = (e, c) => {
394
- if (!e.trim() && !T)
395
- return S("Child page slug is required"), !1;
396
- const D = te(c), w = Be(D, e);
397
- return Object.keys(xs).some((J) => w === `/${J}` || (w == null ? void 0 : w.startsWith(`/${J}/`))) ? (S("Slugs cannot start with a language code for primary page"), !1) : !0;
398
- }, ns = (e, c) => {
399
- const D = te(c), w = Be(D, e), L = {
400
- pageType: t,
401
- name: q,
402
- slug: w.replace(/\/$/, ""),
403
- // remove trailing slashes
404
- parent: k,
405
- dynamic: T,
406
- hasSlug: !0,
407
- template: me || void 0,
408
- tracking: {},
409
- seo: {},
410
- jsonLD: {}
411
- };
412
- if (T && (L.dynamicSlugCustom = we), u) {
413
- const A = fs(L, ["pageType", "parent", "name", "slug", "dynamic", "dynamicSlugCustom"]);
414
- F(
415
- { id: l == null ? void 0 : l.id, ...A },
416
- {
417
- onSuccess: () => {
418
- E.success("Page updated successfully"), o();
419
- }
420
- }
421
- );
422
- } else {
423
- const A = ge(i, { key: t });
424
- A != null && A.trackingDefault && (L.tracking = A.trackingDefault);
425
- const { seo: J, jsonLD: rs } = $e(A, ve);
426
- P(L, "seo", J), P(L, "jsonLD", rs), f(L, {
427
- onSuccess: (is) => {
428
- o(), g(is.page.id, v);
429
- }
430
- });
431
- }
432
- }, ts = () => {
433
- const e = {
434
- pageType: t,
435
- name: q,
436
- slug: j === "" ? "/" : `/${j.replace(/\/$/, "")}`,
437
- template: me || void 0,
438
- parent: null,
439
- tracking: {}
440
- };
441
- if (u)
442
- F(
443
- { id: l == null ? void 0 : l.id, ...e },
444
- {
445
- onSuccess: () => {
446
- E.success("Page updated successfully"), o();
447
- }
448
- }
449
- );
450
- else {
451
- const c = ge(i, { key: t });
452
- c != null && c.trackingDefault && (e.tracking = c.trackingDefault);
453
- const { seo: D, jsonLD: w } = $e(c, ve);
454
- P(e, "seo", D), P(e, "jsonLD", w), f(e, {
455
- onSuccess: (L) => {
456
- var A;
457
- (A = L == null ? void 0 : L.page) != null && A.id && g(L.page.id, v), o();
458
- }
459
- });
460
- }
461
- }, De = (e) => {
462
- if (e.preventDefault(), S(null), !!ss()) {
463
- if (!(r != null && r.hasSlug)) {
464
- ls();
465
- return;
466
- }
467
- if (k && k !== "none") {
468
- const c = m == null ? void 0 : m.find((w) => w.id === k), D = (c == null ? void 0 : c.slug) || "";
469
- if (!as(j, D))
470
- return;
471
- ns(j, D);
472
- } else
473
- ts();
474
- }
475
- }, { pagesType: pe, partialsType: Z } = B(() => {
476
- const e = (c) => M ? c.name.toLowerCase().includes(M.toLowerCase()) || c.key.toLowerCase().includes(M.toLowerCase()) : !0;
477
- return {
478
- pagesType: i.filter((c) => c.hasSlug !== !1 && e(c)),
479
- partialsType: i.filter((c) => c.hasSlug === !1 && e(c))
480
- };
481
- }, [i, M]);
482
- return r != null && r.hasSlug ? /* @__PURE__ */ a("form", { onSubmit: De, className: "mx-auto w-full max-w-md space-y-4", children: [
483
- /* @__PURE__ */ a("div", { className: "space-y-0.5", children: [
484
- /* @__PURE__ */ s(z, { htmlFor: "pageType", className: "text-sm", children: "Type" }),
485
- Te ? /* @__PURE__ */ a(ee, { open: Ne, onOpenChange: H, children: [
486
- /* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */ a(
487
- W,
488
- {
489
- variant: "outline",
490
- role: "combobox",
491
- disabled: u && !N,
492
- className: V(
493
- "w-full justify-between",
494
- u && !N ? "cursor-not-allowed text-gray-500" : ""
495
- ),
496
- children: [
497
- (r == null ? void 0 : r.name) || "Select page type",
498
- /* @__PURE__ */ s(re, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
499
- ]
500
- }
501
- ) }),
502
- /* @__PURE__ */ s(le, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ a(ae, { shouldFilter: !1, children: [
503
- /* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */ a("div", { className: "relative", children: [
504
- /* @__PURE__ */ s(ie, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
505
- /* @__PURE__ */ s(
506
- Y,
507
- {
508
- placeholder: "Search page types...",
509
- className: "h-8 pl-8 text-xs",
510
- value: M,
511
- onChange: (e) => X(e.target.value)
512
- }
513
- )
514
- ] }) }),
515
- /* @__PURE__ */ a(ce, { className: "overflow-y-auto", children: [
516
- /* @__PURE__ */ s(ne, { children: "No page type found." }),
517
- u ? Se ? /* @__PURE__ */ s(G, { heading: "Partials", children: Z.map((e) => /* @__PURE__ */ a(
518
- I,
519
- {
520
- value: e.key,
521
- onSelect: () => _(e.key),
522
- className: "flex cursor-pointer items-center justify-between",
523
- children: [
524
- e.name,
525
- /* @__PURE__ */ s(
526
- R,
527
- {
528
- className: V("mr-2 h-4 w-4", t === e.key ? "opacity-100" : "opacity-0")
529
- }
530
- )
531
- ]
532
- },
533
- e.key
534
- )) }) : /* @__PURE__ */ s(G, { heading: "Pages", children: pe.map((e) => /* @__PURE__ */ a(
535
- I,
536
- {
537
- value: e.key,
538
- onSelect: () => _(e.key),
539
- className: "flex cursor-pointer items-center justify-between",
540
- children: [
541
- e.name,
542
- /* @__PURE__ */ s(
543
- R,
544
- {
545
- className: V("mr-2 h-4 w-4", t === e.key ? "opacity-100" : "opacity-0")
546
- }
547
- )
548
- ]
549
- },
550
- e.key
551
- )) }) : /* @__PURE__ */ a(We, { children: [
552
- pe.length > 0 && /* @__PURE__ */ s(G, { heading: "Pages", children: pe.map((e) => /* @__PURE__ */ a(
553
- I,
554
- {
555
- value: e.key,
556
- onSelect: () => _(e.key),
557
- className: "flex cursor-pointer items-center justify-between",
558
- children: [
559
- e.name,
560
- /* @__PURE__ */ s(
561
- R,
562
- {
563
- className: V("mr-2 h-4 w-4", t === e.key ? "opacity-100" : "opacity-0")
564
- }
565
- )
566
- ]
567
- },
568
- e.key
569
- )) }),
570
- Z.length > 0 && /* @__PURE__ */ s(G, { heading: "Partials", children: Z.map((e) => /* @__PURE__ */ a(
571
- I,
572
- {
573
- value: e.key,
574
- onSelect: () => _(e.key),
575
- className: "flex cursor-pointer items-center justify-between",
576
- children: [
577
- e.name,
578
- /* @__PURE__ */ s(
579
- R,
580
- {
581
- className: V("mr-2 h-4 w-4", t === e.key ? "opacity-100" : "opacity-0")
582
- }
583
- )
584
- ]
585
- },
586
- e.key
587
- )) })
588
- ] })
589
- ] })
590
- ] }) })
591
- ] }) : /* @__PURE__ */ s(
592
- "select",
593
- {
594
- id: "pageType",
595
- value: t,
596
- disabled: u && !N,
597
- onChange: (e) => _(e.target.value),
598
- className: `w-full rounded-md border border-gray-300 px-3 py-2 ${u && !N ? "cursor-not-allowed text-gray-500" : ""}`,
599
- children: u ? Se ? /* @__PURE__ */ s("optgroup", { label: "Partials", children: i.filter((e) => e.hasSlug === !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }) : /* @__PURE__ */ s("optgroup", { label: "Pages", children: i.filter((e) => e.hasSlug !== !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }) : /* @__PURE__ */ a(We, { children: [
600
- /* @__PURE__ */ s("optgroup", { label: "Pages", children: i.filter((e) => e.hasSlug !== !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }),
601
- /* @__PURE__ */ s("optgroup", { label: "Partials", children: i.filter((e) => e.hasSlug === !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) })
602
- ] })
603
- }
604
- ),
605
- O && /* @__PURE__ */ a("div", { className: "mt-2 rounded-md border border-yellow-200 bg-yellow-50 p-3", children: [
606
- /* @__PURE__ */ s("p", { className: "text-sm text-yellow-800", children: "Changing the page type may impact the page data. Are you sure you want to proceed?" }),
607
- /* @__PURE__ */ a("div", { className: "mt-2 flex gap-2", children: [
608
- /* @__PURE__ */ s(W, { variant: "outline", size: "sm", onClick: () => U(!1), children: "Cancel" }),
609
- /* @__PURE__ */ s(W, { variant: "default", size: "sm", onClick: je, children: "Confirm" })
610
- ] })
611
- ] })
612
- ] }),
613
- !u && (r == null ? void 0 : r.hasSlug) && Le.length > 0 && /* @__PURE__ */ a("div", { className: "space-y-1", children: [
614
- /* @__PURE__ */ s(z, { className: "mb-1 block text-sm", children: "Template" }),
615
- /* @__PURE__ */ s(
616
- Ls,
617
- {
618
- templates: Le,
619
- selectedTemplateId: me,
620
- onSelectTemplate: es,
621
- isLoading: Xe
622
- }
623
- )
624
- ] }),
625
- /* @__PURE__ */ s(
626
- Cs,
627
- {
628
- pages: m,
629
- selectedParentId: k,
630
- onChange: Ee,
631
- currentPage: l
632
- }
633
- ),
634
- /* @__PURE__ */ a("div", { className: "space-y-0.5", children: [
635
- /* @__PURE__ */ s(z, { htmlFor: "name", className: "text-sm", children: "Name" }),
636
- /* @__PURE__ */ s(
637
- Y,
638
- {
639
- id: "name",
640
- value: q,
641
- onChange: (e) => be(e.target.value),
642
- required: !0,
643
- "aria-required": "true",
644
- placeholder: "Enter page name"
645
- }
646
- )
647
- ] }),
648
- (r == null ? void 0 : r.dynamicSegments) && k && k !== "none" && /* @__PURE__ */ a("div", { className: "space-y-2", children: [
649
- /* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
650
- /* @__PURE__ */ s(
651
- "input",
652
- {
653
- type: "checkbox",
654
- id: "useDynamicSlug",
655
- checked: T,
656
- onChange: (e) => Pe(e.target.checked),
657
- className: "rounded border-gray-300"
658
- }
659
- ),
660
- /* @__PURE__ */ s(z, { htmlFor: "useDynamicSlug", className: "text-sm", children: "Use Dynamic Slug" })
661
- ] }),
662
- T && /* @__PURE__ */ s("div", { className: "space-y-2", children: /* @__PURE__ */ s("div", { className: "space-y-0.5", children: /* @__PURE__ */ s(
663
- ws,
664
- {
665
- value: we,
666
- onChange: Ce,
667
- dynamicPattern: (r == null ? void 0 : r.dynamicSlug) || "{{id}}",
668
- placeholder: "Enter custom slug part (optional)",
669
- onValidationChange: Qe
670
- }
671
- ) }) })
672
- ] }),
673
- (!(r != null && r.dynamicSegments) || !T) && /* @__PURE__ */ a("div", { className: "space-y-0.5", children: [
674
- /* @__PURE__ */ s(z, { htmlFor: "slug", className: "text-sm", children: "Slug" }),
675
- /* @__PURE__ */ s(
676
- hs,
677
- {
678
- value: j,
679
- onChange: (e) => {
680
- var c;
681
- K(e), u && e !== (((c = l == null ? void 0 : l.slug) == null ? void 0 : c.split("/").pop()) || "") ? ue(!!(Ze || Je)) : ue(!1);
682
- },
683
- placeholder: k && k !== "none" ? "Enter page slug" : t === "page" ? "Leave empty for home page" : "Required - e.g. your-slug",
684
- parentSlug: k && k !== "none" ? (Fe = m == null ? void 0 : m.find((e) => e.id === k)) == null ? void 0 : Fe.slug : void 0,
685
- onValidationChange: h
686
- }
687
- ),
688
- $ && /* @__PURE__ */ s("p", { className: "text-xs text-red-500", children: $ }),
689
- He && /* @__PURE__ */ s("div", { className: "mt-4 rounded-md border border-amber-200 bg-amber-50 p-3", children: /* @__PURE__ */ a("div", { className: "flex items-start space-x-2", children: [
690
- /* @__PURE__ */ s("div", { className: "flex-shrink-0", children: /* @__PURE__ */ s("svg", { className: "h-5 w-5 text-amber-400", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ s(
691
- "path",
692
- {
693
- fillRule: "evenodd",
694
- d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",
695
- clipRule: "evenodd"
696
- }
697
- ) }) }),
698
- /* @__PURE__ */ a("div", { className: "flex-1", children: [
699
- /* @__PURE__ */ s("h3", { className: "text-sm font-medium text-amber-800", children: "Slug Change Warning" }),
700
- /* @__PURE__ */ s("div", { className: "mt-1 text-sm text-amber-700", children: /* @__PURE__ */ s("p", { children: "The previous URL and any child pages will become inaccessible. You may want to set up a redirect to avoid broken links." }) })
701
- ] })
702
- ] }) })
703
- ] }),
704
- /* @__PURE__ */ s(
705
- W,
706
- {
707
- disabled: Q || // Disable if regular slug is invalid and we're not using dynamic slug
708
- !b && (!(r != null && r.dynamicSegments) || !T) || // Disable if dynamic slug is invalid and we are using dynamic slug
709
- T && !ke,
710
- type: "submit",
711
- className: "w-full",
712
- children: u ? Q ? "Updating..." : "Update page" : Q ? "Creating..." : "Create Page"
713
- }
714
- )
715
- ] }) : /* @__PURE__ */ a("form", { onSubmit: De, className: "mx-auto w-full max-w-md space-y-4", children: [
716
- /* @__PURE__ */ a("div", { className: "space-y-0.5", children: [
717
- /* @__PURE__ */ s(z, { htmlFor: "pageType", className: "text-sm", children: "Type" }),
718
- Te ? /* @__PURE__ */ a(ee, { open: Ne, onOpenChange: H, children: [
719
- /* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */ a(
720
- W,
721
- {
722
- variant: "outline",
723
- role: "combobox",
724
- disabled: u && !N,
725
- className: V(
726
- "w-full justify-between",
727
- u && !N ? "cursor-not-allowed text-gray-500" : ""
728
- ),
729
- children: [
730
- (r == null ? void 0 : r.name) || "Select page type",
731
- /* @__PURE__ */ s(re, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
732
- ]
733
- }
734
- ) }),
735
- /* @__PURE__ */ s(le, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ a(ae, { shouldFilter: !1, children: [
736
- /* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */ a("div", { className: "relative", children: [
737
- /* @__PURE__ */ s(ie, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
738
- /* @__PURE__ */ s(
739
- Y,
740
- {
741
- placeholder: "Search page types...",
742
- className: "h-8 pl-8 text-xs",
743
- value: M,
744
- onChange: (e) => X(e.target.value)
745
- }
746
- )
747
- ] }) }),
748
- /* @__PURE__ */ a(ce, { className: "max-h-[200px] overflow-y-auto", children: [
749
- /* @__PURE__ */ s(ne, { children: "No page type found." }),
750
- /* @__PURE__ */ s(G, { heading: "Partials", children: Z.map((e) => /* @__PURE__ */ a(
751
- I,
752
- {
753
- value: e.key,
754
- onSelect: () => {
755
- _(e.key), H(!1);
756
- },
757
- className: "flex cursor-pointer items-center justify-between",
758
- children: [
759
- e.name,
760
- /* @__PURE__ */ s(R, { className: V("mr-2 h-4 w-4", t === e.key ? "opacity-100" : "opacity-0") })
761
- ]
762
- },
763
- e.key
764
- )) })
765
- ] })
766
- ] }) })
767
- ] }) : /* @__PURE__ */ s(
768
- "select",
769
- {
770
- id: "pageType",
771
- value: t,
772
- disabled: u && !N,
773
- onChange: (e) => _(e.target.value),
774
- className: `w-full rounded-md border border-gray-300 px-3 py-2 ${u && !N ? "cursor-not-allowed text-gray-500" : ""}`,
775
- children: /* @__PURE__ */ s("optgroup", { label: "Partials", children: i.filter((e) => e.hasSlug === !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) })
776
- }
777
- ),
778
- O && /* @__PURE__ */ a("div", { className: "mt-2 rounded-md border border-yellow-200 bg-yellow-50 p-3", children: [
779
- /* @__PURE__ */ s("p", { className: "text-sm text-yellow-800", children: "Changing the page type may impact the page data. Are you sure you want to proceed?" }),
780
- /* @__PURE__ */ a("div", { className: "mt-2 flex gap-2", children: [
781
- /* @__PURE__ */ s(W, { variant: "outline", size: "sm", onClick: () => U(!1), children: "Cancel" }),
782
- /* @__PURE__ */ s(W, { variant: "default", size: "sm", onClick: je, children: "Confirm" })
783
- ] })
784
- ] }),
785
- /* @__PURE__ */ s("p", { className: "text-xs text-gray-500", children: (Ae = i.find((e) => e.key === t)) == null ? void 0 : Ae.helpText })
786
- ] }),
787
- /* @__PURE__ */ a("div", { className: "space-y-0.5", children: [
788
- /* @__PURE__ */ s(z, { htmlFor: "name", className: "text-sm", children: "Name" }),
789
- /* @__PURE__ */ s(Y, { id: "name", value: q, onChange: (e) => be(e.target.value), required: !0, "aria-required": "true" })
790
- ] }),
791
- /* @__PURE__ */ s(W, { disabled: Q, type: "submit", className: "w-full", children: u ? Q ? "Updating..." : "Update " + (r == null ? void 0 : r.name) : Q ? "Creating..." : "Create " + (r == null ? void 0 : r.name) })
792
- ] });
793
- }
794
- export {
795
- _s as default
796
- };