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

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