@chaibuilder/sdk 3.2.13 → 4.0.0-beta.10

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