@chaibuilder/pages 0.16.14 → 0.16.16

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