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

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