@chaibuilder/sdk 4.0.0-beta.1 → 4.0.0-beta.3

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 (184) hide show
  1. package/README.md +27 -20
  2. package/dist/2SSKDMRQ-BnsZi3K3.cjs +1 -0
  3. package/dist/2SSKDMRQ-CnSDkQcy.js +42 -0
  4. package/dist/AP7HFJJL-B31839PG.cjs +1228 -0
  5. package/dist/AP7HFJJL-CymCmW14.js +9214 -0
  6. package/dist/IconPicker-B1rWC-Ex.js +59 -0
  7. package/dist/IconPicker-DREyo007.cjs +1 -0
  8. package/dist/WDYDFRGG-BUVnbAci.js +33 -0
  9. package/dist/WDYDFRGG-BxhOCHc3.cjs +1 -0
  10. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  11. package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
  12. package/dist/actions-registery-CZ1w0NKa.js +15545 -0
  13. package/dist/actions-registery-YnFmU21O.cjs +418 -0
  14. package/dist/actions.cjs +1 -0
  15. package/dist/actions.d.ts +3202 -0
  16. package/dist/actions.js +216 -0
  17. package/dist/active-in-another-tab-B47YjQGN.cjs +1 -0
  18. package/dist/active-in-another-tab-CyjngVA6.js +34 -0
  19. package/dist/add-new-language-page-88xzrUy8.cjs +1 -0
  20. package/dist/add-new-language-page-WmlCnytQ.js +401 -0
  21. package/dist/add-new-page-VW2wAYZp.js +31 -0
  22. package/dist/add-new-page-soZ8GAkN.cjs +1 -0
  23. package/dist/ai-panel-content-7zCil042.cjs +1 -0
  24. package/dist/ai-panel-content-D_o7Q_A-.js +61 -0
  25. package/dist/ai-panel-default-lang-COYaxNwn.cjs +3 -0
  26. package/dist/ai-panel-default-lang-DnElspF0.js +341 -0
  27. package/dist/ai-panel-other-lang-CkynNlAU.cjs +1 -0
  28. package/dist/ai-panel-other-lang-Dp0E9_Hx.js +162 -0
  29. package/dist/ai-prompt-input-Bhc0ds7X.js +655 -0
  30. package/dist/ai-prompt-input-CThbVp0_.cjs +1 -0
  31. package/dist/ai-translation-prompt-C2kJQFDX.cjs +1 -0
  32. package/dist/ai-translation-prompt-CZ55HQmo.js +28 -0
  33. package/dist/apply-binding-6iwlED02.js +833 -0
  34. package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
  35. package/dist/code-display-BnqzqzoP.cjs +1 -0
  36. package/dist/{code-display-337R7Dev.js → code-display-DhD_RBcg.js} +1 -1
  37. package/dist/code-editor-DRIAnNbb.js +50 -0
  38. package/dist/code-editor-o3___nu2.cjs +1 -0
  39. package/dist/common-functions-B3a4xKt_.cjs +1 -0
  40. package/dist/common-functions-D2lMFR6K.js +13 -0
  41. package/dist/continue-editing-in-this-client-CS2aQ7yY.js +24 -0
  42. package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +1 -0
  43. package/dist/core-BoRDjj4h.cjs +1 -0
  44. package/dist/core-yvI6kCyw.js +56 -0
  45. package/dist/core.cjs +1 -1
  46. package/dist/core.d.ts +51 -383
  47. package/dist/core.js +39 -106
  48. package/dist/{css-import-modal-DA2L6kwP.js → css-import-modal-Byg6wV0O.js} +36 -36
  49. package/dist/css-import-modal-CyqkXWCO.cjs +13 -0
  50. package/dist/delete-design-token-BRZZiWtQ.js +40 -0
  51. package/dist/delete-design-token-DkVs1oBf.cjs +1 -0
  52. package/dist/delete-page-BzyX9TN-.js +70 -0
  53. package/dist/delete-page-DxX7PFIE.cjs +1 -0
  54. package/dist/design-token-usage-CAHzEGgJ.cjs +1 -0
  55. package/dist/design-token-usage-xQs6SlaJ.js +113 -0
  56. package/dist/digital-asset-manager--uO8Agia.cjs +1 -0
  57. package/dist/digital-asset-manager-DbtwzxRz.js +876 -0
  58. package/dist/duplicate-page-BR7Dlo9d.js +133 -0
  59. package/dist/duplicate-page-CaNAbXwV.cjs +1 -0
  60. package/dist/dynamic-page-selector-Cb5r_W8s.js +85 -0
  61. package/dist/dynamic-page-selector-Cxk_gjni.cjs +1 -0
  62. package/dist/fonts-B-Xt29pe.cjs +1 -0
  63. package/dist/fonts-DRly3Wzd.js +78 -0
  64. package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
  65. package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
  66. package/dist/{get-chai-builder-theme-D0IsUvK4.js → get-chai-builder-theme-BYtp20KD.js} +4 -4
  67. package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
  68. package/dist/get-seo-defaults-9zHebckY.js +65 -0
  69. package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
  70. package/dist/image-compression-DZ9WMmyn.cjs +1 -0
  71. package/dist/image-compression-DsZ1oqpb.js +37 -0
  72. package/dist/image-editor-DV8kUKhl.js +108 -0
  73. package/dist/image-editor-G-K28aTS.cjs +1 -0
  74. package/dist/index-B-rSiAp_.cjs +1 -0
  75. package/dist/index-Ct7ElCGK.js +19069 -0
  76. package/dist/index-DF5DEvqb.cjs +160 -0
  77. package/dist/index-Dxfyt4d4.js +39 -0
  78. package/dist/index-WQwzsC7A.cjs +5 -0
  79. package/dist/index-ZuacEL1j.js +4732 -0
  80. package/dist/json-diff-viewer-D7z4zNvv.cjs +8 -0
  81. package/dist/json-diff-viewer-krslPepD.js +258 -0
  82. package/dist/lang-panel-BwIewMyw.js +215 -0
  83. package/dist/lang-panel-DT96k1xg.cjs +1 -0
  84. package/dist/manage-design-tokens-Caz_20VK.js +240 -0
  85. package/dist/manage-design-tokens-CrmLe7UT.cjs +1 -0
  86. package/dist/mark-as-template-D295ZQtU.js +156 -0
  87. package/dist/mark-as-template-W3LmpiqN.cjs +1 -0
  88. package/dist/models-5gOsRC56.cjs +1 -0
  89. package/dist/models-D95ZYr_x.js +70 -0
  90. package/dist/nested-path-selector-content-CKYYK-C5.js +87 -0
  91. package/dist/nested-path-selector-content-CoS_d3dc.cjs +1 -0
  92. package/dist/no-language-page-content-BvqRBP6y.js +42 -0
  93. package/dist/no-language-page-content-DkfeMl90.cjs +1 -0
  94. package/dist/no-language-page-dialog-BcEoqyQB.cjs +1 -0
  95. package/dist/no-language-page-dialog-PjNqTUpl.js +10 -0
  96. package/dist/page-creator-C4gc5NSC.cjs +1 -0
  97. package/dist/page-creator-DiOITEMw.js +795 -0
  98. package/dist/page-lock-BdYmCks0.cjs +1 -0
  99. package/dist/page-lock-Bfbs6RgL.js +30 -0
  100. package/dist/page-locked-dialog-B1FAtK92.cjs +1 -0
  101. package/dist/page-locked-dialog-B6MKTRfY.js +133 -0
  102. package/dist/page-manager-new-CHDueBDk.cjs +1 -0
  103. package/dist/page-manager-new-CzX22g2n.js +394 -0
  104. package/dist/page-manager-search-and-filter-CM0UMb6U.js +201 -0
  105. package/dist/page-manager-search-and-filter-DkkRIH86.cjs +1 -0
  106. package/dist/page-revisions-content-ChY-4f2V.cjs +1 -0
  107. package/dist/page-revisions-content-NH9JK4Ey.js +445 -0
  108. package/dist/pages.cjs +1 -0
  109. package/dist/pages.d.ts +491 -0
  110. package/dist/pages.js +27 -0
  111. package/dist/plugin-3ZKK6RXm.js +245 -0
  112. package/dist/plugin-C6rgJDNQ.cjs +22 -0
  113. package/dist/publish-pages-content-D9aixMN5.js +178 -0
  114. package/dist/publish-pages-content-x-JuSFJ9.cjs +1 -0
  115. package/dist/register-partial-type-BjtdfKHE.js +36 -0
  116. package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
  117. package/dist/render.cjs +2 -2
  118. package/dist/render.d.ts +26 -13
  119. package/dist/render.js +130 -124
  120. package/dist/rte-widget-modal-BaHIuEjF.cjs +1 -0
  121. package/dist/rte-widget-modal-DOJEXLIf.js +38 -0
  122. package/dist/runtime.cjs +1 -1
  123. package/dist/runtime.d.ts +306 -7
  124. package/dist/runtime.js +44 -1
  125. package/dist/save-to-lib-Cgpxw8-g.cjs +1 -0
  126. package/dist/save-to-lib-eiOc_SSN.js +422 -0
  127. package/dist/sdk.css +1 -1
  128. package/dist/selected-block-display-BgRY82CT.cjs +16 -0
  129. package/dist/selected-block-display-CBFePS19.js +319 -0
  130. package/dist/seo-panel-C1-iMOR1.js +798 -0
  131. package/dist/seo-panel-DfAb8U7W.cjs +2 -0
  132. package/dist/shared-json-ld-B4PxAM_0.js +565 -0
  133. package/dist/shared-json-ld-DzG398hr.cjs +1 -0
  134. package/dist/slug-input-AwNJs9im.js +86 -0
  135. package/dist/slug-input-C_ijLQ_X.cjs +1 -0
  136. package/dist/supabase-actions.cjs +1 -0
  137. package/dist/supabase-actions.d.ts +284 -0
  138. package/dist/supabase-actions.js +524 -0
  139. package/dist/take-over-request-BNxcjY2j.cjs +1 -0
  140. package/dist/take-over-request-C4FeDtN_.js +63 -0
  141. package/dist/theme-panel-footer-Cq9pljro.cjs +1 -0
  142. package/dist/theme-panel-footer-uBQqSJXm.js +25 -0
  143. package/dist/translation-warning-modal-B64YqlbI.js +26 -0
  144. package/dist/translation-warning-modal-BZAcwM2_.cjs +1 -0
  145. package/dist/unmark-as-template-CZ9sQp_P.js +39 -0
  146. package/dist/unmark-as-template-EVvk0vmp.cjs +1 -0
  147. package/dist/unpublish-page-D4VwOlxc.js +27 -0
  148. package/dist/unpublish-page-bdSmwAVQ.cjs +1 -0
  149. package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
  150. package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
  151. package/dist/{tailwind.cjs → utils.cjs} +1 -1
  152. package/dist/{tailwind.d.ts → utils.d.ts} +12 -11
  153. package/dist/utils.js +7 -0
  154. package/dist/web-blocks.cjs +1 -1
  155. package/dist/web-blocks.d.ts +0 -6
  156. package/dist/web-blocks.js +248 -241
  157. package/dist/web-preview-Cio70gk5.cjs +1 -0
  158. package/dist/web-preview-Djy6WIyj.js +73 -0
  159. package/package.json +175 -105
  160. package/dist/IconPicker-CGWn9C4u.cjs +0 -1
  161. package/dist/IconPicker-QvxJ-4Ez.js +0 -64
  162. package/dist/apply-binding-DCno1xQL.js +0 -711
  163. package/dist/apply-binding-DvHNFLQD.cjs +0 -1
  164. package/dist/code-display-BZ1x7SqI.cjs +0 -1
  165. package/dist/code-editor-B28LoECM.cjs +0 -1
  166. package/dist/code-editor-CfG2FhJ-.js +0 -58
  167. package/dist/common-functions-BGzDsf1z.js +0 -14
  168. package/dist/common-functions-BZmyleS1.cjs +0 -1
  169. package/dist/css-import-modal-CENUYvcl.cjs +0 -13
  170. package/dist/get-chai-builder-theme-Ck_Z4Q-M.cjs +0 -1
  171. package/dist/index-CaGNHF7f.js +0 -12209
  172. package/dist/index-Gn6pJt2v.cjs +0 -166
  173. package/dist/mockServiceWorker.js +0 -307
  174. package/dist/plugin-B5627hMN.js +0 -195
  175. package/dist/plugin-UxTRfDum.cjs +0 -22
  176. package/dist/rte-widget-modal-DL739qeQ.cjs +0 -1
  177. package/dist/rte-widget-modal-Dte0od04.js +0 -41
  178. package/dist/tailwind.js +0 -7
  179. package/dist/tooltip-A4qGk781.cjs +0 -1
  180. package/dist/tooltip-tLiIOgjq.js +0 -1067
  181. package/dist/ui.cjs +0 -1
  182. package/dist/ui.d.ts +0 -415
  183. package/dist/ui.js +0 -129
  184. package/dist/vite.svg +0 -1
@@ -0,0 +1,4732 @@
1
+ var Qn = (e) => {
2
+ throw TypeError(e);
3
+ };
4
+ var zn = (e, t, n) => t.has(e) || Qn("Cannot " + n);
5
+ var A = (e, t, n) => (zn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), O = (e, t, n) => t.has(e) ? Qn("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), C = (e, t, n, s) => (zn(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n);
6
+ import { jsxs as m, jsx as c, Fragment as he } from "react/jsx-runtime";
7
+ import { n as Pe, an as Rr, am as Ts, r as Ln, s as Cn, t as Gn, v as ce, V as Re, w as en, x as tn, B as M, y as nn, aH as Ss, aI as _s, ac as Ur, ad as Mr, aJ as Br, aK as Fr, aw as Ps, aL as Kr, ae as Dt, D as ws, aM as Vr, aG as Hr, aN as qr, aO as $r, aB as Qr, aA as zr, aC as Wr, G as jr, H as Yr, J as Jr, K as Zr, M as Xr, O as ea, Q as ta, R as na, U as sa, aP as kt, aQ as Wn, aR as ra, aS as aa, aT as ia, aU as oa, a9 as la, aa as ca, d as ua, e as da, f as fa, ax as ha, ay as ga, az as cn, aV as un, T as jn, A as ma, av as Ea } from "./index-Ct7ElCGK.js";
8
+ import { atom as Ee, useAtom as pe, useSetAtom as On, useAtomValue as pa } from "jotai";
9
+ import { get as H, reverse as ya, sortBy as Aa, find as ie, noop as vs, minBy as bs, values as Is, first as Ns, groupBy as Ta, keyBy as Sa, map as qt, isEmpty as fe, compact as Ls, each as _a, upperCase as Yn, filter as Cs, includes as Pa, has as sn, pickBy as wa, pick as xn, endsWith as va, keys as ba, isArray as Ia, startCase as Na, isFunction as La, cloneDeep as Ca, isEqual as Jn } from "lodash-es";
10
+ import * as $ from "react";
11
+ import Ga, { useMemo as q, useCallback as z, useState as K, useEffect as se, useRef as Ie, Suspense as X, lazy as V } from "react";
12
+ import { useQuery as re, useMutation as Y, useQueryClient as J, onlineManager as Gs, QueryClient as Oa, QueryClientProvider as xa } from "@tanstack/react-query";
13
+ import { CopyPlusIcon as Da, Pencil as ka, Power as Ra, Trash as Ua, SquareLibrary as Zn, LogsIcon as Ma, Folder as Ba, Loader as $t, Hash as Fa, File as Ka, MoreHorizontal as Xn, Languages as es, ChevronDown as yn, Star as Va, Plus as Os, History as Ha, Palette as qa, Play as $a, CheckCircle as Qa, Save as za, Send as ts, Rocket as ns, ExternalLink as Wa, LanguagesIcon as ja, User as Ya, X as ss, Trash2 as Ja, ImageIcon as rs, Code as Za, Eye as Xa, Share2 as ei, FileCode2 as ti, AlertTriangle as ni } from "lucide-react";
14
+ import { useTranslation as we } from "react-i18next";
15
+ import { c as Qt } from "./common-functions-D2lMFR6K.js";
16
+ import { toast as R } from "sonner";
17
+ import { j as si, b as ri } from "./core-yvI6kCyw.js";
18
+ import { g as ai } from "./apply-binding-6iwlED02.js";
19
+ import { loadWebBlocks as ii } from "./web-blocks.js";
20
+ import { ErrorBoundary as oi } from "react-error-boundary";
21
+ const zt = Ee(null), E = {
22
+ GET_GLOBAL_JSONLD_ITEMS: "GET_GLOBAL_JSONLD_ITEMS",
23
+ GENERATE_SEO_FIELD: "GENERATE_SEO_FIELD",
24
+ UPDATE_PAGE_METADATA: "UPDATE_PAGE_METADATA",
25
+ GET_BLOCK_ASYNC_PROPS: "GET_BLOCK_ASYNC_PROPS",
26
+ ASK_AI: "ASK_AI",
27
+ GET_DRAFT_PAGE: "GET_DRAFT_PAGE",
28
+ CREATE_PAGE: "CREATE_PAGE",
29
+ UPDATE_PAGE: "UPDATE_PAGE",
30
+ DELETE_PAGE: "DELETE_PAGE",
31
+ DUPLICATE_PAGE: "DUPLICATE_PAGE",
32
+ CHANGE_SLUG: "CHANGE_SLUG",
33
+ TAKE_OFFLINE: "TAKE_OFFLINE",
34
+ PUBLISH_PAGE: "PUBLISH_PAGE",
35
+ PUBLISH_CHANGES: "PUBLISH_CHANGES",
36
+ ADD_NEW_LANGUAGE: "ADD_NEW_LANGUAGE",
37
+ EDIT_LANGUAGE: "EDIT_LANGUAGE",
38
+ DELETE_LANGUAGE: "DELETE_LANGUAGE",
39
+ GET_CHANGES: "GET_CHANGES",
40
+ GET_SERVER_BLOCK: "GET_SERVER_BLOCK",
41
+ GET_LANGUAGE_PAGES: "GET_LANGUAGE_PAGES",
42
+ GET_PROJECT_PAGES: "GET_PROJECT_PAGES",
43
+ GET_WEBSITE_PAGES: "GET_WEBSITE_PAGES",
44
+ UPDATE_WEBSITE_SETTINGS: "UPDATE_WEBSITE_SETTINGS",
45
+ GET_COLLECTIONS: "GET_COLLECTIONS",
46
+ GET_PAGE_TYPES: "GET_PAGE_TYPES",
47
+ SEARCH_PAGES: "SEARCH_PAGES",
48
+ GET_WEBSITE_DRAFT_SETTINGS: "GET_WEBSITE_DRAFT_SETTINGS",
49
+ AI_CONTEXT: "AI_CONTEXT",
50
+ GET_WEBSITE_DATA: "GET_WEBSITE_DATA",
51
+ UPDATE_WEBSITE_DATA: "UPDATE_WEBSITE_DATA",
52
+ GET_CHAI_USER: "GET_CHAI_USER",
53
+ GET_SEO_FIELDS: "GET_SEO_FIELDS",
54
+ GET_BUILDER_PAGE_DATA: "GET_BUILDER_PAGE_DATA",
55
+ GET_PAGE_REVISIONS: "GET_PAGE_REVISIONS",
56
+ DELETE_PAGE_REVISION: "DELETE_PAGE_REVISION",
57
+ RESTORE_PAGE_REVISION: "RESTORE_PAGE_REVISION",
58
+ GET_REVISION_DATA: "GET_REVISION_DATA",
59
+ GET_PAGE_DATA: "GET_PAGE_DATA",
60
+ GET_COMPARE_DATA: "GET_COMPARE_DATA",
61
+ GET_ROLE_AND_PERMISSIONS: "GET_ROLE_AND_PERMISSIONS",
62
+ UPSERT_LIBRARY_ITEM: "UPSERT_LIBRARY_ITEM",
63
+ GET_LIBRARIES: "GET_LIBRARIES",
64
+ GET_LIBRARY_ITEM: "GET_LIBRARY_ITEM",
65
+ GET_LIBRARY_ITEMS: "GET_LIBRARY_ITEMS",
66
+ DELETE_LIBRARY_ITEM: "DELETE_LIBRARY_ITEM",
67
+ MARK_AS_TEMPLATE: "MARK_AS_TEMPLATE",
68
+ UNMARK_AS_TEMPLATE: "UNMARK_AS_TEMPLATE",
69
+ GET_TEMPLATES_BY_TYPE: "GET_TEMPLATES_BY_TYPE",
70
+ GET_DYNAMIC_PAGES: "GET_DYNAMIC_PAGES",
71
+ GET_APP_SHARED_JSONLD: "GET_APP_SHARED_JSONLD",
72
+ UPDATE_APP_SHARED_JSONLD: "UPDATE_APP_SHARED_JSONLD",
73
+ ADD_GLOBAL_SCHEMA: "ADD_GLOBAL_SCHEMA",
74
+ UPDATE_GLOBAL_SCHEMA: "UPDATE_GLOBAL_SCHEMA",
75
+ DELETE_GLOBAL_SCHEMA: "DELETE_GLOBAL_SCHEMA",
76
+ TOGGLE_PAGE_GLOBAL_SCHEMA: "TOGGLE_PAGE_GLOBAL_SCHEMA",
77
+ APPLY_SCHEMA_TO_ALL_PAGES: "APPLY_SCHEMA_TO_ALL_PAGES",
78
+ REMOVE_SCHEMA_FROM_ALL_PAGES: "REMOVE_SCHEMA_FROM_ALL_PAGES",
79
+ // DAM Actions
80
+ UPLOAD_ASSET: "UPLOAD_ASSET",
81
+ DELETE_ASSET: "DELETE_ASSET",
82
+ UPDATE_ASSET: "UPDATE_ASSET",
83
+ GET_ASSETS: "GET_ASSETS",
84
+ GET_ASSET: "GET_ASSET"
85
+ }, li = Ee({}), Dn = () => pe(li), ge = (e, t) => {
86
+ const [n] = Dn();
87
+ return q(() => H(n, e, t), [n, e, t]);
88
+ }, b = () => ge("apiUrl", "/chai/api"), xs = () => ge("websocket", null), ci = async (e, t, n = {}) => await fetch(e, {
89
+ method: "POST",
90
+ headers: {
91
+ "Content-Type": "application/json",
92
+ ...n
93
+ },
94
+ body: JSON.stringify(t)
95
+ }), zc = () => {
96
+ const e = I(), t = b();
97
+ return z(
98
+ async ({
99
+ body: n,
100
+ headers: s = {},
101
+ url: r = t,
102
+ streamResponse: a = !1
103
+ }) => e(r, n, s, a),
104
+ [e]
105
+ );
106
+ }, I = () => {
107
+ const e = ge("onLogout"), t = ge("getAccessToken"), n = b();
108
+ return z(
109
+ async (s = n, r, a = {}, i = !1) => {
110
+ const o = await t();
111
+ try {
112
+ const l = H(r, "action", "").toLowerCase(), f = await ci(s + (l ? `?action=${l}` : ""), r, {
113
+ ...a,
114
+ Authorization: `Bearer ${o}`
115
+ });
116
+ if (i)
117
+ return f;
118
+ if (f.status === 401)
119
+ return console.log("401 Response", f), e(), window.location.reload(), null;
120
+ if (!f.ok) {
121
+ const d = await f.json();
122
+ throw console.error(`API Error (${f.status}):`, d), {
123
+ status: f.status,
124
+ statusText: f.statusText,
125
+ ...d,
126
+ message: d.error || d.message || `Server error: ${f.status}`
127
+ };
128
+ }
129
+ return await f.json();
130
+ } catch (l) {
131
+ throw console.error("API request failed:", r, l), l;
132
+ }
133
+ },
134
+ [e, t]
135
+ );
136
+ };
137
+ function ve() {
138
+ const [e, t] = K(
139
+ new URLSearchParams(window.location.search)
140
+ );
141
+ return se(() => {
142
+ const n = () => {
143
+ t(new URLSearchParams(window.location.search));
144
+ };
145
+ return window.addEventListener("popstate", n), () => {
146
+ window.removeEventListener("popstate", n);
147
+ };
148
+ }, []), [e, t];
149
+ }
150
+ const Me = (e) => {
151
+ const t = b(), [n] = ve(), s = e ?? n.get("page"), r = I();
152
+ return re({
153
+ queryKey: [E.GET_LANGUAGE_PAGES, s],
154
+ staleTime: 1 / 0,
155
+ gcTime: 0,
156
+ placeholderData: [],
157
+ queryFn: async () => {
158
+ if (!s) return null;
159
+ const a = await r(t, {
160
+ action: E.GET_LANGUAGE_PAGES,
161
+ data: { id: s }
162
+ });
163
+ return ya(Aa(a, "primaryPage"));
164
+ },
165
+ enabled: !!s
166
+ });
167
+ }, ui = Ee(null), Ds = () => pe(ui), kn = () => {
168
+ const [e] = Ds();
169
+ return (e == null ? void 0 : e.slug) || "";
170
+ };
171
+ function di(e, t) {
172
+ const [n, s] = K(e);
173
+ return se(() => {
174
+ const r = setTimeout(() => s(e), t);
175
+ return () => clearTimeout(r);
176
+ }, [e, t]), n;
177
+ }
178
+ const fi = ({ query: e, uuid: t }) => {
179
+ const { selectedLang: n, fallbackLang: s } = Pe(), { data: r } = oe(), a = r == null ? void 0 : r.pageType, i = b(), o = I(), { data: l, isFetching: f } = re({
180
+ queryKey: [E.GET_DYNAMIC_PAGES, e, a, t],
181
+ staleTime: 3600 * 1e3,
182
+ placeholderData: [],
183
+ queryFn: async () => await o(i, {
184
+ action: E.GET_DYNAMIC_PAGES,
185
+ data: { query: e, pageType: a, uuid: t }
186
+ }) || [],
187
+ enabled: !!a
188
+ }), d = q(() => n === "" ? l.filter((u) => u.lang === "" || u.lang === s) : l.filter((u) => u.lang === n), [n, s, l]);
189
+ return { allLangPages: l, data: d, isFetching: f };
190
+ }, hi = () => {
191
+ const { selectedLang: e, fallbackLang: t } = Pe(), [n, s] = Ds(), [r, a] = K(""), i = di(r, 500), { allLangPages: o, data: l, isFetching: f } = fi({ query: i }), d = z((h) => s(h), [s]), u = z((h) => a(h), [a]), g = z(() => {
192
+ if (!n) return;
193
+ const h = !(n != null && n.primaryPage), p = e.length === 0, T = h ? n == null ? void 0 : n.id : n == null ? void 0 : n.primaryPage, x = o.filter(
194
+ (y) => (y == null ? void 0 : y.primaryPage) === T || y.id === T
195
+ ).find((y) => p ? y.lang === e || y.lang === t : y.lang === e);
196
+ s(x || n);
197
+ }, [n, e, o, s, t]);
198
+ return {
199
+ isFetching: f,
200
+ dynamicPage: n,
201
+ searchQuery: r,
202
+ selectedLang: e,
203
+ dynamicPages: l,
204
+ allLangPages: o,
205
+ updateDynamicPage: d,
206
+ updateSearchQuery: u,
207
+ onChangeLanguage: g
208
+ };
209
+ }, gi = Ee({ lastSaved: void 0 }), ks = () => pe(gi), oe = () => {
210
+ const [e] = ve(), t = e.get("page"), { data: n, isFetching: s } = Me();
211
+ return { data: q(() => ({ ...ie(n, { id: t }) || {} }), [n, t]), isFetching: s };
212
+ }, Le = () => {
213
+ const [e] = ve(), t = e.get("lang") ?? "", { data: n, isFetching: s } = Me();
214
+ return { data: q(() => ie(n, { lang: t }) || {}, [n, t]), isFetching: s };
215
+ }, mi = Ee({}), Ei = () => pe(mi), pi = () => {
216
+ const { data: e } = Le(), t = kn(), n = ge("getLiveUrl", vs), s = e == null ? void 0 : e.slug, r = n(s || "/");
217
+ return t ? r + t : r;
218
+ }, le = {
219
+ ...Rr,
220
+ //pages
221
+ ADD_PAGE: "add_page",
222
+ EDIT_PAGE: "edit_page",
223
+ DELETE_PAGE: "delete_page",
224
+ CHANGE_PAGE_TYPE: "change_page_type",
225
+ PUBLISH_PAGE: "publish_page",
226
+ UNPUBLISH_PAGE: "unpublish_page",
227
+ MARK_AS_TEMPLATE: "mark_as_template",
228
+ //SEO
229
+ EDIT_SEO: "edit_seo",
230
+ // revisions
231
+ RESTORE_REVISION: "restore_revision",
232
+ DELETE_REVISION: "delete_revision",
233
+ DELETE_LIBRARY_BLOCK: "delete_library_block"
234
+ }, Ce = () => {
235
+ const e = b(), t = I();
236
+ return re({
237
+ queryKey: [E.GET_PAGE_TYPES],
238
+ staleTime: 1 / 0,
239
+ placeholderData: [],
240
+ queryFn: async () => t(e, { action: E.GET_PAGE_TYPES })
241
+ });
242
+ }, yi = (e) => {
243
+ const { data: t } = Ce();
244
+ return q(() => t == null ? void 0 : t.find((n) => n.key === e), [t, e]);
245
+ }, Ai = () => {
246
+ const e = b(), t = I();
247
+ return Y({
248
+ mutationFn: async ({ pageType: n, query: s }) => {
249
+ try {
250
+ return t(e, {
251
+ action: E.SEARCH_PAGES,
252
+ data: {
253
+ pageType: n,
254
+ query: Array.isArray(s) && s.length > 0 ? s[0] : s
255
+ }
256
+ }) || [];
257
+ } catch (r) {
258
+ return console.error(r), [];
259
+ }
260
+ }
261
+ });
262
+ }, Ti = ({
263
+ page: e,
264
+ setDuplicatePage: t,
265
+ setAddEditPage: n,
266
+ setUnpublishPage: s,
267
+ setDeletePage: r,
268
+ setMarkAsTemplate: a,
269
+ setUnmarkAsTemplate: i,
270
+ children: o,
271
+ isLanguagePage: l
272
+ }) => {
273
+ const { t: f } = we(), { hasPermission: d } = Ts(), { data: u } = Ce(), g = q(() => ie(u, { key: e.pageType }), [u, e.pageType]), h = q(() => !!e.isTemplate, [e.isTemplate]), p = q(() => !!(g != null && g.hasSlug), [g == null ? void 0 : g.hasSlug]);
274
+ return !d(le.EDIT_PAGE) && !d(le.DELETE_PAGE) && !d(le.UNPUBLISH_PAGE) || !e ? null : /* @__PURE__ */ m(Ln, { children: [
275
+ /* @__PURE__ */ c(Cn, { asChild: !0, onClick: (S) => S.stopPropagation(), children: o }),
276
+ /* @__PURE__ */ m(Gn, { align: "center", className: "text-sm", children: [
277
+ d(le.ADD_PAGE) && !l && /* @__PURE__ */ m(
278
+ ce,
279
+ {
280
+ className: "flex cursor-pointer items-center gap-2",
281
+ onClick: (S) => {
282
+ S.stopPropagation(), t(e);
283
+ },
284
+ children: [
285
+ /* @__PURE__ */ c(Da, { className: "size-3" }),
286
+ "Duplicate page"
287
+ ]
288
+ }
289
+ ),
290
+ d(le.EDIT_PAGE) && /* @__PURE__ */ m(
291
+ ce,
292
+ {
293
+ className: "flex cursor-pointer items-center gap-2",
294
+ onClick: (S) => {
295
+ S.stopPropagation(), n({
296
+ ...e,
297
+ global: !(g != null && g.hasSlug)
298
+ });
299
+ },
300
+ children: [
301
+ /* @__PURE__ */ c(ka, { className: "size-3" }),
302
+ "Edit"
303
+ ]
304
+ }
305
+ ),
306
+ (e == null ? void 0 : e.online) && d(le.UNPUBLISH_PAGE) && /* @__PURE__ */ m(
307
+ ce,
308
+ {
309
+ className: "flex cursor-pointer items-center gap-2",
310
+ onClick: (S) => {
311
+ S.stopPropagation(), s(e);
312
+ },
313
+ children: [
314
+ /* @__PURE__ */ c(Ra, { className: "size-3" }),
315
+ f("Unpublish")
316
+ ]
317
+ }
318
+ ),
319
+ d(le.DELETE_PAGE) && /* @__PURE__ */ m(
320
+ ce,
321
+ {
322
+ className: "flex cursor-pointer items-center gap-2",
323
+ onClick: (S) => {
324
+ S.stopPropagation(), r(e);
325
+ },
326
+ children: [
327
+ /* @__PURE__ */ c(Ua, { className: "size-3" }),
328
+ f("Delete")
329
+ ]
330
+ }
331
+ ),
332
+ d(le.MARK_AS_TEMPLATE) && p && !l && /* @__PURE__ */ c(he, { children: h ? /* @__PURE__ */ m(
333
+ ce,
334
+ {
335
+ className: "flex cursor-pointer items-center gap-2",
336
+ onClick: (S) => {
337
+ S.stopPropagation(), i(e);
338
+ },
339
+ children: [
340
+ /* @__PURE__ */ c(Zn, { className: "size-3" }),
341
+ f("Unmark as template")
342
+ ]
343
+ }
344
+ ) : /* @__PURE__ */ m(
345
+ ce,
346
+ {
347
+ className: "flex cursor-pointer items-center gap-2",
348
+ onClick: (S) => {
349
+ S.stopPropagation(), a(e);
350
+ },
351
+ children: [
352
+ /* @__PURE__ */ c(Zn, { className: "size-3" }),
353
+ f("Mark as template")
354
+ ]
355
+ }
356
+ ) })
357
+ ] })
358
+ ] });
359
+ }, Be = () => {
360
+ const e = b(), t = I();
361
+ return re({
362
+ queryKey: [E.GET_WEBSITE_DRAFT_SETTINGS],
363
+ staleTime: 300 * 1e3,
364
+ placeholderData: {
365
+ languages: [],
366
+ theme: { fontFamily: "", borderRadius: "", colors: {} },
367
+ appKey: "",
368
+ fallbackLang: "",
369
+ designTokens: {}
370
+ },
371
+ queryFn: async () => t(e, {
372
+ action: E.GET_WEBSITE_DRAFT_SETTINGS,
373
+ data: { draft: !0 }
374
+ })
375
+ });
376
+ }, Rn = () => {
377
+ const e = ge("currentUser"), t = ge("onLogout");
378
+ return {
379
+ isLoggedIn: !!e,
380
+ user: e,
381
+ logout: t
382
+ };
383
+ }, te = {
384
+ LOCKED: "LOCKED",
385
+ EDITING: "EDITING",
386
+ CHECKING: "CHECKING",
387
+ TAKE_OVER_REQUESTED: "TAKE_OVER_REQUESTED",
388
+ ACTIVE_IN_ANOTHER_TAB: "ACTIVE_IN_ANOTHER_TAB",
389
+ FORCE_TAKE_OVER: "FORCE_TAKE_OVER",
390
+ CONNECTION_LOST: "CONNECTION_LOST"
391
+ }, ne = {
392
+ FORCE_TAKE_OVER: "FORCE_TAKE_OVER",
393
+ TAKE_OVER_REQUEST: "TAKE_OVER_REQUEST",
394
+ TAKE_OVER_APPROVED: "TAKE_OVER_APPROVED",
395
+ TAKE_OVER_REJECTED: "TAKE_OVER_REJECTED",
396
+ FORCE_TAKE_OVER_REQUEST: "FORCE_TAKE_OVER_REQUEST",
397
+ CONTINUE_EDITING_IN_THIS_CLIENT: "CONTINUE_EDITING_IN_THIS_CLIENT",
398
+ CONTINUE_EDITING_IN_THIS_TAB_REQUEST: "CONTINUE_EDITING_IN_THIS_TAB_REQUEST"
399
+ }, Si = ["sync", "join", "leave"], _i = [
400
+ ne.FORCE_TAKE_OVER,
401
+ ne.TAKE_OVER_REQUEST,
402
+ ne.TAKE_OVER_APPROVED,
403
+ ne.TAKE_OVER_REJECTED,
404
+ ne.FORCE_TAKE_OVER_REQUEST,
405
+ ne.CONTINUE_EDITING_IN_THIS_CLIENT,
406
+ ne.CONTINUE_EDITING_IN_THIS_TAB_REQUEST
407
+ ], Pi = Ee({}), Rs = Ee(null), wi = Ee(te.CHECKING), vi = Ee({}), bi = (e) => {
408
+ const t = {}, n = Ta(Is(e).map(Ns).filter(Boolean), "pageId");
409
+ return Object.entries(n).forEach(
410
+ ([s, r]) => t[s] = bs(r, "onlineAt")
411
+ ), t;
412
+ }, Ii = (e) => {
413
+ const t = bs(Is(e).map(Ns).filter(Boolean), "onlineAt"), n = t == null ? void 0 : t.onlineAt;
414
+ return n ? n - 100 : +/* @__PURE__ */ new Date() - 1e3 * 60 * 60 * 4;
415
+ }, rn = () => {
416
+ const { user: e } = Rn();
417
+ return e == null ? void 0 : e.id;
418
+ }, Ni = () => {
419
+ const { data: e } = Be();
420
+ return `WEBSITE:${e == null ? void 0 : e.appKey}`;
421
+ }, Ct = () => {
422
+ const { data: e } = oe();
423
+ return e == null ? void 0 : e.id;
424
+ }, Ue = crypto.randomUUID();
425
+ let dn = null;
426
+ const Us = () => {
427
+ const [e, t] = pe(Pi);
428
+ return { pageToUser: e, setPageToUser: t };
429
+ }, ye = () => {
430
+ const [e, t] = pe(wi), n = [te.LOCKED, te.ACTIVE_IN_ANOTHER_TAB].includes(e), s = [te.EDITING].includes(e);
431
+ return { pageStatus: e, setPageStatus: t, isLocked: n, isEditing: s };
432
+ }, Ms = () => {
433
+ const [e, t] = pe(vi);
434
+ return { pageLockMeta: e, setPageLockMeta: t };
435
+ }, Li = () => {
436
+ const e = Ct(), { pageToUser: t } = Us();
437
+ return q(() => t[e], [t, e]);
438
+ }, Un = () => {
439
+ const e = xs(), { setPageStatus: t } = ye(), [n] = pe(Rs);
440
+ return se(() => {
441
+ if (clearTimeout(dn), !e)
442
+ return dn = setTimeout(() => {
443
+ e || t(te.EDITING);
444
+ }, 500), () => clearTimeout(dn);
445
+ }, [e, t]), n;
446
+ }, Ci = () => {
447
+ const e = Ct(), t = rn(), n = Un(), { setPageToUser: s } = Us(), { setPageStatus: r, pageStatus: a } = ye(), i = Ie(e);
448
+ return i.current = e, z(
449
+ (o) => {
450
+ const l = o || n;
451
+ if (!l) return [];
452
+ const f = l == null ? void 0 : l.presenceState(), d = bi(f);
453
+ s(d);
454
+ const u = d[i.current];
455
+ if (!u)
456
+ r(te.CHECKING);
457
+ else if (!t)
458
+ r(te.CHECKING);
459
+ else if (u.userId === t && u.clientId === Ue) {
460
+ if (a === te.TAKE_OVER_REQUESTED)
461
+ return;
462
+ r(te.EDITING);
463
+ } else u.userId === t && u.clientId !== Ue ? r(te.ACTIVE_IN_ANOTHER_TAB) : r(te.LOCKED);
464
+ },
465
+ [n, s, r, t, a]
466
+ );
467
+ }, Gi = () => {
468
+ const e = rn(), t = Ct(), n = Un(), s = Li(), { setPageLockMeta: r } = Ms(), a = Ie(t);
469
+ return a.current = t, z(
470
+ async (i, o) => {
471
+ if (!n) return;
472
+ const l = o || {};
473
+ l.userId = e, l.pageId = a.current, l.senderClientId = Ue, l.receiverClientId = (o == null ? void 0 : o.requestingClientId) || (s == null ? void 0 : s.clientId), await n.send({ event: i, payload: l, type: "broadcast" }), r({});
474
+ },
475
+ [n, e, s, r]
476
+ );
477
+ }, Oi = () => {
478
+ const e = rn(), t = Ct(), n = Un(), { setPageStatus: s } = ye(), { setPageLockMeta: r } = Ms(), a = Gi(), i = Ie(t), { savePageAsync: o } = Re();
479
+ return i.current = t, z(
480
+ (l) => async ({ payload: f }) => {
481
+ const d = f || {};
482
+ if (!(!(d != null && d.pageId) || (d == null ? void 0 : d.pageId) !== i.current || (d == null ? void 0 : d.receiverClientId) !== Ue))
483
+ switch (r({}), l) {
484
+ case ne.FORCE_TAKE_OVER_REQUEST:
485
+ case ne.CONTINUE_EDITING_IN_THIS_TAB_REQUEST: {
486
+ try {
487
+ await o(!0);
488
+ } catch (u) {
489
+ console.error("Failed to save page before releasing lock:", u);
490
+ }
491
+ await a(ne.CONTINUE_EDITING_IN_THIS_CLIENT, { requestingClientId: d == null ? void 0 : d.senderClientId }), setTimeout(() => r({ type: l }), 0);
492
+ break;
493
+ }
494
+ case ne.TAKE_OVER_REQUEST: {
495
+ r({ requestingUserId: d == null ? void 0 : d.userId, requestingClientId: d == null ? void 0 : d.senderClientId }), s(te.TAKE_OVER_REQUESTED);
496
+ break;
497
+ }
498
+ case ne.CONTINUE_EDITING_IN_THIS_CLIENT: {
499
+ const u = Ii(n == null ? void 0 : n.presenceState());
500
+ s(te.CHECKING), await (n == null ? void 0 : n.track({ onlineAt: u, pageId: i.current, userId: e, clientId: Ue }));
501
+ break;
502
+ }
503
+ case ne.TAKE_OVER_REJECTED: {
504
+ r({ type: ne.TAKE_OVER_REJECTED });
505
+ break;
506
+ }
507
+ }
508
+ },
509
+ [a, r, s, n, e, o]
510
+ );
511
+ }, Wc = () => {
512
+ const e = xs(), t = rn(), n = Ct(), s = Ni(), [r, a] = pe(Rs), i = Oi(), o = Ci(), l = Ie(i), f = Ie(o);
513
+ se(() => {
514
+ l.current = i, f.current = o;
515
+ }, [i, o]), se(() => {
516
+ if (!e || !t || !s || r && r.topic === s) return;
517
+ const d = e.channel(s, {
518
+ config: { presence: { key: Ue } }
519
+ });
520
+ return _i.forEach((u) => {
521
+ d.on("broadcast", { event: u }, (g) => {
522
+ l.current(u)(g);
523
+ });
524
+ }), Si.forEach((u) => {
525
+ d.on("presence", { event: u }, () => {
526
+ f.current(d);
527
+ });
528
+ }), d.subscribe(async (u) => {
529
+ u === "SUBSCRIBED" ? a(d) : (u === "CHANNEL_ERROR" || u === "TIMED_OUT") && console.log("Realtime connection failed", u);
530
+ }), () => {
531
+ d.unsubscribe();
532
+ };
533
+ }, [e, t, s, a]), se(() => (r && n && t && r.track({
534
+ pageId: n,
535
+ userId: t,
536
+ clientId: Ue,
537
+ onlineAt: +/* @__PURE__ */ new Date()
538
+ }), () => {
539
+ r && n && r.untrack();
540
+ }), [r, n, t]);
541
+ }, Mn = () => {
542
+ const { data: e } = Be();
543
+ return q(
544
+ () => (e == null ? void 0 : e.fallbackLang) || "en",
545
+ [e]
546
+ );
547
+ }, Bs = () => {
548
+ const e = I(), t = b();
549
+ return re({
550
+ queryKey: [E.GET_WEBSITE_PAGES],
551
+ staleTime: 1e3 * 60 * 5,
552
+ queryFn: async () => e(t, { action: E.GET_WEBSITE_PAGES }) || [],
553
+ placeholderData: (n) => n || []
554
+ });
555
+ }, jc = (e) => {
556
+ const t = I(), n = b(), s = Mn();
557
+ return re({
558
+ queryKey: [E.GET_WEBSITE_PAGES, e, s],
559
+ staleTime: 1e3 * 60 * 5,
560
+ enabled: !!e,
561
+ queryFn: async () => {
562
+ if (s === e) return {};
563
+ const r = await t(n, { action: E.GET_WEBSITE_PAGES, data: { lang: e } }) || [];
564
+ return Sa(
565
+ qt(r, (a) => ({ ...a, lang: e })),
566
+ "primaryPage"
567
+ );
568
+ },
569
+ placeholderData: (r) => r || {}
570
+ });
571
+ };
572
+ function Fs(e, t, n = !1) {
573
+ const s = e.toString() ? `?${e.toString()}` : "/";
574
+ n ? window.history.replaceState(null, "", s) : window.history.pushState({}, "", s), t(e), window.dispatchEvent(new PopStateEvent("popstate"));
575
+ }
576
+ const xi = V(() => import("./page-manager-new-CzX22g2n.js")), Ks = ({ children: e }) => {
577
+ const { t } = we(), [n, s] = ve(), r = n.get("page"), { data: a, isFetching: i } = oe(), { data: o, isFetching: l } = Bs(), [f, d] = K(!1), [u, g] = K(!0), { savePage: h } = Re(), p = !!r && !fe(a), { isLocked: T } = ye(), S = q(() => {
578
+ if (!o || l) return !1;
579
+ const v = o.find((U) => U.slug === "/");
580
+ return v == null ? void 0 : v.id;
581
+ }, [o, l]);
582
+ se(() => {
583
+ if (l || !S || o.some((N) => N.id === r)) return;
584
+ const U = new URLSearchParams({ page: S });
585
+ Fs(U, s), !l && o && g(!1);
586
+ }, [r, l, o, S, s]);
587
+ const x = !u && !r, y = !u && !i && fe(a), w = f || x || y;
588
+ return /* @__PURE__ */ m(he, { children: [
589
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-x-1", children: /* @__PURE__ */ c("div", { className: "relative", children: /* @__PURE__ */ m(en, { children: [
590
+ /* @__PURE__ */ c(
591
+ tn,
592
+ {
593
+ asChild: !0,
594
+ onClick: () => {
595
+ T || h(), d(!0);
596
+ },
597
+ children: e || /* @__PURE__ */ c(M, { variant: "outline", className: "flex w-full items-center space-x-2 py-1", children: /* @__PURE__ */ c(Ma, { className: "h-4 w-4" }) }, "template-viewer")
598
+ }
599
+ ),
600
+ /* @__PURE__ */ c(nn, { side: "right", children: /* @__PURE__ */ c("p", { children: t("Open pages manager") }) })
601
+ ] }) }) }),
602
+ /* @__PURE__ */ c(Ss, { open: w, onOpenChange: (v) => !v && p && d(!1), children: /* @__PURE__ */ m(
603
+ _s,
604
+ {
605
+ side: "left",
606
+ "aria-describedby": "pages-manager-description",
607
+ className: `z-50 !min-w-[50vh] !max-w-[800px] border-border p-0 ${p ? "" : "sheet-hide-close-btn"}`,
608
+ children: [
609
+ /* @__PURE__ */ m(Ur, { className: "mb-3 px-4 pt-4", children: [
610
+ /* @__PURE__ */ m(Mr, { className: "flex items-center gap-2 text-sm font-semibold", children: [
611
+ /* @__PURE__ */ c("div", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ c(Ba, { className: "h-4 w-4" }) }),
612
+ /* @__PURE__ */ m("div", { className: "flex flex-col", children: [
613
+ /* @__PURE__ */ c("span", { className: "text-sm font-semibold", children: t("Pages") }),
614
+ /* @__PURE__ */ c("span", { id: "pages-manager-description", className: "text-xs font-normal text-muted-foreground", children: t("Manage your site structure") })
615
+ ] })
616
+ ] }),
617
+ /* @__PURE__ */ c(Br, { className: "sr-only", children: t("Manage your site structure") })
618
+ ] }),
619
+ /* @__PURE__ */ c("div", { className: "h-[calc(100vh-80px)] overflow-y-auto", children: w && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(xi, { close: () => d(!1) }) }) })
620
+ ]
621
+ }
622
+ ) })
623
+ ] });
624
+ }, Di = V(() => import("./add-new-page-VW2wAYZp.js")), ki = V(() => import("./delete-page-BzyX9TN-.js")), Ri = V(() => import("./duplicate-page-BR7Dlo9d.js")), Ui = V(() => import("./mark-as-template-D295ZQtU.js")), Mi = V(() => import("./unmark-as-template-CZ9sQp_P.js")), Bi = V(() => import("./unpublish-page-D4VwOlxc.js")), Fi = () => {
625
+ const [e, t] = K(null), [n, s] = K(null), [r, a] = K(null), [i, o] = K(null), [l, f] = K(null), [d, u] = K(null), { data: g, isFetching: h } = Le(), { selectedLang: p, fallbackLang: T } = Pe(), { data: S } = Me(), x = S == null ? void 0 : S.find((N) => N.lang === p), { isLocked: y } = ye(), w = !(g != null && g.slug), v = On(zt);
626
+ if (!g) return null;
627
+ const U = (N) => {
628
+ p.length > 0 && p !== T ? v({
629
+ edit: !0,
630
+ id: N == null ? void 0 : N.id,
631
+ primaryPage: N == null ? void 0 : N.primaryPage
632
+ }) : u(N);
633
+ };
634
+ return /* @__PURE__ */ m(he, { children: [
635
+ /* @__PURE__ */ m("div", { className: "flex items-center justify-between rounded px-[2px] transition-colors duration-200", children: [
636
+ /* @__PURE__ */ c(Ks, { children: /* @__PURE__ */ c(
637
+ M,
638
+ {
639
+ className: "flex h-7 max-w-[200px] cursor-pointer items-center truncate rounded px-1 text-xs font-medium",
640
+ variant: "ghost",
641
+ children: h ? /* @__PURE__ */ c($t, { className: "h-4 w-4 animate-spin text-slate-400" }) : /* @__PURE__ */ m("span", { className: "flex w-full cursor-pointer items-end overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-xs font-medium", children: [
642
+ w ? /* @__PURE__ */ c(Fa, { className: "mr-1 h-4 w-4" }) : /* @__PURE__ */ c(Ka, { className: "mr-1 h-4 w-4" }),
643
+ H(x || g, "name") ?? ""
644
+ ] })
645
+ }
646
+ ) }),
647
+ y ? /* @__PURE__ */ c(
648
+ M,
649
+ {
650
+ variant: "ghost",
651
+ size: "icon",
652
+ className: "h-7 w-7 cursor-not-allowed rounded opacity-50 hover:bg-transparent",
653
+ children: /* @__PURE__ */ c(Xn, { className: "h-4 w-4" })
654
+ }
655
+ ) : /* @__PURE__ */ c(
656
+ Ti,
657
+ {
658
+ page: g,
659
+ setDuplicatePage: (N) => f(N),
660
+ setAddEditPage: (N) => U(N),
661
+ setUnpublishPage: (N) => s(N),
662
+ setDeletePage: (N) => t(N),
663
+ setMarkAsTemplate: (N) => a(N),
664
+ setUnmarkAsTemplate: (N) => o(N),
665
+ isLanguagePage: p.length > 0 && p !== T,
666
+ children: /* @__PURE__ */ c(M, { variant: "ghost", size: "icon", className: "h-7 w-7 rounded", children: /* @__PURE__ */ c(Xn, { className: "h-4 w-4" }) })
667
+ }
668
+ )
669
+ ] }),
670
+ d && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(
671
+ Di,
672
+ {
673
+ closePanel: () => u(null),
674
+ editPage: () => {
675
+ },
676
+ addEditPage: d,
677
+ setAddEditPage: u
678
+ }
679
+ ) }),
680
+ e && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(ki, { page: e, onClose: () => t(null) }) }),
681
+ n && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(Bi, { page: n, onClose: () => s(null) }) }),
682
+ r && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(Ui, { page: r, onClose: () => a(null) }) }),
683
+ i && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(Mi, { page: i, onClose: () => o(null) }) }),
684
+ l && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(
685
+ Ri,
686
+ {
687
+ page: l,
688
+ onClose: () => f(null),
689
+ closePanel: () => u(null)
690
+ }
691
+ ) })
692
+ ] });
693
+ }, Vs = ({ children: e, className: t = "" }) => /* @__PURE__ */ c(
694
+ "div",
695
+ {
696
+ className: Qt(
697
+ "fixed bottom-0 left-0 right-0 top-[50px] z-[20] flex w-screen flex-col items-center justify-center bg-black/40 transition-all",
698
+ t
699
+ ),
700
+ children: e
701
+ }
702
+ ), Ki = ({ hasDynamicPage: e }) => /* @__PURE__ */ c(Vs, { children: /* @__PURE__ */ m("div", { className: "flex min-w-[300px] max-w-[400px] flex-col items-center justify-center rounded-lg border bg-white p-4 shadow-lg", children: [
703
+ /* @__PURE__ */ c("h1", { className: "text-lg font-medium", children: e ? "Select a page" : "No pages found" }),
704
+ /* @__PURE__ */ c("p", { className: "pt-2 text-center text-sm font-light text-gray-600", children: e ? "Please select a page from the list in the top header. This will enable you to edit the page." : "Please add a new page" })
705
+ ] }) }), Rt = {
706
+ ab: "Abkhazian",
707
+ aa: "Afar",
708
+ af: "Afrikaans",
709
+ ak: "Akan",
710
+ sq: "Albanian",
711
+ am: "Amharic",
712
+ ar: "Arabic",
713
+ an: "Aragonese",
714
+ hy: "Armenian",
715
+ as: "Assamese",
716
+ av: "Avaric",
717
+ ae: "Avestan",
718
+ ay: "Aymara",
719
+ az: "Azerbaijani",
720
+ bm: "Bambara",
721
+ ba: "Bashkir",
722
+ eu: "Basque",
723
+ be: "Belarusian",
724
+ bn: "Bengali",
725
+ bh: "Bihari",
726
+ bi: "Bislama",
727
+ bs: "Bosnian",
728
+ br: "Breton",
729
+ bg: "Bulgarian",
730
+ my: "Burmese",
731
+ ca: "Catalan",
732
+ ch: "Chamorro",
733
+ ce: "Chechen",
734
+ ny: "Chichewa",
735
+ zh: "Chinese",
736
+ "zh-Hans": "Chinese (Simplified)",
737
+ "zh-Hant": "Chinese (Traditional)",
738
+ cv: "Chuvash",
739
+ kw: "Cornish",
740
+ co: "Corsican",
741
+ cr: "Cree",
742
+ hr: "Croatian",
743
+ cs: "Czech",
744
+ da: "Danish",
745
+ dv: "Maldivian",
746
+ nl: "Dutch",
747
+ dz: "Dzongkha",
748
+ en: "English",
749
+ eo: "Esperanto",
750
+ et: "Estonian",
751
+ ee: "Ewe",
752
+ fo: "Faroese",
753
+ fj: "Fijian",
754
+ fi: "Finnish",
755
+ fr: "French",
756
+ ff: "Fula, Pular",
757
+ gl: "Galician",
758
+ gd: "Gaelic (Scottish)",
759
+ gv: "Manx",
760
+ ka: "Georgian",
761
+ de: "German",
762
+ el: "Greek",
763
+ kl: "Kalaallisut",
764
+ gn: "Guarani",
765
+ gu: "Gujarati",
766
+ ht: "Haitian Creole",
767
+ ha: "Hausa",
768
+ he: "Hebrew",
769
+ hz: "Herero",
770
+ hi: "Hindi",
771
+ ho: "Hiri Motu",
772
+ hu: "Hungarian",
773
+ is: "Icelandic",
774
+ io: "Ido",
775
+ ig: "Igbo",
776
+ id: "Indonesian",
777
+ ia: "Interlingua",
778
+ ie: "Interlingue",
779
+ iu: "Inuktitut",
780
+ ik: "Inupiak",
781
+ ga: "Irish",
782
+ it: "Italian",
783
+ ja: "Japanese",
784
+ jv: "Javanese",
785
+ kn: "Kannada",
786
+ kr: "Kanuri",
787
+ ks: "Kashmiri",
788
+ kk: "Kazakh",
789
+ km: "Khmer",
790
+ ki: "Kikuyu",
791
+ rw: "Kinyarwanda",
792
+ rn: "Kirundi",
793
+ ky: "Kyrgyz",
794
+ kv: "Komi",
795
+ kg: "Kongo",
796
+ ko: "Korean",
797
+ ku: "Kurdish",
798
+ kj: "Kwanyama",
799
+ lo: "Lao",
800
+ la: "Latin",
801
+ lv: "Latvian",
802
+ li: "Limburgish",
803
+ ln: "Lingala",
804
+ lt: "Lithuanian",
805
+ lu: "Luga-Katanga",
806
+ lg: "Luganda, Ganda",
807
+ lb: "Luxembourgish",
808
+ mk: "Macedonian",
809
+ mg: "Malagasy",
810
+ ms: "Malay",
811
+ ml: "Malayalam",
812
+ mt: "Maltese",
813
+ mi: "Maori",
814
+ mr: "Marathi",
815
+ mh: "Marshallese",
816
+ mo: "Moldavian",
817
+ mn: "Mongolian",
818
+ na: "Nauru",
819
+ nv: "Navajo",
820
+ ng: "Ndonga",
821
+ nd: "Northern Ndebele",
822
+ ne: "Nepali",
823
+ no: "Norwegian",
824
+ nb: "Norwegian bokmål",
825
+ nn: "Norwegian nynorsk",
826
+ ii: "Sichuan Yi",
827
+ oc: "Occitan",
828
+ oj: "Ojibwe",
829
+ cu: "Old Church Slavonic",
830
+ or: "Oriya",
831
+ om: "Oromo",
832
+ os: "Ossetian",
833
+ pi: "Pāli",
834
+ ps: "Pashto, Pushto",
835
+ fa: "Persian (Farsi)",
836
+ pl: "Polish",
837
+ pt: "Portuguese",
838
+ pa: "Punjabi (Eastern)",
839
+ qu: "Quechua",
840
+ rm: "Romansh",
841
+ ro: "Romanian",
842
+ ru: "Russian",
843
+ se: "Sami",
844
+ sm: "Samoan",
845
+ sg: "Sango",
846
+ sa: "Sanskrit",
847
+ sr: "Serbian",
848
+ sh: "Serbo-Croatian",
849
+ st: "Sesotho",
850
+ tn: "Setswana",
851
+ sn: "Shona",
852
+ sd: "Sindhi",
853
+ si: "Sinhalese",
854
+ ss: "Swati",
855
+ sk: "Slovak",
856
+ sl: "Slovenian",
857
+ so: "Somali",
858
+ nr: "Southern Ndebele",
859
+ es: "Spanish",
860
+ su: "Sundanese",
861
+ sw: "Swahili (Kiswahili)",
862
+ sv: "Swedish",
863
+ tl: "Tagalog",
864
+ ty: "Tahitian",
865
+ tg: "Tajik",
866
+ ta: "Tamil",
867
+ tt: "Tatar",
868
+ te: "Telugu",
869
+ th: "Thai",
870
+ bo: "Tibetan",
871
+ ti: "Tigrinya",
872
+ to: "Tonga",
873
+ ts: "Tsonga",
874
+ tr: "Turkish",
875
+ tk: "Turkmen",
876
+ tw: "Twi",
877
+ ug: "Uyghur",
878
+ uk: "Ukrainian",
879
+ ur: "Urdu",
880
+ uz: "Uzbek",
881
+ ve: "Venda",
882
+ vi: "Vietnamese",
883
+ vo: "Volapük",
884
+ wa: "Wallon",
885
+ cy: "Welsh",
886
+ wo: "Wolof",
887
+ fy: "Western Frisian",
888
+ xh: "Xhosa",
889
+ yi: "Yiddish",
890
+ yo: "Yoruba",
891
+ za: "Zhuang, Chuang",
892
+ zu: "Zulu"
893
+ }, Vi = V(() => import("./add-new-language-page-WmlCnytQ.js")), Hi = () => {
894
+ const e = ge("topLeftCorner", null);
895
+ return e ? /* @__PURE__ */ c("div", { className: "max-h-9 w-full overflow-hidden pr-2", children: Ga.createElement(e, {}) }) : null;
896
+ }, qi = ({
897
+ showAdd: e = !0,
898
+ variant: t = "ghost",
899
+ goToDefaultLang: n = !1
900
+ }) => {
901
+ const { fallbackLang: s, languages: r, selectedLang: a, setSelectedLang: i } = Pe(), o = fe(a) ? s : a, [, l] = ve(), { isLocked: f } = ye(), { t: d } = we();
902
+ se(() => {
903
+ const y = new URLSearchParams(window.location.search), w = y.get("lang");
904
+ w && (r.includes(w) ? i(w) : (y.delete("lang"), l(y), i("")));
905
+ }, [r, l, i]);
906
+ const u = On(zt), { data: g } = oe(), { data: h } = Be(), { data: p } = Me(), T = q(() => {
907
+ const y = Ls(
908
+ qt(H(h, "languages"), (w) => {
909
+ const v = ie(p, { lang: w });
910
+ return {
911
+ key: w,
912
+ value: H(Rt, w, w),
913
+ isLangPageAdded: !!v
914
+ };
915
+ })
916
+ ).filter(Boolean);
917
+ return [
918
+ {
919
+ key: s,
920
+ value: H(Rt, s),
921
+ isLangPageAdded: !0
922
+ },
923
+ ...y
924
+ ];
925
+ }, [s, p, h]), S = (y) => {
926
+ if (document.querySelector('[data-panel-id="seo"]')) {
927
+ const v = new CustomEvent("seo-language-switch-check", {
928
+ detail: {
929
+ fromLang: o,
930
+ toLang: y,
931
+ switchHandler: () => x(y)
932
+ }
933
+ });
934
+ window.dispatchEvent(v);
935
+ return;
936
+ }
937
+ x(y);
938
+ }, x = (y) => {
939
+ i(y);
940
+ const w = new URLSearchParams(window.location.search);
941
+ y === s ? w.delete("lang") : w.set("lang", y), Fs(w, l);
942
+ };
943
+ return fe(r) ? null : f ? /* @__PURE__ */ m(M, { variant: "ghost", size: "sm", className: "ml-px h-max cursor-not-allowed gap-2 py-1.5 opacity-50", children: [
944
+ /* @__PURE__ */ c(es, { className: "h-4 w-4" }),
945
+ H(Rt, o, o),
946
+ /* @__PURE__ */ c(yn, { className: "h-4 w-4" })
947
+ ] }) : n ? /* @__PURE__ */ c(M, { onClick: () => x(s), variant: "link", size: "sm", children: d("Switch to default language") }) : /* @__PURE__ */ c(he, { children: /* @__PURE__ */ m(Ln, { children: [
948
+ /* @__PURE__ */ c(Cn, { asChild: !0, className: "focus:outline-none", children: /* @__PURE__ */ m(
949
+ M,
950
+ {
951
+ disabled: !!f,
952
+ variant: t,
953
+ size: "sm",
954
+ className: "ml-px h-max gap-2 py-1.5",
955
+ children: [
956
+ /* @__PURE__ */ c(es, { className: "h-4 w-4" }),
957
+ H(Rt, o, o),
958
+ /* @__PURE__ */ c(yn, { className: "h-4 w-4" })
959
+ ]
960
+ }
961
+ ) }),
962
+ /* @__PURE__ */ m(Gn, { className: "space-y-1 border-border", children: [
963
+ qt(
964
+ T.filter((y) => y.isLangPageAdded),
965
+ (y) => /* @__PURE__ */ m(
966
+ ce,
967
+ {
968
+ className: Qt(
969
+ "flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",
970
+ y.key === o && "!bg-gray-200 text-gray-700"
971
+ ),
972
+ onClick: () => S(y.key),
973
+ children: [
974
+ /* @__PURE__ */ c("div", { className: "text-slate-600", children: y.value }),
975
+ y.key === s && /* @__PURE__ */ m("small", { className: "flex items-center gap-x-1 text-[9px] leading-none text-orange-500", children: [
976
+ /* @__PURE__ */ c(Va, { fill: "orange", className: "h-2 w-2" }),
977
+ "Primary"
978
+ ] })
979
+ ]
980
+ },
981
+ y.value
982
+ )
983
+ ),
984
+ e && !fe(T.filter((y) => !y.isLangPageAdded)) && /* @__PURE__ */ m(he, { children: [
985
+ /* @__PURE__ */ c(Fr, {}),
986
+ /* @__PURE__ */ m(
987
+ M,
988
+ {
989
+ size: "sm",
990
+ variant: "ghost",
991
+ onClick: () => {
992
+ g && u({
993
+ edit: !1,
994
+ primaryPage: g.id
995
+ });
996
+ },
997
+ className: "text-xs font-normal duration-200 hover:bg-slate-300 hover:text-slate-800",
998
+ children: [
999
+ /* @__PURE__ */ c(Os, { className: "mr-1 h-3 w-3" }),
1000
+ " Add Language"
1001
+ ]
1002
+ }
1003
+ )
1004
+ ] })
1005
+ ] })
1006
+ ] }) });
1007
+ };
1008
+ function $i() {
1009
+ const e = pa(zt), t = On(zt);
1010
+ return /* @__PURE__ */ m("div", { className: "relative z-10 flex items-center justify-end gap-1", children: [
1011
+ /* @__PURE__ */ c(Hi, {}),
1012
+ /* @__PURE__ */ c(Ks, {}),
1013
+ e && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(
1014
+ Vi,
1015
+ {
1016
+ isOpen: !0,
1017
+ id: e == null ? void 0 : e.id,
1018
+ edit: !!(e != null && e.id),
1019
+ primaryPage: e == null ? void 0 : e.primaryPage,
1020
+ preselectedLang: e == null ? void 0 : e.preselectedLang,
1021
+ onClose: () => t(null)
1022
+ }
1023
+ ) })
1024
+ ] });
1025
+ }
1026
+ function Qi() {
1027
+ return /* @__PURE__ */ c("div", { className: "mt-2 space-y-2", children: Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ m("div", { className: "flex items-start gap-3 rounded-md border p-2", children: [
1028
+ /* @__PURE__ */ m("div", { className: "flex-1 space-y-1", children: [
1029
+ /* @__PURE__ */ c(Dt, { className: "h-4 w-3/4" }),
1030
+ /* @__PURE__ */ c(Dt, { className: "h-3 w-1/2" }),
1031
+ /* @__PURE__ */ c(Dt, { className: "mt-1 h-5 w-20" })
1032
+ ] }),
1033
+ /* @__PURE__ */ c(Dt, { className: "h-8 w-8 rounded-full" })
1034
+ ] }, t)) });
1035
+ }
1036
+ const zi = $.lazy(() => import("./page-revisions-content-NH9JK4Ey.js"));
1037
+ function Wi() {
1038
+ const [e, t] = $.useState(!1);
1039
+ return /* @__PURE__ */ c(Ps, { children: /* @__PURE__ */ m(en, { delayDuration: 0, children: [
1040
+ /* @__PURE__ */ m(Ss, { open: e, onOpenChange: t, children: [
1041
+ /* @__PURE__ */ c(Kr, { asChild: !0, children: /* @__PURE__ */ c(tn, { asChild: !0, children: /* @__PURE__ */ m("span", { className: "flex items-center gap-2", children: [
1042
+ /* @__PURE__ */ m(M, { variant: "ghost", size: "icon", className: "h-8 w-8", children: [
1043
+ /* @__PURE__ */ c(Ha, { className: "h-4 w-4" }),
1044
+ /* @__PURE__ */ c("span", { className: "sr-only", children: "View revision history" })
1045
+ ] }),
1046
+ /* @__PURE__ */ c("div", { className: "h-4 w-px bg-gray-200 dark:bg-gray-700" })
1047
+ ] }) }) }),
1048
+ /* @__PURE__ */ c(_s, { className: "flex h-[100vh] flex-col", children: e && /* @__PURE__ */ c(X, { fallback: /* @__PURE__ */ c(Qi, {}), children: /* @__PURE__ */ c(zi, { isOpen: e }) }) })
1049
+ ] }),
1050
+ /* @__PURE__ */ c(nn, { side: "bottom", children: /* @__PURE__ */ c("p", { children: "Revision history" }) })
1051
+ ] }) });
1052
+ }
1053
+ const fn = ({
1054
+ permission: e,
1055
+ permissions: t,
1056
+ children: n,
1057
+ fallback: s = null
1058
+ }) => {
1059
+ const { hasPermission: r } = Ts();
1060
+ return e && !r(e) || t && !t.some((a) => r(a)) ? s : n;
1061
+ }, ji = {
1062
+ SLUG_ALREADY_USED: "This slug is already in use. Please choose a different one."
1063
+ }, Yc = () => {
1064
+ const e = b(), t = J(), n = I(), { data: s } = Ce();
1065
+ return Y({
1066
+ mutationFn: async (r) => await n(e, {
1067
+ action: E.CREATE_PAGE,
1068
+ data: r
1069
+ }),
1070
+ onSuccess: (r, a) => {
1071
+ var o;
1072
+ a && (a != null && a.primaryPage) ? (t.invalidateQueries({
1073
+ queryKey: [E.GET_LANGUAGE_PAGES, a == null ? void 0 : a.primaryPage]
1074
+ }), t.invalidateQueries({
1075
+ queryKey: [E.GET_WEBSITE_PAGES, a == null ? void 0 : a.lang]
1076
+ })) : t.invalidateQueries({
1077
+ queryKey: [E.GET_WEBSITE_PAGES]
1078
+ });
1079
+ const i = a.template ? `Page created from "${a.template.name}" template` : a.hasSlug === !1 ? "New " + ((o = ie(s, { key: a.pageType })) == null ? void 0 : o.name) + " added successfully" : "New page added successfully";
1080
+ R.success(i);
1081
+ },
1082
+ onError: (r, a) => {
1083
+ const i = ie(s, { key: a.pageType });
1084
+ R.error(`Failed to add new ${i != null && i.hasSlug ? "page" : i.name}.`, {
1085
+ description: H(ji, r.message, r.message)
1086
+ });
1087
+ }
1088
+ });
1089
+ }, Jc = () => {
1090
+ const e = b(), t = J(), n = I(), { data: s } = Le(), { data: r } = Ce();
1091
+ return Y({
1092
+ mutationFn: async (a) => await n(e, {
1093
+ action: E.UPDATE_PAGE,
1094
+ data: a
1095
+ }),
1096
+ onSuccess: (a, i) => {
1097
+ (s == null ? void 0 : s.id) === (i == null ? void 0 : i.id) && t.invalidateQueries({
1098
+ queryKey: [E.GET_LANGUAGE_PAGES]
1099
+ }), i && (i != null && i.primaryPage || i != null && i.seo) ? (t.invalidateQueries({
1100
+ queryKey: [E.GET_LANGUAGE_PAGES, i == null ? void 0 : i.primaryPage]
1101
+ }), t.invalidateQueries({
1102
+ queryKey: [E.GET_WEBSITE_PAGES]
1103
+ })) : t.invalidateQueries({
1104
+ queryKey: [E.GET_WEBSITE_PAGES]
1105
+ });
1106
+ },
1107
+ onError: (a, i) => {
1108
+ const o = ie(r, { key: i.pageType });
1109
+ R.error(`Failed to update ${o != null && o.hasSlug ? "page" : o.name}.`, {
1110
+ description: a.message
1111
+ });
1112
+ }
1113
+ });
1114
+ }, Zc = () => {
1115
+ const e = b(), t = J(), n = I(), { data: s } = Ce();
1116
+ return Y({
1117
+ mutationFn: async (r) => n(e, {
1118
+ action: E.DELETE_PAGE,
1119
+ data: { id: r == null ? void 0 : r.id }
1120
+ }),
1121
+ onSuccess: (r, a) => {
1122
+ if (r.code === "PAGE_LOCKED") {
1123
+ R.error("Delete not allowed", {
1124
+ description: "Page is currently being edited by another user."
1125
+ });
1126
+ return;
1127
+ }
1128
+ a && (a != null && a.primaryPage) ? (t.invalidateQueries({
1129
+ queryKey: [E.GET_LANGUAGE_PAGES, a == null ? void 0 : a.primaryPage]
1130
+ }), t.invalidateQueries({
1131
+ queryKey: [E.GET_WEBSITE_PAGES]
1132
+ })) : t.invalidateQueries({
1133
+ queryKey: [E.GET_WEBSITE_PAGES]
1134
+ });
1135
+ },
1136
+ onError: (r, a) => {
1137
+ const i = ie(s, { key: a.pageType });
1138
+ R.error(`Failed to delete ${i != null && i.hasSlug ? "page" : i.name}.`, {
1139
+ description: r.message
1140
+ });
1141
+ }
1142
+ });
1143
+ }, Xc = () => {
1144
+ const e = b(), t = J(), n = I(), { data: s } = Ce();
1145
+ return Y({
1146
+ mutationFn: async (r) => n(e, {
1147
+ action: E.TAKE_OFFLINE,
1148
+ data: { id: r == null ? void 0 : r.id }
1149
+ }),
1150
+ onSuccess: (r, a) => {
1151
+ a && (a != null && a.primaryPage) ? t.invalidateQueries({
1152
+ queryKey: [E.GET_LANGUAGE_PAGES, a == null ? void 0 : a.primaryPage]
1153
+ }) : t.invalidateQueries({
1154
+ queryKey: [E.GET_WEBSITE_PAGES]
1155
+ });
1156
+ const i = ie(s, { key: a.pageType });
1157
+ R.success(
1158
+ i != null && i.hasSlug ? "Page unpublished successfully." : "New " + i.name + " added successfully."
1159
+ );
1160
+ },
1161
+ onError: (r, a) => {
1162
+ const i = ie(s, { key: a.pageType });
1163
+ R.error(`Failed to take offline ${i != null && i.hasSlug ? "page" : i.name}.`, {
1164
+ description: r.message
1165
+ });
1166
+ }
1167
+ });
1168
+ }, Hs = () => {
1169
+ const e = b(), t = I(), n = J(), { data: s } = oe(), { savePageAsync: r } = Re();
1170
+ return Y({
1171
+ mutationFn: async ({ ids: a }) => (await r(), t(e, {
1172
+ action: E.PUBLISH_CHANGES,
1173
+ data: { ids: a }
1174
+ })),
1175
+ onSuccess: () => {
1176
+ n.invalidateQueries({
1177
+ queryKey: [E.GET_CHANGES]
1178
+ }), n.invalidateQueries({
1179
+ queryKey: [E.GET_WEBSITE_PAGES]
1180
+ }), n.invalidateQueries({
1181
+ queryKey: [E.GET_LANGUAGE_PAGES, s == null ? void 0 : s.id]
1182
+ });
1183
+ },
1184
+ onError: (a) => {
1185
+ console.log("##", a), R.error("Failed to publish pages.");
1186
+ }
1187
+ });
1188
+ }, eu = () => {
1189
+ const e = b(), t = I(), n = J();
1190
+ return Y({
1191
+ mutationFn: async (s) => {
1192
+ var r;
1193
+ return t(e, {
1194
+ action: E.MARK_AS_TEMPLATE,
1195
+ data: {
1196
+ id: (r = s.page) == null ? void 0 : r.id,
1197
+ name: s.name,
1198
+ description: s.description,
1199
+ pageType: s.pageType,
1200
+ previewImage: s.previewImage
1201
+ }
1202
+ });
1203
+ },
1204
+ onSuccess: () => {
1205
+ n.invalidateQueries({
1206
+ queryKey: [E.GET_WEBSITE_PAGES]
1207
+ }), R.success("Page marked as template successfully.");
1208
+ },
1209
+ onError: () => {
1210
+ R.error("Failed to mark page as template.");
1211
+ }
1212
+ });
1213
+ }, tu = () => {
1214
+ const e = b(), t = I(), n = J();
1215
+ return Y({
1216
+ mutationFn: async (s) => t(e, {
1217
+ action: E.UNMARK_AS_TEMPLATE,
1218
+ data: { id: s == null ? void 0 : s.id }
1219
+ }),
1220
+ onSuccess: () => {
1221
+ n.invalidateQueries({
1222
+ queryKey: [E.GET_WEBSITE_PAGES]
1223
+ }), R.success("Page unmarked as template successfully.");
1224
+ },
1225
+ onError: () => {
1226
+ R.error("Failed to unmark page as template.");
1227
+ }
1228
+ });
1229
+ }, nu = () => {
1230
+ const e = b(), t = I(), n = J();
1231
+ return Y({
1232
+ mutationFn: async ({ id: s, slug: r }) => t(e, {
1233
+ action: E.CHANGE_SLUG,
1234
+ data: { id: s, slug: r }
1235
+ }),
1236
+ onSuccess: (s, { primaryPage: r }) => {
1237
+ R.success("Slug changed successfully."), r ? n.invalidateQueries({
1238
+ queryKey: [E.GET_LANGUAGE_PAGES, r]
1239
+ }) : n.invalidateQueries({
1240
+ queryKey: [E.GET_WEBSITE_PAGES]
1241
+ });
1242
+ },
1243
+ onError: () => {
1244
+ R.error("Failed to change slug");
1245
+ }
1246
+ });
1247
+ }, Yi = V(() => import("./publish-pages-content-D9aixMN5.js"));
1248
+ function Ji({
1249
+ showModal: e = !1,
1250
+ onClose: t = () => console.log("Cancelled")
1251
+ }) {
1252
+ const { mutate: n, isPending: s } = Hs();
1253
+ return /* @__PURE__ */ c(ws, { open: e, onOpenChange: s ? () => {
1254
+ } : t, children: e && /* @__PURE__ */ c(X, { fallback: /* @__PURE__ */ c("div", { className: "h-96 w-96 animate-pulse bg-gray-100" }), children: /* @__PURE__ */ c(Yi, { onClose: t, isPending: s, publishPage: n }) }) });
1255
+ }
1256
+ const Zi = (e) => {
1257
+ const { fallbackLang: t } = Pe(), { data: n } = Be(), { data: s, isFetching: r } = Me(), a = q(() => {
1258
+ const i = { [t]: !0 };
1259
+ return _a(H(n, "languages"), (o) => {
1260
+ const l = ie(s, { lang: o });
1261
+ i[o] = !!l;
1262
+ }), i;
1263
+ }, [t, s, n]);
1264
+ return r || fe(e) || e && a[e];
1265
+ }, Xi = {
1266
+ particleCount: 350,
1267
+ spread: 120,
1268
+ origin: { y: 0.6 },
1269
+ angle: 90
1270
+ }, eo = {
1271
+ TOP_RIGHT: {
1272
+ angle: 225,
1273
+ origin: { x: 0.9, y: 0 }
1274
+ },
1275
+ BOTTOM_RIGHT: {
1276
+ angle: 100,
1277
+ origin: { x: 0.9, y: 0.9 }
1278
+ }
1279
+ }, to = async () => {
1280
+ const { default: e } = await import("canvas-confetti");
1281
+ return e;
1282
+ }, hn = (e) => {
1283
+ let t = eo[e];
1284
+ t || (t = {});
1285
+ const n = { ...Xi, ...t };
1286
+ to().then((s) => s(n));
1287
+ };
1288
+ function Bn({
1289
+ children: e,
1290
+ content: t,
1291
+ side: n = "bottom",
1292
+ delayDuration: s = 700,
1293
+ showTooltip: r = !0
1294
+ }) {
1295
+ return r ? /* @__PURE__ */ c(Ps, { children: /* @__PURE__ */ m(en, { delayDuration: s, children: [
1296
+ /* @__PURE__ */ c(tn, { asChild: !0, children: e }),
1297
+ /* @__PURE__ */ c(nn, { side: n, sideOffset: 10, children: /* @__PURE__ */ c("p", { children: t }) })
1298
+ ] }) }) : e;
1299
+ }
1300
+ const no = V(() => import("./unpublish-page-D4VwOlxc.js")), so = V(
1301
+ () => import("./translation-warning-modal-B64YqlbI.js")
1302
+ ), ro = () => {
1303
+ const { t: e } = we(), { selectedLang: t, fallbackLang: n } = Pe(), s = ge("getPreviewUrl", async (g) => g), [r, a] = K(""), { data: i } = oe(), { data: o } = Me(), { data: l } = Ce(), f = q(
1304
+ () => {
1305
+ var g;
1306
+ return (g = o == null ? void 0 : o.find((h) => (h == null ? void 0 : h.lang) === t)) == null ? void 0 : g.slug;
1307
+ },
1308
+ [t, o]
1309
+ ), d = z((g) => {
1310
+ var h;
1311
+ return (h = ie(l, { key: g })) == null ? void 0 : h.hasSlug;
1312
+ }, [l]), u = t === n ? "" : t;
1313
+ return se(() => {
1314
+ (async () => {
1315
+ if (typeof s == "function") {
1316
+ const g = !d(i == null ? void 0 : i.pageType), h = await s(
1317
+ g ? `${u !== "" ? u + "/" : ""}${i == null ? void 0 : i.id}` : f || ""
1318
+ );
1319
+ a(h);
1320
+ } else
1321
+ a("");
1322
+ })();
1323
+ }, [s, f, i == null ? void 0 : i.pageType, d, i == null ? void 0 : i.id, u]), /* @__PURE__ */ c(he, { children: /* @__PURE__ */ c(Bn, { content: e("Open preview in new tab"), delayDuration: 0, children: /* @__PURE__ */ c("a", { href: r, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ c(M, { variant: "ghost", size: "sm", className: "gap-2", children: /* @__PURE__ */ c($a, { className: "h-4 w-4" }) }) }) }) });
1324
+ }, ao = () => {
1325
+ const { t: e } = we(), [t, n] = Vr();
1326
+ return /* @__PURE__ */ m(he, { children: [
1327
+ /* @__PURE__ */ c(Bn, { content: e("Theme"), delayDuration: 0, children: /* @__PURE__ */ c(
1328
+ M,
1329
+ {
1330
+ variant: t === "theme" ? "outline" : "ghost",
1331
+ size: "icon",
1332
+ className: "gap-2",
1333
+ onClick: () => n(t === "theme" ? "block" : "theme"),
1334
+ children: /* @__PURE__ */ c(qa, { className: "h-4 w-4" })
1335
+ }
1336
+ ) }),
1337
+ /* @__PURE__ */ c("div", { className: "h-4 w-px bg-gray-200 dark:bg-gray-700" })
1338
+ ] });
1339
+ }, io = () => {
1340
+ const { t: e } = we(), [t, n] = K(!1), { isLocked: s } = ye(), { savePageAsync: r, saveState: a } = Re();
1341
+ se(() => {
1342
+ const d = (u) => {
1343
+ a === "UNSAVED" && (u.preventDefault(), u.returnValue = !1);
1344
+ };
1345
+ return a === "UNSAVED" && window.addEventListener("beforeunload", d), () => {
1346
+ window.removeEventListener("beforeunload", d);
1347
+ };
1348
+ }, [a]);
1349
+ const i = z(async () => {
1350
+ t || (n(!0), await r(), n(!1));
1351
+ }, [r, t]), { buttonIcon: o, buttonClass: l, tooltipContent: f } = q(() => {
1352
+ switch (a) {
1353
+ case "UNSAVED":
1354
+ return {
1355
+ tooltipContent: e("Save draft"),
1356
+ buttonIcon: /* @__PURE__ */ c(za, { className: "h-4 w-4" }),
1357
+ buttonClass: "gap-x-1"
1358
+ };
1359
+ case "SAVING":
1360
+ return {
1361
+ tooltipContent: e("Saving"),
1362
+ buttonIcon: /* @__PURE__ */ c($t, { className: "h-4 w-4 animate-spin text-sky-700" }),
1363
+ buttonClass: "gap-x-1"
1364
+ };
1365
+ case "SAVED":
1366
+ return {
1367
+ tooltipContent: e("Saved"),
1368
+ buttonIcon: /* @__PURE__ */ c(Qa, { className: "h-4 w-4" }),
1369
+ buttonClass: "text-green-500 gap-x-1"
1370
+ };
1371
+ }
1372
+ }, [a, e]);
1373
+ return s ? null : /* @__PURE__ */ m(M, { size: "sm", variant: "ghost", onClick: i, className: `${l} w-24 max-w-24`, children: [
1374
+ o,
1375
+ " ",
1376
+ f
1377
+ ] });
1378
+ }, oo = () => {
1379
+ const { t: e } = we(), { selectedLang: t } = Pe(), { data: n } = Le(), { data: s } = Me(), [r, a] = K(!1), [i, o] = K(!1), [l, f] = K(null), { savePageAsync: d } = Re(), [u, g] = K(!1), { data: h } = oe(), { mutate: p, isPending: T } = Hs(), { needTranslations: S } = Re(), x = S(), { buttonText: y, buttonClassName: w, isPublished: v } = q(() => {
1380
+ const P = h && (h == null ? void 0 : h.online);
1381
+ return {
1382
+ buttonClassName: P ? "hover:bg-green-600 bg-green-500" : "",
1383
+ isPublished: P,
1384
+ buttonText: e(P ? "Published" : "Publish")
1385
+ };
1386
+ }, [h, e]), U = async () => {
1387
+ if (x) {
1388
+ g(!0);
1389
+ return;
1390
+ }
1391
+ N();
1392
+ }, N = () => {
1393
+ const P = [n == null ? void 0 : n.id, n == null ? void 0 : n.primaryPage];
1394
+ p({ ids: Ls(P) }, { onSuccess: () => hn("TOP_RIGHT") });
1395
+ }, Ae = () => {
1396
+ g(!1), N();
1397
+ }, Te = async () => {
1398
+ g(!1), await d();
1399
+ }, B = q(() => qt(s ?? [], "id"), [s]);
1400
+ return /* @__PURE__ */ m(he, { children: [
1401
+ /* @__PURE__ */ m("div", { className: "flex", children: [
1402
+ /* @__PURE__ */ m(
1403
+ M,
1404
+ {
1405
+ size: "sm",
1406
+ onClick: U,
1407
+ disabled: T || !(h != null && h.id),
1408
+ className: `relative flex items-center gap-1 overflow-hidden rounded-r-none text-white transition-all duration-300 ease-in-out ${w}`,
1409
+ onMouseEnter: () => o(!0),
1410
+ onMouseLeave: () => o(!1),
1411
+ children: [
1412
+ /* @__PURE__ */ c(
1413
+ "span",
1414
+ {
1415
+ className: `flex items-center transition-transform duration-300 ease-in-out ${i ? "-translate-y-10" : ""}`,
1416
+ children: v ? /* @__PURE__ */ c(ts, { className: "h-4 w-4" }) : /* @__PURE__ */ c(ns, { className: "h-4 w-4" })
1417
+ }
1418
+ ),
1419
+ /* @__PURE__ */ c(
1420
+ "span",
1421
+ {
1422
+ className: `absolute inset-0 left-3 flex items-center transition-transform duration-300 ease-in-out ${i ? "" : "translate-y-10"}`,
1423
+ children: v ? /* @__PURE__ */ c(ns, { className: "h-4 w-4" }) : /* @__PURE__ */ c(ts, { className: "h-4 w-4" })
1424
+ }
1425
+ ),
1426
+ /* @__PURE__ */ c("span", { children: y }),
1427
+ t ? `(${Yn(t)})` : ""
1428
+ ]
1429
+ }
1430
+ ),
1431
+ /* @__PURE__ */ m(Ln, { children: [
1432
+ /* @__PURE__ */ c(Cn, { asChild: !0, children: /* @__PURE__ */ c(
1433
+ M,
1434
+ {
1435
+ size: "sm",
1436
+ disabled: T || !(h != null && h.id),
1437
+ className: `rounded-l-none border-l border-white/50 px-2 text-white ${w}`,
1438
+ children: /* @__PURE__ */ c(yn, { className: "h-4 w-4" })
1439
+ }
1440
+ ) }),
1441
+ /* @__PURE__ */ m(Gn, { align: "end", className: "w-52", children: [
1442
+ /* @__PURE__ */ m(
1443
+ ce,
1444
+ {
1445
+ disabled: T,
1446
+ className: "cursor-pointer text-xs",
1447
+ onClick: () => p({ ids: B }, { onSuccess: () => hn("TOP_RIGHT") }),
1448
+ children: [
1449
+ e("Publish"),
1450
+ " with translation pages"
1451
+ ]
1452
+ }
1453
+ ),
1454
+ !v && /* @__PURE__ */ m(
1455
+ ce,
1456
+ {
1457
+ disabled: T,
1458
+ className: "cursor-pointer text-xs",
1459
+ onClick: () => p({ ids: [h == null ? void 0 : h.id] }, { onSuccess: () => hn("TOP_RIGHT") }),
1460
+ children: [
1461
+ e("Publish"),
1462
+ " page"
1463
+ ]
1464
+ }
1465
+ ),
1466
+ /* @__PURE__ */ m(ce, { onClick: () => a(!0), className: "cursor-pointer text-xs", children: [
1467
+ e("Open"),
1468
+ " publish menu"
1469
+ ] }),
1470
+ v && /* @__PURE__ */ m(ce, { onClick: () => f(n), className: "cursor-pointer text-xs", children: [
1471
+ e("Unpublish"),
1472
+ " page ",
1473
+ t ? `(${Yn(t)})` : ""
1474
+ ] })
1475
+ ] })
1476
+ ] })
1477
+ ] }),
1478
+ /* @__PURE__ */ c(Ji, { showModal: r, onClose: () => a(!1) }),
1479
+ l && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(no, { page: l, onClose: () => f(null) }) }),
1480
+ u && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(
1481
+ so,
1482
+ {
1483
+ isOpen: u,
1484
+ onClose: Te,
1485
+ onContinue: Ae,
1486
+ isPending: T
1487
+ }
1488
+ ) })
1489
+ ] });
1490
+ };
1491
+ function lo() {
1492
+ const { isLocked: e } = ye(), [t] = ve(), n = t.get("lang"), s = Zi(n);
1493
+ return e || !s ? /* @__PURE__ */ c("div", {}) : /* @__PURE__ */ m("div", { className: "flex items-center justify-end gap-1", children: [
1494
+ /* @__PURE__ */ c(Wi, {}),
1495
+ /* @__PURE__ */ c(fn, { permission: le.EDIT_THEME, children: /* @__PURE__ */ c(ao, {}) }),
1496
+ /* @__PURE__ */ c(ro, {}),
1497
+ /* @__PURE__ */ c(fn, { permission: le.SAVE_PAGE, children: /* @__PURE__ */ c(io, {}) }),
1498
+ /* @__PURE__ */ c(fn, { permission: le.PUBLISH_PAGE, children: /* @__PURE__ */ c(oo, {}) })
1499
+ ] });
1500
+ }
1501
+ const co = V(() => import("./dynamic-page-selector-Cb5r_W8s.js")), uo = () => {
1502
+ const { dynamicPage: e, allLangPages: t, isFetching: n } = hi(), s = t.length > 0;
1503
+ return n ? null : /* @__PURE__ */ m("div", { className: "relative", children: [
1504
+ !e && /* @__PURE__ */ c(Ki, { hasDynamicPage: s }),
1505
+ /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(co, {}) })
1506
+ ] });
1507
+ }, fo = () => {
1508
+ const { data: e, isFetching: t } = Le(), { data: n, isFetching: s } = oe(), r = H(n, "dynamic", !1), a = kn(), i = Hr("dynamic-page-selector"), o = e == null ? void 0 : e.slug, l = !o, f = pi(), d = t || s, g = (l ? `Partial: ${e == null ? void 0 : e.name} ` : `${o}${a}`).replace(window.location.host, "");
1509
+ return /* @__PURE__ */ m("div", { className: "relative flex items-center gap-x-1", children: [
1510
+ /* @__PURE__ */ c(
1511
+ "div",
1512
+ {
1513
+ className: Qt(
1514
+ "flex h-8 w-auto max-w-[600px] items-center rounded-md border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",
1515
+ d && "max-w-0 overflow-hidden opacity-0"
1516
+ ),
1517
+ children: /* @__PURE__ */ c(Fi, {})
1518
+ }
1519
+ ),
1520
+ /* @__PURE__ */ m(
1521
+ "div",
1522
+ {
1523
+ className: Qt(
1524
+ "flex h-8 w-auto max-w-[600px] items-center rounded-md border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800" + (l ? " pr-2" : ""),
1525
+ d && "max-w-0 overflow-hidden opacity-0"
1526
+ ),
1527
+ children: [
1528
+ /* @__PURE__ */ c(qi, {}),
1529
+ /* @__PURE__ */ m("div", { className: "flex w-full items-center overflow-hidden", children: [
1530
+ /* @__PURE__ */ c(
1531
+ "div",
1532
+ {
1533
+ className: `w-full max-w-[200px] overflow-hidden overflow-ellipsis whitespace-nowrap pl-1 text-xs ${l ? "italic text-gray-400" : "font-mono text-gray-500"}`,
1534
+ children: g === "/" ? /* @__PURE__ */ m("span", { className: "text-gray-900", children: [
1535
+ "/",
1536
+ /* @__PURE__ */ c("span", { className: "text-[11px] font-light italic text-gray-400", children: "(Homepage)" })
1537
+ ] }) : g
1538
+ }
1539
+ ),
1540
+ !l && /* @__PURE__ */ c("a", { href: f, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ c("div", { className: "ml-2 mr-px flex-shrink-0 rounded-sm p-1.5 text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300", children: /* @__PURE__ */ c(Wa, { className: "h-4 w-4", strokeWidth: 1 }) }) })
1541
+ ] })
1542
+ ]
1543
+ }
1544
+ ),
1545
+ r && i && /* @__PURE__ */ c(uo, {})
1546
+ ] });
1547
+ }, ho = () => /* @__PURE__ */ m("div", { className: "flex h-full w-full items-center justify-between px-2", children: [
1548
+ /* @__PURE__ */ c($i, {}),
1549
+ /* @__PURE__ */ c(fo, {}),
1550
+ /* @__PURE__ */ c(lo, {})
1551
+ ] }), qs = () => {
1552
+ const e = J(), { data: t } = re({
1553
+ queryKey: [E.AI_CONTEXT],
1554
+ initialData: "",
1555
+ queryFn: () => "",
1556
+ staleTime: 0
1557
+ });
1558
+ return { setAiContext: z(
1559
+ (s) => {
1560
+ e.setQueryData([E.AI_CONTEXT], s);
1561
+ },
1562
+ [e]
1563
+ ), aiContext: t };
1564
+ }, go = () => {
1565
+ const e = b(), { aiContext: t } = qs(), n = I();
1566
+ return z(
1567
+ async (s, r, a, i) => n(e, {
1568
+ action: E.ASK_AI,
1569
+ data: { type: s, prompt: r, blocks: a, context: t, lang: i }
1570
+ }),
1571
+ [e, t, n]
1572
+ );
1573
+ }, mo = (e, t) => t.map((n) => {
1574
+ if (sn(e, n._type)) {
1575
+ const s = ri(n._type);
1576
+ return {
1577
+ ...s,
1578
+ ...xn(n, [...ba(s), "_type", "_id", "_name", "_parent", "_bindings"]),
1579
+ ...wa(n, (r, a) => va(a, "_attrs")),
1580
+ ...n
1581
+ };
1582
+ }
1583
+ return n;
1584
+ }), Eo = (e) => {
1585
+ const t = si();
1586
+ return q(() => {
1587
+ if (!e || fe(e)) return { blocks: [] };
1588
+ const n = Cs(e, (s) => !Pa(s == null ? void 0 : s._type, "@chai/"));
1589
+ return { blocks: mo(t, n) };
1590
+ }, [e, t]);
1591
+ }, po = () => {
1592
+ const [e] = ve(), t = e.get("page"), n = b(), { setAiContext: s } = qs(), [, r] = ks(), [, a] = Ei(), [, i] = qr(), o = I();
1593
+ return re({
1594
+ queryKey: [E.GET_DRAFT_PAGE, t],
1595
+ staleTime: 1 / 0,
1596
+ gcTime: 0,
1597
+ queryFn: async () => {
1598
+ i(!1);
1599
+ const l = await o(n, {
1600
+ action: E.GET_DRAFT_PAGE,
1601
+ data: { id: t, draft: !0 }
1602
+ }), f = l.blocks ?? [], d = ie(f, { _type: "@chai/ai-context" });
1603
+ return s(H(d, "_value", "") || ""), r((u) => ({ ...u, lastSaved: l.lastSaved })), a(H(l, "metadata", {})), setTimeout(() => i(!0), 500), f;
1604
+ },
1605
+ enabled: !!t
1606
+ });
1607
+ }, yo = () => {
1608
+ const { data: e } = oe(), { data: t } = Le(), n = b(), s = I(), r = Mn(), a = kn();
1609
+ return re({
1610
+ queryKey: [E.GET_BUILDER_PAGE_DATA, t == null ? void 0 : t.id, a],
1611
+ staleTime: 1 / 0,
1612
+ gcTime: 0,
1613
+ queryFn: async () => s(n, {
1614
+ action: E.GET_BUILDER_PAGE_DATA,
1615
+ data: {
1616
+ pageType: e == null ? void 0 : e.pageType,
1617
+ lang: (t == null ? void 0 : t.lang) || r,
1618
+ dynamic: e == null ? void 0 : e.dynamic,
1619
+ pageProps: {
1620
+ slug: (t == null ? void 0 : t.slug) + a,
1621
+ searchParams: {},
1622
+ pageType: t == null ? void 0 : t.pageType,
1623
+ fallbackLang: r,
1624
+ lastSaved: t.lastSaved,
1625
+ pageId: e.id,
1626
+ primaryPageId: t.primaryPage || e.id,
1627
+ pageBaseSlug: t == null ? void 0 : t.slug,
1628
+ dynamic: e == null ? void 0 : e.dynamic,
1629
+ //
1630
+ languagePageId: t.id,
1631
+ metadata: e.metadata || {}
1632
+ }
1633
+ }
1634
+ }),
1635
+ enabled: !!(e != null && e.pageType) && !!t.id
1636
+ });
1637
+ }, Ao = () => {
1638
+ const e = b(), t = J(), n = I();
1639
+ return Y({
1640
+ mutationFn: async (s) => n(e, {
1641
+ action: E.UPDATE_WEBSITE_SETTINGS,
1642
+ data: s
1643
+ }),
1644
+ onSuccess: (s, r) => {
1645
+ var a;
1646
+ t.invalidateQueries({
1647
+ queryKey: [E.GET_WEBSITE_DRAFT_SETTINGS]
1648
+ }), (a = r == null ? void 0 : r.settings) != null && a.theme || R.success("Website settings updated successfully.");
1649
+ },
1650
+ onError: (s) => {
1651
+ R.error("Failed to update website settings", {
1652
+ description: s.message
1653
+ });
1654
+ }
1655
+ });
1656
+ }, su = () => {
1657
+ const e = b(), t = J(), n = I(), { selectedLang: s } = Pe();
1658
+ return Y({
1659
+ mutationFn: async (r) => n(e, { action: E.ADD_GLOBAL_SCHEMA, data: { ...r, lang: s } }),
1660
+ onSuccess: () => {
1661
+ t.invalidateQueries({
1662
+ queryKey: [E.GET_GLOBAL_JSONLD_ITEMS]
1663
+ }), R.success("Schema added successfully.");
1664
+ },
1665
+ onError: (r) => {
1666
+ R.error("Failed to add schema", {
1667
+ description: r.message
1668
+ });
1669
+ }
1670
+ });
1671
+ }, ru = () => {
1672
+ const e = b(), t = J(), n = I(), { selectedLang: s } = Pe();
1673
+ return Y({
1674
+ mutationFn: async (r) => n(e, { action: E.UPDATE_GLOBAL_SCHEMA, data: { ...r, lang: s } }),
1675
+ onSuccess: () => {
1676
+ t.invalidateQueries({
1677
+ queryKey: [E.GET_GLOBAL_JSONLD_ITEMS]
1678
+ }), R.success("Schema updated successfully.");
1679
+ },
1680
+ onError: (r) => {
1681
+ R.error("Failed to update schema", {
1682
+ description: r.message
1683
+ });
1684
+ }
1685
+ });
1686
+ }, au = () => {
1687
+ const e = b(), t = J(), n = I();
1688
+ return Y({
1689
+ mutationFn: async (s) => n(e, { action: E.DELETE_GLOBAL_SCHEMA, data: { id: s } }),
1690
+ onSuccess: () => {
1691
+ t.invalidateQueries({
1692
+ queryKey: [E.GET_GLOBAL_JSONLD_ITEMS]
1693
+ }), R.success("Schema deleted successfully.");
1694
+ },
1695
+ onError: (s) => {
1696
+ R.error("Failed to delete schema", {
1697
+ description: s.message
1698
+ });
1699
+ }
1700
+ });
1701
+ }, iu = () => {
1702
+ const e = b(), t = I();
1703
+ return Y({
1704
+ mutationFn: async (n) => t(e, { action: E.TOGGLE_PAGE_GLOBAL_SCHEMA, data: n }),
1705
+ onError: (n) => {
1706
+ R.error("Failed to toggle schema", {
1707
+ description: n.message
1708
+ });
1709
+ }
1710
+ });
1711
+ }, ou = () => {
1712
+ const e = b(), t = I();
1713
+ return Y({
1714
+ mutationFn: async (n) => t(e, { action: E.APPLY_SCHEMA_TO_ALL_PAGES, data: { schemaId: n } }),
1715
+ onSuccess: (n) => {
1716
+ R.success(`Schema applied to ${n.count} page(s)`);
1717
+ },
1718
+ onError: (n) => {
1719
+ R.error("Failed to apply schema to all pages", {
1720
+ description: n.message
1721
+ });
1722
+ }
1723
+ });
1724
+ }, lu = () => {
1725
+ const e = b(), t = I();
1726
+ return Y({
1727
+ mutationFn: async (n) => t(e, { action: E.REMOVE_SCHEMA_FROM_ALL_PAGES, data: { schemaId: n } }),
1728
+ onSuccess: (n) => {
1729
+ R.success(`Schema removed from ${n.count} page(s)`);
1730
+ },
1731
+ onError: (n) => {
1732
+ R.error("Failed to remove schema from all pages", {
1733
+ description: n.message
1734
+ });
1735
+ }
1736
+ });
1737
+ }, as = {
1738
+ async getUILibraryBlock(e, t, n) {
1739
+ const s = await t(n, {
1740
+ action: "GET_LIBRARY_ITEM",
1741
+ data: { id: e.id }
1742
+ }), r = H(s, "html", ""), a = H(s, "blocks", []);
1743
+ return Ia(a) ? a : ai(r);
1744
+ },
1745
+ async getUILibraryBlocks(e, t, n) {
1746
+ try {
1747
+ return (await t(n, {
1748
+ action: "GET_LIBRARY_ITEMS",
1749
+ data: { id: e.id }
1750
+ })).map((r) => ({
1751
+ ...r
1752
+ }));
1753
+ } catch (s) {
1754
+ return console.error(s), [];
1755
+ }
1756
+ }
1757
+ }, To = () => {
1758
+ const e = b(), t = I();
1759
+ return re({
1760
+ queryKey: ["uiLibraries"],
1761
+ staleTime: "static",
1762
+ queryFn: async () => {
1763
+ const s = (await t(e, { action: "GET_LIBRARIES" })).map((r) => ({
1764
+ ...r
1765
+ }));
1766
+ return s.forEach((r) => {
1767
+ $r(r.id, {
1768
+ name: r.isSiteLibrary ? r.name + " (Current Site) " : r.name,
1769
+ description: r.description,
1770
+ getBlocksList: (a) => as.getUILibraryBlocks(a, t, e),
1771
+ getBlock: ({ block: a }) => as.getUILibraryBlock(a, t, e)
1772
+ });
1773
+ }), s;
1774
+ }
1775
+ });
1776
+ }, So = () => {
1777
+ const e = b(), t = I(), { user: n } = Rn(), s = n == null ? void 0 : n.id;
1778
+ return re({
1779
+ queryKey: [E.GET_ROLE_AND_PERMISSIONS, s],
1780
+ queryFn: () => t(e, {
1781
+ action: E.GET_ROLE_AND_PERMISSIONS,
1782
+ data: {}
1783
+ }),
1784
+ enabled: !!s,
1785
+ staleTime: 1 / 0
1786
+ });
1787
+ }, _o = () => {
1788
+ const e = b(), t = I(), [, n] = ks();
1789
+ return { onSave: async ({
1790
+ page: r,
1791
+ blocks: a,
1792
+ needTranslations: i
1793
+ }) => {
1794
+ try {
1795
+ const o = await t(e, {
1796
+ action: "UPDATE_PAGE",
1797
+ data: { id: r, blocks: a, needTranslations: i }
1798
+ });
1799
+ return o.code === "PAGE_LOCKED" ? !0 : (n((l) => ({
1800
+ ...l,
1801
+ lastSaved: (/* @__PURE__ */ new Date()).toISOString()
1802
+ })), o);
1803
+ } catch (o) {
1804
+ return console.error(o), new Error("Failed to save blocks");
1805
+ }
1806
+ } };
1807
+ }, Po = () => {
1808
+ const { data: e } = Bs(), t = b(), n = I();
1809
+ return {
1810
+ getPartialBlocks: z(async () => {
1811
+ const s = {};
1812
+ for (const r of e ?? [])
1813
+ fe(r == null ? void 0 : r.slug) && (s[r.id] = {
1814
+ type: r.pageType,
1815
+ name: Na(r.name ?? r.slug),
1816
+ description: ""
1817
+ });
1818
+ return s;
1819
+ }, [e]),
1820
+ getPartialBlockBlocks: z(
1821
+ async (s) => {
1822
+ if (!s) return [];
1823
+ try {
1824
+ const r = await n(t, {
1825
+ action: "GET_DRAFT_PAGE",
1826
+ data: { id: s, draft: !0, editor: !1 }
1827
+ });
1828
+ return Cs(r.blocks, (a) => sn(a, "_id"));
1829
+ } catch (r) {
1830
+ return console.error(r), [];
1831
+ }
1832
+ },
1833
+ [n, t]
1834
+ )
1835
+ };
1836
+ }, wo = V(() => import("./ai-panel-content-D_o7Q_A-.js")), $s = "chai-chat-panel", vo = ({ className: e = "h-full w-full" }) => /* @__PURE__ */ m("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", version: "1.1", className: e, children: [
1837
+ /* @__PURE__ */ c("title", { children: "ai" }),
1838
+ /* @__PURE__ */ c("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ c("g", { id: "icon", fill: "currentColor", transform: "translate(64.000000, 64.000000)", children: /* @__PURE__ */ c(
1839
+ "path",
1840
+ {
1841
+ d: "M320,64 L320,320 L64,320 L64,64 L320,64 Z M171.749388,128 L146.817842,128 L99.4840387,256 L121.976629,256 L130.913039,230.977 L187.575039,230.977 L196.319607,256 L220.167172,256 L171.749388,128 Z M260.093778,128 L237.691519,128 L237.691519,256 L260.093778,256 L260.093778,128 Z M159.094727,149.47526 L181.409039,213.333 L137.135039,213.333 L159.094727,149.47526 Z M341.333333,256 L384,256 L384,298.666667 L341.333333,298.666667 L341.333333,256 Z M85.3333333,341.333333 L128,341.333333 L128,384 L85.3333333,384 L85.3333333,341.333333 Z M170.666667,341.333333 L213.333333,341.333333 L213.333333,384 L170.666667,384 L170.666667,341.333333 Z M85.3333333,0 L128,0 L128,42.6666667 L85.3333333,42.6666667 L85.3333333,0 Z M256,341.333333 L298.666667,341.333333 L298.666667,384 L256,384 L256,341.333333 Z M170.666667,0 L213.333333,0 L213.333333,42.6666667 L170.666667,42.6666667 L170.666667,0 Z M256,0 L298.666667,0 L298.666667,42.6666667 L256,42.6666667 L256,0 Z M341.333333,170.666667 L384,170.666667 L384,213.333333 L341.333333,213.333333 L341.333333,170.666667 Z M0,256 L42.6666667,256 L42.6666667,298.666667 L0,298.666667 L0,256 Z M341.333333,85.3333333 L384,85.3333333 L384,128 L341.333333,128 L341.333333,85.3333333 Z M0,170.666667 L42.6666667,170.666667 L42.6666667,213.333333 L0,213.333333 L0,170.666667 Z M0,85.3333333 L42.6666667,85.3333333 L42.6666667,128 L0,128 L0,85.3333333 Z",
1842
+ id: "Combined-Shape"
1843
+ }
1844
+ ) }) })
1845
+ ] }), bo = ({ isActive: e, show: t }) => /* @__PURE__ */ c(M, { size: "icon", className: "p-0 [&_svg]:size-6", onClick: t, variant: e ? "default" : "ghost", children: /* @__PURE__ */ c(vo, { className: e ? "h-5 w-5 text-white" : "h-5 w-5 text-primary" }) }), Io = {
1846
+ id: $s,
1847
+ label: "AI Assistant",
1848
+ button: bo,
1849
+ panel: wo,
1850
+ position: "top"
1851
+ }, No = V(() => import("./lang-panel-BwIewMyw.js")), Lo = ({ isActive: e, show: t }) => {
1852
+ const { data: n } = Be();
1853
+ return !sn(n, "languages") || !H(n, "languages", []).length ? null : /* @__PURE__ */ c(M, { size: "sm", onClick: t, variant: e ? "default" : "ghost", children: /* @__PURE__ */ c(ja, { className: "h-4 w-4" }) });
1854
+ }, Qs = "lang", Co = {
1855
+ id: Qs,
1856
+ label: "Languages",
1857
+ position: "top",
1858
+ panel: No,
1859
+ button: Lo,
1860
+ view: "modal",
1861
+ width: 400
1862
+ }, Go = V(() => import("./seo-panel-C1-iMOR1.js")), zs = "seo", Oo = ({ isActive: e, show: t }) => {
1863
+ const { data: n } = oe(), s = yi(n == null ? void 0 : n.pageType);
1864
+ return !sn(s, "hasSlug") || !s.hasSlug ? null : /* @__PURE__ */ c(M, { size: "icon", className: "my-1 p-0", onClick: t, variant: e ? "default" : "ghost", children: /* @__PURE__ */ m(
1865
+ "svg",
1866
+ {
1867
+ stroke: "currentColor",
1868
+ fill: "none",
1869
+ style: { height: "20px", width: "20px" },
1870
+ strokeWidth: "2",
1871
+ viewBox: "0 0 24 24",
1872
+ strokeLinecap: "round",
1873
+ strokeLinejoin: "round",
1874
+ children: [
1875
+ /* @__PURE__ */ c("path", { d: "M7 8h-3a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-3" }),
1876
+ /* @__PURE__ */ c("path", { d: "M14 16h-4v-8h4" }),
1877
+ /* @__PURE__ */ c("path", { d: "M11 12h2" }),
1878
+ /* @__PURE__ */ c("path", { d: "M17 8m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" })
1879
+ ]
1880
+ }
1881
+ ) });
1882
+ }, xo = {
1883
+ id: zs,
1884
+ label: "SEO",
1885
+ panel: Go,
1886
+ button: Oo,
1887
+ position: "top",
1888
+ width: 600,
1889
+ view: "modal"
1890
+ }, Ws = "user-info", Do = () => {
1891
+ const { t: e } = we(), { user: t, logout: n } = Rn(), s = ge("onLogout", vs);
1892
+ return t ? /* @__PURE__ */ m(Qr, { children: [
1893
+ /* @__PURE__ */ c(zr, { asChild: !0, children: /* @__PURE__ */ c(M, { variant: "ghost", className: "text-sm font-medium", children: /* @__PURE__ */ c(Ya, { className: "h-4 w-4" }) }) }),
1894
+ /* @__PURE__ */ m(Wr, { className: "w-auto space-y-2 p-4", children: [
1895
+ /* @__PURE__ */ c("div", { className: "text-sm font-medium", children: t.name ?? t.email }),
1896
+ /* @__PURE__ */ c("div", { className: "text-xs text-muted-foreground", children: t.email }),
1897
+ /* @__PURE__ */ m(jr, { children: [
1898
+ /* @__PURE__ */ c(Yr, { asChild: !0, children: /* @__PURE__ */ c(M, { variant: "outline", size: "sm", className: "w-full", children: e("Logout") }) }),
1899
+ /* @__PURE__ */ m(Jr, { children: [
1900
+ /* @__PURE__ */ m(Zr, { children: [
1901
+ /* @__PURE__ */ c(Xr, { children: e("Are you sure you want to logout?") }),
1902
+ /* @__PURE__ */ c(ea, { children: e("You will be redirected to the login page.") })
1903
+ ] }),
1904
+ /* @__PURE__ */ m(ta, { children: [
1905
+ /* @__PURE__ */ c(na, { children: e("Cancel") }),
1906
+ /* @__PURE__ */ c(
1907
+ sa,
1908
+ {
1909
+ onClick: () => {
1910
+ n(), La(s) && s();
1911
+ },
1912
+ children: e("Logout")
1913
+ }
1914
+ )
1915
+ ] })
1916
+ ] })
1917
+ ] })
1918
+ ] })
1919
+ ] }) : null;
1920
+ }, ko = {
1921
+ id: Ws,
1922
+ label: "User Info",
1923
+ button: Do,
1924
+ position: "bottom"
1925
+ }, Ro = () => {
1926
+ kt(zs, xo), kt(Qs, Co), kt(Ws, ko), kt($s, Io);
1927
+ };
1928
+ var _ = {
1929
+ context: void 0,
1930
+ registry: void 0,
1931
+ effects: void 0,
1932
+ done: !1,
1933
+ getContextId() {
1934
+ return is(this.context.count);
1935
+ },
1936
+ getNextContextId() {
1937
+ return is(this.context.count++);
1938
+ }
1939
+ };
1940
+ function is(e) {
1941
+ const t = String(e), n = t.length - 1;
1942
+ return _.context.id + (n ? String.fromCharCode(96 + n) : "") + t;
1943
+ }
1944
+ function ct(e) {
1945
+ _.context = e;
1946
+ }
1947
+ var js = !1, Uo = (e, t) => e === t, Wt = Symbol("solid-proxy"), Ys = typeof Proxy == "function", Js = Symbol("solid-track"), jt = {
1948
+ equals: Uo
1949
+ }, Zs = ar, be = 1, Yt = 2, Xs = {
1950
+ owned: null,
1951
+ cleanups: null,
1952
+ context: null,
1953
+ owner: null
1954
+ }, gn = {}, G = null, mn = null, Mo = null, D = null, ee = null, _e = null, an = 0;
1955
+ function De(e, t) {
1956
+ const n = D, s = G, r = e.length === 0, a = t === void 0 ? s : t, i = r ? Xs : {
1957
+ owned: null,
1958
+ cleanups: null,
1959
+ context: a ? a.context : null,
1960
+ owner: a
1961
+ }, o = r ? e : () => e(() => Z(() => ht(i)));
1962
+ G = i, D = null;
1963
+ try {
1964
+ return me(o, !0);
1965
+ } finally {
1966
+ D = n, G = s;
1967
+ }
1968
+ }
1969
+ function F(e, t) {
1970
+ t = t ? Object.assign({}, jt, t) : jt;
1971
+ const n = {
1972
+ value: e,
1973
+ observers: null,
1974
+ observerSlots: null,
1975
+ comparator: t.equals || void 0
1976
+ }, s = (r) => (typeof r == "function" && (r = r(n.value)), rr(n, r));
1977
+ return [sr.bind(n), s];
1978
+ }
1979
+ function Bo(e, t, n) {
1980
+ const s = on(e, t, !0, be);
1981
+ lt(s);
1982
+ }
1983
+ function ke(e, t, n) {
1984
+ const s = on(e, t, !1, be);
1985
+ lt(s);
1986
+ }
1987
+ function er(e, t, n) {
1988
+ Zs = Wo;
1989
+ const s = on(e, t, !1, be);
1990
+ (!n || !n.render) && (s.user = !0), _e ? _e.push(s) : lt(s);
1991
+ }
1992
+ function j(e, t, n) {
1993
+ n = n ? Object.assign({}, jt, n) : jt;
1994
+ const s = on(e, t, !0, 0);
1995
+ return s.observers = null, s.observerSlots = null, s.comparator = n.equals || void 0, lt(s), sr.bind(s);
1996
+ }
1997
+ function Fo(e) {
1998
+ return e && typeof e == "object" && "then" in e;
1999
+ }
2000
+ function Ko(e, t, n) {
2001
+ let s, r, a;
2002
+ s = !0, r = e, a = {};
2003
+ let i = null, o = gn, l = null, f = !1, d = "initialValue" in a, u = typeof s == "function" && j(s);
2004
+ const g = /* @__PURE__ */ new Set(), [h, p] = (a.storage || F)(a.initialValue), [T, S] = F(void 0), [x, y] = F(void 0, {
2005
+ equals: !1
2006
+ }), [w, v] = F(d ? "ready" : "unresolved");
2007
+ _.context && (l = _.getNextContextId(), a.ssrLoadFrom === "initial" ? o = a.initialValue : _.load && _.has(l) && (o = _.load(l)));
2008
+ function U(P, L, W, Q) {
2009
+ return i === P && (i = null, Q !== void 0 && (d = !0), (P === o || L === o) && a.onHydrated && queueMicrotask(() => a.onHydrated(Q, {
2010
+ value: L
2011
+ })), o = gn, N(L, W)), L;
2012
+ }
2013
+ function N(P, L) {
2014
+ me(() => {
2015
+ L === void 0 && p(() => P), v(L !== void 0 ? "errored" : d ? "ready" : "unresolved"), S(L);
2016
+ for (const W of g.keys()) W.decrement();
2017
+ g.clear();
2018
+ }, !1);
2019
+ }
2020
+ function Ae() {
2021
+ const P = $o, L = h(), W = T();
2022
+ if (W !== void 0 && !i) throw W;
2023
+ return D && D.user, L;
2024
+ }
2025
+ function Te(P = !0) {
2026
+ if (P !== !1 && f) return;
2027
+ f = !1;
2028
+ const L = u ? u() : s;
2029
+ if (L == null || L === !1) {
2030
+ U(i, Z(h));
2031
+ return;
2032
+ }
2033
+ let W;
2034
+ const Q = o !== gn ? o : Z(() => {
2035
+ try {
2036
+ return r(L, {
2037
+ value: h(),
2038
+ refetching: P
2039
+ });
2040
+ } catch (ue) {
2041
+ W = ue;
2042
+ }
2043
+ });
2044
+ if (W !== void 0) {
2045
+ U(i, void 0, Vt(W), L);
2046
+ return;
2047
+ } else if (!Fo(Q))
2048
+ return U(i, Q, void 0, L), Q;
2049
+ return i = Q, "v" in Q ? (Q.s === 1 ? U(i, Q.v, void 0, L) : U(i, void 0, Vt(Q.v), L), Q) : (f = !0, queueMicrotask(() => f = !1), me(() => {
2050
+ v(d ? "refreshing" : "pending"), y();
2051
+ }, !1), Q.then((ue) => U(Q, ue, void 0, L), (ue) => U(Q, void 0, Vt(ue), L)));
2052
+ }
2053
+ Object.defineProperties(Ae, {
2054
+ state: {
2055
+ get: () => w()
2056
+ },
2057
+ error: {
2058
+ get: () => T()
2059
+ },
2060
+ loading: {
2061
+ get() {
2062
+ const P = w();
2063
+ return P === "pending" || P === "refreshing";
2064
+ }
2065
+ },
2066
+ latest: {
2067
+ get() {
2068
+ if (!d) return Ae();
2069
+ const P = T();
2070
+ if (P && !i) throw P;
2071
+ return h();
2072
+ }
2073
+ }
2074
+ });
2075
+ let B = G;
2076
+ return u ? Bo(() => (B = G, Te(!1))) : Te(!1), [Ae, {
2077
+ refetch: (P) => tr(B, () => Te(P)),
2078
+ mutate: p
2079
+ }];
2080
+ }
2081
+ function cu(e) {
2082
+ return me(e, !1);
2083
+ }
2084
+ function Z(e) {
2085
+ if (D === null) return e();
2086
+ const t = D;
2087
+ D = null;
2088
+ try {
2089
+ return e();
2090
+ } finally {
2091
+ D = t;
2092
+ }
2093
+ }
2094
+ function uu(e, t, n) {
2095
+ const s = Array.isArray(e);
2096
+ let r, a = n && n.defer;
2097
+ return (i) => {
2098
+ let o;
2099
+ if (s) {
2100
+ o = Array(e.length);
2101
+ for (let f = 0; f < e.length; f++) o[f] = e[f]();
2102
+ } else o = e();
2103
+ if (a)
2104
+ return a = !1, i;
2105
+ const l = Z(() => t(o, r, i));
2106
+ return r = o, l;
2107
+ };
2108
+ }
2109
+ function Vo(e) {
2110
+ er(() => Z(e));
2111
+ }
2112
+ function ft(e) {
2113
+ return G === null || (G.cleanups === null ? G.cleanups = [e] : G.cleanups.push(e)), e;
2114
+ }
2115
+ function os() {
2116
+ return G;
2117
+ }
2118
+ function tr(e, t) {
2119
+ const n = G, s = D;
2120
+ G = e, D = null;
2121
+ try {
2122
+ return me(t, !0);
2123
+ } catch (r) {
2124
+ Fn(r);
2125
+ } finally {
2126
+ G = n, D = s;
2127
+ }
2128
+ }
2129
+ function Ho(e) {
2130
+ const t = D, n = G;
2131
+ return Promise.resolve().then(() => {
2132
+ D = t, G = n;
2133
+ let s;
2134
+ return me(e, !1), D = G = null, s ? s.done : void 0;
2135
+ });
2136
+ }
2137
+ var [qo, du] = /* @__PURE__ */ F(!1);
2138
+ function fu() {
2139
+ return [qo, Ho];
2140
+ }
2141
+ function hu(e, t) {
2142
+ const n = Symbol("context");
2143
+ return {
2144
+ id: n,
2145
+ Provider: jo(n),
2146
+ defaultValue: e
2147
+ };
2148
+ }
2149
+ function gu(e) {
2150
+ let t;
2151
+ return G && G.context && (t = G.context[e.id]) !== void 0 ? t : e.defaultValue;
2152
+ }
2153
+ function nr(e) {
2154
+ const t = j(e), n = j(() => An(t()));
2155
+ return n.toArray = () => {
2156
+ const s = n();
2157
+ return Array.isArray(s) ? s : s != null ? [s] : [];
2158
+ }, n;
2159
+ }
2160
+ var $o;
2161
+ function sr() {
2162
+ if (this.sources && this.state)
2163
+ if (this.state === be) lt(this);
2164
+ else {
2165
+ const e = ee;
2166
+ ee = null, me(() => Zt(this), !1), ee = e;
2167
+ }
2168
+ if (D) {
2169
+ const e = this.observers ? this.observers.length : 0;
2170
+ D.sources ? (D.sources.push(this), D.sourceSlots.push(e)) : (D.sources = [this], D.sourceSlots = [e]), this.observers ? (this.observers.push(D), this.observerSlots.push(D.sources.length - 1)) : (this.observers = [D], this.observerSlots = [D.sources.length - 1]);
2171
+ }
2172
+ return this.value;
2173
+ }
2174
+ function rr(e, t, n) {
2175
+ let s = e.value;
2176
+ return (!e.comparator || !e.comparator(s, t)) && (e.value = t, e.observers && e.observers.length && me(() => {
2177
+ for (let r = 0; r < e.observers.length; r += 1) {
2178
+ const a = e.observers[r], i = mn && mn.running;
2179
+ i && mn.disposed.has(a), (i ? !a.tState : !a.state) && (a.pure ? ee.push(a) : _e.push(a), a.observers && ir(a)), i || (a.state = be);
2180
+ }
2181
+ if (ee.length > 1e6)
2182
+ throw ee = [], new Error();
2183
+ }, !1)), t;
2184
+ }
2185
+ function lt(e) {
2186
+ if (!e.fn) return;
2187
+ ht(e);
2188
+ const t = an;
2189
+ Qo(e, e.value, t);
2190
+ }
2191
+ function Qo(e, t, n) {
2192
+ let s;
2193
+ const r = G, a = D;
2194
+ D = G = e;
2195
+ try {
2196
+ s = e.fn(t);
2197
+ } catch (i) {
2198
+ return e.pure && (e.state = be, e.owned && e.owned.forEach(ht), e.owned = null), e.updatedAt = n + 1, Fn(i);
2199
+ } finally {
2200
+ D = a, G = r;
2201
+ }
2202
+ (!e.updatedAt || e.updatedAt <= n) && (e.updatedAt != null && "observers" in e ? rr(e, s) : e.value = s, e.updatedAt = n);
2203
+ }
2204
+ function on(e, t, n, s = be, r) {
2205
+ const a = {
2206
+ fn: e,
2207
+ state: s,
2208
+ updatedAt: null,
2209
+ owned: null,
2210
+ sources: null,
2211
+ sourceSlots: null,
2212
+ cleanups: null,
2213
+ value: t,
2214
+ owner: G,
2215
+ context: G ? G.context : null,
2216
+ pure: n
2217
+ };
2218
+ return G === null || G !== Xs && (G.owned ? G.owned.push(a) : G.owned = [a]), a;
2219
+ }
2220
+ function Jt(e) {
2221
+ if (e.state === 0) return;
2222
+ if (e.state === Yt) return Zt(e);
2223
+ if (e.suspense && Z(e.suspense.inFallback)) return e.suspense.effects.push(e);
2224
+ const t = [e];
2225
+ for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < an); )
2226
+ e.state && t.push(e);
2227
+ for (let n = t.length - 1; n >= 0; n--)
2228
+ if (e = t[n], e.state === be)
2229
+ lt(e);
2230
+ else if (e.state === Yt) {
2231
+ const s = ee;
2232
+ ee = null, me(() => Zt(e, t[0]), !1), ee = s;
2233
+ }
2234
+ }
2235
+ function me(e, t) {
2236
+ if (ee) return e();
2237
+ let n = !1;
2238
+ t || (ee = []), _e ? n = !0 : _e = [], an++;
2239
+ try {
2240
+ const s = e();
2241
+ return zo(n), s;
2242
+ } catch (s) {
2243
+ n || (_e = null), ee = null, Fn(s);
2244
+ }
2245
+ }
2246
+ function zo(e) {
2247
+ if (ee && (ar(ee), ee = null), e) return;
2248
+ const t = _e;
2249
+ _e = null, t.length && me(() => Zs(t), !1);
2250
+ }
2251
+ function ar(e) {
2252
+ for (let t = 0; t < e.length; t++) Jt(e[t]);
2253
+ }
2254
+ function Wo(e) {
2255
+ let t, n = 0;
2256
+ for (t = 0; t < e.length; t++) {
2257
+ const s = e[t];
2258
+ s.user ? e[n++] = s : Jt(s);
2259
+ }
2260
+ if (_.context) {
2261
+ if (_.count) {
2262
+ _.effects || (_.effects = []), _.effects.push(...e.slice(0, n));
2263
+ return;
2264
+ }
2265
+ ct();
2266
+ }
2267
+ for (_.effects && (_.done || !_.count) && (e = [..._.effects, ...e], n += _.effects.length, delete _.effects), t = 0; t < n; t++) Jt(e[t]);
2268
+ }
2269
+ function Zt(e, t) {
2270
+ e.state = 0;
2271
+ for (let n = 0; n < e.sources.length; n += 1) {
2272
+ const s = e.sources[n];
2273
+ if (s.sources) {
2274
+ const r = s.state;
2275
+ r === be ? s !== t && (!s.updatedAt || s.updatedAt < an) && Jt(s) : r === Yt && Zt(s, t);
2276
+ }
2277
+ }
2278
+ }
2279
+ function ir(e) {
2280
+ for (let t = 0; t < e.observers.length; t += 1) {
2281
+ const n = e.observers[t];
2282
+ n.state || (n.state = Yt, n.pure ? ee.push(n) : _e.push(n), n.observers && ir(n));
2283
+ }
2284
+ }
2285
+ function ht(e) {
2286
+ let t;
2287
+ if (e.sources)
2288
+ for (; e.sources.length; ) {
2289
+ const n = e.sources.pop(), s = e.sourceSlots.pop(), r = n.observers;
2290
+ if (r && r.length) {
2291
+ const a = r.pop(), i = n.observerSlots.pop();
2292
+ s < r.length && (a.sourceSlots[i] = s, r[s] = a, n.observerSlots[s] = i);
2293
+ }
2294
+ }
2295
+ if (e.tOwned) {
2296
+ for (t = e.tOwned.length - 1; t >= 0; t--) ht(e.tOwned[t]);
2297
+ delete e.tOwned;
2298
+ }
2299
+ if (e.owned) {
2300
+ for (t = e.owned.length - 1; t >= 0; t--) ht(e.owned[t]);
2301
+ e.owned = null;
2302
+ }
2303
+ if (e.cleanups) {
2304
+ for (t = e.cleanups.length - 1; t >= 0; t--) e.cleanups[t]();
2305
+ e.cleanups = null;
2306
+ }
2307
+ e.state = 0;
2308
+ }
2309
+ function Vt(e) {
2310
+ return e instanceof Error ? e : new Error(typeof e == "string" ? e : "Unknown error", {
2311
+ cause: e
2312
+ });
2313
+ }
2314
+ function Fn(e, t = G) {
2315
+ throw Vt(e);
2316
+ }
2317
+ function An(e) {
2318
+ if (typeof e == "function" && !e.length) return An(e());
2319
+ if (Array.isArray(e)) {
2320
+ const t = [];
2321
+ for (let n = 0; n < e.length; n++) {
2322
+ const s = An(e[n]);
2323
+ Array.isArray(s) ? t.push.apply(t, s) : t.push(s);
2324
+ }
2325
+ return t;
2326
+ }
2327
+ return e;
2328
+ }
2329
+ function jo(e, t) {
2330
+ return function(s) {
2331
+ let r;
2332
+ return ke(() => r = Z(() => (G.context = {
2333
+ ...G.context,
2334
+ [e]: s.value
2335
+ }, nr(() => s.children))), void 0), r;
2336
+ };
2337
+ }
2338
+ var Tn = Symbol("fallback");
2339
+ function Xt(e) {
2340
+ for (let t = 0; t < e.length; t++) e[t]();
2341
+ }
2342
+ function Yo(e, t, n = {}) {
2343
+ let s = [], r = [], a = [], i = 0, o = t.length > 1 ? [] : null;
2344
+ return ft(() => Xt(a)), () => {
2345
+ let l = e() || [], f = l.length, d, u;
2346
+ return l[Js], Z(() => {
2347
+ let h, p, T, S, x, y, w, v, U;
2348
+ if (f === 0)
2349
+ i !== 0 && (Xt(a), a = [], s = [], r = [], i = 0, o && (o = [])), n.fallback && (s = [Tn], r[0] = De((N) => (a[0] = N, n.fallback())), i = 1);
2350
+ else if (i === 0) {
2351
+ for (r = new Array(f), u = 0; u < f; u++)
2352
+ s[u] = l[u], r[u] = De(g);
2353
+ i = f;
2354
+ } else {
2355
+ for (T = new Array(f), S = new Array(f), o && (x = new Array(f)), y = 0, w = Math.min(i, f); y < w && s[y] === l[y]; y++) ;
2356
+ for (w = i - 1, v = f - 1; w >= y && v >= y && s[w] === l[v]; w--, v--)
2357
+ T[v] = r[w], S[v] = a[w], o && (x[v] = o[w]);
2358
+ for (h = /* @__PURE__ */ new Map(), p = new Array(v + 1), u = v; u >= y; u--)
2359
+ U = l[u], d = h.get(U), p[u] = d === void 0 ? -1 : d, h.set(U, u);
2360
+ for (d = y; d <= w; d++)
2361
+ U = s[d], u = h.get(U), u !== void 0 && u !== -1 ? (T[u] = r[d], S[u] = a[d], o && (x[u] = o[d]), u = p[u], h.set(U, u)) : a[d]();
2362
+ for (u = y; u < f; u++)
2363
+ u in T ? (r[u] = T[u], a[u] = S[u], o && (o[u] = x[u], o[u](u))) : r[u] = De(g);
2364
+ r = r.slice(0, i = f), s = l.slice(0);
2365
+ }
2366
+ return r;
2367
+ });
2368
+ function g(h) {
2369
+ if (a[u] = h, o) {
2370
+ const [p, T] = F(u);
2371
+ return o[u] = T, t(l[u], p);
2372
+ }
2373
+ return t(l[u]);
2374
+ }
2375
+ };
2376
+ }
2377
+ function Jo(e, t, n = {}) {
2378
+ let s = [], r = [], a = [], i = [], o = 0, l;
2379
+ return ft(() => Xt(a)), () => {
2380
+ const f = e() || [], d = f.length;
2381
+ return f[Js], Z(() => {
2382
+ if (d === 0)
2383
+ return o !== 0 && (Xt(a), a = [], s = [], r = [], o = 0, i = []), n.fallback && (s = [Tn], r[0] = De((g) => (a[0] = g, n.fallback())), o = 1), r;
2384
+ for (s[0] === Tn && (a[0](), a = [], s = [], r = [], o = 0), l = 0; l < d; l++)
2385
+ l < s.length && s[l] !== f[l] ? i[l](() => f[l]) : l >= s.length && (r[l] = De(u));
2386
+ for (; l < s.length; l++)
2387
+ a[l]();
2388
+ return o = i.length = a.length = d, s = f.slice(0), r = r.slice(0, o);
2389
+ });
2390
+ function u(g) {
2391
+ a[l] = g;
2392
+ const [h, p] = F(f[l]);
2393
+ return i[l] = p, t(h, l);
2394
+ }
2395
+ };
2396
+ }
2397
+ function or(e, t) {
2398
+ return Z(() => e(t || {}));
2399
+ }
2400
+ function Ut() {
2401
+ return !0;
2402
+ }
2403
+ var Sn = {
2404
+ get(e, t, n) {
2405
+ return t === Wt ? n : e.get(t);
2406
+ },
2407
+ has(e, t) {
2408
+ return t === Wt ? !0 : e.has(t);
2409
+ },
2410
+ set: Ut,
2411
+ deleteProperty: Ut,
2412
+ getOwnPropertyDescriptor(e, t) {
2413
+ return {
2414
+ configurable: !0,
2415
+ enumerable: !0,
2416
+ get() {
2417
+ return e.get(t);
2418
+ },
2419
+ set: Ut,
2420
+ deleteProperty: Ut
2421
+ };
2422
+ },
2423
+ ownKeys(e) {
2424
+ return e.keys();
2425
+ }
2426
+ };
2427
+ function En(e) {
2428
+ return (e = typeof e == "function" ? e() : e) ? e : {};
2429
+ }
2430
+ function Zo() {
2431
+ for (let e = 0, t = this.length; e < t; ++e) {
2432
+ const n = this[e]();
2433
+ if (n !== void 0) return n;
2434
+ }
2435
+ }
2436
+ function lr(...e) {
2437
+ let t = !1;
2438
+ for (let i = 0; i < e.length; i++) {
2439
+ const o = e[i];
2440
+ t = t || !!o && Wt in o, e[i] = typeof o == "function" ? (t = !0, j(o)) : o;
2441
+ }
2442
+ if (Ys && t)
2443
+ return new Proxy({
2444
+ get(i) {
2445
+ for (let o = e.length - 1; o >= 0; o--) {
2446
+ const l = En(e[o])[i];
2447
+ if (l !== void 0) return l;
2448
+ }
2449
+ },
2450
+ has(i) {
2451
+ for (let o = e.length - 1; o >= 0; o--)
2452
+ if (i in En(e[o])) return !0;
2453
+ return !1;
2454
+ },
2455
+ keys() {
2456
+ const i = [];
2457
+ for (let o = 0; o < e.length; o++) i.push(...Object.keys(En(e[o])));
2458
+ return [...new Set(i)];
2459
+ }
2460
+ }, Sn);
2461
+ const n = {}, s = /* @__PURE__ */ Object.create(null);
2462
+ for (let i = e.length - 1; i >= 0; i--) {
2463
+ const o = e[i];
2464
+ if (!o) continue;
2465
+ const l = Object.getOwnPropertyNames(o);
2466
+ for (let f = l.length - 1; f >= 0; f--) {
2467
+ const d = l[f];
2468
+ if (d === "__proto__" || d === "constructor") continue;
2469
+ const u = Object.getOwnPropertyDescriptor(o, d);
2470
+ if (!s[d])
2471
+ s[d] = u.get ? {
2472
+ enumerable: !0,
2473
+ configurable: !0,
2474
+ get: Zo.bind(n[d] = [u.get.bind(o)])
2475
+ } : u.value !== void 0 ? u : void 0;
2476
+ else {
2477
+ const g = n[d];
2478
+ g && (u.get ? g.push(u.get.bind(o)) : u.value !== void 0 && g.push(() => u.value));
2479
+ }
2480
+ }
2481
+ }
2482
+ const r = {}, a = Object.keys(s);
2483
+ for (let i = a.length - 1; i >= 0; i--) {
2484
+ const o = a[i], l = s[o];
2485
+ l && l.get ? Object.defineProperty(r, o, l) : r[o] = l ? l.value : void 0;
2486
+ }
2487
+ return r;
2488
+ }
2489
+ function Xo(e, ...t) {
2490
+ if (Ys && Wt in e) {
2491
+ const r = new Set(t.length > 1 ? t.flat() : t[0]), a = t.map((i) => new Proxy({
2492
+ get(o) {
2493
+ return i.includes(o) ? e[o] : void 0;
2494
+ },
2495
+ has(o) {
2496
+ return i.includes(o) && o in e;
2497
+ },
2498
+ keys() {
2499
+ return i.filter((o) => o in e);
2500
+ }
2501
+ }, Sn));
2502
+ return a.push(new Proxy({
2503
+ get(i) {
2504
+ return r.has(i) ? void 0 : e[i];
2505
+ },
2506
+ has(i) {
2507
+ return r.has(i) ? !1 : i in e;
2508
+ },
2509
+ keys() {
2510
+ return Object.keys(e).filter((i) => !r.has(i));
2511
+ }
2512
+ }, Sn)), a;
2513
+ }
2514
+ const n = {}, s = t.map(() => ({}));
2515
+ for (const r of Object.getOwnPropertyNames(e)) {
2516
+ const a = Object.getOwnPropertyDescriptor(e, r), i = !a.get && !a.set && a.enumerable && a.writable && a.configurable;
2517
+ let o = !1, l = 0;
2518
+ for (const f of t)
2519
+ f.includes(r) && (o = !0, i ? s[l][r] = a.value : Object.defineProperty(s[l], r, a)), ++l;
2520
+ o || (i ? n[r] = a.value : Object.defineProperty(n, r, a));
2521
+ }
2522
+ return [...s, n];
2523
+ }
2524
+ function cr(e) {
2525
+ let t, n;
2526
+ const s = (r) => {
2527
+ const a = _.context;
2528
+ if (a) {
2529
+ const [o, l] = F();
2530
+ _.count || (_.count = 0), _.count++, (n || (n = e())).then((f) => {
2531
+ !_.done && ct(a), _.count--, l(() => f.default), ct();
2532
+ }), t = o;
2533
+ } else if (!t) {
2534
+ const [o] = Ko(() => (n || (n = e())).then((l) => l.default));
2535
+ t = o;
2536
+ }
2537
+ let i;
2538
+ return j(() => (i = t()) ? Z(() => {
2539
+ if (!a || _.done) return i(r);
2540
+ const o = _.context;
2541
+ ct(a);
2542
+ const l = i(r);
2543
+ return ct(o), l;
2544
+ }) : "");
2545
+ };
2546
+ return s.preload = () => n || ((n = e()).then((r) => t = () => r.default), n), s;
2547
+ }
2548
+ var el = 0;
2549
+ function mu() {
2550
+ return _.context ? _.getNextContextId() : `cl-${el++}`;
2551
+ }
2552
+ var ur = (e) => `Stale read from <${e}>.`;
2553
+ function Eu(e) {
2554
+ const t = "fallback" in e && {
2555
+ fallback: () => e.fallback
2556
+ };
2557
+ return j(Yo(() => e.each, e.children, t || void 0));
2558
+ }
2559
+ function pu(e) {
2560
+ const t = "fallback" in e && {
2561
+ fallback: () => e.fallback
2562
+ };
2563
+ return j(Jo(() => e.each, e.children, t || void 0));
2564
+ }
2565
+ function yu(e) {
2566
+ const t = e.keyed, n = j(() => e.when, void 0, void 0), s = t ? n : j(n, void 0, {
2567
+ equals: (r, a) => !r == !a
2568
+ });
2569
+ return j(() => {
2570
+ const r = s();
2571
+ if (r) {
2572
+ const a = e.children;
2573
+ return typeof a == "function" && a.length > 0 ? Z(() => a(t ? r : () => {
2574
+ if (!Z(s)) throw ur("Show");
2575
+ return n();
2576
+ })) : a;
2577
+ }
2578
+ return e.fallback;
2579
+ }, void 0, void 0);
2580
+ }
2581
+ function Au(e) {
2582
+ const t = nr(() => e.children), n = j(() => {
2583
+ const s = t(), r = Array.isArray(s) ? s : [s];
2584
+ let a = () => {
2585
+ };
2586
+ for (let i = 0; i < r.length; i++) {
2587
+ const o = i, l = r[i], f = a, d = j(() => f() ? void 0 : l.when, void 0, void 0), u = l.keyed ? d : j(d, void 0, {
2588
+ equals: (g, h) => !g == !h
2589
+ });
2590
+ a = () => f() || (u() ? [o, d, l] : void 0);
2591
+ }
2592
+ return a;
2593
+ });
2594
+ return j(() => {
2595
+ const s = n()();
2596
+ if (!s) return e.fallback;
2597
+ const [r, a, i] = s, o = i.children;
2598
+ return typeof o == "function" && o.length > 0 ? Z(() => o(i.keyed ? a() : () => {
2599
+ var f;
2600
+ if (((f = Z(n)()) == null ? void 0 : f[0]) !== r) throw ur("Match");
2601
+ return a();
2602
+ })) : o;
2603
+ }, void 0, void 0);
2604
+ }
2605
+ function Tu(e) {
2606
+ return e;
2607
+ }
2608
+ var tl = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"], nl = /* @__PURE__ */ new Set(["className", "value", "readOnly", "noValidate", "formNoValidate", "isMap", "noModule", "playsInline", ...tl]), sl = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]), rl = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
2609
+ className: "class",
2610
+ htmlFor: "for"
2611
+ }), al = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
2612
+ class: "className",
2613
+ novalidate: {
2614
+ $: "noValidate",
2615
+ FORM: 1
2616
+ },
2617
+ formnovalidate: {
2618
+ $: "formNoValidate",
2619
+ BUTTON: 1,
2620
+ INPUT: 1
2621
+ },
2622
+ ismap: {
2623
+ $: "isMap",
2624
+ IMG: 1
2625
+ },
2626
+ nomodule: {
2627
+ $: "noModule",
2628
+ SCRIPT: 1
2629
+ },
2630
+ playsinline: {
2631
+ $: "playsInline",
2632
+ VIDEO: 1
2633
+ },
2634
+ readonly: {
2635
+ $: "readOnly",
2636
+ INPUT: 1,
2637
+ TEXTAREA: 1
2638
+ }
2639
+ });
2640
+ function il(e, t) {
2641
+ const n = al[e];
2642
+ return typeof n == "object" ? n[t] ? n.$ : void 0 : n;
2643
+ }
2644
+ var ol = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]), ll = /* @__PURE__ */ new Set([
2645
+ "altGlyph",
2646
+ "altGlyphDef",
2647
+ "altGlyphItem",
2648
+ "animate",
2649
+ "animateColor",
2650
+ "animateMotion",
2651
+ "animateTransform",
2652
+ "circle",
2653
+ "clipPath",
2654
+ "color-profile",
2655
+ "cursor",
2656
+ "defs",
2657
+ "desc",
2658
+ "ellipse",
2659
+ "feBlend",
2660
+ "feColorMatrix",
2661
+ "feComponentTransfer",
2662
+ "feComposite",
2663
+ "feConvolveMatrix",
2664
+ "feDiffuseLighting",
2665
+ "feDisplacementMap",
2666
+ "feDistantLight",
2667
+ "feDropShadow",
2668
+ "feFlood",
2669
+ "feFuncA",
2670
+ "feFuncB",
2671
+ "feFuncG",
2672
+ "feFuncR",
2673
+ "feGaussianBlur",
2674
+ "feImage",
2675
+ "feMerge",
2676
+ "feMergeNode",
2677
+ "feMorphology",
2678
+ "feOffset",
2679
+ "fePointLight",
2680
+ "feSpecularLighting",
2681
+ "feSpotLight",
2682
+ "feTile",
2683
+ "feTurbulence",
2684
+ "filter",
2685
+ "font",
2686
+ "font-face",
2687
+ "font-face-format",
2688
+ "font-face-name",
2689
+ "font-face-src",
2690
+ "font-face-uri",
2691
+ "foreignObject",
2692
+ "g",
2693
+ "glyph",
2694
+ "glyphRef",
2695
+ "hkern",
2696
+ "image",
2697
+ "line",
2698
+ "linearGradient",
2699
+ "marker",
2700
+ "mask",
2701
+ "metadata",
2702
+ "missing-glyph",
2703
+ "mpath",
2704
+ "path",
2705
+ "pattern",
2706
+ "polygon",
2707
+ "polyline",
2708
+ "radialGradient",
2709
+ "rect",
2710
+ "set",
2711
+ "stop",
2712
+ "svg",
2713
+ "switch",
2714
+ "symbol",
2715
+ "text",
2716
+ "textPath",
2717
+ "tref",
2718
+ "tspan",
2719
+ "use",
2720
+ "view",
2721
+ "vkern"
2722
+ ]), cl = {
2723
+ xlink: "http://www.w3.org/1999/xlink",
2724
+ xml: "http://www.w3.org/XML/1998/namespace"
2725
+ }, Su = (e) => j(() => e());
2726
+ function ul(e, t, n) {
2727
+ let s = n.length, r = t.length, a = s, i = 0, o = 0, l = t[r - 1].nextSibling, f = null;
2728
+ for (; i < r || o < a; ) {
2729
+ if (t[i] === n[o]) {
2730
+ i++, o++;
2731
+ continue;
2732
+ }
2733
+ for (; t[r - 1] === n[a - 1]; )
2734
+ r--, a--;
2735
+ if (r === i) {
2736
+ const d = a < s ? o ? n[o - 1].nextSibling : n[a - o] : l;
2737
+ for (; o < a; ) e.insertBefore(n[o++], d);
2738
+ } else if (a === o)
2739
+ for (; i < r; )
2740
+ (!f || !f.has(t[i])) && t[i].remove(), i++;
2741
+ else if (t[i] === n[a - 1] && n[o] === t[r - 1]) {
2742
+ const d = t[--r].nextSibling;
2743
+ e.insertBefore(n[o++], t[i++].nextSibling), e.insertBefore(n[--a], d), t[r] = n[a];
2744
+ } else {
2745
+ if (!f) {
2746
+ f = /* @__PURE__ */ new Map();
2747
+ let u = o;
2748
+ for (; u < a; ) f.set(n[u], u++);
2749
+ }
2750
+ const d = f.get(t[i]);
2751
+ if (d != null)
2752
+ if (o < d && d < a) {
2753
+ let u = i, g = 1, h;
2754
+ for (; ++u < r && u < a && !((h = f.get(t[u])) == null || h !== d + g); )
2755
+ g++;
2756
+ if (g > d - o) {
2757
+ const p = t[i];
2758
+ for (; o < d; ) e.insertBefore(n[o++], p);
2759
+ } else e.replaceChild(n[o++], t[i++]);
2760
+ } else i++;
2761
+ else t[i++].remove();
2762
+ }
2763
+ }
2764
+ }
2765
+ var ut = "_$DX_DELEGATE";
2766
+ function dr(e, t, n, s = {}) {
2767
+ let r;
2768
+ return De((a) => {
2769
+ r = a, t === document ? e() : Pn(t, e(), t.firstChild ? null : void 0, n);
2770
+ }, s.owner), () => {
2771
+ r(), t.textContent = "";
2772
+ };
2773
+ }
2774
+ function _u(e, t, n, s) {
2775
+ let r;
2776
+ const a = () => {
2777
+ const o = document.createElement("template");
2778
+ return o.innerHTML = e, o.content.firstChild;
2779
+ }, i = () => (r || (r = a())).cloneNode(!0);
2780
+ return i.cloneNode = i, i;
2781
+ }
2782
+ function dl(e, t = window.document) {
2783
+ const n = t[ut] || (t[ut] = /* @__PURE__ */ new Set());
2784
+ for (let s = 0, r = e.length; s < r; s++) {
2785
+ const a = e[s];
2786
+ n.has(a) || (n.add(a), t.addEventListener(a, fr));
2787
+ }
2788
+ }
2789
+ function Pu(e = window.document) {
2790
+ if (e[ut]) {
2791
+ for (let t of e[ut].keys()) e.removeEventListener(t, fr);
2792
+ delete e[ut];
2793
+ }
2794
+ }
2795
+ function _n(e, t, n) {
2796
+ Fe(e) || (n == null ? e.removeAttribute(t) : e.setAttribute(t, n));
2797
+ }
2798
+ function fl(e, t, n, s) {
2799
+ Fe(e) || (s == null ? e.removeAttributeNS(t, n) : e.setAttributeNS(t, n, s));
2800
+ }
2801
+ function hl(e, t, n) {
2802
+ Fe(e) || (n ? e.setAttribute(t, "") : e.removeAttribute(t));
2803
+ }
2804
+ function gl(e, t) {
2805
+ Fe(e) || (t == null ? e.removeAttribute("class") : e.className = t);
2806
+ }
2807
+ function ml(e, t, n, s) {
2808
+ if (s)
2809
+ Array.isArray(n) ? (e[`$$${t}`] = n[0], e[`$$${t}Data`] = n[1]) : e[`$$${t}`] = n;
2810
+ else if (Array.isArray(n)) {
2811
+ const r = n[0];
2812
+ e.addEventListener(t, n[0] = (a) => r.call(e, n[1], a));
2813
+ } else e.addEventListener(t, n, typeof n != "function" && n);
2814
+ }
2815
+ function El(e, t, n = {}) {
2816
+ const s = Object.keys(t || {}), r = Object.keys(n);
2817
+ let a, i;
2818
+ for (a = 0, i = r.length; a < i; a++) {
2819
+ const o = r[a];
2820
+ !o || o === "undefined" || t[o] || (ls(e, o, !1), delete n[o]);
2821
+ }
2822
+ for (a = 0, i = s.length; a < i; a++) {
2823
+ const o = s[a], l = !!t[o];
2824
+ !o || o === "undefined" || n[o] === l || !l || (ls(e, o, !0), n[o] = l);
2825
+ }
2826
+ return n;
2827
+ }
2828
+ function pl(e, t, n) {
2829
+ if (!t) return n ? _n(e, "style") : t;
2830
+ const s = e.style;
2831
+ if (typeof t == "string") return s.cssText = t;
2832
+ typeof n == "string" && (s.cssText = n = void 0), n || (n = {}), t || (t = {});
2833
+ let r, a;
2834
+ for (a in n)
2835
+ t[a] == null && s.removeProperty(a), delete n[a];
2836
+ for (a in t)
2837
+ r = t[a], r !== n[a] && (s.setProperty(a, r), n[a] = r);
2838
+ return n;
2839
+ }
2840
+ function yl(e, t = {}, n, s) {
2841
+ const r = {};
2842
+ return s || ke(() => r.children = gt(e, t.children, r.children)), ke(() => typeof t.ref == "function" && Al(t.ref, e)), ke(() => Tl(e, t, n, !0, r, !0)), r;
2843
+ }
2844
+ function Al(e, t, n) {
2845
+ return Z(() => e(t, n));
2846
+ }
2847
+ function Pn(e, t, n, s) {
2848
+ if (n !== void 0 && !s && (s = []), typeof t != "function") return gt(e, t, s, n);
2849
+ ke((r) => gt(e, t(), r, n), s);
2850
+ }
2851
+ function Tl(e, t, n, s, r = {}, a = !1) {
2852
+ t || (t = {});
2853
+ for (const i in r)
2854
+ if (!(i in t)) {
2855
+ if (i === "children") continue;
2856
+ r[i] = cs(e, i, null, r[i], n, a, t);
2857
+ }
2858
+ for (const i in t) {
2859
+ if (i === "children")
2860
+ continue;
2861
+ const o = t[i];
2862
+ r[i] = cs(e, i, o, r[i], n, a, t);
2863
+ }
2864
+ }
2865
+ function Sl(e) {
2866
+ let t, n;
2867
+ return !Fe() || !(t = _.registry.get(n = Pl())) ? e() : (_.completed && _.completed.add(t), _.registry.delete(n), t);
2868
+ }
2869
+ function Fe(e) {
2870
+ return !!_.context && !_.done && (!e || e.isConnected);
2871
+ }
2872
+ function _l(e) {
2873
+ return e.toLowerCase().replace(/-([a-z])/g, (t, n) => n.toUpperCase());
2874
+ }
2875
+ function ls(e, t, n) {
2876
+ const s = t.trim().split(/\s+/);
2877
+ for (let r = 0, a = s.length; r < a; r++) e.classList.toggle(s[r], n);
2878
+ }
2879
+ function cs(e, t, n, s, r, a, i) {
2880
+ let o, l, f, d, u;
2881
+ if (t === "style") return pl(e, n, s);
2882
+ if (t === "classList") return El(e, n, s);
2883
+ if (n === s) return s;
2884
+ if (t === "ref")
2885
+ a || n(e);
2886
+ else if (t.slice(0, 3) === "on:") {
2887
+ const g = t.slice(3);
2888
+ s && e.removeEventListener(g, s, typeof s != "function" && s), n && e.addEventListener(g, n, typeof n != "function" && n);
2889
+ } else if (t.slice(0, 10) === "oncapture:") {
2890
+ const g = t.slice(10);
2891
+ s && e.removeEventListener(g, s, !0), n && e.addEventListener(g, n, !0);
2892
+ } else if (t.slice(0, 2) === "on") {
2893
+ const g = t.slice(2).toLowerCase(), h = ol.has(g);
2894
+ if (!h && s) {
2895
+ const p = Array.isArray(s) ? s[0] : s;
2896
+ e.removeEventListener(g, p);
2897
+ }
2898
+ (h || n) && (ml(e, g, n, h), h && dl([g]));
2899
+ } else if (t.slice(0, 5) === "attr:")
2900
+ _n(e, t.slice(5), n);
2901
+ else if (t.slice(0, 5) === "bool:")
2902
+ hl(e, t.slice(5), n);
2903
+ else if ((u = t.slice(0, 5) === "prop:") || (f = sl.has(t)) || !r && ((d = il(t, e.tagName)) || (l = nl.has(t))) || (o = e.nodeName.includes("-") || "is" in i)) {
2904
+ if (u)
2905
+ t = t.slice(5), l = !0;
2906
+ else if (Fe(e)) return n;
2907
+ t === "class" || t === "className" ? gl(e, n) : o && !l && !f ? e[_l(t)] = n : e[d || t] = n;
2908
+ } else {
2909
+ const g = r && t.indexOf(":") > -1 && cl[t.split(":")[0]];
2910
+ g ? fl(e, g, t, n) : _n(e, rl[t] || t, n);
2911
+ }
2912
+ return n;
2913
+ }
2914
+ function fr(e) {
2915
+ if (_.registry && _.events && _.events.find(([l, f]) => f === e))
2916
+ return;
2917
+ let t = e.target;
2918
+ const n = `$$${e.type}`, s = e.target, r = e.currentTarget, a = (l) => Object.defineProperty(e, "target", {
2919
+ configurable: !0,
2920
+ value: l
2921
+ }), i = () => {
2922
+ const l = t[n];
2923
+ if (l && !t.disabled) {
2924
+ const f = t[`${n}Data`];
2925
+ if (f !== void 0 ? l.call(t, f, e) : l.call(t, e), e.cancelBubble) return;
2926
+ }
2927
+ return t.host && typeof t.host != "string" && !t.host._$host && t.contains(e.target) && a(t.host), !0;
2928
+ }, o = () => {
2929
+ for (; i() && (t = t._$host || t.parentNode || t.host); ) ;
2930
+ };
2931
+ if (Object.defineProperty(e, "currentTarget", {
2932
+ configurable: !0,
2933
+ get() {
2934
+ return t || document;
2935
+ }
2936
+ }), _.registry && !_.done && (_.done = _$HY.done = !0), e.composedPath) {
2937
+ const l = e.composedPath();
2938
+ a(l[0]);
2939
+ for (let f = 0; f < l.length - 2 && (t = l[f], !!i()); f++) {
2940
+ if (t._$host) {
2941
+ t = t._$host, o();
2942
+ break;
2943
+ }
2944
+ if (t.parentNode === r)
2945
+ break;
2946
+ }
2947
+ } else o();
2948
+ a(s);
2949
+ }
2950
+ function gt(e, t, n, s, r) {
2951
+ const a = Fe(e);
2952
+ if (a) {
2953
+ !n && (n = [...e.childNodes]);
2954
+ let l = [];
2955
+ for (let f = 0; f < n.length; f++) {
2956
+ const d = n[f];
2957
+ d.nodeType === 8 && d.data.slice(0, 2) === "!$" ? d.remove() : l.push(d);
2958
+ }
2959
+ n = l;
2960
+ }
2961
+ for (; typeof n == "function"; ) n = n();
2962
+ if (t === n) return n;
2963
+ const i = typeof t, o = s !== void 0;
2964
+ if (e = o && n[0] && n[0].parentNode || e, i === "string" || i === "number") {
2965
+ if (a || i === "number" && (t = t.toString(), t === n))
2966
+ return n;
2967
+ if (o) {
2968
+ let l = n[0];
2969
+ l && l.nodeType === 3 ? l.data !== t && (l.data = t) : l = document.createTextNode(t), n = Ve(e, n, s, l);
2970
+ } else
2971
+ n !== "" && typeof n == "string" ? n = e.firstChild.data = t : n = e.textContent = t;
2972
+ } else if (t == null || i === "boolean") {
2973
+ if (a) return n;
2974
+ n = Ve(e, n, s);
2975
+ } else {
2976
+ if (i === "function")
2977
+ return ke(() => {
2978
+ let l = t();
2979
+ for (; typeof l == "function"; ) l = l();
2980
+ n = gt(e, l, n, s);
2981
+ }), () => n;
2982
+ if (Array.isArray(t)) {
2983
+ const l = [], f = n && Array.isArray(n);
2984
+ if (wn(l, t, n, r))
2985
+ return ke(() => n = gt(e, l, n, s, !0)), () => n;
2986
+ if (a) {
2987
+ if (!l.length) return n;
2988
+ if (s === void 0) return n = [...e.childNodes];
2989
+ let d = l[0];
2990
+ if (d.parentNode !== e) return n;
2991
+ const u = [d];
2992
+ for (; (d = d.nextSibling) !== s; ) u.push(d);
2993
+ return n = u;
2994
+ }
2995
+ if (l.length === 0) {
2996
+ if (n = Ve(e, n, s), o) return n;
2997
+ } else f ? n.length === 0 ? us(e, l, s) : ul(e, n, l) : (n && Ve(e), us(e, l));
2998
+ n = l;
2999
+ } else if (t.nodeType) {
3000
+ if (a && t.parentNode) return n = o ? [t] : t;
3001
+ if (Array.isArray(n)) {
3002
+ if (o) return n = Ve(e, n, s, t);
3003
+ Ve(e, n, null, t);
3004
+ } else n == null || n === "" || !e.firstChild ? e.appendChild(t) : e.replaceChild(t, e.firstChild);
3005
+ n = t;
3006
+ }
3007
+ }
3008
+ return n;
3009
+ }
3010
+ function wn(e, t, n, s) {
3011
+ let r = !1;
3012
+ for (let a = 0, i = t.length; a < i; a++) {
3013
+ let o = t[a], l = n && n[e.length], f;
3014
+ if (!(o == null || o === !0 || o === !1)) if ((f = typeof o) == "object" && o.nodeType)
3015
+ e.push(o);
3016
+ else if (Array.isArray(o))
3017
+ r = wn(e, o, l) || r;
3018
+ else if (f === "function")
3019
+ if (s) {
3020
+ for (; typeof o == "function"; ) o = o();
3021
+ r = wn(e, Array.isArray(o) ? o : [o], Array.isArray(l) ? l : [l]) || r;
3022
+ } else
3023
+ e.push(o), r = !0;
3024
+ else {
3025
+ const d = String(o);
3026
+ l && l.nodeType === 3 && l.data === d ? e.push(l) : e.push(document.createTextNode(d));
3027
+ }
3028
+ }
3029
+ return r;
3030
+ }
3031
+ function us(e, t, n = null) {
3032
+ for (let s = 0, r = t.length; s < r; s++) e.insertBefore(t[s], n);
3033
+ }
3034
+ function Ve(e, t, n, s) {
3035
+ if (n === void 0) return e.textContent = "";
3036
+ const r = s || document.createTextNode("");
3037
+ if (t.length) {
3038
+ let a = !1;
3039
+ for (let i = t.length - 1; i >= 0; i--) {
3040
+ const o = t[i];
3041
+ if (r !== o) {
3042
+ const l = o.parentNode === e;
3043
+ !a && !i ? l ? e.replaceChild(r, o) : e.insertBefore(r, n) : l && o.remove();
3044
+ } else a = !0;
3045
+ }
3046
+ } else e.insertBefore(r, n);
3047
+ return [r];
3048
+ }
3049
+ function Pl() {
3050
+ return _.getNextContextId();
3051
+ }
3052
+ var wl = "http://www.w3.org/2000/svg";
3053
+ function hr(e, t = !1) {
3054
+ return t ? document.createElementNS(wl, e) : document.createElement(e);
3055
+ }
3056
+ function wu(e) {
3057
+ const {
3058
+ useShadow: t
3059
+ } = e, n = document.createTextNode(""), s = () => e.mount || document.body, r = os();
3060
+ let a, i = !!_.context;
3061
+ return er(() => {
3062
+ i && (os().user = i = !1), a || (a = tr(r, () => j(() => e.children)));
3063
+ const o = s();
3064
+ if (o instanceof HTMLHeadElement) {
3065
+ const [l, f] = F(!1), d = () => f(!0);
3066
+ De((u) => Pn(o, () => l() ? u() : a(), null)), ft(d);
3067
+ } else {
3068
+ const l = hr(e.isSVG ? "g" : "div", e.isSVG), f = t && l.attachShadow ? l.attachShadow({
3069
+ mode: "open"
3070
+ }) : l;
3071
+ Object.defineProperty(l, "_$host", {
3072
+ get() {
3073
+ return n.parentNode;
3074
+ },
3075
+ configurable: !0
3076
+ }), Pn(f, a), o.appendChild(l), e.ref && e.ref(l), ft(() => o.removeChild(l));
3077
+ }
3078
+ }, void 0, {
3079
+ render: !i
3080
+ }), n;
3081
+ }
3082
+ function vl(e, t) {
3083
+ const n = j(e);
3084
+ return j(() => {
3085
+ const s = n();
3086
+ switch (typeof s) {
3087
+ case "function":
3088
+ return Z(() => s(t));
3089
+ case "string":
3090
+ const r = ll.has(s), a = _.context ? Sl() : hr(s, r);
3091
+ return yl(a, t, r), a;
3092
+ }
3093
+ });
3094
+ }
3095
+ function vu(e) {
3096
+ const [, t] = Xo(e, ["component"]);
3097
+ return vl(() => e.component, t);
3098
+ }
3099
+ var bl = class {
3100
+ constructor() {
3101
+ this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
3102
+ }
3103
+ set(e, t) {
3104
+ this.keyToValue.set(e, t), this.valueToKey.set(t, e);
3105
+ }
3106
+ getByKey(e) {
3107
+ return this.keyToValue.get(e);
3108
+ }
3109
+ getByValue(e) {
3110
+ return this.valueToKey.get(e);
3111
+ }
3112
+ clear() {
3113
+ this.keyToValue.clear(), this.valueToKey.clear();
3114
+ }
3115
+ }, gr = class {
3116
+ constructor(e) {
3117
+ this.generateIdentifier = e, this.kv = new bl();
3118
+ }
3119
+ register(e, t) {
3120
+ this.kv.getByValue(e) || (t || (t = this.generateIdentifier(e)), this.kv.set(t, e));
3121
+ }
3122
+ clear() {
3123
+ this.kv.clear();
3124
+ }
3125
+ getIdentifier(e) {
3126
+ return this.kv.getByValue(e);
3127
+ }
3128
+ getValue(e) {
3129
+ return this.kv.getByKey(e);
3130
+ }
3131
+ }, Il = class extends gr {
3132
+ constructor() {
3133
+ super((e) => e.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
3134
+ }
3135
+ register(e, t) {
3136
+ typeof t == "object" ? (t.allowProps && this.classToAllowedProps.set(e, t.allowProps), super.register(e, t.identifier)) : super.register(e, t);
3137
+ }
3138
+ getAllowedProps(e) {
3139
+ return this.classToAllowedProps.get(e);
3140
+ }
3141
+ };
3142
+ function Nl(e) {
3143
+ if ("values" in Object)
3144
+ return Object.values(e);
3145
+ const t = [];
3146
+ for (const n in e)
3147
+ e.hasOwnProperty(n) && t.push(e[n]);
3148
+ return t;
3149
+ }
3150
+ function Ll(e, t) {
3151
+ const n = Nl(e);
3152
+ if ("find" in n)
3153
+ return n.find(t);
3154
+ const s = n;
3155
+ for (let r = 0; r < s.length; r++) {
3156
+ const a = s[r];
3157
+ if (t(a))
3158
+ return a;
3159
+ }
3160
+ }
3161
+ function ot(e, t) {
3162
+ Object.entries(e).forEach(([n, s]) => t(s, n));
3163
+ }
3164
+ function Ht(e, t) {
3165
+ return e.indexOf(t) !== -1;
3166
+ }
3167
+ function ds(e, t) {
3168
+ for (let n = 0; n < e.length; n++) {
3169
+ const s = e[n];
3170
+ if (t(s))
3171
+ return s;
3172
+ }
3173
+ }
3174
+ var Cl = class {
3175
+ constructor() {
3176
+ this.transfomers = {};
3177
+ }
3178
+ register(e) {
3179
+ this.transfomers[e.name] = e;
3180
+ }
3181
+ findApplicable(e) {
3182
+ return Ll(this.transfomers, (t) => t.isApplicable(e));
3183
+ }
3184
+ findByName(e) {
3185
+ return this.transfomers[e];
3186
+ }
3187
+ }, Gl = (e) => Object.prototype.toString.call(e).slice(8, -1), mr = (e) => typeof e > "u", Ol = (e) => e === null, mt = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, vn = (e) => mt(e) && Object.keys(e).length === 0, Ne = (e) => Array.isArray(e), xl = (e) => typeof e == "string", Dl = (e) => typeof e == "number" && !isNaN(e), kl = (e) => typeof e == "boolean", Rl = (e) => e instanceof RegExp, Et = (e) => e instanceof Map, pt = (e) => e instanceof Set, Er = (e) => Gl(e) === "Symbol", Ul = (e) => e instanceof Date && !isNaN(e.valueOf()), Ml = (e) => e instanceof Error, fs = (e) => typeof e == "number" && isNaN(e), Bl = (e) => kl(e) || Ol(e) || mr(e) || Dl(e) || xl(e) || Er(e), Fl = (e) => typeof e == "bigint", Kl = (e) => e === 1 / 0 || e === -1 / 0, Vl = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), Hl = (e) => e instanceof URL, pr = (e) => e.replace(/\./g, "\\."), pn = (e) => e.map(String).map(pr).join("."), dt = (e) => {
3188
+ const t = [];
3189
+ let n = "";
3190
+ for (let r = 0; r < e.length; r++) {
3191
+ let a = e.charAt(r);
3192
+ if (a === "\\" && e.charAt(r + 1) === ".") {
3193
+ n += ".", r++;
3194
+ continue;
3195
+ }
3196
+ if (a === ".") {
3197
+ t.push(n), n = "";
3198
+ continue;
3199
+ }
3200
+ n += a;
3201
+ }
3202
+ const s = n;
3203
+ return t.push(s), t;
3204
+ };
3205
+ function de(e, t, n, s) {
3206
+ return {
3207
+ isApplicable: e,
3208
+ annotation: t,
3209
+ transform: n,
3210
+ untransform: s
3211
+ };
3212
+ }
3213
+ var yr = [
3214
+ de(mr, "undefined", () => null, () => {
3215
+ }),
3216
+ de(Fl, "bigint", (e) => e.toString(), (e) => typeof BigInt < "u" ? BigInt(e) : e),
3217
+ de(Ul, "Date", (e) => e.toISOString(), (e) => new Date(e)),
3218
+ de(Ml, "Error", (e, t) => {
3219
+ const n = {
3220
+ name: e.name,
3221
+ message: e.message
3222
+ };
3223
+ return t.allowedErrorProps.forEach((s) => {
3224
+ n[s] = e[s];
3225
+ }), n;
3226
+ }, (e, t) => {
3227
+ const n = new Error(e.message);
3228
+ return n.name = e.name, n.stack = e.stack, t.allowedErrorProps.forEach((s) => {
3229
+ n[s] = e[s];
3230
+ }), n;
3231
+ }),
3232
+ de(Rl, "regexp", (e) => "" + e, (e) => {
3233
+ const t = e.slice(1, e.lastIndexOf("/")), n = e.slice(e.lastIndexOf("/") + 1);
3234
+ return new RegExp(t, n);
3235
+ }),
3236
+ de(
3237
+ pt,
3238
+ "set",
3239
+ // (sets only exist in es6+)
3240
+ // eslint-disable-next-line es5/no-es6-methods
3241
+ (e) => [...e.values()],
3242
+ (e) => new Set(e)
3243
+ ),
3244
+ de(Et, "map", (e) => [...e.entries()], (e) => new Map(e)),
3245
+ de((e) => fs(e) || Kl(e), "number", (e) => fs(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
3246
+ de((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
3247
+ de(Hl, "URL", (e) => e.toString(), (e) => new URL(e))
3248
+ ];
3249
+ function ln(e, t, n, s) {
3250
+ return {
3251
+ isApplicable: e,
3252
+ annotation: t,
3253
+ transform: n,
3254
+ untransform: s
3255
+ };
3256
+ }
3257
+ var Ar = ln((e, t) => Er(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, n) => {
3258
+ const s = n.symbolRegistry.getValue(t[1]);
3259
+ if (!s)
3260
+ throw new Error("Trying to deserialize unknown symbol");
3261
+ return s;
3262
+ }), ql = [
3263
+ Int8Array,
3264
+ Uint8Array,
3265
+ Int16Array,
3266
+ Uint16Array,
3267
+ Int32Array,
3268
+ Uint32Array,
3269
+ Float32Array,
3270
+ Float64Array,
3271
+ Uint8ClampedArray
3272
+ ].reduce((e, t) => (e[t.name] = t, e), {}), Tr = ln(Vl, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
3273
+ const n = ql[t[1]];
3274
+ if (!n)
3275
+ throw new Error("Trying to deserialize unknown typed array");
3276
+ return new n(e);
3277
+ });
3278
+ function Sr(e, t) {
3279
+ return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
3280
+ }
3281
+ var _r = ln(Sr, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
3282
+ const n = t.classRegistry.getAllowedProps(e.constructor);
3283
+ if (!n)
3284
+ return { ...e };
3285
+ const s = {};
3286
+ return n.forEach((r) => {
3287
+ s[r] = e[r];
3288
+ }), s;
3289
+ }, (e, t, n) => {
3290
+ const s = n.classRegistry.getValue(t[1]);
3291
+ if (!s)
3292
+ throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
3293
+ return Object.assign(Object.create(s.prototype), e);
3294
+ }), Pr = ln((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, n) => {
3295
+ const s = n.customTransformerRegistry.findByName(t[1]);
3296
+ if (!s)
3297
+ throw new Error("Trying to deserialize unknown custom value");
3298
+ return s.deserialize(e);
3299
+ }), $l = [_r, Ar, Pr, Tr], hs = (e, t) => {
3300
+ const n = ds($l, (r) => r.isApplicable(e, t));
3301
+ if (n)
3302
+ return {
3303
+ value: n.transform(e, t),
3304
+ type: n.annotation(e, t)
3305
+ };
3306
+ const s = ds(yr, (r) => r.isApplicable(e, t));
3307
+ if (s)
3308
+ return {
3309
+ value: s.transform(e, t),
3310
+ type: s.annotation
3311
+ };
3312
+ }, wr = {};
3313
+ yr.forEach((e) => {
3314
+ wr[e.annotation] = e;
3315
+ });
3316
+ var Ql = (e, t, n) => {
3317
+ if (Ne(t))
3318
+ switch (t[0]) {
3319
+ case "symbol":
3320
+ return Ar.untransform(e, t, n);
3321
+ case "class":
3322
+ return _r.untransform(e, t, n);
3323
+ case "custom":
3324
+ return Pr.untransform(e, t, n);
3325
+ case "typed-array":
3326
+ return Tr.untransform(e, t, n);
3327
+ default:
3328
+ throw new Error("Unknown transformation: " + t);
3329
+ }
3330
+ else {
3331
+ const s = wr[t];
3332
+ if (!s)
3333
+ throw new Error("Unknown transformation: " + t);
3334
+ return s.untransform(e, n);
3335
+ }
3336
+ }, He = (e, t) => {
3337
+ if (t > e.size)
3338
+ throw new Error("index out of bounds");
3339
+ const n = e.keys();
3340
+ for (; t > 0; )
3341
+ n.next(), t--;
3342
+ return n.next().value;
3343
+ };
3344
+ function vr(e) {
3345
+ if (Ht(e, "__proto__"))
3346
+ throw new Error("__proto__ is not allowed as a property");
3347
+ if (Ht(e, "prototype"))
3348
+ throw new Error("prototype is not allowed as a property");
3349
+ if (Ht(e, "constructor"))
3350
+ throw new Error("constructor is not allowed as a property");
3351
+ }
3352
+ var zl = (e, t) => {
3353
+ vr(t);
3354
+ for (let n = 0; n < t.length; n++) {
3355
+ const s = t[n];
3356
+ if (pt(e))
3357
+ e = He(e, +s);
3358
+ else if (Et(e)) {
3359
+ const r = +s, a = +t[++n] == 0 ? "key" : "value", i = He(e, r);
3360
+ switch (a) {
3361
+ case "key":
3362
+ e = i;
3363
+ break;
3364
+ case "value":
3365
+ e = e.get(i);
3366
+ break;
3367
+ }
3368
+ } else
3369
+ e = e[s];
3370
+ }
3371
+ return e;
3372
+ }, bn = (e, t, n) => {
3373
+ if (vr(t), t.length === 0)
3374
+ return n(e);
3375
+ let s = e;
3376
+ for (let a = 0; a < t.length - 1; a++) {
3377
+ const i = t[a];
3378
+ if (Ne(s)) {
3379
+ const o = +i;
3380
+ s = s[o];
3381
+ } else if (mt(s))
3382
+ s = s[i];
3383
+ else if (pt(s)) {
3384
+ const o = +i;
3385
+ s = He(s, o);
3386
+ } else if (Et(s)) {
3387
+ if (a === t.length - 2)
3388
+ break;
3389
+ const l = +i, f = +t[++a] == 0 ? "key" : "value", d = He(s, l);
3390
+ switch (f) {
3391
+ case "key":
3392
+ s = d;
3393
+ break;
3394
+ case "value":
3395
+ s = s.get(d);
3396
+ break;
3397
+ }
3398
+ }
3399
+ }
3400
+ const r = t[t.length - 1];
3401
+ if (Ne(s) ? s[+r] = n(s[+r]) : mt(s) && (s[r] = n(s[r])), pt(s)) {
3402
+ const a = He(s, +r), i = n(a);
3403
+ a !== i && (s.delete(a), s.add(i));
3404
+ }
3405
+ if (Et(s)) {
3406
+ const a = +t[t.length - 2], i = He(s, a);
3407
+ switch (+r == 0 ? "key" : "value") {
3408
+ case "key": {
3409
+ const l = n(i);
3410
+ s.set(l, s.get(i)), l !== i && s.delete(i);
3411
+ break;
3412
+ }
3413
+ case "value": {
3414
+ s.set(i, n(s.get(i)));
3415
+ break;
3416
+ }
3417
+ }
3418
+ }
3419
+ return e;
3420
+ };
3421
+ function In(e, t, n = []) {
3422
+ if (!e)
3423
+ return;
3424
+ if (!Ne(e)) {
3425
+ ot(e, (a, i) => In(a, t, [...n, ...dt(i)]));
3426
+ return;
3427
+ }
3428
+ const [s, r] = e;
3429
+ r && ot(r, (a, i) => {
3430
+ In(a, t, [...n, ...dt(i)]);
3431
+ }), t(s, n);
3432
+ }
3433
+ function Wl(e, t, n) {
3434
+ return In(t, (s, r) => {
3435
+ e = bn(e, r, (a) => Ql(a, s, n));
3436
+ }), e;
3437
+ }
3438
+ function jl(e, t) {
3439
+ function n(s, r) {
3440
+ const a = zl(e, dt(r));
3441
+ s.map(dt).forEach((i) => {
3442
+ e = bn(e, i, () => a);
3443
+ });
3444
+ }
3445
+ if (Ne(t)) {
3446
+ const [s, r] = t;
3447
+ s.forEach((a) => {
3448
+ e = bn(e, dt(a), () => e);
3449
+ }), r && ot(r, n);
3450
+ } else
3451
+ ot(t, n);
3452
+ return e;
3453
+ }
3454
+ var Yl = (e, t) => mt(e) || Ne(e) || Et(e) || pt(e) || Sr(e, t);
3455
+ function Jl(e, t, n) {
3456
+ const s = n.get(e);
3457
+ s ? s.push(t) : n.set(e, [t]);
3458
+ }
3459
+ function Zl(e, t) {
3460
+ const n = {};
3461
+ let s;
3462
+ return e.forEach((r) => {
3463
+ if (r.length <= 1)
3464
+ return;
3465
+ t || (r = r.map((o) => o.map(String)).sort((o, l) => o.length - l.length));
3466
+ const [a, ...i] = r;
3467
+ a.length === 0 ? s = i.map(pn) : n[pn(a)] = i.map(pn);
3468
+ }), s ? vn(n) ? [s] : [s, n] : vn(n) ? void 0 : n;
3469
+ }
3470
+ var br = (e, t, n, s, r = [], a = [], i = /* @__PURE__ */ new Map()) => {
3471
+ const o = Bl(e);
3472
+ if (!o) {
3473
+ Jl(e, r, t);
3474
+ const h = i.get(e);
3475
+ if (h)
3476
+ return s ? {
3477
+ transformedValue: null
3478
+ } : h;
3479
+ }
3480
+ if (!Yl(e, n)) {
3481
+ const h = hs(e, n), p = h ? {
3482
+ transformedValue: h.value,
3483
+ annotations: [h.type]
3484
+ } : {
3485
+ transformedValue: e
3486
+ };
3487
+ return o || i.set(e, p), p;
3488
+ }
3489
+ if (Ht(a, e))
3490
+ return {
3491
+ transformedValue: null
3492
+ };
3493
+ const l = hs(e, n), f = (l == null ? void 0 : l.value) ?? e, d = Ne(f) ? [] : {}, u = {};
3494
+ ot(f, (h, p) => {
3495
+ if (p === "__proto__" || p === "constructor" || p === "prototype")
3496
+ throw new Error(`Detected property ${p}. This is a prototype pollution risk, please remove it from your object.`);
3497
+ const T = br(h, t, n, s, [...r, p], [...a, e], i);
3498
+ d[p] = T.transformedValue, Ne(T.annotations) ? u[p] = T.annotations : mt(T.annotations) && ot(T.annotations, (S, x) => {
3499
+ u[pr(p) + "." + x] = S;
3500
+ });
3501
+ });
3502
+ const g = vn(u) ? {
3503
+ transformedValue: d,
3504
+ annotations: l ? [l.type] : void 0
3505
+ } : {
3506
+ transformedValue: d,
3507
+ annotations: l ? [l.type, u] : u
3508
+ };
3509
+ return o || i.set(e, g), g;
3510
+ };
3511
+ function Ir(e) {
3512
+ return Object.prototype.toString.call(e).slice(8, -1);
3513
+ }
3514
+ function gs(e) {
3515
+ return Ir(e) === "Array";
3516
+ }
3517
+ function Xl(e) {
3518
+ if (Ir(e) !== "Object")
3519
+ return !1;
3520
+ const t = Object.getPrototypeOf(e);
3521
+ return !!t && t.constructor === Object && t === Object.prototype;
3522
+ }
3523
+ function ec(e, t, n, s, r) {
3524
+ const a = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
3525
+ a === "enumerable" && (e[t] = n), r && a === "nonenumerable" && Object.defineProperty(e, t, {
3526
+ value: n,
3527
+ enumerable: !1,
3528
+ writable: !0,
3529
+ configurable: !0
3530
+ });
3531
+ }
3532
+ function Nn(e, t = {}) {
3533
+ if (gs(e))
3534
+ return e.map((r) => Nn(r, t));
3535
+ if (!Xl(e))
3536
+ return e;
3537
+ const n = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
3538
+ return [...n, ...s].reduce((r, a) => {
3539
+ if (gs(t.props) && !t.props.includes(a))
3540
+ return r;
3541
+ const i = e[a], o = Nn(i, t);
3542
+ return ec(r, a, o, e, t.nonenumerable), r;
3543
+ }, {});
3544
+ }
3545
+ var k = class {
3546
+ /**
3547
+ * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
3548
+ */
3549
+ constructor({ dedupe: e = !1 } = {}) {
3550
+ this.classRegistry = new Il(), this.symbolRegistry = new gr((t) => t.description ?? ""), this.customTransformerRegistry = new Cl(), this.allowedErrorProps = [], this.dedupe = e;
3551
+ }
3552
+ serialize(e) {
3553
+ const t = /* @__PURE__ */ new Map(), n = br(e, t, this, this.dedupe), s = {
3554
+ json: n.transformedValue
3555
+ };
3556
+ n.annotations && (s.meta = {
3557
+ ...s.meta,
3558
+ values: n.annotations
3559
+ });
3560
+ const r = Zl(t, this.dedupe);
3561
+ return r && (s.meta = {
3562
+ ...s.meta,
3563
+ referentialEqualities: r
3564
+ }), s;
3565
+ }
3566
+ deserialize(e) {
3567
+ const { json: t, meta: n } = e;
3568
+ let s = Nn(t);
3569
+ return n != null && n.values && (s = Wl(s, n.values, this)), n != null && n.referentialEqualities && (s = jl(s, n.referentialEqualities)), s;
3570
+ }
3571
+ stringify(e) {
3572
+ return JSON.stringify(this.serialize(e));
3573
+ }
3574
+ parse(e) {
3575
+ return this.deserialize(JSON.parse(e));
3576
+ }
3577
+ registerClass(e, t) {
3578
+ this.classRegistry.register(e, t);
3579
+ }
3580
+ registerSymbol(e, t) {
3581
+ this.symbolRegistry.register(e, t);
3582
+ }
3583
+ registerCustom(e, t) {
3584
+ this.customTransformerRegistry.register({
3585
+ name: t,
3586
+ ...e
3587
+ });
3588
+ }
3589
+ allowErrorProps(...e) {
3590
+ this.allowedErrorProps.push(...e);
3591
+ }
3592
+ };
3593
+ k.defaultInstance = new k();
3594
+ k.serialize = k.defaultInstance.serialize.bind(k.defaultInstance);
3595
+ k.deserialize = k.defaultInstance.deserialize.bind(k.defaultInstance);
3596
+ k.stringify = k.defaultInstance.stringify.bind(k.defaultInstance);
3597
+ k.parse = k.defaultInstance.parse.bind(k.defaultInstance);
3598
+ k.registerClass = k.defaultInstance.registerClass.bind(k.defaultInstance);
3599
+ k.registerSymbol = k.defaultInstance.registerSymbol.bind(k.defaultInstance);
3600
+ k.registerCustom = k.defaultInstance.registerCustom.bind(k.defaultInstance);
3601
+ k.allowErrorProps = k.defaultInstance.allowErrorProps.bind(k.defaultInstance);
3602
+ var tc = k.serialize, bu = k.stringify;
3603
+ function Iu(e) {
3604
+ return e.state.fetchStatus === "fetching" ? "fetching" : e.getObserversCount() ? e.state.fetchStatus === "paused" ? "paused" : e.isStale() ? "stale" : "fresh" : "inactive";
3605
+ }
3606
+ function Nu(e, t) {
3607
+ return `${e}${t.charAt(0).toUpperCase() + t.slice(1)}`;
3608
+ }
3609
+ function Lu({
3610
+ queryState: e,
3611
+ observerCount: t,
3612
+ isStale: n
3613
+ }) {
3614
+ return e.fetchStatus === "fetching" ? "blue" : t ? e.fetchStatus === "paused" ? "purple" : n ? "yellow" : "green" : "gray";
3615
+ }
3616
+ function Cu({
3617
+ status: e,
3618
+ isPaused: t
3619
+ }) {
3620
+ return t ? "purple" : e === "error" ? "red" : e === "pending" ? "yellow" : e === "success" ? "green" : "gray";
3621
+ }
3622
+ function Gu(e) {
3623
+ return e === "fresh" ? "green" : e === "stale" ? "yellow" : e === "paused" ? "purple" : e === "inactive" ? "gray" : "blue";
3624
+ }
3625
+ var Ou = (e, t = !1) => {
3626
+ const {
3627
+ json: n
3628
+ } = tc(e);
3629
+ return JSON.stringify(n, null, t ? 2 : void 0);
3630
+ }, Mt = (e) => e.state.fetchStatus !== "idle" ? 0 : e.getObserversCount() ? e.isStale() ? 2 : 1 : 3, nc = (e, t) => e.queryHash.localeCompare(t.queryHash), Nr = (e, t) => e.state.dataUpdatedAt < t.state.dataUpdatedAt ? 1 : -1, sc = (e, t) => Mt(e) === Mt(t) ? Nr(e, t) : Mt(e) > Mt(t) ? 1 : -1, xu = {
3631
+ status: sc,
3632
+ "query hash": nc,
3633
+ "last updated": Nr
3634
+ }, Bt = (e) => e.state.isPaused ? 0 : e.state.status === "error" ? 2 : e.state.status === "pending" ? 1 : 3, Lr = (e, t) => e.state.submittedAt < t.state.submittedAt ? 1 : -1, rc = (e, t) => Bt(e) === Bt(t) ? Lr(e, t) : Bt(e) > Bt(t) ? 1 : -1, Du = {
3635
+ status: rc,
3636
+ "last updated": Lr
3637
+ }, ku = (e) => e * parseFloat(getComputedStyle(document.documentElement).fontSize), Ru = () => {
3638
+ const [e, t] = F("dark");
3639
+ return Vo(() => {
3640
+ const n = window.matchMedia("(prefers-color-scheme: dark)");
3641
+ t(n.matches ? "dark" : "light");
3642
+ const s = (r) => {
3643
+ t(r.matches ? "dark" : "light");
3644
+ };
3645
+ n.addEventListener("change", s), ft(() => n.removeEventListener("change", s));
3646
+ }), e;
3647
+ }, Ft = (e, t, n) => {
3648
+ if (t.length === 0)
3649
+ return n;
3650
+ if (e instanceof Map) {
3651
+ const s = new Map(e);
3652
+ if (t.length === 1)
3653
+ return s.set(t[0], n), s;
3654
+ const [r, ...a] = t;
3655
+ return s.set(r, Ft(s.get(r), a, n)), s;
3656
+ }
3657
+ if (e instanceof Set) {
3658
+ const s = Ft(Array.from(e), t, n);
3659
+ return new Set(s);
3660
+ }
3661
+ if (Array.isArray(e)) {
3662
+ const s = [...e];
3663
+ if (t.length === 1)
3664
+ return s[t[0]] = n, s;
3665
+ const [r, ...a] = t;
3666
+ return s[r] = Ft(s[r], a, n), s;
3667
+ }
3668
+ if (e instanceof Object) {
3669
+ const s = {
3670
+ ...e
3671
+ };
3672
+ if (t.length === 1)
3673
+ return s[t[0]] = n, s;
3674
+ const [r, ...a] = t;
3675
+ return s[r] = Ft(s[r], a, n), s;
3676
+ }
3677
+ return e;
3678
+ }, Kt = (e, t) => {
3679
+ if (e instanceof Map) {
3680
+ const n = new Map(e);
3681
+ if (t.length === 1)
3682
+ return n.delete(t[0]), n;
3683
+ const [s, ...r] = t;
3684
+ return n.set(s, Kt(n.get(s), r)), n;
3685
+ }
3686
+ if (e instanceof Set) {
3687
+ const n = Kt(Array.from(e), t);
3688
+ return new Set(n);
3689
+ }
3690
+ if (Array.isArray(e)) {
3691
+ const n = [...e];
3692
+ if (t.length === 1)
3693
+ return n.filter((a, i) => i.toString() !== t[0]);
3694
+ const [s, ...r] = t;
3695
+ return n[s] = Kt(n[s], r), n;
3696
+ }
3697
+ if (e instanceof Object) {
3698
+ const n = {
3699
+ ...e
3700
+ };
3701
+ if (t.length === 1)
3702
+ return delete n[t[0]], n;
3703
+ const [s, ...r] = t;
3704
+ return n[s] = Kt(n[s], r), n;
3705
+ }
3706
+ return e;
3707
+ }, Cr = (e, t) => {
3708
+ if (!e || document.querySelector("#_goober") || (t == null ? void 0 : t.querySelector("#_goober"))) return;
3709
+ const s = document.createElement("style"), r = document.createTextNode("");
3710
+ s.appendChild(r), s.id = "_goober", s.setAttribute("nonce", e), t ? t.appendChild(s) : document.head.appendChild(s);
3711
+ }, qe, yt, At, Tt, Oe, St, $e, Qe, ze, We, je, _t, Ye, Je, Pt, ys, ac = (ys = class {
3712
+ constructor(e) {
3713
+ O(this, qe);
3714
+ O(this, yt);
3715
+ O(this, At);
3716
+ O(this, Tt);
3717
+ O(this, Oe, !1);
3718
+ O(this, St);
3719
+ O(this, $e);
3720
+ O(this, Qe);
3721
+ O(this, ze);
3722
+ O(this, We);
3723
+ O(this, je);
3724
+ O(this, _t);
3725
+ O(this, Ye);
3726
+ O(this, Je);
3727
+ O(this, Pt);
3728
+ const {
3729
+ client: t,
3730
+ queryFlavor: n,
3731
+ version: s,
3732
+ onlineManager: r,
3733
+ buttonPosition: a,
3734
+ position: i,
3735
+ initialIsOpen: o,
3736
+ errorTypes: l,
3737
+ styleNonce: f,
3738
+ shadowDOMTarget: d,
3739
+ hideDisabledQueries: u,
3740
+ theme: g
3741
+ } = e;
3742
+ C(this, qe, F(t)), C(this, At, n), C(this, Tt, s), C(this, yt, r), C(this, St, f), C(this, $e, d), C(this, Qe, F(a)), C(this, ze, F(i)), C(this, We, F(o)), C(this, je, F(l)), C(this, _t, F(u)), C(this, Je, F(g));
3743
+ }
3744
+ setButtonPosition(e) {
3745
+ A(this, Qe)[1](e);
3746
+ }
3747
+ setPosition(e) {
3748
+ A(this, ze)[1](e);
3749
+ }
3750
+ setInitialIsOpen(e) {
3751
+ A(this, We)[1](e);
3752
+ }
3753
+ setErrorTypes(e) {
3754
+ A(this, je)[1](e);
3755
+ }
3756
+ setClient(e) {
3757
+ A(this, qe)[1](e);
3758
+ }
3759
+ setTheme(e) {
3760
+ A(this, Je)[1](e);
3761
+ }
3762
+ mount(e) {
3763
+ if (A(this, Oe))
3764
+ throw new Error("Devtools is already mounted");
3765
+ const t = dr(() => {
3766
+ const n = this, [s] = A(this, Qe), [r] = A(this, ze), [a] = A(this, We), [i] = A(this, je), [o] = A(this, _t), [l] = A(this, qe), [f] = A(this, Je);
3767
+ let d;
3768
+ return A(this, Ye) ? d = A(this, Ye) : (d = cr(() => import("./WDYDFRGG-BUVnbAci.js")), C(this, Ye, d)), Cr(A(this, St), A(this, $e)), or(d, lr({
3769
+ get queryFlavor() {
3770
+ return A(n, At);
3771
+ },
3772
+ get version() {
3773
+ return A(n, Tt);
3774
+ },
3775
+ get onlineManager() {
3776
+ return A(n, yt);
3777
+ },
3778
+ get shadowDOMTarget() {
3779
+ return A(n, $e);
3780
+ }
3781
+ }, {
3782
+ get client() {
3783
+ return l();
3784
+ },
3785
+ get buttonPosition() {
3786
+ return s();
3787
+ },
3788
+ get position() {
3789
+ return r();
3790
+ },
3791
+ get initialIsOpen() {
3792
+ return a();
3793
+ },
3794
+ get errorTypes() {
3795
+ return i();
3796
+ },
3797
+ get hideDisabledQueries() {
3798
+ return o();
3799
+ },
3800
+ get theme() {
3801
+ return f();
3802
+ }
3803
+ }));
3804
+ }, e);
3805
+ C(this, Oe, !0), C(this, Pt, t);
3806
+ }
3807
+ unmount() {
3808
+ var e;
3809
+ if (!A(this, Oe))
3810
+ throw new Error("Devtools is not mounted");
3811
+ (e = A(this, Pt)) == null || e.call(this), C(this, Oe, !1);
3812
+ }
3813
+ }, qe = new WeakMap(), yt = new WeakMap(), At = new WeakMap(), Tt = new WeakMap(), Oe = new WeakMap(), St = new WeakMap(), $e = new WeakMap(), Qe = new WeakMap(), ze = new WeakMap(), We = new WeakMap(), je = new WeakMap(), _t = new WeakMap(), Ye = new WeakMap(), Je = new WeakMap(), Pt = new WeakMap(), ys), Ze, wt, vt, bt, xe, It, Xe, et, tt, nt, st, Nt, rt, at, it, Lt, As, ic = (As = class {
3814
+ constructor(e) {
3815
+ O(this, Ze);
3816
+ O(this, wt);
3817
+ O(this, vt);
3818
+ O(this, bt);
3819
+ O(this, xe, !1);
3820
+ O(this, It);
3821
+ O(this, Xe);
3822
+ O(this, et);
3823
+ O(this, tt);
3824
+ O(this, nt);
3825
+ O(this, st);
3826
+ O(this, Nt);
3827
+ O(this, rt);
3828
+ O(this, at);
3829
+ O(this, it);
3830
+ O(this, Lt);
3831
+ const {
3832
+ client: t,
3833
+ queryFlavor: n,
3834
+ version: s,
3835
+ onlineManager: r,
3836
+ buttonPosition: a,
3837
+ position: i,
3838
+ initialIsOpen: o,
3839
+ errorTypes: l,
3840
+ styleNonce: f,
3841
+ shadowDOMTarget: d,
3842
+ onClose: u,
3843
+ hideDisabledQueries: g,
3844
+ theme: h
3845
+ } = e;
3846
+ C(this, Ze, F(t)), C(this, vt, n), C(this, bt, s), C(this, wt, r), C(this, It, f), C(this, Xe, d), C(this, et, F(a)), C(this, tt, F(i)), C(this, nt, F(o)), C(this, st, F(l)), C(this, Nt, F(g)), C(this, rt, F(u)), C(this, it, F(h));
3847
+ }
3848
+ setButtonPosition(e) {
3849
+ A(this, et)[1](e);
3850
+ }
3851
+ setPosition(e) {
3852
+ A(this, tt)[1](e);
3853
+ }
3854
+ setInitialIsOpen(e) {
3855
+ A(this, nt)[1](e);
3856
+ }
3857
+ setErrorTypes(e) {
3858
+ A(this, st)[1](e);
3859
+ }
3860
+ setClient(e) {
3861
+ A(this, Ze)[1](e);
3862
+ }
3863
+ setOnClose(e) {
3864
+ A(this, rt)[1](() => e);
3865
+ }
3866
+ setTheme(e) {
3867
+ A(this, it)[1](e);
3868
+ }
3869
+ mount(e) {
3870
+ if (A(this, xe))
3871
+ throw new Error("Devtools is already mounted");
3872
+ const t = dr(() => {
3873
+ const n = this, [s] = A(this, et), [r] = A(this, tt), [a] = A(this, nt), [i] = A(this, st), [o] = A(this, Nt), [l] = A(this, Ze), [f] = A(this, rt), [d] = A(this, it);
3874
+ let u;
3875
+ return A(this, at) ? u = A(this, at) : (u = cr(() => import("./2SSKDMRQ-CnSDkQcy.js")), C(this, at, u)), Cr(A(this, It), A(this, Xe)), or(u, lr({
3876
+ get queryFlavor() {
3877
+ return A(n, vt);
3878
+ },
3879
+ get version() {
3880
+ return A(n, bt);
3881
+ },
3882
+ get onlineManager() {
3883
+ return A(n, wt);
3884
+ },
3885
+ get shadowDOMTarget() {
3886
+ return A(n, Xe);
3887
+ }
3888
+ }, {
3889
+ get client() {
3890
+ return l();
3891
+ },
3892
+ get buttonPosition() {
3893
+ return s();
3894
+ },
3895
+ get position() {
3896
+ return r();
3897
+ },
3898
+ get initialIsOpen() {
3899
+ return a();
3900
+ },
3901
+ get errorTypes() {
3902
+ return i();
3903
+ },
3904
+ get hideDisabledQueries() {
3905
+ return o();
3906
+ },
3907
+ get onClose() {
3908
+ return f();
3909
+ },
3910
+ get theme() {
3911
+ return d();
3912
+ }
3913
+ }));
3914
+ }, e);
3915
+ C(this, xe, !0), C(this, Lt, t);
3916
+ }
3917
+ unmount() {
3918
+ var e;
3919
+ if (!A(this, xe))
3920
+ throw new Error("Devtools is not mounted");
3921
+ (e = A(this, Lt)) == null || e.call(this), C(this, xe, !1);
3922
+ }
3923
+ }, Ze = new WeakMap(), wt = new WeakMap(), vt = new WeakMap(), bt = new WeakMap(), xe = new WeakMap(), It = new WeakMap(), Xe = new WeakMap(), et = new WeakMap(), tt = new WeakMap(), nt = new WeakMap(), st = new WeakMap(), Nt = new WeakMap(), rt = new WeakMap(), at = new WeakMap(), it = new WeakMap(), Lt = new WeakMap(), As);
3924
+ function oc(e) {
3925
+ const t = J(e.client), n = $.useRef(null), {
3926
+ buttonPosition: s,
3927
+ position: r,
3928
+ initialIsOpen: a,
3929
+ errorTypes: i,
3930
+ styleNonce: o,
3931
+ shadowDOMTarget: l,
3932
+ hideDisabledQueries: f,
3933
+ theme: d
3934
+ } = e, [u] = $.useState(
3935
+ new ac({
3936
+ client: t,
3937
+ queryFlavor: "React Query",
3938
+ version: "5",
3939
+ onlineManager: Gs,
3940
+ buttonPosition: s,
3941
+ position: r,
3942
+ initialIsOpen: a,
3943
+ errorTypes: i,
3944
+ styleNonce: o,
3945
+ shadowDOMTarget: l,
3946
+ hideDisabledQueries: f,
3947
+ theme: d
3948
+ })
3949
+ );
3950
+ return $.useEffect(() => {
3951
+ u.setClient(t);
3952
+ }, [t, u]), $.useEffect(() => {
3953
+ s && u.setButtonPosition(s);
3954
+ }, [s, u]), $.useEffect(() => {
3955
+ r && u.setPosition(r);
3956
+ }, [r, u]), $.useEffect(() => {
3957
+ u.setInitialIsOpen(a || !1);
3958
+ }, [a, u]), $.useEffect(() => {
3959
+ u.setErrorTypes(i || []);
3960
+ }, [i, u]), $.useEffect(() => {
3961
+ u.setTheme(d);
3962
+ }, [d, u]), $.useEffect(() => (n.current && u.mount(n.current), () => {
3963
+ u.unmount();
3964
+ }), [u]), /* @__PURE__ */ c("div", { dir: "ltr", className: "tsqd-parent-container", ref: n });
3965
+ }
3966
+ function lc(e) {
3967
+ const t = J(e.client), n = $.useRef(null), {
3968
+ errorTypes: s,
3969
+ styleNonce: r,
3970
+ shadowDOMTarget: a,
3971
+ hideDisabledQueries: i,
3972
+ theme: o
3973
+ } = e, [l] = $.useState(
3974
+ new ic({
3975
+ client: t,
3976
+ queryFlavor: "React Query",
3977
+ version: "5",
3978
+ onlineManager: Gs,
3979
+ buttonPosition: "bottom-left",
3980
+ position: "bottom",
3981
+ initialIsOpen: !0,
3982
+ errorTypes: s,
3983
+ styleNonce: r,
3984
+ shadowDOMTarget: a,
3985
+ onClose: e.onClose,
3986
+ hideDisabledQueries: i,
3987
+ theme: o
3988
+ })
3989
+ );
3990
+ return $.useEffect(() => {
3991
+ l.setClient(t);
3992
+ }, [t, l]), $.useEffect(() => {
3993
+ l.setOnClose(e.onClose ?? (() => {
3994
+ }));
3995
+ }, [e.onClose, l]), $.useEffect(() => {
3996
+ l.setErrorTypes(s || []);
3997
+ }, [s, l]), $.useEffect(() => {
3998
+ l.setTheme(o);
3999
+ }, [o, l]), $.useEffect(() => (n.current && l.mount(n.current), () => {
4000
+ l.unmount();
4001
+ }), [l]), /* @__PURE__ */ c(
4002
+ "div",
4003
+ {
4004
+ style: { height: "500px", ...e.style },
4005
+ className: "tsqd-parent-container",
4006
+ ref: n
4007
+ }
4008
+ );
4009
+ }
4010
+ var ms = process.env.NODE_ENV !== "development" ? function() {
4011
+ return null;
4012
+ } : oc;
4013
+ process.env.NODE_ENV;
4014
+ const cc = Ee(""), uc = () => {
4015
+ Wn("dynamic-page-selector", {
4016
+ description: "Dynamic page selector"
4017
+ }), Wn("enable-add-page-dropdown", {
4018
+ description: "Enable add page dropdown"
4019
+ });
4020
+ }, dc = () => {
4021
+ const e = b(), t = I();
4022
+ return re({
4023
+ queryKey: [E.GET_COLLECTIONS],
4024
+ staleTime: 1 / 0,
4025
+ queryFn: async () => t(e, { action: E.GET_COLLECTIONS })
4026
+ });
4027
+ }, fc = () => {
4028
+ const { data: e } = oe(), { data: t } = Le(), { data: n } = Be(), s = b(), r = I(), a = q(() => (n == null ? void 0 : n.fallbackLang) || "en", [n == null ? void 0 : n.fallbackLang]), i = Ie(/* @__PURE__ */ new Map());
4029
+ return Y({
4030
+ mutationFn: async ({ block: o }) => {
4031
+ const l = o._id, f = (t == null ? void 0 : t.lang) || a, d = `${l}:${f}`;
4032
+ if (i.current.has(d))
4033
+ return i.current.get(d);
4034
+ const u = r(s, {
4035
+ action: E.GET_BLOCK_ASYNC_PROPS,
4036
+ data: {
4037
+ block: o,
4038
+ lang: f,
4039
+ pageProps: {
4040
+ slug: t == null ? void 0 : t.slug,
4041
+ searchParams: {},
4042
+ pageType: t == null ? void 0 : t.pageType,
4043
+ fallbackLang: a,
4044
+ lastSaved: t.lastSaved,
4045
+ pageId: e.id,
4046
+ primaryPageId: t.primaryPage || e.id,
4047
+ pageBaseSlug: t == null ? void 0 : t.slug,
4048
+ dynamic: e == null ? void 0 : e.dynamic,
4049
+ languagePageId: t.id
4050
+ }
4051
+ }
4052
+ });
4053
+ return i.current.set(d, u), u.finally(() => {
4054
+ i.current.delete(d);
4055
+ }), u;
4056
+ }
4057
+ });
4058
+ }, hc = () => {
4059
+ const [, e] = ve();
4060
+ return z(
4061
+ (t, n) => {
4062
+ const r = new URLSearchParams(window.location.search).get("lang"), a = new URLSearchParams({ page: t });
4063
+ r && a.set("lang", r), window.history.pushState({}, "", `?${a.toString()}`), e(a), window.dispatchEvent(new PopStateEvent("popstate")), n == null || n();
4064
+ },
4065
+ [e]
4066
+ );
4067
+ }, gc = () => {
4068
+ const e = hc();
4069
+ return z(
4070
+ ({ pageId: t }) => {
4071
+ e(t);
4072
+ },
4073
+ [e]
4074
+ );
4075
+ }, mc = {
4076
+ SITE_WIDE_USAGE: "SITE_WIDE_USAGE"
4077
+ }, Ec = (e) => {
4078
+ const t = I(), n = b();
4079
+ return re({
4080
+ queryKey: [mc.SITE_WIDE_USAGE],
4081
+ queryFn: async () => e ? t(n, { action: "GET_SITE_WIDE_USAGE" }) : {},
4082
+ retry: !1
4083
+ });
4084
+ }, pc = V(() => import("./page-lock-Bfbs6RgL.js")), yc = V(
4085
+ () => import("./no-language-page-dialog-PjNqTUpl.js")
4086
+ ), Ac = V(() => import("./digital-asset-manager-DbtwzxRz.js")), Tc = V(() => import("./save-to-lib-eiOc_SSN.js")), Sc = V(() => import("./theme-panel-footer-uBQqSJXm.js")), _c = V(() => import("./web-preview-Djy6WIyj.js"));
4087
+ uc();
4088
+ ii();
4089
+ oa(ho);
4090
+ Ro();
4091
+ ra(Ac);
4092
+ aa(Tc);
4093
+ const Pc = {
4094
+ role: "",
4095
+ permissions: null
4096
+ }, Es = (e) => {
4097
+ var Hn;
4098
+ const { data: t } = To(), n = Mn(), { data: s = Pc, isFetching: r } = So(), { data: a, isFetching: i } = Ce(), { data: o, isFetching: l } = dc(), { data: f, isFetching: d } = Be(), u = r || i || l || d, [g] = ve(), h = g.get("page"), { data: p } = oe(), { data: T, isFetching: S } = po(), { blocks: x } = Eo(T), { data: y, isFetching: w } = yo(), { pageStatus: v } = ye(), U = go(), { onSave: N } = _o(), { mutateAsync: Ae } = fc(), { getPartialBlocks: Te, getPartialBlockBlocks: B } = Po(), { mutateAsync: P } = Ai(), { mutateAsync: L } = Ao(), { data: W } = Ec(((Hn = e.flags) == null ? void 0 : Hn.designTokens) ?? !1), Q = gc(), [ue, Gt] = K(!1), Se = Ie([]), Ke = q(() => H(f, "theme", {}) || {}, [f]), Ge = v === te.EDITING, Gr = v === te.CHECKING, Kn = S || Gr || w;
4099
+ Se.current = x;
4100
+ const [Or] = pe(cc);
4101
+ se(() => {
4102
+ const ae = () => {
4103
+ document.hidden ? Gt(!0) : Gt(!1);
4104
+ };
4105
+ return window.addEventListener("visibilitychange", ae), () => window.removeEventListener("visibilitychange", ae);
4106
+ }, []);
4107
+ const xr = q(() => {
4108
+ const ae = {};
4109
+ return s && (ae.permissions = H(s, "permissions", null), ae.role = H(s, "role", "user")), ae;
4110
+ }, [s]), Vn = q(() => t == null ? void 0 : t.some((ae) => ae.isSiteLibrary), [t]), Dr = z(
4111
+ async (ae, Ot) => await P({ pageType: ae, query: Ot }),
4112
+ [P]
4113
+ );
4114
+ return /* @__PURE__ */ m(he, { children: [
4115
+ Kn && /* @__PURE__ */ c(Vs, { className: u ? "fixed inset-0 bg-white" : "bg-white/75", children: /* @__PURE__ */ c($t, { className: `animate-spin text-primary ${u ? "h-6 w-6" : "h-5 w-5"}` }) }),
4116
+ Or && /* @__PURE__ */ c(
4117
+ X,
4118
+ {
4119
+ fallback: /* @__PURE__ */ c("div", { className: "absolute inset-0 z-[999999] flex min-h-screen w-screen items-center justify-center bg-gray-100", children: /* @__PURE__ */ c($t, { className: "h-6 w-6 animate-spin text-primary" }) }),
4120
+ children: /* @__PURE__ */ c(_c, {})
4121
+ }
4122
+ ),
4123
+ /* @__PURE__ */ c(
4124
+ ia,
4125
+ {
4126
+ siteWideUsage: W ?? {},
4127
+ flags: e.flags ? { ...e.flags, librarySite: Vn } : { librarySite: Vn },
4128
+ gotoPage: Q,
4129
+ collections: o ?? [],
4130
+ getBlockAsyncProps: Ae,
4131
+ pageExternalData: y,
4132
+ themePresets: e.themePresets ?? [],
4133
+ pageId: p == null ? void 0 : p.id,
4134
+ loading: S,
4135
+ fallbackLang: n,
4136
+ languages: (f == null ? void 0 : f.languages) || [],
4137
+ brandingOptions: (f == null ? void 0 : f.theme) || {},
4138
+ designTokens: (f == null ? void 0 : f.designTokens) || {},
4139
+ translations: e.translations || {},
4140
+ locale: e.locale || "en",
4141
+ htmlDir: e.htmlDir || "ltr",
4142
+ autoSave: !ue && Ge && (e.autoSave ?? !0),
4143
+ autoSaveActionsCount: e.autoSaveActionsCount ?? 10,
4144
+ onError: e.onError || console.error,
4145
+ getPartialBlockBlocks: B,
4146
+ getPartialBlocks: Te,
4147
+ blocks: S ? [] : x,
4148
+ theme: Ca(Ke),
4149
+ pageTypes: a,
4150
+ searchPageTypeItems: Dr,
4151
+ askAiCallBack: U,
4152
+ onSave: async ({ blocks: ae, theme: Ot, needTranslations: kr, designTokens: qn }) => {
4153
+ if (!h) return !0;
4154
+ Se.current = ae;
4155
+ const $n = [...ae];
4156
+ await N({ page: h, blocks: $n, needTranslations: kr }), Se.current = $n;
4157
+ const xt = {};
4158
+ return Jn(Ot, Ke) || (xt.theme = Ot), Jn(qn, f == null ? void 0 : f.designTokens) || (xt.designTokens = qn), fe(xt) || await L({ settings: xt }), !0;
4159
+ },
4160
+ themePanelComponent: Sc,
4161
+ ...xr,
4162
+ children: /* @__PURE__ */ c(pc, { isFetchingPageData: Kn })
4163
+ }
4164
+ ),
4165
+ /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(yc, {}) })
4166
+ ] });
4167
+ }, wc = new Oa({
4168
+ defaultOptions: {
4169
+ queries: {
4170
+ refetchOnWindowFocus: !1,
4171
+ refetchOnReconnect: !1,
4172
+ refetchOnMount: !1
4173
+ }
4174
+ }
4175
+ }), Uu = (e) => {
4176
+ const [, t] = Dn(), [n, s] = K(!1);
4177
+ return se(() => (t(
4178
+ xn(e, [
4179
+ "apiUrl",
4180
+ "usersApiUrl",
4181
+ "assetsApiUrl",
4182
+ "getPreviewUrl",
4183
+ "getLiveUrl",
4184
+ "topLeftCorner",
4185
+ "onLogout",
4186
+ "getAccessToken",
4187
+ "websocket",
4188
+ "getLoggedInUser",
4189
+ "features",
4190
+ "currentUser"
4191
+ ])
4192
+ ), setTimeout(() => {
4193
+ s(!0);
4194
+ }, 200), () => {
4195
+ s(!1), t({});
4196
+ }), [e, t]), n ? H(e, "hasReactQueryProvider", !1) === !0 ? /* @__PURE__ */ m(he, { children: [
4197
+ /* @__PURE__ */ c(Es, { ...e }),
4198
+ /* @__PURE__ */ c(ms, {})
4199
+ ] }) : /* @__PURE__ */ m(xa, { client: wc, children: [
4200
+ /* @__PURE__ */ c(Es, { ...e }),
4201
+ /* @__PURE__ */ c(ms, {})
4202
+ ] }) : /* @__PURE__ */ c("div", {});
4203
+ }, vc = $.lazy(() => import("./nested-path-selector-content-CKYYK-C5.js"));
4204
+ function bc({ data: e, onSelect: t, dataType: n = "value", disabled: s = !1 }) {
4205
+ const [r, a] = $.useState(!1);
4206
+ return /* @__PURE__ */ m(la, { open: r, onOpenChange: a, children: [
4207
+ /* @__PURE__ */ m(en, { children: [
4208
+ /* @__PURE__ */ c(tn, { asChild: !0, children: /* @__PURE__ */ c(ca, { asChild: !0, children: /* @__PURE__ */ c(
4209
+ M,
4210
+ {
4211
+ size: "sm",
4212
+ variant: "outline",
4213
+ className: "h-6 w-6 px-1 py-0 text-[9px] text-muted-foreground",
4214
+ role: "combobox",
4215
+ "aria-expanded": r,
4216
+ disabled: s,
4217
+ children: /* @__PURE__ */ c("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24px", height: "24px", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ c(
4218
+ "path",
4219
+ {
4220
+ d: "M9.5 5H9C7.89543 5 7 5.89543 7 7V9C7 10 6.4 12 4 12C5 12 7 12.6 7 15V17.0002C7 18.1048 7.89543 19 9 19H9.5M14.5 5H15C16.1046 5 17 5.89543 17 7V9C17 10 17.6 12 20 12C19 12 17 12.6 17 15V17.0002C17 18.1048 16.1046 19 15 19H14.5",
4221
+ stroke: "#000000",
4222
+ strokeLinecap: "round",
4223
+ strokeLinejoin: "round",
4224
+ strokeWidth: "2"
4225
+ }
4226
+ ) })
4227
+ }
4228
+ ) }) }),
4229
+ /* @__PURE__ */ c(nn, { children: "Add field" })
4230
+ ] }),
4231
+ r && /* @__PURE__ */ c($.Suspense, { children: /* @__PURE__ */ c(
4232
+ vc,
4233
+ {
4234
+ data: e,
4235
+ onSelect: t,
4236
+ dataType: n,
4237
+ open: r,
4238
+ setOpen: a
4239
+ }
4240
+ ) })
4241
+ ] });
4242
+ }
4243
+ const Mu = () => {
4244
+ const { savePageAsync: e } = Re(), t = J(), { isLocked: n } = ye();
4245
+ return z(async () => {
4246
+ n || await e(), t.invalidateQueries({ queryKey: [E.GET_DRAFT_PAGE] }), t.invalidateQueries({ queryKey: [E.GET_BUILDER_PAGE_DATA] });
4247
+ }, [e, t, n]);
4248
+ }, Bu = () => {
4249
+ const e = J();
4250
+ return z(() => {
4251
+ e.clear();
4252
+ }, [e]);
4253
+ }, Fu = () => {
4254
+ const e = b(), t = I(), { data: n } = Le(), s = J();
4255
+ return Y({
4256
+ mutationFn: async (r) => {
4257
+ if (!(n != null && n.id))
4258
+ throw new Error("No active page found");
4259
+ return await t(`${e}`, {
4260
+ action: E.UPDATE_PAGE_METADATA,
4261
+ data: {
4262
+ id: n.id,
4263
+ metadata: r
4264
+ }
4265
+ });
4266
+ },
4267
+ onSuccess: () => {
4268
+ s.invalidateQueries({
4269
+ queryKey: [E.GET_BUILDER_PAGE_DATA]
4270
+ }), s.invalidateQueries({
4271
+ queryKey: [E.GET_LANGUAGE_PAGES]
4272
+ });
4273
+ },
4274
+ onError: () => {
4275
+ console.error("Failed to update metadata");
4276
+ }
4277
+ });
4278
+ }, Ic = V(() => import("./digital-asset-manager-DbtwzxRz.js")), Ku = ({
4279
+ assetId: e,
4280
+ assetUrl: t,
4281
+ onChange: n,
4282
+ className: s = "",
4283
+ placeholder: r = "Select an image",
4284
+ disabled: a = !1
4285
+ }) => {
4286
+ const { t: i } = we(), [o, l] = K(!1), f = () => {
4287
+ a || l(!0);
4288
+ }, d = () => {
4289
+ l(!1);
4290
+ }, u = (p) => {
4291
+ const T = Array.isArray(p) ? p[0] : p;
4292
+ T != null && T.url && n(xn(T, ["url", "id"])), l(!1);
4293
+ }, g = () => {
4294
+ n({ url: "", id: "" });
4295
+ }, h = (t == null ? void 0 : t.startsWith("{{")) && (t == null ? void 0 : t.endsWith("}}"));
4296
+ return /* @__PURE__ */ m("div", { className: `w-full ${s}`, children: [
4297
+ t ? /* @__PURE__ */ m("div", { className: "relative overflow-hidden rounded-md border", children: [
4298
+ h ? /* @__PURE__ */ c("div", { className: "flex h-12 items-center bg-gray-100 px-4", children: /* @__PURE__ */ c("p", { className: "text-xs text-gray-500", children: t }) }) : /* @__PURE__ */ c(
4299
+ "img",
4300
+ {
4301
+ onClick: f,
4302
+ src: t,
4303
+ alt: i("Selected image"),
4304
+ className: "h-auto max-h-[100px] w-full bg-gray-100 object-contain"
4305
+ }
4306
+ ),
4307
+ /* @__PURE__ */ m("div", { className: "absolute right-2 top-2 flex gap-2", children: [
4308
+ /* @__PURE__ */ c(
4309
+ M,
4310
+ {
4311
+ type: "button",
4312
+ variant: "outline",
4313
+ size: "icon",
4314
+ className: "h-8 w-8 rounded-full bg-white text-red-500",
4315
+ onClick: g,
4316
+ disabled: a,
4317
+ children: h ? /* @__PURE__ */ c(ss, { className: "h-4 w-4" }) : /* @__PURE__ */ c(Ja, { className: "h-4 w-4" })
4318
+ }
4319
+ ),
4320
+ !h && /* @__PURE__ */ c(
4321
+ M,
4322
+ {
4323
+ type: "button",
4324
+ variant: "outline",
4325
+ size: "icon",
4326
+ className: "h-8 w-8 rounded-full bg-white/80 hover:bg-white/90",
4327
+ onClick: f,
4328
+ disabled: a,
4329
+ children: /* @__PURE__ */ c(rs, { className: "h-4 w-4" })
4330
+ }
4331
+ )
4332
+ ] })
4333
+ ] }) : /* @__PURE__ */ c(
4334
+ "div",
4335
+ {
4336
+ className: `flex cursor-pointer items-center justify-center rounded-md border border-dashed p-6 ${a ? "cursor-not-allowed opacity-50" : "hover:border-gray-400"}`,
4337
+ onClick: f,
4338
+ children: /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-2", children: [
4339
+ /* @__PURE__ */ c(rs, { className: "h-10 w-10 text-gray-400" }),
4340
+ /* @__PURE__ */ c("p", { className: "text-sm text-gray-500", children: r })
4341
+ ] })
4342
+ }
4343
+ ),
4344
+ /* @__PURE__ */ c(ws, { open: o, onOpenChange: l, children: /* @__PURE__ */ m(ua, { className: "h-fit w-full max-w-7xl overflow-hidden p-0", children: [
4345
+ /* @__PURE__ */ m(da, { className: "hidden border-b px-4 py-2", children: [
4346
+ /* @__PURE__ */ c(fa, { children: i("Select Image") }),
4347
+ /* @__PURE__ */ c(
4348
+ M,
4349
+ {
4350
+ type: "button",
4351
+ variant: "ghost",
4352
+ size: "icon",
4353
+ className: "absolute right-4 top-2",
4354
+ onClick: d,
4355
+ children: /* @__PURE__ */ c(ss, { className: "h-4 w-4" })
4356
+ }
4357
+ )
4358
+ ] }),
4359
+ /* @__PURE__ */ c("div", { className: "h-full flex-1 p-4", children: /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(
4360
+ Ic,
4361
+ {
4362
+ close: d,
4363
+ onSelect: u,
4364
+ mode: "image",
4365
+ assetId: e
4366
+ }
4367
+ ) }) })
4368
+ ] }) })
4369
+ ] });
4370
+ }, Nc = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), ps = (e) => {
4371
+ if (!e.trim())
4372
+ return { isValid: !1, parsed: null, placeholders: [], error: { message: "JSON is empty" } };
4373
+ try {
4374
+ return { isValid: !0, parsed: JSON.parse(e), error: null, placeholders: [] };
4375
+ } catch {
4376
+ }
4377
+ const t = /{{([^{}]+)}}/g, n = [];
4378
+ let s = e, r;
4379
+ for (; (r = t.exec(e)) !== null; ) {
4380
+ const a = r[0], i = r.index, o = `"__placeholder_${n.length}__"`;
4381
+ n.push({ original: a, replaced: o, position: i }), s = s.replace(a, o);
4382
+ }
4383
+ try {
4384
+ return { isValid: !0, parsed: JSON.parse(s), error: null, placeholders: n };
4385
+ } catch (a) {
4386
+ const i = a, o = i.message.match(/position (\d+)/), l = o ? parseInt(o[1]) : void 0;
4387
+ let f, d;
4388
+ if (l !== void 0) {
4389
+ const u = s.substring(0, l).split(`
4390
+ `);
4391
+ f = u.length, d = u[u.length - 1].length + 1;
4392
+ }
4393
+ return {
4394
+ isValid: !1,
4395
+ parsed: null,
4396
+ placeholders: n,
4397
+ error: {
4398
+ message: i.message,
4399
+ line: f,
4400
+ column: d,
4401
+ position: l
4402
+ }
4403
+ };
4404
+ }
4405
+ }, Lc = (e, t) => {
4406
+ let s = JSON.stringify(e, null, 2);
4407
+ return t.forEach(({ original: r }, a) => {
4408
+ const i = `"__placeholder_${a}__"`, o = new RegExp(Nc(i), "g");
4409
+ s = s.replace(o, r);
4410
+ }), s;
4411
+ }, Cc = (e, t) => {
4412
+ if (!e) return "";
4413
+ let n = JSON.stringify(e, null, 2);
4414
+ const s = /{{([^{}]+)}}/g;
4415
+ let r;
4416
+ for (; (r = s.exec(n)) !== null; ) {
4417
+ const a = r[1], i = H(t, a, null);
4418
+ n = n.replace(r[0], i);
4419
+ }
4420
+ return n;
4421
+ }, Gc = V(() => import("./shared-json-ld-B4PxAM_0.js")), Vu = ({
4422
+ value: e,
4423
+ onChange: t,
4424
+ disabled: n = !1,
4425
+ readOnly: s = !1,
4426
+ placeholder: r = "Enter JSON",
4427
+ rows: a = 6,
4428
+ id: i = "json-input",
4429
+ pageData: o = {},
4430
+ handleFieldInsert: l,
4431
+ hasJsonLdForSelectedLang: f,
4432
+ copyJsonLDFromDefaultPage: d
4433
+ }) => {
4434
+ const [u, g] = K("edit"), [h, p] = K(null), [T, S] = K(""), x = Ie(null), [y] = Dn(), w = i === "jsonLD" && H(y, "features.sharedJsonLD", !1), v = i === "jsonLD" && !f && !!d;
4435
+ se(() => {
4436
+ e.trim() === "" && t("{}");
4437
+ }, [e, t]);
4438
+ const U = (B) => {
4439
+ if (s) return;
4440
+ const P = B.target.value;
4441
+ t(P);
4442
+ }, N = (B) => {
4443
+ if (B.key === "Tab") {
4444
+ B.preventDefault();
4445
+ const P = B.currentTarget, L = P.selectionStart, W = P.selectionEnd;
4446
+ if (L !== W) {
4447
+ const ue = e.substring(L, W).split(`
4448
+ `);
4449
+ if (B.shiftKey) {
4450
+ const Se = ue.map((Ge) => Ge.startsWith(" ") ? Ge.substring(2) : Ge).join(`
4451
+ `), Ke = e.substring(0, L) + Se + e.substring(W);
4452
+ t(Ke), setTimeout(() => {
4453
+ P.selectionStart = L, P.selectionEnd = L + Se.length;
4454
+ }, 0);
4455
+ } else {
4456
+ const Se = ue.map((Ge) => ` ${Ge}`).join(`
4457
+ `), Ke = e.substring(0, L) + Se + e.substring(W);
4458
+ t(Ke), setTimeout(() => {
4459
+ P.selectionStart = L, P.selectionEnd = L + Se.length;
4460
+ }, 0);
4461
+ }
4462
+ } else {
4463
+ const Q = e.substring(0, L) + " " + e.substring(W);
4464
+ t(Q), setTimeout(() => {
4465
+ P.selectionStart = P.selectionEnd = L + 2;
4466
+ }, 0);
4467
+ }
4468
+ }
4469
+ };
4470
+ se(() => {
4471
+ const B = ps(e);
4472
+ if (B.isValid)
4473
+ if (p(null), B.parsed) {
4474
+ const P = Cc(B.parsed, o);
4475
+ S(P);
4476
+ } else
4477
+ S("");
4478
+ else
4479
+ p(B.error), S("");
4480
+ }, [e, o]);
4481
+ const Ae = () => {
4482
+ const B = ps(e);
4483
+ if (B.isValid && B.parsed) {
4484
+ const P = Lc(B.parsed, B.placeholders);
4485
+ t(P);
4486
+ }
4487
+ }, Te = () => {
4488
+ h != null && h.position && x.current && (x.current.focus(), x.current.setSelectionRange(h.position, h.position + 1));
4489
+ };
4490
+ return /* @__PURE__ */ c(oi, { fallback: /* @__PURE__ */ c("div", { children: "Some error" }), children: /* @__PURE__ */ c("div", { className: "space-y-2", children: /* @__PURE__ */ m(ha, { value: u, onValueChange: g, className: "w-full", children: [
4491
+ /* @__PURE__ */ m("div", { className: "mb-2 flex items-center justify-between", children: [
4492
+ /* @__PURE__ */ m(ga, { className: "w-max", children: [
4493
+ /* @__PURE__ */ m(cn, { value: "edit", className: "flex items-center gap-1", children: [
4494
+ /* @__PURE__ */ c(Za, { className: "h-4 w-4" }),
4495
+ /* @__PURE__ */ c("span", { children: "Edit" })
4496
+ ] }),
4497
+ /* @__PURE__ */ m(
4498
+ cn,
4499
+ {
4500
+ value: "preview",
4501
+ className: "flex items-center gap-1",
4502
+ disabled: !e.trim() || h !== null || v,
4503
+ children: [
4504
+ /* @__PURE__ */ c(Xa, { className: "h-4 w-4" }),
4505
+ /* @__PURE__ */ c("span", { children: "Preview" })
4506
+ ]
4507
+ }
4508
+ ),
4509
+ w && /* @__PURE__ */ m(
4510
+ cn,
4511
+ {
4512
+ value: "shared",
4513
+ className: "flex items-center gap-1",
4514
+ disabled: !e.trim() || h !== null,
4515
+ children: [
4516
+ /* @__PURE__ */ c(ei, { className: "h-4 w-4" }),
4517
+ /* @__PURE__ */ c("span", { children: "Shared" })
4518
+ ]
4519
+ }
4520
+ )
4521
+ ] }),
4522
+ v ? null : u === "edit" && !s && /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ c(
4523
+ bc,
4524
+ {
4525
+ dataType: "value",
4526
+ data: o ?? {},
4527
+ onSelect: (B) => l && l(B, i)
4528
+ }
4529
+ ) })
4530
+ ] }),
4531
+ /* @__PURE__ */ m(un, { value: "edit", className: "relative mt-0", children: [
4532
+ !v && u === "edit" && /* @__PURE__ */ c(Bn, { content: "Format JSON", side: "right", showTooltip: !n && !h, children: /* @__PURE__ */ c(
4533
+ M,
4534
+ {
4535
+ type: "button",
4536
+ variant: "outline",
4537
+ size: "icon",
4538
+ onClick: Ae,
4539
+ className: "absolute right-1 top-1 h-6 w-6 p-1",
4540
+ disabled: !e.trim() || n || h !== null,
4541
+ children: /* @__PURE__ */ c(ti, {})
4542
+ }
4543
+ ) }),
4544
+ v ? /* @__PURE__ */ c("div", { className: "flex h-40 items-center justify-center rounded-md bg-black/20", children: /* @__PURE__ */ m("div", { className: "flex max-w-[400px] flex-col items-center gap-2 rounded-md bg-white p-4 shadow-lg", children: [
4545
+ /* @__PURE__ */ c("div", { className: "max-w-xl text-center text-xs text-gray-500", children: "JSON-LD for is not added for selected language. JSON LD will be used from default language." }),
4546
+ /* @__PURE__ */ m(M, { type: "button", variant: "default", size: "sm", onClick: d, children: [
4547
+ /* @__PURE__ */ c(Os, {}),
4548
+ "Copy & Edit from default language"
4549
+ ] })
4550
+ ] }) }) : /* @__PURE__ */ c(
4551
+ jn,
4552
+ {
4553
+ ref: x,
4554
+ id: i,
4555
+ name: i,
4556
+ className: `rounded-md border border-input text-xs ${h ? "border-red-500" : ""}`,
4557
+ onChange: U,
4558
+ onKeyDown: N,
4559
+ value: e,
4560
+ placeholder: r,
4561
+ rows: a,
4562
+ disabled: n,
4563
+ readOnly: s
4564
+ }
4565
+ ),
4566
+ h && /* @__PURE__ */ m(ma, { variant: "destructive", className: "mt-2", children: [
4567
+ /* @__PURE__ */ c(ni, { className: "h-4 w-4" }),
4568
+ /* @__PURE__ */ m(Ea, { className: "flex flex-col", children: [
4569
+ /* @__PURE__ */ c("span", { className: "font-medium", children: "Invalid JSON" }),
4570
+ /* @__PURE__ */ c("span", { className: "text-sm", children: h.message }),
4571
+ h.line && h.column && /* @__PURE__ */ m("span", { className: "text-sm", children: [
4572
+ "Error at line ",
4573
+ h.line,
4574
+ ", column ",
4575
+ h.column
4576
+ ] }),
4577
+ /* @__PURE__ */ c(
4578
+ M,
4579
+ {
4580
+ type: "button",
4581
+ variant: "link",
4582
+ size: "sm",
4583
+ className: "mt-1 h-auto self-start p-0 text-sm",
4584
+ onClick: Te,
4585
+ children: "Show position"
4586
+ }
4587
+ )
4588
+ ] })
4589
+ ] })
4590
+ ] }),
4591
+ /* @__PURE__ */ m(un, { value: "preview", className: "mt-0", children: [
4592
+ /* @__PURE__ */ c(jn, { rows: a, value: T, readOnly: !0, className: "cursor-default bg-muted font-mono text-sm" }),
4593
+ /* @__PURE__ */ c("p", { className: "mt-1 text-xs text-muted-foreground", children: "This is how the JSON will look after placeholder substitution." })
4594
+ ] }),
4595
+ w && /* @__PURE__ */ c(un, { value: "shared", className: "mt-0", children: /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(Gc, {}) }) })
4596
+ ] }) }) });
4597
+ }, Hu = (e) => {
4598
+ const t = b(), n = I();
4599
+ return re({
4600
+ queryKey: [E.GET_CHAI_USER, e],
4601
+ queryFn: async () => {
4602
+ const r = await n(t, {
4603
+ action: E.GET_CHAI_USER,
4604
+ data: { userId: e }
4605
+ });
4606
+ return { ...r, name: r.name || r.email };
4607
+ },
4608
+ enabled: !fe(e),
4609
+ staleTime: "static"
4610
+ });
4611
+ };
4612
+ if (typeof window > "u")
4613
+ throw new Error("@chaibuilder/pages is not available on the server");
4614
+ export {
4615
+ mu as $,
4616
+ E as A,
4617
+ Vs as B,
4618
+ F as C,
4619
+ Vo as D,
4620
+ ne as E,
4621
+ er as F,
4622
+ wu as G,
4623
+ Su as H,
4624
+ _u as I,
4625
+ Pn as J,
4626
+ ke as K,
4627
+ Rt as L,
4628
+ gl as M,
4629
+ Pu as N,
4630
+ dl as O,
4631
+ te as P,
4632
+ gu as Q,
4633
+ ft as R,
4634
+ yu as S,
4635
+ Bn as T,
4636
+ xu as U,
4637
+ Du as V,
4638
+ uu as W,
4639
+ _n as X,
4640
+ Nu as Y,
4641
+ Al as Z,
4642
+ ku as _,
4643
+ ye as a,
4644
+ cu as a0,
4645
+ Iu as a1,
4646
+ Cu as a2,
4647
+ Lu as a3,
4648
+ Gu as a4,
4649
+ Ou as a5,
4650
+ Eu as a6,
4651
+ Z as a7,
4652
+ Js as a8,
4653
+ fu as a9,
4654
+ rn as aA,
4655
+ Us as aB,
4656
+ su as aC,
4657
+ iu as aD,
4658
+ Vu as aE,
4659
+ ps as aF,
4660
+ ru as aG,
4661
+ ou as aH,
4662
+ lu as aI,
4663
+ au as aJ,
4664
+ yo as aK,
4665
+ yi as aL,
4666
+ Dn as aM,
4667
+ qi as aN,
4668
+ bc as aO,
4669
+ Ku as aP,
4670
+ Ti as aQ,
4671
+ jc as aR,
4672
+ Fs as aS,
4673
+ Uu as aT,
4674
+ Le as aU,
4675
+ Bu as aV,
4676
+ gc as aW,
4677
+ Mu as aX,
4678
+ Fu as aY,
4679
+ Rn as aZ,
4680
+ So as a_,
4681
+ yl as aa,
4682
+ lr as ab,
4683
+ De as ac,
4684
+ tc as ad,
4685
+ pu as ae,
4686
+ Ft as af,
4687
+ ml as ag,
4688
+ bu as ah,
4689
+ Tu as ai,
4690
+ Au as aj,
4691
+ Kt as ak,
4692
+ Xo as al,
4693
+ vu as am,
4694
+ Bo as an,
4695
+ Gi as ao,
4696
+ Hu as ap,
4697
+ Li as aq,
4698
+ b as ar,
4699
+ I as as,
4700
+ hc as at,
4701
+ nu as au,
4702
+ zt as av,
4703
+ oe as aw,
4704
+ fn as ax,
4705
+ le as ay,
4706
+ ks as az,
4707
+ Ms as b,
4708
+ ve as c,
4709
+ Zi as d,
4710
+ Hs as e,
4711
+ Ao as f,
4712
+ Bs as g,
4713
+ Yc as h,
4714
+ Jc as i,
4715
+ Be as j,
4716
+ Mn as k,
4717
+ Me as l,
4718
+ Ce as m,
4719
+ hi as n,
4720
+ Zc as o,
4721
+ cc as p,
4722
+ eu as q,
4723
+ tu as r,
4724
+ Xc as s,
4725
+ hn as t,
4726
+ Wc as u,
4727
+ zc as v,
4728
+ Ru as w,
4729
+ j as x,
4730
+ or as y,
4731
+ hu as z
4732
+ };