zudoku 0.47.2 → 0.48.0

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 (264) hide show
  1. package/dist/app/ZuploBuildConfig.d.ts +4 -114
  2. package/dist/app/ZuploBuildConfig.js +1 -1
  3. package/dist/app/ZuploBuildConfig.js.map +1 -1
  4. package/dist/app/demo.js +4 -3
  5. package/dist/app/demo.js.map +1 -1
  6. package/dist/app/main.js +5 -5
  7. package/dist/app/main.js.map +1 -1
  8. package/dist/app/standalone.js +4 -3
  9. package/dist/app/standalone.js.map +1 -1
  10. package/dist/config/loader.js +1 -2
  11. package/dist/config/loader.js.map +1 -1
  12. package/dist/config/validators/BuildSchema.d.ts +20 -44
  13. package/dist/config/validators/BuildSchema.js +3 -14
  14. package/dist/config/validators/BuildSchema.js.map +1 -1
  15. package/dist/config/validators/InputNavigationSchema.d.ts +7217 -0
  16. package/dist/config/validators/InputNavigationSchema.js +74 -0
  17. package/dist/config/validators/InputNavigationSchema.js.map +1 -0
  18. package/dist/config/validators/InputNavigationSchema.test-d.d.ts +1 -0
  19. package/dist/config/validators/InputNavigationSchema.test-d.js +146 -0
  20. package/dist/config/validators/InputNavigationSchema.test-d.js.map +1 -0
  21. package/dist/config/validators/NavigationSchema.d.ts +44 -0
  22. package/dist/config/validators/NavigationSchema.js +95 -0
  23. package/dist/config/validators/NavigationSchema.js.map +1 -0
  24. package/dist/config/validators/icon-types.d.ts +2 -1
  25. package/dist/config/validators/icon-types.js +1775 -1
  26. package/dist/config/validators/icon-types.js.map +1 -1
  27. package/dist/config/validators/validate.d.ts +442 -5780
  28. package/dist/config/validators/validate.js +37 -55
  29. package/dist/config/validators/validate.js.map +1 -1
  30. package/dist/config/validators/validate.test.js +0 -2
  31. package/dist/config/validators/validate.test.js.map +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/lib/components/BuildCheck.js +1 -1
  35. package/dist/lib/components/BuildCheck.js.map +1 -1
  36. package/dist/lib/components/Header.js +10 -9
  37. package/dist/lib/components/Header.js.map +1 -1
  38. package/dist/lib/components/Heading.d.ts +6 -2
  39. package/dist/lib/components/Heading.js +2 -2
  40. package/dist/lib/components/Heading.js.map +1 -1
  41. package/dist/lib/components/Main.js +4 -4
  42. package/dist/lib/components/Main.js.map +1 -1
  43. package/dist/lib/components/MobileTopNavigation.js +5 -5
  44. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  45. package/dist/lib/components/PageProgress.d.ts +1 -0
  46. package/dist/lib/components/PageProgress.js +20 -0
  47. package/dist/lib/components/PageProgress.js.map +1 -0
  48. package/dist/lib/components/TopNavigation.d.ts +2 -3
  49. package/dist/lib/components/TopNavigation.js +45 -44
  50. package/dist/lib/components/TopNavigation.js.map +1 -1
  51. package/dist/lib/components/context/ZudokuContext.d.ts +3 -7
  52. package/dist/lib/components/context/ZudokuContext.js +44 -26
  53. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  54. package/dist/lib/components/navigation/Navigation.d.ts +5 -0
  55. package/dist/lib/components/navigation/Navigation.js +12 -0
  56. package/dist/lib/components/navigation/Navigation.js.map +1 -0
  57. package/dist/lib/components/navigation/{SidebarBadge.d.ts → NavigationBadge.d.ts} +1 -1
  58. package/dist/lib/components/navigation/{SidebarBadge.js → NavigationBadge.js} +2 -2
  59. package/dist/lib/components/navigation/NavigationBadge.js.map +1 -0
  60. package/dist/lib/components/navigation/NavigationCategory.d.ts +5 -0
  61. package/dist/lib/components/navigation/{SidebarCategory.js → NavigationCategory.js} +14 -12
  62. package/dist/lib/components/navigation/NavigationCategory.js.map +1 -0
  63. package/dist/lib/components/navigation/NavigationItem.d.ts +6 -0
  64. package/dist/lib/components/navigation/NavigationItem.js +47 -0
  65. package/dist/lib/components/navigation/NavigationItem.js.map +1 -0
  66. package/dist/lib/components/navigation/{SidebarWrapper.d.ts → NavigationWrapper.d.ts} +1 -1
  67. package/dist/lib/components/navigation/{SidebarWrapper.js → NavigationWrapper.js} +3 -3
  68. package/dist/lib/components/navigation/NavigationWrapper.js.map +1 -0
  69. package/dist/lib/components/navigation/utils.d.ts +7 -9
  70. package/dist/lib/components/navigation/utils.js +17 -17
  71. package/dist/lib/components/navigation/utils.js.map +1 -1
  72. package/dist/lib/core/ZudokuContext.d.ts +6 -8
  73. package/dist/lib/core/ZudokuContext.js +5 -7
  74. package/dist/lib/core/ZudokuContext.js.map +1 -1
  75. package/dist/lib/core/plugins.d.ts +2 -2
  76. package/dist/lib/hooks/useEvent.test.js +5 -3
  77. package/dist/lib/hooks/useEvent.test.js.map +1 -1
  78. package/dist/lib/plugins/api-catalog/Catalog.d.ts +1 -1
  79. package/dist/lib/plugins/api-catalog/index.d.ts +6 -6
  80. package/dist/lib/plugins/api-catalog/index.js +10 -10
  81. package/dist/lib/plugins/api-catalog/index.js.map +1 -1
  82. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +4 -4
  83. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  84. package/dist/lib/plugins/custom-pages/index.d.ts +3 -2
  85. package/dist/lib/plugins/custom-pages/index.js +15 -8
  86. package/dist/lib/plugins/custom-pages/index.js.map +1 -1
  87. package/dist/lib/plugins/markdown/MdxPage.js +6 -3
  88. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  89. package/dist/lib/plugins/markdown/index.d.ts +2 -1
  90. package/dist/lib/plugins/markdown/index.js +9 -26
  91. package/dist/lib/plugins/markdown/index.js.map +1 -1
  92. package/dist/lib/plugins/openapi/OperationList.js +1 -1
  93. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  94. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  95. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  96. package/dist/lib/plugins/openapi/SchemaList.js +1 -1
  97. package/dist/lib/plugins/openapi/SchemaList.js.map +1 -1
  98. package/dist/lib/plugins/openapi/graphql/gql.d.ts +1 -1
  99. package/dist/lib/plugins/openapi/graphql/gql.js +1 -1
  100. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  101. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +3 -3
  102. package/dist/lib/plugins/openapi/graphql/graphql.js +2 -2
  103. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  104. package/dist/lib/plugins/openapi/index.d.ts +3 -3
  105. package/dist/lib/plugins/openapi/index.js +9 -9
  106. package/dist/lib/plugins/openapi/index.js.map +1 -1
  107. package/dist/lib/plugins/openapi/interfaces.d.ts +3 -3
  108. package/dist/lib/plugins/openapi/util/createNavigationCategory.d.ts +9 -0
  109. package/dist/lib/plugins/openapi/util/{createSidebarCategory.js → createNavigationCategory.js} +5 -4
  110. package/dist/lib/plugins/openapi/util/createNavigationCategory.js.map +1 -0
  111. package/dist/lib/plugins/openapi/util/getRoutes.js +2 -2
  112. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  113. package/dist/lib/plugins/openapi/util/methodColorMap.d.ts +1 -1
  114. package/dist/lib/util/useScrollToAnchor.js +3 -3
  115. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  116. package/dist/vite/api/SchemaManager.d.ts +4 -4
  117. package/dist/vite/api/SchemaManager.js +19 -19
  118. package/dist/vite/api/SchemaManager.js.map +1 -1
  119. package/dist/vite/api/SchemaManager.test.js +4 -4
  120. package/dist/vite/api/SchemaManager.test.js.map +1 -1
  121. package/dist/vite/config.js +1 -0
  122. package/dist/vite/config.js.map +1 -1
  123. package/dist/vite/plugin-api.js +8 -8
  124. package/dist/vite/plugin-api.js.map +1 -1
  125. package/dist/vite/plugin-config-reload.js +2 -0
  126. package/dist/vite/plugin-config-reload.js.map +1 -1
  127. package/dist/vite/plugin-custom-pages.js +2 -2
  128. package/dist/vite/plugin-custom-pages.js.map +1 -1
  129. package/dist/vite/plugin-docs.js +61 -59
  130. package/dist/vite/plugin-docs.js.map +1 -1
  131. package/dist/vite/{plugin-sidebar.d.ts → plugin-navigation.d.ts} +1 -1
  132. package/dist/vite/{plugin-sidebar.js → plugin-navigation.js} +20 -19
  133. package/dist/vite/plugin-navigation.js.map +1 -0
  134. package/dist/vite/plugin.js +2 -2
  135. package/dist/vite/plugin.js.map +1 -1
  136. package/dist/vite/shadcn-registry.d.ts +4 -4
  137. package/lib/{Markdown-C5j8kKSX.js → Markdown-DCAIYXF5.js} +480 -475
  138. package/lib/Markdown-DCAIYXF5.js.map +1 -0
  139. package/lib/{MdxPage-CKTMf1cR.js → MdxPage-Cf9YXWoC.js} +30 -30
  140. package/lib/MdxPage-Cf9YXWoC.js.map +1 -0
  141. package/lib/OasProvider-JMVTfG6_.js +35 -0
  142. package/lib/OasProvider-JMVTfG6_.js.map +1 -0
  143. package/lib/{OperationList-BJAKaG5p.js → OperationList-m4tFCI4S.js} +8 -8
  144. package/lib/{OperationList-BJAKaG5p.js.map → OperationList-m4tFCI4S.js.map} +1 -1
  145. package/lib/{RouteGuard-B7GVW4oL.js → RouteGuard-gV7nvzi7.js} +2 -2
  146. package/lib/{RouteGuard-B7GVW4oL.js.map → RouteGuard-gV7nvzi7.js.map} +1 -1
  147. package/lib/{SchemaList-Dgc0A8x5.js → SchemaList-_wRy4aQ0.js} +20 -20
  148. package/lib/SchemaList-_wRy4aQ0.js.map +1 -0
  149. package/lib/{SchemaView-DVx-jFN4.js → SchemaView-CRl_cQYH.js} +3 -3
  150. package/lib/{SchemaView-DVx-jFN4.js.map → SchemaView-CRl_cQYH.js.map} +1 -1
  151. package/lib/{SignUp-CRIKdWt9.js → SignUp-B6w5AwHM.js} +2 -2
  152. package/lib/{SignUp-CRIKdWt9.js.map → SignUp-B6w5AwHM.js.map} +1 -1
  153. package/lib/{Slot-ITby_hMb.js → Slot-BkYrj_uC.js} +4 -4
  154. package/lib/{Slot-ITby_hMb.js.map → Slot-BkYrj_uC.js.map} +1 -1
  155. package/lib/{SyntaxHighlight-CqKHkyEy.js → SyntaxHighlight-CH9OUJre.js} +2 -2
  156. package/lib/{SyntaxHighlight-CqKHkyEy.js.map → SyntaxHighlight-CH9OUJre.js.map} +1 -1
  157. package/lib/{Toc-Csq3UNtW.js → Toc-DRxqEsFc.js} +2 -2
  158. package/lib/{Toc-Csq3UNtW.js.map → Toc-DRxqEsFc.js.map} +1 -1
  159. package/lib/{circular-BP4OrHFK.js → circular-wJaV4vh_.js} +2 -2
  160. package/lib/{circular-BP4OrHFK.js.map → circular-wJaV4vh_.js.map} +1 -1
  161. package/lib/{createServer-zu4cDiPe.js → createServer-DN5AJLcN.js} +3 -3
  162. package/lib/{createServer-zu4cDiPe.js.map → createServer-DN5AJLcN.js.map} +1 -1
  163. package/lib/{errors-CPPSp5F4.js → errors-D_5vKvUq.js} +3 -3
  164. package/lib/{errors-CPPSp5F4.js.map → errors-D_5vKvUq.js.map} +1 -1
  165. package/lib/hook-CHXroBFt.js +1503 -0
  166. package/lib/hook-CHXroBFt.js.map +1 -0
  167. package/lib/{index-jWXxqkni.js → index-DJVaRmzI.js} +63 -62
  168. package/lib/index-DJVaRmzI.js.map +1 -0
  169. package/lib/{mutation-C1XCQTQL.js → mutation-BpcyTgWI.js} +2 -2
  170. package/lib/{mutation-C1XCQTQL.js.map → mutation-BpcyTgWI.js.map} +1 -1
  171. package/lib/ui/SyntaxHighlight.js +2 -2
  172. package/lib/{useMutation-BKvPttRn.js → useMutation-N4ockVKi.js} +3 -3
  173. package/lib/{useMutation-BKvPttRn.js.map → useMutation-N4ockVKi.js.map} +1 -1
  174. package/lib/zudoku.auth-auth0.js +1 -1
  175. package/lib/zudoku.auth-azureb2c.js +2 -2
  176. package/lib/zudoku.auth-clerk.js +2 -2
  177. package/lib/zudoku.auth-openid.js +2 -2
  178. package/lib/zudoku.components.js +2756 -3424
  179. package/lib/zudoku.components.js.map +1 -1
  180. package/lib/zudoku.hooks.js +2 -2
  181. package/lib/zudoku.plugin-api-catalog.js +44 -44
  182. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  183. package/lib/zudoku.plugin-api-keys.js +42 -39
  184. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  185. package/lib/zudoku.plugin-custom-pages.js +22 -16
  186. package/lib/zudoku.plugin-custom-pages.js.map +1 -1
  187. package/lib/zudoku.plugin-markdown.js +20 -69
  188. package/lib/zudoku.plugin-markdown.js.map +1 -1
  189. package/lib/zudoku.plugin-openapi.js +5 -5
  190. package/lib/zudoku.plugin-search-pagefind.js +2 -2
  191. package/lib/zudoku.plugins.js.map +1 -1
  192. package/package.json +12 -9
  193. package/src/app/ZuploBuildConfig.ts +1 -1
  194. package/src/app/demo.tsx +4 -3
  195. package/src/app/main.css +5 -0
  196. package/src/app/main.tsx +6 -5
  197. package/src/app/standalone.tsx +4 -3
  198. package/src/lib/components/BuildCheck.tsx +1 -1
  199. package/src/lib/components/Header.tsx +5 -3
  200. package/src/lib/components/Heading.tsx +7 -3
  201. package/src/lib/components/Main.tsx +8 -8
  202. package/src/lib/components/MobileTopNavigation.tsx +12 -11
  203. package/src/lib/components/PageProgress.tsx +28 -0
  204. package/src/lib/components/TopNavigation.tsx +57 -66
  205. package/src/lib/components/context/ZudokuContext.ts +50 -32
  206. package/src/lib/components/navigation/{Sidebar.tsx → Navigation.tsx} +18 -16
  207. package/src/lib/components/navigation/{SidebarBadge.tsx → NavigationBadge.tsx} +1 -1
  208. package/src/lib/components/navigation/{SidebarCategory.tsx → NavigationCategory.tsx} +16 -14
  209. package/src/lib/components/navigation/{SidebarItem.tsx → NavigationItem.tsx} +23 -17
  210. package/src/lib/components/navigation/{SidebarWrapper.tsx → NavigationWrapper.tsx} +2 -2
  211. package/src/lib/components/navigation/utils.ts +27 -28
  212. package/src/lib/core/ZudokuContext.ts +9 -15
  213. package/src/lib/core/plugins.ts +2 -2
  214. package/src/lib/hooks/useEvent.test.tsx +7 -5
  215. package/src/lib/plugins/api-catalog/Catalog.tsx +1 -1
  216. package/src/lib/plugins/api-catalog/index.tsx +19 -19
  217. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +6 -5
  218. package/src/lib/plugins/custom-pages/index.tsx +20 -11
  219. package/src/lib/plugins/markdown/MdxPage.tsx +6 -3
  220. package/src/lib/plugins/markdown/index.tsx +19 -40
  221. package/src/lib/plugins/openapi/OperationList.tsx +1 -1
  222. package/src/lib/plugins/openapi/OperationListItem.tsx +1 -1
  223. package/src/lib/plugins/openapi/SchemaList.tsx +2 -2
  224. package/src/lib/plugins/openapi/graphql/gql.ts +5 -5
  225. package/src/lib/plugins/openapi/graphql/graphql.ts +6 -6
  226. package/src/lib/plugins/openapi/index.tsx +11 -11
  227. package/src/lib/plugins/openapi/interfaces.ts +3 -3
  228. package/src/lib/plugins/openapi/util/{createSidebarCategory.tsx → createNavigationCategory.tsx} +6 -5
  229. package/src/lib/plugins/openapi/util/getRoutes.tsx +2 -2
  230. package/src/lib/plugins/openapi/util/methodColorMap.tsx +1 -1
  231. package/src/lib/util/useScrollToAnchor.ts +3 -3
  232. package/dist/config/validators/InputSidebarSchema.d.ts +0 -220
  233. package/dist/config/validators/InputSidebarSchema.js +0 -63
  234. package/dist/config/validators/InputSidebarSchema.js.map +0 -1
  235. package/dist/config/validators/SidebarSchema.d.ts +0 -46
  236. package/dist/config/validators/SidebarSchema.js +0 -118
  237. package/dist/config/validators/SidebarSchema.js.map +0 -1
  238. package/dist/lib/components/navigation/Sidebar.d.ts +0 -5
  239. package/dist/lib/components/navigation/Sidebar.js +0 -10
  240. package/dist/lib/components/navigation/Sidebar.js.map +0 -1
  241. package/dist/lib/components/navigation/SidebarBadge.js.map +0 -1
  242. package/dist/lib/components/navigation/SidebarCategory.d.ts +0 -5
  243. package/dist/lib/components/navigation/SidebarCategory.js.map +0 -1
  244. package/dist/lib/components/navigation/SidebarItem.d.ts +0 -6
  245. package/dist/lib/components/navigation/SidebarItem.js +0 -44
  246. package/dist/lib/components/navigation/SidebarItem.js.map +0 -1
  247. package/dist/lib/components/navigation/SidebarWrapper.js.map +0 -1
  248. package/dist/lib/plugins/markdown/resolver.d.ts +0 -32
  249. package/dist/lib/plugins/markdown/resolver.js +0 -46
  250. package/dist/lib/plugins/markdown/resolver.js.map +0 -1
  251. package/dist/lib/plugins/openapi/util/createSidebarCategory.d.ts +0 -9
  252. package/dist/lib/plugins/openapi/util/createSidebarCategory.js.map +0 -1
  253. package/dist/vite/plugin-sidebar.js.map +0 -1
  254. package/lib/Markdown-C5j8kKSX.js.map +0 -1
  255. package/lib/MdxPage-CKTMf1cR.js.map +0 -1
  256. package/lib/OasProvider-_GzmsbMg.js +0 -33
  257. package/lib/OasProvider-_GzmsbMg.js.map +0 -1
  258. package/lib/SchemaList-Dgc0A8x5.js.map +0 -1
  259. package/lib/hook-7wZANGJP.js +0 -1483
  260. package/lib/hook-7wZANGJP.js.map +0 -1
  261. package/lib/index-jWXxqkni.js.map +0 -1
  262. package/lib/joinPath-B7kNnUX4.js +0 -8
  263. package/lib/joinPath-B7kNnUX4.js.map +0 -1
  264. package/src/lib/plugins/markdown/resolver.ts +0 -59
@@ -0,0 +1,1503 @@
1
+ import * as S from "react";
2
+ import tt, { createContext as Rt, useContext as Et } from "react";
3
+ import { j as Ct } from "./jsx-runtime-C5mzlN2N.js";
4
+ import { u as x, m as j } from "./chunk-DQRVZFIR-BblmKnHy.js";
5
+ import { c as Ft } from "./index-DI5SPFK9.js";
6
+ var $ = class {
7
+ constructor() {
8
+ this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
9
+ }
10
+ subscribe(t) {
11
+ return this.listeners.add(t), this.onSubscribe(), () => {
12
+ this.listeners.delete(t), this.onUnsubscribe();
13
+ };
14
+ }
15
+ hasListeners() {
16
+ return this.listeners.size > 0;
17
+ }
18
+ onSubscribe() {
19
+ }
20
+ onUnsubscribe() {
21
+ }
22
+ }, C = typeof window > "u" || "Deno" in globalThis;
23
+ function Q() {
24
+ }
25
+ function be(t, e) {
26
+ return typeof t == "function" ? t(e) : t;
27
+ }
28
+ function N(t) {
29
+ return typeof t == "number" && t >= 0 && t !== 1 / 0;
30
+ }
31
+ function ut(t, e) {
32
+ return Math.max(t + (e || 0) - Date.now(), 0);
33
+ }
34
+ function A(t, e) {
35
+ return typeof t == "function" ? t(e) : t;
36
+ }
37
+ function w(t, e) {
38
+ return typeof t == "function" ? t(e) : t;
39
+ }
40
+ function Se(t, e) {
41
+ const {
42
+ type: s = "all",
43
+ exact: r,
44
+ fetchStatus: n,
45
+ predicate: i,
46
+ queryKey: o,
47
+ stale: a
48
+ } = t;
49
+ if (o) {
50
+ if (r) {
51
+ if (e.queryHash !== It(o, e.options))
52
+ return !1;
53
+ } else if (!V(e.queryKey, o))
54
+ return !1;
55
+ }
56
+ if (s !== "all") {
57
+ const u = e.isActive();
58
+ if (s === "active" && !u || s === "inactive" && u)
59
+ return !1;
60
+ }
61
+ return !(typeof a == "boolean" && e.isStale() !== a || n && n !== e.state.fetchStatus || i && !i(e));
62
+ }
63
+ function we(t, e) {
64
+ const { exact: s, status: r, predicate: n, mutationKey: i } = t;
65
+ if (i) {
66
+ if (!e.options.mutationKey)
67
+ return !1;
68
+ if (s) {
69
+ if (L(e.options.mutationKey) !== L(i))
70
+ return !1;
71
+ } else if (!V(e.options.mutationKey, i))
72
+ return !1;
73
+ }
74
+ return !(r && e.state.status !== r || n && !n(e));
75
+ }
76
+ function It(t, e) {
77
+ return (e?.queryKeyHashFn || L)(t);
78
+ }
79
+ function L(t) {
80
+ return JSON.stringify(
81
+ t,
82
+ (e, s) => H(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
83
+ );
84
+ }
85
+ function V(t, e) {
86
+ return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? Object.keys(e).every((s) => V(t[s], e[s])) : !1;
87
+ }
88
+ function M(t, e) {
89
+ if (t === e)
90
+ return t;
91
+ const s = et(t) && et(e);
92
+ if (s || H(t) && H(e)) {
93
+ const r = s ? t : Object.keys(t), n = r.length, i = s ? e : Object.keys(e), o = i.length, a = s ? [] : {};
94
+ let u = 0;
95
+ for (let f = 0; f < o; f++) {
96
+ const c = s ? f : i[f];
97
+ (!s && r.includes(c) || s) && t[c] === void 0 && e[c] === void 0 ? (a[c] = void 0, u++) : (a[c] = M(t[c], e[c]), a[c] === t[c] && t[c] !== void 0 && u++);
98
+ }
99
+ return n === o && u === n ? t : a;
100
+ }
101
+ return e;
102
+ }
103
+ function _(t, e) {
104
+ if (!e || Object.keys(t).length !== Object.keys(e).length)
105
+ return !1;
106
+ for (const s in t)
107
+ if (t[s] !== e[s])
108
+ return !1;
109
+ return !0;
110
+ }
111
+ function et(t) {
112
+ return Array.isArray(t) && t.length === Object.keys(t).length;
113
+ }
114
+ function H(t) {
115
+ if (!st(t))
116
+ return !1;
117
+ const e = t.constructor;
118
+ if (e === void 0)
119
+ return !0;
120
+ const s = e.prototype;
121
+ return !(!st(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
122
+ }
123
+ function st(t) {
124
+ return Object.prototype.toString.call(t) === "[object Object]";
125
+ }
126
+ function Pt(t) {
127
+ return new Promise((e) => {
128
+ setTimeout(e, t);
129
+ });
130
+ }
131
+ function K(t, e, s) {
132
+ if (typeof s.structuralSharing == "function")
133
+ return s.structuralSharing(t, e);
134
+ if (s.structuralSharing !== !1) {
135
+ if (process.env.NODE_ENV !== "production")
136
+ try {
137
+ return M(t, e);
138
+ } catch (r) {
139
+ throw console.error(
140
+ `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${r}`
141
+ ), r;
142
+ }
143
+ return M(t, e);
144
+ }
145
+ return e;
146
+ }
147
+ function Oe(t) {
148
+ return t;
149
+ }
150
+ function Re(t, e, s = 0) {
151
+ const r = [...t, e];
152
+ return s && r.length > s ? r.slice(1) : r;
153
+ }
154
+ function Ee(t, e, s = 0) {
155
+ const r = [e, ...t];
156
+ return s && r.length > s ? r.slice(0, -1) : r;
157
+ }
158
+ var k = Symbol();
159
+ function Tt(t, e) {
160
+ return process.env.NODE_ENV !== "production" && t.queryFn === k && console.error(
161
+ `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`
162
+ ), !t.queryFn && e?.initialPromise ? () => e.initialPromise : !t.queryFn || t.queryFn === k ? () => Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)) : t.queryFn;
163
+ }
164
+ var Dt = class extends $ {
165
+ #e;
166
+ #t;
167
+ #s;
168
+ constructor() {
169
+ super(), this.#s = (t) => {
170
+ if (!C && window.addEventListener) {
171
+ const e = () => t();
172
+ return window.addEventListener("visibilitychange", e, !1), () => {
173
+ window.removeEventListener("visibilitychange", e);
174
+ };
175
+ }
176
+ };
177
+ }
178
+ onSubscribe() {
179
+ this.#t || this.setEventListener(this.#s);
180
+ }
181
+ onUnsubscribe() {
182
+ this.hasListeners() || (this.#t?.(), this.#t = void 0);
183
+ }
184
+ setEventListener(t) {
185
+ this.#s = t, this.#t?.(), this.#t = t((e) => {
186
+ typeof e == "boolean" ? this.setFocused(e) : this.onFocus();
187
+ });
188
+ }
189
+ setFocused(t) {
190
+ this.#e !== t && (this.#e = t, this.onFocus());
191
+ }
192
+ onFocus() {
193
+ const t = this.isFocused();
194
+ this.listeners.forEach((e) => {
195
+ e(t);
196
+ });
197
+ }
198
+ isFocused() {
199
+ return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
200
+ }
201
+ }, ct = new Dt(), At = class extends $ {
202
+ #e = !0;
203
+ #t;
204
+ #s;
205
+ constructor() {
206
+ super(), this.#s = (t) => {
207
+ if (!C && window.addEventListener) {
208
+ const e = () => t(!0), s = () => t(!1);
209
+ return window.addEventListener("online", e, !1), window.addEventListener("offline", s, !1), () => {
210
+ window.removeEventListener("online", e), window.removeEventListener("offline", s);
211
+ };
212
+ }
213
+ };
214
+ }
215
+ onSubscribe() {
216
+ this.#t || this.setEventListener(this.#s);
217
+ }
218
+ onUnsubscribe() {
219
+ this.hasListeners() || (this.#t?.(), this.#t = void 0);
220
+ }
221
+ setEventListener(t) {
222
+ this.#s = t, this.#t?.(), this.#t = t(this.setOnline.bind(this));
223
+ }
224
+ setOnline(t) {
225
+ this.#e !== t && (this.#e = t, this.listeners.forEach((s) => {
226
+ s(t);
227
+ }));
228
+ }
229
+ isOnline() {
230
+ return this.#e;
231
+ }
232
+ }, ht = new At();
233
+ function B() {
234
+ let t, e;
235
+ const s = new Promise((n, i) => {
236
+ t = n, e = i;
237
+ });
238
+ s.status = "pending", s.catch(() => {
239
+ });
240
+ function r(n) {
241
+ Object.assign(s, n), delete s.resolve, delete s.reject;
242
+ }
243
+ return s.resolve = (n) => {
244
+ r({
245
+ status: "fulfilled",
246
+ value: n
247
+ }), t(n);
248
+ }, s.reject = (n) => {
249
+ r({
250
+ status: "rejected",
251
+ reason: n
252
+ }), e(n);
253
+ }, s;
254
+ }
255
+ function kt(t) {
256
+ return Math.min(1e3 * 2 ** t, 3e4);
257
+ }
258
+ function lt(t) {
259
+ return (t ?? "online") === "online" ? ht.isOnline() : !0;
260
+ }
261
+ var ft = class extends Error {
262
+ constructor(t) {
263
+ super("CancelledError"), this.revert = t?.revert, this.silent = t?.silent;
264
+ }
265
+ };
266
+ function q(t) {
267
+ return t instanceof ft;
268
+ }
269
+ function xt(t) {
270
+ let e = !1, s = 0, r = !1, n;
271
+ const i = B(), o = (h) => {
272
+ r || (l(new ft(h)), t.abort?.());
273
+ }, a = () => {
274
+ e = !0;
275
+ }, u = () => {
276
+ e = !1;
277
+ }, f = () => ct.isFocused() && (t.networkMode === "always" || ht.isOnline()) && t.canRun(), c = () => lt(t.networkMode) && t.canRun(), d = (h) => {
278
+ r || (r = !0, t.onSuccess?.(h), n?.(), i.resolve(h));
279
+ }, l = (h) => {
280
+ r || (r = !0, t.onError?.(h), n?.(), i.reject(h));
281
+ }, g = () => new Promise((h) => {
282
+ n = (m) => {
283
+ (r || f()) && h(m);
284
+ }, t.onPause?.();
285
+ }).then(() => {
286
+ n = void 0, r || t.onContinue?.();
287
+ }), R = () => {
288
+ if (r)
289
+ return;
290
+ let h;
291
+ const m = s === 0 ? t.initialPromise : void 0;
292
+ try {
293
+ h = m ?? t.fn();
294
+ } catch (v) {
295
+ h = Promise.reject(v);
296
+ }
297
+ Promise.resolve(h).then(d).catch((v) => {
298
+ if (r)
299
+ return;
300
+ const p = t.retry ?? (C ? 0 : 3), y = t.retryDelay ?? kt, E = typeof y == "function" ? y(s, v) : y, I = p === !0 || typeof p == "number" && s < p || typeof p == "function" && p(s, v);
301
+ if (e || !I) {
302
+ l(v);
303
+ return;
304
+ }
305
+ s++, t.onFail?.(s, v), Pt(E).then(() => f() ? void 0 : g()).then(() => {
306
+ e ? l(v) : R();
307
+ });
308
+ });
309
+ };
310
+ return {
311
+ promise: i,
312
+ cancel: o,
313
+ continue: () => (n?.(), i),
314
+ cancelRetry: a,
315
+ continueRetry: u,
316
+ canStart: c,
317
+ start: () => (c() ? R() : g().then(R), i)
318
+ };
319
+ }
320
+ var jt = (t) => setTimeout(t, 0);
321
+ function qt() {
322
+ let t = [], e = 0, s = (a) => {
323
+ a();
324
+ }, r = (a) => {
325
+ a();
326
+ }, n = jt;
327
+ const i = (a) => {
328
+ e ? t.push(a) : n(() => {
329
+ s(a);
330
+ });
331
+ }, o = () => {
332
+ const a = t;
333
+ t = [], a.length && n(() => {
334
+ r(() => {
335
+ a.forEach((u) => {
336
+ s(u);
337
+ });
338
+ });
339
+ });
340
+ };
341
+ return {
342
+ batch: (a) => {
343
+ let u;
344
+ e++;
345
+ try {
346
+ u = a();
347
+ } finally {
348
+ e--, e || o();
349
+ }
350
+ return u;
351
+ },
352
+ /**
353
+ * All calls to the wrapped function will be batched.
354
+ */
355
+ batchCalls: (a) => (...u) => {
356
+ i(() => {
357
+ a(...u);
358
+ });
359
+ },
360
+ schedule: i,
361
+ /**
362
+ * Use this method to set a custom notify function.
363
+ * This can be used to for example wrap notifications with `React.act` while running tests.
364
+ */
365
+ setNotifyFunction: (a) => {
366
+ s = a;
367
+ },
368
+ /**
369
+ * Use this method to set a custom function to batch notifications together into a single tick.
370
+ * By default React Query will use the batch function provided by ReactDOM or React Native.
371
+ */
372
+ setBatchNotifyFunction: (a) => {
373
+ r = a;
374
+ },
375
+ setScheduler: (a) => {
376
+ n = a;
377
+ }
378
+ };
379
+ }
380
+ var J = qt(), Ut = class {
381
+ #e;
382
+ destroy() {
383
+ this.clearGcTimeout();
384
+ }
385
+ scheduleGc() {
386
+ this.clearGcTimeout(), N(this.gcTime) && (this.#e = setTimeout(() => {
387
+ this.optionalRemove();
388
+ }, this.gcTime));
389
+ }
390
+ updateGcTime(t) {
391
+ this.gcTime = Math.max(
392
+ this.gcTime || 0,
393
+ t ?? (C ? 1 / 0 : 5 * 60 * 1e3)
394
+ );
395
+ }
396
+ clearGcTimeout() {
397
+ this.#e && (clearTimeout(this.#e), this.#e = void 0);
398
+ }
399
+ }, Ce = class extends Ut {
400
+ #e;
401
+ #t;
402
+ #s;
403
+ #n;
404
+ #r;
405
+ #o;
406
+ #a;
407
+ constructor(t) {
408
+ super(), this.#a = !1, this.#o = t.defaultOptions, this.setOptions(t.options), this.observers = [], this.#n = t.client, this.#s = this.#n.getQueryCache(), this.queryKey = t.queryKey, this.queryHash = t.queryHash, this.#e = Qt(this.options), this.state = t.state ?? this.#e, this.scheduleGc();
409
+ }
410
+ get meta() {
411
+ return this.options.meta;
412
+ }
413
+ get promise() {
414
+ return this.#r?.promise;
415
+ }
416
+ setOptions(t) {
417
+ this.options = { ...this.#o, ...t }, this.updateGcTime(this.options.gcTime);
418
+ }
419
+ optionalRemove() {
420
+ !this.observers.length && this.state.fetchStatus === "idle" && this.#s.remove(this);
421
+ }
422
+ setData(t, e) {
423
+ const s = K(this.state.data, t, this.options);
424
+ return this.#i({
425
+ data: s,
426
+ type: "success",
427
+ dataUpdatedAt: e?.updatedAt,
428
+ manual: e?.manual
429
+ }), s;
430
+ }
431
+ setState(t, e) {
432
+ this.#i({ type: "setState", state: t, setStateOptions: e });
433
+ }
434
+ cancel(t) {
435
+ const e = this.#r?.promise;
436
+ return this.#r?.cancel(t), e ? e.then(Q).catch(Q) : Promise.resolve();
437
+ }
438
+ destroy() {
439
+ super.destroy(), this.cancel({ silent: !0 });
440
+ }
441
+ reset() {
442
+ this.destroy(), this.setState(this.#e);
443
+ }
444
+ isActive() {
445
+ return this.observers.some(
446
+ (t) => w(t.options.enabled, this) !== !1
447
+ );
448
+ }
449
+ isDisabled() {
450
+ return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === k || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
451
+ }
452
+ isStale() {
453
+ return this.state.isInvalidated ? !0 : this.getObserversCount() > 0 ? this.observers.some(
454
+ (t) => t.getCurrentResult().isStale
455
+ ) : this.state.data === void 0;
456
+ }
457
+ isStaleByTime(t = 0) {
458
+ return this.state.isInvalidated || this.state.data === void 0 || !ut(this.state.dataUpdatedAt, t);
459
+ }
460
+ onFocus() {
461
+ this.observers.find((e) => e.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#r?.continue();
462
+ }
463
+ onOnline() {
464
+ this.observers.find((e) => e.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#r?.continue();
465
+ }
466
+ addObserver(t) {
467
+ this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), this.#s.notify({ type: "observerAdded", query: this, observer: t }));
468
+ }
469
+ removeObserver(t) {
470
+ this.observers.includes(t) && (this.observers = this.observers.filter((e) => e !== t), this.observers.length || (this.#r && (this.#a ? this.#r.cancel({ revert: !0 }) : this.#r.cancelRetry()), this.scheduleGc()), this.#s.notify({ type: "observerRemoved", query: this, observer: t }));
471
+ }
472
+ getObserversCount() {
473
+ return this.observers.length;
474
+ }
475
+ invalidate() {
476
+ this.state.isInvalidated || this.#i({ type: "invalidate" });
477
+ }
478
+ fetch(t, e) {
479
+ if (this.state.fetchStatus !== "idle") {
480
+ if (this.state.data !== void 0 && e?.cancelRefetch)
481
+ this.cancel({ silent: !0 });
482
+ else if (this.#r)
483
+ return this.#r.continueRetry(), this.#r.promise;
484
+ }
485
+ if (t && this.setOptions(t), !this.options.queryFn) {
486
+ const a = this.observers.find((u) => u.options.queryFn);
487
+ a && this.setOptions(a.options);
488
+ }
489
+ process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
490
+ "As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"
491
+ ));
492
+ const s = new AbortController(), r = (a) => {
493
+ Object.defineProperty(a, "signal", {
494
+ enumerable: !0,
495
+ get: () => (this.#a = !0, s.signal)
496
+ });
497
+ }, n = () => {
498
+ const a = Tt(this.options, e), u = {
499
+ client: this.#n,
500
+ queryKey: this.queryKey,
501
+ meta: this.meta
502
+ };
503
+ return r(u), this.#a = !1, this.options.persister ? this.options.persister(
504
+ a,
505
+ u,
506
+ this
507
+ ) : a(u);
508
+ }, i = {
509
+ fetchOptions: e,
510
+ options: this.options,
511
+ queryKey: this.queryKey,
512
+ client: this.#n,
513
+ state: this.state,
514
+ fetchFn: n
515
+ };
516
+ r(i), this.options.behavior?.onFetch(
517
+ i,
518
+ this
519
+ ), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== i.fetchOptions?.meta) && this.#i({ type: "fetch", meta: i.fetchOptions?.meta });
520
+ const o = (a) => {
521
+ q(a) && a.silent || this.#i({
522
+ type: "error",
523
+ error: a
524
+ }), q(a) || (this.#s.config.onError?.(
525
+ a,
526
+ this
527
+ ), this.#s.config.onSettled?.(
528
+ this.state.data,
529
+ a,
530
+ this
531
+ )), this.scheduleGc();
532
+ };
533
+ return this.#r = xt({
534
+ initialPromise: e?.initialPromise,
535
+ fn: i.fetchFn,
536
+ abort: s.abort.bind(s),
537
+ onSuccess: (a) => {
538
+ if (a === void 0) {
539
+ process.env.NODE_ENV !== "production" && console.error(
540
+ `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
541
+ ), o(new Error(`${this.queryHash} data is undefined`));
542
+ return;
543
+ }
544
+ try {
545
+ this.setData(a);
546
+ } catch (u) {
547
+ o(u);
548
+ return;
549
+ }
550
+ this.#s.config.onSuccess?.(a, this), this.#s.config.onSettled?.(
551
+ a,
552
+ this.state.error,
553
+ this
554
+ ), this.scheduleGc();
555
+ },
556
+ onError: o,
557
+ onFail: (a, u) => {
558
+ this.#i({ type: "failed", failureCount: a, error: u });
559
+ },
560
+ onPause: () => {
561
+ this.#i({ type: "pause" });
562
+ },
563
+ onContinue: () => {
564
+ this.#i({ type: "continue" });
565
+ },
566
+ retry: i.options.retry,
567
+ retryDelay: i.options.retryDelay,
568
+ networkMode: i.options.networkMode,
569
+ canRun: () => !0
570
+ }), this.#r.start();
571
+ }
572
+ #i(t) {
573
+ const e = (s) => {
574
+ switch (t.type) {
575
+ case "failed":
576
+ return {
577
+ ...s,
578
+ fetchFailureCount: t.failureCount,
579
+ fetchFailureReason: t.error
580
+ };
581
+ case "pause":
582
+ return {
583
+ ...s,
584
+ fetchStatus: "paused"
585
+ };
586
+ case "continue":
587
+ return {
588
+ ...s,
589
+ fetchStatus: "fetching"
590
+ };
591
+ case "fetch":
592
+ return {
593
+ ...s,
594
+ ...dt(s.data, this.options),
595
+ fetchMeta: t.meta ?? null
596
+ };
597
+ case "success":
598
+ return {
599
+ ...s,
600
+ data: t.data,
601
+ dataUpdateCount: s.dataUpdateCount + 1,
602
+ dataUpdatedAt: t.dataUpdatedAt ?? Date.now(),
603
+ error: null,
604
+ isInvalidated: !1,
605
+ status: "success",
606
+ ...!t.manual && {
607
+ fetchStatus: "idle",
608
+ fetchFailureCount: 0,
609
+ fetchFailureReason: null
610
+ }
611
+ };
612
+ case "error":
613
+ const r = t.error;
614
+ return q(r) && r.revert && this.#t ? { ...this.#t, fetchStatus: "idle" } : {
615
+ ...s,
616
+ error: r,
617
+ errorUpdateCount: s.errorUpdateCount + 1,
618
+ errorUpdatedAt: Date.now(),
619
+ fetchFailureCount: s.fetchFailureCount + 1,
620
+ fetchFailureReason: r,
621
+ fetchStatus: "idle",
622
+ status: "error"
623
+ };
624
+ case "invalidate":
625
+ return {
626
+ ...s,
627
+ isInvalidated: !0
628
+ };
629
+ case "setState":
630
+ return {
631
+ ...s,
632
+ ...t.state
633
+ };
634
+ }
635
+ };
636
+ this.state = e(this.state), J.batch(() => {
637
+ this.observers.forEach((s) => {
638
+ s.onQueryUpdate();
639
+ }), this.#s.notify({ query: this, type: "updated", action: t });
640
+ });
641
+ }
642
+ };
643
+ function dt(t, e) {
644
+ return {
645
+ fetchFailureCount: 0,
646
+ fetchFailureReason: null,
647
+ fetchStatus: lt(e.networkMode) ? "fetching" : "paused",
648
+ ...t === void 0 && {
649
+ error: null,
650
+ status: "pending"
651
+ }
652
+ };
653
+ }
654
+ function Qt(t) {
655
+ const e = typeof t.initialData == "function" ? t.initialData() : t.initialData, s = e !== void 0, r = s ? typeof t.initialDataUpdatedAt == "function" ? t.initialDataUpdatedAt() : t.initialDataUpdatedAt : 0;
656
+ return {
657
+ data: e,
658
+ dataUpdateCount: 0,
659
+ dataUpdatedAt: s ? r ?? Date.now() : 0,
660
+ error: null,
661
+ errorUpdateCount: 0,
662
+ errorUpdatedAt: 0,
663
+ fetchFailureCount: 0,
664
+ fetchFailureReason: null,
665
+ fetchMeta: null,
666
+ isInvalidated: !1,
667
+ status: s ? "success" : "pending",
668
+ fetchStatus: "idle"
669
+ };
670
+ }
671
+ var pt = class extends $ {
672
+ constructor(t, e) {
673
+ super(), this.options = e, this.#e = t, this.#i = null, this.#a = B(), this.options.experimental_prefetchInRender || this.#a.reject(
674
+ new Error("experimental_prefetchInRender feature flag is not enabled")
675
+ ), this.bindMethods(), this.setOptions(e);
676
+ }
677
+ #e;
678
+ #t = void 0;
679
+ #s = void 0;
680
+ #n = void 0;
681
+ #r;
682
+ #o;
683
+ #a;
684
+ #i;
685
+ #y;
686
+ #f;
687
+ // This property keeps track of the last query with defined data.
688
+ // It will be used to pass the previous data and query to the placeholder function between renders.
689
+ #d;
690
+ #c;
691
+ #h;
692
+ #u;
693
+ #p = /* @__PURE__ */ new Set();
694
+ bindMethods() {
695
+ this.refetch = this.refetch.bind(this);
696
+ }
697
+ onSubscribe() {
698
+ this.listeners.size === 1 && (this.#t.addObserver(this), rt(this.#t, this.options) ? this.#l() : this.updateResult(), this.#b());
699
+ }
700
+ onUnsubscribe() {
701
+ this.hasListeners() || this.destroy();
702
+ }
703
+ shouldFetchOnReconnect() {
704
+ return G(
705
+ this.#t,
706
+ this.options,
707
+ this.options.refetchOnReconnect
708
+ );
709
+ }
710
+ shouldFetchOnWindowFocus() {
711
+ return G(
712
+ this.#t,
713
+ this.options,
714
+ this.options.refetchOnWindowFocus
715
+ );
716
+ }
717
+ destroy() {
718
+ this.listeners = /* @__PURE__ */ new Set(), this.#S(), this.#w(), this.#t.removeObserver(this);
719
+ }
720
+ setOptions(t) {
721
+ const e = this.options, s = this.#t;
722
+ if (this.options = this.#e.defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof w(this.options.enabled, this.#t) != "boolean")
723
+ throw new Error(
724
+ "Expected enabled to be a boolean or a callback that returns a boolean"
725
+ );
726
+ this.#O(), this.#t.setOptions(this.options), e._defaulted && !_(this.options, e) && this.#e.getQueryCache().notify({
727
+ type: "observerOptionsUpdated",
728
+ query: this.#t,
729
+ observer: this
730
+ });
731
+ const r = this.hasListeners();
732
+ r && nt(
733
+ this.#t,
734
+ s,
735
+ this.options,
736
+ e
737
+ ) && this.#l(), this.updateResult(), r && (this.#t !== s || w(this.options.enabled, this.#t) !== w(e.enabled, this.#t) || A(this.options.staleTime, this.#t) !== A(e.staleTime, this.#t)) && this.#v();
738
+ const n = this.#g();
739
+ r && (this.#t !== s || w(this.options.enabled, this.#t) !== w(e.enabled, this.#t) || n !== this.#u) && this.#m(n);
740
+ }
741
+ getOptimisticResult(t) {
742
+ const e = this.#e.getQueryCache().build(this.#e, t), s = this.createResult(e, t);
743
+ return Lt(this, s) && (this.#n = s, this.#o = this.options, this.#r = this.#t.state), s;
744
+ }
745
+ getCurrentResult() {
746
+ return this.#n;
747
+ }
748
+ trackResult(t, e) {
749
+ const s = {};
750
+ return Object.keys(t).forEach((r) => {
751
+ Object.defineProperty(s, r, {
752
+ configurable: !1,
753
+ enumerable: !0,
754
+ get: () => (this.trackProp(r), e?.(r), t[r])
755
+ });
756
+ }), s;
757
+ }
758
+ trackProp(t) {
759
+ this.#p.add(t);
760
+ }
761
+ getCurrentQuery() {
762
+ return this.#t;
763
+ }
764
+ refetch({ ...t } = {}) {
765
+ return this.fetch({
766
+ ...t
767
+ });
768
+ }
769
+ fetchOptimistic(t) {
770
+ const e = this.#e.defaultQueryOptions(t), s = this.#e.getQueryCache().build(this.#e, e);
771
+ return s.fetch().then(() => this.createResult(s, e));
772
+ }
773
+ fetch(t) {
774
+ return this.#l({
775
+ ...t,
776
+ cancelRefetch: t.cancelRefetch ?? !0
777
+ }).then(() => (this.updateResult(), this.#n));
778
+ }
779
+ #l(t) {
780
+ this.#O();
781
+ let e = this.#t.fetch(
782
+ this.options,
783
+ t
784
+ );
785
+ return t?.throwOnError || (e = e.catch(Q)), e;
786
+ }
787
+ #v() {
788
+ this.#S();
789
+ const t = A(
790
+ this.options.staleTime,
791
+ this.#t
792
+ );
793
+ if (C || this.#n.isStale || !N(t))
794
+ return;
795
+ const s = ut(this.#n.dataUpdatedAt, t) + 1;
796
+ this.#c = setTimeout(() => {
797
+ this.#n.isStale || this.updateResult();
798
+ }, s);
799
+ }
800
+ #g() {
801
+ return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
802
+ }
803
+ #m(t) {
804
+ this.#w(), this.#u = t, !(C || w(this.options.enabled, this.#t) === !1 || !N(this.#u) || this.#u === 0) && (this.#h = setInterval(() => {
805
+ (this.options.refetchIntervalInBackground || ct.isFocused()) && this.#l();
806
+ }, this.#u));
807
+ }
808
+ #b() {
809
+ this.#v(), this.#m(this.#g());
810
+ }
811
+ #S() {
812
+ this.#c && (clearTimeout(this.#c), this.#c = void 0);
813
+ }
814
+ #w() {
815
+ this.#h && (clearInterval(this.#h), this.#h = void 0);
816
+ }
817
+ createResult(t, e) {
818
+ const s = this.#t, r = this.options, n = this.#n, i = this.#r, o = this.#o, u = t !== s ? t.state : this.#s, { state: f } = t;
819
+ let c = { ...f }, d = !1, l;
820
+ if (e._optimisticResults) {
821
+ const b = this.hasListeners(), T = !b && rt(t, e), P = b && nt(t, s, e, r);
822
+ (T || P) && (c = {
823
+ ...c,
824
+ ...dt(f.data, t.options)
825
+ }), e._optimisticResults === "isRestoring" && (c.fetchStatus = "idle");
826
+ }
827
+ let { error: g, errorUpdatedAt: R, status: h } = c;
828
+ l = c.data;
829
+ let m = !1;
830
+ if (e.placeholderData !== void 0 && l === void 0 && h === "pending") {
831
+ let b;
832
+ n?.isPlaceholderData && e.placeholderData === o?.placeholderData ? (b = n.data, m = !0) : b = typeof e.placeholderData == "function" ? e.placeholderData(
833
+ this.#d?.state.data,
834
+ this.#d
835
+ ) : e.placeholderData, b !== void 0 && (h = "success", l = K(
836
+ n?.data,
837
+ b,
838
+ e
839
+ ), d = !0);
840
+ }
841
+ if (e.select && l !== void 0 && !m)
842
+ if (n && l === i?.data && e.select === this.#y)
843
+ l = this.#f;
844
+ else
845
+ try {
846
+ this.#y = e.select, l = e.select(l), l = K(n?.data, l, e), this.#f = l, this.#i = null;
847
+ } catch (b) {
848
+ this.#i = b;
849
+ }
850
+ this.#i && (g = this.#i, l = this.#f, R = Date.now(), h = "error");
851
+ const v = c.fetchStatus === "fetching", p = h === "pending", y = h === "error", E = p && v, I = l !== void 0, O = {
852
+ status: h,
853
+ fetchStatus: c.fetchStatus,
854
+ isPending: p,
855
+ isSuccess: h === "success",
856
+ isError: y,
857
+ isInitialLoading: E,
858
+ isLoading: E,
859
+ data: l,
860
+ dataUpdatedAt: c.dataUpdatedAt,
861
+ error: g,
862
+ errorUpdatedAt: R,
863
+ failureCount: c.fetchFailureCount,
864
+ failureReason: c.fetchFailureReason,
865
+ errorUpdateCount: c.errorUpdateCount,
866
+ isFetched: c.dataUpdateCount > 0 || c.errorUpdateCount > 0,
867
+ isFetchedAfterMount: c.dataUpdateCount > u.dataUpdateCount || c.errorUpdateCount > u.errorUpdateCount,
868
+ isFetching: v,
869
+ isRefetching: v && !p,
870
+ isLoadingError: y && !I,
871
+ isPaused: c.fetchStatus === "paused",
872
+ isPlaceholderData: d,
873
+ isRefetchError: y && I,
874
+ isStale: Z(t, e),
875
+ refetch: this.refetch,
876
+ promise: this.#a
877
+ };
878
+ if (this.options.experimental_prefetchInRender) {
879
+ const b = (D) => {
880
+ O.status === "error" ? D.reject(O.error) : O.data !== void 0 && D.resolve(O.data);
881
+ }, T = () => {
882
+ const D = this.#a = O.promise = B();
883
+ b(D);
884
+ }, P = this.#a;
885
+ switch (P.status) {
886
+ case "pending":
887
+ t.queryHash === s.queryHash && b(P);
888
+ break;
889
+ case "fulfilled":
890
+ (O.status === "error" || O.data !== P.value) && T();
891
+ break;
892
+ case "rejected":
893
+ (O.status !== "error" || O.error !== P.reason) && T();
894
+ break;
895
+ }
896
+ }
897
+ return O;
898
+ }
899
+ updateResult() {
900
+ const t = this.#n, e = this.createResult(this.#t, this.options);
901
+ if (this.#r = this.#t.state, this.#o = this.options, this.#r.data !== void 0 && (this.#d = this.#t), _(e, t))
902
+ return;
903
+ this.#n = e;
904
+ const s = () => {
905
+ if (!t)
906
+ return !0;
907
+ const { notifyOnChangeProps: r } = this.options, n = typeof r == "function" ? r() : r;
908
+ if (n === "all" || !n && !this.#p.size)
909
+ return !0;
910
+ const i = new Set(
911
+ n ?? this.#p
912
+ );
913
+ return this.options.throwOnError && i.add("error"), Object.keys(this.#n).some((o) => {
914
+ const a = o;
915
+ return this.#n[a] !== t[a] && i.has(a);
916
+ });
917
+ };
918
+ this.#R({ listeners: s() });
919
+ }
920
+ #O() {
921
+ const t = this.#e.getQueryCache().build(this.#e, this.options);
922
+ if (t === this.#t)
923
+ return;
924
+ const e = this.#t;
925
+ this.#t = t, this.#s = t.state, this.hasListeners() && (e?.removeObserver(this), t.addObserver(this));
926
+ }
927
+ onQueryUpdate() {
928
+ this.updateResult(), this.hasListeners() && this.#b();
929
+ }
930
+ #R(t) {
931
+ J.batch(() => {
932
+ t.listeners && this.listeners.forEach((e) => {
933
+ e(this.#n);
934
+ }), this.#e.getQueryCache().notify({
935
+ query: this.#t,
936
+ type: "observerResultsUpdated"
937
+ });
938
+ });
939
+ }
940
+ };
941
+ function Nt(t, e) {
942
+ return w(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
943
+ }
944
+ function rt(t, e) {
945
+ return Nt(t, e) || t.state.data !== void 0 && G(t, e, e.refetchOnMount);
946
+ }
947
+ function G(t, e, s) {
948
+ if (w(e.enabled, t) !== !1) {
949
+ const r = typeof s == "function" ? s(t) : s;
950
+ return r === "always" || r !== !1 && Z(t, e);
951
+ }
952
+ return !1;
953
+ }
954
+ function nt(t, e, s, r) {
955
+ return (t !== e || w(r.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && Z(t, s);
956
+ }
957
+ function Z(t, e) {
958
+ return w(e.enabled, t) !== !1 && t.isStaleByTime(A(e.staleTime, t));
959
+ }
960
+ function Lt(t, e) {
961
+ return !_(t.getCurrentResult(), e);
962
+ }
963
+ var yt = S.createContext(
964
+ void 0
965
+ ), vt = (t) => {
966
+ const e = S.useContext(yt);
967
+ if (t)
968
+ return t;
969
+ if (!e)
970
+ throw new Error("No QueryClient set, use QueryClientProvider to set one");
971
+ return e;
972
+ }, Fe = ({
973
+ client: t,
974
+ children: e
975
+ }) => (S.useEffect(() => (t.mount(), () => {
976
+ t.unmount();
977
+ }), [t]), /* @__PURE__ */ Ct.jsx(yt.Provider, { value: t, children: e })), gt = S.createContext(!1), Mt = () => S.useContext(gt);
978
+ gt.Provider;
979
+ function _t() {
980
+ let t = !1;
981
+ return {
982
+ clearReset: () => {
983
+ t = !1;
984
+ },
985
+ reset: () => {
986
+ t = !0;
987
+ },
988
+ isReset: () => t
989
+ };
990
+ }
991
+ var Ht = S.createContext(_t()), Kt = () => S.useContext(Ht);
992
+ function Bt(t, e) {
993
+ return typeof t == "function" ? t(...e) : !!t;
994
+ }
995
+ function it() {
996
+ }
997
+ var Gt = (t, e) => {
998
+ (t.suspense || t.throwOnError || t.experimental_prefetchInRender) && (e.isReset() || (t.retryOnMount = !1));
999
+ }, zt = (t) => {
1000
+ S.useEffect(() => {
1001
+ t.clearReset();
1002
+ }, [t]);
1003
+ }, $t = ({
1004
+ result: t,
1005
+ errorResetBoundary: e,
1006
+ throwOnError: s,
1007
+ query: r,
1008
+ suspense: n
1009
+ }) => t.isError && !e.isReset() && !t.isFetching && r && (n && t.data === void 0 || Bt(s, [t.error, r])), Vt = (t, e) => e.state.data === void 0, Jt = (t) => {
1010
+ const e = t.staleTime;
1011
+ t.suspense && (t.staleTime = typeof e == "function" ? (...s) => Math.max(e(...s), 1e3) : Math.max(e ?? 1e3, 1e3), typeof t.gcTime == "number" && (t.gcTime = Math.max(t.gcTime, 1e3)));
1012
+ }, Zt = (t, e) => t.isLoading && t.isFetching && !e, Wt = (t, e) => t?.suspense && e.isPending, at = (t, e, s) => e.fetchOptimistic(t).catch(() => {
1013
+ s.clearReset();
1014
+ });
1015
+ function mt(t, e, s) {
1016
+ if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t)))
1017
+ throw new Error(
1018
+ 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
1019
+ );
1020
+ const r = vt(s), n = Mt(), i = Kt(), o = r.defaultQueryOptions(t);
1021
+ r.getDefaultOptions().queries?._experimental_beforeQuery?.(
1022
+ o
1023
+ ), process.env.NODE_ENV !== "production" && (o.queryFn || console.error(
1024
+ `[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
1025
+ )), o._optimisticResults = n ? "isRestoring" : "optimistic", Jt(o), Gt(o, i), zt(i);
1026
+ const a = !r.getQueryCache().get(o.queryHash), [u] = S.useState(
1027
+ () => new e(
1028
+ r,
1029
+ o
1030
+ )
1031
+ ), f = u.getOptimisticResult(o), c = !n && t.subscribed !== !1;
1032
+ if (S.useSyncExternalStore(
1033
+ S.useCallback(
1034
+ (d) => {
1035
+ const l = c ? u.subscribe(J.batchCalls(d)) : it;
1036
+ return u.updateResult(), l;
1037
+ },
1038
+ [u, c]
1039
+ ),
1040
+ () => u.getCurrentResult(),
1041
+ () => u.getCurrentResult()
1042
+ ), S.useEffect(() => {
1043
+ u.setOptions(o);
1044
+ }, [o, u]), Wt(o, f))
1045
+ throw at(o, u, i);
1046
+ if ($t({
1047
+ result: f,
1048
+ errorResetBoundary: i,
1049
+ throwOnError: o.throwOnError,
1050
+ query: r.getQueryCache().get(o.queryHash),
1051
+ suspense: o.suspense
1052
+ }))
1053
+ throw f.error;
1054
+ return r.getDefaultOptions().queries?._experimental_afterQuery?.(
1055
+ o,
1056
+ f
1057
+ ), o.experimental_prefetchInRender && !C && Zt(f, n) && (a ? (
1058
+ // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
1059
+ at(o, u, i)
1060
+ ) : (
1061
+ // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
1062
+ r.getQueryCache().get(o.queryHash)?.promise
1063
+ ))?.catch(it).finally(() => {
1064
+ u.updateResult();
1065
+ }), o.notifyOnChangeProps ? f : u.trackResult(f);
1066
+ }
1067
+ function Yt(t, e) {
1068
+ return mt(t, pt, e);
1069
+ }
1070
+ function Xt(t, e) {
1071
+ return process.env.NODE_ENV !== "production" && t.queryFn === k && console.error("skipToken is not allowed for useSuspenseQuery"), mt(
1072
+ {
1073
+ ...t,
1074
+ enabled: !0,
1075
+ suspense: !0,
1076
+ throwOnError: Vt,
1077
+ placeholderData: void 0
1078
+ },
1079
+ pt,
1080
+ e
1081
+ );
1082
+ }
1083
+ const te = /^(\w+:\/\/[^/?]+)?([^?]*)(\?.*)?$/, ee = (t) => t.filter(
1084
+ (e) => e != null && e !== !1 && (typeof e == "string" || typeof e == "number")
1085
+ ).map((e) => `${e}`).filter((e) => e), se = (t) => {
1086
+ const e = t.join("/"), [, s = "", r = ""] = e.match(te) ?? [];
1087
+ return {
1088
+ prefix: s,
1089
+ pathname: r.split("/").filter((n) => n !== "")
1090
+ };
1091
+ }, re = (t) => {
1092
+ const { prefix: e, pathname: s } = t;
1093
+ let r = e;
1094
+ return s.length > 0 ? (r ? r += "/" : r = "/", r += s.join("/")) : r || (r = "/"), r;
1095
+ }, F = (...t) => {
1096
+ const e = ee(t), s = se(e);
1097
+ return re(s);
1098
+ }, bt = Object.freeze({
1099
+ API_IDENTITIES: ["api-identities"]
1100
+ }), Ie = () => {
1101
+ const t = vt();
1102
+ return {
1103
+ invalidateCache: async (e) => {
1104
+ await t.invalidateQueries({ queryKey: bt[e] });
1105
+ }
1106
+ };
1107
+ }, Pe = "no-dehydrate", W = (t, e) => {
1108
+ for (const s of t) {
1109
+ const r = Y(s, e);
1110
+ if (r !== void 0) return r;
1111
+ }
1112
+ }, Y = (t, e, s = []) => {
1113
+ const r = e(t, s);
1114
+ if (r !== void 0) return r;
1115
+ if (t.type === "category")
1116
+ for (const n of t.items) {
1117
+ const i = Y(n, e, [
1118
+ ...s,
1119
+ t
1120
+ ]);
1121
+ if (i !== void 0) return i;
1122
+ }
1123
+ }, Te = () => {
1124
+ const t = x(), { navigation: e } = St();
1125
+ return W(e, (s) => {
1126
+ if (s.type === "doc" && F(s.path) === t.pathname)
1127
+ return s;
1128
+ });
1129
+ }, De = (t) => {
1130
+ const e = x();
1131
+ return Y(t, (s) => {
1132
+ if (s.type === "category" && s.link && F(s.link.path) === e.pathname || s.type === "doc" && F(s.path) === e.pathname)
1133
+ return !0;
1134
+ });
1135
+ }, Ae = () => {
1136
+ const t = x().pathname, { navigation: e } = St();
1137
+ let s, r, n = !1;
1138
+ return W(e, (i) => {
1139
+ const o = i.type === "doc" ? F(i.path) : i.type === "category" && i.link ? F(i.link.path) : void 0;
1140
+ if (o) {
1141
+ if (n)
1142
+ return r = { label: i.label, id: o }, !0;
1143
+ t === o ? n = !0 : s = { label: i.label, id: o };
1144
+ }
1145
+ }), { prev: s, next: r };
1146
+ }, ke = Ft(
1147
+ "relative flex items-center gap-2 px-(--padding-nav-item) my-0.5 py-1.5 rounded-lg hover:bg-accent tabular-nums",
1148
+ {
1149
+ variants: {
1150
+ isActive: {
1151
+ true: "bg-accent font-medium",
1152
+ false: "text-foreground/80"
1153
+ },
1154
+ isMuted: {
1155
+ true: "text-foreground/30",
1156
+ false: ""
1157
+ },
1158
+ isPending: {
1159
+ true: "bg-accent animate-pulse",
1160
+ false: ""
1161
+ }
1162
+ },
1163
+ defaultVariants: {
1164
+ isActive: !1
1165
+ }
1166
+ }
1167
+ ), xe = (t) => (e) => e.display === "hide" || !e.label ? !1 : e.display === "auth" && t || e.display === "anon" && !t || !e.display || e.display === "always", ne = Rt(
1168
+ void 0
1169
+ ), X = () => {
1170
+ const t = Et(ne);
1171
+ if (!t)
1172
+ throw new Error("useZudoku must be used within a ZudokuProvider.");
1173
+ return t;
1174
+ }, je = () => {
1175
+ const { getApiIdentities: t } = X();
1176
+ return Yt({
1177
+ queryFn: t,
1178
+ queryKey: bt.API_IDENTITIES
1179
+ });
1180
+ }, U = (t) => {
1181
+ switch (t.type) {
1182
+ case "doc":
1183
+ return F(t.path);
1184
+ case "category":
1185
+ return t.link ? F(t.link.path) : void 0;
1186
+ case "link":
1187
+ return t.to;
1188
+ case "custom-page":
1189
+ return t.path;
1190
+ default:
1191
+ return;
1192
+ }
1193
+ }, St = () => {
1194
+ const { getPluginNavigation: t, navigation: e, options: s } = X(), r = x(), n = de(), i = s.protectedRoutes?.some(
1195
+ (c) => j(c, r.pathname)
1196
+ ), o = W(e, (c, d) => {
1197
+ if (U(c) === r.pathname)
1198
+ return d.at(0) ?? c;
1199
+ }), { data: a } = Xt({
1200
+ queryFn: () => t(r.pathname),
1201
+ queryKey: ["plugin-navigation", r.pathname]
1202
+ });
1203
+ let u = o;
1204
+ if (!o && a.length > 0) {
1205
+ const c = a.flatMap((d) => U(d)?.split("?").at(0)?.split("#").at(0) ?? []);
1206
+ u = e.flatMap((d) => {
1207
+ const l = U(d);
1208
+ return l ? [{ item: d, path: l }] : [];
1209
+ }).sort((d, l) => l.path.length - d.path.length).find(({ path: d }) => c.some(
1210
+ (l) => j({ path: d, end: !1 }, l) ?? j({ path: l, end: !1 }, d)
1211
+ ))?.item;
1212
+ }
1213
+ return {
1214
+ navigation: n.isAuthEnabled && !n.isAuthenticated && i ? [] : [...o?.type === "category" ? o.items : [], ...a],
1215
+ topNavItem: u
1216
+ };
1217
+ }, ot = (t) => {
1218
+ let e;
1219
+ const s = /* @__PURE__ */ new Set(), r = (f, c) => {
1220
+ const d = typeof f == "function" ? f(e) : f;
1221
+ if (!Object.is(d, e)) {
1222
+ const l = e;
1223
+ e = c ?? (typeof d != "object" || d === null) ? d : Object.assign({}, e, d), s.forEach((g) => g(e, l));
1224
+ }
1225
+ }, n = () => e, a = { setState: r, getState: n, getInitialState: () => u, subscribe: (f) => (s.add(f), () => s.delete(f)) }, u = e = t(r, n, a);
1226
+ return a;
1227
+ }, ie = (t) => t ? ot(t) : ot, ae = (t) => t;
1228
+ function oe(t, e = ae) {
1229
+ const s = tt.useSyncExternalStore(
1230
+ t.subscribe,
1231
+ () => e(t.getState()),
1232
+ () => e(t.getInitialState())
1233
+ );
1234
+ return tt.useDebugValue(s), s;
1235
+ }
1236
+ const ue = (t) => {
1237
+ const e = ie(t), s = (r) => oe(e, r);
1238
+ return Object.assign(s, e), s;
1239
+ }, ce = (t) => ue;
1240
+ function wt(t, e) {
1241
+ let s;
1242
+ try {
1243
+ s = t();
1244
+ } catch {
1245
+ return;
1246
+ }
1247
+ return {
1248
+ getItem: (n) => {
1249
+ var i;
1250
+ const o = (u) => u === null ? null : JSON.parse(u, void 0), a = (i = s.getItem(n)) != null ? i : null;
1251
+ return a instanceof Promise ? a.then(o) : o(a);
1252
+ },
1253
+ setItem: (n, i) => s.setItem(n, JSON.stringify(i, void 0)),
1254
+ removeItem: (n) => s.removeItem(n)
1255
+ };
1256
+ }
1257
+ const z = (t) => (e) => {
1258
+ try {
1259
+ const s = t(e);
1260
+ return s instanceof Promise ? s : {
1261
+ then(r) {
1262
+ return z(r)(s);
1263
+ },
1264
+ catch(r) {
1265
+ return this;
1266
+ }
1267
+ };
1268
+ } catch (s) {
1269
+ return {
1270
+ then(r) {
1271
+ return this;
1272
+ },
1273
+ catch(r) {
1274
+ return z(r)(s);
1275
+ }
1276
+ };
1277
+ }
1278
+ }, he = (t, e) => (s, r, n) => {
1279
+ let i = {
1280
+ storage: wt(() => localStorage),
1281
+ partialize: (h) => h,
1282
+ version: 0,
1283
+ merge: (h, m) => ({
1284
+ ...m,
1285
+ ...h
1286
+ }),
1287
+ ...e
1288
+ }, o = !1;
1289
+ const a = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
1290
+ let f = i.storage;
1291
+ if (!f)
1292
+ return t(
1293
+ (...h) => {
1294
+ console.warn(
1295
+ `[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`
1296
+ ), s(...h);
1297
+ },
1298
+ r,
1299
+ n
1300
+ );
1301
+ const c = () => {
1302
+ const h = i.partialize({ ...r() });
1303
+ return f.setItem(i.name, {
1304
+ state: h,
1305
+ version: i.version
1306
+ });
1307
+ }, d = n.setState;
1308
+ n.setState = (h, m) => {
1309
+ d(h, m), c();
1310
+ };
1311
+ const l = t(
1312
+ (...h) => {
1313
+ s(...h), c();
1314
+ },
1315
+ r,
1316
+ n
1317
+ );
1318
+ n.getInitialState = () => l;
1319
+ let g;
1320
+ const R = () => {
1321
+ var h, m;
1322
+ if (!f) return;
1323
+ o = !1, a.forEach((p) => {
1324
+ var y;
1325
+ return p((y = r()) != null ? y : l);
1326
+ });
1327
+ const v = ((m = i.onRehydrateStorage) == null ? void 0 : m.call(i, (h = r()) != null ? h : l)) || void 0;
1328
+ return z(f.getItem.bind(f))(i.name).then((p) => {
1329
+ if (p)
1330
+ if (typeof p.version == "number" && p.version !== i.version) {
1331
+ if (i.migrate) {
1332
+ const y = i.migrate(
1333
+ p.state,
1334
+ p.version
1335
+ );
1336
+ return y instanceof Promise ? y.then((E) => [!0, E]) : [!0, y];
1337
+ }
1338
+ console.error(
1339
+ "State loaded from storage couldn't be migrated since no migrate function was provided"
1340
+ );
1341
+ } else
1342
+ return [!1, p.state];
1343
+ return [!1, void 0];
1344
+ }).then((p) => {
1345
+ var y;
1346
+ const [E, I] = p;
1347
+ if (g = i.merge(
1348
+ I,
1349
+ (y = r()) != null ? y : l
1350
+ ), s(g, !0), E)
1351
+ return c();
1352
+ }).then(() => {
1353
+ v?.(g, void 0), g = r(), o = !0, u.forEach((p) => p(g));
1354
+ }).catch((p) => {
1355
+ v?.(void 0, p);
1356
+ });
1357
+ };
1358
+ return n.persist = {
1359
+ setOptions: (h) => {
1360
+ i = {
1361
+ ...i,
1362
+ ...h
1363
+ }, h.storage && (f = h.storage);
1364
+ },
1365
+ clearStorage: () => {
1366
+ f?.removeItem(i.name);
1367
+ },
1368
+ getOptions: () => i,
1369
+ rehydrate: () => R(),
1370
+ hasHydrated: () => o,
1371
+ onHydrate: (h) => (a.add(h), () => {
1372
+ a.delete(h);
1373
+ }),
1374
+ onFinishHydration: (h) => (u.add(h), () => {
1375
+ u.delete(h);
1376
+ })
1377
+ }, i.skipHydration || R(), g || l;
1378
+ }, le = he, fe = (t) => {
1379
+ const e = (s) => {
1380
+ s.key === t.persist.getOptions().name && s.newValue && t.persist.rehydrate();
1381
+ };
1382
+ return window.addEventListener("storage", e), () => {
1383
+ window.removeEventListener("storage", e);
1384
+ };
1385
+ }, Ot = ce()(
1386
+ le(
1387
+ (t) => ({
1388
+ isAuthenticated: !1,
1389
+ isPending: !0,
1390
+ profile: null,
1391
+ providerData: null,
1392
+ setAuthenticationPending: () => t(() => ({
1393
+ isAuthenticated: !1,
1394
+ isPending: !1,
1395
+ profile: null,
1396
+ providerData: null
1397
+ })),
1398
+ setLoggedOut: () => t(() => ({
1399
+ isAuthenticated: !1,
1400
+ isPending: !1,
1401
+ profile: null,
1402
+ providerData: null
1403
+ })),
1404
+ setLoggedIn: ({
1405
+ profile: e,
1406
+ providerData: s
1407
+ }) => t(() => ({
1408
+ isAuthenticated: !0,
1409
+ isPending: !1,
1410
+ profile: e,
1411
+ providerData: s
1412
+ }))
1413
+ }),
1414
+ {
1415
+ merge: (t, e) => ({
1416
+ ...e,
1417
+ isPending: !1,
1418
+ ...typeof t == "object" ? t : {}
1419
+ }),
1420
+ name: "auth-state",
1421
+ storage: wt(() => localStorage)
1422
+ }
1423
+ )
1424
+ );
1425
+ typeof window < "u" && fe(Ot);
1426
+ const de = () => {
1427
+ const { authentication: t } = X(), e = Ot(), s = typeof t < "u";
1428
+ return {
1429
+ isAuthEnabled: s,
1430
+ ...e,
1431
+ login: async () => {
1432
+ if (!s)
1433
+ throw new Error("Authentication is not enabled.");
1434
+ await t.signIn({
1435
+ redirectTo: window.location.href
1436
+ });
1437
+ },
1438
+ logout: async () => {
1439
+ if (!s)
1440
+ throw new Error("Authentication is not enabled.");
1441
+ await t.signOut(), window.location.href = "/";
1442
+ },
1443
+ signup: async () => {
1444
+ if (!s)
1445
+ throw new Error("Authentication is not enabled.");
1446
+ await t.signUp({
1447
+ redirectTo: window.location.href
1448
+ });
1449
+ }
1450
+ };
1451
+ };
1452
+ export {
1453
+ Re as A,
1454
+ ct as B,
1455
+ bt as C,
1456
+ ht as D,
1457
+ A as E,
1458
+ be as F,
1459
+ V as G,
1460
+ k as H,
1461
+ Fe as I,
1462
+ xe as J,
1463
+ St as K,
1464
+ Y as L,
1465
+ ce as M,
1466
+ Pe as N,
1467
+ le as O,
1468
+ wt as P,
1469
+ Ce as Q,
1470
+ Ut as R,
1471
+ $ as S,
1472
+ je as T,
1473
+ De as U,
1474
+ ke as V,
1475
+ ne as Z,
1476
+ Te as a,
1477
+ Ae as b,
1478
+ xt as c,
1479
+ Xt as d,
1480
+ vt as e,
1481
+ it as f,
1482
+ Bt as g,
1483
+ L as h,
1484
+ de as i,
1485
+ F as j,
1486
+ X as k,
1487
+ Yt as l,
1488
+ Ie as m,
1489
+ J as n,
1490
+ Oe as o,
1491
+ ie as p,
1492
+ oe as q,
1493
+ It as r,
1494
+ _ as s,
1495
+ W as t,
1496
+ Ot as u,
1497
+ Se as v,
1498
+ we as w,
1499
+ Q as x,
1500
+ Tt as y,
1501
+ Ee as z
1502
+ };
1503
+ //# sourceMappingURL=hook-CHXroBFt.js.map